Statistics
| Revision:

root / branches / v2_0_0_prep / libraries / libGPE-GML / src / org / gvsig / gpe / gml / warnings / GMLWarningInfo.java @ 27828

History | View | Annotate | Download (3.74 KB)

1
package org.gvsig.gpe.gml.warnings;
2

    
3
import org.gvsig.tools.exception.BaseException;
4
import org.gvsig.tools.exception.ListBaseException;
5
import org.gvsig.gpe.gml.exceptions.GMLExceptionList;
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
/* CVS MESSAGES:
48
 *
49
 * $Id: GMLWarningInfo.java 6 2007-02-28 11:49:30Z csanchez $
50
 * $Log$
51
 * Revision 1.1  2007/02/28 11:48:31  csanchez
52
 * *** empty log message ***
53
 *
54
 * Revision 1.1  2007/02/20 10:53:20  jorpiell
55
 * A?adidos los proyectos de kml y gml antiguos
56
 *
57
 * Revision 1.1  2007/01/15 13:08:06  csanchez
58
 * Sistema de Warnings y Excepciones adaptado a BasicException
59
 *
60
 * Revision 1.1  2006/12/22 11:25:04  csanchez
61
 * Nuevo parser GML 2.x para gml's sin esquema
62
 *
63
 *
64
 */
65
/************************************************************************
66
 * Class < GMLFileParseInfo >                                                                                        *
67
 *                                                                                                                                                 *
68
 * This Class gets all the warnings from the GML Parser, the GML parser        *
69
 * always tries parse the GML file even though it isn't a standard but        *
70
 * it has to info the user.                                                                                         *
71
 *                                                                                                                                                 *
72
 * @author Carlos S?nchez Peri??n (sanchez_carper@gva.es)                                *
73
 ************************************************************************/        
74
public class GMLWarningInfo {
75
        
76
        private ListBaseException warning;
77
                
78
        public GMLWarningInfo(){
79
                warning=new GMLExceptionList("", "", 0);
80
        }
81
        
82
        /**
83
         * This method return true if there aren't warnings else returns false 
84
         * @return boolean
85
         */
86
        public boolean areWarnings(){
87
                if (warning.isEmpty()){
88
                        return false;                                                
89
                }
90
                return true;
91
        }
92
        /**
93
         * This method return the list of warnings parsing the GML 
94
         * @return ArrayList of warnings
95
         */
96
        public ListBaseException getGMLWarningList(){
97
                return warning;
98
        }
99
        
100
        /**
101
         * This method inserts a new warning into the list 
102
         * @args int new warning
103
         */
104
        public void setElement(BaseException war){
105
                //Only we add a warning when it is new
106
                if (warning.contains(war)==false)
107
                {
108
                        warning.add((war));
109
                }
110
        }
111
        /**
112
         * This method returns a warning from the list 
113
         * @args int index
114
         * @return int warning
115
         */
116
        public BaseException getElement(int index, ListBaseException war){
117
                //it returns the int value of a warning or 0 if it doesn't exists
118
                if (war.isEmpty()==false)
119
                {
120
                        if (index < war.size()){
121
                                return (BaseException)war.get(index);
122
                        }
123
                }
124
                return null;
125
        }
126
        
127
        /**
128
         * This method inserts a new warning list 
129
         * @args int new warning
130
         */
131
        public void setGMLWarningList(ListBaseException war){
132
                int i=0;
133
                BaseException info;
134
                while(i < war.size()){
135
                        info = this.getElement(i,war);
136
                        if (info != null)
137
                        {
138
                                this.setElement(info);
139
                        }
140
                        i++;
141
                }
142
        }
143
}