choco.kernel.solver.propagation.event
Class VarEvent<E extends Var>

java.lang.Object
  extended by choco.kernel.solver.propagation.event.VarEvent<E>
All Implemented Interfaces:
IPrioritizable, PropagationEvent
Direct Known Subclasses:
IntVarEvent, RealVarEvent, SetVarEvent, TaskVarEvent

public abstract class VarEvent<E extends Var>
extends Object
implements PropagationEvent

Implements an PropagationEvent for the variable events.


Field Summary
protected  SConstraint cause
          Cause of this basic var.
static int DOWDCAUSE
          Semantic of the cause of an event: -1 means that the event is active without any precise cause.
static int EMPTYEVENT
          empty bitvector for the event type.
protected  int eventType
          stores the type of update performed on the variable
protected  E 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.
protected  int propagatedEvents
          The events that should be fired for the constraints
 
Fields inherited from interface choco.kernel.solver.propagation.event.PropagationEvent
LOGGER
 
Constructor Summary
VarEvent(E var)
          Constructs a variable event for the specified variable and with the given basic events.
 
Method Summary
 void addPropagatedEvents(int bitsmask)
           
abstract  void clear()
          Clears the var: delegates to the basic events.
static int domOverWDegIdx(int idx)
          Deprecated. 
static int domOverWDegInitialIdx(int idx)
          Deprecated. 
protected  void freeze()
          freezes the state of the "delta domain": the set of values that are considered for removal from the domain.
 SConstraint getCause()
          Returns the cause of this basic var.
 int getEventType()
           
 Object getModifiedObject()
          Returns the touched variable.
 E getModifiedVar()
          Returns the touched variable.
 int getPriority()
          Returns the priority of the object.
 int getPropagatedEvents()
           
 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, SConstraint constraint, boolean forceAwake)
           
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

DOWDCAUSE

public static final int DOWDCAUSE
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 SConstraint 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 E extends Var modifiedVar
The touched variable.


eventType

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


propagatedEvents

protected int propagatedEvents
The events that should be fired for the constraints

Constructor Detail

VarEvent

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

Method Detail

addPropagatedEvents

public final void addPropagatedEvents(int bitsmask)

getPropagatedEvents

public final int getPropagatedEvents()

getModifiedVar

public final E getModifiedVar()
Returns the touched variable.


getModifiedObject

public final 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 final 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

getCause

public final SConstraint 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

getEventType

public final int getEventType()

domOverWDegIdx

@Deprecated
public static int domOverWDegIdx(int idx)
Deprecated. 

Compute the constraint idx to inform only DomOverWDegBranching of contradiction.

Parameters:
idx - constraint idx
Returns:
constraint idx for DomOverWDeg

domOverWDegInitialIdx

@Deprecated
public static int domOverWDegInitialIdx(int idx)
Deprecated. 

Recompute the inital constraint idx for DomOverWDegBranching.

Parameters:
idx - modified constraint idx
Returns:
initial constraint idx

isEnqueued

public final 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,
                                    SConstraint constraint,
                                    boolean forceAwake)


Copyright © 2012. All Rights Reserved.