-
Notifications
You must be signed in to change notification settings - Fork 89
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Handle detecting changes to include files
Signed-off-by: applenick <[email protected]>
- Loading branch information
Showing
11 changed files
with
148 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
22 changes: 22 additions & 0 deletions
22
core/src/main/java/tc/oc/pgm/api/map/includes/StoredMapInclude.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
package tc.oc.pgm.api.map.includes; | ||
|
||
/** | ||
* A snapshot of {@link MapInclude} info, used to determine when include files have been updated. * | ||
*/ | ||
public interface StoredMapInclude { | ||
|
||
/** | ||
* Gets the unique include id, used to reference a {@link MapInclude}. | ||
* | ||
* @return A unique include id | ||
*/ | ||
String getIncludeId(); | ||
|
||
/** | ||
* Gets whether the associated {@link MapInclude} files have changed since last loading. | ||
* | ||
* @param time The current system time | ||
* @return True if given time is newer than last modified time | ||
*/ | ||
boolean hasBeenModified(long time); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
25 changes: 25 additions & 0 deletions
25
core/src/main/java/tc/oc/pgm/map/includes/StoredMapIncludeImpl.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
package tc.oc.pgm.map.includes; | ||
|
||
import java.util.concurrent.atomic.AtomicLong; | ||
import tc.oc.pgm.api.map.includes.StoredMapInclude; | ||
|
||
public class StoredMapIncludeImpl implements StoredMapInclude { | ||
|
||
private final String includeId; | ||
private final AtomicLong lastModified; | ||
|
||
public StoredMapIncludeImpl(String includeId, long lastModified) { | ||
this.includeId = includeId; | ||
this.lastModified = new AtomicLong(lastModified); | ||
} | ||
|
||
@Override | ||
public String getIncludeId() { | ||
return includeId; | ||
} | ||
|
||
@Override | ||
public boolean hasBeenModified(long time) { | ||
return time > lastModified.get(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters