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


Java PyList.get方法代码示例

本文整理汇总了Java中org.python.core.PyList.get方法的典型用法代码示例。如果您正苦于以下问题:Java PyList.get方法的具体用法?Java PyList.get怎么用?Java PyList.get使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.python.core.PyList的用法示例。


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

示例1: testSimpleToDict

import org.python.core.PyList; //导入方法依赖的package包/类
@Test
public void testSimpleToDict() throws Exception {

	IPointGenerator<StepModel> temp = service.createGenerator(new StepModel("Temperature", 290, 295, 1));
	IPointGenerator<?> scan = service.createCompoundGenerator(temp);

	Map<?,?> dict = ((PySerializable)scan).toDict();

	PyList gens = (PyList) dict.get("generators");
	PyDictionary line1 = (PyDictionary) gens.get(0);

	assertEquals("Temperature", ((PyList) line1.get("axes")).get(0));
	assertEquals("mm", ((PyList) line1.get("units")).get(0));
	assertEquals(290.0, (double) ((PyList) line1.get("start")).get(0), 1E-10);
	assertEquals(295.0, (double) ((PyList) line1.get("stop")).get(0), 1E-10);
	assertEquals(6, (int) line1.get("size"));

	PyList excluders = (PyList) dict.get("excluders");
	PyList mutators = (PyList) dict.get("mutators");
	assertEquals(new PyList(), excluders);
	assertEquals(new PyList(), mutators);
}
 
开发者ID:eclipse,项目名称:scanning,代码行数:23,代码来源:CompoundTest.java

示例2: testNestedToDict

import org.python.core.PyList; //导入方法依赖的package包/类
@Test
public void testNestedToDict() throws Exception {

	IPointGenerator<StepModel> temp = service.createGenerator(new StepModel("Temperature", 290, 295, 1));
	IPointGenerator<StepModel> pos = service.createGenerator(new StepModel("Position", 1, 4, 0.6));
	IPointGenerator<?> scan = service.createCompoundGenerator(temp, pos);

	Map<?,?> dict = ((PySerializable)scan).toDict();

	PyList gens = (PyList) dict.get("generators");
	PyDictionary line1 = (PyDictionary) gens.get(0);
	PyDictionary line2 = (PyDictionary) gens.get(1);

	assertEquals("Temperature", ((PyList) line1.get("axes")).get(0));
	assertEquals("mm", ((PyList) line1.get("units")).get(0));
	assertEquals(290.0, (double) ((PyList) line1.get("start")).get(0), 1E-10);
	assertEquals(295.0, (double) ((PyList) line1.get("stop")).get(0), 1E-10);
	assertEquals(6, (int) line1.get("size"));

	assertEquals("Position", ((PyList) line2.get("axes")).get(0));
	assertEquals("mm", ((PyList) line2.get("units")).get(0));
	assertEquals(1.0, (double) ((PyList) line2.get("start")).get(0), 1E-10);
	assertEquals(4.0, (double) ((PyList) line2.get("stop")).get(0), 1E-10);
	assertEquals(6, (int) line2.get("size"));

	PyList excluders = (PyList) dict.get("excluders");
	PyList mutators = (PyList) dict.get("mutators");
	assertEquals(new PyList(), excluders);
	assertEquals(new PyList(), mutators);
}
 
开发者ID:eclipse,项目名称:scanning,代码行数:31,代码来源:CompoundTest.java

示例3: setDoubles

import org.python.core.PyList; //导入方法依赖的package包/类
/**
 * Lets the name of the variable containing list of numbers.
 * Specifically desinged to used from Python.
 */
public void setDoubles(final String name, final PyList list) {
    final double[] values = new double[list.size()];
    for(int i = 0; i < values.length; i++) {
        values[i] = (Double) list.get(i);
    }
    this.engine.assign(name, values);
}
 
开发者ID:K0414,项目名称:metaos,代码行数:12,代码来源:R.java

示例4: setDoubles

import org.python.core.PyList; //导入方法依赖的package包/类
public void setDoubles(final String name, final PyList list) {
    final double[] values = new double[list.size()];
    for(int i = 0; i < values.length; i++) {
        values[i] = (Double) list.get(i);
    }
    this.engine.assign(name, values);
}
 
开发者ID:K0414,项目名称:metaos,代码行数:8,代码来源:R.java


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