cz.cuni.amis.pogamut.base.utils.logging.marks
Class LogMapMark

java.lang.Object
  extended by cz.cuni.amis.pogamut.base.utils.logging.marks.LogMapMark
All Implemented Interfaces:
java.io.Serializable

public class LogMapMark
extends java.lang.Object
implements java.io.Serializable

DON'T USE THIS CLASS! Use methods in LogCategory to place mark on the map.

This is an object that is passed through log infrastructure to appear on the other side through JMX and it is utilized there to add mark on the map.

Basically, if you want to use it directly (DON'T), create LogMapMark using some of the create*Event method and pass it to log as parameter of log message. // create a mark that with text "text to show in map" that will be // shown at the position of agent for its duration of 2secibds. logger.info("Text to log" , new Object[]{LogMapMark.createFixedLengthEvent(Level.INFO, "text to show in map", null, 2000)});

See Also:
Serialized Form

Nested Class Summary
static class LogMapMark.Type
           
 
Method Summary
static LogMapMark createAgentFixedLengthEvent(java.util.logging.Level level, java.lang.String message, long duration)
          Create map mark that appear in the map for certain time and will be always shown at the current position of agent.
static LogMapMark createAgentVariableLengthEvent(java.util.logging.Level level, java.lang.String message)
          Create mark that will always be shown at the position of agent.
static LogMapMark createFixedLengthEvent(java.util.logging.Level level, java.lang.String message, Location location, long duration)
          Create mark on the map that will stay there for some time.
static LogMapMark createVariableLengthEvent(java.util.logging.Level level, java.lang.String message, Location location)
          Create starting map mark.
 boolean equals(java.lang.Object otherObject)
           
 long getCreated()
           
 long getDuration()
           
 LogMapMark getEndMark()
          Get end mark to make some map mark disappear from map.
 int getId()
          Get unique id of this map mark
 java.util.logging.Level getLevel()
          Get level of mark, used mainly to send end marks at same level as starting.
 Location getLocation()
          Get location of mark.
 Location getLocation(Location entityLoc)
          Get location, where mark is supposed to be.
 java.lang.String getMessage()
           
 LogMapMark.Type getType()
           
 int hashCode()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

createFixedLengthEvent

public static LogMapMark createFixedLengthEvent(java.util.logging.Level level,
                                                java.lang.String message,
                                                Location location,
                                                long duration)
Create mark on the map that will stay there for some time.

Parameters:
level - level of mark, should be same as the level of carrying LogRecord
message - text of map mark
location - location, at which map mark should be located. If null, than mark will follow agent.
duration - how long should map mark be shown in the map.
Returns:

createAgentFixedLengthEvent

public static LogMapMark createAgentFixedLengthEvent(java.util.logging.Level level,
                                                     java.lang.String message,
                                                     long duration)
Create map mark that appear in the map for certain time and will be always shown at the current position of agent.

Parameters:
level - level of mark, should be same as the level of carrying LogRecord
message - text of mark
duration - how long should be mark shown
Returns:
created mark.

createAgentVariableLengthEvent

public static LogMapMark createAgentVariableLengthEvent(java.util.logging.Level level,
                                                        java.lang.String message)
Create mark that will always be shown at the position of agent.

If you don't want to show mark in the map anymore, you have to create end mark and pass it to log infrastucture. You can create end mark by calling getEndMark() on the starting mark (the one returned by this method).

Parameters:
level - level of mark, should be same as the level of carrying LogRecord
message - text to be shown
Returns:
created mark.

createVariableLengthEvent

public static LogMapMark createVariableLengthEvent(java.util.logging.Level level,
                                                   java.lang.String message,
                                                   Location location)
Create starting map mark.

In order to end the map mark, create end mark by calling getEndMark() on the starting mark (the one returned by this method) and pass it to same log as starting mark.

Parameters:
message - text of mark
location - location, at which map mark should be located. If null, than mark will follow agent.
Returns:
starting map mark

equals

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

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object

getId

public int getId()
Get unique id of this map mark

Returns:
id of mark

getLevel

public java.util.logging.Level getLevel()
Get level of mark, used mainly to send end marks at same level as starting.

Returns:
level of the mark.

getMessage

public java.lang.String getMessage()

getLocation

public Location getLocation()
Get location of mark. If location is null, mark is supposed to follow agent.

Returns:
copy of marks location or null.
See Also:
getLocation(cz.cuni.amis.pogamut.base3d.worldview.object.Location)

getLocation

public Location getLocation(Location entityLoc)
Get location, where mark is supposed to be.

If marks location is null, return location of entity

Parameters:
entityLoc - location of agent this map mark belongs to
Returns:
copy of location, where mark is supposed to be.

getCreated

public long getCreated()

getDuration

public long getDuration()

getType

public LogMapMark.Type getType()

getEndMark

public LogMapMark getEndMark()
Get end mark to make some map mark disappear from map.

This is method that should be used only by map marks without defined duration (starting map marks).

Returns:
end mark to be passed to same log as the starting mark was.