本文整理匯總了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();
}