+ switch (this)
+ {
+ case ONE:
+ return Bit.ZERO;
+ case ZERO:
+ return Bit.ONE;
+ default:
+ return Bit.X;
+ }
+ }
+
+ /**
+ * Rules for two bits that get directly connected<br>
+ * <code><table>
+ * <tbody>
+ * <tr><td><td>X<td>0<td>1<td>Z</tr>
+ * <tr><td>X<td>X<td>X<td>X<td>X</tr>
+ * <tr><td>0<td>X<td>0<td>X<td>0</tr>
+ * <tr><td>1<td>X<td>X<td>1<td>1</tr>
+ * <tr><td>Z<td>X<td>0<td>1<td>Z</tr>
+ * </tbody>
+ * </table><code>
+ *
+ * @return the result according to the table
+ *
+ * @author Christian Femers
+ */
+ public Bit combineWith(Bit other)
+ {
+ if (this == other)
+ return this;
+ if (this == X || other == X)
+ return X;
+ if (other == Z)
+ return this;
+ if (this == Z)
+ return other;
+ return X;
+ }
+
+ public static Bit combine(Bit a, Bit b)
+ {
+ return a.combineWith(b);