sk.baka.xml.schematic.msv.bca
Class NBCASet

java.lang.Object
  extended by sk.baka.xml.schematic.msv.bca.NBCASet

public final class NBCASet
extends Object

Represents a mutable normalized BCA (Base, Corrector, AddBase) set.

Author:
Martin Vysny

Constructor Summary
NBCASet()
          Constructs empty NBCA set, that doesn't contain anything.
NBCASet(BasicNcContainer nc)
          Constructs NBCA set, that contains same set of items as given nameclass.
NBCASet(NBCASet nbcaSet)
          Constructs clone of given NBCASet.
 
Method Summary
 void complement()
          Computes complement of this set.
 boolean contains(QName qname)
          Checks, whether this qname is contained in this set.
 boolean contains(String namespaceUri, String localName)
          Checks, whether this qname is contained in this set.
 boolean containsAll()
          Tests, whether this set accepts any qname.
static NBCASet create(com.sun.msv.grammar.NameClass nc)
          Creates instance of NBCASet, accepting same set of qnames as nc.
 QName getItem()
          Returns one random item from this set that this set accepts.
 Set<String> getLocalNames(String namespaceURI)
          Determines all localnames that are accepted by the set with given namespace.
 Set<String> getNamespaces()
          Obtains a list of namespaces of qnames that are contained in this name list.
 void intersect(NBCASet nbcaSet)
          Intersects this set with given set.
 boolean isEmpty()
          Tests if this set contains no qname.
 void subtract(NBCASet nbcaSet)
          Computes difference of this set and given set.
 String toString()
           
 void union(NBCASet nbcaSet)
          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

NBCASet

public NBCASet()
Constructs empty NBCA set, that doesn't contain anything.


NBCASet

public NBCASet(NBCASet nbcaSet)
Constructs clone of given NBCASet.

Parameters:
nbcaSet - the set to clone.

NBCASet

public NBCASet(BasicNcContainer nc)
Constructs NBCA set, that contains same set of items as given nameclass.

Parameters:
nc - the nameclass.
Method Detail

contains

public boolean contains(QName qname)
Checks, whether this qname is contained in this set.

Parameters:
qname - the qname to check.
Returns:
true if this set accepts/contains given qname.

contains

public boolean contains(String namespaceUri,
                        String localName)
Checks, whether this qname is contained in this set.

Parameters:
namespaceUri - namespace part of qname to check.
localName - local name part of qname to check.
Returns:
true if this set accepts/contains given qname.

containsAll

public boolean containsAll()
Tests, whether this set accepts any qname.

Returns:
true if it accepts any qname.

isEmpty

public boolean isEmpty()
Tests if this set contains no qname.

Returns:
true if this set is empty.

getItem

public QName getItem()
Returns one random item from this set that this set accepts.

Returns:
one qname for which contains returns. If the set is empty then null is returned. The prefix field may not be set.

complement

public void complement()
Computes complement of this set.


subtract

public void subtract(NBCASet nbcaSet)
Computes difference of this set and given set.

Parameters:
nbcaSet - the set.

intersect

public void intersect(NBCASet nbcaSet)
Intersects this set with given set.

Parameters:
nbcaSet - the set.

union

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

Parameters:
nbcaSet - the NBCA set.

create

public static NBCASet create(com.sun.msv.grammar.NameClass nc)
Creates instance of NBCASet, accepting same set of qnames as nc.

Parameters:
nc - any nameclass to analyze.
Returns:
a NBCASet instance.

toString

public String toString()
Overrides:
toString in class Object

getNamespaces

public Set<String> getNamespaces()
Obtains a list of namespaces of qnames that are contained in this name list. If the set is infinite then return null.

Returns:
namespaces of items contained in the namelist, or null if it cannot be computed and/or represented. null namespace is represented as an empty string.

getLocalNames

public Set<String> getLocalNames(String namespaceURI)
Determines all localnames that are accepted by the set with given namespace.

Parameters:
namespaceURI - all returned localnames are from this namespace
Returns:
set of Strings. If there is infinite number of localnames the function returns null.


Copyright © 2006 Martin Vysny - baka. All Rights Reserved.