Methods Summary |
---|
public void | addZoneAdjustment(ZoneAdjustment za)Adds an element to the zone adjustment list.
zoneAdjustments.addElement(za);
|
public java.lang.Object | clone()Copies the current instance.
ZoneField retval = new ZoneField();
retval.zoneAdjustments =
(SDPObjectList) this.zoneAdjustments.clone();
return retval;
|
public java.lang.String | encode()Encodes this structure into a canonical form.
StringBuffer retval = new StringBuffer(ZONE_FIELD);
for (int i = 0; i < zoneAdjustments.size(); i++) {
ZoneAdjustment za = (ZoneAdjustment)
zoneAdjustments.elementAt(i);
if (i > 0) retval.append(Separators.SP);
retval.append(za.encode());
}
retval.append(Separators.NEWLINE);
return retval.toString();
|
public boolean | getTypedTime()Returns whether the field will be output as a typed time or a
integer value.
Typed time is formatted as an integer followed by a unit character.
The unit indicates an appropriate multiplier for
the integer.
The following unit types are allowed.
d - days (86400 seconds)
h - hours (3600 seconds)
m - minutes (60 seconds)
s - seconds ( 1 seconds)
return false;
|
public SDPObjectList | getZoneAdjustments()Gets the zone adjustment list.
return zoneAdjustments;
|
public java.util.Hashtable | getZoneAdjustments(boolean create)Returns a Hashtable of adjustment times, where:
key = Date. This is the equivalent of the decimal NTP time value.
value = Int Adjustment. This is a relative time value in seconds.
Hashtable result = new Hashtable();
SDPObjectList zoneAdjustments = getZoneAdjustments();
ZoneAdjustment zone;
if (zoneAdjustments == null)
if (create)
return new Hashtable();
else return null;
else {
for (int i = 0; i < zoneAdjustments.size(); i++) {
zone = (ZoneAdjustment) zoneAdjustments.elementAt(i);
Long l = new Long(zone.getTime());
Integer time = new Integer((int) l.longValue());
Date date = new Date(zone.getTime());
result.put(date, time);
}
return result;
}
|
public void | setTypedTime(boolean typedTime)Sets whether the field will be output as a typed time or a integer value.
Typed time is formatted as an integer followed by a unit character.
The unit indicates an appropriate multiplier for
the integer.
The following unit types are allowed.
d - days (86400 seconds)
h - hours (3600 seconds)
m - minutes (60 seconds)
s - seconds ( 1 seconds)
// Dummy -- feature not implemented.
|
public void | setZoneAdjustments(java.util.Hashtable map)Sets the Hashtable of adjustment times, where:
key = Date. This is the equivalent of the decimal NTP time value.
value = Int Adjustment. This is a relative time value in seconds.
if (map == null)
throw new SdpException("The map is null");
else {
SDPObjectList zoneAdjustments = getZoneAdjustments();
for (Enumeration e = map.keys(); e.hasMoreElements(); ) {
Object o = e.nextElement();
if (o instanceof Date) {
Date date = (Date)o;
ZoneAdjustment zone = new ZoneAdjustment();
zone.setTime(date.getTime());
addZoneAdjustment(zone);
} else
throw new SdpException("The map is not well-formated ");
}
}
|