Hi all,
i want to ask opinion,advice or mayb solution to my problem.
i want to add data from this object to an ArrayList<string>.this is my code:
class Main
{
static ArrayList<String> test_case_list=new ArrayList<String> ();
public static void main(String[] args)
{
//do argument....
TestCaseGenerator(s,count,test_suite_list);
display_list("Final Result",test_suite_list);
}
private final static void display_list(String title,ArrayList<string> list)
{
int i=0;
System.out.println(title);
for(Iterator it= list.iterator();it.hasNext();)
String s=(String)it.next();
System.out.println("i="+i+"->"+s);
i++;
}
private final static void TestCaseGenerator(String binary_setting,int Count,ArrayList<String> test_suite_list)
{
System.out.println("Interaction Setting ->"+binary_setting);
int[][] TestCase_Store = new int[count][value.length];
String Test_Case=new String ("");
int repetition =1;
for(int i=value.length-1;i>=0;i--)
{
if(binary_setting.charAt(i)=='1')
{
int currentTestCase=0;
while(currentTestCase < count)
{
for(int j=0;j<value[i];j++)
{
for(int k=0;k<repetition;k++)
{
TestCase_Store[currentTestCase][i]=j;
currentTestCase++;
}
}
}
repetition=repetition* value[i];
}
else
{
for(int j=0;j<count;j++)
{
Random generator = new Random();
TestCase_Store[j][i]=generator.nextInt(value[i]);
}
}
}
for(int i=0;i<count;i++)
{
for(int j=0;j<value.length;j++)
{
if(j>0)
Test_Case=":"+TestCase_Store[i][j];
else
Test_Case=""+TestCase_Store[i][j];
System.out.print(Test_Case);
}
System.out.println();
}
// check if the generated test case is already
// in the tupple_store
if(!test_suite_list.contains(Test_Case))
test_suite_list.add(Test_Case);
}
}
this is an example:
input: 3,3,3,3
value=3, since the input all 3
value.length=4
binary_setting=
1110
1101
1011
0111
count=27..
the expected result
example: i=1->0:1:2:1
the reason i want to use arraylist,because since there r a lot of data list,u can see after system.out.print(Test_Case) and possibility to get duplicate data is there,so i want to compare the list data so that there is no duplicate data at last in ArrayList.
but i cant get what i expected.
i would appreciate any advice or mayb solution u can give me.or mayb any suggestion about reading material that i could have to get the solution!!
Thanks a lot