de.unidu.is.retrieval
Class SchemaElement

java.lang.Object
  extended byde.unidu.is.retrieval.SchemaElement

public class SchemaElement
extends java.lang.Object

A schema element, having a name, corresponding to a datatype, and having a (potentially empty) list of operator names (from the list of operators supported by the corresponding datatype).

Since:
2004-04-10
Version:
$Revision: 1.8 $, $Date: 2005/03/14 17:33:13 $
Author:
Henrik Nottelmann

Field Summary
protected  java.util.List children
          The element children.
protected  java.lang.String datatypeName
          The schema element datatype.
protected  java.lang.String name
          The schema element name.
protected  java.util.List operators
          The list of operators (as strings) for this schema element.
 
Constructor Summary
SchemaElement()
          Creates a new, empty schema element.
SchemaElement(java.lang.String name)
          Creates a new schema element.
SchemaElement(java.lang.String name, java.lang.String datatypeName, java.util.List operators)
          Creates a new schema element.
 
Method Summary
 boolean add(SchemaElement element)
          Adds the specified schema element as a child.
 boolean addAll(java.util.Collection c)
          Adds all schema elements in the specified collection to the children set.
 void appendHierarchicalView(java.lang.StringBuffer buf, int depth)
          Appends a description of this schema element to the hierarchical view.
 java.util.Iterator children()
          Returns an iterator over the children.
 int childrenCount()
          Returns the number of direct children.
 void clear()
          Removes all children.
 boolean contains(SchemaElement element)
          Returns true iff the specified element is a child.
 boolean equals(java.lang.Object obj)
           
 SchemaElement get(int index)
          Returns the i-th child.
 java.lang.String getDatatypeName()
          Returns the the datatype name.
 SchemaElement getElement(java.lang.String xpath)
          Returns the schema element specified by a XPath.
 java.lang.String getName()
          Returns the name of this schema element.
 java.util.List getOperators()
          Returns the list of schema element operators.
 java.util.List getXPaths()
          Returns all XPath expressions for this schema subtree.
 int hashCode()
           
 boolean isEmpty()
          Returns true iff there is no child.
 boolean remove(SchemaElement element)
          Removes the specified schema element as a child.
 void setDatatypeName(java.lang.String datatypeName)
          Sets the datatype name.
 void setName(java.lang.String name)
          Sets the name of this schema element.
 void setOperators(java.util.List operators)
          Sets the list of schema element operators.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

name

protected java.lang.String name
The schema element name.


datatypeName

protected java.lang.String datatypeName
The schema element datatype.


operators

protected java.util.List operators
The list of operators (as strings) for this schema element.


children

protected java.util.List children
The element children.

Constructor Detail

SchemaElement

public SchemaElement()
Creates a new, empty schema element.


SchemaElement

public SchemaElement(java.lang.String name)
Creates a new schema element.

Parameters:
name - name of the schema element

SchemaElement

public SchemaElement(java.lang.String name,
                     java.lang.String datatypeName,
                     java.util.List operators)
Creates a new schema element.

Parameters:
name - name of the schema element
datatypeName - datatype of the schema element
operators - list of operators (as strings)
Method Detail

getName

public java.lang.String getName()
Returns the name of this schema element.

Returns:
name of this schema element

setName

public void setName(java.lang.String name)
Sets the name of this schema element.

Parameters:
name - name of this schema element

getDatatypeName

public java.lang.String getDatatypeName()
Returns the the datatype name.

Returns:
datatype name

setDatatypeName

public void setDatatypeName(java.lang.String datatypeName)
Sets the datatype name.

Parameters:
datatypeName - datatype name

getOperators

public java.util.List getOperators()
Returns the list of schema element operators.

Returns:
list of schema element operators (as strings)

setOperators

public void setOperators(java.util.List operators)
Sets the list of schema element operators.

Parameters:
operators - list of schema element operators (as strings)

add

public boolean add(SchemaElement element)
Adds the specified schema element as a child.

Parameters:
element - new child element

addAll

public boolean addAll(java.util.Collection c)
Adds all schema elements in the specified collection to the children set.

Parameters:
c - collection with schema elements

clear

public void clear()
Removes all children.


contains

public boolean contains(SchemaElement element)
Returns true iff the specified element is a child.

Parameters:
element - true iff the specified element is a child

get

public SchemaElement get(int index)
Returns the i-th child.

Parameters:
index - index number
Returns:
i-th element child

isEmpty

public boolean isEmpty()
Returns true iff there is no child.

Returns:
true iff there is no child

children

public java.util.Iterator children()
Returns an iterator over the children.

Returns:
iterator over children

remove

public boolean remove(SchemaElement element)
Removes the specified schema element as a child.

Parameters:
element - element to be removed

childrenCount

public int childrenCount()
Returns the number of direct children.

Returns:
number of direct children.

equals

public boolean equals(java.lang.Object obj)

hashCode

public int hashCode()

toString

public java.lang.String toString()

getXPaths

public java.util.List getXPaths()
Returns all XPath expressions for this schema subtree.

Returns:

getElement

public SchemaElement getElement(java.lang.String xpath)
Returns the schema element specified by a XPath.

Parameters:
xpath - XPath
Returns:
corresponding element or null, of not existing

appendHierarchicalView

public void appendHierarchicalView(java.lang.StringBuffer buf,
                                   int depth)
Appends a description of this schema element to the hierarchical view.

Parameters:
buf - string buffer for the hierarchical view
depth - element depth