List of usage examples for org.joda.time Minutes toString
@ToString
public String toString()
From source file:org.kalypso.ui.rrm.internal.timeseries.view.actions.MergeTimeseriesOperation.java
License:Open Source License
private void validateTimeseries(final DateRange baseRange, final Period baseTimestep, final DateRange importRange, final Period importTimestep) throws CoreException { /* The timesteps must be equal. */ final Minutes baseMinutes = baseTimestep.toStandardMinutes(); final Minutes importMinutes = importTimestep.toStandardMinutes(); if (baseMinutes.getMinutes() != importMinutes.getMinutes()) throw new CoreException(new Status(IStatus.ERROR, KalypsoUIRRMPlugin.getID(), String.format(Messages.getString("MergeTimeseriesOperation.0"), baseTimestep.toString(), //$NON-NLS-1$ importTimestep.toString()))); /* Create the intervals. */ final Interval baseInterval = new Interval(new DateTime(baseRange.getFrom()), new DateTime(baseRange.getTo())); final Interval importInterval = new Interval(new DateTime(importRange.getFrom()), new DateTime(importRange.getTo())); /* Is the base range before the import range? */ /* Only a gap with one timestep is allowed. */ if (baseInterval.isBefore(importInterval)) { final DateTime baseEnd = baseInterval.getEnd(); final DateTime importStart = importInterval.getStart(); final Period gap = new Period(baseEnd, importStart); final Minutes gapMinutes = gap.toStandardMinutes(); if (gapMinutes.getMinutes() > 0 && baseMinutes.getMinutes() != gapMinutes.getMinutes()) throw new CoreException(new Status(IStatus.ERROR, KalypsoUIRRMPlugin.getID(), String.format(Messages.getString("MergeTimeseriesOperation.1"), baseMinutes.toString(), //$NON-NLS-1$ gapMinutes.toString()))); }//from w w w .ja va 2s. c o m /* Is the base range after the import range? */ /* Only a gap with one timestep is allowed. */ if (baseInterval.isAfter(importInterval)) { final DateTime importEnd = importInterval.getEnd(); final DateTime baseStart = baseInterval.getStart(); final Period gap = new Period(importEnd, baseStart); final Minutes gapMinutes = gap.toStandardMinutes(); if (gapMinutes.getMinutes() > 0 && baseMinutes.getMinutes() != gapMinutes.getMinutes()) throw new CoreException(new Status(IStatus.ERROR, KalypsoUIRRMPlugin.getID(), String.format(Messages.getString("MergeTimeseriesOperation.1"), baseMinutes.toString(), //$NON-NLS-1$ gapMinutes.toString()))); } /* Here the intervals touch or overlap. */ }