• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java OtpErlangObject类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: testParseBig

import com.ericsson.otp.erlang.OtpErlangObject; //导入依赖的package包/类
@Test
public void testParseBig()
{
	final String text = "{\'this is an atom\',\"this is a string\",[[-234],{}]}";
	OtpErlangObject obtained = ErlangLabel.parseText(text);
	checkResponse(runner, text, text);
	Assert.assertEquals(new OtpErlangTuple(new OtpErlangObject[]{
					new OtpErlangAtom("this is an atom"),
					new OtpErlangString("this is a string"),
					new OtpErlangList(new OtpErlangObject[]{
							new OtpErlangList(new OtpErlangObject[]{
									new OtpErlangInt(-234)
							}),
							new OtpErlangTuple(new OtpErlangObject[]{
							})
					})
			}),obtained);
}
 
开发者ID:kirilluk,项目名称:statechum,代码行数:19,代码来源:TestErlangParser.java


示例2: initRunner

import com.ericsson.otp.erlang.OtpErlangObject; //导入依赖的package包/类
/** This one has to be called after construction of the runner. */
public void initRunner()
{
	// Now create another genserver to handle requests from this runner. Upon failure, the box remains closed.
	try
	{
		mboxOpen = true;
		call(new OtpErlangObject[] { new OtpErlangAtom("startrunner"), new OtpErlangAtom(getRunnerName()) }, "Failed to start a new runner.");
		genServerToCall = getRunnerName();
	}
	catch(IllegalArgumentException ex)
	{// if anything fails, eliminate this runner
		close();
		throw(ex);// rethrow
	}
}
 
开发者ID:kirilluk,项目名称:statechum,代码行数:17,代码来源:ErlangRunner.java


示例3: close

import com.ericsson.otp.erlang.OtpErlangObject; //导入依赖的package包/类
/** Closes the mailbox, causing the linked processes to receive an exception. */
public synchronized void close()
{
	synchronized(nameToRunnerMap)
	{
		if (mboxOpen && !genServerToCall.equals(genServerDefault))
			try
			{
				call(new OtpErlangObject[] { new OtpErlangAtom("terminate") }, 1000);// a short timeout here since we do not care whether we are successful. Dormant processes are not too bad; timeouts on closing mboxes are possibly worse if we are closing many inboxes following unexpected termination of Erlang runtime. 
			}
			catch(IllegalArgumentException ex)
			{// if anything fails, ignore this
			}
		nameToRunnerMap.remove(this);
		thisMbox.close();
		mboxOpen = false;
	}
}
 
开发者ID:kirilluk,项目名称:statechum,代码行数:19,代码来源:ErlangRunner.java


示例4: testToString12

import com.ericsson.otp.erlang.OtpErlangObject; //导入依赖的package包/类
/** A bigger structure to dump. */
@Test
public void testToString12()
{
	Assert.assertEquals("{\'this is an atom\',\"this is a string\",[[-234],{}]}",
			ErlangLabel.dumpErlangObject(new OtpErlangTuple(new OtpErlangObject[]{
					new OtpErlangAtom("this is an atom"),
					new OtpErlangString("this is a string"),
					new OtpErlangList(new OtpErlangObject[]{
							new OtpErlangList(new OtpErlangObject[]{
									new OtpErlangInt(-234)
							}),
							new OtpErlangTuple(new OtpErlangObject[]{
							})
					})
			})));
}
 
开发者ID:kirilluk,项目名称:statechum,代码行数:18,代码来源:TestErlangParser.java


示例5: testFsmDiff3a

