X-Git-Url: https://gerrit.simantics.org/r/gitweb?p=simantics%2Fplatform.git;a=blobdiff_plain;f=bundles%2Forg.simantics.scl.runtime%2Fsrc%2Forg%2Fsimantics%2Fscl%2Fruntime%2Feither%2FLeft.java;fp=bundles%2Forg.simantics.scl.runtime%2Fsrc%2Forg%2Fsimantics%2Fscl%2Fruntime%2Feither%2FLeft.java;h=1e0c29b1fde0449879333936297817e247a4cb45;hp=0000000000000000000000000000000000000000;hb=5b1f5568f25146b397bcdb7b570ddad74246969f;hpb=564cbf99b9cc2cd4ce3a645c206c9742d8123035 diff --git a/bundles/org.simantics.scl.runtime/src/org/simantics/scl/runtime/either/Left.java b/bundles/org.simantics.scl.runtime/src/org/simantics/scl/runtime/either/Left.java new file mode 100644 index 000000000..1e0c29b1f --- /dev/null +++ b/bundles/org.simantics.scl.runtime/src/org/simantics/scl/runtime/either/Left.java @@ -0,0 +1,29 @@ +package org.simantics.scl.runtime.either; + +public class Left implements Either { + public final Object value; + + public Left(Object value) { + this.value = value; + } + + @Override + public String toString() { + return "Left " + value; + } + + @Override + public boolean equals(Object obj) { + if(this == obj) + return true; + if(obj == null || obj.getClass() != getClass()) + return false; + Right other = (Right)obj; + return value == null ? other.value == null : value.equals(other.value); + } + + @Override + public int hashCode() { + return 31 * (value == null ? 0 : value.hashCode()) + 13532; + } +}