-package fi.vtt.simantics.procore.internal;\r
-\r
-import java.util.ArrayList;\r
-import java.util.Collection;\r
-import java.util.Collections;\r
-import java.util.List;\r
-\r
-import org.simantics.db.Operation;\r
-import org.simantics.db.service.ExternalOperation;\r
-\r
-public class OperationImpl implements Operation {\r
- private final long id;\r
- private final long csid;\r
- private Operation combined;\r
- private final List<ExternalOperation> externals;\r
- OperationImpl(long id, long csid) {\r
- this(id, csid, null);\r
- }\r
- OperationImpl(long id, long csid, List<ExternalOperation> externals) {\r
- this.id = id;\r
- this.csid = csid;\r
- this.combined = null;\r
- this.externals = externals.isEmpty() ? null : externals;\r
- }\r
- @Override\r
- public String toString() {\r
- return "Operation id=" + id + " cs=" + csid + ".";\r
- }\r
- @Override\r
- public long getId() {\r
- return id;\r
- }\r
-\r
- @Override\r
- public long getCSId() {\r
- return csid;\r
- }\r
-\r
- @Override\r
- public void combine(Operation operation) {\r
- combined = operation;\r
- }\r
-\r
- @Override\r
- public List<Operation> getOperations() {\r
- \r
- if(combined == null) return Collections.<Operation>singletonList(this);\r
-\r
- ArrayList<Operation> result = new ArrayList<Operation>();\r
- OperationImpl current = this;\r
- while(current != null) {\r
- result.add(current);\r
- current = (OperationImpl)(current.combined);\r
- }\r
- \r
- Collections.reverse(result);\r
- \r
- return result;\r
- \r
- }\r
- \r
- @Override\r
- public Collection<ExternalOperation> getExternalOperations() {\r
- if(externals == null)\r
- return Collections.emptyList();\r
- else\r
- return externals;\r
- }\r
- \r
-}\r
+package fi.vtt.simantics.procore.internal;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.List;
+
+import org.simantics.db.Operation;
+import org.simantics.db.service.ExternalOperation;
+
+public class OperationImpl implements Operation {
+ private final long id;
+ private final long csid;
+ private Operation combined;
+ private final List<ExternalOperation> externals;
+ OperationImpl(long id, long csid) {
+ this(id, csid, null);
+ }
+ OperationImpl(long id, long csid, List<ExternalOperation> externals) {
+ this.id = id;
+ this.csid = csid;
+ this.combined = null;
+ this.externals = externals.isEmpty() ? null : externals;
+ }
+ @Override
+ public String toString() {
+ return "Operation id=" + id + " cs=" + csid + ".";
+ }
+ @Override
+ public long getId() {
+ return id;
+ }
+
+ @Override
+ public long getCSId() {
+ return csid;
+ }
+
+ @Override
+ public void combine(Operation operation) {
+ combined = operation;
+ }
+
+ @Override
+ public List<Operation> getOperations() {
+
+ if(combined == null) return Collections.<Operation>singletonList(this);
+
+ ArrayList<Operation> result = new ArrayList<Operation>();
+ OperationImpl current = this;
+ while(current != null) {
+ result.add(current);
+ current = (OperationImpl)(current.combined);
+ }
+
+ Collections.reverse(result);
+
+ return result;
+
+ }
+
+ @Override
+ public Collection<ExternalOperation> getExternalOperations() {
+ if(externals == null)
+ return Collections.emptyList();
+ else
+ return externals;
+ }
+
+}