explicit cast in InSetVariable - removes compiler error

This commit is contained in:
Juergen Graf 2012-11-22 14:02:13 +01:00
parent 6990401629
commit bb6d890976
1 changed files with 18 additions and 11 deletions

View File

@ -25,16 +25,17 @@ public abstract class IntSetVariable<T extends IntSetVariable> extends AbstractV
private MutableIntSet V; private MutableIntSet V;
public void copyState(T other) { public void copyState(T other) {
final IntSetVariable<?> isv = (IntSetVariable<?>) other;
if (V == null) { if (V == null) {
if (other.V == null) { if (isv.V == null) {
return; return;
} else { } else {
V = IntSetUtil.getDefaultIntSetFactory().makeCopy(other.V); V = IntSetUtil.getDefaultIntSetFactory().makeCopy(isv.V);
return; return;
} }
} else { } else {
if (other.V != null) { if (isv.V != null) {
V.copySet(other.V); V.copySet(isv.V);
} }
} }
} }
@ -60,12 +61,14 @@ public abstract class IntSetVariable<T extends IntSetVariable> extends AbstractV
* @return true iff the contents of this variable changes. * @return true iff the contents of this variable changes.
*/ */
public boolean addAll(T other) { public boolean addAll(T other) {
final IntSetVariable<?> isv = (IntSetVariable<?>) other;
if (V == null) { if (V == null) {
copyState(other); copyState(other);
return (V != null); return (V != null);
} else { } else {
if (other.V != null) { if (isv.V != null) {
boolean result = addAll(other.V); boolean result = addAll(isv.V);
return result; return result;
} else { } else {
return false; return false;
@ -74,13 +77,15 @@ public abstract class IntSetVariable<T extends IntSetVariable> extends AbstractV
} }
public boolean sameValue(IntSetVariable other) { public boolean sameValue(IntSetVariable other) {
final IntSetVariable<?> isv = (IntSetVariable<?>) other;
if (V == null) { if (V == null) {
return (other.V == null); return (isv.V == null);
} else { } else {
if (other.V == null) { if (isv.V == null) {
return false; return false;
} else { } else {
return V.sameValue(other.V); return V.sameValue(isv.V);
} }
} }
} }
@ -153,8 +158,10 @@ public abstract class IntSetVariable<T extends IntSetVariable> extends AbstractV
} }
return (V != null); return (V != null);
} else { } else {
if (other.V != null) { final IntSetVariable<?> isv = (IntSetVariable<?>) other;
boolean result = addAllInIntersection(other.V, filter);
if (isv.V != null) {
boolean result = addAllInIntersection(isv.V, filter);
return result; return result;
} else { } else {
return false; return false;