Ila

org.topoweb.ila
Class Node

java.lang.Object
  |
  +--org.topoweb.ila.Node
All Implemented Interfaces:
java.lang.Comparable
Direct Known Subclasses:
LinkNode

public class Node
extends java.lang.Object
implements java.lang.Comparable

The respresentation of linked object in the Ila system. A Node instance is not the object itself, but just a representation of it. For a node representing something on an HTTP server, for example, you can get the actual resouce as follows:

      Node node = ..
      org.topoweb.net.OriTranslator trans = ..
      URI nodeUri = trans.toUri(node.getOri());
      nodeUri.toURL().openConnection();
      ..
 
Instances are immutable. This class may be subclassed, but the accessor methods implemented here are final.

Author:
Babak Farhang
See Also:
Ori, State

Constructor Summary
Node(org.topoweb.net.Ori ori, State state)
          Constructs a new instance with the given identifier and state.
 
Method Summary
 int compareTo(Node other)
          Compares this instance with the other.
 int compareTo(java.lang.Object other)
          Compares this instance with the other.
 boolean equals(Node other)
          Tests whether the other instance is equal to this instance.
 boolean equals(java.lang.Object other)
          Tests whether the other instance is equal to this instance.
 org.topoweb.net.Ori getOri()
          Returns this instance's identifier.
 State getState()
          Returns the state of this instance.
 int hashCode()
          Returns the hashcode as per the general contract.
 java.lang.String toString()
          Returns the string representation of this instance.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Node

public Node(org.topoweb.net.Ori ori,
            State state)
Constructs a new instance with the given identifier and state.

Parameters:
ori - the node's identifier
state - the node's state
Throws:
java.lang.NullPointerException - if either of ori or state is null
Method Detail

getOri

public final org.topoweb.net.Ori getOri()
Returns this instance's identifier. All comparison methods are implemented based on the value of the Ori returned by this instance.

Returns:
the intance's identifier.

getState

public State getState()
Returns the state of this instance. The returned State object is not used to compare one Node instance against another.

Returns:
the instance's state

equals

public final boolean equals(java.lang.Object other)
Tests whether the other instance is equal to this instance.

Overrides:
equals in class java.lang.Object
Parameters:
other - the other instance
Returns:
true, if equal; false , o.w.
See Also:
equals(Node), hashCode()

equals

public final boolean equals(Node other)
Tests whether the other instance is equal to this instance. Two instances are equal if they have the same Oris.

Parameters:
other - the other instance
Returns:
true, if equal; false , o.w.

hashCode

public final int hashCode()
Returns the hashcode as per the general contract. Consistent with the equals method.

Overrides:
hashCode in class java.lang.Object
Returns:
the hashcode
See Also:
equals(Object)

compareTo

public final int compareTo(java.lang.Object other)
Compares this instance with the other. Consistent with equals.

Specified by:
compareTo in interface java.lang.Comparable
See Also:
compareTo(Node)

compareTo

public final int compareTo(Node other)
Compares this instance with the other. The return value is based on the lexicographic comparison of the two instances' identifiers.

See Also:
Ori.compareTo(Ori)

toString

public final java.lang.String toString()
Returns the string representation of this instance. The string representation of Node is just the string reprsentation of its ORI.

Overrides:
toString in class java.lang.Object
Returns:
the instance's Ori: getOri().toString()

Ila

Copyright (C) 2002 Babak Farhang

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.