gpt4 book ai didi

us.ihmc.yoVariables.variable.YoVariable.addVariableChangedListener()方法的使用及代码示例

转载 作者:知者 更新时间:2024-03-16 13:20:40 27 4
gpt4 key购买 nike

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

YoVariable.addVariableChangedListener介绍

[英]Attaches an object implementing VariableChangedListener to this variable's list of listeners.

Instantiates a new empty list of listeners if it is currently null.
[中]将实现VariableChangedListener的对象附加到此变量的侦听器列表。
如果侦听器的新空列表当前为空,则实例化该列表。

代码示例

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

public void registerYovaribleForAutoSendToBehavior(YoVariable var)
{
 var.addVariableChangedListener(new VariableChangedListener()
 {
   @Override
   public void notifyOfVariableChange(YoVariable<?> v)
   {
    sendToBehavior(v.getName(), v.getValueAsDouble());
   }
 });
}

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

protected YoVariableTestGoal(YoVariable<?>... yoVariables)
{
 for (YoVariable<?> yoVariable : yoVariables)
 {
   yoVariable.addVariableChangedListener(this);
 }
}

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

public void registerYovaribleForAutoSendToUI(YoVariable var)
{
 var.addVariableChangedListener(new VariableChangedListener()
 {
   @Override
   public void notifyOfVariableChange(YoVariable<?> v)
   {
    sendToUI(v.getName(), v.getValueAsDouble());
   }
 });
}

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

private void setupDirtyGraphicListener()
{
 getVariablesDefiningGraphic().forEach(variable -> variable.addVariableChangedListener(v -> dirtyGraphic.set(true)));
}

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

private synchronized void addSlider(MidiControl ctrl)
{
 virtualMidiControls.add(ctrl);
 ctrl.var.addVariableChangedListener(listener);
 setUpGui(closeableAndDisposableRegistry);
}

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

/**
* Start the variable changed producer listener and add listener to all variableIdentifiers.
* 
* @param variables List of variables.
* @throws IOException if the producer cannot be created
*/
public void startVariableChangedProducers(List<YoVariable<?>> variables) throws IOException
{
 for (int i = 0; i < variables.size(); i++)
 {
   this.variableIdentifiers.put(variables.get(i), i);
   variables.get(i).addVariableChangedListener(variableListener);
 }
}

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

yoVariable.addVariableChangedListener(new VariableChangedListener()

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

/**
* Attaches an object implementing {@link ParameterChangedListener} to this parameter's list of listeners.
*
*<p>Instantiates a new list of listeners if it is currently empty.</p>
*
* @param ParameterChangedListener ParameterChangedListener to attach
*/
public void addParameterChangedListener(ParameterChangedListener parameterChangedListener)
{
 if (parameterChangedListenersHolder == null)
 {
   parameterChangedListenersHolder = new YoParameterChangedListenerHolder();
   getVariable().addVariableChangedListener(parameterChangedListenersHolder);
 }
 this.parameterChangedListenersHolder.add(parameterChangedListener);
}

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

private synchronized void setControl(int channel, YoVariable<?> var, String name, double min, double max, double exponent, double hires,
                  MidiControl.SliderType sliderType, MidiControl.ControlType controlType)
{
 if (var != null)
 {
   if (exponent <= 0.0)
   {
    System.err.println("Slider Board: Exponent must be positive. Setting it to 1.0");
    exponent = 1.0;
   }
   MidiControl midiControl = new MidiControl(channel, var, max, min, exponent, hires, name);
   midiControl.sliderType = sliderType;
   midiControl.controlType = controlType;
   if (listener != null)
   {
    var.addVariableChangedListener(listener);
   }
   setControl(midiControl);
   setToInitialPosition(midiControl);
   for (SliderBoardControlAddedListener listener : controlAddedListeners)
   {
    listener.controlAdded(midiControl);
   }
 }
 else
 {
   // PrintTools.error("Passed in null variable");
 }
}

代码示例来源: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 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/ihmc-avatar-interfaces-test

yoTime.addVariableChangedListener(timingChecker1);

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