1
0
mirror of https://github.com/octoleo/plantuml.git synced 2024-11-22 04:55:10 +00:00

Version 5974

This commit is contained in:
Arnaud Roques 2011-01-13 22:52:37 +01:00
parent 6ace15b789
commit 581798f94d
19 changed files with 385 additions and 90 deletions

View File

@ -60,7 +60,7 @@ final public class BlockUmlBuilder {
}
}
static boolean isArobaseEnduml(String s) {
public static boolean isArobaseEnduml(String s) {
s = s.trim();
return s.equals("@enduml") || s.startsWith("@enduml ");
}
@ -71,7 +71,7 @@ final public class BlockUmlBuilder {
return s.startsWith("'");
}
static boolean isArobaseStartuml(String s) {
public static boolean isArobaseStartuml(String s) {
s = s.trim();
return s.equals("@startuml") || s.startsWith("@startuml ");
}

View File

@ -33,11 +33,15 @@
*/
package net.sourceforge.plantuml;
import net.sourceforge.plantuml.suggest.SuggestEngineResult;
import net.sourceforge.plantuml.suggest.SuggestEngineStatus;
class ErrorUml {
private final String error;
private final int position;
private final ErrorUmlType type;
private SuggestEngineResult suggest;
ErrorUml(ErrorUmlType type, String error, int position) {
if (error == null || type == null || StringUtils.isEmpty(error)) {
@ -51,8 +55,7 @@ class ErrorUml {
@Override
public boolean equals(Object obj) {
final ErrorUml this2 = (ErrorUml) obj;
return this.type == this2.type && this.position == this2.position
&& this.error.equals(this2.error);
return this.type == this2.type && this.position == this2.position && this.error.equals(this2.error);
}
@Override
@ -77,4 +80,16 @@ class ErrorUml {
return position;
}
public final SuggestEngineResult getSuggest() {
return suggest;
}
public final boolean hasSuggest() {
return suggest != null && suggest.getStatus() == SuggestEngineStatus.ONE_SUGGESTION;
}
public void setSuggest(SuggestEngineResult suggest) {
this.suggest = suggest;
}
}

View File

@ -28,7 +28,7 @@
*
* Original Author: Arnaud Roques
*
* Revision $Revision: 5746 $
* Revision $Revision: 5974 $
*
*/
package net.sourceforge.plantuml;
@ -36,6 +36,7 @@ package net.sourceforge.plantuml;
public class OptionFlags {
static public final boolean PBBACK = false;
static public final boolean SUGGEST = false;
void reset() {
keepTmpFiles = false;

View File

@ -82,7 +82,7 @@ public class PSystemBuilder {
final List<PSystemError> errors = new ArrayList<PSystemError>();
for (PSystemFactory systemFactory : factories) {
final PSystem sys = new PSystemSingleBuilder(strings, systemFactory).getPSystem();
final PSystem sys = new PSystemSingleBuilder(new UmlSource(strings), systemFactory).getPSystem();
if (isOk(sys)) {
return sys;
}

View File

@ -28,7 +28,7 @@
*
* Original Author: Arnaud Roques
*
* Revision $Revision: 5898 $
* Revision $Revision: 5971 $
*/
package net.sourceforge.plantuml;
@ -43,64 +43,46 @@ import java.util.Collection;
import java.util.Collections;
import java.util.LinkedHashSet;
import java.util.List;
import java.util.TreeSet;
import net.sourceforge.plantuml.graphic.GraphicStrings;
public class PSystemError extends AbstractPSystem {
private final List<ErrorUml> errorsUml = new ArrayList<ErrorUml>();
private final List<String> htmlStrings = new ArrayList<String>();
private final List<String> plainStrings = new ArrayList<String>();
private final int higherErrorPosition;
private final Collection<String> errs;
private final List<ErrorUml> printedErrors;
public PSystemError(UmlSource source, List<ErrorUml> errorUml) {
this.errorsUml.addAll(errorUml);
public PSystemError(UmlSource source, List<ErrorUml> all) {
this.setSource(source);
final int higherErrorPositionExecution = getHigherErrorPosition(ErrorUmlType.EXECUTION_ERROR);
final int higherErrorPositionSyntax = getHigherErrorPosition(ErrorUmlType.SYNTAX_ERROR);
final int higherErrorPositionExecution = getHigherErrorPosition(ErrorUmlType.EXECUTION_ERROR, all);
final int higherErrorPositionSyntax = getHigherErrorPosition(ErrorUmlType.SYNTAX_ERROR, all);
if (higherErrorPositionExecution == Integer.MIN_VALUE && higherErrorPositionSyntax == Integer.MIN_VALUE) {
throw new IllegalStateException();
}
if (higherErrorPositionExecution >= higherErrorPositionSyntax) {
higherErrorPosition = higherErrorPositionExecution;
errs = getErrorsAt(higherErrorPositionExecution, ErrorUmlType.EXECUTION_ERROR);
printedErrors = getErrorsAt(higherErrorPositionExecution, ErrorUmlType.EXECUTION_ERROR, all);
} else {
assert higherErrorPositionSyntax > higherErrorPositionExecution;
higherErrorPosition = higherErrorPositionSyntax;
errs = getErrorsAt(higherErrorPositionSyntax, ErrorUmlType.SYNTAX_ERROR);
printedErrors = getErrorsAt(higherErrorPositionSyntax, ErrorUmlType.SYNTAX_ERROR, all);
}
appendSource(higherErrorPosition, errs);
// final Collection<ErrorUml> executions = getErrors(ErrorUmlType.EXECUTION_ERROR);
// if (executions.size() > 0) {
// higherErrorPosition = getHigherErrorPosition(ErrorUmlType.EXECUTION_ERROR);
// errs = getErrorsAt(higherErrorPosition, ErrorUmlType.EXECUTION_ERROR);
// appendSource(higherErrorPosition, errs);
// } else {
// higherErrorPosition = getHigherErrorPosition(ErrorUmlType.SYNTAX_ERROR);
// errs = getErrorsAt(higherErrorPosition, ErrorUmlType.SYNTAX_ERROR);
// if (errs.size() != 1) {
// throw new UnsupportedOperationException(errs.toString());
// }
// appendSource(higherErrorPosition, errs);
// }
appendSource(higherErrorPosition);
}
public PSystemError(UmlSource source, ErrorUml... errorUml) {
this(source, Arrays.asList(errorUml));
public PSystemError(UmlSource source, ErrorUml singleError) {
this(source, Collections.singletonList(singleError));
}
public List<File> createFiles(File suggestedFile, FileFormatOption fileFormat) throws IOException, InterruptedException {
public List<File> createFiles(File suggestedFile, FileFormatOption fileFormat) throws IOException,
InterruptedException {
if (suggestedFile.exists() && suggestedFile.isDirectory()) {
throw new IllegalArgumentException("File is a directory "+suggestedFile);
throw new IllegalArgumentException("File is a directory " + suggestedFile);
}
OutputStream os = null;
try {
@ -122,7 +104,7 @@ public class PSystemError extends AbstractPSystem {
return new GraphicStrings(htmlStrings);
}
private void appendSource(int position, Collection<String> errs) {
private void appendSource(int position) {
final int limit = 4;
int start;
final int skip = position - limit + 1;
@ -150,15 +132,30 @@ public class PSystemError extends AbstractPSystem {
underscore.append("^");
}
plainStrings.add(underscore.toString());
for (String er : errs) {
htmlStrings.add(" <font color=red>" + er);
plainStrings.add(" " + er);
for (ErrorUml er : printedErrors) {
htmlStrings.add(" <color:red>" + er.getError());
plainStrings.add(" " + er.getError());
}
boolean suggested = false;
for (ErrorUml er : printedErrors) {
if (er.hasSuggest()) {
suggested = true;
}
}
if (suggested) {
htmlStrings.add(" <color:white><i>Did you mean:");
for (ErrorUml er : printedErrors) {
if (er.hasSuggest()) {
htmlStrings.add("<color:white>"
+ StringUtils.hideComparatorCharacters(er.getSuggest().getSuggestedLine()));
}
}
}
}
private Collection<ErrorUml> getErrors(ErrorUmlType type) {
private Collection<ErrorUml> getErrors(ErrorUmlType type, List<ErrorUml> all) {
final Collection<ErrorUml> result = new LinkedHashSet<ErrorUml>();
for (ErrorUml error : errorsUml) {
for (ErrorUml error : all) {
if (error.getType() == type) {
result.add(error);
}
@ -166,24 +163,24 @@ public class PSystemError extends AbstractPSystem {
return result;
}
private int getHigherErrorPosition(ErrorUmlType type) {
private int getHigherErrorPosition(ErrorUmlType type, List<ErrorUml> all) {
int max = Integer.MIN_VALUE;
for (ErrorUml error : getErrors(type)) {
for (ErrorUml error : getErrors(type, all)) {
if (error.getPosition() > max) {
max = error.getPosition();
}
}
// if (max == Integer.MIN_VALUE) {
// throw new IllegalStateException();
// }
// if (max == Integer.MIN_VALUE) {
// throw new IllegalStateException();
// }
return max;
}
private Collection<String> getErrorsAt(int position, ErrorUmlType type) {
final Collection<String> result = new TreeSet<String>();
for (ErrorUml error : getErrors(type)) {
private List<ErrorUml> getErrorsAt(int position, ErrorUmlType type, List<ErrorUml> all) {
final List<ErrorUml> result = new ArrayList<ErrorUml>();
for (ErrorUml error : getErrors(type, all)) {
if (error.getPosition() == position && StringUtils.isNotEmpty(error.getError())) {
result.add(error.getError());
result.add(error);
}
}
return result;
@ -193,10 +190,6 @@ public class PSystemError extends AbstractPSystem {
return "(Error)";
}
public final List<ErrorUml> getErrorsUml() {
return Collections.unmodifiableList(errorsUml);
}
public void print(PrintStream ps) {
for (String s : plainStrings) {
ps.println(StringUtils.showComparatorCharacters(s));
@ -207,7 +200,7 @@ public class PSystemError extends AbstractPSystem {
return higherErrorPosition;
}
public final Collection<String> getErrs() {
return Collections.unmodifiableCollection(errs);
public final Collection<ErrorUml> getErrorsUml() {
return Collections.unmodifiableCollection(printedErrors);
}
}

View File

@ -44,6 +44,9 @@ import net.sourceforge.plantuml.command.CommandControl;
import net.sourceforge.plantuml.command.CommandExecutionResult;
import net.sourceforge.plantuml.command.PSystemCommandFactory;
import net.sourceforge.plantuml.command.ProtectedCommand;
import net.sourceforge.plantuml.suggest.SuggestEngine;
import net.sourceforge.plantuml.suggest.SuggestEngineResult;
import net.sourceforge.plantuml.suggest.SuggestEngineStatus;
final public class PSystemSingleBuilder {
@ -66,9 +69,9 @@ final public class PSystemSingleBuilder {
return sys;
}
public PSystemSingleBuilder(List<String> strings, PSystemFactory systemFactory) throws IOException {
source = new UmlSource(strings);
it = strings.iterator();
public PSystemSingleBuilder(UmlSource s, PSystemFactory systemFactory) throws IOException {
this.source = s;
it = s.iterator();
if (BlockUmlBuilder.isArobaseStartuml(next()) == false) {
throw new UnsupportedOperationException();
}
@ -130,7 +133,15 @@ final public class PSystemSingleBuilder {
}
final CommandControl commandControl = systemFactory.isValid(Arrays.asList(s));
if (commandControl == CommandControl.NOT_OK) {
sys = new PSystemError(source, new ErrorUml(ErrorUmlType.SYNTAX_ERROR, "Syntax Error?", nb - 1));
final ErrorUml err = new ErrorUml(ErrorUmlType.SYNTAX_ERROR, "Syntax Error?", nb - 1);
if (OptionFlags.SUGGEST) {
final SuggestEngine engine = new SuggestEngine(source, systemFactory);
final SuggestEngineResult result = engine.tryToSuggest();
if (result.getStatus() == SuggestEngineStatus.ONE_SUGGESTION) {
err.setSuggest(result);
}
}
sys = new PSystemError(source, err);
return;
} else if (commandControl == CommandControl.OK_PARTIAL) {
final boolean ok = manageMultiline(systemFactory, s);
@ -142,8 +153,8 @@ final public class PSystemSingleBuilder {
final Command cmd = new ProtectedCommand(systemFactory.createCommand(Arrays.asList(s)));
final CommandExecutionResult result = cmd.execute(Arrays.asList(s));
if (result.isOk() == false) {
sys = new PSystemError(source, new ErrorUml(ErrorUmlType.EXECUTION_ERROR, result.getError(),
nb - 1));
sys = new PSystemError(source,
new ErrorUml(ErrorUmlType.EXECUTION_ERROR, result.getError(), nb - 1));
return;
}
testDeprecated(Arrays.asList(s), cmd);

View File

@ -28,7 +28,7 @@
*
* Original Author: Arnaud Roques
*
* Revision $Revision: 5810 $
* Revision $Revision: 5969 $
*
*/
package net.sourceforge.plantuml;
@ -103,8 +103,8 @@ public class Run {
ps.println("ERROR");
final PSystemError sys = (PSystemError) system;
ps.println(sys.getHigherErrorPosition());
for (String er : sys.getErrs()) {
ps.println(er);
for (ErrorUml er : sys.getErrorsUml()) {
ps.println(er.getError());
}
} else {
ps.println("OTHER");

View File

@ -28,7 +28,7 @@
*
* Original Author: Arnaud Roques
*
* Revision $Revision: 5749 $
* Revision $Revision: 5957 $
*
*/
package net.sourceforge.plantuml;
@ -36,6 +36,7 @@ package net.sourceforge.plantuml;
import java.io.File;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Iterator;
import java.util.List;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
@ -307,11 +308,18 @@ public class StringUtils {
return Collections.unmodifiableList(result);
}
public static void trim(List<String> data) {
public static void trim(List<String> data, boolean removeEmptyLines) {
for (int i = 0; i < data.size(); i++) {
final String s = data.get(i);
data.set(i, s.trim());
}
if (removeEmptyLines) {
for (final Iterator<String> it = data.iterator(); it.hasNext();) {
if (it.next().length() == 0) {
it.remove();
}
}
}
}
}

View File

@ -84,7 +84,7 @@ public class CommandLinkLongActivity extends CommandMultilines2<ActivityDiagram>
}
public CommandExecutionResult execute(List<String> lines) {
StringUtils.trim(lines);
StringUtils.trim(lines, false);
final Map<String, RegexPartialMatch> line0 = getStartingPattern().matcher(lines.get(0).trim());
final IEntity entity1 = CommandLinkActivity.getEntity(getSystem(), line0, true);
if (line0.get("STEREOTYPE").get(0) != null) {

View File

@ -69,17 +69,15 @@ public class CommandCreateEntityClassMultilines2 extends CommandMultilines2<Clas
public CommandExecutionResult execute(List<String> lines) {
StringUtils.trim(lines);
StringUtils.trim(lines, true);
final Map<String, RegexPartialMatch> line0 = getStartingPattern().matcher(lines.get(0).trim());
final Entity entity = executeArg0(line0);
if (entity == null) {
return CommandExecutionResult.error("No such entity");
}
for (String s : lines.subList(1, lines.size() - 1)) {
if (s.length()==0) {
continue;
}
if (s.length() > 0 && VisibilityModifier.isVisibilityCharacter(s.charAt(0))) {
assert s.length() > 0;
if (VisibilityModifier.isVisibilityCharacter(s.charAt(0))) {
getSystem().setVisibilityModifierPresent(true);
}
entity.addFieldOrMethod(s);

View File

@ -28,7 +28,7 @@
*
* Original Author: Arnaud Roques
*
* Revision $Revision: 5750 $
* Revision $Revision: 5957 $
*
*/
package net.sourceforge.plantuml.command;
@ -47,7 +47,7 @@ public class CommandMultilinesFooter extends CommandMultilines<UmlDiagram> {
}
public CommandExecutionResult execute(List<String> lines) {
StringUtils.trim(lines);
StringUtils.trim(lines, false);
final Matcher m = getStartingPattern().matcher(lines.get(0).trim());
if (m.find() == false) {
throw new IllegalStateException();

View File

@ -28,7 +28,7 @@
*
* Original Author: Arnaud Roques
*
* Revision $Revision: 5750 $
* Revision $Revision: 5957 $
*
*/
package net.sourceforge.plantuml.command;
@ -47,7 +47,7 @@ public class CommandMultilinesHeader extends CommandMultilines<UmlDiagram> {
}
public CommandExecutionResult execute(List<String> lines) {
StringUtils.trim(lines);
StringUtils.trim(lines, false);
final Matcher m = getStartingPattern().matcher(lines.get(0).trim());
if (m.find() == false) {
throw new IllegalStateException();

View File

@ -86,12 +86,10 @@ public class CommandSkinParamMultilines extends CommandMultilinesBracket<UmlDiag
}
lines = new ArrayList<String>(lines.subList(1, lines.size() - 1));
StringUtils.trim(lines);
StringUtils.trim(lines, true);
for (String s : lines) {
if (s.length() == 0) {
continue;
}
assert s.length() > 0;
if (s.equals("}")) {
context.pop();
continue;

View File

@ -28,7 +28,7 @@
*
* Original Author: Arnaud Roques
*
* Revision $Revision: 5847 $
* Revision $Revision: 5972 $
*
*/
package net.sourceforge.plantuml.cucadiagram.dot;

View File

@ -55,14 +55,15 @@ public class CommandCreateEntityObjectMultilines extends CommandMultilines<Objec
}
public CommandExecutionResult execute(List<String> lines) {
StringUtils.trim(lines);
StringUtils.trim(lines, true);
final List<String> line0 = StringUtils.getSplit(getStartingPattern(), lines.get(0).trim());
final Entity entity = executeArg0(line0);
if (entity == null) {
return CommandExecutionResult.error("No such entity");
}
for (String s : lines.subList(1, lines.size() - 1)) {
if (s.length() > 0 && VisibilityModifier.isVisibilityCharacter(s.charAt(0))) {
assert s.length() > 0;
if (VisibilityModifier.isVisibilityCharacter(s.charAt(0))) {
getSystem().setVisibilityModifierPresent(true);
}
entity.addField(s);

View File

@ -0,0 +1,159 @@
/* ========================================================================
* PlantUML : a free UML diagram generator
* ========================================================================
*
* (C) Copyright 2009, Arnaud Roques
*
* Project Info: http://plantuml.sourceforge.net
*
* 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
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
* 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.
*
* [Java is a trademark or registered trademark of Sun Microsystems, Inc.
* in the United States and other countries.]
*
* Original Author: Arnaud Roques
*
* Revision $Revision: 4975 $
*
*/
package net.sourceforge.plantuml.suggest;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Iterator;
import java.util.List;
import net.sourceforge.plantuml.BlockUmlBuilder;
import net.sourceforge.plantuml.UmlSource;
import net.sourceforge.plantuml.command.Command;
import net.sourceforge.plantuml.command.CommandControl;
import net.sourceforge.plantuml.command.CommandExecutionResult;
import net.sourceforge.plantuml.command.PSystemCommandFactory;
import net.sourceforge.plantuml.command.ProtectedCommand;
final public class SuggestEngine {
// private final UmlSource source;
private final PSystemCommandFactory systemFactory;
private final Iterator<String> it;
private int nb = 0;
public SuggestEngine(UmlSource source, PSystemCommandFactory systemFactory) {
// this.source = source;
this.systemFactory = systemFactory;
this.it = source.iterator();
if (BlockUmlBuilder.isArobaseStartuml(next()) == false) {
throw new UnsupportedOperationException();
}
}
private boolean hasNext() {
return it.hasNext();
}
private String next() {
nb++;
return it.next();
}
public SuggestEngineResult tryToSuggest() throws IOException {
return executeUmlCommand();
}
private SuggestEngineResult executeUmlCommand() throws IOException {
systemFactory.reset();
while (hasNext()) {
final String s = next();
if (BlockUmlBuilder.isArobaseEnduml(s)) {
return SuggestEngineResult.SYNTAX_OK;
}
final SuggestEngineResult check = checkAndCorrect(s);
if (check.getStatus() != SuggestEngineStatus.SYNTAX_OK) {
return check;
}
final CommandControl commandControl = systemFactory.isValid(Arrays.asList(s));
if (commandControl == CommandControl.OK_PARTIAL) {
final boolean ok = manageMultiline(s);
if (ok == false) {
return SuggestEngineResult.CANNOT_CORRECT;
}
} else if (commandControl == CommandControl.OK) {
final Command cmd = new ProtectedCommand(systemFactory.createCommand(Arrays.asList(s)));
final CommandExecutionResult result = cmd.execute(Arrays.asList(s));
if (result.isOk() == false) {
return SuggestEngineResult.CANNOT_CORRECT;
}
} else {
assert false;
}
}
throw new IllegalStateException();
}
private boolean manageMultiline(final String init) throws IOException {
final List<String> lines = new ArrayList<String>();
lines.add(init);
while (hasNext()) {
final String s = next();
if (BlockUmlBuilder.isArobaseEnduml(s)) {
return false;
}
lines.add(s);
final CommandControl commandControl = systemFactory.isValid(lines);
if (commandControl == CommandControl.NOT_OK) {
throw new IllegalStateException();
}
if (commandControl == CommandControl.OK) {
// final Command cmd = systemFactory.createCommand(lines);
// return cmd.execute(lines).isOk();
return true;
}
}
return false;
}
SuggestEngineResult checkAndCorrect(String incorrectLine) {
CommandControl commandControl = systemFactory.isValid(Arrays.asList(incorrectLine));
if (commandControl != CommandControl.NOT_OK) {
return SuggestEngineResult.SYNTAX_OK;
}
// Remove one
for (int i = 0; i < incorrectLine.length(); i++) {
final String newS = incorrectLine.substring(0, i) + incorrectLine.substring(i + 1);
commandControl = systemFactory.isValid(Arrays.asList(newS));
if (commandControl != CommandControl.NOT_OK) {
return new SuggestEngineResult(newS, nb);
}
}
// Inverse
for (int i = 0; i < incorrectLine.length() - 1; i++) {
final String newS = incorrectLine.substring(0, i) + incorrectLine.charAt(i + 1) + incorrectLine.charAt(i)
+ incorrectLine.substring(i + 2);
commandControl = systemFactory.isValid(Arrays.asList(newS));
if (commandControl != CommandControl.NOT_OK) {
return new SuggestEngineResult(newS, nb);
}
}
return SuggestEngineResult.CANNOT_CORRECT;
}
}

View File

@ -0,0 +1,72 @@
/* ========================================================================
* PlantUML : a free UML diagram generator
* ========================================================================
*
* (C) Copyright 2009, Arnaud Roques
*
* Project Info: http://plantuml.sourceforge.net
*
* 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
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
* 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.
*
* [Java is a trademark or registered trademark of Sun Microsystems, Inc.
* in the United States and other countries.]
*
* Original Author: Arnaud Roques
*
* Revision $Revision: 4975 $
*
*/
package net.sourceforge.plantuml.suggest;
public class SuggestEngineResult {
private final SuggestEngineStatus status;
private final String suggestedLine;
private final int numLine;
public static final SuggestEngineResult CANNOT_CORRECT = new SuggestEngineResult(SuggestEngineStatus.CANNOT_CORRECT);
public static final SuggestEngineResult SYNTAX_OK = new SuggestEngineResult(SuggestEngineStatus.SYNTAX_OK);
private SuggestEngineResult(SuggestEngineStatus status) {
if (status == SuggestEngineStatus.ONE_SUGGESTION) {
throw new IllegalArgumentException();
}
this.status = status;
this.suggestedLine = null;
this.numLine = -1;
}
public SuggestEngineResult(String suggestedLine, int numLine) {
this.status = SuggestEngineStatus.ONE_SUGGESTION;
this.suggestedLine = suggestedLine;
this.numLine = numLine;
}
public final SuggestEngineStatus getStatus() {
return status;
}
public final String getSuggestedLine() {
return suggestedLine;
}
public final int getNumLine() {
return numLine;
}
}

View File

@ -0,0 +1,39 @@
/* ========================================================================
* PlantUML : a free UML diagram generator
* ========================================================================
*
* (C) Copyright 2009, Arnaud Roques
*
* Project Info: http://plantuml.sourceforge.net
*
* 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
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
* 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.
*
* [Java is a trademark or registered trademark of Sun Microsystems, Inc.
* in the United States and other countries.]
*
* Original Author: Arnaud Roques
*
* Revision $Revision: 4975 $
*
*/
package net.sourceforge.plantuml.suggest;
public enum SuggestEngineStatus {
SYNTAX_OK, CANNOT_CORRECT, ONE_SUGGESTION
}

View File

@ -28,7 +28,7 @@
*
* Original Author: Arnaud Roques
*
* Revision $Revision: 5955 $
* Revision $Revision: 5975 $
*
*/
package net.sourceforge.plantuml.version;
@ -36,11 +36,11 @@ package net.sourceforge.plantuml.version;
public class Version {
public static int version() {
return 5954;
return 5974;
}
public static long compileTime() {
return 1294857964687L;
return 1294953848234L;
}
}