Revision 38007

View differences:

tags/v2_0_0_Build_2045/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_2045/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_2045/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_2045/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
	<artifactId>org.gvsig.utils</artifactId>
8
	<packaging>jar</packaging>
9
	<version>2.0-SNAPSHOT</version>
10
	<name>libIverUtiles</name>
11
	<parent>
12
		<groupId>org.gvsig</groupId>
13
		<artifactId>gvsig-base-library-pom</artifactId>
14
		<version>2.0-SNAPSHOT</version>
15
	</parent>	
16
	<dependencies>
17
        <dependency>
18
            <groupId>org.gvsig</groupId>
19
            <artifactId>org.gvsig.tools.lib</artifactId>
20
            <scope>compile</scope>
21
        </dependency>
22
        <dependency>
23
            <groupId>org.gvsig</groupId>
24
            <artifactId>org.gvsig.tools.swing.api</artifactId>
25
            <scope>compile</scope>
26
        </dependency>
27
        <dependency>
28
            <groupId>org.gvsig</groupId>
29
            <artifactId>org.gvsig.tools.lib</artifactId>
30
            <type>test-jar</type>
31
            <scope>test</scope>
32
        </dependency>
33
		<dependency>
34
			<groupId>castor</groupId>
35
			<artifactId>castor</artifactId>
36
            <scope>compile</scope>
37
		</dependency>	
38
	</dependencies>
39
	<properties>
40
		<build-dir>${basedir}/../build</build-dir>
41
        <eclipse.project.name>libIverUtiles</eclipse.project.name>
42
	</properties>
43
	<build>
44
		<sourceDirectory>src</sourceDirectory>
45
		<testSourceDirectory>src-test</testSourceDirectory>
46
		<resources>
47
			<resource>
48
				<directory>src</directory>
49
				<includes>
50
					<include>**/*.gif</include>
51
					<include>**/*.png</include>
52
					<include>**/*.PNG</include>
53
					<include> **/*.bmp</include>
54
					<include> **/*.jpg</include>
55
					<include> **/*.jpeg</include>
56
					<include> **/*.properties</include>
57
				</includes>
58
			</resource>
59
			<resource>
60
				<directory>${basedir}/resources</directory>
61
			</resource>
62
		</resources>
63
		<testResources>
64
			<testResource>
65
				<directory>${basedir}/resources-test</directory>
66
			</testResource>
67
		</testResources>
68
		
69
		<!-- TODO: MAKE TESTS WORK AND REMOVE THIS OPTION -->
70
		<plugins>
71
			<plugin>
72
				<groupId>org.apache.maven.plugins</groupId>
73
				<artifactId>maven-surefire-plugin</artifactId>
74
				<configuration>
75
					<skipTests>true</skipTests>
76
				</configuration>
77
			</plugin>
78
		</plugins>
79
		
80
	</build>
81
	
82
	<reporting>
83
		<plugins>
84
			<plugin>
85
				<groupId>org.apache.maven.plugins</groupId>
86
				<artifactId>maven-javadoc-plugin</artifactId>
87
				<configuration>
88
					<name>Javadoc: API</name>
89
					<destDir>apidoc</destDir>
90
					<windowtitle>API Documentation</windowtitle>
91
				</configuration>
92
			</plugin>
93
		</plugins>
94
	</reporting>	
95
</project>
tags/v2_0_0_Build_2045/libraries/libIverUtiles/resources/META-INF/services/org.gvsig.tools.library.Library
1
org.gvsig.tools.IverUtilesLibrary
tags/v2_0_0_Build_2045/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_2045/libraries/libIverUtiles/.cvsignore
1
bin
2
bin-test
0 3

  
tags/v2_0_0_Build_2045/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_2045/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"));
590
			results.add(new Item("extScripting"));
591
			results.add(new Item("extWCS"));
592
			results.add(new Item("extWCS"));
593
			results.add(new Item("extWFS2"));
594
			results.add(new Item("extWFS2"));
595
			results.add(new Item("extWFS2"));
596
			results.add(new Item("extWFS2"));
597
			results.add(new Item("extWFS2"));
598
			results.add(new Item("extWFS2"));
599
			results.add(new Item("extWFS2"));
600
			results.add(new Item("extWMS"));
601
			results.add(new Item("extWMS"));
602
			results.add(new Item("extWMS"));
603
			results.add(new Item("extWMS"));
604
			results.add(new Item("extensi?n"));
605
			results.add(new Item("extwfs2"));
606
							
607
			System.out.println("Test 12:\nText: " + text + "\nResults of the search: " + list + "\nResults expected: " + results);
608
				
609
			if (CompareLists.compareIgnoringCaseSensitive(list, results)) {
610
				System.out.println("Op: doSearchIgnoringCaseSensitive(String, Vector) -> OK");
611
			} else {
612
				System.out.println("Op: doSearchIgnoringCaseSensitive(String, Vector) -> FAILED");
613
				fail();
614
			}
615
		} catch (Exception e) {
616
			e.printStackTrace();
617
		}
618
	}
619
	
620
	/**
621
	 * A test
622
	 */
