|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--sub_arctic.constraints.std_constraint_impl
Class that provides the implementation for standard lightweight constraints. This class understand how to encode and decode an integer encoding of a constraint, and use that to perform operations such as evaluate the constraint, determine if it depends upon a particular value, produce a human readable rendition of the constraint, etc.
There should only be one instance of this class created: std_constraint_impl.the_impl(). This should be shared by all constraints. encoded in standard form.
In order to organize this class into more manageable units, it is actually implemented with four helper classes, one for each of the possible numbers of operands to the constraint. These are: op0_impl, op1_impl, op2_impl, and op3_impl. See those classes for full encoding details.
op0_impl
,
op1_impl
,
op2_impl
,
op3_impl
Field Summary | |
protected static std_constraint_impl |
_the_impl
The one and only instance of this class. |
protected static int |
ENABLED
|
protected static int |
H
|
protected static int |
PART_A
|
protected static int |
PART_B
|
protected static int |
VISIBLE
|
protected static int |
W
|
protected static int |
X
|
protected static int |
Y
|
Constructor Summary | |
protected |
std_constraint_impl()
Protected constructor -- no instances of this class should be created outside the one stored statically with the class (the_impl). |
Method Summary | |
protected void |
add_depend_obj_part(java.util.Vector result,
int part_enc,
interactor constr_obj,
int orient)
Extract a depended upon object/part from the given object/part encoding and add it to the end of the given vector. |
protected void |
add_depend_part(java.util.Vector result,
int part_enc,
int orient)
Append depended upon part numbers to the given Vector. |
java.lang.String |
const_str(int enc)
Create a human readable string corresponding to the constant contained in the given encoded constraint. |
java.util.Vector |
depend_list(int enc,
interactor constr_obj,
int orient)
Extract the set of objects/parts that a constraint depends on. |
boolean |
depends_on(int enc,
interactor constr_obj,
int which_obj,
int which_part,
int nth_child,
int orient)
Test whether the given encoded constraint depends on the indicated neighboring object and part. |
int |
eval(int enc,
interactor constr_obj,
int constr_part,
int orient)
Evaluate an encoded constraint (under a given orientation). |
int |
fetch_value(int objpart_code,
interactor constr_obj,
int orient)
Fetch the indicated depended-upon value for the given object and part. |
protected int |
get_parent_value(interactor from_obj,
int from_part,
int orient)
Fetch a particular value from a parent object on behalf of a given part in a particular orientation. |
protected int |
get_value(interactor from_obj,
int from_part,
int orient)
Fetch a particular value on behalf of a given part in a particular orientation. |
java.util.Vector |
implicit_depend_list(int enc,
interactor constr_obj,
int orient)
Extract the dependencies that are implicit in the particular operation encoded in the given standard constraint encoding. |
boolean |
is_external(int enc)
Determine if a given constraint encoding represents an external constraint. |
boolean |
is_none(int enc)
Determine if a given constraint encoding represents "none" (i.e., that no constraint is to be applied). |
int |
num_ops(int enc)
Determine which kind of constraint (how many operands) the given encoding has. |
java.lang.String |
obj_part_str(int enc,
int orient)
Create a human readable string corresponding to an object/part designator. |
java.lang.String |
obj_part_tag(int enc,
int orient)
Create a terse human readable string corresponding to an object/part designator. |
java.lang.String |
opcode_str(int enc)
Create a human readable string corresponding to the op_code from the given constraint encoding. |
java.lang.String |
opcode_tag(int enc)
Create a terse human readable string corresponding to the op_code from the given constraint encoding. |
java.lang.String |
operand_str(int enc,
int orient)
Create a human readable string corresponding to the operands of the given constraint encoding. |
java.lang.String |
operand_tag(int enc,
int orient)
Create a terse human readable string corresponding to the operands of the given constraint encoding. |
boolean |
part_depends_on(int enc,
interactor constr_obj,
int which_obj,
int which_part,
int nth_child,
int orient)
Test whether the given encoded object/part indicates the given object and part for dependency purposes. |
java.lang.String |
str_for(int enc,
int orient)
Create a human readable string corresponding to the given constraint encoding. |
java.lang.String |
tag_for(int enc,
int orient)
Create a terse human readable string corresponding to the given constraint encoding. |
static std_constraint_impl |
the_impl()
The one and only instance of this class. |
Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
Field Detail |
protected static final std_constraint_impl _the_impl
protected static final int X
protected static final int Y
protected static final int W
protected static final int H
protected static final int VISIBLE
protected static final int ENABLED
protected static final int PART_A
protected static final int PART_B
Constructor Detail |
protected std_constraint_impl()
Method Detail |
public static std_constraint_impl the_impl()
public int num_ops(int enc)
int
- enc the encoding for the constraint.public java.lang.String const_str(int enc)
int
- enc the constraint encodingpublic java.lang.String obj_part_str(int enc, int orient)
int
- enc the designator encodingint
- orient the orientation of the encoding (HORIZONTAL or VERTICAL)public java.lang.String opcode_str(int enc)
int
- enc the constraint encodingpublic java.lang.String operand_str(int enc, int orient)
int
- enc the constraint encodingint
- orient the orientation of the encoding (HORIZONTAL or VERTICAL)public java.lang.String str_for(int enc, int orient)
int
- enc the constraint encodingint
- orient the orientation of the encoding (HORIZONTAL or VERTICAL)public java.lang.String obj_part_tag(int enc, int orient)
int
- enc the designator encodingint
- orient the orientation of the encoding (HORIZONTAL or VERTICAL)public java.lang.String opcode_tag(int enc)
int
- enc the constraint encodingpublic java.lang.String operand_tag(int enc, int orient)
int
- enc the constraint encodingint
- orient the orientation of the encoding (HORIZONTAL or VERTICAL)public java.lang.String tag_for(int enc, int orient)
int
- enc the constraint encodingint
- orient the orientation of the encoding (HORIZONTAL or VERTICAL)protected int get_value(interactor from_obj, int from_part, int orient)
interactor
- from_obj object we are getting the value fromint
- from_part component of that object we wantint
- orient orientation (should be HORIZONTAL or VERTICAL)get_parent_value(sub_arctic.lib.interactor, int, int)
protected int get_parent_value(interactor from_obj, int from_part, int orient)
interactor
- from_obj object we are getting the value fromint
- from_part component of that object we wantint
- orient orientation (should be HORIZONTAL or VERTICAL)get_parent_value(sub_arctic.lib.interactor, int, int)
public int fetch_value(int objpart_code, interactor constr_obj, int orient)
int
- objpart_code encoding of object/part we need to fetchinteractor
- constr_obj constrained object we are fetching value
for. fetched values are found relative to
this object.int
- orient orientation of fetched value (should be
HORIZONTAL or VERTICAL).public boolean is_none(int enc)
int
- enc the encoding for the constraint.public boolean is_external(int enc)
int
- enc the encoding for the constraint.boolean
- whether the encoding indicates an external constraint.public int eval(int enc, interactor constr_obj, int constr_part, int orient)
int
- enc the encoding of the constraintinteractor
- constr_obj the object being constrainedint
- constr_part the part being constrainedint
- orient the orientation of the constraintpublic boolean depends_on(int enc, interactor constr_obj, int which_obj, int which_part, int nth_child, int orient)
If this is an "external" constraint that maintains its own dependency edges and works through the external notification system, then this method may safely return false in all cases.
int
- enc The encoding for the constraint.interactor
- constr_obj The object the constraint is attached toint
- test_which_obj The neighboring object we are asking
about. This can be one of the values
OBJCODE_SELF, OBJCODE_PARENT,
OBJCODE_SOME_CHILD,
OBJCODE_PREV_SIBLING, or
OBJCODE_NEXT_SIBLING.int
- test_which_part The part we are asking about.int
- nth_child for SOME_CHILD, this provides the index
of the child (and is ignored otherwise).int
- orient Orientation of the constraint. This
should be HORIZONTAL or VERTICAL.public boolean part_depends_on(int enc, interactor constr_obj, int which_obj, int which_part, int nth_child, int orient)
int
- enc The encoding we are testing.interactor
- constr_obj The object the constraint is attached toint
- test_which_obj The object we are asking about. This
can be one of the values OBJCODE_SELF,
OBJCODE_PARENT, OBJCODE_SOME_CHILD,
OBJCODE_PREV_SIBLING, or
OBJCODE_NEXT_SIBLING.int
- test_which_part The part we are asking about.int
- nth_child for SOME_CHILD, this provides the index
of the child (and is ignored otherwise).int
- orient Orientation of the constraint. This
should be HORIZONTAL or VERTICAL.public java.util.Vector depend_list(int enc, interactor constr_obj, int orient)
int
- enc encoding value for the constraint in question.interactor
- constr_obj the object the constraint is attached to
(hence its referents are relative to).int
- orient Orientation of the constraint. This
should be HORIZONTAL or VERTICAL.public java.util.Vector implicit_depend_list(int enc, interactor constr_obj, int orient)
int
- enc encoding value for the constraint in question.interactor
- constr_obj the object the constraint is attached to
(hence its referents are relative to).int
- orient Orientation of the constraint. This
should be HORIZONTAL or VERTICAL.protected void add_depend_obj_part(java.util.Vector result, int part_enc, interactor constr_obj, int orient)
Vector
- result the Vector object we add to the end of.int
- part_enc encoding value for object/part in question.interactor
- constr_obj the object the constraint is attached to
(hence its referents are relative to).int
- orient Orientation of the constraint. This
should be HORIZONTAL or VERTICAL.protected void add_depend_part(java.util.Vector result, int part_enc, int orient)
Vector
- result the Vector object we add to the end of.int
- part_enc encoding value for part in question.int
- orient Orientation of the constraint. This
should be HORIZONTAL or VERTICAL.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |