Xindice API
version 1.1

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 Object
implements Streamable

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

Version:
$Revision: 511426 $, $Date: 2007-02-24 22:25:02 -0500 (Sat, 24 Feb 2007) $

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, String attrName)
           
IndexPattern(SymbolTable symbols, String pattern, NamespaceMap nsMap)
           
 
Method Summary
 boolean equals(Object obj)
           
 short getAttributeID()
          getAttributeID returns the Attribute Symbol ID for this pattern if there is one, otherwise it returns a negative value.
 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.
 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.
 int hashCode()
           
 void read(DataInput dis)
          read reads the object state from the stream.
 void write(DataOutput dos)
          write writes the object state to the stream.
 
Methods inherited from class java.lang.Object
clone, finalize, 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,
                    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,
                    String attrName)
Method Detail

getMatchLevel

public int getMatchLevel(IndexPattern p)
getMatchLevel compares this IndexPattern to p. It 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 String getElementName()
getElementName returns the Element Name for this pattern if there is one, otherwise it returns null.
Returns:
The Element Name

getAttributeName

public 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(DataInput dis)
          throws 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:
IOException - if an IOException occurs

write

public void write(DataOutput dos)
           throws 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:
IOException - if an IOException occurs

hashCode

public int hashCode()
Overrides:
hashCode in class Object

equals

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

Xindice API
version 1.1

Copyright (c) 1999-2007 The Apache Software Foundation. All Rights Reserved.