sub_arctic.constraints
Class std_ext_constraint

java.lang.Object
  |
  +--sub_arctic.constraints.external_constraint
        |
        +--sub_arctic.constraints.std_ext_constraint

public class std_ext_constraint
extends external_constraint

This class provides an external constraint that executes one of the standard constraint functions based on a (partial) standard constraint encoding along with an explicit set of operands (which involve explicitly provided objects and standard or non-standard parts).


Field Summary
protected  int _const_value
          Constant value passed to the constraint evaluation function.
protected  int _encoding
          Partial encoding of the constraint.
protected  int _num_ops
          Cache of number of operands for the encoded function
protected  interactor _op1_obj
          Object referenced by operand 1 of the constraint.
protected  int _op1_part
          Non-standard part number for operand 1 of the constraint.
protected  byte _op1_std_part
          Standard part code for operand 1.
protected  interactor _op2_obj
          Object referenced by operand 2 of the constraint.
protected  int _op2_part
          Non-standard part number for operand 2 of the constraint.
protected  byte _op2_std_part
          Standard part code for operand 2.
protected  interactor _op3_obj
          Object referenced by operand 3 of the constraint.
protected  int _op3_part
          Non-standard part number for operand 3 of the constraint.
protected  byte _op3_std_part
          Standard part code for operand 3.
protected  byte _orientation
          Orientation under which this constraint is evaluated.
protected  interactor _self_obj
          The object which serves as self for the constraint.
static byte IS_HORIZ
          Bit mask for bit used to indicate a horizontally oriented standard part.
static byte NOT_STANDARD
          Flag value for non-standard part code.
 
Fields inherited from class sub_arctic.constraints.external_constraint
_doing_ood, _notify_list
 
Constructor Summary
std_ext_constraint(int enc, interactor slf_obj, int orient, ext_objpart_encoding op1, ext_objpart_encoding op2, ext_objpart_encoding op3, int c_val)
          Construct a 3 operand external constraint that executes the constraint function encoded in standard from, but with arbitrary operand values.
std_ext_constraint(int enc, interactor slf_obj, int orient, ext_objpart_encoding op1, ext_objpart_encoding op2, int c_val)
          Construct a 2 operand external constraint that executes the constraint function encoded in standard from, but with potentially arbitrary operand values.
std_ext_constraint(int enc, interactor slf_obj, int orient, ext_objpart_encoding op1, int c_val)
          Construct a 1 operand external constraint that executes the constraint function encoded in standard from, but with a potentially arbitrary operand value.
std_ext_constraint(int enc, interactor slf_obj, int orient, int c_val)
          Construct a 0 operand external constraint that executes the constraint function encoded in standard from.
 
Method Summary
 int const_value()
          Constant value passed to the constraint evaluation function.
 int encoding()
          Partial encoding of the constraint.
protected  int fetch_part(interactor from_obj, int std_part, int ext_part_num)
          Fetch a standard or non-standard part from the given interactor object.
protected  int fetch_std_part(interactor the_obj, int the_part)
          Fetch a standard part from the given object.
 java.lang.Object get_value(int ignored_part_number)
          Actually evaluate the constraint.
 interactor op1_obj()
          Object referenced by operand 1 of the constraint.
 int op1_part()
          Non-standard part number for operand 1 of the constraint.
 byte op1_std_part()
          Standard part code for operand 1.
 interactor op2_obj()
          Object referenced by operand 2 of the constraint.
 int op2_part()
          Non-standard part number for operand 2 of the constraint.
 byte op2_std_part()
          Standard part code for operand 2.
 interactor op3_obj()
          Object referenced by operand 3 of the constraint.
 int op3_part()
          Non-standard part number for operand 3 of the constraint.
 byte op3_std_part()
          Standard part code for operand 3.
 byte orientation()
          Orientation under which this constraint is evaluated.
 interactor self_obj()
          The object which serves as self for the constraint.
 void set_const_value(int v)
          Set the constant value passed to the constraint evaluation function.
 void set_orientation(int ov)
          Set the orientation under which this constraint is evaluated.
 void set_self_obj(interactor slf_obj)
          Set the object which serves as self for the constraint.
protected  void setup_dependencies()
          Establish the external dependencies needed for this constraint
protected  void setup_op_dependencies(byte op_std_part, interactor op_obj, int op_part)
          Setup dependencies for a particular operand.
protected  void setup_std_part_dependencies(interactor for_obj, byte part_code)
          Establish the external dependencies for a particular standard part reference.
 
Methods inherited from class sub_arctic.constraints.external_constraint
attach_dependent, detach_dependent, value_ood
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

_encoding

protected int _encoding
Partial encoding of the constraint. This controls how the constraint operates and is encoded the same way as a standard constraint encoding (see std_encoding_consts) except that the encoded operands and constant are ignored.

_const_value

protected int _const_value
Constant value passed to the constraint evaluation function.

_orientation

protected byte _orientation
Orientation under which this constraint is evaluated. This should match the orientation of the object to which this constraint is attached and only affects implicit operands (i.e., self.wh used in centered()), and does not affect explicit operands which maintain their own orientation. This should have one of the values HORIZONTAL, VERTICAL, or NOT_ORIENTED.

