1 package org.simantics.acorn.internal;
4 public class ClusterChange2 {
5 public static final int VERSION = 2;
6 public static final byte SET_IMMUTABLE_OPERATION = 1; // <byte : 0 = false>
7 public static final byte UNDO_VALUE_OPERATION = 2; // <int : resource index>
8 private static final int INCREMENT = 1<<10;
9 // private boolean dirty = false;
10 // private byte[] bytes;
11 // private int byteIndex;
12 // private ClusterUID clusterUID;
13 // private ClusterImpl cluster;
14 // ClusterChange2(ClusterUID clusterUID, ClusterImpl cluster) {
15 // this.clusterUID = clusterUID;
16 // this.cluster = cluster;
20 //// System.err.println("clusterChange2 dirty " + cluster.clusterId);
22 // bytes = new byte[INCREMENT];
24 // addInt(0); // Size of byte vector. Set by flush.
26 // byteIndex = clusterUID.toByte(bytes, 8);
28 // boolean isDirty() {
31 // void flush(GraphSession graphSession) {
32 //// System.err.println("flush2 clusterChange2 " + dirty + this);
35 // Bytes.writeLE(bytes, 0, byteIndex - 4);
36 // byte[] ops = Arrays.copyOf(bytes, byteIndex);
37 //// System.err.println("flush2 clusterChange2 " + cluster.clusterId + " " + ops.length + " bytes.");
38 // graphSession.updateCluster(new UpdateClusterFunction(ops));
41 // void setImmutable(boolean immutable) {
43 // addByte(SET_IMMUTABLE_OPERATION);
44 // addByte((byte)(immutable ? -1 : 0));
46 // void undoValueEx(int resourceIndex) {
48 // addByte(UNDO_VALUE_OPERATION);
49 // addInt(resourceIndex);
51 // private final void checkSpace(int len) {
52 // if (bytes.length - byteIndex > len)
54 // bytes = Arrays.copyOf(bytes, bytes.length + len + INCREMENT);
56 // private final void addByte(byte value) {
58 // bytes[byteIndex++] = value;
60 // private final void addInt(int value) {
62 // Bytes.writeLE(bytes, byteIndex, value);
65 //// private void addLong(long value) {
67 //// Bytes.writeLE(bytes, byteIndex, value);