xtc.type
Class FieldReference

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

public class FieldReference
extends RelativeReference

Representation of a field reference.

Version:
$Revision: 1.7 $
Author:
Robert Grimm

Field Summary
 
Fields inherited from class xtc.type.RelativeReference
base
 
Fields inherited from class xtc.type.Reference
type
 
Constructor Summary
FieldReference(Reference base, java.lang.String name)
          Create a new field reference.
 
Method Summary
 boolean equals(java.lang.Object o)
           
 java.lang.String getField()
          Get this reference's field.
 java.math.BigInteger getLocation(C ops)
          Get this reference's absolute memory location.
 boolean hasField()
          Determine whether this reference has a field.
 int hashCode()
           
 boolean hasLocation()
          Determine whether this reference has an absolute memory location.
 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, add, difference, getIndex, getType, hasIndex, indirect, isCast, isDynamic, isIndirect, isNull, isPrefix, isStatic, isString, isVariable, subtract, subtract, toString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

FieldReference

public FieldReference(Reference base,
                      java.lang.String name)
Create a new field reference. The specified base reference must have a struct or union type with a member of the specified name. The type of the newly created field reference is the named member's type, unless that type is an array, in which case the type is the array's element type.

Parameters:
base - The base reference.
name - The member name.
Throws:
java.lang.ClassCastException - Signals that the base reference is does not have a struct or union.
java.lang.IllegalArgumentException - Signals that the base reference does not have a struct/union with the named member.
Method Detail

hasField

public boolean hasField()
Description copied from class: Reference
Determine whether this reference has a field.

Overrides:
hasField in class Reference
Returns:
true if this reference has a field.
See Also:
FieldReference

getField

public java.lang.String getField()
Description copied from class: Reference
Get this reference's field.

Overrides:
getField in class Reference
Returns:
The field.

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.

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.