org.gcn.plinguacore.util
Class InmutableMultiSet<E>

java.lang.Object
  extended by org.gcn.plinguacore.util.InmutableMultiSet<E>
Type Parameters:
E -
All Implemented Interfaces:
java.io.Serializable, java.lang.Iterable<E>, java.util.Collection<E>, MultiSet<E>

public class InmutableMultiSet<E>
extends java.lang.Object
implements MultiSet<E>

An inmutable multiset. All methods that attempts to change the inner state throws NotSupportedException

Author:
Research Group on Natural Computing (http://www.gcn.us.es)
See Also:
Serialized Form

Constructor Summary
InmutableMultiSet()
           
InmutableMultiSet(MultiSet<E> multiset)
           
 
Method Summary
 boolean add(E arg0)
           
 boolean add(E object, long multiplicity)
          Add an object to the multiset
 boolean addAll(java.util.Collection<? extends E> arg0)
           
 boolean addAll(java.util.Collection<? extends E> objects, long multiplicity)
          Add several objects to the multiset
 void clear()
           
 boolean contains(java.lang.Object arg0)
           
 boolean containsAll(java.util.Collection<?> arg0)
           
 long count(java.lang.Object object)
           
 long countSubSets(java.util.Collection<?> objects)
          counts the number of subsets
 java.util.Set<E> entrySet()
          Get the set of objects without repetitions Changes in this set will affect the multiset
 boolean equals(java.lang.Object arg0)
           
 int hashCode()
           
 boolean isEmpty()
           
 java.util.Iterator<E> iterator()
           
 long longSize()
           
 boolean remove(java.lang.Object arg0)
           
 boolean remove(java.lang.Object object, long multiplicity)
          Remove several objects of the multiset
 boolean removeAll(java.util.Collection<?> arg0)
           
 boolean retainAll(java.util.Collection<?> arg0)
           
 int size()
           
 boolean subtraction(java.util.Collection<?> objects)
          Subtraction between multisets
 boolean subtraction(java.util.Collection<?> objects, long multiplicity)
          subtracts the objects in objects a number of times equal to multiplicity
 java.lang.Object[] toArray()
           
<T> T[]
toArray(T[] arg0)
           
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

InmutableMultiSet

public InmutableMultiSet()

InmutableMultiSet

public InmutableMultiSet(MultiSet<E> multiset)
Method Detail

add

public boolean add(E object,
                   long multiplicity)
Description copied from interface: MultiSet
Add an object to the multiset

Specified by:
add in interface MultiSet<E>
Returns:
True if the multiset has been changed

addAll

public boolean addAll(java.util.Collection<? extends E> objects,
                      long multiplicity)
Description copied from interface: MultiSet
Add several objects to the multiset

Specified by:
addAll in interface MultiSet<E>
Returns:
True if the multiset has been changed

longSize

public long longSize()
Specified by:
longSize in interface MultiSet<E>

count

public long count(java.lang.Object object)
Specified by:
count in interface MultiSet<E>
Returns:
The multiplicity of the object

countSubSets

public long countSubSets(java.util.Collection<?> objects)
Description copied from interface: MultiSet
counts the number of subsets

Specified by:
countSubSets in interface MultiSet<E>
Returns:
The number of subsets

entrySet

public java.util.Set<E> entrySet()
Description copied from interface: MultiSet
Get the set of objects without repetitions Changes in this set will affect the multiset

Specified by:
entrySet in interface MultiSet<E>
Returns:
A Set of objects

remove

public boolean remove(java.lang.Object object,
                      long multiplicity)
Description copied from interface: MultiSet
Remove several objects of the multiset

Specified by:
remove in interface MultiSet<E>
Returns:
True if the multiset has been changed

subtraction

public boolean subtraction(java.util.Collection<?> objects,
                           long multiplicity)
Description copied from interface: MultiSet
subtracts the objects in objects a number of times equal to multiplicity

Specified by:
subtraction in interface MultiSet<E>
Parameters:
objects - the collection of objects to be subtracted
multiplicity - the number of times the objects will be subtracted
Returns:
true if there was any subtraction

subtraction

public boolean subtraction(java.util.Collection<?> objects)
Description copied from interface: MultiSet
Subtraction between multisets

Specified by:
subtraction in interface MultiSet<E>
Parameters:
objects - a collection containing the objects to be subtracted
Returns:
true if the multiset has been changed

add

public boolean add(E arg0)
Specified by:
add in interface java.util.Collection<E>

addAll

public boolean addAll(java.util.Collection<? extends E> arg0)
Specified by:
addAll in interface java.util.Collection<E>

clear

public void clear()
Specified by:
clear in interface java.util.Collection<E>

contains

public boolean contains(java.lang.Object arg0)
Specified by:
contains in interface java.util.Collection<E>

containsAll

public boolean containsAll(java.util.Collection<?> arg0)
Specified by:
containsAll in interface java.util.Collection<E>

isEmpty

public boolean isEmpty()
Specified by:
isEmpty in interface java.util.Collection<E>

iterator

public java.util.Iterator<E> iterator()
Specified by:
iterator in interface java.lang.Iterable<E>
Specified by:
iterator in interface java.util.Collection<E>

remove

public boolean remove(java.lang.Object arg0)
Specified by:
remove in interface java.util.Collection<E>

removeAll

public boolean removeAll(java.util.Collection<?> arg0)
Specified by:
removeAll in interface java.util.Collection<E>

retainAll

public boolean retainAll(java.util.Collection<?> arg0)
Specified by:
retainAll in interface java.util.Collection<E>

size

public int size()
Specified by:
size in interface java.util.Collection<E>

toArray

public java.lang.Object[] toArray()
Specified by:
toArray in interface java.util.Collection<E>

toArray

public <T> T[] toArray(T[] arg0)
Specified by:
toArray in interface java.util.Collection<E>

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

equals

public boolean equals(java.lang.Object arg0)
Specified by:
equals in interface java.util.Collection<E>
Overrides:
equals in class java.lang.Object

hashCode

public int hashCode()
Specified by:
hashCode in interface java.util.Collection<E>
Overrides:
hashCode in class java.lang.Object