Xindice API

org.apache.xindice.core.indexer
Class IndexPattern

java.lang.Object
  |
  +--org.apache.xindice.core.indexer.IndexPattern
All Implemented Interfaces:
Streamable

public final class IndexPattern
extends java.lang.Object
implements Streamable

IndexPattern is the internal representation of a pattern for index matching purposes.


Field Summary
static int PATTERN_NAME
           
static int PATTERN_NONE
           
static int PATTERN_WILDCARD
           
static int SCORE_NAME
           
static int SCORE_NATURAL
           
static int SCORE_NONE
           
static int SCORE_WILDCARD
           
 
Constructor Summary
IndexPattern(SymbolTable symbols, short elemID)
           
IndexPattern(SymbolTable symbols, short elemID, short attrID)
           
IndexPattern(SymbolTable symbols, short elemID, java.lang.String attrName)
           
IndexPattern(SymbolTable symbols, java.lang.String pattern, NamespaceMap nsMap)
           
 
Method Summary
 boolean equals(java.lang.Object obj)
           
 short getAttributeID()
          getAttributeID returns the Attribute Symbol ID for this pattern if there is one, otherwise it returns a negative value.
 java.lang.String getAttributeName()
          getAttributeName returns the Attribute Name for this pattern if there is one, otherwise it returns null.
 short getElementID()
          getElementID returns the Element Symbol ID for this pattern if there is one, otherwise it returns a negative value.
 java.lang.String getElementName()
          getElementName returns the Element Name for this pattern if there is one, otherwise it returns null.
 int getMatchLevel(IndexPattern p)
          getMatchLevel compares this IndexPattern to p and returns the strength of the match betwen the two patterns from 0 to 15.
 int hashCode()
           
 void read(java.io.DataInputStream dis)
          read reads the object state from the stream.
 void write(java.io.DataOutputStream dos)
          write writes the object state to the stream.
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PATTERN_NONE

public static final int PATTERN_NONE

PATTERN_WILDCARD

public static final int PATTERN_WILDCARD

PATTERN_NAME

public static final int PATTERN_NAME

SCORE_NONE

public static final int SCORE_NONE

SCORE_WILDCARD

public static final int SCORE_WILDCARD

SCORE_NAME

public static final int SCORE_NAME

SCORE_NATURAL

public static final int SCORE_NATURAL
Constructor Detail

IndexPattern

public IndexPattern(SymbolTable symbols,
                    java.lang.String pattern,
                    NamespaceMap nsMap)

IndexPattern

public IndexPattern(SymbolTable symbols,
                    short elemID)

IndexPattern

public IndexPattern(SymbolTable symbols,
                    short elemID,
                    short attrID)

IndexPattern

public IndexPattern(SymbolTable symbols,
                    short elemID,
                    java.lang.String attrName)
Method Detail

getMatchLevel

public int getMatchLevel(IndexPattern p)
getMatchLevel compares this IndexPattern to p and returns the strength of the match betwen the two patterns from 0 to 15. (0 being no match at all, 15 being perfect). This method should be called by XPath and SAX patterns to be matched against Indexer patterns.
Parameters:
p - The pattern to compare
Returns:
The resulting IndexPattern strength

getElementID

public short getElementID()
getElementID returns the Element Symbol ID for this pattern if there is one, otherwise it returns a negative value.
Returns:
The Element Symbol ID

getAttributeID

public short getAttributeID()
getAttributeID returns the Attribute Symbol ID for this pattern if there is one, otherwise it returns a negative value.
Returns:
The Attribute Symbol ID

getElementName

public java.lang.String getElementName()
getElementName returns the Element Name for this pattern if there is one, otherwise it returns null.
Returns:
The Element Name

getAttributeName

public java.lang.String getAttributeName()
getAttributeName returns the Attribute Name for this pattern if there is one, otherwise it returns null.
Returns:
The Attribute Name

read

public void read(java.io.DataInputStream dis)
          throws java.io.IOException
Description copied from interface: Streamable
read reads the object state from the stream.
Specified by:
read in interface Streamable
Following copied from interface: org.apache.xindice.core.filer.Streamable
Parameters:
is - The DataInputStream
Throws:
java.io.IOException - if an IOException occurs

write

public void write(java.io.DataOutputStream dos)
           throws java.io.IOException
Description copied from interface: Streamable
write writes the object state to the stream.
Specified by:
write in interface Streamable
Following copied from interface: org.apache.xindice.core.filer.Streamable
Parameters:
os - The DataOutputStream
Throws:
java.io.IOException - if an IOException occurs

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object

equals

public boolean equals(java.lang.Object obj)
Overrides:
equals in class java.lang.Object

Xindice API

Copyright (c) 1999-2001 The Apache Software Foundation