View Javadoc

1   // ListWrapper.java, created Wed Mar  5  0:26:32 2003 by joewhaley
2   // Copyright (C) 2001-3 John Whaley <jwhaley@alum.mit.edu>
3   // Licensed under the terms of the GNU LGPL; see COPYING for details.
4   package joeq.Util.Templates;
5   
6   /***
7    * @author John Whaley <jwhaley@alum.mit.edu>
8    * @version $Id: ListWrapper.java 1456 2004-03-09 22:01:46Z jwhaley $
9    */
10  public abstract class ListWrapper {
11          
12      public static class BasicBlock extends java.util.AbstractList implements List.BasicBlock {
13          private final java.util.List/*<joeq.Compiler.Quad.BasicBlock>*/ a;
14          public BasicBlock(java.util.List/*<joeq.Compiler.Quad.BasicBlock>*/ c) { this.a = c; }
15          public int size() { return a.size(); }
16          public Object get(int index) { return a.get(index); }
17          public joeq.Compiler.Quad.BasicBlock getBasicBlock(int index) { return (joeq.Compiler.Quad.BasicBlock)a.get(index); }
18          public void add(int i, Object o) { a.add(i, o); }
19          public Object set(int i, Object o) { return a.set(i, o); }
20          public Object remove(int i) { return a.remove(i); }
21          public ListIterator.BasicBlock basicBlockIterator() { return new Iterator(a.listIterator()); }
22          public static class Iterator implements ListIterator.BasicBlock {
23              private java.util.ListIterator/*<joeq.Compiler.Quad.BasicBlock>*/ i;
24              public Iterator(java.util.ListIterator/*<joeq.Compiler.Quad.BasicBlock>*/ l) { this.i = l; }
25              public boolean hasNext() { return i.hasNext(); }
26              public boolean hasPrevious() { return i.hasPrevious(); }
27              public int nextIndex() { return i.nextIndex(); }
28              public int previousIndex() { return i.previousIndex(); }
29              public Object next() { return i.next(); }
30              public joeq.Compiler.Quad.BasicBlock nextBasicBlock() { return (joeq.Compiler.Quad.BasicBlock)i.next(); }
31              public Object previous() { return i.previous(); }
32              public joeq.Compiler.Quad.BasicBlock previousBasicBlock() { return (joeq.Compiler.Quad.BasicBlock)i.previous(); }
33              public void remove() { i.remove(); }
34              public void set(Object o) { i.set(o); }
35              public void add(Object o) { i.add(o); }
36          }
37          public static class EmptyIterator implements ListIterator.BasicBlock {
38              private EmptyIterator() {}
39              public boolean hasNext() { return false; }
40              public boolean hasPrevious() { return false; }
41              public int nextIndex() { return 0; }
42              public int previousIndex() { return -1; }
43              public Object next() { throw new java.util.NoSuchElementException(); }
44              public joeq.Compiler.Quad.BasicBlock nextBasicBlock() { throw new java.util.NoSuchElementException(); }
45              public Object previous() { throw new java.util.NoSuchElementException(); }
46              public joeq.Compiler.Quad.BasicBlock previousBasicBlock() { throw new java.util.NoSuchElementException(); }
47              public void remove() { throw new java.lang.IllegalStateException(); }
48              public void set(Object o) { throw new java.lang.IllegalStateException(); }
49              public void add(Object o) { throw new java.lang.UnsupportedOperationException(); }
50              public static EmptyIterator INSTANCE = new EmptyIterator();
51          }
52      }
53          
54      public static class Quad extends java.util.AbstractList implements List.Quad {
55          private final java.util.List/*<joeq.Compiler.Quad.Quad>*/ a;
56          public Quad(java.util.List/*<joeq.Compiler.Quad.Quad>*/ c) { this.a = c; }
57          public int size() { return a.size(); }
58          public Object get(int index) { return a.get(index); }
59          public joeq.Compiler.Quad.Quad getQuad(int index) { return (joeq.Compiler.Quad.Quad)a.get(index); }
60          public void add(int i, Object o) { a.add(i, o); }
61          public Object set(int i, Object o) { return a.set(i, o); }
62          public Object remove(int i) { return a.remove(i); }
63          public ListIterator.Quad quadIterator() { return new Iterator(a.listIterator()); }
64          public static class Iterator implements ListIterator.Quad {
65              private java.util.ListIterator/*<joeq.Compiler.Quad.Quad>*/ i;
66              public Iterator(java.util.ListIterator/*<joeq.Compiler.Quad.Quad>*/ l) { this.i = l; }
67              public boolean hasNext() { return i.hasNext(); }
68              public boolean hasPrevious() { return i.hasPrevious(); }
69              public int nextIndex() { return i.nextIndex(); }
70              public int previousIndex() { return i.previousIndex(); }
71              public Object next() { return i.next(); }
72              public joeq.Compiler.Quad.Quad nextQuad() { return (joeq.Compiler.Quad.Quad)i.next(); }
73              public Object previous() { return i.previous(); }
74              public joeq.Compiler.Quad.Quad previousQuad() { return (joeq.Compiler.Quad.Quad)i.previous(); }
75              public void remove() { i.remove(); }
76              public void set(Object o) { i.set(o); }
77              public void add(Object o) { i.add(o); }
78          }
79          public static class EmptyIterator implements ListIterator.Quad {
80              private EmptyIterator() {}
81              public boolean hasNext() { return false; }
82              public boolean hasPrevious() { return false; }
83              public int nextIndex() { return 0; }
84              public int previousIndex() { return -1; }
85              public Object next() { throw new java.util.NoSuchElementException(); }
86              public joeq.Compiler.Quad.Quad nextQuad() { throw new java.util.NoSuchElementException(); }
87              public Object previous() { throw new java.util.NoSuchElementException(); }
88              public joeq.Compiler.Quad.Quad previousQuad() { throw new java.util.NoSuchElementException(); }
89              public void remove() { throw new java.lang.IllegalStateException(); }
90              public void set(Object o) { throw new java.lang.IllegalStateException(); }
91              public void add(Object o) { throw new java.lang.UnsupportedOperationException(); }
92              public static EmptyIterator INSTANCE = new EmptyIterator();
93          }
94      }
95          
96      public static class ExceptionHandler extends java.util.AbstractList implements List.ExceptionHandler {
97          private final java.util.List/*<joeq.Compiler.Quad.ExceptionHandler>*/ a;
98          public ExceptionHandler(java.util.List/*<joeq.Compiler.Quad.ExceptionHandler>*/ c) { this.a = c; }
99          public int size() { return a.size(); }
100         public Object get(int index) { return a.get(index); }
101         public joeq.Compiler.Quad.ExceptionHandler getExceptionHandler(int index) { return (joeq.Compiler.Quad.ExceptionHandler)a.get(index); }
102         public void add(int i, Object o) { a.add(i, o); }
103         public Object set(int i, Object o) { return a.set(i, o); }
104         public Object remove(int i) { return a.remove(i); }
105         public ListIterator.ExceptionHandler exceptionHandlerIterator() { return new Iterator(a.listIterator()); }
106         public static class Iterator implements ListIterator.ExceptionHandler {
107             private java.util.ListIterator/*<joeq.Compiler.Quad.ExceptionHandler>*/ i;
108             public Iterator(java.util.ListIterator/*<joeq.Compiler.Quad.ExceptionHandler>*/ l) { this.i = l; }
109             public boolean hasNext() { return i.hasNext(); }
110             public boolean hasPrevious() { return i.hasPrevious(); }
111             public int nextIndex() { return i.nextIndex(); }
112             public int previousIndex() { return i.previousIndex(); }
113             public Object next() { return i.next(); }
114             public joeq.Compiler.Quad.ExceptionHandler nextExceptionHandler() { return (joeq.Compiler.Quad.ExceptionHandler)i.next(); }
115             public Object previous() { return i.previous(); }
116             public joeq.Compiler.Quad.ExceptionHandler previousExceptionHandler() { return (joeq.Compiler.Quad.ExceptionHandler)i.previous(); }
117             public void remove() { i.remove(); }
118             public void set(Object o) { i.set(o); }
119             public void add(Object o) { i.add(o); }
120         }
121         public static class EmptyIterator implements ListIterator.ExceptionHandler {
122             private EmptyIterator() {}
123             public boolean hasNext() { return false; }
124             public boolean hasPrevious() { return false; }
125             public int nextIndex() { return 0; }
126             public int previousIndex() { return -1; }
127             public Object next() { throw new java.util.NoSuchElementException(); }
128             public joeq.Compiler.Quad.ExceptionHandler nextExceptionHandler() { throw new java.util.NoSuchElementException(); }
129             public Object previous() { throw new java.util.NoSuchElementException(); }
130             public joeq.Compiler.Quad.ExceptionHandler previousExceptionHandler() { throw new java.util.NoSuchElementException(); }
131             public void remove() { throw new java.lang.IllegalStateException(); }
132             public void set(Object o) { throw new java.lang.IllegalStateException(); }
133             public void add(Object o) { throw new java.lang.UnsupportedOperationException(); }
134             public static EmptyIterator INSTANCE = new EmptyIterator();
135         }
136     }
137 }