sub_arctic.constraints
Class linear_ext_constraint

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

public class linear_ext_constraint
extends external_constraint

An external (heavyweight) constraint for computing a linear value (A*x + B for two fixed values A and B and one variable x). This class provides an example of how to do a stand-alone external constraint.


Field Summary
protected  int _A
          "A" coefficient in A*x+B equation.
protected  int _B
          "B" coefficient in A*x+B equation.
protected  provider_part_ref _target
          Provider part that gives the value we compute from
 
Fields inherited from class sub_arctic.constraints.external_constraint
_doing_ood, _notify_list
 
Constructor Summary
linear_ext_constraint(int a, int b, value_provider v_obj, int v_part)
          Constructor.
 
Method Summary
 int A()
          "A" coefficient in A*x+B equation.
 int B()
          "B" coefficient in A*x+B equation.
 void finalize()
          Finalize by cutting off from any target
 java.lang.Object get_value(int part_number)
          Compute our value as A*x+B where is x is an integer obtained from our target provider part.
 void set_A(int v)
          Set the "A" coefficient in A*x+B equation.
 void set_B(int v)
          Set the "B" coefficient in A*x+B equation.
 void set_target(provider_part_ref targ)
          Set the provider part that gives the value we compute from
 provider_part_ref target()
          Provider part that gives the value we compute from
 
Methods inherited from class sub_arctic.constraints.external_constraint
attach_dependent, detach_dependent, value_ood
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

_A

protected int _A
"A" coefficient in A*x+B equation.

_B

protected int _B
"B" coefficient in A*x+B equation.

_target

protected provider_part_ref _target
Provider part that gives the value we compute from
Constructor Detail

linear_ext_constraint

public linear_ext_constraint(int a,
                             int b,
                             value_provider v_obj,
                             int v_part)
Constructor.
Parameters:
int - a the A value in A*x+B.
int - b the B value in A*x+B.
value_provider - v_obj the object we obtain the x value from in A*x+B.
int - v_part the part number of the above object that we obtain the x value from in A*x+B.
Method Detail

A

public int A()
"A" coefficient in A*x+B equation.

set_A

public void set_A(int v)
Set the "A" coefficient in A*x+B equation.

B

public int B()
"B" coefficient in A*x+B equation.

set_B

public void set_B(int v)
Set the "B" coefficient in A*x+B equation.

target

public provider_part_ref target()
Provider part that gives the value we compute from

set_target

public void set_target(provider_part_ref targ)
Set the provider part that gives the value we compute from

finalize

public void finalize()
Finalize by cutting off from any target
Overrides:
finalize in class java.lang.Object

get_value

public java.lang.Object get_value(int part_number)
Compute our value as A*x+B where is x is an integer obtained from our target provider part. Here part_number is ignored since we only provide one value.

Parameters:
int - part_number the part number of the value being requested from us. Since we have only one part we ignore this.
Returns:
Object an Integer value providing the result.
Overrides:
get_value in class external_constraint