| 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 |
* . |
| 24 |
* |
| 25 |
*/ |
| 26 |
/******************************************************************************* |
| 27 |
* Product of NIST/ITL Advanced Networking Technologies Division (ANTD). * |
| 28 |
*******************************************************************************/ |
| 29 |
package gov.nist.javax.sip.header; |
| 30 |
|
| 31 |
import javax.sip.header.*; |
| 32 |
import java.util.*; |
| 33 |
|
| 34 |
/** |
| 35 |
* A list of Route Headers. |
| 36 |
* |
| 37 |
* @version 1.2 $Revision: 1.8 $ $Date: 2009/07/17 18:57:36 $ |
| 38 |
* |
| 39 |
* @author M. Ranganathan <br/> |
| 40 |
* |
| 41 |
* |
| 42 |
* |
| 43 |
*/ |
| 44 |
public class RouteList extends SIPHeaderList<Route> { |
| 45 |
|
| 46 |
private static final long serialVersionUID = 3407603519354809748L; |
| 47 |
|
| 48 |
|
| 49 |
/** default constructor |
| 50 |
*/ |
| 51 |
public RouteList() { |
| 52 |
super(Route.class, RouteHeader.NAME); |
| 53 |
|
| 54 |
} |
| 55 |
|
| 56 |
public Object clone() { |
| 57 |
RouteList retval = new RouteList(); |
| 58 |
retval.clonehlist(this.hlist); |
| 59 |
return retval; |
| 60 |
} |
| 61 |
|
| 62 |
public String encode() { |
| 63 |
if ( super.hlist.isEmpty()) return ""; |
| 64 |
else return super.encode(); |
| 65 |
} |
| 66 |
|
| 67 |
|
| 68 |
/** |
| 69 |
* Order is important when comparing route lists. |
| 70 |
*/ |
| 71 |
public boolean equals(Object other) { |
| 72 |
if (!(other instanceof RouteList)) |
| 73 |
return false; |
| 74 |
RouteList that = (RouteList) other; |
| 75 |
if (this.size() != that.size()) |
| 76 |
return false; |
| 77 |
ListIterator<Route> it = this.listIterator(); |
| 78 |
ListIterator<Route> it1 = that.listIterator(); |
| 79 |
while (it.hasNext()) { |
| 80 |
Route route = (Route) it.next(); |
| 81 |
Route route1 = (Route) it1.next(); |
| 82 |
if (!route.equals(route1)) |
| 83 |
return false; |
| 84 |
} |
| 85 |
return true; |
| 86 |
} |
| 87 |
|
| 88 |
|
| 89 |
} |