mas.agentsHempelsSofa.data.graph
Class Vertex

java.lang.Object
  extended by mas.agentsHempelsSofa.data.graph.Vertex
All Implemented Interfaces:
java.lang.Comparable<Vertex>, Believable

public class Vertex
extends java.lang.Object
implements java.lang.Comparable<Vertex>, Believable

An implementation of the vertices for our graph. A node knows

Author:
Hempels-Sofa

Field Summary
static int UNPROBED_VALUE
           
 
Constructor Summary
Vertex(eis.iilang.Parameter identifier)
          Creates a new unprobed node with a specified identifier, unknown value and a graph it thinks it belongs to.
Vertex(eis.iilang.Parameter identifier, int value)
          Creates a new node with a specified identifier, a certain value, a boolean probed which says whether the real value is known and a graph it thinks it belongs to.
Vertex(java.lang.String identifier)
           
 
Method Summary
 void addIncidentEdge(Edge incidentEdge)
          Immediately adds an incident edge to the vertex.
 void addToken(AgentToken token)
           
 int compareTo(Vertex v)
           
 boolean contains(AgentToken token)
          Determines, whether the agent token is on the vertex or not
 void decreaseNumberOfUnsurveyedIncidentEdges(int n)
           
 boolean equals(java.lang.Object obj)
           
 java.util.LinkedList<Vertex> getAdjacentVertices()
           
 java.lang.String[] getAgentNames()
           
 eis.iilang.Parameter getIdentifier()
           
 java.util.LinkedList<Edge> getIncidentEdges()
           
 java.lang.String getName()
           
 int getNumber()
           
 int getNumberOfEdges()
           
 int getNumberOfUnsurveyedEdges()
           
 java.util.LinkedList<AgentToken> getTokens()
           
 int getValue()
           
 double getWeightedDistance()
           
 boolean hasEnemyTokens(java.lang.String team)
           
 boolean hasUnsurveyedEdges()
           
 boolean isAdjacentTo(Vertex adjacentVertex)
           
 boolean isProbed()
           
 boolean isTarget(java.lang.String teamname)
           
 AgentToken removeToken(AgentToken token)
          removes a token from the vertex
 void setIdentifier(eis.iilang.Parameter identifier)
           
 void setValue(int value)
          Sets the value of the vertex.
 void setWeightedDistance(double weightedDistance)
           
 void surveyAllIncidentEdges()
          clears the list of incident unsurveyed edges.
 apltk.interpreter.data.LogicBelief toBelief()
          generates a belief for this node.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

UNPROBED_VALUE

public static final int UNPROBED_VALUE
See Also:
Constant Field Values
Constructor Detail

Vertex

public Vertex(eis.iilang.Parameter identifier,
              int value)
Creates a new node with a specified identifier, a certain value, a boolean probed which says whether the real value is known and a graph it thinks it belongs to.

Parameters:
identifier - The identifier of the node.
value - The value of the node.

Vertex

public Vertex(eis.iilang.Parameter identifier)
Creates a new unprobed node with a specified identifier, unknown value and a graph it thinks it belongs to.

Parameters:
identifier - The identifier of the node.

Vertex

public Vertex(java.lang.String identifier)
Method Detail

equals

public final boolean equals(java.lang.Object obj)
Overrides:
equals in class java.lang.Object

toString

public final java.lang.String toString()
Overrides:
toString in class java.lang.Object

compareTo

public final int compareTo(Vertex v)
Specified by:
compareTo in interface java.lang.Comparable<Vertex>

toBelief

public apltk.interpreter.data.LogicBelief toBelief()
generates a belief for this node.

Specified by:
toBelief in interface Believable
Returns:
a belief with
  • predicate - vertex,
  • parameter1 - identifier,
  • parameter2 - value,
  • parameter3 - probed

addIncidentEdge

public void addIncidentEdge(Edge incidentEdge)
Immediately adds an incident edge to the vertex.

Parameters:
incidentEdge - the incidentEdge.

isAdjacentTo

public boolean isAdjacentTo(Vertex adjacentVertex)
Parameters:
adjacentVertex - The vertex which shall be tested.
Returns:
  • true, if adjacentVertex is adjacent to this vertex,
  • false, otherwise.

surveyAllIncidentEdges

public void surveyAllIncidentEdges()
clears the list of incident unsurveyed edges.


getIncidentEdges

public java.util.LinkedList<Edge> getIncidentEdges()
Returns:
the incidentEdges

getAdjacentVertices

public java.util.LinkedList<Vertex> getAdjacentVertices()
Returns:
the adjacentVertices

setIdentifier

public void setIdentifier(eis.iilang.Parameter identifier)
Parameters:
identifier - the identifier to set.

getIdentifier

public eis.iilang.Parameter getIdentifier()
Returns:
the name

isProbed

public boolean isProbed()
Returns:
the probed

setValue

public void setValue(int value)
Sets the value of the vertex.

Parameters:
value - The new value.

getValue

public int getValue()
Returns:
the value

getNumberOfUnsurveyedEdges

public int getNumberOfUnsurveyedEdges()
Returns:
the numberOfUnsurveyedEdges

setWeightedDistance

public void setWeightedDistance(double weightedDistance)
Parameters:
weightedDistance - the weightedDistance to set

getWeightedDistance

public double getWeightedDistance()
Returns:
the weightedDistance

getNumberOfEdges

public int getNumberOfEdges()
Returns:
the number of incident edges

getName

public java.lang.String getName()
Returns:
the name of the vertex

addToken

public void addToken(AgentToken token)
Parameters:
token - The agent token which has to be added to the vertex

getTokens

public java.util.LinkedList<AgentToken> getTokens()
Returns:
A List of all the Tokens which are on the vertex

contains

public boolean contains(AgentToken token)
Determines, whether the agent token is on the vertex or not

Parameters:
token - The agent token
Returns:
True, if the agent token is on the vertex

removeToken

public AgentToken removeToken(AgentToken token)
removes a token from the vertex

Parameters:
token - agent token to remove.

isTarget

public boolean isTarget(java.lang.String teamname)
Returns:
  • true, if the vertex s already target of a different agent,
  • false, otherwise.

getAgentNames

public java.lang.String[] getAgentNames()
Returns:
the names of all agents.

hasEnemyTokens

public boolean hasEnemyTokens(java.lang.String team)

hasUnsurveyedEdges

public boolean hasUnsurveyedEdges()

getNumber

public int getNumber()

decreaseNumberOfUnsurveyedIncidentEdges

public void decreaseNumberOfUnsurveyedIncidentEdges(int n)


Copyright © 2012. All Rights Reserved.