Package railo.runtime.type

Examples of railo.runtime.type.ArrayImpl


    if(args.length==2)return call(pc,Caster.toArray(args[0]),Caster.toDoubleValue(args[1]));
    return call(pc,Caster.toArray(args[0]),Caster.toDoubleValue(args[1]),Caster.toDoubleValue(args[2]));
  }
 
  private static Array get(Array arr, int from, int to) throws PageException {
    Array rtn=new ArrayImpl(arr.getDimension());
    int[] keys=arr.intKeys();
    for(int i=0;i<keys.length;i++) {
      int key=keys[i];
      if(key<from)continue;
      if(to>0 && key>to)break;
      rtn.append(arr.getE(key));
    }
    return rtn;
  }
View Full Code Here


    try {
      Cache cache = Util.getCache(pc,cacheName,ConfigImpl.CACHE_DEFAULT_OBJECT);
     
      List<String> keys = isFilter(filter)?cache.keys(new WildCardFilter(filter,true)):cache.keys();
      Iterator<String> it = keys.iterator();
      Array arr = new ArrayImpl();
      while(it.hasNext()){
        arr.append(it.next());
      }
      return arr;
    } catch (Exception e) {
      throw Caster.toPageException(e);
    }
View Full Code Here

  public static Array call(PageContext pc) throws PageException {
    return call(pc, null);
  }
 
  public static Array call(PageContext pc, String cacheName) throws PageException {
    Array arr = new ArrayImpl();
    try {
      if(StringUtil.isEmpty(cacheName)){
        addDefault(pc,ConfigImpl.CACHE_DEFAULT_OBJECT,arr);
        addDefault(pc,ConfigImpl.CACHE_DEFAULT_TEMPLATE,arr);
        addDefault(pc,ConfigImpl.CACHE_DEFAULT_QUERY,arr);
        addDefault(pc,ConfigImpl.CACHE_DEFAULT_RESOURCE,arr);
        addDefault(pc,ConfigImpl.CACHE_DEFAULT_FUNCTION,arr);
        //arr.appendEL(Util.getDefault(pc,ConfigImpl.CACHE_DEFAULT_TEMPLATE).getCustomInfo());
        //arr.appendEL(Util.getDefault(pc,ConfigImpl.CACHE_DEFAULT_QUERY).getCustomInfo());
        //arr.appendEL(Util.getDefault(pc,ConfigImpl.CACHE_DEFAULT_RESOURCE).getCustomInfo());
        // MUST welcher muss zuers sein
      }
      else{
        String name;
        String[] names=ListUtil.listToStringArray(cacheName, ',');
        for(int i=0;i<names.length;i++){
          name=names[i].trim();
          if(name.equalsIgnoreCase("template"))
            arr.appendEL(Util.getDefault(pc,ConfigImpl.CACHE_DEFAULT_TEMPLATE).getCustomInfo());
          else if(name.equalsIgnoreCase("object"))
            arr.appendEL(Util.getDefault(pc,ConfigImpl.CACHE_DEFAULT_OBJECT).getCustomInfo());
          else if(name.equalsIgnoreCase("query"))
            arr.appendEL(Util.getDefault(pc,ConfigImpl.CACHE_DEFAULT_QUERY).getCustomInfo());
          else if(name.equalsIgnoreCase("resource"))
            arr.appendEL(Util.getDefault(pc,ConfigImpl.CACHE_DEFAULT_RESOURCE).getCustomInfo());
          else if(name.equalsIgnoreCase("function"))
            arr.appendEL(Util.getDefault(pc,ConfigImpl.CACHE_DEFAULT_FUNCTION).getCustomInfo());
          else
            arr.appendEL(Util.getCache(pc.getConfig(),name).getCustomInfo());
        }
      }
     
     
      return arr;
View Full Code Here

    return call(pc,Caster.toArray(args[0]),args[1]);
  }
 

    public static Array find(PageContext pc , Array array, UDF udf) throws PageException {
        Array rtn=new ArrayImpl();
      int len=array.size();
     
      Object[] arr=new Object[1];
        Object res;
        Boolean b;
        for(int i=1;i<=len;i++) {
            arr[0]=array.get(i,null);
            if(arr[0]!=null) {
              res=udf.call(pc, arr, false);
              b=Caster.toBoolean(res,null);
              if(b==null) throw new FunctionException(pc,"ArrayFindAll",2,"function","return value of the "+(udf instanceof Closure?"closure":"function ["+udf.getFunctionName()+"]")+" cannot be casted to a boolean value.",CasterException.createMessage(res, "boolean"));
              if(b.booleanValue()) {
                rtn.appendEL(Caster.toDouble(i));
              }
            }
        }
        return rtn;
    }
View Full Code Here

        }
        return rtn;
    }
 
    public static Array find(Array array, Object value, boolean caseSensitive) throws PageException {
        Array rtn=new ArrayImpl();
      int len=array.size();
        boolean valueIsSimple=Decision.isSimpleValue(value);
        Object o;
        for(int i=1;i<=len;i++) {
            o=array.get(i,null);
            if(o!=null && Operator.equals(o, value,caseSensitive,!valueIsSimple)) {
              rtn.appendEL(Caster.toDouble(i));
            }
        }
        return rtn;
    }
