Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
03c515e
commit 46ed9fe
Showing
45 changed files
with
1,373 additions
and
877 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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,26 @@ | ||
package eu.heronnet.model; | ||
|
||
import eu.heronnet.module.storage.util.HexUtil; | ||
|
||
/** | ||
* Created by edo on 07/08/15. | ||
*/ | ||
public class BinaryDataNode extends Node { | ||
|
||
private final byte[] data; | ||
|
||
public BinaryDataNode(byte[] nodeId, byte[] data) { | ||
super(nodeId, NodeType.BINARY); | ||
this.data = data; | ||
} | ||
|
||
@Override | ||
public byte[] getData() { | ||
return data; | ||
} | ||
|
||
@Override | ||
public String toString() { | ||
return HexUtil.bytesToHex(nodeId); | ||
} | ||
} |
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,36 @@ | ||
package eu.heronnet.model; | ||
|
||
import javax.swing.plaf.nimbus.State; | ||
import java.util.HashSet; | ||
import java.util.Set; | ||
|
||
/** | ||
* Created by edo on 07/08/15. | ||
*/ | ||
public class Bundle { | ||
|
||
private final IdentifierNode subject; | ||
|
||
private final HashSet<Statement> statements = new HashSet<>(); | ||
|
||
public Bundle(IdentifierNode subject) { | ||
this.subject = subject; | ||
} | ||
|
||
public Bundle(IdentifierNode subject, Set<Statement> statements) { | ||
this.subject = subject; | ||
statements.addAll(statements); | ||
} | ||
|
||
public void add(Statement statement) { | ||
statements.add(statement); | ||
} | ||
|
||
public IdentifierNode getSubject() { | ||
return subject; | ||
} | ||
|
||
public Set<Statement> getStatements() { | ||
return new HashSet(statements); | ||
} | ||
} |
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,26 @@ | ||
package eu.heronnet.model; | ||
|
||
import java.util.Date; | ||
|
||
/** | ||
* Created by edo on 07/08/15. | ||
*/ | ||
public class DateNode extends Node<Date> { | ||
|
||
private final Date date; | ||
|
||
public DateNode(byte[] nodeId, Date date) { | ||
super(nodeId, NodeType.DATE); | ||
this.date = date; | ||
} | ||
|
||
@Override | ||
public Date getData() { | ||
return new Date(date.getTime()); | ||
} | ||
|
||
@Override | ||
public String toString() { | ||
return date.toString(); | ||
} | ||
} |
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,24 @@ | ||
package eu.heronnet.model; | ||
|
||
import eu.heronnet.module.storage.util.HexUtil; | ||
|
||
/** | ||
* Created by edo on 07/08/15. | ||
*/ | ||
public class IdentifierNode extends Node { | ||
|
||
public IdentifierNode(byte[] nodeId) { | ||
super(nodeId, NodeType.IDENTIFIER); | ||
} | ||
|
||
@Override | ||
public Object getData() { | ||
return nodeId; | ||
} | ||
|
||
@Override | ||
public String toString() { | ||
return HexUtil.bytesToHex(nodeId); | ||
} | ||
|
||
} |
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,28 @@ | ||
package eu.heronnet.model; | ||
|
||
/** | ||
* Created by edo on 07/08/15. | ||
*/ | ||
public abstract class Node<T> { | ||
|
||
final byte[] nodeId; | ||
final NodeType nodeType; | ||
|
||
public Node(byte[] nodeId, NodeType nodeType) { | ||
this.nodeId = nodeId; | ||
this.nodeType = nodeType; | ||
} | ||
|
||
public byte[] getNodeId() { | ||
return nodeId; | ||
} | ||
|
||
public NodeType getNodeType() { | ||
return nodeType; | ||
} | ||
|
||
public abstract T getData(); | ||
|
||
public abstract String toString(); | ||
|
||
} |
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,8 @@ | ||
package eu.heronnet.model; | ||
|
||
/** | ||
* Created by edo on 07/08/15. | ||
*/ | ||
public enum NodeType { | ||
IDENTIFIER, BINARY, STRING, DATE; | ||
} |
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,24 @@ | ||
package eu.heronnet.model; | ||
|
||
/** | ||
* Created by edo on 07/08/15. | ||
*/ | ||
public class Statement { | ||
|
||
private final StringNode predicate; | ||
|
||
private final Node object; | ||
|
||
public Statement(StringNode predicate, Node object) { | ||
this.predicate = predicate; | ||
this.object = object; | ||
} | ||
|
||
public StringNode getPredicate() { | ||
return predicate; | ||
} | ||
|
||
public Node getObject() { | ||
return object; | ||
} | ||
} |
Oops, something went wrong.