Difference (final Proto past) { final ProtoMember m = (ProtoMember)past; final Difference diff = super.difference(past); int base = diff.base(); if (!m.myType.equals(myType)) { base |= Difference.TYPE; } switch ((myValue == null ? 0 : 1) + (m.myValue == null ? 0 : 2)) { case 3: if (!myValue.equals(m.myValue)) { base |= Difference.VALUE; } break; case 2: base |= Difference.VALUE; break; case 1: base |= Difference.VALUE; break; case 0: break; } final int newBase = base; return new DifferenceImpl(diff) { @Override public int base() { return newBase; } @Override public boolean no() { return newBase == NONE && super.no(); } @Override public boolean hadValue() { return ((ProtoMember)past).hasValue(); } }; }