623
	public void test13() {
624
		try {
625
			text = "libUI";
626
			list = BinarySearchUsingFirstCharacters.doSearchIgnoringCaseSensitive(text, v1);
627

  
628
			// List of results
629
			results = new ArrayList();
630
			results.add(new Item("libUI"));
631
			results.add(new Item("libuiDownCase"));
632
					
633
			System.out.println("Test 13:\nText: " + text + "\nResults of the search: " + list + "\nResults expected: " + results);
634
				
635
			if (CompareLists.compareIgnoringCaseSensitive(list, results)) {
636
				System.out.println("Op: doSearchIgnoringCaseSensitive(String, Vector) -> OK");
637
			} else {
638
				System.out.println("Op: doSearchIgnoringCaseSensitive(String, Vector) -> FAILED");
639
				fail();
640
			}
641
		} catch (Exception e) {
642
			e.printStackTrace();
643
		}
644
	}
645
	
646
	/**
647
	 * A test
648
	 */
649
	public void test14() {
650
		try {
651
			text = "extWFS2";
652
			list = BinarySearchUsingFirstCharacters.doSearchIgnoringCaseSensitive(text, v1);
653
			
654
			// List of results
655
			results = new ArrayList();
656
			results.add(new Item("extWFS2"));
657
			results.add(new Item("extWFS2"));
658
			results.add(new Item("extWFS2"));
659
			results.add(new Item("extWFS2"));
660
			results.add(new Item("extWFS2"));
661
			results.add(new Item("extWFS2"));
662
			results.add(new Item("extWFS2"));
663
			results.add(new Item("extwfs2"));
664

  
665
			System.out.println("Test 14:\nText: " + text + "\nResults of the search: " + list + "\nResults expected: " + results);
666
				
667
			if (CompareLists.compareIgnoringCaseSensitive(list, results)) {
668
				System.out.println("Op: doSearchIgnoringCaseSensitive(String, Vector) -> OK");
669
			} else {
670
				System.out.println("Op: doSearchIgnoringCaseSensitive(String, Vector) -> FAILED");
671
				fail();
672
			}
673
		} catch (Exception e) {
674
			e.printStackTrace();
675
		}
676
	}
677
	
678
	/**
679
	 * A test
680
	 */
681
	public void test15() {
682
		try {
683
			text = "extWFS2a";
684
			list = BinarySearchUsingFirstCharacters.doSearchIgnoringCaseSensitive(text, v1);
685
			
686
			// List of results (without elements)
687
			results = null;
688
							
689
			System.out.println("Test 15:\nText: " + text + "\nResults of the search: " + list + "\nResults expected: " + results);
690
				
691
			if (CompareLists.compareIgnoringCaseSensitive(list, results)) {
692
				System.out.println("Op: doSearchIgnoringCaseSensitive(String, Vector) -> OK");
693
			} else {
694
				System.out.println("Op: doSearchIgnoringCaseSensitive(String, Vector) -> FAILED");
695
				fail();
696
			}
697
		} catch (Exception e) {
698
			e.printStackTrace();
699
		}
700
	}
701
	
702
	/**
703
	 * A test
704
	 */
