From: <aki...@us...> - 2010-06-13 10:48:34
|
Revision: 8368 http://gridarta.svn.sourceforge.net/gridarta/?rev=8368&view=rev Author: akirschbaum Date: 2010-06-13 10:48:28 +0000 (Sun, 13 Jun 2010) Log Message: ----------- Suppress warnings. Modified Paths: -------------- trunk/model/src/app/net/sf/gridarta/model/archetype/AbstractArchetypeBuilder.java trunk/model/src/app/net/sf/gridarta/model/baseobject/GameObjectContainer.java Modified: trunk/model/src/app/net/sf/gridarta/model/archetype/AbstractArchetypeBuilder.java =================================================================== --- trunk/model/src/app/net/sf/gridarta/model/archetype/AbstractArchetypeBuilder.java 2010-06-13 10:46:11 UTC (rev 8367) +++ trunk/model/src/app/net/sf/gridarta/model/archetype/AbstractArchetypeBuilder.java 2010-06-13 10:48:28 UTC (rev 8368) @@ -162,6 +162,9 @@ archetype.setMultiY(multiY); } + /** + * @noinspection TypeMayBeWeakened + */ @NotNull protected R getArchetype() { return archetype; Modified: trunk/model/src/app/net/sf/gridarta/model/baseobject/GameObjectContainer.java =================================================================== --- trunk/model/src/app/net/sf/gridarta/model/baseobject/GameObjectContainer.java 2010-06-13 10:46:11 UTC (rev 8367) +++ trunk/model/src/app/net/sf/gridarta/model/baseobject/GameObjectContainer.java 2010-06-13 10:48:28 UTC (rev 8368) @@ -233,6 +233,7 @@ * regarded deprecated. * @return last GameObject contained or <code>null</code> if {@link * #isEmpty()} returns <code>true</code> + * @noinspection TypeMayBeWeakened */ @Nullable public G getLast() { @@ -455,6 +456,7 @@ * @throws IllegalArgumentException if <var>gameObject</var> already is * inside another container or <var>previousGameObject</var> isn't inside * this container + * @noinspection TypeMayBeWeakened */ public void insertAfter(@Nullable final G previousGameObject, @NotNull final G gameObject) { if (gameObject.isInContainer()) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2010-06-13 10:54:11
|
Revision: 8369 http://gridarta.svn.sourceforge.net/gridarta/?rev=8369&view=rev Author: akirschbaum Date: 2010-06-13 10:54:04 +0000 (Sun, 13 Jun 2010) Log Message: ----------- Remove nested assignments. Modified Paths: -------------- trunk/model/src/app/net/sf/gridarta/model/artifact/ArtifactParser.java trunk/model/src/app/net/sf/gridarta/model/autojoin/AutojoinListsParser.java Modified: trunk/model/src/app/net/sf/gridarta/model/artifact/ArtifactParser.java =================================================================== --- trunk/model/src/app/net/sf/gridarta/model/artifact/ArtifactParser.java 2010-06-13 10:48:28 UTC (rev 8368) +++ trunk/model/src/app/net/sf/gridarta/model/artifact/ArtifactParser.java 2010-06-13 10:54:04 UTC (rev 8369) @@ -196,11 +196,14 @@ @Nullable String defArchName = null; int lineCount = 0; - String thisLine; @Nullable String editorPath = null; - while ((thisLine = in.readLine()) != null) { + while (true) { + final String thisLine2 = in.readLine(); + if (thisLine2 == null) { + break; + } lineCount++; - thisLine = thisLine.trim(); + final String thisLine = thisLine2.trim(); // ignore white space lines or '#' comment lines if (!thisLine.startsWith("#") && thisLine.length() != 0) { if (thisLine.startsWith("artifact ")) { @@ -242,7 +245,11 @@ // note: in the parser is a small part where we handle the title setting // and the reverse type setting for type == -1 (unique items marker in artifacts file) } else { - while ((thisLine = in.readLine()) != null && !thisLine.equals("end")) { + while (true) { + final String thisLine3 = in.readLine(); + if (thisLine3 == null || thisLine3.equals("end")) { + break; + } } } } catch (final UndefinedArchetypeException ex) { Modified: trunk/model/src/app/net/sf/gridarta/model/autojoin/AutojoinListsParser.java =================================================================== --- trunk/model/src/app/net/sf/gridarta/model/autojoin/AutojoinListsParser.java 2010-06-13 10:48:28 UTC (rev 8368) +++ trunk/model/src/app/net/sf/gridarta/model/autojoin/AutojoinListsParser.java 2010-06-13 10:54:04 UTC (rev 8369) @@ -95,10 +95,13 @@ boolean sectionFlag = false; // true while section (start ... end) read final List<R> archetypes = new ArrayList<R>(AutojoinList.SIZE); boolean skipList = true; - String line; - while ((line = stream.readLine()) != null) { - if (!line.startsWith("#") && line.length() > 0) { - line = line.trim(); // remove whitespace at both ends + while (true) { + final String line2 = stream.readLine(); + if (line2 == null) { + break; + } + if (!line2.startsWith("#") && line2.length() > 0) { + final String line = line2.trim(); // remove whitespace at both ends if (sectionFlag) { // we are inside a section This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2010-06-13 11:12:35
|
Revision: 8378 http://gridarta.svn.sourceforge.net/gridarta/?rev=8378&view=rev Author: akirschbaum Date: 2010-06-13 11:12:28 +0000 (Sun, 13 Jun 2010) Log Message: ----------- Fix Javadoc issues. Modified Paths: -------------- trunk/model/src/app/net/sf/gridarta/model/archetypetype/ArchetypeTypeSet.java trunk/model/src/app/net/sf/gridarta/model/map/grid/MapGrid.java Modified: trunk/model/src/app/net/sf/gridarta/model/archetypetype/ArchetypeTypeSet.java =================================================================== --- trunk/model/src/app/net/sf/gridarta/model/archetypetype/ArchetypeTypeSet.java 2010-06-13 11:08:05 UTC (rev 8377) +++ trunk/model/src/app/net/sf/gridarta/model/archetypetype/ArchetypeTypeSet.java 2010-06-13 11:12:28 UTC (rev 8378) @@ -131,11 +131,6 @@ * Find and return the type-structure (<code>ArchetypeType</code>) that * matches for the given arch. This is not only a comparison between type * numbers - special type-attributes must also be dealt with. <p/> - * IMPORTANT: A similar-but-different version of this code is used in {@link - * net.sf.gridarta.gui.gameobjectattributesdialog.GameObjectAttributesDialog}. - * Hence, if modifying this method, the appropriate parts in - * <code>GameObjectAttributesDialog</code> must also be updated and - * vice-versa. * @param baseObject the arch to find the type for * @return the <code>ArchetypeType</code> which belongs to this arch, or the * first (misc) type if no match is found. Modified: trunk/model/src/app/net/sf/gridarta/model/map/grid/MapGrid.java =================================================================== --- trunk/model/src/app/net/sf/gridarta/model/map/grid/MapGrid.java 2010-06-13 11:08:05 UTC (rev 8377) +++ trunk/model/src/app/net/sf/gridarta/model/map/grid/MapGrid.java 2010-06-13 11:12:28 UTC (rev 8378) @@ -28,14 +28,14 @@ /** * 2D-Grid containing flags for selection, pre-selection, cursor, warnings and - * errors. This class provides methods to modify these flags. Normally a {@link - * net.sf.gridarta.gui.mapcursor.MapCursor} is used to access them. Selection - * flags are not changed directly. First pre-selection flags have to be set with - * {@link #preSelect(Point, Point)}, then {@link #select(Point, Point, - * SelectionMode)} will change the selection flags according to {@link - * SelectionMode}. This allows visualisation of the dragging process when - * selecting an area. <p/> Every change of the grid size or flags fires a {@link - * MapGridEvent} and informs all registered {@link MapGridListener}s. + * errors. This class provides methods to modify these flags. Normally a map + * cursor is used to access them. Selection flags are not changed directly. + * First pre-selection flags have to be set with {@link #preSelect(Point, + * Point)}, then {@link #select(Point, Point, SelectionMode)} will change the + * selection flags according to {@link SelectionMode}. This allows visualisation + * of the dragging process when selecting an area. <p/> Every change of the grid + * size or flags fires a {@link MapGridEvent} and informs all registered {@link + * MapGridListener}s. * @author <a href="mailto:dlv...@gm...">Daniel Viegas</a> * @author Andreas Kirschbaum */ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2010-06-13 11:31:50
|
Revision: 8382 http://gridarta.svn.sourceforge.net/gridarta/?rev=8382&view=rev Author: akirschbaum Date: 2010-06-13 11:31:43 +0000 (Sun, 13 Jun 2010) Log Message: ----------- Explicitly initialize fields. Modified Paths: -------------- trunk/model/src/app/net/sf/gridarta/model/data/NamedTreeNode.java trunk/model/src/app/net/sf/gridarta/model/face/DoubleImageFilter.java trunk/model/src/app/net/sf/gridarta/model/match/ViewGameObjectMatcherManager.java Modified: trunk/model/src/app/net/sf/gridarta/model/data/NamedTreeNode.java =================================================================== --- trunk/model/src/app/net/sf/gridarta/model/data/NamedTreeNode.java 2010-06-13 11:29:06 UTC (rev 8381) +++ trunk/model/src/app/net/sf/gridarta/model/data/NamedTreeNode.java 2010-06-13 11:31:43 UTC (rev 8382) @@ -58,7 +58,7 @@ * @serial */ @Nullable - private NamedTreeNode<E>[] childNodeArray; + private NamedTreeNode<E>[] childNodeArray = null; /** * The parent node, which may be <code>null</code> for the root node. Modified: trunk/model/src/app/net/sf/gridarta/model/face/DoubleImageFilter.java =================================================================== --- trunk/model/src/app/net/sf/gridarta/model/face/DoubleImageFilter.java 2010-06-13 11:29:06 UTC (rev 8381) +++ trunk/model/src/app/net/sf/gridarta/model/face/DoubleImageFilter.java 2010-06-13 11:31:43 UTC (rev 8382) @@ -42,7 +42,7 @@ /** * The image width. */ - private int width; + private int width = 0; /** * The destination image's pixels. Modified: trunk/model/src/app/net/sf/gridarta/model/match/ViewGameObjectMatcherManager.java =================================================================== --- trunk/model/src/app/net/sf/gridarta/model/match/ViewGameObjectMatcherManager.java 2010-06-13 11:29:06 UTC (rev 8381) +++ trunk/model/src/app/net/sf/gridarta/model/match/ViewGameObjectMatcherManager.java 2010-06-13 11:31:43 UTC (rev 8382) @@ -155,7 +155,7 @@ /** * Selected state. */ - private boolean selected; + private boolean selected = false; /** * A {@link MutableOrGameObjectMatcher} to add / remove {@link This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2010-06-24 03:18:01
|
Revision: 8439 http://gridarta.svn.sourceforge.net/gridarta/?rev=8439&view=rev Author: akirschbaum Date: 2010-06-24 03:17:54 +0000 (Thu, 24 Jun 2010) Log Message: ----------- Make sure every GameObject has an Archetype. Modified Paths: -------------- trunk/model/src/app/net/sf/gridarta/model/baseobject/AbstractBaseObject.java trunk/model/src/app/net/sf/gridarta/model/gameobject/AbstractGameObject.java Modified: trunk/model/src/app/net/sf/gridarta/model/baseobject/AbstractBaseObject.java =================================================================== --- trunk/model/src/app/net/sf/gridarta/model/baseobject/AbstractBaseObject.java 2010-06-24 03:09:38 UTC (rev 8438) +++ trunk/model/src/app/net/sf/gridarta/model/baseobject/AbstractBaseObject.java 2010-06-24 03:17:54 UTC (rev 8439) @@ -219,7 +219,7 @@ final String normalizedFaceName = faceName.length() > 0 ? faceName.intern() : null; //Strings are interned //noinspection StringEquality - final String effectiveFaceName = normalizedFaceName != null && normalizedFaceName.length() > 0 && (getArchetype() == null || isArchetype() || normalizedFaceName != getArchetype().getFaceName()) ? normalizedFaceName : null; + final String effectiveFaceName = normalizedFaceName != null && normalizedFaceName.length() > 0 && (isArchetype() || normalizedFaceName != getArchetype().getFaceName()) ? normalizedFaceName : null; //Strings are interned //noinspection StringEquality if (this.faceName == effectiveFaceName) { @@ -280,7 +280,7 @@ public String getAttributeString(@NotNull final String attributeName, final boolean queryArchetype) { String result = gameObjectText.getAttributeValue(attributeName); if (result == null) { - if (!queryArchetype || isArchetype() || getArchetype() == null) { + if (!queryArchetype || isArchetype()) { result = ""; } else { result = getArchetype().getAttributeString(attributeName); @@ -352,7 +352,7 @@ @Override public void setAttributeString(@NotNull final String attributeName, @NotNull final String value) { final String attributeNameWithSpace = attributeName.trim() + " "; // attributeName must be followed by space - final boolean sameAsInArchetype = getArchetype() != null && getArchetype().getAttributeString(attributeName).equals(value); + final boolean sameAsInArchetype = getArchetype().getAttributeString(attributeName).equals(value); boolean exists = false; final StringBuilder result = new StringBuilder(); for (final String line : StringUtils.PATTERN_END_OF_LINE.split(getObjectText(), 0)) { @@ -716,23 +716,17 @@ @NotNull @Override public String getBestName() { + if (objName.length() > 0) { + return objName; + } + final Archetype<G, A, R> archetype = getArchetype(); - if (archetype != null) { - final String archObjName = archetype.getObjName(); - if (objName.length() > 0) { - return objName; - } else if (archObjName.length() > 0) { - return archObjName; - } else { - return archetype.getArchetypeName(); - } - } else { - if (objName.length() > 0) { - return objName; - } else { - throw new IllegalStateException(); - } + final String archObjName = archetype.getObjName(); + if (archObjName.length() > 0) { + return archObjName; } + + return archetype.getArchetypeName(); } /** @@ -786,9 +780,6 @@ @Override public boolean isDefaultGameObject() { final R archetype = getArchetype(); - if (archetype == null) { - return false; - } if (!objName.equals(archetype.getObjName())) { return false; } Modified: trunk/model/src/app/net/sf/gridarta/model/gameobject/AbstractGameObject.java =================================================================== --- trunk/model/src/app/net/sf/gridarta/model/gameobject/AbstractGameObject.java 2010-06-24 03:09:38 UTC (rev 8438) +++ trunk/model/src/app/net/sf/gridarta/model/gameobject/AbstractGameObject.java 2010-06-24 03:17:54 UTC (rev 8439) @@ -42,7 +42,7 @@ * not yet known. * @serial */ - @Nullable + @NotNull private R archetype; /** @@ -324,7 +324,7 @@ /** * {@inheritDoc} */ - //XXX: @NotNull + @NotNull @Override public R getArchetype() { return archetype; @@ -348,7 +348,7 @@ */ @Override public boolean hasUndefinedArchetype() { - return archetype != null && archetype.isUndefinedArchetype(); + return archetype.isUndefinedArchetype(); } } // class AbstractGameObject This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2010-06-26 06:17:38
|
Revision: 8473 http://gridarta.svn.sourceforge.net/gridarta/?rev=8473&view=rev Author: akirschbaum Date: 2010-06-26 06:17:32 +0000 (Sat, 26 Jun 2010) Log Message: ----------- Whitespace changes. Modified Paths: -------------- trunk/model/src/app/net/sf/gridarta/model/archetypetype/ArchetypeType.java trunk/model/src/app/net/sf/gridarta/model/baseobject/AbstractBaseObject.java Modified: trunk/model/src/app/net/sf/gridarta/model/archetypetype/ArchetypeType.java =================================================================== --- trunk/model/src/app/net/sf/gridarta/model/archetypetype/ArchetypeType.java 2010-06-26 06:15:48 UTC (rev 8472) +++ trunk/model/src/app/net/sf/gridarta/model/archetypetype/ArchetypeType.java 2010-06-26 06:17:32 UTC (rev 8473) @@ -287,7 +287,7 @@ final String attributeValue = baseObject.getAttributeString(spec.substring(0, question)); final boolean attributeExists = attributeValue.length() != 0 && !attributeValue.equals("0"); if (attributeExists) { - value = spec.substring(question + 1, colon == -1 ? spec.length(): colon); + value = spec.substring(question + 1, colon == -1 ? spec.length() : colon); } else { value = colon == -1 ? "" : spec.substring(colon + 1); } Modified: trunk/model/src/app/net/sf/gridarta/model/baseobject/AbstractBaseObject.java =================================================================== --- trunk/model/src/app/net/sf/gridarta/model/baseobject/AbstractBaseObject.java 2010-06-26 06:15:48 UTC (rev 8472) +++ trunk/model/src/app/net/sf/gridarta/model/baseobject/AbstractBaseObject.java 2010-06-26 06:17:32 UTC (rev 8473) @@ -730,7 +730,7 @@ } final String title = getAttributeString(TITLE); - return title.isEmpty() ? baseName : baseName + " " +title; + return title.isEmpty() ? baseName : baseName + " " + title; } /** This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2010-06-26 07:38:46
|
Revision: 8490 http://gridarta.svn.sourceforge.net/gridarta/?rev=8490&view=rev Author: akirschbaum Date: 2010-06-26 07:38:40 +0000 (Sat, 26 Jun 2010) Log Message: ----------- Add @NotNull annotations. Modified Paths: -------------- trunk/model/src/app/net/sf/gridarta/model/data/AbstractNamedObject.java trunk/model/src/app/net/sf/gridarta/model/face/DefaultFaceObject.java Modified: trunk/model/src/app/net/sf/gridarta/model/data/AbstractNamedObject.java =================================================================== --- trunk/model/src/app/net/sf/gridarta/model/data/AbstractNamedObject.java 2010-06-26 07:37:52 UTC (rev 8489) +++ trunk/model/src/app/net/sf/gridarta/model/data/AbstractNamedObject.java 2010-06-26 07:38:40 UTC (rev 8490) @@ -74,7 +74,7 @@ * {@inheritDoc} */ @Override - public int compareTo(final NamedObject o) { + public int compareTo(@NotNull final NamedObject o) { return getName().compareTo(o.getName()); } Modified: trunk/model/src/app/net/sf/gridarta/model/face/DefaultFaceObject.java =================================================================== --- trunk/model/src/app/net/sf/gridarta/model/face/DefaultFaceObject.java 2010-06-26 07:37:52 UTC (rev 8489) +++ trunk/model/src/app/net/sf/gridarta/model/face/DefaultFaceObject.java 2010-06-26 07:38:40 UTC (rev 8490) @@ -205,7 +205,7 @@ * faces. */ @Override - public int compareTo(final NamedObject o) { + public int compareTo(@NotNull final NamedObject o) { final boolean iAmBug = faceName.equals("bug.111") || faceName.equals("bug.101"); final boolean otherIsBug = o.getName().equals("bug.111") || o.getName().equals("bug.101"); if (iAmBug && otherIsBug) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2010-07-06 07:01:15
|
Revision: 8588 http://gridarta.svn.sourceforge.net/gridarta/?rev=8588&view=rev Author: akirschbaum Date: 2010-07-06 07:01:08 +0000 (Tue, 06 Jul 2010) Log Message: ----------- Remove GameObjectMatchers.calculateEditType2(); clean up edit type calculation to store edit types only in head parts. Modified Paths: -------------- trunk/model/src/app/net/sf/gridarta/model/baseobject/AbstractBaseObject.java trunk/model/src/app/net/sf/gridarta/model/io/AbstractGameObjectParser.java trunk/model/src/app/net/sf/gridarta/model/mapmodel/DefaultMapModel.java trunk/model/src/app/net/sf/gridarta/model/mapmodel/SavedSquares.java trunk/model/src/app/net/sf/gridarta/model/match/GameObjectMatchers.java Modified: trunk/model/src/app/net/sf/gridarta/model/baseobject/AbstractBaseObject.java =================================================================== --- trunk/model/src/app/net/sf/gridarta/model/baseobject/AbstractBaseObject.java 2010-07-06 06:59:50 UTC (rev 8587) +++ trunk/model/src/app/net/sf/gridarta/model/baseobject/AbstractBaseObject.java 2010-07-06 07:01:08 UTC (rev 8588) @@ -425,7 +425,7 @@ */ @Override public int getEditType() { - return editType; + return isHead() ? editType : getHead().getEditType(); } /** @@ -433,6 +433,7 @@ */ @Override public void setEditType(final int editType) { + assert isHead(); if (this.editType == editType) { return; } Modified: trunk/model/src/app/net/sf/gridarta/model/io/AbstractGameObjectParser.java =================================================================== --- trunk/model/src/app/net/sf/gridarta/model/io/AbstractGameObjectParser.java 2010-07-06 06:59:50 UTC (rev 8587) +++ trunk/model/src/app/net/sf/gridarta/model/io/AbstractGameObjectParser.java 2010-07-06 07:01:08 UTC (rev 8588) @@ -204,7 +204,9 @@ final Collection<G> tailList = new ArrayList<G>(); for (final G gameObject : objects) { - gameObjectMatchers.updateEditType(gameObject, mapViewSettings.getEditType()); + if (gameObject.isHead()) { + gameObjectMatchers.updateEditType(gameObject, mapViewSettings.getEditType()); + } if (!gameObject.isInContainer()) { expandMulti(gameObject, tailList); Modified: trunk/model/src/app/net/sf/gridarta/model/mapmodel/DefaultMapModel.java =================================================================== --- trunk/model/src/app/net/sf/gridarta/model/mapmodel/DefaultMapModel.java 2010-07-06 06:59:50 UTC (rev 8587) +++ trunk/model/src/app/net/sf/gridarta/model/mapmodel/DefaultMapModel.java 2010-07-06 07:01:08 UTC (rev 8588) @@ -797,7 +797,9 @@ if (direction != null) { part.setAttributeString(BaseObject.DIRECTION, direction.toString()); } - if (!parts.isEmpty()) { + if (parts.isEmpty()) { + gameObjectMatchers.updateEditType(part, activeEditType); + } else { parts.get(0).addTailPart(part); } parts.add(part); @@ -806,7 +808,6 @@ for (final G part : parts) { final int mapX = pos.x + part.getArchetype().getMultiX(); final int mapY = pos.y + part.getArchetype().getMultiY(); - gameObjectMatchers.updateEditType(part, activeEditType); insertionMode.insert(part, mapGrid.getMapSquare(mapX, mapY)); } @@ -828,7 +829,9 @@ return; } - gameObjectMatchers.updateEditType(gameObject, activeEditType); + if (gameObject.isHead()) { + gameObjectMatchers.updateEditType(gameObject, activeEditType); + } insertionMode.insert(gameObject, mapGrid.getMapSquare(pos.x, pos.y)); } @@ -913,7 +916,7 @@ try { for (final Iterable<G> mapSquare : this) { for (final GameObject<G, A, R> gameObject : mapSquare) { - gameObjectMatchers.updateEditType(gameObject, editType); + gameObjectMatchers.updateEditType(gameObject.getHead(), editType); } } } finally { Modified: trunk/model/src/app/net/sf/gridarta/model/mapmodel/SavedSquares.java =================================================================== --- trunk/model/src/app/net/sf/gridarta/model/mapmodel/SavedSquares.java 2010-07-06 06:59:50 UTC (rev 8587) +++ trunk/model/src/app/net/sf/gridarta/model/mapmodel/SavedSquares.java 2010-07-06 07:01:08 UTC (rev 8588) @@ -197,7 +197,7 @@ objectsToDelete.clear(); for (final G gameObject : square) { mapSquare.addLast(gameObject); - gameObjectMatchers.calculateEditType2(gameObject, activeEditType); + gameObjectMatchers.updateEditType(gameObject.getHead(), activeEditType); } } point.y++; @@ -214,7 +214,6 @@ for (final Iterable<G> square : col) { if (square != null) { for (final GameObject<G, A, R> gameObject : square) { - final int editType = gameObject.getEditType(); final int mapX = gameObject.getMapX(); final int mapY = gameObject.getMapY(); for (G tailGameObject = gameObject.getMultiNext(); tailGameObject != null; tailGameObject = tailGameObject.getMultiNext()) { @@ -222,7 +221,6 @@ point2.y = mapY + tailGameObject.getArchetype().getMultiY(); final GameObjectContainer<G, A, R> mapSquare = mapModel.getMapSquare(point2); mapSquare.addLast(tailGameObject); - tailGameObject.setEditType(editType); } } } Modified: trunk/model/src/app/net/sf/gridarta/model/match/GameObjectMatchers.java =================================================================== --- trunk/model/src/app/net/sf/gridarta/model/match/GameObjectMatchers.java 2010-07-06 06:59:50 UTC (rev 8587) +++ trunk/model/src/app/net/sf/gridarta/model/match/GameObjectMatchers.java 2010-07-06 07:01:08 UTC (rev 8588) @@ -123,24 +123,22 @@ } /** - * Get the EditType of an GameObject (e.g. floor, monster, etc). These are - * determined by the various attributes of the GameObject - * (->objectText). + * Updates the edit type of a {@link GameObject}. These are determined by + * various attributes of the game object. * @param gameObject the game object * @param checkType bitmask containing the edit type(s) to be calculated - * @return new editType for this GameObject */ - public int calculateEditType2(@NotNull final GameObject<?, ?, ?> gameObject, final int checkType) { + public void updateEditType(@NotNull final GameObject<?, ?, ?> gameObject, final int checkType) { + assert gameObject.isHead(); final int editType = gameObject.getEditType(); if (checkType == 0) { - return editType; + return; } // all flags from 'checkType' must be unset in this arch because they get recalculated now final int retainedEditType = editType == GUIConstants.EDIT_TYPE_NONE ? 0 : editType & ~checkType; final int newEditType = retainedEditType | calculateEditType(gameObject, checkType); gameObject.setEditType(newEditType); - return newEditType; } /** @@ -160,17 +158,4 @@ return editType; } - /** - * Update the cached edit types. - * @param gameObject the game object to update - * @param checkType the edit types to update - */ - public void updateEditType(@NotNull final GameObject<?, ?, ?> gameObject, final int checkType) { - final GameObject<?, ?, ?> head = gameObject.getHead(); - final int headEditType = calculateEditType2(head, checkType); - if (head != gameObject) { - gameObject.setEditType(headEditType); - } - } - } // class GameObjectMatchers This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2010-10-06 20:44:54
|
Revision: 8682 http://gridarta.svn.sourceforge.net/gridarta/?rev=8682&view=rev Author: akirschbaum Date: 2010-10-06 20:44:47 +0000 (Wed, 06 Oct 2010) Log Message: ----------- Fix unchecked cast. Modified Paths: -------------- trunk/model/src/app/net/sf/gridarta/model/archetype/AbstractArchetype.java trunk/model/src/app/net/sf/gridarta/model/baseobject/GameObjectContainer.java trunk/model/src/app/net/sf/gridarta/model/gameobject/AbstractGameObject.java trunk/model/src/app/net/sf/gridarta/model/mapmodel/MapSquare.java Modified: trunk/model/src/app/net/sf/gridarta/model/archetype/AbstractArchetype.java =================================================================== --- trunk/model/src/app/net/sf/gridarta/model/archetype/AbstractArchetype.java 2010-10-06 20:29:25 UTC (rev 8681) +++ trunk/model/src/app/net/sf/gridarta/model/archetype/AbstractArchetype.java 2010-10-06 20:44:47 UTC (rev 8682) @@ -175,6 +175,15 @@ /** * {@inheritDoc} */ + @Nullable + @Override + public G asGameObject() { + return null; + } + + /** + * {@inheritDoc} + */ @NotNull @Override public G newInstance(@NotNull final GameObjectFactory<G, A, R> gameObjectFactory) { Modified: trunk/model/src/app/net/sf/gridarta/model/baseobject/GameObjectContainer.java =================================================================== --- trunk/model/src/app/net/sf/gridarta/model/baseobject/GameObjectContainer.java 2010-10-06 20:29:25 UTC (rev 8681) +++ trunk/model/src/app/net/sf/gridarta/model/baseobject/GameObjectContainer.java 2010-10-06 20:44:47 UTC (rev 8682) @@ -638,6 +638,14 @@ protected abstract void setThisContainer(@NotNull final G gameObject); /** + * Returns this instance as a {@link GameObject} or <code>null</code> if + * this instance is not a game object. + * @return this instance or <code>null</code> + */ + @Nullable + public abstract G asGameObject(); + + /** * An iterator for iterating over a list in reverse order. * @todo move this class to JAPI */ Modified: trunk/model/src/app/net/sf/gridarta/model/gameobject/AbstractGameObject.java =================================================================== --- trunk/model/src/app/net/sf/gridarta/model/gameobject/AbstractGameObject.java 2010-10-06 20:29:25 UTC (rev 8681) +++ trunk/model/src/app/net/sf/gridarta/model/gameobject/AbstractGameObject.java 2010-10-06 20:44:47 UTC (rev 8682) @@ -119,6 +119,15 @@ */ @NotNull @Override + public G asGameObject() { + return getThis(); + } + + /** + * {@inheritDoc} + */ + @NotNull + @Override public G newInstance(@NotNull final GameObjectFactory<G, A, R> gameObjectFactory) { return gameObjectFactory.cloneGameObject(getThis()); } @@ -262,7 +271,7 @@ @Nullable @Override public G getContainerGameObject() { - return container != null && container instanceof GameObject ? (G) container : null; + return container == null ? null : container.asGameObject(); } /** Modified: trunk/model/src/app/net/sf/gridarta/model/mapmodel/MapSquare.java =================================================================== --- trunk/model/src/app/net/sf/gridarta/model/mapmodel/MapSquare.java 2010-10-06 20:29:25 UTC (rev 8681) +++ trunk/model/src/app/net/sf/gridarta/model/mapmodel/MapSquare.java 2010-10-06 20:44:47 UTC (rev 8682) @@ -141,6 +141,15 @@ } /** + * {@inheritDoc} + */ + @Nullable + @Override + public G asGameObject() { + return null; + } + + /** * 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-10-07 19:01:58
|
Revision: 8689 http://gridarta.svn.sourceforge.net/gridarta/?rev=8689&view=rev Author: akirschbaum Date: 2010-10-07 19:01:52 +0000 (Thu, 07 Oct 2010) Log Message: ----------- Remove call to BaseObject.isArchetype(). Modified Paths: -------------- trunk/model/src/app/net/sf/gridarta/model/archetype/AbstractArchetype.java trunk/model/src/app/net/sf/gridarta/model/baseobject/AbstractBaseObject.java trunk/model/src/app/net/sf/gridarta/model/gameobject/AbstractGameObject.java Modified: trunk/model/src/app/net/sf/gridarta/model/archetype/AbstractArchetype.java =================================================================== --- trunk/model/src/app/net/sf/gridarta/model/archetype/AbstractArchetype.java 2010-10-07 18:50:13 UTC (rev 8688) +++ trunk/model/src/app/net/sf/gridarta/model/archetype/AbstractArchetype.java 2010-10-07 19:01:52 UTC (rev 8689) @@ -118,6 +118,16 @@ /** * {@inheritDoc} + */ + @Override + @NotNull + public String getAttributeString(@NotNull final String attributeName, final boolean queryArchetype) { + final String result = getAttributeValue(attributeName); + return result == null ? "" : result; + } + + /** + * {@inheritDoc} * @noinspection NoopMethodInAbstractClass */ @Override Modified: trunk/model/src/app/net/sf/gridarta/model/baseobject/AbstractBaseObject.java =================================================================== --- trunk/model/src/app/net/sf/gridarta/model/baseobject/AbstractBaseObject.java 2010-10-07 18:50:13 UTC (rev 8688) +++ trunk/model/src/app/net/sf/gridarta/model/baseobject/AbstractBaseObject.java 2010-10-07 19:01:52 UTC (rev 8689) @@ -273,20 +273,13 @@ } /** - * {@inheritDoc} + * Returns an attribute value by attribute name. + * @param attributeName the attribute name + * @return the attribute value or <code>null</code> */ - @Override - @NotNull - public String getAttributeString(@NotNull final String attributeName, final boolean queryArchetype) { - String result = gameObjectText.getAttributeValue(attributeName); - if (result == null) { - if (!queryArchetype || isArchetype()) { - result = ""; - } else { - result = getArchetype().getAttributeString(attributeName); - } - } - return result; + @Nullable + protected String getAttributeValue(@NotNull final String attributeName) { + return gameObjectText.getAttributeValue(attributeName); } /** Modified: trunk/model/src/app/net/sf/gridarta/model/gameobject/AbstractGameObject.java =================================================================== --- trunk/model/src/app/net/sf/gridarta/model/gameobject/AbstractGameObject.java 2010-10-07 18:50:13 UTC (rev 8688) +++ trunk/model/src/app/net/sf/gridarta/model/gameobject/AbstractGameObject.java 2010-10-07 19:01:52 UTC (rev 8689) @@ -72,6 +72,19 @@ * {@inheritDoc} */ @Override + @NotNull + public String getAttributeString(@NotNull final String attributeName, final boolean queryArchetype) { + final String result = getAttributeValue(attributeName); + if (result != null) { + return result; + } + return queryArchetype ? archetype.getAttributeString(attributeName) : ""; + } + + /** + * {@inheritDoc} + */ + @Override public void notifyBeginChange() { final MapSquare<G, A, R> mapSquare = getMapSquare(); if (mapSquare != null) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2010-10-07 19:11:11
|
Revision: 8690 http://gridarta.svn.sourceforge.net/gridarta/?rev=8690&view=rev Author: akirschbaum Date: 2010-10-07 19:11:05 +0000 (Thu, 07 Oct 2010) Log Message: ----------- Remove call to BaseObject.isArchetype(). Modified Paths: -------------- trunk/model/src/app/net/sf/gridarta/model/archetype/AbstractArchetype.java trunk/model/src/app/net/sf/gridarta/model/baseobject/AbstractBaseObject.java trunk/model/src/app/net/sf/gridarta/model/gameobject/AbstractGameObject.java Modified: trunk/model/src/app/net/sf/gridarta/model/archetype/AbstractArchetype.java =================================================================== --- trunk/model/src/app/net/sf/gridarta/model/archetype/AbstractArchetype.java 2010-10-07 19:01:52 UTC (rev 8689) +++ trunk/model/src/app/net/sf/gridarta/model/archetype/AbstractArchetype.java 2010-10-07 19:11:05 UTC (rev 8690) @@ -128,6 +128,18 @@ /** * {@inheritDoc} + */ + @Nullable + @Override + protected String getEffectiveFaceName(@NotNull final String faceName) { + final String normalizedFaceName = faceName.length() > 0 ? faceName.intern() : null; + //Strings are interned + //noinspection StringEquality + return normalizedFaceName != null && normalizedFaceName.length() > 0 ? normalizedFaceName : null; + } + + /** + * {@inheritDoc} * @noinspection NoopMethodInAbstractClass */ @Override Modified: trunk/model/src/app/net/sf/gridarta/model/baseobject/AbstractBaseObject.java =================================================================== --- trunk/model/src/app/net/sf/gridarta/model/baseobject/AbstractBaseObject.java 2010-10-07 19:01:52 UTC (rev 8689) +++ trunk/model/src/app/net/sf/gridarta/model/baseobject/AbstractBaseObject.java 2010-10-07 19:11:05 UTC (rev 8690) @@ -216,12 +216,9 @@ * @param faceName new face name. */ private void setFaceName(@NotNull final String faceName) { - final String normalizedFaceName = faceName.length() > 0 ? faceName.intern() : null; + final String effectiveFaceName = getEffectiveFaceName(faceName); //Strings are interned //noinspection StringEquality - final String effectiveFaceName = normalizedFaceName != null && normalizedFaceName.length() > 0 && (isArchetype() || normalizedFaceName != getArchetype().getFaceName()) ? normalizedFaceName : null; - //Strings are interned - //noinspection StringEquality if (this.faceName == effectiveFaceName) { return; } @@ -235,6 +232,16 @@ } /** + * Returns the effective face name for {@link #faceName} for a given real + * face name. + * @param faceName the real face name + * @return the effective face name or <code>null</code> if the real face + * name is unset or equals the archetype's face name + */ + @Nullable + protected abstract String getEffectiveFaceName(@NotNull final String faceName); + + /** * {@inheritDoc} */ @Nullable Modified: trunk/model/src/app/net/sf/gridarta/model/gameobject/AbstractGameObject.java =================================================================== --- trunk/model/src/app/net/sf/gridarta/model/gameobject/AbstractGameObject.java 2010-10-07 19:01:52 UTC (rev 8689) +++ trunk/model/src/app/net/sf/gridarta/model/gameobject/AbstractGameObject.java 2010-10-07 19:11:05 UTC (rev 8690) @@ -84,7 +84,19 @@ /** * {@inheritDoc} */ + @Nullable @Override + protected String getEffectiveFaceName(@NotNull final String faceName) { + final String normalizedFaceName = faceName.length() > 0 ? faceName.intern() : null; + //Strings are interned + //noinspection StringEquality + return normalizedFaceName != null && normalizedFaceName.length() > 0 && normalizedFaceName != archetype.getFaceName() ? normalizedFaceName : null; + } + + /** + * {@inheritDoc} + */ + @Override public void notifyBeginChange() { final MapSquare<G, A, R> mapSquare = getMapSquare(); if (mapSquare != null) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2010-11-13 18:30:26
|
Revision: 8786 http://gridarta.svn.sourceforge.net/gridarta/?rev=8786&view=rev Author: akirschbaum Date: 2010-11-13 18:30:20 +0000 (Sat, 13 Nov 2010) Log Message: ----------- Fix unchecked warning. Modified Paths: -------------- trunk/model/src/app/net/sf/gridarta/model/floodfill/FillUtils.java trunk/model/src/app/net/sf/gridarta/model/mapmodel/MapModel.java trunk/model/src/app/net/sf/gridarta/model/mapmodel/MapSquareGrid.java trunk/model/src/app/net/sf/gridarta/model/mapmodel/MapSquareIterator.java trunk/model/src/app/net/sf/gridarta/model/validation/checks/MapCheckerScriptChecker.java Modified: trunk/model/src/app/net/sf/gridarta/model/floodfill/FillUtils.java =================================================================== --- trunk/model/src/app/net/sf/gridarta/model/floodfill/FillUtils.java 2010-11-13 18:11:37 UTC (rev 8785) +++ trunk/model/src/app/net/sf/gridarta/model/floodfill/FillUtils.java 2010-11-13 18:30:20 UTC (rev 8786) @@ -116,11 +116,9 @@ for (int dx = -1; dx < w + 1; dx++) { pos.x = p.x + dx; final MapSquare<G, A, R> mapSquare; - // This exception is expected at the border of the map. - //noinspection ProhibitedExceptionCaught try { mapSquare = mapModel.getMapSquare(pos); - } catch (final ArrayIndexOutOfBoundsException ignored) { + } catch (final IndexOutOfBoundsException ignored) { continue; } Modified: trunk/model/src/app/net/sf/gridarta/model/mapmodel/MapModel.java =================================================================== --- trunk/model/src/app/net/sf/gridarta/model/mapmodel/MapModel.java 2010-11-13 18:11:37 UTC (rev 8785) +++ trunk/model/src/app/net/sf/gridarta/model/mapmodel/MapModel.java 2010-11-13 18:30:20 UTC (rev 8786) @@ -265,8 +265,8 @@ * Get the square at a specified location. * @param pos location to get square at * @return square at <var>p</var> - * @throws ArrayIndexOutOfBoundsException in case p specifies a location - * that's not valid within this map model + * @throws IndexOutOfBoundsException in case p specifies a location that's + * not valid within this map model */ @NotNull MapSquare<G, A, R> getMapSquare(@NotNull Point pos); @@ -350,8 +350,8 @@ * @param allowDouble whether overlapping multi-square arches should be * allowed (check is done using the archetype name) * @return whether the multi-arch would still fit on this map - * @retval <code>true</code> if the multi-square archetype would still fit on - * this map + * @retval <code>true</code> if the multi-square archetype would still fit + * on this map * @retval <code>false</code> otherwise */ boolean isMultiArchFittingToMap(@NotNull Archetype<G, A, R> archetype, @NotNull Point pos, boolean allowDouble); Modified: trunk/model/src/app/net/sf/gridarta/model/mapmodel/MapSquareGrid.java =================================================================== --- trunk/model/src/app/net/sf/gridarta/model/mapmodel/MapSquareGrid.java 2010-11-13 18:11:37 UTC (rev 8785) +++ trunk/model/src/app/net/sf/gridarta/model/mapmodel/MapSquareGrid.java 2010-11-13 18:30:20 UTC (rev 8786) @@ -20,7 +20,9 @@ package net.sf.gridarta.model.mapmodel; import java.io.Serializable; +import java.util.ArrayList; import java.util.Collection; +import java.util.List; import net.sf.gridarta.model.archetype.Archetype; import net.sf.gridarta.model.gameobject.GameObject; import net.sf.gridarta.model.maparchobject.MapArchObject; @@ -57,7 +59,7 @@ * @serial */ @NotNull - private MapSquare<G, A, R>[][] mapGrid; + private List<List<MapSquare<G, A, R>>> mapGrid; /** * Creates a new instance. @@ -70,7 +72,7 @@ mapGrid = newMapGrid(mapSize); 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); + mapGrid.get(x).set(y, new MapSquare<G, A, R>(mapModel, x, y)); } } } @@ -81,8 +83,18 @@ * @return the array */ @NotNull - private MapSquare<G, A, R>[][] newMapGrid(@NotNull final Size2D mapSize) { - return (MapSquare<G, A, R>[][]) new MapSquare<?, ?, ?>[mapSize.getWidth()][mapSize.getHeight()]; + private List<List<MapSquare<G, A, R>>> newMapGrid(@NotNull final Size2D mapSize) { + final ArrayList<List<MapSquare<G, A, R>>> result = new ArrayList<List<MapSquare<G, A, R>>>(mapSize.getWidth()); + for (int x = 0; x < mapSize.getWidth(); x++) { + final ArrayList<MapSquare<G, A, R>> column = new ArrayList<MapSquare<G, A, R>>(mapSize.getHeight()); + for (int y = 0; y < mapSize.getHeight(); y++) { + column.add(null); + } + column.trimToSize(); + result.add(column); + } + result.trimToSize(); + return result; } /** @@ -90,12 +102,11 @@ * @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 + * @throws IndexOutOfBoundsException if the location is not within bounds */ @NotNull public MapSquare<G, A, R> getMapSquare(final int x, final int y) { - return mapGrid[x][y]; + return mapGrid.get(x).get(y); } /** @@ -108,14 +119,15 @@ 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()) { - mapGrid[x][y].beginSquareChange(); + final List<MapSquare<G, A, R>> column = mapGrid.get(x); + if (column.get(y) == null) { + column.set(y, new MapSquare<G, A, R>(mapModel, x, y)); + } else if (!column.get(y).isEmpty()) { + column.get(y).beginSquareChange(); try { - mapGrid[x][y] = new MapSquare<G, A, R>(mapModel, x, y); + column.set(y, new MapSquare<G, A, R>(mapModel, x, y)); } finally { - mapGrid[x][y].endSquareChange(); + column.get(y).endSquareChange(); } } } @@ -130,7 +142,7 @@ public boolean isEmpty() { for (int x = 0; x < mapSize.getWidth(); x++) { for (int y = 0; y < mapSize.getHeight(); y++) { - if (!mapGrid[x][y].isEmpty()) { + if (!mapGrid.get(x).get(y).isEmpty()) { return false; } } @@ -143,15 +155,15 @@ * @param newSize the new size */ public void resize(@NotNull final Size2D newSize) { - final MapSquare<G, A, R>[][] newGrid = newMapGrid(newSize); + final List<List<MapSquare<G, A, R>>> newGrid = newMapGrid(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]; + newGrid.get(x).set(y, mapGrid.get(x).get(y)); } else { - newGrid[x][y] = new MapSquare<G, A, R>(mapModel, x, y); + newGrid.get(x).set(y, new MapSquare<G, A, R>(mapModel, x, y)); } } } @@ -172,7 +184,7 @@ 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]) { + for (final GameObject<G, A, R> node : mapGrid.get(x).get(y)) { objectsToDelete.add(node.getHead()); } } Modified: trunk/model/src/app/net/sf/gridarta/model/mapmodel/MapSquareIterator.java =================================================================== --- trunk/model/src/app/net/sf/gridarta/model/mapmodel/MapSquareIterator.java 2010-11-13 18:11:37 UTC (rev 8785) +++ trunk/model/src/app/net/sf/gridarta/model/mapmodel/MapSquareIterator.java 2010-11-13 18:30:20 UTC (rev 8786) @@ -90,13 +90,11 @@ */ @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 % mapWidth, point / mapWidth)); point++; return square; - } catch (final ArrayIndexOutOfBoundsException ignore) { + } catch (final IndexOutOfBoundsException ignore) { //There is no constructor that takes a cause. //noinspection ThrowInsideCatchBlockWhichIgnoresCaughtException throw new NoSuchElementException(); Modified: trunk/model/src/app/net/sf/gridarta/model/validation/checks/MapCheckerScriptChecker.java =================================================================== --- trunk/model/src/app/net/sf/gridarta/model/validation/checks/MapCheckerScriptChecker.java 2010-11-13 18:11:37 UTC (rev 8785) +++ trunk/model/src/app/net/sf/gridarta/model/validation/checks/MapCheckerScriptChecker.java 2010-11-13 18:30:20 UTC (rev 8786) @@ -190,10 +190,9 @@ } final String message = matcher.group(3); final MapSquare<G, A, R> mapSquare; - //noinspection ProhibitedExceptionCaught try { mapSquare = mapModel.getMapSquare(new Point(x, y)); - } catch (final ArrayIndexOutOfBoundsException ignored) { + } catch (final IndexOutOfBoundsException ignored) { errorCollector.collect(new MapCheckerScriptFailureError<G, A, R>(mapModel, command, "invalid map square in '" + line + "'")); continue; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2011-03-08 19:31:25
|
Revision: 8857 http://gridarta.svn.sourceforge.net/gridarta/?rev=8857&view=rev Author: akirschbaum Date: 2011-03-08 19:31:19 +0000 (Tue, 08 Mar 2011) Log Message: ----------- Remove static qualifiers. Modified Paths: -------------- trunk/model/src/app/net/sf/gridarta/model/archetype/AbstractArchetypeBuilder.java trunk/model/src/app/net/sf/gridarta/model/filter/FilterParser.java trunk/model/src/app/net/sf/gridarta/model/index/AbstractIndex.java trunk/model/src/app/net/sf/gridarta/model/io/AbstractGameObjectParser.java Modified: trunk/model/src/app/net/sf/gridarta/model/archetype/AbstractArchetypeBuilder.java =================================================================== --- trunk/model/src/app/net/sf/gridarta/model/archetype/AbstractArchetypeBuilder.java 2011-03-08 19:29:55 UTC (rev 8856) +++ trunk/model/src/app/net/sf/gridarta/model/archetype/AbstractArchetypeBuilder.java 2011-03-08 19:31:19 UTC (rev 8857) @@ -21,6 +21,7 @@ import java.util.LinkedHashMap; import java.util.Map; +import java.util.Map.Entry; import net.sf.gridarta.model.baseobject.BaseObject; import net.sf.gridarta.model.errorview.ErrorViewCategory; import net.sf.gridarta.model.errorview.ErrorViewCollector; @@ -147,7 +148,7 @@ sb.append(attribute).append('\n'); } } - for (final Map.Entry<String, String> attribute : attributes.entrySet()) { + for (final Entry<String, String> attribute : attributes.entrySet()) { sb.append(attribute.getKey()).append(' ').append(attribute.getValue()).append('\n'); } result.setObjectText(sb.toString()); Modified: trunk/model/src/app/net/sf/gridarta/model/filter/FilterParser.java =================================================================== --- trunk/model/src/app/net/sf/gridarta/model/filter/FilterParser.java 2011-03-08 19:29:55 UTC (rev 8856) +++ trunk/model/src/app/net/sf/gridarta/model/filter/FilterParser.java 2011-03-08 19:31:19 UTC (rev 8857) @@ -19,7 +19,7 @@ package net.sf.gridarta.model.filter; -import java.util.Map; +import java.util.Map.Entry; import org.jdom.Content; import org.jdom.Element; import org.jetbrains.annotations.NotNull; @@ -54,7 +54,7 @@ final Element inverted = new Element("inverted"); inverted.addContent(Boolean.toString(filterConfig.isInverted())); result.addContent(inverted); - for (final Map.Entry<String, FilterConfig<?, ?>> entry : filterConfig.getEntries().entrySet()) { + for (final Entry<String, FilterConfig<?, ?>> entry : filterConfig.getEntries().entrySet()) { final String key = entry.getKey(); final FilterConfig<?, ?> subFilterConfig = entry.getValue(); final Content filterValue = toXML(subFilterConfig); Modified: trunk/model/src/app/net/sf/gridarta/model/index/AbstractIndex.java =================================================================== --- trunk/model/src/app/net/sf/gridarta/model/index/AbstractIndex.java 2011-03-08 19:29:55 UTC (rev 8856) +++ trunk/model/src/app/net/sf/gridarta/model/index/AbstractIndex.java 2011-03-08 19:31:19 UTC (rev 8857) @@ -29,6 +29,7 @@ import java.util.HashSet; import java.util.Iterator; import java.util.Map; +import java.util.Map.Entry; import java.util.Set; import net.sf.gridarta.utils.EventListenerList2; import org.jetbrains.annotations.NotNull; @@ -111,7 +112,7 @@ synchronized (sync) { final String nameLowerCase = name.toLowerCase(); final Collection<V> result = new HashSet<V>(); - for (final Map.Entry<V, String> e : names.entrySet()) { + for (final Entry<V, String> e : names.entrySet()) { if (e.getValue().toLowerCase().contains(nameLowerCase)) { result.add(e.getKey()); } Modified: trunk/model/src/app/net/sf/gridarta/model/io/AbstractGameObjectParser.java =================================================================== --- trunk/model/src/app/net/sf/gridarta/model/io/AbstractGameObjectParser.java 2011-03-08 19:29:55 UTC (rev 8856) +++ trunk/model/src/app/net/sf/gridarta/model/io/AbstractGameObjectParser.java 2011-03-08 19:31:19 UTC (rev 8857) @@ -25,6 +25,7 @@ import java.util.Collection; import java.util.List; import java.util.Map; +import java.util.Map.Entry; import java.util.regex.Pattern; import net.sf.gridarta.model.archetype.Archetype; import net.sf.gridarta.model.archetype.ArchetypeSet; @@ -215,7 +216,7 @@ appendable.append("arch "); appendable.append(gameObject.getArchetype().getArchetypeName()); appendable.append("\n"); - for (final Map.Entry<String, String> entry : fields.entrySet()) { + for (final Entry<String, String> entry : fields.entrySet()) { appendable.append(entry.getKey()); appendable.append(entry.getValue()); appendable.append("\n"); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2011-03-26 22:09:08
|
Revision: 8884 http://gridarta.svn.sourceforge.net/gridarta/?rev=8884&view=rev Author: akirschbaum Date: 2011-03-26 22:09:02 +0000 (Sat, 26 Mar 2011) Log Message: ----------- Add serialVersionUID fields. Modified Paths: -------------- trunk/model/src/app/net/sf/gridarta/model/anim/AbstractAnimationObjects.java trunk/model/src/app/net/sf/gridarta/model/archetype/AbstractArchetype.java trunk/model/src/app/net/sf/gridarta/model/face/AbstractFaceObjects.java trunk/model/src/app/net/sf/gridarta/model/gameobject/AbstractGameObject.java trunk/model/src/app/net/sf/gridarta/model/gameobject/DefaultIsoGameObject.java trunk/model/src/app/net/sf/gridarta/model/treasurelist/TreasureObj.java Modified: trunk/model/src/app/net/sf/gridarta/model/anim/AbstractAnimationObjects.java =================================================================== --- trunk/model/src/app/net/sf/gridarta/model/anim/AbstractAnimationObjects.java 2011-03-26 22:06:45 UTC (rev 8883) +++ trunk/model/src/app/net/sf/gridarta/model/anim/AbstractAnimationObjects.java 2011-03-26 22:09:02 UTC (rev 8884) @@ -34,6 +34,11 @@ public abstract class AbstractAnimationObjects<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>> extends AbstractNamedObjects<AnimationObject> implements AnimationObjects<G, A, R> { /** + * The serial version UID. + */ + private static final long serialVersionUID = 1L; + + /** * Creates a new instance. * @param name the localized name of the object type, e.g. used in dialogs */ Modified: trunk/model/src/app/net/sf/gridarta/model/archetype/AbstractArchetype.java =================================================================== --- trunk/model/src/app/net/sf/gridarta/model/archetype/AbstractArchetype.java 2011-03-26 22:06:45 UTC (rev 8883) +++ trunk/model/src/app/net/sf/gridarta/model/archetype/AbstractArchetype.java 2011-03-26 22:09:02 UTC (rev 8884) @@ -38,6 +38,11 @@ public abstract class AbstractArchetype<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>> extends AbstractBaseObject<G, A, R, R> implements Archetype<G, A, R> { /** + * The serial version UID. + */ + private static final long serialVersionUID = 1L; + + /** * The name of this archetype. * @serial */ Modified: trunk/model/src/app/net/sf/gridarta/model/face/AbstractFaceObjects.java =================================================================== --- trunk/model/src/app/net/sf/gridarta/model/face/AbstractFaceObjects.java 2011-03-26 22:06:45 UTC (rev 8883) +++ trunk/model/src/app/net/sf/gridarta/model/face/AbstractFaceObjects.java 2011-03-26 22:09:02 UTC (rev 8884) @@ -34,6 +34,11 @@ public abstract class AbstractFaceObjects<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>> extends AbstractNamedObjects<FaceObject> implements FaceObjects<G, A, R> { /** + * The serial version UID. + */ + private static final long serialVersionUID = 1L; + + /** * Creates a new instance. * @param name localized name of the object type, e.g. used in dialogs */ Modified: trunk/model/src/app/net/sf/gridarta/model/gameobject/AbstractGameObject.java =================================================================== --- trunk/model/src/app/net/sf/gridarta/model/gameobject/AbstractGameObject.java 2011-03-26 22:06:45 UTC (rev 8883) +++ trunk/model/src/app/net/sf/gridarta/model/gameobject/AbstractGameObject.java 2011-03-26 22:09:02 UTC (rev 8884) @@ -38,6 +38,11 @@ public abstract class AbstractGameObject<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>> extends AbstractBaseObject<G, A, R, G> implements GameObject<G, A, R> { /** + * The serial version UID. + */ + private static final long serialVersionUID = 1L; + + /** * The {@link Archetype} of this game object. Set to <code>null</code> if * not yet known. * @serial Modified: trunk/model/src/app/net/sf/gridarta/model/gameobject/DefaultIsoGameObject.java =================================================================== --- trunk/model/src/app/net/sf/gridarta/model/gameobject/DefaultIsoGameObject.java 2011-03-26 22:06:45 UTC (rev 8883) +++ trunk/model/src/app/net/sf/gridarta/model/gameobject/DefaultIsoGameObject.java 2011-03-26 22:09:02 UTC (rev 8884) @@ -35,6 +35,11 @@ public abstract class DefaultIsoGameObject<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>> extends AbstractGameObject<G, A, R> { /** + * The serial version UID. + */ + private static final long serialVersionUID = 1L; + + /** * The {@link FaceObjectProviders} for looking up faces. */ @NotNull Modified: trunk/model/src/app/net/sf/gridarta/model/treasurelist/TreasureObj.java =================================================================== --- trunk/model/src/app/net/sf/gridarta/model/treasurelist/TreasureObj.java 2011-03-26 22:06:45 UTC (rev 8883) +++ trunk/model/src/app/net/sf/gridarta/model/treasurelist/TreasureObj.java 2011-03-26 22:09:02 UTC (rev 8884) @@ -32,6 +32,11 @@ public abstract class TreasureObj implements Serializable { /** + * The serial version UID. + */ + private static final long serialVersionUID = 1L; + + /** * Unset values. */ public static final int UNSET = -1; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2011-06-18 10:49:35
|
Revision: 8900 http://gridarta.svn.sourceforge.net/gridarta/?rev=8900&view=rev Author: akirschbaum Date: 2011-06-18 10:49:28 +0000 (Sat, 18 Jun 2011) Log Message: ----------- Weaken types. Modified Paths: -------------- trunk/model/src/app/net/sf/gridarta/model/baseobject/RecursiveGameObjectIterator.java trunk/model/src/app/net/sf/gridarta/model/index/AbstractIndex.java trunk/model/src/app/net/sf/gridarta/model/validation/errors/ValidationError.java Modified: trunk/model/src/app/net/sf/gridarta/model/baseobject/RecursiveGameObjectIterator.java =================================================================== --- trunk/model/src/app/net/sf/gridarta/model/baseobject/RecursiveGameObjectIterator.java 2011-06-18 09:46:17 UTC (rev 8899) +++ trunk/model/src/app/net/sf/gridarta/model/baseobject/RecursiveGameObjectIterator.java 2011-06-18 10:49:28 UTC (rev 8900) @@ -46,7 +46,7 @@ * Create a recursive GameObject Iterator. * @param container GameObjectContainer to start with */ - RecursiveGameObjectIterator(final GameObjectContainer<G, A, R> container) { + RecursiveGameObjectIterator(final Iterable<G> container) { current = container.iterator(); } Modified: trunk/model/src/app/net/sf/gridarta/model/index/AbstractIndex.java =================================================================== --- trunk/model/src/app/net/sf/gridarta/model/index/AbstractIndex.java 2011-06-18 09:46:17 UTC (rev 8899) +++ trunk/model/src/app/net/sf/gridarta/model/index/AbstractIndex.java 2011-06-18 10:49:28 UTC (rev 8900) @@ -30,7 +30,6 @@ import java.util.Iterator; import java.util.Map; import java.util.Map.Entry; -import java.util.Set; import net.sf.gridarta.utils.EventListenerList2; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -74,7 +73,7 @@ * @serial */ @NotNull - private final Set<V> pending = new HashSet<V>(); + private final Collection<V> pending = new HashSet<V>(); /** * Whether the state ({@link #timestamps} or {@link #names}) was modified Modified: trunk/model/src/app/net/sf/gridarta/model/validation/errors/ValidationError.java =================================================================== --- trunk/model/src/app/net/sf/gridarta/model/validation/errors/ValidationError.java 2011-06-18 09:46:17 UTC (rev 8899) +++ trunk/model/src/app/net/sf/gridarta/model/validation/errors/ValidationError.java 2011-06-18 10:49:28 UTC (rev 8900) @@ -169,6 +169,7 @@ * @return the game objects */ @NotNull + @SuppressWarnings("TypeMayBeWeakened") public List<G> getGameObjects() { return Collections.unmodifiableList(gameObjects); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2011-08-26 18:54:17
|
Revision: 8961 http://gridarta.svn.sourceforge.net/gridarta/?rev=8961&view=rev Author: akirschbaum Date: 2011-08-26 18:54:10 +0000 (Fri, 26 Aug 2011) Log Message: ----------- Merge identical if branches. Modified Paths: -------------- trunk/model/src/app/net/sf/gridarta/model/io/AnimationObjectsReader.java trunk/model/src/app/net/sf/gridarta/model/treasurelist/TreasureLoader.java Modified: trunk/model/src/app/net/sf/gridarta/model/io/AnimationObjectsReader.java =================================================================== --- trunk/model/src/app/net/sf/gridarta/model/io/AnimationObjectsReader.java 2011-08-26 18:51:45 UTC (rev 8960) +++ trunk/model/src/app/net/sf/gridarta/model/io/AnimationObjectsReader.java 2011-08-26 18:54:10 UTC (rev 8961) @@ -120,10 +120,8 @@ /* ignore comment lines. */ } else if (line.startsWith(startKey)) { lineNumber += processAnimation(line.substring(startKey.length()), lineNumber, in, startKey, animationObjects, errorViewCollector, path, animations); - } else if (line.equals("mina")) { + } else if (line.equals("mina") || !ignoreOtherText) { throw new AnimationParseException(startKey + "...", line2, lineNumber); - } else if (!ignoreOtherText) { - throw new AnimationParseException(startKey + "...", line2, lineNumber); } lineNumber++; Modified: trunk/model/src/app/net/sf/gridarta/model/treasurelist/TreasureLoader.java =================================================================== --- trunk/model/src/app/net/sf/gridarta/model/treasurelist/TreasureLoader.java 2011-08-26 18:51:45 UTC (rev 8960) +++ trunk/model/src/app/net/sf/gridarta/model/treasurelist/TreasureLoader.java 2011-08-26 18:54:10 UTC (rev 8961) @@ -366,24 +366,10 @@ } catch (final NumberFormatException ignored) { errorViewCollector.addWarning(ErrorViewCategory.TREASURES_ENTRY_INVALID, "list " + parentNode.getTreasureObj().getName() + ": arch " + node.getTreasureObj().getName() + " magic value is not a number."); } - } else if (line.startsWith("artifact_chance")) { + } else if (line.startsWith("artifact_chance") || line.startsWith("title") || line.startsWith("difficulty") || line.startsWith("quality_quality") || line.startsWith("quality_range") || line.startsWith("material_quality") || line.startsWith("material_range")) { // ignored for now; prevent error message when loading Daimonin/Atrinik treasure lists - } else if (line.startsWith("title")) { - // ignored for now; prevent error message when loading Daimonin/Atrinik treasure lists - } else if (line.startsWith("difficulty")) { - // ignored for now; prevent error message when loading Daimonin/Atrinik treasure lists - } else if (line.startsWith("quality_quality")) { - // ignored for now; prevent error message when loading Daimonin/Atrinik treasure lists - } else if (line.startsWith("quality_range")) { - // ignored for now; prevent error message when loading Daimonin/Atrinik treasure lists - } else if (line.startsWith("material_quality")) { - // ignored for now; prevent error message when loading Daimonin/Atrinik treasure lists - } else if (line.startsWith("material_range")) { - // ignored for now; prevent error message when loading Daimonin/Atrinik treasure lists - } else if (line.startsWith("name")) { + } else if (line.startsWith("name") || line.startsWith("t_style")) { // ignored for now; prevent error message when loading Atrinik treasure lists - } else if (line.startsWith("t_style")) { - // ignored for now; prevent error message when loading Atrinik treasure lists } else if (line.equals("no")) { final int parentChance = node.getTreasureObj().getChance(); final int chance; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2011-08-26 18:55:45
|
Revision: 8962 http://gridarta.svn.sourceforge.net/gridarta/?rev=8962&view=rev Author: akirschbaum Date: 2011-08-26 18:55:39 +0000 (Fri, 26 Aug 2011) Log Message: ----------- Suppress incorrect warnings. Modified Paths: -------------- trunk/model/src/app/net/sf/gridarta/model/baseobject/RecursiveGameObjectIterator.java trunk/model/src/app/net/sf/gridarta/model/io/RecursiveFileIterator.java Modified: trunk/model/src/app/net/sf/gridarta/model/baseobject/RecursiveGameObjectIterator.java =================================================================== --- trunk/model/src/app/net/sf/gridarta/model/baseobject/RecursiveGameObjectIterator.java 2011-08-26 18:54:10 UTC (rev 8961) +++ trunk/model/src/app/net/sf/gridarta/model/baseobject/RecursiveGameObjectIterator.java 2011-08-26 18:55:39 UTC (rev 8962) @@ -69,6 +69,7 @@ } finally { if (gameObject.isEmpty()) { try { + //noinspection LoopConditionNotUpdatedInsideLoop while (!current.hasNext()) { current = iteratorStack.pop(); } Modified: trunk/model/src/app/net/sf/gridarta/model/io/RecursiveFileIterator.java =================================================================== --- trunk/model/src/app/net/sf/gridarta/model/io/RecursiveFileIterator.java 2011-08-26 18:54:10 UTC (rev 8961) +++ trunk/model/src/app/net/sf/gridarta/model/io/RecursiveFileIterator.java 2011-08-26 18:55:39 UTC (rev 8962) @@ -70,6 +70,7 @@ iteratorStack.push(current); current = new FlatFileIterator(result); try { + //noinspection LoopConditionNotUpdatedInsideLoop while (!current.hasNext()) { current = iteratorStack.pop(); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2011-10-17 18:02:53
|
Revision: 9055 http://gridarta.svn.sourceforge.net/gridarta/?rev=9055&view=rev Author: akirschbaum Date: 2011-10-17 18:02:43 +0000 (Mon, 17 Oct 2011) Log Message: ----------- Move code from AbstractMapArchObject to DefaultMapModel. Modified Paths: -------------- trunk/model/src/app/net/sf/gridarta/model/maparchobject/AbstractMapArchObject.java trunk/model/src/app/net/sf/gridarta/model/maparchobject/MapArchObject.java trunk/model/src/app/net/sf/gridarta/model/mapmodel/DefaultMapModel.java Modified: trunk/model/src/app/net/sf/gridarta/model/maparchobject/AbstractMapArchObject.java =================================================================== --- trunk/model/src/app/net/sf/gridarta/model/maparchobject/AbstractMapArchObject.java 2011-10-17 09:22:28 UTC (rev 9054) +++ trunk/model/src/app/net/sf/gridarta/model/maparchobject/AbstractMapArchObject.java 2011-10-17 18:02:43 UTC (rev 9055) @@ -21,14 +21,9 @@ import java.awt.Point; import java.util.Arrays; -import java.util.Collection; -import java.util.Iterator; import java.util.regex.Matcher; import java.util.regex.Pattern; -import net.sf.gridarta.model.archetype.Archetype; import net.sf.gridarta.model.direction.Direction; -import net.sf.gridarta.model.gameobject.GameObject; -import net.sf.gridarta.model.mapmodel.MapSquare; import net.sf.gridarta.utils.EventListenerList2; import net.sf.gridarta.utils.Size2D; import org.jetbrains.annotations.NotNull; @@ -627,35 +622,6 @@ /** * {@inheritDoc} */ - @Override - public <G extends GameObject<G, A, R>, R extends Archetype<G, A, R>> void discardInvalidMapSquares(@NotNull final Collection<MapSquare<G, A, R>> mapSquares) { - final Iterator<MapSquare<G, A, R>> it = mapSquares.iterator(); - while (it.hasNext()) { - final MapSquare<G, A, R> mapSquare = it.next(); - if (mapSquare.getMapX() >= mapSize.getWidth() || mapSquare.getMapY() >= mapSize.getHeight()) { - it.remove(); - } - } - } - - /** - * {@inheritDoc} - */ - @Override - public <G extends GameObject<G, A, R>, R extends Archetype<G, A, R>> void discardInvalidGameObjects(@NotNull final Collection<G> gameObjects) { - final Iterator<G> it2 = gameObjects.iterator(); - while (it2.hasNext()) { - final GameObject<G, A, R> gameObject = it2.next(); - final G topGameObject = gameObject.getTopContainer(); - if (topGameObject.getContainer() == null || topGameObject.getMapX() >= mapSize.getWidth() || topGameObject.getMapY() >= mapSize.getHeight()) { - it2.remove(); - } - } - } - - /** - * {@inheritDoc} - */ @NotNull @Override @SuppressWarnings("unchecked") Modified: trunk/model/src/app/net/sf/gridarta/model/maparchobject/MapArchObject.java =================================================================== --- trunk/model/src/app/net/sf/gridarta/model/maparchobject/MapArchObject.java 2011-10-17 09:22:28 UTC (rev 9054) +++ trunk/model/src/app/net/sf/gridarta/model/maparchobject/MapArchObject.java 2011-10-17 18:02:43 UTC (rev 9055) @@ -21,11 +21,7 @@ import java.awt.Point; import java.io.Serializable; -import java.util.Collection; -import net.sf.gridarta.model.archetype.Archetype; import net.sf.gridarta.model.direction.Direction; -import net.sf.gridarta.model.gameobject.GameObject; -import net.sf.gridarta.model.mapmodel.MapSquare; import net.sf.gridarta.utils.Size2D; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -295,16 +291,4 @@ */ boolean isPointValid(@Nullable Point pos); - /** - * Discards map squares that are out of map bounds. - * @param mapSquares the map squares to check - */ - <G extends GameObject<G, A, R>, R extends Archetype<G, A, R>> void discardInvalidMapSquares(@NotNull Collection<MapSquare<G, A, R>> mapSquares); - - /** - * Discards game objects that are out of map bounds. - * @param gameObjects the game objects to check - */ - <G extends GameObject<G, A, R>, R extends Archetype<G, A, R>> void discardInvalidGameObjects(@NotNull Collection<G> gameObjects); - } // interface MapArchObject Modified: trunk/model/src/app/net/sf/gridarta/model/mapmodel/DefaultMapModel.java =================================================================== --- trunk/model/src/app/net/sf/gridarta/model/mapmodel/DefaultMapModel.java 2011-10-17 09:22:28 UTC (rev 9054) +++ trunk/model/src/app/net/sf/gridarta/model/mapmodel/DefaultMapModel.java 2011-10-17 18:02:43 UTC (rev 9055) @@ -335,15 +335,46 @@ } mapGrid.resize(newSize); - mapArchObject.discardInvalidMapSquares(changedSquares); - mapArchObject.<G, R>discardInvalidGameObjects(changedGameObjects); - mapArchObject.<G, R>discardInvalidGameObjects(transientChangedGameObjects); + discardInvalidMapSquares(changedSquares, mapSize); + discardInvalidGameObjects(changedGameObjects, mapSize); + discardInvalidGameObjects(transientChangedGameObjects, mapSize); fireMapSizeChanged(newSize); } } /** + * Discards map squares that are out of map bounds. + * @param mapSquares the map squares to check + * @param mapSize the new map size + */ + private void discardInvalidMapSquares(@NotNull final Collection<MapSquare<G, A, R>> mapSquares, @NotNull final Size2D mapSize) { + final Iterator<MapSquare<G, A, R>> it = mapSquares.iterator(); + while (it.hasNext()) { + final MapSquare<G, A, R> mapSquare = it.next(); + if (mapSquare.getMapX() >= mapSize.getWidth() || mapSquare.getMapY() >= mapSize.getHeight()) { + it.remove(); + } + } + } + + /** + * Discards game objects that are out of map bounds. + * @param gameObjects the game objects to check + * @param mapSize the new map size + */ + private void discardInvalidGameObjects(@NotNull final Iterable<G> gameObjects, @NotNull final Size2D mapSize) { + final Iterator<G> it2 = gameObjects.iterator(); + while (it2.hasNext()) { + final GameObject<G, A, R> gameObject = it2.next(); + final G topGameObject = gameObject.getTopContainer(); + if (topGameObject.getContainer() == null || topGameObject.getMapX() >= mapSize.getWidth() || topGameObject.getMapY() >= mapSize.getHeight()) { + it2.remove(); + } + } + } + + /** * {@inheritDoc} */ @Override This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |