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: package de.uka.ilkd.key.rule.metaconstruct;
12:
13: import de.uka.ilkd.key.java.Expression;
14: import de.uka.ilkd.key.java.ProgramElement;
15: import de.uka.ilkd.key.java.Services;
16: import de.uka.ilkd.key.java.reference.FieldReference;
17: import de.uka.ilkd.key.java.reference.ReferencePrefix;
18: import de.uka.ilkd.key.rule.inst.SVInstantiations;
19:
20: public class ArrayLength extends ProgramMetaConstruct {
21:
22: /** creates a typeof ProgramMetaConstruct
23: * @param expr the instance of expression contained by
24: * the meta construct
25: */
26: public ArrayLength(Expression expr) {
27: super ("#length-reference", expr);
28:
29: }
30:
31: /** performs the program transformation needed for symbolic
32: * program transformation
33: * @return the transformated program
34: */
35: public ProgramElement symbolicExecution(ProgramElement pe,
36: Services services, SVInstantiations insts) {
37: return new FieldReference(services.getJavaInfo().getAttribute(
38: "length",
39: ((Expression) pe).getKeYJavaType(services, insts
40: .getExecutionContext())), (ReferencePrefix) pe);
41: }
42: }
|