1
0
mirror of https://github.com/octoleo/plantuml.git synced 2024-06-12 21:22:26 +00:00
plantuml/src/net/sourceforge/plantuml/ErrorUml.java

94 lines
2.5 KiB
Java
Raw Normal View History

2010-11-15 20:35:36 +00:00
/* ========================================================================
* PlantUML : a free UML diagram generator
* ========================================================================
*
2023-02-22 18:43:48 +00:00
* (C) Copyright 2009-2024, Arnaud Roques
2010-11-15 20:35:36 +00:00
*
2023-02-22 18:43:48 +00:00
* Project Info: https://plantuml.com
2010-11-15 20:35:36 +00:00
*
2017-03-15 19:13:31 +00:00
* If you like this project or if you find it useful, you can support us at:
*
2023-02-22 18:43:48 +00:00
* https://plantuml.com/patreon (only 1$ per month!)
* https://plantuml.com/paypal
2017-03-15 19:13:31 +00:00
*
2010-11-15 20:35:36 +00:00
* This file is part of PlantUML.
*
* PlantUML is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* PlantUML distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
2013-12-10 19:36:50 +00:00
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
2010-11-15 20:35:36 +00:00
* License for more details.
*
* You should have received a copy of the GNU General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
* USA.
*
*
* Original Author: Arnaud Roques
*
*
*/
package net.sourceforge.plantuml;
2021-05-09 21:14:40 +00:00
import java.util.Objects;
2022-12-17 11:01:10 +00:00
import net.sourceforge.plantuml.utils.LineLocation;
2013-12-10 19:36:50 +00:00
public class ErrorUml {
2023-02-28 21:22:51 +00:00
// ::remove file when __HAXE__
2010-11-15 20:35:36 +00:00
private final String error;
private final ErrorUmlType type;
2015-06-20 10:54:49 +00:00
private final LineLocation lineLocation;
2021-02-02 10:12:15 +00:00
private final int score;
2010-11-15 20:35:36 +00:00
2021-02-02 10:12:15 +00:00
public ErrorUml(ErrorUmlType type, String error, int score, LineLocation lineLocation) {
this.score = score;
2021-05-09 21:14:40 +00:00
this.error = Objects.requireNonNull(error);
this.type = Objects.requireNonNull(type);
2015-06-20 10:54:49 +00:00
this.lineLocation = lineLocation;
2010-11-15 20:35:36 +00:00
}
2021-02-02 10:12:15 +00:00
public int score() {
return score;
}
2010-11-15 20:35:36 +00:00
@Override
public boolean equals(Object obj) {
final ErrorUml this2 = (ErrorUml) obj;
2017-06-05 11:27:21 +00:00
return this.type == this2.type && this.getPosition() == this2.getPosition() && this.error.equals(this2.error);
2010-11-15 20:35:36 +00:00
}
@Override
public int hashCode() {
2019-05-24 19:59:31 +00:00
return error.hashCode() + type.hashCode() + getPosition();
2010-11-15 20:35:36 +00:00
}
@Override
public String toString() {
2019-05-24 19:59:31 +00:00
return type.toString() + " " + getPosition() + " " + error;
2010-11-15 20:35:36 +00:00
}
public final String getError() {
return error;
}
public final ErrorUmlType getType() {
return type;
}
2017-07-03 17:59:53 +00:00
public final int getPosition() {
2017-06-05 11:27:21 +00:00
return lineLocation.getPosition();
2010-11-15 20:35:36 +00:00
}
2017-07-03 17:59:53 +00:00
public final LineLocation getLineLocation() {
2015-06-20 10:54:49 +00:00
return lineLocation;
}
2010-11-15 20:35:36 +00:00
}