import com.ericsson.otp.erlang.OtpErlangObject; //导入依赖的package包/类
/** Special case of fsmdiff - disconnected states with different names */
@Test
public void testFsmDiff3a()
{
	Configuration config = Configuration.getDefaultConfiguration().copy();config.setGdFailOnDuplicateNames(false);
	LearnerGraphND grA = new LearnerGraphND(config);
	OtpErlangObject grAerlang = ErlangLabel.parseText("{statemachine,['P1000','P1002','N1000'],"+
            "[{'P1000','a','P1000'}],"+
            "'P1000',"+
            "['a']}");
	Synapse.StatechumProcess.parseStatemachine(grAerlang,grA,null,true);

	LearnerGraphND grB = new LearnerGraphND(config);
	Synapse.StatechumProcess.parseStatemachine(ErlangLabel.parseText("{statemachine,['P1000','P1001','N1001'],"+
             "[{'P1000','a','P1001'}],"+
             "'P1000',"+
             "['a']}"),grB,null,true);
	
	OtpErlangObject difference = DifferenceVisualiser.ChangesToGraph.computeGD(grA, grB, config);
	Assert.assertEquals("{'statemachinedifference',[{'P1000','a','P1001'}],[{'P1000','a','P1000'}],['N1001','P1001'],['N1000','P1002'],[],'P1000'}",ErlangLabel.dumpErlangObject(difference));

	LearnerGraphND shouldBeLikePrevious = new LearnerGraphND(grA,config);
	DifferenceVisualiser.ChangesToGraph.load(difference).applyDiff(shouldBeLikePrevious, config);
	DifferentFSMException ex = WMethod.checkM(grB, shouldBeLikePrevious);
	Assert.assertNull(ex);Assert.assertEquals(grB.getStateNumber(),shouldBeLikePrevious.getStateNumber());
}
 
开发者ID:kirilluk,项目名称:statechum,代码行数:27,代码来源:TestSynapseAuxiliaryFunctions.java


示例6: testSetRed3

import com.ericsson.otp.erlang.OtpErlangObject; //导入依赖的package包/类
@Test
public void testSetRed3()
{
	Configuration config = Configuration.getDefaultConfiguration().copy();config.setGdFailOnDuplicateNames(false);
	final LearnerGraphND grA = new LearnerGraphND(config);
	OtpErlangObject grAerlang = ErlangLabel.parseText("{statemachine,['P1000','P1002','N1000'],"+
            "[{'P1000',a,'P1000'},"+
            " {'P1000',b,'P1002'},"+
            " {'P1000',c,'N1000'},"+
            " {'P1002',c,'P1002'},"+
            " {'P1002',d,'P1002'}],"+
            "'P1000',"+
            "[d,b,c,a]}");
	Synapse.StatechumProcess.parseStatemachine(grAerlang,grA,null,true);
	Assert.assertEquals(0, grA.getRedStateNumber());
	checkForCorrectException(new whatToRun() { public @Override void run() {
		Synapse.StatechumProcess.setReds(new OtpErlangList(new OtpErlangObject[]{new OtpErlangString("P1002")}), grA);
	}},ClassCastException.class,"OtpErlangString");
}
 
开发者ID:kirilluk,项目名称:statechum,代码行数:20,代码来源:TestSynapseAuxiliaryFunctions.java


示例7: loadDependencies

import com.ericsson.otp.erlang.OtpErlangObject; //导入依赖的package包/类
/**
 * Extracts dependencies of the supplied module, assuming the module has
 * been successfully compiled and .beam file exists.
 * 
 * @param file
 *            the file of the module
 * @throws IOException
 *             if this fails.
 */
public void loadDependencies(File file, Configuration config) {
	OtpErlangTuple response = ErlangRunner.getRunner(config.getErlangMboxName()).call(
			new OtpErlangObject[] { new OtpErlangAtom("dependencies"),
					new OtpErlangAtom(ErlangRunner.getName(file, ErlangRunner.ERL.BEAM, config.getErlangCompileIntoBeamDirectory())) },
			"Could not load dependencies of " + file.getName());
	
	// the first element is 'ok'
	OtpErlangList listOfDepTuples = (OtpErlangList) response.elementAt(1);
	for (OtpErlangObject tup : listOfDepTuples.elements()) {
		String mod = ((OtpErlangAtom) ((OtpErlangTuple) tup).elementAt(0)).atomValue();
		if (!stdModsList.contains(mod) && !dependencies.contains(mod)) {
			dependencies.add(mod);
		}
	}
}
 
