001: /*
002: * Portions Copyright 2000-2007 Sun Microsystems, Inc. All Rights
003: * Reserved. Use is subject to license terms.
004: * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER
005: *
006: * This program is free software; you can redistribute it and/or
007: * modify it under the terms of the GNU General Public License version
008: * 2 only, as published by the Free Software Foundation.
009: *
010: * This program is distributed in the hope that it will be useful, but
011: * WITHOUT ANY WARRANTY; without even the implied warranty of
012: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
013: * General Public License version 2 for more details (a copy is
014: * included at /legal/license.txt).
015: *
016: * You should have received a copy of the GNU General Public License
017: * version 2 along with this work; if not, write to the Free Software
018: * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
019: * 02110-1301 USA
020: *
021: * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
022: * Clara, CA 95054 or visit www.sun.com if you need additional
023: * information or have any questions.
024: */
025: /*
026: */
027: package gov.nist.javax.sdp.fields;
028:
029: import gov.nist.core.*;
030:
031: /**
032: * Zone adjustment class.
033: *
034: * @version JAIN-SIP-1.1
035: *
036: *
037: *<a href="{@docRoot}/uncopyright.html">This code is in the public domain.</a>
038: *
039: */
040: public class ZoneAdjustment extends SDPObject {
041: /** The time value. */
042: protected long time;
043: /** The sign of the time zone offset. */
044: protected String sign;
045: /** The value of the time zone offset. */
046: protected TypedTime offset;
047:
048: /**
049: * Sets the time.
050: * @param t time to set.
051: */
052: public void setTime(long t) {
053: time = t;
054: }
055:
056: /**
057: * Gets the time.
058: * @return the time value
059: */
060: public long getTime() {
061: return time;
062: }
063:
064: /**
065: * Gets the offset.
066: * @return the time offset
067: */
068: public TypedTime getOffset() {
069: return offset;
070: }
071:
072: /**
073: * Sets the offset.
074: * @param off typed time offset to set.
075: */
076: public void setOffset(TypedTime off) {
077: offset = off;
078: }
079:
080: /**
081: * Sets the sign.
082: * @param s sign for the offset.
083: */
084: public void setSign(String s) {
085: sign = s;
086: }
087:
088: /**
089: * Encodes this structure into canonical form.
090: * @return encoded form of the header.
091: */
092: public String encode() {
093: String retval = new Long(time).toString();
094: retval += Separators.SP;
095: if (sign != null)
096: retval += sign;
097: retval += offset.encode();
098: return retval;
099: }
100:
101: /**
102: * Copies the current instance.
103: * @return the copy of this object
104: */
105: public Object clone() {
106: ZoneAdjustment retval = new ZoneAdjustment();
107: retval.sign = this .sign;
108: retval.offset = (TypedTime) this.offset.clone();
109: retval.time = this.time;
110: return retval;
111: }
112:
113: }
|