/** * Gets the top element of the node <code>key</code>. * @param key the node * @return the top element */ public Key getTop( Key key ){ if( !isNode( key )) throw new IllegalArgumentException( "Not a node" ); return key.asNode().keyA; }
/** * Gets the divider of the node <code>key</code>. * @param key the node * @return the divider, a number between 0 and 1 */ public double getDivider( Key key ){ if( !isNode( key )) throw new IllegalArgumentException( "Not a node" ); return key.asNode().divider; }
/** * Gets the right element of the node <code>key</code>. * @param key the node * @return the right element */ public Key getRight( Key key ){ if( !isNode( key )) throw new IllegalArgumentException( "Not a node" ); return key.asNode().keyB; }
/** * Gets the divider of the node <code>key</code>. * @param key the node * @return the divider, a number between 0 and 1 */ public double getDivider( Key key ){ if( !isNode( key )) throw new IllegalArgumentException( "Not a node" ); return key.asNode().divider; }
/** * Gets the left element of the node <code>key</code>. * @param key the node * @return the left element */ public Key getLeft( Key key ){ if( !isNode( key )) throw new IllegalArgumentException( "Not a node" ); return key.asNode().keyA; }
/** * Tells whether the node <code>key</code> represents a horizontal * or a vertical node. * @param key the node * @return <code>true</code> if the elements are laid out horizontally, * <code>false</code> if the are vertically */ public boolean isHorizontal( Key key ){ if( !isNode( key )) throw new IllegalArgumentException( "Not a node" ); return key.asNode().horizontal; }
/** * Gets the top element of the node <code>key</code>. * @param key the node * @return the top element */ public Key getTop( Key key ){ if( !isNode( key )) throw new IllegalArgumentException( "Not a node" ); return key.asNode().keyA; }
/** * Gets the left element of the node <code>key</code>. * @param key the node * @return the left element */ public Key getLeft( Key key ){ if( !isNode( key )) throw new IllegalArgumentException( "Not a node" ); return key.asNode().keyA; }
/** * Tells whether <code>key</code> represents a node or not. * @param key the key to test * @return <code>true</code> if <code>key</code> is a node */ public boolean isNode( Key key ){ return key.asNode() != null; }
/** * Gets the bottom element of the node <code>key</code>. * @param key the node * @return the bottom element */ public Key getBottom( Key key ){ if( !isNode( key )) throw new IllegalArgumentException( "Not a node" ); return key.asNode().keyB; }
/** * Tells whether the node <code>key</code> represents a horizontal * or a vertical node. * @param key the node * @return <code>true</code> if the elements are laid out horizontally, * <code>false</code> if the are vertically */ public boolean isHorizontal( Key key ){ if( !isNode( key )) throw new IllegalArgumentException( "Not a node" ); return key.asNode().horizontal; }
/** * Gets the bottom element of the node <code>key</code>. * @param key the node * @return the bottom element */ public Key getBottom( Key key ){ if( !isNode( key )) throw new IllegalArgumentException( "Not a node" ); return key.asNode().keyB; }
/** * Gets the right element of the node <code>key</code>. * @param key the node * @return the right element */ public Key getRight( Key key ){ if( !isNode( key )) throw new IllegalArgumentException( "Not a node" ); return key.asNode().keyB; }
/** * Tells whether <code>key</code> represents a node or not. * @param key the key to test * @return <code>true</code> if <code>key</code> is a node */ public boolean isNode( Key key ){ return key.asNode() != null; }