added test files
[IRC.git] / Robust / src / Tests / Prefetch / FieldPointer.java
diff --git a/Robust/src/Tests/Prefetch/FieldPointer.java b/Robust/src/Tests/Prefetch/FieldPointer.java
new file mode 100644 (file)
index 0000000..c490f03
--- /dev/null
@@ -0,0 +1,46 @@
+public class FieldPointer {
+       Account x;
+       public FieldPointer() {
+       }
+
+       public static void main(String[] args) {
+               int bal;
+               FieldPointer fp = new FieldPointer();
+               fp.x = new Account();
+               fp.x.name = new String("TestAccount");
+               fp.x.accountid = new Integer(12345);
+               fp.x.balance = new Item();
+               fp.x.balance.i = new Integer(11000);
+               bal = fp.getBalance(fp.x.accountid);
+               if(bal < 7500) 
+                       bal = bal + fp.x.getBalance().intValue();
+               else 
+                       bal = fp.x.getBalance().intValue();
+               System.printInt(bal);
+       }
+
+       public int getBalance(Integer accountid) {
+               if(accountid.intValue() > 12000) {
+                       return 10000;
+               } else {
+                       return 5000;
+               }
+       }
+}
+
+public class Account {
+       String name;
+       Integer accountid;
+       Item balance;
+       public Account() {
+       }
+       public Integer getBalance() {
+               return balance.i;
+       }
+}
+
+public class Item {
+       Integer i;
+       public Item() {
+       }
+}