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-05-24 18:42:54
|
Revision: 7985 http://gridarta.svn.sourceforge.net/gridarta/?rev=7985&view=rev Author: akirschbaum Date: 2010-05-24 18:42:47 +0000 (Mon, 24 May 2010) Log Message: ----------- Fix checkstyle issues. Modified Paths: -------------- trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/validation/checks/NonAbsoluteExitPathChecker.java trunk/src/app/net/sf/gridarta/delayedmapmodel/DelayedMapModelListenerManager.java trunk/src/app/net/sf/gridarta/gui/filter/MenuItemCreator.java trunk/src/app/net/sf/gridarta/gui/map/mapactions/MapActions.java trunk/src/app/net/sf/gridarta/gui/selectedsquare/CellRenderer.java trunk/src/app/net/sf/gridarta/gui/shortcuts/KeyStrokeField.java trunk/src/app/net/sf/gridarta/gui/spells/SpellsUtils.java trunk/src/app/net/sf/gridarta/gui/utils/MenuUtils.java trunk/src/app/net/sf/gridarta/mainactions/MainActions.java trunk/src/app/net/sf/gridarta/maincontrol/GridartaEditor.java trunk/src/app/net/sf/gridarta/mapfiles/MapFolder.java trunk/src/app/net/sf/gridarta/mapmanager/DefaultFileControl.java trunk/src/app/net/sf/gridarta/model/face/DefaultFaceObjects.java trunk/src/app/net/sf/gridarta/model/gameobject/MultiPositionData.java trunk/src/app/net/sf/gridarta/model/io/AbstractGameObjectParser.java trunk/src/app/net/sf/gridarta/model/io/AbstractMapArchObjectParser.java trunk/src/app/net/sf/gridarta/model/treasurelist/TreasureLoader.java trunk/src/app/net/sf/gridarta/preferences/Storage.java trunk/src/app/net/sf/gridarta/resource/AbstractResourcesReader.java trunk/src/app/net/sf/gridarta/textedit/scripteditor/CFPythonPopup.java trunk/src/app/net/sf/gridarta/utils/IOUtils.java Modified: trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/validation/checks/NonAbsoluteExitPathChecker.java =================================================================== --- trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/validation/checks/NonAbsoluteExitPathChecker.java 2010-05-24 18:09:49 UTC (rev 7984) +++ trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/validation/checks/NonAbsoluteExitPathChecker.java 2010-05-24 18:42:47 UTC (rev 7985) @@ -27,7 +27,6 @@ import net.sf.gridarta.model.match.GameObjectMatcher; import net.sf.gridarta.validation.AbstractValidator; import net.sf.gridarta.validation.GameObjectValidator; -import net.sf.gridarta.validation.MapValidator; import net.sf.gridarta.validation.checks.NonAbsoluteExitPathError; import net.sf.gridarta.var.crossfire.model.archetype.Archetype; import net.sf.gridarta.var.crossfire.model.gameobject.GameObject; @@ -35,8 +34,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.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/src/app/net/sf/gridarta/delayedmapmodel/DelayedMapModelListenerManager.java =================================================================== --- trunk/src/app/net/sf/gridarta/delayedmapmodel/DelayedMapModelListenerManager.java 2010-05-24 18:09:49 UTC (rev 7984) +++ trunk/src/app/net/sf/gridarta/delayedmapmodel/DelayedMapModelListenerManager.java 2010-05-24 18:42:47 UTC (rev 7985) @@ -153,7 +153,7 @@ try { final Map<MapModel<G, A, R>, Void> mapModels = new IdentityHashMap<MapModel<G, A, R>, Void>(); while (!Thread.currentThread().isInterrupted()) { - for (; ;) { + while (true) { final long now = System.currentTimeMillis(); synchronized (sync) { if (timeout == 0L) { Modified: trunk/src/app/net/sf/gridarta/gui/filter/MenuItemCreator.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/filter/MenuItemCreator.java 2010-05-24 18:09:49 UTC (rev 7984) +++ trunk/src/app/net/sf/gridarta/gui/filter/MenuItemCreator.java 2010-05-24 18:42:47 UTC (rev 7985) @@ -21,7 +21,6 @@ import javax.swing.JCheckBoxMenuItem; import javax.swing.JMenuItem; -import net.sf.gridarta.model.filter.Filter; import net.sf.gridarta.model.filter.FilterConfig; import net.sf.gridarta.model.filter.FilterConfigVisitor; import net.sf.gridarta.model.filter.NamedFilterConfig; @@ -32,7 +31,7 @@ import org.jetbrains.annotations.Nullable; /** - * Creates menu items for {@link Filter} instances. + * Creates menu items for {@link net.sf.gridarta.model.filter.Filter} instances. * @author tchize * @author Andreas Kirschbaum */ Modified: trunk/src/app/net/sf/gridarta/gui/map/mapactions/MapActions.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/map/mapactions/MapActions.java 2010-05-24 18:09:49 UTC (rev 7984) +++ trunk/src/app/net/sf/gridarta/gui/map/mapactions/MapActions.java 2010-05-24 18:42:47 UTC (rev 7985) @@ -501,7 +501,7 @@ */ @ActionMethod public boolean isTileShow() { - return doTileShow(false, false) && false; // XXX: not yet implemented + return /*doTileShow(false, false) && */false; // XXX: not yet implemented } /** Modified: trunk/src/app/net/sf/gridarta/gui/selectedsquare/CellRenderer.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/selectedsquare/CellRenderer.java 2010-05-24 18:09:49 UTC (rev 7984) +++ trunk/src/app/net/sf/gridarta/gui/selectedsquare/CellRenderer.java 2010-05-24 18:42:47 UTC (rev 7985) @@ -106,7 +106,7 @@ int indent = 0; if (arch != null) { - for (; ;) { + while (true) { final GameObject<G, A, R> env = arch.getContainerGameObject(); if (env == null) { break; Modified: trunk/src/app/net/sf/gridarta/gui/shortcuts/KeyStrokeField.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/shortcuts/KeyStrokeField.java 2010-05-24 18:09:49 UTC (rev 7984) +++ trunk/src/app/net/sf/gridarta/gui/shortcuts/KeyStrokeField.java 2010-05-24 18:42:47 UTC (rev 7985) @@ -21,7 +21,6 @@ import java.awt.event.KeyEvent; import java.awt.event.KeyListener; -import javax.swing.JComponent; import javax.swing.JTextField; import javax.swing.KeyStroke; import net.sf.gridarta.utils.EventListenerList2; @@ -29,7 +28,7 @@ import org.jetbrains.annotations.Nullable; /** - * A {@link JComponent} for selecting a {@link KeyStroke}. + * A {@link javax.swing.JComponent} for selecting a {@link KeyStroke}. * @author Andreas Kirschbaum */ public class KeyStrokeField extends JTextField { Modified: trunk/src/app/net/sf/gridarta/gui/spells/SpellsUtils.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/spells/SpellsUtils.java 2010-05-24 18:09:49 UTC (rev 7984) +++ trunk/src/app/net/sf/gridarta/gui/spells/SpellsUtils.java 2010-05-24 18:42:47 UTC (rev 7985) @@ -136,7 +136,7 @@ readUntil(in, "{", null); int counter = 0; - for (; ;) { + while (true) { readUntil(in, "{", "}"); readUntil(in, "\"", null); final String name = readUntil(in, "\"").trim(); Modified: trunk/src/app/net/sf/gridarta/gui/utils/MenuUtils.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/utils/MenuUtils.java 2010-05-24 18:09:49 UTC (rev 7984) +++ trunk/src/app/net/sf/gridarta/gui/utils/MenuUtils.java 2010-05-24 18:42:47 UTC (rev 7985) @@ -80,7 +80,7 @@ * @param menu the menu to remove the entries from */ public static void removeAllToSeparator(final JMenu menu) { - for (; ;) { + while (true) { final Component menuItem = menu.getMenuComponent(0); if (menuItem == null || menuItem instanceof JSeparator) { break; Modified: trunk/src/app/net/sf/gridarta/mainactions/MainActions.java =================================================================== --- trunk/src/app/net/sf/gridarta/mainactions/MainActions.java 2010-05-24 18:09:49 UTC (rev 7984) +++ trunk/src/app/net/sf/gridarta/mainactions/MainActions.java 2010-05-24 18:42:47 UTC (rev 7985) @@ -1537,7 +1537,7 @@ */ private int getFillDensity(@NotNull final String title) { String input = "100"; - for (; ;) { + while (true) { input = (String) JOptionPane.showInputDialog(parent, "Enter a fill density between 1-100", title, JOptionPane.QUESTION_MESSAGE, null, null, input); if (input == null) { return -1; Modified: trunk/src/app/net/sf/gridarta/maincontrol/GridartaEditor.java =================================================================== --- trunk/src/app/net/sf/gridarta/maincontrol/GridartaEditor.java 2010-05-24 18:09:49 UTC (rev 7984) +++ trunk/src/app/net/sf/gridarta/maincontrol/GridartaEditor.java 2010-05-24 18:42:47 UTC (rev 7985) @@ -154,7 +154,7 @@ final Getopt g = new Getopt("testprog", args, "bchns", longopts); Mode mode = Mode.NORMAL; boolean doExit = true; - for (; ;) { + while (true) { final int ch = g.getopt(); if (ch == -1) { break; Modified: trunk/src/app/net/sf/gridarta/mapfiles/MapFolder.java =================================================================== --- trunk/src/app/net/sf/gridarta/mapfiles/MapFolder.java 2010-05-24 18:09:49 UTC (rev 7984) +++ trunk/src/app/net/sf/gridarta/mapfiles/MapFolder.java 2010-05-24 18:42:47 UTC (rev 7985) @@ -184,7 +184,7 @@ * @param deleteFile if set, also remove the map file */ public void removeAllPickmaps(final boolean deleteFile) { - for (; ;) { + while (true) { final MapFile<G, A, R> mapFile; synchronized (sync) { if (mapFiles.isEmpty()) { Modified: trunk/src/app/net/sf/gridarta/mapmanager/DefaultFileControl.java =================================================================== --- trunk/src/app/net/sf/gridarta/mapmanager/DefaultFileControl.java 2010-05-24 18:09:49 UTC (rev 7984) +++ trunk/src/app/net/sf/gridarta/mapmanager/DefaultFileControl.java 2010-05-24 18:42:47 UTC (rev 7985) @@ -276,7 +276,7 @@ @ActionMethod @Override public boolean closeAllMaps() { - for (; ;) { + while (true) { final MapControl<G, A, R> mapControl = mapManager.getOpenMap(); if (mapControl == null) { break; Modified: trunk/src/app/net/sf/gridarta/model/face/DefaultFaceObjects.java =================================================================== --- trunk/src/app/net/sf/gridarta/model/face/DefaultFaceObjects.java 2010-05-24 18:09:49 UTC (rev 7984) +++ trunk/src/app/net/sf/gridarta/model/face/DefaultFaceObjects.java 2010-05-24 18:42:47 UTC (rev 7985) @@ -344,7 +344,7 @@ } int size = 0; // read size ' ' - for (; ;) { + while (true) { final char c = (char) data[offset++]; // XXX: do not cast from byte to char if (c == ' ') { break; @@ -357,7 +357,7 @@ } faceB.setLength(0); // read facename '\n' - for (; ;) { + while (true) { final char c = (char) data[offset++]; // XXX: do not cast from byte to char if (c == '\n') { break; @@ -423,7 +423,7 @@ final InputStream inputStream = new FileInputStream(file); try { final byte[] buf = new byte[CHUNK_SIZE]; - for (; ;) { + while (true) { final int len = inputStream.read(buf); if (len == -1) { break; Modified: trunk/src/app/net/sf/gridarta/model/gameobject/MultiPositionData.java =================================================================== --- trunk/src/app/net/sf/gridarta/model/gameobject/MultiPositionData.java 2010-05-24 18:09:49 UTC (rev 7984) +++ trunk/src/app/net/sf/gridarta/model/gameobject/MultiPositionData.java 2010-05-24 18:42:47 UTC (rev 7985) @@ -102,7 +102,7 @@ // read the whole file line by line boolean hasErrors = false; - for (; ;) { + while (true) { final String inputLine = lnr.readLine(); if (inputLine == null) { break; Modified: trunk/src/app/net/sf/gridarta/model/io/AbstractGameObjectParser.java =================================================================== --- trunk/src/app/net/sf/gridarta/model/io/AbstractGameObjectParser.java 2010-05-24 18:09:49 UTC (rev 7984) +++ trunk/src/app/net/sf/gridarta/model/io/AbstractGameObjectParser.java 2010-05-24 18:42:47 UTC (rev 7985) @@ -112,7 +112,7 @@ final G gameObject = gameObjectFactory.newGameObject(archName); boolean msgflag = false; - for (; ;) { + while (true) { final String thisLine2 = reader.readLine(); if (thisLine2 == null) { throw new IOException("unexpected end of file while reading 'arch " + archName + "'"); Modified: trunk/src/app/net/sf/gridarta/model/io/AbstractMapArchObjectParser.java =================================================================== --- trunk/src/app/net/sf/gridarta/model/io/AbstractMapArchObjectParser.java 2010-05-24 18:09:49 UTC (rev 7984) +++ trunk/src/app/net/sf/gridarta/model/io/AbstractMapArchObjectParser.java 2010-05-24 18:42:47 UTC (rev 7985) @@ -43,7 +43,7 @@ int height = 0; boolean archflag = false; // flag for arch<->end boolean msgflag = false; // flag for map-message - for (; ;) { + while (true) { final String tmp = reader.readLine(); if (tmp == null) { throw new IOException("unexpected end of file in map header"); Modified: trunk/src/app/net/sf/gridarta/model/treasurelist/TreasureLoader.java =================================================================== --- trunk/src/app/net/sf/gridarta/model/treasurelist/TreasureLoader.java 2010-05-24 18:09:49 UTC (rev 7984) +++ trunk/src/app/net/sf/gridarta/model/treasurelist/TreasureLoader.java 2010-05-24 18:42:47 UTC (rev 7985) @@ -108,7 +108,8 @@ final List<TreasureTreeNode> needLink = new ArrayList<TreasureTreeNode>(); // all sub-treasurelist nodes that need linking // first step: parsing datafile, adding all treasurelists to the tmpList vector - for (int index = 0; ; index++) { + int index = 0; + while (true) { final File treasureLocation; try { treasureLocation = configSource.getFile(globalSettings, "treasures", index); @@ -130,6 +131,7 @@ if (log.isInfoEnabled()) { log.info("Loaded " + (tmpList.size() - tmpListSize) + " treasurelists from '" + treasureLocation + "'."); } + index++; } return createTreasureTree(tmpList, needLink, specialTreasureLists); @@ -217,7 +219,7 @@ try { final BufferedReader bufferedReader = new BufferedReader(reader); try { - for (; ;) { + while (true) { final String rawLine = bufferedReader.readLine(); if (rawLine == null) { break; @@ -295,7 +297,7 @@ boolean insideArch = false; - for (; ;) { + while (true) { final String rawLine = reader.readLine(); if (rawLine == null) { break; Modified: trunk/src/app/net/sf/gridarta/preferences/Storage.java =================================================================== --- trunk/src/app/net/sf/gridarta/preferences/Storage.java 2010-05-24 18:09:49 UTC (rev 7984) +++ trunk/src/app/net/sf/gridarta/preferences/Storage.java 2010-05-24 18:42:47 UTC (rev 7985) @@ -275,7 +275,7 @@ String path = defaultPath; final LineNumberReader lnr = new LineNumberReader(isr); try { - for (; ;) { + while (true) { final String line2 = lnr.readLine(); if (line2 == null) { break; Modified: trunk/src/app/net/sf/gridarta/resource/AbstractResourcesReader.java =================================================================== --- trunk/src/app/net/sf/gridarta/resource/AbstractResourcesReader.java 2010-05-24 18:09:49 UTC (rev 7984) +++ trunk/src/app/net/sf/gridarta/resource/AbstractResourcesReader.java 2010-05-24 18:42:47 UTC (rev 7985) @@ -222,7 +222,7 @@ @NotNull private static Map<String, String> loadAnimTree(@NotNull final BufferedReader reader) throws IOException { final Map<String, String> animations = new HashMap<String, String>(); - for (; ;) { + while (true) { final String line = reader.readLine(); if (line == null) { break; Modified: trunk/src/app/net/sf/gridarta/textedit/scripteditor/CFPythonPopup.java =================================================================== --- trunk/src/app/net/sf/gridarta/textedit/scripteditor/CFPythonPopup.java 2010-05-24 18:09:49 UTC (rev 7984) +++ trunk/src/app/net/sf/gridarta/textedit/scripteditor/CFPythonPopup.java 2010-05-24 18:42:47 UTC (rev 7985) @@ -128,7 +128,7 @@ final BufferedReader bufferedReader = new BufferedReader(reader); try { // read file into the cmdList vector: - for (; ;) { + while (true) { final String inputLine = bufferedReader.readLine(); if (inputLine == null) { break; Modified: trunk/src/app/net/sf/gridarta/utils/IOUtils.java =================================================================== --- trunk/src/app/net/sf/gridarta/utils/IOUtils.java 2010-05-24 18:09:49 UTC (rev 7984) +++ trunk/src/app/net/sf/gridarta/utils/IOUtils.java 2010-05-24 18:42:47 UTC (rev 7985) @@ -137,7 +137,7 @@ final FileOutputStream outputStream = new FileOutputStream(tmpFile); try { final byte[] buf = new byte[65536]; - for (; ;) { + while (true) { final int len = bufferedInputStream.read(buf); if (len == -1) { break; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2010-05-24 18:09:55
|
Revision: 7984 http://gridarta.svn.sourceforge.net/gridarta/?rev=7984&view=rev Author: akirschbaum Date: 2010-05-24 18:09:49 +0000 (Mon, 24 May 2010) Log Message: ----------- Fix regression tests. Modified Paths: -------------- trunk/src/test/net/sf/gridarta/model/archetypetype/ArchetypeTypeSetParserTest.java Modified: trunk/src/test/net/sf/gridarta/model/archetypetype/ArchetypeTypeSetParserTest.java =================================================================== --- trunk/src/test/net/sf/gridarta/model/archetypetype/ArchetypeTypeSetParserTest.java 2010-05-24 18:03:16 UTC (rev 7983) +++ trunk/src/test/net/sf/gridarta/model/archetypetype/ArchetypeTypeSetParserTest.java 2010-05-24 18:09:49 UTC (rev 7984) @@ -79,8 +79,8 @@ + "type:123,name 123\n" + ":\n" + ":\n" - + "string/name[name_editor] section=0/General\n" + "fixed/f[v] section=1/Special\n" + + "string/name[name_editor] section=0/General\n" + "\n"); } @@ -121,20 +121,20 @@ + "type:1,name1\n" + ":\n" + ":\n" - + "string/default_attr1[default] section=0/General\n" - + "string/default_attr2[default] section=0/General\n" + "string/name1_attr1[name1] section=1/Special\n" + "string/name1_attr2[name1] section=1/Special\n" + + "string/default_attr1[default] section=0/General\n" + + "string/default_attr2[default] section=0/General\n" + "\n" + "type:2,name2\n" + ":\n" + ":\n" - /* defaults */ - + "string/default_attr1[default] section=0/General\n" /* attributes */ + "string/name2_attr1[name2] section=1/Special\n" + "string/name1_attr2[name2] section=1/Special\n" + "string/default_attr2[name2] section=1/Special\n" + /* defaults */ + + "string/default_attr1[default] section=0/General\n" /* imports */ + "string/name1_attr1[name1] section=1/Special\n" + "\n"); @@ -213,16 +213,16 @@ + "type:1,name1\n" + ":\n" + ":\n" - + "string/default_attr1[default] section=0/General\n" + "string/name1_attr1[name1] section=1/Special\n" + "string/name1_attr2[name1] section=1/Special\n" + + "string/default_attr1[default] section=0/General\n" + "\n" + "type:2,name2\n" + ":\n" + ":\n" + /* attributes */ /* defaults */ + "string/default_attr1[default] section=0/General\n" - /* attributes */ /* imports */ + "string/name1_attr1[name1] section=1/Special\n" // imported attributes are not affected by ignores + "string/name1_attr2[name1] section=1/Special\n" @@ -257,10 +257,10 @@ + "type:1,name1\n" + ":\n" + ":\n" - /* defaults */ /* attributes */ + "string/name1_attr1[name1] section=1/Special\n" // defined attributes are not affected by ignores + "string/name1_attr2[name1] section=1/Special\n" + /* defaults */ /* imports */ + "\n"); } @@ -290,9 +290,9 @@ + "type:1,name1\n" + ":\n" + ":\n" + /* attributes */ /* defaults */ + "text/msg[default] section=2/default\n" - /* attributes */ /* imports */ + "\n"); } @@ -324,9 +324,9 @@ + "type:1,name1\n" + ":\n" + ":\n" - /* defaults */ /* attributes */ + "text/msg[name1] section=2/name1\n" + /* defaults */ /* imports */ + "\n"); } @@ -359,8 +359,8 @@ + "type:1,name1\n" + ":\n" + ":\n" + /* attributes */ /* defaults */ - /* attributes */ /* imports */ + "\n"); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2010-05-24 18:03:23
|
Revision: 7983 http://gridarta.svn.sourceforge.net/gridarta/?rev=7983&view=rev Author: akirschbaum Date: 2010-05-24 18:03:16 +0000 (Mon, 24 May 2010) Log Message: ----------- Replace string constants with named constants. Modified Paths: -------------- trunk/atrinik/src/app/net/sf/gridarta/var/atrinik/model/gameobject/GameObject.java trunk/atrinik/src/app/net/sf/gridarta/var/atrinik/model/scripts/DefaultScriptedEvent.java trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/model/io/DefaultGameObjectParser.java trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/model/scripts/DefaultScriptedEvent.java trunk/daimonin/src/app/net/sf/gridarta/var/daimonin/model/gameobject/GameObject.java trunk/daimonin/src/app/net/sf/gridarta/var/daimonin/model/scripts/DefaultScriptedEvent.java trunk/src/app/net/sf/gridarta/gui/gameobjectattributesdialog/GameObjectAttributesDialog.java trunk/src/app/net/sf/gridarta/gui/gameobjectattributespanel/ArchTab.java trunk/src/app/net/sf/gridarta/gui/gameobjectattributespanel/FaceTab.java trunk/src/app/net/sf/gridarta/model/archetype/Archetype.java trunk/src/app/net/sf/gridarta/model/baseobject/AbstractBaseObject.java trunk/src/app/net/sf/gridarta/model/baseobject/BaseObject.java trunk/src/app/net/sf/gridarta/model/exitconnector/ExitLocation.java trunk/src/app/net/sf/gridarta/model/gameobject/GameObjectUtils.java trunk/src/app/net/sf/gridarta/model/map/mapmodel/DefaultMapModel.java trunk/src/test/net/sf/gridarta/exitconnector/ExitConnectorActionsTest.java trunk/src/test/net/sf/gridarta/model/baseobject/AbstractBaseObjectTest.java trunk/src/test/net/sf/gridarta/model/map/mapmodel/DefaultMapModelTest.java trunk/src/test/net/sf/gridarta/model/match/NamedGameObjectMatcherTest.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-05-24 17:41:22 UTC (rev 7982) +++ trunk/atrinik/src/app/net/sf/gridarta/var/atrinik/model/gameobject/GameObject.java 2010-05-24 18:03:16 UTC (rev 7983) @@ -93,7 +93,7 @@ public void addLast(@NotNull final GameObject gameObject) { // force type change when a MONSTER is put in a spawn point if (archetypeTypeSet.getTypeOfArch(this).getTypeNo() == Archetype.TYPE_SPAWN_POINT && archetypeTypeSet.getTypeOfArch(gameObject).getTypeNo() == Archetype.TYPE_MOB) { - gameObject.setAttributeString(net.sf.gridarta.model.archetype.Archetype.TYPE, Integer.toString(Archetype.TYPE_SPAWN_POINT_MOB)); // change to SPAWN_POINT_MOB + gameObject.setAttributeString(TYPE, Integer.toString(Archetype.TYPE_SPAWN_POINT_MOB)); // change to SPAWN_POINT_MOB } super.addLast(gameObject); } @@ -105,7 +105,7 @@ public void addFirst(@NotNull final GameObject gameObject) { // force type change when a MONSTER is put in a spawn point if (archetypeTypeSet.getTypeOfArch(this).getTypeNo() == Archetype.TYPE_SPAWN_POINT && archetypeTypeSet.getTypeOfArch(gameObject).getTypeNo() == Archetype.TYPE_MOB) { - gameObject.setAttributeString(net.sf.gridarta.model.archetype.Archetype.TYPE, Integer.toString(Archetype.TYPE_SPAWN_POINT_MOB)); // change to SPAWN_POINT_MOB + gameObject.setAttributeString(TYPE, Integer.toString(Archetype.TYPE_SPAWN_POINT_MOB)); // change to SPAWN_POINT_MOB } super.addFirst(gameObject); } Modified: trunk/atrinik/src/app/net/sf/gridarta/var/atrinik/model/scripts/DefaultScriptedEvent.java =================================================================== --- trunk/atrinik/src/app/net/sf/gridarta/var/atrinik/model/scripts/DefaultScriptedEvent.java 2010-05-24 17:41:22 UTC (rev 7982) +++ trunk/atrinik/src/app/net/sf/gridarta/var/atrinik/model/scripts/DefaultScriptedEvent.java 2010-05-24 18:03:16 UTC (rev 7983) @@ -20,6 +20,7 @@ package net.sf.gridarta.var.atrinik.model.scripts; import net.sf.gridarta.gui.scripts.ScriptedEventEditor; +import net.sf.gridarta.model.baseobject.BaseObject; import net.sf.gridarta.model.scripts.AbstractScriptedEvent; import net.sf.gridarta.model.scripts.ScriptArchUtils; import net.sf.gridarta.model.scripts.ScriptedEventFactory; @@ -36,6 +37,18 @@ public class DefaultScriptedEvent extends AbstractScriptedEvent<GameObject, MapArchObject, Archetype> { /** + * The attribute that holds the script path. + */ + @NotNull + private static final String SCRIPT_PATH = "race"; + + /** + * The attribute that holds the options. + */ + @NotNull + private static final String OPTIONS = "slaying"; + + /** * The {@link ScriptArchUtils} instance to use. */ @NotNull @@ -145,7 +158,7 @@ @Override @NotNull public String getScriptPath() { - return event.getAttributeString("race"); + return event.getAttributeString(SCRIPT_PATH); } /** @@ -154,7 +167,7 @@ @Override @NotNull public String getOptions() { - return event.getAttributeString("slaying"); + return event.getAttributeString(OPTIONS); } private void setPluginName(@NotNull final String pluginName) { @@ -187,9 +200,9 @@ final int eventType = getEventType(); event.setObjectText(""); event.setAttributeString(subtypeAttribute, Integer.toString(eventType)); - event.setAttributeString(net.sf.gridarta.model.archetype.Archetype.NAME, pluginName); - event.setAttributeString("race", scriptPath); - event.setAttributeString("slaying", options); + event.setAttributeString(BaseObject.NAME, pluginName); + event.setAttributeString(SCRIPT_PATH, scriptPath); + event.setAttributeString(OPTIONS, options); } } // class DefaultScriptedEvent Modified: trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/model/io/DefaultGameObjectParser.java =================================================================== --- trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/model/io/DefaultGameObjectParser.java 2010-05-24 17:41:22 UTC (rev 7982) +++ trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/model/io/DefaultGameObjectParser.java 2010-05-24 18:03:16 UTC (rev 7983) @@ -51,7 +51,7 @@ */ static { - addKey(net.sf.gridarta.model.archetype.Archetype.NAME); + addKey("name"); addKey("name_pl"); addKey("custom_name"); addKey("title"); Modified: trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/model/scripts/DefaultScriptedEvent.java =================================================================== --- trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/model/scripts/DefaultScriptedEvent.java 2010-05-24 17:41:22 UTC (rev 7982) +++ trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/model/scripts/DefaultScriptedEvent.java 2010-05-24 18:03:16 UTC (rev 7983) @@ -20,6 +20,7 @@ package net.sf.gridarta.var.crossfire.model.scripts; import net.sf.gridarta.gui.scripts.ScriptedEventEditor; +import net.sf.gridarta.model.baseobject.BaseObject; import net.sf.gridarta.model.scripts.AbstractScriptedEvent; import net.sf.gridarta.model.scripts.ScriptArchUtils; import net.sf.gridarta.model.scripts.ScriptedEventFactory; @@ -36,6 +37,18 @@ public class DefaultScriptedEvent extends AbstractScriptedEvent<GameObject, MapArchObject, Archetype> { /** + * The attribute that holds the plugin name. + */ + @NotNull + private static final String PLUGIN_NAME = "title"; + + /** + * The attribute that holds the options. + */ + @NotNull + private static final String OPTIONS = "slaying"; + + /** * The {@link ScriptArchUtils} instance to use. */ @NotNull @@ -134,7 +147,7 @@ @Override @NotNull public String getPluginName() { - return event.getAttributeString("title"); + return event.getAttributeString(PLUGIN_NAME); } /** @@ -143,7 +156,7 @@ @Override @NotNull public String getScriptPath() { - return event.getAttributeString("slaying"); + return event.getAttributeString(OPTIONS); } /** @@ -184,9 +197,9 @@ final int eventType = getEventType(); event.setObjectText(""); event.setAttributeString(subtypeAttribute, Integer.toString(eventType)); - event.setAttributeString("title", pluginName); - event.setAttributeString("slaying", scriptPath); - event.setAttributeString(net.sf.gridarta.model.archetype.Archetype.NAME, options); + event.setAttributeString(PLUGIN_NAME, pluginName); + event.setAttributeString(OPTIONS, scriptPath); + event.setAttributeString(BaseObject.NAME, options); } } // class DefaultScriptedEvent 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-05-24 17:41:22 UTC (rev 7982) +++ trunk/daimonin/src/app/net/sf/gridarta/var/daimonin/model/gameobject/GameObject.java 2010-05-24 18:03:16 UTC (rev 7983) @@ -93,7 +93,7 @@ public void addLast(@NotNull final GameObject gameObject) { // force type change when a MONSTER is put in a spawn point if (archetypeTypeSet.getTypeOfArch(this).getTypeNo() == Archetype.TYPE_SPAWN_POINT && archetypeTypeSet.getTypeOfArch(gameObject).getTypeNo() == Archetype.TYPE_MOB) { - gameObject.setAttributeString(net.sf.gridarta.model.archetype.Archetype.TYPE, Integer.toString(Archetype.TYPE_SPAWN_POINT_MOB)); // change to SPAWN_POINT_MOB + gameObject.setAttributeString(TYPE, Integer.toString(Archetype.TYPE_SPAWN_POINT_MOB)); // change to SPAWN_POINT_MOB } super.addLast(gameObject); } @@ -105,7 +105,7 @@ public void addFirst(@NotNull final GameObject gameObject) { // force type change when a MONSTER is put in a spawn point if (archetypeTypeSet.getTypeOfArch(this).getTypeNo() == Archetype.TYPE_SPAWN_POINT && archetypeTypeSet.getTypeOfArch(gameObject).getTypeNo() == Archetype.TYPE_MOB) { - gameObject.setAttributeString(net.sf.gridarta.model.archetype.Archetype.TYPE, Integer.toString(Archetype.TYPE_SPAWN_POINT_MOB)); // change to SPAWN_POINT_MOB + gameObject.setAttributeString(TYPE, Integer.toString(Archetype.TYPE_SPAWN_POINT_MOB)); // change to SPAWN_POINT_MOB } super.addFirst(gameObject); } Modified: trunk/daimonin/src/app/net/sf/gridarta/var/daimonin/model/scripts/DefaultScriptedEvent.java =================================================================== --- trunk/daimonin/src/app/net/sf/gridarta/var/daimonin/model/scripts/DefaultScriptedEvent.java 2010-05-24 17:41:22 UTC (rev 7982) +++ trunk/daimonin/src/app/net/sf/gridarta/var/daimonin/model/scripts/DefaultScriptedEvent.java 2010-05-24 18:03:16 UTC (rev 7983) @@ -20,6 +20,7 @@ package net.sf.gridarta.var.daimonin.model.scripts; import net.sf.gridarta.gui.scripts.ScriptedEventEditor; +import net.sf.gridarta.model.baseobject.BaseObject; import net.sf.gridarta.model.scripts.AbstractScriptedEvent; import net.sf.gridarta.model.scripts.ScriptArchUtils; import net.sf.gridarta.model.scripts.ScriptedEventFactory; @@ -36,6 +37,18 @@ public class DefaultScriptedEvent extends AbstractScriptedEvent<GameObject, MapArchObject, Archetype> { /** + * The attribute that holds the script path. + */ + @NotNull + private static final String SCRIPT_PATH = "race"; + + /** + * The attribute that holds the options. + */ + @NotNull + private static final String OPTIONS = "slaying"; + + /** * The {@link ScriptArchUtils} instance to use. */ @NotNull @@ -145,7 +158,7 @@ @Override @NotNull public String getScriptPath() { - return event.getAttributeString("race"); + return event.getAttributeString(SCRIPT_PATH); } /** @@ -154,7 +167,7 @@ @Override @NotNull public String getOptions() { - return event.getAttributeString("slaying"); + return event.getAttributeString(OPTIONS); } private void setPluginName(@NotNull final String pluginName) { @@ -187,9 +200,9 @@ final int eventType = getEventType(); event.setObjectText(""); event.setAttributeString(subtypeAttribute, Integer.toString(eventType)); - event.setAttributeString(net.sf.gridarta.model.archetype.Archetype.NAME, pluginName); - event.setAttributeString("race", scriptPath); - event.setAttributeString("slaying", options); + event.setAttributeString(BaseObject.NAME, pluginName); + event.setAttributeString(SCRIPT_PATH, scriptPath); + event.setAttributeString(OPTIONS, options); } } // class DefaultScriptedEvent Modified: trunk/src/app/net/sf/gridarta/gui/gameobjectattributesdialog/GameObjectAttributesDialog.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/gameobjectattributesdialog/GameObjectAttributesDialog.java 2010-05-24 17:41:22 UTC (rev 7982) +++ trunk/src/app/net/sf/gridarta/gui/gameobjectattributesdialog/GameObjectAttributesDialog.java 2010-05-24 18:03:16 UTC (rev 7983) @@ -1255,7 +1255,7 @@ // --- parsing succeeded, now we write it into the gameObject/map --- final int typeNo = gameObject.getTypeNo(); gameObject.setObjectText(newArchText.toString()); - gameObject.setAttributeString(Archetype.TYPE, Integer.toString(typeNo)); + gameObject.setAttributeString(BaseObject.TYPE, Integer.toString(typeNo)); if (newMsg[0] != null) { // set new msg text only when it is not equal to Archetype @@ -1541,7 +1541,7 @@ gameObjectAttributesDialog.archetypeType = newType; // change the gameObject to be of the new type: - gameObject.setAttributeString(Archetype.TYPE, Integer.toString(newType.getTypeNo())); + gameObject.setAttributeString(BaseObject.TYPE, Integer.toString(newType.getTypeNo())); dialogAttributes.clear(); type = gameObjectAttributesDialog.typeComboBox.getSelectedIndex(); Modified: trunk/src/app/net/sf/gridarta/gui/gameobjectattributespanel/ArchTab.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/gameobjectattributespanel/ArchTab.java 2010-05-24 17:41:22 UTC (rev 7982) +++ trunk/src/app/net/sf/gridarta/gui/gameobjectattributespanel/ArchTab.java 2010-05-24 18:03:16 UTC (rev 7983) @@ -262,7 +262,7 @@ */ @Override protected void apply(@NotNull final G gameObject) { - gameObject.setAttributeString(Archetype.NAME, archNameField.getText()); + gameObject.setAttributeString(BaseObject.NAME, archNameField.getText()); } /** @@ -276,7 +276,7 @@ if (gameObject == null) { setArchNameField("", Color.black); } else { - final String objName = gameObject.getAttributeString("name", false); + final String objName = gameObject.getAttributeString(BaseObject.NAME, false); if (objName.length() > 0) { setArchNameField(objName, Color.blue); } else { @@ -476,7 +476,7 @@ final MapModel<G, A, R> mapModel = mapSquare.getMapModel(); mapModel.beginTransaction("Change object attributes"); try { - selectedGameObject.setAttributeString("direction", Integer.toString(direction)); + selectedGameObject.setAttributeString(BaseObject.DIRECTION, Integer.toString(direction)); } finally { mapModel.endTransaction(); } Modified: trunk/src/app/net/sf/gridarta/gui/gameobjectattributespanel/FaceTab.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/gameobjectattributespanel/FaceTab.java 2010-05-24 17:41:22 UTC (rev 7982) +++ trunk/src/app/net/sf/gridarta/gui/gameobjectattributespanel/FaceTab.java 2010-05-24 18:03:16 UTC (rev 7983) @@ -37,6 +37,7 @@ import net.sf.gridarta.gui.utils.Severity; import net.sf.gridarta.model.anim.AnimationObjects; import net.sf.gridarta.model.archetype.Archetype; +import net.sf.gridarta.model.baseobject.BaseObject; import net.sf.gridarta.model.data.NamedObjects; import net.sf.gridarta.model.face.FaceObjectProviders; import net.sf.gridarta.model.face.FaceObjects; @@ -120,7 +121,7 @@ final MapModel<G, A, R> mapModel = mapSquare.getMapModel(); mapModel.beginTransaction("Change object attributes"); try { - gameObject.setAttributeString("direction", Integer.toString(dir)); + gameObject.setAttributeString(BaseObject.DIRECTION, Integer.toString(dir)); } finally { mapModel.endTransaction(); } @@ -331,9 +332,9 @@ faceName2 = faceName; } if (faceName2 == null) { - gameObject.removeAttribute("face"); + gameObject.removeAttribute(BaseObject.FACE); } else { - gameObject.setAttributeString("face", faceName2); + gameObject.setAttributeString(BaseObject.FACE, faceName2); } final String animName = normalizeFace(animationComponent.getAnimName()); @@ -345,9 +346,9 @@ animName2 = animName; } if (animName2 == null) { - gameObject.removeAttribute("animation"); + gameObject.removeAttribute(BaseObject.ANIMATION); } else { - gameObject.setAttributeString("animation", animName2); + gameObject.setAttributeString(BaseObject.ANIMATION, animName2); } final boolean isAnimated = animatedCheckBox.isSelected(); Modified: trunk/src/app/net/sf/gridarta/model/archetype/Archetype.java =================================================================== --- trunk/src/app/net/sf/gridarta/model/archetype/Archetype.java 2010-05-24 17:41:22 UTC (rev 7982) +++ trunk/src/app/net/sf/gridarta/model/archetype/Archetype.java 2010-05-24 18:03:16 UTC (rev 7983) @@ -40,16 +40,6 @@ public interface Archetype<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>> extends BaseObject<G, A, R, R> { /** - * The attribute name of the archetype's object type. - */ - String TYPE = "type"; - - /** - * The attribute name of the archetype's object name. - */ - String NAME = "name"; - - /** * Return whether this archetype uses the "direction" attribute. * @return Whether this archetype uses the "direction" attribute. */ Modified: trunk/src/app/net/sf/gridarta/model/baseobject/AbstractBaseObject.java =================================================================== --- trunk/src/app/net/sf/gridarta/model/baseobject/AbstractBaseObject.java 2010-05-24 17:41:22 UTC (rev 7982) +++ trunk/src/app/net/sf/gridarta/model/baseobject/AbstractBaseObject.java 2010-05-24 18:03:16 UTC (rev 7983) @@ -422,11 +422,11 @@ protected void updateArchetype() { beginGameObjectChange(); try { - direction = getAttributeInt("direction"); - setFaceName(getAttributeString("face")); - setAnimName(getAttributeString("animation")); - setTypeNo(getAttributeInt(Archetype.TYPE)); - setObjName(getAttributeString(Archetype.NAME)); + direction = getAttributeInt(DIRECTION); + setFaceName(getAttributeString(FACE)); + setAnimName(getAttributeString(ANIMATION)); + setTypeNo(getAttributeInt(TYPE)); + setObjName(getAttributeString(NAME)); setObjectFace(); if (multi != null) { final int multiShapeID = getArchetype().getMultiShapeID(); @@ -782,11 +782,11 @@ beginGameObjectChange(); try { gameObjectText.addObjectText(line); - direction = getAttributeInt("direction"); - setFaceName(getAttributeString("face")); - setAnimName(getAttributeString("animation")); - setTypeNo(getAttributeInt(Archetype.TYPE)); - setObjName(getAttributeString(Archetype.NAME)); + direction = getAttributeInt(DIRECTION); + setFaceName(getAttributeString(FACE)); + setAnimName(getAttributeString(ANIMATION)); + setTypeNo(getAttributeInt(TYPE)); + setObjName(getAttributeString(NAME)); setObjectFace(); } finally { endGameObjectChange(); @@ -805,11 +805,11 @@ beginGameObjectChange(); try { gameObjectText.setObjectText(objectText); - direction = getAttributeInt("direction"); - setFaceName(getAttributeString("face")); - setAnimName(getAttributeString("animation")); - setTypeNo(getAttributeInt(Archetype.TYPE)); - setObjName(getAttributeString(Archetype.NAME)); + direction = getAttributeInt(DIRECTION); + setFaceName(getAttributeString(FACE)); + setAnimName(getAttributeString(ANIMATION)); + setTypeNo(getAttributeInt(TYPE)); + setObjName(getAttributeString(NAME)); setObjectFace(); } finally { endGameObjectChange(); Modified: trunk/src/app/net/sf/gridarta/model/baseobject/BaseObject.java =================================================================== --- trunk/src/app/net/sf/gridarta/model/baseobject/BaseObject.java 2010-05-24 17:41:22 UTC (rev 7982) +++ trunk/src/app/net/sf/gridarta/model/baseobject/BaseObject.java 2010-05-24 18:03:16 UTC (rev 7983) @@ -33,6 +33,36 @@ public interface BaseObject<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>, T extends BaseObject<G, A, R, T>> extends Cloneable, Iterable<G>, Serializable { /** + * The attribute name of the object's animation. + */ + @NotNull + String ANIMATION = "animation"; + + /** + * The attribute name of the object's direction. + */ + @NotNull + String DIRECTION = "direction"; + + /** + * The attribute name of the object's face. + */ + @NotNull + String FACE = "face"; + + /** + * The attribute name of the object's name. + */ + @NotNull + String NAME = "name"; + + /** + * The attribute name of the object's type. + */ + @NotNull + String TYPE = "type"; + + /** * Returns the type number of this Archetype. * @return The type number of this Archetype. */ Modified: trunk/src/app/net/sf/gridarta/model/exitconnector/ExitLocation.java =================================================================== --- trunk/src/app/net/sf/gridarta/model/exitconnector/ExitLocation.java 2010-05-24 17:41:22 UTC (rev 7982) +++ trunk/src/app/net/sf/gridarta/model/exitconnector/ExitLocation.java 2010-05-24 18:03:16 UTC (rev 7983) @@ -21,7 +21,6 @@ import java.awt.Point; import java.io.File; -import net.sf.gridarta.model.archetype.Archetype; import net.sf.gridarta.model.baseobject.BaseObject; import net.sf.gridarta.model.io.PathManager; import org.jetbrains.annotations.NotNull; @@ -110,7 +109,7 @@ gameObject.setAttributeString("hp", Integer.toString(x)); gameObject.setAttributeString("sp", Integer.toString(y)); if (updateName) { - gameObject.setAttributeString(Archetype.NAME, mapName); + gameObject.setAttributeString(BaseObject.NAME, mapName); } } Modified: trunk/src/app/net/sf/gridarta/model/gameobject/GameObjectUtils.java =================================================================== --- trunk/src/app/net/sf/gridarta/model/gameobject/GameObjectUtils.java 2010-05-24 17:41:22 UTC (rev 7982) +++ trunk/src/app/net/sf/gridarta/model/gameobject/GameObjectUtils.java 2010-05-24 18:03:16 UTC (rev 7983) @@ -64,7 +64,7 @@ // now check if there's a match in the definitions /* we exclude "direction", "type", and "name" on the hard way */ - if (!attrKey.equals("direction") && !attrKey.equals(Archetype.TYPE) && !attrKey.equals(Archetype.NAME) && !type.hasAttributeKey(attrKey)) { + if (!attrKey.equals(BaseObject.DIRECTION) && !attrKey.equals(BaseObject.TYPE) && !attrKey.equals(BaseObject.NAME) && !type.hasAttributeKey(attrKey)) { errors.append(line.trim()).append('\n'); // append line to the errors /* // the attribute doesn't match the definitions, Modified: trunk/src/app/net/sf/gridarta/model/map/mapmodel/DefaultMapModel.java =================================================================== --- trunk/src/app/net/sf/gridarta/model/map/mapmodel/DefaultMapModel.java 2010-05-24 17:41:22 UTC (rev 7982) +++ trunk/src/app/net/sf/gridarta/model/map/mapmodel/DefaultMapModel.java 2010-05-24 18:03:16 UTC (rev 7983) @@ -852,7 +852,7 @@ part = archetypePart.newInstance(gameObjectFactory); } if (direction != null) { - part.setAttributeString("direction", direction.toString()); + part.setAttributeString(BaseObject.DIRECTION, direction.toString()); } if (!parts.isEmpty()) { parts.get(0).addTailPart(part); Modified: trunk/src/test/net/sf/gridarta/exitconnector/ExitConnectorActionsTest.java =================================================================== --- trunk/src/test/net/sf/gridarta/exitconnector/ExitConnectorActionsTest.java 2010-05-24 17:41:22 UTC (rev 7982) +++ trunk/src/test/net/sf/gridarta/exitconnector/ExitConnectorActionsTest.java 2010-05-24 18:03:16 UTC (rev 7983) @@ -28,7 +28,6 @@ import net.sf.gridarta.mapmanager.TestFileControl; import net.sf.gridarta.model.anim.AnimationObjects; import net.sf.gridarta.model.anim.DefaultAnimationObjects; -import net.sf.gridarta.model.archetype.Archetype; import net.sf.gridarta.model.archetype.ArchetypeFactory; import net.sf.gridarta.model.archetype.ArchetypeSet; import net.sf.gridarta.model.archetype.DuplicateArchetypeException; @@ -406,11 +405,11 @@ mapManager = tmpMapManager; floorArchetype = new TestArchetype("floor", faceObjectProviders, animationObjects); - floorArchetype.setAttributeString(Archetype.TYPE, Integer.toString(FLOOR_TYPE)); + floorArchetype.setAttributeString(BaseObject.TYPE, Integer.toString(FLOOR_TYPE)); archetypeSet.addArchetype(floorArchetype); exitArchetype = new TestArchetype("exit", faceObjectProviders, animationObjects); - exitArchetype.setAttributeString(Archetype.TYPE, Integer.toString(EXIT_TYPE)); + exitArchetype.setAttributeString(BaseObject.TYPE, Integer.toString(EXIT_TYPE)); archetypeSet.addArchetype(exitArchetype); } Modified: trunk/src/test/net/sf/gridarta/model/baseobject/AbstractBaseObjectTest.java =================================================================== --- trunk/src/test/net/sf/gridarta/model/baseobject/AbstractBaseObjectTest.java 2010-05-24 17:41:22 UTC (rev 7982) +++ trunk/src/test/net/sf/gridarta/model/baseobject/AbstractBaseObjectTest.java 2010-05-24 18:03:16 UTC (rev 7983) @@ -22,7 +22,6 @@ import java.util.regex.Pattern; import net.sf.gridarta.model.anim.AnimationObjects; import net.sf.gridarta.model.anim.DefaultAnimationObjects; -import net.sf.gridarta.model.archetype.Archetype; import net.sf.gridarta.model.archetype.TestArchetype; import net.sf.gridarta.model.face.ArchFaceProvider; import net.sf.gridarta.model.face.DefaultFaceObjects; @@ -60,7 +59,7 @@ final FaceObjectProviders faceObjectProviders = newFaceObjectProviders(); final TestArchetype archetype = newArchetype("arch", null, faceObjectProviders, animationObjects); Assert.assertNull(archetype.getFaceName()); - archetype.setAttributeString("face", "archface"); + archetype.setAttributeString(BaseObject.FACE, "archface"); Assert.assertEquals("archface", archetype.getFaceName()); final GameObject<TestGameObject, TestMapArchObject, TestArchetype> gameObject = newGameObject(archetype, "test", faceObjectProviders, animationObjects); @@ -74,7 +73,7 @@ // set face by text change gameObject.setAttributeString("face1", "face1"); Assert.assertNull(gameObject.getFaceName()); - gameObject.setAttributeString("face", "face2"); + gameObject.setAttributeString(BaseObject.FACE, "face2"); Assert.assertEquals("face2", gameObject.getFaceName()); gameObject.setAttributeString("face2", "face3"); Assert.assertEquals("face2", gameObject.getFaceName()); @@ -245,7 +244,7 @@ } /** - * Checks that the "direction" attribute of an {@link GameObject} contains + * Checks that the "direction" attribute of a {@link GameObject} contains * the expected value. * @param gameObject the game object to check * @param direction the expected direction @@ -256,7 +255,7 @@ } /** - * Checks that caching the "type" attribute does work. + * Checks that caching the {@link }BaseObject#TYPE} attribute does work. */ @Test public void testType1() { @@ -265,16 +264,16 @@ final TestArchetype archetype = newArchetype("arch", null, faceObjectProviders, animationObjects); final GameObject<TestGameObject, TestMapArchObject, TestArchetype> gameObject = newGameObject(archetype, "test", faceObjectProviders, animationObjects); checkType(gameObject, 0); - gameObject.setAttributeString("type", "3"); + gameObject.setAttributeString(BaseObject.TYPE, "3"); checkType(gameObject, 3); - gameObject.removeAttribute("type"); + gameObject.removeAttribute(BaseObject.TYPE); checkType(gameObject, 0); gameObject.setObjectText("type 3"); checkType(gameObject, 3); } /** - * Checks that caching the "type" attribute does work. + * Checks that caching the {@link BaseObject#NAME} attribute does work. */ @Test public void testType2() { @@ -283,14 +282,14 @@ final TestArchetype archetype = newArchetype("arch", "type 2", faceObjectProviders, animationObjects); final GameObject<TestGameObject, TestMapArchObject, TestArchetype> gameObject = newGameObject(archetype, "test", faceObjectProviders, animationObjects); checkType(gameObject, 2); - gameObject.setAttributeString("type", "3"); + gameObject.setAttributeString(BaseObject.TYPE, "3"); checkType(gameObject, 3); - gameObject.removeAttribute("type"); + gameObject.removeAttribute(BaseObject.TYPE); checkType(gameObject, 2); } /** - * Checks that caching the "type" attribute does work. + * Checks that caching the {@link BaseObject#TYPE} attribute does work. */ @Test public void testType3() { @@ -302,27 +301,27 @@ checkType(gameObject, 1); gameObject.setArchetype(archetype2); checkType(gameObject, 2); - gameObject.setAttributeString("type", "4"); + gameObject.setAttributeString(BaseObject.TYPE, "4"); checkType(gameObject, 4); gameObject.setArchetype(archetype1); checkType(gameObject, 4); - gameObject.removeAttribute("type"); + gameObject.removeAttribute(BaseObject.TYPE); checkType(gameObject, 1); } /** - * Checks that the "type" attribute of an {@link GameObject} contains the - * expected value. + * Checks that the {@link BaseObject#TYPE} attribute of a {@link GameObject} + * contains the expected value. * @param gameObject the game object to check * @param type the expected direction */ private static void checkType(@NotNull final BaseObject<?, ?, ?, ?> gameObject, final int type) { Assert.assertEquals(type, gameObject.getTypeNo()); - Assert.assertEquals(type, gameObject.getAttributeInt("type")); + Assert.assertEquals(type, gameObject.getAttributeInt(BaseObject.TYPE)); } /** - * Checks that caching the "name" attribute does work. + * Checks that caching the {@link BaseObject#NAME} attribute does work. */ @Test public void testName1() { @@ -331,16 +330,16 @@ final TestArchetype archetype = newArchetype("arch", null, faceObjectProviders, animationObjects); final BaseObject<?, ?, ?, ?> gameObject = new TestGameObject(archetype, faceObjectProviders, animationObjects); checkName(gameObject, "arch", ""); - gameObject.setAttributeString("name", "3"); + gameObject.setAttributeString(BaseObject.NAME, "3"); checkName(gameObject, "3", "3"); - gameObject.removeAttribute("name"); + gameObject.removeAttribute(BaseObject.NAME); checkName(gameObject, "arch", ""); gameObject.setObjectText("name 3"); checkName(gameObject, "3", "3"); } /** - * Checks that caching the "name" attribute does work. + * Checks that caching the {@link BaseObject#NAME} attribute does work. */ @Test public void testName2() { @@ -349,14 +348,14 @@ final TestArchetype archetype = newArchetype("arch", "name 2", faceObjectProviders, animationObjects); final BaseObject<?, ?, ?, ?> gameObject = new TestGameObject(archetype, faceObjectProviders, animationObjects); checkName(gameObject, "2", "2"); - gameObject.setAttributeString("name", "3"); + gameObject.setAttributeString(BaseObject.NAME, "3"); checkName(gameObject, "3", "3"); - gameObject.removeAttribute("name"); + gameObject.removeAttribute(BaseObject.NAME); checkName(gameObject, "2", "2"); } /** - * Checks that caching the "name" attribute does work. + * Checks that caching the {@link BaseObject#NAME} attribute does work. */ @Test public void testName3() { @@ -368,24 +367,24 @@ checkName(gameObject, "1", "1"); gameObject.setArchetype(archetype2); checkName(gameObject, "2", "2"); - gameObject.setAttributeString("name", "4"); + gameObject.setAttributeString(BaseObject.NAME, "4"); checkName(gameObject, "4", "4"); gameObject.setArchetype(archetype1); checkName(gameObject, "4", "4"); - gameObject.removeAttribute("name"); + gameObject.removeAttribute(BaseObject.NAME); checkName(gameObject, "1", "1"); } /** - * Checks that the "name" attribute of an {@link GameObject} contains the - * expected value. + * Checks that the {@link BaseObject#NAME} attribute of an {@link + * GameObject} contains the expected value. * @param gameObject the game object to check * @param name the expected name (cached value) * @param nameAttribute the expected name ("name" attribute) */ private static void checkName(@NotNull final BaseObject<?, ?, ?, ?> gameObject, @NotNull final String name, @NotNull final String nameAttribute) { Assert.assertEquals(name, gameObject.getObjName()); - Assert.assertEquals(nameAttribute, gameObject.getAttributeString("name")); + Assert.assertEquals(nameAttribute, gameObject.getAttributeString(BaseObject.NAME)); } /** @@ -418,7 +417,7 @@ @NotNull private static GameObject<TestGameObject, TestMapArchObject, TestArchetype> newGameObject(@NotNull final TestArchetype archetype, @NotNull final String name, @NotNull final FaceObjectProviders faceObjectProviders, @NotNull final AnimationObjects animationObjects) { final GameObject<TestGameObject, TestMapArchObject, TestArchetype> gameObject = new TestGameObject(archetype, faceObjectProviders, animationObjects); - gameObject.setAttributeString(Archetype.NAME, name); + gameObject.setAttributeString(BaseObject.NAME, name); return gameObject; } Modified: trunk/src/test/net/sf/gridarta/model/map/mapmodel/DefaultMapModelTest.java =================================================================== --- trunk/src/test/net/sf/gridarta/model/map/mapmodel/DefaultMapModelTest.java 2010-05-24 17:41:22 UTC (rev 7982) +++ trunk/src/test/net/sf/gridarta/model/map/mapmodel/DefaultMapModelTest.java 2010-05-24 18:03:16 UTC (rev 7983) @@ -30,7 +30,6 @@ import javax.swing.ImageIcon; import net.sf.gridarta.model.anim.AnimationObjects; import net.sf.gridarta.model.anim.DefaultAnimationObjects; -import net.sf.gridarta.model.archetype.Archetype; import net.sf.gridarta.model.archetype.TestArchetype; import net.sf.gridarta.model.archetypechooser.ArchetypeChooserModel; import net.sf.gridarta.model.autojoin.AutojoinLists; @@ -398,7 +397,7 @@ final TestArchetype archetype = new TestArchetype("arch", faceObjectProviders, animationObjects); assert animationObjects != null; final TestGameObject gameObject = new TestGameObject(archetype, faceObjectProviders, animationObjects); - gameObject.setAttributeString(Archetype.NAME, objectName); + gameObject.setAttributeString(BaseObject.NAME, objectName); return gameObject; } Modified: trunk/src/test/net/sf/gridarta/model/match/NamedGameObjectMatcherTest.java =================================================================== --- trunk/src/test/net/sf/gridarta/model/match/NamedGameObjectMatcherTest.java 2010-05-24 17:41:22 UTC (rev 7982) +++ trunk/src/test/net/sf/gridarta/model/match/NamedGameObjectMatcherTest.java 2010-05-24 18:03:16 UTC (rev 7983) @@ -22,8 +22,8 @@ import java.util.regex.Pattern; import net.sf.gridarta.model.anim.AnimationObjects; import net.sf.gridarta.model.anim.DefaultAnimationObjects; -import net.sf.gridarta.model.archetype.Archetype; import net.sf.gridarta.model.archetype.TestArchetype; +import net.sf.gridarta.model.baseobject.BaseObject; import net.sf.gridarta.model.face.ArchFaceProvider; import net.sf.gridarta.model.face.DefaultFaceObjects; import net.sf.gridarta.model.face.FaceObjectProviders; @@ -112,7 +112,7 @@ @NotNull private static TestArchetype newArchetype(@NotNull final String archetypeName, final int typeNo, @NotNull final FaceObjectProviders faceObjectProviders, @NotNull final AnimationObjects animationObjects) { final TestArchetype archetype = new TestArchetype(archetypeName, faceObjectProviders, animationObjects); - archetype.setAttributeString(Archetype.TYPE, Integer.toString(typeNo)); + archetype.setAttributeString(BaseObject.TYPE, Integer.toString(typeNo)); return archetype; } @@ -126,7 +126,7 @@ @NotNull private static TestGameObject newGameObject(@NotNull final TestGameObjectFactory gameObjectFactory, @NotNull final TestArchetype archetype, @NotNull final String gameObjectName) { final TestGameObject gameObject = gameObjectFactory.createGameObject(archetype); - gameObject.setAttributeString(Archetype.NAME, gameObjectName); + gameObject.setAttributeString(BaseObject.NAME, gameObjectName); return gameObject; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2010-05-24 17:41:30
|
Revision: 7982 http://gridarta.svn.sourceforge.net/gridarta/?rev=7982&view=rev Author: akirschbaum Date: 2010-05-24 17:41:22 +0000 (Mon, 24 May 2010) Log Message: ----------- Simplify code. Modified Paths: -------------- trunk/src/app/net/sf/gridarta/model/gameobject/GameObjectUtils.java Modified: trunk/src/app/net/sf/gridarta/model/gameobject/GameObjectUtils.java =================================================================== --- trunk/src/app/net/sf/gridarta/model/gameobject/GameObjectUtils.java 2010-05-24 17:39:38 UTC (rev 7981) +++ trunk/src/app/net/sf/gridarta/model/gameobject/GameObjectUtils.java 2010-05-24 17:41:22 UTC (rev 7982) @@ -63,14 +63,8 @@ final Comparable<String> attrKey = spaceIndex == -1 ? line : line.substring(0, spaceIndex); // now check if there's a match in the definitions - final boolean doesMatch; /* we exclude "direction", "type", and "name" on the hard way */ - if (attrKey.compareTo("direction") == 0 || attrKey.equals(Archetype.TYPE) || attrKey.equals(Archetype.NAME)) { - doesMatch = true; - } else { - doesMatch = type.hasAttributeKey(attrKey); - } - if (!doesMatch) { + if (!attrKey.equals("direction") && !attrKey.equals(Archetype.TYPE) && !attrKey.equals(Archetype.NAME) && !type.hasAttributeKey(attrKey)) { errors.append(line.trim()).append('\n'); // append line to the errors /* // the attribute doesn't match the definitions, This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2010-05-24 17:39:44
|
Revision: 7981 http://gridarta.svn.sourceforge.net/gridarta/?rev=7981&view=rev Author: akirschbaum Date: 2010-05-24 17:39:38 +0000 (Mon, 24 May 2010) Log Message: ----------- Move code into ArchetypeType. Modified Paths: -------------- trunk/src/app/net/sf/gridarta/gui/gameobjectattributesdialog/GameObjectAttributesDialog.java trunk/src/app/net/sf/gridarta/gui/gameobjecttexteditor/GameObjectTextEditor.java trunk/src/app/net/sf/gridarta/model/archetypetype/ArchetypeType.java trunk/src/app/net/sf/gridarta/model/gameobject/GameObjectUtils.java Modified: trunk/src/app/net/sf/gridarta/gui/gameobjectattributesdialog/GameObjectAttributesDialog.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/gameobjectattributesdialog/GameObjectAttributesDialog.java 2010-05-24 17:39:03 UTC (rev 7980) +++ trunk/src/app/net/sf/gridarta/gui/gameobjectattributesdialog/GameObjectAttributesDialog.java 2010-05-24 17:39:38 UTC (rev 7981) @@ -1005,7 +1005,7 @@ for (int sectionId = 0; sectionId < archetypeType.getSectionNum(); sectionId++) { final Component panel = makeAttributePanel(sectionId); if (panel != null) { - final String sectionName = getSectionName(sectionId); + final String sectionName = archetypeType.getSectionName(sectionId); assert tabbedPane != null; tabbedPane.addTab(sectionName, null, panel); } @@ -1112,22 +1112,6 @@ } /** - * Looks up the section name from the ID. - * @param sectionId ID of the section - * @return name of that section - */ - @NotNull - private String getSectionName(final int sectionId) { - for (final ArchetypeAttribute<G, A, R> archetypeAttribute : archetypeType) { - if (archetypeAttribute.getSectionId() == sectionId) { - return archetypeAttribute.getCapitalizedSectionName(); - } - } - - return "???"; - } - - /** * Construct the dialog options: help, default, okay, apply, cancel. * @return Object[] with dialog options */ Modified: trunk/src/app/net/sf/gridarta/gui/gameobjecttexteditor/GameObjectTextEditor.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/gameobjecttexteditor/GameObjectTextEditor.java 2010-05-24 17:39:03 UTC (rev 7980) +++ trunk/src/app/net/sf/gridarta/gui/gameobjecttexteditor/GameObjectTextEditor.java 2010-05-24 17:39:38 UTC (rev 7981) @@ -37,7 +37,7 @@ import javax.swing.text.StyleContext; import net.sf.gridarta.model.archetype.Archetype; import net.sf.gridarta.model.archetype.AttributeListUtils; -import net.sf.gridarta.model.archetypetype.ArchetypeAttribute; +import net.sf.gridarta.model.archetypetype.ArchetypeType; import net.sf.gridarta.model.archetypetype.ArchetypeTypeSet; import net.sf.gridarta.model.gameobject.GameObject; import net.sf.gridarta.model.gameobject.GameObjectUtils; @@ -121,7 +121,7 @@ try { final Document document = archEdit.getDocument(); - final Iterable<ArchetypeAttribute<G, A, R>> typeStruct = archetypeTypeSet.getTypeOfArch(gameObject); + final ArchetypeType<G, A, R> typeStruct = archetypeTypeSet.getTypeOfArch(gameObject); final String errorText = GameObjectUtils.getSyntaxErrors(gameObject, typeStruct); if (errorText == null) { Modified: trunk/src/app/net/sf/gridarta/model/archetypetype/ArchetypeType.java =================================================================== --- trunk/src/app/net/sf/gridarta/model/archetypetype/ArchetypeType.java 2010-05-24 17:39:03 UTC (rev 7980) +++ trunk/src/app/net/sf/gridarta/model/archetypetype/ArchetypeType.java 2010-05-24 17:39:38 UTC (rev 7981) @@ -181,6 +181,37 @@ } /** + * Looks up the section name from the ID. + * @param sectionId ID of the section + * @return name of that section + */ + @NotNull + public String getSectionName(final int sectionId) { + for (final ArchetypeAttribute<G, A, R> archetypeAttribute : archetypeAttributes) { + if (archetypeAttribute.getSectionId() == sectionId) { + return archetypeAttribute.getCapitalizedSectionName(); + } + } + + return "???"; + } + + /** + * Returns whether an attribute key is defined. + * @param key the attribute key + * @return whether the attribute key is defined + */ + public boolean hasAttributeKey(@NotNull final Comparable<String> key) { + for (final ArchetypeAttribute<G, A, R> attr : archetypeAttributes) { + if (attr.getArchetypeAttributeName().equals(key)) { + return true; + } + } + + return false; + } + + /** * {@inheritDoc} */ @NotNull Modified: trunk/src/app/net/sf/gridarta/model/gameobject/GameObjectUtils.java =================================================================== --- trunk/src/app/net/sf/gridarta/model/gameobject/GameObjectUtils.java 2010-05-24 17:39:03 UTC (rev 7980) +++ trunk/src/app/net/sf/gridarta/model/gameobject/GameObjectUtils.java 2010-05-24 17:39:38 UTC (rev 7981) @@ -20,7 +20,7 @@ package net.sf.gridarta.model.gameobject; import net.sf.gridarta.model.archetype.Archetype; -import net.sf.gridarta.model.archetypetype.ArchetypeAttribute; +import net.sf.gridarta.model.archetypetype.ArchetypeType; import net.sf.gridarta.model.baseobject.BaseObject; import net.sf.gridarta.model.map.maparchobject.MapArchObject; import net.sf.gridarta.utils.StringUtils; @@ -55,7 +55,7 @@ * returned. */ @Nullable - public static <G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>> String getSyntaxErrors(@NotNull final BaseObject<G, A, R, ?> gameObject, @NotNull final Iterable<ArchetypeAttribute<G, A, R>> type) { + public static <G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>> String getSyntaxErrors(@NotNull final BaseObject<G, A, R, ?> gameObject, @NotNull final ArchetypeType<G, A, R> type) { final StringBuilder errors = new StringBuilder(); // return value: all error lines for (final String line : StringUtils.PATTERN_END_OF_LINE.split(gameObject.getObjectText())) { // get only the key-part of the attribute. @@ -63,17 +63,12 @@ final Comparable<String> attrKey = spaceIndex == -1 ? line : line.substring(0, spaceIndex); // now check if there's a match in the definitions - boolean doesMatch = false; + final boolean doesMatch; /* we exclude "direction", "type", and "name" on the hard way */ if (attrKey.compareTo("direction") == 0 || attrKey.equals(Archetype.TYPE) || attrKey.equals(Archetype.NAME)) { doesMatch = true; } else { - for (final ArchetypeAttribute<G, A, R> attr : type) { - if (attr.getArchetypeAttributeName().equals(attrKey)) { - doesMatch = true; - break; - } - } + doesMatch = type.hasAttributeKey(attrKey); } if (!doesMatch) { errors.append(line.trim()).append('\n'); // append line to the errors This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2010-05-24 17:39:09
|
Revision: 7980 http://gridarta.svn.sourceforge.net/gridarta/?rev=7980&view=rev Author: akirschbaum Date: 2010-05-24 17:39:03 +0000 (Mon, 24 May 2010) Log Message: ----------- Fix regression tests. Modified Paths: -------------- trunk/src/test/net/sf/gridarta/model/archetypetype/ArchetypeTypeSetParserTest.java Modified: trunk/src/test/net/sf/gridarta/model/archetypetype/ArchetypeTypeSetParserTest.java =================================================================== --- trunk/src/test/net/sf/gridarta/model/archetypetype/ArchetypeTypeSetParserTest.java 2010-05-24 17:11:42 UTC (rev 7979) +++ trunk/src/test/net/sf/gridarta/model/archetypetype/ArchetypeTypeSetParserTest.java 2010-05-24 17:39:03 UTC (rev 7980) @@ -410,7 +410,9 @@ + "<types>\n" + string + "</types>\n"; - return new InputSource(new ByteArrayInputStream(typesString.getBytes("UTF-8"))); + final InputSource inputSource = new InputSource(new ByteArrayInputStream(typesString.getBytes("UTF-8"))); + inputSource.setSystemId("types.dtd"); + return inputSource; } /** This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2010-05-24 17:11:49
|
Revision: 7979 http://gridarta.svn.sourceforge.net/gridarta/?rev=7979&view=rev Author: akirschbaum Date: 2010-05-24 17:11:42 +0000 (Mon, 24 May 2010) Log Message: ----------- Move SyntaxErrorException to utils package. Modified Paths: -------------- trunk/src/app/net/sf/gridarta/maincontrol/GridartaEditor.java Added Paths: ----------- trunk/src/app/net/sf/gridarta/utils/SyntaxErrorException.java Removed Paths: ------------- trunk/src/app/net/sf/gridarta/commands/SyntaxErrorException.java Deleted: trunk/src/app/net/sf/gridarta/commands/SyntaxErrorException.java =================================================================== --- trunk/src/app/net/sf/gridarta/commands/SyntaxErrorException.java 2010-05-24 17:01:28 UTC (rev 7978) +++ trunk/src/app/net/sf/gridarta/commands/SyntaxErrorException.java 2010-05-24 17:11:42 UTC (rev 7979) @@ -1,43 +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.commands; - -import org.jetbrains.annotations.NotNull; - -/** - * Exception thrown for incorrect arguments. - * @author Andreas Kirschbaum - */ -public class SyntaxErrorException extends Exception { - - /** - * The serial version UID. - */ - private static final long serialVersionUID = 1L; - - /** - * Creates a new instance. - * @param usage describes the expected arguments - */ - public SyntaxErrorException(@NotNull final String usage) { - super(usage); - } - -} // class SyntaxErrorException Modified: trunk/src/app/net/sf/gridarta/maincontrol/GridartaEditor.java =================================================================== --- trunk/src/app/net/sf/gridarta/maincontrol/GridartaEditor.java 2010-05-24 17:01:28 UTC (rev 7978) +++ trunk/src/app/net/sf/gridarta/maincontrol/GridartaEditor.java 2010-05-24 17:11:42 UTC (rev 7979) @@ -38,7 +38,6 @@ import net.sf.gridarta.commands.CreateThumbsCommand; import net.sf.gridarta.commands.ScriptCommand; import net.sf.gridarta.commands.SinglePngCommand; -import net.sf.gridarta.commands.SyntaxErrorException; import net.sf.gridarta.gui.errorview.ConsoleErrorView; import net.sf.gridarta.gui.errorview.DefaultErrorView; import net.sf.gridarta.gui.filter.DefaultFilterControl; @@ -94,6 +93,7 @@ import net.sf.gridarta.script.ScriptParameters; import net.sf.gridarta.script.parameter.PluginParameterFactory; import net.sf.gridarta.utils.GUIUtils; +import net.sf.gridarta.utils.SyntaxErrorException; import net.sf.gridarta.utils.SystemIcons; import net.sf.gridarta.validation.DelegatingMapValidator; import net.sf.gridarta.validation.checks.AttributeRangeChecker; Copied: trunk/src/app/net/sf/gridarta/utils/SyntaxErrorException.java (from rev 7977, trunk/src/app/net/sf/gridarta/commands/SyntaxErrorException.java) =================================================================== --- trunk/src/app/net/sf/gridarta/utils/SyntaxErrorException.java (rev 0) +++ trunk/src/app/net/sf/gridarta/utils/SyntaxErrorException.java 2010-05-24 17:11:42 UTC (rev 7979) @@ -0,0 +1,43 @@ +/* + * 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 org.jetbrains.annotations.NotNull; + +/** + * Exception thrown for incorrect arguments. + * @author Andreas Kirschbaum + */ +public class SyntaxErrorException extends Exception { + + /** + * The serial version UID. + */ + private static final long serialVersionUID = 1L; + + /** + * Creates a new instance. + * @param usage describes the expected arguments + */ + public SyntaxErrorException(@NotNull final String usage) { + super(usage); + } + +} // class SyntaxErrorException Property changes on: trunk/src/app/net/sf/gridarta/utils/SyntaxErrorException.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-05-24 17:01:40
|
Revision: 7978 http://gridarta.svn.sourceforge.net/gridarta/?rev=7978&view=rev Author: akirschbaum Date: 2010-05-24 17:01:28 +0000 (Mon, 24 May 2010) Log Message: ----------- Whitespace changes. Modified Paths: -------------- trunk/atrinik/build.xml trunk/atrinik/devlib/JAPI.xml trunk/atrinik/devlib/checkstyle_braces.xml trunk/atrinik/devlib/checkstyle_checks.xml trunk/atrinik/devlib/checkstyle_misc.xml trunk/atrinik/devlib/checkstyle_names.xml trunk/atrinik/devlib/checkstyle_ops.xml trunk/atrinik/devlib/jalopy_format.xml trunk/atrinik/metrics/project/2005-01-01.xml trunk/atrinik/metrics/project/2006-04-01.xml trunk/atrinik/metrics/project/joinInputExample.xml trunk/atrinik/metrics/project/joinmetrics.xslt trunk/atrinik/metrics/project/joinmetrics2xhtml.xslt trunk/atrinik/metrics/project/metric2xhtml.xslt trunk/atrinik/src/app/net/sf/gridarta/var/atrinik/IGUIConstants.java trunk/atrinik/src/app/net/sf/gridarta/var/atrinik/gui/mappropertiesdialog/MapPropertiesDialog.java trunk/build.xml trunk/crossfire/build.xml trunk/crossfire/resource/conf/GameObjectMatchers.xml trunk/crossfire/resource/conf/TreasureLists.xml trunk/crossfire/resource/conf/types.xml trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/IGUIConstants.java trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/gui/mappropertiesdialog/MapPropertiesDialog.java trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/model/io/DefaultGameObjectParser.java trunk/daimonin/build.xml trunk/daimonin/devlib/JAPI.xml trunk/daimonin/devlib/checkstyle_braces.xml trunk/daimonin/devlib/checkstyle_checks.xml trunk/daimonin/devlib/checkstyle_misc.xml trunk/daimonin/devlib/checkstyle_names.xml trunk/daimonin/devlib/checkstyle_ops.xml trunk/daimonin/devlib/jalopy_format.xml trunk/daimonin/metrics/project/2005-01-01.xml trunk/daimonin/metrics/project/2006-04-01.xml trunk/daimonin/metrics/project/joinInputExample.xml trunk/daimonin/metrics/project/joinmetrics.xslt trunk/daimonin/metrics/project/joinmetrics2xhtml.xslt trunk/daimonin/metrics/project/metric2xhtml.xslt trunk/daimonin/resource/HelpFiles/treasure_special.html trunk/daimonin/resource/HelpFiles/tut_loading.html trunk/daimonin/src/app/net/sf/gridarta/var/daimonin/IGUIConstants.java trunk/daimonin/src/app/net/sf/gridarta/var/daimonin/gui/mappropertiesdialog/MapPropertiesDialog.java trunk/src/app/net/sf/gridarta/actions/AttachTiledMaps.java trunk/src/app/net/sf/gridarta/commands/Collector.java trunk/src/app/net/sf/gridarta/gui/gameobjectattributesdialog/DialogAttributeBool.java trunk/src/app/net/sf/gridarta/gui/gameobjectattributesdialog/DialogAttributeBoolSpec.java trunk/src/app/net/sf/gridarta/gui/gameobjectattributesdialog/DialogAttributeString.java trunk/src/app/net/sf/gridarta/gui/gameobjectattributesdialog/DialogAttributeTreasure.java trunk/src/app/net/sf/gridarta/gui/gameobjectattributesdialog/GuiInfo.java trunk/src/app/net/sf/gridarta/gui/gameobjectattributespanel/EventsTab.java trunk/src/app/net/sf/gridarta/gui/map/cursor/MapCursorActions.java trunk/src/app/net/sf/gridarta/gui/misc/HelpActions.java trunk/src/app/net/sf/gridarta/gui/script/ScriptManager.java trunk/src/app/net/sf/gridarta/gui/script/parameter/ArchComboBoxCellRenderer.java trunk/src/app/net/sf/gridarta/gui/script/parameter/ArchComboBoxEditor.java trunk/src/app/net/sf/gridarta/gui/scripts/DefaultScriptArchEditor.java trunk/src/app/net/sf/gridarta/gui/scripts/ScriptedEventEditor.java trunk/src/app/net/sf/gridarta/gui/selectedsquare/CellRenderer.java trunk/src/app/net/sf/gridarta/gui/treasurelist/CFTreasureListTree.java trunk/src/app/net/sf/gridarta/mainactions/MainActions.java trunk/src/app/net/sf/gridarta/model/archetype/Archetype.java trunk/src/app/net/sf/gridarta/model/archetypetype/ArchetypeAttributeParser.java trunk/src/app/net/sf/gridarta/model/archetypetype/ArchetypeTypeList.java trunk/src/app/net/sf/gridarta/model/archetypetype/ArchetypeTypeParser.java trunk/src/app/net/sf/gridarta/model/artifact/ArtifactParser.java trunk/src/app/net/sf/gridarta/model/autojoin/AutojoinList.java trunk/src/app/net/sf/gridarta/model/baseobject/AbstractBaseObject.java trunk/src/app/net/sf/gridarta/model/baseobject/GameObjectContainer.java trunk/src/app/net/sf/gridarta/model/io/FlatFileIterator.java trunk/src/app/net/sf/gridarta/model/io/RecursiveFileIterator.java trunk/src/app/net/sf/gridarta/model/map/mapmodel/MapSquareIterator.java trunk/src/app/net/sf/gridarta/model/treasurelist/TreasureObj.java trunk/src/app/net/sf/gridarta/textedit/scripteditor/CFPythonPopup.java trunk/src/app/net/sf/gridarta/textedit/scripteditor/ScriptEditControl.java trunk/src/app/net/sf/gridarta/textedit/textarea/DefaultInputHandler.java trunk/src/app/net/sf/gridarta/textedit/textarea/SyntaxDocument.java trunk/src/app/net/sf/gridarta/textedit/textarea/actions/FunctionMenu.java trunk/src/app/net/sf/gridarta/textedit/textarea/actions/InputActions.java trunk/src/app/net/sf/gridarta/utils/ActionUtils.java trunk/src/app/net/sf/gridarta/utils/CommonConstants.java trunk/src/app/net/sf/gridarta/utils/SystemIcons.java trunk/src/app/net/sf/gridarta/validation/checks/PaidItemShopSquareChecker.java trunk/src/app/net/sf/gridarta/validation/checks/ShopSquareChecker.java trunk/src/checkstyle.xml trunk/src/doc/cleanupXhtml11.xslt trunk/src/doc/copyright.xhtml trunk/src/doc/dev/SafeCopy.java trunk/src/doc/dev/changelog.xslt trunk/src/doc/dev/codeStyle.xhtml trunk/src/doc/dev/howToHelp.xhtml trunk/src/doc/dev/start.xhtml trunk/src/doc/dev/todo.xhtml trunk/src/doc/dev/transactions.xhtml trunk/src/doc/dev/typeParameters.xhtml trunk/src/doc/dtd/catalogForAnt.xml trunk/src/doc/faq.xhtml trunk/src/doc/faq2txt.xslt trunk/src/doc/hist/MergingEditors.xhtml trunk/src/doc/history.xhtml trunk/src/doc/news/2006-05-27_1.xhtml trunk/src/doc/news/start.xhtml trunk/src/doc/ref/GameObjectMatcher.xhtml trunk/src/doc/start.xhtml trunk/src/doc/status404.xhtml trunk/src/doc/subversion.xhtml trunk/src/doc/transform.xslt trunk/src/doc/xhtml2html.xslt Modified: trunk/atrinik/build.xml =================================================================== --- trunk/atrinik/build.xml 2010-05-24 15:40:45 UTC (rev 7977) +++ trunk/atrinik/build.xml 2010-05-24 17:01:28 UTC (rev 7978) @@ -1,5 +1,4 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- +<?xml version="1.0" encoding="UTF-8"?><!-- ~ Gridarta MMORPG map editor for Crossfire, Daimonin and similar games. ~ Copyright (C) 2000-2010 The Gridarta Developers. ~ @@ -40,33 +39,36 @@ <!-- set properties and clean build directory --> <target name="init"> - <property name="package" value="net.sf.gridarta.var.atrinik.maincontrol" /> - <property name="targetName" value="Atrinik" /> - <property file="developer.properties" /> - <property name="src.dir" value="src/app" /> - <property name="lib.dir" value="lib" /> - <property name="devlib.dir" value="devlib/" /><!-- Don't forget trailing / ! --> - <property name="test.dir" value="test" /> - <property name="resource.dir" value="resource" /> - <property name="arch.dir" value="../arch" /> - <property name="build.dir.production" value="class/production" /> - <property name="jarname" value="${targetName}Editor.jar" /> - <property name="build.source.version" value="1.5" /> - <property name="build.target.version" value="${build.source.version}" /> - <property name="build.source.encoding" value="utf-8" /> - <property name="checkstyle.path" value="${devlib.dir}checkstyle-all-3.5.jar" /> - <property name="checkstyle.conv" value="${devlib.dir}checkstyle_checks.xml" /> - <property name="todo.file" value="todo.txt" /> - <property name="debug" value="false" /> - <property name="user.ftp.depends" value="yes" /> - <property name="user.ftp.passive" value="yes" /> - <property name="user.ftp.ignoreNoncriticalErrors" value="yes" /> - <property name="build.developer" value="unknown" /> - <property name="javac.args" value="-Xlint:all,-path,-unchecked,-fallthrough,-serial,-deprecation" /> - <property name="javac.fork" value="no" /> - <tstamp><format property="build.tstamp" pattern="yyyy-MM-dd HH:mm:ss z" timezone="UTC"/></tstamp> - <exec executable="svnversion" outputproperty="build.number" failifexecutionfails="false" /> - <property name="build.number" value="unknown" /> + <property name="package" value="net.sf.gridarta.var.atrinik.maincontrol"/> + <property name="targetName" value="Atrinik"/> + <property file="developer.properties"/> + <property name="src.dir" value="src/app"/> + <property name="lib.dir" value="lib"/> + <property name="devlib.dir" value="devlib/"/> + <!-- Don't forget trailing / ! --> + <property name="test.dir" value="test"/> + <property name="resource.dir" value="resource"/> + <property name="arch.dir" value="../arch"/> + <property name="build.dir.production" value="class/production"/> + <property name="jarname" value="${targetName}Editor.jar"/> + <property name="build.source.version" value="1.5"/> + <property name="build.target.version" value="${build.source.version}"/> + <property name="build.source.encoding" value="utf-8"/> + <property name="checkstyle.path" value="${devlib.dir}checkstyle-all-3.5.jar"/> + <property name="checkstyle.conv" value="${devlib.dir}checkstyle_checks.xml"/> + <property name="todo.file" value="todo.txt"/> + <property name="debug" value="false"/> + <property name="user.ftp.depends" value="yes"/> + <property name="user.ftp.passive" value="yes"/> + <property name="user.ftp.ignoreNoncriticalErrors" value="yes"/> + <property name="build.developer" value="unknown"/> + <property name="javac.args" value="-Xlint:all,-path,-unchecked,-fallthrough,-serial,-deprecation"/> + <property name="javac.fork" value="no"/> + <tstamp> + <format property="build.tstamp" pattern="yyyy-MM-dd HH:mm:ss z" timezone="UTC"/> + </tstamp> + <exec executable="svnversion" outputproperty="build.number" failifexecutionfails="false"/> + <property name="build.number" value="unknown"/> <echoproperties destfile="build.properties"> <propertyset negate="true"> <propertyref prefix="user.ftp"/> @@ -78,34 +80,24 @@ <!-- create ctags. --> <target name="ctags" if="user.ctags" depends="init" description="creates tags file with symbol definitions for vim and other editors."> <exec executable="ctags"> - <arg line="-R ${src.dir}" /> + <arg line="-R ${src.dir}"/> </exec> </target> <!-- delete and recreate the build directory --> <target name="clean" description="deletes compiled classes." depends="init"> - <delete dir="${build.dir.production}" /> - <mkdir dir="${build.dir.production}" /> + <delete dir="${build.dir.production}"/> + <mkdir dir="${build.dir.production}"/> </target> <!-- compiling all Java classes --> <target name="compile" depends="init,clean,ctags" description="compiles source."> - <javac - srcdir = "${src.dir}:../src/app" - destdir = "${build.dir.production}" - encoding = "${build.source.encoding}" - source = "${build.source.version}" - target = "${build.target.version}" - debug = "${debug}" - excludes = "test/**/*.java" - fork = "${javac.fork}" - includeantruntime = "false" - > + <javac srcdir="${src.dir}:../src/app" destdir="${build.dir.production}" encoding="${build.source.encoding}" source="${build.source.version}" target="${build.target.version}" debug="${debug}" excludes="test/**/*.java" fork="${javac.fork}" includeantruntime="false"> <classpath> - <fileset dir="${lib.dir}" includes="*.jar" /> - <fileset dir="../lib/" includes="*.jar" /> + <fileset dir="${lib.dir}" includes="*.jar"/> + <fileset dir="../lib/" includes="*.jar"/> </classpath> - <compilerarg line="${javac.args}" /> + <compilerarg line="${javac.args}"/> </javac> </target> @@ -123,10 +115,10 @@ </fileset> </copy> <copy todir="${build.dir.production}"> - <fileset dir="../src/app" excludes="**/*.java,**/package.html,**/overview.html" /> + <fileset dir="../src/app" excludes="**/*.java,**/package.html,**/overview.html"/> </copy> <copy todir="${build.dir.production}"> - <fileset dir="${src.dir}" includes="**/*.properties" /> + <fileset dir="${src.dir}" includes="**/*.properties"/> </copy> <copy todir="${build.dir.production}"> <fileset dir="../resource"> @@ -136,120 +128,72 @@ <include name="toolbarButtonGraphics/**/*.*"/> </fileset> </copy> - <!--copy file="${arch.dir}/archetypes" todir="${build.dir.production}" /--> - <!--copy file="${arch.dir}/atrinik.0" todir="${build.dir.production}" /--> - <!--copy file="${arch.dir}/treasures" todir="${build.dir.production}" /--> - <delete dir="${build.dir.production}/customize" /> + <!--copy file="${arch.dir}/archetypes" todir="${build.dir.production}" /--><!--copy file="${arch.dir}/atrinik.0" todir="${build.dir.production}" /--><!--copy file="${arch.dir}/treasures" todir="${build.dir.production}" /--> + <delete dir="${build.dir.production}/customize"/> - <jar - destfile = "${jarname}" - index = "true" - > + <jar destfile="${jarname}" index="true"> <!-- pack everything into the jar file --> <fileset dir="${build.dir.production}" excludes="MANIFEST.MF,test/**"/> - <fileset file="build.properties" /> - <fileset file="../COPYING" /> + <fileset file="build.properties"/> + <fileset file="../COPYING"/> <fileset dir="${lib.dir}"> - <include name="*-LICENSE" /> + <include name="*-LICENSE"/> </fileset> <fileset dir="../lib"> - <include name="bsh-LICENSE" /> - <include name="java-getopt-1.0.13" /> - <include name="japi.jar-LICENSE" /> - <include name="log4j-1.2.13.jar-LICENSE" /> - <include name="jdom.jar-LICENSE" /> - <include name="java-getopt-1.0.13.jar-LICENSE" /> + <include name="bsh-LICENSE"/> + <include name="java-getopt-1.0.13"/> + <include name="japi.jar-LICENSE"/> + <include name="log4j-1.2.13.jar-LICENSE"/> + <include name="jdom.jar-LICENSE"/> + <include name="java-getopt-1.0.13.jar-LICENSE"/> </fileset> - <zipfileset src="../lib/log4j-1.2.13.jar" /> - <zipfileset src="../lib/java-getopt-1.0.13.jar" /> - <zipfileset src="../lib/jdom.jar" /> - <zipfileset src="../lib/bsh-core-2.0b4.jar" excludes="META-INF/**" /> - <zipfileset src="../lib/bsh-commands-2.0b4.jar" excludes="META-INF/**" /> - <zipfileset src="../lib/bsh-classgen-2.0b4.jar" excludes="META-INF/**" /> - <zipfileset src="../lib/bsh-util-2.0b4.jar" excludes="META-INF/**" /> - <zipgroupfileset dir="../lib/" includes="japi-*.jar" /> + <zipfileset src="../lib/log4j-1.2.13.jar"/> + <zipfileset src="../lib/java-getopt-1.0.13.jar"/> + <zipfileset src="../lib/jdom.jar"/> + <zipfileset src="../lib/bsh-core-2.0b4.jar" excludes="META-INF/**"/> + <zipfileset src="../lib/bsh-commands-2.0b4.jar" excludes="META-INF/**"/> + <zipfileset src="../lib/bsh-classgen-2.0b4.jar" excludes="META-INF/**"/> + <zipfileset src="../lib/bsh-util-2.0b4.jar" excludes="META-INF/**"/> + <zipgroupfileset dir="../lib/" includes="japi-*.jar"/> <!-- creating the manifest --> <manifest> <attribute name="Main-Class" value="${package}.AtrinikEditor"/> - <attribute name="SplashScreen-Image" value="icons/CFIntro.gif" /> + <attribute name="SplashScreen-Image" value="icons/CFIntro.gif"/> </manifest> </jar> <!-- delete the build directory --> - <delete dir="${build.dir.production}" /> + <delete dir="${build.dir.production}"/> </target> <!-- run the jar file with default memory (64 Mb on most systems) --> <target name="run" depends="init" description="runs editor."> - <java jar="${jarname}" fork="true" failonerror="true" /> + <java jar="${jarname}" fork="true" failonerror="true"/> </target> <!-- run the jar file with extra memory (128 Mb) --> <target name="run_high" depends="init" description="runs editor with extra memory (128m)."> - <java jar="${jarname}" fork="true" failonerror="true" maxmemory="128m" /> + <java jar="${jarname}" fork="true" failonerror="true" maxmemory="128m"/> </target> <!-- Create API documentation. --> <target name="doc" depends="init" description="creates JavaDoc documentation for editor source."> - <mkdir dir="javadoc" /> - <javadoc - destdir = "javadoc" - locale = "en_US" - version = "yes" - author = "yes" - use = "yes" - splitindex = "yes" - windowtitle = "${targetName} Editor — API Documentation" - doctitle = "${targetName} Editor<br />API Documentation" - header = "${targetName} Editor<br />API Documentation" - footer = "${targetName} Editor<br />API Documentation" - bottom = "<div style="text-align:center;">© 2003 Andreas Vogl, Michael Toennies, 2004-2006 The ${targetName} Developers, 2006 The Gridarta Developers. All rights reserved.</div>" - serialwarn = "yes" - charset = "utf-8" - docencoding = "utf-8" - source = "${build.source.version}" - encoding = "${build.source.encoding}" - linksource = "yes" - private = "yes" - overview = "src/${package}/overview.html" - link = "${user.javadoc.link}" - > + <mkdir dir="javadoc"/> + <javadoc destdir="javadoc" locale="en_US" version="yes" author="yes" use="yes" splitindex="yes" windowtitle="${targetName} Editor — API Documentation" doctitle="${targetName} Editor<br />API Documentation" header="${targetName} Editor<br />API Documentation" footer="${targetName} Editor<br />API Documentation" bottom="<div style="text-align:center;">© 2003 Andreas Vogl, Michael Toennies, 2004-2006 The ${targetName} Developers, 2006 The Gridarta Developers. All rights reserved.</div>" serialwarn="yes" charset="utf-8" docencoding="utf-8" source="${build.source.version}" encoding="${build.source.encoding}" linksource="yes" private="yes" overview="src/${package}/overview.html" link="${user.javadoc.link}"> <classpath> - <fileset dir="${lib.dir}" includes="*.jar" excludes="*.jar-LICENSE" /> - <fileset dir="../lib/" includes="*.jar" excludes="*.jar-LICENSE" /> + <fileset dir="${lib.dir}" includes="*.jar" excludes="*.jar-LICENSE"/> + <fileset dir="../lib/" includes="*.jar" excludes="*.jar-LICENSE"/> </classpath> - <sourcepath path="${src.dir}" /> - <packageset - dir="src" - defaultexcludes="yes" - > - <include name="**" /> + <sourcepath path="${src.dir}"/> + <packageset dir="src" defaultexcludes="yes"> + <include name="**"/> </packageset> - <tag - name="todo" - description="Todo:" - /> - <tag - name="used" - description="Manually marked as used." - enabled="false" - /> - <tag - name="fixme" - description="Fixme:" - /> - <tag - name="xxx" - description="XXX:" - /> - <tag - name="note" - description="Note:" - /> - <tag - name="devs" - description="At Developers:" - /> + <tag name="todo" description="Todo:"/> + <tag name="used" description="Manually marked as used." enabled="false"/> + <tag name="fixme" description="Fixme:"/> + <tag name="xxx" description="XXX:"/> + <tag name="note" description="Note:"/> + <tag name="devs" description="At Developers:"/> </javadoc> </target> @@ -258,7 +202,7 @@ --> <target name="checkstyle" depends="init" description="performs style checks for source."> <taskdef resource="checkstyletask.properties" classpath="${checkstyle.path}"/> - <mkdir dir="${test.dir}" /> + <mkdir dir="${test.dir}"/> <checkstyle config="${checkstyle.conv}"> <fileset dir="${src.dir}" includes="**/*.java"/> <formatter type="plain"/> @@ -271,61 +215,36 @@ --> <target name="todo" depends="init" description="prints a file with todo information"> <concat> - <fileset file="${todo.file}" /> + <fileset file="${todo.file}"/> </concat> </target> - <target - name = "preparePublish" - description = "preparse files to publish" - depends = "jar" - > - <property name="update.number" value="${build.number}"/> - <property name="update.tstamp" value="${build.tstamp}"/> + <target name="preparePublish" description="preparse files to publish" depends="jar"> + <property name="update.number" value="${build.number}"/> + <property name="update.tstamp" value="${build.tstamp}"/> <property name="update.developer" value="${build.developer}"/> - <property name="update.url" value="${user.update.url}"/> + <property name="update.url" value="${user.update.url}"/> <echoproperties destfile="update.properties"> <propertyset> - <propertyref prefix="update" /> + <propertyref prefix="update"/> </propertyset> </echoproperties> </target> - <target - name = "ftpPublish" - description = "publishes ${jarname} using ftp" - depends = "preparePublish" - > - <ftp - server="${user.ftp.host}" - userid="${user.ftp.user}" - password="${user.ftp.pass}" - remotedir="${user.ftp.dir}" - depends="${user.ftp.depends}" - passive="${user.ftp.passive}" - ignoreNoncriticalErrors="${user.ftp.ignoreNoncriticalErrors}" - > + <target name="ftpPublish" description="publishes ${jarname} using ftp" depends="preparePublish"> + <ftp server="${user.ftp.host}" userid="${user.ftp.user}" password="${user.ftp.pass}" remotedir="${user.ftp.dir}" depends="${user.ftp.depends}" passive="${user.ftp.passive}" ignoreNoncriticalErrors="${user.ftp.ignoreNoncriticalErrors}"> <fileset dir="."> - <include name="${jarname}" /> - <include name="update.properties" /> + <include name="${jarname}"/> + <include name="update.properties"/> </fileset> </ftp> </target> - <target - name = "scpPublish" - description = "publishes ${jarname} using scp" - depends = "preparePublish" - > - <scp - todir="${user.scp.dir}" - passphrase="${user.scp.passphrase}" - trust="${user.scp.trust}" - keyfile="${user.scp.keyfile}" - > + <target name="scpPublish" description="publishes ${jarname} using scp" depends="preparePublish"> + <scp todir="${user.scp.dir}" passphrase="${user.scp.passphrase}" trust="${user.scp.trust}" keyfile="${user.scp.keyfile}"> <fileset dir="."> - <include name="${jarname}" /> - <include name="update.properties" /> + <include name="${jarname}"/> + <include name="update.properties"/> </fileset> </scp> </target> Modified: trunk/atrinik/devlib/JAPI.xml =================================================================== --- trunk/atrinik/devlib/JAPI.xml 2010-05-24 15:40:45 UTC (rev 7977) +++ trunk/atrinik/devlib/JAPI.xml 2010-05-24 17:01:28 UTC (rev 7978) @@ -1,5 +1,4 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- +<?xml version="1.0" encoding="UTF-8"?><!-- ~ Gridarta MMORPG map editor for Crossfire, Daimonin and similar games. ~ Copyright (C) 2000-2010 The Gridarta Developers. ~ @@ -19,634 +18,634 @@ --> <inspections profile_name="JAPI" version="1.0"> - <inspection_tool class="AssertAsName" level="ERROR" enabled="true" /> - <inspection_tool class="EnumAsName" level="ERROR" enabled="true" /> - <inspection_tool class="InstanceofChain" level="WARNING" enabled="true" /> - <inspection_tool class="ClassReferencesSubclass" level="WARNING" enabled="true" /> - <inspection_tool class="DeclareCollectionAsInterface" level="WARNING" enabled="true" /> - <inspection_tool class="InstanceofThis" level="WARNING" enabled="true" /> - <inspection_tool class="OverlyStrongTypeCast" level="WARNING" enabled="true" /> - <inspection_tool class="MethodOnlyUsedFromInnerClass" level="WARNING" enabled="true"> - <option name="ignoreMethodsAccessedFromAnonymousClass" value="false" /> - </inspection_tool> - <inspection_tool class="ReplaceAssignmentWithOperatorAssignment" level="WARNING" enabled="true" /> - <inspection_tool class="AssignmentToForLoopParameter" level="WARNING" enabled="true" /> - <inspection_tool class="AssignmentToCatchBlockParameter" level="WARNING" enabled="true" /> - <inspection_tool class="AssignmentToMethodParameter" level="WARNING" enabled="true" /> - <inspection_tool class="NestedAssignment" level="WARNING" enabled="true" /> - <inspection_tool class="AnonymousClassMethodCount" level="WARNING" enabled="true"> - <option name="m_limit" value="1" /> - </inspection_tool> - <inspection_tool class="FieldCount" level="WARNING" enabled="true"> - <option name="m_countConstantFields" value="false" /> - <option name="m_considerStaticFinalFieldsConstant" value="false" /> - <option name="m_limit" value="10" /> - </inspection_tool> - <inspection_tool class="MethodCount" level="WARNING" enabled="true"> - <option name="m_limit" value="20" /> - </inspection_tool> - <inspection_tool class="ConstructorCount" level="WARNING" enabled="true"> - <option name="m_limit" value="5" /> - </inspection_tool> - <inspection_tool class="ClassNestingDepth" level="WARNING" enabled="true"> - <option name="m_limit" value="1" /> - </inspection_tool> - <inspection_tool class="AnonymousClassComplexity" level="WARNING" enabled="true"> - <option name="m_limit" value="3" /> - </inspection_tool> - <inspection_tool class="ClassComplexity" level="WARNING" enabled="true"> - <option name="m_limit" value="80" /> - </inspection_tool> - <inspection_tool class="ClassCoupling" level="WARNING" enabled="true"> - <option name="m_includeJavaClasses" value="false" /> - <option name="m_includeLibraryClasses" value="false" /> - <option name="m_limit" value="15" /> - </inspection_tool> - <inspection_tool class="AnonymousInnerClass" level="WARNING" enabled="true" /> - <inspection_tool class="ClassMayBeInterface" level="WARNING" enabled="true" /> - <inspection_tool class="ClassNameDiffersFromFileName" level="WARNING" enabled="true" /> - <inspection_tool class="ClassInTopLevelPackage" level="WARNING" enabled="true" /> - <inspection_tool class="ConstantDeclaredInInterface" level="WARNING" enabled="true" /> - <inspection_tool class="EmptyClass" level="WARNING" enabled="true" /> - <inspection_tool class="FinalMethodInFinalClass" level="WARNING" enabled="true" /> - <inspection_tool class="InnerClassOnInterface" level="WARNING" enabled="true"> - <option name="m_ignoreInnerInterfaces" value="false" /> - </inspection_tool> - <inspection_tool class="LimitedScopeInnerClass" level="WARNING" enabled="true" /> - <inspection_tool class="MarkerInterface" level="WARNING" enabled="true" /> - <inspection_tool class="MissingDeprecatedAnnotation" level="WARNING" enabled="true" /> - <inspection_tool class="MissingOverrideAnnotation" level="WARNING" enabled="true" /> - <inspection_tool class="MultipleTopLevelClassesInFile" level="WARNING" enabled="true" /> - <inspection_tool class="ClassInitializer" level="WARNING" enabled="true" /> - <inspection_tool class="ProtectedMemberInFinalClass" level="WARNING" enabled="true" /> - <inspection_tool class="PublicConstructorInNonPublicClass" level="WARNING" enabled="true" /> - <inspection_tool class="Singleton" level="WARNING" enabled="true" /> - <inspection_tool class="StaticNonFinalField" level="WARNING" enabled="true" /> - <inspection_tool class="UtilityClass" level="WARNING" enabled="true" /> - <inspection_tool class="UtilityClassWithPublicConstructor" level="WARNING" enabled="true" /> - <inspection_tool class="UtilityClassWithoutPrivateConstructor" level="WARNING" enabled="true" /> - <inspection_tool class="CloneCallsConstructors" level="WARNING" enabled="true" /> - <inspection_tool class="CloneInNonCloneableClass" level="WARNING" enabled="true" /> - <inspection_tool class="CloneableImplementsClone" level="WARNING" enabled="true"> - <option name="m_ignoreCloneableDueToInheritance" value="false" /> - </inspection_tool> - <inspection_tool class="ThrowablePrintStackTrace" level="WARNING" enabled="true" /> - <inspection_tool class="ThreadDumpStack" level="WARNING" enabled="true" /> - <inspection_tool class="ObsoleteCollection" level="WARNING" enabled="true" /> - <inspection_tool class="SystemOutErr" level="WARNING" enabled="true" /> - <inspection_tool class="CStyleArrayDeclaration" level="WARNING" enabled="true" /> - <inspection_tool class="ChainedEquality" level="WARNING" enabled="true" /> - <inspection_tool class="ConfusingOctalEscape" level="WARNING" enabled="true" /> - <inspection_tool class="ControlFlowStatementWithoutBraces" level="WARNING" enabled="true" /> - <inspection_tool class="LiteralAsArgToStringEquals" level="WARNING" enabled="true" /> - <inspection_tool class="LocalCanBeFinal" level="WARNING" enabled="true"> - <option name="REPORT_VARIABLES" value="true" /> - <option name="REPORT_PARAMETERS" value="true" /> - </inspection_tool> - <inspection_tool class="MissortedModifiers" level="WARNING" enabled="true"> - <option name="m_requireAnnotationsFirst" value="true" /> - </inspection_tool> - <inspection_tool class="MultipleDeclaration" level="WARNING" enabled="true" /> - <inspection_tool class="RedundantFieldInitialization" level="WARNING" enabled="true" /> - <inspection_tool class="RedundantImplements" level="WARNING" enabled="true" /> - <inspection_tool class="UnnecessarilyQualifiedStaticUsage" level="WARNING" enabled="true"> - <option name="m_ignoreStaticFieldAccesses" value="false" /> - <option name="m_ignoreStaticMethodCalls" value="false" /> - <option name="m_ignoreStaticAccessFromStaticContext" value="false" /> - </inspection_tool> - <inspection_tool class="UnnecessaryThis" level="WARNING" enabled="true" /> - <inspection_tool class="UnnecessarySuperConstructor" level="WARNING" enabled="true" /> - <inspection_tool class="UnnecessaryBlockStatement" level="WARNING" enabled="true" /> - <inspection_tool class="UnnecessaryEnumModifier" level="WARNING" enabled="true" /> - <inspection_tool class="UnnecessaryFullyQualifiedName" level="WARNING" enabled="true"> - <option name="m_ignoreJavadoc" value="false" /> - </inspection_tool> - <inspection_tool class="UnnecessaryInterfaceModifier" level="WARNING" enabled="true" /> - <inspection_tool class="UnnecessaryParentheses" level="WARNING" enabled="true" /> - <inspection_tool class="UnnecessaryQualifierForThis" level="WARNING" enabled="true" /> - <inspection_tool class="MultipleTypedDeclaration" level="WARNING" enabled="true" /> - <inspection_tool class="BreakStatement" level="WARNING" enabled="true" /> - <inspection_tool class="BreakStatementWithLabel" level="WARNING" enabled="true" /> - <inspection_tool class="ConditionalExpressionWithIdenticalBranches" level="WARNING" enabled="true" /> - <inspection_tool class="NegatedConditional" level="WARNING" enabled="true"> - <option name="m_ignoreNegatedNullComparison" value="true" /> - </inspection_tool> - <inspection_tool class="ConfusingElse" level="WARNING" enabled="true" /> - <inspection_tool class="ContinueStatement" level="WARNING" enabled="true" /> - <inspection_tool class="ContinueStatementWithLabel" level="WARNING" enabled="true" /> - <inspection_tool class="DefaultNotLastCaseInSwitch" level="WARNING" enabled="true" /> - <inspection_tool class="DuplicateCondition" level="WARNING" enabled="true" /> - <inspection_tool class="EnumSwitchStatementWhichMissesCases" level="WARNING" enabled="true"> - <option name="ignoreSwitchStatementsWithDefault" value="false" /> - </inspection_tool> - <inspection_tool class="FallthruInSwitchStatement" level="WARNING" enabled="true" /> - <inspection_tool class="ForLoopReplaceableByWhile" level="WARNING" enabled="true"> - <option name="m_ignoreLoopsWithoutConditions" value="false" /> - </inspection_tool> - <inspection_tool class="ForLoopWithMissingComponent" level="WARNING" enabled="true" /> - <inspection_tool class="IfStatementWithIdenticalBranches" level="WARNING" enabled="true" /> - <inspection_tool class="NegatedIfElse" level="WARNING" enabled="true"> - <option name="m_ignoreNegatedNullComparison" value="true" /> - </inspection_tool> - <inspection_tool class="IfStatementWithTooManyBranches" level="WARNING" enabled="true"> - <option name="m_limit" value="3" /> - </inspection_tool> - <inspection_tool class="LabeledStatement" level="WARNING" enabled="true" /> - <inspection_tool class="SwitchStatementWithConfusingDeclaration" level="WARNING" enabled="true" /> - <inspection_tool class="NestedSwitchStatement" level="WARNING" enabled="true" /> - <inspection_tool class="NestedConditionalExpression" level="WARNING" enabled="true" /> - <inspection_tool class="OverlyComplexBooleanExpression" level="WARNING" enabled="true"> - <option name="m_limit" value="3" /> - <option name="m_ignorePureConjunctionsDisjunctions" value="true" /> - </inspection_tool> - <inspection_tool class="PointlessIndexOfComparison" level="WARNING" enabled="true" /> - <inspection_tool class="SwitchStatementWithTooFewBranches" level="WARNING" enabled="true"> - <option name="m_limit" value="2" /> - </inspection_tool> - <inspection_tool class="SwitchStatementDensity" level="WARNING" enabled="true"> - <option name="m_limit" value="20" /> - </inspection_tool> - <inspection_tool class="SwitchStatementWithTooManyBranches" level="WARNING" enabled="true"> - <option name="m_limit" value="10" /> - </inspection_tool> - <inspection_tool class="SwitchStatementsWithoutDefault" level="WARNING" enabled="true"> - <option name="m_ignoreFullyCoveredEnums" value="true" /> - </inspection_tool> - <inspection_tool class="UnnecessaryDefault" level="WARNING" enabled="true" /> - <inspection_tool class="ReuseOfLocalVariable" level="WARNING" enabled="true" /> - <inspection_tool class="TooBroadScope" level="WARNING" enabled="true"> - <option name="m_allowConstructorAsInitializer" value="false" /> - <option name="m_onlyLookAtBlocks" value="false" /> - </inspection_tool> - <inspection_tool class="AssignmentToCollectionFieldFromParameter" level="WARNING" enabled="true" /> - <inspection_tool class="AssignmentToDateFieldFromParameter" level="WARNING" enabled="true" /> - <inspection_tool class="PackageVisibleField" level="WARNING" enabled="true" /> - <inspection_tool class="PackageVisibleInnerClass" level="WARNING" enabled="true" /> - <inspection_tool class="ProtectedField" level="WARNING" enabled="true" /> - <inspection_tool class="ProtectedInnerClass" level="WARNING" enabled="true" /> - <inspection_tool class="PublicField" level="WARNING" enabled="true" /> - <inspection_tool class="ReturnOfCollectionField" level="WARNING" enabled="true"> - <option name="ignorePrivateMethods" value="true" /> - </inspection_tool> - <inspection_tool class="ReturnOfDateField" level="WARNING" enabled="true" /> - <inspection_tool class="CatchGenericClass" level="WARNING" enabled="true" /> - <inspection_tool class="InstanceofCatchParameter" level="WARNING" enabled="true" /> - <inspection_tool class="ErrorRethrown" level="WARNING" enabled="true" /> - <inspection_tool class="ThreadDeathRethrown" level="WARNING" enabled="true" /> - <inspection_tool class="NestedTryStatement" level="WARNING" enabled="true" /> - <inspection_tool class="NonFinalFieldOfException" level="WARNING" enabled="true" /> - <inspection_tool class="TooBroadCatch" level="WARNING" enabled="true" /> - <inspection_tool class="ThrowCaughtLocally" level="WARNING" enabled="true" /> - <inspection_tool class="ExceptionFromCatchWhichDoesntWrap" level="WARNING" enabled="true" /> - <inspection_tool class="Finalize" level="WARNING" enabled="true" /> - <inspection_tool class="FinalizeNotProtected" level="WARNING" enabled="true" /> - <inspection_tool class="OnDemandImport" level="WARNING" enabled="true" /> - <inspection_tool class="SamePackageImport" level="WARNING" enabled="true" /> - <inspection_tool class="JavaLangImport" level="WARNING" enabled="true" /> - <inspection_tool class="RedundantImport" level="WARNING" enabled="true" /> - <inspection_tool class="UnusedImport" level="WARNING" enabled="true" /> - <inspection_tool class="AbstractClassNeverImplemented" level="WARNING" enabled="true" /> - <inspection_tool class="AbstractClassWithoutAbstractMethods" level="WARNING" enabled="true" /> - <inspection_tool class="AbstractMethodOverridesAbstractMethod" level="WARNING" enabled="true" /> - <inspection_tool class="AbstractMethodOverridesConcreteMethod" level="WARNING" enabled="true" /> - <inspection_tool class="AbstractMethodWithMissingImplementations" level="WARNING" enabled="true" /> - <inspection_tool class="ExtendsConcreteCollection" level="WARNING" enabled="true" /> - <inspection_tool class="NonProtectedConstructorInAbstractClass" level="WARNING" enabled="true"> - <option name="m_ignoreNonPublicClasses" value="false" /> - </inspection_tool> - <inspection_tool class="RedundantMethodOverride" level="WARNING" enabled="true" /> - <inspection_tool class="StaticInheritance" level="WARNING" enabled="true" /> - <inspection_tool class="AbstractMethodCallInConstructor" level="WARNING" enabled="true" /> - <inspection_tool class="InstanceVariableUninitializedUse" level="WARNING" enabled="true"> - <option name="m_ignorePrimitives" value="false" /> - </inspection_tool> - <inspection_tool class="NonFinalStaticVariableUsedInClassInitialization" level="WARNING" enabled="true" /> - <inspection_tool class="OverriddenMethodCallInConstructor" level="WARNING" enabled="true" /> - <inspection_tool class="StaticVariableInitialization" level="WARNING" enabled="true"> - <option name="m_ignorePrimitives" value="false" /> - </inspection_tool> - <inspection_tool class="StaticVariableUninitializedUse" level="WARNING" enabled="true"> - <option name="m_ignorePrimitives" value="false" /> - </inspection_tool> - <inspection_tool class="ThisEscapedInConstructor" level="WARNING" enabled="true" /> - <inspection_tool class="NonThreadSafeLazyInitialization" level="WARNING" enabled="true" /> - <inspection_tool class="DateToString" level="WARNING" enabled="true" /> - <inspection_tool class="NumericToString" level="WARNING" enabled="true" /> - <inspection_tool class="StringEqualsIgnoreCase" level="WARNING" enabled="true" /> - <inspection_tool class="StringToUpperWithoutLocale" level="WARNING" enabled="true" /> - <inspection_tool class="TimeToString" level="WARNING" enabled="true" /> - <inspection_tool class="CharacterComparison" level="WARNING" enabled="true" /> - <inspection_tool class="SimpleDateFormatWithoutLocale" level="WARNING" enabled="true" /> - <inspection_tool class="StringTokenizer" level="WARNING" enabled="true" /> - <inspection_tool class="AbstractClassWithOnlyOneDirectInheritor" level="WARNING" enabled="true" /> - <inspection_tool class="AnonymousInnerClassMayBeStatic" level="WARNING" enabled="true" /> - <inspection_tool class="ConnectionResource" level="WARNING" enabled="true" /> - <inspection_tool class="CheckForOutOfMemoryOnLargeArrayAllocation" level="WARNING" enabled="true"> - <option name="m_limit" value="64" /> - </inspection_tool> - <inspection_tool class="OverlyLargePrimitiveArrayInitializer" level="WARNING" enabled="true"> - <option name="m_limit" value="64" /> - </inspection_tool> - <inspection_tool class="RecordStoreResource" level="WARNING" enabled="true" /> - <inspection_tool class="IndexOfReplaceableByContains" level="WARNING" enabled="true" /> - <inspection_tool class="RawUseOfParameterizedType" level="WARNING" enabled="true"> - <option name="ignoreObjectConstruction" value="true" /> - </inspection_tool> - <inspection_tool class="FieldHasSetterButNoGetter" level="WARNING" enabled="true" /> - <inspection_tool class="ClassWithMultipleLoggers" level="WARNING" enabled="true"> - <option name="loggerClassName" value="java.util.logging.Logger" /> - </inspection_tool> - <inspection_tool class="NonStaticFinalLogger" level="WARNING" enabled="true"> - <option name="loggerClassName" value="java.util.logging.Logger" /> - </inspection_tool> - <inspection_tool class="SystemGC" level="WARNING" enabled="true" /> - <inspection_tool class="StaticCollection" level="WARNING" enabled="true"> - <option name="m_ignoreWeakCollections" value="false" /> - </inspection_tool> - <inspection_tool class="StringBufferField" level="WARNING" enabled="true" /> - <inspection_tool class="ZeroLengthArrayInitialization" level="WARNING" enabled="true" /> - <inspection_tool class="ThreeNegationsPerMethod" level="WARNING" enabled="true"> - <option name="m_ignoreInEquals" value="true" /> - </inspection_tool> - <inspection_tool class="ParametersPerMethod" level="WARNING" enabled="true"> - <option name="m_limit" value="5" /> - </inspection_tool> - <inspection_tool class="CyclomaticComplexity" level="WARNING" enabled="true"> - <option name="m_limit" value="10" /> - </inspection_tool> - <inspection_tool class="MethodCoupling" level="WARNING" enabled="true"> - <option name="m_includeJavaClasses" value="false" /> - <option name="m_includeLibraryClasses" value="false" /> - <option name="m_limit" value="10" /> - </inspection_tool> - <inspection_tool class="NonCommentSourceStatements" level="WARNING" enabled="true"> - <option name="m_limit" value="30" /> - </inspection_tool> - <inspection_tool class="NestingDepth" level="WARNING" enabled="true"> - <option name="m_limit" value="5" /> - </inspection_tool> - <inspection_tool class="ClassNamingConvention" level="WARNING" enabled="true"> - <option name="m_regex" value="[A-Z][0-9A-Za-z]*" /> - <option name="m_minLength" value="4" /> - <option name="m_maxLength" value="64" /> - </inspection_tool> - <inspection_tool class="ConstantNamingConvention" level="WARNING" enabled="true"> - <option name="m_regex" value="[A-Z][A-Z0-9_]*" /> - <option name="m_minLength" value="5" /> - <option name="m_maxLength" value="32" /> - </inspection_tool> - <inspection_tool class="EnumeratedClassNamingConvention" level="WARNING" enabled="true"> - <option name="m_regex" value="[A-Z][A-Za-z]*" /> - <option name="m_minLength" value="8" /> - <option name="m_maxLength" value="64" /> - </inspection_tool> - <inspection_tool class="EnumeratedConstantNamingConvention" level="WARNING" enabled="true"> - <option name="m_regex" value="[A-Z][A-Za-z]*" /> - <option name="m_minLength" value="5" /> - <option name="m_maxLength" value="32" /> - </inspection_tool> - <inspection_tool class="InstanceMethodNamingConvention" level="WARNING" enabled="true"> - <option name="m_regex" value="[a-z][A-Za-z]*" /> - <option name="m_minLength" value="4" /> - <option name="m_maxLength" value="32" /> - </inspection_tool> - <inspection_tool class="InstanceVariableNamingConvention" level="WARNING" enabled="true"> - <option name="m_regex" value="[a-z][A-Za-z0-9]*" /> - <option name="m_minLength" value="2" /> - <option name="m_maxLength" value="32" /> - </inspection_tool> - <inspection_tool class="InterfaceNamingConvention" level="WARNING" enabled="true"> - <option name="m_regex" value="[A-Z][0-9A-Za-z]*" /> - <option name="m_minLength" value="5" /> - <option name="m_maxLength" value="64" /> - </inspection_tool> - <inspection_tool class="LocalVariableNamingConvention" level="WARNING" enabled="true"> - <option name="m_ignoreForLoopParameters" value="false" /> - <option name="m_ignoreCatchParameters" value="false" /> - <option name="m_regex" value="[a-z][A-Za-z0-9]*" /> - <option name="m_minLength" value="1" /> - <option name="m_maxLength" value="20" /> - </inspection_tool> - <inspection_tool class="ParameterNamingConvention" level="WARNING" enabled="true"> - <option name="m_regex" value="[a-z][0-9A-Za-z]*" /> - <option name="m_minLength" value="1" /> - <option name="m_maxLength" value="20" /> - </inspection_tool> - <inspection_tool class="NonBooleanMethodNameMayNotStartWithQuestion" level="WARNING" enabled="true"> - <option name="nameCheckString" value="is,can,has,should,could,will,shall,check,contains,equals,add,put,remove,startsWith,endsWith" /> - </inspection_tool> - <inspection_tool class="StaticMethodNamingConvention" level="WARNING" enabled="true"> - <option name="m_regex" value="[a-z][0-9A-Za-z]*" /> - <option name="m_minLength" value="4" /> - <option name="m_maxLength" value="32" /> - </inspection_tool> - <inspection_tool class="StaticVariableNamingConvention" level="WARNING" enabled="true"> - <option name="m_regex" value="s_[a-z][A-Za-z]*" /> - <option name="m_minLength" value="5" /> - <option name="m_maxLength" value="32" /> - </inspection_tool> - <inspection_tool class="TypeParameterNamingConvention" level="WARNING" enabled="true"> - <option name="m_regex" value="[A-Z]" /> - <option name="m_minLength" value="1" /> - <option name="m_maxLength" value="1" /> - </inspection_tool> - <inspection_tool class="AnnotationNamingConvention" level="WARNING" enabled="true"> - <option name="m_regex" value="[A-Z][A-Za-z]*" /> - <option name="m_minLength" value="8" /> - <option name="m_maxLength" value="64" /> - </inspection_tool> - <inspection_tool class="ClassNameSameAsAncestorName" level="WARNING" enabled="true" /> - <inspection_tool class="ConfusingMainMethod" level="WARNING" enabled="true" /> - <inspection_tool class="ExceptionNameDoesntEndWithException" level="WARNING" enabled="true" /> - <inspection_tool class="MethodNameSameAsClassName" level="WARNING" enabled="true" /> - <inspection_tool class="MethodNameSameAsParentName" level="WARNING" enabled="true" /> - <inspection_tool class="MethodNamesDifferOnlyByCase" level="WARNING" enabled="true" /> - <inspection_tool class="UpperCaseFieldNameNotConstant" level="WARNING" enabled="true" /> - <inspection_tool class="NonExceptionNameEndsWithException" level="WARNING" enabled="true" /> - <inspection_tool class="ParameterNameDiffersFromOverriddenParameter" level="WARNING" enabled="true"> - <option name="m_ignoreSingleCharacterNames" value="true" /> - </inspection_tool> - <inspection_tool class="QuestionableName" level="WARNING" enabled="true"> - <option name="nameCheckString" value="foo,bar,baz" /> - </inspection_tool> - <inspection_tool class="StandardVariableNames" level="WARNING" enabled="true" /> - <inspection_tool class="DollarSignInName" level="WARNING" enabled="true" /> - <inspection_tool class="ImplicitNumericConversion" level="WARNING" enabled="true"> - <option name="m_ignoreWideningConversions" value="true" /> - </inspection_tool> - <inspection_tool class="ComparisonOfShortAndChar" level="WARNING" enabled="true" /> - <inspection_tool class="ComparisonToNaN" level="WARNING" enabled="true" /> - <inspection_tool class="ConfusingFloatingPointLiteral" level="WARNING" enabled="true" /> - <inspection_tool class="ConstantMathCall" level="WARNING" enabled="true" /> - <inspection_tool class="DivideByZero" level="WARNING" enabled="true" /> - <inspection_tool class="BigDecimalEquals" level="WARNING" enabled="true" /> - <inspection_tool class="FloatingPointEquality" level="WARNING" enabled="true" /> - <inspection_tool class="IntegerDivisionInFloatingPointContext" level="WARNING" enabled="true" /> - <inspection_tool class="LongLiteralsEndingWithLowercaseL" level="WARNING" enabled="true" /> - <inspection_tool class="NonReproducibleMathCall" level="WARNING" enabled="true" /> - <inspection_tool class="CachedNumberConstructorCall" level="WARNING" enabled="true" /> - <inspection_tool class="OverlyComplexArithmeticExpression" level="WARNING" enabled="true"> - <option name="m_limit" value="6" /> - </inspection_tool> - <inspection_tool class="CallToSimpleGetterInClass" level="WARNING" enabled="true" /> - <inspection_tool class="CallToSimpleSetterInClass" level="WARNING" enabled="true" /> - <inspection_tool class="TrivialStringConcatenation" level="WARNING" enabled="true" /> - <inspection_tool class="StringBufferReplaceableByString" level="WARNING" enabled="true" /> - <inspection_tool class="FieldMayBeStatic" level="WARNING" enabled="true" /> - <inspection_tool class="InnerClassMayBeStatic" level="WARNING" enabled="true" /> - <inspection_tool class="MapReplaceableByEnumMap" level="WARNING" enabled="true" /> - <inspection_tool class="MethodMayBeStatic" level="WARNING" enabled="true"> - <option name="m_onlyPrivateOrFinal" value="false" /> - <option name="m_ignoreEmptyMethods" value="true" /> - </inspection_tool> - <inspection_tool class="MultiplyOrDivideByPowerOfTwo" level="WARNING" enabled="true" /> - <inspection_tool class="StringReplaceableByStringBuffer" level="WARNING" enabled="true" /> - <inspection_tool class="SubstringZero" level="WARNING" enabled="true" /> - <inspection_tool class="SetReplaceableByEnumSet" level="WARNING" enabled="true" /> - <inspection_tool class="LengthOneStringsInConcatenation" level="WARNING" enabled="true" /> - <inspection_tool class="StringConcatenationInLoops" level="WARNING" enabled="true"> - <option name="m_ignoreUnlessAssigned" value="false" /> - </inspection_tool> - <inspection_tool class="StringEqualsEmptyString" level="WARNING" enabled="true" /> - <inspection_tool class="StringBufferReplaceableByStringBuilder" level="WARNING" enabled="true" /> - <inspection_tool class="StringBufferToStringInConcatenation" level="WARNING" enabled="true" /> - <inspection_tool class="TailRecursion" level="WARNING" enabled="true" /> - <inspection_tool class="JavaLangReflect" level="WARNING" enabled="true" /> - <inspection_tool class="RandomDoubleForRandomInteger" level="WARNING" enabled="true" /> - <inspection_tool class="RuntimeExec" level="WARNING" enabled="true" /> - <inspection_tool class="SystemExit" level="WARNING" enabled="true" /> - <inspection_tool class="SystemGetenv" level="WARNING" enabled="true" /> - <inspection_tool class="NativeMethods" level="WARNING" enabled="true" /> - <inspection_tool class="UseOfAWTPeerClass" level="WARNING" enabled="true" /> - <inspection_tool class="UseOfJDBCDriverClass" level="WARNING" enabled="true" /> - <inspection_tool class="UseOfProcessBuilder" level="WARNING" enabled="true" /> - <inspection_tool class="UseOfSunClasses" level="WARNING" enabled="true" /> - <inspection_tool class="AssignmentToStaticFieldFromInstanceMethod" level="WARNING" enabled="true" /> - <inspection_tool class="AssignmentUsedAsCondition" level="WARNING" enabled="true" /> - <inspection_tool class="ObjectToString" level="WARNING" enabled="true" /> - <inspection_tool class="CastConflictsWithInstanceof" level="WARNING" enabled="true" /> - <inspection_tool class="CastToIncompatibleInterface" level="WARNING" enabled="true" /> - <inspection_tool class="CollectionAddedToSelf" level="WARNING" enabled="true" /> - <inspection_tool class="MisspelledCompareTo" level="WARNING" enabled="true" /> - <inspection_tool class="CovariantCompareTo" level="WARNING" enabled="true" /> - <inspection_tool class="CovariantEquals" level="WARNING" enabled="true" /> - <inspection_tool class="EmptyInitializer" level="WARNING" enabled="true" /> - <inspection_tool class="MisspelledEquals" level="WARNING" enabled="true" /> - <inspection_tool class="EqualsBetweenInconvertibleTypes" level="WARNING" enabled="true" /> - <inspection_tool class="ArrayEquals" level="WARNING" enabled="true" /> - <inspection_tool class="EqualsWhichDoesntCheckParameterClass" level="WARNING" enabled="true" /> - <inspection_tool class="ForLoopThatDoesntUseLoopVariable" level="WARNING" enabled="true" /> - <inspection_tool class="MisspelledHashcode" level="WARNING" enabled="true" /> - <inspection_tool class="InstanceofIncompatibleInterface" level="WARNING" enabled="true" /> - <inspection_tool class="InstantiationOfUtilityClass" level="WARNING" enabled="true" /> - <inspection_tool class="IteratorHasNextCallsIteratorNext" level="WARNING" enabled="true" /> - <inspection_tool class="IteratorNextDoesNotThrowNoSuchElementException" level="WARNING" enabled="true" /> - <inspection_tool class="CompareToUsesNonFinalVariable" level="WARNING" enabled="true" /> - <inspection_tool class="EqualsUsesNonFinalVariable" level="WARNING" enabled="true" /> - <inspection_tool class="HashCodeUsesNonFinalVariable" level="WARNING" enabled="true" /> - <inspection_tool class="NonShortCircuitBoolean" level="WARNING" enabled="true" /> - <inspection_tool class="ObjectEquality" level="WARNING" enabled="true"> - <option name="m_ignoreEnums" value="true" /> - <option name="m_ignoreClassObjects" value="false" /> - <option name="m_ignorePrivateConstructors" value="false" /> - </inspection_tool> - <inspection_tool class="OctalAndDecimalIntegersMixed" level="WARNING" enabled="true" /> - <inspection_tool class="ResultOfObjectAllocationIgnored" level="WARNING" enabled="true" /> - <inspection_tool class="ReturnNull" level="WARNING" enabled="true"> - <option name="m_reportObjectMethods" value="true" /> - <option name="m_reportArrayMethods" value="true" /> - <option name="m_reportCollectionMethods" value="true" /> - </inspection_tool> - <inspection_tool class="StaticFieldReferenceOnSubclass" level="WARNING" enabled="true" /> - <inspection_tool class="StaticCallOnSubclass" level="WARNING" enabled="true" /> - <inspection_tool class="SubtractionInCompareTo" level="WARNING" enabled="true" /> - <inspection_tool class="SuspiciousToArrayCall" level="WARNING" enabled="true" /> - <inspection_tool class="SuspiciousSystemArraycopy" level="WARNING" enabled="true" /> - <inspection_tool class="TextLabelInSwitchStatement" level="WARNING" enabled="true" /> - <inspection_tool class="MisspelledToString" level="WARNING" enabled="true" /> - <inspection_tool class="ArchaicSystemPropertyAccess" level="WARNING" enabled="true" /> - <inspection_tool class="ResultSetIndexZero" level="WARNING" enabled="true" /> - <inspection_tool class="UseOfPropertiesAsHashtable" level="WARNING" enabled="true" /> - <inspection_tool class="UnusedProperty" level="WARNING" enabled="true" /> - <inspection_tool class="ChannelResource" level="WARNING" enabled="true" /> - <inspection_tool class="HibernateResource" level="WARNING" enabled="true" /> - <inspection_tool class="IOResource" level="WARNING" enabled="true" /> - <inspection_tool class="JDBCResource" level="WARNING" enabled="true" /> - <inspection_tool class="JNDIResource" level="WARNING" enabled="true" /> - <inspection_tool class="SocketResource" level="WARNING" enabled="true" /> - <inspection_tool class="DriverManagerGetConnection" level="WARNING" enabled="true" /> - <inspection_tool class="JDBCPrepareStatementWithNonConstantString" level="WARNING" enabled="true" /> - <inspection_tool class="RuntimeExecWithNonConstantString" level="WARNING" enabled="true" /> - <inspection_tool class="JDBCExecuteWithNonConstantString" level="WARNING" enabled="true" /> - <inspection_tool class="LoadLibraryWithNonConstantString" level="WARNING" enabled="true" /> - <inspection_tool class="SystemSetSecurityManager" level="WARNING" enabled="true" /> - <inspection_tool class="ClassLoader2Instantiation" level="WARNING" enabled="true" /> - <inspection_tool class="CustomClassloader" level="WARNING" enabled="true" /> - <inspection_tool class="CustomSecurityManager" level="WARNING" enabled="true" /> - <inspection_tool class="PublicStaticArrayField" level="WARNING" enabled="true" /> - <inspection_tool class="PublicStaticCollectionField" level="WARNING" enabled="true" /> - <inspection_tool class="UnsecureRandomNumberGeneration" level="WARNING" enabled="true" /> - <inspection_tool class="ExternalizableWithSerializationMethods" level="WARNING" enabled="true" /> - <inspection_tool class="ReadObjectInitialization" level="WARNING" enabled="true" /> - <inspection_tool class="NonSerializableWithSerializationMethods" level="WARNING" enabled="true" /> - <inspection_tool class="NonSerializableWithSerialVersionUIDField" level="WARNING" enabled="true" /> - <inspection_tool class="ReadObjectAndWriteObjectPrivate" level="WARNING" enabled="true" /> - <inspection_tool class="ReadResolveAndWriteReplaceProtected" level="WARNING" enabled="true" /> - <inspection_tool class="SerializableWithUnconstructableAncestor" level="WARNING" enabled="true" /> - <inspection_tool class="SerializableHasSerializationMethods" level="WARNING" enabled="true"> - <option name="m_ignoreSerializableDueToInheritance" value="true" /> - </inspection_tool> - <inspection_tool class="SerializableHasSerialVersionUIDField" level="WARNING" enabled="true"> - <option name="m_ignoreSerializableDueToInheritance" value="true" /> - </inspection_tool> - <inspection_tool class="SerializableInnerClassHasSerialVersionUIDField" level="WARNING" enabled="true"> - <option name="m_ignoreSerializableDueToInheritance" value="true" /> - </inspection_tool> - <inspection_tool class="SerializableInnerClassWithNonSerializableOuterClass" level="WARNING" enabled="true"> - <option name="m_ignoreSerializableDueToInheritance" value="true" /> - </inspection_tool> - <inspection_tool class="SerialPersistentFieldsWithWrongSignature" level="WARNING" enabled="true" /> - <inspection_tool class="SerialVersionUIDNotStaticFinal" level="WARNING" enabled="true" /> - <inspection_tool class="TransientFieldInNonSerializableClass" level="WARNING" enabled="true" /> - <inspection_tool class="ArithmeticOnVolatileField" level="WARNING" enabled="true" /> - <inspection_tool class="AwaitNotInLoop" level="WARNING" enabled="true" /> - <inspection_tool class="BusyWait" level="WARNING" enabled="true" /> - <inspection_tool class="ObjectNotify" level="WARNING" enabled="true" /> - <inspection_tool class="ConditionSignal" level="WARNING" enabled="true"... [truncated message content] |
From: <aki...@us...> - 2010-05-24 15:46:21
|
Revision: 7960 http://gridarta.svn.sourceforge.net/gridarta/?rev=7960&view=rev Author: akirschbaum Date: 2010-05-24 12:17:16 +0000 (Mon, 24 May 2010) Log Message: ----------- Extract code into functions; add comments. Modified Paths: -------------- trunk/src/app/net/sf/gridarta/model/archetypetype/ArchetypeTypeParser.java Modified: trunk/src/app/net/sf/gridarta/model/archetypetype/ArchetypeTypeParser.java =================================================================== --- trunk/src/app/net/sf/gridarta/model/archetypetype/ArchetypeTypeParser.java 2010-05-24 12:00:54 UTC (rev 7959) +++ trunk/src/app/net/sf/gridarta/model/archetypetype/ArchetypeTypeParser.java 2010-05-24 12:17:16 UTC (rev 7960) @@ -157,21 +157,21 @@ archetypeAttribute.setSectionId(sectionId); } - return new ArchetypeType<G, A, R>(typeName, typeNo, parseDesc(root), parseUse(root), sectionNames.getSectionNames(), attributes, typeAttributes); + return new ArchetypeType<G, A, R>(typeName, typeNo, parseDescription(root), parseUse(root), sectionNames.getSectionNames(), attributes, typeAttributes); } @NotNull private Collection<ArchetypeAttribute<G, A, R>> getDefaultList(@NotNull final Iterable<ArchetypeAttribute<G, A, R>> archetypeType, @NotNull final Collection<String> autoIgnoreTable, @NotNull final Map<String, String> ignoreTable) { - final Collection<ArchetypeAttribute<G, A, R>> defList = new ArrayList<ArchetypeAttribute<G, A, R>>(); + final Collection<ArchetypeAttribute<G, A, R>> defaultList = new ArrayList<ArchetypeAttribute<G, A, R>>(); for (final ArchetypeAttribute<G, A, R> archetypeAttribute : archetypeType) { // add all attributes from the default_type which are not in the ignoreTable if (!ignoreTable.containsKey(archetypeAttribute.getArchetypeAttributeName()) && !autoIgnoreTable.contains(archetypeAttribute.getArchetypeAttributeName())) { - defList.add(archetypeAttribute.clone()); + defaultList.add(archetypeAttribute.clone()); } } - return defList; + return defaultList; } @NotNull @@ -273,7 +273,30 @@ return Collections.emptyList(); } - // parse 'required' attributes + final List<ArchetypeAttributeDefinition> typeAttributes = parseRequiredAttribute(root, typeName, errorViewCollector); + + // parse 'ignore' elements + final Element ignoreElement = NodeListIterator.getFirstChild(root, XML_IGNORE); + if (ignoreElement != null) { + // load all attributes in the ignore section + parseAttributeAttributes(typeName, errorViewCollector, ignoreTable, ignoreElement); + + // load attributes from ignore lists + parseIgnoreListAttribute(typeName, errorViewCollector, ignoreTable, ignoreListTable, ignoreElement); + } + + return typeAttributes; + } + + /** + * Parses the {@link #XML_REQUIRED} child. + * @param root the root element + * @param typeName the type name + * @param errorViewCollector the error view collector for error messages + * @return the type definitions + */ + @NotNull + private static List<ArchetypeAttributeDefinition> parseRequiredAttribute(@NotNull final Element root, @NotNull final String typeName, @NotNull final ErrorViewCollector errorViewCollector) { final List<ArchetypeAttributeDefinition> typeAttributes = new ArrayList<ArchetypeAttributeDefinition>(); final Element required = NodeListIterator.getFirstChild(root, XML_REQUIRED); if (required != null) { @@ -289,50 +312,72 @@ } } } + return typeAttributes; + } - // parse 'ignore' elements - final Element signore = NodeListIterator.getFirstChild(root, XML_IGNORE); - if (signore != null) { - // load all attributes in the ignore section - final Iterator<Element> it = new NodeListIterator<Element>(signore, XML_ATTRIBUTE); - while (it.hasNext()) { - final Element elem = it.next(); - final Attr a1 = elem.getAttributeNode(ArchetypeAttributeParser.XML_KEY_ARCH); - if (a1 == null) { - errorViewCollector.addWarning(ErrorViewCategory.TYPES_ENTRY_INVALID, XML_IGNORE + ": section of type " + typeName + ": " + XML_ATTRIBUTE + " missing '" + ArchetypeAttributeParser.XML_KEY_ARCH + "'."); - } else { - ignoreTable.put(a1.getValue().trim(), ""); - } + /** + * Parses the {@link #XML_ATTRIBUTE} child. + * @param typeName the type name for error messages + * @param errorViewCollector the error view collector for error messages + * @param ignoreTable the ignore table to add to + * @param ignoreElement the ignore element to parse + */ + private static void parseAttributeAttributes(@NotNull final String typeName, @NotNull final ErrorViewCollector errorViewCollector, @NotNull final Map<String, String> ignoreTable, @NotNull final Element ignoreElement) { + final Iterator<Element> it = new NodeListIterator<Element>(ignoreElement, XML_ATTRIBUTE); + while (it.hasNext()) { + final Element elem = it.next(); + final Attr a1 = elem.getAttributeNode(ArchetypeAttributeParser.XML_KEY_ARCH); + if (a1 == null) { + errorViewCollector.addWarning(ErrorViewCategory.TYPES_ENTRY_INVALID, XML_IGNORE + ": section of type " + typeName + ": " + XML_ATTRIBUTE + " missing '" + ArchetypeAttributeParser.XML_KEY_ARCH + "'."); + } else { + ignoreTable.put(a1.getValue().trim(), ""); } + } + } - // load attributes from ignore lists - final Iterator<Element> it2 = new NodeListIterator<Element>(signore, "ignore_list"); - while (it2.hasNext()) { - final Element elem = it2.next(); - final Attr a1 = elem.getAttributeNode("name"); - if (a1 == null) { - errorViewCollector.addWarning(ErrorViewCategory.TYPES_ENTRY_INVALID, XML_IGNORE + ": section of type " + typeName + ": ignore_list missing 'name'."); - } else if (ignoreListTable.containsKey(a1.getValue().trim())) { - // just copy everything from ignore list to this ignore section - final Iterable<String> ignoreList = ignoreListTable.get(a1.getValue().trim()); - for (final String ignItem : ignoreList) { - ignoreTable.put(ignItem, ""); - } - } else { - errorViewCollector.addWarning(ErrorViewCategory.TYPES_ENTRY_INVALID, XML_IGNORE + ": section of type " + typeName + ": ignore_list with name \"" + a1.getValue() + "\" is undefined."); + /** + * Parses the "ignore_list" children. + * @param typeName the type name for error messages + * @param errorViewCollector the error view collector for error messages + * @param ignoreTable the ignore table to add to + * @param ignoreListTable the ignore lists to use + * @param ignoreElement the ignore element to parse + */ + private static void parseIgnoreListAttribute(@NotNull final String typeName, @NotNull final ErrorViewCollector errorViewCollector, @NotNull final Map<String, String> ignoreTable, final Map<String, List<String>> ignoreListTable, @NotNull final Element ignoreElement) { + final Iterator<Element> it2 = new NodeListIterator<Element>(ignoreElement, "ignore_list"); + while (it2.hasNext()) { + final Element elem = it2.next(); + final Attr a1 = elem.getAttributeNode("name"); + if (a1 == null) { + errorViewCollector.addWarning(ErrorViewCategory.TYPES_ENTRY_INVALID, XML_IGNORE + ": section of type " + typeName + ": ignore_list missing 'name'."); + } else if (ignoreListTable.containsKey(a1.getValue().trim())) { + // just copy everything from ignore list to this ignore section + final Iterable<String> ignoreList = ignoreListTable.get(a1.getValue().trim()); + for (final String ignItem : ignoreList) { + ignoreTable.put(ignItem, ""); } + } else { + errorViewCollector.addWarning(ErrorViewCategory.TYPES_ENTRY_INVALID, XML_IGNORE + ": section of type " + typeName + ": ignore_list with name \"" + a1.getValue() + "\" is undefined."); } } - - return typeAttributes; } + /** + * Parses the {@link #XML_DESCRIPTION} child. + * @param root the root element + * @return the description or <code>null</code> if no description is present + */ @Nullable - private static String parseDesc(@NotNull final Element root) { + private static String parseDescription(@NotNull final Element root) { final Node elem = NodeListIterator.getFirstChild(root, XML_DESCRIPTION); return elem == null ? null : elem.getTextContent().trim(); } + /** + * Parses the {@link #XML_USE} child. + * @param root the root element + * @return the use or <code>null</code> if no use is present + */ @Nullable private static String parseUse(@NotNull final Element root) { final Node elem = NodeListIterator.getFirstChild(root, XML_USE); @@ -340,20 +385,20 @@ } /** - * Parse an xml attribute element. If parsing succeeds, the new {@link + * Parses an XML attribute element. If parsing succeeds, the new {@link * ArchetypeAttribute} is added to the temporary linked list provided by the * parameters (see below). Assignment of sections to attributes also happens * in this method. * @param errorViewCollector the error view collector for reporting errors * @param typeName the archetype type's name * @param typeNo the archetype type's type number - * @param elem the xml attribute element + * @param elem the XML attribute element * @param sectionNames the defined section names * @param inSection true if this attribute belongs to a (custom-defined) * section * @param section name of the section (only relevant if 'inSection'==true) * @param archetypeTypeSet arch type list - * @return the parsed attribute or <code>null</code> + * @return the parsed attribute or <code>null</code> if an error occurs */ @Nullable private ArchetypeAttribute<G, A, R> parseAttribute(@NotNull final ErrorViewCollector errorViewCollector, @NotNull final String typeName, final int typeNo, final Element elem, final SectionNames sectionNames, final boolean inSection, final String section, final ArchetypeTypeSet<G, A, R> archetypeTypeSet) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2010-05-24 15:40:52
|
Revision: 7977 http://gridarta.svn.sourceforge.net/gridarta/?rev=7977&view=rev Author: akirschbaum Date: 2010-05-24 15:40:45 +0000 (Mon, 24 May 2010) Log Message: ----------- Cleanup parser for/document <lists> elements within types.xml. Modified Paths: -------------- trunk/resource/system/dtd/types.dtd trunk/src/app/net/sf/gridarta/model/archetypetype/ArchetypeTypeList.java trunk/src/app/net/sf/gridarta/model/archetypetype/ArchetypeTypeSetParser.java Modified: trunk/resource/system/dtd/types.dtd =================================================================== --- trunk/resource/system/dtd/types.dtd 2010-05-24 14:33:17 UTC (rev 7976) +++ trunk/resource/system/dtd/types.dtd 2010-05-24 15:40:45 UTC (rev 7977) @@ -49,6 +49,8 @@ name CDATA #REQUIRED > +<!-- value: must be unique within the surrounding <list> --> +<!-- name: must be non-empty --> <!ELEMENT listentry EMPTY> <!ATTLIST listentry value CDATA #REQUIRED Modified: trunk/src/app/net/sf/gridarta/model/archetypetype/ArchetypeTypeList.java =================================================================== --- trunk/src/app/net/sf/gridarta/model/archetypetype/ArchetypeTypeList.java 2010-05-24 14:33:17 UTC (rev 7976) +++ trunk/src/app/net/sf/gridarta/model/archetypetype/ArchetypeTypeList.java 2010-05-24 15:40:45 UTC (rev 7977) @@ -57,10 +57,20 @@ /** * Adds an entry. - * @param pair the entry to add + * @param value the entry's value + * @param name the entry's name + * @throws IllegalArgumentException if the values are not acceptable */ - public void add(@NotNull final Pair<Integer, String> pair) { - list.add(pair); + public void add(final int value, @NotNull final String name) { + if (name.isEmpty()) { + throw new IllegalArgumentException("empty name"); + } + for (final Pair<Integer, String> pair : list) { + if (pair.getFirst() == value) { + throw new IllegalArgumentException("duplicate value '" + value + "' for '" + pair.getSecond() + "' and '" + name +"'"); + } + } + list.add(new Pair<Integer, String>(value, name)); } /** Modified: trunk/src/app/net/sf/gridarta/model/archetypetype/ArchetypeTypeSetParser.java =================================================================== --- trunk/src/app/net/sf/gridarta/model/archetypetype/ArchetypeTypeSetParser.java 2010-05-24 14:33:17 UTC (rev 7976) +++ trunk/src/app/net/sf/gridarta/model/archetypetype/ArchetypeTypeSetParser.java 2010-05-24 15:40:45 UTC (rev 7977) @@ -33,7 +33,6 @@ import net.sf.gridarta.model.errorview.ErrorViewCollector; import net.sf.gridarta.model.gameobject.GameObject; import net.sf.gridarta.model.map.maparchobject.MapArchObject; -import net.sf.gridarta.utils.Pair; import net.sf.japi.xml.NodeListIterator; import org.apache.log4j.Category; import org.apache.log4j.Logger; @@ -273,19 +272,16 @@ final Iterator<Element> it = new NodeListIterator<Element>(xpath, element, "lists/list"); while (it.hasNext()) { final Element elem = it.next(); - if (elem.getAttribute("name") == null) { - errorViewCollector.addWarning(ErrorViewCategory.TYPES_ENTRY_INVALID, "cannot load list element without 'name'."); - } else { - final ArchetypeTypeList list = parseList(errorViewCollector, elem); - if (list.size() > 0) { - archetypeTypeSet.addList(elem.getAttribute("name"), list); - } + final ArchetypeTypeList list = parseList(errorViewCollector, elem); + if (list.size() > 0) { + final String name = elem.getAttribute("name"); + archetypeTypeSet.addList(name, list); } } } /** - * Parses a "lists/list" section of a types.xml file. + * Parses a "list" section of a types.xml file. * @param errorViewCollector the error view collector for reporting errors * @param element the element to parse * @return the parsed archetype type list @@ -298,14 +294,19 @@ while (it.hasNext()) { final Element elem = it.next(); final String name = elem.getAttribute("name"); + final String valueString = elem.getAttribute("value"); final int value; try { - value = Integer.valueOf(elem.getAttribute("value")); + value = Integer.valueOf(valueString); } catch (final NumberFormatException ignore) { - errorViewCollector.addWarning(ErrorViewCategory.TYPES_ENTRY_INVALID, name + ": value '" + elem.getAttribute("value") + "' is not an integer."); + errorViewCollector.addWarning(ErrorViewCategory.TYPES_ENTRY_INVALID, name + ": value '" + valueString + "' is not an integer."); continue; } - list.add(new Pair<Integer, String>(value, name)); + try { + list.add(value, name); + } catch (final IllegalArgumentException ex) { + errorViewCollector.addWarning(ErrorViewCategory.TYPES_ENTRY_INVALID, ex.getMessage() + "."); + } } return list; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2010-05-24 14:33:23
|
Revision: 7976 http://gridarta.svn.sourceforge.net/gridarta/?rev=7976&view=rev Author: akirschbaum Date: 2010-05-24 14:33:17 +0000 (Mon, 24 May 2010) Log Message: ----------- Cleanup parser for/document <bitmask> elements within types.xml. Modified Paths: -------------- trunk/resource/system/dtd/types.dtd trunk/src/app/net/sf/gridarta/model/archetypetype/ArchetypeTypeSetParser.java Modified: trunk/resource/system/dtd/types.dtd =================================================================== --- trunk/resource/system/dtd/types.dtd 2010-05-24 14:22:56 UTC (rev 7975) +++ trunk/resource/system/dtd/types.dtd 2010-05-24 14:33:17 UTC (rev 7976) @@ -55,6 +55,13 @@ name CDATA #REQUIRED > +<!-- bit/value: exactly one must be specified --> +<!-- value: only valid within "is_named" <bitmask> elements --> +<!-- value: integer value of bitmask --> +<!-- bit: bit value 0..31 --> +<!-- name: the name for the value --> +<!-- encoding: the external representation of the bit value --> +<!-- encoding: only valid within "is_named" <bitmask> elements --> <!ELEMENT bmentry EMPTY> <!ATTLIST bmentry bit CDATA #IMPLIED Modified: trunk/src/app/net/sf/gridarta/model/archetypetype/ArchetypeTypeSetParser.java =================================================================== --- trunk/src/app/net/sf/gridarta/model/archetypetype/ArchetypeTypeSetParser.java 2010-05-24 14:22:56 UTC (rev 7975) +++ trunk/src/app/net/sf/gridarta/model/archetypetype/ArchetypeTypeSetParser.java 2010-05-24 14:33:17 UTC (rev 7976) @@ -199,29 +199,32 @@ * Parses a "bmentry" section of a types.xml file. * @param errorViewCollector the error view collector for reporting errors * @param element the "bmentry" section to parse - * @param name the name of the parent's "bitmask" section for error messages + * @param bitmaskName the name of the parent's "bitmask" section for error + * messages * @param isNamed whether the bitmask attribute is named * @param attributeBitmask the bitmask attribute to update */ - private void parseBmentry(@NotNull final ErrorViewCollector errorViewCollector, @NotNull final Element element, @NotNull final String name, final boolean isNamed, @NotNull final AttributeBitmask<G, A, R> attributeBitmask) { + private void parseBmentry(@NotNull final ErrorViewCollector errorViewCollector, @NotNull final Element element, @NotNull final String bitmaskName, final boolean isNamed, @NotNull final AttributeBitmask<G, A, R> attributeBitmask) { final String bitAttribute = element.getAttribute("bit"); final String valueAttribute = element.getAttribute("value"); if (bitAttribute.length() != 0 && valueAttribute.length() != 0) { - errorViewCollector.addWarning(ErrorViewCategory.TYPES_ENTRY_INVALID, name + ": element contains both 'bit' and 'value' attributes"); + errorViewCollector.addWarning(ErrorViewCategory.TYPES_ENTRY_INVALID, bitmaskName + ": element contains both 'bit' and 'value' attributes"); return; } + final String name = element.getAttribute("name"); + final int value; if (bitAttribute.length() == 0) { if (!isNamed) { - errorViewCollector.addWarning(ErrorViewCategory.TYPES_ENTRY_INVALID, name + ": 'value' attribute allowed only in named bitmasks"); + errorViewCollector.addWarning(ErrorViewCategory.TYPES_ENTRY_INVALID, bitmaskName + ": 'value' attribute allowed only in named bitmasks"); return; } try { value = Integer.parseInt(valueAttribute); } catch (final NumberFormatException ignored) { - errorViewCollector.addWarning(ErrorViewCategory.TYPES_ENTRY_INVALID, name + ": invalid 'value' value: " + valueAttribute); + errorViewCollector.addWarning(ErrorViewCategory.TYPES_ENTRY_INVALID, bitmaskName + ": invalid 'value' value: " + valueAttribute); return; } } else { @@ -229,32 +232,32 @@ try { bitValue = Integer.parseInt(bitAttribute); } catch (final NumberFormatException ignored) { - errorViewCollector.addWarning(ErrorViewCategory.TYPES_ENTRY_INVALID, name + ": invalid 'bit' value: " + bitAttribute); + errorViewCollector.addWarning(ErrorViewCategory.TYPES_ENTRY_INVALID, bitmaskName + ": invalid 'bit' value: " + bitAttribute); return; } if (bitValue < 0 || bitValue >= 32) { - errorViewCollector.addWarning(ErrorViewCategory.TYPES_ENTRY_INVALID, name + ": invalid 'bit' value: " + bitValue); + errorViewCollector.addWarning(ErrorViewCategory.TYPES_ENTRY_INVALID, bitmaskName + ": invalid 'bit' value: " + bitValue); return; } - if (!attributeBitmask.addBitName(bitValue, element.getAttribute("name"))) { - errorViewCollector.addWarning(ErrorViewCategory.TYPES_ENTRY_INVALID, name + ": duplicate 'bit' value: " + bitValue); + if (!attributeBitmask.addBitName(bitValue, name)) { + errorViewCollector.addWarning(ErrorViewCategory.TYPES_ENTRY_INVALID, bitmaskName + ": duplicate 'bit' value: " + bitValue); return; } value = 1 << bitValue; } - attributeBitmask.addName(element.getAttribute("name"), value); + attributeBitmask.addName(name, value); - final String encodingAttribute = element.getAttribute("encoding"); + final String encoding = element.getAttribute("encoding"); if (isNamed) { - if (encodingAttribute.length() == 0) { - errorViewCollector.addWarning(ErrorViewCategory.TYPES_ENTRY_INVALID, name + ": missing 'encoding' attribute"); + if (encoding.length() == 0) { + errorViewCollector.addWarning(ErrorViewCategory.TYPES_ENTRY_INVALID, bitmaskName + ": missing 'encoding' attribute"); return; } - attributeBitmask.addNamedValue(encodingAttribute, value); + attributeBitmask.addNamedValue(encoding, value); } else { - if (encodingAttribute.length() != 0) { - errorViewCollector.addWarning(ErrorViewCategory.TYPES_ENTRY_INVALID, name + ": unused 'encoding' attribute"); + if (encoding.length() != 0) { + errorViewCollector.addWarning(ErrorViewCategory.TYPES_ENTRY_INVALID, bitmaskName + ": unused 'encoding' attribute"); return; } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2010-05-24 14:23:02
|
Revision: 7975 http://gridarta.svn.sourceforge.net/gridarta/?rev=7975&view=rev Author: akirschbaum Date: 2010-05-24 14:22:56 +0000 (Mon, 24 May 2010) Log Message: ----------- Remove XML parsing code out of AttributeBitmask. Modified Paths: -------------- trunk/src/app/net/sf/gridarta/model/archetypetype/ArchetypeTypeSetParser.java trunk/src/app/net/sf/gridarta/model/archetypetype/AttributeBitmask.java Modified: trunk/src/app/net/sf/gridarta/model/archetypetype/ArchetypeTypeSetParser.java =================================================================== --- trunk/src/app/net/sf/gridarta/model/archetypetype/ArchetypeTypeSetParser.java 2010-05-24 13:46:00 UTC (rev 7974) +++ trunk/src/app/net/sf/gridarta/model/archetypetype/ArchetypeTypeSetParser.java 2010-05-24 14:22:56 UTC (rev 7975) @@ -38,6 +38,7 @@ import org.apache.log4j.Category; import org.apache.log4j.Logger; import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; import org.w3c.dom.Attr; import org.w3c.dom.Document; import org.w3c.dom.Element; @@ -152,11 +153,114 @@ final Iterator<Element> it = new NodeListIterator<Element>(xpath, element, "bitmasks/bitmask"); while (it.hasNext()) { final Element elem = it.next(); - archetypeTypeSet.addBitmask(elem.getAttribute("name"), new AttributeBitmask<G, A, R>(errorViewCollector, xpath, elem)); + final AttributeBitmask<G, A, R> attributeBitmask = parseBitmask(errorViewCollector, elem); + if (attributeBitmask != null) { + archetypeTypeSet.addBitmask(elem.getAttribute("name"), attributeBitmask); + } } } /** + * Parses a "bitmasks/bitmask" section of a types.xml file. + * @param errorViewCollector the error view collector for reporting errors + * @param element the element to parse or <code>null</code> if the entry is + * invalid + * @return the parsed bitmask attribute + * @throws XPathExpressionException if an internal error occurs + */ + @Nullable + private AttributeBitmask<G, A, R> parseBitmask(@NotNull final ErrorViewCollector errorViewCollector, @NotNull final Element element) throws XPathExpressionException { + final String name = element.getAttribute("name"); + final boolean isNamed = element.getAttribute("is_named").equals("yes"); + final AttributeBitmask<G, A, R> attributeBitmask = new AttributeBitmask<G, A, R>(isNamed); + + final NodeListIterator<Element> entries = new NodeListIterator<Element>(xpath, element, "bmentry"); + while (entries.hasNext()) { + parseBmentry(errorViewCollector, entries.next(), name, isNamed, attributeBitmask); + } + if (attributeBitmask.getNumber() <= 0) { + errorViewCollector.addWarning(ErrorViewCategory.TYPES_ENTRY_INVALID, name + ": no 'bit' entries"); + return null; + } + + if (isNamed && !attributeBitmask.containsEncoding(0)) { + errorViewCollector.addWarning(ErrorViewCategory.TYPES_ENTRY_INVALID, name + ": missing name for value 0"); + return null; + } + if (isNamed && !attributeBitmask.containsEncoding(attributeBitmask.getMaxValue())) { + errorViewCollector.addWarning(ErrorViewCategory.TYPES_ENTRY_INVALID, name + ": missing name for value " + attributeBitmask.getMaxValue()); + return null; + } + + return attributeBitmask; + } + + /** + * Parses a "bmentry" section of a types.xml file. + * @param errorViewCollector the error view collector for reporting errors + * @param element the "bmentry" section to parse + * @param name the name of the parent's "bitmask" section for error messages + * @param isNamed whether the bitmask attribute is named + * @param attributeBitmask the bitmask attribute to update + */ + private void parseBmentry(@NotNull final ErrorViewCollector errorViewCollector, @NotNull final Element element, @NotNull final String name, final boolean isNamed, @NotNull final AttributeBitmask<G, A, R> attributeBitmask) { + final String bitAttribute = element.getAttribute("bit"); + + final String valueAttribute = element.getAttribute("value"); + if (bitAttribute.length() != 0 && valueAttribute.length() != 0) { + errorViewCollector.addWarning(ErrorViewCategory.TYPES_ENTRY_INVALID, name + ": element contains both 'bit' and 'value' attributes"); + return; + } + + final int value; + if (bitAttribute.length() == 0) { + if (!isNamed) { + errorViewCollector.addWarning(ErrorViewCategory.TYPES_ENTRY_INVALID, name + ": 'value' attribute allowed only in named bitmasks"); + return; + } + try { + value = Integer.parseInt(valueAttribute); + } catch (final NumberFormatException ignored) { + errorViewCollector.addWarning(ErrorViewCategory.TYPES_ENTRY_INVALID, name + ": invalid 'value' value: " + valueAttribute); + return; + } + } else { + final int bitValue; + try { + bitValue = Integer.parseInt(bitAttribute); + } catch (final NumberFormatException ignored) { + errorViewCollector.addWarning(ErrorViewCategory.TYPES_ENTRY_INVALID, name + ": invalid 'bit' value: " + bitAttribute); + return; + } + if (bitValue < 0 || bitValue >= 32) { + errorViewCollector.addWarning(ErrorViewCategory.TYPES_ENTRY_INVALID, name + ": invalid 'bit' value: " + bitValue); + return; + } + if (!attributeBitmask.addBitName(bitValue, element.getAttribute("name"))) { + errorViewCollector.addWarning(ErrorViewCategory.TYPES_ENTRY_INVALID, name + ": duplicate 'bit' value: " + bitValue); + return; + } + value = 1 << bitValue; + } + + attributeBitmask.addName(element.getAttribute("name"), value); + + final String encodingAttribute = element.getAttribute("encoding"); + if (isNamed) { + if (encodingAttribute.length() == 0) { + errorViewCollector.addWarning(ErrorViewCategory.TYPES_ENTRY_INVALID, name + ": missing 'encoding' attribute"); + return; + } + attributeBitmask.addNamedValue(encodingAttribute, value); + } else { + if (encodingAttribute.length() != 0) { + errorViewCollector.addWarning(ErrorViewCategory.TYPES_ENTRY_INVALID, name + ": unused 'encoding' attribute"); + return; + } + } + } + + /** * Parses the "lists" section of a types.xml file. * @param errorViewCollector the error view collector for reporting errors * @param element the element to parse Modified: trunk/src/app/net/sf/gridarta/model/archetypetype/AttributeBitmask.java =================================================================== --- trunk/src/app/net/sf/gridarta/model/archetypetype/AttributeBitmask.java 2010-05-24 13:46:00 UTC (rev 7974) +++ trunk/src/app/net/sf/gridarta/model/archetypetype/AttributeBitmask.java 2010-05-24 14:22:56 UTC (rev 7975) @@ -22,22 +22,17 @@ import java.util.ArrayList; import java.util.Collection; import java.util.HashMap; +import java.util.List; import java.util.Map; import java.util.regex.Pattern; -import javax.xml.xpath.XPath; -import javax.xml.xpath.XPathExpressionException; import net.sf.gridarta.model.archetype.Archetype; -import net.sf.gridarta.model.errorview.ErrorViewCategory; -import net.sf.gridarta.model.errorview.ErrorViewCollector; import net.sf.gridarta.model.gameobject.GameObject; import net.sf.gridarta.model.map.maparchobject.MapArchObject; import net.sf.gridarta.utils.WrappingStringBuilder; -import net.sf.japi.xml.NodeListIterator; import org.apache.log4j.Category; import org.apache.log4j.Logger; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; -import org.w3c.dom.Element; /** * This class manages bitmask values which appear in Gridarta arch attributes. @@ -61,10 +56,10 @@ private static final int MAX_CHARS_PER_LINE = 35; // 50 /** - * Names of the bitmask-entries. + * The names of the bitmask entries. */ @NotNull - private final String[] bitName; + private final List<String> bitName = new ArrayList<String>(); /** * Set if the bitmask value may be encoded as strings in external @@ -91,11 +86,6 @@ private final Map<Integer, String> names = new HashMap<Integer, String>(); /** - * Number of bitmask entries (not counting zero). - */ - private final int number; - - /** * A pattern that matches one or more spaces. */ @NotNull @@ -103,92 +93,11 @@ /** * Constructor of a bitmask from XML element. - * @param errorViewCollector the error view collector for reporting errors - * @param xpath XPath for XPath evaluation - * @param bitmasksElement xml bitmask element - * @throws XPathExpressionException in case of XPath evaluation errors + * @param isNamed whether this attribute's bitmask values are to be encoded + * as strings in external representation */ - public AttributeBitmask(@NotNull final ErrorViewCollector errorViewCollector, @NotNull final XPath xpath, @NotNull final Element bitmasksElement) throws XPathExpressionException { - final NodeListIterator<Element> entries = new NodeListIterator<Element>(xpath, bitmasksElement, "bmentry"); - isNamed = bitmasksElement.getAttribute("is_named").equals("yes"); - final String[] tmp = new String[32]; - int bitValues = 0; - while (entries.hasNext()) { - final Element elem = entries.next(); - final String bitAttribute = elem.getAttribute("bit"); - final String valueAttribute = elem.getAttribute("value"); - if (bitAttribute.length() != 0 && valueAttribute.length() != 0) { - errorViewCollector.addWarning(ErrorViewCategory.TYPES_ENTRY_INVALID, bitmasksElement.getAttribute("name") + ": element contains both 'bit' and 'value' attributes"); - continue; - } - - final int value; - if (bitAttribute.length() == 0) { - if (!isNamed) { - errorViewCollector.addWarning(ErrorViewCategory.TYPES_ENTRY_INVALID, bitmasksElement.getAttribute("name") + ": 'value' attribute allowed only in named bitmasks"); - continue; - } - try { - value = Integer.parseInt(valueAttribute); - } catch (final NumberFormatException ignored) { - errorViewCollector.addWarning(ErrorViewCategory.TYPES_ENTRY_INVALID, bitmasksElement.getAttribute("name") + ": invalid 'value' value: " + valueAttribute); - continue; - } - } else { - final int bitValue; - try { - bitValue = Integer.parseInt(bitAttribute); - } catch (final NumberFormatException ignored) { - errorViewCollector.addWarning(ErrorViewCategory.TYPES_ENTRY_INVALID, bitmasksElement.getAttribute("name") + ": invalid 'bit' value: " + bitAttribute); - continue; - } - if (bitValue < 0 || bitValue >= tmp.length) { - errorViewCollector.addWarning(ErrorViewCategory.TYPES_ENTRY_INVALID, bitmasksElement.getAttribute("name") + ": invalid 'bit' value: " + bitValue); - continue; - } - if (tmp[bitValue] != null) { - errorViewCollector.addWarning(ErrorViewCategory.TYPES_ENTRY_INVALID, bitmasksElement.getAttribute("name") + ": duplicate 'bit' value: " + bitValue); - continue; - } - tmp[bitValue] = elem.getAttribute("name"); - value = 1 << bitValue; - bitValues = Math.max(bitValues, bitValue + 1); - } - - final String encodingAttribute = elem.getAttribute("encoding"); - if (isNamed) { - if (encodingAttribute.length() == 0) { - errorViewCollector.addWarning(ErrorViewCategory.TYPES_ENTRY_INVALID, bitmasksElement.getAttribute("name") + ": missing 'encoding' attribute"); - continue; - } - namedValues.put(encodingAttribute, value); - encodings.put(value, encodingAttribute); - } else { - if (encodingAttribute.length() != 0) { - errorViewCollector.addWarning(ErrorViewCategory.TYPES_ENTRY_INVALID, bitmasksElement.getAttribute("name") + ": unused 'encoding' attribute"); - continue; - } - } - names.put(value, elem.getAttribute("name")); - } - if (bitValues <= 0) { - number = 0; - bitName = new String[number]; - errorViewCollector.addWarning(ErrorViewCategory.TYPES_ENTRY_INVALID, bitmasksElement.getAttribute("name") + ": no 'bit' entries"); - return; - } - number = bitValues; - bitName = new String[bitValues]; - System.arraycopy(tmp, 0, bitName, 0, bitValues); - - if (isNamed && !encodings.containsKey(0)) { - errorViewCollector.addWarning(ErrorViewCategory.TYPES_ENTRY_INVALID, bitmasksElement.getAttribute("name") + ": missing name for value 0"); - return; - } - if (isNamed && !encodings.containsKey(getMaxValue())) { - errorViewCollector.addWarning(ErrorViewCategory.TYPES_ENTRY_INVALID, bitmasksElement.getAttribute("name") + ": missing name for value " + getMaxValue()); - return; - } + public AttributeBitmask(final boolean isNamed) { + this.isNamed = isNamed; } /** @@ -341,7 +250,7 @@ * @return the maximum allowed bitmask value */ public int getMaxValue() { - return (1 << bitName.length) - 1; + return (1 << bitName.size()) - 1; } /** @@ -349,7 +258,7 @@ * @return the number of bitmask entries */ public int getNumber() { - return number; + return bitName.size(); } /** @@ -359,7 +268,54 @@ */ @Nullable public String getBitName(final int index) { - return bitName[index]; + return bitName.get(index); } + /** + * Adds a readable name for a bit value. + * @param name the name + * @param value the bit value + */ + public void addName(@NotNull final String name, final int value) { + names.put(value, name); + } + + /** + * Adds a name for external encoding of a value. + * @param name the name + * @param value the value + */ + public void addNamedValue(@NotNull final String name, final int value) { + namedValues.put(name, value); + encodings.put(value, name); + } + + /** + * Returns whether an external encoding for value exists. + * @param value the value + * @return whether an external encoding exists + */ + public boolean containsEncoding(final int value) { + return encodings.containsKey(value); + } + + /** + * Defines a bit name for a bit value. + * @param bitValue the bit value + * @param name the name + * @return whether the entry was added + */ + public boolean addBitName(final int bitValue, @NotNull final String name) { + if (bitValue >= bitName.size()) { + do { + bitName.add(null); + } while (bitValue >= bitName.size()); + } else if (bitName.get(bitValue) != null) { + return false; + } + + bitName.set(bitValue, name); + return true; + } + } // class AttributeBitmask This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2010-05-24 13:46:06
|
Revision: 7974 http://gridarta.svn.sourceforge.net/gridarta/?rev=7974&view=rev Author: akirschbaum Date: 2010-05-24 13:46:00 +0000 (Mon, 24 May 2010) Log Message: ----------- Rewrite expression. Modified Paths: -------------- trunk/src/app/net/sf/gridarta/model/archetypetype/ArchetypeTypeSetParser.java Modified: trunk/src/app/net/sf/gridarta/model/archetypetype/ArchetypeTypeSetParser.java =================================================================== --- trunk/src/app/net/sf/gridarta/model/archetypetype/ArchetypeTypeSetParser.java 2010-05-24 13:44:54 UTC (rev 7973) +++ trunk/src/app/net/sf/gridarta/model/archetypetype/ArchetypeTypeSetParser.java 2010-05-24 13:46:00 UTC (rev 7974) @@ -266,7 +266,7 @@ final Iterator<Element> it = new NodeListIterator<Element>(element, "type"); while (it.hasNext()) { final Element elem = it.next(); - if (!"no".equals(elem.getAttribute("available"))) { + if (!elem.getAttribute("available").equals("no")) { archetypeTypeSet.add(archetypeTypeParser.load(errorViewCollector, archetypeTypeSet.getDefaultArchetypeType(), elem, archetypeTypeSet, ignoreListTable)); } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2010-05-24 13:45:00
|
Revision: 7973 http://gridarta.svn.sourceforge.net/gridarta/?rev=7973&view=rev Author: akirschbaum Date: 2010-05-24 13:44:54 +0000 (Mon, 24 May 2010) Log Message: ----------- Update comments. Modified Paths: -------------- trunk/src/app/net/sf/gridarta/model/archetypetype/ArchetypeTypeSetParser.java Modified: trunk/src/app/net/sf/gridarta/model/archetypetype/ArchetypeTypeSetParser.java =================================================================== --- trunk/src/app/net/sf/gridarta/model/archetypetype/ArchetypeTypeSetParser.java 2010-05-24 13:38:47 UTC (rev 7972) +++ trunk/src/app/net/sf/gridarta/model/archetypetype/ArchetypeTypeSetParser.java 2010-05-24 13:44:54 UTC (rev 7973) @@ -45,38 +45,38 @@ import org.xml.sax.SAXException; /** - * Parser for {@link ArchetypeTypeSet}s. + * Parser for {@link ArchetypeTypeSet ArchetypeTypeSets} ("types.xml" files). * @author <a href="mailto:ch...@ri...">Christian Hujer</a> * @author Andreas Kirschbaum */ public class ArchetypeTypeSetParser<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>> { /** - * The Logger for printing log messages. + * The logger for printing log messages. */ @NotNull private static final Category log = Logger.getLogger(ArchetypeTypeSetParser.class); /** - * The document builder to use. + * The {@link DocumentBuilder} to use. */ @NotNull private final DocumentBuilder documentBuilder; /** - * The XPath for using XPath. + * The {@link }XPath} for using XPath. */ @NotNull private final XPath xpath; /** - * The archetype type set to update. + * The {@link ArchetypeTypeSet} to update. */ @NotNull private final ArchetypeTypeSet<G, A, R> archetypeTypeSet; /** - * The parser to use. + * The {@link ArchetypeTypeParser} }to use. */ @NotNull private final ArchetypeTypeParser<G, A, R> archetypeTypeParser; @@ -87,7 +87,7 @@ * @param xpath the XPath instance to use for applying for XPath * expressions * @param archetypeTypeSet the archetype type set to update - * @param archetypeTypeParser the parser to use + * @param archetypeTypeParser the archetype type parser to use */ public ArchetypeTypeSetParser(@NotNull final DocumentBuilder documentBuilder, @NotNull final XPath xpath, @NotNull final ArchetypeTypeSet<G, A, R> archetypeTypeSet, @NotNull final ArchetypeTypeParser<G, A, R> archetypeTypeParser) { this.documentBuilder = documentBuilder; @@ -169,7 +169,7 @@ if (elem.getAttribute("name") == null) { errorViewCollector.addWarning(ErrorViewCategory.TYPES_ENTRY_INVALID, "cannot load list element without 'name'."); } else { - final ArchetypeTypeList list = parseListFromElement(errorViewCollector, elem); + final ArchetypeTypeList list = parseList(errorViewCollector, elem); if (list.size() > 0) { archetypeTypeSet.addList(elem.getAttribute("name"), list); } @@ -178,15 +178,14 @@ } /** - * Parse a list vector from an xml list element. + * Parses a "lists/list" section of a types.xml file. * @param errorViewCollector the error view collector for reporting errors * @param element the element to parse - * @return List with data parsed from <var>root</var> + * @return the parsed archetype type list * @throws XPathExpressionException if an internal error occurs - * @todo improve this comment */ @NotNull - private ArchetypeTypeList parseListFromElement(@NotNull final ErrorViewCollector errorViewCollector, @NotNull final Element element) throws XPathExpressionException { + private ArchetypeTypeList parseList(@NotNull final ErrorViewCollector errorViewCollector, @NotNull final Element element) throws XPathExpressionException { final ArchetypeTypeList list = new ArchetypeTypeList(); final Iterator<Element> it = new NodeListIterator<Element>(xpath, element, "listentry"); while (it.hasNext()) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2010-05-24 13:38:53
|
Revision: 7972 http://gridarta.svn.sourceforge.net/gridarta/?rev=7972&view=rev Author: akirschbaum Date: 2010-05-24 13:38:47 +0000 (Mon, 24 May 2010) Log Message: ----------- Simplify code. Modified Paths: -------------- trunk/src/app/net/sf/gridarta/model/archetypetype/ArchetypeTypeSetParser.java Modified: trunk/src/app/net/sf/gridarta/model/archetypetype/ArchetypeTypeSetParser.java =================================================================== --- trunk/src/app/net/sf/gridarta/model/archetypetype/ArchetypeTypeSetParser.java 2010-05-24 13:37:09 UTC (rev 7971) +++ trunk/src/app/net/sf/gridarta/model/archetypetype/ArchetypeTypeSetParser.java 2010-05-24 13:38:47 UTC (rev 7972) @@ -124,12 +124,11 @@ * file */ public void loadTypesFromXML(@NotNull final ErrorViewCollector errorViewCollector, @NotNull final String filename, @NotNull final Document document) { - final Map<String, List<String>> ignoreListTable = new HashMap<String, List<String>>(); try { final Element root = document.getDocumentElement(); parseBitmasks(errorViewCollector, root); parseLists(errorViewCollector, root); - parseIgnoreLists(errorViewCollector, root, ignoreListTable); + final Map<String, List<String>> ignoreListTable = parseIgnoreLists(errorViewCollector, root); parseDefaultType(errorViewCollector, root, ignoreListTable); parseTypes(errorViewCollector, root, ignoreListTable); @@ -209,10 +208,12 @@ * Parses the "ignorelists" section of a types.xml file. * @param errorViewCollector the error view collector for reporting errors * @param element the element to parse - * @param ignoreListTable returns the section's contents + * @return the section's contents * @throws XPathExpressionException if an internal error occurs */ - private void parseIgnoreLists(@NotNull final ErrorViewCollector errorViewCollector, final Element element, @NotNull final Map<String, List<String>> ignoreListTable) throws XPathExpressionException { + @NotNull + private Map<String, List<String>> parseIgnoreLists(@NotNull final ErrorViewCollector errorViewCollector, final Element element) throws XPathExpressionException { + final Map<String, List<String>> ignoreListTable = new HashMap<String, List<String>>(); final Iterator<Element> it = new NodeListIterator<Element>(xpath, element, "ignore_list|ignorelists/ignore_list"); while (it.hasNext()) { final Element elem = it.next(); @@ -236,6 +237,7 @@ } } } + return ignoreListTable; } /** This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2010-05-24 13:37:15
|
Revision: 7971 http://gridarta.svn.sourceforge.net/gridarta/?rev=7971&view=rev Author: akirschbaum Date: 2010-05-24 13:37:09 +0000 (Mon, 24 May 2010) Log Message: ----------- Simplify code. Modified Paths: -------------- trunk/src/app/net/sf/gridarta/model/archetypetype/ArchetypeTypeSetParser.java Modified: trunk/src/app/net/sf/gridarta/model/archetypetype/ArchetypeTypeSetParser.java =================================================================== --- trunk/src/app/net/sf/gridarta/model/archetypetype/ArchetypeTypeSetParser.java 2010-05-24 13:34:58 UTC (rev 7970) +++ trunk/src/app/net/sf/gridarta/model/archetypetype/ArchetypeTypeSetParser.java 2010-05-24 13:37:09 UTC (rev 7971) @@ -38,7 +38,6 @@ import org.apache.log4j.Category; import org.apache.log4j.Logger; import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; import org.w3c.dom.Attr; import org.w3c.dom.Document; import org.w3c.dom.Element; @@ -131,10 +130,7 @@ parseBitmasks(errorViewCollector, root); parseLists(errorViewCollector, root); parseIgnoreLists(errorViewCollector, root, ignoreListTable); - final ArchetypeType<G, A, R> defaultType = parseDefaultType(errorViewCollector, root, ignoreListTable); - if (defaultType != null) { - archetypeTypeSet.setDefaultArchetypeType(defaultType); - } + parseDefaultType(errorViewCollector, root, ignoreListTable); parseTypes(errorViewCollector, root, ignoreListTable); if (log.isInfoEnabled()) { @@ -247,17 +243,16 @@ * @param errorViewCollector the error view collector for reporting errors * @param element the element to parse * @param ignoreListTable the contents of the "ignorelists" section - * @return the parsed archetype type */ - @Nullable - private ArchetypeType<G, A, R> parseDefaultType(@NotNull final ErrorViewCollector errorViewCollector, final Element element, @NotNull final Map<String, List<String>> ignoreListTable) { + private void parseDefaultType(@NotNull final ErrorViewCollector errorViewCollector, final Element element, @NotNull final Map<String, List<String>> ignoreListTable) { final Element el = NodeListIterator.getFirstChild(element, "default_type"); if (el == null) { errorViewCollector.addWarning(ErrorViewCategory.TYPES_ENTRY_INVALID, "default_type element is missing!"); - return null; + return; } - return archetypeTypeParser.load(errorViewCollector, null, el, archetypeTypeSet, ignoreListTable); + final ArchetypeType<G, A, R> defaultType = archetypeTypeParser.load(errorViewCollector, null, el, archetypeTypeSet, ignoreListTable); + archetypeTypeSet.setDefaultArchetypeType(defaultType); } /** This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2010-05-24 13:35:04
|
Revision: 7970 http://gridarta.svn.sourceforge.net/gridarta/?rev=7970&view=rev Author: akirschbaum Date: 2010-05-24 13:34:58 +0000 (Mon, 24 May 2010) Log Message: ----------- Add @NotNull annotations; remove unneeded check. Modified Paths: -------------- trunk/src/app/net/sf/gridarta/model/archetypetype/ArchetypeTypeSetParser.java Modified: trunk/src/app/net/sf/gridarta/model/archetypetype/ArchetypeTypeSetParser.java =================================================================== --- trunk/src/app/net/sf/gridarta/model/archetypetype/ArchetypeTypeSetParser.java 2010-05-24 13:33:50 UTC (rev 7969) +++ trunk/src/app/net/sf/gridarta/model/archetypetype/ArchetypeTypeSetParser.java 2010-05-24 13:34:58 UTC (rev 7970) @@ -175,7 +175,7 @@ errorViewCollector.addWarning(ErrorViewCategory.TYPES_ENTRY_INVALID, "cannot load list element without 'name'."); } else { final ArchetypeTypeList list = parseListFromElement(errorViewCollector, elem); - if (list != null && list.size() > 0) { + if (list.size() > 0) { archetypeTypeSet.addList(elem.getAttribute("name"), list); } } @@ -190,7 +190,8 @@ * @throws XPathExpressionException if an internal error occurs * @todo improve this comment */ - private ArchetypeTypeList parseListFromElement(@NotNull final ErrorViewCollector errorViewCollector, final Element element) throws XPathExpressionException { + @NotNull + private ArchetypeTypeList parseListFromElement(@NotNull final ErrorViewCollector errorViewCollector, @NotNull final Element element) throws XPathExpressionException { final ArchetypeTypeList list = new ArchetypeTypeList(); final Iterator<Element> it = new NodeListIterator<Element>(xpath, element, "listentry"); while (it.hasNext()) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2010-05-24 13:33:56
|
Revision: 7969 http://gridarta.svn.sourceforge.net/gridarta/?rev=7969&view=rev Author: akirschbaum Date: 2010-05-24 13:33:50 +0000 (Mon, 24 May 2010) Log Message: ----------- Remove call to Throwable.printStackTrace(). Modified Paths: -------------- trunk/src/app/net/sf/gridarta/model/archetypetype/ArchetypeTypeSetParser.java Modified: trunk/src/app/net/sf/gridarta/model/archetypetype/ArchetypeTypeSetParser.java =================================================================== --- trunk/src/app/net/sf/gridarta/model/archetypetype/ArchetypeTypeSetParser.java 2010-05-24 13:33:14 UTC (rev 7968) +++ trunk/src/app/net/sf/gridarta/model/archetypetype/ArchetypeTypeSetParser.java 2010-05-24 13:33:50 UTC (rev 7969) @@ -108,7 +108,6 @@ try { doc = documentBuilder.parse(inputSource); } catch (final SAXException e) { - e.printStackTrace(); errorViewCollector.addWarning(ErrorViewCategory.TYPES_ENTRY_INVALID, "parsing error: " + e.getMessage()); return; } catch (final IOException e) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2010-05-24 13:33:21
|
Revision: 7968 http://gridarta.svn.sourceforge.net/gridarta/?rev=7968&view=rev Author: akirschbaum Date: 2010-05-24 13:33:14 +0000 (Mon, 24 May 2010) Log Message: ----------- Add comments. Modified Paths: -------------- trunk/src/app/net/sf/gridarta/model/archetypetype/ArchetypeTypeParser.java trunk/src/app/net/sf/gridarta/model/archetypetype/ArchetypeTypeSetParser.java Modified: trunk/src/app/net/sf/gridarta/model/archetypetype/ArchetypeTypeParser.java =================================================================== --- trunk/src/app/net/sf/gridarta/model/archetypetype/ArchetypeTypeParser.java 2010-05-24 13:25:16 UTC (rev 7967) +++ trunk/src/app/net/sf/gridarta/model/archetypetype/ArchetypeTypeParser.java 2010-05-24 13:33:14 UTC (rev 7968) @@ -111,7 +111,7 @@ * Loading the data from an xml type element into this instance. Since users * are expected to edit the type definitions, I have tried to design the * parser to be somewhat robust and provide error feedback. - * @param errorViewCollector the error view collector for reporting error + * @param errorViewCollector the error view collector for reporting errors * @param parent the parent archetype type * @param root the xml 'type' element which is going to be parsed * @param archetypeTypeSet archetype type list Modified: trunk/src/app/net/sf/gridarta/model/archetypetype/ArchetypeTypeSetParser.java =================================================================== --- trunk/src/app/net/sf/gridarta/model/archetypetype/ArchetypeTypeSetParser.java 2010-05-24 13:25:16 UTC (rev 7967) +++ trunk/src/app/net/sf/gridarta/model/archetypetype/ArchetypeTypeSetParser.java 2010-05-24 13:33:14 UTC (rev 7968) @@ -97,6 +97,12 @@ this.archetypeTypeParser = archetypeTypeParser; } + /** + * Loads a types.xml file. + * @param errorViewCollector the error view collector for reporting errors + * @param inputSource the input source providing the contents of the + * types.xml file + */ public void loadTypesFromXML(@NotNull final ErrorViewCollector errorViewCollector, @NotNull final InputSource inputSource) { final Document doc; try { @@ -112,10 +118,17 @@ loadTypesFromXML(errorViewCollector, inputSource.getSystemId(), doc); } - public void loadTypesFromXML(@NotNull final ErrorViewCollector errorViewCollector, @NotNull final String filename, @NotNull final Document doc) { + /** + * Loads a types.xml file. + * @param errorViewCollector the error view collector for reporting errors + * @param filename the filename of the types.xml file for error messages + * @param document the document containing the contents of the types.xml + * file + */ + public void loadTypesFromXML(@NotNull final ErrorViewCollector errorViewCollector, @NotNull final String filename, @NotNull final Document document) { final Map<String, List<String>> ignoreListTable = new HashMap<String, List<String>>(); try { - final Element root = doc.getDocumentElement(); + final Element root = document.getDocumentElement(); parseBitmasks(errorViewCollector, root); parseLists(errorViewCollector, root); parseIgnoreLists(errorViewCollector, root, ignoreListTable); @@ -135,16 +148,28 @@ archetypeTypeSet.defineFallbackArchetypeType(); } - private void parseBitmasks(@NotNull final ErrorViewCollector errorViewCollector, final Element root) throws XPathExpressionException { - final Iterator<Element> it = new NodeListIterator<Element>(xpath, root, "bitmasks/bitmask"); + /** + * Parses the "bitmasks" section of a types.xml file. + * @param errorViewCollector the error view collector for reporting errors + * @param element the element to parse + * @throws XPathExpressionException if an internal error occurs + */ + private void parseBitmasks(@NotNull final ErrorViewCollector errorViewCollector, final Element element) throws XPathExpressionException { + final Iterator<Element> it = new NodeListIterator<Element>(xpath, element, "bitmasks/bitmask"); while (it.hasNext()) { final Element elem = it.next(); archetypeTypeSet.addBitmask(elem.getAttribute("name"), new AttributeBitmask<G, A, R>(errorViewCollector, xpath, elem)); } } - private void parseLists(@NotNull final ErrorViewCollector errorViewCollector, final Element root) throws XPathExpressionException { - final Iterator<Element> it = new NodeListIterator<Element>(xpath, root, "lists/list"); + /** + * Parses the "lists" section of a types.xml file. + * @param errorViewCollector the error view collector for reporting errors + * @param element the element to parse + * @throws XPathExpressionException if an internal error occurs + */ + private void parseLists(@NotNull final ErrorViewCollector errorViewCollector, final Element element) throws XPathExpressionException { + final Iterator<Element> it = new NodeListIterator<Element>(xpath, element, "lists/list"); while (it.hasNext()) { final Element elem = it.next(); if (elem.getAttribute("name") == null) { @@ -161,15 +186,14 @@ /** * Parse a list vector from an xml list element. * @param errorViewCollector the error view collector for reporting errors - * @param root element to parse + * @param element the element to parse * @return List with data parsed from <var>root</var> - * @throws XPathExpressionException In case of XPath issues (should never - * happen). + * @throws XPathExpressionException if an internal error occurs * @todo improve this comment */ - private ArchetypeTypeList parseListFromElement(@NotNull final ErrorViewCollector errorViewCollector, final Element root) throws XPathExpressionException { + private ArchetypeTypeList parseListFromElement(@NotNull final ErrorViewCollector errorViewCollector, final Element element) throws XPathExpressionException { final ArchetypeTypeList list = new ArchetypeTypeList(); - final Iterator<Element> it = new NodeListIterator<Element>(xpath, root, "listentry"); + final Iterator<Element> it = new NodeListIterator<Element>(xpath, element, "listentry"); while (it.hasNext()) { final Element elem = it.next(); final String name = elem.getAttribute("name"); @@ -185,8 +209,15 @@ return list; } - private void parseIgnoreLists(@NotNull final ErrorViewCollector errorViewCollector, final Element root, @NotNull final Map<String, List<String>> ignoreListTable) throws XPathExpressionException { - final Iterator<Element> it = new NodeListIterator<Element>(xpath, root, "ignore_list|ignorelists/ignore_list"); + /** + * Parses the "ignorelists" section of a types.xml file. + * @param errorViewCollector the error view collector for reporting errors + * @param element the element to parse + * @param ignoreListTable returns the section's contents + * @throws XPathExpressionException if an internal error occurs + */ + private void parseIgnoreLists(@NotNull final ErrorViewCollector errorViewCollector, final Element element, @NotNull final Map<String, List<String>> ignoreListTable) throws XPathExpressionException { + final Iterator<Element> it = new NodeListIterator<Element>(xpath, element, "ignore_list|ignorelists/ignore_list"); while (it.hasNext()) { final Element elem = it.next(); if (elem.getAttribute("name") == null) { @@ -212,11 +243,15 @@ } /** - * Parses the "default_type". + * Parses the "default_type" section of a types.xml file. + * @param errorViewCollector the error view collector for reporting errors + * @param element the element to parse + * @param ignoreListTable the contents of the "ignorelists" section + * @return the parsed archetype type */ @Nullable - private ArchetypeType<G, A, R> parseDefaultType(@NotNull final ErrorViewCollector errorViewCollector, final Element root, @NotNull final Map<String, List<String>> ignoreListTable) { - final Element el = NodeListIterator.getFirstChild(root, "default_type"); + private ArchetypeType<G, A, R> parseDefaultType(@NotNull final ErrorViewCollector errorViewCollector, final Element element, @NotNull final Map<String, List<String>> ignoreListTable) { + final Element el = NodeListIterator.getFirstChild(element, "default_type"); if (el == null) { errorViewCollector.addWarning(ErrorViewCategory.TYPES_ENTRY_INVALID, "default_type element is missing!"); return null; @@ -226,10 +261,13 @@ } /** - * Parses all "type" elements. + * Parses the "type" section of a types.xml file. + * @param errorViewCollector the error view collector for reporting errors + * @param element the element to parse + * @param ignoreListTable the contents of the "ignorelists" section */ - private void parseTypes(@NotNull final ErrorViewCollector errorViewCollector, final Element root, @NotNull final Map<String, List<String>> ignoreListTable) { - final Iterator<Element> it = new NodeListIterator<Element>(root, "type"); + private void parseTypes(@NotNull final ErrorViewCollector errorViewCollector, final Element element, @NotNull final Map<String, List<String>> ignoreListTable) { + final Iterator<Element> it = new NodeListIterator<Element>(element, "type"); while (it.hasNext()) { final Element elem = it.next(); if (!"no".equals(elem.getAttribute("available"))) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2010-05-24 13:25:22
|
Revision: 7967 http://gridarta.svn.sourceforge.net/gridarta/?rev=7967&view=rev Author: akirschbaum Date: 2010-05-24 13:25:16 +0000 (Mon, 24 May 2010) Log Message: ----------- Remove unused code. Modified Paths: -------------- trunk/src/app/net/sf/gridarta/model/archetypetype/ArchetypeTypeSetParser.java Modified: trunk/src/app/net/sf/gridarta/model/archetypetype/ArchetypeTypeSetParser.java =================================================================== --- trunk/src/app/net/sf/gridarta/model/archetypetype/ArchetypeTypeSetParser.java 2010-05-24 13:13:27 UTC (rev 7966) +++ trunk/src/app/net/sf/gridarta/model/archetypetype/ArchetypeTypeSetParser.java 2010-05-24 13:25:16 UTC (rev 7967) @@ -112,20 +112,6 @@ loadTypesFromXML(errorViewCollector, inputSource.getSystemId(), doc); } - public void loadTypesFromXML(@NotNull final ErrorViewCollector errorViewCollector, @NotNull final String filename) { - final Document doc; - try { - doc = documentBuilder.parse(filename); - } catch (final SAXException e) { - errorViewCollector.addWarning(ErrorViewCategory.TYPES_ENTRY_INVALID, "parsing error: " + e.getMessage()); - return; - } catch (final IOException e) { - errorViewCollector.addWarning(ErrorViewCategory.TYPES_FILE_INVALID, e.getMessage()); - return; - } - loadTypesFromXML(errorViewCollector, filename, doc); - } - public void loadTypesFromXML(@NotNull final ErrorViewCollector errorViewCollector, @NotNull final String filename, @NotNull final Document doc) { final Map<String, List<String>> ignoreListTable = new HashMap<String, List<String>>(); try { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2010-05-24 13:13:33
|
Revision: 7966 http://gridarta.svn.sourceforge.net/gridarta/?rev=7966&view=rev Author: akirschbaum Date: 2010-05-24 13:13:27 +0000 (Mon, 24 May 2010) Log Message: ----------- Declare variables more local. Modified Paths: -------------- trunk/src/app/net/sf/gridarta/model/archetypetype/ArchetypeTypeParser.java Modified: trunk/src/app/net/sf/gridarta/model/archetypetype/ArchetypeTypeParser.java =================================================================== --- trunk/src/app/net/sf/gridarta/model/archetypetype/ArchetypeTypeParser.java 2010-05-24 13:12:30 UTC (rev 7965) +++ trunk/src/app/net/sf/gridarta/model/archetypetype/ArchetypeTypeParser.java 2010-05-24 13:13:27 UTC (rev 7966) @@ -121,15 +121,15 @@ */ @NotNull public ArchetypeType<G, A, R> load(@NotNull final ErrorViewCollector errorViewCollector, @Nullable final ArchetypeType<G, A, R> parent, @NotNull final Element root, @NotNull final ArchetypeTypeSet<G, A, R> archetypeTypeSet, @NotNull final Map<String, List<String>> ignoreListTable) { - final SectionNames sectionNames = new SectionNames(); - final Map<String, String> ignoreTable = new HashMap<String, String>(); - final Collection<String> autoIgnoreTable = new HashSet<String>(); final boolean isDefaultType = root.getNodeName().equals("default_type"); final String typeName = parseTypeName(root, isDefaultType); + final Map<String, String> ignoreTable = new HashMap<String, String>(); final int typeNo = parseTypeNo(root, isDefaultType, typeName, errorViewCollector); final ArchetypeAttributesDefinition typeAttributes = parseTypeAttributes(root, isDefaultType, typeName, typeNo, errorViewCollector, ignoreTable, ignoreListTable); final String importName = parseImportName(root, typeName, errorViewCollector); final ArchetypeAttributes<G, A, R> attributes = new ArchetypeAttributes<G, A, R>(); + final SectionNames sectionNames = new SectionNames(); + final Collection<String> autoIgnoreTable = new HashSet<String>(); attributes.addAll(parseAttrList(root, errorViewCollector, typeName, typeNo, sectionNames, autoIgnoreTable, archetypeTypeSet)); if (parent != null) { attributes.addAll(getDefaultList(parent, autoIgnoreTable, ignoreTable)); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2010-05-24 13:12:36
|
Revision: 7965 http://gridarta.svn.sourceforge.net/gridarta/?rev=7965&view=rev Author: akirschbaum Date: 2010-05-24 13:12:30 +0000 (Mon, 24 May 2010) Log Message: ----------- Fix typo. Modified Paths: -------------- trunk/src/app/net/sf/gridarta/model/archetypetype/ArchetypeAttributes.java trunk/src/app/net/sf/gridarta/model/archetypetype/ArchetypeTypeParser.java Modified: trunk/src/app/net/sf/gridarta/model/archetypetype/ArchetypeAttributes.java =================================================================== --- trunk/src/app/net/sf/gridarta/model/archetypetype/ArchetypeAttributes.java 2010-05-24 13:12:11 UTC (rev 7964) +++ trunk/src/app/net/sf/gridarta/model/archetypetype/ArchetypeAttributes.java 2010-05-24 13:12:30 UTC (rev 7965) @@ -77,7 +77,7 @@ * Updates the section names of all archetype attributes. * @param sectionNames the section names to use */ - public void setSectionNamed(@NotNull final SectionNames sectionNames) { + public void setSectionNames(@NotNull final SectionNames sectionNames) { for (final ArchetypeAttribute<G, A, R> archetypeAttribute : archetypeAttributes) { final String sectionName = archetypeAttribute.getSectionName(); final int sectionId = sectionNames.defineSectionName(sectionName); Modified: trunk/src/app/net/sf/gridarta/model/archetypetype/ArchetypeTypeParser.java =================================================================== --- trunk/src/app/net/sf/gridarta/model/archetypetype/ArchetypeTypeParser.java 2010-05-24 13:12:11 UTC (rev 7964) +++ trunk/src/app/net/sf/gridarta/model/archetypetype/ArchetypeTypeParser.java 2010-05-24 13:12:30 UTC (rev 7965) @@ -137,7 +137,7 @@ attributes.addAll(importName(importName, errorViewCollector, typeName, archetypeTypeSet, autoIgnoreTable)); } } - attributes.setSectionNamed(sectionNames); + attributes.setSectionNames(sectionNames); return new ArchetypeType<G, A, R>(typeName, typeNo, parseDescription(root), parseUse(root), sectionNames.getSectionNames(), attributes, typeAttributes); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2010-05-24 13:12:19
|
Revision: 7964 http://gridarta.svn.sourceforge.net/gridarta/?rev=7964&view=rev Author: akirschbaum Date: 2010-05-24 13:12:11 +0000 (Mon, 24 May 2010) Log Message: ----------- Simplify code. Modified Paths: -------------- trunk/src/app/net/sf/gridarta/model/archetypetype/ArchetypeTypeParser.java Modified: trunk/src/app/net/sf/gridarta/model/archetypetype/ArchetypeTypeParser.java =================================================================== --- trunk/src/app/net/sf/gridarta/model/archetypetype/ArchetypeTypeParser.java 2010-05-24 13:08:43 UTC (rev 7963) +++ trunk/src/app/net/sf/gridarta/model/archetypetype/ArchetypeTypeParser.java 2010-05-24 13:12:11 UTC (rev 7964) @@ -129,25 +129,14 @@ final int typeNo = parseTypeNo(root, isDefaultType, typeName, errorViewCollector); final ArchetypeAttributesDefinition typeAttributes = parseTypeAttributes(root, isDefaultType, typeName, typeNo, errorViewCollector, ignoreTable, ignoreListTable); final String importName = parseImportName(root, typeName, errorViewCollector); - final ArchetypeAttributes<G, A, R> attributeList = parseAttrList(root, errorViewCollector, typeName, typeNo, sectionNames, autoIgnoreTable, archetypeTypeSet); - final ArchetypeAttributes<G, A, R> defaultList; - final ArchetypeAttributes<G, A, R> importList; + final ArchetypeAttributes<G, A, R> attributes = new ArchetypeAttributes<G, A, R>(); + attributes.addAll(parseAttrList(root, errorViewCollector, typeName, typeNo, sectionNames, autoIgnoreTable, archetypeTypeSet)); if (parent != null) { - defaultList = getDefaultList(parent, autoIgnoreTable, ignoreTable); + attributes.addAll(getDefaultList(parent, autoIgnoreTable, ignoreTable)); if (parent.hasAttribute()) { - importList = importName(importName, errorViewCollector, typeName, archetypeTypeSet, autoIgnoreTable); - } else { - importList = new ArchetypeAttributes<G, A, R>(); + attributes.addAll(importName(importName, errorViewCollector, typeName, archetypeTypeSet, autoIgnoreTable)); } - } else { - defaultList = new ArchetypeAttributes<G, A, R>(); - importList = new ArchetypeAttributes<G, A, R>(); } - - final ArchetypeAttributes<G, A, R> attributes = new ArchetypeAttributes<G, A, R>(); - attributes.addAll(defaultList); - attributes.addAll(attributeList); - attributes.addAll(importList); attributes.setSectionNamed(sectionNames); return new ArchetypeType<G, A, R>(typeName, typeNo, parseDescription(root), parseUse(root), sectionNames.getSectionNames(), attributes, typeAttributes); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2010-05-24 13:08:50
|
Revision: 7963 http://gridarta.svn.sourceforge.net/gridarta/?rev=7963&view=rev Author: akirschbaum Date: 2010-05-24 13:08:43 +0000 (Mon, 24 May 2010) Log Message: ----------- Extract ArchetypeAttributes. Modified Paths: -------------- trunk/src/app/net/sf/gridarta/model/archetypetype/ArchetypeType.java trunk/src/app/net/sf/gridarta/model/archetypetype/ArchetypeTypeParser.java trunk/src/app/net/sf/gridarta/model/archetypetype/ArchetypeTypeSet.java Added Paths: ----------- trunk/src/app/net/sf/gridarta/model/archetypetype/ArchetypeAttributes.java Added: trunk/src/app/net/sf/gridarta/model/archetypetype/ArchetypeAttributes.java =================================================================== --- trunk/src/app/net/sf/gridarta/model/archetypetype/ArchetypeAttributes.java (rev 0) +++ trunk/src/app/net/sf/gridarta/model/archetypetype/ArchetypeAttributes.java 2010-05-24 13:08:43 UTC (rev 7963) @@ -0,0 +1,88 @@ +/* + * 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.archetypetype; + +import java.util.ArrayList; +import java.util.Collections; +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.map.maparchobject.MapArchObject; +import org.jetbrains.annotations.NotNull; + +/** + * A set of {@link ArchetypeAttribute ArchetypeAttributes}. + * @author Andreas Kirschbaum + */ +public class ArchetypeAttributes<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>> implements Iterable<ArchetypeAttribute<G, A, R>> { + + /** + * The {@link ArchetypeAttribute ArchetypeAttributes}. + */ + @NotNull + private final List<ArchetypeAttribute<G, A, R>> archetypeAttributes = new ArrayList<ArchetypeAttribute<G, A, R>>(); + + /** + * Adds an {@link ArchetypeAttribute}. + * @param archetypeAttribute the archetype attribute + */ + public void add(@NotNull final ArchetypeAttribute<G, A, R> archetypeAttribute) { + archetypeAttributes.add(archetypeAttribute); + } + + /** + * Adds all {@link ArchetypeAttribute ArchetypeAttributes} of another + * archetype attributes to this archetype attributes. + * @param archetypeAttributes the other archetype attributes + */ + public void addAll(@NotNull final ArchetypeAttributes<G, A, R> archetypeAttributes) { + this.archetypeAttributes.addAll(archetypeAttributes.archetypeAttributes); + } + + /** + * {@inheritDoc} + */ + @Override + public Iterator<ArchetypeAttribute<G, A, R>> iterator() { + return Collections.unmodifiableList(archetypeAttributes).iterator(); + } + + /** + * Returns whether no {@link ArchetypeAttribute ArchetypeAttributes} exist. + * @return wether no archetype attributes exist + */ + public boolean isEmpty() { + return archetypeAttributes.isEmpty(); + } + + /** + * Updates the section names of all archetype attributes. + * @param sectionNames the section names to use + */ + public void setSectionNamed(@NotNull final SectionNames sectionNames) { + for (final ArchetypeAttribute<G, A, R> archetypeAttribute : archetypeAttributes) { + final String sectionName = archetypeAttribute.getSectionName(); + final int sectionId = sectionNames.defineSectionName(sectionName); + archetypeAttribute.setSectionId(sectionId); + } + } + +} // class ArchetypeAttributes Property changes on: trunk/src/app/net/sf/gridarta/model/archetypetype/ArchetypeAttributes.java ___________________________________________________________________ Added: svn:mime-type + text/plain Added: svn:eol-style + LF Modified: trunk/src/app/net/sf/gridarta/model/archetypetype/ArchetypeType.java =================================================================== --- trunk/src/app/net/sf/gridarta/model/archetypetype/ArchetypeType.java 2010-05-24 12:42:30 UTC (rev 7962) +++ trunk/src/app/net/sf/gridarta/model/archetypetype/ArchetypeType.java 2010-05-24 13:08:43 UTC (rev 7963) @@ -19,9 +19,7 @@ package net.sf.gridarta.model.archetypetype; -import java.util.Collections; import java.util.Iterator; -import java.util.List; import net.sf.gridarta.model.archetype.Archetype; import net.sf.gridarta.model.baseobject.BaseObject; import net.sf.gridarta.model.gameobject.GameObject; @@ -80,7 +78,7 @@ * The list of {@link ArchetypeAttribute}s. */ @NotNull - private final List<ArchetypeAttribute<G, A, R>> archetypeAttributes; + private final ArchetypeAttributes<G, A, R> archetypeAttributes; /** * The list of additional attributes that an object must have in order to be @@ -99,7 +97,7 @@ * @param archetypeAttributes the list of archetype attributes * @param typeAttributes the list of additional attributes */ - public ArchetypeType(@NotNull final String typeName, final int typeNo, @Nullable final String description, @Nullable final String use, final int sectionNum, @NotNull final List<ArchetypeAttribute<G, A, R>> archetypeAttributes, @NotNull final ArchetypeAttributesDefinition typeAttributes) { + public ArchetypeType(@NotNull final String typeName, final int typeNo, @Nullable final String description, @Nullable final String use, final int sectionNum, @NotNull final ArchetypeAttributes<G, A, R> archetypeAttributes, @NotNull final ArchetypeAttributesDefinition typeAttributes) { this.typeName = typeName; this.typeNo = typeNo; this.description = description; @@ -123,7 +121,7 @@ @NotNull @Override public Iterator<ArchetypeAttribute<G, A, R>> iterator() { - return Collections.unmodifiableList(archetypeAttributes).iterator(); + return archetypeAttributes.iterator(); } /** Modified: trunk/src/app/net/sf/gridarta/model/archetypetype/ArchetypeTypeParser.java =================================================================== --- trunk/src/app/net/sf/gridarta/model/archetypetype/ArchetypeTypeParser.java 2010-05-24 12:42:30 UTC (rev 7962) +++ trunk/src/app/net/sf/gridarta/model/archetypetype/ArchetypeTypeParser.java 2010-05-24 13:08:43 UTC (rev 7963) @@ -19,9 +19,7 @@ package net.sf.gridarta.model.archetypetype; -import java.util.ArrayList; import java.util.Collection; -import java.util.Collections; import java.util.HashMap; import java.util.HashSet; import java.util.Iterator; @@ -131,38 +129,33 @@ final int typeNo = parseTypeNo(root, isDefaultType, typeName, errorViewCollector); final ArchetypeAttributesDefinition typeAttributes = parseTypeAttributes(root, isDefaultType, typeName, typeNo, errorViewCollector, ignoreTable, ignoreListTable); final String importName = parseImportName(root, typeName, errorViewCollector); - final Collection<ArchetypeAttribute<G, A, R>> attributeList = parseAttrList(root, errorViewCollector, typeName, typeNo, sectionNames, autoIgnoreTable, archetypeTypeSet); - final Collection<ArchetypeAttribute<G, A, R>> defaultList; - final Collection<ArchetypeAttribute<G, A, R>> importList; + final ArchetypeAttributes<G, A, R> attributeList = parseAttrList(root, errorViewCollector, typeName, typeNo, sectionNames, autoIgnoreTable, archetypeTypeSet); + final ArchetypeAttributes<G, A, R> defaultList; + final ArchetypeAttributes<G, A, R> importList; if (parent != null) { defaultList = getDefaultList(parent, autoIgnoreTable, ignoreTable); if (parent.hasAttribute()) { importList = importName(importName, errorViewCollector, typeName, archetypeTypeSet, autoIgnoreTable); } else { - importList = Collections.emptyList(); + importList = new ArchetypeAttributes<G, A, R>(); } } else { - defaultList = Collections.emptyList(); - importList = Collections.emptyList(); + defaultList = new ArchetypeAttributes<G, A, R>(); + importList = new ArchetypeAttributes<G, A, R>(); } - final List<ArchetypeAttribute<G, A, R>> attributes = new ArrayList<ArchetypeAttribute<G, A, R>>(defaultList.size() + attributeList.size() + importList.size()); + final ArchetypeAttributes<G, A, R> attributes = new ArchetypeAttributes<G, A, R>(); attributes.addAll(defaultList); attributes.addAll(attributeList); attributes.addAll(importList); + attributes.setSectionNamed(sectionNames); - for (final ArchetypeAttribute<G, A, R> archetypeAttribute : attributes) { - final String sectionName = archetypeAttribute.getSectionName(); - final int sectionId = sectionNames.defineSectionName(sectionName); - archetypeAttribute.setSectionId(sectionId); - } - return new ArchetypeType<G, A, R>(typeName, typeNo, parseDescription(root), parseUse(root), sectionNames.getSectionNames(), attributes, typeAttributes); } @NotNull - private Collection<ArchetypeAttribute<G, A, R>> getDefaultList(@NotNull final Iterable<ArchetypeAttribute<G, A, R>> archetypeType, @NotNull final Collection<String> autoIgnoreTable, @NotNull final Map<String, String> ignoreTable) { - final Collection<ArchetypeAttribute<G, A, R>> defaultList = new ArrayList<ArchetypeAttribute<G, A, R>>(); + private ArchetypeAttributes<G, A, R> getDefaultList(@NotNull final Iterable<ArchetypeAttribute<G, A, R>> archetypeType, @NotNull final Collection<String> autoIgnoreTable, @NotNull final Map<String, String> ignoreTable) { + final ArchetypeAttributes<G, A, R> defaultList = new ArchetypeAttributes<G, A, R>(); for (final ArchetypeAttribute<G, A, R> archetypeAttribute : archetypeType) { // add all attributes from the default_type which are not in the ignoreTable @@ -175,23 +168,23 @@ } @NotNull - private Collection<ArchetypeAttribute<G, A, R>> importName(@Nullable final String importName, @NotNull final ErrorViewCollector errorViewCollector, @NotNull final String typeName, @NotNull final ArchetypeTypeSet<G, A, R> archetypeTypeSet, @NotNull final Collection<String> autoIgnoreTable) { + private ArchetypeAttributes<G, A, R> importName(@Nullable final String importName, @NotNull final ErrorViewCollector errorViewCollector, @NotNull final String typeName, @NotNull final ArchetypeTypeSet<G, A, R> archetypeTypeSet, @NotNull final Collection<String> autoIgnoreTable) { if (importName == null) { - return Collections.emptyList(); + return new ArchetypeAttributes<G, A, R>(); } final Iterable<ArchetypeAttribute<G, A, R>> impType = archetypeTypeSet.getArchetypeType(importName); if (impType == null) { errorViewCollector.addWarning(ErrorViewCategory.TYPES_ENTRY_INVALID, typeName + ": import type \"" + importName + "\" not found!"); - return Collections.emptyList(); + return new ArchetypeAttributes<G, A, R>(); } return importAttributes(impType, autoIgnoreTable); } @NotNull - private Collection<ArchetypeAttribute<G, A, R>> importAttributes(@NotNull final Iterable<ArchetypeAttribute<G, A, R>> impType, @NotNull final Collection<String> autoIgnoreTable) { - final Collection<ArchetypeAttribute<G, A, R>> importList = new ArrayList<ArchetypeAttribute<G, A, R>>(); + private ArchetypeAttributes<G, A, R> importAttributes(@NotNull final Iterable<ArchetypeAttribute<G, A, R>> impType, @NotNull final Collection<String> autoIgnoreTable) { + final ArchetypeAttributes<G, A, R> importList = new ArchetypeAttributes<G, A, R>(); for (final ArchetypeAttribute<G, A, R> archetypeAttribute : impType) { if (autoIgnoreTable.contains(archetypeAttribute.getArchetypeAttributeName())) { @@ -417,8 +410,8 @@ } @NotNull - private Collection<ArchetypeAttribute<G, A, R>> parseAttrList(@NotNull final Element root, @NotNull final ErrorViewCollector errorViewCollector, @NotNull final String typeName, final int typeNo, @NotNull final SectionNames sectionNames, @NotNull final Collection<String> autoIgnoreTable, @NotNull final ArchetypeTypeSet<G, A, R> archetypeTypeSet) { - final Collection<ArchetypeAttribute<G, A, R>> attributeList = new ArrayList<ArchetypeAttribute<G, A, R>>(); + private ArchetypeAttributes<G, A, R> parseAttrList(@NotNull final Element root, @NotNull final ErrorViewCollector errorViewCollector, @NotNull final String typeName, final int typeNo, @NotNull final SectionNames sectionNames, @NotNull final Collection<String> autoIgnoreTable, @NotNull final ArchetypeTypeSet<G, A, R> archetypeTypeSet) { + final ArchetypeAttributes<G, A, R> attributeList = new ArchetypeAttributes<G, A, R>(); // now get all children and process them in order: final Iterator<Element> it = new NodeListIterator<Element>(root, Node.ELEMENT_NODE); @@ -453,7 +446,7 @@ return attributeList; } - private void parseAttr(@NotNull final ErrorViewCollector errorViewCollector, @NotNull final String typeName, final int typeNo, @NotNull final Element elem, @NotNull final SectionNames sectionNames, @Nullable final String section, @NotNull final ArchetypeTypeSet<G, A, R> archetypeTypeSet, @NotNull final Collection<ArchetypeAttribute<G, A, R>> attrList, @NotNull final Collection<String> autoIgnoreTable) { + private void parseAttr(@NotNull final ErrorViewCollector errorViewCollector, @NotNull final String typeName, final int typeNo, @NotNull final Element elem, @NotNull final SectionNames sectionNames, @Nullable final String section, @NotNull final ArchetypeTypeSet<G, A, R> archetypeTypeSet, @NotNull final ArchetypeAttributes<G, A, R> attrList, @NotNull final Collection<String> autoIgnoreTable) { final ArchetypeAttribute<G, A, R> archetypeAttribute = parseAttribute(errorViewCollector, typeName, typeNo, elem, sectionNames, section != null, section, archetypeTypeSet); if (archetypeAttribute != null) { attrList.add(archetypeAttribute); Modified: trunk/src/app/net/sf/gridarta/model/archetypetype/ArchetypeTypeSet.java =================================================================== --- trunk/src/app/net/sf/gridarta/model/archetypetype/ArchetypeTypeSet.java 2010-05-24 12:42:30 UTC (rev 7962) +++ trunk/src/app/net/sf/gridarta/model/archetypetype/ArchetypeTypeSet.java 2010-05-24 13:08:43 UTC (rev 7963) @@ -20,7 +20,6 @@ package net.sf.gridarta.model.archetypetype; import java.util.ArrayList; -import java.util.Collections; import java.util.HashMap; import java.util.Iterator; import java.util.List; @@ -285,7 +284,7 @@ public void defineFallbackArchetypeType() { fallbackArchetypeType = archetypeTypeNames.get("Misc"); if (fallbackArchetypeType == null) { - fallbackArchetypeType = new ArchetypeType<G, A, R>("", 0, null, null, 2, Collections.<ArchetypeAttribute<G, A, R>>emptyList(), new ArchetypeAttributesDefinition()); + fallbackArchetypeType = new ArchetypeType<G, A, R>("", 0, null, null, 2, new ArchetypeAttributes<G, A, R>(), new ArchetypeAttributesDefinition()); } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2010-05-24 12:42:36
|
Revision: 7962 http://gridarta.svn.sourceforge.net/gridarta/?rev=7962&view=rev Author: akirschbaum Date: 2010-05-24 12:42:30 +0000 (Mon, 24 May 2010) Log Message: ----------- Extract ArchetypeAttributesDefinition from ArchetypeTypeParser. Modified Paths: -------------- trunk/src/app/net/sf/gridarta/model/archetypetype/ArchetypeType.java trunk/src/app/net/sf/gridarta/model/archetypetype/ArchetypeTypeParser.java trunk/src/app/net/sf/gridarta/model/archetypetype/ArchetypeTypeSet.java Added Paths: ----------- trunk/src/app/net/sf/gridarta/model/archetypetype/ArchetypeAttributesDefinition.java Added: trunk/src/app/net/sf/gridarta/model/archetypetype/ArchetypeAttributesDefinition.java =================================================================== --- trunk/src/app/net/sf/gridarta/model/archetypetype/ArchetypeAttributesDefinition.java (rev 0) +++ trunk/src/app/net/sf/gridarta/model/archetypetype/ArchetypeAttributesDefinition.java 2010-05-24 12:42:30 UTC (rev 7962) @@ -0,0 +1,81 @@ +/* + * 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.archetypetype; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.Iterator; +import java.util.List; +import net.sf.gridarta.model.baseobject.BaseObject; +import org.jetbrains.annotations.NotNull; + +/** + * A set of {@link ArchetypeAttributeDefinition ArchetypeAttributeDefinitions}. + * Corresponds to a list of <attribute> definitions in types.xml. + * @author Andreas Kirschbaum + */ +public class ArchetypeAttributesDefinition implements Iterable<ArchetypeAttributeDefinition> { + + /** + * The {@link ArchetypeAttributeDefinition ArchetypeAttributeDefinitions}. + */ + @NotNull + private final List<ArchetypeAttributeDefinition> archetypeAttributes = new ArrayList<ArchetypeAttributeDefinition>(); + + /** + * Adds an {@link ArchetypeAttributeDefinition}. + * @param archetypeAttribute the definition to add + */ + public void add(@NotNull final ArchetypeAttributeDefinition archetypeAttribute) { + archetypeAttributes.add(archetypeAttribute); // XXX: check for duplicates + } + + /** + * Checks whether a {@link BaseObject} matches all type attributes. + * @param baseObject the base object to check + * @return whether the base object matches + */ + public boolean matches(@NotNull final BaseObject<?, ?, ?, ?> baseObject) { + for (final ArchetypeAttributeDefinition typeAttribute : archetypeAttributes) { + if (!typeAttribute.matches(baseObject)) { + return false; + } + } + + return true; + } + + /** + * {@inheritDoc} + */ + @Override + public Iterator<ArchetypeAttributeDefinition> iterator() { + return Collections.unmodifiableList(archetypeAttributes).iterator(); + } + + /** + * Returns whether no attribute definitions exist. + * @return whether no attribute definitions exist + */ + public boolean isEmpty() { + return archetypeAttributes.isEmpty(); + } + +} // class ArchetypeAttributesDefinition Property changes on: trunk/src/app/net/sf/gridarta/model/archetypetype/ArchetypeAttributesDefinition.java ___________________________________________________________________ Added: svn:mime-type + text/plain Added: svn:eol-style + LF Modified: trunk/src/app/net/sf/gridarta/model/archetypetype/ArchetypeType.java =================================================================== --- trunk/src/app/net/sf/gridarta/model/archetypetype/ArchetypeType.java 2010-05-24 12:41:28 UTC (rev 7961) +++ trunk/src/app/net/sf/gridarta/model/archetypetype/ArchetypeType.java 2010-05-24 12:42:30 UTC (rev 7962) @@ -19,7 +19,6 @@ package net.sf.gridarta.model.archetypetype; -import java.util.Collection; import java.util.Collections; import java.util.Iterator; import java.util.List; @@ -88,7 +87,7 @@ * of this type. */ @NotNull - private final Collection<ArchetypeAttributeDefinition> typeAttributes; + private final ArchetypeAttributesDefinition typeAttributes; /** * Creates a new instance. @@ -100,7 +99,7 @@ * @param archetypeAttributes the list of archetype attributes * @param typeAttributes the list of additional attributes */ - public ArchetypeType(@NotNull final String typeName, final int typeNo, @Nullable final String description, @Nullable final String use, final int sectionNum, @NotNull final List<ArchetypeAttribute<G, A, R>> archetypeAttributes, @NotNull final Collection<ArchetypeAttributeDefinition> typeAttributes) { + public ArchetypeType(@NotNull final String typeName, final int typeNo, @Nullable final String description, @Nullable final String use, final int sectionNum, @NotNull final List<ArchetypeAttribute<G, A, R>> archetypeAttributes, @NotNull final ArchetypeAttributesDefinition typeAttributes) { this.typeName = typeName; this.typeNo = typeNo; this.description = description; @@ -172,13 +171,7 @@ return false; } - for (final ArchetypeAttributeDefinition typeAttribute : typeAttributes) { - if (!typeAttribute.matches(baseObject)) { - return false; - } - } - - return true; + return typeAttributes.matches(baseObject); } /** Modified: trunk/src/app/net/sf/gridarta/model/archetypetype/ArchetypeTypeParser.java =================================================================== --- trunk/src/app/net/sf/gridarta/model/archetypetype/ArchetypeTypeParser.java 2010-05-24 12:41:28 UTC (rev 7961) +++ trunk/src/app/net/sf/gridarta/model/archetypetype/ArchetypeTypeParser.java 2010-05-24 12:42:30 UTC (rev 7962) @@ -129,7 +129,7 @@ final boolean isDefaultType = root.getNodeName().equals("default_type"); final String typeName = parseTypeName(root, isDefaultType); final int typeNo = parseTypeNo(root, isDefaultType, typeName, errorViewCollector); - final List<ArchetypeAttributeDefinition> typeAttributes = parseTypeAttributes(root, isDefaultType, typeName, typeNo, errorViewCollector, ignoreTable, ignoreListTable); + final ArchetypeAttributesDefinition typeAttributes = parseTypeAttributes(root, isDefaultType, typeName, typeNo, errorViewCollector, ignoreTable, ignoreListTable); final String importName = parseImportName(root, typeName, errorViewCollector); final Collection<ArchetypeAttribute<G, A, R>> attributeList = parseAttrList(root, errorViewCollector, typeName, typeNo, sectionNames, autoIgnoreTable, archetypeTypeSet); final Collection<ArchetypeAttribute<G, A, R>> defaultList; @@ -267,13 +267,13 @@ * @return the type attributes */ @NotNull - private static List<ArchetypeAttributeDefinition> parseTypeAttributes(@NotNull final Element root, final boolean isDefaultType, @NotNull final String typeName, final int typeNo, @NotNull final ErrorViewCollector errorViewCollector, @NotNull final Map<String, String> ignoreTable, @NotNull final Map<String, List<String>> ignoreListTable) { + private static ArchetypeAttributesDefinition parseTypeAttributes(@NotNull final Element root, final boolean isDefaultType, @NotNull final String typeName, final int typeNo, @NotNull final ErrorViewCollector errorViewCollector, @NotNull final Map<String, String> ignoreTable, @NotNull final Map<String, List<String>> ignoreListTable) { if (isDefaultType) { // special case: default type (this one contains the default attributes) - return Collections.emptyList(); + return new ArchetypeAttributesDefinition(); } - final List<ArchetypeAttributeDefinition> typeAttributes = parseRequiredAttribute(root, typeName, errorViewCollector); + final ArchetypeAttributesDefinition typeAttributes = parseRequiredAttribute(root, typeName, errorViewCollector); // parse 'ignore' elements final Element ignoreElement = NodeListIterator.getFirstChild(root, XML_IGNORE); @@ -296,8 +296,8 @@ * @return the type definitions */ @NotNull - private static List<ArchetypeAttributeDefinition> parseRequiredAttribute(@NotNull final Element root, @NotNull final String typeName, @NotNull final ErrorViewCollector errorViewCollector) { - final List<ArchetypeAttributeDefinition> typeAttributes = new ArrayList<ArchetypeAttributeDefinition>(); + private static ArchetypeAttributesDefinition parseRequiredAttribute(@NotNull final Element root, @NotNull final String typeName, @NotNull final ErrorViewCollector errorViewCollector) { + final ArchetypeAttributesDefinition attributes = new ArchetypeAttributesDefinition(); final Element required = NodeListIterator.getFirstChild(root, XML_REQUIRED); if (required != null) { final Iterator<Element> it = new NodeListIterator<Element>(required, XML_ATTRIBUTE); @@ -308,11 +308,11 @@ if (a1 == null || a2 == null) { errorViewCollector.addWarning(ErrorViewCategory.TYPES_ENTRY_INVALID, XML_REQUIRED + ": element of type " + typeName + ": " + XML_ATTRIBUTE + " missing '" + ArchetypeAttributeParser.XML_KEY_ARCH + "' or '" + XML_VALUE + "'."); } else { - typeAttributes.add(new ArchetypeAttributeDefinition(a1.getValue().trim(), a2.getValue().trim())); + attributes.add(new ArchetypeAttributeDefinition(a1.getValue().trim(), a2.getValue().trim())); } } } - return typeAttributes; + return attributes; } /** Modified: trunk/src/app/net/sf/gridarta/model/archetypetype/ArchetypeTypeSet.java =================================================================== --- trunk/src/app/net/sf/gridarta/model/archetypetype/ArchetypeTypeSet.java 2010-05-24 12:41:28 UTC (rev 7961) +++ trunk/src/app/net/sf/gridarta/model/archetypetype/ArchetypeTypeSet.java 2010-05-24 12:42:30 UTC (rev 7962) @@ -285,7 +285,7 @@ public void defineFallbackArchetypeType() { fallbackArchetypeType = archetypeTypeNames.get("Misc"); if (fallbackArchetypeType == null) { - fallbackArchetypeType = new ArchetypeType<G, A, R>("", 0, null, null, 2, Collections.<ArchetypeAttribute<G, A, R>>emptyList(), Collections.<ArchetypeAttributeDefinition>emptyList()); + fallbackArchetypeType = new ArchetypeType<G, A, R>("", 0, null, null, 2, Collections.<ArchetypeAttribute<G, A, R>>emptyList(), new ArchetypeAttributesDefinition()); } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |