1 package edu.uci.ics.jung.graph.util;
2
3
4
5
6
7 public class Context<G,E>
8 {
9 @SuppressWarnings("rawtypes")
10 private static Context instance = new Context();
11
12
13
14
15 public G graph;
16
17
18
19
20 public E element;
21
22
23
24
25
26
27
28
29 @SuppressWarnings("unchecked")
30 public static <G,E> Context<G,E> getInstance(G graph, E element) {
31 instance.graph = graph;
32 instance.element = element;
33 return instance;
34 }
35
36 @Override
37 public int hashCode() {
38 return graph.hashCode() ^ element.hashCode();
39 }
40
41 @SuppressWarnings("rawtypes")
42 @Override
43 public boolean equals(Object o) {
44 if (!(o instanceof Context))
45 return false;
46 Context context = (Context) o;
47 return context.graph.equals(graph) && context.element.equals(element);
48 }
49 }
50