Package com.caucho.quercus.env

Examples of com.caucho.quercus.env.Callable


      return NullValue.NULL;

    ArrayValue filteredArray = new ArrayValueImpl();

    if (! callbackName.isDefault()) {
      Callable callback = callbackName.toCallable(env);
     
      if (callback == null || ! callback.isValid(env)) {
        return NullValue.NULL;
      }

      try {
        Iterator<Map.Entry<Value,Value>> iter = array.getIterator(env);

        while (iter.hasNext()) {
          Map.Entry<Value,Value> entry = iter.next();
         
          Value key = entry.getKey();
          Value value;
         
          if (entry instanceof ArrayValue.Entry)
            value = ((ArrayValue.Entry) entry).getRawValue();
          else
            value = entry.getValue();
          // php/1740         
          boolean isMatch
            = callback.callArray(env, array, key, value).toBoolean();
         
          if (isMatch)
            filteredArray.put(key, value);
        }
      }
View Full Code Here


    ArrayValue array = (ArrayValue) arrays[0];

    Value callbackValue = arrays[arrays.length - 1];

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

    ArrayValue diffArray = new ArrayValueImpl();

    boolean isFound = false;

    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 (Exception t) {
View Full Code Here

    ArrayValue array = (ArrayValue) arrays[0];

    Value callbackValue = arrays[arrays.length - 2];

    Callable cmpValue = callbackValue.toCallable(env);

    if (! cmpValue.isValid(env))
      return NullValue.NULL;

    Value callbackKey = arrays[arrays.length - 1];

    Callable cmpKey = callbackKey.toCallable(env);

    if (! cmpKey.isValid(env))
      return NullValue.NULL;

    ArrayValue diffArray = new ArrayValueImpl();

    boolean isFound = false;

    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) {
View Full Code Here

    ArrayValue array = (ArrayValue) arrays[0];

    Value callbackValue = arrays[arrays.length - 1];

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

    ArrayValue diffArray = new ArrayValueImpl();

    boolean isFound = false;

    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 (Exception t) {
            log.log(Level.WARNING, t.toString(), t);

            env.warning("An error occurred while invoking the filter callback");
View Full Code Here

    ArrayValue array = (ArrayValue) arrays[0];

    Value callbackValue = arrays[arrays.length - 1];

    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) {
View Full Code Here

    ArrayValue array = (ArrayValue) arrays[0];

    Value callbackValue = arrays[arrays.length - 2];

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

    Value callbackKey = arrays[arrays.length - 1];

    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) {
View Full Code Here

    ArrayValue array = (ArrayValue) arrays[0];

    Value callbackValue = arrays[arrays.length - 1];

    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");
View Full Code Here

TOP

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

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.