Ila

org.topoweb.ila
Class LinkNode

java.lang.Object
  |
  +--org.topoweb.ila.Node
        |
        +--org.topoweb.ila.LinkNode
All Implemented Interfaces:
java.lang.Comparable, NodeConstants

public class LinkNode
extends Node
implements NodeConstants

A Node subclass which may contain references to other linked Node instances. The returned links may be a subset of the available links for the node in Ila. Immutability of instances is subject to the qualifications documented for NodeSet.

Author:
Babak Farhang
See Also:
getForelinks(), getBacklinks(), getLinks(int), NodeSet

Field Summary
 
Fields inherited from interface org.topoweb.ila.NodeConstants
BACK, FIRST_PAGE, FORE, LAST_PAGE, LINK_MASK, PAGE_MASK
 
Constructor Summary
LinkNode(org.topoweb.net.Ori ori, State state, NodeSet fore, NodeSet back)
          Creates a new instance with the specified ori, state, forelinks and backlinks.
 
Method Summary
 NodeSet getBacklinks()
          Returns the backlinks.
 NodeSet getForelinks()
          Returns the forelinks.
 NodeSet getLinks(int type)
          Returns the links for the given type.
 
Methods inherited from class org.topoweb.ila.Node
compareTo, compareTo, equals, equals, getOri, getState, hashCode, toString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

LinkNode

public LinkNode(org.topoweb.net.Ori ori,
                State state,
                NodeSet fore,
                NodeSet back)
Creates a new instance with the specified ori, state, forelinks and backlinks. The [fore/back] links are expressed as node sets. The value null for either of the node sets is taken to mean NodeSet.UNKNOWN.

Parameters:
ori - the ORI
state - the state
fore - the forelinks (may be null)
back - the backlinks (may be null)
Throws:
java.lang.IllegalArgumentException - if the size of any of the node sets, fore or back is greater than the total corresponding size as advertised by state.getLinkCount(FORE / BACK)
Method Detail

getForelinks

public final NodeSet getForelinks()
Returns the forelinks.

Returns:
the forward links

getBacklinks

public final NodeSet getBacklinks()
Returns the backlinks.

Returns:
the backward links

getLinks

public final NodeSet getLinks(int type)
Returns the links for the given type. The link type is resolved by examining the link bit field: (type & LINK_MASK).

Parameters:
type - the link type
Returns:
the links for specified type
See Also:
NodeConstants

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.