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%2FOperationImpl.java;h=43b150508267dceec019ec2d9d14a50a6ce626a2;hp=90b4f74e64a367929f5943299033a51855e3ae73;hb=62201fffbf97905cd7cce3b68458f519a64a26d3;hpb=969bd23cab98a79ca9101af33334000879fb60c5 diff --git a/bundles/org.simantics.db.procore/src/fi/vtt/simantics/procore/internal/OperationImpl.java b/bundles/org.simantics.db.procore/src/fi/vtt/simantics/procore/internal/OperationImpl.java index 90b4f74e6..43b150508 100644 --- a/bundles/org.simantics.db.procore/src/fi/vtt/simantics/procore/internal/OperationImpl.java +++ b/bundles/org.simantics.db.procore/src/fi/vtt/simantics/procore/internal/OperationImpl.java @@ -1,70 +1,70 @@ -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 externals; - OperationImpl(long id, long csid) { - this(id, csid, null); - } - OperationImpl(long id, long csid, List 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 getOperations() { - - if(combined == null) return Collections.singletonList(this); - - ArrayList result = new ArrayList(); - OperationImpl current = this; - while(current != null) { - result.add(current); - current = (OperationImpl)(current.combined); - } - - Collections.reverse(result); - - return result; - - } - - @Override - public Collection getExternalOperations() { - if(externals == null) - return Collections.emptyList(); - else - return externals; - } - -} +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 externals; + OperationImpl(long id, long csid) { + this(id, csid, null); + } + OperationImpl(long id, long csid, List 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 getOperations() { + + if(combined == null) return Collections.singletonList(this); + + ArrayList result = new ArrayList(); + OperationImpl current = this; + while(current != null) { + result.add(current); + current = (OperationImpl)(current.combined); + } + + Collections.reverse(result); + + return result; + + } + + @Override + public Collection getExternalOperations() { + if(externals == null) + return Collections.emptyList(); + else + return externals; + } + +}