Statistics
| Revision:

svn-gvsig-desktop / branches / v2_0_0_prep / libraries / libGeocoding / src / org / gvsig / geocoding / pattern / impl / DefaultGeocodingSettings.java @ 28375

History | View | Annotate | Download (3.13 KB)

1
/* gvSIG. Geographic Information System of the Valencian Government
2
 *
3
 * Copyright (C) 2007-2008 Infrastructures and Transports Department
4
 * of the Valencian Government (CIT)
5
 * 
6
 * This program is free software; you can redistribute it and/or
7
 * modify it under the terms of the GNU General Public License
8
 * as published by the Free Software Foundation; either version 2
9
 * of the License, or (at your option) any later version.
10
 * 
11
 * This program is distributed in the hope that it will be useful,
12
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
 * GNU General Public License for more details.
15
 * 
16
 * You should have received a copy of the GNU General Public License
17
 * along with this program; if not, write to the Free Software
18
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, 
19
 * MA  02110-1301, USA.
20
 * 
21
 */
22

    
23
/*
24
 * AUTHORS (In addition to CIT):
25
 * 2008 Prodevelop S.L. main development
26
 */
27

    
28
package org.gvsig.geocoding.pattern.impl;
29

    
30
import org.gvsig.geocoding.pattern.GeocodingSettings;
31
import org.gvsig.tools.persistence.PersistenceException;
32
import org.gvsig.tools.persistence.PersistentState;
33

    
34
/**
35
 * Settings class implementation. This class has the parameters that define the
36
 * quality of search and the maximun number of results showed in the panel.
37
 * 
38
 * @author <a href="mailto:jsanz@prodevelop.es"> Jorge Gaspar Sanz Salinas</a>
39
 * @author <a href="mailto:vsanjaime@prodevelop.es"> Vicente Sanjaime Calvet</a>
40
 */
41
public class DefaultGeocodingSettings implements GeocodingSettings {
42

    
43
        private static final String SCORE = "score";
44
        private static final String RESULTSNUMBER = "resultsnumber";
45

    
46
        private int resultsNumber;
47
        private double score;
48

    
49
        /**
50
         * Default Constructor with parameters initializated.
51
         */
52
        public DefaultGeocodingSettings() {
53

    
54
                this.resultsNumber = 10;
55
                this.score = 60.0;
56
        }
57

    
58
        /**
59
         * Constructor with parameters
60
         */
61
        public DefaultGeocodingSettings(int results, double score) {
62
                this.resultsNumber = results;
63
                this.score = score;
64
        }
65

    
66
        /**
67
         * @return the results
68
         */
69
        public int getResultsNumber() {
70
                return resultsNumber;
71
        }
72

    
73
        /**
74
         * @param results
75
         *            the results to set
76
         */
77
        public void setResultsNumber(int results) {
78
                this.resultsNumber = results;
79
        }
80

    
81
        /**
82
         * @return the quality
83
         */
84
        public double getScore() {
85
                return this.score;
86
        }
87

    
88
        /**
89
         * @param quality
90
         *            the quality to set
91
         */
92
        public void setScore(double score) {
93
                this.score = score;
94
        }
95

    
96
        /**
97
         * Set the state of the settings from the state passed as parameter.
98
         * 
99
         * @param state
100
         */
101
        public void setState(PersistentState state) throws PersistenceException {
102
                this.resultsNumber = state.getInt(RESULTSNUMBER);
103
                this.score = state.getInt(SCORE);
104
        }
105

    
106
        /**
107
         * Saves the internal state of the object on the provided PersistentState
108
         * object.
109
         * 
110
         * @param state
111
         */
112
        public void saveToState(PersistentState state) throws PersistenceException {
113
                state.set(RESULTSNUMBER, this.resultsNumber);
114
                state.set(SCORE, this.score);
115

    
116
        }
117

    
118
}