org.javasimon
Class Sample

java.lang.Object
  extended by org.javasimon.Sample
Direct Known Subclasses:
CounterSample, StopwatchSample, UnknownSample

public abstract class Sample
extends Object

Sample contains all relevant values of the Simon that are obtained by the Simon.sample() and Simon.sampleAndReset() methods. Returned object contains consistent set of Simon values as both operations are synchronized. However Sample is a Java Bean and it can be modified afterwards so no consistency is guaranteed when the object is used in an inapropriate context. As a Java Bean object can be used directly as the data transfer object without need to create another DTO with the same data. Sample generally doesn't have any behavior.

Author:
Richard "Virgo" Richter

Field Summary
private  long firstUsage
           
private  long lastReset
           
private  long lastUsage
           
private  String name
           
private  String note
           
 
Constructor Summary
Sample()
           
 
Method Summary
(package private)  void finishWithUsagesAndNote(StringBuilder sb)
           
 long getFirstUsage()
          Timestamp of the first usage from the sampled Simon.
 long getLastReset()
          Timestamp of the last reset from the sampled Simon.
 long getLastUsage()
          Timestamp of the last usage from the sampled Simon.
 String getName()
          Name of the sampled Simon.
 String getNote()
          Note from the sampled Simon.
 void setFirstUsage(long firstUsage)
          Sets the timestamp of the first usage from the sampled Simon.
 void setLastReset(long lastReset)
          Sets the timestamp of the last reset from the sampled Simon.
 void setLastUsage(long lastUsage)
          Sets the timestamp of the last usage from the sampled Simon.
 void setName(String name)
          Sets the name of the sampled Simon - mostly not used directly.
 void setNote(String note)
          Sets the note for the sample, typically note from the sampled Simon.
 String simonToString()
          Similar to AbstractSimon.toString() except for the state missing in the output.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

name

private String name

note

private String note

firstUsage

private long firstUsage

lastUsage

private long lastUsage

lastReset

private long lastReset
Constructor Detail

Sample

public Sample()
Method Detail

getName

public String getName()
Name of the sampled Simon.

Returns:
Simon's name

setName

public void setName(String name)
Sets the name of the sampled Simon - mostly not used directly.

Parameters:
name - Simon's name

getNote

public final String getNote()
Note from the sampled Simon.

Returns:
Simon's note

setNote

public final void setNote(String note)
Sets the note for the sample, typically note from the sampled Simon.

Parameters:
note - Simon's note

getFirstUsage

public long getFirstUsage()
Timestamp of the first usage from the sampled Simon.

Returns:
Simon's first usage timestamp

setFirstUsage

public void setFirstUsage(long firstUsage)
Sets the timestamp of the first usage from the sampled Simon.

Parameters:
firstUsage - Simon's first usage timestamp

getLastUsage

public long getLastUsage()
Timestamp of the last usage from the sampled Simon.

Returns:
Simon's last usage timestamp

setLastUsage

public void setLastUsage(long lastUsage)
Sets the timestamp of the last usage from the sampled Simon.

Parameters:
lastUsage - Simon's last usage timestamp

getLastReset

public long getLastReset()
Timestamp of the last reset from the sampled Simon.

Returns:
Simon's last reset timestamp

setLastReset

public void setLastReset(long lastReset)
Sets the timestamp of the last reset from the sampled Simon.

Parameters:
lastReset - Simon's last reset timestamp

finishWithUsagesAndNote

void finishWithUsagesAndNote(StringBuilder sb)

simonToString

public String simonToString()
Similar to AbstractSimon.toString() except for the state missing in the output.



Copyright © 2013. All Rights Reserved.