Main Page | Packages | Class Hierarchy | Class List | Directories | File List | Class Members

TestDataWithArray.java

00001 /*
00002  * OpenMobileIS - a free Java(TM) Framework for mobile applications Java(TM)
00003  * Copyright (C) 2004-2005 Philippe Delrieu
00004  * All rights reserved.
00005  * Contact: openmobileis@e-care.fr
00006  *
00007  * This library is free software; you can redistribute it and/or
00008  * modify it under the terms of the GNU Lesser General Public
00009  * License as published by the Free Software Foundation; either
00010  * version 2.1 of the License, or any later version.
00011  *
00012  * This library is distributed in the hope that it will be useful,
00013  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00014  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00015  * Lesser General Public License for more details.
00016  *
00017  * You should have received a copy of the GNU Lesser General Public
00018  * License along with this library; if not, write to the Free Software
00019  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307
00020  * USA
00021  *
00022  *  Author : Philippe Delrieu
00023  *  
00024  *  Modifications :
00025  *  2004 Creation P.Delrieu
00026  *  2004 Modified by Romain Beaugrand
00027  * 
00028  */
00029 package org.openmobileis.database.fastobjectdb.db.test;
00030 
00031 import java.io.Serializable;
00032 
00041 public class TestDataWithArray implements Serializable {
00042         private String id;
00043         private long idLong;
00044         private String[] stringList;
00045         private int indexStringList;
00046         private int[] intList;
00047         private int indexIntList;
00048         private long[] longList;
00049         private int indexLongList;
00053         public TestDataWithArray(String id,long idLong) {
00054                 this.id=id;
00055                 this.idLong=idLong;
00056                 stringList=new String[10];
00057                 intList=new int [2];
00058                 longList=new long[4];
00059                 indexStringList=0;
00060                 indexIntList=0;
00061                 indexLongList=0;
00062         }
00063         
00064         public void addElement(String element){
00065                 if(indexStringList<10){
00066                         stringList[indexStringList]=element;
00067                         indexStringList++;
00068                 }
00069         }
00070         
00071         public void addElement(int element){
00072                 if(indexIntList<2){
00073                         intList[indexIntList]=element;
00074                         indexIntList++;
00075                 }
00076         }
00077         
00078         public void addElement(long element){
00079                 if(indexLongList<4){
00080                         longList[indexLongList]=element;
00081                         indexLongList++;
00082                 }
00083         }
00084         
00085         public String[] getStringList(){
00086                 return stringList;
00087         }
00088         
00089         public int [] getIntList(){
00090                 return intList;
00091         }
00092         
00093         public long[] getLongList(){
00094                 return longList;
00095         }
00096         
00097         public String getId(){
00098                 return id;
00099         } 
00100         
00101         public long getIdLong(){
00102                 return idLong;
00103         }
00104         
00105         public String toString(){
00106                 String str="id:"+id+"\nStrings{";
00107                 for(int i=0;i<indexStringList;i++)
00108                         str+=" "+stringList[i];
00109                 str+=" }\n";
00110                 str+="int{";
00111                 for(int i=0;i<indexIntList;i++)
00112                         str+=" "+intList[i];
00113                 str+=" }\n";
00114                 str+="long{";
00115                 for(int i=0;i<indexLongList;i++)
00116                         str+=" "+longList[i];
00117                 str+=" }";return str;
00118         }
00119 
00120 }

Generated on Thu Oct 6 10:06:34 2005 for OpenMobileIS by  doxygen 1.4.3