org.sixdml.xindice
Class xiSixdmlIndex

java.lang.Object
  |
  +--org.sixdml.xindice.xiSixdmlIndex
All Implemented Interfaces:
SixdmlConstants, SixdmlIndex

public class xiSixdmlIndex
extends Object
implements SixdmlIndex, SixdmlConstants

  
 xiSixdmlIndex.java

 A database index. 
 

Version:
1.0

Field Summary
private  HashMap indexFields
          The fields of this index.
private  String name
          The name of the index.
 
Fields inherited from interface org.sixdml.SixdmlConstants
SIXDML_NS, SIXDML_VERSION
 
Constructor Summary
private xiSixdmlIndex()
          Default constructor private because one must always create an xiSixdmlIndex with an indexFields table.
(package private) xiSixdmlIndex(String name, HashMap indexFields)
          Creates an index with a name and an indexFields table.
 
Method Summary
(package private) static xiSixdmlIndex createIndex(Element xmlNode)
          Creates a xiSixdmlIndex object from an XML serialization of the class.
 boolean equals(Object obj)
          Compares two objects of this class.
 HashMap getIndexFields()
          Returns a hash table containing various characteristics of the index depending on its type.
 String getName()
          Get the name of the index.
 SixdmlIndexType getType()
          Returns the type of the index.
 Node getXMLAsNode()
          Creates an XML representation of this object that conforms to the following DTD as a DOM node.
 String getXMLAsString()
          Creates an XML representation of this object that conforms to the following DTD as a string.
 
Methods inherited from class java.lang.Object
, clone, finalize, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait
 

Field Detail

name

private String name
The name of the index.

indexFields

private HashMap indexFields
The fields of this index.
See Also:
getIndexFields()
Constructor Detail

xiSixdmlIndex

private xiSixdmlIndex()
Default constructor private because one must always create an xiSixdmlIndex with an indexFields table.

xiSixdmlIndex

xiSixdmlIndex(String name,
              HashMap indexFields)
Creates an index with a name and an indexFields table.
NOTE: Runtime error may occur if table not properly populated.
Parameters:
name - the name of the index.
indexFields - the index fields for the class.
Method Detail

createIndex

static xiSixdmlIndex createIndex(Element xmlNode)
Creates a xiSixdmlIndex object from an XML serialization of the class.
NOTE: This code assumes that the XML node contains XML that conforms to the following DTD
 <!ELEMENT index(name, type, key, pagesize?, maxkeysize?)> 
 <!ELEMENT name (#PCDATA)> 
 <!ELEMENT type (#PCDATA)> 
 <!ELEMENT key (#PCDATA)> 
 <!ELEMENT pagesize (#PCDATA)> 
 <!ELEMENT maxkeysize (#PCDATA)> 
 
Parameters:
xmlNode - the XML representation of the object to create
Returns:
the newly created index.

getName

public String getName()
Get the name of the index.
Specified by:
getName in interface SixdmlIndex
Returns:
Value of name.

getType

public SixdmlIndexType getType()
Returns the type of the index.
Specified by:
getType in interface SixdmlIndex
Returns:
type of the index.

getIndexFields

public HashMap getIndexFields()
Returns a hash table containing various characteristics of the index depending on its type. All eXcelon DXE indexes will have an entry for "key", "indexElement", "options" and "type". Both the "options" and "type" fields will be integer values that will be one of a range of values defined as static ints in the XlnIndex, XlnTextIndex and XlnValueIndex classes.
Specified by:
getIndexFields in interface SixdmlIndex
Returns:
a hash table containing the relevant data about the index. The hashtable returned is a COPY of the one used by this class internally.

getXMLAsNode

public Node getXMLAsNode()
Creates an XML representation of this object that conforms to the following DTD as a DOM node.
 <!ELEMENT index(key, pagesize?, maxkeysize?)> 
 <!ATTLIST index name CDATA #REQUIRED >
 <!ELEMENT key (#PCDATA)> 
 <!ELEMENT pagesize (#PCDATA)> 
 <!ELEMENT maxkeysize (#PCDATA)> 
 
Returns:
a DOM Node containing the XML representation of this class.

getXMLAsString

public String getXMLAsString()
Creates an XML representation of this object that conforms to the following DTD as a string.
 <!ELEMENT index(name, type, key, pagesize?, maxkeysize?)> 
 <!ELEMENT name (#PCDATA)> 
 <!ELEMENT type (#PCDATA)> 
 <!ELEMENT key (#PCDATA)> 
 <!ELEMENT pagesize (#PCDATA)> 
 <!ELEMENT maxkeysize (#PCDATA)> 
 
Returns:
a string containing the XML representation of this class.

equals

public boolean equals(Object obj)
Compares two objects of this class. Returns true if they have the same name and same values in their index fields.
Overrides:
equals in class Object
Parameters:
obj - the object to compare.
Returns:
true if they have the same name and values in their index fields, false otherwise.