_self_obj

protected interactor _self_obj
The object which serves as self for the constraint. This object should be the one that contains the part being constrained and controls the coordinate system in which position values are delivered.

NOT_STANDARD

public static final byte NOT_STANDARD
Flag value for non-standard part code. This can be stored in op*_std_part to indicate that a non-standard part is being referred to (in which case op*_part will contain the part number being referenced).

IS_HORIZ

public static final byte IS_HORIZ
Bit mask for bit used to indicate a horizontally oriented standard part. This bit will be set in op*_std_part if the part is to be interpreted as having a horizontal orientation.

_op1_std_part

protected byte _op1_std_part
Standard part code for operand 1. If this has the special value NOT_STANDARD, then a non-standard part (found in _op1_part) is used instead. Otherwise this will contain a standard part code (one of the PARTCODE_* values) optionally ORed with IS_HORIZ to indicate that it should be interpreted with a horizontal orientation.

_op2_std_part

protected byte _op2_std_part
Standard part code for operand 2. If this has the special value NOT_STANDARD, then a non-standard part (found in _op2_part) is used instead. Otherwise this will contain a standard part code (one of the PARTCODE_* values) optionally ORed with IS_HORIZ to indicate that it should be interpreted with a horizontal orientation.

_op3_std_part

protected byte _op3_std_part
Standard part code for operand 3. If this has the special value NOT_STANDARD, then a non-standard part (found in _op3_part) is used instead. Otherwise this will contain a standard part code (one of the PARTCODE_* values) optionally ORed with IS_HORIZ to indicate that it should be interpreted with a horizontal orientation.

_op1_part

protected int _op1_part
Non-standard part number for operand 1 of the constraint. This is used if op1_std_part == NON_STANDARD, and will contain the part number of the part providing operand 1.

_op1_obj

protected interactor _op1_obj
Object referenced by operand 1 of the constraint.

_op2_part

protected int _op2_part
Non-standard part number for operand 2 of the constraint. This is used if op2_std_part == NON_STANDARD, and will contain the part number of the part providing operand 2.

_op2_obj

protected interactor _op2_obj
Object referenced by operand 2 of the constraint.

_op3_part

protected int _op3_part
Non-standard part number for operand 3 of the constraint. This is used if op3_std_part == NON_STANDARD, and will contain the part number of the part providing operand 3.

_op3_obj

protected interactor _op3_obj
Object referenced by operand 3 of the constraint.

_num_ops

protected int _num_ops
Cache of number of operands for the encoded function
Constructor Detail

std_ext_constraint

public std_ext_constraint(int enc,
                          interactor slf_obj,
                          int orient,
                          ext_objpart_encoding op1,
                          ext_objpart_encoding op2,
                          ext_objpart_encoding op3,
                          int c_val)
Construct a 3 operand external constraint that executes the constraint function encoded in standard from, but with arbitrary operand values.

Parameters:
int - enc The (partial) standard encoding for the constraint (the operand encoding portions are ignored).
interactor - slf_obj The object which acts as self for the constraint (this is only used for constraints that implicitly reference self or parent).
int - orient Orientation of the part we are constraining.
ext_objpart_encoding - op1 An encoding of the first operand.
ext_objpart_encoding - op2 An encoding of the second operand.
ext_objpart_encoding - op3 An encoding of the third operand.
int - c_val The constant value supplied to the constraint.

std_ext_constraint

public std_ext_constraint(int enc,
                          interactor slf_obj,
                          int orient,
                          ext_objpart_encoding op1,
                          ext_objpart_encoding op2,
                          int c_val)
Construct a 2 operand external constraint that executes the constraint function encoded in standard from, but with potentially arbitrary operand values.

Parameters:
int - enc The (partial) standard encoding for the constraint (the operand encoding portions are ignored).
interactor - slf_obj The object which acts as self for the constraint (this is only used for constraints that implicitly reference self or parent).
int - orient Orientation of the part we are constraining.
ext_objpart_encoding - op1 An encoding of the first operand.
ext_objpart_encoding - op2 An encoding of the second operand.
int - c_val The constant value supplied to the constraint.

std_ext_constraint

public std_ext_constraint(int enc,
                          interactor slf_obj,
                          int orient,
                          ext_objpart_encoding op1,
                          int c_val)
Construct a 1 operand external constraint that executes the constraint function encoded in standard from, but with a potentially arbitrary operand value.

Parameters:
int - enc The (partial) standard encoding for the constraint (the operand encoding portions are ignored).
interactor - slf_obj The object which acts as self for the constraint (this is only used for constraints that implicitly reference self or parent).
int - orient Orientation of the part we are constraining.
ext_objpart_encoding - op1 An encoding of the second operand.
int - c_val The constant value supplied to the constraint.

std_ext_constraint

public std_ext_constraint(int enc,
                          interactor slf_obj,
                          int orient,
                          int c_val)
Construct a 0 operand external constraint that executes the constraint function encoded in standard from.