705
	public void test16() {
706
		try {
707
			text = "?";
708
			list = BinarySearchUsingFirstCharacters.doSearchIgnoringCaseSensitive(text, v1);
709
			
710
			// List of results
711
			results = new ArrayList();
712
			results.add(new Item("?e"));
713
			results.add(new Item("?"));
714
					
715
			System.out.println("Test 16:\nText: " + text + "\nResults of the search: " + list + "\nResults expected: " + results);
716
				
717
			if (CompareLists.compareIgnoringCaseSensitive(list, results)) {
718
				System.out.println("Op: doSearchIgnoringCaseSensitive(String, Vector) -> OK");
719
			} else {
720
				System.out.println("Op: doSearchIgnoringCaseSensitive(String, Vector) -> FAILED");
721
				fail();
722
			}
723
		} catch (Exception e) {
724
			e.printStackTrace();
725
		}
726
	}
727
	
728
	/**
729
	 * A test
730
	 */
731
	public void test17() {
732
		try {
733
			text = "La ";
734
			list = BinarySearchUsingFirstCharacters.doSearchIgnoringCaseSensitive(text, v1);
735
			
736
			// List of results
737
			results = new ArrayList();
738
			results.add(new Item("la casa"));
739
			results.add(new Item("la colina"));
740
			results.add(new Item("la monta?a"));
741

  
742
			System.out.println("Test 17:\nText: " + text + "\nResults of the search: " + list + "\nResults expected: " + results);
743
				
744
			if (CompareLists.compareIgnoringCaseSensitive(list, results)) {
745
				System.out.println("Op: doSearchIgnoringCaseSensitive(String, Vector) -> OK");
746
			} else {
747
				System.out.println("Op: doSearchIgnoringCaseSensitive(String, Vector) -> FAILED");
748
				fail();
749
			}
750
		} catch (Exception e) {
751
			e.printStackTrace();
752
		}
753
	}
754
	
755
	/**
756
	 * A test
757
	 */
758
	public void test18() {
759
		try {
760
			text = "livUI";
761
			list = BinarySearchUsingFirstCharacters.doSearchIgnoringCaseSensitive(text, v1);
762
			
763
			// List of results
764
			results = null;
765

  
766
			System.out.println("Test 18:\nText: " + text + "\nResults of the search: " + list + "\nResults expected: " + results);
767
				
768
			if (CompareLists.compareIgnoringCaseSensitive(list, results)) {
769
				System.out.println("Op: doSearchIgnoringCaseSensitive(String, Vector) -> OK");
770
			} else {
771
				System.out.println("Op: doSearchIgnoringCaseSensitive(String, Vector) -> FAILED");
772
				fail();
773
			}
774
		} catch (Exception e) {
775
			e.printStackTrace();
776
		}
777
	}
778
	
779
	/**
780
	 * A test
781
	 */
782
	public void test18_1() {
783
		try {
784
			text = "libui";
785
			list = BinarySearchUsingFirstCharacters.doSearchIgnoringCaseSensitive(text, v1);
786
			
787
			// List of results
788
			results = new ArrayList();
789
			results.add(new Item("libUI"));
790
			results.add(new Item("libuiDownCase"));
791

  
792
			System.out.println("Test 18_1:\nText: " + text + "\nResults of the search: " + list + "\nResults expected: " + results);
793
				
794
			if (CompareLists.compareIgnoringCaseSensitive(list, results)) {
795
				System.out.println("Op: doSearchIgnoringCaseSensitive(String, Vector) -> OK");
796
			} else {
797
				System.out.println("Op: doSearchIgnoringCaseSensitive(String, Vector) -> FAILED");
798
				fail();
799
			}
800
		} catch (Exception e) {
801
			e.printStackTrace();
802
		}
803
	}
804
	
805
	/**
806
	 * A test
807
	 */
808
	public void test19() {
809
		try {
810
			text = "?AND?";
811
			list = BinarySearchUsingFirstCharacters.doSearchIgnoringCaseSensitive(text, v1);
812
			
813
			// List of results
814
			results = new ArrayList();
815
			results.add(new Item("?AND?"));
816
			results.add(new Item("?and?"));
817
			results.add(new Item("?and?"));
818
			results.add(new Item("?and?"));
819

  
820
			System.out.println("Test 19:\nText: " + text + "\nResults of the search: " + list + "\nResults expected: " + results);
821
				
822
			if (CompareLists.compareIgnoringCaseSensitive(list, results)) {
823
				System.out.println("Op: doSearchIgnoringCaseSensitive(String, Vector) -> OK");
824
			} else {
825
				System.out.println("Op: doSearchIgnoringCaseSensitive(String, Vector) -> FAILED");
826
				fail();
827
			}
828
		} catch (Exception e) {
829
			e.printStackTrace();
830
		}
831
	}
