addTimeInterval(dateFrom, dateTo, false, false);
}
public void addTimeInterval(String dateFrom, String dateTo, boolean startOpen, boolean endOpen) throws IllegalArgumentException {
if (timeInterval == null) {
timeInterval = new TimeInterval();
}
Double start = null;
Double end = null;
if (dateFrom != null && !dateFrom.isEmpty()) {
try {
if (container.getTimeFormat().equals(TimeFormat.DATE) ||
container.getTimeFormat().equals(TimeFormat.DATETIME)) {
start = DynamicUtilities.getDoubleFromXMLDateString(dateFrom);
} else {
start = Double.parseDouble(dateFrom);
}
} catch (Exception ex) {
throw new IllegalArgumentException(NbBundle.getMessage(NodeDraftImpl.class, "ImportContainerException_TimeInterval_ParseError", dateFrom));
}
}
if (dateTo != null && !dateTo.isEmpty()) {
try {
if (container.getTimeFormat().equals(TimeFormat.DATE) ||
container.getTimeFormat().equals(TimeFormat.DATETIME)) {
end = DynamicUtilities.getDoubleFromXMLDateString(dateTo);
} else {
end = Double.parseDouble(dateTo);
}
} catch (Exception ex) {
throw new IllegalArgumentException(NbBundle.getMessage(NodeDraftImpl.class, "ImportContainerException_TimeInterval_ParseError", dateTo));
}
}
if (start == null && end == null) {
throw new IllegalArgumentException(NbBundle.getMessage(EdgeDraftImpl.class, "ImportContainerException_TimeInterval_Empty"));
}
timeInterval = new TimeInterval(timeInterval, start != null ? start : Double.NEGATIVE_INFINITY, end != null ? end : Double.POSITIVE_INFINITY, startOpen, endOpen);
}