]> gerrit.simantics Code Review - simantics/platform.git/blob - bundles/org.simantics.scl.runtime/src/org/simantics/scl/runtime/tuple/Tuple3.java
Fixed multiple issues causing dangling references to discarded queries
[simantics/platform.git] / bundles / org.simantics.scl.runtime / src / org / simantics / scl / runtime / tuple / Tuple3.java
1 /**
2  * This code is generated in org.simantics.scl.runtime.generation.GenerateTuples.
3  * Do not edit manually!
4  */
5 package org.simantics.scl.runtime.tuple;
6
7 public class Tuple3 implements Tuple {
8     public final Object c0;
9     public final Object c1;
10     public final Object c2;
11
12     public Tuple3(Object c0, Object c1, Object c2) {
13         this.c0 = c0;
14         this.c1 = c1;
15         this.c2 = c2;
16     }
17
18     public int length() {
19         return 3;
20     }
21
22     public Object get(int id) {
23         switch(id) {
24         case 0: return c0;
25         case 1: return c1;
26         case 2: return c2;
27         default: throw new IndexOutOfBoundsException();
28         }
29     }
30
31     public Object[] toArray() {
32         return new Object[] { c0, c1, c2 };
33     }
34
35     @Override
36     public boolean equals(Object obj) {
37         if(obj == this)
38             return true;
39         if(obj == null || obj.getClass() != getClass())
40             return false;
41         Tuple3 tuple = (Tuple3)obj;
42         if(c0 == null) {
43             if(tuple.c0 != null)
44                 return false;
45         }
46         else if(!c0.equals(tuple.c0))
47             return false;
48         if(c1 == null) {
49             if(tuple.c1 != null)
50                 return false;
51         }
52         else if(!c1.equals(tuple.c1))
53             return false;
54         if(c2 == null) {
55             if(tuple.c2 != null)
56                 return false;
57         }
58         else if(!c2.equals(tuple.c2))
59             return false;
60         return true;
61     }
62
63     @Override
64     public int hashCode() {
65         int result = c0 == null ? 0 : c0.hashCode();
66         result *= 31;
67         if(c1 != null)
68             result += c1.hashCode();
69         result *= 31;
70         if(c2 != null)
71             result += c2.hashCode();
72         return result;
73     }
74
75     @Override
76     public String toString() {
77         StringBuilder b = new StringBuilder();
78         b.append('(');
79         b.append(c0);
80         b.append(',');
81         b.append(c1);
82         b.append(',');
83         b.append(c2);
84         b.append(')');
85         return b.toString();
86     }
87 }