01: // This file is part of KeY - Integrated Deductive Software Design
02: // Copyright (C) 2001-2007 Universitaet Karlsruhe, Germany
03: // Universitaet Koblenz-Landau, Germany
04: // Chalmers University of Technology, Sweden
05: //
06: // The KeY system is protected by the GNU General Public License.
07: // See LICENSE.TXT for details.
08: //
09: //
10: /**
11: * This class encapsulates a guard for a loop
12: */package de.uka.ilkd.key.java.statement;
13:
14: import de.uka.ilkd.key.java.Expression;
15: import de.uka.ilkd.key.java.JavaNonTerminalProgramElement;
16: import de.uka.ilkd.key.java.ProgramElement;
17: import de.uka.ilkd.key.java.visitor.Visitor;
18: import de.uka.ilkd.key.util.ExtList;
19:
20: public class Guard extends JavaNonTerminalProgramElement implements
21: IGuard {
22:
23: Expression expr;
24:
25: public Guard(Expression expression) {
26: expr = expression;
27: }
28:
29: public Guard(ExtList children) {
30: expr = (Expression) children.get(Expression.class);
31: }
32:
33: public Expression getExpression() {
34: return expr;
35: }
36:
37: public void visit(Visitor v) {
38: v.performActionOnGuard(this );
39: }
40:
41: public int getChildCount() {
42: return (expr != null) ? 1 : 0;
43: }
44:
45: public ProgramElement getChildAt(int index) {
46: if (index == 0)
47: return expr;
48: return null;
49: }
50: }
|