sub_arctic.constraints
Class external_constraint
java.lang.Object
|
+--sub_arctic.constraints.external_constraint
- Direct Known Subclasses:
- linear_ext_constraint, std_ext_constraint
- public abstract class external_constraint
- extends java.lang.Object
- implements value_provider, value_consumer
This abstract class provides that base class for all "external" (aka
heavyweight) constraints. External constraints can provide values from
any source capable of supporting this protocol (which includes operations
attaching and detaching dependency edges, retrieving or computing a value,
and indicating the stored or computed value has been changed).
Field Summary |
protected boolean |
_doing_ood
Local mark for breaking cycles. |
protected java.util.Vector |
_notify_list
The set of things we notify when values are out-of-date. |
Method Summary |
void |
attach_dependent(int on_part_num,
value_consumer dep_obj,
int dep_part)
Register something as interested in (dependent on) one of the parts of
this object. |
void |
detach_dependent(int on_part_num,
value_consumer dep_obj,
int dep_part)
Remove an (object,part) pair from the dependent (interested in) list. |
abstract java.lang.Object |
get_value(int part_number)
Compute an up-to-date copy of (or reference to) the value produced by this
constraint. |
void |
value_ood(int for_part_here,
value_provider prov_obj,
int prov_part)
Indicate to this constraint that a value it depends on (a part of a
value_provider object that it is interested in) has, or might have,
changed value. |
Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
_doing_ood
protected boolean _doing_ood
- Local mark for breaking cycles. This is true while a mark out-of-date
traversal which has passed through this constraint is still going on.
if the traversal reaches a constraint with this value set it indicates
a cycle.
_notify_list
protected java.util.Vector _notify_list
- The set of things we notify when values are out-of-date. This Vector
contains consumer_part_ref objects.
external_constraint
public external_constraint()
- Default constructor.
get_value
public abstract java.lang.Object get_value(int part_number)
- Compute an up-to-date copy of (or reference to) the value produced by this
constraint. Here part_number is ignored since we only provide one value.
This gets overridden to provide the actual computation done by this
constraint.
- Specified by:
- get_value in interface value_provider
- Parameters:
int
- part_number the internal part number for the value desired. In
this case only part 0 is supported, so this is
ignored.
attach_dependent
public void attach_dependent(int on_part_num,
value_consumer dep_obj,
int dep_part)
- Register something as interested in (dependent on) one of the parts of
this object. The entity registered is a part within a value_consumer
object. Whenever a value represented by this value_provider changes
(or might change), the value_ood() method must be invoked on each
currently registered (object,part). Here we ignore on_part_num since
we only have one part.
- Specified by:
- attach_dependent in interface value_provider
- Parameters:
int
- on_part_num the part of this object we are attaching
the dependent to (in this case ignored
since we only have one part).value_consumer
- dep_obj the dependent object.int
- dep_part the part within that object which is
dependent.
detach_dependent
public void detach_dependent(int on_part_num,
value_consumer dep_obj,
int dep_part)
- Remove an (object,part) pair from the dependent (interested in) list.
Here we ignore on_part_num since we only have one part.
- Specified by:
- detach_dependent in interface value_provider
- Parameters:
int
- on_part_num the part number of this object the
dependent was attached to (ignored here).value_consumer
- dep_obj the previously dependent object.int
- dep_part the previously dependent part of that
object.
value_ood
public void value_ood(int for_part_here,
value_provider prov_obj,
int prov_part)
- Indicate to this constraint that a value it depends on (a part of a
value_provider object that it is interested in) has, or might have,
changed value. Here we just pass this on to others that depend on us
(being sure to break any cycles).
- Specified by:
- value_ood in interface value_consumer
- Parameters:
int
- for_part_here the part of this object interested in
the value (here this is ignored since
we only have one part).value_provider
- prov_obj the object providing the value we are
interested in.int
- prov_part the part of the above object we are
interested in.