当前位置: 首页>>代码示例>>Java>>正文


Java Interpreter.getInstance方法代码示例

本文整理汇总了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);
}
 
开发者ID:nickbattle,项目名称:FJ-VDMJ,代码行数:39,代码来源:VDMUtil.java

示例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();
}
 
开发者ID:nickbattle,项目名称:FJ-VDMJ,代码行数:14,代码来源:ValueFactory.java

示例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);
}
 
开发者ID:nickbattle,项目名称:vdmj,代码行数:36,代码来源:IO.java

示例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();
}
 
开发者ID:nickbattle,项目名称:FJ-VDMJ,代码行数:7,代码来源:DebugExecutor.java


注:本文中的com.fujitsu.vdmj.runtime.Interpreter.getInstance方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。