001    /**
002     * Implements the CFML Function arrayresize
003     */
004    package railo.runtime.functions.arrays;
005    
006    import railo.runtime.PageContext;
007    import railo.runtime.exp.PageException;
008    import railo.runtime.functions.BIF;
009    import railo.runtime.op.Caster;
010    import railo.runtime.type.Array;
011    
012    public final class ArrayResize extends BIF {
013    
014            private static final long serialVersionUID = -3107784929660340665L;
015    
016            public static boolean call(PageContext pc , Array array, double number) {
017                    try {
018                            array.resize((int)number);
019                            return true;
020                    } catch (PageException e) {
021                            return false;
022                    }
023                    
024            }
025            
026            @Override
027            public Object invoke(PageContext pc, Object[] args) throws PageException {
028                    return call(pc,Caster.toArray(args[0]),Caster.toDoubleValue(args[1]));
029            }
030    }