55import com .genexus .internet .IGxJSONAble ;
66import com .genexus .internet .IGxJSONSerializable ;
77
8- public abstract class GXBaseList <T > extends Vector <T > implements Serializable , IGxJSONAble , IGxJSONSerializable , IGXAssigned
9- {
8+ public abstract class GXBaseList <T > extends Vector <T > implements Serializable , IGxJSONAble , IGxJSONSerializable , IGXAssigned {
109 private boolean IsAssigned ;
1110
12- public GXBaseList ()
13- {
11+ public GXBaseList () {
1412 IsAssigned = true ;
1513 }
1614
17- public boolean getIsAssigned ()
18- {
15+ public boolean getIsAssigned () {
1916 return this .IsAssigned ;
2017 }
21- public void setIsAssigned (boolean bAssigned )
22- {
18+ public void setIsAssigned (boolean bAssigned ) {
2319 this .IsAssigned = bAssigned ;
2420 }
25- public void removeAllItems ()
26- {
21+ public void removeAllItems () {
2722 super .clear ();
2823 IsAssigned = true ;
2924 }
30- public byte removeItem (int index )
31- {
25+ public byte removeItem (int index ) {
3226 T item = null ;
33- if (index > 0 && index <= size ())
34- {
27+ if (index > 0 && index <= size ()) {
3528 item = super .remove ((int )index - 1 );//Vector.remove(int)
3629 IsAssigned = true ;
3730 return (byte )1 ;
3831 }
3932 return (byte )0 ;
4033 }
41- public byte removeElement (double index )
42- {
43- if (index > 0 && index <= size ())
44- {
34+ public byte removeElement (double index ) {
35+ if (index > 0 && index <= size ()) {
4536 super .remove ((int )index - 1 );//Vector.remove(int)
4637 IsAssigned = true ;
4738 return (byte )1 ;
4839 }
49- else
50- {
40+ else {
5141 return (byte )0 ;
5242 }
5343 }
@@ -58,24 +48,62 @@ public void addObject(Object obj){
5848 IsAssigned = true ;
5949 }
6050 @ SuppressWarnings ("unchecked" )
61- public void add (Object item , int index )
62- {
63- if (index < 1 || index > size ())
64- {
51+ public void add (Object item , int index ) {
52+ if (index < 1 || index > size ()) {
6553 add ((T )item ); //this.add, GXBCLevelCollection.add for example
6654 }
67- else
68- {
55+ else {
6956 super .add (index - 1 , (T )item ); //Vector insert element
7057 IsAssigned = true ;
7158 }
7259 }
7360 @ SuppressWarnings ("unchecked" )
74- public void addBase ( Object item )
75- {
61+ public void addBase ( Object item ) {
7662 super .add ((T )item );
7763 IsAssigned = true ;
7864 }
65+
66+ public boolean addRange ( GXBaseList <T > baseList , Number index ) {
67+ if (baseList .size () == 0 )
68+ return true ;
69+
70+ boolean result ;
71+ if (index == null ) {
72+ result = addAll (baseList );
73+ }
74+ else {
75+ int nindex = index .intValue ();
76+ if (nindex != 1 && (nindex < 0 || nindex > size () +1 ))
77+ return false ;
78+ if (nindex == 0 )
79+ nindex = 1 ;
80+ result = addAll (nindex -1 , baseList );
81+ }
82+ IsAssigned = true ;
83+ return result ;
84+ }
85+
86+ public boolean removeRange ( int index , Number count ) {
87+ int colSize = size ();
88+ if (index <= 0 || index > colSize || (count != null && index + count .intValue () > colSize ))
89+ return false ;
90+ int toIndex ;
91+ if (count == null )
92+ toIndex = colSize ;
93+ else
94+ toIndex = count .intValue ();
95+ super .removeRange (index -1 , toIndex );
96+ IsAssigned = true ;
97+ return true ;
98+ }
99+
100+ public boolean setElement ( int index , T element ) {
101+ if (index < 1 || index > size ())
102+ return false ;
103+ super .set (index -1 , element );
104+ IsAssigned = true ;
105+ return true ;
106+ }
79107}
80108
81109
0 commit comments