KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > propagation > PropagationRule


1 package propagation;
2
3 /**
4  * The <code>PropagationRule</code> interface is a summary and propagation
5  * logic.<br />
6  * This interface's user creates it's instance and sets it to <code>Node</code>
7  * objects. The <code>PropagationRule</code> interface don't have states
8  * (logic only). So, you have only to create one instance and set to any
9  * <code>Node</code>s which you want to use.
10  *
11  * @author y-komori
12  */

13 public interface PropagationRule {
14    /**
15     * A constant for summary state. It represents the node is not failed.
16     */

17    public static final long STATE_CLEAR = 2000;
18
19    /**
20     * Changes the specified <code>Node</code>'s <code>StateItem</code> to
21     * the specified state.
22     * When the specified <code>StateItem</code>'s state is changed,
23     * calculates and propagates the node's summary state using
24     * <code>summaryUpperPropagate</code> method.
25     *
26     * @param node the node to change state
27     * @param itemId the <code>StateItem</code>'s item ID to change state
28     * @param state a new state
29     * @see PropagationRule#summaryUpperPropagate(Node)
30     */

31    public void changeState(Node node, long itemId, long state);
32
33    /**
34     * Calculates the specified <code>Node</code>'s summary state and
35     * propagates to it's parent nodes.
36     * This method calculates the specified <code>Node</code>'s summary state
37     * from it's <code>StateItem</code>s and child <code>Node</code>'s
38     * summary.<br />
39     * As a result of summary calculation, when the specified node's summary is
40     * changed, propagates it's summary state to parent and upper nodes calling
41     * their <code>PropagationRule</code>'s <code>changeState</code>
42     * method.
43     *
44     * @param node the node to calculate it's summary state
45     */

46    public void summaryUpperPropagate(Node node);
47 }
48
Popular Tags