public class PositionManager
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
protected java.util.Map<java.lang.String,java.util.List<PositionInformation>> |
persistedPositions
persisted positions, key is the position id, value a list of signal data
|
protected PersistenceManager |
persistenceManager
persistence manager
|
protected boolean |
positioningStarted
true, if positioning (online mode) has been started, false if it is not started
|
protected java.util.List<PositionListener> |
positionListeners
list of all position listeners which will be notified
|
protected java.util.List<Technology> |
technologies
list of all technologies
|
Constructor and Description |
---|
PositionManager()
Creates a position manager with default XML persistence-file: positionManagerData.xml in the same directory
|
PositionManager(java.io.File file)
Creates a position manager which will persist the data in a given file.
|
PositionManager(PersistenceManager persistenceManager)
Creates a position manager which will persist the data in a given file.
|
Modifier and Type | Method and Description |
---|---|
void |
addTechnology(Technology technology)
Adds a technology to the positioning system.
|
protected java.util.List<java.util.Map<PositionInformation,java.lang.Double>> |
collectNearestNeighboursTechnologies()
Collects the matched positions of all added technologies.
|
java.util.List<java.lang.String> |
getMappedPositions()
Delivers all mapped positions.
|
protected void |
init(PersistenceManager persistenceManager)
Initializes the position manager
|
void |
map(java.lang.String name)
Maps the current position and persists it in a new thread.
|
protected java.util.List<PositionInformation> |
match()
Matches the current position with the persisted positions.
|
protected java.util.List<PositionInformation> |
mergeNearestNeighboursTechnologies(java.util.List<java.util.Map<PositionInformation,java.lang.Double>> nearestNeighboursTechnologies)
Merges and sorts the calculated position information of different technologies.
|
void |
registerPositionListener(PositionListener positionListener)
Registers a position listener which will be notified if a position has been calculated and received.
|
void |
removeAllMappedPositions()
Removes all mapped and persisted positions
|
void |
removeAllPositionListener()
Removes all position listeners.
|
void |
removeAllTechnologies()
Removes all technologies.
|
void |
removeMappedPosition(java.lang.String name)
Removes a mapped position in a new thread.
|
void |
removeMappedPosition(java.lang.String name,
java.lang.String technology)
Removes mapped technology data of a given position.
|
void |
removePositionListener(PositionListener positionListener)
Removes a position listener.
|
void |
removeTechnology(Technology technology)
Removes a technology.
|
void |
startPositioning()
Starts positioning in a new thread with a default time interval between position receiving of 3 seconds.
|
void |
startPositioning(long interval)
Starts positioning in a new thread with given time interval between position receiving.
|
void |
stopPositioning()
Stops the positioning and finishes the positioning thread.
|
protected java.util.List<Technology> technologies
protected PersistenceManager persistenceManager
protected java.util.Map<java.lang.String,java.util.List<PositionInformation>> persistedPositions
protected boolean positioningStarted
protected java.util.List<PositionListener> positionListeners
public PositionManager() throws PositioningPersistenceException
PositioningPersistenceException
- if the persistence file could not be opened or readpublic PositionManager(PersistenceManager persistenceManager) throws PositioningPersistenceException
persistenceManager
- persistenceManager with defined filePositioningPersistenceException
- if the persistence file could not be opened or readpublic PositionManager(java.io.File file) throws PositioningPersistenceException
file
- persistence filePositioningPersistenceException
- if the persistence file could not be opened or readprotected void init(PersistenceManager persistenceManager) throws PositioningPersistenceException
persistenceManager
- persistenceManager with defined filePositioningPersistenceException
- if the persistence file could not be opened or readpublic void addTechnology(Technology technology) throws PositioningException
technology
- technology / hardwarePositioningException
- if a technology with the same name has already been addedpublic void removeTechnology(Technology technology)
technology
- technology / hardwarepublic void removeAllTechnologies()
public void registerPositionListener(PositionListener positionListener)
positionListener
- position listenerpublic void removePositionListener(PositionListener positionListener)
positionListener
- position listenerpublic void removeAllPositionListener()
protected java.util.List<PositionInformation> match()
protected java.util.List<java.util.Map<PositionInformation,java.lang.Double>> collectNearestNeighboursTechnologies()
protected java.util.List<PositionInformation> mergeNearestNeighboursTechnologies(java.util.List<java.util.Map<PositionInformation,java.lang.Double>> nearestNeighboursTechnologies)
nearestNeighboursTechnologies
- position information of all technologiespublic void startPositioning()
public void startPositioning(long interval)
interval
- time interval in millisecondspublic void stopPositioning()
public void map(java.lang.String name)
name
- identifier or name of the current positionpublic void removeMappedPosition(java.lang.String name)
name
- identifier or name of the current positionpublic void removeMappedPosition(java.lang.String name, java.lang.String technology)
name
- identifier or name of the current positiontechnology
- technologypublic void removeAllMappedPositions()
public java.util.List<java.lang.String> getMappedPositions()