开发者ID:kirilluk,项目名称:statechum,代码行数:25,代码来源:OTPBehaviour.java


示例8: testFsmDiff5

import com.ericsson.otp.erlang.OtpErlangObject; //导入依赖的package包/类
/** Special case of fsmdiff - disconnected states */
@Test
public void testFsmDiff5()
{
	Configuration config = Configuration.getDefaultConfiguration().copy();config.setGdFailOnDuplicateNames(false);
	LearnerGraphND grA = new LearnerGraphND(config);
	OtpErlangObject grAerlang = ErlangLabel.parseText("{statemachine,['P1000','P1002','N1000'],"+
            "[{'P1000','a','P1000'}],"+
            "'P1000',"+
            "['a']}");
	Synapse.StatechumProcess.parseStatemachine(grAerlang,grA,null,true);

	LearnerGraphND grB = new LearnerGraphND(config);
	Synapse.StatechumProcess.parseStatemachine(ErlangLabel.parseText("{statemachine,['P1000','P1001'],"+
             "[{'P1000','a','P1001'}],"+
             "'P1000',"+
             "['a']}"),grB,null,true);
	
	OtpErlangObject difference = DifferenceVisualiser.ChangesToGraph.computeGD(grA, grB, config);
	Assert.assertEquals("{'statemachinedifference',[{'P1000','a','P1001'}],[{'P1000','a','P1000'}],['P1001'],['N1000','P1002'],[],'P1000'}",ErlangLabel.dumpErlangObject(difference));

	LearnerGraphND shouldBeLikePrevious = new LearnerGraphND(grA,config);
	DifferenceVisualiser.ChangesToGraph.load(difference).applyDiff(shouldBeLikePrevious, config);
	DifferentFSMException ex = WMethod.checkM(grB, shouldBeLikePrevious);
	Assert.assertNull(ex);Assert.assertEquals(grB.getStateNumber(),shouldBeLikePrevious.getStateNumber());
}
 
开发者ID:kirilluk,项目名称:statechum,代码行数:27,代码来源:TestSynapseAuxiliaryFunctions.java


示例9: constructFSM

import com.ericsson.otp.erlang.OtpErlangObject; //导入依赖的package包/类
/** Turns the supplied graph into an Erlang tuple. 
 * @param gr graph to convert. 
 */
public static <TARGET_TYPE,CACHE_TYPE extends CachedData<TARGET_TYPE,CACHE_TYPE>> OtpErlangTuple constructFSM(AbstractLearnerGraph<TARGET_TYPE,CACHE_TYPE> gr)
{
	List<OtpErlangObject> statesList = new LinkedList<OtpErlangObject>(), transitions = new LinkedList<OtpErlangObject>();
	Map<String,OtpErlangObject> alphabet = new TreeMap<String,OtpErlangObject>();
	
	for(Entry<CmpVertex,Map<Label,TARGET_TYPE>> entry:gr.transitionMatrix.entrySet()) 
	{
		statesList.add(new OtpErlangAtom(entry.getKey().getStringId()));
		for(Entry<Label,TARGET_TYPE> transition:entry.getValue().entrySet())
		{
			String lblStr = transition.getKey().toErlangTerm();OtpErlangAtom lblAtom = new OtpErlangAtom(lblStr);
			alphabet.put(lblStr,lblAtom);
			for(CmpVertex target:gr.getTargets(transition.getValue()))
				transitions.add(new OtpErlangTuple(new OtpErlangObject[]{new OtpErlangAtom(entry.getKey().getStringId()), lblAtom, new OtpErlangAtom(target.getStringId())}));
		}
	}
	return new OtpErlangTuple(new OtpErlangObject[]{new OtpErlangAtom("statemachine"),new OtpErlangList(statesList.toArray(new OtpErlangObject[0])),
			new OtpErlangList(transitions.toArray(new OtpErlangObject[0])),
			new OtpErlangAtom(gr.getInit().getStringId()),new OtpErlangList(alphabet.values().toArray(new OtpErlangObject[alphabet.size()])),
	});
}
 
