本文整理了Java中us.ihmc.yoVariables.variable.YoVariableList.<init>()
方法的一些代码示例,展示了YoVariableList.<init>()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。YoVariableList.<init>()
方法的具体详情如下:
包路径:us.ihmc.yoVariables.variable.YoVariableList
类名称:YoVariableList
方法名:<init>
暂无
代码示例来源:origin: us.ihmc/simulation-construction-set-test
private YoVariableList createYoVariableList(String name, YoVariable<?>[] yoVariables)
{
YoVariableList yoVariableList = new YoVariableList(name);
yoVariableList.addVariables(yoVariables);
return yoVariableList;
}
代码示例来源:origin: us.ihmc/simulation-construction-set-test
private ArrayList<YoVariable<?>> getSimpleRobotRegExpVariables(String[] varNames, String[] regularExpressions, Robot robotModel)
{
ArrayList<YoVariable<?>> currentlyMatched = robotModel.getAllVariables();
YoVariableList tempList = new YoVariableList("temp");
for (int i = 0; i < currentlyMatched.size(); i++)
{
YoVariable var = currentlyMatched.get(i);
tempList.addVariable(var);
}
return tempList.getMatchingVariables(varNames, regularExpressions);
}
代码示例来源:origin: us.ihmc/ihmc-yovariables
public YoVariableList createVarList()
{
YoVariableList ret = new YoVariableList(this.nameSpace.getName());
ret.addVariables(controlVars);
return ret;
}
代码示例来源:origin: us.ihmc/ihmc-yovariables
public ArrayList<YoVariable<?>> getVars(String[] varNames, String[] regularExpressions)
{
YoVariableList tempList = new YoVariableList("temp");
for (int i = 0; i < entries.size(); i++)
{
YoVariable<?> var = (entries.get(i)).getVariable();
tempList.addVariable(var);
}
return tempList.getMatchingVariables(varNames, regularExpressions);
}
代码示例来源:origin: us.ihmc/simulation-construction-set-tools
@Override
public void doAllRegistriesAndVariables(String[] registryNames, String[][] variableNames, float[][] initialValues)
{
if (registryNames.length != variableNames.length) throw new RuntimeException("registryNames.length != variableNames.length");
if (registryNames.length != initialValues.length) throw new RuntimeException("registryNames.length != initialValues.length");
doAllRegistries(registryNames, variableNames);
allVariables = new YoVariableList("All Variables");
for (int i=0; i<variableNames.length; i++)
{
addVariables(variableNames[i].length, variableNames[i], initialValues[i]);
}
putVariablesInIndexMap();
// verifyRegistriesAndVariableListsAreConsistent(registryNames, variableNames);
doneReceivingAllRegistriesAndVariables = true;
}
代码示例来源:origin: us.ihmc/simulation-construction-set-tools-test
private boolean compareSCSInstances(double maxPercentDifference, ArrayList<String> stringsToIgnore)
{
YoVariableList listOne = new YoVariableList("SimOneList");
YoVariableList listTwo = new YoVariableList("SimTwoList");
listOne.addVariables(scsOne.getAllVariables());
listTwo.addVariables(scsTwo.getAllVariables());
ArrayList<VariableDifference> variableDifferences = StateFileComparer.compareVarLists(listOne, listTwo, maxPercentDifference, true, stringsToIgnore);
if(variableDifferences.isEmpty())
{
return true;
}
for(VariableDifference difference : variableDifferences)
{
System.err.println("Variable One: " + difference.getVariableOne());
System.err.println("Variable Two: " + difference.getVariableTwo());
System.err.println(difference.toString());
}
return false;
}
代码示例来源:origin: us.ihmc/simulation-construction-set-tools
YoVariableList varList = new YoVariableList("foo_" + count);
varList.addVariable(foo);
代码示例来源:origin: us.ihmc/simulation-construction-set-tools
public void convertData() throws IOException
{
File binaryFile = new File(binaryFilename);
File asciiFile = new File(asciiFilename);
int bufferSize = 16000;
DataFileReader reader = new DataFileReader(binaryFile);
YoVariableList newVars = new YoVariableList("Converter");
DataBuffer dataBuffer = new DataBuffer(bufferSize);
YoVariableRegistry rootRegistry = new YoVariableRegistry("root");
reader.readData(newVars, rootRegistry, dataBuffer);
DataFileWriter dataFileWriter = new DataFileWriter(asciiFile);
boolean binary = false;
boolean compress = false;
ArrayList<YoVariable<?>> varsToWrite = newVars.getVariables();
dataFileWriter.writeData("ConvertedData", 0.001, dataBuffer, varsToWrite, binary, compress);
}
代码示例来源:origin: us.ihmc/simulation-construction-set-test
private void testDataWriteReadIsTheSame(DataBuffer dataBuffer, ArrayList<YoVariable<?>> allVariables, boolean binary, boolean compress,
boolean spreadsheetFormatted, Robot robot) throws IOException, URISyntaxException
{
String filename = TEST_DIRECTORY + "testFile.data";
if (spreadsheetFormatted)
filename = filename + ".csv";
if (compress)
filename = filename + ".gz";
URL resource = getClass().getClassLoader().getResource(filename);
File testFile = new File(resource.getFile());
String model = "testModel";
double recordDT = 0.001;
DataFileWriter dataFileWriter = new DataFileWriter(testFile);
if (spreadsheetFormatted)
{
dataFileWriter.writeSpreadsheetFormattedData(dataBuffer, allVariables);
}
else
{
dataFileWriter.writeData(model, recordDT, dataBuffer, allVariables, binary, compress, robot);
}
DataFileReader dataFileReader = new DataFileReader(testFile);
DataBuffer readBackBuffer = new DataBuffer(dataBuffer.getBufferSize());
YoVariableRegistry readBackRegistry = new YoVariableRegistry("rootRegistry");
YoVariableList newVars = new YoVariableList("newVars");
dataFileReader.readData(newVars, readBackRegistry, readBackBuffer);
boolean dataIsEqual = readBackBuffer.checkIfDataIsEqual(dataBuffer, 1e-7);
assertTrue(dataIsEqual);
}
代码示例来源:origin: us.ihmc/simulation-construction-set-test
@Test// timeout = 30000
public void testWritingAndReadingALongStateFile() throws IOException
{
File fileOne = new File("fileOne.state");
if (fileOne.exists())
fileOne.delete();
long seed = 1776L;
int numberOfVariables = 2000; // 12000 for when testing long files for efficiency;
Random random = new Random(seed);
ArrayList<YoVariable<?>> variables = createALargeNumberOfVariables(random, numberOfVariables);
YoVariableList originalVarList = new YoVariableList("originalVarList");
originalVarList.addVariables(variables);
writeALongStateFile(fileOne, variables);
DataFileReader dataFileReader = new DataFileReader(fileOne);
YoVariableList newVarList = new YoVariableList("newVarList");
boolean createMissingVariables = true;
boolean printErrorForMissingVariables = false;
YoVariableRegistry registry = new YoVariableRegistry("root");
dataFileReader.readState(newVarList, createMissingVariables, printErrorForMissingVariables, registry);
assertEquals(originalVarList.size(), newVarList.size());
for (int i = 0; i < originalVarList.size(); i++)
{
YoVariable<?> originalVariable = originalVarList.getVariable(i);
YoVariable<?> newVariable = newVarList.getVariable(originalVariable.getName());
assertFalse(originalVariable == newVariable);
assertEquals(originalVariable.getValueAsDouble(), newVariable.getValueAsDouble(), 1e-7);
}
fileOne.delete();
}
代码示例来源:origin: us.ihmc/simulation-construction-set-test
Random random = new Random(seed);
ArrayList<YoVariable<?>> variables = createALargeNumberOfVariables(random, numberOfVariables);
YoVariableList originalVarList = new YoVariableList("originalVarList");
originalVarList.addVariables(variables);
YoVariableList newVarList = new YoVariableList("newVarList");
YoVariableRegistry registry = new YoVariableRegistry("rootRegistry");
内容来源于网络,如有侵权,请联系作者删除!