restore copyState method to IVariable with appropriate f-bounded type hackery to get the right argument types in implementors

git-svn-id: https://wala.svn.sourceforge.net/svnroot/wala/trunk@1766 f5eafffb-2e1d-0410-98e4-8ec43c5233c4
This commit is contained in:
dolby-oss 2007-09-18 16:27:55 +00:00
parent 10b1ec8b7f
commit 09971d0c20
7 changed files with 17 additions and 10 deletions

View File

@ -14,7 +14,7 @@ import com.ibm.wala.fixedpoint.impl.AbstractVariable;
/**
* A type variable in the dataflow system.
*/
public class TypeVariable extends AbstractVariable {
public class TypeVariable extends AbstractVariable<TypeVariable> {
TypeAbstraction type;

View File

@ -18,7 +18,7 @@ import com.ibm.wala.util.graph.impl.NodeWithNumber;
*
* @author Stephen Fink
*/
public abstract class AbstractVariable extends NodeWithNumber implements IVariable {
public abstract class AbstractVariable<T extends AbstractVariable> extends NodeWithNumber implements IVariable<T> {
private int orderNumber;

View File

@ -23,7 +23,7 @@ import com.ibm.wala.util.intset.MutableSharedBitVectorIntSet;
*
* @author sfink
*/
public class BitVectorVariable extends AbstractVariable {
public class BitVectorVariable extends AbstractVariable<BitVectorVariable> {
private MutableSharedBitVectorIntSet V;
private final int hash;

View File

@ -18,7 +18,7 @@ import com.ibm.wala.fixedpoint.impl.AbstractVariable;
*
* @author sfink
*/
public class BooleanVariable extends AbstractVariable {
public class BooleanVariable extends AbstractVariable<BooleanVariable> {
private boolean B;

View File

@ -19,7 +19,7 @@ import com.ibm.wala.util.graph.INodeWithNumber;
*
* @author Stephen Fink
*/
public interface IVariable extends INodeWithNumber {
public interface IVariable<T extends IVariable> extends INodeWithNumber {
/**
@ -44,4 +44,11 @@ public interface IVariable extends INodeWithNumber {
*/
public abstract void setOrderNumber(int i);
/**
* Set this variable to have the same state as another one
*
* @param v
*/
public void copyState(T v);
}

View File

@ -24,11 +24,11 @@ import com.ibm.wala.util.intset.MutableIntSet;
*
* @author sfink
*/
public abstract class IntSetVariable extends AbstractVariable {
public abstract class IntSetVariable<T extends IntSetVariable> extends AbstractVariable<T> {
private MutableIntSet V;
public void copyState(IntSetVariable other) {
public void copyState(T other) {
if (V == null) {
if (other.V == null) {
return;
@ -64,7 +64,7 @@ public abstract class IntSetVariable extends AbstractVariable {
*
* @return true iff the contents of this variable changes.
*/
public boolean addAll(IntSetVariable other) {
public boolean addAll(T other) {
if (V == null) {
copyState(other);
return (V != null);
@ -157,7 +157,7 @@ public abstract class IntSetVariable extends AbstractVariable {
return V.containsAny(instances);
}
public boolean addAllInIntersection(IntSetVariable other, IntSet filter) {
public boolean addAllInIntersection(T other, IntSet filter) {
if (V == null) {
copyState(other);
if (V != null) {

View File

@ -17,7 +17,7 @@ import com.ibm.wala.util.debug.Assertions;
* @author sfink
*
*/
public class PointsToSetVariable extends IntSetVariable {
public class PointsToSetVariable extends IntSetVariable<PointsToSetVariable> {
private PointerKey pointerKey;
public PointsToSetVariable(PointerKey key) {