cz.cuni.amis.pogamut.ut2004.storyworld.place
Class SPStoryPlace

Package class diagram package SPStoryPlace
java.lang.Object
  extended by cz.cuni.amis.pogamut.ut2004.storyworld.place.SPStoryPlace
Direct Known Subclasses:
SPStoryPlaceBase

public class SPStoryPlace
extends Object

Basic interface for all story places.

Contains two methods that provides a means to create hierarchical description of places.

(Kitchen is in House that is in the City that is in the Czech Republic...)

We don't support changing the story-place-graph at runtime!

Author:
Jimmy

Field Summary
protected  String insidePlaceName
           
 
Constructor Summary
SPStoryPlace(String name)
           
SPStoryPlace(String name, SPStoryPlace inside)
           
 
Method Summary
 boolean contains(SPStoryPlace place)
           
 boolean equals(Object obj)
           
 SPLocation getCenter()
           
 NavPoint getCenterNavPoint()
           
 Set<SPStoryPlace> getContainsAllPlaces()
          Returns all places that are inside this one.
 Set<SPStoryPlace> getContainsPlaces()
          Returns set with places this one contains (not recursive!).
 NavPoint getFurthestNavPoint(SPLocation location)
           
 Set<SPStoryPlace> getHigherPlaces()
          Returns set of all places this one is a part of.
 SPStoryPlace getInsidePlace()
          Returns the place that this one is a part.
 String getInsidePlaceName()
          Returns name of the place this one is inside.
 cz.cuni.amis.utils.token.Token getName()
           
 Map<NavPoint,Double> getNavPointDistances(SPLocation location)
           
 Map<Double,NavPoint> getNavPointDistancesSwapped(SPLocation location)
           
 Set<NavPoint> getNavPoints()
          Returns places inside the virtual world that belongs to this place.
 List<NavPoint> getNavPointsList()
          Returns places inside the virtual world that belongs to this place.
 NavPoint getNearestNavPoint(SPLocation location)
           
 NavPoint getRandomNavPoint()
           
 NavPoint getRandomNavPoint(SPLocation location, double distance)
           
 int hashCode()
           
protected  void setInsidePlace(SPStoryPlace place)
          Used to inject the insidePlace after construction with "name" only (needed because the xml definition may be written the way it needs to be processed twiced, 1) create SPStoryPlaces, 2) inject inside)
 String toString()
          DO NOT ALTER!
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

insidePlaceName

@XStreamAsAttribute
protected String insidePlaceName
Constructor Detail

SPStoryPlace

public SPStoryPlace(String name,
                    SPStoryPlace inside)

SPStoryPlace

public SPStoryPlace(String name)
Method Detail

setInsidePlace

protected void setInsidePlace(SPStoryPlace place)
Used to inject the insidePlace after construction with "name" only (needed because the xml definition may be written the way it needs to be processed twiced, 1) create SPStoryPlaces, 2) inject inside)

Can't be called if insidePlace is already bound (RuntimeException).

Parameters:
place -

hashCode

public int hashCode()
Overrides:
hashCode in class Object

equals

public boolean equals(Object obj)
Overrides:
equals in class Object

getName

public cz.cuni.amis.utils.token.Token getName()

getInsidePlace

public SPStoryPlace getInsidePlace()
Returns the place that this one is a part.

If null - that means it's the highest

Returns:

getInsidePlaceName

public String getInsidePlaceName()
Returns name of the place this one is inside.

Returns:

getHigherPlaces

public Set<SPStoryPlace> getHigherPlaces()
Returns set of all places this one is a part of.

(You may ask whether this Kitchen in Czech Republic

Can't be called before the definition of all places is completed otherwise it won't contain all higher places! (Lazy initialization.)

Returns:

getContainsPlaces

public Set<SPStoryPlace> getContainsPlaces()
Returns set with places this one contains (not recursive!).

Returns:

getContainsAllPlaces

public Set<SPStoryPlace> getContainsAllPlaces()
Returns all places that are inside this one.

Can't be called before the definition of all story places are defined, otherwise it won't contains all places. (Lazy initialization.)

Returns:

getNavPoints

public Set<NavPoint> getNavPoints()
Returns places inside the virtual world that belongs to this place. Basically this is binding to the chosen 3D world simulator. It should contains objects upon whose the real path-finding can run.

Can't be called before the definition of all story places are defined, otherwise it won't contains all places. (Lazy initialization.)

Returns:

getNavPointsList

public List<NavPoint> getNavPointsList()
Returns places inside the virtual world that belongs to this place. Basically this is binding to the chosen 3D world simulator. It should contains objects upon whose the real path-finding can run.

Can't be called before the definition of all story places are defined, otherwise it won't contains all places. (Lazy initialization.)

Returns:

getCenter

public SPLocation getCenter()

getCenterNavPoint

public NavPoint getCenterNavPoint()

getRandomNavPoint

public NavPoint getRandomNavPoint()

getNearestNavPoint

public NavPoint getNearestNavPoint(SPLocation location)

getFurthestNavPoint

public NavPoint getFurthestNavPoint(SPLocation location)

getNavPointDistances

public Map<NavPoint,Double> getNavPointDistances(SPLocation location)

getNavPointDistancesSwapped

public Map<Double,NavPoint> getNavPointDistancesSwapped(SPLocation location)

getRandomNavPoint

public NavPoint getRandomNavPoint(SPLocation location,
                                  double distance)
Parameters:
distance - must be <0,1> ... 0 ~ pick from all possible navpoint, 1 ~ pick the furthest navpoint
Returns:

toString

public String toString()
DO NOT ALTER!

Used during translation into prolog!

Overrides:
toString in class Object

contains

public boolean contains(SPStoryPlace place)


Copyright © 2012 AMIS research group, Faculty of Mathematics and Physics, Charles University in Prague, Czech Republic. All Rights Reserved.