sub_arctic.style
Class center_rule
java.lang.Object
|
+--sub_arctic.style.op1_placement_rule
|
+--sub_arctic.style.op2_placement_rule
|
+--sub_arctic.style.op3_placement_rule
|
+--sub_arctic.style.center_rule
- public class center_rule
- extends op3_placement_rule
This class provides a composition placement rule for setting the position
of something centered around something else (and offset by some amount).
In particular it computes the value A - B/2 + C. Normally A represents
the coordinate being centered about, B is the size of the object being
centered, and C is the offset (which can be defaulted to a constant zero).
- See Also:
composer
,
composition_part
Constructor Summary |
center_rule(int referent1,
int referent_num1,
int referent_coord1,
int referent2,
int referent_num2,
int referent_coord2)
Constructor defaulting its 3rd argument to a constant 0. |
center_rule(int referent1,
int referent_num1,
int referent_coord1,
int referent2,
int referent_num2,
int referent_coord2,
int referent3,
int referent_num3,
int referent_coord3)
Full constructor. |
Method Summary |
int |
eval(composer comp_obj)
Evaluate the rule to produce a value. |
Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
center_rule
public center_rule(int referent1,
int referent_num1,
int referent_coord1,
int referent2,
int referent_num2,
int referent_coord2,
int referent3,
int referent_num3,
int referent_coord3)
- Full constructor. Constraint computes ref1 - ref2/2 + ref3 , where ref1
is normally a coordinate we are centering about, ref2 is the size of the
thing being centered, and ref3 is an offset from the nominal center
position.
- Parameters:
int
- referent1 Designator for value we are centering aboutint
- refernent_num1 Number of part or parameter for referent1.int
- referent_coord1 designator for coordinate of the referent1.int
- referent2 designator for size of object being centeredint
- refernent_num2 Number of part or parameter for referent2int
- referent_coord2 designator for coordinate of referent2.int
- referent3 designator for offsetint
- refernent_num3 Number of part or parameter for referent3.int
- referent_coord3 designator for coordinate of referent3.
center_rule
public center_rule(int referent1,
int referent_num1,
int referent_coord1,
int referent2,
int referent_num2,
int referent_coord2)
- Constructor defaulting its 3rd argument to a constant 0. The constraint
then computes ref1 - ref2/2, where ref1 is normally a coordinate we are
centering about, and ref2 is the size of the thing being centered.
- Parameters:
int
- referent1 Designator for value we are centering aboutint
- refernent_num1 Number of part or parameter for referent1.int
- referent_coord1 designator for coordinate of the referent1.int
- referent2 designator for size of object being centeredint
- refernent_num2 Number of part or parameter for referent2int
- referent_coord2 designator for coordinate of referent2.
eval
public int eval(composer comp_obj)
- Evaluate the rule to produce a value. This basically just executes the
function associated with the rule.
- Parameters:
composer
- comp_obj the composer object doing the evaluation.
This object provides access the value of other
parts, and to the set of parameters to the
composition. It also keeps some of the
evauation bookkeeping.- Returns:
- int the result of the evaluation.
- Overrides:
- eval in class op3_placement_rule