Skip to content

Commit

Permalink
checkstyle
Browse files Browse the repository at this point in the history
git-svn-id: https://josm.openstreetmap.de/svn/trunk@18930 0c6e7542-c601-0410-84e7-c038aed88b3b
  • Loading branch information
stoecker committed Dec 31, 2023
1 parent 462e0f9 commit 126da89
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 12 deletions.
15 changes: 7 additions & 8 deletions src/org/openstreetmap/josm/gui/animation/DropImage.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

/**
* A random image displayed when {@link ChristmasExtension} is active.
* @since xxx
* @since 18929
*/
class DropImage implements IAnimObject {
private static final Random seed = new Random();
Expand Down Expand Up @@ -73,24 +73,23 @@ private Image getImage() {
if (url != null && url.getProtocol().equals("file")) {
ArrayList<File> dirs = new ArrayList<File>();

Check failure on line 74 in src/org/openstreetmap/josm/gui/animation/DropImage.java

View workflow job for this annotation

GitHub Actions / Analyze

Code Style/UseDiamondOperator

https://pmd.github.io/pmd-6.55.0/pmd_rules_java_codestyle.html#usediamondoperator
dirs.add(new File(url.toURI()));
do
{
for(File f : dirs.remove(0).listFiles()) {
if(f.isFile()) {
do {
for (File f : dirs.remove(0).listFiles()) {
if (f.isFile()) {
result.add(f.getPath());
} else {
dirs.add(f);
}
}
} while(dirs.size() > 0);
} while (dirs.size() > 0);

Check failure on line 84 in src/org/openstreetmap/josm/gui/animation/DropImage.java

View workflow job for this annotation

GitHub Actions / Analyze

Best Practices/UseCollectionIsEmpty

https://pmd.github.io/pmd-6.55.0/pmd_rules_java_bestpractices.html#usecollectionisempty
name = result.get(seed.nextInt(result.size()));
} else if (url != null && url.getProtocol().equals("jar")) {
String jarPath = url.getPath().substring(5, url.getPath().indexOf("!"));
JarFile jar = new JarFile(URLDecoder.decode(jarPath, "UTF-8"));

Check failure on line 88 in src/org/openstreetmap/josm/gui/animation/DropImage.java

View workflow job for this annotation

GitHub Actions / Analyze

Error Prone/CloseResource

https://pmd.github.io/pmd-6.55.0/pmd_rules_java_errorprone.html#closeresource
Enumeration<JarEntry> entries = jar.entries();
while(entries.hasMoreElements()) {
while (entries.hasMoreElements()) {
String fileName = entries.nextElement().getName();
if(fileName.startsWith(path) && !fileName.endsWith("/")) {
if (fileName.startsWith(path) && !fileName.endsWith("/")) {
result.add(fileName.substring(7));
}
}
Expand Down
17 changes: 13 additions & 4 deletions src/org/openstreetmap/josm/gui/animation/IAnimObject.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,22 @@

/**
* An animated object
* @since xxx
* @since 18929
*/
public interface IAnimObject {

public void paint(Graphics g);
/** Paint the object
* @param g the graphics object to paint to
*/
void paint(Graphics g);

public void setExtend(int w, int h);
/** Set the extend when window size changed
* @param w window width
* @param h window height
*/
void setExtend(int w, int h);

public void animate();
/** Animate the object - Cause next step of animation
*/
void animate();
}

0 comments on commit 126da89

Please sign in to comment.