uk.ac.ucl.cs.emofocl.jmi.reflect.extended
Class Bag

java.lang.Object
  extended by uk.ac.ucl.cs.emofocl.jmi.reflect.extended.OCLCollection
      extended by uk.ac.ucl.cs.emofocl.jmi.reflect.extended.Bag
All Implemented Interfaces:
Iterable, Collection

public class Bag
extends OCLCollection
implements Collection

TODO: Rewrite to use HashSet as underlying container.

Author:
James

Constructor Summary
Bag(CollectionType type, int lower, int upper)
           
Bag(Type elementType)
           
 
Method Summary
 boolean add(Object o)
           
 boolean addAll(Collection collection)
           
 void clear()
           
 boolean contains(Object o)
           
 boolean containsAll(Collection arg0)
           
 boolean equals(Object other)
          Equal if all contents are equal and present in identical quantities.
 boolean extEquals(Object other)
           
 int extHashValue()
           
 boolean isEmpty()
           
 Iterator iterator()
           
protected static void quickSort(int[] unsorted)
           
protected static void quickSort(int[] unsorted, int l, int h, int[] lower, int[] higher)
           
 boolean remove(Object o)
           
 boolean removeAll(Collection collection)
           
 boolean retainAll(Collection collection)
           
 int size()
           
 Object[] toArray()
           
 Object[] toArray(Object[] arg0)
           
 String toString()
           
 
Methods inherited from class uk.ac.ucl.cs.emofocl.jmi.reflect.extended.OCLCollection
extElementEquals, extElementHashValue, getType, refVerifyConstraints
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.util.Collection
hashCode
 

Constructor Detail

Bag

public Bag(CollectionType type,
           int lower,
           int upper)

Bag

public Bag(Type elementType)
Method Detail

size

public int size()
Specified by:
size in interface Collection
Specified by:
size in class OCLCollection

isEmpty

public boolean isEmpty()
Specified by:
isEmpty in interface Collection

contains

public boolean contains(Object o)
Specified by:
contains in interface Collection

iterator

public Iterator iterator()
Specified by:
iterator in interface Iterable
Specified by:
iterator in interface Collection
Specified by:
iterator in class OCLCollection

toArray

public Object[] toArray()
Specified by:
toArray in interface Collection

toArray

public Object[] toArray(Object[] arg0)
Specified by:
toArray in interface Collection

add

public boolean add(Object o)
Specified by:
add in interface Collection
Overrides:
add in class OCLCollection

remove

public boolean remove(Object o)
Specified by:
remove in interface Collection
Overrides:
remove in class OCLCollection

containsAll

public boolean containsAll(Collection arg0)
Specified by:
containsAll in interface Collection

addAll

public boolean addAll(Collection collection)
Specified by:
addAll in interface Collection

removeAll

public boolean removeAll(Collection collection)
Specified by:
removeAll in interface Collection

retainAll

public boolean retainAll(Collection collection)
Specified by:
retainAll in interface Collection

clear

public void clear()
Specified by:
clear in interface Collection

quickSort

protected static void quickSort(int[] unsorted)

quickSort

protected static void quickSort(int[] unsorted,
                                int l,
                                int h,
                                int[] lower,
                                int[] higher)

extHashValue

public int extHashValue()
Specified by:
extHashValue in class OCLCollection

extEquals

public boolean extEquals(Object other)
Specified by:
extEquals in class OCLCollection

equals

public boolean equals(Object other)
Equal if all contents are equal and present in identical quantities.

Specified by:
equals in interface Collection
Overrides:
equals in class Object

toString

public String toString()
Overrides:
toString in class Object