|
Rakesh API | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.rakeshv.Statistics
public class Statistics
A simple value object used to store statistics about usage of resources.
The following shows the easiest way to use this class.
import org.rakeshv.Statistics;
...
// Instance member
private Statistics statistics = new Statistics();
...
// Within method
statistics.update();
...
Copyright 2005 Rakesh Vidyadharan
| Field Summary | |
|---|---|
private int |
accessCount
The total number of times the resource has been accessed. |
private long |
lastAccess
The time in milliseconds that represents the last time at which the resource was accessed. |
| Constructor Summary | |
|---|---|
Statistics()
Default constructor. |
|
Statistics(int accessCount,
long lastAccess)
Designated constructor. |
|
Statistics(long lastAccess)
Create a new instance of the class using the specified value for lastAccess. |
|
| Method Summary | |
|---|---|
int |
getAccessCount()
Returns accessCount. |
java.util.Date |
getLastAccess()
Returns lastAccess as a Date object. |
void |
incrementAccessCount()
Increment the value of accessCount |
void |
resetAccessCount()
Reset the accessCount to 0. |
protected void |
setAccessCount(int accessCount)
Set accessCount. |
void |
setLastAccess(java.util.Date date)
Set the value of lastAccess using the specified date. |
void |
setLastAccess(long lastAccess)
Set the value of lastAccess using the specified
millisecond value. |
void |
update()
Update the instance members to indicate that a resource has been accessed. |
void |
updateLastAccess()
Update the lastAccess to the current time. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
private volatile int accessCount
Note: No synchronisation is done while modifying the value of this field.
private volatile long lastAccess
Note: No synchronisation is done while modifying the value of this field.
| Constructor Detail |
|---|
public Statistics()
public Statistics(long lastAccess)
lastAccess.
lastAccess - The millisecond value to use to initialise the
lastAccess.
public Statistics(int accessCount,
long lastAccess)
accessCount - The number of times the resource has been
accessed.lastAccess - The millisecond value to use to initialise the
lastAccess.| Method Detail |
|---|
public final java.util.Date getLastAccess()
lastAccess as a Date object.
lastAccess
time.public final int getAccessCount()
accessCount.
public final void incrementAccessCount()
accessCount
public final void resetAccessCount()
accessCount to 0.
protected final void setAccessCount(int accessCount)
accessCount.
accessCount - The value to set.public final void setLastAccess(long lastAccess)
lastAccess using the specified
millisecond value.
lastAccess - The value in milliseconds to set.public final void setLastAccess(java.util.Date date)
lastAccess using the specified date.
date - The date to use to set the value.public final void updateLastAccess()
lastAccess to the current time.
public final void update()
incrementAccessCount(),
updateLastAccess()
|
Rakesh API | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||