Merge branch 'release/5.45.0'
[cdmlib.git] / cdmlib-model / src / main / java / eu / etaxonomy / cdm / model / common / IParsable.java
1 /**
2 * Copyright (C) 2007 EDIT
3 * European Distributed Institute of Taxonomy
4 * http://www.e-taxonomy.eu
5 *
6 * The contents of this file are subject to the Mozilla Public License Version 1.1
7 * See LICENSE.TXT at the top of this package for the full license terms.
8 */
9 package eu.etaxonomy.cdm.model.common;
10
11 import java.util.List;
12
13 import eu.etaxonomy.cdm.strategy.parser.ParserProblem;
14
15
16 /**
17 * @author a.mueller
18 * @since 21.05.2008
19 */
20 public interface IParsable {
21
22 /**
23 * Returns an integer value indicating whether the used parser
24 * method was able to parse a string successfully into this object (<code>0</code>)
25 * or not (<code>!=0</code>). The the parsing was not successful the value returned
26 * defines in more detail what the problem was. The definition of these values depends
27 * on the parser that has been used for parsing.
28 *
29 * @return the int value parsingProblem
30 */
31 public int getParsingProblem();
32
33 /**
34 * @see #getParsingProblem()
35 */
36 public void setParsingProblem(int hasProblem);
37
38 /**
39 * Returns true if any parsing problem (warning or error) exists.
40 *
41 * @see #getHasProblem()
42 */
43 public boolean hasProblem();
44
45 /**
46 * Returns true, if the specified problem exists. False otherwise.
47 * @param problem
48 * @return
49 */
50 public boolean hasProblem(ParserProblem problem);
51
52
53 /**
54 * Returns a list of all warnings and errors that have been recognized during the parsing
55 * and not yet handled.
56 * @return
57 */
58 public List<ParserProblem> getParsingProblems();
59
60 /**
61 * Adds a parsing problem to the list of parsing problems
62 * @param problem
63 */
64 public void addParsingProblem(ParserProblem problem);
65
66 /**
67 * Removes a parsing problem from the list of parsing problems.
68 * If the problem is not in the list or is <code>null</code>, nothing happens.
69 * @param warning
70 */public void removeParsingProblem(ParserProblem problem);
71
72
73 /**
74 * Returns the integer value of the position where a parsing problem starts.
75 * If no problem exists -1 is returned.
76 * Default: -1
77 * @deprecated This method will be removed by a more sophisticated method in future versions,
78 * therefore it is deprecated.<BR>
79 * @see #getHasProblem()
80 */
81 @Deprecated
82 public int getProblemStarts();
83
84 /**
85 * Returns the integer value of the position where a parsing problem ends.
86 * If no problem exists -1 is returned.
87 * Default: -1
88 * @deprecated This method will be removed by a more sophisticated method in future versions,
89 * therefore it is deprecated. <BR>
90 * @see #getHasProblem()
91 */
92 @Deprecated
93 public int getProblemEnds();
94
95 /**
96 * @deprecated This method will be removed by a more sophisticated method in future versions,
97 * therefore it is deprecated. <BR>
98 * @see #getProblemStarts()
99 */
100 @Deprecated
101 public void setProblemStarts(int start);
102
103 /**
104 * @deprecated This method will be removed by a more sophisticated method in future versions,
105 * therefore it is deprecated. <BR>
106 * @see #getProblemEnds()
107 */
108 @Deprecated
109 public void setProblemEnds(int end);
110
111 }