Parameters:
int - enc The (partial) standard encoding for the constraint (the operand encoding portions are ignored).
interactor - slf_obj The object which acts as self for the constraint (this is only used for constraints that implicitly reference self or parent).
int - orient Orientation of the part we are constraining.
int - c_val The constant value supplied to the constraint.
Method Detail

encoding

public int encoding()
Partial encoding of the constraint. This controls how the constraint operates and is encoded the same way as a standard constraint encoding (see std_encoding_consts) except that the encoded operands and constant are ignored.

const_value

public int const_value()
Constant value passed to the constraint evaluation function.

set_const_value

public void set_const_value(int v)
Set the constant value passed to the constraint evaluation function.

orientation

public byte orientation()
Orientation under which this constraint is evaluated. This should match the orientation of the object to which this constraint is attached and only affects implicit operands (i.e., self.wh used in centered()), and does not affect explicit operands which maintain their own orientation. This should have one of the values HORIZONTAL, VERTICAL, or NOT_ORIENTED.

set_orientation

public void set_orientation(int ov)
Set the orientation under which this constraint is evaluated. This should match the orientation of the object to which this constraint is attached and only affects implicit operands (i.e., self.wh used in centered()), and does not affect explicit operands which maintain their own orientation. This should have one of the values HORIZONTAL, VERTICAL, or NOT_ORIENTED.

self_obj

public interactor self_obj()
The object which serves as self for the constraint. This object should be the one that contains the part being constrained and controls the coordinate system in which position values are delivered.

set_self_obj

public void set_self_obj(interactor slf_obj)
Set the object which serves as self for the constraint. This object should be the one that contains the part being constrained and controls the coordinate system in which position values are delivered.

op1_std_part

public byte op1_std_part()
Standard part code for operand 1. If this has the special value NOT_STANDARD, then a non-standard part (found in _op1_part) is used instead. Otherwise this will contain a standard part code (one of the PARTCODE_* values) optionally ORed with IS_HORIZ to indicate that it should be interpreted with a horizontal orientation.

op2_std_part

public byte op2_std_part()
Standard part code for operand 2. If this has the special value NOT_STANDARD, then a non-standard part (found in _op2_part) is used instead. Otherwise this will contain a standard part code (one of the PARTCODE_* values) optionally ORed with IS_HORIZ to indicate that it should be interpreted with a horizontal orientation.

op3_std_part

public byte op3_std_part()
Standard part code for operand 3. If this has the special value NOT_STANDARD, then a non-standard part (found in _op3_part) is used instead. Otherwise this will contain a standard part code (one of the PARTCODE_* values) optionally ORed with IS_HORIZ to indicate that it should be interpreted with a horizontal orientation.

op1_part

public int op1_part()
Non-standard part number for operand 1 of the constraint. This is used if op1_std_part == NON_STANDARD, and will contain the part number of the part providing operand 1.

op1_obj

public interactor op1_obj()
Object referenced by operand 1 of the constraint.

op2_part

public int op2_part()
Non-standard part number for operand 2 of the constraint. This is used if op2_std_part == NON_STANDARD, and will contain the part number of the part providing operand 2.

op2_obj

public interactor op2_obj()
Object referenced by operand 2 of the constraint.

op3_part

public int op3_part()
Non-standard part number for operand 3 of the constraint. This is used if op3_std_part == NON_STANDARD, and will contain the part number of the part providing operand 3.

op3_obj

public interactor op3_obj()
Object referenced by operand 3 of the constraint.

setup_std_part_dependencies

protected void setup_std_part_dependencies(interactor for_obj,
                                           byte part_code)
Establish the external dependencies for a particular standard part reference.

Parameters:
interactor - for_obj the object depended upon.
byte - part_code the code of the part within that object we are dependent upon. Note: this should include the IS_HORIZ bit as used in op*_std_part.

setup_op_dependencies

protected void setup_op_dependencies(byte op_std_part,
                                     interactor op_obj,
                                     int op_part)
Setup dependencies for a particular operand.

Parameters:
byte - op_std_part the part (or NOT_STANDARD)
interactor - op_obj the object referred to for a non-standard part.
int - op_part the part referred to for a non-standard part.

setup_dependencies

protected void setup_dependencies()
Establish the external dependencies needed for this constraint

fetch_std_part

protected int fetch_std_part(interactor the_obj,
                             int the_part)
Fetch a standard part from the given object.

Parameters:
interactor - the_obj the object we are getting the part from.
int - the_part encoding of the part (including IS_HORIZ bit).
Returns:
int the value of the requested object part.

fetch_part

protected int fetch_part(interactor from_obj,
                         int std_part,
                         int ext_part_num)
Fetch a standard or non-standard part from the given interactor object.

Parameters:
interactor - from_obj object we are getting part value from.
int - std_part encoding for a standard part, or NOT_STANDARD.
int - ext_part number of non-standard part being referred to.
Returns:
int the value of the part.

get_value

public java.lang.Object get_value(int ignored_part_number)
Actually evaluate the constraint. Here the part number is ignored since we only have one exported value.

Parameters:
int - ignored_part_number Ignored.
Overrides:
get_value in class external_constraint