sk.uniba.euromath.document.schema.impl.export
Class NameListImpl<R extends ISingleQNameP>

java.lang.Object
  extended by sk.uniba.euromath.document.schema.impl.export.NameListImpl<R>
Type Parameters:
R - the rule type. May be instance of IAttributeRuleP or INewElementRuleP only.
All Implemented Interfaces:
IQNameAcceptor, IForeignNodeP, INameListP<R>

public final class NameListImpl<R extends ISingleQNameP>
extends Object
implements INameListP<R>

Implementor of the NameListP interface.

Author:
Martin Vysny

Field Summary
 String namespaceURI
          The 'local' namespace.
 
Method Summary
 boolean accepts(String namespaceURI, String local)
           Check whether the acceptor accepts given pair.
 boolean acceptsNamespace(String namespaceURI)
          Checks if the namelist accepts/contains at least one qname from given namespace.
 boolean equals(Object obj)
           
 EnumSet<AcceptsEnum> getAccepts()
          Returns type of qnames, that this rule accepts.
 Map<String,R> getLocalNames()
           Returns map, that maps String to AttributeRuleP or NewElementRuleP.
 Set<String> getNamespaces()
          Tries to obtain a list of namespaces of qnames that are contained in this name list.
 String getNamespaceUri()
          Returns base namespace (the namespace of local elements).
 int hashCode()
           
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

namespaceURI

public final String namespaceURI
The 'local' namespace.

Method Detail

getLocalNames

public Map<String,R> getLocalNames()
Description copied from interface: INameListP

Returns map, that maps String to AttributeRuleP or NewElementRuleP. Each string represents one local name, and corresponding object holds rules, that can be used to create this element/attribute's content.

General rule for schema says that each rule must generate finite set of local elements (elements from schema's namespace). Thus, this list will not be infinite.

Specified by:
getLocalNames in interface INameListP<R extends ISingleQNameP>
Returns:
map of allowed localnames.

accepts

public boolean accepts(String namespaceURI,
                       String local)
Description copied from interface: IQNameAcceptor

Check whether the acceptor accepts given pair.

Specified by:
accepts in interface IQNameAcceptor
Parameters:
namespaceURI - the namespace part of the qname. Acceptor must take both empty-string and null values as a null namespace.

If the acceptor accepts the attribute qnames also, then local attributes should have null as their namespace, regardless of the value of getNamespaceUri() function.

local - the local name part.
Returns:
true if it accepts given qname, false otherwise.

getAccepts

public EnumSet<AcceptsEnum> getAccepts()
Description copied from interface: IQNameAcceptor
Returns type of qnames, that this rule accepts. If the information is not known then the function should return EnumSet with both flags.

Specified by:
getAccepts in interface IQNameAcceptor
Returns:
one of ACCEPTS_* constants.

toString

public String toString()
Overrides:
toString in class Object

getNamespaceUri

public String getNamespaceUri()
Description copied from interface: IQNameAcceptor
Returns base namespace (the namespace of local elements).

Specified by:
getNamespaceUri in interface IQNameAcceptor
Returns:
base namespace of schema, that created this object.

equals

public boolean equals(Object obj)
Overrides:
equals in class Object

hashCode

public int hashCode()
Overrides:
hashCode in class Object

acceptsNamespace

public boolean acceptsNamespace(String namespaceURI)
Description copied from interface: IForeignNodeP
Checks if the namelist accepts/contains at least one qname from given namespace.

Specified by:
acceptsNamespace in interface IForeignNodeP
Parameters:
namespaceURI - the namespace to check.
Returns:
true if the namelist accepts at least one qname with given namespace.

getNamespaces

public Set<String> getNamespaces()
Description copied from interface: IForeignNodeP
Tries to obtain a list of namespaces of qnames that are contained in this name list. If the set cannot be computed (or it would be infinite) then return null.

Specified by:
getNamespaces in interface IForeignNodeP
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.


Copyright © 2003-2006 null. All Rights Reserved.