當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。