} else if (data instanceof TemporalRange) {
return toSet((TemporalRange) data);
} else if (data instanceof TemporalConstraints) {
return (TemporalConstraints) data;
} else if (data instanceof Period) {
final Position beginPosition = ((Period) data).getBeginning()
.getPosition();
final Position endPosition = ((Period) data).getEnding()
.getPosition();
Date s = TemporalRange.START_TIME, e = TemporalRange.START_TIME;
if (beginPosition.getDate() != null)
s = beginPosition.getDate();
else if (beginPosition.getTime() != null)
s = beginPosition.getTime();
if (endPosition.getDate() != null)
e = endPosition.getDate();
else if (endPosition.getTime() != null)
e = endPosition.getTime();
return toSet(new TemporalRange(s, e));
} else if (data instanceof Instant) {
final Position beginPosition = ((Instant) data).getPosition();
Date s = TemporalRange.START_TIME;
if (beginPosition.getDate() != null)
s = beginPosition.getDate();
else if (beginPosition.getTime() != null)
s = beginPosition.getTime();
return toSet(new TemporalRange(s, s));
}
throw new ClassCastException("Could not cast data to TemporalRange");
}