jeops.conflict
Class ConflictSetElement

java.lang.Object
  |
  +--jeops.conflict.ConflictSetElement

public class ConflictSetElement
extends java.lang.Object

An element present in the conflict set.

Version:
0.02 07 Apr 2000 The local declarations are now stored as a two-dimensional array, which stores their dependencies with the regular declarations.
Author:
Carlos Figueira Filho (csff@cin.ufpe.br)

Field Summary
private  java.lang.Object[] objects
          The objects bound to the declared variables.
private  int ruleIndex
          The index of the fireable rule.
private  long timestamp
          A timestamp of this element.
 
Constructor Summary
ConflictSetElement(int ruleIndex, java.lang.Object[] objects)
          Class constructor.
 
Method Summary
private static boolean compareArrays(java.lang.Object[] array1, java.lang.Object[] array2)
          Auxiliar method used to compare two arrays of objects.
 boolean equals(java.lang.Object obj)
          Compares this object with the given one.
 java.lang.Object[] getObjects()
          Returns the objects bound to the declared variables.
 int getRuleIndex()
          Returns the index of the fireable rule.
 long getTimestamp()
          Returns the timestamp of this element.
 int hashCode()
          Returns a hash code for this object.
 boolean isDeclared(java.lang.Object obj)
          Checks whether a given object is one of the objects bound to the declared variables in this element.
 java.lang.String toString()
          Returns a string representation of this object.
 
Methods inherited from class java.lang.Object
, clone, finalize, getClass, notify, notifyAll, registerNatives, wait, wait, wait
 

Field Detail

ruleIndex

private int ruleIndex
The index of the fireable rule.

objects

private java.lang.Object[] objects
The objects bound to the declared variables.

timestamp

private long timestamp
A timestamp of this element. Useful for conflict resolution policies based on object recency.
Constructor Detail

ConflictSetElement

public ConflictSetElement(int ruleIndex,
                          java.lang.Object[] objects)
Class constructor.
Parameters:
ruleIndex - the index of the fireable rule.
objects - the objects bound to the declared variables.
Method Detail

compareArrays

private static boolean compareArrays(java.lang.Object[] array1,
                                     java.lang.Object[] array2)
Auxiliar method used to compare two arrays of objects.
Parameters:
array1 - the first array to be compared.
array2 - the second array to be compared.
Returns:
true if all elements of the arrays are equals; false otherwise.

equals

public boolean equals(java.lang.Object obj)
Compares this object with the given one.
Overrides:
equals in class java.lang.Object
Parameters:
obj - the object to be compared
Returns:
true if the two objects represent the same conflict set element; false otherwise.

getObjects

public java.lang.Object[] getObjects()
Returns the objects bound to the declared variables.
Returns:
the objects bound to the declared variables.

getRuleIndex

public int getRuleIndex()
Returns the index of the fireable rule.
Returns:
the index of the fireable rule.

getTimestamp

public long getTimestamp()
Returns the timestamp of this element.
Returns:
the timestamp of this element.

hashCode

public int hashCode()
Returns a hash code for this object.
Overrides:
hashCode in class java.lang.Object
Returns:
a hash code for this object.

isDeclared

public boolean isDeclared(java.lang.Object obj)
Checks whether a given object is one of the objects bound to the declared variables in this element.
Parameters:
obj - the object to be checked.
Returns:
true if the given object bound to one of the declared variables in this element; false otherwise.

toString

public java.lang.String toString()
Returns a string representation of this object. Useful for debugging.
Overrides:
toString in class java.lang.Object
Returns:
a string representation of this object.