开发者ID:kirilluk,项目名称:statechum,代码行数:25,代码来源:Synapse.java


示例10: runDialyzerAndTyperAsAProcessInsideErlang

import com.ericsson.otp.erlang.OtpErlangObject; //导入依赖的package包/类
/** Only used for testing against runTyperAsAProcess. 
  * @throws IOException */
 protected String runDialyzerAndTyperAsAProcessInsideErlang(File f) throws IOException
 {
 	ErlangRunner.compileErl(f, runner, true);
 	OtpErlangObject otpArgs[] = new OtpErlangObject[]{
     		null, 
	new OtpErlangList(new OtpErlangObject[]{new OtpErlangString(ErlangRunner.getName(f, ERL.BEAM, true))}),
	new OtpErlangString(ErlangRunner.getName(f, ERL.PLT, true)),
	new OtpErlangList(new OtpErlangObject[]{new OtpErlangString(ErlangRunner.getName(f, ERL.ERL, false))}),
	new OtpErlangAtom("text")
};
 	otpArgs[0]=new OtpErlangAtom("dialyzer");
 	runner.call(otpArgs,"Could not run dialyzer");
 	otpArgs[0]=new OtpErlangAtom("typer");
 	OtpErlangTuple response = runner.call(otpArgs,"Could not run typer");
 	return ((OtpErlangString)response.elementAt(1)).stringValue();
 }
 
开发者ID:kirilluk,项目名称:statechum,代码行数:19,代码来源:TestErlangModule.java


示例11: testFsmDiff4

import com.ericsson.otp.erlang.OtpErlangObject; //导入依赖的package包/类
/** Special case of fsmdiff - disconnected states */
@Test
public void testFsmDiff4()
{
	Configuration config = Configuration.getDefaultConfiguration().copy();config.setGdFailOnDuplicateNames(false);
	LearnerGraphND grA = new LearnerGraphND(config);
	OtpErlangObject grAerlang = ErlangLabel.parseText("{statemachine,['P1000','P1002'],"+
            "[{'P1000','a','P1000'}],"+
            "'P1000',"+
            "['a']}");
	Synapse.StatechumProcess.parseStatemachine(grAerlang,grA,null,true);

	LearnerGraphND grB = new LearnerGraphND(config);
	Synapse.StatechumProcess.parseStatemachine(ErlangLabel.parseText("{statemachine,['P1000','P1001','N1000'],"+
             "[{'P1000','a','P1001'}],"+
             "'P1000',"+
             "['a']}"),grB,null,true);
	
	OtpErlangObject difference = DifferenceVisualiser.ChangesToGraph.computeGD(grA, grB, config);
	Assert.assertEquals("{'statemachinedifference',[{'P1000','a','P1001'}],[{'P1000','a','P1000'}],['N1000','P1001'],['P1002'],[],'P1000'}",ErlangLabel.dumpErlangObject(difference));

	LearnerGraphND shouldBeLikePrevious = new LearnerGraphND(grA,config);
	DifferenceVisualiser.ChangesToGraph.load(difference).applyDiff(shouldBeLikePrevious, config);
	DifferentFSMException ex = WMethod.checkM(grB, shouldBeLikePrevious);
	Assert.assertNull(ex);Assert.assertEquals(grB.getStateNumber(),shouldBeLikePrevious.getStateNumber());
}
 
开发者ID:kirilluk,项目名称:statechum,代码行数:27,代码来源:TestSynapseAuxiliaryFunctions.java


示例12: typeCompatible

import com.ericsson.otp.erlang.OtpErlangObject; //导入依赖的package包/类
/** Given that orderedSignatures starts with an atom reflecting the tag of this record, 
    * checking is identical to that for the tuple.
    */
   @Override
