Package railo.runtime.type

Examples of railo.runtime.type.ArrayImpl


   * @param list list to cast
   * @param delimiter delimter of the list
   * @return Array Object
   */
  public static Array listToArray(String list, char delimiter) {
    if(list.length()==0) return new ArrayImpl();
    int len=list.length();
    int last=0;
   
    Array array=new ArrayImpl();
    try{
      for(int i=0;i<len;i++) {
        if(list.charAt(i)==delimiter) {
          array.append(list.substring(last,i));
          last=i+1;
        }
      }
      if(last<=len)array.append(list.substring(last));
    }
    catch(PageException e){}
    return array;
  }
View Full Code Here


    if(!multiCharDelim || delimiter.length()==0) return listToArrayRemoveEmpty(list, delimiter);
   
      if(delimiter.length()==1)return listToArrayRemoveEmpty(list, delimiter.charAt(0));
   
      int len=list.length();
    if(len==0return new ArrayImpl();
   
   
    Array array=new ArrayImpl();
    int from=0;
    int index;
    int dl=delimiter.length();
    while((index=list.indexOf(delimiter,from))!=-1){
      if(from<index)array.appendEL(list.substring(from,index));
      from=index+dl;
    }
    if(from<len)array.appendEL(list.substring(from,len));
    return array;
   
  }
View Full Code Here

  }

  public static Array listToArrayRemoveEmpty(String list, String delimiter) {
      if(delimiter.length()==1)return listToArrayRemoveEmpty(list, delimiter.charAt(0));
    int len=list.length();
    ArrayImpl array=new ArrayImpl();
    if(len==0) return array;
    if(delimiter.length()==0) {
        for(int i=0;i<len;i++){
          array.appendEL(list.charAt(i));
        }
      return array;
      }
    int last=0;
   
    char[] del = delimiter.toCharArray();
    char c;
    for(int i=0;i<len;i++) {
        c=list.charAt(i);
        for(int y=0;y<del.length;y++) {
        if(c==del[y]) {
          if(last<i)array._append(list.substring(last,i));
          last=i+1;
          break;
        }
        }
    }
    if(last<len)array._append(list.substring(last));

    return array;
  }
View Full Code Here

     * @param delimiter delimter of the list
     * @return Array Object
     */
    public static Array listToArrayRemoveEmpty(String list, char delimiter) {
        int len=list.length();
        ArrayImpl array=new ArrayImpl();
        if(len==0) return array;
        int last=0;
       
        for(int i=0;i<len;i++) {
            if(list.charAt(i)==delimiter) {
                if(last<i)array._append(list.substring(last,i));
                last=i+1;
            }
        }
        if(last<len)array._append(list.substring(last));

        return array;
    }
View Full Code Here

   * @param delimiter delimter of the list
   * @return Array Object
   */
  public static Array listToArrayTrim(String list, String delimiter) {
      if(delimiter.length()==1)return listToArrayTrim(list, delimiter.charAt(0));
    if(list.length()==0) return new ArrayImpl();
    char[] del = delimiter.toCharArray();
    char c;
   
    // remove at start
    outer:while(list.length()>0) {
View Full Code Here

   * @param info
   * @return Array Object
   */
  public static Array listToArrayTrim(String list, String delimiter, int[] info) {
      if(delimiter.length()==1)return listToArrayTrim(list, delimiter.charAt(0),info);
    if(list.length()==0) return new ArrayImpl();
    char[] del = delimiter.toCharArray();
    char c;
   
    // remove at start
    outer:while(list.length()>0) {
View Full Code Here

   * @param list list to cast
   * @param delimiter delimter of the list
   * @return Array Object
   */
    public static Array listToArrayTrim(String list, char delimiter) {
        if(list.length()==0) return new ArrayImpl();
        // remove at start
        while(list.indexOf(delimiter)==0) {
            list=list.substring(1);
        }
        int len=list.length();
        if(len==0) return new ArrayImpl();
        while(list.lastIndexOf(delimiter)==len-1) {
            list=list.substring(0,len-1<0?0:len-1);
            len=list.length();
        }
        return listToArray(list, delimiter);
View Full Code Here

   * @param delimiter delimter of the list
   * @param info
   * @return Array Object
   */
  public static Array listToArrayTrim(String list, char delimiter, int[] info) {
    if(list.length()==0) return new ArrayImpl();
    // remove at start
    while(list.indexOf(delimiter)==0) {
      info[0]++;
      list=list.substring(1);
    }
    int len=list.length();
    if(len==0) return new ArrayImpl();
    while(list.lastIndexOf(delimiter)==len-1) {
      info[1]++;
      list=list.substring(0,len-1<0?0:len-1);
      len=list.length();
    }
View Full Code Here

            curr=parent.get(key,null);
        }
       
        if(curr==null) {
          if(isArrayDef) {
            Array arr = new ArrayImpl();
            arr.appendEL(value);
            parent.setEL(key,arr);
          }
            else parent.setEL(key,value);
        }
        else if(curr instanceof Array){
            ((Array) curr).appendEL(value);
        }
        else if(curr instanceof CastableStruct){
          if(isLast) ((CastableStruct)curr).setValue(value);
            else return (Struct) curr;
         
        }
        else if(curr instanceof Struct){
            if(isLast) parent.setEL(key,value);
            else return (Struct) curr;
        }
        else if(curr instanceof String){
            if(isArrayDef) {
              Array arr = new ArrayImpl();
              arr.appendEL(curr);
              arr.appendEL(value);
                parent.setEL(key,arr);
            }
            else if(value instanceof Struct) {
                parent.setEL(key,value);
            }
View Full Code Here

  public static QueryColumnImpl duplicate2QueryColumnImpl(QueryImpl targetQuery,QueryColumn col, boolean deepCopy) {
    if(col instanceof QueryColumnImpl)
        return ((QueryColumnImpl)col).cloneColumnImpl(deepCopy);
     
    // fill array for column
    Array content=new ArrayImpl();
    int len=col.size();
    for(int i=1;i<=len;i++){
      content.setEL(i, col.get(i,null));
    }
   
    // create and return column
    try {
      return new QueryColumnImpl(targetQuery,col.getKey(),content,col.getType());
View Full Code Here

TOP

Related Classes of railo.runtime.type.ArrayImpl

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.