public class Graph extends Object
Constructor and Description |
---|
Graph()
Creates a new empty graph.
|
Modifier and Type | Method and Description |
---|---|
void |
add(AgentToken token)
adds an agent to the list of tokens and to the vertex, if not already
contained.
|
Edge |
add(Edge edge)
Adds an
edge to the graph. |
Vertex |
add(eis.iilang.Parameter identifier)
Adds a new node to the graph with an
identifier . |
Edge |
add(eis.iilang.Parameter param1,
eis.iilang.Parameter param2)
Adds a new edge to the graph, whereas the edge is built by two new
vertices which are created by
param1 and param2 . |
Vertex |
add(Vertex vertex)
Adds a node to the graph, if there is no equal vertex in the graph.
|
boolean |
contains(AgentToken token) |
boolean |
contains(Edge edge) |
boolean |
contains(Vertex vertex) |
boolean |
containsAllEdges(Collection<Edge> edges) |
boolean |
containsAllTokens(Collection<AgentToken> tokens) |
boolean |
containsAllVertices(Collection<Vertex> vertices) |
AdjacencyMatrix |
getAdjacencyMatrix() |
LinkedList<String> |
getAllTeams() |
LinkedList<Vertex> |
getConnectedComponent()
gets the connected component which contains the actual position.
|
LinkedList<Vertex> |
getConnectedComponent(Vertex vertex)
gets the connected component which contains
vertex . |
Edge |
getEdge(Edge edge)
Returns the edge which equals
edge . |
Edge |
getEdge(eis.iilang.Parameter param1,
eis.iilang.Parameter param2) |
Edge |
getEdge(Vertex vertex1,
Vertex vertex2) |
LinkedList<Edge> |
getEdges() |
LinkedList<AgentToken> |
getEnemyTokens(String ownTeam) |
int |
getNumberOfEdges() |
int |
getNumberOfExploredEdges() |
int |
getNumberOfExploredVertices() |
int |
getNumberOfProbedVertices() |
int |
getNumberOfSurveyedEdges() |
int |
getNumberOfVertices() |
Vertex |
getPosition() |
double |
getRatioOfExploredEdges() |
double |
getRatioOfExploredVertices() |
double |
getRatioOfProbedVertices() |
double |
getRatioOfSurveyedEdges() |
LinkedList<Vertex> |
getSurveyedConnectedComponent()
gets the connected component which contains the actual position.
|
LinkedList<Vertex> |
getSurveyedConnectedComponent(Vertex vertex)
gets the connected component which contains
vertex . |
AgentToken |
getToken(AgentToken token) |
LinkedList<AgentToken> |
getTokens() |
int |
getTotalNumberOfEdges() |
int |
getTotalNumberOfVertices() |
Vertex |
getVertex(eis.iilang.Parameter param) |
Vertex |
getVertex(String vertexName) |
Vertex |
getVertex(Vertex vertex) |
Vertex[] |
getVertexArray() |
LinkedList<Vertex> |
getVertices() |
boolean |
isAdjacentToEnemyAgent(Vertex vertex,
String team) |
void |
moveToken(AgentToken token,
Vertex targetVertex)
moves a token to another
vertex . |
void |
setPosition(Vertex vertex) |
void |
setProbed(Vertex vertex,
int value) |
void |
setSurveyed(Edge e,
int weight) |
void |
SetTotalNumberOfEdges(int number) |
void |
setVertexArray(Vertex[] vertexArray) |
LinkedList<apltk.interpreter.data.LogicBelief> |
toBeliefs()
gets all relevant beliefs of the graph (edges, vertices and tokens).
|
String |
toString() |
void |
updateToken(AgentToken token)
updates an agent token. if the token is not already in the graph, it is
added.
|
public Vertex add(eis.iilang.Parameter identifier)
identifier
. If an equal node
is already contained, false
is returned.identifier
- The identifier of the new node.public Vertex add(Vertex vertex)
public Edge add(eis.iilang.Parameter param1, eis.iilang.Parameter param2)
param1
and param2
. This
also adds the vertices, if not contained already contained.param1
- The identifier of the first vertex.param2
- The identifier of the second vertex.public Edge add(Edge edge)
edge
to the graph. This also adds the vertices, if not
already contained.edge
- The edge to add.public LinkedList<apltk.interpreter.data.LogicBelief> toBeliefs()
public boolean contains(Edge edge)
edge
- an edgetrue
, if an equal edge is already on the Graphfalse
, otherwise.public boolean contains(Vertex vertex)
vertex
- a vertextrue
, if an equal vertex is already on the Graphfalse
, otherwise.public boolean contains(AgentToken token)
token
- an agent tokentrue
, if an equal token is already on the Graphfalse
, otherwise.public boolean containsAllEdges(Collection<Edge> edges)
edges
- some edgestrue
, if an equal edge for all edges
is
already on the Graphfalse
, otherwise.public boolean containsAllVertices(Collection<Vertex> vertices)
vertices
- some verticestrue
, if an equal vertex for all vertices
is
already on the Graphfalse
, otherwise.public boolean containsAllTokens(Collection<AgentToken> tokens)
tokens
- some agent tokenstrue
, if an equal agent for all tokens
is
already on the Graphfalse
, otherwise.public void add(AgentToken token)
token
- the token to add.public void moveToken(AgentToken token, Vertex targetVertex)
vertex
. If there is no equal token in
the graph, a new token is added at that position.token
- the agent token which shall be moved.targetVertex
- the target vertex.public void updateToken(AgentToken token)
AgentToken
token
- the agent token to update.public AdjacencyMatrix getAdjacencyMatrix()
public Edge getEdge(eis.iilang.Parameter param1, eis.iilang.Parameter param2)
param1
- the first paramter.param2
- the second parameter.public Edge getEdge(Vertex vertex1, Vertex vertex2)
vertex1
- the first vertex.vertex2
- the second vertex.public Edge getEdge(Edge edge)
edge
.edge
- the edge equal to the queried edge.public Vertex getVertex(eis.iilang.Parameter param)
param
- the parameter of the vertex.public Vertex getVertex(Vertex vertex)
vertex
- a vertex.vertex
.public Vertex getVertex(String vertexName)
vertexName
- the name of a vertex.vertexName
.public LinkedList<Vertex> getVertices()
public LinkedList<Edge> getEdges()
public void setPosition(Vertex vertex)
vertex
- the vertex to set as position.public Vertex getPosition()
public int getNumberOfVertices()
public int getNumberOfEdges()
public LinkedList<Vertex> getConnectedComponent(Vertex vertex)
vertex
.vertex
- the vertexpublic LinkedList<Vertex> getConnectedComponent()
public LinkedList<Vertex> getSurveyedConnectedComponent(Vertex vertex)
vertex
.vertex
- the vertexpublic LinkedList<Vertex> getSurveyedConnectedComponent()
public LinkedList<AgentToken> getEnemyTokens(String ownTeam)
ownTeam
- the own teampublic LinkedList<String> getAllTeams()
public void setProbed(Vertex vertex, int value)
public void setSurveyed(Edge e, int weight)
public void setVertexArray(Vertex[] vertexArray)
vertexArray
- the vertexArray to setpublic Vertex[] getVertexArray()
public int getNumberOfExploredVertices()
public double getRatioOfExploredVertices()
public int getNumberOfProbedVertices()
public double getRatioOfProbedVertices()
public int getNumberOfExploredEdges()
public double getRatioOfExploredEdges()
public int getNumberOfSurveyedEdges()
public double getRatioOfSurveyedEdges()
public int getTotalNumberOfVertices()
public int getTotalNumberOfEdges()
public void SetTotalNumberOfEdges(int number)
number
- the total number of edges in this simulation.public LinkedList<AgentToken> getTokens()
public AgentToken getToken(AgentToken token)
token
- an agent tokennull
is returned.Copyright © 2013. All Rights Reserved.