-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #375 from gdgib/G2-1645-DraftBasicAPIs
G2-1645 Draft basic API and tests
- Loading branch information
Showing
19 changed files
with
187 additions
and
103 deletions.
There are no files selected for viewing
5 changes: 5 additions & 0 deletions
5
ax-adt/src/main/java/com/g2forge/alexandria/adt/trie/Node.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,5 @@ | ||
package com.g2forge.alexandria.adt.trie; | ||
|
||
import com.g2forge.alexandria.adt.graph.v2.member.ASingleGraphMember; | ||
|
||
public class Node extends ASingleGraphMember {} |
7 changes: 0 additions & 7 deletions
7
ax-path/src/main/java/com/g2forge/alexandria/path/directory/IDirectorySystem.java
This file was deleted.
Oops, something went wrong.
4 changes: 2 additions & 2 deletions
4
ax-path/src/main/java/com/g2forge/alexandria/path/file/IFile.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
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
7 changes: 7 additions & 0 deletions
7
ax-path/src/main/java/com/g2forge/alexandria/path/file/system/IFileSystem.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,7 @@ | ||
package com.g2forge.alexandria.path.file.system; | ||
|
||
import com.g2forge.alexandria.path.path.IPath; | ||
|
||
public interface IFileSystem<T> { | ||
public IPath<T> normalize(IPath<T> path); | ||
} |
16 changes: 8 additions & 8 deletions
16
...h/directory/IStandardDirectorySystem.java → ...path/file/system/IStandardFileSystem.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
10 changes: 5 additions & 5 deletions
10
...ndria/path/directory/DirectorySystem.java → ...andria/path/file/system/OSFileSystem.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
9 changes: 0 additions & 9 deletions
9
ax-path/src/main/java/com/g2forge/alexandria/path/format/IPathFormat.java
This file was deleted.
Oops, something went wrong.
14 changes: 0 additions & 14 deletions
14
ax-path/src/main/java/com/g2forge/alexandria/path/format/IStandardPathFormat.java
This file was deleted.
Oops, something went wrong.
2 changes: 1 addition & 1 deletion
2
...va/com/g2forge/alexandria/path/IPath.java → ...m/g2forge/alexandria/path/path/IPath.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
2 changes: 1 addition & 1 deletion
2
...ava/com/g2forge/alexandria/path/Path.java → ...om/g2forge/alexandria/path/path/Path.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 |
---|---|---|
@@ -1,4 +1,4 @@ | ||
package com.g2forge.alexandria.path; | ||
package com.g2forge.alexandria.path.path; | ||
|
||
import java.util.Collection; | ||
|
||
|
13 changes: 13 additions & 0 deletions
13
ax-path/src/main/java/com/g2forge/alexandria/path/path/format/IPathFormat.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,13 @@ | ||
package com.g2forge.alexandria.path.path.format; | ||
|
||
import com.g2forge.alexandria.path.path.IPath; | ||
|
||
public interface IPathFormat<T> { | ||
public T toComponent(String component); | ||
|
||
public IPath<T> toPath(String path); | ||
|
||
public String toString(IPath<T> path); | ||
|
||
public String toString(T component); | ||
} |
23 changes: 23 additions & 0 deletions
23
ax-path/src/main/java/com/g2forge/alexandria/path/path/format/IStandardPathFormat.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,23 @@ | ||
package com.g2forge.alexandria.path.path.format; | ||
|
||
import java.util.regex.Pattern; | ||
import java.util.stream.Collectors; | ||
import java.util.stream.Stream; | ||
|
||
import com.g2forge.alexandria.path.path.IPath; | ||
import com.g2forge.alexandria.path.path.Path; | ||
|
||
public interface IStandardPathFormat<T> extends IPathFormat<T> { | ||
public String getSeparator(); | ||
|
||
@Override | ||
public default IPath<T> toPath(String path) { | ||
final String[] components = path.split(Pattern.quote(getSeparator())); | ||
return new Path<>(Stream.of(components).map(this::toComponent).collect(Collectors.toList())); | ||
} | ||
|
||
@Override | ||
public default String toString(IPath<T> path) { | ||
return path.getComponents().stream().map(this::toString).collect(Collectors.joining(getSeparator())); | ||
} | ||
} |
9 changes: 7 additions & 2 deletions
9
...ge/alexandria/path/format/PathFormat.java → ...andria/path/path/format/OSPathFormat.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
33 changes: 33 additions & 0 deletions
33
ax-path/src/test/java/com/g2forge/alexandria/path/file/TestLocalFile.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,33 @@ | ||
package com.g2forge.alexandria.path.file; | ||
|
||
import java.nio.file.Path; | ||
import java.nio.file.Paths; | ||
|
||
import org.junit.Test; | ||
|
||
import com.g2forge.alexandria.test.HAssert; | ||
|
||
import lombok.Getter; | ||
|
||
public class TestLocalFile { | ||
@Getter(lazy = true) | ||
private final Path directory = Paths.get(System.getProperty("user.home")); | ||
|
||
@Test | ||
public void get() { | ||
final Path directory = getDirectory(); | ||
HAssert.assertEquals(new LocalFile(directory), new LocalFile(directory).get(".")); | ||
} | ||
|
||
@Test | ||
public void getParent() { | ||
final Path directory = getDirectory(); | ||
HAssert.assertEquals(new LocalFile(directory.getParent()), new LocalFile(directory).getParent()); | ||
} | ||
|
||
@Test | ||
public void isDirectory() { | ||
final Path directory = getDirectory(); | ||
HAssert.assertTrue(new LocalFile(directory).isDirectory()); | ||
} | ||
} |
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
39 changes: 0 additions & 39 deletions
39
ax-path/src/test/java/com/g2forge/alexandria/path/format/TestPathFormat.java
This file was deleted.
Oops, something went wrong.
11 changes: 5 additions & 6 deletions
11
...com/g2forge/alexandria/path/TestPath.java → ...2forge/alexandria/path/path/TestPath.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
Oops, something went wrong.