org.apache.xmlbeans

## Class QNameSetBuilder

- java.lang.Object
- - org.apache.xmlbeans.QNameSetBuilder

All Implemented Interfaces:
  Serializable, QNameSetSpecification

    public class QNameSetBuilder
    extends Object
    implements QNameSetSpecification, Serializable

Used to build `QNameSets`.

See Also:
  Serialized Form

### Constructor Summary

Constructors
Constructor and Description
`QNameSetBuilder()` Constructs an empty QNameSetBuilder.
`QNameSetBuilder(QNameSetSpecification set)` Constructs a QNameSetBuilder whose initial contents are given by another QNameSetSpecification.
`QNameSetBuilder(Set<String> excludedURIs, Set<String> includedURIs, Set<QName> excludedQNamesInIncludedURIs, Set<QName> includedQNamesInExcludedURIs)` Constructs a QNameSetBuilder whose inital contents are given by the four sets.
`QNameSetBuilder(String str, String targetURI)` Constructs a QNameSetBuilder whose initial contents are given as a list of namespace URIs, using the same format used by wildcards in XSD files.

### Method Summary

All Methods Instance Methods Concrete Methods
`void` `add(QName qname)` Adds a single QName to this QNameSetBuilder.
`void` `addAll(QNameSetSpecification set)` Adds the contents of another QNameSet to this QNameSetBuilder.
`void` `addNamespace(String uri)` Adds an entire namespace URI of QNames to this QNameSetBuilder.
`void` `clear()` Clears this QNameSetBuilder
`boolean` `contains(QName name)` True if this ModelTransitionSet contains the given qname.
`boolean` `containsAll(QNameSetSpecification set)` True if the parameter is a subset of this set.
`Set<QName>` `excludedQNamesInIncludedURIs()` The finite set of QNames that are excluded from the set within namespaces that are otherwise included.
`Set<String>` `excludedURIs()` The finite set of namespace URIs that are almost completely excluded from the set (that is, each namespace URI that included in the set with with a finite number of QName exceptions).
`Set<QName>` `includedQNamesInExcludedURIs()` The finite set of QNames that are included in the set within namespaces that are otherwise excluded.
`Set<String>` `includedURIs()` The finite set of namespace URIs that are almost completely included in the set (that is, each namespace URI that included in the set with with a finite number of QName exceptions).
`QNameSet` `intersect(QNameSetSpecification set)` Returns a new QNameSet that is the intersection of this one and another.
`QNameSet` `inverse()` Returns a new QNameSet that is the inverse of this one.
`void` `invert()` Inverts this QNameSetBuilder.
`boolean` `isAll()` True if this ModelTransitionSet contains all QNames.
`boolean` `isDisjoint(QNameSetSpecification set)` True if the given set is disjoint from this one.
`boolean` `isEmpty()` True if this ModelTransitionSet contains no QNames.
`void` `remove(QName qname)` Removes the given qname from this QNameSetBuilder.
`void` `removeAll(QNameSetSpecification set)` Removes all contents of a given QNameSet from this QNameSetBuilder.
`void` `removeNamespace(String uri)` Removes an entire namespace URI from this QNameSetBuilder.
`void` `restrict(QNameSetSpecification set)` Restricts the contents of this QNameSetBuilder to be a subset of the given QNameSet.
`QNameSet` `toQNameSet()` Returns a `QNameSet` equivalent to the current state of this QNameSetBuilder.
`String` `toString()` Returns a string representation useful for debugging, subject to change.
`QNameSet` `union(QNameSetSpecification set)` Returns a new QNameSet that is the union of this one and another.

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

### Constructor Detail

#### QNameSetBuilder

    public QNameSetBuilder()

Constructs an empty QNameSetBuilder.

#### QNameSetBuilder

    public QNameSetBuilder(QNameSetSpecification set)

Constructs a QNameSetBuilder whose initial contents are given by another QNameSetSpecification.

Parameters:
  `set` - the QNameSetSpecification to copy

#### QNameSetBuilder

    public QNameSetBuilder(Set<String> excludedURIs,
                           Set<String> includedURIs,
                           Set<QName> excludedQNamesInIncludedURIs,
                           Set<QName> includedQNamesInExcludedURIs)

Constructs a QNameSetBuilder whose inital contents are given by the four sets. Exactly one of either excludedURIs or includedURIs must be non-null.

Parameters:
  `excludedURIs` - the finite set of namespace URI strings to exclude from the set, or null if this set is infinite
  `includedURIs` - the finite set of namespace URI strings to include in the set, or null if this set is infinite
  `excludedQNamesInIncludedURIs` - the finite set of exceptional QNames to exclude from the included namespaces
  `includedQNamesInExcludedURIs` - the finite set of exceptional QNames to include that are in the excluded namespaces

#### QNameSetBuilder

    public QNameSetBuilder(String str,
                           String targetURI)

Constructs a QNameSetBuilder whose initial contents are given as a list of namespace URIs, using the same format used by wildcards in XSD files.

