You can subscribe to this list here.
2006 |
Jan
|
Feb
|
Mar
|
Apr
|
May
(103) |
Jun
(121) |
Jul
(16) |
Aug
(67) |
Sep
(126) |
Oct
(161) |
Nov
(164) |
Dec
(588) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2007 |
Jan
(394) |
Feb
(181) |
Mar
(131) |
Apr
(180) |
May
(255) |
Jun
(11) |
Jul
(79) |
Aug
(70) |
Sep
(274) |
Oct
(138) |
Nov
(195) |
Dec
(8) |
2008 |
Jan
(3) |
Feb
(142) |
Mar
(162) |
Apr
(124) |
May
(148) |
Jun
(157) |
Jul
(425) |
Aug
(373) |
Sep
(264) |
Oct
(315) |
Nov
(225) |
Dec
(6) |
2009 |
Jan
(67) |
Feb
(78) |
Mar
(279) |
Apr
(294) |
May
(92) |
Jun
(65) |
Jul
(134) |
Aug
(41) |
Sep
(138) |
Oct
(125) |
Nov
(126) |
Dec
(122) |
2010 |
Jan
(15) |
Feb
(48) |
Mar
(9) |
Apr
(195) |
May
(373) |
Jun
(507) |
Jul
(42) |
Aug
(16) |
Sep
(38) |
Oct
(81) |
Nov
(64) |
Dec
(18) |
2011 |
Jan
(13) |
Feb
(12) |
Mar
(39) |
Apr
(1) |
May
(2) |
Jun
(27) |
Jul
(27) |
Aug
(31) |
Sep
(14) |
Oct
(102) |
Nov
(20) |
Dec
(37) |
2012 |
Jan
(22) |
Feb
(1) |
Mar
(1) |
Apr
(2) |
May
(2) |
Jun
(18) |
Jul
(6) |
Aug
(1) |
Sep
(1) |
Oct
|
Nov
|
Dec
|
2013 |
Jan
(1) |
Feb
(2) |
Mar
(1) |
Apr
(1) |
May
(47) |
Jun
(7) |
Jul
(107) |
Aug
|
Sep
|
Oct
(112) |
Nov
(31) |
Dec
(17) |
2014 |
Jan
(29) |
Feb
(111) |
Mar
(34) |
Apr
|
May
(1) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
(2) |
Nov
(18) |
Dec
(10) |
From: <aki...@us...> - 2010-10-10 14:19:37
|
Revision: 8710 http://gridarta.svn.sourceforge.net/gridarta/?rev=8710&view=rev Author: akirschbaum Date: 2010-10-10 14:19:30 +0000 (Sun, 10 Oct 2010) Log Message: ----------- Correctly update game object type in undo/redo. Modified Paths: -------------- trunk/atrinik/ChangeLog trunk/crossfire/ChangeLog trunk/daimonin/ChangeLog trunk/src/app/net/sf/gridarta/gui/gameobjectattributesdialog/TypesBoxItemListener.java Modified: trunk/atrinik/ChangeLog =================================================================== --- trunk/atrinik/ChangeLog 2010-10-10 14:18:10 UTC (rev 8709) +++ trunk/atrinik/ChangeLog 2010-10-10 14:19:30 UTC (rev 8710) @@ -1,5 +1,7 @@ 2010-10-10 Andreas Kirschbaum + * Correctly update game object type in undo/redo. + * Add map-checker.py as a validator. 2010-10-06 Andreas Kirschbaum Modified: trunk/crossfire/ChangeLog =================================================================== --- trunk/crossfire/ChangeLog 2010-10-10 14:18:10 UTC (rev 8709) +++ trunk/crossfire/ChangeLog 2010-10-10 14:19:30 UTC (rev 8710) @@ -1,3 +1,7 @@ +2010-10-10 Andreas Kirschbaum + + * Correctly update game object type in undo/redo. + 2010-10-06 Andreas Kirschbaum * Define and configure validators from "validator.*" entries in Modified: trunk/daimonin/ChangeLog =================================================================== --- trunk/daimonin/ChangeLog 2010-10-10 14:18:10 UTC (rev 8709) +++ trunk/daimonin/ChangeLog 2010-10-10 14:19:30 UTC (rev 8710) @@ -1,3 +1,7 @@ +2010-10-10 Andreas Kirschbaum + + * Correctly update game object type in undo/redo. + 2010-10-06 Andreas Kirschbaum * Define and configure validators from "validator.*" entries in Modified: trunk/src/app/net/sf/gridarta/gui/gameobjectattributesdialog/TypesBoxItemListener.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/gameobjectattributesdialog/TypesBoxItemListener.java 2010-10-10 14:18:10 UTC (rev 8709) +++ trunk/src/app/net/sf/gridarta/gui/gameobjectattributesdialog/TypesBoxItemListener.java 2010-10-10 14:19:30 UTC (rev 8710) @@ -30,6 +30,7 @@ import net.sf.gridarta.model.baseobject.BaseObject; import net.sf.gridarta.model.gameobject.GameObject; import net.sf.gridarta.model.maparchobject.MapArchObject; +import net.sf.gridarta.model.mapmodel.MapModel; import net.sf.gridarta.model.match.GameObjectMatchers; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -154,7 +155,14 @@ archetypeType = newType; // change the gameObject to be of the new type: - gameObject.setAttributeInt(BaseObject.TYPE, newType.getTypeNo()); + + final MapModel<G, A, R> mapModel = gameObject.getMapSquare().getMapModel(); + mapModel.beginTransaction("change type to " + newType.getTypeName()); + try { + gameObject.setAttributeInt(BaseObject.TYPE, newType.getTypeNo()); + } finally { + mapModel.endTransaction(); + } dialogAttributes.clear(); type = typeComboBox.getSelectedIndex(); @@ -164,7 +172,7 @@ gameObjectAttributesDialog.update(gameObjectAttributesDialog.getGraphics()); // recalculate the editType value; XXX: should use MVC - gameObjectMatchers.updateEditType(gameObject, gameObject.getMapSquare().getMapModel().getActiveEditType()); + gameObjectMatchers.updateEditType(gameObject, mapModel.getActiveEditType()); } else { // change not wanted -> reset the choose box ignoreEvent = true; // ignore events thrown by the forced reset This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2010-10-10 14:18:17
|
Revision: 8709 http://gridarta.svn.sourceforge.net/gridarta/?rev=8709&view=rev Author: akirschbaum Date: 2010-10-10 14:18:10 +0000 (Sun, 10 Oct 2010) Log Message: ----------- Fix typos. Modified Paths: -------------- trunk/atrinik/ChangeLog trunk/crossfire/ChangeLog trunk/daimonin/ChangeLog Modified: trunk/atrinik/ChangeLog =================================================================== --- trunk/atrinik/ChangeLog 2010-10-10 14:01:13 UTC (rev 8708) +++ trunk/atrinik/ChangeLog 2010-10-10 14:18:10 UTC (rev 8709) @@ -4,7 +4,7 @@ 2010-10-06 Andreas Kirschbaum - * Define and configure validators from "valdator.*" entries in + * Define and configure validators from "validator.*" entries in messages.properties. Document available validators in validators.xhtml. Modified: trunk/crossfire/ChangeLog =================================================================== --- trunk/crossfire/ChangeLog 2010-10-10 14:01:13 UTC (rev 8708) +++ trunk/crossfire/ChangeLog 2010-10-10 14:18:10 UTC (rev 8709) @@ -1,6 +1,6 @@ 2010-10-06 Andreas Kirschbaum - * Define and configure validators from "valdator.*" entries in + * Define and configure validators from "validator.*" entries in messages.properties. Document available validators in validators.xhtml. Modified: trunk/daimonin/ChangeLog =================================================================== --- trunk/daimonin/ChangeLog 2010-10-10 14:01:13 UTC (rev 8708) +++ trunk/daimonin/ChangeLog 2010-10-10 14:18:10 UTC (rev 8709) @@ -1,6 +1,6 @@ 2010-10-06 Andreas Kirschbaum - * Define and configure validators from "valdator.*" entries in + * Define and configure validators from "validator.*" entries in messages.properties. Document available validators in validators.xhtml. This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2010-10-10 14:01:19
|
Revision: 8708 http://gridarta.svn.sourceforge.net/gridarta/?rev=8708&view=rev Author: akirschbaum Date: 2010-10-10 14:01:13 +0000 (Sun, 10 Oct 2010) Log Message: ----------- Whitespace changes. Modified Paths: -------------- trunk/resource/system/dtd/GameObjectMatchers.dtd trunk/resource/system/dtd/TreasureLists.dtd trunk/resource/system/dtd/types.dtd Modified: trunk/resource/system/dtd/GameObjectMatchers.dtd =================================================================== --- trunk/resource/system/dtd/GameObjectMatchers.dtd 2010-10-10 12:08:14 UTC (rev 8707) +++ trunk/resource/system/dtd/GameObjectMatchers.dtd 2010-10-10 14:01:13 UTC (rev 8708) @@ -1,8 +1,4 @@ <?xml version="1.0" encoding="utf-8"?> - -<!ENTITY % Match "(And|Or|Attrib|TypeNrs)"> -<!ENTITY % Matches "%Match;+"> - <!-- ~ Gridarta MMORPG map editor for Crossfire, Daimonin and similar games. ~ Copyright (C) 2000-2010 The Gridarta Developers. @@ -22,6 +18,9 @@ ~ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. --> +<!ENTITY % Match "(And|Or|Attrib|TypeNrs)"> +<!ENTITY % Matches "%Match;+"> + <!ELEMENT GameObjectMatchers (GameObjectMatcher+)> <!ELEMENT GameObjectMatcher (title+,Env?,%Match;)> <!ATTLIST GameObjectMatcher Modified: trunk/resource/system/dtd/TreasureLists.dtd =================================================================== --- trunk/resource/system/dtd/TreasureLists.dtd 2010-10-10 12:08:14 UTC (rev 8707) +++ trunk/resource/system/dtd/TreasureLists.dtd 2010-10-10 14:01:13 UTC (rev 8708) @@ -1,5 +1,4 @@ <?xml version="1.0" encoding="utf-8"?> - <!-- ~ Gridarta MMORPG map editor for Crossfire, Daimonin and similar games. ~ Copyright (C) 2000-2010 The Gridarta Developers. Modified: trunk/resource/system/dtd/types.dtd =================================================================== --- trunk/resource/system/dtd/types.dtd 2010-10-10 12:08:14 UTC (rev 8707) +++ trunk/resource/system/dtd/types.dtd 2010-10-10 14:01:13 UTC (rev 8708) @@ -1,5 +1,4 @@ <?xml version="1.0" encoding="utf-8"?> - <!-- ~ Gridarta MMORPG map editor for Crossfire, Daimonin and similar games. ~ Copyright (C) 2000-2010 The Gridarta Developers. This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2010-10-10 12:08:24
|
Revision: 8707 http://gridarta.svn.sourceforge.net/gridarta/?rev=8707&view=rev Author: akirschbaum Date: 2010-10-10 12:08:14 +0000 (Sun, 10 Oct 2010) Log Message: ----------- Rename parameter names. Modified Paths: -------------- trunk/atrinik/src/app/net/sf/gridarta/var/atrinik/model/archetype/ArchetypeSet.java trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/model/archetype/ArchetypeSet.java trunk/daimonin/src/app/net/sf/gridarta/var/daimonin/model/archetype/ArchetypeSet.java trunk/model/src/app/net/sf/gridarta/model/archetype/AbstractArchetypeSet.java trunk/model/src/app/net/sf/gridarta/model/archetypetype/ArchetypeAttribute.java trunk/model/src/app/net/sf/gridarta/model/archetypetype/ArchetypeTypeParser.java trunk/model/src/app/net/sf/gridarta/model/archetypetype/ArchetypeTypeSet.java trunk/model/src/app/net/sf/gridarta/model/archetypetype/AttributeBitmask.java trunk/model/src/app/net/sf/gridarta/model/autojoin/AutojoinLists.java trunk/model/src/app/net/sf/gridarta/model/baseobject/BaseObject.java trunk/model/src/app/net/sf/gridarta/model/collectable/Collectable.java trunk/model/src/app/net/sf/gridarta/model/face/package.html trunk/model/src/app/net/sf/gridarta/model/gameobject/FaceSource.java trunk/model/src/app/net/sf/gridarta/model/gameobject/GameObjectUtils.java trunk/model/src/app/net/sf/gridarta/model/io/AbstractMapArchObjectParser.java trunk/model/src/app/net/sf/gridarta/model/io/DefaultMapReader.java trunk/model/src/app/net/sf/gridarta/model/io/GameObjectParser.java trunk/model/src/app/net/sf/gridarta/model/io/MapArchObjectParser.java trunk/model/src/app/net/sf/gridarta/model/mapmodel/DefaultMapModel.java trunk/model/src/app/net/sf/gridarta/model/mapmodel/MapModel.java trunk/model/src/app/net/sf/gridarta/model/match/AndGameObjectMatcher.java trunk/model/src/app/net/sf/gridarta/model/match/AttributeGameObjectMatcher.java trunk/model/src/app/net/sf/gridarta/model/match/GameObjectMatcher.java trunk/model/src/app/net/sf/gridarta/model/match/GameObjectMatchers.java trunk/model/src/app/net/sf/gridarta/model/match/MutableNameGameObjectMatcher.java trunk/model/src/app/net/sf/gridarta/model/match/MutableOrGameObjectMatcher.java trunk/model/src/app/net/sf/gridarta/model/match/NamedGameObjectMatcher.java trunk/model/src/app/net/sf/gridarta/model/match/NotGameObjectMatcher.java trunk/model/src/app/net/sf/gridarta/model/match/OrGameObjectMatcher.java trunk/model/src/app/net/sf/gridarta/model/match/TypeNrsGameObjectMatcher.java trunk/model/src/app/net/sf/gridarta/model/resource/AbstractFilesResourcesReader.java trunk/model/src/app/net/sf/gridarta/model/scripts/ScriptUtils.java trunk/model/src/app/net/sf/gridarta/model/validation/DelegatingMapValidator.java trunk/model/src/app/net/sf/gridarta/model/validation/GameObjectValidator.java trunk/model/src/app/net/sf/gridarta/model/validation/checks/SlayingChecker.java trunk/model/src/app/net/sf/gridarta/model/validation/errors/BlockedMobOrSpawnPointError.java trunk/model/src/app/net/sf/gridarta/model/validation/errors/BlockedSquareError.java trunk/model/src/test/net/sf/gridarta/model/archetype/TestArchetypeSet.java trunk/utils/src/app/net/sf/gridarta/utils/CommonConstants.java Modified: trunk/atrinik/src/app/net/sf/gridarta/var/atrinik/model/archetype/ArchetypeSet.java =================================================================== --- trunk/atrinik/src/app/net/sf/gridarta/var/atrinik/model/archetype/ArchetypeSet.java 2010-10-10 10:52:56 UTC (rev 8706) +++ trunk/atrinik/src/app/net/sf/gridarta/var/atrinik/model/archetype/ArchetypeSet.java 2010-10-10 12:08:14 UTC (rev 8707) @@ -52,26 +52,26 @@ * {@inheritDoc} */ @Override - protected int collectArch(@NotNull final Archetype arch, @NotNull final Writer out, @NotNull final GameObjectParser<GameObject, MapArchObject, Archetype> gameObjectParser) throws IOException { - out.append("Object ").append(arch.getArchetypeName()).append('\n'); + protected int collectArchetype(@NotNull final Archetype archetype, @NotNull final Writer out, @NotNull final GameObjectParser<GameObject, MapArchObject, Archetype> gameObjectParser) throws IOException { + out.append("Object ").append(archetype.getArchetypeName()).append('\n'); - if (arch.getMultiShapeID() > 0) { - out.append("mpart_id ").append(Integer.toString(arch.getMultiShapeID())).append('\n'); + if (archetype.getMultiShapeID() > 0) { + out.append("mpart_id ").append(Integer.toString(archetype.getMultiShapeID())).append('\n'); } - if (arch.getMultiPartNr() > 0) { - out.append("mpart_nr ").append(Integer.toString(arch.getMultiPartNr())).append('\n'); + if (archetype.getMultiPartNr() > 0) { + out.append("mpart_nr ").append(Integer.toString(archetype.getMultiPartNr())).append('\n'); } - if (arch.getMsgText() != null) { - out.append("msg\n").append(arch.getMsgText()).append("endmsg\n"); + if (archetype.getMsgText() != null) { + out.append("msg\n").append(archetype.getMsgText()).append("endmsg\n"); } // special: add a string-attribute with the display-category - out.append("editor_folder ").append(arch.getEditorFolder()).append('\n'); + out.append("editor_folder ").append(archetype.getEditorFolder()).append('\n'); - out.append(arch.getObjectText()); + out.append(archetype.getObjectText()); - for (final GameObject inv : arch) { + for (final GameObject inv : archetype) { gameObjectParser.save(out, inv); } @@ -79,7 +79,7 @@ // process the multi-part tails: int result = 1; - for (Archetype tail = arch.getMultiNext(); tail != null; tail = tail.getMultiNext()) { + for (Archetype tail = archetype.getMultiNext(); tail != null; tail = tail.getMultiNext()) { result++; out.append("More\n"); Modified: trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/model/archetype/ArchetypeSet.java =================================================================== --- trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/model/archetype/ArchetypeSet.java 2010-10-10 10:52:56 UTC (rev 8706) +++ trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/model/archetype/ArchetypeSet.java 2010-10-10 12:08:14 UTC (rev 8707) @@ -60,20 +60,20 @@ * {@inheritDoc} */ @Override - protected int collectArch(@NotNull final Archetype arch, @NotNull final Writer out, @NotNull final GameObjectParser<GameObject, MapArchObject, Archetype> gameObjectParser) throws IOException { - out.append("Object ").append(arch.getArchetypeName()).append('\n'); + protected int collectArchetype(@NotNull final Archetype archetype, @NotNull final Writer out, @NotNull final GameObjectParser<GameObject, MapArchObject, Archetype> gameObjectParser) throws IOException { + out.append("Object ").append(archetype.getArchetypeName()).append('\n'); // special: add a string-attribute with the display-category - out.append("editor_folder ").append(arch.getEditorFolder()).append('\n'); + out.append("editor_folder ").append(archetype.getEditorFolder()).append('\n'); // add message text - if (arch.getMsgText() != null) { - out.append("msg\n").append(arch.getMsgText()).append("endmsg\n"); + if (archetype.getMsgText() != null) { + out.append("msg\n").append(archetype.getMsgText()).append("endmsg\n"); } - out.append(arch.getObjectText()); + out.append(archetype.getObjectText()); - for (final GameObject inv : arch) { + for (final GameObject inv : archetype) { gameObjectParser.save(out, inv); } @@ -81,7 +81,7 @@ // process the multi-part tails: int result = 1; - for (Archetype tail = arch.getMultiNext(); tail != null; tail = tail.getMultiNext()) { + for (Archetype tail = archetype.getMultiNext(); tail != null; tail = tail.getMultiNext()) { result++; out.append("More\n"); Modified: trunk/daimonin/src/app/net/sf/gridarta/var/daimonin/model/archetype/ArchetypeSet.java =================================================================== --- trunk/daimonin/src/app/net/sf/gridarta/var/daimonin/model/archetype/ArchetypeSet.java 2010-10-10 10:52:56 UTC (rev 8706) +++ trunk/daimonin/src/app/net/sf/gridarta/var/daimonin/model/archetype/ArchetypeSet.java 2010-10-10 12:08:14 UTC (rev 8707) @@ -52,30 +52,30 @@ * {@inheritDoc} */ @Override - protected int collectArch(@NotNull final Archetype arch, @NotNull final Writer out, @NotNull final GameObjectParser<GameObject, MapArchObject, Archetype> gameObjectParser) throws IOException { - out.append("Object ").append(arch.getArchetypeName()).append('\n'); + protected int collectArchetype(@NotNull final Archetype archetype, @NotNull final Writer out, @NotNull final GameObjectParser<GameObject, MapArchObject, Archetype> gameObjectParser) throws IOException { + out.append("Object ").append(archetype.getArchetypeName()).append('\n'); - if (arch.getMultiShapeID() > 0) { - out.append("mpart_id ").append(Integer.toString(arch.getMultiShapeID())).append('\n'); + if (archetype.getMultiShapeID() > 0) { + out.append("mpart_id ").append(Integer.toString(archetype.getMultiShapeID())).append('\n'); } - if (arch.getMultiPartNr() > 0) { - out.append("mpart_nr ").append(Integer.toString(arch.getMultiPartNr())).append('\n'); + if (archetype.getMultiPartNr() > 0) { + out.append("mpart_nr ").append(Integer.toString(archetype.getMultiPartNr())).append('\n'); } - if (arch.getMsgText() != null) { - out.append("msg\n").append(arch.getMsgText()).append("endmsg\n"); + if (archetype.getMsgText() != null) { + out.append("msg\n").append(archetype.getMsgText()).append("endmsg\n"); } // special: add a string-attribute with the display-category - out.append("editor_folder ").append(arch.getEditorFolder()).append('\n'); + out.append("editor_folder ").append(archetype.getEditorFolder()).append('\n'); - out.append(arch.getObjectText()); + out.append(archetype.getObjectText()); out.append("end\n"); // process the multi-part tails: int result = 1; - for (Archetype tail = arch.getMultiNext(); tail != null; tail = tail.getMultiNext()) { + for (Archetype tail = archetype.getMultiNext(); tail != null; tail = tail.getMultiNext()) { result++; out.append("More\n"); Modified: trunk/model/src/app/net/sf/gridarta/model/archetype/AbstractArchetypeSet.java =================================================================== --- trunk/model/src/app/net/sf/gridarta/model/archetype/AbstractArchetypeSet.java 2010-10-10 10:52:56 UTC (rev 8706) +++ trunk/model/src/app/net/sf/gridarta/model/archetype/AbstractArchetypeSet.java 2010-10-10 12:08:14 UTC (rev 8707) @@ -285,24 +285,24 @@ progress.setLabel(ActionBuilderUtils.getString(ACTION_BUILDER, "archCollectArches"), archetypes.size()); int artifactCount = 0; int count = 0; - for (final R arch : archetypes) { - if (arch.isArtifact()) { + for (final R archetype : archetypes) { + if (archetype.isArtifact()) { artifactCount++; continue; } - if (arch.isUndefinedArchetype()) { + if (archetype.isUndefinedArchetype()) { continue; } - if (arch.isTail()) { + if (archetype.isTail()) { continue; } - if (arch.getArchetypeName().equals(ArchetypeParser.START_ARCH_NAME)) { - collectStartArch(arch, writer); + if (archetype.getArchetypeName().equals(ArchetypeParser.START_ARCH_NAME)) { + collectStartArch(archetype, writer); count++; } else { - count += collectArch(arch, writer, gameObjectParser); + count += collectArchetype(archetype, writer, gameObjectParser); } if (count % 100 == 0) { @@ -337,11 +337,11 @@ /** * Collects an {@link Archetype}: writes its definition into a writer. - * @param arch the archetype + * @param archetype the archetype * @param out the writer * @return the number of archetype parts written * @throws IOException if an I/O error occurs */ - protected abstract int collectArch(@NotNull final R arch, @NotNull final Writer out, @NotNull final GameObjectParser<G, A, R> gameObjectParser) throws IOException; + protected abstract int collectArchetype(@NotNull final R archetype, @NotNull final Writer out, @NotNull final GameObjectParser<G, A, R> gameObjectParser) throws IOException; } // class AbstractArchetypeSet Modified: trunk/model/src/app/net/sf/gridarta/model/archetypetype/ArchetypeAttribute.java =================================================================== --- trunk/model/src/app/net/sf/gridarta/model/archetypetype/ArchetypeAttribute.java 2010-10-10 10:52:56 UTC (rev 8706) +++ trunk/model/src/app/net/sf/gridarta/model/archetypetype/ArchetypeAttribute.java 2010-10-10 12:08:14 UTC (rev 8707) @@ -22,7 +22,7 @@ import org.jetbrains.annotations.NotNull; /** - * This Class contains the data of one arch attribute. + * This Class contains the data of one archetype attribute. * @author <a href="mailto:and...@gm...">Andreas Vogl</a> */ public abstract class ArchetypeAttribute implements Cloneable { Modified: trunk/model/src/app/net/sf/gridarta/model/archetypetype/ArchetypeTypeParser.java =================================================================== --- trunk/model/src/app/net/sf/gridarta/model/archetypetype/ArchetypeTypeParser.java 2010-10-10 10:52:56 UTC (rev 8706) +++ trunk/model/src/app/net/sf/gridarta/model/archetypetype/ArchetypeTypeParser.java 2010-10-10 12:08:14 UTC (rev 8707) @@ -339,8 +339,8 @@ errorViewCollector.addWarning(ErrorViewCategory.TYPES_ENTRY_INVALID, XML_ELEMENT_REQUIRED + ": element of type " + typeName + ": " + XML_ELEMENT_ATTRIBUTE + " missing '" + XML_ATTRIBUTE_ARCH + "'."); continue; } - final String arch = archAttribute.getValue(); - if (arch.isEmpty()) { + final String attributeValue = archAttribute.getValue(); + if (attributeValue.isEmpty()) { errorViewCollector.addWarning(ErrorViewCategory.TYPES_ENTRY_INVALID, XML_ELEMENT_REQUIRED + ": element of type " + typeName + ": " + XML_ELEMENT_ATTRIBUTE + " empty '" + XML_ATTRIBUTE_ARCH + "'."); continue; } @@ -356,7 +356,7 @@ continue; } - attributes.add(new ArchetypeAttributeDefinition(arch, value)); + attributes.add(new ArchetypeAttributeDefinition(attributeValue, value)); } } return attributes; @@ -380,13 +380,13 @@ continue; } - final String arch = archAttribute.getValue(); - if (arch.isEmpty()) { + final String attributeValue = archAttribute.getValue(); + if (attributeValue.isEmpty()) { errorViewCollector.addWarning(ErrorViewCategory.TYPES_ENTRY_INVALID, XML_ELEMENT_IGNORE + ": section of type " + typeName + ": " + XML_ELEMENT_ATTRIBUTE + " empty '" + XML_ATTRIBUTE_ARCH + "'."); continue; } - ignoreTable.add(arch); + ignoreTable.add(attributeValue); } } @@ -521,7 +521,7 @@ * @param typeNo the archetype type's type number * @param sectionName name of the section or <code>null</code> for top-level * attribute definitions - * @param archetypeTypeSet arch type list + * @param archetypeTypeSet archetype type set * @return the parsed attribute or <code>null</code> if an error occurs */ @Nullable Modified: trunk/model/src/app/net/sf/gridarta/model/archetypetype/ArchetypeTypeSet.java =================================================================== --- trunk/model/src/app/net/sf/gridarta/model/archetypetype/ArchetypeTypeSet.java 2010-10-10 10:52:56 UTC (rev 8706) +++ trunk/model/src/app/net/sf/gridarta/model/archetypetype/ArchetypeTypeSet.java 2010-10-10 12:08:14 UTC (rev 8707) @@ -73,7 +73,7 @@ private final Map<String, AttributeBitmask> bitmaskTable = new HashMap<String, AttributeBitmask>(); /** - * Table with type arch type name as keys ({@link String}), and {@link + * Table with type archetype type name as keys ({@link String}), and {@link * ArchetypeType} object as values (<code>ArchetypeType</code>). */ @NotNull @@ -129,14 +129,14 @@ /** * Find and return the type-structure (<code>ArchetypeType</code>) that - * matches for the given arch. This is not only a comparison between type - * numbers - special type-attributes must also be dealt with. <p/> - * @param baseObject the arch to find the type for - * @return the <code>ArchetypeType</code> which belongs to this arch, or the - * first (misc) type if no match is found. + * matches for the given base object. This is not only a comparison between + * type numbers - special type-attributes must also be dealt with. <p/> + * @param baseObject the base object to find the type for + * @return the <code>ArchetypeType</code> which belongs to this base object, + * or the first (misc) type if no match is found. */ @NotNull - public ArchetypeType getTypeOfArch(final BaseObject<?, ?, ?, ?> baseObject) { + public ArchetypeType getTypeOfArch(@NotNull final BaseObject<?, ?, ?, ?> baseObject) { for (final ArchetypeType tmp : archetypeTypeList) { if (tmp.matches(baseObject)) { return tmp; @@ -160,8 +160,8 @@ } /** - * Returns the default arch type. - * @return The default arch type. + * Returns the default archetype type. + * @return the default archetype type */ @Nullable public ArchetypeType getDefaultArchetypeType() { @@ -169,8 +169,8 @@ } /** - * Sets the default arch type. - * @param defaultArchetypeType the default arch type + * Sets the default archetype type. + * @param defaultArchetypeType the default archetype type */ public void setDefaultArchetypeType(@NotNull final ArchetypeType defaultArchetypeType) { this.defaultArchetypeType = defaultArchetypeType; Modified: trunk/model/src/app/net/sf/gridarta/model/archetypetype/AttributeBitmask.java =================================================================== --- trunk/model/src/app/net/sf/gridarta/model/archetypetype/AttributeBitmask.java 2010-10-10 10:52:56 UTC (rev 8706) +++ trunk/model/src/app/net/sf/gridarta/model/archetypetype/AttributeBitmask.java 2010-10-10 12:08:14 UTC (rev 8707) @@ -33,9 +33,9 @@ import org.jetbrains.annotations.Nullable; /** - * This class manages bitmask values which appear in Gridarta arch attributes. - * Attack type, spell path and material are such bitmasks. They are disguised - * for the user, with the help of the attribute dialog. + * This class manages bitmask values which appear in Gridarta archetype + * attributes. Attack type, spell path and material are such bitmasks. They are + * disguised for the user, with the help of the attribute dialog. * @author <a href="mailto:and...@gm...">Andreas Vogl</a> * @author <a href="mailto:ch...@ri...">Christian Hujer</a> */ Modified: trunk/model/src/app/net/sf/gridarta/model/autojoin/AutojoinLists.java =================================================================== --- trunk/model/src/app/net/sf/gridarta/model/autojoin/AutojoinLists.java 2010-10-10 10:52:56 UTC (rev 8706) +++ trunk/model/src/app/net/sf/gridarta/model/autojoin/AutojoinLists.java 2010-10-10 12:08:14 UTC (rev 8707) @@ -83,11 +83,11 @@ } /** - * Do autojoining on insertion of a default arch on the map. All arches + * Do autojoining on insertion of an game object on the map. All arches * around the insert point get adjusted, and the archetype name of the - * correct arch to be inserted is returned. This method must be called from - * the appropriate element of the AutojoinList, best use the link from the - * default arch. + * correct archetype to be inserted is returned. This method must be called + * from the appropriate element of the AutojoinList, best use the link from + * the default archetype. * @param point Location of the insert point on the map * @param archetype the archetype to connect with * @param mapModel Data model of the map @@ -108,7 +108,7 @@ return new InsertionResult<G, A, R>(null, archetype); } - // if there already is an arch of this list at point -> abort + // if there already is an archetype of this list at point -> abort final boolean isMainIndex = autojoinList.isMainIndex(archetype); final G gameObject = findGameObjectOfAutojoinList(mapModel, point, autojoinList); if (gameObject != null) { @@ -182,7 +182,7 @@ * Do autojoining on deletion of an GameObject on the map. All arches around * the insert point get adjusted. This method must be called from the * appropriate element of the AutojoinList, best use the link from the - * default arch. + * default archetype. * @param point Location of the insert point on the map * @param archetype the archetype to connect with * @param mapModel Data model of the map @@ -229,46 +229,44 @@ } /** - * Looks for an arch at map-position point which is part of an autojoin + * Looks for an archetype at map-position point which is part of an autojoin * list. * @param mapModel the map model to search * @param point location to search * @param autojoinList the autojoin list - * @return arch which is part of this join-list, null if no such arch - * exists + * @return the archetype which is part of this join-list or + * <code>null</code> if no such archetype exists */ @Nullable private G findGameObjectOfAutojoinList(@NotNull final MapModel<G, A, R> mapModel, @NotNull final Point point, @NotNull final AutojoinList<G, A, R> autojoinList) { - // we look through the arches at the given location (top to bottom): for (final G gameObject : mapModel.getMapSquare(point).reverse()) { if (autojoinLists.get(gameObject.getArchetype()) == autojoinList) { - return gameObject; // we found an arch + return gameObject; } } - return null; // nothing found + return null; } /** - * Looks for an arch at map-position point which is the main archetypes part - * of an autojoin list. + * Looks for an archetype at map-position point which is the main archetypes + * part of an autojoin list. * @param mapModel the map model to search * @param point location to search * @param autojoinList the autojoin list - * @return arch which is part of this join-list, null if no such arch - * exists + * @return the archetype which is part of this join-list or + * <code>null</code> if no such archetype exists */ @Nullable private GameObject<G, A, R> findMainGameObjectOfAutojoinList(@NotNull final MapModel<G, A, R> mapModel, @NotNull final Point point, @NotNull final AutojoinList<G, A, R> autojoinList) { - // we look through the arches at the given location (top to bottom): for (final GameObject<G, A, R> gameObject : mapModel.getMapSquare(point).reverse()) { final R archetype = gameObject.getArchetype(); if (autojoinLists.get(archetype) == autojoinList && autojoinList.isMainIndex(archetype)) { - return gameObject; // we found an arch + return gameObject; } } - return null; // nothing found + return null; } } // class AutojoinLists Modified: trunk/model/src/app/net/sf/gridarta/model/baseobject/BaseObject.java =================================================================== --- trunk/model/src/app/net/sf/gridarta/model/baseobject/BaseObject.java 2010-10-10 10:52:56 UTC (rev 8706) +++ trunk/model/src/app/net/sf/gridarta/model/baseobject/BaseObject.java 2010-10-10 12:08:14 UTC (rev 8707) @@ -196,7 +196,7 @@ double getAttributeDouble(@NotNull String attributeName); /** - * Set the String of an arch attribute in the objectText. + * Set the String of an archetype attribute in the objectText. * @param attributeName search for "attributeName <string>" * @param value value to set */ @@ -210,7 +210,7 @@ void setAttributeInt(@NotNull String attributeName, int value); /** - * Remove the String of an arch attribute from the objectText. + * Remove the String of an archetype attribute from the objectText. * @param attributeName search for "attributeName <string>" */ void removeAttribute(@NotNull String attributeName); Modified: trunk/model/src/app/net/sf/gridarta/model/collectable/Collectable.java =================================================================== --- trunk/model/src/app/net/sf/gridarta/model/collectable/Collectable.java 2010-10-10 10:52:56 UTC (rev 8706) +++ trunk/model/src/app/net/sf/gridarta/model/collectable/Collectable.java 2010-10-10 12:08:14 UTC (rev 8707) @@ -30,7 +30,7 @@ /** * A Collectable has information that can be collected. This is used during the - * "arch collection" process to gather information into files suitable for the + * "collection" process to gather information into files suitable for the * server. * @author <a href="mailto:ch...@ri...">Christian Hujer</a> */ Modified: trunk/model/src/app/net/sf/gridarta/model/face/package.html =================================================================== --- trunk/model/src/app/net/sf/gridarta/model/face/package.html 2010-10-10 10:52:56 UTC (rev 8706) +++ trunk/model/src/app/net/sf/gridarta/model/face/package.html 2010-10-10 12:08:14 UTC (rev 8707) @@ -24,7 +24,7 @@ <p/> This package contains classes for managing icons in memory sensitive caches. Currently, the keys to lookup the icons are Strings (usually the facename of an -arch), and lookup is done in HashMaps. +archetype), and lookup is done in HashMaps. <p/> HashMaps are fast, but, of course, never as fast as an indexed array. Though, HashMaps are easier to maintain. In case someone complains about the usage of @@ -78,8 +78,8 @@ The design to generate artificial indices for faces has some flaws. Keeping several arrays in parallel to hold the same information can cause serious, eventually difficult to find bugs. Such a design also - prevents the implementation of dynamic arch handling, where arches and - faces should be loadable, editable and un-loadable during editor + prevents the implementation of dynamic archetype handling, where arches + and faces should be loadable, editable and un-loadable during editor runtime. The allocation of several large arrays also is a serious indicator for design flaws when using artificial indices, also these arrays need to be anxiously oversized to not get into @@ -88,10 +88,10 @@ names to face references therefore is a good and clear design and very resistant against bugs or overflows. <p/> - Also, an arch first naturally comes with a face name. To get an index - for a face name, it is required to first do a linear search. Linear - search is always wrong and averages to <var>O(n * c)</var> which is - worse than HashMap performance. If the indices are sorted, a binary + Also, an archetype first naturally comes with a face name. To get an + index for a face name, it is required to first do a linear search. + Linear search is always wrong and averages to <var>O(n * c)</var> which + is worse than HashMap performance. If the indices are sorted, a binary search with a performance of <var>O(2*c + log2(n)*c*2)</var>, which is exactly what a HashMap does. That means, the term that best describes the usage of artificial face indices for increasing face lookup Modified: trunk/model/src/app/net/sf/gridarta/model/gameobject/FaceSource.java =================================================================== --- trunk/model/src/app/net/sf/gridarta/model/gameobject/FaceSource.java 2010-10-10 10:52:56 UTC (rev 8706) +++ trunk/model/src/app/net/sf/gridarta/model/gameobject/FaceSource.java 2010-10-10 12:08:14 UTC (rev 8707) @@ -39,7 +39,7 @@ /** * This GameObject has no face defined and thus inherited the face from its - * default arch. + * archetype. */ ARCHETYPE_FACE, @@ -50,7 +50,7 @@ /** * This GameObject is animated but doesn't define an animation and thus - * inherited the animation from its default arch. + * inherited the animation from its archetype. */ ARCHETYPE_ANIM Modified: trunk/model/src/app/net/sf/gridarta/model/gameobject/GameObjectUtils.java =================================================================== --- trunk/model/src/app/net/sf/gridarta/model/gameobject/GameObjectUtils.java 2010-10-10 10:52:56 UTC (rev 8706) +++ trunk/model/src/app/net/sf/gridarta/model/gameobject/GameObjectUtils.java 2010-10-10 12:08:14 UTC (rev 8707) @@ -41,13 +41,13 @@ * This method checks the objectText for syntax errors. More precisely: It * reads every line in the objectText and looks if it matches the * type-definitions (-> see {@link net.sf.gridarta.model.archetypetype.ArchetypeTypeSet}) - * for this arch. If there is no match, the line is considered wrong. Of - * course the type-definitions will never be perfect, this should be kept in - * mind. <p/> Note that the default arch is ignored in the check. The + * for this base object. If there is no match, the line is considered wrong. + * Of course the type-definitions will never be perfect, this should be kept + * in mind. <p/> Note that the archetype is ignored in the check. The * default arches should be correct, and even if not - it isn't the map * maker to blame. * @param gameObject the game object to check - * @param type the type structure belonging to this arch + * @param type the type structure belonging to this base object * @return A String with all lines which don't match the * type-definitions.<br> If no such "errors" encountered, null is * returned. @@ -66,7 +66,7 @@ errors.append(line.trim()).append('\n'); // append line to the errors /* // the attribute doesn't match the definitions, - // now check if it is a negation of an entry in the default arch + // now check if it is a negation of an entry in the archetype if (line.contains(" ")) { String attr_val = line.substring(line.indexOf(" ")).trim(); if (!(archetype.getAttributeString(attrKey, null).length() > 0 && (attr_val.equals("0") || attr_val.equals("null") || attr_val.equals("none")))) { Modified: trunk/model/src/app/net/sf/gridarta/model/io/AbstractMapArchObjectParser.java =================================================================== --- trunk/model/src/app/net/sf/gridarta/model/io/AbstractMapArchObjectParser.java 2010-10-10 10:52:56 UTC (rev 8706) +++ trunk/model/src/app/net/sf/gridarta/model/io/AbstractMapArchObjectParser.java 2010-10-10 12:08:14 UTC (rev 8707) @@ -30,7 +30,7 @@ /** * Abstract base class for classes implementing {@link MapArchObjectParser}s. - * This class contains the common code for reading map arch objects. Subclasses + * This class contains the common code for reading map game objects. Subclasses * can extend the parser ({@link #parseLine(String, MapArchObject, * BufferedReader)}. No support for writing is present. * @author Andreas Kirschbaum Modified: trunk/model/src/app/net/sf/gridarta/model/io/DefaultMapReader.java =================================================================== --- trunk/model/src/app/net/sf/gridarta/model/io/DefaultMapReader.java 2010-10-10 10:52:56 UTC (rev 8706) +++ trunk/model/src/app/net/sf/gridarta/model/io/DefaultMapReader.java 2010-10-10 12:08:14 UTC (rev 8707) @@ -50,7 +50,7 @@ private final List<G> objects = new ArrayList<G>(); /** - * Contains the map arch (see MapArchObject class). + * Contains the map arch object. */ @NotNull private final A mapArchObject; Modified: trunk/model/src/app/net/sf/gridarta/model/io/GameObjectParser.java =================================================================== --- trunk/model/src/app/net/sf/gridarta/model/io/GameObjectParser.java 2010-10-10 10:52:56 UTC (rev 8706) +++ trunk/model/src/app/net/sf/gridarta/model/io/GameObjectParser.java 2010-10-10 12:08:14 UTC (rev 8707) @@ -66,7 +66,7 @@ G load(@NotNull BufferedReader reader, @NotNull String firstLine, @Nullable Collection<G> objects) throws IOException; /** - * Write a map arch object to a stream. + * Write a game object object to a stream. * @param appendable The stream to write to. * @param gameObject The game object to write. * @throws IOException If the stream cannot be written. @@ -74,8 +74,8 @@ void save(@NotNull Appendable appendable, @NotNull G gameObject) throws IOException; /** - * Browse first through the default arch list and attach map arches to it - * then browse through the face list and try to find the pictures. + * Browse first through the archetype list and attach map arches to it then + * browse through the face list and try to find the pictures. * @param mapViewSettings the map view settings instance * @param objects List of GameObjects to collect */ Modified: trunk/model/src/app/net/sf/gridarta/model/io/MapArchObjectParser.java =================================================================== --- trunk/model/src/app/net/sf/gridarta/model/io/MapArchObjectParser.java 2010-10-10 10:52:56 UTC (rev 8706) +++ trunk/model/src/app/net/sf/gridarta/model/io/MapArchObjectParser.java 2010-10-10 12:08:14 UTC (rev 8707) @@ -32,18 +32,18 @@ /** * Parse a map arch object from a stream. - * @param reader The stream to read. - * @param mapArchObject The map arch object to update. - * @throws IOException If the stream cannot be read or if a parsing error - * occurs; the map arch object may have been partially updated. + * @param reader the stream to read + * @param mapArchObject the map arch object to update + * @throws IOException if the stream cannot be read or if a parsing error + * occurs; the map arch object may have been partially updated */ void load(@NotNull BufferedReader reader, @NotNull A mapArchObject) throws IOException; /** * Write a map arch object to a stream. - * @param appendable The stream to write to. - * @param mapArchObject The map arch object to write. - * @throws IOException If the stream cannot be written. + * @param appendable the stream to write to + * @param mapArchObject the map arch object to write + * @throws IOException if the stream cannot be written */ void save(@NotNull Appendable appendable, @NotNull A mapArchObject) throws IOException; Modified: trunk/model/src/app/net/sf/gridarta/model/mapmodel/DefaultMapModel.java =================================================================== --- trunk/model/src/app/net/sf/gridarta/model/mapmodel/DefaultMapModel.java 2010-10-10 10:52:56 UTC (rev 8706) +++ trunk/model/src/app/net/sf/gridarta/model/mapmodel/DefaultMapModel.java 2010-10-10 12:08:14 UTC (rev 8707) @@ -714,7 +714,7 @@ */ @Nullable @Override - public G insertArchToMap(@NotNull final BaseObject<G, A, R, ?> templateGameObject, @Nullable final G nextGameObject, @NotNull final Point pos, final boolean join) { + public G insertArchToMap(@NotNull final BaseObject<G, A, R, ?> templateBaseObject, @Nullable final G nextGameObject, @NotNull final Point pos, final boolean join) { // map coords must be valid if (!mapArchObject.isPointValid(pos)) { return null; @@ -723,9 +723,7 @@ final G newGameObject; final GameObject<G, A, R> nextGameObjectEnv = nextGameObject == null ? null : nextGameObject.getContainerGameObject(); if (nextGameObject == null || nextGameObjectEnv == null) { - - // put arch on the map - newGameObject = insertBaseObject(templateGameObject, pos, true, join, topmostInsertionMode); + newGameObject = insertBaseObject(templateBaseObject, pos, true, join, topmostInsertionMode); if (newGameObject == null) { return null; } @@ -743,8 +741,7 @@ newGameObject.moveDown(); } } else { - // insert the new arch into the inventory of a map arch - newGameObject = templateGameObject.newInstance(gameObjectFactory); + newGameObject = templateBaseObject.newInstance(gameObjectFactory); gameObjectMatchers.updateEditType(newGameObject, activeEditType); nextGameObjectEnv.addLast(newGameObject); } Modified: trunk/model/src/app/net/sf/gridarta/model/mapmodel/MapModel.java =================================================================== --- trunk/model/src/app/net/sf/gridarta/model/mapmodel/MapModel.java 2010-10-10 10:52:56 UTC (rev 8706) +++ trunk/model/src/app/net/sf/gridarta/model/mapmodel/MapModel.java 2010-10-10 12:08:14 UTC (rev 8707) @@ -321,23 +321,20 @@ G insertBaseObject(@NotNull BaseObject<G, A, R, ?> baseObject, @NotNull Point pos, boolean allowMany, boolean join, @NotNull InsertionMode<G, A, R> insertionMode); /** - * Insert a new arch to the map at a specified position. This function - * allows either to choose from the default arches (->archName) or to insert - * a copy from an existing arch (->newObject). It also works for - * container-inventory. - * @param templateGameObject A clone copy of this GameObject gets inserted - * to the map. It can be an arch directly from a pickmap or even a default - * arch. - * @param nextGameObject the new arch gets inserted before 'next' if - * ('next'==null) the arch gets inserted at bottom -> 'next' must be an arch - * from the map! (or null) - * @param pos map position to insert the new arch + * Insert a game object to the map at a specified position. This function + * allows either to choose from the archetypes or to insert a copy from an + * existing game object. It also works for container-inventory. + * @param templateBaseObject a clone copy of this game object gets inserted + * to the map; it can be an archetype of a game object + * @param nextGameObject the new game object gets inserted before this; if + * <code>null</code>, the game object gets inserted at bottom + * @param pos the map position to insert the new game object * @param join if set, auto-joining is supported * @return the inserted game object, or <code>null</code> if an error * occurred */ @Nullable - G insertArchToMap(@NotNull BaseObject<G, A, R, ?> templateGameObject, @Nullable G nextGameObject, @NotNull Point pos, boolean join); + G insertArchToMap(@NotNull BaseObject<G, A, R, ?> templateBaseObject, @Nullable G nextGameObject, @NotNull Point pos, boolean join); /** * Delete an existing {@link GameObject} from the map. @@ -351,9 +348,9 @@ * @param archetype the archetype to check * @param pos position of multi-square head * @param allowDouble whether overlapping multi-square arches should be - * allowed (check is done using the arch name) + * allowed (check is done using the archetype name) * @return whether the multi-arch would still fit on this map - * @retval <code>true</code> if the multi-square arch would still fit on + * @retval <code>true</code> if the multi-square archetype would still fit on * this map * @retval <code>false</code> otherwise */ Modified: trunk/model/src/app/net/sf/gridarta/model/match/AndGameObjectMatcher.java =================================================================== --- trunk/model/src/app/net/sf/gridarta/model/match/AndGameObjectMatcher.java 2010-10-10 10:52:56 UTC (rev 8706) +++ trunk/model/src/app/net/sf/gridarta/model/match/AndGameObjectMatcher.java 2010-10-10 12:08:14 UTC (rev 8707) @@ -54,9 +54,9 @@ * {@inheritDoc} */ @Override - public boolean isMatching(@NotNull final GameObject<?, ?, ?> arch) { + public boolean isMatching(@NotNull final GameObject<?, ?, ?> gameObject) { for (final GameObjectMatcher gameObjectMatcher : matchers) { - if (!gameObjectMatcher.isMatching(arch)) { + if (!gameObjectMatcher.isMatching(gameObject)) { return false; } } Modified: trunk/model/src/app/net/sf/gridarta/model/match/AttributeGameObjectMatcher.java =================================================================== --- trunk/model/src/app/net/sf/gridarta/model/match/AttributeGameObjectMatcher.java 2010-10-10 10:52:56 UTC (rev 8706) +++ trunk/model/src/app/net/sf/gridarta/model/match/AttributeGameObjectMatcher.java 2010-10-10 12:08:14 UTC (rev 8707) @@ -79,8 +79,8 @@ * {@inheritDoc} */ @Override - public boolean isMatching(@NotNull final GameObject<?, ?, ?> arch) { - final Comparable<String> actual = arch.getAttributeString(name, useDefArch); + public boolean isMatching(@NotNull final GameObject<?, ?, ?> gameObject) { + final Comparable<String> actual = gameObject.getAttributeString(name, useDefArch); final int ret = actual.compareTo(value); switch (operation) { case eq: Modified: trunk/model/src/app/net/sf/gridarta/model/match/GameObjectMatcher.java =================================================================== --- trunk/model/src/app/net/sf/gridarta/model/match/GameObjectMatcher.java 2010-10-10 10:52:56 UTC (rev 8706) +++ trunk/model/src/app/net/sf/gridarta/model/match/GameObjectMatcher.java 2010-10-10 12:08:14 UTC (rev 8707) @@ -31,10 +31,10 @@ /** * Matches an {@link GameObject}. - * @param arch the <code>GameObject</code> to match + * @param gameObject the <code>GameObject</code> to match * @return <code>true</code> if this matcher matches the given game object, * otherwise <code>false</code> */ - boolean isMatching(@NotNull GameObject<?, ?, ?> arch); + boolean isMatching(@NotNull GameObject<?, ?, ?> gameObject); } // interface GameObjectMatcher Modified: trunk/model/src/app/net/sf/gridarta/model/match/GameObjectMatchers.java =================================================================== --- trunk/model/src/app/net/sf/gridarta/model/match/GameObjectMatchers.java 2010-10-10 10:52:56 UTC (rev 8706) +++ trunk/model/src/app/net/sf/gridarta/model/match/GameObjectMatchers.java 2010-10-10 12:08:14 UTC (rev 8707) @@ -45,14 +45,14 @@ private static final long serialVersionUID = 1L; /** - * Map with arch object matchers and their IDs. + * Map with game object object matchers and their IDs. * @serial */ @NotNull private final Map<String, NamedGameObjectMatcher> gameObjectMatchersByIds = new HashMap<String, NamedGameObjectMatcher>(); /** - * List with arch object matchers. + * List with game object matchers. * @serial */ @NotNull @@ -118,7 +118,8 @@ return; } - // all flags from 'checkType' must be unset in this arch because they get recalculated now + // all flags from 'checkType' must be unset in this game object because + // they get recalculated now final int retainedEditType = editType == GUIConstants.EDIT_TYPE_NONE ? 0 : editType & ~checkType; final int newEditType = retainedEditType | calculateEditType(gameObject, checkType); gameObject.setEditType(newEditType); Modified: trunk/model/src/app/net/sf/gridarta/model/match/MutableNameGameObjectMatcher.java =================================================================== --- trunk/model/src/app/net/sf/gridarta/model/match/MutableNameGameObjectMatcher.java 2010-10-10 10:52:56 UTC (rev 8706) +++ trunk/model/src/app/net/sf/gridarta/model/match/MutableNameGameObjectMatcher.java 2010-10-10 12:08:14 UTC (rev 8707) @@ -54,8 +54,8 @@ * {@inheritDoc} */ @Override - public boolean isMatching(@NotNull final GameObject<?, ?, ?> arch) { - return name.matches(arch.getArchetype().getArchetypeName()); + public boolean isMatching(@NotNull final GameObject<?, ?, ?> gameObject) { + return name.matches(gameObject.getArchetype().getArchetypeName()); } /** Modified: trunk/model/src/app/net/sf/gridarta/model/match/MutableOrGameObjectMatcher.java =================================================================== --- trunk/model/src/app/net/sf/gridarta/model/match/MutableOrGameObjectMatcher.java 2010-10-10 10:52:56 UTC (rev 8706) +++ trunk/model/src/app/net/sf/gridarta/model/match/MutableOrGameObjectMatcher.java 2010-10-10 12:08:14 UTC (rev 8707) @@ -62,12 +62,12 @@ * {@inheritDoc} */ @Override - public boolean isMatching(@NotNull final GameObject<?, ?, ?> arch) { + public boolean isMatching(@NotNull final GameObject<?, ?, ?> gameObject) { if (gameObjectMatchers.isEmpty()) { return true; } for (final GameObjectMatcher gameObjectMatcher : gameObjectMatchers) { - if (gameObjectMatcher.isMatching(arch)) { + if (gameObjectMatcher.isMatching(gameObject)) { return true; } } Modified: trunk/model/src/app/net/sf/gridarta/model/match/NamedGameObjectMatcher.java =================================================================== --- trunk/model/src/app/net/sf/gridarta/model/match/NamedGameObjectMatcher.java 2010-10-10 10:52:56 UTC (rev 8706) +++ trunk/model/src/app/net/sf/gridarta/model/match/NamedGameObjectMatcher.java 2010-10-10 12:08:14 UTC (rev 8707) @@ -111,12 +111,12 @@ * {@inheritDoc} */ @Override - public boolean isMatching(@NotNull final GameObject<?, ?, ?> arch) { + public boolean isMatching(@NotNull final GameObject<?, ?, ?> gameObject) { if (envGameObjectMatcher != null) { - return envGameObjectMatcher.isMatching(arch) && isMatchingInventory(arch); + return envGameObjectMatcher.isMatching(gameObject) && isMatchingInventory(gameObject); } - return gameObjectMatcher.isMatching(arch); + return gameObjectMatcher.isMatching(gameObject); } /** Modified: trunk/model/src/app/net/sf/gridarta/model/match/NotGameObjectMatcher.java =================================================================== --- trunk/model/src/app/net/sf/gridarta/model/match/NotGameObjectMatcher.java 2010-10-10 10:52:56 UTC (rev 8706) +++ trunk/model/src/app/net/sf/gridarta/model/match/NotGameObjectMatcher.java 2010-10-10 12:08:14 UTC (rev 8707) @@ -52,8 +52,8 @@ * {@inheritDoc} */ @Override - public boolean isMatching(@NotNull final GameObject<?, ?, ?> arch) { - return !gameObjectMatcher.isMatching(arch); + public boolean isMatching(@NotNull final GameObject<?, ?, ?> gameObject) { + return !gameObjectMatcher.isMatching(gameObject); } } // class NotGameObjectMatcher Modified: trunk/model/src/app/net/sf/gridarta/model/match/OrGameObjectMatcher.java =================================================================== --- trunk/model/src/app/net/sf/gridarta/model/match/OrGameObjectMatcher.java 2010-10-10 10:52:56 UTC (rev 8706) +++ trunk/model/src/app/net/sf/gridarta/model/match/OrGameObjectMatcher.java 2010-10-10 12:08:14 UTC (rev 8707) @@ -54,9 +54,9 @@ * {@inheritDoc} */ @Override - public boolean isMatching(@NotNull final GameObject<?, ?, ?> arch) { + public boolean isMatching(@NotNull final GameObject<?, ?, ?> gameObject) { for (final GameObjectMatcher gameObjectMatcher : matchers) { - if (gameObjectMatcher.isMatching(arch)) { + if (gameObjectMatcher.isMatching(gameObject)) { return true; } } Modified: trunk/model/src/app/net/sf/gridarta/model/match/TypeNrsGameObjectMatcher.java =================================================================== --- trunk/model/src/app/net/sf/gridarta/model/match/TypeNrsGameObjectMatcher.java 2010-10-10 10:52:56 UTC (rev 8706) +++ trunk/model/src/app/net/sf/gridarta/model/match/TypeNrsGameObjectMatcher.java 2010-10-10 12:08:14 UTC (rev 8707) @@ -53,8 +53,8 @@ * {@inheritDoc} */ @Override - public boolean isMatching(@NotNull final GameObject<?, ?, ?> arch) { - return Arrays.binarySearch(types, arch.getTypeNo()) >= 0; + public boolean isMatching(@NotNull final GameObject<?, ?, ?> gameObject) { + return Arrays.binarySearch(types, gameObject.getTypeNo()) >= 0; } /** Modified: trunk/model/src/app/net/sf/gridarta/model/resource/AbstractFilesResourcesReader.java =================================================================== --- trunk/model/src/app/net/sf/gridarta/model/resource/AbstractFilesResourcesReader.java 2010-10-10 10:52:56 UTC (rev 8706) +++ trunk/model/src/app/net/sf/gridarta/model/resource/AbstractFilesResourcesReader.java 2010-10-10 12:08:14 UTC (rev 8707) @@ -155,7 +155,7 @@ private void loadArchetypesFromFiles(@NotNull final ErrorViewCollector errorViewCollector, @NotNull final AbstractArchetypeParser<G, A, R, ?> archetypeParser, @NotNull final String path, @NotNull final File f, final int folderLevel, @NotNull final String panelName, @NotNull final String folderName, @NotNull final List<G> invObjects, @NotNull final ArchFaceProvider archFaceProvider, @NotNull final ErrorView errorView, @NotNull final Collection<Pair<String, File>> animFiles) { final String name = f.getName(); if (f.isDirectory()) { - // now, setup the arch panels + // now, setup the archetype panels if (isValidEntry(folderLevel, name)) { final String[] entries = f.list(); if (entries != null) { Modified: trunk/model/src/app/net/sf/gridarta/model/scripts/ScriptUtils.java =================================================================== --- trunk/model/src/app/net/sf/gridarta/model/scripts/ScriptUtils.java 2010-10-10 10:52:56 UTC (rev 8706) +++ trunk/model/src/app/net/sf/gridarta/model/scripts/ScriptUtils.java 2010-10-10 12:08:14 UTC (rev 8707) @@ -91,14 +91,14 @@ /** * Try to create a reasonable default script name for lazy users. * @param baseDir the base dir for the default script name - * @param archName the best suitable name for the arch (see + * @param archetypeName the best suitable name for the archetype (see * GameObject.getBestName()) * @param scriptEnding the ending for scripts * @param pathManager the path manager for converting path names * @return a nice default script name without whitespaces */ - public static String chooseDefaultScriptName(@NotNull final File baseDir, final String archName, final String scriptEnding, @NotNull final PathManager pathManager) { - String defScriptName = archName.trim(); + public static String chooseDefaultScriptName(@NotNull final File baseDir, final String archetypeName, final String scriptEnding, @NotNull final PathManager pathManager) { + String defScriptName = archetypeName.trim(); final int i = defScriptName.indexOf(' '); if (i >= 0) { if (defScriptName.length() > 12 || defScriptName.lastIndexOf(' ') != i) { Modified: trunk/model/src/app/net/sf/gridarta/model/validation/DelegatingMapValidator.java =================================================================== --- trunk/model/src/app/net/sf/gridarta/model/validation/DelegatingMapValidator.java 2010-10-10 10:52:56 UTC (rev 8706) +++ trunk/model/src/app/net/sf/gridarta/model/validation/DelegatingMapValidator.java 2010-10-10 12:08:14 UTC (rev 8707) @@ -122,9 +122,9 @@ } /** - * Validate a set of arch objects. - * @param gameObjects ArchObjects to validate - * @param errorCollector Error collector to report errors to + * Validate a set of game objects. + * @param gameObjects game objects to validate + * @param errorCollector the rror collector to report errors to */ public void validate(@NotNull final G[] gameObjects, @NotNull final ErrorCollector<G, A, R> errorCollector) { for (final G gameObject : gameObjects) { Modified: trunk/model/src/app/net/sf/gridarta/model/validation/GameObjectValidator.java =================================================================== --- trunk/model/src/app/net/sf/gridarta/model/validation/GameObjectValidator.java 2010-10-10 10:52:56 UTC (rev 8706) +++ trunk/model/src/app/net/sf/gridarta/model/validation/GameObjectValidator.java 2010-10-10 12:08:14 UTC (rev 8707) @@ -32,9 +32,9 @@ public interface GameObjectValidator<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>> extends Validator { /** - * Validate an arch object. - * @param gameObject GameObject to validate - * @param errorCollector Error collector to report errors to + * Validates a game object. + * @param gameObject the game object to validate + * @param errorCollector the error collector to report errors to */ void validateGameObject(@NotNull G gameObject, @NotNull ErrorCollector<G, A, R> errorCollector); Modified: trunk/model/src/app/net/sf/gridarta/model/validation/checks/SlayingChecker.java =================================================================== --- trunk/model/src/app/net/sf/gridarta/model/validation/checks/SlayingChecker.java 2010-10-10 10:52:56 UTC (rev 8706) +++ trunk/model/src/app/net/sf/gridarta/model/validation/checks/SlayingChecker.java 2010-10-10 12:08:14 UTC (rev 8707) @@ -34,7 +34,7 @@ import org.jetbrains.annotations.NotNull; /** - * An GameObjectValidator to assert that arch objects do not have critical + * An GameObjectValidator to assert that game objects do not have critical * slaying strings. * @author <a href="mailto:ch...@ri...">Christian Hujer</a> */ Modified: trunk/model/src/app/net/sf/gridarta/model/validation/errors/BlockedMobOrSpawnPointError.java =================================================================== --- trunk/model/src/app/net/sf/gridarta/model/validation/errors/BlockedMobOrSpawnPointError.java 2010-10-10 10:52:56 UTC (rev 8706) +++ trunk/model/src/app/net/sf/gridarta/model/validation/errors/BlockedMobOrSpawnPointError.java 2010-10-10 12:08:14 UTC (rev 8707) @@ -88,7 +88,7 @@ */ @Override public void correct(@NotNull final Component parentComponent) { - // TODO: Query whether the user wants to delete the arch, delete the spawn / mob or cancel. + // TODO: Query whether the user wants to delete the game object, delete the spawn / mob or cancel. } } // class BlockedMobOrSpawnPointError Modified: trunk/model/src/app/net/sf/gridarta/model/validation/errors/BlockedSquareError.java =================================================================== --- trunk/model/src/app/net/sf/gridarta/model/validation/errors/BlockedSquareError.java 2010-10-10 10:52:56 UTC (rev 8706) +++ trunk/model/src/app/net/sf/gridarta/model/validation/errors/BlockedSquareError.java 2010-10-10 12:08:14 UTC (rev 8707) @@ -50,7 +50,7 @@ */ @Override public void correct(@NotNull final Component parentComponent) { - // TODO: Query whether the user wants to delete the arch, delete the spawn / mob or cancel. + // TODO: Query whether the user wants to delete the game object, delete the spawn / mob or cancel. } } // class BlockedSquareError Modified: trunk/model/src/test/net/sf/gridarta/model/archetype/TestArchetypeSet.java =================================================================== --- trunk/model/src/test/net/sf/gridarta/model/archetype/TestArchetypeSet.java 2010-10-10 10:52:56 UTC (rev 8706) +++ trunk/model/src/test/net/sf/gridarta/model/archetype/TestArchetypeSet.java 2010-10-10 12:08:14 UTC (rev 8707) @@ -48,7 +48,7 @@ * {@inheritDoc} */ @Override - protected int collectArch(@NotNull final TestArchetype arch, @NotNull final Writer out, @NotNull final GameObjectParser<TestGameObject, TestMapArchObject, TestArchetype> gameObjectParser) throws IOException { + protected int collectArchetype(@NotNull final TestArchetype archetype, @NotNull final Writer out, @NotNull final GameObjectParser<TestGameObject, TestMapArchObject, TestArchetype> gameObjectParser) throws IOException { throw new AssertionError(); } Modified: trunk/utils/src/app/net/sf/gridarta/utils/CommonConstants.java =================================================================== --- trunk/utils/src/app/net/sf/gridarta/utils/CommonConstants.java 2010-10-10 10:52:56 UTC (rev 8706) +++ trunk/utils/src/app/net/sf/gridarta/utils/CommonConstants.java 2010-10-10 12:08:14 UTC (rev 8707) @@ -44,7 +44,7 @@ /** * The height of rigid area between the two tab-panes on the pickmap- and - * arch-panel. + * archetype-panel. */ public static final int SPACE_PICKMAP_ARCHETYPE_TOP = 10; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2010-10-10 10:53:02
|
Revision: 8706 http://gridarta.svn.sourceforge.net/gridarta/?rev=8706&view=rev Author: akirschbaum Date: 2010-10-10 10:52:56 +0000 (Sun, 10 Oct 2010) Log Message: ----------- Add map-checker.py as a validator. Modified Paths: -------------- trunk/atrinik/ChangeLog trunk/atrinik/src/app/net/sf/gridarta/var/atrinik/messages.properties Modified: trunk/atrinik/ChangeLog =================================================================== --- trunk/atrinik/ChangeLog 2010-10-10 10:48:14 UTC (rev 8705) +++ trunk/atrinik/ChangeLog 2010-10-10 10:52:56 UTC (rev 8706) @@ -1,3 +1,7 @@ +2010-10-10 Andreas Kirschbaum + + * Add map-checker.py as a validator. + 2010-10-06 Andreas Kirschbaum * Define and configure validators from "valdator.*" entries in Modified: trunk/atrinik/src/app/net/sf/gridarta/var/atrinik/messages.properties =================================================================== --- trunk/atrinik/src/app/net/sf/gridarta/var/atrinik/messages.properties 2010-10-10 10:48:14 UTC (rev 8705) +++ trunk/atrinik/src/app/net/sf/gridarta/var/atrinik/messages.properties 2010-10-10 10:52:56 UTC (rev 8706) @@ -172,3 +172,4 @@ validator.11=net.sf.gridarta.model.validation.checks.UndefinedArchetypeChecker validator.12=net.sf.gridarta.model.validation.checks.UndefinedFaceChecker validator.13=net.sf.gridarta.model.validation.checks.UnsetSlayingChecker 20,21,51,55,64,122 +validator.14=net.sf.gridarta.model.validation.checks.MapCheckerScriptChecker map-checker.py -c --text-only -a ${ARCH} -r ${MAPS}/regions.reg -m ${MAP} This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2010-10-10 10:48:23
|
Revision: 8705 http://gridarta.svn.sourceforge.net/gridarta/?rev=8705&view=rev Author: akirschbaum Date: 2010-10-10 10:48:14 +0000 (Sun, 10 Oct 2010) Log Message: ----------- Implement MapCheckerScriptChecker validator. Modified Paths: -------------- trunk/atrinik/src/app/net/sf/gridarta/var/atrinik/maincontrol/DefaultEditorFactory.java trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/maincontrol/DefaultEditorFactory.java trunk/daimonin/src/app/net/sf/gridarta/var/daimonin/maincontrol/DefaultEditorFactory.java trunk/model/src/app/net/sf/gridarta/model/validation/checks/ValidatorFactory.java trunk/model/src/test/net/sf/gridarta/model/settings/TestGlobalSettings.java trunk/model/src/test/net/sf/gridarta/validation/ValidationUtils.java trunk/model/src/test/net/sf/gridarta/validation/checks/ValidatorFactoryTest.java trunk/src/app/net/sf/gridarta/maincontrol/DefaultMainControl.java trunk/src/app/net/sf/gridarta/maincontrol/EditorFactory.java trunk/src/app/net/sf/gridarta/maincontrol/GridartaEditor.java trunk/src/app/net/sf/gridarta/messages.properties trunk/src/doc/ref/validators.xhtml Added Paths: ----------- trunk/model/src/app/net/sf/gridarta/model/validation/checks/MapCheckerScriptChecker.java trunk/model/src/app/net/sf/gridarta/model/validation/checks/MapCheckerScriptFailureError.java trunk/model/src/app/net/sf/gridarta/model/validation/checks/MapCheckerScriptIOError.java trunk/model/src/app/net/sf/gridarta/model/validation/checks/MapCheckerScriptMapError.java trunk/model/src/app/net/sf/gridarta/model/validation/checks/MapCheckerScriptMapSquareError.java trunk/model/src/app/net/sf/gridarta/model/validation/checks/MapCheckerScriptMissingError.java trunk/utils/src/app/net/sf/gridarta/utils/CopyReader.java Modified: trunk/atrinik/src/app/net/sf/gridarta/var/atrinik/maincontrol/DefaultEditorFactory.java =================================================================== --- trunk/atrinik/src/app/net/sf/gridarta/var/atrinik/maincontrol/DefaultEditorFactory.java 2010-10-10 10:35:35 UTC (rev 8704) +++ trunk/atrinik/src/app/net/sf/gridarta/var/atrinik/maincontrol/DefaultEditorFactory.java 2010-10-10 10:48:14 UTC (rev 8705) @@ -178,8 +178,8 @@ */ @NotNull @Override - public DefaultMainControl<GameObject, MapArchObject, Archetype> newMainControl(final boolean forceReadFromFiles, @NotNull final ErrorView errorView, @NotNull final GlobalSettings globalSettings, @NotNull final ConfigSourceFactory configSourceFactory, @NotNull final PathManager pathManager, @NotNull final GameObjectMatchers gameObjectMatchers, @NotNull final GameObjectFactory<GameObject, MapArchObject, Archetype> gameObjectFactory, @NotNull final ArchetypeTypeSet archetypeTypeSet, @NotNull final net.sf.gridarta.model.archetype.ArchetypeSet<GameObject, MapArchObject, Archetype> archetypeSet, @NotNull final ArchetypeChooserModel<GameObject, MapArchObject, Archetype> archetypeChooserModel, @NotNull final AutojoinLists<GameObject, MapArchObject, Archetype> autojoinLists, @NotNull final AbstractMapManager<GameObject, MapArchObject, Archetype> mapManager, @NotNull final ScriptModel<GameObject, MapArchObject, Archetype> scriptModel, @NotNull final DelegatingMapValidator<GameObject, MapArchObject, Archetype> validators, @NotNull final ScriptedEventEditor<GameObject, MapArchObject, Archetype> scriptedEventEditor, @NotNull final AbstractResources<GameObject, MapArchObject, Archetype> resources, @NotNull final Spells<NumberSpell> numberSpells, @NotNull final Spells<GameObjectSpell<GameObject, MapArchObject, Archetype>> gameObjectSpells, @NotNull final PluginParameterFactory<GameObject, MapArchObject, Archetype> pluginParameterFactory, @NotNull final ValidatorPreferences validatorPreferences) { - return new DefaultMainControl<GameObject, MapArchObject, Archetype>(GuiFileFilters.pythonFileFilter, ".py", "Python", 0, IGUIConstants.SPELL_FILE, IGUIConstants.SCRIPTS_DIR, errorView, this, forceReadFromFiles, globalSettings, configSourceFactory, pathManager, gameObjectMatchers, gameObjectFactory, archetypeTypeSet, archetypeSet, archetypeChooserModel, autojoinLists, mapManager, scriptModel, validators, scriptedEventEditor, resources, numberSpells, gameObjectSpells, pluginParameterFactory, validatorPreferences); + public DefaultMainControl<GameObject, MapArchObject, Archetype> newMainControl(final boolean forceReadFromFiles, @NotNull final ErrorView errorView, @NotNull final GlobalSettings globalSettings, @NotNull final ConfigSourceFactory configSourceFactory, @NotNull final PathManager pathManager, @NotNull final GameObjectMatchers gameObjectMatchers, @NotNull final GameObjectFactory<GameObject, MapArchObject, Archetype> gameObjectFactory, @NotNull final ArchetypeTypeSet archetypeTypeSet, @NotNull final net.sf.gridarta.model.archetype.ArchetypeSet<GameObject, MapArchObject, Archetype> archetypeSet, @NotNull final ArchetypeChooserModel<GameObject, MapArchObject, Archetype> archetypeChooserModel, @NotNull final AutojoinLists<GameObject, MapArchObject, Archetype> autojoinLists, @NotNull final AbstractMapManager<GameObject, MapArchObject, Archetype> mapManager, @NotNull final ScriptModel<GameObject, MapArchObject, Archetype> scriptModel, @NotNull final DelegatingMapValidator<GameObject, MapArchObject, Archetype> validators, @NotNull final ScriptedEventEditor<GameObject, MapArchObject, Archetype> scriptedEventEditor, @NotNull final AbstractResources<GameObject, MapArchObject, Archetype> resources, @NotNull final Spells<NumberSpell> numberSpells, @NotNull final Spells<GameObjectSpell<GameObject, MapArchObject, Archetype>> gameObjectSpells, @NotNull final PluginParameterFactory<GameObject, MapArchObject, Archetype> pluginParameterFactory, @NotNull final ValidatorPreferences validatorPreferences, @NotNull final MapWriter<GameObject, MapArchObject, Archetype> mapWriter) { + return new DefaultMainControl<GameObject, MapArchObject, Archetype>(GuiFileFilters.pythonFileFilter, ".py", "Python", 0, IGUIConstants.SPELL_FILE, IGUIConstants.SCRIPTS_DIR, errorView, this, forceReadFromFiles, globalSettings, configSourceFactory, pathManager, gameObjectMatchers, gameObjectFactory, archetypeTypeSet, archetypeSet, archetypeChooserModel, autojoinLists, mapManager, scriptModel, validators, scriptedEventEditor, resources, numberSpells, gameObjectSpells, pluginParameterFactory, validatorPreferences, mapWriter); } /** Modified: trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/maincontrol/DefaultEditorFactory.java =================================================================== --- trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/maincontrol/DefaultEditorFactory.java 2010-10-10 10:35:35 UTC (rev 8704) +++ trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/maincontrol/DefaultEditorFactory.java 2010-10-10 10:48:14 UTC (rev 8705) @@ -149,8 +149,8 @@ */ @NotNull @Override - public DefaultMainControl<GameObject, MapArchObject, Archetype> newMainControl(final boolean forceReadFromFiles, @NotNull final ErrorView errorView, @NotNull final GlobalSettings globalSettings, @NotNull final ConfigSourceFactory configSourceFactory, @NotNull final PathManager pathManager, @NotNull final GameObjectMatchers gameObjectMatchers, @NotNull final GameObjectFactory<GameObject, MapArchObject, Archetype> gameObjectFactory, @NotNull final ArchetypeTypeSet archetypeTypeSet, @NotNull final net.sf.gridarta.model.archetype.ArchetypeSet<GameObject, MapArchObject, Archetype> archetypeSet, @NotNull final ArchetypeChooserModel<GameObject, MapArchObject, Archetype> archetypeChooserModel, @NotNull final AutojoinLists<GameObject, MapArchObject, Archetype> autojoinLists, @NotNull final AbstractMapManager<GameObject, MapArchObject, Archetype> mapManager, @NotNull final ScriptModel<GameObject, MapArchObject, Archetype> scriptModel, @NotNull final DelegatingMapValidator<GameObject, MapArchObject, Archetype> validators, @NotNull final ScriptedEventEditor<GameObject, MapArchObject, Archetype> scriptedEventEditor, @NotNull final AbstractResources<GameObject, MapArchObject, Archetype> resources, @NotNull final Spells<NumberSpell> numberSpells, @NotNull final Spells<GameObjectSpell<GameObject, MapArchObject, Archetype>> gameObjectSpells, @NotNull final PluginParameterFactory<GameObject, MapArchObject, Archetype> pluginParameterFactory, @NotNull final ValidatorPreferences validatorPreferences) { - return new DefaultMainControl<GameObject, MapArchObject, Archetype>(GuiFileFilters.pythonFileFilter, ".py", "Python", Archetype.TYPE_SPELL, null, IGUIConstants.SCRIPTS_DIR, errorView, this, false, globalSettings, configSourceFactory, pathManager, gameObjectMatchers, gameObjectFactory, archetypeTypeSet, archetypeSet, archetypeChooserModel, autojoinLists, mapManager, scriptModel, validators, scriptedEventEditor, resources, numberSpells, gameObjectSpells, pluginParameterFactory, validatorPreferences); + public DefaultMainControl<GameObject, MapArchObject, Archetype> newMainControl(final boolean forceReadFromFiles, @NotNull final ErrorView errorView, @NotNull final GlobalSettings globalSettings, @NotNull final ConfigSourceFactory configSourceFactory, @NotNull final PathManager pathManager, @NotNull final GameObjectMatchers gameObjectMatchers, @NotNull final GameObjectFactory<GameObject, MapArchObject, Archetype> gameObjectFactory, @NotNull final ArchetypeTypeSet archetypeTypeSet, @NotNull final net.sf.gridarta.model.archetype.ArchetypeSet<GameObject, MapArchObject, Archetype> archetypeSet, @NotNull final ArchetypeChooserModel<GameObject, MapArchObject, Archetype> archetypeChooserModel, @NotNull final AutojoinLists<GameObject, MapArchObject, Archetype> autojoinLists, @NotNull final AbstractMapManager<GameObject, MapArchObject, Archetype> mapManager, @NotNull final ScriptModel<GameObject, MapArchObject, Archetype> scriptModel, @NotNull final DelegatingMapValidator<GameObject, MapArchObject, Archetype> validators, @NotNull final ScriptedEventEditor<GameObject, MapArchObject, Archetype> scriptedEventEditor, @NotNull final AbstractResources<GameObject, MapArchObject, Archetype> resources, @NotNull final Spells<NumberSpell> numberSpells, @NotNull final Spells<GameObjectSpell<GameObject, MapArchObject, Archetype>> gameObjectSpells, @NotNull final PluginParameterFactory<GameObject, MapArchObject, Archetype> pluginParameterFactory, @NotNull final ValidatorPreferences validatorPreferences, @NotNull final MapWriter<GameObject, MapArchObject, Archetype> mapWriter) { + return new DefaultMainControl<GameObject, MapArchObject, Archetype>(GuiFileFilters.pythonFileFilter, ".py", "Python", Archetype.TYPE_SPELL, null, IGUIConstants.SCRIPTS_DIR, errorView, this, false, globalSettings, configSourceFactory, pathManager, gameObjectMatchers, gameObjectFactory, archetypeTypeSet, archetypeSet, archetypeChooserModel, autojoinLists, mapManager, scriptModel, validators, scriptedEventEditor, resources, numberSpells, gameObjectSpells, pluginParameterFactory, validatorPreferences, mapWriter); } /** Modified: trunk/daimonin/src/app/net/sf/gridarta/var/daimonin/maincontrol/DefaultEditorFactory.java =================================================================== --- trunk/daimonin/src/app/net/sf/gridarta/var/daimonin/maincontrol/DefaultEditorFactory.java 2010-10-10 10:35:35 UTC (rev 8704) +++ trunk/daimonin/src/app/net/sf/gridarta/var/daimonin/maincontrol/DefaultEditorFactory.java 2010-10-10 10:48:14 UTC (rev 8705) @@ -178,8 +178,8 @@ */ @NotNull @Override - public DefaultMainControl<GameObject, MapArchObject, Archetype> newMainControl(final boolean forceReadFromFiles, @NotNull final ErrorView errorView, @NotNull final GlobalSettings globalSettings, @NotNull final ConfigSourceFactory configSourceFactory, @NotNull final PathManager pathManager, @NotNull final GameObjectMatchers gameObjectMatchers, @NotNull final GameObjectFactory<GameObject, MapArchObject, Archetype> gameObjectFactory, @NotNull final ArchetypeTypeSet archetypeTypeSet, @NotNull final net.sf.gridarta.model.archetype.ArchetypeSet<GameObject, MapArchObject, Archetype> archetypeSet, @NotNull final ArchetypeChooserModel<GameObject, MapArchObject, Archetype> archetypeChooserModel, @NotNull final AutojoinLists<GameObject, MapArchObject, Archetype> autojoinLists, @NotNull final AbstractMapManager<GameObject, MapArchObject, Archetype> mapManager, @NotNull final ScriptModel<GameObject, MapArchObject, Archetype> scriptModel, @NotNull final DelegatingMapValidator<GameObject, MapArchObject, Archetype> validators, @NotNull final ScriptedEventEditor<GameObject, MapArchObject, Archetype> scriptedEventEditor, @NotNull final AbstractResources<GameObject, MapArchObject, Archetype> resources, @NotNull final Spells<NumberSpell> numberSpells, @NotNull final Spells<GameObjectSpell<GameObject, MapArchObject, Archetype>> gameObjectSpells, @NotNull final PluginParameterFactory<GameObject, MapArchObject, Archetype> pluginParameterFactory, @NotNull final ValidatorPreferences validatorPreferences) { - return new DefaultMainControl<GameObject, MapArchObject, Archetype>(GuiFileFilters.luaFileFilter, ".lua", "Lua", 0, IGUIConstants.SPELL_FILE, IGUIConstants.SCRIPTS_DIR, errorView, this, forceReadFromFiles, globalSettings, configSourceFactory, pathManager, gameObjectMatchers, gameObjectFactory, archetypeTypeSet, archetypeSet, archetypeChooserModel, autojoinLists, mapManager, scriptModel, validators, scriptedEventEditor, resources, numberSpells, gameObjectSpells, pluginParameterFactory, validatorPreferences); + public DefaultMainControl<GameObject, MapArchObject, Archetype> newMainControl(final boolean forceReadFromFiles, @NotNull final ErrorView errorView, @NotNull final GlobalSettings globalSettings, @NotNull final ConfigSourceFactory configSourceFactory, @NotNull final PathManager pathManager, @NotNull final GameObjectMatchers gameObjectMatchers, @NotNull final GameObjectFactory<GameObject, MapArchObject, Archetype> gameObjectFactory, @NotNull final ArchetypeTypeSet archetypeTypeSet, @NotNull final net.sf.gridarta.model.archetype.ArchetypeSet<GameObject, MapArchObject, Archetype> archetypeSet, @NotNull final ArchetypeChooserModel<GameObject, MapArchObject, Archetype> archetypeChooserModel, @NotNull final AutojoinLists<GameObject, MapArchObject, Archetype> autojoinLists, @NotNull final AbstractMapManager<GameObject, MapArchObject, Archetype> mapManager, @NotNull final ScriptModel<GameObject, MapArchObject, Archetype> scriptModel, @NotNull final DelegatingMapValidator<GameObject, MapArchObject, Archetype> validators, @NotNull final ScriptedEventEditor<GameObject, MapArchObject, Archetype> scriptedEventEditor, @NotNull final AbstractResources<GameObject, MapArchObject, Archetype> resources, @NotNull final Spells<NumberSpell> numberSpells, @NotNull final Spells<GameObjectSpell<GameObject, MapArchObject, Archetype>> gameObjectSpells, @NotNull final PluginParameterFactory<GameObject, MapArchObject, Archetype> pluginParameterFactory, @NotNull final ValidatorPreferences validatorPreferences, @NotNull final MapWriter<GameObject, MapArchObject, Archetype> mapWriter) { + return new DefaultMainControl<GameObject, MapArchObject, Archetype>(GuiFileFilters.luaFileFilter, ".lua", "Lua", 0, IGUIConstants.SPELL_FILE, IGUIConstants.SCRIPTS_DIR, errorView, this, forceReadFromFiles, globalSettings, configSourceFactory, pathManager, gameObjectMatchers, gameObjectFactory, archetypeTypeSet, archetypeSet, archetypeChooserModel, autojoinLists, mapManager, scriptModel, validators, scriptedEventEditor, resources, numberSpells, gameObjectSpells, pluginParameterFactory, validatorPreferences, mapWriter); } /** Added: trunk/model/src/app/net/sf/gridarta/model/validation/checks/MapCheckerScriptChecker.java =================================================================== --- trunk/model/src/app/net/sf/gridarta/model/validation/checks/MapCheckerScriptChecker.java (rev 0) +++ trunk/model/src/app/net/sf/gridarta/model/validation/checks/MapCheckerScriptChecker.java 2010-10-10 10:48:14 UTC (rev 8705) @@ -0,0 +1,390 @@ +/* + * Gridarta MMORPG map editor for Crossfire, Daimonin and similar games. + * Copyright (C) 2000-2010 The Gridarta Developers. + * + * This program 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 2 of the License, or + * (at your option) any later version. + * + * This program is 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 General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +package net.sf.gridarta.model.validation.checks; + +import java.awt.Point; +import java.io.File; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.InputStreamReader; +import java.io.OutputStream; +import java.io.OutputStreamWriter; +import java.io.Writer; +import java.util.concurrent.Semaphore; +import java.util.concurrent.TimeUnit; +import java.util.regex.Matcher; +import java.util.regex.Pattern; +import net.sf.gridarta.model.archetype.Archetype; +import net.sf.gridarta.model.gameobject.GameObject; +import net.sf.gridarta.model.io.MapWriter; +import net.sf.gridarta.model.maparchobject.MapArchObject; +import net.sf.gridarta.model.mapmodel.MapModel; +import net.sf.gridarta.model.mapmodel.MapSquare; +import net.sf.gridarta.model.validation.AbstractValidator; +import net.sf.gridarta.model.validation.ErrorCollector; +import net.sf.gridarta.model.validation.MapValidator; +import net.sf.gridarta.model.validation.ValidatorPreferences; +import net.sf.gridarta.utils.CopyReader; +import net.sf.gridarta.utils.IOUtils; +import net.sf.gridarta.utils.StringUtils; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; + +/** + * Executes a script to check a map. The script's output is parsed and converted + * into validation errors. + * @author Andreas Kirschbaum + */ +public class MapCheckerScriptChecker<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>> extends AbstractValidator implements MapValidator<G, A, R> { + + /** + * The maximum execution time of the checker script in milliseconds. If the + * script runs longer, it will be terminated. + */ + private static final int MAX_EXEC_TIME = 1000; + + /** + * The placeholder in the command's arguments for the map to check. + */ + @NotNull + public static final String MAP_PLACEHOLDER = "${MAP}"; + + /** + * The quoted. placeholder in the command's arguments for the map to check. + */ + @NotNull + private static final String QUOTED_MAP_PLACEHOLDER = Pattern.quote(MAP_PLACEHOLDER); + + /** + * The {@link Pattern} for matching per map square messages. + */ + @NotNull + private static final Pattern PATTERN_MAP_SQUARE_MESSAGE = Pattern.compile("(\\d+)\\s+(\\d+)\\s+(.*)"); + + /** + * The {@link MapWriter} for saving temporary map files. + */ + @NotNull + private final MapWriter<G, A, R> mapWriter; + + /** + * The command to execute and the arguments to pass. + */ + @NotNull + private final String[] args; + + /** + * The command to execute. Set to <code>null</code> if unknown. Otherwise + * points to <code>{@link #args}[0]</code>. + */ + @Nullable + private File cachedCommand = null; + + /** + * The temp file for saving maps to be checked. Set to <code>null</code> + * until created. + */ + @Nullable + private File tmpFile = null; + + /** + * Creates a new instance. + * @param validatorPreferences the validator preferences to use + * @param mapWriter the map writer for saving temporary map files + * @param args the command to execute and the arguments to pass + */ + public MapCheckerScriptChecker(@NotNull final ValidatorPreferences validatorPreferences, @NotNull final MapWriter<G, A, R> mapWriter, @NotNull final String[] args) { + super(validatorPreferences); + this.mapWriter = mapWriter; + this.args = args.clone(); + + if (this.args.length < 1) { + throw new IllegalArgumentException("no script to execute"); + } + + boolean found = false; + for (int i = 1; i < this.args.length; i++) { + if (this.args[i].contains(MAP_PLACEHOLDER)) { + found = true; + break; + } + } + if (!found) { + throw new IllegalArgumentException("the script to execute doesn't receive the map to check (" + MAP_PLACEHOLDER + ")"); + } + } + + /** + * {@inheritDoc} + */ + @Override + public void validateMap(@NotNull final MapModel<G, A, R> mapModel, @NotNull final ErrorCollector<G, A, R> errorCollector) { + final String[] command = getCommand(mapModel, errorCollector); + if (command == null) { + return; + } + final Process process; + try { + process = Runtime.getRuntime().exec(command); + } catch (final IOException ex) { + errorCollector.collect(new MapCheckerScriptMissingError<G, A, R>(mapModel, command[0], ex.getMessage())); + return; + } + @Nullable final String output; + try { + try { + process.getOutputStream().close(); + } catch (final IOException ex) { + errorCollector.collect(new MapCheckerScriptFailureError<G, A, R>(mapModel, command[0], ex.getMessage() + " (closing stdin)")); + return; + } + + output = runProcess(process, errorCollector, mapModel, command[0]); + } finally { + process.destroy(); + } + if (output != null) { + parseOutput(output, errorCollector, mapModel, command[0]); + } + } + + /** + * Parses output of the executed script. Adds validation error to an {@link + * ErrorCollector}. + * @param output the output to parse + * @param errorCollector the error collector to add to + * @param mapModel the map model being checked + * @param command the command being run + */ + private void parseOutput(@NotNull final CharSequence output, @NotNull final ErrorCollector<G, A, R> errorCollector, @NotNull final MapModel<G, A, R> mapModel, @NotNull final String command) { + final String[] lines = StringUtils.PATTERN_END_OF_LINE.split(output); + for (final String line : lines) { + if (!line.isEmpty()) { + final Matcher matcher = PATTERN_MAP_SQUARE_MESSAGE.matcher(line); + if (matcher.matches()) { + final int x; + final int y; + try { + x = Integer.parseInt(matcher.group(1)); + y = Integer.parseInt(matcher.group(2)); + } catch (final NumberFormatException ignored) { + errorCollector.collect(new MapCheckerScriptFailureError<G, A, R>(mapModel, command, "syntax error in '" + line + "'")); + continue; + } + final String message = matcher.group(3); + final MapSquare<G, A, R> mapSquare; + //noinspection ProhibitedExceptionCaught + try { + mapSquare = mapModel.getMapSquare(new Point(x, y)); + } catch (final ArrayIndexOutOfBoundsException ignored) { + errorCollector.collect(new MapCheckerScriptFailureError<G, A, R>(mapModel, command, "invalid map square in '" + line + "'")); + continue; + } + errorCollector.collect(new MapCheckerScriptMapSquareError<G, A, R>(mapSquare, message)); + } else { + errorCollector.collect(new MapCheckerScriptMapError<G, A, R>(mapModel, line)); + } + } + } + } + + /** + * Waits for a {@link Process} to terminate and returns its output. + * @param process the process + * @param errorCollector the error collector to add problems to + * @param mapModel the map model that is being checked + * @param command the command that is being run + * @return the command's output + */ + @Nullable + private String runProcess(@NotNull final Process process, @NotNull final ErrorCollector<G, A, R> errorCollector, @NotNull final MapModel<G, A, R> mapModel, @NotNull final String command) { + @Nullable String output; + final InputStreamReader stdoutReader = new InputStreamReader(process.getInputStream()); + try { + final CopyReader stdout = new CopyReader(stdoutReader); + final InputStreamReader stderrReader = new InputStreamReader(process.getErrorStream()); + try { + final CopyReader stderr = new CopyReader(stderrReader); + stdout.start(); + try { + stderr.start(); + try { + if (!waitForTermination(process, errorCollector, mapModel, command, stdout, stderr)) { + return null; + } + } finally { + stderr.stop(); + } + } finally { + stdout.stop(); + } + } finally { + try { + stderrReader.close(); + } catch (final IOException ex) { + errorCollector.collect(new MapCheckerScriptFailureError<G, A, R>(mapModel, command, ex.getMessage() + " (closing stderr)")); + } + } + final String stdoutFailure = stdout.getFailure(); + if (stdoutFailure != null) { + errorCollector.collect(new MapCheckerScriptFailureError<G, A, R>(mapModel, command, stdoutFailure)); + return null; + } + output = stdout.getOutput(); + } finally { + try { + stdoutReader.close(); + } catch (final IOException ex) { + errorCollector.collect(new MapCheckerScriptFailureError<G, A, R>(mapModel, command, ex.getMessage() + " (closing stdout)")); + } + } + return output; + } + + /** + * Waits for a {@link Process} to terminate. + * @param process the process + * @param errorCollector the error collector to add problems to + * @param mapModel the map model being checked + * @param command the command being executed + * @param stdout the stdout stream of the process + * @param stderr the stderr stream of the process + * @return whether the process did exit successfully + */ + private boolean waitForTermination(@NotNull final Process process, @NotNull final ErrorCollector<G, A, R> errorCollector, @NotNull final MapModel<G, A, R> mapModel, @NotNull final String command, @NotNull final CopyReader stdout, @NotNull final CopyReader stderr) { + final Semaphore sem = new Semaphore(0); + final int[] tmp = new int[] { -1, }; + final Runnable runnable = new Runnable() { + + @Override + public void run() { + try { + try { + stdout.join(); + stderr.join(); + tmp[0] = process.waitFor(); + } catch (final InterruptedException ignored) { + Thread.currentThread().interrupt(); + } + } finally { + sem.release(); + } + } + + }; + final Thread thread = new Thread(runnable); + thread.start(); + try { + if (!sem.tryAcquire(MAX_EXEC_TIME, TimeUnit.MILLISECONDS)) { + errorCollector.collect(new MapCheckerScriptFailureError<G, A, R>(mapModel, command, "timeout waiting for script to terminate")); + return false; + } + } catch (final InterruptedException ignored) { + errorCollector.collect(new MapCheckerScriptFailureError<G, A, R>(mapModel, command, "interrupted waiting for script to terminate")); + return false; + } + thread.interrupt(); + if (tmp[0] != 0) { + errorCollector.collect(new MapCheckerScriptFailureError<G, A, R>(mapModel, command, "command exited with status " + tmp[0])); + return false; + } + final String stderrFailure = stderr.getFailure(); + if (stderrFailure != null) { + errorCollector.collect(new MapCheckerScriptFailureError<G, A, R>(mapModel, command, stderrFailure)); + return false; + } + final String stderrOutput = stderr.getOutput(); + if (!stderrOutput.isEmpty()) { + errorCollector.collect(new MapCheckerScriptFailureError<G, A, R>(mapModel, command, stderrOutput.replaceAll("\n", "<br>"))); + return false; + } + return true; + } + + /** + * Returns the command to execute. Returns {@link #args} but replaces {@link + * #MAP_PLACEHOLDER} with the map to check. + * @param mapModel the map to check + * @param errorCollector the error collector for reporting problems + * @return the command to execute or <code>null</code> if an error occurred + */ + @Nullable + private String[] getCommand(@NotNull final MapModel<G, A, R> mapModel, @NotNull final ErrorCollector<G, A, R> errorCollector) { + if (tmpFile == null) { + try { + tmpFile = File.createTempFile("gridarta", null); + } catch (final IOException ex) { + errorCollector.collect(new MapCheckerScriptIOError<G, A, R>(mapModel, "create temporary file", ex.getMessage())); + return null; + } + assert tmpFile != null; + tmpFile.deleteOnExit(); + } + assert tmpFile != null; + final String mapPath = tmpFile.getPath(); + try { + final OutputStream outputStream = new FileOutputStream(tmpFile); + try { + final Writer writer = new OutputStreamWriter(outputStream, IOUtils.MAP_ENCODING); + try { + mapWriter.encodeMapFile(mapModel, writer); + } finally { + writer.close(); + } + } finally { + outputStream.close(); + } + } catch (final IOException ex) { + errorCollector.collect(new MapCheckerScriptIOError<G, A, R>(mapModel, mapPath, ex.getMessage())); + return null; + } + + final String[] result = new String[args.length]; + try { + result[0] = getCommand(); + } catch (final IOException ex) { + errorCollector.collect(new MapCheckerScriptMissingError<G, A, R>(mapModel, args[0], ex.getMessage())); + return null; + } + for (int i = 1; i < result.length; i++) { + result[i] = args[i].replaceAll(QUOTED_MAP_PLACEHOLDER, mapPath); + } + return result; + } + + /** + * Returns the command to execute. Returns or updates {@link + * #cachedCommand}. + * @return the command to execute + * @throws IOException if the command cannot be found + */ + @NotNull + private String getCommand() throws IOException { + final File existingCommand = cachedCommand; + if (existingCommand != null && existingCommand.exists()) { + return existingCommand.getPath(); + } + + final File command = IOUtils.findPathFile(args[0]); + cachedCommand = command; + return command.getPath(); + } + +} // class MapCheckerScriptChecker Property changes on: trunk/model/src/app/net/sf/gridarta/model/validation/checks/MapCheckerScriptChecker.java ___________________________________________________________________ Added: svn:mime-type + text/plain Added: svn:eol-style + LF Added: trunk/model/src/app/net/sf/gridarta/model/validation/checks/MapCheckerScriptFailureError.java =================================================================== --- trunk/model/src/app/net/sf/gridarta/model/validation/checks/MapCheckerScriptFailureError.java (rev 0) +++ trunk/model/src/app/net/sf/gridarta/model/validation/checks/MapCheckerScriptFailureError.java 2010-10-10 10:48:14 UTC (rev 8705) @@ -0,0 +1,84 @@ +/* + * Gridarta MMORPG map editor for Crossfire, Daimonin and similar games. + * Copyright (C) 2000-2010 The Gridarta Developers. + * + * This program 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 2 of the License, or + * (at your option) any later version. + * + * This program is 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 General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +package net.sf.gridarta.model.validation.checks; + +import net.sf.gridarta.model.archetype.Archetype; +import net.sf.gridarta.model.gameobject.GameObject; +import net.sf.gridarta.model.maparchobject.MapArchObject; +import net.sf.gridarta.model.mapmodel.MapModel; +import net.sf.gridarta.model.validation.errors.MapValidationError; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; + +/** + * A {@link MapValidationError} that indicates that the map validator script + * could not be executed. + * @author Andreas Kirschbaum + */ +public class MapCheckerScriptFailureError<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>> extends MapValidationError<G, A, R> { + + /** + * The serial version UID. + */ + private static final long serialVersionUID = 1L; + + /** + * The command that failed to execute. + */ + @NotNull + private final String command; + + /** + * The failure reason. + */ + @NotNull + private final String reason; + + /** + * Create a MapValidationError. + * @param mapModel the map on which the error occurred + * @param command the command that failed to execute + * @param reason the failure reason + */ + protected MapCheckerScriptFailureError(@NotNull final MapModel<G, A, R> mapModel, @NotNull final String command, @NotNull final String reason) { + super(mapModel); + this.command = command; + this.reason = reason; + } + + /** + * {@inheritDoc} + */ + @Nullable + @Override + public String getParameter(final int id) { + switch (id) { + case 0: + return command; + + case 1: + return reason; + + default: + return super.getParameter(id); + } + } + +} // class MapCheckerScriptMissingError Property changes on: trunk/model/src/app/net/sf/gridarta/model/validation/checks/MapCheckerScriptFailureError.java ___________________________________________________________________ Added: svn:mime-type + text/plain Added: svn:eol-style + LF Added: trunk/model/src/app/net/sf/gridarta/model/validation/checks/MapCheckerScriptIOError.java =================================================================== --- trunk/model/src/app/net/sf/gridarta/model/validation/checks/MapCheckerScriptIOError.java (rev 0) +++ trunk/model/src/app/net/sf/gridarta/model/validation/checks/MapCheckerScriptIOError.java 2010-10-10 10:48:14 UTC (rev 8705) @@ -0,0 +1,84 @@ +/* + * Gridarta MMORPG map editor for Crossfire, Daimonin and similar games. + * Copyright (C) 2000-2010 The Gridarta Developers. + * + * This program 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 2 of the License, or + * (at your option) any later version. + * + * This program is 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 General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +package net.sf.gridarta.model.validation.checks; + +import net.sf.gridarta.model.archetype.Archetype; +import net.sf.gridarta.model.gameobject.GameObject; +import net.sf.gridarta.model.maparchobject.MapArchObject; +import net.sf.gridarta.model.mapmodel.MapModel; +import net.sf.gridarta.model.validation.errors.ValidationError; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; + +/** + * A {@link ValidationError} that reports I/O errors related to {@link + * MapCheckerScriptChecker}. + * @author Andreas Kirschbaum + */ +public class MapCheckerScriptIOError<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>> extends ValidationError<G, A, R> { + + /** + * The serial version UID. + */ + private static final long serialVersionUID = 1L; + + /** + * The file name related to the error message. + */ + @NotNull + private final String file; + + /** + * The error message. + */ + @NotNull + private final String message; + + /** + * Creates a new instance. + * @param mapModel the map model + * @param file the file name related to the error message + * @param message the error message + */ + public MapCheckerScriptIOError(@NotNull final MapModel<G, A, R> mapModel, @NotNull final String file, @NotNull final String message) { + super(mapModel); + this.file = file; + this.message = message; + } + + /** + * {@inheritDoc} + */ + @Nullable + @Override + public String getParameter(final int id) { + switch (id) { + case 0: + return file; + + case 1: + return message; + + default: + return super.getParameter(id); + } + } + +} Property changes on: trunk/model/src/app/net/sf/gridarta/model/validation/checks/MapCheckerScriptIOError.java ___________________________________________________________________ Added: svn:mime-type + text/plain Added: svn:eol-style + LF Added: trunk/model/src/app/net/sf/gridarta/model/validation/checks/MapCheckerScriptMapError.java =================================================================== --- trunk/model/src/app/net/sf/gridarta/model/validation/checks/MapCheckerScriptMapError.java (rev 0) +++ trunk/model/src/app/net/sf/gridarta/model/validation/checks/MapCheckerScriptMapError.java 2010-10-10 10:48:14 UTC (rev 8705) @@ -0,0 +1,73 @@ +/* + * Gridarta MMORPG map editor for Crossfire, Daimonin and similar games. + * Copyright (C) 2000-2010 The Gridarta Developers. + * + * This program 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 2 of the License, or + * (at your option) any later version. + * + * This program is 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 General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +package net.sf.gridarta.model.validation.checks; + +import net.sf.gridarta.model.archetype.Archetype; +import net.sf.gridarta.model.gameobject.GameObject; +import net.sf.gridarta.model.maparchobject.MapArchObject; +import net.sf.gridarta.model.mapmodel.MapModel; +import net.sf.gridarta.model.validation.errors.MapValidationError; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; + +/** + * A {@link MapValidationError} that represents a per map error of the {@link + * MapCheckerScriptChecker}. + * @author Andreas Kirschbaum + */ +public class MapCheckerScriptMapError<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>> extends MapValidationError<G, A, R> { + + /** + * The serial version UID. + */ + private static final long serialVersionUID = 1L; + + /** + * The error message. + */ + @NotNull + private final String message; + + /** + * Creates a new instance. + * @param mapModel the map model + * @param message the error message + */ + public MapCheckerScriptMapError(@NotNull final MapModel<G, A, R> mapModel, @NotNull final String message) { + super(mapModel); + this.message = message; + } + + /** + * {@inheritDoc} + */ + @Nullable + @Override + public String getParameter(final int id) { + switch (id) { + case 0: + return message; + + default: + return super.getParameter(id); + } + } + +} Property changes on: trunk/model/src/app/net/sf/gridarta/model/validation/checks/MapCheckerScriptMapError.java ___________________________________________________________________ Added: svn:mime-type + text/plain Added: svn:eol-style + LF Added: trunk/model/src/app/net/sf/gridarta/model/validation/checks/MapCheckerScriptMapSquareError.java =================================================================== --- trunk/model/src/app/net/sf/gridarta/model/validation/checks/MapCheckerScriptMapSquareError.java (rev 0) +++ trunk/model/src/app/net/sf/gridarta/model/validation/checks/MapCheckerScriptMapSquareError.java 2010-10-10 10:48:14 UTC (rev 8705) @@ -0,0 +1,73 @@ +/* + * Gridarta MMORPG map editor for Crossfire, Daimonin and similar games. + * Copyright (C) 2000-2010 The Gridarta Developers. + * + * This program 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 2 of the License, or + * (at your option) any later version. + * + * This program is 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 General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +package net.sf.gridarta.model.validation.checks; + +import net.sf.gridarta.model.archetype.Archetype; +import net.sf.gridarta.model.gameobject.GameObject; +import net.sf.gridarta.model.maparchobject.MapArchObject; +import net.sf.gridarta.model.mapmodel.MapSquare; +import net.sf.gridarta.model.validation.errors.SquareValidationError; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; + +/** + * A {@link SquareValidationError} that represents a per map square error of the + * {@link MapCheckerScriptChecker}. + * @author Andreas Kirschbaum + */ +public class MapCheckerScriptMapSquareError<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>> extends SquareValidationError<G, A, R> { + + /** + * The serial version UID. + */ + private static final long serialVersionUID = 1L; + + /** + * The error message. + */ + @NotNull + private final String message; + + /** + * Creates a new instance. + * @param mapSquare the map square + * @param message the error message + */ + public MapCheckerScriptMapSquareError(@NotNull final MapSquare<G, A, R> mapSquare, @NotNull final String message) { + super(mapSquare); + this.message = message; + } + + /** + * {@inheritDoc} + */ + @Nullable + @Override + public String getParameter(final int id) { + switch (id) { + case 0: + return message; + + default: + return super.getParameter(id); + } + } + +} Property changes on: trunk/model/src/app/net/sf/gridarta/model/validation/checks/MapCheckerScriptMapSquareError.java ___________________________________________________________________ Added: svn:mime-type + text/plain Added: svn:eol-style + LF Added: trunk/model/src/app/net/sf/gridarta/model/validation/checks/MapCheckerScriptMissingError.java =================================================================== --- trunk/model/src/app/net/sf/gridarta/model/validation/checks/MapCheckerScriptMissingError.java (rev 0) +++ trunk/model/src/app/net/sf/gridarta/model/validation/checks/MapCheckerScriptMissingError.java 2010-10-10 10:48:14 UTC (rev 8705) @@ -0,0 +1,84 @@ +/* + * Gridarta MMORPG map editor for Crossfire, Daimonin and similar games. + * Copyright (C) 2000-2010 The Gridarta Developers. + * + * This program 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 2 of the License, or + * (at your option) any later version. + * + * This program is 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 General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +package net.sf.gridarta.model.validation.checks; + +import net.sf.gridarta.model.archetype.Archetype; +import net.sf.gridarta.model.gameobject.GameObject; +import net.sf.gridarta.model.maparchobject.MapArchObject; +import net.sf.gridarta.model.mapmodel.MapModel; +import net.sf.gridarta.model.validation.errors.MapValidationError; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; + +/** + * A {@link MapValidationError} that indicates that the map checker script could + * not be found. + * @author Andreas Kirschbaum + */ +public class MapCheckerScriptMissingError<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>> extends MapValidationError<G, A, R> { + + /** + * The serial version UID. + */ + private static final long serialVersionUID = 1L; + + /** + * The command that could not be executed. + */ + @NotNull + private final String command; + + /** + * The failure reason. + */ + @NotNull + private final String reason; + + /** + * Create a MapValidationError. + * @param mapModel the map on which the error occurred + * @param command the command that could not be executed + * @param reason the failure reason + */ + protected MapCheckerScriptMissingError(@NotNull final MapModel<G, A, R> mapModel, @NotNull final String command, @NotNull final String reason) { + super(mapModel); + this.command = command; + this.reason = reason; + } + + /** + * {@inheritDoc} + */ + @Nullable + @Override + public String getParameter(final int id) { + switch (id) { + case 0: + return command; + + case 1: + return reason; + + default: + return super.getParameter(id); + } + } + +} // class MapCheckerScriptMissingError Property changes on: trunk/model/src/app/net/sf/gridarta/model/validation/checks/MapCheckerScriptMissingError.java ___________________________________________________________________ Added: svn:mime-type + text/plain Added: svn:eol-style + LF Modified: trunk/model/src/app/net/sf/gridarta/model/validation/checks/ValidatorFactory.java =================================================================== --- trunk/model/src/app/net/sf/gridarta/model/validation/checks/ValidatorFactory.java 2010-10-10 10:35:35 UTC (rev 8704) +++ trunk/model/src/app/net/sf/gridarta/model/validation/checks/ValidatorFactory.java 2010-10-10 10:48:14 UTC (rev 8705) @@ -23,13 +23,19 @@ import java.lang.reflect.InvocationTargetException; import java.util.regex.Pattern; import java.util.regex.PatternSyntaxException; +import net.sf.gridarta.model.archetype.Archetype; +import net.sf.gridarta.model.gameobject.GameObject; +import net.sf.gridarta.model.io.MapWriter; +import net.sf.gridarta.model.maparchobject.MapArchObject; import net.sf.gridarta.model.match.GameObjectMatcher; import net.sf.gridarta.model.match.GameObjectMatchers; import net.sf.gridarta.model.settings.GlobalSettings; import net.sf.gridarta.model.validation.NoSuchValidatorException; import net.sf.gridarta.model.validation.Validator; import net.sf.gridarta.model.validation.ValidatorPreferences; +import net.sf.gridarta.utils.StringParameterBuilder; import net.sf.gridarta.utils.StringUtils; +import net.sf.gridarta.utils.SyntaxErrorException; import org.jetbrains.annotations.NotNull; /** @@ -38,7 +44,7 @@ * must implement {@link Validator}) and optional constructor arguments. * @author Andreas Kirschbaum */ -public class ValidatorFactory { +public class ValidatorFactory<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>> { /** * The {@link ValidatorPreferences} to pass to the newly created {@link @@ -62,6 +68,13 @@ private final GlobalSettings globalSettings; /** + * The {@link MapWriter} to pass to the newly created {@link Validator} + * instances. + */ + @NotNull + private final MapWriter<G, A, R> mapWriter; + + /** * Creates a new instance. * @param validatorPreferences the validator preferences to pass to the * newly created validator instances @@ -69,11 +82,14 @@ * object matcher instances from string representation * @param globalSettings the global settings to pass to the newly created * validator instances + * @param mapWriter the map writer to pass to the newly created validator + * instances */ - public ValidatorFactory(@NotNull final ValidatorPreferences validatorPreferences, @NotNull final GameObjectMatchers gameObjectMatchers, @NotNull final GlobalSettings globalSettings) { + public ValidatorFactory(@NotNull final ValidatorPreferences validatorPreferences, @NotNull final GameObjectMatchers gameObjectMatchers, @NotNull final GlobalSettings globalSettings, @NotNull final MapWriter<G, A, R> mapWriter) { this.validatorPreferences = validatorPreferences; this.gameObjectMatchers = gameObjectMatchers; this.globalSettings = globalSettings; + this.mapWriter = mapWriter; } /** @@ -118,6 +134,8 @@ constructorArguments[i] = validatorPreferences; } else if (constructorParameterType == GlobalSettings.class) { constructorArguments[i] = globalSettings; + } else if (constructorParameterType == MapWriter.class) { + constructorArguments[i] = mapWriter; } else { if (pos >= args.length) { throw new NoSuchValidatorException("missing argument in '" + spec + "'"); @@ -129,6 +147,9 @@ constructorArguments[i] = createGameObjectMatcher(arg); } else if (constructorParameterType == int.class) { constructorArguments[i] = createInteger(arg); + } else if (constructorParameterType == String[].class) { + constructorArguments[i] = createStringArray(args, pos - 1); + pos = args.length; } else if (constructorParameterType == Pattern.class) { constructorArguments[i] = createPattern(arg); } else { @@ -231,6 +252,32 @@ } /** + * Creates an <code>Integer[]</code> instance from string representation. + * @param args the string representation + * @param pos the first element of <code>array</code> to use + * @return the integer array instance + * @throws NoSuchValidatorException if the string representation is + * incorrect + */ + @NotNull + private String[] createStringArray(@NotNull final String[] args, final int pos) throws NoSuchValidatorException { + final StringParameterBuilder stringParameterBuilder = new StringParameterBuilder(); + stringParameterBuilder.addParameter("COLLECTED", globalSettings.getCollectedDirectory().getPath()); + stringParameterBuilder.addParameter("ARCH", globalSettings.getArchDirectory().getPath()); + stringParameterBuilder.addParameter("MAPS", globalSettings.getMapsDirectory().getPath()); + stringParameterBuilder.addParameter("MAP", MapCheckerScriptChecker.MAP_PLACEHOLDER); + final String[] result = new String[args.length - pos]; + for (int i = 0; i < result.length; i++) { + try { + result[i] = stringParameterBuilder.replace(args[pos + i]); + } catch (final SyntaxErrorException ex) { + throw new NoSuchValidatorException(ex.getMessage(), ex); + } + } + return result; + } + + /** * Creates a {@link GameObjectMatcher} instance from string representation. * @param arg the string representation * @return the game object matcher instance Modified: trunk/model/src/test/net/sf/gridarta/model/settings/TestGlobalSettings.java =================================================================== --- trunk/model/src/test/net/sf/gridarta/model/settings/TestGlobalSettings.java 2010-10-10 10:35:35 UTC (rev 8704) +++ trunk/model/src/test/net/sf/gridarta/model/settings/TestGlobalSettings.java 2010-10-10 10:48:14 UTC (rev 8705) @@ -44,7 +44,7 @@ @NotNull @Override public File getArchDirectory() { - throw new AssertionError(); + return new File("arch"); } /** @@ -253,7 +253,7 @@ @Override @NotNull public File getCollectedDirectory() { - throw new AssertionError(); + return new File("collected"); } /** Modified: trunk/model/src/test/net/sf/gridarta/validation/ValidationUtils.java =================================================================== --- trunk/model/src/test/net/sf/gridarta/validation/ValidationUtils.java 2010-10-10 10:35:35 UTC (rev 8704) +++ trunk/model/src/test/net/sf/gridarta/validation/ValidationUtils.java 2010-10-10 10:48:14 UTC (rev 8705) @@ -19,6 +19,15 @@ package net.sf.gridarta.validation; +import net.sf.gridarta.model.archetype.TestArchetype; +import net.sf.gridarta.model.gameobject.TestGameObject; +import net.sf.gridarta.model.io.DefaultMapWriter; +import net.sf.gridarta.model.io.GameObjectParser; +import net.sf.gridarta.model.io.MapArchObjectParserFactory; +import net.sf.gridarta.model.io.MapWriter; +import net.sf.gridarta.model.io.TestMapArchObjectParserFactory; +import net.sf.gridarta.model.maparchobject.TestMapArchObject; +import net.sf.gridarta.model.mapmodel.TestMapModelCreator; import net.sf.gridarta.model.match.GameObjectMatchers; import net.sf.gridarta.model.match.NamedGameObjectMatcher; import net.sf.gridarta.model.match.TypeNrsGameObjectMatcher; @@ -45,12 +54,16 @@ * @return the new instance */ @NotNull - public static ValidatorFactory newValidatorFactory() { + public static ValidatorFactory<TestGameObject, TestMapArchObject, TestArchetype> newValidatorFactory() { final ValidatorPreferences validatorPreferences = new TestValidatorPreferences(); - final GameObjectMatchers gameObjectMatchers = new GameObjectMatchers(); + final TestMapModelCreator mapModelCreator = new TestMapModelCreator(false); + final GameObjectMatchers gameObjectMatchers = mapModelCreator.getGameObjectMatchers(); gameObjectMatchers.addGameObjectMatcher(new NamedGameObjectMatcher(0, "matcher", "name", false, null, new TypeNrsGameObjectMatcher(1))); + final GameObjectParser<TestGameObject, TestMapArchObject, TestArchetype> gameObjectParser = mapModelCreator.newGameObjectParser(); + final MapArchObjectParserFactory<TestMapArchObject> mapArchObjectParserFactory = new TestMapArchObjectParserFactory(); + final MapWriter<TestGameObject, TestMapArchObject, TestArchetype> mapWriter = new DefaultMapWriter<TestGameObject, TestMapArchObject, TestArchetype>(mapArchObjectParserFactory, gameObjectParser); final GlobalSettings globalSettings = new TestGlobalSettings(); - final ValidatorFactory validatorFactory = new ValidatorFactory(validatorPreferences, gameObjectMatchers, globalSettings); + final ValidatorFactory<TestGameObject, TestMapArchObject, TestArchetype> validatorFactory = new ValidatorFactory<TestGameObject, TestMapArchObject, TestArchetype>(validatorPreferences, gameObjectMatchers, globalSettings, mapWriter); return validatorFactory; } Modified: trunk/model/src/test/net/sf/gridarta/validation/checks/ValidatorFactoryTest.java =================================================================== --- trunk/model/src/test/net/sf/gridarta/validation/checks/ValidatorFactoryTest.java 2010-10-10 10:35:35 UTC (rev 8704) +++ trunk/model/src/test/net/sf/gridarta/validation/checks/ValidatorFactoryTest.java 2010-10-10 10:48:14 UTC (rev 8705) @@ -262,6 +262,26 @@ } /** + * Checks that {@link net.sf.gridarta.model.validation.checks.MapCheckerScriptChecker} + * can be instantiated. + * @throws NoSuchValidatorException if the test fails + */ + @Test(expected = NoSuchValidatorException.class) + public void testNewMapCheckerScriptChecker1() throws NoSuchValidatorException { + ValidationUtils.newValidatorFactory().newValidator("net.sf.gridarta.model.validation.checks.MapCheckerScriptChecker a b c"); + } + + /** + * Checks that {@link net.sf.gridarta.model.validation.checks.MapCheckerScriptChecker} + * can be instantiated. + * @throws NoSuchValidatorException if the test fails + */ + @Test + public void testNewMapCheckerScriptChecker2() throws NoSuchValidatorException { + ValidationUtils.newValidatorFactory().newValidator("net.sf.gridarta.model.validation.checks.MapCheckerScriptChecker a ${MAP} c"); + } + + /** * Initializes the action builder. */ @BeforeClass Modified: trunk/src/app/net/sf/gridarta/maincontrol/DefaultMainControl.java =================================================================== --- trunk/src/app/net/sf/gridarta/maincontrol/DefaultMainControl.java 2010-10-10 10:35:35 UTC (rev 8704) +++ trunk/src/app/net/sf/gridarta/maincontrol/DefaultMainControl.java 2010-10-10 10:48:14 UTC (rev 8705) @@ -66,6 +66,7 @@ import net.sf.gridarta.model.gameobject.GameObjectFactory; import net.sf.gridarta.model.io.CacheFiles; import net.sf.gridarta.model.io.DefaultMapReaderFactory; +import net.sf.gridarta.model.io.MapWriter; import net.sf.gridarta.model.io.PathManager; import net.sf.gridarta.model.maparchobject.MapArchObject; import net.sf.gridarta.model.maparchobject.MapArchObjectFactory; @@ -175,8 +176,9 @@ * @param gameObjectSpells the game object spells to use * @param pluginParameterFact... [truncated message content] |
From: <aki...@us...> - 2010-10-10 10:35:42
|
Revision: 8704 http://gridarta.svn.sourceforge.net/gridarta/?rev=8704&view=rev Author: akirschbaum Date: 2010-10-10 10:35:35 +0000 (Sun, 10 Oct 2010) Log Message: ----------- Make StringParameterBuilder work with replacements containing '$'. Modified Paths: -------------- trunk/utils/src/app/net/sf/gridarta/utils/StringParameterBuilder.java Modified: trunk/utils/src/app/net/sf/gridarta/utils/StringParameterBuilder.java =================================================================== --- trunk/utils/src/app/net/sf/gridarta/utils/StringParameterBuilder.java 2010-10-10 10:33:09 UTC (rev 8703) +++ trunk/utils/src/app/net/sf/gridarta/utils/StringParameterBuilder.java 2010-10-10 10:35:35 UTC (rev 8704) @@ -70,7 +70,8 @@ if (value == null) { throw new SyntaxErrorException("unknown variable '${" + key + "}"); } - matcher.appendReplacement(sb, Matcher.quoteReplacement(value)); + matcher.appendReplacement(sb, ""); + sb.append(value); } matcher.appendTail(sb); return sb.toString(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2010-10-10 10:33:15
|
Revision: 8703 http://gridarta.svn.sourceforge.net/gridarta/?rev=8703&view=rev Author: akirschbaum Date: 2010-10-10 10:33:09 +0000 (Sun, 10 Oct 2010) Log Message: ----------- Remove redundant constructor declaration. Modified Paths: -------------- trunk/utils/src/app/net/sf/gridarta/utils/StringParameterBuilder.java Modified: trunk/utils/src/app/net/sf/gridarta/utils/StringParameterBuilder.java =================================================================== --- trunk/utils/src/app/net/sf/gridarta/utils/StringParameterBuilder.java 2010-10-10 10:32:11 UTC (rev 8702) +++ trunk/utils/src/app/net/sf/gridarta/utils/StringParameterBuilder.java 2010-10-10 10:33:09 UTC (rev 8703) @@ -44,12 +44,6 @@ private final Map<String, String> values = new HashMap<String, String>(); /** - * Creates a new instance. - */ - public StringParameterBuilder() { - } - - /** * Adds a parameter key/value pair. The key "PATH" is handled differently: * the value is a list of path names to search for the argument. The first * match is used; if no match is found, a syntax error occurs. This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2010-10-10 10:32:17
|
Revision: 8702 http://gridarta.svn.sourceforge.net/gridarta/?rev=8702&view=rev Author: akirschbaum Date: 2010-10-10 10:32:11 +0000 (Sun, 10 Oct 2010) Log Message: ----------- Remove support for ${PATH} replacement from StringParameterBuilder; add IOUtils.findPathFile() to do this. Modified Paths: -------------- trunk/model/src/app/net/sf/gridarta/model/configsource/AbstractConfigSource.java trunk/utils/src/app/net/sf/gridarta/utils/IOUtils.java trunk/utils/src/app/net/sf/gridarta/utils/StringParameterBuilder.java Modified: trunk/model/src/app/net/sf/gridarta/model/configsource/AbstractConfigSource.java =================================================================== --- trunk/model/src/app/net/sf/gridarta/model/configsource/AbstractConfigSource.java 2010-10-09 13:24:51 UTC (rev 8701) +++ trunk/model/src/app/net/sf/gridarta/model/configsource/AbstractConfigSource.java 2010-10-10 10:32:11 UTC (rev 8702) @@ -64,7 +64,7 @@ return null; } - final StringParameterBuilder stringParameterBuilder = new StringParameterBuilder(false); + final StringParameterBuilder stringParameterBuilder = new StringParameterBuilder(); stringParameterBuilder.addParameter("COLLECTED", globalSettings.getCollectedDirectory().getPath()); stringParameterBuilder.addParameter("ARCH", globalSettings.getArchDirectory().getPath()); stringParameterBuilder.addParameter("MAPS", globalSettings.getMapsDirectory().getPath()); Modified: trunk/utils/src/app/net/sf/gridarta/utils/IOUtils.java =================================================================== --- trunk/utils/src/app/net/sf/gridarta/utils/IOUtils.java 2010-10-09 13:24:51 UTC (rev 8701) +++ trunk/utils/src/app/net/sf/gridarta/utils/IOUtils.java 2010-10-10 10:32:11 UTC (rev 8702) @@ -28,6 +28,7 @@ import java.net.MalformedURLException; import java.net.URI; import java.net.URL; +import java.util.regex.Pattern; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -158,4 +159,34 @@ return tmpFile; } + /** + * Searches for <code>file</code> on all paths specified by the environment + * variable "PATH". + * @param name the file to search for + * @return the matching file + * @throws IOException if the file was not found + */ + @NotNull + public static File findPathFile(@NotNull final String name) throws IOException { + final File absoluteFile = new File(name); + if (absoluteFile.isAbsolute()) { + return absoluteFile; + } + + final String pathSpec = System.getenv("PATH"); + if (pathSpec == null) { + throw new IOException("environment variable PATH is undefined"); + } + + final String[] tmp = pathSpec.split(Pattern.quote(File.pathSeparator), -1); + for (final String path : tmp) { + final File dir = new File(path.isEmpty() ? "." : path); + final File file = new File(dir, name); + if (file.exists()) { + return file; + } + } + throw new IOException("'" + name + "' not found in " + pathSpec); + } + } // class IOUtils Modified: trunk/utils/src/app/net/sf/gridarta/utils/StringParameterBuilder.java =================================================================== --- trunk/utils/src/app/net/sf/gridarta/utils/StringParameterBuilder.java 2010-10-09 13:24:51 UTC (rev 8701) +++ trunk/utils/src/app/net/sf/gridarta/utils/StringParameterBuilder.java 2010-10-10 10:32:11 UTC (rev 8702) @@ -19,7 +19,6 @@ package net.sf.gridarta.utils; -import java.io.File; import java.util.HashMap; import java.util.Map; import java.util.regex.Matcher; @@ -39,11 +38,6 @@ private static final Pattern pattern = Pattern.compile("\\$\\{([a-zA-Z]+)}"); /** - * If set, ${PATH} is supported. - */ - private final boolean pathReplacement; - - /** * Maps parameter key to value. */ @NotNull @@ -51,15 +45,8 @@ /** * Creates a new instance. - * <p/> - * If <code>pathReplacement</code> is set, ${PATH} is recognized at the - * start of the string. If present, the remainder is searched on the "PATH" - * environment variable. The first match is returned. If not match is found, - * a syntax error occurs. - * @param pathReplacement if set, ${PATH} is supported */ - public StringParameterBuilder(final boolean pathReplacement) { - this.pathReplacement = pathReplacement; + public StringParameterBuilder() { } /** @@ -86,43 +73,13 @@ while (matcher.find()) { final String key = matcher.group(1); final String value = values.get(key); - final String replacement; - if (value != null) { - replacement = value; - } else if (pathReplacement && key.startsWith("${PATH}/")) { - replacement = findFile(key.substring(8)).getPath(); - } else { + if (value == null) { throw new SyntaxErrorException("unknown variable '${" + key + "}"); } - matcher.appendReplacement(sb, Matcher.quoteReplacement(replacement)); + matcher.appendReplacement(sb, Matcher.quoteReplacement(value)); } matcher.appendTail(sb); return sb.toString(); } - /** - * Searches for <code>file</code> on all paths specified by the environment - * variable "PATH". - * @param name the file to search for - * @return the matching file - * @throws SyntaxErrorException if the file was not found - */ - @NotNull - private static File findFile(@NotNull final String name) throws SyntaxErrorException { - final String pathSpec = System.getenv("PATH"); - if (pathSpec == null) { - throw new SyntaxErrorException("environment variable PATH is undefined"); - } - - final String[] tmp = pathSpec.split(Pattern.quote(File.pathSeparator), -1); - for (final String path : tmp) { - final File dir = new File(path.isEmpty() ? "." : path); - final File file = new File(dir, name); - if (file.exists()) { - return file; - } - } - throw new SyntaxErrorException("'" + name + "' not found in " + pathSpec); - } - } // class StringParameterBuilder This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2010-10-09 13:24:58
|
Revision: 8701 http://gridarta.svn.sourceforge.net/gridarta/?rev=8701&view=rev Author: akirschbaum Date: 2010-10-09 13:24:51 +0000 (Sat, 09 Oct 2010) Log Message: ----------- Add support for executing commands with parameters to ProcessRunner. Modified Paths: -------------- trunk/src/app/net/sf/gridarta/maincontrol/GUIMainControl.java trunk/utils/src/app/net/sf/gridarta/utils/ProcessRunner.java Modified: trunk/src/app/net/sf/gridarta/maincontrol/GUIMainControl.java =================================================================== --- trunk/src/app/net/sf/gridarta/maincontrol/GUIMainControl.java 2010-10-09 13:21:52 UTC (rev 8700) +++ trunk/src/app/net/sf/gridarta/maincontrol/GUIMainControl.java 2010-10-09 13:24:51 UTC (rev 8701) @@ -749,10 +749,10 @@ @ActionMethod public void controlServer() { if (controlServer == null) { - controlServer = new ProcessRunner("controlServer", appPreferencesModel.getServer()); + controlServer = new ProcessRunner("controlServer", new String[] { appPreferencesModel.getServer(), }); ACTION_BUILDER.showOnetimeMessageDialog(mainViewFrame, JOptionPane.WARNING_MESSAGE, "controlServerWarning"); } else { - controlServer.setCommand(appPreferencesModel.getServer()); + controlServer.setCommand(new String[] { appPreferencesModel.getServer(), }); } controlServer.showDialog(mainViewFrame); } @@ -764,9 +764,9 @@ @ActionMethod public void controlClient() { if (controlClient == null) { - controlClient = new ProcessRunner("controlClient", appPreferencesModel.getClient()); + controlClient = new ProcessRunner("controlClient", new String[] { appPreferencesModel.getClient(), }); } else { - controlClient.setCommand(appPreferencesModel.getClient()); + controlClient.setCommand(new String[] { appPreferencesModel.getClient(), }); } controlClient.showDialog(mainViewFrame); } Modified: trunk/utils/src/app/net/sf/gridarta/utils/ProcessRunner.java =================================================================== --- trunk/utils/src/app/net/sf/gridarta/utils/ProcessRunner.java 2010-10-09 13:21:52 UTC (rev 8700) +++ trunk/utils/src/app/net/sf/gridarta/utils/ProcessRunner.java 2010-10-09 13:24:51 UTC (rev 8701) @@ -83,11 +83,11 @@ private final String key; /** - * The command. + * The command and arguments. * @serial include */ @NotNull - private String command; + private String[] command; /** * The working directory for the command. @@ -147,12 +147,12 @@ * Creates a ProcessRunner for running the given command in the given * directory. * @param key i18n key - * @param command Command to run + * @param command the command to run and its arguments * @param dir Working directory for command */ - private ProcessRunner(@NotNull final String key, @NotNull final String command, @Nullable final String dir) { + private ProcessRunner(@NotNull final String key, @NotNull final String[] command, @Nullable final String dir) { this.key = key; - this.command = command; + this.command = command.clone(); this.dir = dir == null ? null : new File(dir); setLayout(new BorderLayout()); stdtxt.setFont(new Font("monospaced", Font.PLAIN, stdtxt.getFont().getSize())); @@ -176,10 +176,10 @@ /** * Creates a ProcessRunner for running the given command in its directory. * @param key i18n key - * @param command Command to run + * @param command the command to run and its arguments */ - public ProcessRunner(@NotNull final String key, @NotNull final String command) { - this(key, command, new File(command).getParent()); + public ProcessRunner(@NotNull final String key, @NotNull final String[] command) { + this(key, command, new File(command[0]).getParent()); } /** @@ -211,10 +211,10 @@ /** * Set the command to be executed by this ProcessRunner. - * @param command command + * @param command the command to run and its arguments */ - public void setCommand(@NotNull final String command) { - this.command = command; + public void setCommand(@NotNull final String[] command) { + this.command = command.clone(); } /** This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2010-10-09 13:21:58
|
Revision: 8700 http://gridarta.svn.sourceforge.net/gridarta/?rev=8700&view=rev Author: akirschbaum Date: 2010-10-09 13:21:52 +0000 (Sat, 09 Oct 2010) Log Message: ----------- Add support for /home/ank/gnu/gradle/gradle-0.7/bin:/home/ank/install/java/jdk/bin:/home/ank/install/tools/findbugs-1.1.1/bin:/home/ank/bin/tools:/home/ank/bin:/usr/local/bin:/usr/bin:/bin:/usr/games expansion to StringParameterBuilder. Modified Paths: -------------- trunk/model/src/app/net/sf/gridarta/model/configsource/AbstractConfigSource.java trunk/utils/src/app/net/sf/gridarta/utils/StringParameterBuilder.java Modified: trunk/model/src/app/net/sf/gridarta/model/configsource/AbstractConfigSource.java =================================================================== --- trunk/model/src/app/net/sf/gridarta/model/configsource/AbstractConfigSource.java 2010-10-09 13:16:12 UTC (rev 8699) +++ trunk/model/src/app/net/sf/gridarta/model/configsource/AbstractConfigSource.java 2010-10-09 13:21:52 UTC (rev 8700) @@ -64,7 +64,7 @@ return null; } - final StringParameterBuilder stringParameterBuilder = new StringParameterBuilder(); + final StringParameterBuilder stringParameterBuilder = new StringParameterBuilder(false); stringParameterBuilder.addParameter("COLLECTED", globalSettings.getCollectedDirectory().getPath()); stringParameterBuilder.addParameter("ARCH", globalSettings.getArchDirectory().getPath()); stringParameterBuilder.addParameter("MAPS", globalSettings.getMapsDirectory().getPath()); Modified: trunk/utils/src/app/net/sf/gridarta/utils/StringParameterBuilder.java =================================================================== --- trunk/utils/src/app/net/sf/gridarta/utils/StringParameterBuilder.java 2010-10-09 13:16:12 UTC (rev 8699) +++ trunk/utils/src/app/net/sf/gridarta/utils/StringParameterBuilder.java 2010-10-09 13:21:52 UTC (rev 8700) @@ -19,6 +19,7 @@ package net.sf.gridarta.utils; +import java.io.File; import java.util.HashMap; import java.util.Map; import java.util.regex.Matcher; @@ -38,6 +39,11 @@ private static final Pattern pattern = Pattern.compile("\\$\\{([a-zA-Z]+)}"); /** + * If set, ${PATH} is supported. + */ + private final boolean pathReplacement; + + /** * Maps parameter key to value. */ @NotNull @@ -45,12 +51,21 @@ /** * Creates a new instance. + * <p/> + * If <code>pathReplacement</code> is set, ${PATH} is recognized at the + * start of the string. If present, the remainder is searched on the "PATH" + * environment variable. The first match is returned. If not match is found, + * a syntax error occurs. + * @param pathReplacement if set, ${PATH} is supported */ - public StringParameterBuilder() { + public StringParameterBuilder(final boolean pathReplacement) { + this.pathReplacement = pathReplacement; } /** - * Adds a parameter key/value pair. + * Adds a parameter key/value pair. The key "PATH" is handled differently: + * the value is a list of path names to search for the argument. The first + * match is used; if no match is found, a syntax error occurs. * @param key the parameter's key * @param value the parameter's value */ @@ -69,10 +84,15 @@ final Matcher matcher = pattern.matcher(spec); final StringBuffer sb = new StringBuffer(); while (matcher.find()) { - final String group = matcher.group(1); - final String replacement = values.get(group); - if (replacement == null) { - throw new SyntaxErrorException("unknown variable '${" + group + "}"); + final String key = matcher.group(1); + final String value = values.get(key); + final String replacement; + if (value != null) { + replacement = value; + } else if (pathReplacement && key.startsWith("${PATH}/")) { + replacement = findFile(key.substring(8)).getPath(); + } else { + throw new SyntaxErrorException("unknown variable '${" + key + "}"); } matcher.appendReplacement(sb, Matcher.quoteReplacement(replacement)); } @@ -80,4 +100,29 @@ return sb.toString(); } + /** + * Searches for <code>file</code> on all paths specified by the environment + * variable "PATH". + * @param name the file to search for + * @return the matching file + * @throws SyntaxErrorException if the file was not found + */ + @NotNull + private static File findFile(@NotNull final String name) throws SyntaxErrorException { + final String pathSpec = System.getenv("PATH"); + if (pathSpec == null) { + throw new SyntaxErrorException("environment variable PATH is undefined"); + } + + final String[] tmp = pathSpec.split(Pattern.quote(File.pathSeparator), -1); + for (final String path : tmp) { + final File dir = new File(path.isEmpty() ? "." : path); + final File file = new File(dir, name); + if (file.exists()) { + return file; + } + } + throw new SyntaxErrorException("'" + name + "' not found in " + pathSpec); + } + } // class StringParameterBuilder This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2010-10-09 13:16:20
|
Revision: 8699 http://gridarta.svn.sourceforge.net/gridarta/?rev=8699&view=rev Author: akirschbaum Date: 2010-10-09 13:16:12 +0000 (Sat, 09 Oct 2010) Log Message: ----------- Use correct name if the validator's class name contains 'Checker'. Modified Paths: -------------- trunk/model/src/app/net/sf/gridarta/model/validation/AbstractValidator.java Modified: trunk/model/src/app/net/sf/gridarta/model/validation/AbstractValidator.java =================================================================== --- trunk/model/src/app/net/sf/gridarta/model/validation/AbstractValidator.java 2010-10-09 11:35:35 UTC (rev 8698) +++ trunk/model/src/app/net/sf/gridarta/model/validation/AbstractValidator.java 2010-10-09 13:16:12 UTC (rev 8699) @@ -80,7 +80,7 @@ if (!name.endsWith("Checker")) { throw new IllegalArgumentException("Class name must end with \"Checker\""); } - key = VALIDATOR_PREFIX + name.substring(0, name.indexOf("Checker")); + key = VALIDATOR_PREFIX + name.substring(0, name.lastIndexOf("Checker")); final String defaultEnabledString = ActionBuilderUtils.getString(ACTION_BUILDER, key + ".default"); defaultEnabled = Boolean.parseBoolean(defaultEnabledString); enabled = validatorPreferences.loadEnabled(key, defaultEnabled); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2010-10-09 11:35:41
|
Revision: 8698 http://gridarta.svn.sourceforge.net/gridarta/?rev=8698&view=rev Author: akirschbaum Date: 2010-10-09 11:35:35 +0000 (Sat, 09 Oct 2010) Log Message: ----------- Fix checkstyle issues. Modified Paths: -------------- trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/model/validation/checks/NonAbsoluteExitPathChecker.java trunk/crossfire/src/test/net/sf/gridarta/var/crossfire/model/validation/checks/ValidatorFactoryTest.java trunk/model/src/test/net/sf/gridarta/validation/checks/ValidatorFactoryTest.java Modified: trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/model/validation/checks/NonAbsoluteExitPathChecker.java =================================================================== --- trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/model/validation/checks/NonAbsoluteExitPathChecker.java 2010-10-09 11:32:29 UTC (rev 8697) +++ trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/model/validation/checks/NonAbsoluteExitPathChecker.java 2010-10-09 11:35:35 UTC (rev 8698) @@ -27,7 +27,6 @@ import net.sf.gridarta.model.validation.AbstractValidator; import net.sf.gridarta.model.validation.ErrorCollector; import net.sf.gridarta.model.validation.GameObjectValidator; -import net.sf.gridarta.model.validation.MapValidator; import net.sf.gridarta.model.validation.ValidatorPreferences; import net.sf.gridarta.model.validation.checks.NonAbsoluteExitPathError; import net.sf.gridarta.var.crossfire.model.archetype.Archetype; @@ -36,9 +35,9 @@ import org.jetbrains.annotations.NotNull; /** - * A {@link MapValidator} that checks for relative - * exit paths within unique maps. Such paths do not work reliably in Crossfire - * and Atrinik. + * A {@link net.sf.gridarta.model.validation.MapValidator} that checks for + * relative exit paths within unique maps. Such paths do not work reliably in + * Crossfire and Atrinik. * @author Andreas Kirschbaum */ public class NonAbsoluteExitPathChecker extends AbstractValidator implements GameObjectValidator<GameObject, MapArchObject, Archetype> { Modified: trunk/crossfire/src/test/net/sf/gridarta/var/crossfire/model/validation/checks/ValidatorFactoryTest.java =================================================================== --- trunk/crossfire/src/test/net/sf/gridarta/var/crossfire/model/validation/checks/ValidatorFactoryTest.java 2010-10-09 11:32:29 UTC (rev 8697) +++ trunk/crossfire/src/test/net/sf/gridarta/var/crossfire/model/validation/checks/ValidatorFactoryTest.java 2010-10-09 11:35:35 UTC (rev 8698) @@ -20,13 +20,12 @@ package net.sf.gridarta.var.crossfire.model.validation.checks; import net.sf.gridarta.model.validation.NoSuchValidatorException; -import net.sf.gridarta.model.validation.checks.ValidatorFactory; import net.sf.gridarta.validation.ValidationUtils; import org.junit.Test; /** - * Regression tests for {@link ValidatorFactory} to - * create Crossfire specific validators. + * Regression tests for {@link net.sf.gridarta.model.validation.checks.ValidatorFactory} + * to create Crossfire specific validators. * @author Andreas Kirschbaum */ public class ValidatorFactoryTest { Modified: trunk/model/src/test/net/sf/gridarta/validation/checks/ValidatorFactoryTest.java =================================================================== --- trunk/model/src/test/net/sf/gridarta/validation/checks/ValidatorFactoryTest.java 2010-10-09 11:32:29 UTC (rev 8697) +++ trunk/model/src/test/net/sf/gridarta/validation/checks/ValidatorFactoryTest.java 2010-10-09 11:35:35 UTC (rev 8698) @@ -20,14 +20,14 @@ package net.sf.gridarta.validation.checks; import net.sf.gridarta.model.validation.NoSuchValidatorException; -import net.sf.gridarta.model.validation.checks.ValidatorFactory; import net.sf.gridarta.utils.TestActionBuilder; import net.sf.gridarta.validation.ValidationUtils; import org.junit.BeforeClass; import org.junit.Test; /** - * Regression tests for {@link ValidatorFactory} to create validators. + * Regression tests for {@link net.sf.gridarta.model.validation.checks.ValidatorFactory} + * to create validators. * @author Andreas Kirschbaum */ public class ValidatorFactoryTest { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2010-10-09 11:32:36
|
Revision: 8697 http://gridarta.svn.sourceforge.net/gridarta/?rev=8697&view=rev Author: akirschbaum Date: 2010-10-09 11:32:29 +0000 (Sat, 09 Oct 2010) Log Message: ----------- Fix failing regression tests. Modified Paths: -------------- trunk/build.xml trunk/model/src/app/net/sf/gridarta/model/validation/DelegatingMapValidator.java trunk/model/src/test/net/sf/gridarta/validation/AbstractValidatorTest.java trunk/model/src/test/net/sf/gridarta/validation/checks/ValidatorFactoryTest.java Added Paths: ----------- trunk/utils/src/test/net/sf/gridarta/utils/TestActionBuilder.java Modified: trunk/build.xml =================================================================== --- trunk/build.xml 2010-10-09 11:30:55 UTC (rev 8696) +++ trunk/build.xml 2010-10-09 11:32:29 UTC (rev 8697) @@ -387,11 +387,14 @@ <javac srcdir="model/src/test" destdir="dest/model/test" encoding="${build.source.encoding}" source="${build.source.version}" target="${build.target.version}" includeantruntime="false" debug="yes"> <classpath> <fileset dir="lib" includes="annotations.jar"/> + <fileset dir="lib" includes="japi-lib-swing-action-0.1.0.jar"/> <fileset dir="lib" includes="japi-lib-swing-misc-trunk-1398.jar"/> + <fileset dir="lib" includes="japi-lib-util-trunk-1379.jar"/> <fileset dir="lib" includes="junit-4.2.jar"/> <fileset dir="lib" includes="log4j-1.2.13.jar"/> <pathelement location="dest/model/app"/> <pathelement location="dest/utils/app"/> + <pathelement location="dest/utils/test"/> </classpath> <compilerarg line="${javac.args}"/> </javac> @@ -464,6 +467,7 @@ <javac srcdir="utils/src/test" destdir="dest/utils/test" encoding="${build.source.encoding}" source="${build.source.version}" target="${build.target.version}" includeantruntime="false" debug="yes"> <classpath> <fileset dir="lib" includes="annotations.jar"/> + <fileset dir="lib" includes="japi-lib-swing-action-0.1.0.jar"/> <fileset dir="lib" includes="japi-lib-util-trunk-1379.jar"/> <fileset dir="lib" includes="junit-4.2.jar"/> <pathelement location="dest/utils/app"/> @@ -963,6 +967,7 @@ <pathelement location="dest/model/app"/> <pathelement location="dest/model/test"/> <pathelement location="dest/utils/app"/> + <pathelement location="dest/utils/test"/> <pathelement location="resource"/> </classpath> <formatter type="plain"/> Modified: trunk/model/src/app/net/sf/gridarta/model/validation/DelegatingMapValidator.java =================================================================== --- trunk/model/src/app/net/sf/gridarta/model/validation/DelegatingMapValidator.java 2010-10-09 11:30:55 UTC (rev 8696) +++ trunk/model/src/app/net/sf/gridarta/model/validation/DelegatingMapValidator.java 2010-10-09 11:32:29 UTC (rev 8697) @@ -45,7 +45,7 @@ * The default key. */ @NotNull - private static final String DEFAULT_KEY = "MapValidator.All"; + public static final String DEFAULT_KEY = "MapValidator.All"; /** * Create a DelegatingMapValidator for the default key. Modified: trunk/model/src/test/net/sf/gridarta/validation/AbstractValidatorTest.java =================================================================== --- trunk/model/src/test/net/sf/gridarta/validation/AbstractValidatorTest.java 2010-10-09 11:30:55 UTC (rev 8696) +++ trunk/model/src/test/net/sf/gridarta/validation/AbstractValidatorTest.java 2010-10-09 11:32:29 UTC (rev 8697) @@ -21,8 +21,10 @@ import junit.framework.TestCase; import net.sf.gridarta.model.validation.AbstractValidator; +import net.sf.gridarta.model.validation.DelegatingMapValidator; import net.sf.gridarta.model.validation.Validator; import net.sf.gridarta.model.validation.ValidatorPreferences; +import net.sf.gridarta.utils.TestActionBuilder; import org.jetbrains.annotations.Nullable; /** @@ -44,9 +46,10 @@ @Override public void setUp() throws Exception { super.setUp(); + TestActionBuilder.initialize(); final ValidatorPreferences validatorPreferences = new TestValidatorPreferences(); //noinspection EmptyClass - oUT = new AbstractValidator(validatorPreferences, "") { + oUT = new AbstractValidator(validatorPreferences, DelegatingMapValidator.DEFAULT_KEY) { }; } Modified: trunk/model/src/test/net/sf/gridarta/validation/checks/ValidatorFactoryTest.java =================================================================== --- trunk/model/src/test/net/sf/gridarta/validation/checks/ValidatorFactoryTest.java 2010-10-09 11:30:55 UTC (rev 8696) +++ trunk/model/src/test/net/sf/gridarta/validation/checks/ValidatorFactoryTest.java 2010-10-09 11:32:29 UTC (rev 8697) @@ -21,7 +21,9 @@ import net.sf.gridarta.model.validation.NoSuchValidatorException; import net.sf.gridarta.model.validation.checks.ValidatorFactory; +import net.sf.gridarta.utils.TestActionBuilder; import net.sf.gridarta.validation.ValidationUtils; +import org.junit.BeforeClass; import org.junit.Test; /** @@ -259,4 +261,12 @@ ValidationUtils.newValidatorFactory().newValidator("net.sf.gridarta.model.validation.checks.UnsetSlayingChecker 1,2,3 player"); } + /** + * Initializes the action builder. + */ + @BeforeClass + public static void setUp() { + TestActionBuilder.initialize(); + } + } // class ValidatorFactoryTest Added: trunk/utils/src/test/net/sf/gridarta/utils/TestActionBuilder.java =================================================================== --- trunk/utils/src/test/net/sf/gridarta/utils/TestActionBuilder.java (rev 0) +++ trunk/utils/src/test/net/sf/gridarta/utils/TestActionBuilder.java 2010-10-09 11:32:29 UTC (rev 8697) @@ -0,0 +1,87 @@ +/* + * Gridarta MMORPG map editor for Crossfire, Daimonin and similar games. + * Copyright (C) 2000-2010 The Gridarta Developers. + * + * This program 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 2 of the License, or + * (at your option) any later version. + * + * This program is 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 General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +package net.sf.gridarta.utils; + +import java.util.Collections; +import java.util.Enumeration; +import java.util.HashMap; +import java.util.Map; +import java.util.ResourceBundle; +import net.sf.japi.swing.action.ActionBuilder; +import net.sf.japi.swing.action.ActionBuilderFactory; +import net.sf.japi.util.IteratorEnumeration; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; + +/** + * Utility class for initializing the {@link ActionBuilder} infrastructure for + * regression tests. + * @author Andreas Kirschbaum + */ +public class TestActionBuilder { + + /** + * Private constructor to prevent instantiation. + */ + private TestActionBuilder() { + } + + /** + * Initializes the {@link ActionBuilder} infrastructure for regression tests. + */ + public static void initialize() { + final ActionBuilder actionBuilder = ActionBuilderFactory.getInstance().getActionBuilder("net.sf.gridarta"); + final ResourceBundle resourceBundle = new ResourceBundle() { + + /** + * Maps key to associated object. + */ + @NotNull + private final Map<String, Object> objects = new HashMap<String, Object>(); + + @Nullable + @Override + protected Object handleGetObject(@NotNull final String key) { + final Object existingObject = objects.get(key); + if (existingObject != null) { + return existingObject; + } + + final Object object; + if (key.matches("Validator\\..*\\.default")) { + object = "true"; + } else { + return null; + } + objects.put(key, object); + return object; + } + + @NotNull + @Override + public Enumeration<String> getKeys() { + return new IteratorEnumeration<String>(Collections.unmodifiableSet(objects.keySet()).iterator()); + } + + }; + actionBuilder.addBundle(resourceBundle); + } + +} // class TestActionBuilder Property changes on: trunk/utils/src/test/net/sf/gridarta/utils/TestActionBuilder.java ___________________________________________________________________ Added: svn:mime-type + text/plain Added: svn:eol-style + LF This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2010-10-09 11:31:02
|
Revision: 8696 http://gridarta.svn.sourceforge.net/gridarta/?rev=8696&view=rev Author: akirschbaum Date: 2010-10-09 11:30:55 +0000 (Sat, 09 Oct 2010) Log Message: ----------- Include missing resource name in error messages. Modified Paths: -------------- trunk/utils/src/app/net/sf/gridarta/utils/ActionBuilderUtils.java trunk/utils/src/app/net/sf/gridarta/utils/GUIUtils.java Modified: trunk/utils/src/app/net/sf/gridarta/utils/ActionBuilderUtils.java =================================================================== --- trunk/utils/src/app/net/sf/gridarta/utils/ActionBuilderUtils.java 2010-10-09 10:05:10 UTC (rev 8695) +++ trunk/utils/src/app/net/sf/gridarta/utils/ActionBuilderUtils.java 2010-10-09 11:30:55 UTC (rev 8696) @@ -87,7 +87,7 @@ public static String getString(@NotNull final ActionBuilder actionBuilder, @NotNull final String key) { final String value = actionBuilder.getString(key); if (value == null) { - throw new MissingResourceException("missing resource key", ActionBuilderUtils.class.getName(), key); + throw new MissingResourceException("missing resource key: " + key, ActionBuilderUtils.class.getName(), key); } return value; } Modified: trunk/utils/src/app/net/sf/gridarta/utils/GUIUtils.java =================================================================== --- trunk/utils/src/app/net/sf/gridarta/utils/GUIUtils.java 2010-10-09 10:05:10 UTC (rev 8695) +++ trunk/utils/src/app/net/sf/gridarta/utils/GUIUtils.java 2010-10-09 11:30:55 UTC (rev 8696) @@ -85,7 +85,7 @@ icon = new ImageIcon(iconFile.getAbsolutePath()); } else { log.warn("Cannot find icon '" + iconName + "'"); - throw new MissingResourceException("missing resource", GUIUtils.class.getName(), iconName); + throw new MissingResourceException("missing resource: icon " + iconName, GUIUtils.class.getName(), iconName); } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2010-10-09 10:05:17
|
Revision: 8695 http://gridarta.svn.sourceforge.net/gridarta/?rev=8695&view=rev Author: akirschbaum Date: 2010-10-09 10:05:10 +0000 (Sat, 09 Oct 2010) Log Message: ----------- Fix typos. Modified Paths: -------------- trunk/src/app/net/sf/gridarta/messages.properties Modified: trunk/src/app/net/sf/gridarta/messages.properties =================================================================== --- trunk/src/app/net/sf/gridarta/messages.properties 2010-10-08 17:38:12 UTC (rev 8694) +++ trunk/src/app/net/sf/gridarta/messages.properties 2010-10-09 10:05:10 UTC (rev 8695) @@ -1369,7 +1369,7 @@ Validator.TilePaths.msg=<html><h3>{0}</h3><p>The tile path ''{5}'' in direction ''{4}'' is invalid.<br>Go to the map properties dialog and change the map tile paths. Validator.UndefinedAnim.title=Undefined animation -Validator.UndefinedAnim.msg=<html><h3>{0}</h3><p>The animation "{4}" does not exist.</p><p>Sie could:</p><ul><li>Change the animation attribute</li></ul> +Validator.UndefinedAnim.msg=<html><h3>{0}</h3><p>The animation "{4}" does not exist.</p><p>You could:</p><ul><li>Change the animation attribute</li></ul> Validator.UndefinedArchetype.default=true Validator.UndefinedArchetype.title=Undefined archetype @@ -1377,7 +1377,7 @@ Validator.UndefinedFace.default=true Validator.UndefinedFace.title=Undefined face -Validator.UndefinedFace.msg=<html><h3>{0}</h3><p>The face "{4}" does not exist.</p><p>Sie could:</p><ul><li>Change the face attribute</li></ul> +Validator.UndefinedFace.msg=<html><h3>{0}</h3><p>The face "{4}" does not exist.</p><p>You could:</p><ul><li>Change the face attribute</li></ul> Validator.UnsetSlaying.default=true Validator.UnsetSlaying.title=Invalid key string This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2010-10-08 17:38:23
|
Revision: 8694 http://gridarta.svn.sourceforge.net/gridarta/?rev=8694&view=rev Author: akirschbaum Date: 2010-10-08 17:38:12 +0000 (Fri, 08 Oct 2010) Log Message: ----------- Move validator related code into model module. Modified Paths: -------------- trunk/atrinik/src/app/net/sf/gridarta/var/atrinik/maincontrol/DefaultEditorFactory.java trunk/atrinik/src/app/net/sf/gridarta/var/atrinik/messages.properties trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/maincontrol/DefaultEditorFactory.java trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/messages.properties trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/model/validation/checks/NonAbsoluteExitPathChecker.java trunk/crossfire/src/test/net/sf/gridarta/var/crossfire/model/validation/checks/ValidatorFactoryTest.java trunk/daimonin/src/app/net/sf/gridarta/var/daimonin/maincontrol/DefaultEditorFactory.java trunk/daimonin/src/app/net/sf/gridarta/var/daimonin/messages.properties trunk/model/src/app/net/sf/gridarta/model/validation/checks/AbstractShopSquareChecker.java trunk/model/src/app/net/sf/gridarta/model/validation/checks/AttributeRangeChecker.java trunk/model/src/app/net/sf/gridarta/model/validation/checks/BlockedMobOrSpawnPointChecker.java trunk/model/src/app/net/sf/gridarta/model/validation/checks/BlockedSpawnPointChecker.java trunk/model/src/app/net/sf/gridarta/model/validation/checks/ConnectedInsideContainerChecker.java trunk/model/src/app/net/sf/gridarta/model/validation/checks/ConnectedPickableChecker.java trunk/model/src/app/net/sf/gridarta/model/validation/checks/CustomTypeChecker.java trunk/model/src/app/net/sf/gridarta/model/validation/checks/DoubleTypeChecker.java trunk/model/src/app/net/sf/gridarta/model/validation/checks/EmptySpawnPointChecker.java trunk/model/src/app/net/sf/gridarta/model/validation/checks/Entry.java trunk/model/src/app/net/sf/gridarta/model/validation/checks/ExitChecker.java trunk/model/src/app/net/sf/gridarta/model/validation/checks/InvalidCheckException.java trunk/model/src/app/net/sf/gridarta/model/validation/checks/MapDifficultyChecker.java trunk/model/src/app/net/sf/gridarta/model/validation/checks/MobOutsideSpawnPointChecker.java trunk/model/src/app/net/sf/gridarta/model/validation/checks/NonAbsoluteExitPathError.java trunk/model/src/app/net/sf/gridarta/model/validation/checks/PaidItemShopSquareChecker.java trunk/model/src/app/net/sf/gridarta/model/validation/checks/Range.java trunk/model/src/app/net/sf/gridarta/model/validation/checks/RangeEntry.java trunk/model/src/app/net/sf/gridarta/model/validation/checks/ShopSquareChecker.java trunk/model/src/app/net/sf/gridarta/model/validation/checks/SlayingChecker.java trunk/model/src/app/net/sf/gridarta/model/validation/checks/SquareWithoutFloorChecker.java trunk/model/src/app/net/sf/gridarta/model/validation/checks/SysObjectNotOnLayerZeroChecker.java trunk/model/src/app/net/sf/gridarta/model/validation/checks/TilePathsChecker.java trunk/model/src/app/net/sf/gridarta/model/validation/checks/Type.java trunk/model/src/app/net/sf/gridarta/model/validation/checks/UndefinedArchetypeChecker.java trunk/model/src/app/net/sf/gridarta/model/validation/checks/UndefinedFaceChecker.java trunk/model/src/app/net/sf/gridarta/model/validation/checks/UnsetSlayingChecker.java trunk/src/app/net/sf/gridarta/gui/archetypetype/ArchetypeTypeChecks.java trunk/src/app/net/sf/gridarta/gui/autovalidator/AutoValidator.java trunk/src/app/net/sf/gridarta/gui/prefs/MapValidatorPreferences.java trunk/src/app/net/sf/gridarta/mainactions/MainActions.java trunk/src/app/net/sf/gridarta/maincontrol/DefaultMainControl.java trunk/src/app/net/sf/gridarta/maincontrol/EditorFactory.java trunk/src/app/net/sf/gridarta/maincontrol/GUIMainControl.java trunk/src/app/net/sf/gridarta/maincontrol/GridartaEditor.java trunk/src/doc/ref/validators.xhtml Added Paths: ----------- trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/model/validation/ trunk/crossfire/src/test/net/sf/gridarta/var/crossfire/model/validation/ trunk/model/src/app/net/sf/gridarta/model/validation/AbstractValidator.java trunk/model/src/app/net/sf/gridarta/model/validation/DefaultValidatorPreferences.java trunk/model/src/app/net/sf/gridarta/model/validation/DelegatingMapValidator.java trunk/model/src/app/net/sf/gridarta/model/validation/GameObjectValidator.java trunk/model/src/app/net/sf/gridarta/model/validation/MapValidator.java trunk/model/src/app/net/sf/gridarta/model/validation/NoSuchValidatorException.java trunk/model/src/app/net/sf/gridarta/model/validation/SquareValidator.java trunk/model/src/app/net/sf/gridarta/model/validation/Validator.java trunk/model/src/app/net/sf/gridarta/model/validation/ValidatorPreferences.java trunk/model/src/app/net/sf/gridarta/model/validation/checks/ trunk/model/src/app/net/sf/gridarta/model/validation/checks/BlockedMatrix.java trunk/model/src/app/net/sf/gridarta/model/validation/checks/BlockedSquareChecker.java trunk/model/src/app/net/sf/gridarta/model/validation/checks/ConnectionChecker.java trunk/model/src/app/net/sf/gridarta/model/validation/checks/DoubleLayerChecker.java trunk/model/src/app/net/sf/gridarta/model/validation/checks/ValidatorFactory.java trunk/model/src/app/net/sf/gridarta/model/validation/errors/ConnectionUnknownError.java trunk/model/src/test/net/sf/gridarta/validation/ trunk/model/src/test/net/sf/gridarta/validation/AbstractValidatorTest.java trunk/model/src/test/net/sf/gridarta/validation/TestValidatorPreferences.java trunk/model/src/test/net/sf/gridarta/validation/ValidationUtils.java trunk/model/src/test/net/sf/gridarta/validation/checks/ trunk/model/src/test/net/sf/gridarta/validation/checks/ValidatorFactoryTest.java Removed Paths: ------------- trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/validation/ trunk/crossfire/src/test/net/sf/gridarta/var/crossfire/validation/ trunk/model/src/app/net/sf/gridarta/model/validation/checks/BlockedMatrix.java trunk/model/src/app/net/sf/gridarta/model/validation/checks/BlockedSquareChecker.java trunk/model/src/app/net/sf/gridarta/model/validation/checks/ConnectionChecker.java trunk/model/src/app/net/sf/gridarta/model/validation/checks/ConnectionUnknownError.java trunk/model/src/app/net/sf/gridarta/model/validation/checks/DoubleLayerChecker.java trunk/src/app/net/sf/gridarta/model/validation/errors/ConnectionUnknownError.java trunk/src/app/net/sf/gridarta/validation/AbstractValidator.java trunk/src/app/net/sf/gridarta/validation/DefaultValidatorPreferences.java trunk/src/app/net/sf/gridarta/validation/DelegatingMapValidator.java trunk/src/app/net/sf/gridarta/validation/GameObjectValidator.java trunk/src/app/net/sf/gridarta/validation/MapValidator.java trunk/src/app/net/sf/gridarta/validation/NoSuchValidatorException.java trunk/src/app/net/sf/gridarta/validation/SquareValidator.java trunk/src/app/net/sf/gridarta/validation/Validator.java trunk/src/app/net/sf/gridarta/validation/ValidatorFactory.java trunk/src/app/net/sf/gridarta/validation/ValidatorPreferences.java trunk/src/app/net/sf/gridarta/validation/checks/ trunk/src/test/net/sf/gridarta/validation/AbstractValidatorTest.java trunk/src/test/net/sf/gridarta/validation/TestValidatorPreferences.java trunk/src/test/net/sf/gridarta/validation/ValidationUtils.java trunk/src/test/net/sf/gridarta/validation/ValidatorFactoryTest.java Modified: trunk/atrinik/src/app/net/sf/gridarta/var/atrinik/maincontrol/DefaultEditorFactory.java =================================================================== --- trunk/atrinik/src/app/net/sf/gridarta/var/atrinik/maincontrol/DefaultEditorFactory.java 2010-10-08 07:41:55 UTC (rev 8693) +++ trunk/atrinik/src/app/net/sf/gridarta/var/atrinik/maincontrol/DefaultEditorFactory.java 2010-10-08 17:38:12 UTC (rev 8694) @@ -91,6 +91,10 @@ import net.sf.gridarta.model.spells.GameObjectSpell; import net.sf.gridarta.model.spells.NumberSpell; import net.sf.gridarta.model.spells.Spells; +import net.sf.gridarta.model.validation.DelegatingMapValidator; +import net.sf.gridarta.model.validation.ValidatorPreferences; +import net.sf.gridarta.model.validation.checks.AttributeRangeChecker; +import net.sf.gridarta.model.validation.checks.InvalidCheckException; import net.sf.gridarta.script.ScriptExecutor; import net.sf.gridarta.script.ScriptModel; import net.sf.gridarta.script.ScriptParameters; @@ -98,10 +102,6 @@ import net.sf.gridarta.utils.GUIUtils; import net.sf.gridarta.utils.IOUtils; import net.sf.gridarta.utils.SystemIcons; -import net.sf.gridarta.validation.DelegatingMapValidator; -import net.sf.gridarta.validation.ValidatorPreferences; -import net.sf.gridarta.validation.checks.AttributeRangeChecker; -import net.sf.gridarta.validation.checks.InvalidCheckException; import net.sf.gridarta.var.atrinik.IGUIConstants; import net.sf.gridarta.var.atrinik.gui.map.renderer.DefaultRendererFactory; import net.sf.gridarta.var.atrinik.gui.mappropertiesdialog.DefaultMapPropertiesDialogFactory; Modified: trunk/atrinik/src/app/net/sf/gridarta/var/atrinik/messages.properties =================================================================== --- trunk/atrinik/src/app/net/sf/gridarta/var/atrinik/messages.properties 2010-10-08 07:41:55 UTC (rev 8693) +++ trunk/atrinik/src/app/net/sf/gridarta/var/atrinik/messages.properties 2010-10-08 17:38:12 UTC (rev 8694) @@ -158,17 +158,17 @@ ########################### # Map Validator definitions -validator.0=net.sf.gridarta.validation.checks.ConnectionChecker system_connection_source system_connection_sink system_connection_sink2 -validator.1=net.sf.gridarta.validation.checks.BlockedSpawnPointChecker 81 -validator.2=net.sf.gridarta.validation.checks.BlockedMobOrSpawnPointChecker 80 -validator.3=net.sf.gridarta.validation.checks.ConnectedInsideContainerChecker -validator.4=net.sf.gridarta.validation.checks.ConnectedPickableChecker -validator.5=net.sf.gridarta.validation.checks.DoubleLayerChecker -validator.6=net.sf.gridarta.validation.checks.EmptySpawnPointChecker 81 -validator.7=net.sf.gridarta.validation.checks.ExitChecker 66 -validator.8=net.sf.gridarta.validation.checks.MapDifficultyChecker -validator.9=net.sf.gridarta.validation.checks.MobOutsideSpawnPointChecker 80 -validator.10=net.sf.gridarta.validation.checks.TilePathsChecker 8 -validator.11=net.sf.gridarta.validation.checks.UndefinedArchetypeChecker -validator.12=net.sf.gridarta.validation.checks.UndefinedFaceChecker -validator.13=net.sf.gridarta.validation.checks.UnsetSlayingChecker 20,21,51,55,64,122 +validator.0=net.sf.gridarta.model.validation.checks.ConnectionChecker system_connection_source system_connection_sink system_connection_sink2 +validator.1=net.sf.gridarta.model.validation.checks.BlockedSpawnPointChecker 81 +validator.2=net.sf.gridarta.model.validation.checks.BlockedMobOrSpawnPointChecker 80 +validator.3=net.sf.gridarta.model.validation.checks.ConnectedInsideContainerChecker +validator.4=net.sf.gridarta.model.validation.checks.ConnectedPickableChecker +validator.5=net.sf.gridarta.model.validation.checks.DoubleLayerChecker +validator.6=net.sf.gridarta.model.validation.checks.EmptySpawnPointChecker 81 +validator.7=net.sf.gridarta.model.validation.checks.ExitChecker 66 +validator.8=net.sf.gridarta.model.validation.checks.MapDifficultyChecker +validator.9=net.sf.gridarta.model.validation.checks.MobOutsideSpawnPointChecker 80 +validator.10=net.sf.gridarta.model.validation.checks.TilePathsChecker 8 +validator.11=net.sf.gridarta.model.validation.checks.UndefinedArchetypeChecker +validator.12=net.sf.gridarta.model.validation.checks.UndefinedFaceChecker +validator.13=net.sf.gridarta.model.validation.checks.UnsetSlayingChecker 20,21,51,55,64,122 Modified: trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/maincontrol/DefaultEditorFactory.java =================================================================== --- trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/maincontrol/DefaultEditorFactory.java 2010-10-08 07:41:55 UTC (rev 8693) +++ trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/maincontrol/DefaultEditorFactory.java 2010-10-08 17:38:12 UTC (rev 8694) @@ -86,6 +86,10 @@ import net.sf.gridarta.model.spells.GameObjectSpell; import net.sf.gridarta.model.spells.NumberSpell; import net.sf.gridarta.model.spells.Spells; +import net.sf.gridarta.model.validation.DelegatingMapValidator; +import net.sf.gridarta.model.validation.ValidatorPreferences; +import net.sf.gridarta.model.validation.checks.AttributeRangeChecker; +import net.sf.gridarta.model.validation.checks.InvalidCheckException; import net.sf.gridarta.script.ScriptExecutor; import net.sf.gridarta.script.ScriptModel; import net.sf.gridarta.script.ScriptParameters; @@ -93,10 +97,6 @@ import net.sf.gridarta.utils.ConfigFileUtils; import net.sf.gridarta.utils.GUIUtils; import net.sf.gridarta.utils.SystemIcons; -import net.sf.gridarta.validation.DelegatingMapValidator; -import net.sf.gridarta.validation.ValidatorPreferences; -import net.sf.gridarta.validation.checks.AttributeRangeChecker; -import net.sf.gridarta.validation.checks.InvalidCheckException; import net.sf.gridarta.var.crossfire.IGUIConstants; import net.sf.gridarta.var.crossfire.gui.map.renderer.DefaultRendererFactory; import net.sf.gridarta.var.crossfire.gui.mappropertiesdialog.DefaultMapPropertiesDialogFactory; Modified: trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/messages.properties =================================================================== --- trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/messages.properties 2010-10-08 07:41:55 UTC (rev 8693) +++ trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/messages.properties 2010-10-08 17:38:12 UTC (rev 8694) @@ -139,14 +139,14 @@ ########################### # Map Validator definitions -validator.0=net.sf.gridarta.validation.checks.ConnectionChecker system_connection_source system_connection_sink system_connection_sink2 -validator.1=net.sf.gridarta.var.crossfire.validation.checks.NonAbsoluteExitPathChecker system_exit -validator.2=net.sf.gridarta.validation.checks.ConnectedInsideContainerChecker -validator.3=net.sf.gridarta.validation.checks.ConnectedPickableChecker -validator.4=net.sf.gridarta.validation.checks.ExitChecker 66 -validator.5=net.sf.gridarta.validation.checks.MapDifficultyChecker -validator.6=net.sf.gridarta.validation.checks.TilePathsChecker 4 -validator.7=net.sf.gridarta.validation.checks.UndefinedFaceChecker -validator.8=net.sf.gridarta.validation.checks.UndefinedArchetypeChecker -validator.9=net.sf.gridarta.validation.checks.UnsetSlayingChecker 20,21,51,52,55,64,122 player -validator.10=net.sf.gridarta.validation.checks.CustomTypeChecker 0,71 0,77 +validator.0=net.sf.gridarta.model.validation.checks.ConnectionChecker system_connection_source system_connection_sink system_connection_sink2 +validator.1=net.sf.gridarta.var.crossfire.model.validation.checks.NonAbsoluteExitPathChecker system_exit +validator.2=net.sf.gridarta.model.validation.checks.ConnectedInsideContainerChecker +validator.3=net.sf.gridarta.model.validation.checks.ConnectedPickableChecker +validator.4=net.sf.gridarta.model.validation.checks.ExitChecker 66 +validator.5=net.sf.gridarta.model.validation.checks.MapDifficultyChecker +validator.6=net.sf.gridarta.model.validation.checks.TilePathsChecker 4 +validator.7=net.sf.gridarta.model.validation.checks.UndefinedFaceChecker +validator.8=net.sf.gridarta.model.validation.checks.UndefinedArchetypeChecker +validator.9=net.sf.gridarta.model.validation.checks.UnsetSlayingChecker 20,21,51,52,55,64,122 player +validator.10=net.sf.gridarta.model.validation.checks.CustomTypeChecker 0,71 0,77 Modified: trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/model/validation/checks/NonAbsoluteExitPathChecker.java =================================================================== --- trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/validation/checks/NonAbsoluteExitPathChecker.java 2010-10-07 18:42:08 UTC (rev 8687) +++ trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/model/validation/checks/NonAbsoluteExitPathChecker.java 2010-10-08 17:38:12 UTC (rev 8694) @@ -17,25 +17,26 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ -package net.sf.gridarta.var.crossfire.validation.checks; +package net.sf.gridarta.var.crossfire.model.validation.checks; import net.sf.gridarta.gui.map.mapactions.MapLocation; import net.sf.gridarta.gui.map.mapactions.NoExitPathException; import net.sf.gridarta.model.mapmodel.MapModel; import net.sf.gridarta.model.mapmodel.MapSquare; import net.sf.gridarta.model.match.GameObjectMatcher; +import net.sf.gridarta.model.validation.AbstractValidator; import net.sf.gridarta.model.validation.ErrorCollector; -import net.sf.gridarta.validation.AbstractValidator; -import net.sf.gridarta.validation.GameObjectValidator; -import net.sf.gridarta.validation.ValidatorPreferences; -import net.sf.gridarta.validation.checks.NonAbsoluteExitPathError; +import net.sf.gridarta.model.validation.GameObjectValidator; +import net.sf.gridarta.model.validation.MapValidator; +import net.sf.gridarta.model.validation.ValidatorPreferences; +import net.sf.gridarta.model.validation.checks.NonAbsoluteExitPathError; import net.sf.gridarta.var.crossfire.model.archetype.Archetype; import net.sf.gridarta.var.crossfire.model.gameobject.GameObject; import net.sf.gridarta.var.crossfire.model.maparchobject.MapArchObject; import org.jetbrains.annotations.NotNull; /** - * A {@link net.sf.gridarta.validation.MapValidator} that checks for relative + * A {@link MapValidator} that checks for relative * exit paths within unique maps. Such paths do not work reliably in Crossfire * and Atrinik. * @author Andreas Kirschbaum Modified: trunk/crossfire/src/test/net/sf/gridarta/var/crossfire/model/validation/checks/ValidatorFactoryTest.java =================================================================== --- trunk/crossfire/src/test/net/sf/gridarta/var/crossfire/validation/checks/ValidatorFactoryTest.java 2010-10-07 18:42:08 UTC (rev 8687) +++ trunk/crossfire/src/test/net/sf/gridarta/var/crossfire/model/validation/checks/ValidatorFactoryTest.java 2010-10-08 17:38:12 UTC (rev 8694) @@ -17,14 +17,15 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ -package net.sf.gridarta.var.crossfire.validation.checks; +package net.sf.gridarta.var.crossfire.model.validation.checks; -import net.sf.gridarta.validation.NoSuchValidatorException; +import net.sf.gridarta.model.validation.NoSuchValidatorException; +import net.sf.gridarta.model.validation.checks.ValidatorFactory; import net.sf.gridarta.validation.ValidationUtils; import org.junit.Test; /** - * Regression tests for {@link net.sf.gridarta.validation.ValidatorFactory} to + * Regression tests for {@link ValidatorFactory} to * create Crossfire specific validators. * @author Andreas Kirschbaum */ @@ -36,7 +37,7 @@ */ @Test public void testNewNonAbsoluteExitPathChecker() throws NoSuchValidatorException { - ValidationUtils.newValidatorFactory().newValidator("net.sf.gridarta.var.crossfire.validation.checks.NonAbsoluteExitPathChecker matcher"); + ValidationUtils.newValidatorFactory().newValidator("net.sf.gridarta.var.crossfire.model.validation.checks.NonAbsoluteExitPathChecker matcher"); } } // class ValidatorFactoryTest Modified: trunk/daimonin/src/app/net/sf/gridarta/var/daimonin/maincontrol/DefaultEditorFactory.java =================================================================== --- trunk/daimonin/src/app/net/sf/gridarta/var/daimonin/maincontrol/DefaultEditorFactory.java 2010-10-08 07:41:55 UTC (rev 8693) +++ trunk/daimonin/src/app/net/sf/gridarta/var/daimonin/maincontrol/DefaultEditorFactory.java 2010-10-08 17:38:12 UTC (rev 8694) @@ -91,6 +91,10 @@ import net.sf.gridarta.model.spells.GameObjectSpell; import net.sf.gridarta.model.spells.NumberSpell; import net.sf.gridarta.model.spells.Spells; +import net.sf.gridarta.model.validation.DelegatingMapValidator; +import net.sf.gridarta.model.validation.ValidatorPreferences; +import net.sf.gridarta.model.validation.checks.AttributeRangeChecker; +import net.sf.gridarta.model.validation.checks.InvalidCheckException; import net.sf.gridarta.script.ScriptExecutor; import net.sf.gridarta.script.ScriptModel; import net.sf.gridarta.script.ScriptParameters; @@ -98,10 +102,6 @@ import net.sf.gridarta.utils.GUIUtils; import net.sf.gridarta.utils.IOUtils; import net.sf.gridarta.utils.SystemIcons; -import net.sf.gridarta.validation.DelegatingMapValidator; -import net.sf.gridarta.validation.ValidatorPreferences; -import net.sf.gridarta.validation.checks.AttributeRangeChecker; -import net.sf.gridarta.validation.checks.InvalidCheckException; import net.sf.gridarta.var.daimonin.IGUIConstants; import net.sf.gridarta.var.daimonin.gui.map.renderer.DefaultRendererFactory; import net.sf.gridarta.var.daimonin.gui.mappropertiesdialog.DefaultMapPropertiesDialogFactory; Modified: trunk/daimonin/src/app/net/sf/gridarta/var/daimonin/messages.properties =================================================================== --- trunk/daimonin/src/app/net/sf/gridarta/var/daimonin/messages.properties 2010-10-08 07:41:55 UTC (rev 8693) +++ trunk/daimonin/src/app/net/sf/gridarta/var/daimonin/messages.properties 2010-10-08 17:38:12 UTC (rev 8694) @@ -158,23 +158,23 @@ ########################### # Map Validator definitions -validator.0=net.sf.gridarta.validation.checks.ConnectionChecker system_connection_source system_connection_sink system_connection_sink2 -validator.1=net.sf.gridarta.validation.checks.BlockedSpawnPointChecker 81 -validator.2=net.sf.gridarta.validation.checks.BlockedMobOrSpawnPointChecker 80 -validator.3=net.sf.gridarta.validation.checks.BlockedSquareChecker -validator.4=net.sf.gridarta.validation.checks.ConnectedInsideContainerChecker -validator.5=net.sf.gridarta.validation.checks.ConnectedPickableChecker -validator.6=net.sf.gridarta.validation.checks.DoubleTypeChecker -validator.7=net.sf.gridarta.validation.checks.DoubleLayerChecker -validator.8=net.sf.gridarta.validation.checks.EmptySpawnPointChecker 81 -validator.9=net.sf.gridarta.validation.checks.ExitChecker 66 -validator.10=net.sf.gridarta.validation.checks.MapDifficultyChecker -validator.11=net.sf.gridarta.validation.checks.MobOutsideSpawnPointChecker 80 -validator.12=net.sf.gridarta.validation.checks.SquareWithoutFloorChecker 71,68 -validator.13=net.sf.gridarta.validation.checks.SysObjectNotOnLayerZeroChecker -validator.14=net.sf.gridarta.validation.checks.TilePathsChecker 8 -validator.15=net.sf.gridarta.validation.checks.UndefinedArchetypeChecker -validator.16=net.sf.gridarta.validation.checks.UndefinedFaceChecker -validator.17=net.sf.gridarta.validation.checks.UnsetSlayingChecker 20,21,51,55,64,122 -validator.18=net.sf.gridarta.validation.checks.CustomTypeChecker 80,83,81 -validator.19=net.sf.gridarta.validation.checks.SlayingChecker ^[a-zA-Z_0-9/.]*$ system_environment_sensor,|([0-1][0-9]|2[0-3]):[0-5][0-9]-([0-1][0-9]|2[0-3]):[0-5][0-9] +validator.0=net.sf.gridarta.model.validation.checks.ConnectionChecker system_connection_source system_connection_sink system_connection_sink2 +validator.1=net.sf.gridarta.model.validation.checks.BlockedSpawnPointChecker 81 +validator.2=net.sf.gridarta.model.validation.checks.BlockedMobOrSpawnPointChecker 80 +validator.3=net.sf.gridarta.model.validation.checks.BlockedSquareChecker +validator.4=net.sf.gridarta.model.validation.checks.ConnectedInsideContainerChecker +validator.5=net.sf.gridarta.model.validation.checks.ConnectedPickableChecker +validator.6=net.sf.gridarta.model.validation.checks.DoubleTypeChecker +validator.7=net.sf.gridarta.model.validation.checks.DoubleLayerChecker +validator.8=net.sf.gridarta.model.validation.checks.EmptySpawnPointChecker 81 +validator.9=net.sf.gridarta.model.validation.checks.ExitChecker 66 +validator.10=net.sf.gridarta.model.validation.checks.MapDifficultyChecker +validator.11=net.sf.gridarta.model.validation.checks.MobOutsideSpawnPointChecker 80 +validator.12=net.sf.gridarta.model.validation.checks.SquareWithoutFloorChecker 71,68 +validator.13=net.sf.gridarta.model.validation.checks.SysObjectNotOnLayerZeroChecker +validator.14=net.sf.gridarta.model.validation.checks.TilePathsChecker 8 +validator.15=net.sf.gridarta.model.validation.checks.UndefinedArchetypeChecker +validator.16=net.sf.gridarta.model.validation.checks.UndefinedFaceChecker +validator.17=net.sf.gridarta.model.validation.checks.UnsetSlayingChecker 20,21,51,55,64,122 +validator.18=net.sf.gridarta.model.validation.checks.CustomTypeChecker 80,83,81 +validator.19=net.sf.gridarta.model.validation.checks.SlayingChecker ^[a-zA-Z_0-9/.]*$ system_environment_sensor,|([0-1][0-9]|2[0-3]):[0-5][0-9]-([0-1][0-9]|2[0-3]):[0-5][0-9] Copied: trunk/model/src/app/net/sf/gridarta/model/validation/AbstractValidator.java (from rev 8687, trunk/src/app/net/sf/gridarta/validation/AbstractValidator.java) =================================================================== --- trunk/model/src/app/net/sf/gridarta/model/validation/AbstractValidator.java (rev 0) +++ trunk/model/src/app/net/sf/gridarta/model/validation/AbstractValidator.java 2010-10-08 17:38:12 UTC (rev 8694) @@ -0,0 +1,140 @@ +/* + * Gridarta MMORPG map editor for Crossfire, Daimonin and similar games. + * Copyright (C) 2000-2010 The Gridarta Developers. + * + * This program 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 2 of the License, or + * (at your option) any later version. + * + * This program is 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 General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +package net.sf.gridarta.model.validation; + +import net.sf.gridarta.utils.ActionBuilderUtils; +import net.sf.japi.swing.action.ActionBuilder; +import net.sf.japi.swing.action.ActionBuilderFactory; +import org.jetbrains.annotations.NotNull; + +/** + * This is the base class for validators. + * @author <a href="mailto:ch...@ri...">Christian Hujer</a> + * @note that this class completely implements the interface {@link Validator} + * but does not declare it to force subclasses to choose the interface to + * implement. + */ +public abstract class AbstractValidator implements Validator { + + /** + * The prefix for preference keys. + */ + @NotNull + private static final String VALIDATOR_PREFIX = "Validator."; + + /** + * Action Builder. + */ + @NotNull + private static final ActionBuilder ACTION_BUILDER = ActionBuilderFactory.getInstance().getActionBuilder("net.sf.gridarta"); + + /** + * The {@link ValidatorPreferences} to use. + */ + @NotNull + private final ValidatorPreferences validatorPreferences; + + /** + * Key. + */ + @NotNull + private final String key; + + /** + * Whether this MapValidator is enabled. + */ + private boolean enabled; + + /** + * Whether this MapValidator is enabled by default. + */ + private final boolean defaultEnabled; + + /** + * Create an AbstractMapValidator. The key is generated from the validator's + * name, which must end on "Checker". + * @param validatorPreferences the validator preferences to use + * @throws IllegalArgumentException in case the validator's name does not + * end on "Checker". + */ + protected AbstractValidator(@NotNull final ValidatorPreferences validatorPreferences) throws IllegalArgumentException { + this.validatorPreferences = validatorPreferences; + final String name = getClass().getSimpleName(); + if (!name.endsWith("Checker")) { + throw new IllegalArgumentException("Class name must end with \"Checker\""); + } + key = VALIDATOR_PREFIX + name.substring(0, name.indexOf("Checker")); + final String defaultEnabledString = ActionBuilderUtils.getString(ACTION_BUILDER, key + ".default"); + defaultEnabled = Boolean.parseBoolean(defaultEnabledString); + enabled = validatorPreferences.loadEnabled(key, defaultEnabled); + } + + /** + * Create an AbstractMapValidator. + * @param validatorPreferences the validator preferences to use + * @param key Key + */ + protected AbstractValidator(@NotNull final ValidatorPreferences validatorPreferences, @NotNull final String key) { + this.validatorPreferences = validatorPreferences; + this.key = key; + final String defaultEnabledString = ActionBuilderUtils.getString(ACTION_BUILDER, key + ".default"); + defaultEnabled = Boolean.parseBoolean(defaultEnabledString); + enabled = validatorPreferences.loadEnabled(key, defaultEnabled); + } + + /** + * {@inheritDoc} + */ + @NotNull + @Override + public String getKey() { + return key; + } + + /** + * {@inheritDoc} + */ + @Override + public void setEnabled(final boolean enabled) { + if (this.enabled == enabled) { + return; + } + + this.enabled = enabled; + validatorPreferences.saveEnabled(key, enabled); + } + + /** + * {@inheritDoc} + */ + @Override + public boolean isEnabled() { + return enabled; + } + + /** + * {@inheritDoc} + */ + @Override + public boolean isDefaultEnabled() { + return defaultEnabled; + } + +} // class AbstractValidator Property changes on: trunk/model/src/app/net/sf/gridarta/model/validation/AbstractValidator.java ___________________________________________________________________ Added: svn:mime-type + text/plain Added: svn:eol-style + LF Copied: trunk/model/src/app/net/sf/gridarta/model/validation/DefaultValidatorPreferences.java (from rev 8687, trunk/src/app/net/sf/gridarta/validation/DefaultValidatorPreferences.java) =================================================================== --- trunk/model/src/app/net/sf/gridarta/model/validation/DefaultValidatorPreferences.java (rev 0) +++ trunk/model/src/app/net/sf/gridarta/model/validation/DefaultValidatorPreferences.java 2010-10-08 17:38:12 UTC (rev 8694) @@ -0,0 +1,55 @@ +/* + * Gridarta MMORPG map editor for Crossfire, Daimonin and similar games. + * Copyright (C) 2000-2010 The Gridarta Developers. + * + * This program 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 2 of the License, or + * (at your option) any later version. + * + * This program is 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 General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +package net.sf.gridarta.model.validation; + +import java.util.prefs.Preferences; +import net.sf.gridarta.MainControl; +import org.jetbrains.annotations.NotNull; + +/** + * Default {@link ValidatorPreferences} implementations. Stores settings in + * preferences. + * @author Andreas Kirschbaum + */ +public class DefaultValidatorPreferences implements ValidatorPreferences { + + /** + * Preferences. + */ + @NotNull + private static final Preferences preferences = Preferences.userNodeForPackage(MainControl.class); + + /** + * {@inheritDoc} + */ + @Override + public boolean loadEnabled(@NotNull final String key, final boolean defaultEnabled) { + return preferences.getBoolean(key, defaultEnabled); + } + + /** + * {@inheritDoc} + */ + @Override + public void saveEnabled(@NotNull final String key, final boolean enabled) { + preferences.putBoolean(key, enabled); + } + +} // class DefaultValidatorPreferences Property changes on: trunk/model/src/app/net/sf/gridarta/model/validation/DefaultValidatorPreferences.java ___________________________________________________________________ Added: svn:mime-type + text/plain Added: svn:eol-style + LF Copied: trunk/model/src/app/net/sf/gridarta/model/validation/DelegatingMapValidator.java (from rev 8687, trunk/src/app/net/sf/gridarta/validation/DelegatingMapValidator.java) =================================================================== --- trunk/model/src/app/net/sf/gridarta/model/validation/DelegatingMapValidator.java (rev 0) +++ trunk/model/src/app/net/sf/gridarta/model/validation/DelegatingMapValidator.java 2010-10-08 17:38:12 UTC (rev 8694) @@ -0,0 +1,154 @@ +/* + * Gridarta MMORPG map editor for Crossfire, Daimonin and similar games. + * Copyright (C) 2000-2010 The Gridarta Developers. + * + * This program 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 2 of the License, or + * (at your option) any later version. + * + * This program is 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 General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +package net.sf.gridarta.model.validation; + +import java.util.ArrayList; +import java.util.Iterator; +import java.util.List; +import net.sf.gridarta.model.archetype.Archetype; +import net.sf.gridarta.model.gameobject.GameObject; +import net.sf.gridarta.model.maparchobject.MapArchObject; +import net.sf.gridarta.model.mapmodel.MapModel; +import net.sf.gridarta.model.mapmodel.MapSquare; +import org.jetbrains.annotations.NotNull; + +/** + * A Map Validator that delegates to other MapValidators. + * @author <a href="mailto:ch...@ri...">Christian Hujer</a> + */ +public class DelegatingMapValidator<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>> extends AbstractValidator implements GameObjectValidator<G, A, R>, SquareValidator<G, A, R>, MapValidator<G, A, R>, Iterable<Validator> { + + /** + * Map Validators to validate against. + */ + @NotNull + private final List<Validator> validators = new ArrayList<Validator>(); + + /** + * The default key. + */ + @NotNull + private static final String DEFAULT_KEY = "MapValidator.All"; + + /** + * Create a DelegatingMapValidator for the default key. + * @param validatorPreferences the validator preferences to use + */ + public DelegatingMapValidator(@NotNull final ValidatorPreferences validatorPreferences) { + this(validatorPreferences, DEFAULT_KEY); + } + + /** + * Create a DelegatingMapValidator for a specific key. + * @param validatorPreferences the validator preferences to use + * @param key key + */ + private DelegatingMapValidator(@NotNull final ValidatorPreferences validatorPreferences, @NotNull final String key) { + super(validatorPreferences, key); + } + + /** + * Perform all validations on a map. + * @param mapModel map to validate + */ + public void validateAll(@NotNull final MapModel<G, A, R> mapModel) { + final ErrorCollector<G, A, R> errorCollector = new DefaultErrorCollector<G, A, R>(); + validateMap(mapModel, errorCollector); + for (final MapSquare<G, A, R> mapSquare : mapModel) { + validateSquare(mapSquare, errorCollector); + for (final G archObject : mapSquare) { + validateGameObject(archObject, errorCollector); + for (final G invObject : archObject.recursive()) { + validateGameObject(invObject, errorCollector); + } + } + } + mapModel.setErrors(errorCollector); + } + + /** + * {@inheritDoc} + */ + @Override + public void validateMap(@NotNull final MapModel<G, A, R> mapModel, @NotNull final ErrorCollector<G, A, R> errorCollector) { + for (final Validator validator : validators) { + if (validator.isEnabled()) { + if (validator instanceof MapValidator) { + ((MapValidator<G, A, R>) validator).validateMap(mapModel, errorCollector); + } + } + } + } + + /** + * {@inheritDoc} + */ + @Override + public void validateSquare(@NotNull final MapSquare<G, A, R> mapSquare, @NotNull final ErrorCollector<G, A, R> errorCollector) { + for (final Validator validator : validators) { + if (validator.isEnabled() && validator instanceof SquareValidator) { + ((SquareValidator<G, A, R>) validator).validateSquare(mapSquare, errorCollector); + } + } + } + + /** + * {@inheritDoc} + */ + @Override + public void validateGameObject(@NotNull final G gameObject, @NotNull final ErrorCollector<G, A, R> errorCollector) { + for (final Validator validator : validators) { + if (validator.isEnabled() && validator instanceof GameObjectValidator) { + ((GameObjectValidator<G, A, R>) validator).validateGameObject(gameObject, errorCollector); + } + } + } + + /** + * Validate a set of arch objects. + * @param gameObjects ArchObjects to validate + * @param errorCollector Error collector to report errors to + */ + public void validate(@NotNull final G[] gameObjects, @NotNull final ErrorCollector<G, A, R> errorCollector) { + for (final G gameObject : gameObjects) { + validateGameObject(gameObject, errorCollector); + } + } + + /** + * Add a Validator that might to be queried. The Validator is queried for a + * KeyName and the preferences are queried whether this validator module + * should or shouldn't be active. + * @param validator to be queried + */ + public void addValidator(@NotNull final Validator validator) { + validators.add(validator); + } + + /** + * {@inheritDoc} + */ + @NotNull + @Override + public Iterator<Validator> iterator() { + return validators.iterator(); + } + +} // class DelegatingMapValidator Property changes on: trunk/model/src/app/net/sf/gridarta/model/validation/DelegatingMapValidator.java ___________________________________________________________________ Added: svn:mime-type + text/plain Added: svn:eol-style + LF Copied: trunk/model/src/app/net/sf/gridarta/model/validation/GameObjectValidator.java (from rev 8687, trunk/src/app/net/sf/gridarta/validation/GameObjectValidator.java) =================================================================== --- trunk/model/src/app/net/sf/gridarta/model/validation/GameObjectValidator.java (rev 0) +++ trunk/model/src/app/net/sf/gridarta/model/validation/GameObjectValidator.java 2010-10-08 17:38:12 UTC (rev 8694) @@ -0,0 +1,41 @@ +/* + * Gridarta MMORPG map editor for Crossfire, Daimonin and similar games. + * Copyright (C) 2000-2010 The Gridarta Developers. + * + * This program 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 2 of the License, or + * (at your option) any later version. + * + * This program is 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 General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +package net.sf.gridarta.model.validation; + +import net.sf.gridarta.model.archetype.Archetype; +import net.sf.gridarta.model.gameobject.GameObject; +import net.sf.gridarta.model.maparchobject.MapArchObject; +import org.jetbrains.annotations.NotNull; + +/** + * Interface for GameObject Validators. To create a GameObjectValidator, + * implement this interface. + * @author <a href="mailto:ch...@ri...">Christian Hujer</a> + */ +public interface GameObjectValidator<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>> extends Validator { + + /** + * Validate an arch object. + * @param gameObject GameObject to validate + * @param errorCollector Error collector to report errors to + */ + void validateGameObject(@NotNull G gameObject, @NotNull ErrorCollector<G, A, R> errorCollector); + +} // interface GameObjectValidator Property changes on: trunk/model/src/app/net/sf/gridarta/model/validation/GameObjectValidator.java ___________________________________________________________________ Added: svn:mime-type + text/plain Added: svn:eol-style + LF Copied: trunk/model/src/app/net/sf/gridarta/model/validation/MapValidator.java (from rev 8687, trunk/src/app/net/sf/gridarta/validation/MapValidator.java) =================================================================== --- trunk/model/src/app/net/sf/gridarta/model/validation/MapValidator.java (rev 0) +++ trunk/model/src/app/net/sf/gridarta/model/validation/MapValidator.java 2010-10-08 17:38:12 UTC (rev 8694) @@ -0,0 +1,42 @@ +/* + * Gridarta MMORPG map editor for Crossfire, Daimonin and similar games. + * Copyright (C) 2000-2010 The Gridarta Developers. + * + * This program 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 2 of the License, or + * (at your option) any later version. + * + * This program is 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 General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +package net.sf.gridarta.model.validation; + +import net.sf.gridarta.model.archetype.Archetype; +import net.sf.gridarta.model.gameobject.GameObject; +import net.sf.gridarta.model.maparchobject.MapArchObject; +import net.sf.gridarta.model.mapmodel.MapModel; +import org.jetbrains.annotations.NotNull; + +/** + * Interface for Map Validators. To create a MapValidator, implement this + * interface. + * @author <a href="mailto:ch...@ri...">Christian Hujer</a> + */ +public interface MapValidator<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>> extends Validator { + + /** + * Validate a map. + * @param mapModel Map to validate + * @param errorCollector Error collector to report errors to + */ + void validateMap(@NotNull MapModel<G, A, R> mapModel, @NotNull ErrorCollector<G, A, R> errorCollector); + +} // interface MapValidator Property changes on: trunk/model/src/app/net/sf/gridarta/model/validation/MapValidator.java ___________________________________________________________________ Added: svn:mime-type + text/plain Added: svn:eol-style + LF Copied: trunk/model/src/app/net/sf/gridarta/model/validation/NoSuchValidatorException.java (from rev 8687, trunk/src/app/net/sf/gridarta/validation/NoSuchValidatorException.java) =================================================================== --- trunk/model/src/app/net/sf/gridarta/model/validation/NoSuchValidatorException.java (rev 0) +++ trunk/model/src/app/net/sf/gridarta/model/validation/NoSuchValidatorException.java 2010-10-08 17:38:12 UTC (rev 8694) @@ -0,0 +1,52 @@ +/* + * Gridarta MMORPG map editor for Crossfire, Daimonin and similar games. + * Copyright (C) 2000-2010 The Gridarta Developers. + * + * This program 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 2 of the License, or + * (at your option) any later version. + * + * This program is 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 General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +package net.sf.gridarta.model.validation; + +import org.jetbrains.annotations.NotNull; + +/** + * Exception thrown if a map validator cannot be created. + * @author Andreas Kirschbaum + */ +public class NoSuchValidatorException extends Exception { + + /** + * The serial version UID. + */ + private static final long serialVersionUID = 1L; + + /** + * Creates a new instance. + * @param reason the reason why the map validator could not be created + */ + public NoSuchValidatorException(@NotNull final String reason) { + super(reason); + } + + /** + * Creates a new instance. + * @param reason the reason why the map validator could not be created + * @param cause the cause + */ + public NoSuchValidatorException(@NotNull final String reason, final Throwable cause) { + super(reason, cause); + } + +} // class NoSuchValidatorException Property changes on: trunk/model/src/app/net/sf/gridarta/model/validation/NoSuchValidatorException.java ___________________________________________________________________ Added: svn:mime-type + text/plain Added: svn:eol-style + LF Copied: trunk/model/src/app/net/sf/gridarta/model/validation/SquareValidator.java (from rev 8687, trunk/src/app/net/sf/gridarta/validation/SquareValidator.java) =================================================================== --- trunk/model/src/app/net/sf/gridarta/model/validation/SquareValidator.java (rev 0) +++ trunk/model/src/app/net/sf/gridarta/model/validation/SquareValidator.java 2010-10-08 17:38:12 UTC (rev 8694) @@ -0,0 +1,42 @@ +/* + * Gridarta MMORPG map editor for Crossfire, Daimonin and similar games. + * Copyright (C) 2000-2010 The Gridarta Developers. + * + * This program 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 2 of the License, or + * (at your option) any later version. + * + * This program is 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 General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +package net.sf.gridarta.model.validation; + +import net.sf.gridarta.model.archetype.Archetype; +import net.sf.gridarta.model.gameobject.GameObject; +import net.sf.gridarta.model.maparchobject.MapArchObject; +import net.sf.gridarta.model.mapmodel.MapSquare; +import org.jetbrains.annotations.NotNull; + +/** + * Interface for Square Validators. To create a SquareValidator, implement this + * interface. + * @author <a href="mailto:ch...@ri...">Christian Hujer</a> + */ +public interface SquareValidator<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>> extends Validator { + + /** + * Validate a map square. + * @param mapSquare Square to validate + * @param errorCollector Error collector to report errors to + */ + void validateSquare(@NotNull MapSquare<G, A, R> mapSquare, @NotNull ErrorCollector<G, A, R> errorCollector); + +} // interface SquareValidator Property changes on: trunk/model/src/app/net/sf/gridarta/model/validation/SquareValidator.java ___________________________________________________________________ Added: svn:mime-type + text/plain Added: svn:eol-style + LF Copied: trunk/model/src/app/net/sf/gridarta/model/validation/Validator.java (from rev 8687, trunk/src/app/net/sf/gridarta/validation/Validator.java) =================================================================== --- trunk/model/src/app/net/sf/gridarta/model/validation/Validator.java (rev 0) +++ trunk/model/src/app/net/sf/gridarta/model/validation/Validator.java 2010-10-08 17:38:12 UTC (rev 8694) @@ -0,0 +1,57 @@ +/* + * Gridarta MMORPG map editor for Crossfire, Daimonin and similar games. + * Copyright (C) 2000-2010 The Gridarta Developers. + * + * This program 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 2 of the License, or + * (at your option) any later version. + * + * This program is 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 General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +package net.sf.gridarta.model.validation; + +import org.jetbrains.annotations.NotNull; + +/** + * Super-interface for validators. + * @author <a href="mailto:ch...@ri...">Christian Hujer</a> + */ +public interface Validator { + + /** + * Get a Key that uniquely identifies this Validator. The key can then be + * used for purposes like i18n/l10n or preferences. + * @return key + */ + @NotNull + String getKey(); + + /** + * Set whether this Validator should be enabled. + * @param enabled <code>true</code> if this validator should be enabled, + * otherwise <code>false</code> + */ + void setEnabled(boolean enabled); + + /** + * Get whether this Validator is enabled. + * @return enabled + */ + boolean isEnabled(); + + /** + * Get whether this Validator should be enabled per default. + * @return defaultEnabled + */ + boolean isDefaultEnabled(); + +} // interface Validator Property changes on: trunk/model/src/app/net/sf/gridarta/model/validation/Validator.java ___________________________________________________________________ Added: svn:mime-type + text/plain Added: svn:eol-style + LF Copied: trunk/model/src/app/net/sf/gridarta/model/validation/ValidatorPreferences.java (from rev 8687, trunk/src/app/net/sf/gridarta/validation/ValidatorPreferences.java) =================================================================== --- trunk/model/src/app/net/sf/gridarta/model/validation/ValidatorPreferences.java (rev 0) +++ trunk/model/src/app/net/sf/gridarta/model/validation/ValidatorPreferences.java 2010-10-08 17:38:12 UTC (rev 8694) @@ -0,0 +1,45 @@ +/* + * Gridarta MMORPG map editor for Crossfire, Daimonin and similar games. + * Copyright (C) 2000-2010 The Gridarta Developers. + * + * This program 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 2 of the License, or + * (at your option) any later version. + * + * This program is 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 General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +package net.sf.gridarta.model.validation; + +import org.jetbrains.annotations.NotNull; + +/** + * Configuration parameters for {@link Validator Validators}. + * @author Andreas Kirschbaum + */ +public interface ValidatorPreferences { + + /** + * Loads the stored "enabled" attribute. + * @param key the validator's key + * @param defaultEnabled whether the validator is enabled by default + * @return whether the validator is enabled + */ + boolean loadEnabled(@NotNull String key, boolean defaultEnabled); + + /** + * Saves the "enabled" attribute. + * @param key the validator's key + * @param enabled the enabled state + */ + void saveEnabled(@NotNull String key, boolean enabled); + +} // interface ValidatorPreferences Property changes on: trunk/model/src/app/net/sf/gridarta/model/validation/ValidatorPreferences.java ___________________________________________________________________ Added: svn:mime-type + text/plain Added: svn:eol-style + LF Modified: trunk/model/src/app/net/sf/gridarta/model/validation/checks/AbstractShopSquareChecker.java =================================================================== --- trunk/src/app/net/sf/gridarta/validation/checks/AbstractShopSquareChecker.java 2010-10-07 18:42:08 UTC (rev 8687) +++ trunk/model/src/app/net/sf/gridarta/model/validation/checks/AbstractShopSquareChecker.java 2010-10-08 17:38:12 UTC (rev 8694) @@ -17,7 +17,7 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ -package net.sf.gridarta.validation.checks; +package net.sf.gridarta.model.validation.checks; import java.awt.Point; import net.sf.gridarta.model.archetype.Archetype; @@ -25,10 +25,10 @@ import net.sf.gridarta.model.maparchobject.MapArchObject; import net.sf.gridarta.model.mapmodel.MapModel; import net.sf.gridarta.model.match.GameObjectMatcher; +import net.sf.gridarta.model.validation.AbstractValidator; +import net.sf.gridarta.model.validation.MapValidator; +import net.sf.gridarta.model.validation.ValidatorPreferences; import net.sf.gridarta.utils.Size2D; -import net.sf.gridarta.validation.AbstractValidator; -import net.sf.gridarta.validation.MapValidator; -import net.sf.gridarta.validation.ValidatorPreferences; import org.jetbrains.annotations.NotNull; /** Modified: trunk/model/src/app/net/sf/gridarta/model/validation/checks/AttributeRangeChecker.java =================================================================== --- trunk/src/app/net/sf/gridarta/validation/checks/AttributeRangeChecker.java 2010-10-07 18:42:08 UTC (rev 8687) +++ trunk/model/src/app/net/sf/gridarta/model/validation/checks/AttributeRangeChecker.java 2010-10-08 17:38:12 UTC (rev 8694) @@ -17,7 +17,7 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ -package net.sf.gridarta.validation.checks; +package net.sf.gridarta.model.validation.checks; import java.util.HashMap; import java.util.IdentityHashMap; @@ -26,10 +26,10 @@ import net.sf.gridarta.model.gameobject.GameObject; import net.sf.gridarta.model.maparchobject.MapArchObject; import net.sf.gridarta.model.match.GameObjectMatcher; +import net.sf.gridarta.model.validation.AbstractValidator; import net.sf.gridarta.model.validation.ErrorCollector; -import net.sf.gridarta.validation.AbstractValidator; -import net.sf.gridarta.validation.GameObjectValidator; -import net.sf.gridarta.validation.ValidatorPreferences; +import net.sf.gridarta.model.validation.GameObjectValidator; +import net.sf.gridarta.model.validation.ValidatorPreferences; import org.jetbrains.annotations.NotNull; /** Deleted: trunk/model/src/app/net/sf/gridarta/model/validation/checks/BlockedMatrix.java =================================================================== --- trunk/src/app/net/sf/gridarta/validation/checks/BlockedMatrix.java 2010-10-07 18:42:08 UTC (rev 8687) +++ trunk/model/src/app/net/sf/gridarta/model/validation/checks/BlockedMatrix.java 2010-10-08 17:38:12 UTC (rev 8694) @@ -1,80 +0,0 @@ -/* - * Gridarta MMORPG map editor for Crossfire, Daimonin and similar games. - * Copyright (C) 2000-2010 The Gridarta Developers. - * - * This program 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 2 of the License, or - * (at your option) any later version. - * - * This program is 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 General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ - -package net.sf.gridarta.validation.checks; - -import java.awt.Point; -import net.sf.gridarta.model.archetype.Archetype; -import net.sf.gridarta.model.baseobject.BaseObject; -import net.sf.gridarta.model.gameobject.GameObject; -import net.sf.gridarta.model.maparchobject.MapArchObject; -import net.sf.gridarta.model.mapmodel.MapModel; -import net.sf.gridarta.utils.Size2D; -import org.jetbrains.annotations.NotNull; - -/** - * Determines whether a map square is blocked. - * @author Andreas Kirschbaum - */ -public class BlockedMatrix<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>> { - - /** - * The blocked grid of the currently processed map: <code>blocked[x][y]</code> - * is set if and only if the corresponding map square contains at least - * one object which has "no_pass" set. - */ - private final boolean[][] blocked; - - /** - * Creates a new instance. - * @param mapModel the map model to operate on - */ - public BlockedMatrix(@NotNull final MapModel<G, A, R> mapModel) { - final Size2D mapSize = mapModel.getMapArchObject().getMapSize(); - final int width = mapSize.getWidth(); - final int height = mapSize.getHeight(); - blocked = new boolean[width][height]; - final Point pos = new Point(); - for (pos.y = 0; pos.y < height; pos.y++) { - for (pos.x = 0; pos.x < width; pos.x++) { - for (final BaseObject<G, A, R, ?> gameObject : mapModel.getMapSquare(pos)) { - if (gameObject.getAttributeInt("no_pass") != 0) { - blocked[pos.x][pos.y] = true; - break; - } - } - } - } - } - - /** - * Returns whether a given location is blocked. - * @param x the x coordinate to check - * @param y the y coordinate to check - * @return whether the square is blocked - */ - public boolean isBlocked(final int x, final int y) { - try { - return blocked[x][y]; - } catch (final IndexOutOfBoundsException ignored) { - return true; - } - } - -} // class BlockedMatrix Copied: trunk/model/src/app/net/sf/gridarta/model/validation/checks/BlockedMatrix.java (from rev 8691, trunk/src/app/net/sf/gridarta/validation/checks/BlockedMatrix.java) ==============================================... [truncated message content] |
From: <aki...@us...> - 2010-10-08 07:42:02
|
Revision: 8693 http://gridarta.svn.sourceforge.net/gridarta/?rev=8693&view=rev Author: akirschbaum Date: 2010-10-08 07:41:55 +0000 (Fri, 08 Oct 2010) Log Message: ----------- Move ConnectionUnknownError to correct package. Modified Paths: -------------- trunk/src/app/net/sf/gridarta/validation/checks/ConnectionChecker.java Added Paths: ----------- trunk/src/app/net/sf/gridarta/model/validation/ trunk/src/app/net/sf/gridarta/model/validation/errors/ trunk/src/app/net/sf/gridarta/model/validation/errors/ConnectionUnknownError.java Removed Paths: ------------- trunk/src/app/net/sf/gridarta/validation/checks/ConnectionUnknownError.java Copied: trunk/src/app/net/sf/gridarta/model/validation/errors/ConnectionUnknownError.java (from rev 8687, trunk/src/app/net/sf/gridarta/validation/checks/ConnectionUnknownError.java) =================================================================== --- trunk/src/app/net/sf/gridarta/model/validation/errors/ConnectionUnknownError.java (rev 0) +++ trunk/src/app/net/sf/gridarta/model/validation/errors/ConnectionUnknownError.java 2010-10-08 07:41:55 UTC (rev 8693) @@ -0,0 +1,48 @@ +/* + * Gridarta MMORPG map editor for Crossfire, Daimonin and similar games. + * Copyright (C) 2000-2010 The Gridarta Developers. + * + * This program 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 2 of the License, or + * (at your option) any later version. + * + * This program is 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 General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +package net.sf.gridarta.model.validation.errors; + +import net.sf.gridarta.model.archetype.Archetype; +import net.sf.gridarta.model.gameobject.GameObject; +import net.sf.gridarta.model.maparchobject.MapArchObject; +import net.sf.gridarta.model.validation.errors.GameObjectValidationError; +import org.jetbrains.annotations.NotNull; + +/** + * Validation error for a connected object that is not supposed to be + * connected. + * @author Andreas Kirschbaum + */ +public class ConnectionUnknownError<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>> extends GameObjectValidationError<G, A, R> { + + /** + * The serial version UID. + */ + private static final long serialVersionUID = 1L; + + /** + * Create a new instance. + * @param gameObject The erroneous game object. + */ + protected ConnectionUnknownError(@NotNull final G gameObject) { + super(gameObject); + } + +} // class ConnectionUnknownError Property changes on: trunk/src/app/net/sf/gridarta/model/validation/errors/ConnectionUnknownError.java ___________________________________________________________________ Added: svn:mime-type + text/plain Added: svn:eol-style + LF Modified: trunk/src/app/net/sf/gridarta/validation/checks/ConnectionChecker.java =================================================================== --- trunk/src/app/net/sf/gridarta/validation/checks/ConnectionChecker.java 2010-10-07 19:19:18 UTC (rev 8692) +++ trunk/src/app/net/sf/gridarta/validation/checks/ConnectionChecker.java 2010-10-08 07:41:55 UTC (rev 8693) @@ -31,6 +31,7 @@ import net.sf.gridarta.model.mapmodel.MapModel; import net.sf.gridarta.model.match.GameObjectMatcher; import net.sf.gridarta.model.validation.ErrorCollector; +import net.sf.gridarta.model.validation.errors.ConnectionUnknownError; import net.sf.gridarta.model.validation.errors.ConnectionWithoutSinksError; import net.sf.gridarta.model.validation.errors.ConnectionWithoutSourcesError; import net.sf.gridarta.validation.AbstractValidator; Deleted: trunk/src/app/net/sf/gridarta/validation/checks/ConnectionUnknownError.java =================================================================== --- trunk/src/app/net/sf/gridarta/validation/checks/ConnectionUnknownError.java 2010-10-07 19:19:18 UTC (rev 8692) +++ trunk/src/app/net/sf/gridarta/validation/checks/ConnectionUnknownError.java 2010-10-08 07:41:55 UTC (rev 8693) @@ -1,48 +0,0 @@ -/* - * Gridarta MMORPG map editor for Crossfire, Daimonin and similar games. - * Copyright (C) 2000-2010 The Gridarta Developers. - * - * This program 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 2 of the License, or - * (at your option) any later version. - * - * This program is 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 General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ - -package net.sf.gridarta.validation.checks; - -import net.sf.gridarta.model.archetype.Archetype; -import net.sf.gridarta.model.gameobject.GameObject; -import net.sf.gridarta.model.maparchobject.MapArchObject; -import net.sf.gridarta.model.validation.errors.GameObjectValidationError; -import org.jetbrains.annotations.NotNull; - -/** - * Validation error for a connected object that is not supposed to be - * connected. - * @author Andreas Kirschbaum - */ -public class ConnectionUnknownError<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>> extends GameObjectValidationError<G, A, R> { - - /** - * The serial version UID. - */ - private static final long serialVersionUID = 1L; - - /** - * Create a new instance. - * @param gameObject The erroneous game object. - */ - protected ConnectionUnknownError(@NotNull final G gameObject) { - super(gameObject); - } - -} // class ConnectionUnknownError This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2010-10-07 19:19:25
|
Revision: 8692 http://gridarta.svn.sourceforge.net/gridarta/?rev=8692&view=rev Author: akirschbaum Date: 2010-10-07 19:19:18 +0000 (Thu, 07 Oct 2010) Log Message: ----------- Remove BaseObject.isArchetype(). Modified Paths: -------------- trunk/atrinik/src/app/net/sf/gridarta/var/atrinik/model/gameobject/GameObject.java trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/model/gameobject/GameObject.java trunk/daimonin/src/app/net/sf/gridarta/var/daimonin/model/gameobject/GameObject.java trunk/model/src/app/net/sf/gridarta/model/archetype/AbstractArchetype.java trunk/model/src/app/net/sf/gridarta/model/baseobject/BaseObject.java trunk/model/src/test/net/sf/gridarta/model/gameobject/TestGameObject.java Modified: trunk/atrinik/src/app/net/sf/gridarta/var/atrinik/model/gameobject/GameObject.java =================================================================== --- trunk/atrinik/src/app/net/sf/gridarta/var/atrinik/model/gameobject/GameObject.java 2010-10-07 19:17:02 UTC (rev 8691) +++ trunk/atrinik/src/app/net/sf/gridarta/var/atrinik/model/gameobject/GameObject.java 2010-10-07 19:19:18 UTC (rev 8692) @@ -128,12 +128,4 @@ return false; } - /** - * {@inheritDoc} - */ - @Override - public boolean isArchetype() { - return false; - } - } // class GameObject Modified: trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/model/gameobject/GameObject.java =================================================================== --- trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/model/gameobject/GameObject.java 2010-10-07 19:17:02 UTC (rev 8691) +++ trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/model/gameobject/GameObject.java 2010-10-07 19:19:18 UTC (rev 8692) @@ -108,14 +108,6 @@ * {@inheritDoc} */ @Override - public boolean isArchetype() { - return false; - } - - /** - * {@inheritDoc} - */ - @Override public boolean isDefaultGameObject() { if (!super.isDefaultGameObject()) { return false; Modified: trunk/daimonin/src/app/net/sf/gridarta/var/daimonin/model/gameobject/GameObject.java =================================================================== --- trunk/daimonin/src/app/net/sf/gridarta/var/daimonin/model/gameobject/GameObject.java 2010-10-07 19:17:02 UTC (rev 8691) +++ trunk/daimonin/src/app/net/sf/gridarta/var/daimonin/model/gameobject/GameObject.java 2010-10-07 19:19:18 UTC (rev 8692) @@ -128,12 +128,4 @@ return false; } - /** - * {@inheritDoc} - */ - @Override - public boolean isArchetype() { - return false; - } - } // class GameObject Modified: trunk/model/src/app/net/sf/gridarta/model/archetype/AbstractArchetype.java =================================================================== --- trunk/model/src/app/net/sf/gridarta/model/archetype/AbstractArchetype.java 2010-10-07 19:17:02 UTC (rev 8691) +++ trunk/model/src/app/net/sf/gridarta/model/archetype/AbstractArchetype.java 2010-10-07 19:19:18 UTC (rev 8692) @@ -177,14 +177,6 @@ /** * {@inheritDoc} */ - @Override - public boolean isArchetype() { - return true; - } - - /** - * {@inheritDoc} - */ @NotNull @Override @SuppressWarnings({ "unchecked" }) Modified: trunk/model/src/app/net/sf/gridarta/model/baseobject/BaseObject.java =================================================================== --- trunk/model/src/app/net/sf/gridarta/model/baseobject/BaseObject.java 2010-10-07 19:17:02 UTC (rev 8691) +++ trunk/model/src/app/net/sf/gridarta/model/baseobject/BaseObject.java 2010-10-07 19:19:18 UTC (rev 8692) @@ -503,15 +503,6 @@ ImageIcon getNormalImage(); /** - * Returns whether this base object is an {@link Archetype}. - * @return <code>true</code> if this base object is an archetype, - * <code>false</code> if it is a game object - * @see Archetype#isArtifact() - */ - @Deprecated - boolean isArchetype(); - - /** * Creates a clone of this base object. */ @NotNull Modified: trunk/model/src/test/net/sf/gridarta/model/gameobject/TestGameObject.java =================================================================== --- trunk/model/src/test/net/sf/gridarta/model/gameobject/TestGameObject.java 2010-10-07 19:17:02 UTC (rev 8691) +++ trunk/model/src/test/net/sf/gridarta/model/gameobject/TestGameObject.java 2010-10-07 19:19:18 UTC (rev 8692) @@ -87,14 +87,6 @@ /** * {@inheritDoc} */ - @Override - public boolean isArchetype() { - return false; - } - - /** - * {@inheritDoc} - */ @NotNull @Override public TestGameObject clone() { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2010-10-07 19:17:13
|
Revision: 8691 http://gridarta.svn.sourceforge.net/gridarta/?rev=8691&view=rev Author: akirschbaum Date: 2010-10-07 19:17:02 +0000 (Thu, 07 Oct 2010) Log Message: ----------- Whitespace changes. Modified Paths: -------------- trunk/atrinik/resource/resource/HelpFiles/faq.html trunk/atrinik/resource/resource/HelpFiles/guide.html trunk/atrinik/resource/resource/HelpFiles/tut_loading.html trunk/atrinik/src/app/net/sf/gridarta/var/atrinik/gui/mappropertiesdialog/MapPropertiesDialog.java trunk/crossfire/resource/resource/HelpFiles/guide.html trunk/crossfire/resource/resource/HelpFiles/tut_loading.html trunk/crossfire/resource/resource/HelpFiles/tut_objects.html trunk/crossfire/resource/resource/conf/types.xml trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/gui/map/renderer/AbstractFlatMapRenderer.java trunk/crossfire/src/test/net/sf/gridarta/var/crossfire/model/gameobject/PropagateElevationTest.java trunk/daimonin/resource/resource/HelpFiles/faq.html trunk/daimonin/resource/resource/HelpFiles/guide.html trunk/daimonin/resource/resource/HelpFiles/tut_loading.html trunk/model/src/app/net/sf/gridarta/model/archetype/AttributeListUtils.java trunk/model/src/app/net/sf/gridarta/model/archetypetype/ArchetypeTypeSet.java trunk/model/src/app/net/sf/gridarta/model/autojoin/AutojoinLists.java trunk/model/src/app/net/sf/gridarta/model/baseobject/AbstractBaseObject.java trunk/model/src/app/net/sf/gridarta/model/data/AbstractNamedObject.java trunk/model/src/app/net/sf/gridarta/model/data/NamedObject.java trunk/model/src/app/net/sf/gridarta/model/direction/Direction.java trunk/model/src/app/net/sf/gridarta/model/face/FaceObjectProviders.java trunk/model/src/app/net/sf/gridarta/model/face/package.html trunk/model/src/app/net/sf/gridarta/model/match/NamedGameObjectMatcher.java trunk/model/src/app/net/sf/gridarta/model/match/SetEnabledAction.java trunk/model/src/app/net/sf/gridarta/model/match/package.html trunk/model/src/app/net/sf/gridarta/model/treasurelist/TreasureListsParser.java trunk/model/src/app/net/sf/gridarta/model/treasurelist/TreasureObj.java trunk/model/src/app/net/sf/gridarta/model/validation/ValidationErrorComparator.java trunk/model/src/app/net/sf/gridarta/model/validation/package.html trunk/model/src/test/net/sf/gridarta/model/gameobject/GameObjectFactoryTest.java trunk/model/src/test/net/sf/gridarta/model/mapmodel/DefaultMapModelTest.java trunk/src/app/net/sf/gridarta/gui/autovalidator/AutoValidator.java trunk/src/app/net/sf/gridarta/gui/bookmarks/BookmarkActions.java trunk/src/app/net/sf/gridarta/gui/data/NamedObjectsUtils.java trunk/src/app/net/sf/gridarta/gui/map/mapactions/NoExitPathException.java trunk/src/app/net/sf/gridarta/gui/map/mapview/MapViewBasic.java trunk/src/app/net/sf/gridarta/gui/mapfiles/MapFolderTreeActions.java trunk/src/app/net/sf/gridarta/gui/misc/StatusBar.java trunk/src/app/net/sf/gridarta/gui/newmap/AbstractNewMapDialog.java trunk/src/app/net/sf/gridarta/gui/pickmapchooser/PickmapChooserControl.java trunk/src/app/net/sf/gridarta/gui/pickmapchooser/PickmapChooserModel.java trunk/src/app/net/sf/gridarta/gui/script/parameter/ArchComboBoxModel.java trunk/src/app/net/sf/gridarta/mapfiles/MapFolderTree.java trunk/src/app/net/sf/gridarta/validation/checks/BlockedMatrix.java trunk/src/app/net/sf/gridarta/validation/checks/BlockedSquareChecker.java trunk/src/doc/dev/codeStyle.xhtml trunk/src/doc/dev/howToHelp.xhtml trunk/src/doc/dev/start.xhtml trunk/src/doc/dev/transactions.xhtml trunk/src/doc/dev/typeParameters.xhtml trunk/src/doc/faq.xhtml trunk/src/doc/hist/MergingEditors.xhtml trunk/src/doc/start.xhtml trunk/src/doc/subversion.xhtml trunk/src/test/net/sf/gridarta/gui/copybuffer/CopyBufferTest.java trunk/src/test/net/sf/gridarta/gui/selectedsquare/SelectedSquareActionsTest.java trunk/textedit/src/app/net/sf/gridarta/textedit/scripteditor/CFPythonPopup.java trunk/textedit/src/app/net/sf/gridarta/textedit/textarea/tokenmarker/LineInfo.java trunk/utils/src/app/net/sf/gridarta/utils/ActionBuilderUtils.java Modified: trunk/atrinik/resource/resource/HelpFiles/faq.html =================================================================== --- trunk/atrinik/resource/resource/HelpFiles/faq.html 2010-10-07 19:11:05 UTC (rev 8690) +++ trunk/atrinik/resource/resource/HelpFiles/faq.html 2010-10-07 19:17:02 UTC (rev 8691) @@ -55,6 +55,7 @@ <P><B>The editor has successfully loaded the arches, but all the images are missing. WTF?</B></P> + <UL> <LI><P>If you are using up-to-date Daimonin arches, these support multiple image sets. Select menu "File->Options" and make sure the entry "Use Modified: trunk/atrinik/resource/resource/HelpFiles/guide.html =================================================================== --- trunk/atrinik/resource/resource/HelpFiles/guide.html 2010-10-07 19:11:05 UTC (rev 8690) +++ trunk/atrinik/resource/resource/HelpFiles/guide.html 2010-10-07 19:17:02 UTC (rev 8691) @@ -41,6 +41,7 @@ </table> <H2 align=center>Guidelines for map-layout and -concept:</H2> + <UL> <LI>Pure hack'n'slash maps are boring. <B>Your maps should contain a storyline</B>, or at least a "theme". Put NPCs (non-player-characters), @@ -77,6 +78,7 @@ certain difficulty level dominates. Just try not to overdo it. </UL> <H2 align=center>Guidlines for creating Artifacts:</H2> + <UL> <LI><B>Don't rely on artifacts to make your maps interesting for players.</B> Modified: trunk/atrinik/resource/resource/HelpFiles/tut_loading.html =================================================================== --- trunk/atrinik/resource/resource/HelpFiles/tut_loading.html 2010-10-07 19:11:05 UTC (rev 8690) +++ trunk/atrinik/resource/resource/HelpFiles/tut_loading.html 2010-10-07 19:17:02 UTC (rev 8691) @@ -34,6 +34,7 @@ are vital for the editor and you can't work without them.</P> <P>It is very important to know that there are two ways to load the Arches: + <ol> <LI><P>Load it from collected archive files. These should already be included in your editor and per default, these get loaded. Hence, if you Modified: trunk/atrinik/src/app/net/sf/gridarta/var/atrinik/gui/mappropertiesdialog/MapPropertiesDialog.java =================================================================== --- trunk/atrinik/src/app/net/sf/gridarta/var/atrinik/gui/mappropertiesdialog/MapPropertiesDialog.java 2010-10-07 19:11:05 UTC (rev 8690) +++ trunk/atrinik/src/app/net/sf/gridarta/var/atrinik/gui/mappropertiesdialog/MapPropertiesDialog.java 2010-10-07 19:17:02 UTC (rev 8691) @@ -596,8 +596,8 @@ } /** - * Creates a checkbox-line, similar to {@link - * #createPanelLine(JTextField, int, int, String)}. + * Creates a checkbox-line, similar to {@link #createPanelLine(JTextField, + * int, int, String)}. * @param checkBox the checkbox * @param state the initial state * @param labelKey the (attribute-)label key Modified: trunk/crossfire/resource/resource/HelpFiles/guide.html =================================================================== --- trunk/crossfire/resource/resource/HelpFiles/guide.html 2010-10-07 19:11:05 UTC (rev 8690) +++ trunk/crossfire/resource/resource/HelpFiles/guide.html 2010-10-07 19:17:02 UTC (rev 8691) @@ -45,6 +45,7 @@ </table> <H2 align=center>Guidelines for map-layout and -concept:</H2> + <UL> <LI>Pure hack'n'slash maps are boring. <B>Your maps should contain a storyline</B>, or at least a "theme". Put NPCs (non-player-characters), @@ -83,6 +84,7 @@ enter which keeps out too weak players. </UL> <H2 align=center>Guidlines for creating artifacts:</H2> + <UL> <LI><B>Don't rely on artifacts to make your maps interesting for players.</B> Modified: trunk/crossfire/resource/resource/HelpFiles/tut_loading.html =================================================================== --- trunk/crossfire/resource/resource/HelpFiles/tut_loading.html 2010-10-07 19:11:05 UTC (rev 8690) +++ trunk/crossfire/resource/resource/HelpFiles/tut_loading.html 2010-10-07 19:17:02 UTC (rev 8691) @@ -35,6 +35,7 @@ archetypes are vital for the editor and you can't work without them.</P> <P>It is very important to know that there are two ways to load the archetypes: + <ol> <LI><P>Load it from collected archive files. These are included in your Modified: trunk/crossfire/resource/resource/HelpFiles/tut_objects.html =================================================================== --- trunk/crossfire/resource/resource/HelpFiles/tut_objects.html 2010-10-07 19:11:05 UTC (rev 8690) +++ trunk/crossfire/resource/resource/HelpFiles/tut_objects.html 2010-10-07 19:17:02 UTC (rev 8691) @@ -38,6 +38,7 @@ to change the attributes of an object, you have two options:</p> <p> + <ol> <li><p><b>Use the convenient attribute interface</b></p> Modified: trunk/crossfire/resource/resource/conf/types.xml =================================================================== --- trunk/crossfire/resource/resource/conf/types.xml 2010-10-07 19:11:05 UTC (rev 8690) +++ trunk/crossfire/resource/resource/conf/types.xml 2010-10-07 19:17:02 UTC (rev 8691) @@ -496,15 +496,16 @@ leave the default in place. </attribute> <attribute arch="price_adjustment" editor="price adjustment" type="float"> - If set, this is the buy and sell price adjustment ratio for the item. + If set, this is the buy and sell price adjustment ratio for the + item. </attribute> <attribute arch="price_adjustment_buy" editor="price adjustment for buying" type="float"> - If set, this is the adjustment ratio when buying the item. Ignored if - <price> adjustment is set. + If set, this is the adjustment ratio when buying the item. Ignored + if <price> adjustment is set. </attribute> <attribute arch="price_adjustment_sell" editor="price adjustment for selling" type="float"> - If set, this is the adjustment ratio when selling the item. Ignored if - <price> adjustment is set. + If set, this is the adjustment ratio when selling the item. Ignored + if <price> adjustment is set. </attribute> </default_type> @@ -589,8 +590,8 @@ the altar is activated. </attribute> <attribute arch="accept_alive" editor="accept alive things" type="bool"> - If set, this altar will accept living things as sacrifice. - Else they will be ignored. + If set, this altar will accept living things as sacrifice. Else they + will be ignored. </attribute> </type> @@ -668,8 +669,8 @@ the altar is activated. </attribute> <attribute arch="accept_alive" editor="accept alive things" type="bool"> - If set, this altar will accept living things as sacrifice. - Else they will be ignored. + If set, this altar will accept living things as sacrifice. Else they + will be ignored. </attribute> </type> @@ -1732,8 +1733,9 @@ stomach and gain a little health. ]]> </description> <attribute arch="food" editor="food points" type="int" min="0" max="32767"> - The player's stomach will get filled with this amount of food points. - The player's health will increase by <food points>/50 hp. + The player's stomach will get filled with this amount of food + points. The player's health will increase by <food points>/50 + hp. </attribute> <attribute arch="startequip" editor="godgiven item" type="bool"> A godgiven item vanishes as soon as the player drops it to the @@ -1873,9 +1875,8 @@ <attribute arch_begin="msg" arch_end="endmsg" editor="exit message" type="text"> If set, this message will be displayed to the player when he applies the exit. This is quite useful to throw in some "role-play feeling": - "As you enter the dark cave you hear the sound of rustling - dragon scales...". Well, my English is poor, but you get the point. - =) + "As you enter the dark cave you hear the sound of rustling dragon + scales...". Well, my English is poor, but you get the point. =) </attribute> <attribute arch="unique" editor="unique destination" type="bool"> This flag defines the destined map as "personal unique map". If set, @@ -1917,8 +1918,9 @@ out on the reward completely. ]]> </use> <attribute arch="food" editor="food points" type="int" min="0" max="32767"> - The player's stomach will get filled with this amount of food points. - The player's health will increase by <food points>/50 hp. + The player's stomach will get filled with this amount of food + points. The player's health will increase by <food points>/50 + hp. </attribute> <attribute arch="level" editor="flesh level" type="int" min="-32768" max="32767" check_min="1" check_max="115"> The <flesh level> is not visible to the players and it affects @@ -2199,8 +2201,9 @@ stomach and gain a little health. ]]> </description> <attribute arch="food" editor="food points" type="int" min="0" max="32767"> - The player's stomach will get filled with this amount of food points. - The player's health will increase by <food points>/50 hp. + The player's stomach will get filled with this amount of food + points. The player's health will increase by <food points>/50 + hp. </attribute> <attribute arch="startequip" editor="godgiven item" type="bool"> A godgiven item vanishes as soon as the player drops it to the @@ -3113,9 +3116,9 @@ <template generation> and put other monsters in the inventory. </attribute> <attribute arch="generator_radius" editor="multiply radius" type="int" min="0" max="10"> - If <multiply> is enabled, this is the radius, in square, - in which the generator will try to put a new monster. Default value - is 1. + If <multiply> is enabled, this is the radius, in square, in + which the generator will try to put a new monster. Default value is + 1. </attribute> <attribute arch="generator_limit" editor="multiply limit" type="int"> If <multiply> is enabled, this limits how many <breed @@ -3123,12 +3126,12 @@ is destroyed. </attribute> <attribute arch="generator_max_map" editor="multiply map limit" type="int"> - If <multiply> is enabled, this limits how many alive monsters at - the same time will be on the map. + If <multiply> is enabled, this limits how many alive monsters + at the same time will be on the map. </attribute> <attribute arch="generator_code" editor="multiply map code" type="string"> - If <multiply map limit> is set, this groups generators for counting - purposes. If not set, defaults to the generator's name. + If <multiply map limit> is set, this groups generators for + counting purposes. If not set, defaults to the generator's name. </attribute> <attribute arch="maxsp" editor="multiply speed" type="int" min="0" max="32767"> If <multiply> is enabled and <friendly> is not enabled, @@ -4720,43 +4723,48 @@ these types are of a more generic nature than others. </attribute> <attribute arch="level" editor="spell level" type="int" min="-32768" max="32767" check_min="1" check_max="115"> - The level, without taking into account spellpath attenuation, required to cast this spell. + The level, without taking into account spellpath attenuation, + required to cast this spell. </attribute> <attribute arch="path_attuned" editor="attuned paths" type="bitmask_spellpath"> - Spellpath for this spell. A player needs to not be denied this path to cast the spell. + Spellpath for this spell. A player needs to not be denied this path + to cast the spell. </attribute> <attribute arch="casting_time" editor="casting time" type="int"> - If the server uses spell casting times, this is the base number of ticks required - for casting this spell. + If the server uses spell casting times, this is the base number of + ticks required for casting this spell. </attribute> <attribute arch="duration" editor="duration" type="int"> - Base spell effect duration. The actual duration will depend on the effective - casting level. + Base spell effect duration. The actual duration will depend on the + effective casting level. </attribute> <attribute arch="other_arch" editor="create object" type="string"> - For spells creating or launching things, the archetype to use. + For spells creating or launching things, the archetype to use. </attribute> <attribute arch="sp" editor="spellpoint cost" type="int" min="0" max="32767"> - How many base spell points this spell costs to cast. - The effective cost can be based on the casting level, depending on server settings. + How many base spell points this spell costs to cast. The effective + cost can be based on the casting level, depending on server + settings. </attribute> <attribute arch="maxsp" editor="double sp cost per level" type="int" min="0" max="32767"> - If non zero, the spellpoint cost will increase <spellpoint cost> per this value levels. + If non zero, the spellpoint cost will increase <spellpoint cost> + per this value levels. </attribute> <attribute arch="grace" editor="cost grace" type="int" min="0" max="32767"> - How many base grace points this spell costs to cast. - The effective cost can be based on the casting level, depending on server settings. + How many base grace points this spell costs to cast. The effective + cost can be based on the casting level, depending on server + settings. </attribute> <attribute arch="maxgrace" editor="double grace cost per level" type="int" min="0" max="32767"> - If non zero, the grace cost will increase <grace cost> per this value levels. + If non zero, the grace cost will increase <grace cost> per + this value levels. </attribute> <attribute arch="casting_requirements" editor="consumed items" type="string"> - If set, this is a comma-separated list of items the spell will require and consume to - be cast by players and monsters. - The format is '<optional count> item's name, etc.'. - Examples: - - 'water' will make the spell use one water per casting. - - ' 2 diamonds' will make the spell use 2 diamonds per casting. + If set, this is a comma-separated list of items the spell will + require and consume to be cast by players and monsters. The format + is '<optional count> item's name, etc.'. Examples: - 'water' + will make the spell use one water per casting. - ' 2 diamonds' will + make the spell use 2 diamonds per casting. </attribute> <attribute arch="anim_suffix" editor="animation suffix" type="string"> If set, will apply a compound animation to the player or monster @@ -5580,8 +5588,8 @@ of races, only players of this race will be able to apply the item. </attribute> <attribute arch="anim_suffix" editor="animation suffix" type="string"> - If set, will apply a compound animation to the player or monster when - attacking with this weapon. + If set, will apply a compound animation to the player or monster + when attacking with this weapon. </attribute> <section name="resistance"> Modified: trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/gui/map/renderer/AbstractFlatMapRenderer.java =================================================================== --- trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/gui/map/renderer/AbstractFlatMapRenderer.java 2010-10-07 19:11:05 UTC (rev 8690) +++ trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/gui/map/renderer/AbstractFlatMapRenderer.java 2010-10-07 19:17:02 UTC (rev 8691) @@ -64,7 +64,8 @@ private static final long serialVersionUID = 1L; /** - * The offset to map borders (32 for std. rectangular maps, 0 for pickmaps). + * The offset to map borders (32 for std. rectangular maps, 0 for + * pickmaps). * @serial */ @NotNull Modified: trunk/crossfire/src/test/net/sf/gridarta/var/crossfire/model/gameobject/PropagateElevationTest.java =================================================================== --- trunk/crossfire/src/test/net/sf/gridarta/var/crossfire/model/gameobject/PropagateElevationTest.java 2010-10-07 19:11:05 UTC (rev 8690) +++ trunk/crossfire/src/test/net/sf/gridarta/var/crossfire/model/gameobject/PropagateElevationTest.java 2010-10-07 19:17:02 UTC (rev 8691) @@ -35,8 +35,7 @@ public class PropagateElevationTest { /** - * Checks that {@link - * GameObjectContainer#addFirst(net.sf.gridarta.model.gameobject.GameObject)} + * Checks that {@link GameObjectContainer#addFirst(net.sf.gridarta.model.gameobject.GameObject)} * does work correctly. */ @Test @@ -58,8 +57,7 @@ } /** - * Checks that {@link - * GameObjectContainer#addLast(net.sf.gridarta.model.gameobject.GameObject)} + * Checks that {@link GameObjectContainer#addLast(net.sf.gridarta.model.gameobject.GameObject)} * does work correctly. */ @Test @@ -81,8 +79,7 @@ } /** - * Checks that {@link - * GameObjectContainer#insertBefore(net.sf.gridarta.model.gameobject.GameObject, + * Checks that {@link GameObjectContainer#insertBefore(net.sf.gridarta.model.gameobject.GameObject, * GameObject)} does work correctly. */ @Test @@ -113,8 +110,7 @@ } /** - * Checks that {@link - * GameObjectContainer#insertAfter(net.sf.gridarta.model.gameobject.GameObject, + * Checks that {@link GameObjectContainer#insertAfter(net.sf.gridarta.model.gameobject.GameObject, * GameObject)} does work correctly. */ @Test @@ -145,8 +141,7 @@ } /** - * Checks that {@link - * GameObjectContainer#moveBottom(net.sf.gridarta.model.gameobject.GameObject)} + * Checks that {@link GameObjectContainer#moveBottom(net.sf.gridarta.model.gameobject.GameObject)} * does work correctly. */ @Test @@ -162,8 +157,7 @@ } /** - * Checks that {@link - * GameObjectContainer#moveDown(net.sf.gridarta.model.gameobject.GameObject)} + * Checks that {@link GameObjectContainer#moveDown(net.sf.gridarta.model.gameobject.GameObject)} * does work correctly. */ @Test @@ -179,8 +173,7 @@ } /** - * Checks that {@link - * GameObjectContainer#moveUp(net.sf.gridarta.model.gameobject.GameObject)} + * Checks that {@link GameObjectContainer#moveUp(net.sf.gridarta.model.gameobject.GameObject)} * does work correctly. */ @Test @@ -196,8 +189,7 @@ } /** - * Checks that {@link - * GameObjectContainer#moveTop(net.sf.gridarta.model.gameobject.GameObject)} + * Checks that {@link GameObjectContainer#moveTop(net.sf.gridarta.model.gameobject.GameObject)} * does work correctly. */ @Test @@ -213,8 +205,7 @@ } /** - * Checks that {@link - * GameObjectContainer#remove(net.sf.gridarta.model.gameobject.GameObject)} + * Checks that {@link GameObjectContainer#remove(net.sf.gridarta.model.gameobject.GameObject)} * does work correctly. */ @Test @@ -232,8 +223,7 @@ } /** - * Checks that {@link - * GameObjectContainer#replace(net.sf.gridarta.model.gameobject.GameObject, + * Checks that {@link GameObjectContainer#replace(net.sf.gridarta.model.gameobject.GameObject, * GameObject)} does work correctly. */ @Test Modified: trunk/daimonin/resource/resource/HelpFiles/faq.html =================================================================== --- trunk/daimonin/resource/resource/HelpFiles/faq.html 2010-10-07 19:11:05 UTC (rev 8690) +++ trunk/daimonin/resource/resource/HelpFiles/faq.html 2010-10-07 19:17:02 UTC (rev 8691) @@ -55,6 +55,7 @@ <P><B>The editor has successfully loaded the arches, but all the images are missing. WTF?</B></P> + <UL> <LI><P>If you are using up-to-date Daimonin arches, these support multiple image sets. Select menu "File->Options" and make sure the entry "Use Modified: trunk/daimonin/resource/resource/HelpFiles/guide.html =================================================================== --- trunk/daimonin/resource/resource/HelpFiles/guide.html 2010-10-07 19:11:05 UTC (rev 8690) +++ trunk/daimonin/resource/resource/HelpFiles/guide.html 2010-10-07 19:17:02 UTC (rev 8691) @@ -41,6 +41,7 @@ </table> <H2 align=center>Guidelines for map-layout and -concept:</H2> + <UL> <LI>Pure hack'n'slash maps are boring. <B>Your maps should contain a storyline</B>, or at least a "theme". Put NPCs (non-player-characters), @@ -77,6 +78,7 @@ certain difficulty level dominates. Just try not to overdo it. </UL> <H2 align=center>Guidlines for creating Artifacts:</H2> + <UL> <LI><B>Don't rely on artifacts to make your maps interesting for players.</B> Modified: trunk/daimonin/resource/resource/HelpFiles/tut_loading.html =================================================================== --- trunk/daimonin/resource/resource/HelpFiles/tut_loading.html 2010-10-07 19:11:05 UTC (rev 8690) +++ trunk/daimonin/resource/resource/HelpFiles/tut_loading.html 2010-10-07 19:17:02 UTC (rev 8691) @@ -34,6 +34,7 @@ are vital for the editor and you can't work without them.</P> <P>It is very important to know that there are two ways to load the Arches: + <ol> <LI><P>Load it from collected archive files. These should already be included in your editor and per default, these get loaded. Hence, if you Modified: trunk/model/src/app/net/sf/gridarta/model/archetype/AttributeListUtils.java =================================================================== --- trunk/model/src/app/net/sf/gridarta/model/archetype/AttributeListUtils.java 2010-10-07 19:11:05 UTC (rev 8690) +++ trunk/model/src/app/net/sf/gridarta/model/archetype/AttributeListUtils.java 2010-10-07 19:17:02 UTC (rev 8691) @@ -87,7 +87,7 @@ * @param attributes the attributes * @param archetype the game object * @return all lines from <code>attributes</code> that don't occur in this - * game object + * game object */ @NotNull public static String diffArchTextValues(@NotNull final BaseObject<?, ?, ?, ?> archetype, @NotNull final CharSequence attributes) { Modified: trunk/model/src/app/net/sf/gridarta/model/archetypetype/ArchetypeTypeSet.java =================================================================== --- trunk/model/src/app/net/sf/gridarta/model/archetypetype/ArchetypeTypeSet.java 2010-10-07 19:11:05 UTC (rev 8690) +++ trunk/model/src/app/net/sf/gridarta/model/archetypetype/ArchetypeTypeSet.java 2010-10-07 19:17:02 UTC (rev 8691) @@ -227,6 +227,7 @@ public String getDisplayName(@NotNull final BaseObject<?, ?, ?, ?> baseObject) { return getArchetypeType(baseObject).getDisplayName(baseObject); } + /** * Returns an {@link ArchetypeType} by type name. * @param typeName the type name to look up Modified: trunk/model/src/app/net/sf/gridarta/model/autojoin/AutojoinLists.java =================================================================== --- trunk/model/src/app/net/sf/gridarta/model/autojoin/AutojoinLists.java 2010-10-07 19:11:05 UTC (rev 8690) +++ trunk/model/src/app/net/sf/gridarta/model/autojoin/AutojoinLists.java 2010-10-07 19:17:02 UTC (rev 8691) @@ -64,7 +64,8 @@ /** * Adds a new autojoin list. * @param autojoinList the autojoin list to add - * @throws IllegalAutojoinListException if the autojoin list cannot be added + * @throws IllegalAutojoinListException if the autojoin list cannot be + * added */ public void addAutojoinList(@NotNull final AutojoinList<G, A, R> autojoinList) throws IllegalAutojoinListException { for (int i = 0; i < AutojoinList.SIZE; i++) { @@ -233,7 +234,8 @@ * @param mapModel the map model to search * @param point location to search * @param autojoinList the autojoin list - * @return arch which is part of this join-list, null if no such arch exists + * @return arch which is part of this join-list, null if no such arch + * exists */ @Nullable private G findGameObjectOfAutojoinList(@NotNull final MapModel<G, A, R> mapModel, @NotNull final Point point, @NotNull final AutojoinList<G, A, R> autojoinList) { @@ -253,7 +255,8 @@ * @param mapModel the map model to search * @param point location to search * @param autojoinList the autojoin list - * @return arch which is part of this join-list, null if no such arch exists + * @return arch which is part of this join-list, null if no such arch + * exists */ @Nullable private GameObject<G, A, R> findMainGameObjectOfAutojoinList(@NotNull final MapModel<G, A, R> mapModel, @NotNull final Point point, @NotNull final AutojoinList<G, A, R> autojoinList) { Modified: trunk/model/src/app/net/sf/gridarta/model/baseobject/AbstractBaseObject.java =================================================================== --- trunk/model/src/app/net/sf/gridarta/model/baseobject/AbstractBaseObject.java 2010-10-07 19:11:05 UTC (rev 8690) +++ trunk/model/src/app/net/sf/gridarta/model/baseobject/AbstractBaseObject.java 2010-10-07 19:17:02 UTC (rev 8691) @@ -418,14 +418,16 @@ /** * {@inheritDoc} - * @noinspection AbstractMethodOverridesAbstractMethod // needed because of public modifier + * @noinspection AbstractMethodOverridesAbstractMethod // needed because of + * public modifier */ @Override public abstract void notifyBeginChange(); /** * {@inheritDoc} - * @noinspection AbstractMethodOverridesAbstractMethod // needed because of public modifier + * @noinspection AbstractMethodOverridesAbstractMethod // needed because of + * public modifier */ @Override public abstract void notifyEndChange(); Modified: trunk/model/src/app/net/sf/gridarta/model/data/AbstractNamedObject.java =================================================================== --- trunk/model/src/app/net/sf/gridarta/model/data/AbstractNamedObject.java 2010-10-07 19:11:05 UTC (rev 8690) +++ trunk/model/src/app/net/sf/gridarta/model/data/AbstractNamedObject.java 2010-10-07 19:17:02 UTC (rev 8691) @@ -24,8 +24,8 @@ /** * A <code>AbstractNamedObject</code> has a name and tree position source and - * provides an icon for display. <code>AbstractNamedObject</code> is the - * super class of {@link net.sf.gridarta.model.face.FaceObject} and {@link + * provides an icon for display. <code>AbstractNamedObject</code> is the super + * class of {@link net.sf.gridarta.model.face.FaceObject} and {@link * net.sf.gridarta.model.anim.AnimationObject}. * @author <a href="mailto:ch...@ri...">Christian Hujer</a> */ Modified: trunk/model/src/app/net/sf/gridarta/model/data/NamedObject.java =================================================================== --- trunk/model/src/app/net/sf/gridarta/model/data/NamedObject.java 2010-10-07 19:11:05 UTC (rev 8690) +++ trunk/model/src/app/net/sf/gridarta/model/data/NamedObject.java 2010-10-07 19:17:02 UTC (rev 8691) @@ -24,8 +24,8 @@ /** * A <code>AbstractNamedObject</code> has a name and tree position source and - * provides an icon for display. <code>AbstractNamedObject</code> is the - * super class of {@link net.sf.gridarta.model.face.FaceObject} and {@link + * provides an icon for display. <code>AbstractNamedObject</code> is the super + * class of {@link net.sf.gridarta.model.face.FaceObject} and {@link * net.sf.gridarta.model.anim.AnimationObject}. * @author <a href="mailto:ch...@ri...">Christian Hujer</a> */ Modified: trunk/model/src/app/net/sf/gridarta/model/direction/Direction.java =================================================================== --- trunk/model/src/app/net/sf/gridarta/model/direction/Direction.java 2010-10-07 19:11:05 UTC (rev 8690) +++ trunk/model/src/app/net/sf/gridarta/model/direction/Direction.java 2010-10-07 19:17:02 UTC (rev 8691) @@ -43,7 +43,7 @@ /** * West. */ - WEST(-1 , 0), + WEST(-1, 0), /** * North east. Modified: trunk/model/src/app/net/sf/gridarta/model/face/FaceObjectProviders.java =================================================================== --- trunk/model/src/app/net/sf/gridarta/model/face/FaceObjectProviders.java 2010-10-07 19:11:05 UTC (rev 8690) +++ trunk/model/src/app/net/sf/gridarta/model/face/FaceObjectProviders.java 2010-10-07 19:17:02 UTC (rev 8691) @@ -45,7 +45,8 @@ public class FaceObjectProviders { /** - * The gray level for gray-scaled images; 100=darkest gray, 0=lightest gray. + * The gray level for gray-scaled images; 100=darkest gray, 0=lightest + * gray. */ private static final int GRAY_PERCENTAGE = 50; @@ -192,7 +193,8 @@ } /** - * Removes a {@link FaceObjectProvidersListener} to be notified about changes. + * Removes a {@link FaceObjectProvidersListener} to be notified about + * changes. * @param listener the listener */ public void removeFaceObjectProvidersListener(@NotNull final FaceObjectProvidersListener listener) { Modified: trunk/model/src/app/net/sf/gridarta/model/face/package.html =================================================================== --- trunk/model/src/app/net/sf/gridarta/model/face/package.html 2010-10-07 19:11:05 UTC (rev 8690) +++ trunk/model/src/app/net/sf/gridarta/model/face/package.html 2010-10-07 19:17:02 UTC (rev 8691) @@ -99,6 +99,7 @@ </dd> </dl> <h4>Conclusions</h4> + <ul> <li>Do not use the face number for face lookup, use the face name instead. </li> Modified: trunk/model/src/app/net/sf/gridarta/model/match/NamedGameObjectMatcher.java =================================================================== --- trunk/model/src/app/net/sf/gridarta/model/match/NamedGameObjectMatcher.java 2010-10-07 19:11:05 UTC (rev 8690) +++ trunk/model/src/app/net/sf/gridarta/model/match/NamedGameObjectMatcher.java 2010-10-07 19:17:02 UTC (rev 8691) @@ -124,7 +124,8 @@ * game object. {@link #envGameObjectMatcher} is ignored. * @param gameObject the game object to search * @return whether a matching inventory game object was found - * @noinspection TypeMayBeWeakened // is false warning: weakened type would cause compile-errors + * @noinspection TypeMayBeWeakened // is false warning: weakened type would + * cause compile-errors */ private boolean isMatchingInventory(@NotNull final GameObject<?, ?, ?> gameObject) { for (final GameObject<?, ?, ?> inv : gameObject) { Modified: trunk/model/src/app/net/sf/gridarta/model/match/SetEnabledAction.java =================================================================== --- trunk/model/src/app/net/sf/gridarta/model/match/SetEnabledAction.java 2010-10-07 19:11:05 UTC (rev 8690) +++ trunk/model/src/app/net/sf/gridarta/model/match/SetEnabledAction.java 2010-10-07 19:17:02 UTC (rev 8691) @@ -51,9 +51,10 @@ /** * Creates a <code>SetEnabledAction</code>. - * @param mutableOrGameObjectMatcher the <code>MutaMutableOrGameObjectMatcher</code> to add to / - * remove from - * @param gameObjectMatcher the <code>ArchGameObjectMatcher</code> to be added / removed + * @param mutableOrGameObjectMatcher the <code>MutaMutableOrGameObjectMatcher</code> + * to add to / remove from + * @param gameObjectMatcher the <code>ArchGameObjectMatcher</code> to be + * added / removed */ public SetEnabledAction(@NotNull final MutableOrGameObjectMatcher mutableOrGameObjectMatcher, @NotNull final GameObjectMatcher gameObjectMatcher) { this.mutableOrGameObjectMatcher = mutableOrGameObjectMatcher; Modified: trunk/model/src/app/net/sf/gridarta/model/match/package.html =================================================================== --- trunk/model/src/app/net/sf/gridarta/model/match/package.html 2010-10-07 19:11:05 UTC (rev 8690) +++ trunk/model/src/app/net/sf/gridarta/model/match/package.html 2010-10-07 19:17:02 UTC (rev 8691) @@ -22,9 +22,9 @@ <body> This package contains classes related to matching {@link net.sf.gridarta.model.gameobject.GameObject GameObjects}, so called {@link -net.sf.gridarta.model.match.GameObjectMatcher GameObjectMatchers}. A -<code>GameObjectMatcher</code> matches a <code>GameObject</code> by checking -whether it fulfills certain conditions. +net.sf.gridarta.model.match.GameObjectMatcher GameObjectMatchers}. A <code>GameObjectMatcher</code> +matches a <code>GameObject</code> by checking whether it fulfills certain +conditions. <p/> One application is used for instance for choosing which objects to render transparent or at all. Modified: trunk/model/src/app/net/sf/gridarta/model/treasurelist/TreasureListsParser.java =================================================================== --- trunk/model/src/app/net/sf/gridarta/model/treasurelist/TreasureListsParser.java 2010-10-07 19:11:05 UTC (rev 8690) +++ trunk/model/src/app/net/sf/gridarta/model/treasurelist/TreasureListsParser.java 2010-10-07 19:17:02 UTC (rev 8691) @@ -41,7 +41,8 @@ /** * This method fills the 'specialTreasureLists' hash table with the names of - * all treasurelists which are special and belong into a special sub-folder. + * all treasurelists which are special and belong into a special + * sub-folder. * @param specialTreasureListsDocument the special treasure lists * definitions * @return the hash table Modified: trunk/model/src/app/net/sf/gridarta/model/treasurelist/TreasureObj.java =================================================================== --- trunk/model/src/app/net/sf/gridarta/model/treasurelist/TreasureObj.java 2010-10-07 19:11:05 UTC (rev 8690) +++ trunk/model/src/app/net/sf/gridarta/model/treasurelist/TreasureObj.java 2010-10-07 19:17:02 UTC (rev 8691) @@ -201,7 +201,7 @@ * Returns whether this treasure object is a "treasure" or "treasureone" * object. * @return whether this treasure object is a "treasure" or "treasureone" - * object + * object */ public boolean isTreasureList() { return isTreasureList; Modified: trunk/model/src/app/net/sf/gridarta/model/validation/ValidationErrorComparator.java =================================================================== --- trunk/model/src/app/net/sf/gridarta/model/validation/ValidationErrorComparator.java 2010-10-07 19:11:05 UTC (rev 8690) +++ trunk/model/src/app/net/sf/gridarta/model/validation/ValidationErrorComparator.java 2010-10-07 19:17:02 UTC (rev 8691) @@ -46,8 +46,8 @@ */ @Override public int compare(@NotNull final ValidationError<G, A, R> o1, @NotNull final ValidationError<G, A, R> o2) { - final MapModel<G, A, R> mapModel1 = o1.getMapModel(); - final MapModel<G, A, R> mapModel2 = o2.getMapModel(); + final MapModel<G, A, R> mapModel1 = o1.getMapModel(); + final MapModel<G, A, R> mapModel2 = o2.getMapModel(); if (mapModel1 == mapModel2) { final int minY1 = getMinY(o1); final int minY2 = getMinY(o2); Modified: trunk/model/src/app/net/sf/gridarta/model/validation/package.html =================================================================== --- trunk/model/src/app/net/sf/gridarta/model/validation/package.html 2010-10-07 19:11:05 UTC (rev 8690) +++ trunk/model/src/app/net/sf/gridarta/model/validation/package.html 2010-10-07 19:17:02 UTC (rev 8691) @@ -27,10 +27,12 @@ Although it would have been possible to create a Mirror API I have decided to directly hand out the original API to the map validation. <h4>Pro Mirror API / Contra Original API</h4> + <ul> <li>Keep the validation from (accidental) manipulation.</li> </ul> <h4>Pro Original API / Contra Mirror API</h4> + <ul> <li>The amount of work that a mirror API would have involved.</li> <li>Allow the validation to provide an error correction facility.</li> Modified: trunk/model/src/test/net/sf/gridarta/model/gameobject/GameObjectFactoryTest.java =================================================================== --- trunk/model/src/test/net/sf/gridarta/model/gameobject/GameObjectFactoryTest.java 2010-10-07 19:11:05 UTC (rev 8690) +++ trunk/model/src/test/net/sf/gridarta/model/gameobject/GameObjectFactoryTest.java 2010-10-07 19:17:02 UTC (rev 8691) @@ -37,8 +37,7 @@ public class GameObjectFactoryTest { /** - * Checks that {@link - * net.sf.gridarta.model.gameobject.GameObjectFactory#cloneGameObject(GameObject)} + * Checks that {@link net.sf.gridarta.model.gameobject.GameObjectFactory#cloneGameObject(GameObject)} * correctly updates the container. * @throws DuplicateArchetypeException if the test fails * @throws CannotInsertGameObjectException if the test fails Modified: trunk/model/src/test/net/sf/gridarta/model/mapmodel/DefaultMapModelTest.java =================================================================== --- trunk/model/src/test/net/sf/gridarta/model/mapmodel/DefaultMapModelTest.java 2010-10-07 19:11:05 UTC (rev 8690) +++ trunk/model/src/test/net/sf/gridarta/model/mapmodel/DefaultMapModelTest.java 2010-10-07 19:17:02 UTC (rev 8691) @@ -108,8 +108,8 @@ }; /** - * The {@link MapArchObjectListener} registered to all map models to - * record map changes. + * The {@link MapArchObjectListener} registered to all map models to record + * map changes. */ @NotNull private final MapArchObjectListener mapArchObjectListener = new MapArchObjectListener() { @@ -152,8 +152,7 @@ } /** - * Test case for {@link - * net.sf.gridarta.model.maparchobject.MapArchObject#setMapSize(Size2D)}. + * Test case for {@link net.sf.gridarta.model.maparchobject.MapArchObject#setMapSize(Size2D)}. */ @Test public void testResizeMap1() { @@ -167,8 +166,7 @@ } /** - * Test case for {@link - * net.sf.gridarta.model.maparchobject.MapArchObject#setMapSize(Size2D)}. + * Test case for {@link net.sf.gridarta.model.maparchobject.MapArchObject#setMapSize(Size2D)}. */ @Test public void testResizeMap2() { @@ -187,8 +185,7 @@ } /** - * Test case for {@link - * net.sf.gridarta.model.maparchobject.MapArchObject#setMapSize(Size2D)}. + * Test case for {@link net.sf.gridarta.model.maparchobject.MapArchObject#setMapSize(Size2D)}. */ @Test public void testResizeMap3() { @@ -209,8 +206,7 @@ } /** - * Test case for {@link - * net.sf.gridarta.model.maparchobject.MapArchObject#setMapSize(Size2D)}. + * Test case for {@link net.sf.gridarta.model.maparchobject.MapArchObject#setMapSize(Size2D)}. */ @Test public void testResizeMap4() { Modified: trunk/src/app/net/sf/gridarta/gui/autovalidator/AutoValidator.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/autovalidator/AutoValidator.java 2010-10-07 19:11:05 UTC (rev 8690) +++ trunk/src/app/net/sf/gridarta/gui/autovalidator/AutoValidator.java 2010-10-07 19:17:02 UTC (rev 8691) @@ -68,8 +68,8 @@ /** * The preference change listener to detect an changed options. The - * auto-validator is re-enabled if either {@link #PREFERENCES_VALIDATOR_AUTO} was - * enabled, or a validator check was changed while the validator is + * auto-validator is re-enabled if either {@link #PREFERENCES_VALIDATOR_AUTO} + * was enabled, or a validator check was changed while the validator is * enabled. */ private final PreferenceChangeListener preferenceChangeListener = new PreferenceChangeListener() { Modified: trunk/src/app/net/sf/gridarta/gui/bookmarks/BookmarkActions.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/bookmarks/BookmarkActions.java 2010-10-07 19:11:05 UTC (rev 8690) +++ trunk/src/app/net/sf/gridarta/gui/bookmarks/BookmarkActions.java 2010-10-07 19:17:02 UTC (rev 8691) @@ -89,8 +89,8 @@ private final Action addBookmarkAction; /** - * The {@link ManageBookmarksDialog} instance. Set to <code>null</code> if not - * yet created. + * The {@link ManageBookmarksDialog} instance. Set to <code>null</code> if + * not yet created. */ @Nullable private ManageBookmarksDialog<G, A, R> manageBookmarksDialog = null; Modified: trunk/src/app/net/sf/gridarta/gui/data/NamedObjectsUtils.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/data/NamedObjectsUtils.java 2010-10-07 19:11:05 UTC (rev 8690) +++ trunk/src/app/net/sf/gridarta/gui/data/NamedObjectsUtils.java 2010-10-07 19:17:02 UTC (rev 8691) @@ -60,7 +60,8 @@ * Show a dialog for choosing from the object tree. * @param parentComponent parent component to show dialog on * @param initial initially selected node name - * @param faceObjectProviders the face object providers for looking up faces + * @param faceObjectProviders the face object providers for looking up + * faces * @param namedObjects the named objects tree to show * @return name of selected node or <code>null</code> if the user abandoned * the selection dialog by using cancel or close instead of okay Modified: trunk/src/app/net/sf/gridarta/gui/map/mapactions/NoExitPathException.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/map/mapactions/NoExitPathException.java 2010-10-07 19:11:05 UTC (rev 8690) +++ trunk/src/app/net/sf/gridarta/gui/map/mapactions/NoExitPathException.java 2010-10-07 19:17:02 UTC (rev 8691) @@ -35,7 +35,8 @@ /** * Creates a new instance. - * @param baseObject the game object that does not specify a valid exit path + * @param baseObject the game object that does not specify a valid exit + * path */ public NoExitPathException(@NotNull final BaseObject<?, ?, ?, ?> baseObject) { super(baseObject.getBestName()); Modified: trunk/src/app/net/sf/gridarta/gui/map/mapview/MapViewBasic.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/map/mapview/MapViewBasic.java 2010-10-07 19:11:05 UTC (rev 8690) +++ trunk/src/app/net/sf/gridarta/gui/map/mapview/MapViewBasic.java 2010-10-07 19:17:02 UTC (rev 8691) @@ -67,8 +67,8 @@ List<MapSquare<G, A, R>> getSelectedSquares(); /** - * Must be called when this renderer is not used anymore. It un-registers all - * listeners. + * Must be called when this renderer is not used anymore. It un-registers + * all listeners. */ void closeNotify(); Modified: trunk/src/app/net/sf/gridarta/gui/mapfiles/MapFolderTreeActions.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/mapfiles/MapFolderTreeActions.java 2010-10-07 19:11:05 UTC (rev 8690) +++ trunk/src/app/net/sf/gridarta/gui/mapfiles/MapFolderTreeActions.java 2010-10-07 19:17:02 UTC (rev 8691) @@ -132,7 +132,8 @@ }; /** - * The {@link PickmapSettingsListener} attached to {@link #pickmapSettings}. + * The {@link PickmapSettingsListener} attached to {@link + * #pickmapSettings}. */ @NotNull private final PickmapSettingsListener pickmapSettingsListener = new PickmapSettingsListener() { Modified: trunk/src/app/net/sf/gridarta/gui/misc/StatusBar.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/misc/StatusBar.java 2010-10-07 19:11:05 UTC (rev 8690) +++ trunk/src/app/net/sf/gridarta/gui/misc/StatusBar.java 2010-10-07 19:17:02 UTC (rev 8691) @@ -56,9 +56,9 @@ import org.jetbrains.annotations.Nullable; /** - * <code>StatusBar</code> implements the main status bar of the application. Used - * to show one line text messages to the user about progress, state etc. Also - * includes level info and memory info panels. + * <code>StatusBar</code> implements the main status bar of the application. + * Used to show one line text messages to the user about progress, state etc. + * Also includes level info and memory info panels. * @author <a href="mailto:mic...@no...">Michael Toennies</a> * @author <a href="mailto:and...@gm...">Andreas Vogl</a> * @author <a href="mailto:ch...@ri...">Christian Hujer</a> Modified: trunk/src/app/net/sf/gridarta/gui/newmap/AbstractNewMapDialog.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/newmap/AbstractNewMapDialog.java 2010-10-07 19:11:05 UTC (rev 8690) +++ trunk/src/app/net/sf/gridarta/gui/newmap/AbstractNewMapDialog.java 2010-10-07 19:17:02 UTC (rev 8691) @@ -191,8 +191,8 @@ } /** - * Adds additional fields to the dialog. Will be called once when the - * dialog is created. + * Adds additional fields to the dialog. Will be called once when the dialog + * is created. * @param panel the panel to add the fields to * @param gbcLabel the grid bag constraints for the label part * @param gbcField the grid bag constraints for the input field Modified: trunk/src/app/net/sf/gridarta/gui/pickmapchooser/PickmapChooserControl.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/pickmapchooser/PickmapChooserControl.java 2010-10-07 19:11:05 UTC (rev 8690) +++ trunk/src/app/net/sf/gridarta/gui/pickmapchooser/PickmapChooserControl.java 2010-10-07 19:17:02 UTC (rev 8691) @@ -336,7 +336,8 @@ }; /** - * The {@link PickmapSettingsListener} attached to {@link #pickmapSettings}. + * The {@link PickmapSettingsListener} attached to {@link + * #pickmapSettings}. */ @NotNull private final PickmapSettingsListener pickmapSettingsListener = new PickmapSettingsListener() { Modified: trunk/src/app/net/sf/gridarta/gui/pickmapchooser/PickmapChooserModel.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/pickmapchooser/PickmapChooserModel.java 2010-10-07 19:11:05 UTC (rev 8690) +++ trunk/src/app/net/sf/gridarta/gui/pickmapchooser/PickmapChooserModel.java 2010-10-07 19:17:02 UTC (rev 8691) @@ -256,37 +256,49 @@ this.mapModel = mapModel; } - /** {@inheritDoc} */ + /** + * {@inheritDoc} + */ @Override public void mapSizeChanged(@NotNull final Size2D newSize) { // ignore } - /** {@inheritDoc} */ + /** + * {@inheritDoc} + */ @Override public void mapSquaresChanged(@NotNull final Set<MapSquare<G, A, R>> mapSquares) { // ignore } - /** {@inheritDoc} */ + /** + * {@inheritDoc} + */ @Override public void mapObjectsChanged(@NotNull final Set<G> gameObjects, @NotNull final Set<G> transientGameObjects) { // ignore } - /** {@inheritDoc} */ + /** + * {@inheritDoc} + */ @Override public void errorsChanged(@NotNull final ErrorCollector<G, A, R> errors) { // ignore } - /** {@inheritDoc} */ + /** + * {@inheritDoc} + */ @Override public void mapFileChanged(@Nullable final File oldMapFile) { // ignore } - /** {@inheritDoc} */ + /** + * {@inheritDoc} + */ @Override public void modifiedChanged() { int index = 0; Modified: trunk/src/app/net/sf/gridarta/gui/script/parameter/ArchComboBoxModel.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/script/parameter/ArchComboBoxModel.java 2010-10-07 19:11:05 UTC (rev 8690) +++ trunk/src/app/net/sf/gridarta/gui/script/parameter/ArchComboBoxModel.java 2010-10-07 19:17:02 UTC (rev 8691) @@ -40,6 +40,7 @@ private final Archetype<G, A, R>[] archList; /*the current list*/ // FIXME: This constant looks pretty pointless. + @NotNull private static final String CURRENT_FILTER = ""; Modified: trunk/src/app/net/sf/gridarta/mapfiles/MapFolderTree.java =================================================================== --- trunk/src/app/net/sf/gridarta/mapfiles/MapFolderTree.java 2010-10-07 19:11:05 UTC (rev 8690) +++ trunk/src/app/net/sf/gridarta/mapfiles/MapFolderTree.java 2010-10-07 19:17:02 UTC (rev 8691) @@ -107,7 +107,8 @@ * removed, the next or previous map folder becomes the active folder. * @param mapFolder the map folder to remove * @param deleteFile if set, also remove the map files - * @throws MapFolderNotEmptyException if the map folder contains sub-folders + * @throws MapFolderNotEmptyException if the map folder contains + * sub-folders */ public synchronized void removeMapFolder(@NotNull final MapFolder<G, A, R> mapFolder, final boolean deleteFile) throws MapFolderNotEmptyException { if (mapFolders.get(mapFolder.getName()) != mapFolder) { Modified: trunk/src/app/net/sf/gridarta/validation/checks/BlockedMatrix.java =================================================================== --- trunk/src/app/net/sf/gridarta/validation/checks/BlockedMatrix.java 2010-10-07 19:11:05 UTC (rev 8690) +++ trunk/src/app/net/sf/gridarta/validation/checks/BlockedMatrix.java 2010-10-07 19:17:02 UTC (rev 8691) @@ -36,8 +36,8 @@ /** * The blocked grid of the currently processed map: <code>blocked[x][y]</code> - * is set if and only if the corresponding map square contains at least - * one object which has "no_pass" set. + * is set if and only if the corresponding map square contains at least one + * object which has "no_pass" set. */ private final boolean[][] blocked; Modified: trunk/src/app/net/sf/gridarta/validation/checks/BlockedSquareChecker.java =================================================================== --- trunk/src/app/net/sf/gridarta/validation/checks/BlockedSquareChecker.java 2010-10-07 19:11:05 UTC (rev 8690) +++ trunk/src/app/net/sf/gridarta/validation/checks/BlockedSquareChecker.java 2010-10-07 19:17:02 UTC (rev 8691) @@ -51,6 +51,7 @@ public BlockedSquareChecker(@NotNull final ValidatorPreferences validatorPreferences) { super(validatorPreferences); } + /** * {@inheritDoc} */ Modified: trunk/src/doc/dev/codeStyle.xhtml =================================================================== --- trunk/src/doc/dev/codeStyle.xhtml 2010-10-07 19:11:05 UTC (rev 8690) +++ trunk/src/doc/dev/codeStyle.xhtml 2010-10-07 19:17:02 UTC (rev 8691) @@ -42,6 +42,7 @@ <p> ("small" in the sense how long it takes to describe them, not in their importance!) </p> + <ul> <li>Imports are sorted alphabetically by package, within a package alphabetically by class. @@ -72,6 +73,7 @@ <pre class="listing"><xi:include href="SafeCopy.java.xhtml" xpointer="element(/1/2/1/1)"/></pre> <p> Rationale: </p> + <ul> <li>The stream references needn't be nulled because they loose scope instantly after being closed. @@ -86,6 +88,7 @@ <p> The single catch for multiple streams is okay because the following cases can happen: </p> + <ul> <li>work okay, stream open, close okay - good.</li> <li>work okay, stream open, close exception - interested in close exception. @@ -114,6 +117,7 @@ explain the rationale of the configured rules. The other is to enable developers that do not use IntelliJ IDEA / InspectionGadgets to know what the rules are to be able to perform the same verifications. </p> + <ul> <li> Inspections Modified: trunk/src/doc/dev/howToHelp.xhtml =================================================================== --- trunk/src/doc/dev/howToHelp.xhtml 2010-10-07 19:11:05 UTC (rev 8690) +++ trunk/src/doc/dev/howToHelp.xhtml 2010-10-07 19:17:02 UTC (rev 8691) @@ -43,6 +43,7 @@ </dd> </dl> <h2>Helping as a User</h2> + <ul> <li>Requirement: You need to be a map maker for Atrinik, Crossfire or Daimonin. @@ -73,6 +74,7 @@ <!-- TODO: Crossfire Forums etc. --> </ul> <h2>Helping as a Developer</h2> + <ul> <li>Requirement: You need a firm knowledge of Java.</li> <li>Subscribe to the @@ -102,6 +104,7 @@ </li> </ul> <h3>Useful information for developers</h3> + <ul> <li> <a href="http://www.daimonin.net/modules.php?op=modload&name=phpWiki&file=index&pagename=Guide%20to%20the%20Editor%20Code">Daimonin @@ -119,6 +122,7 @@ </li> </ul> <h3>How to start</h3> + <ul> <li>Read the development documentation.</li> <li>Checkout your copy of the Gridarta source code from Subversion. (The Modified: trunk/src/doc/dev/start.xhtml =================================================================== --- trunk/src/doc/dev/start.xhtml 2010-10-07 19:11:05 UTC (rev 8690) +++ trunk/src/doc/dev/start.xhtml 2010-10-07 19:17:02 UTC (rev 8691) @@ -27,6 +27,7 @@ </head> <body> <h2>Contents</h2> + <ul> <li><a href="howToHelp">How to help</a></li> </ul> Modified: trunk/src/doc/dev/transactions.xhtml =================================================================== --- trunk/src/doc/dev/transactions.xhtml 2010-10-07 19:11:05 UTC (rev 8690) +++ trunk/src/doc/dev/transactions.xhtml 2010-10-07 19:17:02 UTC (rev 8691) @@ -67,6 +67,7 @@ <p> There are some requirements that could also be fulfilled using the transaction system. </p> + <ul> <li>The transaction system could support undo / redo by creating a backup and storing that in the undo buffer each time the outermost transaction Modified: trunk/src/doc/dev/typeParameters.xhtml =================================================================== --- trunk/src/doc/dev/typeParameters.xhtml 2010-10-07 19:11:05 UTC (rev 8690) +++ trunk/src/doc/dev/typeParameters.xhtml 2010-10-07 19:17:02 UTC (rev 8691) @@ -31,6 +31,7 @@ <p> This is a list of all classes that are sometimes used as base types for generics type parameters, along with the suggested type parameter name. </p> + <ul> <li>G: <strong>G</strong>ameObject</li> <li>R: A<strong>r</strong>chetype</li> @@ -39,8 +40,8 @@ <li>T: <em><strong>T</strong>ype</em> - Some abstract specific data type, usually in non-collection sense. </li> - <li>E: <em><strong>E</strong>lement</em> - Some unspecific data type, usually - in collection sense. + <li>E: <em><strong>E</strong>lement</em> - Some unspecific data type, + usually in collection sense. </li> </ul> </body> Modified: trunk/src/doc/faq.xhtml ==============================================================... [truncated message content] |
From: <aki...@us...> - 2010-10-07 19:11:11
|
Revision: 8690 http://gridarta.svn.sourceforge.net/gridarta/?rev=8690&view=rev Author: akirschbaum Date: 2010-10-07 19:11:05 +0000 (Thu, 07 Oct 2010) Log Message: ----------- Remove call to BaseObject.isArchetype(). Modified Paths: -------------- trunk/model/src/app/net/sf/gridarta/model/archetype/AbstractArchetype.java trunk/model/src/app/net/sf/gridarta/model/baseobject/AbstractBaseObject.java trunk/model/src/app/net/sf/gridarta/model/gameobject/AbstractGameObject.java Modified: trunk/model/src/app/net/sf/gridarta/model/archetype/AbstractArchetype.java =================================================================== --- trunk/model/src/app/net/sf/gridarta/model/archetype/AbstractArchetype.java 2010-10-07 19:01:52 UTC (rev 8689) +++ trunk/model/src/app/net/sf/gridarta/model/archetype/AbstractArchetype.java 2010-10-07 19:11:05 UTC (rev 8690) @@ -128,6 +128,18 @@ /** * {@inheritDoc} + */ + @Nullable + @Override + protected String getEffectiveFaceName(@NotNull final String faceName) { + final String normalizedFaceName = faceName.length() > 0 ? faceName.intern() : null; + //Strings are interned + //noinspection StringEquality + return normalizedFaceName != null && normalizedFaceName.length() > 0 ? normalizedFaceName : null; + } + + /** + * {@inheritDoc} * @noinspection NoopMethodInAbstractClass */ @Override Modified: trunk/model/src/app/net/sf/gridarta/model/baseobject/AbstractBaseObject.java =================================================================== --- trunk/model/src/app/net/sf/gridarta/model/baseobject/AbstractBaseObject.java 2010-10-07 19:01:52 UTC (rev 8689) +++ trunk/model/src/app/net/sf/gridarta/model/baseobject/AbstractBaseObject.java 2010-10-07 19:11:05 UTC (rev 8690) @@ -216,12 +216,9 @@ * @param faceName new face name. */ private void setFaceName(@NotNull final String faceName) { - final String normalizedFaceName = faceName.length() > 0 ? faceName.intern() : null; + final String effectiveFaceName = getEffectiveFaceName(faceName); //Strings are interned //noinspection StringEquality - final String effectiveFaceName = normalizedFaceName != null && normalizedFaceName.length() > 0 && (isArchetype() || normalizedFaceName != getArchetype().getFaceName()) ? normalizedFaceName : null; - //Strings are interned - //noinspection StringEquality if (this.faceName == effectiveFaceName) { return; } @@ -235,6 +232,16 @@ } /** + * Returns the effective face name for {@link #faceName} for a given real + * face name. + * @param faceName the real face name + * @return the effective face name or <code>null</code> if the real face + * name is unset or equals the archetype's face name + */ + @Nullable + protected abstract String getEffectiveFaceName(@NotNull final String faceName); + + /** * {@inheritDoc} */ @Nullable Modified: trunk/model/src/app/net/sf/gridarta/model/gameobject/AbstractGameObject.java =================================================================== --- trunk/model/src/app/net/sf/gridarta/model/gameobject/AbstractGameObject.java 2010-10-07 19:01:52 UTC (rev 8689) +++ trunk/model/src/app/net/sf/gridarta/model/gameobject/AbstractGameObject.java 2010-10-07 19:11:05 UTC (rev 8690) @@ -84,7 +84,19 @@ /** * {@inheritDoc} */ + @Nullable @Override + protected String getEffectiveFaceName(@NotNull final String faceName) { + final String normalizedFaceName = faceName.length() > 0 ? faceName.intern() : null; + //Strings are interned + //noinspection StringEquality + return normalizedFaceName != null && normalizedFaceName.length() > 0 && normalizedFaceName != archetype.getFaceName() ? normalizedFaceName : null; + } + + /** + * {@inheritDoc} + */ + @Override public void notifyBeginChange() { final MapSquare<G, A, R> mapSquare = getMapSquare(); if (mapSquare != null) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2010-10-07 19:01:58
|
Revision: 8689 http://gridarta.svn.sourceforge.net/gridarta/?rev=8689&view=rev Author: akirschbaum Date: 2010-10-07 19:01:52 +0000 (Thu, 07 Oct 2010) Log Message: ----------- Remove call to BaseObject.isArchetype(). Modified Paths: -------------- trunk/model/src/app/net/sf/gridarta/model/archetype/AbstractArchetype.java trunk/model/src/app/net/sf/gridarta/model/baseobject/AbstractBaseObject.java trunk/model/src/app/net/sf/gridarta/model/gameobject/AbstractGameObject.java Modified: trunk/model/src/app/net/sf/gridarta/model/archetype/AbstractArchetype.java =================================================================== --- trunk/model/src/app/net/sf/gridarta/model/archetype/AbstractArchetype.java 2010-10-07 18:50:13 UTC (rev 8688) +++ trunk/model/src/app/net/sf/gridarta/model/archetype/AbstractArchetype.java 2010-10-07 19:01:52 UTC (rev 8689) @@ -118,6 +118,16 @@ /** * {@inheritDoc} + */ + @Override + @NotNull + public String getAttributeString(@NotNull final String attributeName, final boolean queryArchetype) { + final String result = getAttributeValue(attributeName); + return result == null ? "" : result; + } + + /** + * {@inheritDoc} * @noinspection NoopMethodInAbstractClass */ @Override Modified: trunk/model/src/app/net/sf/gridarta/model/baseobject/AbstractBaseObject.java =================================================================== --- trunk/model/src/app/net/sf/gridarta/model/baseobject/AbstractBaseObject.java 2010-10-07 18:50:13 UTC (rev 8688) +++ trunk/model/src/app/net/sf/gridarta/model/baseobject/AbstractBaseObject.java 2010-10-07 19:01:52 UTC (rev 8689) @@ -273,20 +273,13 @@ } /** - * {@inheritDoc} + * Returns an attribute value by attribute name. + * @param attributeName the attribute name + * @return the attribute value or <code>null</code> */ - @Override - @NotNull - public String getAttributeString(@NotNull final String attributeName, final boolean queryArchetype) { - String result = gameObjectText.getAttributeValue(attributeName); - if (result == null) { - if (!queryArchetype || isArchetype()) { - result = ""; - } else { - result = getArchetype().getAttributeString(attributeName); - } - } - return result; + @Nullable + protected String getAttributeValue(@NotNull final String attributeName) { + return gameObjectText.getAttributeValue(attributeName); } /** Modified: trunk/model/src/app/net/sf/gridarta/model/gameobject/AbstractGameObject.java =================================================================== --- trunk/model/src/app/net/sf/gridarta/model/gameobject/AbstractGameObject.java 2010-10-07 18:50:13 UTC (rev 8688) +++ trunk/model/src/app/net/sf/gridarta/model/gameobject/AbstractGameObject.java 2010-10-07 19:01:52 UTC (rev 8689) @@ -72,6 +72,19 @@ * {@inheritDoc} */ @Override + @NotNull + public String getAttributeString(@NotNull final String attributeName, final boolean queryArchetype) { + final String result = getAttributeValue(attributeName); + if (result != null) { + return result; + } + return queryArchetype ? archetype.getAttributeString(attributeName) : ""; + } + + /** + * {@inheritDoc} + */ + @Override public void notifyBeginChange() { final MapSquare<G, A, R> mapSquare = getMapSquare(); if (mapSquare != null) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2010-10-07 18:50:19
|
Revision: 8688 http://gridarta.svn.sourceforge.net/gridarta/?rev=8688&view=rev Author: akirschbaum Date: 2010-10-07 18:50:13 +0000 (Thu, 07 Oct 2010) Log Message: ----------- Fix unchecked warning. Modified Paths: -------------- trunk/src/app/net/sf/gridarta/validation/checks/DoubleLayerChecker.java Modified: trunk/src/app/net/sf/gridarta/validation/checks/DoubleLayerChecker.java =================================================================== --- trunk/src/app/net/sf/gridarta/validation/checks/DoubleLayerChecker.java 2010-10-07 18:42:08 UTC (rev 8687) +++ trunk/src/app/net/sf/gridarta/validation/checks/DoubleLayerChecker.java 2010-10-07 18:50:13 UTC (rev 8688) @@ -27,7 +27,6 @@ import net.sf.gridarta.model.mapmodel.MapSquare; import net.sf.gridarta.model.validation.ErrorCollector; import net.sf.gridarta.model.validation.errors.DoubleLayerError; -import net.sf.gridarta.model.validation.errors.ValidationError; import net.sf.gridarta.validation.AbstractValidator; import net.sf.gridarta.validation.SquareValidator; import net.sf.gridarta.validation.ValidatorPreferences; @@ -53,23 +52,26 @@ */ @Override public void validateSquare(@NotNull final MapSquare<G, A, R> mapSquare, @NotNull final ErrorCollector<G, A, R> errorCollector) { - final Map<Integer, Object> layers = new HashMap<Integer, Object>(); - for (final G archObject : mapSquare) { - final int layer = archObject.getAttributeInt("layer", true); + final Map<Integer, G> gameObjects = new HashMap<Integer, G>(); + final Map<Integer, DoubleLayerError<G, A, R>> errors = new HashMap<Integer, DoubleLayerError<G, A, R>>(); + for (final G gameObject : mapSquare) { + final int layer = gameObject.getAttributeInt("layer", true); if (layer == 0) { // ignore layer 0 - } else if (layers.containsKey(layer)) { - final Object o = layers.get(layer); - if (o instanceof GameObject) { - final ValidationError<G, A, R> error = new DoubleLayerError<G, A, R>(mapSquare, (G) o); - layers.put(layer, error); - errorCollector.collect(error); + } else { + final DoubleLayerError<G, A, R> existingError = errors.get(layer); + if (existingError != null) { + existingError.addGameObject(gameObject); } else { - assert o instanceof DoubleLayerError; - ((DoubleLayerError<G, A, R>) o).addGameObject(archObject); + final G existingGameObject = gameObjects.get(layer); + if (existingGameObject != null) { + final DoubleLayerError<G, A, R> error = new DoubleLayerError<G, A, R>(mapSquare, existingGameObject); + errors.put(layer, error); + errorCollector.collect(error); + } else { + gameObjects.put(layer, gameObject); + } } - } else { - layers.put(layer, archObject); } } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2010-10-07 18:42:15
|
Revision: 8687 http://gridarta.svn.sourceforge.net/gridarta/?rev=8687&view=rev Author: akirschbaum Date: 2010-10-07 18:42:08 +0000 (Thu, 07 Oct 2010) Log Message: ----------- Extract StringParameterBuilder from AbstractConfigSource. Modified Paths: -------------- trunk/model/src/app/net/sf/gridarta/model/configsource/AbstractConfigSource.java Added Paths: ----------- trunk/utils/src/app/net/sf/gridarta/utils/StringParameterBuilder.java Modified: trunk/model/src/app/net/sf/gridarta/model/configsource/AbstractConfigSource.java =================================================================== --- trunk/model/src/app/net/sf/gridarta/model/configsource/AbstractConfigSource.java 2010-10-07 17:01:10 UTC (rev 8686) +++ trunk/model/src/app/net/sf/gridarta/model/configsource/AbstractConfigSource.java 2010-10-07 18:42:08 UTC (rev 8687) @@ -21,10 +21,10 @@ import java.io.File; import java.io.IOException; -import java.util.regex.Matcher; -import java.util.regex.Pattern; import net.sf.gridarta.model.settings.GlobalSettings; import net.sf.gridarta.utils.IOUtils; +import net.sf.gridarta.utils.StringParameterBuilder; +import net.sf.gridarta.utils.SyntaxErrorException; import net.sf.japi.swing.action.ActionBuilder; import net.sf.japi.swing.action.ActionBuilderFactory; import org.jetbrains.annotations.NotNull; @@ -64,25 +64,16 @@ return null; } - final Pattern pattern = Pattern.compile("\\$\\{([a-zA-Z]+)}"); - final Matcher matcher = pattern.matcher(spec); - final StringBuffer sb = new StringBuffer(); - while (matcher.find()) { - final String group = matcher.group(1); - final String replacement; - if (group.equals("COLLECTED")) { - replacement = globalSettings.getCollectedDirectory().getPath(); - } else if (group.equals("ARCH")) { - replacement = globalSettings.getArchDirectory().getPath(); - } else if (group.equals("MAPS")) { - replacement = globalSettings.getMapsDirectory().getPath(); - } else { - throw new IOException("unknown variable '${" + group + "} in '" + key + "=" + spec + "'"); - } - matcher.appendReplacement(sb, Matcher.quoteReplacement(replacement)); + final StringParameterBuilder stringParameterBuilder = new StringParameterBuilder(); + stringParameterBuilder.addParameter("COLLECTED", globalSettings.getCollectedDirectory().getPath()); + stringParameterBuilder.addParameter("ARCH", globalSettings.getArchDirectory().getPath()); + stringParameterBuilder.addParameter("MAPS", globalSettings.getMapsDirectory().getPath()); + final String result; + try { + result = stringParameterBuilder.replace(spec); + } catch (final SyntaxErrorException ex) { + throw new IOException(ex.getMessage() + " in " + key + "=" + spec, ex); } - matcher.appendTail(sb); - final String result = sb.toString(); return IOUtils.getFile(null, result); } Added: trunk/utils/src/app/net/sf/gridarta/utils/StringParameterBuilder.java =================================================================== --- trunk/utils/src/app/net/sf/gridarta/utils/StringParameterBuilder.java (rev 0) +++ trunk/utils/src/app/net/sf/gridarta/utils/StringParameterBuilder.java 2010-10-07 18:42:08 UTC (rev 8687) @@ -0,0 +1,83 @@ +/* + * Gridarta MMORPG map editor for Crossfire, Daimonin and similar games. + * Copyright (C) 2000-2010 The Gridarta Developers. + * + * This program 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 2 of the License, or + * (at your option) any later version. + * + * This program is 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 General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +package net.sf.gridarta.utils; + +import java.util.HashMap; +import java.util.Map; +import java.util.regex.Matcher; +import java.util.regex.Pattern; +import org.jetbrains.annotations.NotNull; + +/** + * Replaces placeholders in strings. + * @author Andreas Kirschbaum + */ +public class StringParameterBuilder { + + /** + * The {@link Pattern} for parameters. + */ + @NotNull + private static final Pattern pattern = Pattern.compile("\\$\\{([a-zA-Z]+)}"); + + /** + * Maps parameter key to value. + */ + @NotNull + private final Map<String, String> values = new HashMap<String, String>(); + + /** + * Creates a new instance. + */ + public StringParameterBuilder() { + } + + /** + * Adds a parameter key/value pair. + * @param key the parameter's key + * @param value the parameter's value + */ + public void addParameter(@NotNull final String key, @NotNull final String value) { + values.put(key, value); + } + + /** + * Replaces all parameters in a string. + * @param spec the input string + * @return the output string + * @throws SyntaxErrorException if a parameter is invalid + */ + @NotNull + public String replace(@NotNull final CharSequence spec) throws SyntaxErrorException { + final Matcher matcher = pattern.matcher(spec); + final StringBuffer sb = new StringBuffer(); + while (matcher.find()) { + final String group = matcher.group(1); + final String replacement = values.get(group); + if (replacement == null) { + throw new SyntaxErrorException("unknown variable '${" + group + "}"); + } + matcher.appendReplacement(sb, Matcher.quoteReplacement(replacement)); + } + matcher.appendTail(sb); + return sb.toString(); + } + +} // class StringParameterBuilder Property changes on: trunk/utils/src/app/net/sf/gridarta/utils/StringParameterBuilder.java ___________________________________________________________________ Added: svn:mime-type + text/plain Added: svn:eol-style + LF This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2010-10-07 17:01:16
|
Revision: 8686 http://gridarta.svn.sourceforge.net/gridarta/?rev=8686&view=rev Author: akirschbaum Date: 2010-10-07 17:01:10 +0000 (Thu, 07 Oct 2010) Log Message: ----------- Fix checkstyle issues. Modified Paths: -------------- trunk/crossfire/src/test/net/sf/gridarta/var/crossfire/validation/checks/ValidatorFactoryTest.java trunk/src/app/net/sf/gridarta/maincontrol/DefaultMainControl.java trunk/src/app/net/sf/gridarta/updater/Updater.java trunk/textedit/src/app/net/sf/gridarta/textedit/scripteditor/ScriptEditView.java trunk/textedit/src/app/net/sf/gridarta/textedit/textarea/actions/Paste.java Modified: trunk/crossfire/src/test/net/sf/gridarta/var/crossfire/validation/checks/ValidatorFactoryTest.java =================================================================== --- trunk/crossfire/src/test/net/sf/gridarta/var/crossfire/validation/checks/ValidatorFactoryTest.java 2010-10-06 21:02:59 UTC (rev 8685) +++ trunk/crossfire/src/test/net/sf/gridarta/var/crossfire/validation/checks/ValidatorFactoryTest.java 2010-10-07 17:01:10 UTC (rev 8686) @@ -21,12 +21,11 @@ import net.sf.gridarta.validation.NoSuchValidatorException; import net.sf.gridarta.validation.ValidationUtils; -import net.sf.gridarta.validation.ValidatorFactory; import org.junit.Test; /** - * Regression tests for {@link ValidatorFactory} to create Crossfire specific - * validators. + * Regression tests for {@link net.sf.gridarta.validation.ValidatorFactory} to + * create Crossfire specific validators. * @author Andreas Kirschbaum */ public class ValidatorFactoryTest { Modified: trunk/src/app/net/sf/gridarta/maincontrol/DefaultMainControl.java =================================================================== --- trunk/src/app/net/sf/gridarta/maincontrol/DefaultMainControl.java 2010-10-06 21:02:59 UTC (rev 8685) +++ trunk/src/app/net/sf/gridarta/maincontrol/DefaultMainControl.java 2010-10-07 17:01:10 UTC (rev 8686) @@ -312,7 +312,7 @@ private void loadValidators(@NotNull final DelegatingMapValidator<G, A, R> validators, @NotNull final ValidatorFactory validatorFactory, @NotNull final ErrorView errorView) { final ActionBuilder actionBuilder = ActionBuilderFactory.getInstance().getActionBuilder("net.sf.gridarta"); int id = 0; - for (; ;) { + while (true) { final String spec = actionBuilder.getString("validator." + id); if (spec == null) { break; Modified: trunk/src/app/net/sf/gridarta/updater/Updater.java =================================================================== --- trunk/src/app/net/sf/gridarta/updater/Updater.java 2010-10-06 21:02:59 UTC (rev 8685) +++ trunk/src/app/net/sf/gridarta/updater/Updater.java 2010-10-07 17:01:10 UTC (rev 8686) @@ -205,7 +205,7 @@ final OutputStream out = new FileOutputStream(download); try { final byte[] buf = new byte[BUF_SIZE]; - for (; ;) { + while (true) { final int bytesRead = in.read(buf); if (bytesRead == -1) { break; Modified: trunk/textedit/src/app/net/sf/gridarta/textedit/scripteditor/ScriptEditView.java =================================================================== --- trunk/textedit/src/app/net/sf/gridarta/textedit/scripteditor/ScriptEditView.java 2010-10-06 21:02:59 UTC (rev 8685) +++ trunk/textedit/src/app/net/sf/gridarta/textedit/scripteditor/ScriptEditView.java 2010-10-07 17:01:10 UTC (rev 8686) @@ -229,7 +229,7 @@ try { boolean firstLine = true; final StringBuilder buff = new StringBuilder(""); - for (; ;) { + while (true) { final String line = in.readLine(); if (line == null) { break; Modified: trunk/textedit/src/app/net/sf/gridarta/textedit/textarea/actions/Paste.java =================================================================== --- trunk/textedit/src/app/net/sf/gridarta/textedit/textarea/actions/Paste.java 2010-10-06 21:02:59 UTC (rev 8685) +++ trunk/textedit/src/app/net/sf/gridarta/textedit/textarea/actions/Paste.java 2010-10-07 17:01:10 UTC (rev 8686) @@ -53,7 +53,7 @@ try { // read everything into the buffer 'buff' boolean start = true; - for (; ;) { + while (true) { final String line = bufferedReader.readLine(); if (line == null) { break; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |