001 package railo.runtime.type; 002 import java.util.List; 003 004 import railo.runtime.exp.PageException; 005 006 /** 007 * 008 */ 009 public interface Array extends Collection,Cloneable { 010 011 /** 012 * return dimension of the array 013 * @return dimension of the array 014 */ 015 public int getDimension(); 016 017 /** 018 * return object a given position, key can only be a integer from 1 to array len 019 * @param key key as integer 020 * @return value at key position 021 */ 022 public Object get(int key, Object defaultValue); 023 024 /** 025 * return object a given position, key can only be a integer from 1 to array len 026 * @param key key as integer 027 * @return value at key position 028 * @throws PageException 029 */ 030 public Object getE(int key) throws PageException; 031 032 /** 033 * set value at defined position, on error return null 034 * @param key key of the new value 035 * @param value value to set 036 * @return setted value 037 */ 038 public Object setEL(int key, Object value); 039 040 /** 041 * set value at defined position 042 * @param key 043 * @param value 044 * @return defined value 045 * @throws PageException 046 */ 047 public Object setE(int key, Object value) throws PageException; 048 049 /** 050 * @return return all array keys as int 051 */ 052 public int[] intKeys(); 053 054 /** 055 * insert a value add defined position 056 * @param key position to insert 057 * @param value value to insert 058 * @return has done or not 059 * @throws PageException 060 */ 061 public boolean insert(int key, Object value) throws PageException; 062 063 /** 064 * append a new value to the end of the array 065 * @param o value to insert 066 * @return inserted value 067 * @throws PageException 068 */ 069 public Object append(Object o) throws PageException; 070 071 public Object appendEL(Object o); 072 073 /** 074 * add a new value to the begin of the array 075 * @param o value to insert 076 * @return inserted value 077 * @throws PageException 078 */ 079 public Object prepend(Object o) throws PageException; 080 081 /** 082 * resize array to defined size 083 * @param to new minimum size of the array 084 * @throws PageException 085 */ 086 public void resize(int to) throws PageException; 087 088 /** 089 * sort values of a array 090 * @param sortType search type (text,textnocase,numeric) 091 * @param sortOrder (asc,desc) 092 * @throws PageException 093 */ 094 public void sort(String sortType, String sortOrder) throws PageException; 095 /** 096 * @return return arra as native (Java) Object Array 097 */ 098 public Object[] toArray(); 099 100 /** 101 * @return return array as ArrayList 102 */ 103 //public ArrayList toArrayList(); 104 105 public List toList(); 106 107 108 /** 109 * removes a value ad defined key 110 * @param key key to remove 111 * @return retuns if value is removed or not 112 * @throws PageException 113 */ 114 public Object removeE(int key) throws PageException; 115 116 /** 117 * removes a value ad defined key 118 * @param key key to remove 119 * @return retuns if value is removed or not 120 */ 121 public Object removeEL(int key) ; 122 123 /** 124 * contains this key 125 * @param key 126 * @return returns if collection has a key with given name 127 */ 128 public boolean containsKey(int key); 129 }