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


Java ClassInterpreter类代码示例

本文整理汇总了Java中com.fujitsu.vdmj.runtime.ClassInterpreter的典型用法代码示例。如果您正苦于以下问题:Java ClassInterpreter类的具体用法?Java ClassInterpreter怎么用?Java ClassInterpreter使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


ClassInterpreter类属于com.fujitsu.vdmj.runtime包,在下文中一共展示了ClassInterpreter类的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: processCreate

import com.fujitsu.vdmj.runtime.ClassInterpreter; //导入依赖的package包/类
private void processCreate(DBGPCommand c) throws DBGPException
{
	if (!(interpreter instanceof ClassInterpreter))
	{
		throw new DBGPException(DBGPErrorCode.INTERNAL_ERROR, "Not available for VDM-SL");
	}

	try
	{
		int i = c.data.indexOf(' ');
		String var = c.data.substring(0, i);
		String exp = c.data.substring(i + 1);

		((ClassInterpreter)interpreter).create(var, exp);
	}
	catch (Exception e)
	{
		throw new DBGPException(DBGPErrorCode.INTERNAL_ERROR, e.getMessage());
	}
}
 
开发者ID:nickbattle,项目名称:FJ-VDMJ,代码行数:21,代码来源:DBGPReader.java

示例2: getModules

import com.fujitsu.vdmj.runtime.ClassInterpreter; //导入依赖的package包/类
public List<String> getModules() throws Exception
{
	List<String> names = new Vector<String>();

	if (interpreter instanceof ClassInterpreter)
	{
		throw new Exception("Only available for VDM-SL");
	}
	else
	{
		for (INModule m: ((ModuleInterpreter)interpreter).getModules())
		{
			names.add(m.name.getName());
		}
	}

	return names;
}
 
开发者ID:nickbattle,项目名称:FJ-VDMJ,代码行数:19,代码来源:RemoteInterpreter.java

示例3: getClasses

import com.fujitsu.vdmj.runtime.ClassInterpreter; //导入依赖的package包/类
public List<String> getClasses() throws Exception
{
	List<String> names = new Vector<String>();

	if (interpreter instanceof ClassInterpreter)
	{
		for (INClassDefinition def: ((ClassInterpreter)interpreter).getClasses())
		{
			names.add(def.name.getName());
		}
	}
	else
	{
		throw new Exception("Only available for VDM++ and VDM-RT");
	}

	return names;
}
 
开发者ID:nickbattle,项目名称:FJ-VDMJ,代码行数:19,代码来源:RemoteInterpreter.java

示例4: create

import com.fujitsu.vdmj.runtime.ClassInterpreter; //导入依赖的package包/类
/**
 * @see com.fujitsu.vdmjunit.VDMJUnitTest#create(String, String)
 */
@Override
protected void create(String name, String value) throws Exception
{
	ClassInterpreter ci = (ClassInterpreter) interpreter;
	ci.create(name, value);
}
 
开发者ID:nickbattle,项目名称:FJ-VDMJ,代码行数:10,代码来源:VDMJUnitTestPP.java

示例5: readSpecification

import com.fujitsu.vdmj.runtime.ClassInterpreter; //导入依赖的package包/类
/**
 * @see com.fujitsu.vdmjunit.SpecificationReader#readSpecification(Charset, java.util.List)
 */
@Override
protected Interpreter readSpecification(Charset charset, List<File> files) throws Exception
{
	ASTClassList parsedClasses = new ASTClassList();
	
	for (File file: files)
	{
		LexTokenReader lexer = new LexTokenReader(file, Settings.dialect, charset.toString());
		ClassReader reader = new ClassReader(lexer);
		parsedClasses.addAll(reader.readClasses());
		
		if (reader.getErrorCount() > 0)
		{
			printMessages(reader.getErrors());
			fail("Syntax errors (see stdout)");
		}
	}
	
	if (Settings.dialect == Dialect.VDM_RT)
	{
		parsedClasses.add(new ASTCPUClassDefinition());
		parsedClasses.add(new ASTBUSClassDefinition());
	}
	
	TCClassList checkedClasses = ClassMapper.getInstance(TCNode.MAPPINGS).init().convert(parsedClasses);
	ClassTypeChecker checker = new ClassTypeChecker(checkedClasses);
	checker.typeCheck();
	
	if (ClassTypeChecker.getErrorCount() > 0)
	{
		printMessages(ClassTypeChecker.getErrors());
		fail("Type errors (see stdout)");
	}
	
	INClassList executableClasses = ClassMapper.getInstance(INNode.MAPPINGS).init().convert(checkedClasses);
	return new ClassInterpreter(executableClasses, checkedClasses);
}
 
开发者ID:nickbattle,项目名称:FJ-VDMJ,代码行数:41,代码来源:OOSpecificationReader.java

示例6: processClasses

