edu.mit.jmwe.index
Class MWEDescSet

java.lang.Object
  extended by java.util.AbstractCollection<E>
      extended by edu.mit.jmwe.util.CompositeCollection<IMWEDesc>
          extended by edu.mit.jmwe.index.MWEDescSet
All Implemented Interfaces:
IMWEDescSet, Iterable<IMWEDesc>, Collection<IMWEDesc>, Set<IMWEDesc>

public class MWEDescSet
extends CompositeCollection<IMWEDesc>
implements IMWEDescSet

Default implementation of the IMWEDescSet interface.

Since:
jMWE 1.0.0
Version:
$Id: MWEDescSet.java 616 2011-05-07 01:00:47Z markaf $
Author:
M.A. Finlayson

Nested Class Summary
 
Nested classes/interfaces inherited from class edu.mit.jmwe.util.CompositeCollection
CompositeCollection.CompositeCollectionItr
 
Field Summary
 
Fields inherited from class edu.mit.jmwe.util.CompositeCollection
subsets
 
Constructor Summary
MWEDescSet()
          Creates a new empty, mutable MWE desc set.
MWEDescSet(Set<IRootMWEDesc> rootDescs, Set<IInfMWEDesc> infDescs)
          Creates a new mutable MWE desc set that contains the specified elements
 
Method Summary
 boolean add(IMWEDesc o)
           
static IMWEDescSet emptySet()
          Returns an unmodifiable empty description set.
 Set<IInfMWEDesc> getInflectedMWEDescs()
          Returns the set of inflected MWE desc objects contained herein.
 Set<IRootMWEDesc> getRootMWEDescs()
          Returns the set of root MWE desc objects contained herein.
 void makeUnmodifiable()
          Makes this set unmodifiable.
static
<E extends IMWEDesc>
Set<E>
makeUnmodifiable(Set<E> set)
          Returns an unmodifiable view of the given set.
 boolean remove(Object o)
           
 boolean removeAll(Collection<?> c)
           
static
<E extends IMWEDesc>
Set<E>
replaceNull(Set<E> set)
          If the given set is null, returns the empty set.
 
Methods inherited from class edu.mit.jmwe.util.CompositeCollection
iterator, size
 
Methods inherited from class java.util.AbstractCollection
addAll, clear, contains, containsAll, isEmpty, retainAll, toArray, toArray, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.util.Set
addAll, clear, contains, containsAll, equals, hashCode, isEmpty, iterator, retainAll, size, toArray, toArray
 

Constructor Detail

MWEDescSet

public MWEDescSet()
Creates a new empty, mutable MWE desc set.

Since:
jMWE 1.0.0

MWEDescSet

public MWEDescSet(Set<IRootMWEDesc> rootDescs,
                  Set<IInfMWEDesc> infDescs)
Creates a new mutable MWE desc set that contains the specified elements

Parameters:
rootDescs - the root descs to be included in the set; may be null
infDescs - the inflected descs to be included in the set; may be null
Since:
jMWE 1.0.0
Method Detail

getRootMWEDescs

public Set<IRootMWEDesc> getRootMWEDescs()
Description copied from interface: IMWEDescSet
Returns the set of root MWE desc objects contained herein.

Specified by:
getRootMWEDescs in interface IMWEDescSet
Returns:
the set of root MWE desc objects contained herein

getInflectedMWEDescs

public Set<IInfMWEDesc> getInflectedMWEDescs()
Description copied from interface: IMWEDescSet
Returns the set of inflected MWE desc objects contained herein.

Specified by:
getInflectedMWEDescs in interface IMWEDescSet
Returns:
the set of inflected MWE desc objects contained herein

add

public boolean add(IMWEDesc o)
Specified by:
add in interface Collection<IMWEDesc>
Specified by:
add in interface Set<IMWEDesc>
Overrides:
add in class AbstractCollection<IMWEDesc>

remove

public boolean remove(Object o)
Specified by:
remove in interface Collection<IMWEDesc>
Specified by:
remove in interface Set<IMWEDesc>
Overrides:
remove in class AbstractCollection<IMWEDesc>

removeAll

public boolean removeAll(Collection<?> c)
Specified by:
removeAll in interface Collection<IMWEDesc>
Specified by:
removeAll in interface Set<IMWEDesc>
Overrides:
removeAll in class AbstractCollection<IMWEDesc>

makeUnmodifiable

public void makeUnmodifiable()
Description copied from interface: IMWEDescSet
Makes this set unmodifiable. After this method has been called, attempted changes to the set will cause an UnsupportedOperationException.

Specified by:
makeUnmodifiable in interface IMWEDescSet

emptySet

public static IMWEDescSet emptySet()
Returns an unmodifiable empty description set. If the static field is null, initializes it so that subsequent calls to this method return the static instance.

Returns:
an unmodifiable empty description set.
Since:
jMWE 1.0.0

makeUnmodifiable

public static <E extends IMWEDesc> Set<E> makeUnmodifiable(Set<E> set)
Returns an unmodifiable view of the given set.

Parameters:
set - the set to be made unmodifiable
Returns:
an unmodifiable view of the given set.
Since:
jMWE 1.0.0

replaceNull

public static <E extends IMWEDesc> Set<E> replaceNull(Set<E> set)
If the given set is null, returns the empty set. Otherwise, returns the set itself.

Type Parameters:
E - the elements in the set
Parameters:
set - the set
Returns:
If the given set is null, returns the empty set. Otherwise, returns the set itself.
Since:
jMWE 1.0.0


Copyright © 2011 Massachusetts Institute of Technology. All Rights Reserved.