Package org.nlogo.prim.etc

Source Code of org.nlogo.prim.etc._wait

// (C) Uri Wilensky. https://github.com/NetLogo/NetLogo

package org.nlogo.prim.etc;

import org.nlogo.api.Let;
import org.nlogo.api.LogoException;
import org.nlogo.api.Syntax;
import org.nlogo.nvm.Command;
import org.nlogo.nvm.Context;
import org.nlogo.nvm.MutableLong;

public final strictfp class _wait
    extends Command
    implements org.nlogo.nvm.CustomAssembled {
  private final Let let = new Let();

  @Override
  public Syntax syntax() {
    int[] right = {Syntax.NumberType()};
    return Syntax.commandSyntax(right);
  }

  @Override
  public void perform(final Context context)
      throws LogoException {
    long targetTime = System.nanoTime();
    targetTime += argEvalDoubleValue(context, 0) * 1000000000;
    context.let(let, new MutableLong(targetTime));
    context.ip = next;
  }

  public void assemble(org.nlogo.nvm.AssemblerAssistant a) {
    a.add(this);
    a.add(new _waitinternal(let));
  }
}
TOP

Related Classes of org.nlogo.prim.etc._wait

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.