|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectmas.agentsHempelsSofa.data.graph.Graph
public class Graph
An implementation for our graph. It shall be used for all tokens to have an overview of the playing-graph. A graph knows
Constructor Summary | |
---|---|
Graph()
Creates a new empty graph. |
Method Summary | |
---|---|
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(java.util.Collection<Edge> edges)
|
boolean |
containsAllTokens(java.util.Collection<AgentToken> tokens)
|
boolean |
containsAllVertices(java.util.Collection<Vertex> vertices)
|
AdjacencyMatrix |
getAdjacencyMatrix()
|
java.util.LinkedList<java.lang.String> |
getAllTeams()
|
java.util.LinkedList<Vertex> |
getConnectedComponent()
gets the connected component which contains the actual position. |
java.util.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)
|
java.util.LinkedList<Edge> |
getEdges()
|
java.util.LinkedList<AgentToken> |
getEnemyTokens(java.lang.String ownTeam)
|
int |
getNumberOfEdges()
|
int |
getNumberOfExploredEdges()
|
int |
getNumberOfExploredVertices()
|
int |
getNumberOfProbedVertices()
|
int |
getNumberOfSurveyedEdges()
|
int |
getNumberOfVertices()
|
Vertex |
getPosition()
|
double |
getRatioOfExploredEdges()
|
double |
getRatioOfExploredVertices()
|
double |
getRatioOfProbedVertices()
|
double |
getRatioOfSurveyedEdges()
|
java.util.LinkedList<Vertex> |
getSurveyedConnectedComponent()
gets the connected component which contains the actual position. |
java.util.LinkedList<Vertex> |
getSurveyedConnectedComponent(Vertex vertex)
gets the connected component which contains vertex . |
AgentToken |
getToken(AgentToken token)
|
java.util.LinkedList<AgentToken> |
getTokens()
|
int |
getTotalNumberOfEdges()
|
int |
getTotalNumberOfVertices()
|
Vertex |
getVertex(eis.iilang.Parameter param)
|
Vertex |
getVertex(java.lang.String vertexName)
|
Vertex |
getVertex(Vertex vertex)
|
Vertex[] |
getVertexArray()
|
java.util.LinkedList<Vertex> |
getVertices()
|
boolean |
isAdjacentToEnemyAgent(Vertex vertex,
java.lang.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)
|
java.util.LinkedList<apltk.interpreter.data.LogicBelief> |
toBeliefs()
gets all relevant beliefs of the graph (edges, vertices and tokens). |
java.lang.String |
toString()
|
void |
updateToken(AgentToken token)
updates an agent token. if the token is not already in the graph, it is added. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public Graph()
Method Detail |
---|
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 java.lang.String toString()
toString
in class java.lang.Object
public java.util.LinkedList<apltk.interpreter.data.LogicBelief> toBeliefs()
public boolean contains(Edge edge)
edge
- an edge
true
, if an equal edge is already on the Graphfalse
, otherwise.public boolean contains(Vertex vertex)
vertex
- a vertex
true
, if an equal vertex is already on the Graphfalse
, otherwise.public boolean contains(AgentToken token)
token
- an agent token
true
, if an equal token is already on the Graphfalse
, otherwise.public boolean containsAllEdges(java.util.Collection<Edge> edges)
edges
- some edges
true
, if an equal edge for all edges
is
already on the Graphfalse
, otherwise.public boolean containsAllVertices(java.util.Collection<Vertex> vertices)
vertices
- some vertices
true
, if an equal vertex for all vertices
is
already on the Graphfalse
, otherwise.public boolean containsAllTokens(java.util.Collection<AgentToken> tokens)
tokens
- some agent tokens
true
, 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(java.lang.String vertexName)
vertexName
- the name of a vertex.
vertexName
.public java.util.LinkedList<Vertex> getVertices()
public java.util.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 java.util.LinkedList<Vertex> getConnectedComponent(Vertex vertex)
vertex
.
vertex
- the vertex
public java.util.LinkedList<Vertex> getConnectedComponent()
public java.util.LinkedList<Vertex> getSurveyedConnectedComponent(Vertex vertex)
vertex
.
vertex
- the vertex
public java.util.LinkedList<Vertex> getSurveyedConnectedComponent()
public boolean isAdjacentToEnemyAgent(Vertex vertex, java.lang.String team)
vertex
- the vertexteam
- the team
true
, if an enemy agent is on an adjacent token to
vertex
false
, otherwise
public java.util.LinkedList<AgentToken> getEnemyTokens(java.lang.String ownTeam)
ownTeam
- the own team
public java.util.LinkedList<java.lang.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 java.util.LinkedList<AgentToken> getTokens()
public AgentToken getToken(AgentToken token)
token
- an agent token
null
is returned.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |