edu.upenn.cis.pdtb.util
Class ArraySet

java.lang.Object
  extended byjava.util.AbstractCollection
      extended byjava.util.AbstractSet
          extended byedu.upenn.cis.pdtb.util.ArraySet
All Implemented Interfaces:
java.util.Collection, java.util.Set, java.util.SortedSet
Direct Known Subclasses:
GornAddressList, SpanList

public class ArraySet
extends java.util.AbstractSet
implements java.util.SortedSet

Author:
nikhild

Field Summary
protected  boolean fCheckLowerBound
           
protected  boolean fCheckUpperBound
           
protected  java.util.Comparator fComparator
           
protected  java.lang.Object fLowerBound
           
protected  java.util.List fStore
           
protected  java.lang.Object fUpperBound
           
 
Constructor Summary
  ArraySet(java.util.Comparator comparator)
           
  ArraySet(java.util.Comparator comparator, int initialCapacity)
          Creates a new instance of BaseArraySet
protected ArraySet(java.util.Comparator comparator, java.util.List store, boolean checkLowerBound, java.lang.Object lowerBound, boolean checkUpperBound, java.lang.Object upperBound)
           
 
Method Summary
 boolean add(java.lang.Object o)
           
 void clear()
           
 java.util.Comparator comparator()
           
 boolean contains(java.lang.Object o)
           
protected  int findLeastUpperBound(java.lang.Object o, java.util.Comparator c)
           
 java.lang.Object first()
           
 java.lang.Object get(int index)
           
 java.util.SortedSet headSet(java.lang.Object toElement)
           
 java.util.Iterator iterator()
           
 java.lang.Object last()
           
static void main(java.lang.String[] args)
           
 boolean remove(java.lang.Object o)
           
protected  int search(java.lang.Object o, boolean addIfNotFound, java.util.Comparator c)
           
 int size()
           
 java.util.SortedSet subSet(java.lang.Object fromElement, java.lang.Object toElement)
           
 java.util.SortedSet tailSet(java.lang.Object fromElement)
           
 java.lang.String toString()
           
 
Methods inherited from class java.util.AbstractSet
equals, hashCode, removeAll
 
Methods inherited from class java.util.AbstractCollection
addAll, containsAll, isEmpty, retainAll, toArray, toArray
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.util.Set
addAll, containsAll, equals, hashCode, isEmpty, removeAll, retainAll, toArray, toArray
 

Field Detail

fStore

protected java.util.List fStore

fComparator

protected java.util.Comparator fComparator

fCheckLowerBound

protected boolean fCheckLowerBound

fLowerBound

protected java.lang.Object fLowerBound

fCheckUpperBound

protected boolean fCheckUpperBound

fUpperBound

protected java.lang.Object fUpperBound
Constructor Detail

ArraySet

public ArraySet(java.util.Comparator comparator,
                int initialCapacity)
Creates a new instance of BaseArraySet


ArraySet

public ArraySet(java.util.Comparator comparator)

ArraySet

protected ArraySet(java.util.Comparator comparator,
                   java.util.List store,
                   boolean checkLowerBound,
                   java.lang.Object lowerBound,
                   boolean checkUpperBound,
                   java.lang.Object upperBound)
Method Detail

add

public boolean add(java.lang.Object o)
Specified by:
add in interface java.util.Set

search

protected int search(java.lang.Object o,
                     boolean addIfNotFound,
                     java.util.Comparator c)

findLeastUpperBound

protected int findLeastUpperBound(java.lang.Object o,
                                  java.util.Comparator c)

contains

public boolean contains(java.lang.Object o)
Specified by:
contains in interface java.util.Set

get

public java.lang.Object get(int index)

iterator

public java.util.Iterator iterator()
Specified by:
iterator in interface java.util.Set

remove

public boolean remove(java.lang.Object o)
Specified by:
remove in interface java.util.Set

size

public int size()
Specified by:
size in interface java.util.Set

comparator

public java.util.Comparator comparator()
Specified by:
comparator in interface java.util.SortedSet

first

public java.lang.Object first()
Specified by:
first in interface java.util.SortedSet

headSet

public java.util.SortedSet headSet(java.lang.Object toElement)
Specified by:
headSet in interface java.util.SortedSet

last

public java.lang.Object last()
Specified by:
last in interface java.util.SortedSet

subSet

public java.util.SortedSet subSet(java.lang.Object fromElement,
                                  java.lang.Object toElement)
Specified by:
subSet in interface java.util.SortedSet

tailSet

public java.util.SortedSet tailSet(java.lang.Object fromElement)
Specified by:
tailSet in interface java.util.SortedSet

clear

public void clear()
Specified by:
clear in interface java.util.Set

toString

public java.lang.String toString()

main

public static void main(java.lang.String[] args)