public boolean typeCompatible(OtpErlangObject term) 
{
	if (!(term instanceof OtpErlangTuple)) return false;
	OtpErlangTuple tuple = (OtpErlangTuple)term;
	
	if (tuple.arity() != orderedSignatures.size()) return false;
	
	Iterator<Signature> sigIterator = orderedSignatures.iterator();
	for(int i=0;i<orderedSignatures.size();++i)
		if (!sigIterator.next().typeCompatible(tuple.elementAt(i)))
			return false;
	
	return true;
}
 
开发者ID:kirilluk,项目名称:statechum,代码行数:19,代码来源:RecordSignature.java


示例13: typeCompatible

import com.ericsson.otp.erlang.OtpErlangObject; //导入依赖的package包/类
@Override
public boolean typeCompatible(OtpErlangObject term) 
{
	if (!(term instanceof OtpErlangTuple)) return false;
	OtpErlangTuple tuple = (OtpErlangTuple)term;
	
	if (tuple.arity() != elems.size()) return false;
	
	Iterator<Signature> sigIterator = elems.iterator();
	for(int i=0;i<elems.size();++i)
	{
		Signature sig = sigIterator.next();
		if (!sig.typeCompatible(tuple.elementAt(i)))
			return false;
	}
	return true;
}
 
开发者ID:kirilluk,项目名称:statechum,代码行数:18,代码来源:TupleSignature.java


示例14: checkEmptyList

import com.ericsson.otp.erlang.OtpErlangObject; //导入依赖的package包/类
/** This method is used to check a tail of an improper list. 
 * It returns true if a term can be used to make an improper list, false
 * otherwise and throws an exception if the supplied term represents a non-empty list. */
public static boolean checkEmptyList(OtpErlangObject term) {
	boolean outcome = false;
	if (term instanceof OtpErlangList) {
		if (((OtpErlangList) term).arity() > 0)
			throw new IllegalArgumentException(
					"the tail of an improper list cannot be a non-empty list");
		outcome = true;
	} else if (term instanceof OtpErlangString) {
		if (!((OtpErlangString) term).stringValue().isEmpty())
			throw new IllegalArgumentException(
					"the tail of an improper list cannot be a non-empty string (which is a list)");
		outcome = true;
	}

	return outcome;
}
 
开发者ID:kirilluk,项目名称:statechum,代码行数:20,代码来源:ListSignature.java


示例15: dumpErlangObject

import com.ericsson.otp.erlang.OtpErlangObject; //导入依赖的package包/类
public static String dumpErlangObject(OtpErlangObject obj) {
	StringBuffer buffer = new StringBuffer();
	@SuppressWarnings("rawtypes")
	Class cls = obj.getClass();
	ErlangParserComponent dumper = classToDumper.get(cls);
	while (dumper == null) {
		cls = cls.getSuperclass();
		if (cls == null)
			throw new IllegalArgumentException(
					"cannot dump object of type " + obj.getClass());

		dumper = classToDumper.get(cls);
	}
	dumper.dump(obj, buffer);
	return buffer.toString();
}
 
开发者ID:kirilluk,项目名称:statechum,代码行数:17,代码来源:ErlangLabel.java


示例16: ErlangLabel

import com.ericsson.otp.erlang.OtpErlangObject; //导入依赖的package包/类
public ErlangLabel(FuncSignature operator, String shortName,
		OtpErlangObject inputArgs, OtpErlangObject expectedOutputArgs) {
	super(
			// if there is no valid function involved, this label cannot be passed to Erlang.
			operator == null? new OtpErlangObject[]{}:
			expectedOutputArgs == null ? new OtpErlangObject[] {
			// if no outputs, generate a function/input pair
			new OtpErlangAtom(operator.getName()), inputArgs }
			: new OtpErlangObject[] { 
			// with an output, this will be a function/input/output triple.
			new OtpErlangAtom(operator.getName()),inputArgs, expectedOutputArgs });
	arity = expectedOutputArgs == null ? 2 : 3;
	function = operator;
	callName = shortName;
	input = inputArgs;
	expectedOutput = expectedOutputArgs;
	alphaNum = buildFunctionSignatureAsString();
	if (function != null)
		function.typeCompatible(this);
}
 
