Tree Manipulation

I have a help screen in my application which has a tree on the left and help verbiage on the right. The tree leafs/nodes correspond to the pages in my application. The help verbiage displayed depends on the leaf/node clicked on the tree (clicking on the leaf/node corresponding to page 12 displays help verbiage for page 12). I get to the help page by clicking on a help icon in a nav bar passing in the page I'm coming from and help for that page is displayed automatically.
The tree is built from a table which has the columns
PAGEID (PK)
PARENTPAGEID (FK)
PAGENAME
REFERSTOPAGE (the actual application page number of this page).
A couple of questions:
1. Is it possible to ensure only the branch which contains the page I'm coming from is expanded and all others collapsed when I go to the help page?
2. Once on the help page, is there a way to collapse all other branches when expanding one branch (branch 2 is open, expanding branch 3 causes branch 2 to collapse)?

Hi,
Here example of procedure of search on a tree
Procedure Tree_Find_Label(TLabel In Varchar2) Is
     find_node ftree.node;
     Begin
     find_node:= ftree.find_tree_node(B.Tree, TLabel, ftree.FIND_NEXT, ftree.Node_Label, ftree.ROOT_NODE, ftree.ROOT_NODE);
     if not ftree.id_null(find_node) then
          ftree.set_tree_selection(B.Tree, find_node, ftree.SELECT_ON);
          Go_Item(B.Tree);
          execute_trigger('WHEN-TREE-NODE-SELECTED'); -- Works correctly if Multi-Selection -No
     end if;
     end;

