JET

edu.utep.cs.jet.rat.val
Class ConstructorCall

java.lang.Object
  extended by edu.utep.cs.jet.rat.val.CompositeValue
      extended by edu.utep.cs.jet.rat.val.ConstructorCall
All Implemented Interfaces:
Denotable

public class ConstructorCall
extends CompositeValue

A class to represent a constructor call. A constructor call is represented as a tuple of a constructor (Constructor) and arguments (an array of Denotables).

Version:
$Revision: 1.12 $
Author:
Yoonsik Cheon

Nested Class Summary
 
Nested classes/interfaces inherited from class edu.utep.cs.jet.rat.val.CompositeValue
CompositeValue.SimpleVarGenerator
 
Constructor Summary
ConstructorCall(Constructor<?> con, Denotable[] args)
          Creates a new instance with the given constructor and arguments.
 
Method Summary
 String code()
          Returns a textual representation of the object denoted by this constructor call.
 String[] code(VarGenerator varGen)
          Returns Java source code that, if evaluated, constructs the object represented by this constructor call.
 Object[] getArguments()
          Returns the arguments used to call the constructor
 Constructor<?> getConstructor()
          Returns the constructor wrapped by this Denotable
 boolean isEquivalentTo(Denotable other)
          Returns true if the represented value is equivalent to the argument's represented value.
 String toString()
          Returns the string representation of this method call.
 Object value()
          Evaluates this constructor call and returns the result.
 
Methods inherited from class edu.utep.cs.jet.rat.val.CompositeValue
elems, hasEquals, isNull, type
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ConstructorCall

public ConstructorCall(Constructor<?> con,
                       Denotable[] args)
Creates a new instance with the given constructor and arguments.

Method Detail

value

public Object value()
Evaluates this constructor call and returns the result.


toString

public String toString()
Returns the string representation of this method call.

Specified by:
toString in interface Denotable
Overrides:
toString in class Object

code

public String code()
Returns a textual representation of the object denoted by this constructor call. The returned string has the following general form:
  x where:
  Tn xn = new Tn();
  xn.m();
  ...
  T1 x1 = new T1(..., xi, ...);
 

See Also:
code(VarGenerator)

code

public String[] code(VarGenerator varGen)
Returns Java source code that, if evaluated, constructs the object represented by this constructor call. The given argument is used to generate unique temporary variables to store intermediate values and the constructed object. The first element of the returned array contains Java source code of the following general form:
  Tn xn = new Tn();
  xn.m();
  ...
  T1 x1 = new T1(..., xi, ...);
 
The second element gives the name of the variable (e.g., x1) that contains the constructed object.

Specified by:
code in class CompositeValue
See Also:
code(VarGenerator)

isEquivalentTo

public boolean isEquivalentTo(Denotable other)
Returns true if the represented value is equivalent to the argument's represented value.

Specified by:
isEquivalentTo in interface Denotable
Overrides:
isEquivalentTo in class CompositeValue

getConstructor

public Constructor<?> getConstructor()
Returns the constructor wrapped by this Denotable


getArguments

public Object[] getArguments()
Returns the arguments used to call the constructor


JET

JET is Copyright (C) 2005-2008 by The University of Texas at El Paso and is distributed under the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.