public class Mapping extends Object implements VariableIndexes
| Constructor and Description |
|---|
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. |
| Modifier and Type | Method and Description |
|---|---|
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(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
|
String |
toString() |
public Mapping(Node[] preDeclare)
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.]public int indexOf(Node v)
v - the node to look uppublic int indexOf(String name)
VariableIndexesname, or throw an exception if that
name is not bound in this mapping.indexOf in interface VariableIndexespublic int lookUp(Node v)
v - the node to look uppublic int newIndex(Node v)
v. v
must not already be mapped.v - the node to be given an indexpublic int size()
public boolean hasBound(Node v)
v - the node to look upLicenced under the Apache License, Version 2.0