Package anvil.core

Examples of anvil.core.Any


  }


  public Any eval()
  {
    Any a = getChild(0).eval();
    Any b;
    int n = childs();
    for(int i = 1; i < n; i++) {
      b = getChild(i).eval();
      switch(_op[i-1]) {
      case LESS:
View Full Code Here


  /// @return processed data
  public Any m_update(Context context, Any[] parameters)
  {
    if (parameters.length > 0) {
      try {
        Any param = parameters[0];
        byte[] data;
        int size;
        if (param.isBinary()) {
          data = param.toBinary();
          size = param.sizeOf();
        } else {
          data = anvil.util.Conversions.getBytes(param.toString());
          size = data.length;
        }
        if (parameters.length > 2) {
          int offset = parameters[1].toInt();
          int length = parameters[2].toInt();
View Full Code Here

  /// @return processed data
  public Any m_final(Context context, Any[] parameters)
  {
    try {
      if (parameters.length > 0) {
        Any param = parameters[0];
        byte[] data;
        int size;
        if (param.isBinary()) {
          data = param.toBinary();
          size = param.sizeOf();
        } else {
          data = anvil.util.Conversions.getBytes(param.toString());
          size = data.length;
        }
        if (parameters.length > 2) {
          int offset = parameters[1].toInt();
          int length = parameters[2].toInt();
View Full Code Here

          if (Modifier.isPublic(mod) && Modifier.isStatic(mod) && Modifier.isFinal(mod)) {
            try {
              Object obj = field.get(null);
              if (obj instanceof Any) {
                Doc doc = _document.findFirst(Doc.T_CONST, name);
                Any value = (Any)obj;
                _types.put(name, new NativeConstantVariable(this, name, field, doc));
              }
            } catch (Exception e) {
              anvil.Log.log().error("Couldn't get field '"+field+"' from "+module.getName());
            }
View Full Code Here

        ignoreCase = values[0].toBoolean();
        i++;
      }
    }
    for(; i<n; i++) {
      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

      String id = request[1];
      String name = Conversions.URLDecode(request[2]);
      Session session = _container.getSession(id);
      if (session != null) {
        try {
          Any data = Serialization.unserialize(_context, input);
          session.setAttribute(name, data);
          output.println("ok");
          output.flush();
          return;
        } catch (UnserializationException e) {
View Full Code Here

      String name = Conversions.URLDecode(request[2]);
      Session session = _container.getSession(id);
      if (session != null) {
        Object obj = session.getAttribute(name);
        if (obj != null) {
          Any data = Any.create(obj);
          output.println("ok");
          Serialization.serialize(_context, data, output);
          output.flush();
          return;
        }
View Full Code Here

  /// @synopsis object min(object parameters, ...)
  /// @return Minimum value
  public static final Object[] p_min = { new Integer(2), "first", "second", "rest" };
  public static final Any min(Any first, Any second, Any[] rest)
  {
    Any min;
    if (first.compareTo(second) <= 0) {
      min = first;
    } else {
      min = second;
    }
View Full Code Here

  /// @synopsis object max(object parameters, ...)
  /// @return Maximum value
  public static final Object[] p_max = { new Integer(2), "first", "second", "rest" };
  public static final Any max(Any first, Any second, Any[] rest)
  {
    Any max;
    if (first.compareTo(second) > 0) {
      max = first;
    } else {
      max = second;
    }
View Full Code Here

  }


  public static final Any postdec(Any target, String field, Context context)
  {
    Any value = target.getAttribute(context, field);
    target.setAttribute(context, field, value.decrease());
    return value;
  }
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.