1/*
2* Conditions Of Use
3*
4* This software was developed by employees of the National Institute of
5* Standards and Technology (NIST), an agency of the Federal Government.
6* Pursuant to title 15 Untied States Code Section 105, works of NIST
7* employees are not subject to copyright protection in the United States
8* and are considered to be in the public domain.  As a result, a formal
9* license is not needed to use the software.
10*
11* This software is provided by NIST as a service and is expressly
12* provided "AS IS."  NIST MAKES NO WARRANTY OF ANY KIND, EXPRESS, IMPLIED
13* OR STATUTORY, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTY OF
14* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, NON-INFRINGEMENT
15* AND DATA ACCURACY.  NIST does not warrant or make any representations
16* regarding the use of the software or the results thereof, including but
17* not limited to the correctness, accuracy, reliability or usefulness of
18* the software.
19*
20* Permission to use this software is contingent upon your acceptance
21* of the terms of this agreement.
22*
23*/
24package gov.nist.javax.sip.header;
25
26import javax.sip.address.*;
27import javax.sip.header.FromHeader;
28import javax.sip.header.HeaderAddress;
29import javax.sip.header.Parameters;
30
31import gov.nist.javax.sip.address.*;
32
33/** An abstract class for headers that take an address and parameters.
34 *
35 * @version 1.2 $Revision: 1.11 $ $Date: 2009/07/17 18:57:25 $
36 *
37 * @since 1.1
38 *
39 * @author M. Ranganathan   <br/>
40 *
41 *
42 *
43 *
44 */
45public abstract class AddressParametersHeader extends ParametersHeader implements  Parameters {
46
47    protected AddressImpl address;
48
49    /* (non-Javadoc)
50     * @see gov.nist.javax.sip.header.AddressParameters#getAddress()
51     */
52    public Address getAddress() {
53        return address;
54    }
55
56    /* (non-Javadoc)
57     * @see gov.nist.javax.sip.header.AddressParameters#setAddress(javax.sip.address.Address)
58     */
59    public void setAddress(Address address) {
60        this.address = (AddressImpl) address;
61    }
62
63    /**
64     * Constructor given the name of the header.
65     */
66    protected AddressParametersHeader(String name) {
67        super(name);
68    }
69
70    /**
71     * Constructor given a synch flag.
72     *
73     * @param name
74     * @param sync
75     */
76
77    protected AddressParametersHeader(String name, boolean sync) {
78        super(name,sync);
79    }
80
81    /* (non-Javadoc)
82     * @see gov.nist.javax.sip.header.AddressParameters#clone()
83     */
84    public Object clone() {
85        AddressParametersHeader retval = (AddressParametersHeader) super.clone();
86        if (this.address != null)
87            retval.address = (AddressImpl) this.address.clone();
88        return retval;
89    }
90
91    /* (non-Javadoc)
92     * @see gov.nist.javax.sip.header.AddressParameters#equals(java.lang.Object)
93     */
94    public boolean equals(Object other) {
95        if (this==other) return true;
96
97
98
99        if (other instanceof HeaderAddress && other instanceof Parameters) {
100            final HeaderAddress o = (HeaderAddress) other;
101            return this.getAddress().equals( o.getAddress() ) && this.equalParameters( (Parameters) o );
102        }
103        return false;
104    }
105
106}
107