add interval splitting for bar charts
This commit is contained in:
25
pdb-utils/src/main/java/org/lucares/utils/EndOfInterval.java
Normal file
25
pdb-utils/src/main/java/org/lucares/utils/EndOfInterval.java
Normal file
@@ -0,0 +1,25 @@
|
||||
package org.lucares.utils;
|
||||
|
||||
import java.time.temporal.ChronoUnit;
|
||||
import java.time.temporal.Temporal;
|
||||
import java.time.temporal.TemporalAdjuster;
|
||||
|
||||
public class EndOfInterval implements TemporalAdjuster {
|
||||
|
||||
private final ChronoUnit unit;
|
||||
|
||||
public EndOfInterval(final ChronoUnit unit) {
|
||||
this.unit = unit;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Temporal adjustInto(final Temporal temporal) {
|
||||
Temporal result = temporal;
|
||||
final BeginningOfNextInterval beginningOfnextInterval = new BeginningOfNextInterval(unit);
|
||||
result = result.with(beginningOfnextInterval);
|
||||
|
||||
result = result.minus(1, ChronoUnit.NANOS);
|
||||
return result;
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user