KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > de > uka > ipd > coverage > natures > all_uses > PhiFunction


1 /*
2  * Created on Sep 14, 2004
3  * @author Matthias Kempka
4  */

5 package de.uka.ipd.coverage.natures.all_uses;
6
7 import java.util.ArrayList JavaDoc;
8 import java.util.List JavaDoc;
9
10 import org.apache.bcel.classfile.ConstantPool;
11
12 /**
13  * @author Matthias Kempka
14  *
15  */

16 class PhiFunction extends PhiDashFunction {
17
18     private List JavaDoc predecessorsIndizes = new ArrayList JavaDoc();
19     // the local variable this phi function redirects to
20

21     /**
22      *
23      * @param originalIndex the index the replaced local variable had.
24      */

25     public PhiFunction(int originalIndex) {
26         super(originalIndex);
27     }
28     
29     /**
30      * @param original a PhiDashFunction that shall be converted to a
31      * PhiFunction
32      */

33     public PhiFunction(PhiDashFunction original) {
34         super(original.getOriginalIndex());
35         setVariable(original.getLocalVariable());
36     }
37     
38     /**
39      * @param index the index a predecessor knows the referenced local
40      * variable as.
41      */

42     public void addPredecessorIndex(int index) {
43         Integer JavaDoc newIndex = new Integer JavaDoc(index);
44         if (!predecessorsIndizes.contains(newIndex)) {
45             this.predecessorsIndizes.add(newIndex);
46         }
47     }
48     
49     public Integer JavaDoc[] getPredecessorIndices() {
50         return (Integer JavaDoc[]) predecessorsIndizes.toArray(
51                 new Integer JavaDoc[predecessorsIndizes.size()]);
52     }
53     /* (non-Javadoc)
54      * @see org.apache.bcel.generic.Instruction#toString()
55      */

56     public String JavaDoc toString() {
57         return "implement me: PhiFunction.toString()"; //$NON-NLS-1$
58
}
59
60
61     public String JavaDoc toString(ConstantPool arg0) {
62         return "implement me: PhiFunction.toString()"; //$NON-NLS-1$
63
}
64 }
65
Popular Tags