-
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 #374 from gdgib/G2-1644-CreatePath
G2-1644 Create ax-path module & sketch API
- Loading branch information
Showing
48 changed files
with
464 additions
and
44 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
4 changes: 2 additions & 2 deletions
4
ax-adt/src/main/java/com/g2forge/alexandria/adt/graph/v2/IGraphModifier.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
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 @@ | ||
/.settings/ | ||
/target/ | ||
/.classpath | ||
/.project | ||
*.factorypath |
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,18 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<project xmlns="http://maven.apache.org/POM/4.0.0" | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
|
||
<modelVersion>4.0.0</modelVersion> | ||
<artifactId>ax-collection</artifactId> | ||
|
||
<parent> | ||
<groupId>com.g2forge.alexandria</groupId> | ||
<artifactId>ax-project</artifactId> | ||
<version>0.0.19-SNAPSHOT</version> | ||
<relativePath>../ax-project/pom.xml</relativePath> | ||
</parent> | ||
|
||
<name>Alexandria Collections</name> | ||
<description>Extended Collections API.</description> | ||
</project> |
2 changes: 1 addition & 1 deletion
2
...andria/adt/collection/CircularBuffer.java → ...alexandria/collection/CircularBuffer.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
.../adt/collection/CollectionCollection.java → ...dria/collection/CollectionCollection.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
...adt/collection/DCollectionCollection.java → ...ria/collection/DCollectionCollection.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
...a/adt/collection/DIteratorCollection.java → ...ndria/collection/DIteratorCollection.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
...ria/adt/collection/DStreamCollection.java → ...xandria/collection/DStreamCollection.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
...ndria/adt/collection/EmptyCollection.java → ...lexandria/collection/EmptyCollection.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
.../adt/collection/ICloseableCollection.java → ...dria/collection/ICloseableCollection.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
...lexandria/adt/collection/ICollection.java → ...ge/alexandria/collection/ICollection.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
.../adt/collection/IndexedGeneratorList.java → ...dria/collection/IndexedGeneratorList.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
...dria/adt/collection/IntegerRangeList.java → ...exandria/collection/IntegerRangeList.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
...xandria/adt/collection/LongRangeList.java → .../alexandria/collection/LongRangeList.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
...dria/adt/collection/SingleCollection.java → ...exandria/collection/SingleCollection.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
...lection/collector/ICollectionBuilder.java → ...lection/collector/ICollectionBuilder.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
.../adt/collection/collector/ICollector.java → ...dria/collection/collector/ICollector.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
4 changes: 2 additions & 2 deletions
4
...ntations/CollectionCollectionBuilder.java → ...ntations/CollectionCollectionBuilder.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
4 changes: 2 additions & 2 deletions
4
...ctor/implementations/CollectorSetter.java → ...ctor/implementations/CollectorSetter.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
4 changes: 2 additions & 2 deletions
4
...plementations/FixedCollectionBuilder.java → ...plementations/FixedCollectionBuilder.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
4 changes: 2 additions & 2 deletions
4
.../implementations/SeparatingCollector.java → .../implementations/SeparatingCollector.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
4 changes: 2 additions & 2 deletions
4
...ctor/implementations/StringCollector.java → ...ctor/implementations/StringCollector.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
6 changes: 3 additions & 3 deletions
6
...lection/strategy/ACollectionStrategy.java → ...lection/strategy/ACollectionStrategy.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
4 changes: 2 additions & 2 deletions
4
...lection/strategy/ICollectionStrategy.java → ...lection/strategy/ICollectionStrategy.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
4 changes: 2 additions & 2 deletions
4
...y/implementations/CollectionStrategy.java → ...y/implementations/CollectionStrategy.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
/.settings/ | ||
/target/ | ||
/.classpath | ||
/.project | ||
*.factorypath |
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,27 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<project xmlns="http://maven.apache.org/POM/4.0.0" | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
|
||
<modelVersion>4.0.0</modelVersion> | ||
<artifactId>ax-path</artifactId> | ||
|
||
<parent> | ||
<groupId>com.g2forge.alexandria</groupId> | ||
<artifactId>ax-project</artifactId> | ||
<version>0.0.19-SNAPSHOT</version> | ||
<relativePath>../ax-project/pom.xml</relativePath> | ||
</parent> | ||
|
||
<name>Alexandria Paths</name> | ||
<description>Generic Path API - flexible enough to be used for loca & | ||
remote filesystems or even abstract tree data structures.</description> | ||
|
||
<dependencies> | ||
<dependency> | ||
<groupId>com.g2forge.alexandria</groupId> | ||
<artifactId>ax-collection</artifactId> | ||
<version>${project.version}</version> | ||
</dependency> | ||
</dependencies> | ||
</project> |
11 changes: 11 additions & 0 deletions
11
ax-path/src/main/java/com/g2forge/alexandria/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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
package com.g2forge.alexandria.path; | ||
|
||
import com.g2forge.alexandria.collection.ICollection; | ||
|
||
public interface IPath<T> { | ||
public ICollection<T> getComponents(); | ||
|
||
public IPath<T> resolve(IPath<T> subpath); | ||
|
||
public boolean isEmpty(); | ||
} |
47 changes: 47 additions & 0 deletions
47
ax-path/src/main/java/com/g2forge/alexandria/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 |
---|---|---|
@@ -0,0 +1,47 @@ | ||
package com.g2forge.alexandria.path; | ||
|
||
import java.util.Collection; | ||
|
||
import com.g2forge.alexandria.collection.CollectionCollection; | ||
import com.g2forge.alexandria.collection.EmptyCollection; | ||
import com.g2forge.alexandria.collection.ICollection; | ||
import com.g2forge.alexandria.java.core.helpers.HCollection; | ||
|
||
import lombok.Builder; | ||
import lombok.Data; | ||
import lombok.RequiredArgsConstructor; | ||
|
||
@Data | ||
@Builder(toBuilder = true) | ||
@RequiredArgsConstructor | ||
public class Path<T> implements IPath<T> { | ||
protected static final Path<Object> EMPTY = new Path<>(); | ||
|
||
@SuppressWarnings("unchecked") | ||
public static <T> Path<T> createEmpty() { | ||
return (Path<T>) EMPTY; | ||
} | ||
|
||
protected final ICollection<T> components; | ||
|
||
public Path(Collection<T> components) { | ||
this(components.size() < 1 ? EmptyCollection.create() : new CollectionCollection<>(components)); | ||
} | ||
|
||
@SafeVarargs | ||
public Path(T... components) { | ||
this(components.length < 1 ? EmptyCollection.create() : new CollectionCollection<>(components)); | ||
} | ||
|
||
@Override | ||
public boolean isEmpty() { | ||
return getComponents().isEmpty(); | ||
} | ||
|
||
@Override | ||
public IPath<T> resolve(IPath<T> subpath) { | ||
if (isEmpty()) return subpath; | ||
if (subpath.isEmpty()) return this; | ||
return new Path<>(HCollection.concatenate(getComponents().toCollection(), subpath.getComponents().toCollection())); | ||
} | ||
} |
22 changes: 22 additions & 0 deletions
22
ax-path/src/main/java/com/g2forge/alexandria/path/directory/DirectorySystem.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 com.g2forge.alexandria.path.directory; | ||
|
||
import com.g2forge.alexandria.java.core.enums.EnumException; | ||
import com.g2forge.alexandria.java.platform.HPlatform; | ||
import com.g2forge.alexandria.java.platform.PlatformCategory; | ||
|
||
public enum DirectorySystem implements IStandardDirectorySystem { | ||
Microsoft, | ||
POSIX; | ||
|
||
public static DirectorySystem getDirectorySystem() { | ||
final PlatformCategory category = HPlatform.getPlatform().getCategory(); | ||
switch (category) { | ||
case Microsoft: | ||
return DirectorySystem.Microsoft; | ||
case Posix: | ||
return DirectorySystem.POSIX; | ||
default: | ||
throw new EnumException(PlatformCategory.class, category); | ||
} | ||
} | ||
} |
7 changes: 7 additions & 0 deletions
7
ax-path/src/main/java/com/g2forge/alexandria/path/directory/IDirectorySystem.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.directory; | ||
|
||
import com.g2forge.alexandria.path.IPath; | ||
|
||
public interface IDirectorySystem<T> { | ||
public IPath<T> normalize(IPath<T> path); | ||
} |
Oops, something went wrong.