com.ibm.aglets.security
Class Lifetime

java.lang.Object
  |
  +--com.ibm.aglets.security.Lifetime
All Implemented Interfaces:
java.lang.Cloneable, java.io.Serializable

public final class Lifetime
extends java.lang.Object
implements java.io.Serializable, java.lang.Cloneable

The Lifetime class shows life-time of an aglet.

Version:
1.00 $Date: 2001/07/28 06:33:07 $
Author:
ONO Kouichi
See Also:
Serialized Form

Field Summary
static java.util.Date UNLIMITED
          Infinite lifetime.
static java.lang.String UNLIMITED_LABEL
           
 
Constructor Summary
Lifetime()
          Creates lifetime.
Lifetime(java.util.Date limit)
          Creates lifetime.
Lifetime(Lifetime lifetime)
          Creates lifetime as a copy.
Lifetime(java.lang.String lifetime)
          Creates lifetime.
 
Method Summary
 java.lang.Object clone()
          Returns a clone of the lifetime.
static java.util.Date currentDate()
          Returns whether the time is over the limit of lifetime.
 boolean equals(java.lang.Object obj)
          Returns whether the lifetime equal to lifetime.
 java.util.Date getLimit()
          Gets the available lifetime.
 boolean isAbsolute()
          Returns whether the life time is absolute.
 boolean isGreaterThan(java.util.Date date)
          Returns whether the lifetime is greater than lifetime.
 boolean isGreaterThan(Lifetime lifetime)
          Returns whether the lifetime is greater than lifetime.
 boolean isGreaterThan(long life)
          Returns whether the lifetime is greater than lifetime.
 boolean isLimited()
          Returns whether the lifetime is limited.
static boolean isLimited(java.util.Date limit)
          Returns whether the lifetime is limited.
static boolean isLimited(Lifetime lifetime)
          Returns whether the lifetime is limited.
static boolean isLimited(java.lang.String lifetime)
          Returns whether the lifetime is limited.
 boolean isOver()
          Returns whether the time is over the limit of lifetime.
static boolean isOver(java.util.Date limit)
          Returns whether the time is over the limit of lifetime.
 boolean isRelative()
          Returns whether the life time is relative.
 void limit(java.util.Date date)
          Limits the lifetime.
 void limit(Lifetime lifetime)
          Limits the lifetime.
 void limit(long life)
          Limits the lifetime.
static void main(java.lang.String[] arg)
          For test.
 void setLifetime(java.util.Date lifetime)
          Sets the lifetime.
 void setLifetime(Lifetime lifetime)
          Sets the lifetime.
 void setLifetime(java.lang.String lifetime)
          Sets the lifetime.
 void subtractLifetime(long life)
          Subtracts lifetime.
 java.lang.String toString()
          Returns a string of the lifetime.
 java.lang.String toString(boolean relative)
          Returns a string of the lifetime.
 java.lang.String toString(boolean relative, java.lang.String format)
          Returns a string of the lifetime.
 
Methods inherited from class java.lang.Object
finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

UNLIMITED

public static final java.util.Date UNLIMITED
Infinite lifetime.

UNLIMITED_LABEL

public static final java.lang.String UNLIMITED_LABEL
Constructor Detail

Lifetime

public Lifetime()
Creates lifetime.

Lifetime

public Lifetime(Lifetime lifetime)
Creates lifetime as a copy.

Lifetime

public Lifetime(java.lang.String lifetime)
         throws java.lang.NumberFormatException
Creates lifetime.

Lifetime

public Lifetime(java.util.Date limit)
Creates lifetime.
Method Detail

clone

public java.lang.Object clone()
                       throws java.lang.CloneNotSupportedException
Returns a clone of the lifetime.
Overrides:
clone in class java.lang.Object
Returns:
a clone of the lifetime

currentDate

public static java.util.Date currentDate()
Returns whether the time is over the limit of lifetime.
Returns:
true if the time is over the limit of lifetime, false otherwise

equals

public boolean equals(java.lang.Object obj)
Returns whether the lifetime equal to lifetime.
Overrides:
equals in class java.lang.Object
Returns:
true if the lifetime equal to lifetime, false otherwise

getLimit

public java.util.Date getLimit()
Gets the available lifetime.
Returns:
available lifetime

isAbsolute

public boolean isAbsolute()
Returns whether the life time is absolute.
Returns:
ture if the life time is absolute, false otherwise

isGreaterThan

public boolean isGreaterThan(long life)
Returns whether the lifetime is greater than lifetime.
Parameters:
life - absolute life time [milliseconds]
Returns:
true if the lifetime is greater than lifetime, false otherwise

isGreaterThan

public boolean isGreaterThan(Lifetime lifetime)
Returns whether the lifetime is greater than lifetime.
Parameters:
date - absolute life time
Returns:
true if the lifetime is greater than lifetime, false otherwise

isGreaterThan

public boolean isGreaterThan(java.util.Date date)
Returns whether the lifetime is greater than lifetime.
Parameters:
date - absolute life time
Returns:
true if the lifetime is greater than lifetime, false otherwise

isLimited

public boolean isLimited()
Returns whether the lifetime is limited.
Returns:
true if the lifetime is limited, false otherwise

isLimited

public static boolean isLimited(Lifetime lifetime)
Returns whether the lifetime is limited.
Parameters:
lifetime - lifetime
Returns:
true if the lifetime is limited, false otherwise

isLimited

public static boolean isLimited(java.lang.String lifetime)
Returns whether the lifetime is limited.
Parameters:
lifetime - lifetime
Returns:
true if the lifetime is limited, false otherwise

isLimited

public static boolean isLimited(java.util.Date limit)
Returns whether the lifetime is limited.
Parameters:
limit - date limit
Returns:
true if the lifetime is limited, false otherwise

isOver

public boolean isOver()
Returns whether the time is over the limit of lifetime.
Returns:
true if the time is over the limit of lifetime, false otherwise

isOver

public static boolean isOver(java.util.Date limit)
Returns whether the time is over the limit of lifetime.
Returns:
true if the time is over the limit of lifetime, false otherwise

isRelative

public boolean isRelative()
Returns whether the life time is relative.
Returns:
ture if the life time is relative, false otherwise

limit

public void limit(long life)
Limits the lifetime.
Parameters:
life - absolute life time [milliseconds]

limit

public void limit(Lifetime lifetime)
Limits the lifetime.
Parameters:
lifetime - lifetime

limit

public void limit(java.util.Date date)
Limits the lifetime.
Parameters:
date - absolute time

main

public static void main(java.lang.String[] arg)
For test.

setLifetime

public void setLifetime(Lifetime lifetime)
Sets the lifetime.
Parameters:
lifetime - lifetime

setLifetime

public void setLifetime(java.lang.String lifetime)
                 throws java.lang.NumberFormatException
Sets the lifetime.
Parameters:
lifetime - lifetime

setLifetime

public void setLifetime(java.util.Date lifetime)
Sets the lifetime.
Parameters:
lifetime - lifetime

subtractLifetime

public void subtractLifetime(long life)
Subtracts lifetime.
Parameters:
life - life time [milliseconds]

toString

public java.lang.String toString()
Returns a string of the lifetime.
Overrides:
toString in class java.lang.Object
Returns:
a string of the lifetime

toString

public java.lang.String toString(boolean relative)
Returns a string of the lifetime.
Parameters:
relative - in relative format
Returns:
a string of the lifetime

toString

public java.lang.String toString(boolean relative,
                                 java.lang.String format)
Returns a string of the lifetime.
Parameters:
relative - in relative format
format - format of date string
Returns:
a string of the lifetime