832

  
833
	///// END TEST OPERATION: doSearchWithoutConsideringCaseSensitive(String, Vector) /////
834
	
835
	///// TEST OPERATION: doSearchConsideringCaseSensitive(String, Vector, Comparator) /////
836
	/**
837
	 * A test
838
	 */
839
	public void test21() {
840
		try {
841
			text = "";
842
			stringComparator.setCaseSensitive(true);
843
			list = BinarySearchUsingFirstCharacters.doSearchConsideringCaseSensitive(text, v2, stringComparator);
844
			
845
			// List of results
846
			results = v2.subList(0, v2.size());
847

  
848
			System.out.println("Test 21:\nText: " + text + "\nResults of the search: " + list + "\nResults expected: " + results);
849
			
850
			if (CompareLists.compare(list, results, stringComparator)) {
851
				System.out.println("Op: doSearchConsideringCaseSensitive(String, Vector, Comparator) -> OK");
852
			} else {
853
				System.out.println("Op: doSearchConsideringCaseSensitive(String, Vector, Comparator) -> FAILED");
854
				fail();
855
			}
856
		} catch (Exception e) {
857
			e.printStackTrace();
858
		}
859
	}
860
	
861
	/**
862
	 * A test
863
	 */
864
	public void test22() {
865
		try {
866
			text = "ext";
867
			stringComparator.setCaseSensitive(true);
868
			list = BinarySearchUsingFirstCharacters.doSearchConsideringCaseSensitive(text, v2, stringComparator);
869
			
870
			// List of results
871
			results = new ArrayList();
872
			results.add("extAddIDEELayers");
873
			results.add("extAlertCClient");
874
			results.add("extCAD");
875
			results.add("extensi?n");
876
			results.add("extJDBC");
877
			results.add("extMyPlugin");
878
			results.add("extRasterTools");
879
			results.add("extScripting");
880
			results.add("extWCS");
881
			results.add("extWCS");
882
			results.add("extwfs2");
883
			results.add("extWFS2");
884
			results.add("extWFS2");
885
			results.add("extWFS2");
886
			results.add("extWFS2");
887
			results.add("extWFS2");
888
			results.add("extWFS2");
889
			results.add("extWFS2");
890
			results.add("extWMS");
891
			results.add("extWMS");
892
			results.add("extWMS");
893
			results.add("extWMS");
894

  
895
						
896
			System.out.println("\nTest 22:\nText: " + text + "\nResults of the search: " + list + "\nResults expected: " + results);
897
			
898
			if (CompareLists.compare(list, results, stringComparator)) {
899
				System.out.println("Op: doSearchConsideringCaseSensitive(String, Vector, Comparator) -> OK");
900
			} else {
901
				System.out.println("Op: doSearchConsideringCaseSensitive(String, Vector, Comparator) -> FAILED");
902
				fail();
903
			}
904
		} catch (Exception e) {
905
			e.printStackTrace();
906
		}
907
	}
908

  
909
	/**
910
	 * A test
911
	 */
912
	public void test23() {
913
		try {
914
			text = "libUI";
915
			stringComparator.setCaseSensitive(true);
916
			list = BinarySearchUsingFirstCharacters.doSearchConsideringCaseSensitive(text, v2, stringComparator);
917
			
918
			// List of results
919
			results = new ArrayList();
920
			results.add("libUI");
921
						
922
			System.out.println("\nTest 23:\nText: " + text + "\nResults of the search: " + list + "\nResults expected: " + results);
923
			
924
			if (CompareLists.compare(list, results, stringComparator)) {
925
				System.out.println("Op: doSearchConsideringCaseSensitive(String, Vector, Comparator) -> OK");
926
			} else {
927
				System.out.println("Op: doSearchConsideringCaseSensitive(String, Vector, Comparator) -> FAILED");
928
				fail();
929
			}
930
		} catch (Exception e) {
931
			e.printStackTrace();
932
		}
933
	}
934
	
935
	/**
936
	 * A test
937
	 */
