KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > prefuse > util > force > Force


1 package prefuse.util.force;
2
3 /**
4  * Interface for force functions in a force simulation.
5  *
6  * @author <a HREF="http://jheer.org">jeffrey heer</a>
7  */

8 public interface Force {
9
10     /**
11      * Initialize this force function.
12      * @param fsim the encompassing ForceSimulator
13      */

14     public void init(ForceSimulator fsim);
15
16     /**
17      * Returns the number of parameters (e.g., gravitational constant or
18      * spring force coefficient) affecting this force function.
19      * @return the number of parameters
20      */

21     public int getParameterCount();
22
23     /**
24      * Returns the specified, numbered parameter.
25      * @param i the index of the parameter to return
26      * @return the parameter value
27      */

28     public float getParameter(int i);
29     
30     /**
31      * Get the suggested minimum value for a parameter. This value is not
32      * strictly enforced, but is used by interface components that allow force
33      * parameters to be varied.
34      * @param param the parameter index
35      * @return the suggested minimum value.
36      */

37     public float getMinValue(int param);
38     
39     /**
40      * Get the suggested maximum value for a parameter. This value is not
41      * strictly enforced, but is used by interface components that allow force
42      * parameters to be varied.
43      * @param param the parameter index
44      * @return the suggested maximum value.
45      */

46     public float getMaxValue(int param);
47     
48     /**
49      * Gets the text name of the requested parameter.
50      * @param i the index of the parameter
51      * @return a String containing the name of this parameter
52      */

53     public String JavaDoc getParameterName(int i);
54
55     /**
56      * Sets the specified parameter value.
57      * @param i the index of the parameter
58      * @param val the new value of the parameter
59      */

60     public void setParameter(int i, float val);
61     
62     /**
63      * Set the suggested minimum value for a parameter. This value is not
64      * strictly enforced, but is used by interface components that allow force
65      * parameters to be varied.
66      * @param i the parameter index
67      * @param val the suggested minimum value to use
68      */

69     public void setMinValue(int i, float val);
70     
71     /**
72      * Set the suggested maximum value for a parameter. This value is not
73      * strictly enforced, but is used by interface components that allow force
74      * parameters to be varied.
75      * @param i the parameter index
76      * @return the suggested maximum value to use
77      */

78     public void setMaxValue(int i, float val);
79     
80     /**
81      * Indicates if this force function will compute forces
82      * on Spring instances.
83      * @return true if this force function processes Spring instances
84      */

85     public boolean isSpringForce();
86     
87     /**
88      * Indicates if this force function will compute forces
89      * on ForceItem instances
90      * @return true if this force function processes Force instances
91      */

92     public boolean isItemForce();
93     
94     /**
95      * Updates the force calculation on the given ForceItem
96      * @param item the ForceItem on which to compute updated forces
97      */

98     public void getForce(ForceItem item);
99     
100     /**
101      * Updates the force calculation on the given Spring. The ForceItems
102      * attached to Spring will have their force values updated appropriately.
103      * @param spring the Spring on which to compute updated forces
104      */

105     public void getForce(Spring spring);
106     
107 } // end of interface Force
108
Popular Tags