mas.agentsHempelsSofa.data.graph
Class Edge

java.lang.Object
  extended by mas.agentsHempelsSofa.data.graph.Edge
All Implemented Interfaces:
Believable

public class Edge
extends java.lang.Object
implements Believable

An implementation of an undirected edge for our Graph. An edge knows

Author:
Hempels-Sofa

Field Summary
static int UNSURVEYED_WEIGHT
           
 
Constructor Summary
Edge(eis.iilang.Parameter param1, eis.iilang.Parameter param2)
          Creates a new edge from param1 to param2 with unknown weight (0).
Edge(java.lang.String param1, java.lang.String param2)
           
Edge(Vertex vertex1, Vertex vertex2)
          Creates a new unsurveyed edge from vertex1 to vertex2 with unknown weight (0).
Edge(Vertex vertex1, Vertex vertex2, int weight)
          Creates a new edge from vertex1 to vertex2 with a specified weight.
 
Method Summary
 Edge clone()
           
 boolean equals(java.lang.Object obj)
           
 Vertex[] getVertices()
           
 int getWeight()
           
 boolean isSurveyed()
           
 void setUnsurveyed()
           
 void setVertices(Vertex[] vertices)
           
 void setWeight(int weight)
           
 apltk.interpreter.data.LogicBelief toBelief()
          generates a belief for this edge.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

UNSURVEYED_WEIGHT

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

Edge

public Edge(Vertex vertex1,
            Vertex vertex2,
            int weight)
Creates a new edge from vertex1 to vertex2 with a specified weight. surveyed says weather the real weight is known.

Parameters:
vertex1 - The first vertex of the edge.
vertex2 - The second vertex of the edge.
weight - The weight of the edge.

Edge

public Edge(Vertex vertex1,
            Vertex vertex2)
Creates a new unsurveyed edge from vertex1 to vertex2 with unknown weight (0).

Parameters:
vertex1 - The first vertex of the edge.
vertex2 - The second vertex of the edge.

Edge

public Edge(eis.iilang.Parameter param1,
            eis.iilang.Parameter param2)
Creates a new edge from param1 to param2 with unknown weight (0).

Parameters:
param1 - The identifier for the first vertex.
param2 - The identifier for the second vertex.

Edge

public Edge(java.lang.String param1,
            java.lang.String param2)
Method Detail

equals

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

clone

public final Edge clone()
Overrides:
clone in class java.lang.Object

toString

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

toBelief

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

Specified by:
toBelief in interface Believable
Returns:
a belief with
  • predicate - edge,
  • parameter1 - vertex1,
  • parameter2 - vertex2,
  • parameter3 - weight,
  • parameter4 - surveyed

setVertices

public void setVertices(Vertex[] vertices)
Parameters:
vertices - the vertices to set

getVertices

public Vertex[] getVertices()
Returns:
the vertices as an array.

setWeight

public void setWeight(int weight)
Parameters:
weight - the weight of the edge.

getWeight

public int getWeight()
Returns:
the weight of the edge.

isSurveyed

public boolean isSurveyed()
Returns:
  • true, if the real weight is known,
  • false, otherwise.

setUnsurveyed

public void setUnsurveyed()


Copyright © 2012. All Rights Reserved.