--- /dev/null
+package fi.vtt.simantics.procore.internal;\r
+\r
+import org.simantics.db.service.ClusterUID;\r
+\r
+final public class Change {\r
+ \r
+ byte op0;\r
+ int key0;\r
+ int key1;\r
+ int key2;\r
+ ClusterUID clusterUID1;\r
+ ClusterUID clusterUID2;\r
+ byte[] lookup1;\r
+ byte[] lookup2;\r
+ byte lookIndex1;\r
+ byte lookIndex2;\r
+ int lastArg = 0;\r
+\r
+ @Override\r
+ public String toString() {\r
+ return "Change " + (key0&0xffff) + " " + (key1&0xffff) + " " + (key2&0xffff) + " " + clusterUID2 + " " + clusterUID2;\r
+ }\r
+ \r
+ public final void init() {\r
+ lastArg = 0;\r
+ }\r
+\r
+ public final void initValue() {\r
+ lastArg = 0;\r
+ }\r
+\r
+ final void addStatementIndex0(int key, byte op) {\r
+ assert (op != 0);\r
+ key0 = key;\r
+ op0 = op;\r
+ }\r
+\r
+ final void addStatementIndex1(int key, ClusterUID clusterUID, byte lookIndex, byte[] lookup) {\r
+ key1 = key;\r
+ clusterUID1 = clusterUID;\r
+ lookIndex1 = lookIndex;\r
+ lookup1 = lookup;\r
+// if(lookIndex > 0)\r
+// System.err.println("statementIndex1 " + pos + " " + lookIndex);\r
+ }\r
+\r
+ final void addStatementIndex2(int key, ClusterUID clusterUID, byte lookIndex, byte[] lookup) {\r
+ key2 = key;\r
+ clusterUID2 = clusterUID;\r
+ lookIndex2 = lookIndex;\r
+ lookup2 = lookup;\r
+ }\r
+\r
+ final void addStatementIndex(int key, ClusterUID clusterUID, byte op) {\r
+\r
+ // new Exception("lastArg=" + lastArg).printStackTrace();\r
+\r
+ assert (lastArg < 3);\r
+\r
+ if (0 == lastArg)\r
+ addStatementIndex0(key, op);\r
+ else if (1 == lastArg)\r
+ addStatementIndex1(key, clusterUID, (byte)0, null);\r
+ else if (2 == lastArg)\r
+ addStatementIndex2(key, clusterUID, (byte)0, null);\r
+\r
+ lastArg++;\r
+\r
+ }\r
+}\r