Revision 36162
tags/v2_0_0_Build_2032/libraries/libIverUtiles/docs/list manager/tutorial.txt | ||
---|---|---|
1 |
1. Uso del control ListManagerDemoSkin |
|
2 |
|
|
3 |
Para incluir el control y definir su funcionalidad en |
|
4 |
un di?logo hay que a?adir el control como con cualquier |
|
5 |
otro a un JPanel. Una vez a?adido hay que definir el |
|
6 |
comportamiento de los botones, que se hace estableciendo |
|
7 |
el listener de eventos del ListManager: |
|
8 |
|
|
9 |
listManagerSkin.getListManager().setListener(); |
|
10 |
|
|
11 |
lo cual obligar? a implementar una interfaz, en la que se |
|
12 |
define el comportamiento de los botones a?adir y propiedades. |
|
13 |
|
|
14 |
Esto ya da la funcionalidad de los botones. Una vez esto hecho |
|
15 |
ser? bastante frecuente querer acceder a los objetos a?adidos, |
|
16 |
para ello se puede usar la siguiente instrucci?n: |
|
17 |
|
|
18 |
listManagerSkin.getListManager().getListModel().getObjects(); |
|
19 |
|
|
20 |
2. Creaci?n de un skin del control |
|
21 |
|
|
22 |
Para crear una skin (forma de visualizaci?n del control) hay |
|
23 |
que crear un control con los botones A?adir, eliminar, |
|
24 |
arriba, abajo y propiedades o un subconjunto de estos. Declarar |
|
25 |
un campo como |
|
26 |
|
|
27 |
private ListManager listManager = new ListManager(); |
|
28 |
|
|
29 |
Y en un m?todo de inicializaci?n del componente poner |
|
30 |
las siguientes instrucciones |
|
31 |
|
|
32 |
listManager.setBtnDown(getJButton()); |
|
33 |
listManager.setBtnUp(getJButton1()); |
|
34 |
listManager.setBtnAdd(getJButton2()); |
|
35 |
listManager.setBtnDel(getJButton3()); |
|
36 |
listManager.setList(getJList()); |
|
37 |
listManager.initialize(); |
|
0 | 38 |
tags/v2_0_0_Build_2032/libraries/libIverUtiles/testdata/persistence-test.xml | ||
---|---|---|
1 |
<?xml version="1.0" encoding="UTF-8"?> |
|
2 |
<xml-tag xmlns="http://www.gvsig.gva.es"><property key="_classname_" value="com.iver.utiles.TestXMLEntityPersistenceManager$MyPersistentList"/><xml-tag name="_item_data_"><xml-tag name="myList"><property key="_classname_" value="org.gvsig.tools.persistence.xmlentity.XMLEntityState$PersistentIterator"/><xml-tag name="_item_data_"><xml-tag name="_iterator_item_"><property key="_classname_" value="java.lang.String"/><property key="_value_" value="This is my first$$ String to check"/></xml-tag><xml-tag name="_iterator_item_"><property key="_classname_" value="java.lang.String"/><property key="_value_" value="An very long long long asdasfsafffffffffasfasasdffffffsflong long long long long asdfaaaddddddddddddddddddddddddasdsdfbkdfjger gsdf glkwerqwsdvsiñomodsgt string with specialcharacters and etc etc asdfasdfwqfwefwfasdfasfasfasfasfasfasfasasfasfasfasfasfasfasfasfdasdsdfsafsafasfasfsafasfasfasfasfasfassafasfasfasdfkb sdfd ertge ertwgfwrt43 fbgdsf gw wfwf sdgas asfwr324rf635r sdgsa swe3er 6546 sfasdfsafas asfaasdfasfasf435hdhge sfsd g dfsafasfsa as"/></xml-tag><xml-tag name="_iterator_item_"><property key="_classname_" value="java.lang.Integer"/><property key="_value_" value="9323823"/></xml-tag><xml-tag name="_iterator_item_"><property key="_classname_" value="java.lang.Integer"/><property key="_value_" value="-234234234"/></xml-tag><xml-tag name="_iterator_item_"><property key="_classname_" value="java.lang.Integer"/><property key="_value_" value="0"/></xml-tag><xml-tag name="_iterator_item_"><property key="_classname_" value="java.lang.Boolean"/><property key="_value_" value="true"/></xml-tag><xml-tag name="_iterator_item_"><property key="_classname_" value="java.lang.Boolean"/><property key="_value_" value="false"/></xml-tag><xml-tag name="_iterator_item_"><property key="_classname_" value="com.iver.utiles.TestXMLEntityPersistenceManager$MyPersistentObject"/><xml-tag name="_item_data_"><property key="miValor" value="Sopa de cabrita"/><property key="numero" value="20090625"/></xml-tag></xml-tag><xml-tag name="_iterator_item_"><property key="_classname_" value="com.iver.utiles.TestXMLEntityPersistenceManager$MyPersistentContainer"/><xml-tag name="_item_data_"><property key="miObjetito2" value="piripi pi"/><property key="miObjetito3" value="lepe lepero"/><xml-tag name="miObjetito1"><property key="_classname_" value="com.iver.utiles.TestXMLEntityPersistenceManager$MyPersistentObject"/><xml-tag name="_item_data_"><property key="miValor" value="Sopa de cabrita"/><property key="numero" value="20090625"/></xml-tag></xml-tag></xml-tag></xml-tag></xml-tag></xml-tag></xml-tag></xml-tag> |
|
0 | 3 |
tags/v2_0_0_Build_2032/libraries/libIverUtiles/testdata/persistence-test2.xml | ||
---|---|---|
1 |
<?xml version="1.0" encoding="UTF-8"?> |
|
2 |
<xml-tag xmlns="http://www.gvsig.gva.es"><property key="_classname_" value="com.iver.utiles.TestXMLEntityPersistenceManager$MyPersistentContainer"/><xml-tag name="_item_data_"><property key="miObjetito1" value="pero perico pero"/><xml-tag name="miObjetito2"><property key="_classname_" value="com.iver.utiles.TestXMLEntityPersistenceManager$MyPersistentList"/><xml-tag name="_item_data_"><xml-tag name="myList"><property key="_classname_" value="org.gvsig.tools.persistence.xmlentity.XMLEntityState$PersistentIterator"/><xml-tag name="_item_data_"><xml-tag name="_iterator_item_"><property key="_classname_" value="java.lang.String"/><property key="_value_" value="This is my first$$ String to check"/></xml-tag><xml-tag name="_iterator_item_"><property key="_classname_" value="java.lang.String"/><property key="_value_" value="An very long long long asdasfsafffffffffasfasasdffffffsflong long long long long asdfaaaddddddddddddddddddddddddasdsdfbkdfjger gsdf glkwerqwsdvsiñomodsgt string with specialcharacters and etc etc asdfasdfwqfwefwfasdfasfasfasfasfasfasfasasfasfasfasfasfasfasfasfdasdsdfsafsafasfasfsafasfasfasfasfasfassafasfasfasdfkb sdfd ertge ertwgfwrt43 fbgdsf gw wfwf sdgas asfwr324rf635r sdgsa swe3er 6546 sfasdfsafas asfaasdfasfasf435hdhge sfsd g dfsafasfsa as"/></xml-tag><xml-tag name="_iterator_item_"><property key="_classname_" value="java.lang.Integer"/><property key="_value_" value="9323823"/></xml-tag><xml-tag name="_iterator_item_"><property key="_classname_" value="java.lang.Integer"/><property key="_value_" value="-234234234"/></xml-tag><xml-tag name="_iterator_item_"><property key="_classname_" value="java.lang.Integer"/><property key="_value_" value="0"/></xml-tag><xml-tag name="_iterator_item_"><property key="_classname_" value="java.lang.Boolean"/><property key="_value_" value="true"/></xml-tag><xml-tag name="_iterator_item_"><property key="_classname_" value="java.lang.Boolean"/><property key="_value_" value="false"/></xml-tag><xml-tag name="_iterator_item_"><property key="_classname_" value="com.iver.utiles.TestXMLEntityPersistenceManager$MyPersistentObject"/><xml-tag name="_item_data_"><property key="miValor" value="Sopa de cabrita"/><property key="numero" value="20090625"/></xml-tag></xml-tag><xml-tag name="_iterator_item_"><property key="_classname_" value="com.iver.utiles.TestXMLEntityPersistenceManager$MyPersistentContainer"/><xml-tag name="_item_data_"><property key="miObjetito2" value="piripi pi"/><property key="miObjetito3" value="lepe lepero"/><xml-tag name="miObjetito1"><property key="_classname_" value="com.iver.utiles.TestXMLEntityPersistenceManager$MyPersistentObject"/><xml-tag name="_item_data_"><property key="miValor" value="Sopa de cabrita"/><property key="numero" value="20090625"/></xml-tag></xml-tag></xml-tag></xml-tag></xml-tag></xml-tag></xml-tag></xml-tag><xml-tag name="miObjetito3"><property key="_classname_" value="com.iver.utiles.TestXMLEntityPersistenceManager$MyPersistentObject"/><xml-tag name="_item_data_"><property key="miValor" value="Sopa de cabrita"/><property key="numero" value="20090625"/></xml-tag></xml-tag></xml-tag></xml-tag> |
|
0 | 3 |
tags/v2_0_0_Build_2032/libraries/libIverUtiles/pom.xml | ||
---|---|---|
1 |
<?xml version="1.0" encoding="UTF-8"?> |
|
2 |
|
|
3 |
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" |
|
4 |
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 |
|
5 |
http://maven.apache.org/xsd/maven-4.0.0.xsd"> |
|
6 |
<modelVersion>4.0.0</modelVersion> |
|
7 |
<groupId>org.gvsig</groupId> |
|
8 |
<artifactId>org.gvsig.utils</artifactId> |
|
9 |
<packaging>jar</packaging> |
|
10 |
<version>2.0-SNAPSHOT</version> |
|
11 |
<name>libIverUtiles</name> |
|
12 |
<url>http://gvsig.org</url> |
|
13 |
<parent> |
|
14 |
<groupId>org.gvsig</groupId> |
|
15 |
<artifactId>gvsig-base-library-pom</artifactId> |
|
16 |
<version>2.0-SNAPSHOT</version> |
|
17 |
</parent> |
|
18 |
<distributionManagement> |
|
19 |
<site> |
|
20 |
<id>gvsig-repository</id> |
|
21 |
<url>${site-repository}/</url> |
|
22 |
</site> |
|
23 |
</distributionManagement> |
|
24 |
|
|
25 |
<dependencies> |
|
26 |
<dependency> |
|
27 |
<groupId>org.gvsig</groupId> |
|
28 |
<artifactId>org.gvsig.tools.lib</artifactId> |
|
29 |
<scope>compile</scope> |
|
30 |
</dependency> |
|
31 |
<dependency> |
|
32 |
<groupId>org.gvsig</groupId> |
|
33 |
<artifactId>org.gvsig.tools.lib</artifactId> |
|
34 |
<type>test-jar</type> |
|
35 |
<scope>test</scope> |
|
36 |
</dependency> |
|
37 |
<dependency> |
|
38 |
<groupId>castor</groupId> |
|
39 |
<artifactId>castor</artifactId> |
|
40 |
<scope>compile</scope> |
|
41 |
</dependency> |
|
42 |
</dependencies> |
|
43 |
<properties> |
|
44 |
<build-dir>${basedir}/../build</build-dir> |
|
45 |
<eclipse.project.name>libIverUtiles</eclipse.project.name> |
|
46 |
</properties> |
|
47 |
<build> |
|
48 |
<sourceDirectory>src</sourceDirectory> |
|
49 |
<testSourceDirectory>src-test</testSourceDirectory> |
|
50 |
<resources> |
|
51 |
<resource> |
|
52 |
<directory>src</directory> |
|
53 |
<includes> |
|
54 |
<include>**/*.gif</include> |
|
55 |
<include>**/*.png</include> |
|
56 |
<include>**/*.PNG</include> |
|
57 |
<include> **/*.bmp</include> |
|
58 |
<include> **/*.jpg</include> |
|
59 |
<include> **/*.jpeg</include> |
|
60 |
<include> **/*.properties</include> |
|
61 |
</includes> |
|
62 |
</resource> |
|
63 |
<resource> |
|
64 |
<directory>${basedir}/resources</directory> |
|
65 |
</resource> |
|
66 |
</resources> |
|
67 |
<testResources> |
|
68 |
<testResource> |
|
69 |
<directory>${basedir}/resources-test</directory> |
|
70 |
</testResource> |
|
71 |
</testResources> |
|
72 |
|
|
73 |
<!-- TODO: MAKE TESTS WORK AND REMOVE THIS OPTION --> |
|
74 |
<plugins> |
|
75 |
<plugin> |
|
76 |
<groupId>org.apache.maven.plugins</groupId> |
|
77 |
<artifactId>maven-surefire-plugin</artifactId> |
|
78 |
<configuration> |
|
79 |
<skipTests>true</skipTests> |
|
80 |
</configuration> |
|
81 |
</plugin> |
|
82 |
</plugins> |
|
83 |
|
|
84 |
</build> |
|
85 |
|
|
86 |
<reporting> |
|
87 |
<plugins> |
|
88 |
<plugin> |
|
89 |
<groupId>org.apache.maven.plugins</groupId> |
|
90 |
<artifactId>maven-javadoc-plugin</artifactId> |
|
91 |
<configuration> |
|
92 |
<name>Javadoc: API</name> |
|
93 |
<destDir>apidoc</destDir> |
|
94 |
<windowtitle>API Documentation</windowtitle> |
|
95 |
</configuration> |
|
96 |
</plugin> |
|
97 |
</plugins> |
|
98 |
</reporting> |
|
99 |
</project> |
tags/v2_0_0_Build_2032/libraries/libIverUtiles/resources/META-INF/services/org.gvsig.tools.library.Library | ||
---|---|---|
1 |
org.gvsig.tools.IverUtilesLibrary |
tags/v2_0_0_Build_2032/libraries/libIverUtiles/xmlEntity.xml | ||
---|---|---|
1 |
<project name="MyProject" default="generate-config-classes" basedir="."> |
|
2 |
<!-- set global properties for this build --> |
|
3 |
<property name="bin" location="bin" /> |
|
4 |
<property name="src" location="src" /> |
|
5 |
<property name="lib" location="lib" /> |
|
6 |
<property name="schemas" location="schemas" /> |
|
7 |
|
|
8 |
<target name="init"> |
|
9 |
<!-- Create the time stamp --> |
|
10 |
<tstamp /> |
|
11 |
</target> |
|
12 |
|
|
13 |
<!-- Genera las clases a partir de los esquemas --> |
|
14 |
<target name="generate-config-classes"> |
|
15 |
<delete> |
|
16 |
<fileset dir="${src}" includes="com/iver/utiles/xmlEntity/generate/**" /> |
|
17 |
</delete> |
|
18 |
<java classname="org.exolab.castor.builder.SourceGenerator"> |
|
19 |
<classpath> |
|
20 |
<pathelement path="../GVSIG/lib/castor-0.9.5.3-xml.jar" /> |
|
21 |
<pathelement path="../GVSIG/lib/xercesImpl.jar" /> |
|
22 |
</classpath> |
|
23 |
<arg value="-i" /> |
|
24 |
<arg value="${schemas}/xml-entity.xsd" /> |
|
25 |
<arg value="-package" /> |
|
26 |
<arg value="com.iver.utiles.xmlEntity.generate" /> |
|
27 |
<arg value="-dest" /> |
|
28 |
<arg value="${src}" /> |
|
29 |
</java> |
|
30 |
</target> |
|
31 |
|
|
32 |
</project> |
|
0 | 33 |
tags/v2_0_0_Build_2032/libraries/libIverUtiles/.cvsignore | ||
---|---|---|
1 |
bin |
|
2 |
bin-test |
|
0 | 3 |
tags/v2_0_0_Build_2032/libraries/libIverUtiles/src-test/org/gvsig/utils/TestStringUtilities.java | ||
---|---|---|
1 |
package org.gvsig.utils; |
|
2 |
|
|
3 |
import org.gvsig.utils.StringUtilities; |
|
4 |
|
|
5 |
import junit.framework.TestCase; |
|
6 |
|
|
7 |
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana |
|
8 |
* |
|
9 |
* Copyright (C) 2004 IVER T.I. and Generalitat Valenciana. |
|
10 |
* |
|
11 |
* This program is free software; you can redistribute it and/or |
|
12 |
* modify it under the terms of the GNU General Public License |
|
13 |
* as published by the Free Software Foundation; either version 2 |
|
14 |
* of the License, or (at your option) any later version. |
|
15 |
* |
|
16 |
* This program is distributed in the hope that it will be useful, |
|
17 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
18 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
19 |
* GNU General Public License for more details. |
|
20 |
* |
|
21 |
* You should have received a copy of the GNU General Public License |
|
22 |
* along with this program; if not, write to the Free Software |
|
23 |
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,USA. |
|
24 |
* |
|
25 |
* For more information, contact: |
|
26 |
* |
|
27 |
* Generalitat Valenciana |
|
28 |
* Conselleria d'Infraestructures i Transport |
|
29 |
* Av. Blasco Ib??ez, 50 |
|
30 |
* 46010 VALENCIA |
|
31 |
* SPAIN |
|
32 |
* |
|
33 |
* +34 963862235 |
|
34 |
* gvsig@gva.es |
|
35 |
* www.gvsig.gva.es |
|
36 |
* |
|
37 |
* or |
|
38 |
* |
|
39 |
* IVER T.I. S.A |
|
40 |
* Salamanca 50 |
|
41 |
* 46005 Valencia |
|
42 |
* Spain |
|
43 |
* |
|
44 |
* +34 963163400 |
|
45 |
* dac@iver.es |
|
46 |
*/ |
|
47 |
|
|
48 |
/** |
|
49 |
* This class tests some methods of the 'StringUtilities' class |
|
50 |
* (Now only tests the methods 'numberOfOccurrencesOfSubStringInString' and 'numberOfOccurrencesOfSubStringInStringUpToPosition') |
|
51 |
* |
|
52 |
* @author Pablo Piqueras Bartolom? (p_queras@hotmail.com) |
|
53 |
*/ |
|
54 |
public class TestStringUtilities extends TestCase{ |
|
55 |
private String word_String; |
|
56 |
private String word_subString; |
|
57 |
private boolean case_Sensitive; |
|
58 |
private int start_position; |
|
59 |
private int end_position; |
|
60 |
|
|
61 |
/* |
|
62 |
* (non-Javadoc) |
|
63 |
* @see junit.framework.TestCase#setUp() |
|
64 |
*/ |
|
65 |
protected void setUp() throws Exception { |
|
66 |
super.setUp(); |
|
67 |
word_String = new String(); |
|
68 |
word_subString = new String(); |
|
69 |
case_Sensitive = true; // By default, case sensitive |
|
70 |
} |
|
71 |
|
|
72 |
/* |
|
73 |
* (non-Javadoc) |
|
74 |
* @see junit.framework.TestCase#tearDown() |
|
75 |
*/ |
|
76 |
protected void tearDown() throws Exception { |
|
77 |
super.tearDown(); |
|
78 |
} |
|
79 |
|
|
80 |
/** |
|
81 |
* A test |
|
82 |
*/ |
|
83 |
public void test1() { |
|
84 |
word_String = "la casa es grande"; |
|
85 |
word_subString = "a"; |
|
86 |
case_Sensitive = true; |
|
87 |
|
|
88 |
System.out.print("Test1: El n?mero de ocurrencias"); |
|
89 |
|
|
90 |
if (case_Sensitive) |
|
91 |
System.out.print(" con distinci?n min?sculas/may?sculas "); |
|
92 |
else |
|
93 |
System.out.print(" sin distinci?n min?sculas/may?sculas "); |
|
94 |
|
|
95 |
System.out.println("de '" + word_subString + "' en '" + word_String + " es " + StringUtilities.numberOfOccurrencesOfSubStringInString(word_String, word_subString, case_Sensitive)); |
|
96 |
} |
|
97 |
|
|
98 |
/** |
|
99 |
* A test |
|
100 |
*/ |
|
101 |
public void test2() { |
|
102 |
word_String = "la casa es grande"; |
|
103 |
word_subString = "a"; |
|
104 |
case_Sensitive = false; |
|
105 |
|
|
106 |
System.out.print("Test2: El n?mero de ocurrencias"); |
|
107 |
|
|
108 |
if (case_Sensitive) |
|
109 |
System.out.print(" con distinci?n min?sculas/may?sculas "); |
|
110 |
else |
|
111 |
System.out.print(" sin distinci?n min?sculas/may?sculas "); |
|
112 |
|
|
113 |
System.out.println("de '" + word_subString + "' en '" + word_String + " es " + StringUtilities.numberOfOccurrencesOfSubStringInString(word_String, word_subString, case_Sensitive)); |
|
114 |
} |
|
115 |
|
|
116 |
/** |
|
117 |
* A test |
|
118 |
*/ |
|
119 |
public void test3() { |
|
120 |
word_String = "la casa es grande"; |
|
121 |
word_subString = "A"; |
|
122 |
case_Sensitive = true; |
|
123 |
|
|
124 |
System.out.print("Test3: El n?mero de ocurrencias"); |
|
125 |
|
|
126 |
if (case_Sensitive) |
|
127 |
System.out.print(" con distinci?n min?sculas/may?sculas "); |
|
128 |
else |
|
129 |
System.out.print(" sin distinci?n min?sculas/may?sculas "); |
|
130 |
|
|
131 |
System.out.println("de '" + word_subString + "' en '" + word_String + " es " + StringUtilities.numberOfOccurrencesOfSubStringInString(word_String, word_subString, case_Sensitive)); |
|
132 |
} |
|
133 |
|
|
134 |
/** |
|
135 |
* A test |
|
136 |
*/ |
|
137 |
public void test4() { |
|
138 |
word_String = "la casa es grande"; |
|
139 |
word_subString = "A"; |
|
140 |
case_Sensitive = false; |
|
141 |
|
|
142 |
System.out.print("Test4: El n?mero de ocurrencias"); |
|
143 |
|
|
144 |
if (case_Sensitive) |
|
145 |
System.out.print(" con distinci?n min?sculas/may?sculas "); |
|
146 |
else |
|
147 |
System.out.print(" sin distinci?n min?sculas/may?sculas "); |
|
148 |
|
|
149 |
System.out.println("de '" + word_subString + "' en '" + word_String + " es " + StringUtilities.numberOfOccurrencesOfSubStringInString(word_String, word_subString, case_Sensitive)); |
|
150 |
} |
|
151 |
|
|
152 |
/** |
|
153 |
* A test |
|
154 |
*/ |
|
155 |
public void test5() { |
|
156 |
word_String = "la casa es grande"; |
|
157 |
word_subString = "z"; |
|
158 |
case_Sensitive = true; |
|
159 |
|
|
160 |
System.out.print("Test5: El n?mero de ocurrencias"); |
|
161 |
|
|
162 |
if (case_Sensitive) |
|
163 |
System.out.print(" con distinci?n min?sculas/may?sculas "); |
|
164 |
else |
|
165 |
System.out.print(" sin distinci?n min?sculas/may?sculas "); |
|
166 |
|
|
167 |
System.out.println("de '" + word_subString + "' en '" + word_String + " es " + StringUtilities.numberOfOccurrencesOfSubStringInString(word_String, word_subString, case_Sensitive)); |
|
168 |
} |
|
169 |
|
|
170 |
/** |
|
171 |
* A test |
|
172 |
*/ |
|
173 |
public void test6() { |
|
174 |
word_String = "la casa es grande"; |
|
175 |
word_subString = "z"; |
|
176 |
case_Sensitive = false; |
|
177 |
|
|
178 |
System.out.print("Test6: El n?mero de ocurrencias"); |
|
179 |
|
|
180 |
if (case_Sensitive) |
|
181 |
System.out.print(" con distinci?n min?sculas/may?sculas "); |
|
182 |
else |
|
183 |
System.out.print(" sin distinci?n min?sculas/may?sculas "); |
|
184 |
|
|
185 |
System.out.println("de '" + word_subString + "' en '" + word_String + " es " + StringUtilities.numberOfOccurrencesOfSubStringInString(word_String, word_subString, case_Sensitive)); |
|
186 |
} |
|
187 |
|
|
188 |
/** |
|
189 |
* A test |
|
190 |
*/ |
|
191 |
public void test7() { |
|
192 |
word_String = "Frasecica: tres mas cuAtro menos dos no es lo mismo que cuatro menos dos mas cinco ni que cuatro menos dos mas dos ni que cuatro menos cuatro mas diez. ?Cierto no?"; |
|
193 |
word_subString = "cuatro menos dos"; |
|
194 |
case_Sensitive = true; |
|
195 |
|
|
196 |
System.out.print("Test7: El n?mero de ocurrencias"); |
|
197 |
|
|
198 |
if (case_Sensitive) |
|
199 |
System.out.print(" con distinci?n min?sculas/may?sculas "); |
|
200 |
else |
|
201 |
System.out.print(" sin distinci?n min?sculas/may?sculas "); |
|
202 |
|
|
203 |
System.out.println("de '" + word_subString + "' en '" + word_String + " es " + StringUtilities.numberOfOccurrencesOfSubStringInString(word_String, word_subString, case_Sensitive)); |
|
204 |
} |
|
205 |
|
|
206 |
/** |
|
207 |
* A test |
|
208 |
*/ |
|
209 |
public void test8() { |
|
210 |
word_String = "Frasecica: tres mas cuAtro menos dos no es lo mismo que cuatro menos dos mas cinco ni que cuatro menos dos mas dos ni que cuatro menos cuatro mas diez. ?Cierto no?"; |
|
211 |
word_subString = "cuatro menos Dos"; |
|
212 |
case_Sensitive = true; |
|
213 |
|
|
214 |
System.out.print("Test8: El n?mero de ocurrencias"); |
|
215 |
|
|
216 |
if (case_Sensitive) |
|
217 |
System.out.print(" con distinci?n min?sculas/may?sculas "); |
|
218 |
else |
|
219 |
System.out.print(" sin distinci?n min?sculas/may?sculas "); |
|
220 |
|
|
221 |
System.out.println("de '" + word_subString + "' en '" + word_String + " es " + StringUtilities.numberOfOccurrencesOfSubStringInString(word_String, word_subString, case_Sensitive)); |
|
222 |
} |
|
223 |
|
|
224 |
/** |
|
225 |
* A test |
|
226 |
*/ |
|
227 |
public void test9() { |
|
228 |
word_String = "Frasecica: tres mas cuAtro menos dos no es lo mismo que cuatro menos dos mas cinco ni que cuatro menos dos mas dos ni que cuatro menos cuatro mas diez. ?Cierto no?"; |
|
229 |
word_subString = "cuatro menos dos"; |
|
230 |
case_Sensitive = false; |
|
231 |
|
|
232 |
System.out.print("Test9: El n?mero de ocurrencias"); |
|
233 |
|
|
234 |
if (case_Sensitive) |
|
235 |
System.out.print(" con distinci?n min?sculas/may?sculas "); |
|
236 |
else |
|
237 |
System.out.print(" sin distinci?n min?sculas/may?sculas "); |
|
238 |
|
|
239 |
System.out.println("de '" + word_subString + "' en '" + word_String + " es " + StringUtilities.numberOfOccurrencesOfSubStringInString(word_String, word_subString, case_Sensitive)); |
|
240 |
} |
|
241 |
|
|
242 |
/** |
|
243 |
* A test |
|
244 |
*/ |
|
245 |
public void test10() { |
|
246 |
word_String = "Frasecica: tres mas cuAtro menos dos no es lo mismo que cuatro menos dos mas cinco ni que cuatro menos dos mas dos ni que cuatro menos cuatro mas diez. ?Cierto no?"; |
|
247 |
word_subString = "cuatro menos Dos"; |
|
248 |
case_Sensitive = false; |
|
249 |
|
|
250 |
System.out.print("Test10: El n?mero de ocurrencias"); |
|
251 |
|
|
252 |
if (case_Sensitive) |
|
253 |
System.out.print(" con distinci?n min?sculas/may?sculas "); |
|
254 |
else |
|
255 |
System.out.print(" sin distinci?n min?sculas/may?sculas "); |
|
256 |
|
|
257 |
System.out.println("de '" + word_subString + "' en '" + word_String + " es " + StringUtilities.numberOfOccurrencesOfSubStringInString(word_String, word_subString, case_Sensitive)); |
|
258 |
} |
|
259 |
|
|
260 |
/** |
|
261 |
* A test |
|
262 |
*/ |
|
263 |
public void test11() { |
|
264 |
word_String = "Frasecica: tres mas cuAtro menos dos no es lo mismo que cuatro menos dos mas cinco ni que cuatro menos dos mas dos ni que cuatro menos cuatro mas diez. ?Cierto no?"; |
|
265 |
word_subString = "cuatro menos Dos"; |
|
266 |
case_Sensitive = false; |
|
267 |
start_position = 0; |
|
268 |
end_position = word_String.length(); |
|
269 |
|
|
270 |
System.out.print("Test11: El n?mero de ocurrencias entre posiciones " + start_position + " y " + end_position); |
|
271 |
|
|
272 |
if (case_Sensitive) |
|
273 |
System.out.print(" con distinci?n min?sculas/may?sculas "); |
|
274 |
else |
|
275 |
System.out.print(" sin distinci?n min?sculas/may?sculas "); |
|
276 |
|
|
277 |
System.out.println("de '" + word_subString + "' en '" + word_String + " es " + StringUtilities.numberOfOccurrencesOfSubStringInStringBetweenPositions(word_String, word_subString, case_Sensitive, start_position, end_position)); |
|
278 |
} |
|
279 |
|
|
280 |
/** |
|
281 |
* A test |
|
282 |
*/ |
|
283 |
public void test12() { |
|
284 |
word_String = "Frasecica: tres mas cuAtro menos dos no es lo mismo que cuatro menos dos mas cinco ni que cuatro menos dos mas dos ni que cuatro menos cuatro mas diez. ?Cierto no?"; |
|
285 |
word_subString = "cuatro menos dos"; |
|
286 |
case_Sensitive = true; |
|
287 |
start_position = 20; |
|
288 |
end_position = 72; |
|
289 |
|
|
290 |
System.out.print("Test12: El n?mero de ocurrencias entre posiciones " + start_position + " y " + end_position); |
|
291 |
|
|
292 |
if (case_Sensitive) |
|
293 |
System.out.print(" con distinci?n min?sculas/may?sculas "); |
|
294 |
else |
|
295 |
System.out.print(" sin distinci?n min?sculas/may?sculas "); |
|
296 |
|
|
297 |
System.out.println("de '" + word_subString + "' en '" + word_String + " es " + StringUtilities.numberOfOccurrencesOfSubStringInStringBetweenPositions(word_String, word_subString, case_Sensitive, start_position, end_position)); |
|
298 |
} |
|
299 |
|
|
300 |
/** |
|
301 |
* A test |
|
302 |
*/ |
|
303 |
public void test13() { |
|
304 |
word_String = "Frasecica: tres mas cuAtro menos dos no es lo mismo que cuatro menos dos mas cinco ni que cuatro menos dos mas dos ni que cuatro menos cuatro mas diez. ?Cierto no?"; |
|
305 |
word_subString = "cuatro menos Dos"; |
|
306 |
case_Sensitive = true; |
|
307 |
start_position = 20; |
|
308 |
end_position = 72; |
|
309 |
|
|
310 |
System.out.print("Test13: El n?mero de ocurrencias entre posiciones " + start_position + " y " + end_position); |
|
311 |
|
|
312 |
if (case_Sensitive) |
|
313 |
System.out.print(" con distinci?n min?sculas/may?sculas "); |
|
314 |
else |
|
315 |
System.out.print(" sin distinci?n min?sculas/may?sculas "); |
|
316 |
|
|
317 |
System.out.println("de '" + word_subString + "' en '" + word_String + " es " + StringUtilities.numberOfOccurrencesOfSubStringInStringBetweenPositions(word_String, word_subString, case_Sensitive, start_position, end_position)); |
|
318 |
} |
|
319 |
|
|
320 |
/** |
|
321 |
* A test |
|
322 |
*/ |
|
323 |
public void test14() { |
|
324 |
word_String = "Frasecica: tres mas cuAtro menos dos no es lo mismo que cuatro menos dos mas cinco ni que cuatro menos dos mas dos ni que cuatro menos cuatro mas diez. ?Cierto no?"; |
|
325 |
word_subString = "cuatro menos dos"; |
|
326 |
case_Sensitive = false; |
|
327 |
start_position = 20; |
|
328 |
end_position = 72; |
|
329 |
|
|
330 |
System.out.print("Test14: El n?mero de ocurrencias entre posiciones " + start_position + " y " + end_position); |
|
331 |
|
|
332 |
if (case_Sensitive) |
|
333 |
System.out.print(" con distinci?n min?sculas/may?sculas "); |
|
334 |
else |
|
335 |
System.out.print(" sin distinci?n min?sculas/may?sculas "); |
|
336 |
|
|
337 |
System.out.println("de '" + word_subString + "' en '" + word_String + " es " + StringUtilities.numberOfOccurrencesOfSubStringInStringBetweenPositions(word_String, word_subString, case_Sensitive, start_position, end_position)); |
|
338 |
} |
|
339 |
|
|
340 |
/** |
|
341 |
* A test |
|
342 |
*/ |
|
343 |
public void test15() { |
|
344 |
word_String = "Frasecica: tres mas cuAtro menos dos no es lo mismo que cuatro menos dos mas cinco ni que cuatro menos dos mas dos ni que cuatro menos cuatro mas diez. ?Cierto no?"; |
|
345 |
word_subString = "cuatro menos Dos"; |
|
346 |
case_Sensitive = false; |
|
347 |
start_position = 20; |
|
348 |
end_position = 72; |
|
349 |
|
|
350 |
System.out.print("Test15: El n?mero de ocurrencias entre posiciones " + start_position + " y " + end_position); |
|
351 |
|
|
352 |
if (case_Sensitive) |
|
353 |
System.out.print(" con distinci?n min?sculas/may?sculas "); |
|
354 |
else |
|
355 |
System.out.print(" sin distinci?n min?sculas/may?sculas "); |
|
356 |
|
|
357 |
System.out.println("de '" + word_subString + "' en '" + word_String + " es " + StringUtilities.numberOfOccurrencesOfSubStringInStringBetweenPositions(word_String, word_subString, case_Sensitive, start_position, end_position)); |
|
358 |
} |
|
359 |
|
|
360 |
/** |
|
361 |
* A test |
|
362 |
*/ |
|
363 |
public void test16() { |
|
364 |
word_String = "Frasecica: tres mas cuAtro menos dos no es lo mismo que cuatro menos dos mas cinco ni que cuatro menos dos mas dos ni que cuatro menos cuatro mas diez. ?Cierto no?"; |
|
365 |
word_subString = "cuatro menos dos"; |
|
366 |
case_Sensitive = true; |
|
367 |
start_position = 21; |
|
368 |
end_position = 72; |
|
369 |
|
|
370 |
System.out.print("Test16: El n?mero de ocurrencias entre posiciones " + start_position + " y " + end_position); |
|
371 |
|
|
372 |
if (case_Sensitive) |
|
373 |
System.out.print(" con distinci?n min?sculas/may?sculas "); |
|
374 |
else |
|
375 |
System.out.print(" sin distinci?n min?sculas/may?sculas "); |
|
376 |
|
|
377 |
System.out.println("de '" + word_subString + "' en '" + word_String + " es " + StringUtilities.numberOfOccurrencesOfSubStringInStringBetweenPositions(word_String, word_subString, case_Sensitive, start_position, end_position)); |
|
378 |
} |
|
379 |
|
|
380 |
/** |
|
381 |
* A test |
|
382 |
*/ |
|
383 |
public void test17() { |
|
384 |
word_String = "Frasecica: tres mas cuAtro menos dos no es lo mismo que cuatro menos dos mas cinco ni que cuatro menos dos mas dos ni que cuatro menos cuatro mas diez. ?Cierto no?"; |
|
385 |
word_subString = "cuatro menos Dos"; |
|
386 |
case_Sensitive = true; |
|
387 |
start_position = 21; |
|
388 |
end_position = 72; |
|
389 |
|
|
390 |
System.out.print("Test17: El n?mero de ocurrencias entre posiciones " + start_position + " y " + end_position); |
|
391 |
|
|
392 |
if (case_Sensitive) |
|
393 |
System.out.print(" con distinci?n min?sculas/may?sculas "); |
|
394 |
else |
|
395 |
System.out.print(" sin distinci?n min?sculas/may?sculas "); |
|
396 |
|
|
397 |
System.out.println("de '" + word_subString + "' en '" + word_String + " es " + StringUtilities.numberOfOccurrencesOfSubStringInStringBetweenPositions(word_String, word_subString, case_Sensitive, start_position, end_position)); |
|
398 |
} |
|
399 |
|
|
400 |
/** |
|
401 |
* A test |
|
402 |
*/ |
|
403 |
public void test18() { |
|
404 |
word_String = "Frasecica: tres mas cuAtro menos dos no es lo mismo que cuatro menos dos mas cinco ni que cuatro menos dos mas dos ni que cuatro menos cuatro mas diez. ?Cierto no?"; |
|
405 |
word_subString = "cuatro menos dos"; |
|
406 |
case_Sensitive = false; |
|
407 |
start_position = 21; |
|
408 |
end_position = 72; |
|
409 |
|
|
410 |
System.out.print("Test18: El n?mero de ocurrencias entre posiciones " + start_position + " y " + end_position); |
|
411 |
|
|
412 |
if (case_Sensitive) |
|
413 |
System.out.print(" con distinci?n min?sculas/may?sculas "); |
|
414 |
else |
|
415 |
System.out.print(" sin distinci?n min?sculas/may?sculas "); |
|
416 |
|
|
417 |
System.out.println("de '" + word_subString + "' en '" + word_String + " es " + StringUtilities.numberOfOccurrencesOfSubStringInStringBetweenPositions(word_String, word_subString, case_Sensitive, start_position, end_position)); |
|
418 |
} |
|
419 |
|
|
420 |
/** |
|
421 |
* A test |
|
422 |
*/ |
|
423 |
public void test19() { |
|
424 |
word_String = "Frasecica: tres mas cuAtro menos dos no es lo mismo que cuatro menos dos mas cinco ni que cuatro menos dos mas dos ni que cuatro menos cuatro mas diez. ?Cierto no?"; |
|
425 |
word_subString = "cuatro menos Dos"; |
|
426 |
case_Sensitive = false; |
|
427 |
start_position = 21; |
|
428 |
end_position = 72; |
|
429 |
|
|
430 |
System.out.print("Test19: El n?mero de ocurrencias entre posiciones " + start_position + " y " + end_position); |
|
431 |
|
|
432 |
if (case_Sensitive) |
|
433 |
System.out.print(" con distinci?n min?sculas/may?sculas "); |
|
434 |
else |
|
435 |
System.out.print(" sin distinci?n min?sculas/may?sculas "); |
|
436 |
|
|
437 |
System.out.println("de '" + word_subString + "' en '" + word_String + " es " + StringUtilities.numberOfOccurrencesOfSubStringInStringBetweenPositions(word_String, word_subString, case_Sensitive, start_position, end_position)); |
|
438 |
} |
|
439 |
} |
|
0 | 440 |
tags/v2_0_0_Build_2032/libraries/libIverUtiles/src-test/org/gvsig/utils/centerComponent/TestCenterComponent.java | ||
---|---|---|
1 |
package org.gvsig.utils.centerComponent; |
|
2 |
|
|
3 |
import java.awt.Color; |
|
4 |
import java.awt.Dimension; |
|
5 |
import java.awt.Point; |
|
6 |
import java.awt.Rectangle; |
|
7 |
import java.awt.Toolkit; |
|
8 |
import java.awt.event.MouseAdapter; |
|
9 |
import java.awt.event.MouseEvent; |
|
10 |
|
|
11 |
import javax.swing.JDesktopPane; |
|
12 |
import javax.swing.JDialog; |
|
13 |
import javax.swing.JFrame; |
|
14 |
import javax.swing.JInternalFrame; |
|
15 |
import javax.swing.JPanel; |
|
16 |
|
|
17 |
import org.gvsig.utils.centerComponent.CenterComponent; |
|
18 |
|
|
19 |
|
|
20 |
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana |
|
21 |
* |
|
22 |
* Copyright (C) 2004 IVER T.I. and Generalitat Valenciana. |
|
23 |
* |
|
24 |
* This program is free software; you can redistribute it and/or |
|
25 |
* modify it under the terms of the GNU General Public License |
|
26 |
* as published by the Free Software Foundation; either version 2 |
|
27 |
* of the License, or (at your option) any later version. |
|
28 |
* |
|
29 |
* This program is distributed in the hope that it will be useful, |
|
30 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
31 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
32 |
* GNU General Public License for more details. |
|
33 |
* |
|
34 |
* You should have received a copy of the GNU General Public License |
|
35 |
* along with this program; if not, write to the Free Software |
|
36 |
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,USA. |
|
37 |
* |
|
38 |
* For more information, contact: |
|
39 |
* |
|
40 |
* Generalitat Valenciana |
|
41 |
* Conselleria d'Infraestructures i Transport |
|
42 |
* Av. Blasco Ib??ez, 50 |
|
43 |
* 46010 VALENCIA |
|
44 |
* SPAIN |
|
45 |
* |
|
46 |
* +34 963862235 |
|
47 |
* gvsig@gva.es |
|
48 |
* www.gvsig.gva.es |
|
49 |
* |
|
50 |
* or |
|
51 |
* |
|
52 |
* IVER T.I. S.A |
|
53 |
* Salamanca 50 |
|
54 |
* 46005 Valencia |
|
55 |
* Spain |
|
56 |
* |
|
57 |
* +34 963163400 |
|
58 |
* dac@iver.es |
|
59 |
*/ |
|
60 |
|
|
61 |
/** |
|
62 |
* Tests the 'centerJComponent' method of the CenterJComponent class |
|
63 |
* |
|
64 |
* @author Pablo Piqueras Bartolom? (p_queras@hotmail.com) |
|
65 |
*/ |
|
66 |
public class TestCenterComponent { |
|
67 |
private static JFrame jFrame; |
|
68 |
private static JDesktopPane jDesktopPane; |
|
69 |
private static int i; |
|
70 |
|
|
71 |
/** |
|
72 |
* Test method for the CenterJComponent |
|
73 |
* |
|
74 |
* @param args |
|
75 |
*/ |
|
76 |
public static void main (String args[]) |
|
77 |
{ |
|
78 |
try { |
|
79 |
// Creates the main JFrame and configures it for test. Adds a JDesktopPane |
|
80 |
jFrame = new JFrame("JFrame: Tests 1, 2 y 3"); |
|
81 |
|
|
82 |
jDesktopPane = new JDesktopPane(); |
|
83 |
jDesktopPane.setPreferredSize(new Dimension(300, 300)); |
|
84 |
jDesktopPane.setSize(new Dimension(300, 300)); |
|
85 |
jDesktopPane.addMouseListener(new MouseAdapter() { |
|
86 |
|
|
87 |
/* |
|
88 |
* (non-Javadoc) |
|
89 |
* @see java.awt.event.MouseListener#mouseClicked(java.awt.event.MouseEvent) |
|
90 |
*/ |
|
91 |
public void mouseClicked(MouseEvent e) { |
|
92 |
createComponentsForTest(); |
|
93 |
} |
|
94 |
}); |
|
95 |
|
|
96 |
jFrame.getContentPane().add(jDesktopPane); |
|
97 |
jFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); |
|
98 |
jFrame.pack(); |
|
99 |
jFrame.setVisible(true); |
|
100 |
|
|
101 |
// By default: centers the JFrame in the screen |
|
102 |
Point screenTopLeftCorner = new Point(0, 0); |
|
103 |
Dimension screenDimension = Toolkit.getDefaultToolkit().getScreenSize(); |
|
104 |
Rectangle screenRectangle = new Rectangle(screenTopLeftCorner, screenDimension); |
|
105 |
CenterComponent.centerComponent(jFrame, screenRectangle); |
|
106 |
// jFrame.setLocationRelativeTo(null); |
|
107 |
|
|
108 |
i = 0; |
|
109 |
createComponentsForTest(); |
|
110 |
} |
|
111 |
catch(Exception e) { |
|
112 |
e.printStackTrace(); |
|
113 |
} |
|
114 |
|
|
115 |
} |
|
116 |
|
|
117 |
/** |
|
118 |
* Creates some objects for test |
|
119 |
*/ |
|
120 |
private static void createComponentsForTest() { |
|
121 |
|
|
122 |
// Creates a JInternalFrame with a JPanel, and adds it |
|
123 |
JInternalFrame jInternalFrame1 = new JInternalFrame("JInternalFrame" + i, |
|
124 |
true, // resizable |
|
125 |
true, // closable |
|
126 |
true, // maximizable |
|
127 |
false); //iconizable |
|
128 |
jInternalFrame1.setPreferredSize(new Dimension(200, 200)); |
|
129 |
jInternalFrame1.setSize(new Dimension(200, 200)); |
|
130 |
|
|
131 |
JPanel jPanel1 = new JPanel(); |
|
132 |
jPanel1.setBackground(Color.BLUE); |
|
133 |
jInternalFrame1.getContentPane().add(jPanel1); |
|
134 |
jInternalFrame1.setVisible(true); |
|
135 |
jDesktopPane.add(jInternalFrame1); |
|
136 |
|
|
137 |
// Creates a JDialog with a JPanel, and adds it |
|
138 |
JDialog jDialog = new JDialog(); |
|
139 |
jDialog.setTitle("JDialog " + i); |
|
140 |
jDialog.setSize(new Dimension(100, 150)); |
|
141 |
JPanel jPanel2 = new JPanel(); |
|
142 |
jPanel2.setBackground(Color.GREEN); |
|
143 |
jDialog.getContentPane().add(jPanel2); |
|
144 |
jDialog.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE); |
|
145 |
jDialog.setVisible(true); |
|
146 |
|
|
147 |
// Centers the JInternalFrame |
|
148 |
CenterComponent.centerComponent(jInternalFrame1, jDesktopPane.getBounds()); |
|
149 |
|
|
150 |
// Centers the JDialog |
|
151 |
jDialog.setLocationRelativeTo(jFrame.getContentPane()); |
|
152 |
|
|
153 |
i++; |
|
154 |
} |
|
155 |
} |
|
0 | 156 |
tags/v2_0_0_Build_2032/libraries/libIverUtiles/src-test/org/gvsig/utils/search/TestBinarySearchUsingFirstCharacters.java | ||
---|---|---|
1 |
package org.gvsig.utils.search; |
|
2 |
|
|
3 |
import java.text.Collator; |
|
4 |
import java.util.ArrayList; |
|
5 |
import java.util.Collections; |
|
6 |
import java.util.Comparator; |
|
7 |
import java.util.List; |
|
8 |
import java.util.Locale; |
|
9 |
import java.util.Vector; |
|
10 |
|
|
11 |
import org.gvsig.utils.CompareLists; |
|
12 |
import org.gvsig.utils.StringComparator; |
|
13 |
import org.gvsig.utils.search.BinarySearchUsingFirstCharacters; |
|
14 |
|
|
15 |
|
|
16 |
import junit.framework.TestCase; |
|
17 |
|
|
18 |
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana |
|
19 |
* |
|
20 |
* Copyright (C) 2004 IVER T.I. and Generalitat Valenciana. |
|
21 |
* |
|
22 |
* This program is free software; you can redistribute it and/or |
|
23 |
* modify it under the terms of the GNU General Public License |
|
24 |
* as published by the Free Software Foundation; either version 2 |
|
25 |
* of the License, or (at your option) any later version. |
|
26 |
* |
|
27 |
* This program is distributed in the hope that it will be useful, |
|
28 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
29 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
30 |
* GNU General Public License for more details. |
|
31 |
* |
|
32 |
* You should have received a copy of the GNU General Public License |
|
33 |
* along with this program; if not, write to the Free Software |
|
34 |
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,USA. |
|
35 |
* |
|
36 |
* For more information, contact: |
|
37 |
* |
|
38 |
* Generalitat Valenciana |
|
39 |
* Conselleria d'Infraestructures i Transport |
|
40 |
* Av. Blasco Ib??ez, 50 |
|
41 |
* 46010 VALENCIA |
|
42 |
* SPAIN |
|
43 |
* |
|
44 |
* +34 963862235 |
|
45 |
* gvsig@gva.es |
|
46 |
* www.gvsig.gva.es |
|
47 |
* |
|
48 |
* or |
|
49 |
* |
|
50 |
* IVER T.I. S.A |
|
51 |
* Salamanca 50 |
|
52 |
* 46005 Valencia |
|
53 |
* Spain |
|
54 |
* |
|
55 |
* +34 963163400 |
|
56 |
* dac@iver.es |
|
57 |
*/ |
|
58 |
|
|
59 |
/** |
|
60 |
* Tests the static methods of BinarySearchUsingFirstCharacters |
|
61 |
* |
|
62 |
* @author Pablo Piqueras Bartolom? (p_queras@hotmail.com) |
|
63 |
*/ |
|
64 |
public class TestBinarySearchUsingFirstCharacters extends TestCase { |
|
65 |
private static String text; |
|
66 |
private static Vector v1; |
|
67 |
private static Vector v2; |
|
68 |
private static List list; |
|
69 |
private static List results; |
|
70 |
private static StringComparator stringComparator; |
|
71 |
// private static StringComparatorForItems stringComparatorForItems; |
|
72 |
|
|
73 |
/* |
|
74 |
* (non-Javadoc) |
|
75 |
* @see junit.framework.TestCase#setUp() |
|
76 |
*/ |
|
77 |
protected void setUp() throws Exception { |
|
78 |
super.setUp(); |
|
79 |
|
|
80 |
// Initialize the text |
|
81 |
text = ""; |
|
82 |
|
|
83 |
// Initialize the StringComparator |
|
84 |
stringComparator = new StringComparator(); |
|
85 |
|
|
86 |
// Initialize the StringComparatorForItems |
|
87 |
// stringComparatorForItems = new StringComparatorForItems(); |
|
88 |
|
|
89 |
// Initialize the vector of Items (for test methods without the parameter Comparator) |
|
90 |
v1 = new Vector(); |
|
91 |
v1.add(new Item("extWMS")); |
|
92 |
v1.add(new Item("libUI")); |
|
93 |
v1.add(new Item("extWMS")); |
|
94 |
v1.add(new Item("libRemoteServices")); |
|
95 |
v1.add(new Item("extWFS2")); |
|
96 |
v1.add(new Item("libNomenclatorIGN")); |
|
97 |
v1.add(new Item("libNomenclatorIGN_GUI")); |
|
98 |
v1.add(new Item("libIverUtiles")); |
|
99 |
v1.add(new Item("extWFS2")); |
|
100 |
v1.add(new Item("EXTWFS2")); |
|
101 |
v1.add(new Item("extWFS2")); |
|
102 |
v1.add(new Item("libGDBMS")); |
|
103 |
v1.add(new Item("libInternationalization")); |
|
104 |
v1.add(new Item("libFMap")); |
|
105 |
v1.add(new Item("libuiDownCase")); |
|
106 |
v1.add(new Item("6")); |
|
107 |
v1.add(new Item("4")); |
|
108 |
v1.add(new Item("3")); |
|
109 |
v1.add(new Item("5")); |
|
110 |
v1.add(new Item("2")); |
|
111 |
v1.add(new Item("1")); |
|
112 |
v1.add(new Item("extWFS2")); |
|
113 |
v1.add(new Item("libExceptions")); |
|
114 |
v1.add(new Item("libDriverManager")); |
|
115 |
v1.add(new Item("libCq CMS for java")); |
|
116 |
v1.add(new Item("libCorePlugin")); |
|
117 |
v1.add(new Item("extWFS2")); |
|
118 |
v1.add(new Item("extAddIDEELayers")); |
|
119 |
v1.add(new Item("extAlertCClient")); |
|
120 |
v1.add(new Item("extCAD")); |
|
121 |
v1.add(new Item("extWFS2")); |
|
122 |
v1.add(new Item("?and?")); |
|
123 |
v1.add(new Item("?and?")); |
|
124 |
v1.add(new Item("extJDBC")); |
|
125 |
v1.add(new Item("extMyPlugin")); |
|
126 |
v1.add(new Item("extRasterTools")); |
|
127 |
v1.add(new Item("extScripting")); |
|
128 |
v1.add(new Item("extWCS")); |
|
129 |
v1.add(new Item("extWFS2")); |
|
130 |
v1.add(new Item("extwfs2")); |
|
131 |
v1.add(new Item("extWMS")); |
|
132 |
v1.add(new Item("extWMS")); |
|
133 |
v1.add(new Item("extWCS")); |
|
134 |
v1.add(new Item("7")); |
|
135 |
v1.add(new Item("9")); |
|
136 |
v1.add(new Item("8")); |
|
137 |
v1.add(new Item("0")); |
|
138 |
v1.add(new Item("EXTWCS")); |
|
139 |
v1.add(new Item("?and?")); |
|
140 |
v1.add(new Item("extensi?n")); |
|
141 |
v1.add(new Item("?AND?")); |
|
142 |
v1.add(new Item("_fwAndami")); |
|
143 |
v1.add(new Item("abcdefghijklmn?opqrstuvwxyz")); |
|
144 |
v1.add(new Item("?")); |
|
145 |
v1.add(new Item("appgvSIG")); |
|
146 |
v1.add(new Item("la casa")); |
|
147 |
v1.add(new Item("la monta?a")); |
|
148 |
v1.add(new Item("la colina")); |
|
149 |
v1.add(new Item("las abejas")); |
|
150 |
v1.add(new Item("las nutrias")); |
|
151 |
v1.add(new Item("las ballenas")); |
|
152 |
v1.add(new Item("lasa?a")); |
|
153 |
v1.add(new Item("Vector")); |
|
154 |
v1.add(new Item("?e")); |
|
155 |
|
|
156 |
// Initialize the vector of Strings (for test methods with the parameter Comparator) |
|
157 |
v2 = new Vector(); |
|
158 |
v2.add("extWMS"); |
|
159 |
v2.add("libUI"); |
|
160 |
v2.add("extWMS"); |
|
161 |
v2.add("libRemoteServices"); |
|
162 |
v2.add("extWFS2"); |
|
163 |
v2.add("libNomenclatorIGN"); |
|
164 |
v2.add("libNomenclatorIGN_GUI"); |
|
165 |
v2.add("libIverUtiles"); |
|
166 |
v2.add("extWFS2"); |
|
167 |
v2.add("EXTWFS2"); |
|
168 |
v2.add("extWFS2"); |
|
169 |
v2.add("libGDBMS"); |
|
170 |
v2.add("libInternationalization"); |
|
171 |
v2.add("libFMap"); |
|
172 |
v2.add("libuiDownCase"); |
|
173 |
v2.add("6"); |
|
174 |
v2.add("4"); |
|
175 |
v2.add("3"); |
|
176 |
v2.add("5"); |
|
177 |
v2.add("2"); |
|
178 |
v2.add("1"); |
|
179 |
v2.add("extWFS2"); |
|
180 |
v2.add("libExceptions"); |
|
181 |
v2.add("libDriverManager"); |
|
182 |
v2.add("libCq CMS for java"); |
|
183 |
v2.add("libCorePlugin"); |
|
184 |
v2.add("extWFS2"); |
|
185 |
v2.add("extAddIDEELayers"); |
|
186 |
v2.add("extAlertCClient"); |
|
187 |
v2.add("extCAD"); |
|
188 |
v2.add("extWFS2"); |
|
189 |
v2.add("?and?"); |
|
190 |
v2.add("?and?"); |
|
191 |
v2.add("extJDBC"); |
|
192 |
v2.add("extMyPlugin"); |
|
193 |
v2.add("extRasterTools"); |
|
194 |
v2.add("extScripting"); |
|
195 |
v2.add("extWCS"); |
|
196 |
v2.add("extWFS2"); |
|
197 |
v2.add("extwfs2"); |
|
198 |
v2.add("extWMS"); |
|
199 |
v2.add("extWMS"); |
|
200 |
v2.add("extWCS"); |
|
201 |
v2.add("7"); |
|
202 |
v2.add("9"); |
|
203 |
v2.add("8"); |
|
204 |
v2.add("0"); |
|
205 |
v2.add("EXTWCS"); |
|
206 |
v2.add("?and?"); |
|
207 |
v2.add("extensi?n"); |
|
208 |
v2.add("?AND?"); |
|
209 |
v2.add("_fwAndami"); |
|
210 |
v2.add("abcdefghijklmn?opqrstuvwxyz"); |
|
211 |
v2.add("?"); |
|
212 |
v2.add("appgvSIG"); |
|
213 |
v2.add("la casa"); |
|
214 |
v2.add("la monta?a"); |
|
215 |
v2.add("la colina"); |
|
216 |
v2.add("las abejas"); |
|
217 |
v2.add("las nutrias"); |
|
218 |
v2.add("las ballenas"); |
|
219 |
v2.add("lasa?a"); |
|
220 |
v2.add("Vector"); |
|
221 |
v2.add("?e"); |
|
222 |
|
|
223 |
// Sort items of the two vectors |
|
224 |
Collator collator = Collator.getInstance(new Locale("es_ES")); |
|
225 |
// stringComparatorForItems.setLocaleRules(stringComparatorForItems.new LocaleRules(true, collator)); |
|
226 |
// Collections.sort(v1.subList(0, v1.size()), stringComparatorForItems); |
|
227 |
|
|
228 |
// The algorithm of sort is the default used by Java (that makes some subsets: one for numbers, one for words that starts in big letters, |
|
229 |
// another that stats in small letters, another with 'special' characters, etc) |
|
230 |
Collections.sort(v1.subList(0, v1.size())); |
|
231 |
|
|
232 |
stringComparator.setLocaleRules(stringComparator.new LocaleRules(true, collator)); |
|
233 |
Collections.sort(v2.subList(0, v2.size()), stringComparator); |
|
234 |
} |
|
235 |
|
|
236 |
/* |
|
237 |
* (non-Javadoc) |
|
238 |
* @see junit.framework.TestCase#tearDown() |
|
239 |
*/ |
|
240 |
protected void tearDown() throws Exception { |
|
241 |
super.tearDown(); |
|
242 |
} |
|
243 |
|
|
244 |
///// TEST OPERATION: doSearchConsideringCaseSensitive(String, Vector) ///// |
|
245 |
|
|
246 |
/** |
|
247 |
* A test |
|
248 |
*/ |
|
249 |
public void test1() { |
|
250 |
try { |
|
251 |
text = ""; |
|
252 |
list = BinarySearchUsingFirstCharacters.doSearchConsideringCaseSensitive(text, v1); |
|
253 |
|
|
254 |
// List of results |
|
255 |
results = v1.subList(0, v1.size()); |
|
256 |
|
|
257 |
System.out.println("Test 1:\nText: " + text + "\nResults of the search: " + list + "\nResults expected: " + results); |
|
258 |
|
|
259 |
if (CompareLists.compare(list, results)) { |
|
260 |
System.out.println("Op: doSearchConsideringCaseSensitive(String, Vector) -> OK"); |
|
261 |
} else { |
|
262 |
System.out.println("Op: doSearchConsideringCaseSensitive(String, Vector) -> FAILED"); |
|
263 |
fail(); |
|
264 |
} |
|
265 |
} catch (Exception e) { |
|
266 |
e.printStackTrace(); |
|
267 |
} |
|
268 |
} |
|
269 |
|
|
270 |
/** |
|
271 |
* A test |
|
272 |
*/ |
|
273 |
public void test2() { |
|
274 |
try { |
|
275 |
text = "ext"; |
|
276 |
list = BinarySearchUsingFirstCharacters.doSearchConsideringCaseSensitive("ext", v1); |
|
277 |
|
|
278 |
// List of results |
|
279 |
results = new ArrayList(); |
|
280 |
results.add(new Item("extAddIDEELayers")); |
|
281 |
results.add(new Item("extAlertCClient")); |
|
282 |
results.add(new Item("extCAD")); |
|
283 |
results.add(new Item("extJDBC")); |
|
284 |
results.add(new Item("extMyPlugin")); |
|
285 |
results.add(new Item("extRasterTools")); |
|
286 |
results.add(new Item("extScripting")); |
|
287 |
results.add(new Item("extWCS")); |
|
288 |
results.add(new Item("extWCS")); |
|
289 |
results.add(new Item("extWFS2")); |
|
290 |
results.add(new Item("extWFS2")); |
|
291 |
results.add(new Item("extWFS2")); |
|
292 |
results.add(new Item("extWFS2")); |
|
293 |
results.add(new Item("extWFS2")); |
|
294 |
results.add(new Item("extWFS2")); |
|
295 |
results.add(new Item("extWFS2")); |
|
296 |
results.add(new Item("extWMS")); |
|
297 |
results.add(new Item("extWMS")); |
|
298 |
results.add(new Item("extWMS")); |
|
299 |
results.add(new Item("extWMS")); |
|
300 |
results.add(new Item("extensi?n")); |
|
301 |
results.add(new Item("extwfs2")); |
|
302 |
|
|
303 |
System.out.println("\nTest 2:\nText: " + text + "\nResults of the search: " + list + "\nResults expected: " + results); |
|
304 |
|
|
305 |
if (CompareLists.compare(list, results)) { |
|
306 |
System.out.println("Op: doSearchConsideringCaseSensitive(String, Vector) -> OK"); |
|
307 |
} else { |
|
308 |
System.out.println("Op: doSearchConsideringCaseSensitive(String, Vector) -> FAILED"); |
|
309 |
fail(); |
|
310 |
} |
|
311 |
} catch (Exception e) { |
|
312 |
e.printStackTrace(); |
|
313 |
} |
|
314 |
} |
|
315 |
|
|
316 |
/** |
|
317 |
* A test |
|
318 |
*/ |
|
319 |
public void test3() { |
|
320 |
try { |
|
321 |
text = "libUI"; |
|
322 |
list = BinarySearchUsingFirstCharacters.doSearchConsideringCaseSensitive(text, v1); |
|
323 |
|
|
324 |
// List of results |
|
325 |
results = new ArrayList(); |
|
326 |
results.add(new Item("libUI")); |
|
327 |
|
|
328 |
System.out.println("\nTest 3:\nText: " + text + "\nResults of the search: " + list + "\nResults expected: " + results); |
|
329 |
|
|
330 |
if (CompareLists.compare(list, results)) { |
|
331 |
System.out.println("Op: doSearchConsideringCaseSensitive(String, Vector) -> OK"); |
|
332 |
} else { |
|
333 |
System.out.println("Op: doSearchConsideringCaseSensitive(String, Vector) -> FAILED"); |
|
334 |
fail(); |
|
335 |
} |
|
336 |
} catch (Exception e) { |
|
337 |
e.printStackTrace(); |
|
338 |
} |
|
339 |
} |
|
340 |
|
|
341 |
/** |
|
342 |
* A test |
|
343 |
*/ |
|
344 |
public void test4() { |
|
345 |
try { |
|
346 |
text = "extWFS2"; |
|
347 |
list = BinarySearchUsingFirstCharacters.doSearchConsideringCaseSensitive(text, v1); |
|
348 |
|
|
349 |
// List 4 of results |
|
350 |
results = new ArrayList(); |
|
351 |
results.add(new Item("extWFS2")); |
|
352 |
results.add(new Item("extWFS2")); |
|
353 |
results.add(new Item("extWFS2")); |
|
354 |
results.add(new Item("extWFS2")); |
|
355 |
results.add(new Item("extWFS2")); |
|
356 |
results.add(new Item("extWFS2")); |
|
357 |
results.add(new Item("extWFS2")); |
|
358 |
|
|
359 |
System.out.println("\nTest 4:\nText: " + text + "\nResults of the search: " + list + "\nResults expected: " + results); |
|
360 |
|
|
361 |
if (CompareLists.compare(list, results)) { |
|
362 |
System.out.println("Op: doSearchConsideringCaseSensitive(String, Vector) -> OK"); |
|
363 |
} else { |
|
364 |
System.out.println("Op: doSearchConsideringCaseSensitive(String, Vector) -> FAILED"); |
|
365 |
fail(); |
|
366 |
} |
|
367 |
} catch (Exception e) { |
|
368 |
e.printStackTrace(); |
|
369 |
} |
|
370 |
} |
|
371 |
|
|
372 |
/** |
|
373 |
* A test |
|
374 |
*/ |
|
375 |
public void test5() { |
|
376 |
try { |
|
377 |
text = "extWFS2a"; |
|
378 |
list = BinarySearchUsingFirstCharacters.doSearchConsideringCaseSensitive(text, v1); |
|
379 |
|
|
380 |
// List of results (without elements) |
|
381 |
results = null; |
|
382 |
|
|
383 |
System.out.println("\nTest 5:\nText: " + text + "\nResults of the search: " + list + "\nResults expected: " + results); |
|
384 |
|
|
385 |
if (CompareLists.compare(list, results)) { |
|
386 |
System.out.println("Op: doSearchConsideringCaseSensitive(String, Vector) -> OK"); |
|
387 |
} else { |
|
388 |
System.out.println("Op: doSearchConsideringCaseSensitive(String, Vector) -> FAILED"); |
|
389 |
fail(); |
|
390 |
} |
|
391 |
} catch (Exception e) { |
|
392 |
e.printStackTrace(); |
|
393 |
} |
|
394 |
} |
|
395 |
|
|
396 |
/** |
|
397 |
* A test |
|
398 |
*/ |
|
399 |
public void test6() { |
|
400 |
try { |
|
401 |
text = "?and?"; |
|
402 |
list = BinarySearchUsingFirstCharacters.doSearchConsideringCaseSensitive(text, v1); |
|
403 |
|
|
404 |
// List of results |
|
405 |
results = new ArrayList(); |
|
406 |
results.add(new Item("?and?")); |
|
407 |
|
|
408 |
System.out.println("\nTest 6:\nText: " + text + "\nResults of the search: " + list + "\nResults expected: " + results); |
|
409 |
|
|
410 |
if (CompareLists.compare(list, results)) { |
|
411 |
System.out.println("Op: doSearchConsideringCaseSensitive(String, Vector) -> OK"); |
|
412 |
} else { |
|
413 |
System.out.println("Op: doSearchConsideringCaseSensitive(String, Vector) -> FAILED"); |
|
414 |
fail(); |
|
415 |
} |
|
416 |
} catch (Exception e) { |
|
417 |
e.printStackTrace(); |
|
418 |
} |
|
419 |
} |
|
420 |
|
|
421 |
/** |
|
422 |
* A test |
|
423 |
*/ |
|
424 |
public void test7() { |
|
425 |
try { |
|
426 |
text = "?AND?"; |
|
427 |
list = BinarySearchUsingFirstCharacters.doSearchConsideringCaseSensitive(text, v1); |
|
428 |
|
|
429 |
// List of results |
|
430 |
results = new ArrayList(); |
|
431 |
results.add(new Item("?AND?")); |
|
432 |
|
|
433 |
System.out.println("\nTest 7:\nText: " + text + "\nResults of the search: " + list + "\nResults expected: " + results); |
|
434 |
|
|
435 |
if (CompareLists.compare(list, results)) { |
|
436 |
System.out.println("Op: doSearchConsideringCaseSensitive(String, Vector) -> OK"); |
|
437 |
} else { |
|
438 |
System.out.println("Op: doSearchConsideringCaseSensitive(String, Vector) -> FAILED"); |
|
439 |
fail(); |
|
440 |
} |
|
441 |
} catch (Exception e) { |
|
442 |
e.printStackTrace(); |
|
443 |
} |
|
444 |
} |
|
445 |
|
|
446 |
/** |
|
447 |
* A test |
|
448 |
*/ |
|
449 |
public void test8() { |
|
450 |
try { |
|
451 |
text = "la "; |
|
452 |
list = BinarySearchUsingFirstCharacters.doSearchConsideringCaseSensitive(text, v1); |
|
453 |
|
|
454 |
// List of results |
|
455 |
results = new ArrayList(); |
|
456 |
results.add(new Item("la casa")); |
|
457 |
results.add(new Item("la colina")); |
|
458 |
results.add(new Item("la monta?a")); |
|
459 |
|
|
460 |
System.out.println("\nTest 8:\nText: " + text + "\nResults of the search: " + list + "\nResults expected: " + results); |
|
461 |
|
|
462 |
if (CompareLists.compare(list, results)) { |
|
463 |
System.out.println("Op: doSearchConsideringCaseSensitive(String, Vector) -> OK"); |
|
464 |
} else { |
|
465 |
System.out.println("Op: doSearchConsideringCaseSensitive(String, Vector) -> FAILED"); |
|
466 |
fail(); |
|
467 |
} |
|
468 |
} catch (Exception e) { |
|
469 |
e.printStackTrace(); |
|
470 |
} |
|
471 |
} |
|
472 |
|
|
473 |
/** |
|
474 |
* A test |
|
475 |
*/ |
|
476 |
public void test9() { |
|
477 |
try { |
|
478 |
text = "livUI"; |
|
479 |
list = BinarySearchUsingFirstCharacters.doSearchConsideringCaseSensitive(text, v1); |
|
480 |
|
|
481 |
// List of results (without elements) |
|
482 |
results = null; |
|
483 |
|
|
484 |
System.out.println("\nTest 9:\nText: " + text + "\nResults of the search: " + list + "\nResults expected: " + results); |
|
485 |
|
|
486 |
if (CompareLists.compare(list, results)) { |
|
487 |
System.out.println("Op: doSearchConsideringCaseSensitive(String, Vector) -> OK"); |
|
488 |
} else { |
|
489 |
System.out.println("Op: doSearchConsideringCaseSensitive(String, Vector) -> FAILED"); |
|
490 |
fail(); |
|
491 |
} |
|
492 |
} catch (Exception e) { |
|
493 |
e.printStackTrace(); |
|
494 |
} |
|
495 |
} |
|
496 |
|
|
497 |
/** |
|
498 |
* A test |
|
499 |
*/ |
|
500 |
public void test9_1() { |
|
501 |
try { |
|
502 |
text = "libui"; |
|
503 |
list = BinarySearchUsingFirstCharacters.doSearchConsideringCaseSensitive(text, v1); |
|
504 |
|
|
505 |
// List of results (without elements) |
|
506 |
results = new ArrayList(); |
|
507 |
results.add(new Item("libuiDownCase")); |
|
508 |
|
|
509 |
System.out.println("\nTest 9_1:\nText: " + text + "\nResults of the search: " + list + "\nResults expected: " + results); |
|
510 |
|
|
511 |
if (CompareLists.compare(list, results)) { |
|
512 |
System.out.println("Op: doSearchConsideringCaseSensitive(String, Vector) -> OK"); |
|
513 |
} else { |
|
514 |
System.out.println("Op: doSearchConsideringCaseSensitive(String, Vector) -> FAILED"); |
|
515 |
fail(); |
|
516 |
} |
|
517 |
} catch (Exception e) { |
|
518 |
e.printStackTrace(); |
|
519 |
} |
|
520 |
} |
|
521 |
|
|
522 |
/** |
|
523 |
* A test |
|
524 |
*/ |
|
525 |
public void test10() { |
|
526 |
try { |
|
527 |
text = "?"; |
|
528 |
list = BinarySearchUsingFirstCharacters.doSearchConsideringCaseSensitive(text, v1); |
|
529 |
|
|
530 |
// List of results (without elements) |
|
531 |
results = new ArrayList(); |
|
532 |
results.add(new Item("?")); |
|
533 |
|
|
534 |
System.out.println("\nTest 10:\nText: " + text + "\nResults of the search: " + list + "\nResults expected: " + results); |
|
535 |
|
|
536 |
if (CompareLists.compare(list, results)) { |
|
537 |
System.out.println("Op: doSearchConsideringCaseSensitive(String, Vector) -> OK"); |
|
538 |
} else { |
|
539 |
System.out.println("Op: doSearchConsideringCaseSensitive(String, Vector) -> FAILED"); |
|
540 |
fail(); |
|
541 |
} |
|
542 |
} catch (Exception e) { |
|
543 |
e.printStackTrace(); |
|
544 |
} |
|
545 |
} |
|
546 |
///// END TEST OPERATION: doSearchConsideringCaseSensitive(String, Vector) ///// |
|
547 |
|
|
548 |
///// TEST OPERATION: doSearchWithoutConsideringCaseSensitive(String, Vector) ///// |
|
549 |
|
|
550 |
/** |
|
551 |
* A test |
|
552 |
*/ |
|
553 |
public void test11() { |
|
554 |
try { |
|
555 |
text = ""; |
|
556 |
list = BinarySearchUsingFirstCharacters.doSearchIgnoringCaseSensitive(text, v1); |
|
557 |
|
|
558 |
// List of results |
|
559 |
results = v1.subList(0, v1.size()); |
|
560 |
|
|
561 |
System.out.println("\nTest 11:\nText: " + text + "\nResults of the search: " + list + "\nResults expected: " + results); |
|
562 |
|
|
563 |
if (CompareLists.compareIgnoringCaseSensitive(list, results)) { |
|
564 |
System.out.println("Op: doSearchIgnoringCaseSensitive(String, Vector) -> OK"); |
|
565 |
} else { |
|
566 |
System.out.println("Op: doSearchIgnoringCaseSensitive(String, Vector) -> FAILED"); |
|
567 |
fail(); |
|
568 |
} |
|
569 |
} catch (Exception e) { |
|
570 |
e.printStackTrace(); |
|
571 |
} |
|
572 |
} |
|
573 |
|
|
574 |
/** |
|
575 |
* A test |
|
576 |
*/ |
|
577 |
public void test12() { |
|
578 |
try { |
|
579 |
text = "ext"; |
|
580 |
list = BinarySearchUsingFirstCharacters.doSearchIgnoringCaseSensitive(text, v1); |
|
581 |
|
|
582 |
// List of results |
|
583 |
results = new ArrayList(); |
|
584 |
results.add(new Item("extAddIDEELayers")); |
|
585 |
results.add(new Item("extAlertCClient")); |
|
586 |
results.add(new Item("extCAD")); |
|
587 |
results.add(new Item("extJDBC")); |
|
588 |
results.add(new Item("extMyPlugin")); |
|
589 |
results.add(new Item("extRasterTools")); |
Also available in: Unified diff