Examples of TreeWalker


Examples of org.jibx.schema.TreeWalker

            }
           
        }
       
        // finish by flagging global definitions requiring separate classes
        TreeWalker wlkr = new TreeWalker(null, new SchemaContextTracker());
        for (Iterator iter = m_validationContext.iterateSchemas(); iter.hasNext();) {
            SchemaElement schema = (SchemaElement)iter.next();
            SchemaCustom custom = ((SchemaExtension)schema.getExtension()).getCustom();
            if (custom.isGenerateAll()) {
                int count = schema.getChildCount();
                for (int i = 0; i < count; i++) {
                   
                    // check if this global needs a class
                    SchemaBase comp = schema.getChild(i);
                    boolean include = false;
                    switch (comp.type()) {
/*                        case SchemaBase.ATTRIBUTE_TYPE:
                            include = !custom.isAttributeInlined();
                            break;  */
                       
                        case SchemaBase.ATTRIBUTEGROUP_TYPE:
                        case SchemaBase.GROUP_TYPE:
                           
                            // for attribute group or group, only force separate class if multiple components
                            ValueCountVisitor visitor = new ValueCountVisitor();
                            wlkr.walkChildren(comp, visitor);
                            include = visitor.getCount() > 1;
                            break;
                           
                        case SchemaBase.COMPLEXTYPE_TYPE:
                        case SchemaBase.ELEMENT_TYPE:
View Full Code Here

Examples of org.jibx.schema.TreeWalker

     *
     * @return <code>true</code> if no-namespace used, <code>false</code> if not
     */
    private boolean checkNoNamespacedUsed() {
        SchemaNameVisitor visitor = new SchemaNameVisitor();
        TreeWalker walker = new TreeWalker(null, new SchemaContextTracker());
        for (Iterator iter = m_validationContext.iterateSchemas(); iter.hasNext();) {
            walker.walkSchema((SchemaElement)iter.next(), visitor);
        }
        return visitor.isNoNamespaceUsed();
    }
View Full Code Here

Examples of org.jibx.schema.TreeWalker

            prefixes[fill] = m_schemaPrefix;
            indexes[fill] = m_schemaIndex;
           
            // build schema extracts from main component and all referenced components
            String clasname = group.getGenerateClass().getFullName();
            TreeWalker walker = new TreeWalker(null, new SchemaContextTracker());
            boolean ref = false;
            List list = refcomps.asList();
            for (Iterator iter = list.iterator(); iter.hasNext();) {
               
                // add a blank line separating components
                if (ref) {
                    strwriter.write(COMMENT_LEAD_TEXT);
                } else {
                    ref = true;
                }
               
                // add any necessary namespace declarations
                AnnotatedBase comp = (AnnotatedBase)iter.next();
                for (Iterator jter = uritoprefix.keySet().iterator(); jter.hasNext();) {
                    String uri = (String)jter.next();
                    comp.addNamespaceDeclaration((String)uritoprefix.get(uri), uri);
                }
               
                // write the documentation
                DocumentationVisitor visitor = new DocumentationVisitor(comptoclas, clasname, comp, dropanno, ref,
                    indexes, prefixes);
                walker.walkElement(comp, visitor);
                strwriter.flush();
               
            }
           
            // convert generated schema fragment to plain text for embedding
View Full Code Here

Examples of org.nemesis.forum.TreeWalker

    remove((Message) event.getSource());
  }

  private static void remove(Message m) {
    //remove recursive from index if doc not approved
    TreeWalker walker = m.getForumThread().treeWalker();
    removeFromIndex(m, walker);
  }
View Full Code Here

Examples of org.nemesis.forum.TreeWalker

    }

  }

  private static void index(Message m) {
    TreeWalker walker = m.getForumThread().treeWalker();
    addToIndex(m, walker);

  }
View Full Code Here

Examples of org.nemesis.forum.TreeWalker

        log.error("",e);
      }
    }

    //Recursively delete all children
    TreeWalker walker = treeWalker();
    int childCount = walker.getChildCount(message);
    for (int i = childCount - 1; i >= 0; i--) {
      Message childMessage = walker.getChild(message, i);
      if (childMessage == null) {
        log.error("child message was null -- index " + i);
      }
      deleteMessage(childMessage);
    }
View Full Code Here

Examples of org.nemesis.forum.TreeWalker

    int messageID = message.getID();
    // Original message thread rootMessageID
    int oldRootMessageID = getRootMessage().getID();

    // Move the children of this message to the new thread
    TreeWalker walker = treeWalker();
    int childCount = walker.getChildCount(message);
    for (int i = 0; i < childCount; i++) {
      Message childMessage = walker.getChild(message, i);
      changeMessageThread(childMessage, newThread);
    }

    //Move the message to the new thread.
    changeMessageThread(message, newThread);
View Full Code Here

Examples of org.olat.core.util.traversal.TreeWalker

  /**
   *
   */
  private TreeWalker getTreeWalker() {
    if (tw == null) {
      tw = new TreeWalker(new MessageTreeComparator(), null); // no visitor,
                                                              // since we just
                                                              // need the
                                                              // traversal order
                                                              // after sorting
      Iterator mit = messages.iterator();
View Full Code Here

Examples of org.olat.core.util.traversal.TreeWalker

  public int compareTo(int rowa, int rowb) {
    // we take the treewalker which we built previously and use the visitednr
    // attribute to specify sort order
    Object a = messages.get(rowa);
    Object b = messages.get(rowb); // both are messages; to be compared
    TreeWalker treeWalker = getTreeWalker();
    GenericTraversalNode gtna = treeWalker.getGenericTraversalNode(a);
    GenericTraversalNode gtnb = treeWalker.getGenericTraversalNode(b);
    int sortedposa = gtna.getVisitNumber(); // the visitednumber was determined
                                            // by the sorting algorithm,
                                            // therefore it is the sorted
                                            // position
    int sortedposb = gtnb.getVisitNumber();
View Full Code Here

Examples of org.w3c.dom.traversal.TreeWalker

    public void setUp() throws Exception {
        dom = DOMParser.toDocument(XML).getDocumentElement();
    }

    public void testRootNode() throws Exception {
        TreeWalker tw = new TreeWalkerImpl(dom, NodeFilter.SHOW_ALL, null, false);
        assertEquals("a", tw.getRoot().getLocalName());
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.