1 package org.simantics.scl.compiler.types.util;
10 private Polarity(String symbol) {
14 private final String symbol;
15 private Polarity flipped;
16 private Polarity[] combi = new Polarity[4];
19 for(int ia=0;ia<4;++ia) {
20 Polarity a = values()[ia];
21 a.flipped = values()[ ((ia&1)<<1) | ((ia&2)>>1) ];
22 for(int ib=0;ib<4;++ib) {
23 a.combi[ib] = values()[ia | ib];
28 public Polarity flip() {
32 public Polarity add(Polarity other) {
33 return combi[other.ordinal()];
36 public String getSymbol() {
40 public boolean isPositive() {
41 return (ordinal()&1) != 0;
44 public boolean isNegative() {
45 return (ordinal()&2) != 0;