Subversion Repository Public Repository

litesoft

Diff Revisions 958 vs 959 for /trunk/Java/ScarPlus/src/com/esotericsoftware/filesystem/RootedPathsCollection.java

Diff revisions: vs.
  @@ -5,78 +5,62 @@
5 5 import java.io.*;
6 6 import java.util.*;
7 7
8 - public final class RootedPathsCollection
9 - {
8 + public final class RootedPathsCollection {
10 9 private long mGreatestLastModified;
11 10 private final Map<File, RootedPaths> mPaths = new HashMap<File, RootedPaths>();
12 11
13 - public void add( FilePath pFilePath )
14 - {
12 + public void add( FilePath pFilePath ) {
15 13 File zParentDir = pFilePath.getSomeParentDir();
16 14 RootedPaths zExistingRootedPaths = mPaths.get( zParentDir );
17 - if ( zExistingRootedPaths == null )
18 - {
15 + if ( zExistingRootedPaths == null ) {
19 16 mPaths.put( zParentDir, zExistingRootedPaths = new RootedPaths( zParentDir ) );
20 17 }
21 18 zExistingRootedPaths.addCanonicalRelativePath( pFilePath.getFileSubPath() );
22 19 mGreatestLastModified = Math.max( mGreatestLastModified, zExistingRootedPaths.getGreatestLastModified() );
23 20 }
24 21
25 - public void add( RootedPaths pRootedPaths )
26 - {
22 + public void add( RootedPaths pRootedPaths ) {
27 23 Utils.assertNotNull( "RootedPaths", pRootedPaths );
28 24 File zRootDirectory = pRootedPaths.getCanonicalRootDirectory();
29 25 RootedPaths zExistingRootedPaths = mPaths.get( zRootDirectory );
30 - if ( zExistingRootedPaths == null )
31 - {
26 + if ( zExistingRootedPaths == null ) {
32 27 mPaths.put( zRootDirectory, zExistingRootedPaths = pRootedPaths );
33 - }
34 - else
35 - {
28 + } else {
36 29 zExistingRootedPaths.mergeIn( pRootedPaths );
37 30 }
38 31 mGreatestLastModified = Math.max( mGreatestLastModified, zExistingRootedPaths.getGreatestLastModified() );
39 32 }
40 33
41 - public long getGreatestLastModified()
42 - {
34 + public long getGreatestLastModified() {
43 35 return mGreatestLastModified;
44 36 }
45 37
46 - public RootedPaths[] getRootedPaths()
47 - {
38 + public RootedPaths[] getRootedPaths() {
48 39 return mPaths.values().toArray( new RootedPaths[mPaths.size()] );
49 40 }
50 41
51 - public boolean isEmpty()
52 - {
42 + public boolean isEmpty() {
53 43 return mPaths.isEmpty() || (count() == 0);
54 44 }
55 45
56 - public int count()
57 - {
46 + public int count() {
58 47 int zCount = 0;
59 - for ( RootedPaths zPaths : mPaths.values() )
60 - {
48 + for ( RootedPaths zPaths : mPaths.values() ) {
61 49 zCount += zPaths.count();
62 50 }
63 51 return zCount;
64 52 }
65 53
66 - public List<FilePath> collectPaths( List<FilePath> pPaths )
67 - {
68 - for ( RootedPaths zPaths : mPaths.values() )
69 - {
54 + public List<FilePath> collectPaths( List<FilePath> pPaths ) {
55 + for ( RootedPaths zPaths : mPaths.values() ) {
70 56 zPaths.collectPaths( pPaths );
71 57 }
72 58 return pPaths;
73 59 }
74 60
75 61 /* Package Friendly */
76 - void mergeIn( RootedPathsCollection them )
77 - {
78 - for ( RootedPaths zPaths : them.mPaths.values() )
79 - {
62 + void mergeIn( RootedPathsCollection them ) {
63 + for ( RootedPaths zPaths : them.mPaths.values() ) {
80 64 add( zPaths );
81 65 }
82 66 }