public Period(Temporal temporal, Instant startInstant, Instant finishInstant) throws TemporalException { int granularity; this.startInstant = new Instant(temporal, startInstant); this.finishInstant = new Instant(temporal, finishInstant); // Set granularity to finest of both. if (startInstant.getGranularity() > finishInstant.getGranularity()) granularity = startInstant.getGranularity(); else granularity = finishInstant.getGranularity(); this.startInstant.setGranularity(granularity); this.finishInstant.setGranularity(granularity); orderCheck(); } // Period
public int getGranularity() { return startInstant.getGranularity(); // start and finish instant have same granularity. } // getGranularity
public Period(Temporal temporal, Instant instant) throws TemporalException { this(temporal, instant, instant, instant.getGranularity()); } // Period
public void setFinishInstant(Instant instant) throws TemporalException { finishInstant = new Instant(temporal, instant); // Both instants must share same granularity. startInstant.setGranularity(instant.getGranularity()); } /// setFinishInstant