Package anvil.core

Examples of anvil.core.Any.toObject()


    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


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

    }
    for(int i=0; i<n; i++) {
      Any p = parameters[i];
      try {
        if (p instanceof AnyTribe) {
          _tribe.attach((Tribe)p.toObject());
         
        } else if (p instanceof AnyCitizen) {
          _tribe.attach((Citizen)p.toObject());
         
        } else {
View Full Code Here

      try {
        if (p instanceof AnyTribe) {
          _tribe.attach((Tribe)p.toObject());
         
        } else if (p instanceof AnyCitizen) {
          _tribe.attach((Citizen)p.toObject());
         
        } else {
          throw context.BadParameter("Tribe or citizen expected");
        }
       
View Full Code Here

    }
    for(int i=0; i<n; i++) {
      Any p = parameters[i];
      try {
        if (p instanceof AnyTribe) {
          _tribe.detach((Tribe)p.toObject());
         
        } else if (p instanceof AnyCitizen) {
          _tribe.detach((Citizen)p.toObject());
         
        } else {
View Full Code Here

      try {
        if (p instanceof AnyTribe) {
          _tribe.detach((Tribe)p.toObject());
         
        } else if (p instanceof AnyCitizen) {
          _tribe.detach((Citizen)p.toObject());
         
        } else {
          throw context.BadParameter("Tribe or citizen expected");
        }
       
View Full Code Here

      Any value = values[i];
      if (value.isMap()) {
        AnyMap map = value.toMap();
        attrs.put(map.getLeft().toString(), map.getRight().toObject());
      } else if (value instanceof AnyAttribute) {
        attrs.put((Attribute)value.toObject());
      }
    }
    return new AnyAttributes(attrs);
  }
 
View Full Code Here

      throw parametersMissing(context, "setAttributes");
    }
    if (_result instanceof SearchResult) {
      Any param = parameters[0];
      if (!(param instanceof AnyAttributes)) {
        ((SearchResult)_result).setAttributes((Attributes)param.toObject());
      } else {
        throw context.BadParameter("Attributes expected");
      }
    }
    return this;
View Full Code Here

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.