938
	public void test24() {
939
		try {
940
			text = "extWFS2";
941
			stringComparator.setCaseSensitive(true);
942
			list = BinarySearchUsingFirstCharacters.doSearchConsideringCaseSensitive(text, v2, stringComparator);
943
			
944
			// List 4 of results
945
			results = new ArrayList();
946
			results.add("extWFS2");
947
			results.add("extWFS2");
948
			results.add("extWFS2");
949
			results.add("extWFS2");
950
			results.add("extWFS2");
951
			results.add("extWFS2");
952
			results.add("extWFS2");		
953
						
954
			System.out.println("\nTest 24:\nText: " + text + "\nResults of the search: " + list + "\nResults expected: " + results);
955
			
956
			if (CompareLists.compare(list, results, stringComparator)) {
957
				System.out.println("Op: doSearchConsideringCaseSensitive(String, Vector, Comparator) -> OK");
958
			} else {
959
				System.out.println("Op: doSearchConsideringCaseSensitive(String, Vector, Comparator) -> FAILED");
960
				fail();
961
			}
962
		} catch (Exception e) {
963
			e.printStackTrace();
964
		}
965
	}
966
	
967
	/**
968
	 * A test
969
	 */
970
	public void test25() {
971
		try {
972
			text = "extWFS2a";
973
			stringComparator.setCaseSensitive(true);
974
			list = BinarySearchUsingFirstCharacters.doSearchConsideringCaseSensitive(text, v2, stringComparator);
975
			
976
			// List of results (without elements)
977
			results = null;
978
						
979
			System.out.println("\nTest 25:\nText: " + text + "\nResults of the search: " + list + "\nResults expected: " + results);
980
			
981
			if (CompareLists.compare(list, results, stringComparator)) {
982
				System.out.println("Op: doSearchConsideringCaseSensitive(String, Vector, Comparator) -> OK");
983
			} else {
984
				System.out.println("Op: doSearchConsideringCaseSensitive(String, Vector, Comparator) -> FAILED");
985
				fail();
986
			}
987
		} catch (Exception e) {
988
			e.printStackTrace();
989
		}
990
	}
991
	
992
	/**
993
	 * A test
994
	 */
995
	public void test26() {
996
		try {
997
			text = "?and?";
998
			stringComparator.setCaseSensitive(true);
999
			list = BinarySearchUsingFirstCharacters.doSearchConsideringCaseSensitive(text, v2, stringComparator);
1000
			
1001
			// List of results
1002
			results = new ArrayList();
1003
			results.add("?and?");
1004
						
1005
			System.out.println("\nTest 26:\nText: " + text + "\nResults of the search: " + list + "\nResults expected: " + results);
1006
			
1007
			if (CompareLists.compare(list, results, stringComparator)) {
1008
				System.out.println("Op: doSearchConsideringCaseSensitive(String, Vector, Comparator) -> OK");
1009
			} else {
1010
				System.out.println("Op: doSearchConsideringCaseSensitive(String, Vector, Comparator) -> FAILED");
1011
				fail();
1012
			}
1013
		} catch (Exception e) {
1014
			e.printStackTrace();
1015
		}
1016
	}
1017
	
1018
	/**
1019
	 * A test
1020
	 */
1021
	public void test27() {
1022
		try {
1023
			text = "?AND?";
1024
			stringComparator.setCaseSensitive(true);
1025
			list = BinarySearchUsingFirstCharacters.doSearchConsideringCaseSensitive(text, v2, stringComparator);
1026
			
1027
			// List of results
1028
			results = new ArrayList();
1029
			results.add("?AND?");
1030
						
1031
			System.out.println("\nTest 27:\nText: " + text + "\nResults of the search: " + list + "\nResults expected: " + results);
1032
			
1033
			if (CompareLists.compare(list, results, stringComparator)) {
1034
				System.out.println("Op: doSearchConsideringCaseSensitive(String, Vector, Comparator) -> OK");
1035
			} else {
1036
				System.out.println("Op: doSearchConsideringCaseSensitive(String, Vector, Comparator) -> FAILED");
1037
				fail();
1038
			}
1039
		} catch (Exception e) {
1040
			e.printStackTrace();
1041
		}
1042
	}
1043
	
... This diff was truncated because it exceeds the maximum size that can be displayed.

Also available in: Unified diff