Added MSB first versions of parse() and toString()
[Mograsim.git] / net.mograsim.logic.core / src / net / mograsim / logic / core / types / Bit.java
index fbfd0d5..4fce8dd 100644 (file)
@@ -18,6 +18,11 @@ public enum Bit implements StrictLogicType<Bit>
                this.symbol = symbol;
        }
 
+       public boolean isBinary()
+       {
+               return this == ONE || this == ZERO;
+       }
+
        @Override
        public Bit and(Bit other)
        {
@@ -81,6 +86,11 @@ public enum Bit implements StrictLogicType<Bit>
                return symbol;
        }
 
+       public static Bit lastBitOf(int value)
+       {
+               return values()[2 + (value & 1)];
+       }
+
        public static Bit parse(String s)
        {
                Bit bit = SYMBOL_MAP.get(s);