org.objectweb.fractal.adl.timestamp
Class Timestamp

java.lang.Object
  extended by org.objectweb.fractal.adl.timestamp.Timestamp
All Implemented Interfaces:
MergeableDecoration

public class Timestamp
extends java.lang.Object
implements MergeableDecoration

Allows to attach timestamp information to AST nodes.


Field Summary
static java.lang.String TIMESTAMP_DECORATION
          the name of the decoration used to attache timestamp values.
 
Constructor Summary
Timestamp()
           
 
Method Summary
 boolean equals(java.lang.Object obj)
           
static long getTimestamp(Node node)
          Returns the value of the attached timestamp or zero if the given node has no attached timestamp.
 int hashCode()
           
static boolean isNodeMoreRecentThan(Node node, java.io.File file)
          Returns true if and only if the given node has an attached timestamp and is greater than the timestamp of the given file, or the node has no attached timestamp, or the file does not exist.
static boolean isNodeMoreRecentThan(Node node, long timestamp)
          Returns true if and only if the given node has an attached timestamp and is greater than the given timestamp, or the node has no attached timestamp, or the given timestamp is null.
 java.lang.Object mergeDecoration(java.lang.Object overridingDecoration)
           
static void setTimestamp(Node node, java.io.File file)
          Attaches the timestamp of the given file to the given node.
static void setTimestamp(Node node, long timestamp)
          Attaches the given timestamp to the given node.
static void setTimestamp(Node node, java.net.URL url)
          Attaches the timestamp of the file denoted by the given URL to the given node.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

TIMESTAMP_DECORATION

public static final java.lang.String TIMESTAMP_DECORATION
the name of the decoration used to attache timestamp values.

See Also:
Constant Field Values
Constructor Detail

Timestamp

public Timestamp()
Method Detail

mergeDecoration

public java.lang.Object mergeDecoration(java.lang.Object overridingDecoration)
                                 throws MergeException
Specified by:
mergeDecoration in interface MergeableDecoration
Throws:
MergeException

setTimestamp

public static void setTimestamp(Node node,
                                long timestamp)
Attaches the given timestamp to the given node. If the given node has already an attached timestamp, the greatest timestamp value is attached.

Parameters:
node - the node to which the timestamp will be attached.
timestamp - the timestamp value;

setTimestamp

public static void setTimestamp(Node node,
                                java.io.File file)
Attaches the timestamp of the given file to the given node.

Parameters:
node - the node to which the timestamp will be attached.
file - a file
See Also:
setTimestamp(Node, long)

setTimestamp

public static void setTimestamp(Node node,
                                java.net.URL url)
Attaches the timestamp of the file denoted by the given URL to the given node. If the given URL does not denote a local file, the timestamp is set to 0.

Parameters:
node - the node to which the timestamp will be attached.
url - a URL.
See Also:
setTimestamp(Node, long)

getTimestamp

public static long getTimestamp(Node node)
Returns the value of the attached timestamp or zero if the given node has no attached timestamp.

Parameters:
node - a node.
Returns:
the value of the attached timestamp or zero.

isNodeMoreRecentThan

public static boolean isNodeMoreRecentThan(Node node,
                                           long timestamp)
Returns true if and only if the given node has an attached timestamp and is greater than the given timestamp, or the node has no attached timestamp, or the given timestamp is null.

Parameters:
node - a node.
timestamp - the timestamp to be compared.
Returns:
true if and only if the given node has an attached timestamp and is greater than the given timestamp, or the node has no attached timestamp.

isNodeMoreRecentThan

public static boolean isNodeMoreRecentThan(Node node,
                                           java.io.File file)
Returns true if and only if the given node has an attached timestamp and is greater than the timestamp of the given file, or the node has no attached timestamp, or the file does not exist.

Parameters:
node - a node.
file - a file.
Returns:
true if and only if the given node has an attached timestamp and is greater than the given timestamp, or the node has no attached timestamp.

equals

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

hashCode

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

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object


Copyright © 2001-2010 ObjectWeb Consortium. All Rights Reserved.