Under Original/Normal_Java/ one would find the original Labyrinth project ported...
[IRC.git] / Robust / src / Benchmarks / Java-Single / Labyrinth / mlp / Normal_Java / Pair.java
1
2
3 public class Pair {
4     public Object first;
5     public Object second;
6
7     public Pair() {
8         first = null;
9         second = null;
10     }
11
12
13 /* =============================================================================
14  * 
15  * pair constructor
16  * 
17  * pair_t* pair_alloc(void* firstPtr, void* secondPtr);
18  * =============================================================================
19  */
20     public static Pair alloc(Object first,Object second)
21     {
22         Pair ptr= new Pair();
23         ptr.first = first;
24         ptr.second = second;
25
26         return ptr;
27     }
28
29
30
31 /* =============================================================================
32  * Ppair_alloc
33  *
34  * -- Returns NULL if failure
35  * =============================================================================
36  */
37   public static Pair Ppair_alloc (Object firstPtr, Object secondPtr) {
38     Pair pairPtr = new Pair();       
39     pairPtr.first = firstPtr;
40     pairPtr.second = secondPtr;
41     return pairPtr;
42   }
43
44
45 /* =============================================================================
46  * pair_free
47  * =============================================================================
48  *
49  *  void pair_free (pair_t* pairPtr);
50  *
51  */
52     public static void free(Pair pairPtr)
53     {
54         pairPtr = null;
55     }
56
57
58 /* =============================================================================
59  * Ppair_free
60  * =============================================================================
61  *
62 void Ppair_free (pair_t* pairPtr);
63 */
64
65 /* =============================================================================
66  * pair_swap
67  * -- Exchange 'firstPtr' and 'secondPtr'
68  * =============================================================================
69  * void pair_swap (pair_t* pairPtr);
70 */
71     public static void swap(Pair pairPtr)
72     {
73         Object tmpPtr = pairPtr.first;
74
75         pairPtr.first = pairPtr.second;
76         pairPtr.second = tmpPtr;
77     }
78
79 }    
80
81 /* =============================================================================
82  *
83  * End of pair.java
84  *
85  * =============================================================================
86  */