01: /*
02: * ProGuard -- shrinking, optimization, obfuscation, and preverification
03: * of Java bytecode.
04: *
05: * Copyright (c) 2002-2007 Eric Lafortune (eric@graphics.cornell.edu)
06: *
07: * This program is free software; you can redistribute it and/or modify it
08: * under the terms of the GNU General Public License as published by the Free
09: * Software Foundation; either version 2 of the License, or (at your option)
10: * any later version.
11: *
12: * This program is distributed in the hope that it will be useful, but WITHOUT
13: * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
14: * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
15: * more details.
16: *
17: * You should have received a copy of the GNU General Public License along
18: * with this program; if not, write to the Free Software Foundation, Inc.,
19: * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20: */
21: package proguard;
22:
23: import java.util.*;
24:
25: /**
26: * This class represents a class path, as a list of ClassPathEntry objects.
27: *
28: * @author Eric Lafortune
29: */
30: public class ClassPath {
31: private final List classPathEntries = new ArrayList();
32:
33: /**
34: * Returns whether the class path contains any output entries.
35: */
36: public boolean hasOutput() {
37: for (int index = 0; index < classPathEntries.size(); index++) {
38: if (((ClassPathEntry) classPathEntries.get(index))
39: .isOutput()) {
40: return true;
41: }
42: }
43:
44: return false;
45: }
46:
47: // Delegates to List.
48:
49: public void clear() {
50: classPathEntries.clear();
51: }
52:
53: public void add(int index, ClassPathEntry classPathEntry) {
54: classPathEntries.add(index, classPathEntry);
55: }
56:
57: public boolean add(ClassPathEntry classPathEntry) {
58: return classPathEntries.add(classPathEntry);
59: }
60:
61: public boolean addAll(ClassPath classPath) {
62: return classPathEntries.addAll(classPath.classPathEntries);
63: }
64:
65: public ClassPathEntry get(int index) {
66: return (ClassPathEntry) classPathEntries.get(index);
67: }
68:
69: public ClassPathEntry remove(int index) {
70: return (ClassPathEntry) classPathEntries.remove(index);
71: }
72:
73: public boolean isEmpty() {
74: return classPathEntries.isEmpty();
75: }
76:
77: public int size() {
78: return classPathEntries.size();
79: }
80: }
|