206 lines
5.0 KiB
Java
Executable File
206 lines
5.0 KiB
Java
Executable File
// ino.module.Constant.8556.package
|
|
package de.dhbwstuttgart.syntaxtree;
|
|
// ino.end
|
|
|
|
// ino.module.Constant.8556.import
|
|
import de.dhbwstuttgart.typeinference.Menge;
|
|
import de.dhbwstuttgart.core.MyCompiler;
|
|
import de.dhbwstuttgart.myexception.JVMCodeException;
|
|
import de.dhbwstuttgart.parser.JavaClassName;
|
|
import de.dhbwstuttgart.syntaxtree.modifier.Modifiers;
|
|
import de.dhbwstuttgart.syntaxtree.statement.Expr;
|
|
import de.dhbwstuttgart.syntaxtree.statement.Literal;
|
|
import de.dhbwstuttgart.syntaxtree.type.Type;
|
|
import de.dhbwstuttgart.typeinference.JavaCodeResult;
|
|
import de.dhbwstuttgart.typeinference.ResultSet;
|
|
import de.dhbwstuttgart.typeinference.assumptions.TypeAssumptions;
|
|
import de.dhbwstuttgart.typeinference.exceptions.NotImplementedException;
|
|
|
|
// ino.class.Constant.23212.description type=javadoc
|
|
/**
|
|
* Enthaelt die Eigenschaften einer Konstante (Name, Typ, Modifier, Wert)
|
|
*
|
|
* @author SCJU
|
|
*
|
|
*/
|
|
// ino.end
|
|
|
|
// ino.class.Constant.23212.declaration
|
|
public class Constant extends Method
|
|
// ino.end
|
|
// ino.class.Constant.23212.body
|
|
{
|
|
|
|
// ino.attribute.name.23216.declaration
|
|
protected String name; // Name der Konstante
|
|
// ino.end
|
|
// ino.attribute.mod.23219.declaration
|
|
protected Modifiers mod = new Modifiers(); // Access-Flags
|
|
// ino.end
|
|
// ino.attribute.exp.23222.declaration
|
|
protected Expr exp; // Wert der Konstante
|
|
// ino.end
|
|
// ino.attribute.typ.23225.declaration
|
|
protected Type typ; // Typ der Konstante
|
|
// ino.end
|
|
|
|
// ino.method.Constant.23228.definition
|
|
@Deprecated
|
|
public Constant(String name, Modifiers mod)
|
|
// ino.end
|
|
// ino.method.Constant.23228.body
|
|
{
|
|
super(0); //Nur ein Workaraound. Da Constant = Deprecated
|
|
this.name = name;
|
|
this.mod = mod;
|
|
}
|
|
// ino.end
|
|
|
|
// ino.method.getValue.23231.defdescription type=javadoc
|
|
/**
|
|
* Gibt den Wert der Konstantendefinition zurueck.
|
|
*/
|
|
// ino.end
|
|
// ino.method.getValue.23231.definition
|
|
public Expr getValue()
|
|
// ino.end
|
|
// ino.method.getValue.23231.body
|
|
{
|
|
return exp;
|
|
}
|
|
// ino.end
|
|
|
|
// ino.method.setValue.23234.defdescription type=javadoc
|
|
/**
|
|
* Legt den Wert der Konstantendefinition fest.
|
|
*/
|
|
// ino.end
|
|
// ino.method.setValue.23234.definition
|
|
public void setValue(Expr exp)
|
|
// ino.end
|
|
// ino.method.setValue.23234.body
|
|
{
|
|
this.exp = exp;
|
|
}
|
|
// ino.end
|
|
|
|
// ino.method.getType.23237.defdescription type=javadoc
|
|
/**
|
|
* Gibt den Typ der Konstantendefinition zurueck.
|
|
*/
|
|
// ino.end
|
|
// ino.method.getType.23237.definition
|
|
public Type getType()
|
|
// ino.end
|
|
// ino.method.getType.23237.body
|
|
{
|
|
return typ;
|
|
}
|
|
// ino.end
|
|
|
|
// ino.method.setType.23240.defdescription type=javadoc
|
|
/**
|
|
* Legt den Typ der Konstantendefinition fest
|
|
*/
|
|
// ino.end
|
|
// ino.method.setType.23240.definition
|
|
public void setType(Type typ)
|
|
// ino.end
|
|
// ino.method.setType.23240.body
|
|
{
|
|
this.typ = typ;
|
|
}
|
|
// ino.end
|
|
|
|
// ino.method.getTypeName.23243.definition
|
|
public JavaClassName getTypeName()
|
|
// ino.end
|
|
// ino.method.getTypeName.23243.body
|
|
{
|
|
return new JavaClassName(name);
|
|
}
|
|
// ino.end
|
|
|
|
// ino.method.getName.23246.definition
|
|
public String getIdentifier()
|
|
// ino.end
|
|
// ino.method.getName.23246.body
|
|
{
|
|
return name;
|
|
}
|
|
// ino.end
|
|
// ino.method.setName.23249.definition
|
|
public void setName(String name)
|
|
// ino.end
|
|
// ino.method.setName.23249.body
|
|
{
|
|
this.name = name;
|
|
}
|
|
// ino.end
|
|
|
|
// ino.method.getModifiers.23252.definition
|
|
public Modifiers getModifiers()
|
|
// ino.end
|
|
// ino.method.getModifiers.23252.body
|
|
{
|
|
return mod;
|
|
}
|
|
// ino.end
|
|
|
|
// ino.method.setModifiers.23255.definition
|
|
public void setModifiers(Modifiers modifiers)
|
|
// ino.end
|
|
// ino.method.setModifiers.23255.body
|
|
{
|
|
this.mod = modifiers;
|
|
}
|
|
// ino.end
|
|
|
|
|
|
// ino.method.getOffset.23261.definition
|
|
public int getOffset()
|
|
// ino.end
|
|
// ino.method.getOffset.23261.body
|
|
{
|
|
if(declid.size()<=0)
|
|
return MyCompiler.NO_LINENUMBER;
|
|
else{
|
|
return declid.elementAt(0).getOffset();
|
|
}
|
|
}
|
|
// ino.end
|
|
|
|
// ino.method.getLineNumber.23264.definition
|
|
public int getLineNumber()
|
|
// ino.end
|
|
// ino.method.getLineNumber.23264.body
|
|
{
|
|
if(declid.size()<=0)
|
|
return MyCompiler.NO_LINENUMBER;
|
|
else{
|
|
return declid.elementAt(0).getLineNumber();
|
|
}
|
|
}
|
|
// ino.end
|
|
|
|
@Override
|
|
public JavaCodeResult printJavaCode(ResultSet resultSet) {
|
|
throw new NotImplementedException();
|
|
}
|
|
|
|
@Override
|
|
public TypeAssumptions createTypeAssumptions(Class classmember) {
|
|
throw new NotImplementedException();
|
|
//return null;
|
|
}
|
|
|
|
|
|
@Override
|
|
public int getTypeLineNumber() {
|
|
// TODO Auto-generated method stub
|
|
return 0;
|
|
}
|
|
|
|
}
|
|
// ino.end
|