public class SnapshotRepository extends Object
| Modifier and Type | Field and Description |
|---|---|
protected List<SnapshotDateParser> |
dateParsers |
protected File |
dir |
| Constructor and Description |
|---|
SnapshotRepository(File dir)
Create a new instance of a repository.
|
SnapshotRepository(String dir)
Create a new instance of a repository.
|
| Modifier and Type | Method and Description |
|---|---|
protected void |
detectDate(Snapshot snapshot)
Attempt to detect a snapshot's date and assign it.
|
Snapshot |
getDefaultSnapshot(String world)
Get the default snapshot.
|
File |
getDirectory()
Get the snapshot directory.
|
Snapshot |
getSnapshot(String name)
Get a snapshot.
|
Snapshot |
getSnapshotAfter(Calendar date,
String world)
Get the first snapshot after a date.
|
Snapshot |
getSnapshotBefore(Calendar date,
String world)
Get the first snapshot before a date.
|
List<Snapshot> |
getSnapshots(boolean newestFirst,
String worldName)
Get a list of snapshots in a directory.
|
protected boolean |
isValidSnapshot(File file)
Check to see if a snapshot is valid.
|
boolean |
isValidSnapshotName(String snapshot)
Check to see if a snapshot is valid.
|
protected File dir
protected List<SnapshotDateParser> dateParsers
public SnapshotRepository(File dir)
dir - the directorypublic SnapshotRepository(String dir)
dir - the directorypublic List<Snapshot> getSnapshots(boolean newestFirst, String worldName) throws MissingWorldException
newestFirst - true to get the newest firstMissingWorldException@Nullable public Snapshot getSnapshotAfter(Calendar date, String world) throws MissingWorldException
date - a dateMissingWorldException@Nullable public Snapshot getSnapshotBefore(Calendar date, String world) throws MissingWorldException
date - a dateMissingWorldExceptionprotected void detectDate(Snapshot snapshot)
snapshot - the snapshot@Nullable public Snapshot getDefaultSnapshot(String world) throws MissingWorldException
world - the world nameMissingWorldExceptionpublic boolean isValidSnapshotName(String snapshot)
snapshot - a snapshot nameprotected boolean isValidSnapshot(File file)
file - the file to the snapshotpublic Snapshot getSnapshot(String name) throws InvalidSnapshotException
name - the name of the snapshotInvalidSnapshotException - if the snapshot is invalidpublic File getDirectory()
Copyright © 2010-2014. All Rights Reserved.