sk.uniba.euromath.document.schema.impl.bca
Class NCSet

java.lang.Object
  extended by sk.uniba.euromath.document.schema.impl.bca.NCSet
All Implemented Interfaces:
Iterable<BasicNcContainer>

public final class NCSet
extends Object
implements Iterable<BasicNcContainer>

Represents mutable set of NameClass instances. Qnames set is computed by unification of qnames sets of each nameclass. For each nameclass pair from this set, one nameclass is not subset of another nameclass. Therefore, if ncs contains *:*, then it must be the only one nameclass it contains.

Author:
Martin Vysny

Constructor Summary
NCSet()
          Creates an empty set, that accepts nothing.
NCSet(BasicNcContainer nc)
          Creates set, that accepts same set as nc do.
NCSet(NCSet ncSet)
          Creates set, that accepts same set as ncSet do.
 
Method Summary
 void clear()
          Clears this set.
 boolean contains(BasicNcContainer nameclass)
          Returns true if qname set, generated by given nameclass, is subset of qname set generated by this set.
 boolean contains(QName qname)
          Returns true if given qname is accepted by this set.
 boolean contains(String namespaceUri, String localName)
          Returns true if given qname is accepted by this set.
 boolean containsAll()
          Checks, whether this set accepts anything.
 boolean containsLocalNC(String local)
          Returns true if qname set, generated by local nameclass, is subset of qname set generated by this set.
 boolean containsNamespaceNC(String namespaceURI)
          Returns true if qname set, generated by namespace nameclass, is subset of qname set generated by this set.
 Set<BasicNcContainer> getSameNcs(NCSet set)
          Returns set of nameclasses, that are both in this set and given set.
 void intersect(BasicNcContainer nc)
          Computes intersection of this set and given nameclass.
 void intersect(NCSet ncSet)
          Computes intersection of this set and given set.
 boolean isEmpty()
          Checks, whether this set accepts no qnames.
 Iterator<BasicNcContainer> iterator()
          Returns iterator, that iterates over BasicNcContainer objects.
 void removeNcs(NCSet set)
          Removes all rules, that are both in this set and given set.
 void removeNcs(Set set)
          Removes all rules, that are both in this set and given set.
 int size()
          Returns the size of the set.
 String toString()
           
 void union(BasicNcContainer nc)
          Computes union of this set and given nameclass.
 void union(NCSet set)
          Computes union of this set and given set.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

NCSet

public NCSet()
Creates an empty set, that accepts nothing.


NCSet

public NCSet(BasicNcContainer nc)
Creates set, that accepts same set as nc do.

Parameters:
nc - nameclass.

NCSet

public NCSet(NCSet ncSet)
Creates set, that accepts same set as ncSet do.

Parameters:
ncSet - nameclass set.
Method Detail

contains

public boolean contains(QName qname)
Returns true if given qname is accepted by this set.

Parameters:
qname - qname to check.
Returns:
true if at least one nameclass accepts this qname.

contains

public boolean contains(String namespaceUri,
                        String localName)
Returns true if given qname is accepted by this set.

Parameters:
namespaceUri - namespace part of qname to check.
localName - local name part of qname to check.
Returns:
true if at least one nameclass accepts this qname.

contains

public boolean contains(BasicNcContainer nameclass)
Returns true if qname set, generated by given nameclass, is subset of qname set generated by this set.

Parameters:
nameclass - nameclass to check.
Returns:
true if all qnames, that belong to nameclass, belongs also to this set.

containsNamespaceNC

public boolean containsNamespaceNC(String namespaceURI)
Returns true if qname set, generated by namespace nameclass, is subset of qname set generated by this set.

Parameters:
namespaceURI - the namespace of the nameclass
Returns:
true if all qnames, that belong to nameclass, belongs also to this set.

containsLocalNC

public boolean containsLocalNC(String local)
Returns true if qname set, generated by local nameclass, is subset of qname set generated by this set.

Parameters:
local - the local name of the qnames.
Returns:
true if all qnames, that belong to nameclass, belongs also to this set.

containsAll

public boolean containsAll()
Checks, whether this set accepts anything. If that's true, then ncs must contain only one BasicNcContainer, the BasicNcContainer.BASIC_NC_ALL nameclass.

Returns:
true if this set accepts anything.

isEmpty

public boolean isEmpty()
Checks, whether this set accepts no qnames. If that's true, then ncs set must be empty.

Returns:
true if this set is empty.

union

public void union(NCSet set)
Computes union of this set and given set.

Parameters:
set - the set.

union

public void union(BasicNcContainer nc)
Computes union of this set and given nameclass.

Parameters:
nc - the nameclass.

intersect

public void intersect(BasicNcContainer nc)
Computes intersection of this set and given nameclass.

Parameters:
nc - the nameclass.

intersect

public void intersect(NCSet ncSet)
Computes intersection of this set and given set.

Parameters:
ncSet - the nameclass set.

clear

public void clear()
Clears this set.


iterator

public Iterator<BasicNcContainer> iterator()
Returns iterator, that iterates over BasicNcContainer objects.

Specified by:
iterator in interface Iterable<BasicNcContainer>
Returns:
iterator of nameclasses.

getSameNcs

public Set<BasicNcContainer> getSameNcs(NCSet set)
Returns set of nameclasses, that are both in this set and given set. Please note that this is not a valid intersection.

Parameters:
set - the set.
Returns:
set of nameclasses, contained both in this set and given set.

removeNcs

public void removeNcs(Set set)
Removes all rules, that are both in this set and given set. Please note that this is not a valid set subtraction.

Parameters:
set - the set.

removeNcs

public void removeNcs(NCSet set)
Removes all rules, that are both in this set and given set. Please note that this is not a valid set subtraction.

Parameters:
set - the set.

toString

public String toString()
Overrides:
toString in class Object

size

public int size()
Returns the size of the set.

Returns:
the number of items.


Copyright © 2003-2006 null. All Rights Reserved.