开发者ID:kirilluk,项目名称:statechum,代码行数:21,代码来源:ErlangLabel.java


示例17: dump

import com.ericsson.otp.erlang.OtpErlangObject; //导入依赖的package包/类
@Override
public void dump(OtpErlangObject arg, StringBuffer resultHolder) {
	OtpErlangList list = (OtpErlangList) arg;

	resultHolder.append("[");
	boolean first = true;
	for (OtpErlangObject obj : list.elements()) {
		if (!first)
			resultHolder.append(',');
		else
			first = false;
		classToDumper.get(obj.getClass()).dump(obj, resultHolder);
	}
	
	if (!list.isProper())
	{
		OtpErlangObject lastTail = list.getLastTail();resultHolder.append(" | ");
		classToDumper.get(lastTail.getClass()).dump(lastTail, resultHolder);
	}
	resultHolder.append("]");
}
 
开发者ID:kirilluk,项目名称:statechum,代码行数:22,代码来源:ErlangLabel.java


示例18: testExtractionOfOTPreturnValue5a

import com.ericsson.otp.erlang.OtpErlangObject; //导入依赖的package包/类
/** Tests the extraction of return values. */
@Test
public void testExtractionOfOTPreturnValue5a()
{
	String nestedTerm = "{'Alt',[],[{'Tuple',[],[{'Atom',[],['noreply']},{'Any',[]}]},{'Tuple',[],[{'Atom',[],['stop']},{'Atom',[],['normal']},{'Atom',[],['stopped']}]}]}";
	OtpErlangObject obj = ErlangLabel.parseText("{'Alt',[],[{'Tuple',[],[{'Atom',[],['noreply']},{'Atom',[],['tmp']}]},"+nestedTerm+"]}");
	Signature sig = Signature.buildFromType(defaultConfig, obj);
	Signature conversionResult = new OTPBehaviour.OTPCall().extractVisibleReturnType(sig);
	Assert.assertEquals("{'Alt',[],[{'Atom',[],['tmp']},{'Any',[]},{'Atom',[],['normal']}]}",conversionResult.toErlangTerm());
}
 
开发者ID:kirilluk,项目名称:statechum,代码行数:11,代码来源:TestTypes.java


示例19: testToString6

import com.ericsson.otp.erlang.OtpErlangObject; //导入依赖的package包/类
@Test
public void testToString6()
{
	Assert.assertEquals("{}",
			ErlangLabel.dumpErlangObject(new OtpErlangTuple(new OtpErlangObject[]{
			})));
}
 
开发者ID:kirilluk,项目名称:statechum,代码行数:8,代码来源:TestErlangParser.java


示例20: readSequenceList

import com.ericsson.otp.erlang.OtpErlangObject; //导入依赖的package包/类
/** Loads a collection of sequences of the form [ [elem1,elem2, ... ], [elem11,elem12, ... ] ] */
@Override
public List<List<String>> readSequenceList(String sequence) 
{
	OtpErlangObject obj = ErlangLabel.parseText(sequence);
	if (!(obj instanceof OtpErlangList))
		throw new IllegalArgumentException("expected a sequence of sequences, got "+obj);
	List<List<String>> outcome = new LinkedList<List<String>>();
	for(OtpErlangObject o:((OtpErlangList)obj))
		outcome.add(readSequenceFromErlangObject(o));
	return outcome;
}
 
开发者ID:kirilluk,项目名称:statechum,代码行数:13,代码来源:StatechumXML.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java Point2D类代码示例发布时间:2022-05-23
下一篇:
Java Asset类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap