Subversion Repository Public Repository

litesoft

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
package com.esotericsoftware.filesystem;

import com.esotericsoftware.scar.*;

import java.io.*;
import java.util.*;

public final class RootedPathsCollection {
    private long mGreatestLastModified;
    private final Map<File, RootedPaths> mPaths = new HashMap<File, RootedPaths>();

    public void add( FilePath pFilePath ) {
        File zParentDir = pFilePath.getSomeParentDir();
        RootedPaths zExistingRootedPaths = mPaths.get( zParentDir );
        if ( zExistingRootedPaths == null ) {
            mPaths.put( zParentDir, zExistingRootedPaths = new RootedPaths( zParentDir ) );
        }
        zExistingRootedPaths.addCanonicalRelativePath( pFilePath.getFileSubPath() );
        mGreatestLastModified = Math.max( mGreatestLastModified, zExistingRootedPaths.getGreatestLastModified() );
    }

    public void add( RootedPaths pRootedPaths ) {
        Utils.assertNotNull( "RootedPaths", pRootedPaths );
        File zRootDirectory = pRootedPaths.getCanonicalRootDirectory();
        RootedPaths zExistingRootedPaths = mPaths.get( zRootDirectory );
        if ( zExistingRootedPaths == null ) {
            mPaths.put( zRootDirectory, zExistingRootedPaths = pRootedPaths );
        } else {
            zExistingRootedPaths.mergeIn( pRootedPaths );
        }
        mGreatestLastModified = Math.max( mGreatestLastModified, zExistingRootedPaths.getGreatestLastModified() );
    }

    public long getGreatestLastModified() {
        return mGreatestLastModified;
    }

    public RootedPaths[] getRootedPaths() {
        return mPaths.values().toArray( new RootedPaths[mPaths.size()] );
    }

    public boolean isEmpty() {
        return mPaths.isEmpty() || (count() == 0);
    }

    public int count() {
        int zCount = 0;
        for ( RootedPaths zPaths : mPaths.values() ) {
            zCount += zPaths.count();
        }
        return zCount;
    }

    public List<FilePath> collectPaths( List<FilePath> pPaths ) {
        for ( RootedPaths zPaths : mPaths.values() ) {
            zPaths.collectPaths( pPaths );
        }
        return pPaths;
    }

    /* Package Friendly */
    void mergeIn( RootedPathsCollection them ) {
        for ( RootedPaths zPaths : them.mPaths.values() ) {
            add( zPaths );
        }
    }
}

Commits for litesoft/trunk/Java/ScarPlus/src/com/esotericsoftware/filesystem/RootedPathsCollection.java

Diff revisions: vs.
Revision Author Commited Message
959 Diff Diff GeorgeS picture GeorgeS Sat 19 Jul, 2014 15:27:50 +0000

Scar update

943 Diff Diff GeorgeS picture GeorgeS Tue 03 Jun, 2014 04:25:50 +0000

Extracting commonfoundation

939 Diff Diff GeorgeS picture GeorgeS Mon 02 Jun, 2014 21:30:31 +0000

Extracting commonfoundation

826 Diff Diff GeorgeS picture GeorgeS Mon 20 Aug, 2012 02:46:37 +0000
313 GeorgeS picture GeorgeS Wed 13 Jul, 2011 20:17:30 +0000