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-22 21:26:47
|
Revision: 7885 http://gridarta.svn.sourceforge.net/gridarta/?rev=7885&view=rev Author: akirschbaum Date: 2010-05-22 21:26:41 +0000 (Sat, 22 May 2010) Log Message: ----------- Fix typos. Modified Paths: -------------- trunk/gridarta.ipr trunk/src/app/net/sf/gridarta/model/map/mapmodel/MapSquareGrid.java Modified: trunk/gridarta.ipr =================================================================== --- trunk/gridarta.ipr 2010-05-22 21:09:22 UTC (rev 7884) +++ trunk/gridarta.ipr 2010-05-22 21:26:41 UTC (rev 7885) @@ -1138,6 +1138,7 @@ <w>pickmaps</w> <w>plugins</w> <w>resize</w> + <w>resizes</w> <w>shortdescription</w> <w>startup</w> <w>teleporter</w> Modified: trunk/src/app/net/sf/gridarta/model/map/mapmodel/MapSquareGrid.java =================================================================== --- trunk/src/app/net/sf/gridarta/model/map/mapmodel/MapSquareGrid.java 2010-05-22 21:09:22 UTC (rev 7884) +++ trunk/src/app/net/sf/gridarta/model/map/mapmodel/MapSquareGrid.java 2010-05-22 21:26:41 UTC (rev 7885) @@ -87,9 +87,9 @@ /** * {@inheritDoc} This implementation is very safe by recreating every single * MapSquare as new empty square with the trade-off of some strain of the - * garbage-collector. An alternative implemenation would manually clean + * garbage-collector. An alternative implementation would manually clean * every existing MapSquare but that probably wouldn't really be faster - * until we have reusage of GameObject instances similar to J2EE. + * until we have reuse of GameObject instances similar to J2EE. */ public void clearMap() { for (int x = 0; x < mapSize.getWidth(); x++) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2010-05-22 21:09:29
|
Revision: 7884 http://gridarta.svn.sourceforge.net/gridarta/?rev=7884&view=rev Author: akirschbaum Date: 2010-05-22 21:09:22 +0000 (Sat, 22 May 2010) Log Message: ----------- Fix "Generate Preview" to regenerate previews for all selected files. Modified Paths: -------------- trunk/atrinik/ChangeLog trunk/crossfire/ChangeLog trunk/daimonin/ChangeLog trunk/src/app/net/sf/gridarta/gui/map/MapPreviewAccessory.java Modified: trunk/atrinik/ChangeLog =================================================================== --- trunk/atrinik/ChangeLog 2010-05-22 20:59:39 UTC (rev 7883) +++ trunk/atrinik/ChangeLog 2010-05-22 21:09:22 UTC (rev 7884) @@ -1,5 +1,8 @@ 2010-05-22 Andreas Kirschbaum + * Fix "Generate Preview" to regenerate previews for all selected + files. + * Implement File|Grow Selection and File|Shrink Selection: grows/shrinks the selection by one map square. Modified: trunk/crossfire/ChangeLog =================================================================== --- trunk/crossfire/ChangeLog 2010-05-22 20:59:39 UTC (rev 7883) +++ trunk/crossfire/ChangeLog 2010-05-22 21:09:22 UTC (rev 7884) @@ -1,5 +1,8 @@ 2010-05-22 Andreas Kirschbaum + * Fix "Generate Preview" to regenerate previews for all selected + files. + * Implement File|Grow Selection and File|Shrink Selection: grows/shrinks the selection by one map square. Modified: trunk/daimonin/ChangeLog =================================================================== --- trunk/daimonin/ChangeLog 2010-05-22 20:59:39 UTC (rev 7883) +++ trunk/daimonin/ChangeLog 2010-05-22 21:09:22 UTC (rev 7884) @@ -1,5 +1,8 @@ 2010-05-22 Andreas Kirschbaum + * Fix "Generate Preview" to regenerate previews for all selected + files. + * Implement File|Grow Selection and File|Shrink Selection: grows/shrinks the selection by one map square. Modified: trunk/src/app/net/sf/gridarta/gui/map/MapPreviewAccessory.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/map/MapPreviewAccessory.java 2010-05-22 20:59:39 UTC (rev 7883) +++ trunk/src/app/net/sf/gridarta/gui/map/MapPreviewAccessory.java 2010-05-22 21:09:22 UTC (rev 7884) @@ -105,11 +105,11 @@ private final JFileChooser fileChooser; /** - * The currently selected file, or <code>null</code> if no file is + * The currently selected files, or <code>null</code> if no file is * selected. */ @Nullable - private File selectedFile = null; + private File[] selectedFiles = null; /** * Whether previews should be auto-generated. @@ -136,7 +136,7 @@ if (JFileChooser.DIRECTORY_CHANGED_PROPERTY.equals(prop)) { setPreview("No Preview available"); } else if (JFileChooser.SELECTED_FILE_CHANGED_PROPERTY.equals(prop)) { - selectedFile = (File) evt.getNewValue(); + final File selectedFile = (File) evt.getNewValue(); if (selectedFile != null) { final Image previewImage = getMapPreview(selectedFile); if (previewImage != null) { @@ -147,6 +147,8 @@ } else { setPreview("No Preview available"); } + } else if (JFileChooser.SELECTED_FILES_CHANGED_PROPERTY.equals(prop)) { + selectedFiles = (File[]) evt.getNewValue(); } } @@ -217,15 +219,17 @@ */ @ActionMethod public void genPreview() { - final File file = selectedFile; - if (file == null) { + final File[] files = selectedFiles; + if (files == null || files.length == 0) { return; } - mapImageCache.flush(file); + for (final File file : files) { + mapImageCache.flush(file); - final Image image = mapImageCache.getOrCreatePreview(file); - setPreview(image); + final Image image = mapImageCache.getOrCreatePreview(file); + setPreview(image); + } fileChooser.validate(); fileChooser.repaint(); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2010-05-22 20:59:46
|
Revision: 7883 http://gridarta.svn.sourceforge.net/gridarta/?rev=7883&view=rev Author: akirschbaum Date: 2010-05-22 20:59:39 +0000 (Sat, 22 May 2010) Log Message: ----------- Fix typos. Modified Paths: -------------- trunk/src/app/net/sf/gridarta/gui/map/MapPreviewAccessory.java trunk/src/app/net/sf/gridarta/messages.properties trunk/src/app/net/sf/gridarta/messages_de.properties trunk/src/app/net/sf/gridarta/messages_fr.properties trunk/src/app/net/sf/gridarta/messages_sv.properties Modified: trunk/src/app/net/sf/gridarta/gui/map/MapPreviewAccessory.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/map/MapPreviewAccessory.java 2010-05-22 20:53:05 UTC (rev 7882) +++ trunk/src/app/net/sf/gridarta/gui/map/MapPreviewAccessory.java 2010-05-22 20:59:39 UTC (rev 7883) @@ -67,13 +67,13 @@ * Preferences. */ @NotNull - private static final Preferences prefs = Preferences.userNodeForPackage(MainControl.class); + private static final Preferences preferences = Preferences.userNodeForPackage(MainControl.class); /** * Preferences key for automatic preview generation. */ @NotNull - private static final String PREFS_AUTOGEN_PREVIEW = "autogenPreviews"; + private static final String PREFERENCES_AUTO_GENERATE_PREVIEW = "autoGeneratePreviews"; /** * The cache for map images. @@ -88,10 +88,10 @@ private final JLabel preview = new JLabel(); /** - * ToggleAction for autogen preview. + * ToggleAction for auto-generate preview. */ @NotNull - private final ToggleAction autogenPreview = (ToggleAction) ACTION_BUILDER.createToggle(false, "autogenPreviews", this); + private final ToggleAction autoGeneratePreview = (ToggleAction) ACTION_BUILDER.createToggle(false, "autoGeneratePreviews", this); /** * Action for generating preview. @@ -112,9 +112,9 @@ private File selectedFile = null; /** - * Whether previews should be autogenerated. + * Whether previews should be auto-generated. */ - private boolean autogenPreviews = false; + private boolean autoGeneratePreviews = false; /** * Creates an MapPreviewAccessory. @@ -159,10 +159,10 @@ * Build the user interface. */ private void buildUI() { - setAutogenPreviews(prefs.getBoolean(PREFS_AUTOGEN_PREVIEW, false)); + setAutoGeneratePreviews(preferences.getBoolean(PREFERENCES_AUTO_GENERATE_PREVIEW, false)); setPreferredSize(new Dimension(240, 115)); setLayout(new BorderLayout()); - add(autogenPreview.createCheckBox(), BorderLayout.NORTH); + add(autoGeneratePreview.createCheckBox(), BorderLayout.NORTH); add(new JButton(genPreview), BorderLayout.SOUTH); preview.setHorizontalAlignment(SwingConstants.CENTER); add(new JScrollPane(preview), BorderLayout.CENTER); @@ -188,15 +188,15 @@ /** * Switch automatic preview generation. - * @param autogenPreviews <code>true</code> for automatically generating - * previews, <code>false</code> otherwise + * @param autoGeneratePreviews <code>true</code> for automatically + * generating previews, <code>false</code> otherwise */ @ActionMethod - public void setAutogenPreviews(final boolean autogenPreviews) { - this.autogenPreviews = autogenPreviews; - autogenPreview.setSelected(autogenPreviews); - prefs.putBoolean(PREFS_AUTOGEN_PREVIEW, autogenPreviews); - if (autogenPreviews) { + public void setAutoGeneratePreviews(final boolean autoGeneratePreviews) { + this.autoGeneratePreviews = autoGeneratePreviews; + autoGeneratePreview.setSelected(autoGeneratePreviews); + preferences.putBoolean(PREFERENCES_AUTO_GENERATE_PREVIEW, autoGeneratePreviews); + if (autoGeneratePreviews) { fileChooser.validate(); fileChooser.repaint(); } @@ -208,8 +208,8 @@ * otherwise <code>false</code> */ @ActionMethod - public boolean isAutogenPreviews() { - return autogenPreviews; + public boolean isAutoGeneratePreviews() { + return autoGeneratePreviews; } /** @@ -238,7 +238,7 @@ */ @Nullable public Image getMapIcon(@NotNull final File mapFile) { - return autogenPreview.isSelected() ? mapImageCache.getOrCreateIcon(mapFile) : mapImageCache.getIcon(mapFile); + return autoGeneratePreview.isSelected() ? mapImageCache.getOrCreateIcon(mapFile) : mapImageCache.getIcon(mapFile); } /** @@ -249,7 +249,7 @@ */ @Nullable private Image getMapPreview(@NotNull final File mapFile) { - return autogenPreview.isSelected() ? mapImageCache.getOrCreatePreview(mapFile) : mapImageCache.getPreview(mapFile); + return autoGeneratePreview.isSelected() ? mapImageCache.getOrCreatePreview(mapFile) : mapImageCache.getPreview(mapFile); } /** Modified: trunk/src/app/net/sf/gridarta/messages.properties =================================================================== --- trunk/src/app/net/sf/gridarta/messages.properties 2010-05-22 20:53:05 UTC (rev 7882) +++ trunk/src/app/net/sf/gridarta/messages.properties 2010-05-22 20:59:39 UTC (rev 7883) @@ -1064,7 +1064,7 @@ # Preferences file prefs.archDirectory=Archetype directory. prefs.archetypeChooserDisplayMode=The display mode of the archetype chooser: 0=game object names, 1=archetype names, 2=icons only. -prefs.autogenPreviews=If set, automatically generate map preview images. +prefs.autoGeneratePreviews=If set, automatically generate map preview images. prefs.autojoin=Whether autojoining is enabled. prefs.autoValidate=Whether the map validator is run automatically after each change. prefs.docuVersion=Last displayed version of the help documentation. @@ -1138,7 +1138,7 @@ ############### # File Dialogs -autogenPreviews.text=Autogenerate Previews? +autoGeneratePreviews.text=Auto-generate Previews? genPreview.text=Generate Preview Modified: trunk/src/app/net/sf/gridarta/messages_de.properties =================================================================== --- trunk/src/app/net/sf/gridarta/messages_de.properties 2010-05-22 20:53:05 UTC (rev 7882) +++ trunk/src/app/net/sf/gridarta/messages_de.properties 2010-05-22 20:59:39 UTC (rev 7883) @@ -993,7 +993,7 @@ ############### # File Dialogs -autogenPreviews.text=Vorschaubilder erzeugen? +autoGeneratePreviews.text=Vorschaubilder erzeugen? genPreview.text=Vorschaubild erzeugen Modified: trunk/src/app/net/sf/gridarta/messages_fr.properties =================================================================== --- trunk/src/app/net/sf/gridarta/messages_fr.properties 2010-05-22 20:53:05 UTC (rev 7882) +++ trunk/src/app/net/sf/gridarta/messages_fr.properties 2010-05-22 20:59:39 UTC (rev 7883) @@ -983,7 +983,7 @@ ############### # File Dialogs -#autogenPreviews.text= +#autoGeneratePreviews.text= #genPreview.text= Modified: trunk/src/app/net/sf/gridarta/messages_sv.properties =================================================================== --- trunk/src/app/net/sf/gridarta/messages_sv.properties 2010-05-22 20:53:05 UTC (rev 7882) +++ trunk/src/app/net/sf/gridarta/messages_sv.properties 2010-05-22 20:59:39 UTC (rev 7883) @@ -991,7 +991,7 @@ ############### # File Dialogs -autogenPreviews.text=Autogenerera f\xF6rhandsvisningar? +autoGeneratePreviews.text=Autogenerera f\xF6rhandsvisningar? genPreview.text=Generera f\xF6rhandsvisning This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2010-05-22 20:53:12
|
Revision: 7882 http://gridarta.svn.sourceforge.net/gridarta/?rev=7882&view=rev Author: akirschbaum Date: 2010-05-22 20:53:05 +0000 (Sat, 22 May 2010) Log Message: ----------- Remove MapPreviewAccessory.propertyChangeListener. Modified Paths: -------------- trunk/src/app/net/sf/gridarta/gui/map/MapPreviewAccessory.java Modified: trunk/src/app/net/sf/gridarta/gui/map/MapPreviewAccessory.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/map/MapPreviewAccessory.java 2010-05-22 20:52:32 UTC (rev 7881) +++ trunk/src/app/net/sf/gridarta/gui/map/MapPreviewAccessory.java 2010-05-22 20:53:05 UTC (rev 7882) @@ -117,36 +117,6 @@ private boolean autogenPreviews = false; /** - * The {@link PropertyChangeListener} for receiving events of {@link - * #fileChooser}. - */ - @NotNull - private final PropertyChangeListener propertyChangeListener = new PropertyChangeListener() { - - /** {@inheritDoc} */ - @Override - public void propertyChange(final PropertyChangeEvent evt) { - final String prop = evt.getPropertyName(); - if (JFileChooser.DIRECTORY_CHANGED_PROPERTY.equals(prop)) { - setPreview("No Preview available"); - } else if (JFileChooser.SELECTED_FILE_CHANGED_PROPERTY.equals(prop)) { - selectedFile = (File) evt.getNewValue(); - if (selectedFile != null) { - final Image previewImage = getMapPreview(selectedFile); - if (previewImage != null) { - setPreview(previewImage); - } else { - setPreview("No Preview available"); - } - } else { - setPreview("No Preview available"); - } - } - } - - }; - - /** * Creates an MapPreviewAccessory. * @param mapImageCache The map image cache to use. * @param fileChooser the file chooser to attach to @@ -156,6 +126,31 @@ this.fileChooser = fileChooser; buildUI(); setPreview("No Preview available"); + + final PropertyChangeListener propertyChangeListener = new PropertyChangeListener() { + + /** {@inheritDoc} */ + @Override + public void propertyChange(final PropertyChangeEvent evt) { + final String prop = evt.getPropertyName(); + if (JFileChooser.DIRECTORY_CHANGED_PROPERTY.equals(prop)) { + setPreview("No Preview available"); + } else if (JFileChooser.SELECTED_FILE_CHANGED_PROPERTY.equals(prop)) { + selectedFile = (File) evt.getNewValue(); + if (selectedFile != null) { + final Image previewImage = getMapPreview(selectedFile); + if (previewImage != null) { + setPreview(previewImage); + } else { + setPreview("No Preview available"); + } + } else { + setPreview("No Preview available"); + } + } + } + + }; fileChooser.addPropertyChangeListener(propertyChangeListener); fileChooser.setFileView(new MapFileView()); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2010-05-22 20:52:38
|
Revision: 7881 http://gridarta.svn.sourceforge.net/gridarta/?rev=7881&view=rev Author: akirschbaum Date: 2010-05-22 20:52:32 +0000 (Sat, 22 May 2010) Log Message: ----------- Suppress compiler warnings. Modified Paths: -------------- trunk/src/app/net/sf/gridarta/gui/map/MapPreviewAccessory.java Modified: trunk/src/app/net/sf/gridarta/gui/map/MapPreviewAccessory.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/map/MapPreviewAccessory.java 2010-05-22 20:51:59 UTC (rev 7880) +++ trunk/src/app/net/sf/gridarta/gui/map/MapPreviewAccessory.java 2010-05-22 20:52:32 UTC (rev 7881) @@ -55,7 +55,7 @@ /** * The serial version UID. */ - private static final long serialVersionUID = 1; + private static final long serialVersionUID = 1L; /** * Action Builder. @@ -109,12 +109,12 @@ * selected. */ @Nullable - private File selectedFile; + private File selectedFile = null; /** * Whether previews should be autogenerated. */ - private boolean autogenPreviews; + private boolean autogenPreviews = false; /** * The {@link PropertyChangeListener} for receiving events of {@link This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2010-05-22 20:52:05
|
Revision: 7880 http://gridarta.svn.sourceforge.net/gridarta/?rev=7880&view=rev Author: akirschbaum Date: 2010-05-22 20:51:59 +0000 (Sat, 22 May 2010) Log Message: ----------- Add @ActionMethod annotations. Modified Paths: -------------- trunk/src/app/net/sf/gridarta/gui/map/MapPreviewAccessory.java Modified: trunk/src/app/net/sf/gridarta/gui/map/MapPreviewAccessory.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/map/MapPreviewAccessory.java 2010-05-22 19:17:26 UTC (rev 7879) +++ trunk/src/app/net/sf/gridarta/gui/map/MapPreviewAccessory.java 2010-05-22 20:51:59 UTC (rev 7880) @@ -40,6 +40,7 @@ import net.sf.gridarta.gui.mapimagecache.MapImageCache; import net.sf.japi.swing.action.ActionBuilder; import net.sf.japi.swing.action.ActionBuilderFactory; +import net.sf.japi.swing.action.ActionMethod; import net.sf.japi.swing.action.ToggleAction; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -195,6 +196,7 @@ * @param autogenPreviews <code>true</code> for automatically generating * previews, <code>false</code> otherwise */ + @ActionMethod public void setAutogenPreviews(final boolean autogenPreviews) { this.autogenPreviews = autogenPreviews; autogenPreview.setSelected(autogenPreviews); @@ -210,6 +212,7 @@ * @return <code>true</code> if previews are automatically generated, * otherwise <code>false</code> */ + @ActionMethod public boolean isAutogenPreviews() { return autogenPreviews; } @@ -217,6 +220,7 @@ /** * Generate a preview. */ + @ActionMethod public void genPreview() { final File file = selectedFile; if (file == null) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2010-05-22 19:17:32
|
Revision: 7879 http://gridarta.svn.sourceforge.net/gridarta/?rev=7879&view=rev Author: akirschbaum Date: 2010-05-22 19:17:26 +0000 (Sat, 22 May 2010) Log Message: ----------- Simplify code. Modified Paths: -------------- trunk/src/app/net/sf/gridarta/model/map/mapmodel/DefaultMapModel.java 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-22 19:14:52 UTC (rev 7878) +++ trunk/src/app/net/sf/gridarta/model/map/mapmodel/DefaultMapModel.java 2010-05-22 19:17:26 UTC (rev 7879) @@ -235,7 +235,7 @@ mapGrid = new MapSquareGrid<G, A, R>(this); beginTransaction("init"); try { - clearMap(); + mapGrid.clearMap(); } finally { endTransaction(); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2010-05-22 19:14:59
|
Revision: 7878 http://gridarta.svn.sourceforge.net/gridarta/?rev=7878&view=rev Author: akirschbaum Date: 2010-05-22 19:14:52 +0000 (Sat, 22 May 2010) Log Message: ----------- Make some model classes serializable. Modified Paths: -------------- trunk/src/app/net/sf/gridarta/model/archetypechooser/ArchetypeChooserFolder.java trunk/src/app/net/sf/gridarta/model/archetypechooser/ArchetypeChooserModel.java trunk/src/app/net/sf/gridarta/model/archetypechooser/ArchetypeChooserPanel.java Modified: trunk/src/app/net/sf/gridarta/model/archetypechooser/ArchetypeChooserFolder.java =================================================================== --- trunk/src/app/net/sf/gridarta/model/archetypechooser/ArchetypeChooserFolder.java 2010-05-22 19:14:19 UTC (rev 7877) +++ trunk/src/app/net/sf/gridarta/model/archetypechooser/ArchetypeChooserFolder.java 2010-05-22 19:14:52 UTC (rev 7878) @@ -19,6 +19,7 @@ package net.sf.gridarta.model.archetypechooser; +import java.io.Serializable; import java.util.Collection; import java.util.Collections; import java.util.HashSet; @@ -36,9 +37,14 @@ * time. * @author Andreas Kirschbaum */ -public class ArchetypeChooserFolder<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>> { +public class ArchetypeChooserFolder<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>> implements Serializable { /** + * The serial version UID. + */ + private static final long serialVersionUID = 1L; + + /** * The folder name. */ @NotNull Modified: trunk/src/app/net/sf/gridarta/model/archetypechooser/ArchetypeChooserModel.java =================================================================== --- trunk/src/app/net/sf/gridarta/model/archetypechooser/ArchetypeChooserModel.java 2010-05-22 19:14:19 UTC (rev 7877) +++ trunk/src/app/net/sf/gridarta/model/archetypechooser/ArchetypeChooserModel.java 2010-05-22 19:14:52 UTC (rev 7878) @@ -19,6 +19,7 @@ package net.sf.gridarta.model.archetypechooser; +import java.io.Serializable; import java.util.ArrayList; import java.util.Collections; import java.util.List; @@ -33,9 +34,14 @@ * The view of the archetype chooser. * @author Andreas Kirschbaum */ -public class ArchetypeChooserModel<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>> { +public class ArchetypeChooserModel<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>> implements Serializable { /** + * The serial version UID. + */ + private static final long serialVersionUID = 1L; + + /** * The {@link ArchetypeChooserPanel}s. The panels are ordered by panel * name. */ @@ -67,7 +73,7 @@ * #selectedPanel}. */ @NotNull - private final ArchetypeChooserPanelListener<G, A, R> archetypeChooserPanelListener = new ArchetypeChooserPanelListener<G, A, R>() { + private final transient ArchetypeChooserPanelListener<G, A, R> archetypeChooserPanelListener = new ArchetypeChooserPanelListener<G, A, R>() { /** * {@inheritDoc} Modified: trunk/src/app/net/sf/gridarta/model/archetypechooser/ArchetypeChooserPanel.java =================================================================== --- trunk/src/app/net/sf/gridarta/model/archetypechooser/ArchetypeChooserPanel.java 2010-05-22 19:14:19 UTC (rev 7877) +++ trunk/src/app/net/sf/gridarta/model/archetypechooser/ArchetypeChooserPanel.java 2010-05-22 19:14:52 UTC (rev 7878) @@ -19,6 +19,7 @@ package net.sf.gridarta.model.archetypechooser; +import java.io.Serializable; import java.util.ArrayList; import java.util.Collections; import java.util.List; @@ -34,9 +35,14 @@ * set of {@link ArchetypeChooserFolder}s. One panel is selected at any time. * @author Andreas Kirschbaum */ -public class ArchetypeChooserPanel<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>> { +public class ArchetypeChooserPanel<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>> implements Serializable { /** + * The serial version UID. + */ + private static final long serialVersionUID = 1L; + + /** * The panel name. */ @NotNull @@ -62,7 +68,7 @@ * #selectedFolder}. */ @NotNull - private final ArchetypeChooserFolderListener<G, A, R> archetypeChooserFolderListener = new ArchetypeChooserFolderListener<G, A, R>() { + private final transient ArchetypeChooserFolderListener<G, A, R> archetypeChooserFolderListener = new ArchetypeChooserFolderListener<G, A, R>() { /** * {@inheritDoc} This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2010-05-22 19:14:25
|
Revision: 7877 http://gridarta.svn.sourceforge.net/gridarta/?rev=7877&view=rev Author: akirschbaum Date: 2010-05-22 19:14:19 +0000 (Sat, 22 May 2010) Log Message: ----------- Enable serialization related warnings. Modified Paths: -------------- trunk/gridarta.ipr Modified: trunk/gridarta.ipr =================================================================== --- trunk/gridarta.ipr 2010-05-22 19:09:17 UTC (rev 7876) +++ trunk/gridarta.ipr 2010-05-22 19:14:19 UTC (rev 7877) @@ -532,6 +532,8 @@ <option name="m_allowConstructorAsInitializer" value="false" /> <option name="m_onlyLookAtBlocks" value="false" /> </inspection_tool> + <inspection_tool class="TransientFieldInNonSerializableClass" enabled="true" level="WARNING" enabled_by_default="true" /> + <inspection_tool class="TransientFieldNotInitialized" enabled="true" level="WARNING" enabled_by_default="true" /> <inspection_tool class="TrivialStringConcatenation" enabled="true" level="WARNING" enabled_by_default="true" /> <inspection_tool class="TypeMayBeWeakened" enabled="true" level="WARNING" enabled_by_default="true"> <option name="useRighthandTypeAsWeakestTypeInAssignments" value="true" /> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2010-05-22 19:09:26
|
Revision: 7876 http://gridarta.svn.sourceforge.net/gridarta/?rev=7876&view=rev Author: akirschbaum Date: 2010-05-22 19:09:17 +0000 (Sat, 22 May 2010) Log Message: ----------- Reformat comments. Modified Paths: -------------- trunk/src/app/net/sf/gridarta/model/map/mapmodel/MapModel.java Modified: trunk/src/app/net/sf/gridarta/model/map/mapmodel/MapModel.java =================================================================== --- trunk/src/app/net/sf/gridarta/model/map/mapmodel/MapModel.java 2010-05-22 19:07:16 UTC (rev 7875) +++ trunk/src/app/net/sf/gridarta/model/map/mapmodel/MapModel.java 2010-05-22 19:09:17 UTC (rev 7876) @@ -43,20 +43,25 @@ * will also be used for implementing undo / redo. <h3>Concurrency</h3> It's not * purpose of the transaction system to provide concurrent transactions for * concurrent threads. A MapModel will protect itself against concurrent - * modification. <h3>Performance</h3> <p/> The transaction system is - * efficient-safe. The following operations are very cheap: <ul> <li>Beginning a - * nested transaction</li> <li>Ending a nested transaction</li> <li>Ending an - * outermost transaction without having changed something</li> </ul> Whether - * beginning the outermost transaction will be a cheap operation is not yet - * decided. <p/> Transactions are recorded. <p/> It is not (yet?) the purpose of - * the transaction system to provide real transactions (ACID). Queries to the - * MapModel during an ongoing transaction will reflect the intermediate state. - * And there is no rollback yet, but this is planned for future as it's required - * for undo anyway. <h3>Future</h3> The following features are not yet - * implemented but planned. <h4>Undo System</h4> The transaction system will - * serve as a base for an undo / redo system. Beginning the outermost - * transaction stores a new undo record in the undo buffer. An undo record - * consists of the transaction's name plus the current map state. + * modification. <h3>Performance</h3> + * <p/> + * The transaction system is efficient-safe. The following operations are very + * cheap: <ul> <li>Beginning a nested transaction</li> <li>Ending a nested + * transaction</li> <li>Ending an outermost transaction without having changed + * something</li> </ul> Whether beginning the outermost transaction will be a + * cheap operation is not yet decided. + * <p/> + * Transactions are recorded. + * <p/> + * It is not (yet?) the purpose of the transaction system to provide real + * transactions (ACID). Queries to the MapModel during an ongoing transaction + * will reflect the intermediate state. And there is no rollback yet, but this + * is planned for future as it's required for undo anyway. <h3>Future</h3> The + * following features are not yet implemented but planned. <h4>Undo System</h4> + * The transaction system will serve as a base for an undo / redo system. + * Beginning the outermost transaction stores a new undo record in the undo + * buffer. An undo record consists of the transaction's name plus the current + * map state. * @author <a href="mailto:ch...@ri...">Christian HUjer</a> * @invariant !isAnyTransactionActive() || getTransactionDepth() > 0 */ @@ -179,10 +184,12 @@ * the purpose of firing events to the views when more changes are known to * come before the view is really required to update. Each invocation of * this function requires its own invocation of {@link #endTransaction()}. - * <p/> A transaction has a name. The name of the outermost transaction is - * used as a String presented to the user for undoing the operation enclosed - * by that transaction. <p/> Beginning a nested transaction is a cheap - * operation. + * <p/> + * A transaction has a name. The name of the outermost transaction is used + * as a String presented to the user for undoing the operation enclosed by + * that transaction. + * <p/> + * Beginning a nested transaction is a cheap operation. * @param name Name of the transaction. * @see #endTransaction() * @see #endTransaction(boolean) @@ -194,10 +201,14 @@ /** * End a transaction. Invoking this method will reduce the transaction depth - * by only 1. <p/> Ending a nested operation is a cheap operation. Ending a - * transaction without changes also is a cheap operation. <p/> If the last - * transaction is ended, the changes are committed. <p/> Same as {@link - * #endTransaction(boolean) endTransaction(false)}. + * by only 1. + * <p/> + * Ending a nested operation is a cheap operation. Ending a transaction + * without changes also is a cheap operation. + * <p/> + * If the last transaction is ended, the changes are committed. + * <p/> + * Same as {@link #endTransaction(boolean) endTransaction(false)}. * @see #beginTransaction(String) * @see #endTransaction(boolean) * @see #endAllTransactions() @@ -208,12 +219,16 @@ /** * End a transaction. Invoking this method will reduce the transaction depth - * by only 1. <p/> Ending a nested operation is a cheap operation. Ending a - * transaction without changes also is a cheap operation. <p/> If the last - * transaction is ended, the changes are committed. <p/> An example where - * setting <var>fireEvent</var> to <code>true</code> is useful even though - * the outermost transaction is not ended is when during painting the UI - * should be updated though painting is not finished. + * by only 1. + * <p/> + * Ending a nested operation is a cheap operation. Ending a transaction + * without changes also is a cheap operation. + * <p/> + * If the last transaction is ended, the changes are committed. + * <p/> + * An example where setting <var>fireEvent</var> to <code>true</code> is + * useful even though the outermost transaction is not ended is when during + * painting the UI should be updated though painting is not finished. * @param fireEvent <code>true</code> if an event should be fired even in * case this doesn't end the outermost transaction. * @note If the outermost transaction is ended, <var>fireEvent</var> is This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2010-05-22 19:07:22
|
Revision: 7875 http://gridarta.svn.sourceforge.net/gridarta/?rev=7875&view=rev Author: akirschbaum Date: 2010-05-22 19:07:16 +0000 (Sat, 22 May 2010) Log Message: ----------- Fix typos. Modified Paths: -------------- trunk/gridarta.ipr trunk/src/app/net/sf/gridarta/model/map/mapmodel/DefaultMapModel.java trunk/src/app/net/sf/gridarta/model/map/mapmodel/MapModel.java Modified: trunk/gridarta.ipr =================================================================== --- trunk/gridarta.ipr 2010-05-22 19:03:17 UTC (rev 7874) +++ trunk/gridarta.ipr 2010-05-22 19:07:16 UTC (rev 7875) @@ -1120,6 +1120,7 @@ <w>autojoining</w> <w>backbuffer</w> <w>beanshell</w> + <w>bitmask</w> <w>daimonin</w> <w>filter<?, ?></w> <w>goto</w> 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-22 19:03:17 UTC (rev 7874) +++ trunk/src/app/net/sf/gridarta/model/map/mapmodel/DefaultMapModel.java 2010-05-22 19:07:16 UTC (rev 7875) @@ -332,10 +332,10 @@ final Collection<GameObject<G, A, R>> objectsToDelete = new HashSet<GameObject<G, A, R>>(); - // no other thread may access this mapmodel while resizing + // no other thread may access this map model while resizing synchronized (syncLock) { // first delete all arches in the area that will get cut off - // (this is especially important to remove all multipart-objects + // (this is especially important to remove all multi-part objects // reaching into that area) if (mapSize.getWidth() > newSize.getWidth()) { // clear out the right stripe (as far as being cut off) @@ -850,7 +850,7 @@ BaseObject<G, A, R, ?> baseObjectPart = baseObject; for (R archetypePart = effectiveArchetype; archetypePart != null; archetypePart = archetypePart.getMultiNext(), baseObjectPart = baseObjectPart.getMultiNext()) { if (baseObjectPart == null) { - throw new AssertionError("mutlt-parts of base object " + baseObject.getBestName() + " and archetype " + effectiveArchetype.getBestName() + " do not match"); + throw new AssertionError("multi-parts of base object " + baseObject.getBestName() + " and archetype " + effectiveArchetype.getBestName() + " do not match"); } final G part = baseObjectPart.newInstance(gameObjectFactory); part.setArchetype(archetypePart); @@ -865,12 +865,12 @@ } for (final G part : parts) { - final int mapx = pos.x + part.getMultiX(); - final int mapy = pos.y + part.getMultiY(); - part.setMapX(mapx); - part.setMapY(mapy); + final int mapX = pos.x + part.getMultiX(); + final int mapY = pos.y + part.getMultiY(); + part.setMapX(mapX); + part.setMapY(mapY); gameObjectMatchers.updateEditType(part, activeEditType); - insertionMode.insert(part, mapGrid.getMapSquare(mapx, mapy)); + insertionMode.insert(part, mapGrid.getMapSquare(mapX, mapY)); } final G head = parts.get(0); @@ -886,15 +886,15 @@ */ @Override public void addGameObjectToMap(@NotNull final G gameObject, @NotNull final InsertionMode<G, A, R> insertionMode) { - final int mapx = gameObject.getMapX(); - final int mapy = gameObject.getMapY(); - if (!isPointValid(new Point(mapx, mapy))) { - log.error("addGameObjectToMap: trying to insert game object out of map bounds at " + mapx + "/" + mapy + ", map bounds is " + mapSize); + final int mapX = gameObject.getMapX(); + final int mapY = gameObject.getMapY(); + if (!isPointValid(new Point(mapX, mapY))) { + log.error("addGameObjectToMap: trying to insert game object out of map bounds at " + mapX + "/" + mapY + ", map bounds is " + mapSize); return; } gameObjectMatchers.updateEditType(gameObject, activeEditType); - insertionMode.insert(gameObject, mapGrid.getMapSquare(mapx, mapy)); + insertionMode.insert(gameObject, mapGrid.getMapSquare(mapX, mapY)); } /** Modified: trunk/src/app/net/sf/gridarta/model/map/mapmodel/MapModel.java =================================================================== --- trunk/src/app/net/sf/gridarta/model/map/mapmodel/MapModel.java 2010-05-22 19:03:17 UTC (rev 7874) +++ trunk/src/app/net/sf/gridarta/model/map/mapmodel/MapModel.java 2010-05-22 19:07:16 UTC (rev 7875) @@ -39,14 +39,14 @@ * is to allow several subsequent changes to the model to be collected as a * single big change before the registered listeners (usually the user * interface) gets notified. This prevents the user interface from performing - * hundrets of updates when a single one would be enough. The transaction system + * hundreds of updates when a single one would be enough. The transaction system * will also be used for implementing undo / redo. <h3>Concurrency</h3> It's not * purpose of the transaction system to provide concurrent transactions for * concurrent threads. A MapModel will protect itself against concurrent * modification. <h3>Performance</h3> <p/> The transaction system is * efficient-safe. The following operations are very cheap: <ul> <li>Beginning a * nested transaction</li> <li>Ending a nested transaction</li> <li>Ending an - * outmost transaction without having changed something</li> </ul> Whether + * outermost transaction without having changed something</li> </ul> Whether * beginning the outermost transaction will be a cheap operation is not yet * decided. <p/> Transactions are recorded. <p/> It is not (yet?) the purpose of * the transaction system to provide real transactions (ACID). Queries to the @@ -119,7 +119,7 @@ /** * Unregister a map listener. - * @param listener MapModelListener to unregsiter + * @param listener MapModelListener to unregister */ void removeMapModelListener(@NotNull MapModelListener<G, A, R> listener); @@ -131,7 +131,7 @@ /** * Unregister a map transaction listener. - * @param listener MapTransactionListener to unregsiter + * @param listener MapTransactionListener to unregister */ void removeMapTransactionListener(@NotNull MapTransactionListener<G, A, R> listener); @@ -213,7 +213,7 @@ * transaction is ended, the changes are committed. <p/> An example where * setting <var>fireEvent</var> to <code>true</code> is useful even though * the outermost transaction is not ended is when during painting the UI - * should be updated though painting is not finnished. + * should be updated though painting is not finished. * @param fireEvent <code>true</code> if an event should be fired even in * case this doesn't end the outermost transaction. * @note If the outermost transaction is ended, <var>fireEvent</var> is This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2010-05-22 19:03:23
|
Revision: 7874 http://gridarta.svn.sourceforge.net/gridarta/?rev=7874&view=rev Author: akirschbaum Date: 2010-05-22 19:03:17 +0000 (Sat, 22 May 2010) Log Message: ----------- Remove unused code. Modified Paths: -------------- trunk/src/app/net/sf/gridarta/model/map/mapmodel/DefaultMapModel.java trunk/src/app/net/sf/gridarta/model/map/mapmodel/MapModel.java 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-22 19:01:41 UTC (rev 7873) +++ trunk/src/app/net/sf/gridarta/model/map/mapmodel/DefaultMapModel.java 2010-05-22 19:03:17 UTC (rev 7874) @@ -941,14 +941,6 @@ * {@inheritDoc} */ @Override - public void setActiveEditType(final int activeEditType) { - this.activeEditType = activeEditType; - } - - /** - * {@inheritDoc} - */ - @Override public int getActiveEditType() { return activeEditType; } Modified: trunk/src/app/net/sf/gridarta/model/map/mapmodel/MapModel.java =================================================================== --- trunk/src/app/net/sf/gridarta/model/map/mapmodel/MapModel.java 2010-05-22 19:01:41 UTC (rev 7873) +++ trunk/src/app/net/sf/gridarta/model/map/mapmodel/MapModel.java 2010-05-22 19:03:17 UTC (rev 7874) @@ -384,8 +384,6 @@ */ void addActiveEditType(int editType); - void setActiveEditType(int activeEditType); - /** * Returns the edit types that have already been (requested and) calculated * (edit types get calculated only when needed to save time). This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2010-05-22 19:01:47
|
Revision: 7873 http://gridarta.svn.sourceforge.net/gridarta/?rev=7873&view=rev Author: akirschbaum Date: 2010-05-22 19:01:41 +0000 (Sat, 22 May 2010) Log Message: ----------- Remove unneeded throws clauses. Modified Paths: -------------- trunk/src/app/net/sf/gridarta/model/map/mapmodel/DefaultMapModel.java trunk/src/app/net/sf/gridarta/model/map/mapmodel/MapModel.java 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-22 19:01:09 UTC (rev 7872) +++ trunk/src/app/net/sf/gridarta/model/map/mapmodel/DefaultMapModel.java 2010-05-22 19:01:41 UTC (rev 7873) @@ -281,7 +281,7 @@ */ @NotNull @Override - public MapSquare<G, A, R> getMapSquare(@NotNull final Point pos) throws ArrayIndexOutOfBoundsException { + public MapSquare<G, A, R> getMapSquare(@NotNull final Point pos) { return mapGrid.getMapSquare(pos.x, pos.y); } Modified: trunk/src/app/net/sf/gridarta/model/map/mapmodel/MapModel.java =================================================================== --- trunk/src/app/net/sf/gridarta/model/map/mapmodel/MapModel.java 2010-05-22 19:01:09 UTC (rev 7872) +++ trunk/src/app/net/sf/gridarta/model/map/mapmodel/MapModel.java 2010-05-22 19:01:41 UTC (rev 7873) @@ -279,7 +279,7 @@ * that's not valid within this map model */ @NotNull - MapSquare<G, A, R> getMapSquare(@NotNull Point pos) throws ArrayIndexOutOfBoundsException; + MapSquare<G, A, R> getMapSquare(@NotNull Point pos); /** * Adds a list of {@link GameObject}s to this map. This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2010-05-22 19:01:15
|
Revision: 7872 http://gridarta.svn.sourceforge.net/gridarta/?rev=7872&view=rev Author: akirschbaum Date: 2010-05-22 19:01:09 +0000 (Sat, 22 May 2010) Log Message: ----------- Remove unneeded throws clause. Modified Paths: -------------- trunk/src/app/net/sf/gridarta/model/map/mapmodel/MapSquareGrid.java Modified: trunk/src/app/net/sf/gridarta/model/map/mapmodel/MapSquareGrid.java =================================================================== --- trunk/src/app/net/sf/gridarta/model/map/mapmodel/MapSquareGrid.java 2010-05-22 18:59:57 UTC (rev 7871) +++ trunk/src/app/net/sf/gridarta/model/map/mapmodel/MapSquareGrid.java 2010-05-22 19:01:09 UTC (rev 7872) @@ -80,7 +80,7 @@ * bounds */ @NotNull - public MapSquare<G, A, R> getMapSquare(final int x, final int y) throws ArrayIndexOutOfBoundsException { + public MapSquare<G, A, R> getMapSquare(final int x, final int y) { return mapGrid[x][y]; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2010-05-22 19:00:03
|
Revision: 7871 http://gridarta.svn.sourceforge.net/gridarta/?rev=7871&view=rev Author: akirschbaum Date: 2010-05-22 18:59:57 +0000 (Sat, 22 May 2010) Log Message: ----------- Remove unused code. Modified Paths: -------------- trunk/src/app/net/sf/gridarta/model/map/mapmodel/MapSquare.java Modified: trunk/src/app/net/sf/gridarta/model/map/mapmodel/MapSquare.java =================================================================== --- trunk/src/app/net/sf/gridarta/model/map/mapmodel/MapSquare.java 2010-05-22 18:58:28 UTC (rev 7870) +++ trunk/src/app/net/sf/gridarta/model/map/mapmodel/MapSquare.java 2010-05-22 18:59:57 UTC (rev 7871) @@ -132,16 +132,6 @@ } /** - * Compare the location of this map square to another map square. - * @param mapSquare the other map square - * @return <code>true</code> if this location equals the other location - */ - @SuppressWarnings({ "ObjectEquality" }) - public boolean isLocationEqual(@NotNull final MapSquare<G, A, R> mapSquare) { - return mapSquare.mapModel == mapModel && mapSquare.mapX == mapX && mapSquare.mapY == mapY; - } - - /** * Returns the last occurrence of a matching game object. * @param gameObjectMatcher the matcher to use * @return the last match, or <code>null</code> if no such game object This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2010-05-22 18:58:35
|
Revision: 7870 http://gridarta.svn.sourceforge.net/gridarta/?rev=7870&view=rev Author: akirschbaum Date: 2010-05-22 18:58:28 +0000 (Sat, 22 May 2010) Log Message: ----------- Suppress compiler warning. Modified Paths: -------------- trunk/src/app/net/sf/gridarta/model/map/mapmodel/MapSquare.java Modified: trunk/src/app/net/sf/gridarta/model/map/mapmodel/MapSquare.java =================================================================== --- trunk/src/app/net/sf/gridarta/model/map/mapmodel/MapSquare.java 2010-05-22 18:57:17 UTC (rev 7869) +++ trunk/src/app/net/sf/gridarta/model/map/mapmodel/MapSquare.java 2010-05-22 18:58:28 UTC (rev 7870) @@ -41,7 +41,7 @@ /** * The serial version UID. */ - private static final long serialVersionUID = 1; + private static final long serialVersionUID = 1L; /** * The MaoModel this square is associated with. This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2010-05-22 18:57:23
|
Revision: 7869 http://gridarta.svn.sourceforge.net/gridarta/?rev=7869&view=rev Author: akirschbaum Date: 2010-05-22 18:57:17 +0000 (Sat, 22 May 2010) Log Message: ----------- Extract MapSquareGrid from DefaultMapModel. Modified Paths: -------------- trunk/src/app/net/sf/gridarta/model/map/mapmodel/DefaultMapModel.java Added Paths: ----------- trunk/src/app/net/sf/gridarta/model/map/mapmodel/MapSquareGrid.java 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-22 18:34:47 UTC (rev 7868) +++ trunk/src/app/net/sf/gridarta/model/map/mapmodel/DefaultMapModel.java 2010-05-22 18:57:17 UTC (rev 7869) @@ -100,7 +100,7 @@ * The map, containing all arches grid-wise. Index: [width][height] */ @NotNull - private MapSquare<G, A, R>[][] mapGrid; + private final MapSquareGrid<G, A, R> mapGrid; /** * The registered {@link MapModelListener}s. @@ -232,7 +232,7 @@ savedSquares = new SavedSquares<G, A, R>(gameObjectFactory, gameObjectMatchers); mapSize = mapArchObject.getMapSize(); mapArchObject.addMapArchObjectListener(mapArchObjectListener); - mapGrid = new MapSquare[mapSize.getWidth()][mapSize.getHeight()]; + mapGrid = new MapSquareGrid<G, A, R>(this); beginTransaction("init"); try { clearMap(); @@ -282,7 +282,7 @@ @NotNull @Override public MapSquare<G, A, R> getMapSquare(@NotNull final Point pos) throws ArrayIndexOutOfBoundsException { - return mapGrid[pos.x][pos.y]; + return mapGrid.getMapSquare(pos.x, pos.y); } /** @@ -298,28 +298,11 @@ } /** - * {@inheritDoc} This implementation is very safe by recreating every single - * MapSquare as new empty square with the trade-off of some strain of the - * garbage-collector. An alternative implemenation would manually clean - * every existing MapSquare but that probably wouldn't really be faster - * until we have reusage of GameObject instances similar to J2EE. + * {@inheritDoc} */ @Override public void clearMap() { - for (int x = 0; x < mapSize.getWidth(); x++) { - for (int y = 0; y < mapSize.getHeight(); y++) { - if (mapGrid[x][y] == null) { - mapGrid[x][y] = new MapSquare<G, A, R>(this, x, y); - } else if (!mapGrid[x][y].isEmpty()) { - beginSquareChange(mapGrid[x][y]); - try { - mapGrid[x][y] = new MapSquare<G, A, R>(this, x, y); - } finally { - endSquareChange(mapGrid[x][y]); - } - } - } - } + mapGrid.clearMap(); } /** @@ -327,14 +310,7 @@ */ @Override public boolean isEmpty() { - for (int x = 0; x < mapSize.getWidth(); x++) { - for (int y = 0; y < mapSize.getHeight(); y++) { - if (!mapGrid[x][y].isEmpty()) { - return false; - } - } - } - return true; + return mapGrid.isEmpty(); } /** @@ -363,14 +339,14 @@ // reaching into that area) if (mapSize.getWidth() > newSize.getWidth()) { // clear out the right stripe (as far as being cut off) - collectHeads(newSize.getWidth(), 0, mapSize.getWidth(), mapSize.getHeight(), objectsToDelete); + mapGrid.collectHeads(newSize.getWidth(), 0, mapSize.getWidth(), mapSize.getHeight(), objectsToDelete); } if (mapSize.getHeight() > newSize.getHeight()) { // clear out the bottom stripe (as far as being cut off) // (and yes, there is an area getting sweeped twice - and yes it could // be optimized you smartass - but I don't care!) - collectHeads(0, newSize.getHeight(), mapSize.getWidth(), mapSize.getHeight(), objectsToDelete); + mapGrid.collectHeads(0, newSize.getHeight(), mapSize.getWidth(), mapSize.getHeight(), objectsToDelete); } for (final GameObject<G, A, R> node : objectsToDelete) { @@ -379,22 +355,8 @@ // Now the critical step: create an GameObject array of new dimension, // copy all objects and set it to replace the current one. - final MapSquare<G, A, R>[][] newGrid = new MapSquare[newSize.getWidth()][newSize.getHeight()]; + mapGrid.resize(newSize); - // relink all arches to the new grid - for (int x = 0; x < newSize.getWidth(); x++) { - for (int y = 0; y < newSize.getHeight(); y++) { - if (x < mapSize.getWidth() && y < mapSize.getHeight()) { - newGrid[x][y] = mapGrid[x][y]; - } else { - newGrid[x][y] = new MapSquare<G, A, R>(this, x, y); - } - } - } - - // replace old grid by new one - mapGrid = newGrid; - // adjust the map and model attributes mapSize = newSize; mapArchObject.setMapSize(newSize); @@ -408,24 +370,6 @@ } /** - * Adds all head parts for game object within an area to a collection. - * @param minX the x coordinate of the left border of the area - * @param minY the y coordinate of the top border of the area - * @param maxX the x coordinate of the right border of the area - * @param maxY the y coordinate of the bottom border of the area - * @param objectsToDelete the collection where the heads are added to - */ - private void collectHeads(final int minX, final int minY, final int maxX, final int maxY, @NotNull final Collection<GameObject<G, A, R>> objectsToDelete) { - for (int x = minX; x < maxX; x++) { - for (int y = minY; y < maxY; y++) { - for (final GameObject<G, A, R> node : mapGrid[x][y]) { - objectsToDelete.add(node.getHead()); - } - } - } - } - - /** * Discards map squares that are out of map bounds. * @param mapSquares the map squares to check */ @@ -802,7 +746,7 @@ if (!allowDouble) { final String temp = part.getArchetypeName(); - for (final BaseObject<G, A, R, ?> node : mapGrid[point.x][point.y]) { + for (final BaseObject<G, A, R, ?> node : mapGrid.getMapSquare(point.x, point.y)) { if (node.getArchetypeName().equals(temp)) { return false; } @@ -856,7 +800,7 @@ } int position = 0; - for (final G gameObject : mapGrid[pos.x][pos.y].reverse()) { + for (final G gameObject : mapGrid.getMapSquare(pos.x, pos.y).reverse()) { // This is okay because nextGameObject is on the desired square. //noinspection ObjectEquality if (gameObject == nextGameObject) { @@ -926,7 +870,7 @@ part.setMapX(mapx); part.setMapY(mapy); gameObjectMatchers.updateEditType(part, activeEditType); - insertionMode.insert(part, mapGrid[mapx][mapy]); + insertionMode.insert(part, mapGrid.getMapSquare(mapx, mapy)); } final G head = parts.get(0); @@ -950,7 +894,7 @@ } gameObjectMatchers.updateEditType(gameObject, activeEditType); - insertionMode.insert(gameObject, mapGrid[mapx][mapy]); + insertionMode.insert(gameObject, mapGrid.getMapSquare(mapx, mapy)); } /** Added: trunk/src/app/net/sf/gridarta/model/map/mapmodel/MapSquareGrid.java =================================================================== --- trunk/src/app/net/sf/gridarta/model/map/mapmodel/MapSquareGrid.java (rev 0) +++ trunk/src/app/net/sf/gridarta/model/map/mapmodel/MapSquareGrid.java 2010-05-22 18:57:17 UTC (rev 7869) @@ -0,0 +1,168 @@ +/* + * 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.map.mapmodel; + +import java.io.Serializable; +import java.util.Collection; +import net.sf.gridarta.model.archetype.Archetype; +import net.sf.gridarta.model.gameobject.GameObject; +import net.sf.gridarta.model.map.maparchobject.MapArchObject; +import net.sf.gridarta.utils.Size2D; +import org.jetbrains.annotations.NotNull; + +/** + * A rectangular grid of {@link MapSquare} instances. + * @author Andreas Kirschbaum + */ +public class MapSquareGrid<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>> implements Serializable { + + /** + * The serial version UID. + */ + private static final long serialVersionUID = 1L; + + /** + * The associated {@link MapModel}. + */ + @NotNull + private final MapModel<G, A, R> mapModel; + + /** + * The size of {@link #mapGrid}. + */ + @NotNull + private Size2D mapSize; + + /** + * The {@link MapSquare} of this grid. + */ + @NotNull + private MapSquare<G, A, R>[][] mapGrid; + + /** + * Creates a new instance. + * @param mapModel the associated map model + */ + public MapSquareGrid(@NotNull final MapModel<G, A, R> mapModel) { + this.mapModel = mapModel; + mapSize = mapModel.getMapSize(); + mapGrid = (MapSquare<G, A, R>[][]) new MapSquare<?, ?, ?>[mapSize.getWidth()][mapSize.getHeight()]; + for (int y = 0; y < mapSize.getHeight(); y++) { + for (int x = 0; x < mapSize.getWidth(); x++) { + mapGrid[x][y] = new MapSquare<G, A, R>(mapModel, x, y); + } + } + } + + /** + * Returns the {@link MapSquare} at a given location. + * @param x the location's x coordinate + * @param y the location's y coordinate + * @return the map square + * @throws ArrayIndexOutOfBoundsException if the location is not within + * bounds + */ + @NotNull + public MapSquare<G, A, R> getMapSquare(final int x, final int y) throws ArrayIndexOutOfBoundsException { + return mapGrid[x][y]; + } + + /** + * {@inheritDoc} This implementation is very safe by recreating every single + * MapSquare as new empty square with the trade-off of some strain of the + * garbage-collector. An alternative implemenation would manually clean + * every existing MapSquare but that probably wouldn't really be faster + * until we have reusage of GameObject instances similar to J2EE. + */ + public void clearMap() { + for (int x = 0; x < mapSize.getWidth(); x++) { + for (int y = 0; y < mapSize.getHeight(); y++) { + if (mapGrid[x][y] == null) { + mapGrid[x][y] = new MapSquare<G, A, R>(mapModel, x, y); + } else if (!mapGrid[x][y].isEmpty()) { + mapModel.beginSquareChange(mapGrid[x][y]); + try { + mapGrid[x][y] = new MapSquare<G, A, R>(mapModel, x, y); + } finally { + mapModel.endSquareChange(mapGrid[x][y]); + } + } + } + } + } + + /** + * Returns whether the map is empty. + * @return <code>true</code> if the map is empty, or <code>false</code> if + * the map is not empty + */ + public boolean isEmpty() { + for (int x = 0; x < mapSize.getWidth(); x++) { + for (int y = 0; y < mapSize.getHeight(); y++) { + if (!mapGrid[x][y].isEmpty()) { + return false; + } + } + } + return true; + } + + /** + * Resizes the map grid to a new size. + * @param newSize the new size + */ + public void resize(@NotNull final Size2D newSize) { + final MapSquare<G, A, R>[][] newGrid = (MapSquare<G, A, R>[][]) new MapSquare<?, ?, ?>[newSize.getWidth()][newSize.getHeight()]; + + // relink all arches to the new grid + for (int x = 0; x < newSize.getWidth(); x++) { + for (int y = 0; y < newSize.getHeight(); y++) { + if (x < mapSize.getWidth() && y < mapSize.getHeight()) { + newGrid[x][y] = mapGrid[x][y]; + } else { + newGrid[x][y] = new MapSquare<G, A, R>(mapModel, x, y); + } + } + } + + // replace old grid by new one + mapSize = newSize; + mapGrid = newGrid; + } + + /** + * Adds all head parts for game object within an area to a collection. + * @param minX the x coordinate of the left border of the area + * @param minY the y coordinate of the top border of the area + * @param maxX the x coordinate of the right border of the area + * @param maxY the y coordinate of the bottom border of the area + * @param objectsToDelete the collection where the heads are added to + */ + public void collectHeads(final int minX, final int minY, final int maxX, final int maxY, @NotNull final Collection<GameObject<G, A, R>> objectsToDelete) { + for (int x = minX; x < maxX; x++) { + for (int y = minY; y < maxY; y++) { + for (final GameObject<G, A, R> node : mapGrid[x][y]) { + objectsToDelete.add(node.getHead()); + } + } + } + } + +} // class MapSquareGrid Property changes on: trunk/src/app/net/sf/gridarta/model/map/mapmodel/MapSquareGrid.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-22 18:34:53
|
Revision: 7868 http://gridarta.svn.sourceforge.net/gridarta/?rev=7868&view=rev Author: akirschbaum Date: 2010-05-22 18:34:47 +0000 (Sat, 22 May 2010) Log Message: ----------- Explicitly initialize fields. Modified Paths: -------------- trunk/src/app/net/sf/gridarta/model/archetypechooser/ArchetypeChooserModel.java trunk/src/app/net/sf/gridarta/model/map/mapmodel/DefaultMapModel.java Modified: trunk/src/app/net/sf/gridarta/model/archetypechooser/ArchetypeChooserModel.java =================================================================== --- trunk/src/app/net/sf/gridarta/model/archetypechooser/ArchetypeChooserModel.java 2010-05-22 18:33:52 UTC (rev 7867) +++ trunk/src/app/net/sf/gridarta/model/archetypechooser/ArchetypeChooserModel.java 2010-05-22 18:34:47 UTC (rev 7868) @@ -54,7 +54,7 @@ * <code>null</code> for default direction. */ @Nullable - private Integer direction; + private Integer direction = null; /** * The registered listeners. 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-22 18:33:52 UTC (rev 7867) +++ trunk/src/app/net/sf/gridarta/model/map/mapmodel/DefaultMapModel.java 2010-05-22 18:34:47 UTC (rev 7868) @@ -120,14 +120,14 @@ * nesting level. * @invariant transactionDepth >= 0 */ - private int transactionDepth; + private int transactionDepth = 0; /** * The thread that performs the current transaction. * @invariant transactionDepth > 0 || transactionThread == null */ @Nullable - private transient Thread transactionThread; + private transient Thread transactionThread = null; /** * The ArrayList with changed squares. @@ -189,7 +189,7 @@ * been saved. */ @Nullable - private File mapFile; + private File mapFile = null; /** * Set if the map has changed since last save. This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2010-05-22 18:33:58
|
Revision: 7867 http://gridarta.svn.sourceforge.net/gridarta/?rev=7867&view=rev Author: akirschbaum Date: 2010-05-22 18:33:52 +0000 (Sat, 22 May 2010) Log Message: ----------- Suppress compiler warning. Modified Paths: -------------- trunk/gridarta.ipr Modified: trunk/gridarta.ipr =================================================================== --- trunk/gridarta.ipr 2010-05-22 18:33:28 UTC (rev 7866) +++ trunk/gridarta.ipr 2010-05-22 18:33:52 UTC (rev 7867) @@ -363,7 +363,7 @@ <option name="IGNORE_DEPRECATED" value="true" /> <option name="IGNORE_JAVADOC_PERIOD" value="false" /> <option name="IGNORE_DUPLICATED_THROWS" value="false" /> - <option name="myAdditionalJavadocTags" value="fixme invariant note todo val warning" /> + <option name="myAdditionalJavadocTags" value="fixme invariant note retval todo val warning" /> </inspection_tool> <inspection_tool class="JavaLangImport" enabled="true" level="WARNING" enabled_by_default="true" /> <inspection_tool class="LengthOneStringInIndexOf" enabled="true" level="WARNING" enabled_by_default="true" /> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2010-05-22 18:33:35
|
Revision: 7866 http://gridarta.svn.sourceforge.net/gridarta/?rev=7866&view=rev Author: akirschbaum Date: 2010-05-22 18:33:28 +0000 (Sat, 22 May 2010) Log Message: ----------- Add comments. Modified Paths: -------------- trunk/src/app/net/sf/gridarta/model/map/mapmodel/DefaultMapModel.java 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-22 18:30:21 UTC (rev 7865) +++ trunk/src/app/net/sf/gridarta/model/map/mapmodel/DefaultMapModel.java 2010-05-22 18:33:28 UTC (rev 7866) @@ -77,9 +77,16 @@ @NotNull private final A mapArchObject; + /** + * The {@link AutojoinLists} for performing autojoining. + */ @NotNull private final AutojoinLists<G, A, R> autojoinLists; + /** + * The {@link ArchetypeChooserModel} to use when inserting directional game + * objects. + */ @NotNull private final ArchetypeChooserModel<G, A, R> archetypeChooserModel; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2010-05-22 18:30:27
|
Revision: 7865 http://gridarta.svn.sourceforge.net/gridarta/?rev=7865&view=rev Author: akirschbaum Date: 2010-05-22 18:30:21 +0000 (Sat, 22 May 2010) Log Message: ----------- Suppress compiler warnings. Modified Paths: -------------- trunk/src/app/net/sf/gridarta/model/map/mapmodel/MapSquareIterator.java Modified: trunk/src/app/net/sf/gridarta/model/map/mapmodel/MapSquareIterator.java =================================================================== --- trunk/src/app/net/sf/gridarta/model/map/mapmodel/MapSquareIterator.java 2010-05-22 18:27:29 UTC (rev 7864) +++ trunk/src/app/net/sf/gridarta/model/map/mapmodel/MapSquareIterator.java 2010-05-22 18:30:21 UTC (rev 7865) @@ -90,11 +90,15 @@ */ @Override public MapSquare<G, A, R> next() { + //The exception is expected and handled + //noinspection ProhibitedExceptionCaught try { final MapSquare<G, A, R> square = mapModel.getMapSquare(new Point(point / mapHeight, point % mapHeight)); point++; return square; } catch (final ArrayIndexOutOfBoundsException ignore) { + //There is no constructor that takes a cause. + //noinspection ThrowInsideCatchBlockWhichIgnoresCaughtException throw new NoSuchElementException(); } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2010-05-22 18:27:35
|
Revision: 7864 http://gridarta.svn.sourceforge.net/gridarta/?rev=7864&view=rev Author: akirschbaum Date: 2010-05-22 18:27:29 +0000 (Sat, 22 May 2010) Log Message: ----------- Extract MapSquareIterator from DefaultMapModel. Modified Paths: -------------- trunk/src/app/net/sf/gridarta/model/map/mapmodel/DefaultMapModel.java Added Paths: ----------- trunk/src/app/net/sf/gridarta/model/map/mapmodel/MapSquareIterator.java 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-22 16:00:29 UTC (rev 7863) +++ trunk/src/app/net/sf/gridarta/model/map/mapmodel/DefaultMapModel.java 2010-05-22 18:27:29 UTC (rev 7864) @@ -27,7 +27,6 @@ import java.util.HashSet; import java.util.Iterator; import java.util.List; -import java.util.NoSuchElementException; import java.util.Set; import net.sf.gridarta.model.archetype.Archetype; import net.sf.gridarta.model.archetypechooser.ArchetypeChooserModel; @@ -267,7 +266,7 @@ */ @Override public Iterator<MapSquare<G, A, R>> iterator() { - return new MapSquareIterator(); + return new MapSquareIterator<G, A, R>(this); } /** @@ -754,29 +753,6 @@ } /** - * This method checks whether the map is rectangular. A map always MUST be - * rectangular, this method can be used for assertions regarding this - * assumption. The check for rectangularity is a check whether the array - * dimensions of {@link #mapGrid} match the size specified in {@link - * #mapSize}. - * @return <code>true</code> if the map is rectangular, otherwise - * <code>false</code>. - */ - private boolean isRectangular() { - final int width = mapSize.getWidth(); - final int height = mapSize.getHeight(); - if (mapGrid.length != width) { - return false; - } - for (int x = 0; x < width; x++) { - if (mapGrid[x].length != height) { - return false; - } - } - return true; - } - - /** * {@inheritDoc} */ @Override @@ -1027,57 +1003,6 @@ } /** - * Iterator for iterating over all squares of a model. - */ - private class MapSquareIterator implements Iterator<MapSquare<G, A, R>> { - - /** - * Index of current map square. The point is used as single value index - * to a two dimensional array. That works fine because the two - * dimensional array is a rectangular array. - */ - private int point; - - /** - * Create a MapSquareIterator. - */ - private MapSquareIterator() { - assert isRectangular(); - } - - /** - * {@inheritDoc} - */ - @Override - public void remove() { - throw new UnsupportedOperationException(); - } - - /** - * {@inheritDoc} - */ - @Override - public boolean hasNext() { - return point < mapSize.getWidth() * mapSize.getHeight(); - } - - /** - * {@inheritDoc} - */ - @Override - public MapSquare<G, A, R> next() { - try { - final MapSquare<G, A, R> square = mapGrid[point / mapSize.getHeight()][point % mapSize.getHeight()]; - point++; - return square; - } catch (final ArrayIndexOutOfBoundsException ignore) { - throw new NoSuchElementException(); - } - } - - } // class MapSquareIterator - - /** * {@inheritDoc} */ @Override Added: trunk/src/app/net/sf/gridarta/model/map/mapmodel/MapSquareIterator.java =================================================================== --- trunk/src/app/net/sf/gridarta/model/map/mapmodel/MapSquareIterator.java (rev 0) +++ trunk/src/app/net/sf/gridarta/model/map/mapmodel/MapSquareIterator.java 2010-05-22 18:27:29 UTC (rev 7864) @@ -0,0 +1,102 @@ +/* + * 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.map.mapmodel; + +import java.awt.Point; +import java.util.Iterator; +import java.util.NoSuchElementException; +import net.sf.gridarta.model.archetype.Archetype; +import net.sf.gridarta.model.gameobject.GameObject; +import net.sf.gridarta.model.map.maparchobject.MapArchObject; +import net.sf.gridarta.utils.Size2D; +import org.jetbrains.annotations.NotNull; + +/** + * Iterator for iterating over all squares of a model. + * @author <a href="mailto:ch...@ri...">Christian Hujer</a> + * @author Andreas Kirschbaum + */ +public class MapSquareIterator<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>> implements Iterator<MapSquare<G, A, R>> { + + /** + * The {@link MapModel} to iterate over. + */ + @NotNull + private final MapModel<G, A, R> mapModel; + + /** + * The {@link #mapModel}'s map width. + */ + private final int mapWidth; + + /** + * The {@link #mapModel}'s map height. + */ + private final int mapHeight; + + /** + * Index of current map square. The point is used as single value index + * to a two dimensional array. That works fine because the two + * dimensional array is a rectangular array. + */ + private int point = 0; + + /** + * Creates a new instance. + * @param mapModel the map model to iterate over + */ + MapSquareIterator(@NotNull final MapModel<G, A, R> mapModel) { + this.mapModel = mapModel; + final Size2D mapSize = mapModel.getMapSize(); + mapWidth = mapSize.getWidth(); + mapHeight = mapSize.getHeight(); + } + + /** + * {@inheritDoc} + */ + @Override + public void remove() { + throw new UnsupportedOperationException(); + } + + /** + * {@inheritDoc} + */ + @Override + public boolean hasNext() { + return point < mapWidth * mapHeight; + } + + /** + * {@inheritDoc} + */ + @Override + public MapSquare<G, A, R> next() { + try { + final MapSquare<G, A, R> square = mapModel.getMapSquare(new Point(point / mapHeight, point % mapHeight)); + point++; + return square; + } catch (final ArrayIndexOutOfBoundsException ignore) { + throw new NoSuchElementException(); + } + } + +} // class MapSquareIterator Property changes on: trunk/src/app/net/sf/gridarta/model/map/mapmodel/MapSquareIterator.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-22 16:00:35
|
Revision: 7863 http://gridarta.svn.sourceforge.net/gridarta/?rev=7863&view=rev Author: akirschbaum Date: 2010-05-22 16:00:29 +0000 (Sat, 22 May 2010) Log Message: ----------- Update project file. Modified Paths: -------------- trunk/gridarta.ipr Modified: trunk/gridarta.ipr =================================================================== --- trunk/gridarta.ipr 2010-05-22 14:08:06 UTC (rev 7862) +++ trunk/gridarta.ipr 2010-05-22 16:00:29 UTC (rev 7863) @@ -208,7 +208,7 @@ </inspection_tool> <inspection_tool class="BadExceptionDeclared" enabled="true" level="WARNING" enabled_by_default="true"> <option name="exceptionsString" value="java.lang.Throwable,java.lang.Exception,java.lang.Error,java.lang.RuntimeException,java.lang.NullPointerException,java.lang.ClassCastException,java.lang.ArrayIndexOutOfBoundsException" /> - <option name="ignoreTestCases" value="false" /> + <option name="ignoreTestCases" value="true" /> </inspection_tool> <inspection_tool class="BadExceptionThrown" enabled="true" level="WARNING" enabled_by_default="true"> <option name="exceptionsString" value="java.lang.Throwable,java.lang.Exception,java.lang.Error,java.lang.RuntimeException,java.lang.NullPointerException,java.lang.ClassCastException,java.lang.ArrayIndexOutOfBoundsException" /> @@ -292,6 +292,9 @@ </inspection_tool> <inspection_tool class="FinalizeNotProtected" enabled="true" level="WARNING" enabled_by_default="true" /> <inspection_tool class="FloatingPointEquality" enabled="true" level="WARNING" enabled_by_default="true" /> + <inspection_tool class="ForLoopReplaceableByWhile" enabled="true" level="WARNING" enabled_by_default="true"> + <option name="m_ignoreLoopsWithoutConditions" value="true" /> + </inspection_tool> <inspection_tool class="ForLoopThatDoesntUseLoopVariable" enabled="true" level="WARNING" enabled_by_default="true" /> <inspection_tool class="HashCodeUsesNonFinalVariable" enabled="true" level="WARNING" enabled_by_default="true" /> <inspection_tool class="IOResource" enabled="true" level="WARNING" enabled_by_default="true"> @@ -335,7 +338,7 @@ <inspection_tool class="JavaDoc" enabled="true" level="WARNING" enabled_by_default="true"> <option name="TOP_LEVEL_CLASS_OPTIONS"> <value> - <option name="ACCESS_JAVADOC_REQUIRED_FOR" value="package" /> + <option name="ACCESS_JAVADOC_REQUIRED_FOR" value="none" /> <option name="REQUIRED_TAGS" value="@author" /> </value> </option> @@ -421,6 +424,10 @@ <inspection_tool class="PackageVisibleInnerClass" enabled="true" level="WARNING" enabled_by_default="true"> <option name="ignoreEnums" value="false" /> </inspection_tool> + <inspection_tool class="ParameterNameDiffersFromOverriddenParameter" enabled="true" level="WARNING" enabled_by_default="true"> + <option name="m_ignoreSingleCharacterNames" value="false" /> + <option name="m_ignoreOverridesOfLibraryMethods" value="false" /> + </inspection_tool> <inspection_tool class="PointlessBitwiseExpression" enabled="false" level="WARNING" enabled_by_default="false"> <option name="m_ignoreExpressionsContainingConstants" value="false" /> </inspection_tool> @@ -439,7 +446,7 @@ </inspection_tool> <inspection_tool class="RandomDoubleForRandomInteger" enabled="true" level="WARNING" enabled_by_default="true" /> <inspection_tool class="RawUseOfParameterizedType" enabled="true" level="WARNING" enabled_by_default="true"> - <option name="ignoreObjectConstruction" value="true" /> + <option name="ignoreObjectConstruction" value="false" /> <option name="ignoreTypeCasts" value="false" /> </inspection_tool> <inspection_tool class="RedundantImplements" enabled="true" level="WARNING" enabled_by_default="true"> @@ -476,7 +483,7 @@ <option name="superClassString" value="java.awt.Component" /> </inspection_tool> <inspection_tool class="SerializableInnerClassHasSerialVersionUIDField" enabled="true" level="WARNING" enabled_by_default="true"> - <option name="superClassString" value="java.awt.Component" /> + <option name="superClassString" value="" /> </inspection_tool> <inspection_tool class="SetReplaceableByEnumSet" enabled="true" level="WARNING" enabled_by_default="true" /> <inspection_tool class="SimplifiableConditionalExpression" enabled="false" level="WARNING" enabled_by_default="false" /> @@ -504,7 +511,6 @@ <inspection_tool class="StringBufferReplaceableByString" enabled="true" level="WARNING" enabled_by_default="true" /> <inspection_tool class="StringBufferReplaceableByStringBuilder" enabled="true" level="WARNING" enabled_by_default="true" /> <inspection_tool class="StringBufferToStringInConcatenation" enabled="true" level="WARNING" enabled_by_default="true" /> - <inspection_tool class="StringEquality" enabled="false" level="WARNING" enabled_by_default="false" /> <inspection_tool class="StringEqualsEmptyString" enabled="true" level="WARNING" enabled_by_default="true" /> <inspection_tool class="StringReplaceableByStringBuffer" enabled="true" level="WARNING" enabled_by_default="true"> <option name="onlyWarnOnLoop" value="true" /> @@ -547,7 +553,6 @@ <option name="m_ignoreJavadoc" value="true" /> </inspection_tool> <inspection_tool class="UnnecessaryInterfaceModifier" enabled="true" level="WARNING" enabled_by_default="true" /> - <inspection_tool class="UnnecessaryJavaDocLink" enabled="true" level="WARNING" enabled_by_default="true" /> <inspection_tool class="UnnecessaryLabelOnBreakStatement" enabled="false" level="WARNING" enabled_by_default="false" /> <inspection_tool class="UnnecessaryLabelOnContinueStatement" enabled="false" level="WARNING" enabled_by_default="false" /> <inspection_tool class="UnnecessaryLocalVariable" enabled="false" level="WARNING" enabled_by_default="false"> @@ -607,7 +612,6 @@ <option name="myName" value="unchecked warnings" /> <option name="myLocal" value="false" /> <inspection_tool class="AccessStaticViaInstance" enabled="false" level="WARNING" enabled_by_default="false" /> - <inspection_tool class="Annotator" enabled="false" level="ERROR" enabled_by_default="false" /> <inspection_tool class="AntDuplicateImportedTargetsInspection" enabled="false" level="WARNING" enabled_by_default="false" /> <inspection_tool class="AntDuplicateTargetsInspection" enabled="false" level="ERROR" enabled_by_default="false" /> <inspection_tool class="AntMissingPropertiesFileInspection" enabled="false" level="ERROR" enabled_by_default="false" /> @@ -829,10 +833,6 @@ <option name="m_ignoreExpressionsContainingConstants" value="false" /> </inspection_tool> <inspection_tool class="PrimitiveArrayArgumentToVariableArgMethod" enabled="false" level="WARNING" enabled_by_default="false" /> - <inspection_tool class="RawUseOfParameterizedType" enabled="true" level="WARNING" enabled_by_default="true"> - <option name="ignoreObjectConstruction" value="true" /> - <option name="ignoreTypeCasts" value="false" /> - </inspection_tool> <inspection_tool class="RedundantArrayCreation" enabled="false" level="WARNING" enabled_by_default="false" /> <inspection_tool class="RedundantCast" enabled="false" level="WARNING" enabled_by_default="false" /> <inspection_tool class="RedundantThrows" enabled="false" level="WARNING" enabled_by_default="false" /> @@ -852,11 +852,6 @@ <inspection_tool class="SillyAssignment" enabled="false" level="WARNING" enabled_by_default="false" /> <inspection_tool class="SimplifiableConditionalExpression" enabled="false" level="WARNING" enabled_by_default="false" /> <inspection_tool class="SimplifiableIfStatement" enabled="false" level="WARNING" enabled_by_default="false" /> - <inspection_tool class="SpellCheckingInspection" enabled="false" level="TYPO" enabled_by_default="false"> - <option name="processCode" value="true" /> - <option name="processLiterals" value="true" /> - <option name="processComments" value="true" /> - </inspection_tool> <inspection_tool class="StringConcatenationInsideStringBufferAppend" enabled="false" level="WARNING" enabled_by_default="false" /> <inspection_tool class="StringConstructor" enabled="false" level="WARNING" enabled_by_default="false"> <option name="ignoreSubstringArguments" value="false" /> @@ -877,7 +872,6 @@ <option name="reportMethodParameters" value="true" /> </inspection_tool> <inspection_tool class="SynchronizeOnNonFinalField" enabled="false" level="WARNING" enabled_by_default="false" /> - <inspection_tool class="SyntaxError" enabled="false" level="ERROR" enabled_by_default="false" /> <inspection_tool class="ThrowFromFinallyBlock" enabled="false" level="WARNING" enabled_by_default="false" /> <inspection_tool class="ThrowableInstanceNeverThrown" enabled="false" level="WARNING" enabled_by_default="false" /> <inspection_tool class="ThrowableResultOfMethodCallIgnored" enabled="false" level="WARNING" enabled_by_default="false" /> @@ -943,7 +937,6 @@ <inspection_tool class="WhileCanBeForeach" enabled="false" level="WARNING" enabled_by_default="false" /> <inspection_tool class="WrongPackageStatement" enabled="false" level="ERROR" enabled_by_default="false" /> <inspection_tool class="XmlDuplicatedId" enabled="false" level="ERROR" enabled_by_default="false" /> - <inspection_tool class="XmlHighlighting" enabled="false" level="ERROR" enabled_by_default="false" /> <inspection_tool class="XmlUnboundNsPrefix" enabled="false" level="WARNING" enabled_by_default="false" /> <inspection_tool class="XmlWrongClosingTagName" level="ERROR" enabled="false" /> <inspection_tool class="XmlWrongRootElement" enabled="false" level="ERROR" enabled_by_default="false" /> @@ -1121,9 +1114,11 @@ <dictionary name="ank"> <words> <w>accel</w> + <w>atrinik</w> <w>attribute's</w> <w>autojoin</w> <w>autojoining</w> + <w>backbuffer</w> <w>beanshell</w> <w>daimonin</w> <w>filter<?, ?></w> @@ -1134,11 +1129,24 @@ <w>matchers</w> <w>mmorpg</w> <w>multi</w> + <w>online</w> + <w>oversized</w> + <w>pickmap</w> <w>pickmaps</w> <w>plugins</w> + <w>resize</w> + <w>shortdescription</w> + <w>startup</w> + <w>teleporter</w> + <w>teleporters</w> <w>timestamp</w> + <w>tooltip</w> <w>treasurelist</w> <w>treasurelists</w> + <w>unregister</w> + <w>validator's</w> + <w>validator...</w> + <w>viewport</w> </words> </dictionary> </component> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2010-05-22 14:08:13
|
Revision: 7862 http://gridarta.svn.sourceforge.net/gridarta/?rev=7862&view=rev Author: akirschbaum Date: 2010-05-22 14:08:06 +0000 (Sat, 22 May 2010) Log Message: ----------- Merge duplicated code. Modified Paths: -------------- trunk/src/app/net/sf/gridarta/mainactions/MainActions.java Modified: trunk/src/app/net/sf/gridarta/mainactions/MainActions.java =================================================================== --- trunk/src/app/net/sf/gridarta/mainactions/MainActions.java 2010-05-22 14:01:25 UTC (rev 7861) +++ trunk/src/app/net/sf/gridarta/mainactions/MainActions.java 2010-05-22 14:08:06 UTC (rev 7862) @@ -639,7 +639,7 @@ aShiftSouthWest.setEnabled(getShiftEnabled(6) != null); aShiftWest.setEnabled(getShiftEnabled(3) != null); aShiftNorthWest.setEnabled(getShiftEnabled(7) != null); - aReplace.setEnabled(getReplaceEnabled() != null); + aReplace.setEnabled(replace(false)); aFillAuto.setEnabled(getFillAutoEnabled() != null); aFillAbove.setEnabled(getFillAboveEnabled() != null); aFillBelow.setEnabled(getFillBelowEnabled() != null); @@ -768,10 +768,7 @@ */ @ActionMethod public void replace() { - final MapView<G, A, R> mapView = getReplaceEnabled(); - if (mapView != null) { - replaceDialogManager.showDialog(mapView); - } + replace(true); } /** @@ -1129,16 +1126,6 @@ } /** - * Determine if "replace" is enabled. - * @return the map view to replace on if "replace" is enabled, or - * <code>null</code> otherwise - */ - @Nullable - private MapView<G, A, R> getReplaceEnabled() { - return currentMapView; - } - - /** * Determine if "fill" is enabled. * @return the map view to fill if "fill" is enabled, or <code>null</code> * otherwise @@ -1310,4 +1297,22 @@ return currentMapView != null && currentMapView.getMapViewBasic().getMapCursor().isActive() ? currentMapView : null; } + /** + * Executes the "replace" action. + * @param performAction whether the action should be performed + * @return whether the action was or can be performed + */ + private boolean replace(final boolean performAction) { + final MapView<G, A, R> mapView = currentMapView; + if (mapView == null) { + return false; + } + + if (performAction) { + replaceDialogManager.showDialog(mapView); + } + + return true; + } + } // class MainActions This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2010-05-22 14:01:32
|
Revision: 7861 http://gridarta.svn.sourceforge.net/gridarta/?rev=7861&view=rev Author: akirschbaum Date: 2010-05-22 14:01:25 +0000 (Sat, 22 May 2010) Log Message: ----------- Remove unused code. Modified Paths: -------------- trunk/src/app/net/sf/gridarta/gui/replacedialog/ReplaceDialog.java Modified: trunk/src/app/net/sf/gridarta/gui/replacedialog/ReplaceDialog.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/replacedialog/ReplaceDialog.java 2010-05-22 13:59:59 UTC (rev 7860) +++ trunk/src/app/net/sf/gridarta/gui/replacedialog/ReplaceDialog.java 2010-05-22 14:01:25 UTC (rev 7861) @@ -649,14 +649,6 @@ } /** - * Returns whether this replace dialog has been displayed. - * @return whether this replace dialog has been displayed - */ - public boolean isBuilt() { - return isBuilt; - } - - /** * Dispose the replace dialog. * @param mapView the map view to dispose the dialog of; do nothing if no */ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |