Package com.caucho.quercus.env

Examples of com.caucho.quercus.env.ArrayValueImpl


      env.warning(L.l("Delimiter is empty"));
      return BooleanValue.FALSE;
    }
   
    int head = 0;   
    ArrayValue array = new ArrayValueImpl();

    int separatorLength = separator.length();
    int stringLength = string.length();
    long ulimit;
   
    if (limit >= 0) {
      ulimit = limit;     
    } else {
      ulimit = 0x7fffffff;
    }

    for (int i = 0; i < stringLength; ++i) {
     
      if (ulimit <= array.getSize() + 1) {
        break;
      }
     
      if (string.regionMatches(i, separator, 0, separatorLength)) {

        StringValue chunk = string.substring(head, i);
        array.append(chunk);
       
        head = i + separatorLength;
        i = head - 1;
      }
    }

    StringValue chunk = string.substring(head);

    array.append(chunk);
   
    while (array.getSize() > 0 && limit++ < 0) {
      array.pop(env);
    }

    return array;
  }
View Full Code Here


        part = array.get(keyValue);
      else
        part = env.getVar(key);

      if (! part.isArray())
        part = new ArrayValueImpl();

      if (index.equals(""))
        part.put(value);
      else
        part.put(env.createString(index), value);
View Full Code Here

   * The domain is stored in the returned array under the key named ":domain:".
   */
  public static ArrayValue mbean_explode(String name)
  {
    try {
      ArrayValueImpl exploded = new ArrayValueImpl();

      if (name == null)
        name = "";

      ObjectName objectName = new ObjectName(name);

      exploded.put(":domain:", objectName.getDomain());

      Hashtable<String, String> entries = objectName.getKeyPropertyList();

      for (Map.Entry<String, String> entry : entries.entrySet()) {
        exploded.put(entry.getKey(), entry.getValue());
      }

      return exploded;
    } catch (MalformedObjectNameException e) {
      throw new QuercusModuleException(e);
View Full Code Here

  /**
   * Returns an array of the defined functions.
   */
  public ArrayValue getDefinedFunctions()
  {
    ArrayValue internal = new ArrayValueImpl();

    for (String name : _funMap.keySet()) {
      internal.put(name);
    }

    return internal;
  }
View Full Code Here

      Set<String> extensionSet = moduleInfo.getLoadedExtensions();

      if (extensionSet.contains(name)) {
        for (String functionName : moduleInfo.getFunctions().keySet()) {
          if (value == null)
            value = new ArrayValueImpl();

          value.put(functionName);
        }
      }
    }
View Full Code Here

  /**
   * Returns an array of the defined functions.
   */
  public ArrayValue getDefinedFunctions()
  {
    ArrayValue internal = new ArrayValueImpl();

    for (String name : _funMap.keySet()) {
      internal.put(name);
    }

    return internal;
  }
View Full Code Here

      Set<String> extensionSet = moduleInfo.getLoadedExtensions();

      if (extensionSet.contains(name)) {
        for (String functionName : moduleInfo.getFunctions().keySet()) {
          if (value == null)
            value = new ArrayValueImpl();

          value.put(functionName);
        }
      }
    }
View Full Code Here

    return new DateTimeZone(id);
  }
 
  public static ArrayValue listAbbreviations()
  {
    ArrayValue array = new ArrayValueImpl();
   
    String []ids = TimeZone.getAvailableIDs();
   
    for (int i = 0; i < ids.length; i++) {
      TimeZone tz = TimeZone.getTimeZone(ids[i]);
View Full Code Here

 
  private static void addAbbreviation(ArrayValue array,
                                      TimeZone tz,
                                      boolean isDST)
  {
    ArrayValueImpl zone = new ArrayValueImpl();
   
    zone.put("dst", isDST);
   
    int offset = tz.getRawOffset() / 1000;
   
    if (isDST)
      offset += tz.getDSTSavings() / 1000;
     
    zone.put("offset", offset);
    zone.put("timezone_id", tz.getID());
   
    String name = tz.getDisplayName(isDST, TimeZone.SHORT);
    Value nameV = StringValue.create(name.toLowerCase());
   
    Value zones = array.get(nameV);
   
    if (zones.isNull()) {
      zones = new ArrayValueImpl();
     
      array.put(nameV, zones);
    }
   
    zones.put(zone);
View Full Code Here

    zones.put(zone);
  }
 
  public static ArrayValue listIdentifiers()
  {
    ArrayValue array = new ArrayValueImpl();
   
    String []ids = TimeZone.getAvailableIDs();
   
    java.util.Arrays.sort(ids);
   
    for (int i = 0; i < ids.length; i++) {
      array.put(ids[i]);
    }

    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.