xtc.type
Class IndexReference

java.lang.Object
  extended by xtc.type.Reference
      extended by xtc.type.RelativeReference
          extended by xtc.type.IndexReference

public class IndexReference
extends RelativeReference

Representation of an index reference.

Version:
$Revision: 1.8 $
Author:
Robert Grimm

Field Summary
 
Fields inherited from class xtc.type.RelativeReference
base
 
Fields inherited from class xtc.type.Reference
type
 
Constructor Summary
IndexReference(Reference base, java.math.BigInteger index)
          Create a new index reference.
 
Method Summary
 Reference add(java.math.BigInteger val)
          Add the specified value to this reference.
 boolean equals(java.lang.Object o)
           
 java.math.BigInteger getIndex()
          Get this reference's index.
 java.math.BigInteger getLocation(C ops)
          Get this reference's absolute memory location.
 int hashCode()
           
 boolean hasIndex()
          Determine whether this reference has an index.
 boolean hasLocation()
          Determine whether this reference has an absolute memory location.
 boolean isNull()
          Determine whether this reference is a null reference.
 Reference subtract(java.math.BigInteger val)
          Subtract the specified value from this reference.
 void write(java.lang.Appendable out)
          Write a human readable representation to the specified appendable.
 
Methods inherited from class xtc.type.RelativeReference
getBase, hasBase, isConstant
 
Methods inherited from class xtc.type.Reference
add, difference, getField, getType, hasField, indirect, isCast, isDynamic, isIndirect, isPrefix, isStatic, isString, isVariable, subtract, toString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

IndexReference

public IndexReference(Reference base,
                      java.math.BigInteger index)
Create a new index reference.

Parameters:
base - The base reference.
index - The index.
Method Detail

isNull

public boolean isNull()
Description copied from class: Reference
Determine whether this reference is a null reference. Note that a reference other than NullReference.NULL may still return true; notably, an index reference with a null base and a zero offset still is null.

Overrides:
isNull in class Reference
Returns:
true if this reference is a null reference.
See Also:
NullReference

hasIndex

public boolean hasIndex()
Description copied from class: Reference
Determine whether this reference has an index.

Overrides:
hasIndex in class Reference
Returns:
true if this reference has an index.
See Also:
IndexReference

getIndex

public java.math.BigInteger getIndex()
Description copied from class: Reference
Get this reference's index.

Overrides:
getIndex in class Reference
Returns:
The index.

hasLocation

public boolean hasLocation()
Description copied from class: Reference
Determine whether this reference has an absolute memory location.

Overrides:
hasLocation in class Reference
Returns:
true if this reference has an absolute memory location.

getLocation

public java.math.BigInteger getLocation(C ops)
Description copied from class: Reference
Get this reference's absolute memory location.

Overrides:
getLocation in class Reference
Parameters:
ops - The C operations.
Returns:
The memory location.

add

public Reference add(java.math.BigInteger val)
Description copied from class: Reference
Add the specified value to this reference.

Overrides:
add in class Reference
Parameters:
val - The value.
Returns:
A reference with an index increased by val.

subtract

public Reference subtract(java.math.BigInteger val)
Description copied from class: Reference
Subtract the specified value from this reference.

Overrides:
subtract in class Reference
Parameters:
val - The value.
Returns:
A reference with an index decreased by val.

hashCode

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

equals

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

write

public void write(java.lang.Appendable out)
           throws java.io.IOException
Description copied from class: Reference
Write a human readable representation to the specified appendable.

Specified by:
write in class Reference
Parameters:
out - The appendable.
Throws:
java.io.IOException - Signals an I/O error.


Copyright © 2012. All Rights Reserved.