Similar Messages

  • Component tree manipulation

    hi,
    when would be the best time to manipulate the component tree for a page during the ADF Page Lifecycle?
    thanks
    David

    Hi,
    what is the usecase for modifying the component tree and why can't this be done in a PhaseListener?
    Frank

  • Dynamic content generation

    I have a scenario when user clicks on a button and in response should see another line of input components added. It is not known in advance how many will be needed.
    So if there is a button with label "Add additional items" I want to render more components on the page. I know of rendered="#{true/false} control but since I dont know how many times the user will want to select the Add additional items I need to generate components dynamically, to allow for additional input
    Any help would be greatly appreciated.
    Thanks

    This is a what I am trying to accomplish here. It is very simple with JSTL. foreach tag but I cant seem to picture this how it would work in JSF. If backing bean and component tree manipulation is the only way to get this to work then let me say that JSF made it a lot harder to do what isnt really that hard.
    <body>
    <form method="POST" action="--WEBBOT-SELF--">
    <!--webbot bot="SaveResults" U-File="fpweb:///_private/form_results.txt"
    S-Format="TEXT/CSV" S-Label-Fields="TRUE" -->
    <table border="1" cellpadding="2" width="100%">
    <tr>
    <td width="33%">First name<input type="text" name="T1" size="20"></td>
    <td width="33%">Last Name<input type="text" name="T2" size="20"></td>
    <td width="34%"><input type="button" value="Add another" name="B3"> <input type="button" value="Delete this line" name="B4"></td>
    </tr>
    <tr>
    <td width="33%">First name<input type="text" name="T1" size="20"></td>
    <td width="33%">Last Name<input type="text" name="T2" size="20"></td>
    <td width="34%"><input type="button" value="Add another" name="B3"> <input type="button" value="Delete this line" name="B4"></td>
    </tr>
    <tr>
    <td width="33%">?</td>
    <td width="33%">?</td>
    <td width="34%">?</td>
    </tr>
    </table>
    <p>?</p>
    <p><input type="submit" value="Submit" name="B1"><input type="reset" value="Reset" name="B2"></p>
    </form>

  • Dreamweaver cc2014 - mode grille de mise en page fluide

    Bonjour
    j'ai un souci avec dream. Quand je créé un document vierge en mode grille fluide, les "blocs" peuvent être manipulés avec les poignées de redimensionnement, qui vont générer une dimension en colonne, laquelle sera traduite en pourcentage dans les feuilles de styles css responsive.
    Dès qu'on travail un peu sur le fichier, tres vite la fonctionnalité de manipulation par "poignées" disparait et on ne peut plus générer les css responsive ?
    avez vous rencontré le probleme ?

    Yes I know that you are using Dreamweaver CS6 12.2 last update. Again I do not use it, sorry.
    Maybe someone that does have the version installed, will be able to help you.

  • Preloading data. Problem with beforePhase

    Hi, all!
    I have a little problem. I have an ArrayList that is filled by some method. I want to fill it one time. before my web-page is loaded. But if user refreshes the web-page, my ArrayList must be refilled.
    I've tried to use beforePhase, but in weblogic console I see, that it fired 2 times.
    Is there another ways?
    I have a static class, that prepares data:
    public class PrepDataUtils {
    private static ArrayList<SVNDirEntry> treeDataArr;
    public static void prepareTreeData() {
    System.out.println( "======prepareTreeData======");
    SvnUtils su = new SvnUtils("");
    treeDataArr = su.getSVNTags();
    public static ArrayList<SVNDirEntry> getTreeDataArr() {
    return treeDataArr;
    In manage bean there is a method that fires on beforePhase:
    public void onBeforePhase(PhaseEvent phaseEvent) {
    if(phaseEvent.getPhaseId()== PhaseId.RENDER_RESPONSE) {
    System.out.println( "======onBeforePhase======"+phaseEvent.getPhaseId()+", "+new Date(System.currentTimeMillis()));
    PrepDataUtils.prepareTreeData();
    And in weblogic console I see:
    ======onBeforePhase======RENDER_RESPONSE 6, Tue Jun 26 16:07:38 MSD 2012
    ======prepareTreeData======
    ======createTree======
    iter size = 120
    ======createTree======
    iter size = 120
    ======onBeforePhase======RENDER_RESPONSE 6, Tue Jun 26 16:07:38 MSD 2012
    ======prepareTreeData======
    Edited by: Vis555 on Jun 26, 2012 4:23 PM

    I have a table and a tree. Let me describe all what I want to do.
    I have an application with navigation tree in left side and table in right. Data that I use to build a tree I get from SVN by some methods. Finally, I have an ArrayList that is used by tree. Also I have some filters that reduce tree rows.
    When user clickes on tree node, table on the right side is filled by some kind of data.
    So I want to save original (full, not filtered) tree data somewhere. And then I'll use this data for tree manipulations.
    But when user refreshes page, I need to refresh tree data too.
    Edited by: Vis555 on Jun 28, 2012 10:41 PM

  • Confusion on choosing the right Java XML tehcnology

    Hi there,
    I have a question about Java XML. I am still confuse on whether should I choose JAXP or JAXB for XML documents processing. I need to access a the configuration values form a properties file which stored in XML format to startup an application server, the configuration values might be using while the application server is running all the time. And probably write a tool to add/delete/modify the config values in XML file. From my point of view, I think JAXB is suitable for my needs, but I'm not sure whether the DOM tree manipulation from JAXP will be useful in my application or not. Any suggestion?
    Thanks,
    Jax

    You might want to have a look at the tutorials here:
    http://java.sun.com/webservices/docs/1.1/tutorial/doc/index.html
    When you go to the page about JAXP you will see that it says, right up front, "The Java API for XML Processing (JAXP) makes it easy to process XML data using applications written in the Java programming language." That sounds like what you want to do. And the page about JAXB says "The Java Architecture for XML Binding (JAXB) is a Java technology that enables you to generate Java classes from XML schemas." That doesn't sound like what you want to do.

  • Is it possible to do this sort of sophisticated manipulation with a TREE?

    We want to replace our normal Oracle forms menu system with a tree.
    However, we have a requirement like this:
    (1.) We want to stop using roles to grant access to menu options.
    Now what happens is:
    -- We create a db role for every form (using the form name as the role name).
    -- before we launch the form from the menu we check whether the user has been granted this role.
    -- If he has not been granted the role we give an error message
    (2.) So now, instead of showing ALL the menu options and giving error messages when a user trying to invoke a form to which has no access to, we want to show in the tree ONLY THE MENU options he can access.
    (3.) In order to do this we want to create templates, which consist of SUBSETS of the tree to which the user can access.
    (4.) So instead of having a form to assign form roles to users, we want to have a form where on the left the entire menu is shown and the right another box where admin user can create template menus (i.e. a sub-set of the main menu).
    (5.) We have to have <-- and --> buttons to shift the menus from left to right.
    Below image shows what the menu template building form will look like:
    http://www.freeimagehosting.net/uploads/4b4dd38668.gif
    Is this sort very sophisticated menu manipulation possible with the menu item in Oracle forms?

    Any thing is possible but i think you are taking this to little complicated way.
    My Idea is
    - Create tables contains all Menu names with their types like FORM, REPORTS etc etc
    - Table for all Application Roles
    - Table to store information Role's Menus ( Like Admin can have multiple Create user form, Change password form)
    - Table for all users
    - Table to assign Users specific Roles ( John can be Admin , Manager)
    - Create query to populate tree with User who logged in retrieve his Roles You can always get how many Menu should display on Run time
    My 2 cents
    Baig,
    http://baigsorcl.blogspot.com

  • Manipulating the component tree at runtime

    How is it possible to add components into a form at runtime. I need to create role specific menues after login. I have tried adding new children to the form object but they do not seem to render.

    in a short word, when is the rendered attribute value processed?is it part of the request map, and at Restore View Phase when restore the component tree, the inputText component will not be restored,and is this the reason the new name value is not applied?
    But if i change the editable attribute in the same class( User.java) with the name attribute,and change the jsf code like this:
    <h:selectBooleanCheckbox value="#{user.editable}" onclick="submit()"></h:selectBooleanCheckbox>
          <h:inputText  value="#{user.name}" rendered="#{user.editable}" required="true"></h:inputText>
          <h:outputText value="#{user.name}" rendered="#{not user.editable}"></h:outputText>The new value is applied!!
    Please give some suggestion, and many many thanks:)
    Best Regards:)
    Robin

  • Manipulating pojo based af:tree

    Hi Guys
    I need to build an af:tree component from pojo datacontrol. I should be able to add/delete a child/subling by just doing a right click on the tree element and choosing the corresponding option from context menu. While adding the sibling/child i should be able to give the options like adding 5 elements as child/sibling.. Do we have any sample for this..
    I have seen http://www.oracle.com/technetwork/developer-tools/adf/learnmore/38-pojo-editable-tree-169180.pdf but my requirement is much more than this.. I guess this a common reuqirement.. so checking for some readymade solutions to save time..
    Thanks
    Edited by: 928214 on Jan 28, 2013 7:35 AM

    Any suggestions?

  • Creating/manipulating hierarchial tree with ACTIVEX[comctl32.ocx]!!!

    Hello!
    Can anyone help me about how can i manipulate an activex tree with comctl32.ocx????
    i created an activex item (that will be the tree), and i inserted some node into the tree. it works fine, but how can i find a node, or get the key and text value??? how can i delete??? these methods are unknow for me...
    is there a documentation, that write down the funnction of all methods??? Please HELP!!! It would be a good solution to create a fast, and more powerful hierarchial tree in Forms6i. But should be a description about the COMCTL32.OCX "ComCTL.Treectl.1" methods...
    thanks in advance: [email protected] Tamas Urban

    This is a Microsoft Control so http://msdn.microsoft.com should be the place to go

  • How to populate a adf tree programmatically

    Hi,
    I am creating a adf tree (single select) which is the menu of my application.
    Each node of my tree is a command link.
    I am reading the data from a table through a view object (adfbc).
    I want to somehow manipulate my managed bean so that I can display selected rows (permission based) in the adf tree.
    If I am using the condition in the rendered attribute then the nodestamp facet is still rendered and there is a blank row displayed for a node which should not be displayed.
    The other way I was thinking to Iterate the entire tree in my managed bean and remove the nodes which should not be displayed.
    This way the tree is manipulated before it is endered and hence it will not have any blank row in the place of nodes not to be shown.
    Please let me know a few iterating code strip and where(in which method) I should put it in my managed bean to make it work?
    As of now I was putting a tree iterator code in the getMenuTree() method of my managed bean where menuTree is the RichTree object for the tree which I have to render in my UI.
    CollectionModel model = (CollectionModel)this.menuTree.getValue;
    treeBinding = (JUCtrlHierBinding)model.getWrappedData();
    JUCtrlHierNodeBinding root = treeBinding.getRootNodeBinding();
    checkPermission(root);
    List<JUCtrlHierNodeBinding> children = root.getChildren();
    if (children != null)
    for (JUCtrlHierNodeBinding _node : children)
    checkPermission(_node);
    checkPermission - is the method which reads few bindings from the node and decides that this node id eligible for display or not based on user permission.
    But with this code I am getting the node hierarchical structure of the selected node only.
    Thanks in advance

    I thought in this direction... but I cannot access the permission data from VO level as I have to provide this menu interface to multiple projects.
    And the menu I am creating is in a template from where I need to get permission bean of various other projects.
    any other suggestions ?

  • How to create a tree structure using forms.

    Hi,
    How do i create a tree structure using oracle forms,i have a table named Functions and a specific column 'Function Name' should be displayed in the tree nodes.Can anyone help me out on how to create a tree structure and populating the nodes??
    thanks in advance
    Regards
    Karthik

    The FTree package provides functions to populate the tree - look for the topic "Manipulating a hierarchical tree at runtime
    " in the online help this point to all the functions and triggers

  • My B+Tree can compile but have runtime error ... i can't tink why ...

    Sorry to bother anyone ... i have spent almost 3 weeks trying to debug the problem...
    My B+ Tree can compile but can't run as it throw invalid Null pointer Exception ..
    I suspected the error is in the split (int order ) method in the BTreeNode class but i can't remedy for it
    This my program code
    public class BTree {
    * The order of the B-Tree. All nodes of the B-Tree can store up to 2*order key values.
    private int order;
    * The number of key (with associated data values) stored in the B-Tree.
    private int count;
    * The root node of the B-Tree
    private BTreeNode root;
    * The first leaf node in the B-Tree. This field is used to give the starting point for sequential
    * access to the keys and data stored in the leaf nodes.
    private BTreeNode first;
    * The last leaf node in the B-Tree. This field is used to give the starting point for reverse
    * sequential access to the keys and data stored in the leaf nodes.
    private BTreeNode last;
    * A change count that can be used to invalidate iterators. This field is updated whenever a key plus data pair
    * is added to the B-Tree (or the data associated with a key is changed), or when a key plus data pair are
    * deleted from the B-Tree.
    private int changeCount = 0;
    // WHEN DOING ASSIGNMENT 5, DO NOT ADD ANY ADDITIONAL FIELDS TO THIS CLASS
    // You will loose marks if you add additional fields to this class. The fields above are all that
    // you need. If you need a variable in a method, use a local variable. I have seen too many
    // assignments where students add fields rather than create local variables. Hopefull the threat
    // of loosing (quite a few) marks will help reduce this habit.
    * A general exception class for errors when constructing or manipulating a B-Tree. Use the string
    * parameter to the constructor to say what the error really is.
    public class BTreeError extends RuntimeException {
    public BTreeError(String reason) {
    super(reason);
    * A constructor that creates an empty B-Tree of the given order.
    * <p/>This is the only constructor provided at the moment for this BTree class. Could consider
    * adding the equivalent of a 'copy constructor' that creates a new BTree object from an existing
    * BTree object.Constructor
    * creates the root of a btree
    * A constructor that creates an empty B-Tree of the given order.
    * <p/>This constructor need to copy the order parameter to the field of same name, and initialise the
    * root, cound, first and last fields of the BTree object.
    * @param order The order of the BTree.
    public BTree(int order) {
    count = 0;
    this.order = order;
    root = new BTreeNode(true, null, -1, null, null);
    first = root;
    last = root;
    * A method to return a SequentialIterator object that is positioned just before the first key
    * of the BTree object.
    * <p/>Do not modify this method.
    * @return A SequentialIterator object.
    public SequentialIterator iterator() {
    return new BTreeIterator();
    * A mehtod to return a SequentialIterator object that is positioned at a key found through a call
    * to the searchFor() method.
    * <p/>Do not modify this method.
    * @param position A SearchPosition() object that usually has been returne by a call to the searchFor() method.
    * @return A SequentialIterator object initialised to start at particular key in the BTree.
    public SequentialIterator iterator(SearchPosition position) {
    return new BTreeIterator(position);
    * A method to return a string representationo the BTree.
    * <p>The format of the string is:
    * <pre>BTree: Order=<digits>, size=<digits>, root=<BTreeNode string></pre>
    * <p/>Do not modify this method.
    * @return A string to represent the BTree
    public String toString() {
    StringBuffer s = new StringBuffer("BTree: Order=");
    s.append(order).append(", size=").append(size()).append(", root=").append(root.toString());
    return s.toString();
    * Method to determine the number of records stored in the B-Treee.
    * <p/>Do not modify this method
    * @return the number of records in the B-Tree.
    public int size() {
    return count;
    * method to return the order of the B-Tree.
    * <p/>
    * <p>This is the smallest number of key values for all nodes
    * except the root node. The maximum number of key values in a node is 2*order, and the maximum number
    * of child nodes for a node is 2*order+1.
    * <p/>Do not modify this method.
    * @return The order of the B-tree.
    public int order() {
    return order;
    * Insert a key plus data value into the BTree.
    * <p/>This method needs to locate the leaf node in which the key + data value should be
    * inserted, and then call the insertLeaf() method of BTreeNode to do the insertion.
    * <p/>This method will always result in a change to the BTree, so it should increment
    * the change count.
    * <p/>The method may result in only the data associated with an existing ke being changed,
    * so incrementing the count field should be done in the BTreeNode method (if needed).
    * <p/>This is one of the method you need to complete for assignment 5.
    * @param key The key associated with the data value to be added to the B-Tree
    * @param data The data value to be added (with it's associated key) to the B-Tree.
    public void add(Comparable key, Object data) {
    // you need to add the code for this method
    // i added
    BTreeNode btNode = root;
    while (!btNode.isLeaf) {
    int i=0;
    while(key.compareTo(btNode.keys) > 0) {
    i++;
    if (i == btNode.numberOfKeys) break;
    btNode = btNode.childNodes[i];
    btNode.insert(key,data);
    if (root.numberOfKeys == order*2-1) root.split(order);
    * insert a object with the given key into the tree
    //KeyNode keyNode = new KeyNode(key, data);
    // BTreeNode keyNode = new BTreeNode(key,data);
    BTreeNode btNode = root;
    while (!btNode.isLeaf) {
    int i=0;
    while(key.compareTo(btNode.key(i)) > 0) {
    i++;
    if (i == btNode.numberOfKeys())
    break;
    btNode = btNode.child(i); }
    System.out.println("hmm1");
    btNode.insert(key,data );
    System.out.println("hmm2");
    if (root.numberOfKeys == order*2-1)
    System.out.println("hmm3");
    root.split(order);
    System.out.println("hmm4");
    * This method searches the B-Tree for an occurence of the key in a leaf node and returns the result
    * of the search in a SearchPosition object.
    * <p/>Note that the key may occur in an interior node of the BTree without occuring in the leaf
    * nodes. This can be the result of a deletion operation. This method need to search down to the
    * leaf node that should contain the key if the key and associated data is in the B-Tree, and then
    * scan through the keys in the leaf node for the search key.
    * <p/>The result of the search is returned as a SearchPosition object, as this allow the return
    * of the success or failure of the search, as well as the data belonging to the key. It also
    * allows position information to be returned so that an interator can be initialised with the
    * key as the starting position for subsequent sequential access to adjacent keys.
    * <p/>This is one of the method you need to implement.
    * <p/>Implementation nodes:<br>
    * You need to find the leaf node that may contain the key (same code as for add()), then
    * scan the leaf BTreeNode for the search tree. You can do this within this method, as you
    * have total access to the fields and methods of BTreeNode (as BTreeNode is an inner class
    * of BTree). If you find the key, construct and return a SearchPosition object with the appropriate
    * details of the position, otherwise construct add return a SearchPosition object that indicates the
    * search failed.
    * @param key The key to search for in the BTree
    * @return A SearchPosition object returning the data and position information for the search
    public SearchPosition searchFor(Comparable key) {
    // You need to add the code for this method. The code below simply creates a
    // SearchPosition object which indicates an unsuccessful search.
    return new SearchPosition(false, null, -1);
    * A method to delete a node from the BTree.
    * <p/>The method should return the data object that was deleted when the key plus data object pair
    * are deleted from the B-tree.
    * <p/>The method should throw a BTreeError exception (with an appropriate reason string) if the
    * key is not found in the B-tree.
    * <p/>This is a method you can implement for bonus marks in Assignment 5.
    * <p/>Implementation notes:<br>
    * The easiest way to proceed is to use searchFor() to determine if they key is in the BTree, and
    * (if it is in the B-tree) to return position information about the key. Throw an exception if the
    * key is not in the B-tree, otherwise keep a copy of the data assocaited with the key (to return),
    * then for the leaf node containing the key (a BTreeNode object), call the deleteLeafNodeKey() method,
    * passing across the leaf key index of the key (so you don't have to find it again in the leaf node).
    * After this method deletes the key, return the data you saved as the method result.
    * @param key The key to delete (along with it's associated data) from the B-tree.
    * @return The data associated with the key that was deleted.
    public Object delete(Comparable key){
    // You need to add the code for this method.
    return null;
    * The inner class BTreeNode is used to represent the nodes in the B-Tree.
    * <p/>The nodes in the BTree are of two types:
    * <ol>
    * <li>Leaf nodes that contain the keys and associated data values, stored in ascending key order.<br>
    * These leaf nodes have next and previous pointers to adjacent leaf nodes to allow an easy
    * implementation of an iterator class to provide bi-directional sequential access to the keys stored
    * in the BTree nodes.
    * <li>Interior nodes that contain keys and links to child nodes (that are either all internal nodes
    * or all leaf nodes), organised as the node of a multi-way search tree. The interior nodes have
    * one more child node link than keys. The child node link at index k is to a node with keys that
    * are all less than the key at index k in this node. The link at index k+1 is to a child node
    * with keys that are all greater than or equal to the key at index k.
    * </ol>
    * The BTreeNode class allows you to create these two 'types' of nodes, depending on the parameters
    * passed to the constructor.
    * <p/>There are methods that should only be called for leaf nodes and methods that should only be
    * called for interior nodes. These methods should throw an exception if called by the wrong node
    * type. This class should really be designed using inheritance to mimic the pascal/C++ variant
    * record structure, but this design is relatively easy to understand and to implement.
    * <p/>Note that this class is an inner class of BTree, and so all objects will have an implict
    * reference to the BTree container object. This class has direct access to all the fields of the
    * BTree contaner object. In particular, the order of the BTree is available, hence this class
    * does not need to keep a copy of the order as a field.
    * <p/>Skeleton class provided for Objects and Algorithms Assignment 5
    * <p/>Only modify the methods where the JavaDoc indicates that you need to provide code.
    * @author a.sobey
    * @version 1.0
    * Date: 16/05/2005
    public class BTreeNode {
    * The actual number of key values stored in the BTreeNode. <br>Note that the BTree node has an implicit
    * reference to the containing BTree object, and the maximum number of nodes that can be stored in a
    * a BTreeNode (except temporarily during the split operation) is twice the <i>order</i> of the BTree.<br>
    * This field is valid for both internal and leaf nodes.
    private int numberOfKeys = 0;
    * The array of pointers to child nodes of this node. Only <i>(numberOfKeys+1)</i> are valid if <i>numberOfKeys</i>
    * is non-zero.<br>
    * This array is only valid and created for internal nodes - this array is not created for leaf nodes.<br>
    * There is space in the array created for one additional child node link - this makes the coding for
    * splitting of an internal node easier to implement.
    private BTreeNode[] childNodes;
    * A reference to the parent node of this node.<br>
    * This link is null if this node is the root node of the tree of BTreeNodes.<br>
    * This node is valid for both internal and leaf nodes.
    private BTreeNode parent;
    * The index in the parent node's array of links (the <i>childNodes</i> array) for the link to this node.<br>
    * This value should be set to -1 if this node is the root node (and so has no parent node).<br>
    * This field is valid for both internal and leaf nodes.
    private int parentIndex;
    * A link to the next leaf node in the B-tree, provided to allow easy sequential access of the keys
    * and values stored in the B-tree.<br>
    * This field is only valid if the node is a leaf node. For non-leaf nodes set the value to null.<br>
    * For leaf nodes, set the value to null if this node is the last leaf node in the B-tree.
    private BTreeNode next;
    * The link to the previous leaf node in the B-tree, provided ot allow easy reverse sequential access of the keys
    * and values stored in the B-Tree.<br>
    * This values should be set to null if this node is a leaf node but is the first leaf node in the B-Tree, or
    * if this node is not a leaf node.<br>
    * This field is only used in leaf nodes.
    private BTreeNode previous;
    * An array of comparable key objects that are stored in this node of the B-tree.<br>
    * Only the first <i>numberOfKey</i> values in the array are valid.<br>
    * The maximum number of keys in a node is 2*<i>order</i>, however there is space in this array
    * for one additional value to make the coding of the node splitting operation easier to implement.<br>
    * This field is valid for both internal and leaf nodes.
    private Comparable[] keys;
    * An array of data values associated with the keys stored in this leaf node of the B-tree.<br>
    * Only the first <i>numberOfKey</i> values are valid.<br>
    * The maximum number of data values in a node is 2*<i>order</i>, however there is space in this array
    * for one additional value to make the codingof the leaf node splitting operation easier to implement.<br>
    * This field is only valid for leaf nodes - for interior nodes this array is not created.
    private Object[] data;
    * A boolean value to indicate if the node is a leaf node or not. The structure of the remainder of the node
    * depends on this value (would be nice to have variant records in Java ...).<br>
    * This field is valid for both leaf and internal nodes.
    private boolean isLeaf;
    private int order;
    * The constructor for a BTreeNode.
    * <p/>The code for the constructor is provided - do not modify this constructor.
    * @param isLeaf True if this node is a leaf node.
    * @param parent A link to the parent node or null if this node is the root node of the B-Tree
    * @param parentIndex The index of the link in the array of child node linkes in the parent node that points to this node.
    * @param previous A link to the previous leaf node for sequentail access, or null if not a leaf node or no previous leaf nodes.
    * @param next A link to the next leaf node for sequential access, or null if not a leaf node or the last leaf node.
    public BTreeNode(boolean isLeaf, BTreeNode parent, int parentIndex, BTreeNode previous, BTreeNode next) {
    this.parent = parent;
    this.parentIndex = parentIndex;
    this.previous = previous;
    this.next = next;
    this.isLeaf = isLeaf;
    if (isLeaf)
    data = new Object[2 * order + 1];
    else
    childNodes = new BTreeNode[2 * order + 2];
    keys = new Comparable[2 * order + 1];
    public BTreeNode( int order, BTreeNode parent)
    this.order = order;
    this.parent=parent;
    this.keys = new Comparable[2*order-1];
    this.data = new Object[2*order-1];
    this.childNodes=new BTreeNode[2*order];
    this.isLeaf=true;
    * Returns the number of keys in this BTreeNode. Note that within the code in BTree you have access
    * to all the fields of BTreeNode, so this method is not strictly necessary.
    * @return The number of keys in this BTreeNode object.
    public int numberOfKeys() {
    return numberOfKeys;
    * Returns the container BTree object for this BTreeNode object. You may like to check that container objects
    * are the same when manipulating two BTreeNode objects.
    * @return the containing BTree object.
    public BTree container() {
    return BTree.this;
    * A private method to return a string representation of the array <i>keys</i>. This method is used in
    * the toString() method for this class.<br>
    * Do not modify the code provided for this method.
    * @return A string representation of this nodes array of keys.
    private String keyString() {
    StringBuffer s = new StringBuffer("{");
    for (int index = 0; index < numberOfKeys; index++)
    s.append(index > 0 ? "," + keys[index] : keys[index]);
    return s.append("}").toString();
    * A private method to return a string representation of the array of data values stored in a leaf node.<br>
    * This method is used in the toString() method of BTreeNode. The method does not check if this node is a
    * leaf node, as it is not intended to be called directly from outside of this class, and the toString()
    * method only calls this method if the node is a leaf node.<br>
    * Do not modify the provided code for this method.
    * @return a string representation of the data values array of a BTreeNode.
    private String dataString() {
    StringBuffer s = new StringBuffer("(");
    for (int index = 0; index < numberOfKeys; index++)
    s.append(index > 0 ? "," + data[index] : data[index]);
    return s.append(")").toString();
    * A private method to return a string prepresentation of the array of child node links in an interior node.<br>
    * This method is used in the toString() method. This method does not check if this node is an interior
    * node, so you must take care to only call this method for interior nodes.<br>
    * Do not modify the provided code for this method.
    * @return A string representation of the array of child nodes of this BTreeNode.
    private String childString() {
    StringBuffer s = new StringBuffer("<");
    for (int index = 0; index < numberOfKeys + 1; index++)
    s.append(childNodes[index] + (index == numberOfKeys ? "" : ","));
    return s.append(">").toString();
    * The toString method provides a string representation of a BTreeNode.<br> This particular method does not
    * include the details of all the fields of a BTreeNode. While debugging your code, you may like to include
    * more information (such as the parentIndex value), but in your final submission you must have the code
    * as provided in the skeleton BTreeNode class provided to you.
    * @return A string representation of a BTreeNode.
    public String toString() {
    if (isLeaf)
    return (new StringBuffer("[")).append(numberOfKeys)
    // .append(',').append(parentIndex) // uncomment this line if need to check parentIndex values
    .append(',').append(keyString()).append(',').append(dataString()).append(']').toString();
    else
    return (new StringBuffer("[")).append(numberOfKeys)
    //.append(',').append(parentIndex) // uncomment this line if need to check parentIndex values
    .append(',').append(keyString()).append(',').append(childString()).append(']').toString();
    * Returns the key with the given index in this node. Throws a BTreeError exception if the index is not valid.<br>
    * Do not modify this provided code.
    * @param index The index of the key.
    * @return The key value at the given index.
    public Comparable key(int index) {
    if (index < 0 || index >= numberOfKeys)
    throw new BTreeError("Key index out of range - value = " + index);
    return keys[index];
    * Returns the child node at the provided index into the childNodes array.<br>
    * A BTreeError exception is thrown if the node is not an internal
    * node or if the index is not valid.
    * <p/>Note that the child node returned will have keys that are all less than the key stored
    * in the <i>keys</i> array of this node at the given index value (except the last childNode
    * at index numberOfkeys, as this node has keys that are all greater than or equal to the last
    * key value stored in this node).<br>
    * Do not modify the provided code for this method.
    * @param index The index into the array of child nodes for this internal BTreeNode object.
    * @return The child node link.
    public BTreeNode child(int index) {
    if (isLeaf) throw new BTreeError("child() called for a leaf node");
    if (index < 0 || index > numberOfKeys)
    throw new BTreeError("Child node index out of range - value = " + index);
    return childNodes[index];
    * Returns the data value associated with the key at the given index. An BTreeError exception is thrown if the
    * node is not a leaf node or if the index is invalid.
    * <p/>Do not modify the provided code for this method.
    * @param index The index of the key assocaited with the data value.
    * @return The data value associated with the key with given index.
    public Object data(int index) {
    if (!isLeaf) throw new BTreeError("data() called for an internal node");
    if (index < 0 || index >= numberOfKeys)
    throw new BTreeError("Data index out of range - value = " + index);
    return data[index];
    * This method is used to determine if this node is a leaf node.
    * @return True if this node is a leaf node.
    public boolean isLeaf() {
    return isLeaf;
    * Inserts the (key, data) pair into this BTreeNode object.
    * <p/>You must supply the code for this method.
    * <p/>Implementation notes:<br>
    * <ol>
    * <li>Throw an exception if this node is not a leaf node.
    * <li>Scan the keys array for index of the key greater than or equal to the insertion key.
    * <li>If the key at the index is equal to the insertion key, update the data field and return - you are done.
    * <li>Otherwise shuffle the keys values from the insertion index along to make a hole for the insertion key,
    * and insert the insertion key into the keys array. Do the same for the data array values to insert the
    * new data value into the data array at the insertion index.
    * <li>increment the number of keys, and increment the container BTree object's count field.
    * <li>If the number of keys in the node is now no more than 2*order, you are done, so simply return.
    * <li>Otherwise the node has (2*order+1) key values, and need to split. The split operation leaves the first
    * <i>order</i> keys and data values in this node (and so the node's numberOfKeys value will become
    * <i>order</i>, and moves the remaining (order + 1) keys and data values to a new BTreeNode leaf node
    * that you need to create.<br>
    * You need to fix up the previous and next fields of this leaf node and the new leaf node you have created.<br>
    * Two sub-cases:
    * <ol>
    * <li>If this node is the root node (i.e., it does not have a parent node), the split of this node will create
    * a new root node, with a single key (the key at index (order+1)) and this node and the new BTreeNode as
    * the child nodes. In my solution I used a call to the method newRootNode to do this. The newRootNode()
    * method will also be used when a split of an interior node creates a new root node. See the JavaDoc for
    * details of what the newRootNode() method should do. Once the new root node has been created, and all
    * the fields updated due to the split, you are done.
    * <li>Otherwise we need to insert in this node's parent node the middle key (at index (order+1) and the
    * new node that we created. This is done by the method insertInterior(). The method is passed the
    * key to insert (at location this.parentIndex in the keys array of the parent node), the index to
    * to insert the key (this.parentIndex), and the new leaf node (that will be inserted at index
    * (this.parentIndex+1) in the parent node's child links array).
    * </ol>
    * </ol>
    * @param key The key to insert into the leaf node.
    * @param data The key's corresponding data value.
    public void insertLeaf(Comparable key, Object data) {
    // You need to provide the code for this method.
    // BTreeNode temp = new
    int size = this.data.length;
    int counter = 0;
    this.keys[size] = key;
    this.data[size] = data;
    sort(size);
    public int compareTo(Comparable o2) {
    // Integer o1 = (Integer) o2;
    return (((Integer)o2).compareTo(this));
    *split()
    *Splits a node into to nodes. This can only be done, if the node is full
    *The midlest key go up into the parent, the left ones of them rest in
    *this node, and the right ones go into a new node.
    private BTreeNode split(int order) {
    if (numberOfKeys == order*2-1) {
    BTreeNode right = null;
    if (parent == null) { // algo for the root-node
    BTreeNode left = new BTreeNode(order, this);
    right = new BTreeNode(order, this);
    for (int i=0; i<order-1; i++) {
    left.keys[i] = keys[i];
    left.data[i] = data[i];
    right.keys[i] = keys[order+i];
    right.data[i] = data[order+i];
    if (!isLeaf()) {
    for (int i=0; i<order; i++) {
    left.childNodes[i] = childNodes[i];
    left.childNodes[i].parent = left;
    right.childNodes[i] = childNodes[order+i];
    right.childNodes[i].parent = right;
    left.isLeaf = false;
    right.isLeaf = false;
    } else isLeaf = false;
    keys[0] = keys[order-1];
    numberOfKeys = 1;
    left.numberOfKeys = order-1;
    right.numberOfKeys = order-1;
    for (int i=1; i<order*2-1; i++) {
    keys[i] = null;
    data[i] = null;
    childNodes[i+1] = null;
    childNodes[0] = left;
    childNodes[1] = right;

    * Don't post that much code. There should never be a reason to. You should be able to break your code down into small enough pieces that you can post a small example that demonstrates your problem.
    * When you do post code, use [code] and [/code] tags to make it readable. You can use the code button on the message entry page.
    * The stack trace will tell you which line the NPE occurred on, where it was called from, where that was called from, etc. You can use that to help you find your error. Look at the line it's complaining about. What references are on that line followed by a dot, and what arrays do you try to access the elements of. One of those must be null.
    * Now that you know what[b] is null, put in a bunch of print statements to track [b]how it got to be null.

  • Stapler - A python utility for manipulating PDF docs based on pypdf

    Link to github:
    http://github.com/hellerbarde/stapler/tree/master
    * Dependencies *
    Stapler depends only on the packages python and python-pypdf, both of
    which can be found in the archlinux repositories.
    * History *
    Stapler is a pure python replacement for PDFtk, a tool for manipulating PDF
    documents from the command line. PDFtk was written in Java, and natively
    compiled with gcj. And it has been discontinued a few years ago and bitrot is
    setting in (i.e. it does not compile anymore in archlinux).
    Since I used it quite a lot, I decided to look for an alternative and found
    pypdf, a PDF library written in pure Python. I couldn't find a tool which
    actually uses the library, so I started writing my own.
    At some point I plan on providing a GUI, but the command line version will
    always exist.
    * License *
    A simplified BSD Style license describes the terms under which Stapler is
    distributed. A copy of the BSD Style License used is found in the file "LICENSE"
    * Usage *
    I am too lazy at the moment to learn how to create a proper man page so this has
    to suffice.
    There are 4 modes in Stapler:
    - cat:
      Works like the normal unix utility "cat", meaning it con_cat_enates files. 
      The syntax is delightfully simple:
        Syntax
        stapler cat input1 [input2, input3, ...] output
        Example:
        stapler cat a.pdf b.pdf c.pdf output.pdf
        # this would append "b.pdf" and "c.pdf" to "a.pdf" and write the whole 
        # thing to "output.pdf"
      you can specify as many input files as you want, it always cats all but the
      last file specified and writes the whole thing into the last file specified
    - split:
      Splits the specified pdf files into their single pages and writes each page
      into it's own pdf file with this naming scheme:
        ${origname}p${zeropaddedpagenr}.pdf
      Syntax:
        stapler split input1 [input2 input3 ...]
      Example for a file foobar.pdf with 20 pages:
        $ stapler split foobar.pdf
        $ ls
          foobarp01.pdf foobarp02.pdf ... foobarp19.pdf foobarp20.pdf
      Multiple files can be specified, they will be processed as if you called
      single instances of stapler.
    - select/delete (called with sel and del respectively)
      These are the most sophisticated modes. With select you can cherrypick pages
      out of pdfs and concatenate them into a new pdf file.
      Syntax:
        stapler sel input1 page_or_range [page_or_range ...] [input2 p_o_r ...]
      Example:
        stapler sel a.pdf 1 4-8 20-40 b.pdf 1-5 output.pdf
        # this generates a pdf called output.pdf with the following pages:
        # 1, 4-8, 20-40 from a.pdf, 1-5 from b.pdf in this order
      What you _cannot_ do yet is not to specifying any ranges. I will probably merge
      select and cat at some point in the future so that you can specify pages and
      ranges, and if you don't, it just uses the whole file.
      The delete command works almost exactly the same as select, but inverse.
      It cherrypicks the pages and ranges which you _didn't_ specify out of the
      pdfs.
    contact me if you have questions about usage or anything, really
    2009, Philip Stark (heller <dot> barde <at> gmail <dot> com)
    Last edited by Heller_Barde (2009-08-05 21:02:54)

    firecat53 wrote:
    Are you planning on adding eventually the full functionality of pdftk -- rotate, watermark, encrypt, etc?  I occasionally use pdftk, and I'd like to see a replacement since it's apparently having troubles keeping up to date. Great work!
    Scott
    if you help me with ideas for the command syntax, sure why not. pypdf supports these things. can you make a complete list of things pdftk does that would be important to port over? and how the command line syntax for these features work. I'll then get working
    EDIT: I just had a look at the pdftk man page (didn't think of that when i wrote the above...) there are some things that will not be possible with the current version of pypdf (and frankly i doubt there is going to be a new release):
    update_info (because there is no way to write document properties with pypdf, you can read them just fine though)
    fill_form  (similar reason. it's just not supported)
    the rest will be fine. I'll rename split to burst and then I'll mimic the cat function. the others should be no problem either.
    although... i didn't find anything on rotate in the pdftk manual. how should i implement a rotate function? Rotate complete documents or single pages?
    cheers
    Phil
    Last edited by Heller_Barde (2009-08-06 07:08:42)

  • MEF E-line, E-LAN & E-tree services vs MPLS

    Dears
    Would like your assistance regarding below plz
    I was wondering how MEF  E-line, E-LAN & E-tree services are configured at Cisco ??
    What come to my mind is that first we need to have MPLS network then implement these services as below
    E-line  ---->> EoMPLS  (AToM)
    E-LAN ---->> VPLS
    E-Tree ---->> Point-to-Mulipoint Traffic Engineering
    So am I correct, or I can configure these services without having MPLS network ???
    Many Thanks
    Sherif Ismail

    Yes you have to provision the vlan from on point to the other. On each node's interfaces you have to configure an ethernet flow point (ie vlan manipulation). For example on a service instance at 7600 you can configure to match one or two vlans and pop one or two vlans.
    For multipoint services on 7600 you have to configure all the service instaces which should be communicate under the same bridge domain. It depends on what service you want to deploy, there is not a general configuration guideline for this. For example if you want to have 3 service instances on different interfaces talking together the configuration is :
    interface GigabitEthernet1/0/1
    service instance 100 ethernet
      encapsulation dot1q 100
       rewrite ingress tag pop 1 symmetric
       bridge-domain 10
    interface GigabitEthernet1/0/2
    service instance 101 ethernet
      encapsulation dot1q 101
       rewrite ingress tag pop 1 symmetric
       bridge-domain 10
    interface GigabitEthernet10/3
    service instance 102 ethernet
      encapsulation dot1q 102
       rewrite ingress tag pop 1 symmetric
       bridge-domain 10
    The ethernet services configuration on ES cards is very flexible, you can do vlan translation,1 --> 2 mappings, 2 --> 1 mappings. You can see the details on ES configuration guide http://www.cisco.com/en/US/docs/routers/7600/install_config/ES20_config_guide/baldcfg.html
    Best regards,
    Michael

Maybe you are looking for

  • How to create search/Entry screen in Oracle apps forms.

    HI All, I want to develop a form in such a way that if user enter the values in the master block and Tab out or if i use a button GO then all the detailed records need to be display in the detailed block field, if thers no matching data in the detail

  • Animate CC 2014.1 - 100%w & 100%h don't work anymore for symbols

    Hi. I experienced a strange thing in the latest update for Edge Animate. Before it was always possible to set a symbol to 100% height and width. You had to enter the symbol and then set the height and width to %. Then it worked at the stage. Now, whe

  • Iphone rebooting continously and gives error 1611 when trying to restore

    hey , its ma 1st post in this forum . m in deep trouble rgt now i dont know whts goin on with ma iphone it was workin all fine n suddenly one fine day it starts rebooting cont. showing the apple logo again n again. i tried restoring it in itunes....i

  • Send to color from FC timeline

    Color does not appear in list of send to options when I click in the timeline of Final Cut Pro. It does appear in the "send to" list accessed from the top of the screen. Any idea why?

  • FTP open source component

    I�m looking for an open source FTP component in Java ... any tip?