Package anvil.core

Examples of anvil.core.Any


  {
    Name name = _name;
    if (index.isRange()) {
      AnyRange r = index.toRange();
      int size   = name.size();
      Any a      = r.getLeft();
      int start  = a.isDefined() ? a.toInt() : 0;
      a          = r.getRight();
      int end    = a.isDefined() ? a.toInt() : size;
      long l     = ArrayUtils.adjust2(start, end, size);
      start      = (int)(l & 0xffffffff);
      int length = (int)(l >> 32);
      if (start == 0) {
        return new AnyName(name.getPrefix(length));
View Full Code Here


    try {
      Name name = _name;
      if (index.isRange()) {
        AnyRange r = index.toRange();
        int size   = _name.size();
        Any a      = r.getLeft();
        int start  = a.isDefined() ? a.toInt() : 0;
        a          = r.getRight();
        int end    = a.isDefined() ? a.toInt() : size;
        long l     = ArrayUtils.adjust2(start, end, size);
        start      = (int)(l & 0xffffffff);
        int length = (int)(l >> 32);
        while(length-- > 0) {
          name.remove(start);
View Full Code Here

    if (parameters.length < 1) {
      throw parametersMissing(context, "add");
    }
    try {
      if (parameters.length == 1) {
        Any param = parameters[0];
        if (param instanceof AnyName) {
          _name.addAll((Name)param.toObject());
        } else {
          _name.add(param.toString());
        }
      } else {
        int index = parameters[0].toInt();
        if (index>=0 && index<=_name.size()) {
          Any param = parameters[1];
          if (param instanceof AnyName) {
            _name.addAll(index, (Name)param.toObject());
          } else {
            _name.add(index, param.toString());
          }
        }
      }
    } catch (Exception e) {
      throw context.exception(e);
View Full Code Here

  {
    if (parameters.length < 1) {
      throw parametersMissing(context, "startsWith");
    }
    try {
      Any param = parameters[0];
      if (!(param instanceof AnyName)) {
        throw context.BadParameter("Name expected");
      }
      return Any.create(_name.startsWith((Name)param.toObject()));
    } catch (Exception e) {
      throw context.exception(e);
    }
  }
View Full Code Here

  {
    if (parameters.length < 1) {
      throw parametersMissing(context, "endsWith");
    }
    try {
      Any param = parameters[0];
      if (!(param instanceof AnyName)) {
        throw context.BadParameter("Name expected");
      }
      return Any.create(_name.endsWith((Name)param.toObject()));
    } catch (Exception e) {
      throw context.exception(e);
    }
  }
View Full Code Here

  }
 

  public Any getVariable(String name)
  {
    Any value = _namespace.get(Any.create(name));
    return (value != null) ? value : Any.UNDEFINED;
  }
View Full Code Here

  }


  public Any checkVariable(String name)
  {
    Any value = _namespace.get(Any.create(name));
    if (value != null) {
      return value;
    } else {
      return Any.UNDEFINED;
    }
View Full Code Here

  public Any m_insert(Context context, Any[] parameters)
  {
    if (parameters.length<2) {
      throw parametersMissing(context, "insert");
    }
    Any value = parameters[1];
    if (value instanceof AnySynapse) {
      _dim.insert(parameters[0].toInt(), (Synapse)value.toObject());
      return this;
    } else {
      throw context.BadParameter("Dimension may only contain anvil.brain.Synapse instances");
    }
  }
View Full Code Here

  public Any m_add(Context context, Any[] parameters)
  {
    if (parameters.length<1) {
      throw parametersMissing(context, "add");
    }
    Any value = parameters[0];
    if (value instanceof AnySynapse) {
      _dim.add((Synapse)value.toObject());
      return this;
    } else {
      throw context.BadParameter("Dimension may only contain anvil.brain.Synapse instances");
    }
  }
View Full Code Here

  public Any m_remove(Context context, Any[] parameters)
  {
    if (parameters.length<1) {
      throw parametersMissing(context, "remove");
    }
    Any index = parameters[0];
    if (index instanceof AnySynapse) {
      Synapse synapse = (Synapse)index.toObject();
      _dim.remove(synapse);
    } else {
      _dim.remove(index.toInt());
    }
    return this;
 
View Full Code Here

TOP

Related Classes of anvil.core.Any

Copyright © 2018 www.massapicom. 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.