View Full Code Here

              }
              else if(Decision.isCastableToArray(args)){
                args = Caster.toArray(args);
              }
              else {
                Array arr = new ArrayImpl();
                arr.appendEL(args);
                args=arr;
              }
            }
            else
              args=url;
View Full Code Here

          mem.set(KeyConstants._name,mm);
          mem.set(KeyConstants._chaining,Caster.toBoolean(function.getMemberChaining()));
            mem.set(KeyConstants._type, function.getMemberTypeAsString());
        }
   
    Array _args=new ArrayImpl();
    sct.set(KeyConstants._arguments,_args);
    if(function.getArgType()!=FunctionLibFunction.ARG_DYNAMIC){
      ArrayList<FunctionLibFunctionArg> args = function.getArg();
      for(int i=0;i<args.size();i++) {
        FunctionLibFunctionArg arg=args.get(i);
        Struct _arg=new StructImpl();
        _arg.set(KeyConstants._required,arg.getRequired()?Boolean.TRUE:Boolean.FALSE);
        _arg.set(KeyConstants._type,StringUtil.emptyIfNull(arg.getTypeAsString()));
        _arg.set(KeyConstants._name,StringUtil.emptyIfNull(arg.getName()));
        _arg.set(KeyConstants._status,TagLibFactory.toStatus(arg.getStatus()));
        _arg.set(KeyConstants._description,StringUtil.toStringEmptyIfNull(arg.getDescription()));
       
       
        _args.append(_arg);
      }
    }
    return sct;
  }
View Full Code Here

        sct.set(SOURCE,udf.getPageSource().getDisplayPath());
    sct.set(KeyConstants._status,"implemeted");
   
   
        FunctionArgument[] fas = udf.getFunctionArguments();
        Array _args=new ArrayImpl();
    sct.set(KeyConstants._arguments,_args);
        int min=0,max=0;
    for(int i=0;i<fas.length;i++) {
          FunctionArgument fa=fas[i];
          Struct meta = fa.getMetaData();
         
      Struct _arg=new StructImpl();
      if(fa.isRequired()) min++;
      max++;
      _arg.set(KeyConstants._required,fa.isRequired()?Boolean.TRUE:Boolean.FALSE);
      _arg.set(KeyConstants._type,StringUtil.emptyIfNull(fa.getTypeAsString()));
      _arg.set(KeyConstants._name,StringUtil.emptyIfNull(fa.getName()));
      _arg.set(KeyConstants._description,StringUtil.emptyIfNull(fa.getHint()));
     
      String status;
      if(meta==null)status="implemeted";
      else status=TagLibFactory.toStatus(TagLibFactory.toStatus(Caster.toString(meta.get(KeyConstants._status,"implemeted"))));
     
      _arg.set(KeyConstants._status,status);
     
      _args.append(_arg);
    }
        sct.set(ARG_MIN,Caster.toDouble(min));
        sct.set(ARG_MAX,Caster.toDouble(max));
       
       
View Full Code Here

   
    Array arr = Caster.toArray(obj,null);
    if(arr!=null) {
      Array[] datas=new Array[columns.length];
      for(int i=0;i<datas.length;i++) {
        datas[i]=new ArrayImpl();
      }
     
      Array data;
      Iterator<Object> it = arr.valueIterator();
      while(it.hasNext()) {
View Full Code Here

  public static Array call(PageContext pc , Array arr1, Array arr2) throws PageException {
    return call(pc,arr1,arr2,false);
  }
  public static Array call(PageContext pc , Array arr1, Array arr2, boolean leaveIndex) throws PageException {
    if(leaveIndex) {
      Array arr = new ArrayImpl();
      set(arr,arr2);
      set(arr,arr1);
      return arr;     
    }
   
      Array arr = new ArrayImpl();
      append(arr,arr1);
      append(arr,arr2);
      return arr;
   
  }
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.