View Javadoc

1   package net.kwfgrid.gworkflowdl.analysis;
2   
3   import java.util.ArrayList;
4   
5   /***
6    * Created by IntelliJ IDEA.
7    * User: hans
8    * Date: 25.10.2005
9    * Time: 14:14:56
10   * To change this template use File | Settings | File Templates.
11   */
12  public class IndexDecision {
13      public int type;
14      public int placeIndex;
15      public ArrayList transitionIndices;
16  
17      public boolean equals(Object object) {
18          IndexDecision id = (IndexDecision) object;
19          if (type != id.type || placeIndex != id.placeIndex) {
20              return false;
21          }
22          if (transitionIndices.size() != id.transitionIndices.size()) {
23              return false;
24          }
25          for (int i = 0; i < transitionIndices.size(); i++) {
26              int a = ((Integer) transitionIndices.get(i)).intValue();
27              int b = ((Integer) id.transitionIndices.get(i)).intValue();
28              if (a != b) {
29                  return false;
30              }
31          }
32          return true;
33      }
34  
35      public int hashCode() {
36          int ret = type + 4711 * placeIndex;
37  
38          for (int i = 0; i < transitionIndices.size(); i++) {
39              int a = ((Integer) transitionIndices.get(i)).intValue();
40              ret += (i+1) * a;
41          }
42          return ret;
43      }
44  }