X-Git-Url: https://gerrit.simantics.org/r/gitweb?p=simantics%2Fplatform.git;a=blobdiff_plain;f=bundles%2Forg.simantics.db.procore%2Fsrc%2Ffi%2Fvtt%2Fsimantics%2Fprocore%2Finternal%2FClusterChange.java;h=880bfd00d3e88a225ae10130978cde4f43b5bf76;hp=1a264dc515d5329d22ec1f285f1043cf08771d1a;hb=4aba159170fc72d39c2f930ea224aa71f4cdc2e7;hpb=0ae2b770234dfc3cbb18bd38f324125cf0faca07 diff --git a/bundles/org.simantics.db.procore/src/fi/vtt/simantics/procore/internal/ClusterChange.java b/bundles/org.simantics.db.procore/src/fi/vtt/simantics/procore/internal/ClusterChange.java index 1a264dc51..880bfd00d 100644 --- a/bundles/org.simantics.db.procore/src/fi/vtt/simantics/procore/internal/ClusterChange.java +++ b/bundles/org.simantics.db.procore/src/fi/vtt/simantics/procore/internal/ClusterChange.java @@ -54,7 +54,9 @@ public final class ClusterChange { public ClusterImpl clusterImpl; public ClusterChange(ClusterStream clusterStream, ClusterImpl clusterImpl) { + this.clusterImpl = clusterImpl; + clusterUID = clusterImpl.getClusterUID(); long[] longs = new long[ClusterUID.getLongLength()]; clusterUID.toLong(longs, 0); @@ -69,9 +71,13 @@ public final class ClusterChange { Bytes.writeLE(header, offset, longs[i]); //initBuffer(); this.clusterStream = clusterStream; - this.clusterChange2 = new ClusterChange2(clusterUID, clusterImpl); + this.clusterChange2 = new ClusterChange2(clusterUID); clusterStream.changes.add(this); } + + public void adopt(ClusterImpl impl) { + this.clusterImpl = impl; + } private void setHeaderVectorSize(int size) { if (size < 0) @@ -81,7 +87,7 @@ public final class ClusterChange { } @Override public String toString() { - return super.toString() + " cluster=" + clusterImpl.getClusterUID() + " id=" + clusterImpl.getClusterId() + " off=" + byteIndex; + return super.toString() + " cluster=" + clusterUID + " id=" + clusterImpl.getClusterId() + " off=" + byteIndex; } private final void initBuffer() { flushed = false; @@ -195,8 +201,8 @@ public final class ClusterChange { } if (0 != foreign) { if (foreign > 256) - throw new RuntimeDatabaseException("Internal error, contact application support." + - "Too big foreing index=" + foreign + " max=256"); + throw new RuntimeDatabaseException("Internal error." + + "Too big foreign index=" + foreign + " max=256"); --foreign; bytes[byteIndex++] = foreign; return ClusterEnum.ForeignShort; @@ -208,8 +214,8 @@ public final class ClusterChange { if (DEBUG_STAT) info.sForeign = foreignTable.size(); if (clusterUID.equals(ClusterUID.Null)) - throw new RuntimeDatabaseException("Internal error, contact application support." + - "Cluster unique id not defined for foreing cluster."); + throw new RuntimeDatabaseException("Internal error." + + "Cluster unique id not defined for foreign cluster."); addForeignLong(resourceIndex, clusterUID); return ClusterEnum.ForeignLong; }