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

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   static final long serialVersionUID = 5521257935120563452L;
00043         private String id;
00044         private long idLong;
00045         private String[] stringList;
00046         private int indexStringList;
00047         private int[] intList;
00048         private int indexIntList;
00049         private long[] longList;
00050         private int indexLongList;
00054         public TestDataWithArray(String id,long idLong) {
00055                 this.id=id;
00056                 this.idLong=idLong;
00057                 stringList=new String[10];
00058                 intList=new int [2];
00059                 longList=new long[4];
00060                 indexStringList=0;
00061                 indexIntList=0;
00062                 indexLongList=0;
00063         }
00064         
00065         public void addElement(String element){
00066                 if(indexStringList<10){
00067                         stringList[indexStringList]=element;
00068                         indexStringList++;
00069                 }
00070         }
00071         
00072         public void addElement(int element){
00073                 if(indexIntList<2){
00074                         intList[indexIntList]=element;
00075                         indexIntList++;
00076                 }
00077         }
00078         
00079         public void addElement(long element){
00080                 if(indexLongList<4){
00081                         longList[indexLongList]=element;
00082                         indexLongList++;
00083                 }
00084         }
00085         
00086         public String[] getStringList(){
00087                 return stringList;
00088         }
00089         
00090         public int [] getIntList(){
00091                 return intList;
00092         }
00093         
00094         public long[] getLongList(){
00095                 return longList;
00096         }
00097         
00098         public String getId(){
00099                 return id;
00100         } 
00101         
00102         public long getIdLong(){
00103                 return idLong;
00104         }
00105         
00106         public String toString(){
00107                 String str="id:"+id+"\nStrings{";
00108                 for(int i=0;i<indexStringList;i++)
00109                         str+=" "+stringList[i];
00110                 str+=" }\n";
00111                 str+="int{";
00112                 for(int i=0;i<indexIntList;i++)
00113                         str+=" "+intList[i];
00114                 str+=" }\n";
00115                 str+="long{";
00116                 for(int i=0;i<indexLongList;i++)
00117                         str+=" "+longList[i];
00118                 str+=" }";return str;
00119         }
00120 
00121 }

Generated on Wed Dec 14 21:05:35 2005 for OpenMobileIS by  doxygen 1.4.4