Files
openide/java/java-tests/testData/refactoring/inlineObject/InlineBitString.java.after
Tagir Valeev c57a3e9f2a IDEA-225778 Inline object with the subsequent call
GitOrigin-RevId: 122e10e69f93c31e289a024381c7315f1a62203b
2019-11-07 02:40:58 +00:00

27 lines
883 B
Plaintext

class Main {
BitString test(long result, long mask) {
BitString intersection = null;
BitString other = super.getBitwiseMask();
long intersectMask = mask & other.myMask;
if ((result & mask & intersectMask) == (other.myBits & intersectMask)) {
intersection = new BitString(result & mask | other.myBits, mask | other.myMask);
}
assert intersection != null;
return intersection;
}
}
class BitString {
final long myBits;
final long myMask;
BitString(long bits, long mask) {
myBits = bits & mask;
myMask = mask;
}
BitString intersect(BitString other) {
long intersectMask = myMask & other.myMask;
if ((myBits & intersectMask) != (other.myBits & intersectMask)) return null;
return new BitString(myBits | other.myBits, myMask | other.myMask);
}
}