choco.prop
Class VarEvent

java.lang.Object
  extended by choco.prop.VarEvent
All Implemented Interfaces:
PropagationEvent, IPrioritizable
Direct Known Subclasses:
IntVarEvent, RealVarEvent, SetVarEvent

public abstract class VarEvent
extends java.lang.Object
implements PropagationEvent, IPrioritizable

Implements an PropagationEvent for the variable events.


Field Summary
protected  int cause
          Cause of this basic var.
static int EMPTYEVENT
          empty bitvector for the event type.
protected  int eventType
          stores the type of update performed on the variable
protected static java.util.logging.Logger logger
          Reference to the root Logger, an object for logging trace statements related to propagation events (using the java.util.logging package)
protected  AbstractVar modifiedVar
          The touched variable.
static int NOCAUSE
          Semantic of the cause of an event: -1 means that the event is active without any precise cause.
static int NOEVENT
          empty bitvector for the event type.
 
Fields inherited from interface choco.prop.PropagationEvent
POPPING
 
Constructor Summary
VarEvent(AbstractVar var)
          Constructs a variable event for the specified variable and with the given basic events.
 
Method Summary
abstract  void clear()
          Clears the var: delegates to the basic events.
protected  void freeze()
          freezes the state of the "delta domain": the set of values that are considered for removal from the domain.
 int getCause()
          Returns the cause of this basic var.
 java.lang.Object getModifiedObject()
          Returns the touched variable.
 AbstractVar getModifiedVar()
          Returns the touched variable.
 int getPriority()
          Returns the priority of the object.
 AbstractProblem getProblem()
          Retrieving the problem.
 boolean isActive(int idx)
          Checks if a given listener is active or not
 boolean isEnqueued()
          tests whether the event is currently active (present in some queue) or not
abstract  boolean propagateEvent()
          Propagates the event through calls to the propagation engine.
 void recordEventTypeAndCause(int basicEvt, int idx)
           
protected  boolean release()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

NOEVENT

public static final int NOEVENT
empty bitvector for the event type.

See Also:
Constant Field Values

NOCAUSE

public static final int NOCAUSE
Semantic of the cause of an event: -1 means that the event is active without any precise cause. (Equivalent of 0 in Claire version)

See Also:
Constant Field Values

cause

protected int cause
Cause of this basic var.


EMPTYEVENT

public static final int EMPTYEVENT
empty bitvector for the event type.

See Also:
Constant Field Values

modifiedVar

protected AbstractVar modifiedVar
The touched variable.


logger

protected static java.util.logging.Logger logger
Reference to the root Logger, an object for logging trace statements related to propagation events (using the java.util.logging package)


eventType

protected int eventType
stores the type of update performed on the variable

Constructor Detail

VarEvent

public VarEvent(AbstractVar var)
Constructs a variable event for the specified variable and with the given basic events.

Method Detail

getModifiedVar

public AbstractVar getModifiedVar()
Returns the touched variable.


getModifiedObject

public java.lang.Object getModifiedObject()
Returns the touched variable.

Specified by:
getModifiedObject in interface PropagationEvent

freeze

protected void freeze()
freezes the state of the "delta domain": the set of values that are considered for removal from the domain. Further removals will be treated as a further event.


release

protected boolean release()

propagateEvent

public abstract boolean propagateEvent()
                                throws ContradictionException
Propagates the event through calls to the propagation engine.

Specified by:
propagateEvent in interface PropagationEvent
Returns:
true if the event has been fully propagated (and can thus be discarded), false otherwise
Throws:
ContradictionException

clear

public abstract void clear()
Clears the var: delegates to the basic events.

Specified by:
clear in interface PropagationEvent

isActive

public boolean isActive(int idx)
Checks if a given listener is active or not

Specified by:
isActive in interface PropagationEvent
Parameters:
idx - the index of the listener among all listeners connected to the variable

getProblem

public AbstractProblem getProblem()
Retrieving the problem.


getCause

public int getCause()
Returns the cause of this basic var.


getPriority

public int getPriority()
Description copied from interface: IPrioritizable
Returns the priority of the object.

Specified by:
getPriority in interface IPrioritizable

isEnqueued

public boolean isEnqueued()
tests whether the event is currently active (present in some queue) or not

Returns:
true if and only if the event is present in some queue, waiting to be handled (returns false if the event is either absent from the queue or is the current event, just popped from the queue and being propagated)

recordEventTypeAndCause

public void recordEventTypeAndCause(int basicEvt,
                                    int idx)