public class AbsObjectImpl extends Object implements AbsObject
Modifier and Type | Field and Description |
---|---|
private boolean |
changed
true if this object is changed and its hash must be recomputed
|
private HashMap |
elements |
private int |
hashCode |
private ArrayList |
orderedKeys
This list keeps the keys in the same order as they were added
|
private String |
typeName |
ABS_AGENT_ACTION, ABS_AGGREGATE, ABS_CONCEPT, ABS_CONCEPT_SLOT_FUNCTION, ABS_CONTENT_ELEMENT_LIST, ABS_IRE, ABS_PREDICATE, ABS_PRIMITIVE, ABS_VARIABLE, UNKNOWN
Modifier | Constructor and Description |
---|---|
protected |
AbsObjectImpl(String typeName)
Construct an Abstract descriptor to hold an object of
the proper type.
|
Modifier and Type | Method and Description |
---|---|
boolean |
equals(Object obj)
Returns true if the attribute is equal to
this abstract descriptor, based on the contents
of both descriptors.
|
private int |
f(AbsObjectImpl o) |
private int |
f(AbsObjectImpl o,
int x)
Calculates the hashcode according to a formula based on the
slot names and values taken in an lexicographical order
|
AbsObject |
getAbsObject(String name)
Gets the value of an attribute of the object held by this
abstract descriptor.
|
int |
getAbsType() |
int |
getCount()
Gets the number of attributes.
|
String[] |
getNames() |
String |
getTypeName() |
int |
hashCode()
Returns an integer hashcode calculated from the
contents of this abstract descriptor
|
boolean |
isGrounded()
Tests if the object is grounded, i.e., if no one of its attributes
is associated with a variable
|
protected void |
set(String name,
AbsObject value)
Sets an attribute of the object held by this
abstract descriptor.
|
private void |
sort(String[] strs) |
private void |
swap(String[] strs,
int x,
int y) |
String |
toString()
This method is here just for debugging.
|
private HashMap elements
private ArrayList orderedKeys
private String typeName
private boolean changed
private int hashCode
protected AbsObjectImpl(String typeName)
typeName
- The name of the type of the object held by this
abstract descriptor.public String getTypeName()
getTypeName
in interface AbsObject
AbsObject.getTypeName()
protected void set(String name, AbsObject value)
name
- The name of the attribute to be set.value
- The new value of the attribute. If value
is null the current mapping with name
(if any) is
removed.public AbsObject getAbsObject(String name)
getAbsObject
in interface AbsObject
name
- The name of the attribute.AbsObject.getAbsObject(String)
public String[] getNames()
getNames
in interface AbsObject
AbsObject.getNames()
public boolean isGrounded()
isGrounded
in interface AbsObject
true
if the object is grounded.AbsObject.isGrounded()
public int getCount()
getCount
in interface AbsObject
AbsObject.getCount()
public String toString()
public boolean equals(Object obj)
public int hashCode()
private final int f(AbsObjectImpl o, int x)
private final int f(AbsObjectImpl o)
private final void sort(String[] strs)
private final void swap(String[] strs, int x, int y)
public int getAbsType()
getAbsType
in interface AbsObject