Skip to content
Snippets Groups Projects
Commit a5a953db authored by Sören Henning's avatar Sören Henning
Browse files

initial structure for graph model

parent dae31a14
No related branches found
No related tags found
1 merge request!17Get impletemented stages and Java 8
package kieker.analysis.graph;
public interface Edge extends Element {
// public Vertex getVertex(Direction direction) throws IllegalArgumentException;
}
package kieker.analysis.graph;
import java.util.Set;
public abstract interface Element {
public <T> T getProperty(String key);
public Set<String> getPropertyKeys();
public void setProperty(String key, Object value);
public <T> T removeProperty(String key);
public void remove();
public Object getId();
}
package kieker.analysis.graph;
public interface Graph {
public Vertex addVertex(Object id);
public Vertex getVertex(Object id);
public void removeVertex(Vertex vertex);
public Iterable<Vertex> getVertices();
public Edge addEdge(Object id, Vertex outVertex, Vertex inVertex);
public Edge getEdge(Object id);
public void removeEdge(Edge edge);
public Iterable<Edge> getEdges();
}
package kieker.analysis.graph;
public interface Subgraph {
}
package kieker.analysis.graph;
public interface Vertex extends Element {
public Boolean hasSubgraph();
public Graph getSubgraph();
// public Iterable<Edge> getEdges(Direction direction, String... labels);
// public Iterable<Vertex> getVertices(Direction direction, String... labels);
// public Edge addEdge(String label, Vertex inVertex);
}
package kieker.analysis.graph.impl;
import kieker.analysis.graph.Edge;
class EdgeImp extends ElementImpl implements Edge {
// public Vertex getVertex(Direction direction) throws IllegalArgumentException;
}
package kieker.analysis.graph.impl;
import java.util.Set;
import kieker.analysis.graph.Element;
abstract class ElementImpl implements Element {
@Override
public <T> T getProperty(final String key) {
// TODO Auto-generated method stub
return null;
}
@Override
public Set<String> getPropertyKeys() {
// TODO Auto-generated method stub
return null;
}
@Override
public void setProperty(final String key, final Object value) {
// TODO Auto-generated method stub
}
@Override
public <T> T removeProperty(final String key) {
// TODO Auto-generated method stub
return null;
}
@Override
public void remove() {
// TODO Auto-generated method stub
}
@Override
public Object getId() {
// TODO Auto-generated method stub
return null;
}
}
package kieker.analysis.graph.impl;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Map;
import kieker.analysis.graph.Edge;
import kieker.analysis.graph.Graph;
import kieker.analysis.graph.Vertex;
public class GraphImpl implements Graph {
protected Map<String, Vertex> vertices = new HashMap<String, Vertex>();
protected Map<String, Edge> edges = new HashMap<String, Edge>();
public GraphImpl() {}
@Override
public Vertex addVertex(final Object id) {
// TODO Auto-generated method stub
return null;
}
@Override
public Vertex getVertex(final Object id) {
// TODO exception if not exists
String idString = id.toString();
return this.vertices.get(idString);
}
@Override
public Iterable<Vertex> getVertices() {
return new ArrayList<Vertex>(this.vertices.values());
}
@Override
public void removeVertex(final Vertex vertex) {
// TODO Auto-generated method stub
}
@Override
public Edge addEdge(final Object id, final Vertex outVertex, final Vertex inVertex) {
// TODO Auto-generated method stub
return null;
}
@Override
public Edge getEdge(final Object id) {
// TODO exception if not exists
String idString = id.toString();
return this.edges.get(idString);
}
@Override
public Iterable<Edge> getEdges() {
return new ArrayList<Edge>(this.edges.values());
}
@Override
public void removeEdge(final Edge edge) {
// TODO Auto-generated method stub
}
}
package kieker.analysis.graph.impl;
import kieker.analysis.graph.Graph;
import kieker.analysis.graph.Vertex;
class VertexImpl extends ElementImpl implements Vertex {
@Override
public Boolean hasSubgraph() {
// TODO Auto-generated method stub
return false;
}
@Override
public Graph getSubgraph() {
// TODO Auto-generated method stub
return null;
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment