review cleanup

This commit is contained in:
Alexey Kudravtsev
2013-04-19 12:43:55 +04:00
parent 6edb04da9c
commit 1f50732825
4 changed files with 7 additions and 5 deletions
@@ -51,7 +51,7 @@ public abstract class IntervalTreeImpl<T extends MutableInterval> extends RedBla
protected static class IntervalNode<E extends MutableInterval> extends RedBlackTree.Node<E> implements MutableInterval {
private volatile int myStart;
private volatile int myEnd;
private static final int ATTACHED_TO_TREE_FLAG = 2; // true if the node is inserted to the tree
private static final int ATTACHED_TO_TREE_FLAG = COLOR_FLAG+1; // true if the node is inserted to the tree
protected final List<Getter<E>> intervals;
protected int maxEnd; // max of all intervalEnd()s among all children.
protected int delta; // delta of startOffset. getStartOffset() = myStartOffset + Sum of deltas up to root
@@ -268,7 +268,7 @@ public abstract class IntervalTreeImpl<T extends MutableInterval> extends RedBla
return myEnd = end;
}
private static final int VALID_FLAG = 1;
protected static final int VALID_FLAG = ATTACHED_TO_TREE_FLAG + 1;
@Override
public boolean isValid() {
return isFlagSet(VALID_FLAG);
@@ -151,8 +151,8 @@ public class RangeMarkerTree<T extends RangeMarkerEx> extends IntervalTreeImpl<T
}
static class RMNode<T extends RangeMarkerEx> extends IntervalTreeImpl.IntervalNode<T> {
private static final int EXPAND_TO_LEFT_FLAG = 3;
private static final int EXPAND_TO_RIGHT_FLAG = 4;
private static final int EXPAND_TO_LEFT_FLAG = VALID_FLAG+1;
private static final int EXPAND_TO_RIGHT_FLAG = EXPAND_TO_LEFT_FLAG+1;
public RMNode(@NotNull RangeMarkerTree<T> rangeMarkerTree,
@NotNull T key,
@@ -299,7 +299,7 @@ public abstract class RedBlackTree<K> {
protected Node<K> parent = null;
private volatile byte myFlags;
private static final int COLOR_FLAG = 0;
protected static final int COLOR_FLAG = 0;
protected boolean isFlagSet(int flag) {
int state = myFlags >> flag;
@@ -307,6 +307,7 @@ public abstract class RedBlackTree<K> {
}
protected void setFlag(int flag, boolean value) {
assert flag < 8;
int state = value ? 1 : 0;
myFlags = (byte)(myFlags & ~(1 << flag) | state << flag);
}
@@ -71,6 +71,7 @@ abstract class RangeHighlighterData {
}
private void setFlag(@FlagConstant int flag, boolean value) {
assert flag < 8;
int state = value ? 1 : 0;
myFlags = (byte)(myFlags & ~(1 << flag) | state << flag);
}