Parameters:
  `str` - a wildcard namespace specification string such as "##any", "##other", "##local", "##targetNamespace", or a space-separated list of URIs.
  `targetURI` - the current targetNamespace

### Method Detail

#### contains

    public boolean contains(QName name)

True if this ModelTransitionSet contains the given qname.

Specified by:
  `contains` in interface `QNameSetSpecification`

#### isAll

    public boolean isAll()

True if this ModelTransitionSet contains all QNames.

Specified by:
  `isAll` in interface `QNameSetSpecification`

#### isEmpty

    public boolean isEmpty()

True if this ModelTransitionSet contains no QNames.

Specified by:
  `isEmpty` in interface `QNameSetSpecification`

#### intersect

    public QNameSet intersect(QNameSetSpecification set)

Returns a new QNameSet that is the intersection of this one and another.

Specified by:
  `intersect` in interface `QNameSetSpecification`

#### union

    public QNameSet union(QNameSetSpecification set)

Returns a new QNameSet that is the union of this one and another.

Specified by:
  `union` in interface `QNameSetSpecification`

#### inverse

    public QNameSet inverse()

Returns a new QNameSet that is the inverse of this one.

Specified by:
  `inverse` in interface `QNameSetSpecification`

#### containsAll

    public boolean containsAll(QNameSetSpecification set)

True if the parameter is a subset of this set.

Specified by:
  `containsAll` in interface `QNameSetSpecification`

#### isDisjoint

    public boolean isDisjoint(QNameSetSpecification set)

True if the given set is disjoint from this one.

Specified by:
  `isDisjoint` in interface `QNameSetSpecification`

#### clear

    public void clear()

Clears this QNameSetBuilder

#### invert

    public void invert()

Inverts this QNameSetBuilder.

#### add

    public void add(QName qname)

Adds a single QName to this QNameSetBuilder.

#### addNamespace

    public void addNamespace(String uri)

Adds an entire namespace URI of QNames to this QNameSetBuilder. The empty string is used to signify the (local) no-namespace.

#### addAll

    public void addAll(QNameSetSpecification set)

Adds the contents of another QNameSet to this QNameSetBuilder.

#### remove

    public void remove(QName qname)

Removes the given qname from this QNameSetBuilder.

#### removeNamespace

    public void removeNamespace(String uri)

Removes an entire namespace URI from this QNameSetBuilder.

#### removeAll

    public void removeAll(QNameSetSpecification set)

Removes all contents of a given QNameSet from this QNameSetBuilder.

#### restrict

    public void restrict(QNameSetSpecification set)

Restricts the contents of this QNameSetBuilder to be a subset of the given QNameSet. In other words, computes an intersection.

#### excludedURIs

    public Set<String> excludedURIs()

Description copied from interface: `QNameSetSpecification`
The finite set of namespace URIs that are almost completely excluded from the set (that is, each namespace URI that included in the set with with a finite number of QName exceptions). Null if the set of namespaceURIs that are almost completely included is infinite.

Null (meaning almost all URIs excluded) if includedURIs() is non-null; non-null otherwise.

The same set as inverse().includedURIs().

Specified by:
  `excludedURIs` in interface `QNameSetSpecification`

#### includedURIs

    public Set<String> includedURIs()

Description copied from interface: `QNameSetSpecification`
The finite set of namespace URIs that are almost completely included in the set (that is, each namespace URI that included in the set with with a finite number of QName exceptions). Null if the set of namespaceURIs that are almost completely included is infinite.

Null (meaning almost all URIs included) if excludedURIs() is non-null; non-null otherwise.

The same as inverse.excludedURIs().

Specified by:
  `includedURIs` in interface `QNameSetSpecification`

#### excludedQNamesInIncludedURIs

    public Set<QName> excludedQNamesInIncludedURIs()

Description copied from interface: `QNameSetSpecification`
The finite set of QNames that are excluded from the set within namespaces that are otherwise included. Should only contain QNames within namespace that are within the set includedURIs() (or any URI, if includedURIs() is null, which means that all URIs are almost completely included).

Never null.

The same set as inverse().includedQNames().

Specified by:
  `excludedQNamesInIncludedURIs` in interface `QNameSetSpecification`

#### includedQNamesInExcludedURIs

    public Set<QName> includedQNamesInExcludedURIs()

Description copied from interface: `QNameSetSpecification`
The finite set of QNames that are included in the set within namespaces that are otherwise excluded. Should only contain QNames within namespace that are within the set excludedURIs() (or any URI, if excludedURIs() is null, which means that all URIs are almost completely excluded).

Never null.

The same as inverse().excludedQNames().

Specified by:
  `includedQNamesInExcludedURIs` in interface `QNameSetSpecification`

#### toString

    public String toString()

Returns a string representation useful for debugging, subject to change.

Overrides:
  `toString` in class `Object`

#### toQNameSet

    public QNameSet toQNameSet()

Returns a `QNameSet` equivalent to the current state of this QNameSetBuilder.