dbXML API

## com.dbxml.db.core.indexer
Class IndexPattern

    java.lang.Object
      com.dbxml.db.core.indexer.IndexPattern

public final class IndexPattern
extends java.lang.Object

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

Field Summary
`static int` `PATTERN_NONE`
`static int` `PATTERN_WILDCARD`
`static int` `SCORE_NATURAL`
`static int` `SCORE_NONE`
`static int` `SCORE_WILDCARD`

Constructor Summary
`IndexPattern(SymbolTable symbols, int elemID)`
`IndexPattern(SymbolTable symbols, int elemID, int attrID)`
`IndexPattern(SymbolTable symbols, java.lang.String pattern, NamespaceMap nsMap)`
`IndexPattern(SymbolTable symbols, java.lang.String pattern, NamespaceMap nsMap, boolean create)`

Method Summary
`boolean` `equals(java.lang.Object obj)`
`int` `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.
`int` `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.
`int` `hashCode()`
`boolean` `isInvalid()` isInvalid returns whether or not the IndexPattern is valid.

Methods inherited from class java.lang.Object
`getClass, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### PATTERN_NONE

    public static final int PATTERN_NONE

See Also:
  Constant Field Values

### PATTERN_WILDCARD

    public static final int PATTERN_WILDCARD

See Also:
  Constant Field Values

### SCORE_NONE

    public static final int SCORE_NONE

See Also:
  Constant Field Values

### SCORE_WILDCARD

    public static final int SCORE_WILDCARD

See Also:
  Constant Field Values

### SCORE_NATURAL

    public static final int SCORE_NATURAL

See Also:
  Constant Field Values

Constructor Detail

### IndexPattern

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

### IndexPattern

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

### IndexPattern

    public IndexPattern(SymbolTable symbols,
                        int elemID)

### IndexPattern

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

Method Detail

### getMatchLevel

    public int getMatchLevel(IndexPattern p)

  getMatchLevel compares this IndexPattern to p. It then 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

### isInvalid

    public boolean isInvalid()

  isInvalid returns whether or not the IndexPattern is valid. This is determined by testing whether or not the SymbolTable lookups used when constructing the pattern yielding nil results.

  Returns:
    The IndexPattern's invalid status

### getElementID

    public int 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 int 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

### hashCode

    public int hashCode()

### equals

    public boolean equals(java.lang.Object obj)

dbXML API

Copyright (c) 2004 The dbXML Group