gpt4 book ai didi

us.ihmc.yoVariables.registry.YoVariableRegistry.getAllVariables()方法的使用及代码示例

转载 作者:知者 更新时间:2024-03-17 13:42:40 32 4
gpt4 key购买 nike

本文整理了Java中us.ihmc.yoVariables.registry.YoVariableRegistry.getAllVariables()方法的一些代码示例,展示了YoVariableRegistry.getAllVariables()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。YoVariableRegistry.getAllVariables()方法的具体详情如下:
包路径:us.ihmc.yoVariables.registry.YoVariableRegistry
类名称:YoVariableRegistry
方法名:getAllVariables

YoVariableRegistry.getAllVariables介绍

暂无

代码示例

代码示例来源:origin: us.ihmc/simulation-construction-set-test

private static boolean areRegistryVariablesAreEqual(YoVariableRegistry registry1, YoVariableRegistry registry2)
{
  if (registry1.getAllVariables().size() != registry2.getAllVariables().size())
    return false;
  for (int i = 0; i < registry1.getAllVariables().size(); i++)
  {
    YoVariable<?> original = registry1.getAllVariables().get(i);
    YoVariable<?> copy = registry2.getAllVariables().get(i);
    if (!areYoVariablesEqual(original, copy))
    {
      return false;
    }
  }
  return true;
}

代码示例来源:origin: us.ihmc/ihmc-robot-data-logger

private void updateVariables()
{
 List<YoVariable<?>> variables = registry.getAllVariables();
 for (int varIdx = 0; varIdx < variables.size(); varIdx++)
 {
   updateVariable(variables.get(varIdx));
 }
}

代码示例来源:origin: us.ihmc/ihmc-avatar-interfaces

public void addLogDataProcessor(LogDataProcessorFunction logDataProcessorFunction)
{
 logDataProcessorFunctions.add(logDataProcessorFunction);
 logDataProcessorRegistry.addChild(logDataProcessorFunction.getYoVariableRegistry());
 varsToSave.addAll(logDataProcessorFunction.getYoVariableRegistry().getAllVariables());
}

代码示例来源:origin: us.ihmc/ihmc-yovariables

public ArrayList<YoVariable<?>> getVariables(NameSpace nameSpace)
{
 ArrayList<YoVariable<?>> ret = new ArrayList<YoVariable<?>>();
 ArrayList<YoVariable<?>> allVariables = getAllVariables();
 for (YoVariable<?> variable : allVariables)
 {
   if (variable.getYoVariableRegistry().getNameSpace().equals(nameSpace))
   {
    ret.add(variable);
   }
 }
 return ret;
}

代码示例来源:origin: us.ihmc/simulation-construction-set-test

@Test// timeout = 30000
public void testOriginalListenersAreCalledWhenMirrorChanges()
{
  YoVariableRegistry originalRegistry = createTestRegistry("OriginalRegistry", TEST_VARIABLE_COUNT);
  MirroredYoVariableRegistry mirroredYoVariableRegistry = new MirroredYoVariableRegistry(originalRegistry);
  ListenerCounter listenerCounter = new ListenerCounter();
  for (YoVariable<?> yoVariable : originalRegistry.getAllVariables())
  {
    yoVariable.addVariableChangedListener(listenerCounter);
  }
  for (YoVariable<?> yoVariable : mirroredYoVariableRegistry.getAllVariables())
  {
    yoVariable.setValueFromDouble(1.0);
  }
  mirroredYoVariableRegistry.updateMirror();
  assertEquals(listenerCounter.callCount, originalRegistry.getAllVariables().size());
}

代码示例来源:origin: us.ihmc/simulation-construction-set-test

@Test// timeout = 30000
public void testMirrorListenersAreCalledWhenOriginalChanges()
{
  YoVariableRegistry originalRegistry = createTestRegistry("OriginalRegistry", TEST_VARIABLE_COUNT);
  MirroredYoVariableRegistry mirroredYoVariableRegistry = new MirroredYoVariableRegistry(originalRegistry);
  ListenerCounter listenerCounter = new ListenerCounter();
  for (YoVariable<?> yoVariable : mirroredYoVariableRegistry.getAllVariables())
  {
    yoVariable.addVariableChangedListener(listenerCounter);
  }
  for (YoVariable<?> yoVariable : originalRegistry.getAllVariables())
  {
    yoVariable.setValueFromDouble(1.0);
  }
  mirroredYoVariableRegistry.updateMirror();
  assertEquals(listenerCounter.callCount, mirroredYoVariableRegistry.getAllVariables().size());
}

代码示例来源:origin: us.ihmc/simulation-construction-set-test

@Test// timeout = 30000
public void testChangesArePropagatedFromOriginal()
{
  YoVariableRegistry originalRegistry = createTestRegistry("OriginalRegistry", TEST_VARIABLE_COUNT);
  MirroredYoVariableRegistry mirroredYoVariableRegistry = new MirroredYoVariableRegistry(originalRegistry);
  for (YoVariable<?> yoVariable : originalRegistry.getAllVariables())
  {
    yoVariable.setValueFromDouble(1.0);
  }
  // Should *not* be equal until updateValuesFromOriginal or updateMirror is called
  assertFalse(areRegistryVariablesAreEqual(originalRegistry, mirroredYoVariableRegistry));
  mirroredYoVariableRegistry.updateValuesFromOriginal();
  assertTrue(areRegistryVariablesAreEqual(originalRegistry, mirroredYoVariableRegistry));
}

代码示例来源:origin: us.ihmc/simulation-construction-set-test

@Test// timeout = 30000
public void testMirrorValuesArePreferredWhenConflict()
{
  YoVariableRegistry originalRegistry = createTestRegistry("OriginalRegistry", TEST_VARIABLE_COUNT);
  MirroredYoVariableRegistry mirroredYoVariableRegistry = new MirroredYoVariableRegistry(originalRegistry);
  final double newValueForOriginal = 2.0;
  final double newValueForMirror = 3.0;
  for (YoVariable<?> yoVariable : originalRegistry.getAllVariables())
  {
    yoVariable.setValueFromDouble(newValueForOriginal);
  }
  for (YoVariable<?> yoVariable : mirroredYoVariableRegistry.getAllVariables())
  {
    yoVariable.setValueFromDouble(newValueForMirror);
  }
  // Should *not* be equal until updateMirror is called
  assertFalse(areRegistryVariablesAreEqual(originalRegistry, mirroredYoVariableRegistry));
  mirroredYoVariableRegistry.updateMirror();
  assertTrue(areRegistryVariablesAreEqual(originalRegistry, mirroredYoVariableRegistry));
  for (YoVariable<?> yoVariable : mirroredYoVariableRegistry.getAllVariables())
  {
    assertEquals(yoVariable.getValueAsDouble(), newValueForMirror, 1e-10);
  }
}

32 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com