org.graphstream.boids
Class Boid

java.lang.Object
  extended by org.graphstream.graph.implementations.AbstractElement
      extended by org.graphstream.graph.implementations.AbstractNode
          extended by org.graphstream.graph.implementations.AdjacencyListNode
              extended by org.graphstream.boids.Boid
All Implemented Interfaces:
Iterable<org.graphstream.graph.Edge>, org.graphstream.graph.Element, org.graphstream.graph.Node

public class Boid
extends org.graphstream.graph.implementations.AdjacencyListNode

Represents a single bird-oid object.

A boid is both a particle in the forces system used to compute the position and motion of the object, and a GraphStream node. This allows to consider a graph made of all the boids.

The boid is in fact split in two parts, the Boid class itself that represents the boid in the forces system. The boid particle in turn contains a BoidForces object that represents all the forces exercising on the boid. Globally, the Boid class acts on the graph and updates its position, creating links toward other boids/nodes that it sees, whereas the BoidForces are used to compute the boid position.

Author:
Guilhelm Savin, Antoine Dutot

Nested Class Summary
 
Nested classes/interfaces inherited from class org.graphstream.graph.implementations.AbstractElement
org.graphstream.graph.implementations.AbstractElement.AttributeChangeEvent
 
Constructor Summary
Boid(org.graphstream.graph.implementations.AbstractGraph graph, BoidSpecies species, String id)
          New boid as a node in the given graph.
 
Method Summary
 void checkNeighborhood(Boid... boids)
           
static String getEdgeId(Boid b1, Boid b2)
          Compute the edge identifier between two boids knowing their individual identifiers.
 BoidForces getForces()
           
 org.miv.pherd.geom.Point3 getPosition()
          Actual position of the boid in space.
 BoidSpecies getSpecies()
          Set of parameters used by this boid group.
 void setForces(BoidForces forces)
           
 void setPosition(double x, double y, double z)
          Force the position of the boid in space.
 
Methods inherited from class org.graphstream.graph.implementations.AdjacencyListNode
getDegree, getEdge, getEdgeBetween, getEdgeFrom, getEdgeIterator, getEdgeToward, getEnteringEdge, getEnteringEdgeIterator, getInDegree, getLeavingEdge, getLeavingEdgeIterator, getOutDegree
 
Methods inherited from class org.graphstream.graph.implementations.AbstractNode
getBreadthFirstIterator, getBreadthFirstIterator, getDepthFirstIterator, getDepthFirstIterator, getEachEdge, getEachEnteringEdge, getEachLeavingEdge, getEdgeBetween, getEdgeBetween, getEdgeFrom, getEdgeFrom, getEdgeSet, getEdgeToward, getEdgeToward, getEnteringEdgeSet, getGraph, getLeavingEdgeSet, getNeighborNodeIterator, hasEdgeBetween, hasEdgeBetween, hasEdgeBetween, hasEdgeFrom, hasEdgeFrom, hasEdgeFrom, hasEdgeToward, hasEdgeToward, hasEdgeToward, isEnteringEdge, isIncidentEdge, isLeavingEdge, iterator
 
Methods inherited from class org.graphstream.graph.implementations.AbstractElement
addAttribute, addAttributes, changeAttribute, clearAttributes, getArray, getAttribute, getAttribute, getAttributeCount, getAttributeKeyIterator, getAttributeKeySet, getEachAttributeKey, getFirstAttributeOf, getFirstAttributeOf, getHash, getId, getIndex, getLabel, getNumber, getVector, hasArray, hasAttribute, hasAttribute, hasHash, hasLabel, hasNumber, hasVector, removeAttribute, setAttribute, toString
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.graphstream.graph.Node
toString
 
Methods inherited from interface org.graphstream.graph.Element
addAttribute, addAttributes, changeAttribute, clearAttributes, getArray, getAttribute, getAttribute, getAttributeCount, getAttributeKeyIterator, getAttributeKeySet, getFirstAttributeOf, getFirstAttributeOf, getHash, getId, getIndex, getLabel, getNumber, getVector, hasArray, hasAttribute, hasAttribute, hasHash, hasLabel, hasNumber, hasVector, removeAttribute, setAttribute
 

Constructor Detail

Boid

public Boid(org.graphstream.graph.implementations.AbstractGraph graph,
            BoidSpecies species,
            String id)
New boid as a node in the given graph.

Parameters:
graph - The graph this boids pertains to.
id - The boid identifier in the graph and in the force system.
Method Detail

setPosition

public void setPosition(double x,
                        double y,
                        double z)
Force the position of the boid in space.


getPosition

public org.miv.pherd.geom.Point3 getPosition()
Actual position of the boid in space.


getSpecies

public BoidSpecies getSpecies()
Set of parameters used by this boid group.


setForces

public void setForces(BoidForces forces)

getForces

public BoidForces getForces()

checkNeighborhood

public void checkNeighborhood(Boid... boids)

getEdgeId

public static final String getEdgeId(Boid b1,
                                     Boid b2)
Compute the edge identifier between two boids knowing their individual identifiers. This method ensures the identifiers are always in the same order so that we get the same edge whatever the order of the parameters b1 and b2.



Copyright © 2013. All Rights Reserved.