|
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface InteractionRule
Abstract physical interaction, which can be described by Newton's laws. It is supposed that the interaction is fully specified by 3D vector of the force, by which one item (byItem) acts to the other (toItem). So, this interaction does not describe any object rotations: it is applicable only for point or spherical particles.
AlgART Laboratory 2010
Modifier and Type | Method and Description |
---|---|
boolean |
calculateForce(double[] resultXYZ,
Item toItem,
Item byItem,
double time)
Calculates the force F=(Fx,Fy,Fz) of the action of byItem to toItem and returns it in first 3 elements of resultXYZ array (x-component Fx |
boolean |
isApplicable(Item toItem,
Item byItem)
Checks whether this interaction type is applicable to the given items. |
Method Detail |
---|
boolean isApplicable(Item toItem, Item byItem)
calculateForce(double[], Item, Item, double)
method fills its result
(first 3 elements of resultXYZ array) by 0.0.
If this method returns true, then with high probability
calculateForce(double[], Item, Item, double)
method returns a non-zero force.
The arguments of this method can be null; in this case, this method returns false.
toItem
- the item to which byItem acts;
can be null, then this method returns false.byItem
- the acting item; can be null, then this method returns false.boolean calculateForce(double[] resultXYZ, Item toItem, Item byItem, double time)
This method must work correctly (return false and zero resulting force) also in all situations,
when isApplicable(Item, Item)
method returns false.
resultXYZ
- resulting force (x-component in resultXYZ[0],
y-component in resultXYZ[1], z-component in resultXYZ[2]).toItem
- the item to which byItem acts.byItem
- the acting item.time
- the current time (some interaction can change behaviour in time).java.lang.NullPointerException
- if one of the arguments is null.java.lang.IndexOutOfBoundsException
- if result.length<3; it is not checked at the very beginning,
so, in a case of this exception, some elements of result
array can be still filled (the method is non-atomic regarding this failure).
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |