Skip to content

Commit

Permalink
Merge pull request #84 from DevFactory/release/Collection.isEmpty()-s…
Browse files Browse the repository at this point in the history
…hould-be-used-to-test-for-emptiness-fix-1

squid:S1155 - Collection.isEmpty() should be used to test for emptiness
  • Loading branch information
azakhary committed Mar 30, 2016
2 parents c9da4d0 + 2b6187c commit 1aba2aa
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 18 deletions.
4 changes: 2 additions & 2 deletions src/com/brashmonkey/spriter/XmlReader.java
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,7 @@ else if (data[p] > _xml_trans_keys[_mid + 1])
if (data[i] == '\n') lineNumber++;
throw new SpriterException("Error parsing XML on line " + lineNumber + " near: "
+ new String(data, p, Math.min(32, pe - p)));
} else if (elements.size() != 0) {
} else if (!elements.isEmpty()) {
Element element = elements.get(elements.size()-1);
elements.clear();
throw new SpriterException("Error parsing XML, unclosed element: " + element.getName());
Expand Down Expand Up @@ -404,7 +404,7 @@ protected void text (String text) {
protected void close () {
root = elements.get(elements.size()-1);
elements.remove(elements.size()-1);
current = elements.size() > 0 ? elements.get(elements.size()-1) : null;
current = !elements.isEmpty() ? elements.get(elements.size()-1) : null;
}

static public class Element {
Expand Down
26 changes: 13 additions & 13 deletions src/com/uwsoft/editor/renderer/data/CompositeVO.java
Original file line number Diff line number Diff line change
Expand Up @@ -188,19 +188,19 @@ public void clear() {
}

public boolean isEmpty() {
return sComposites.size() == 0 &&
sImage9patchs.size() == 0 &&
sImages.size() == 0 &&
sSpriteAnimations.size() == 0 &&
sLabels.size() == 0 &&
sLights.size() == 0 &&
sParticleEffects.size() == 0 &&
sSpriteAnimations.size() == 0 &&
sSpriterAnimations.size() == 0 &&
sSpineAnimations.size() == 0 &&
sSelectBoxes.size() == 0 &&
sTextBox.size() == 0 &&
sColorPrimitives.size() == 0;
return sComposites.isEmpty() &&
sImage9patchs.isEmpty() &&
sImages.isEmpty() &&
sSpriteAnimations.isEmpty() &&
sLabels.isEmpty() &&
sLights.isEmpty() &&
sParticleEffects.isEmpty() &&
sSpriteAnimations.isEmpty() &&
sSpriterAnimations.isEmpty() &&
sSpineAnimations.isEmpty() &&
sSelectBoxes.isEmpty() &&
sTextBox.isEmpty() &&
sColorPrimitives.isEmpty();
}

public String[] getRecursiveParticleEffectsList() {
Expand Down
6 changes: 3 additions & 3 deletions src/com/uwsoft/editor/renderer/utils/PolygonUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public static Array<Vector2[]> mergeTouchingPolygons(Vector2[][] polys) {
uniqueEdges.removeAll(duplicateEdges);

Array<Vector2[]> result = new Array<Vector2[]>();
while(uniqueEdges.size() > 0) {
while(!uniqueEdges.isEmpty()) {
Vector2[] mesh = extractClosedLoop(uniqueEdges);
mesh = clearUnnecessaryVertices(mesh);
result.add(mesh);
Expand Down Expand Up @@ -74,10 +74,10 @@ public static Vector2[] extractClosedLoop(Set<Edge> edges) {
Edge edge = (Edge) edges.toArray()[0];
edges.remove(edge);
sortedList.add(edge);
while(edges.size() > 0) {
while(!edges.isEmpty()) {
boolean result2 = false;
boolean result1 = appendNextEdge(sortedList, edges);
if(edges.size() > 0) {
if(!edges.isEmpty()) {
result2 = appendPrevEdge(sortedList, edges);
}
if(!result1 && !result2) {
Expand Down

0 comments on commit 1aba2aa

Please sign in to comment.