本文整理汇总了Java中com.fujitsu.vdmj.runtime.Interpreter.getInstance方法的典型用法代码示例。如果您正苦于以下问题:Java Interpreter.getInstance方法的具体用法?Java Interpreter.getInstance怎么用?Java Interpreter.getInstance使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.fujitsu.vdmj.runtime.Interpreter
的用法示例。
在下文中一共展示了Interpreter.getInstance方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: seq_of_char2val_
import com.fujitsu.vdmj.runtime.Interpreter; //导入方法依赖的package包/类
public static Value seq_of_char2val_(Value arg)
{
ValueList result = new ValueList();
try
{
SeqValue seq = (SeqValue) arg;
StringBuilder expression = new StringBuilder();
for (Value v: seq.values)
{
CharacterValue ch = (CharacterValue) v;
expression.append(ch.unicode);
}
LexTokenReader ltr = new LexTokenReader(expression.toString(), Dialect.VDM_PP);
ExpressionReader reader = new ExpressionReader(ltr);
reader.setCurrentModule("VDMUtil");
ASTExpression exp = reader.readExpression();
TCExpression tcexp = ClassMapper.getInstance(TCNode.MAPPINGS).convert(exp);
Interpreter ip = Interpreter.getInstance();
ip.typeCheck(tcexp);
INExpression inexp = ClassMapper.getInstance(INNode.MAPPINGS).convert(tcexp);
result.add(new BooleanValue(true));
Context ctxt = new Context(null, "seq_of_char2val", null);
ctxt.setThreadState(null);
result.add(inexp.eval(ctxt));
}
catch (Exception e)
{
result = new ValueList();
result.add(new BooleanValue(false));
result.add(new NilValue());
}
return new TupleValue(result);
}
示例2: getType
import com.fujitsu.vdmj.runtime.Interpreter; //导入方法依赖的package包/类
private static TCType getType(String module, String name) throws ValueException
{
Interpreter i = Interpreter.getInstance();
TCNameToken tcname = new TCNameToken(new LexLocation(), module, name);
TCDefinition def = i.getGlobalEnvironment().findType(tcname, i.getDefaultName());
if (def == null)
{
throw new ValueException(70, "Definition " + tcname.getExplicit(true) + " not found", null);
}
return def.getType();
}
示例3: freadval
import com.fujitsu.vdmj.runtime.Interpreter; //导入方法依赖的package包/类
public static Value freadval(Value fval, Context ctxt)
{
ValueList result = new ValueList();
try
{
File file = new File(stringOf(fval).replace('/', File.separatorChar));
if (!file.isAbsolute())
{
file = new File(new File(".").getParentFile(), file.getAbsolutePath());
}
LexTokenReader ltr = new LexTokenReader(file, Dialect.VDM_PP, VDMJ.filecharset);
ExpressionReader reader = new ExpressionReader(ltr);
reader.setCurrentModule("IO");
ASTExpression exp = reader.readExpression();
TCExpression tcexp = ClassMapper.getInstance(TCNode.MAPPINGS).convert(exp);
Interpreter ip = Interpreter.getInstance();
ip.typeCheck(tcexp);
INExpression inexp = ClassMapper.getInstance(INNode.MAPPINGS).convert(tcexp);
result.add(new BooleanValue(true));
result.add(inexp.eval(ctxt));
}
catch (Exception e)
{
lastError = e.toString();
result = new ValueList();
result.add(new BooleanValue(false));
result.add(new NilValue());
}
return new TupleValue(result);
}
示例4: DebugExecutor
import com.fujitsu.vdmj.runtime.Interpreter; //导入方法依赖的package包/类
public DebugExecutor(LexLocation breakloc, Context ctxt)
{
this.breakloc = breakloc;
this.ctxt = ctxt;
this.interpreter = Interpreter.getInstance();
}