import com.fujitsu.vdmj.runtime.ClassInterpreter; //导入依赖的package包/类
private void processClasses() throws IOException, DBGPException
{
	if (!(interpreter instanceof ClassInterpreter))
	{
		throw new DBGPException(
			DBGPErrorCode.INTERNAL_ERROR, "Not available for VDM-SL");
	}

	ClassInterpreter cinterpreter = (ClassInterpreter)interpreter;
	String def = cinterpreter.getDefaultName();
	INClassList classes = cinterpreter.getClasses();
	OutputStream out = new ByteArrayOutputStream();
	PrintWriter pw = new PrintWriter(out);

	for (INClassDefinition cls: classes)
	{
		if (cls.name.getName().equals(def))
		{
			pw.println(cls.name.getName() + " (default)");
		}
		else
		{
			pw.println(cls.name.getName());
		}
	}

	pw.close();
	cdataResponse(out.toString());
}
 
开发者ID:nickbattle,项目名称:FJ-VDMJ,代码行数:30,代码来源:DBGPReader.java

示例7: create

import com.fujitsu.vdmj.runtime.ClassInterpreter; //导入依赖的package包/类
public void create(String var, String exp) throws Exception
{
	if (interpreter instanceof ClassInterpreter)
	{
		ClassInterpreter ci = (ClassInterpreter)interpreter;
		ci.create(var, exp);
	}
	else
	{
		throw new Exception("Only available for VDM++ and VDM-RT");
	}
}
 
开发者ID:nickbattle,项目名称:FJ-VDMJ,代码行数:13,代码来源:RemoteInterpreter.java

示例8: getInterpreter

import com.fujitsu.vdmj.runtime.ClassInterpreter; //导入依赖的package包/类
@Override
public ClassInterpreter getInterpreter() throws Exception
{
	if (executableClasses == null)
	{
		long before = System.currentTimeMillis();
  			executableClasses = ClassMapper.getInstance(INNode.MAPPINGS).init().convert(checkedClasses);
  			mapperStats(before, INNode.MAPPINGS);
	}
	
	return new ClassInterpreter(executableClasses, checkedClasses);
}
 
开发者ID:nickbattle,项目名称:FJ-VDMJ,代码行数:13,代码来源:VDMPP.java

示例9: checkErrors

import com.fujitsu.vdmj.runtime.ClassInterpreter; //导入依赖的package包/类
private void checkErrors(List<VDMMessage> actual)
{
	try
	{
		Interpreter interpreter = new ClassInterpreter(new INClassList(), new TCClassList());
		interpreter.init();

		Value assertions = interpreter.execute(new File(assertName));

		assertTrue("Expecting error list", assertions instanceof SeqValue);

		List<Long> expected = new Vector<Long>();

		for (Value ex: assertions.seqValue(null))
		{
			long n = ex.intValue(null);
			expected.add(n);
		}

		List<Long> actNums = new Vector<Long>();

		for (VDMMessage m: actual)
		{
			actNums.add((long)m.number);
		}

		if (!actNums.equals(expected))
		{
			Console.out.println("Expected errors: " + listErrNos(expected));
			Console.out.println("Actual errors: " + listErrs(actual));
			Console.out.println(Utils.listToString(actual, "\n"));
			fail("Actual errors not as expected");
		}
	}
	catch (Exception e)
	{
		fail("Caught: " + e + " in " + assertName);
	}
}
 
开发者ID:nickbattle,项目名称:FJ-VDMJ,代码行数:40,代码来源:OvertureTest.java

示例10: process

import com.fujitsu.vdmj.runtime.ClassInterpreter; //导入依赖的package包/类
private void process(String resource, String aresource) throws Exception
{
	Console.out.println("Processing " + resource + "...");

	URL rurl = getClass().getResource("/VDMBook/" + resource);
	String file = rurl.getPath();
	URL aurl = getClass().getResource("/VDMBook/" + aresource);
	String assertions = aurl.getPath();

	long before = System.currentTimeMillis();
	ASTClassList parsed = parseClasses(file);
	long after = System.currentTimeMillis();

	Console.out.println("Parsed " + parsed.size() + " classes in " +
  			(double)(after-before)/1000 + " secs. ");

	before = System.currentTimeMillis();
	TCClassList checked = ClassMapper.getInstance(TCNode.MAPPINGS).init().convert(parsed);
	TypeChecker typeChecker = new ClassTypeChecker(checked);
	typeChecker.typeCheck();
	after = System.currentTimeMillis();

  		Console.out.println("Type checked in " + (double)(after-before)/1000 + " secs. ");
	Console.out.println("There were " + TypeChecker.getWarningCount() + " warnings");
	TypeChecker.printErrors(Console.out);
	assertEquals("Type check errors", 0, TypeChecker.getErrorCount());

	INClassList runnable = ClassMapper.getInstance(INNode.MAPPINGS).init().convert(checked);
	ClassInterpreter interpreter = new ClassInterpreter(runnable, checked);
	interpreter.init();
	CommandReader reader = new ClassCommandReader(interpreter, "");
	boolean OK = reader.assertFile(new File(assertions));
	assertEquals("Execution errors", true, OK);
}
 
开发者ID:nickbattle,项目名称:FJ-VDMJ,代码行数:35,代码来源:VDMBookTest.java

示例11: ClassCommandReader

import com.fujitsu.vdmj.runtime.ClassInterpreter; //导入依赖的package包/类
public ClassCommandReader(ClassInterpreter interpreter, String prompt)
{
	super(interpreter, prompt);
	cinterpreter = interpreter;
}
 
开发者ID:nickbattle,项目名称:FJ-VDMJ,代码行数:6,代码来源:ClassCommandReader.java


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