Package com.caucho.quercus.env

Examples of com.caucho.quercus.env.ArrayValueImpl


    return _cls.isA(clsName);
  }
 
  public ArrayValue getStaticProperties(Env env)
  {
    ArrayValue array = new ArrayValueImpl();
   
    getStaticFields(env, array, _cls);
   
    return array;
  }
View Full Code Here


    _cls.getStaticField(env, name).set(value);
  }
 
  public ArrayValue getDefaultProperties(Env env)
  {
    ArrayValue array = new ArrayValueImpl();
   
    getStaticFields(env, array, _cls);
   
    HashMap<StringValue, Expr> fieldMap = _cls.getClassVars();
    for (Map.Entry<StringValue, Expr> entry : fieldMap.entrySet()) {
      array.put(entry.getKey(), entry.getValue().eval(env));
    }
   
    return array;
  }
View Full Code Here

    }
  }

  public static ArrayValue getAvailableDrivers()
  {
    ArrayValue array = new ArrayValueImpl();
   
    array.put("mysql");
    array.put("pgsql");
    array.put("java");
    array.put("jdbc");
   
    return array;
  }
View Full Code Here

    Callable cmp = callbackValue.toCallable(env);
   
    if (! cmp.isValid(env))
      return NullValue.NULL;

    ArrayValue interArray = new ArrayValueImpl();

    boolean isFound = true;

    for (Value entryKey : array.keySet()) {
      Value entryValue = array.get(entryKey);

      for (int k = 1; k < arrays.length - 1 && isFound; k++) {
        if (! (arrays[k] instanceof ArrayValue)) {
          env.warning("Argument #" + (k + 1) + " is not an array");

          return NullValue.NULL;
        }

        ArrayValue checkArray = (ArrayValue) arrays[k];

        for (Map.Entry<Value, Value> entry : checkArray.entrySet()) {
          try {
            boolean keyFound = entryKey.eql(entry.getKey());

            boolean valueFound = false;

            if (keyFound)
              valueFound = cmp.call(env, entryValue, entry.getValue())
                .toLong() == 0;

            isFound = keyFound && valueFound;
          }
          catch (Throwable t) {
            log.log(Level.WARNING, t.toString(), t);

            env.warning("An error occurred while invoking the filter callback");

            return NullValue.NULL;
          }

          if (isFound)
            break;
        }
      }

      if (isFound)
        interArray.put(entryKey, entryValue);
    }

    return interArray;
  }
View Full Code Here

    Callable cmpKey = callbackKey.toCallable(env);
   
    if (! cmpKey.isValid(env))
      return NullValue.NULL;

    ArrayValue interArray = new ArrayValueImpl();

    boolean isFound = true;

    for (Value entryKey : array.keySet()) {
      Value entryValue = array.get(entryKey);

      for (int k = 1; k < arrays.length - 2 && isFound; k++) {
        if (! (arrays[k] instanceof ArrayValue)) {
          env.warning("Argument #" + (k + 1) + " is not an array");

          return NullValue.NULL;
        }

        ArrayValue checkArray = (ArrayValue) arrays[k];

        for (Map.Entry<Value, Value> entry : checkArray.entrySet()) {
          try {
            boolean valueFound =
              cmpValue.call(env, entryValue, entry.getValue()).toLong() == 0;

            boolean keyFound = false;

            if (valueFound)
              keyFound = cmpKey.call(env, entryKey, entry.getKey()).toLong()
                  == 0;

            isFound = valueFound && keyFound;
          }
          catch (Throwable t) {
            log.log(Level.WARNING, t.toString(), t);

            env.warning("An error occurred while invoking the filter callback");

            return NullValue.NULL;
          }

          if (isFound)
            break;
        }
      }

      if (isFound)
        interArray.put(entryKey, entryValue);
    }

    return interArray;
  }
View Full Code Here

    Callable cmp = callbackValue.toCallable(env);
   
    if (! cmp.isValid(env))
      return NullValue.NULL;

    ArrayValue interArray = new ArrayValueImpl();

    boolean isFound = true;

    for (Value entryKey : array.keySet()) {
      Value entryValue = array.get(entryKey);

      for (int k = 1; k < arrays.length - 1 && isFound; k++) {
        if (! (arrays[k] instanceof ArrayValue)) {
          env.warning("Argument #" + (k + 1) + " is not an array");

          return NullValue.NULL;
        }

        ArrayValue checkArray = (ArrayValue) arrays[k];

        for (Map.Entry<Value, Value> entry : checkArray.entrySet()) {
          try {
            isFound = cmp.call(env, entryValue, entry.getValue()).toLong() == 0;
          }
          catch (Throwable t) {
            log.log(Level.WARNING, t.toString(), t);

            env.warning("An error occurred while invoking the filter callback");

            return NullValue.NULL;
          }

          if (isFound)
            break;
        }
      }

      if (isFound)
        interArray.put(entryKey, entryValue);
    }

    return interArray;
  }
View Full Code Here

    array.sort(CNO_VALUE_NORMAL, NO_KEY_RESET, NOT_STRICT);

    Map.Entry<Value, Value> lastEntry = null;

    ArrayValue uniqueArray = new ArrayValueImpl();

    for (Map.Entry<Value, Value> entry : array.entrySet()) {
      Value entryValue = entry.getValue();

      if (lastEntry == null) {
        uniqueArray.put(entry.getKey(), entryValue);

        lastEntry = entry;

        continue;
      }

      Value lastEntryValue = lastEntry.getValue();

      if (! entryValue.toString().equals(lastEntryValue.toString()))
        uniqueArray.put(entry.getKey(), entryValue);

      lastEntry = entry;
    }

    uniqueArray.sort(CNO_KEY_NORMAL, NO_KEY_RESET, NOT_STRICT);

    return uniqueArray;
  }
View Full Code Here

   * @return an array with the values of variables that match those passed
   */
  @UsesSymbolTable
  public static ArrayValue compact(Env env, Value[] variables)
  {
    ArrayValue compactArray = new ArrayValueImpl();

    for (Value variableName : variables) {
      if (variableName.isString()) {
        Var var = env.getRef(variableName.toStringValue(), false);

        if (var != null)
          compactArray.put(variableName, var.toValue());
      }
      else if (variableName instanceof ArrayValue) {
        ArrayValue array = (ArrayValue) variableName;

        ArrayValue innerArray = compact(env, array.valuesToArray());

        compactArray.putAll(innerArray);
      }
    }

    return compactArray;
  }
View Full Code Here

    if (! end.geq(start)) {
      step *= -1;
      increment = false;
    }

    ArrayValue array = new ArrayValueImpl();

    do {
      array.put(start);

      start = rangeIncrement(start, step);
    } while ((increment && start.leq(end))
        || (!increment && start.geq(end)));

View Full Code Here

    return null;
  }
 
  public static ArrayValue getModifierNames(int modifierValue)
  {
    ArrayValue array = new ArrayValueImpl();
   
   
    return array;
  }
View Full Code Here

TOP

Related Classes of com.caucho.quercus.env.ArrayValueImpl

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.