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