Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.hp.hpl.jena.graph.query
Class Mapping

    java.lang.Object
      com.hp.hpl.jena.graph.query.Mapping

All Implemented Interfaces:
  VariableIndexes

    public class Mapping

extends java.lang.Object
implements VariableIndexes

this class is used to record the mapping from [variable] Node's to the indexes they are bound to in a Query. Nodes bound to negative values are predeclared; the negative value is converted on index allocation.

Constructor Summary
`Mapping(Node[] preDeclare)` Create a new mapping in which all variables are unbound and the variables of `preDeclare` will be allocated the first slots in the map in their natural order.

Method Summary
`boolean` | `hasBound(Node v)` Answer true iff we have already bound v (predeclaration doesn't count)
`int` | `indexOf(Node v)` get the index of a node in the mapping; undefined if the node is not mapped.
`int` | `indexOf(java.lang.String name)` Answer the index of `name`, or throw an exception if that name is not bound in this mapping.
`int` | `lookUp(Node v)` get the index of a node in the mapping; return -1 if the node is not mapped.
`int` | `newIndex(Node v)` allocate an index to the node `v`.
`int` | `size()` Answer the number of names currently held in the map
`java.lang.String` | `toString()`

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

Constructor Detail

### Mapping

    public Mapping(Node[] preDeclare)

  Create a new mapping in which all variables are unbound and the variables of `preDeclare` will be allocated the first slots in the map in their natural order. [This is so that the query domain elements that come out of the matching process will be positioned to be suitable as query answers.]

Method Detail

### indexOf

    public int indexOf(Node v)

  get the index of a node in the mapping; undefined if the node is not mapped.

  Parameters:
    `v` - the node to look up
  Returns:
    the index of v in the mapping

### indexOf

    public int indexOf(java.lang.String name)

  Description copied from interface: `VariableIndexes`
  Answer the index of `name`, or throw an exception if that name is not bound in this mapping.

  Specified by:
    `indexOf` in interface `VariableIndexes`

### lookUp

    public int lookUp(Node v)

  get the index of a node in the mapping; return -1 if the node is not mapped.

  Parameters:
    `v` - the node to look up
  Returns:
    the index of v in the mapping

### newIndex

    public int newIndex(Node v)

  allocate an index to the node `v`. `v` must not already be mapped.

  Parameters:
    `v` - the node to be given an index
  Returns:
    the value of the allocated index

### size

    public int size()

  Answer the number of names currently held in the map

  Returns:
    the number of names in the map

### hasBound

    public boolean hasBound(Node v)

  Answer true iff we have already bound v (predeclaration doesn't count)

  Parameters:
    `v` - the node to look up
  Returns:
    true iff this mapping has seen a binding occurance of v

### toString

    public java.lang.String toString()

  Overrides:
    `toString` in class `java.lang.Object`
  Returns:
    a string representing this mapping

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 Hewlett-Packard Development Company, LP