public class URLset extends Object
Title: CASA Agent Infrastructure
Description:
Copyright: Copyright 2003-2014, Knowledge Science Group, University of Calgary. Permission to use, copy, modify, distribute and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The Knowledge Science Group makes no representations about the suitability of this software for any purpose. It is provided "as is" without express or implied warranty.
Company: Knowledge Science Group, University of Calgary
Modifier and Type | Field and Description |
---|---|
(package private) boolean |
marked |
(package private) TreeSet |
s |
Constructor and Description |
---|
URLset() |
Modifier and Type | Method and Description |
---|---|
boolean |
add(URLDescriptor o)
Adds the specified element to this set if it is not already present
(optional operation).
|
void |
clear()
Removes all of the elements from this set (optional operation).
|
boolean |
contains(URLDescriptor o)
Returns true if this set contains the specified element.
|
boolean |
equals(Object o)
Compares the specified object with this set for equality.
|
URLDescriptor |
getUniqueElement() |
int |
hashCode()
Returns the hash code value for this set.
|
boolean |
isEmpty()
Returns true if this set contains no elements.
|
Iterator |
iterator()
Returns an iterator over the elements in this set.
|
boolean |
marked() |
boolean |
remove(URLDescriptor o)
Removes the specified element from this set if it is present (optional
operation).
|
boolean |
setMarked(boolean v) |
int |
size()
Returns the number of elements in this set (its cardinality).
|
URLDescriptor[] |
toArray()
Returns an array containing all of the elements in this set.
|
TreeSet s
boolean marked
public boolean setMarked(boolean v)
v
- public boolean marked()
public URLDescriptor getUniqueElement()
public int size()
public boolean isEmpty()
public boolean contains(URLDescriptor o)
e
such that (o==null ? e==null :
o.equals(e))
.o
- element whose presence in this set is to be tested.ClassCastException
- if the type of the specified element
is incompatible with this set (optional).NullPointerException
- if the specified element is null and this
set does not support null elements (optional).public Iterator iterator()
public URLDescriptor[] toArray()
public boolean add(URLDescriptor o)
o
, to this set if this set contains no element
e
such that (o==null ? e==null :
o.equals(e))
. If this set already contains the specified
element, the call leaves this set unchanged and returns false.
In combination with the restriction on constructors, this ensures that
sets never contain duplicate elements.The stipulation above does not imply that sets must accept all elements; sets may refuse to add any particular element, including null, and throwing an exception, as described in the specification for Collection.add. Individual set implementations should clearly document any restrictions on the the elements that they may contain.
o
- element to be added to this set.UnsupportedOperationException
- if the add method is not
supported by this set.ClassCastException
- if the class of the specified element
prevents it from being added to this set.NullPointerException
- if the specified element is null and this
set does not support null elements.IllegalArgumentException
- if some aspect of the specified element
prevents it from being added to this set.public boolean remove(URLDescriptor o)
e
such that
(o==null ? e==null : o.equals(e))
, if the set contains
such an element. Returns true if the set contained the
specified element (or equivalently, if the set changed as a result of
the call). (The set will not contain the specified element once the
call returns.)o
- object to be removed from this set, if present.ClassCastException
- if the type of the specified element
is incompatible with this set (optional).NullPointerException
- if the specified element is null and this
set does not support null elements (optional).UnsupportedOperationException
- if the remove method is
not supported by this set.public void clear()
UnsupportedOperationException
- if the clear method
is not supported by this set.public boolean equals(Object o)
public int hashCode()
s1.equals(s2)
implies that
s1.hashCode()==s2.hashCode()
for any two sets
s1
and s2
, as required by the general
contract of the Object.hashCode method.hashCode
in class Object
Object.hashCode()
,
Object.equals(Object)
,
Set.equals(Object)