Package dk.brics.xmlgraph

Examples of dk.brics.xmlgraph.XMLGraph.processReachableNodes()


      final Emptiness emptiness = new Emptiness(g, EPresence.EMPTY, EPresence.NONEMPTY, EPresence.EMPTY, EPresence.EMPTY);
      final FirstRootAnalysis first = new FirstRootAnalysis(g, emptiness, false);
      final RootAnalysis roots = new RootAnalysis(g);
          final int emptyIndex = stm_nodes.getGetEmptySequence(s, g).getIndex();
      // we model this as "replace every root node that is not the first root element with the empty sequence"
      g.processReachableNodes(new NodeProcessor<Object>() {
          @Override
          public Object process(ChoiceNode n) {
              EBooleanLattice r = roots.get(n.getIndex());
              if (r.definitelyNot()) {
                  return this;
View Full Code Here


      // We model the "get next sibling" operations as "replace first root with empty sequece".
            // If a ChoiceNode has an edge to a ConcreteNode that might be the first root,
            // then the ChoiceNode gets an additional edge to the empty sequence.
      // If that ConcreteNode can only occur as the first root, then the edge to it is removed.
     
      g.processReachableNodes(new NodeProcessor<Object>() {
          @Override
          public Object process(ChoiceNode n) {
              if (first.get(n.getIndex()).definitelyNot())
                  return this;
              LinkedList<Integer> removed = new LinkedList<Integer>();
View Full Code Here

      if (empty)
        return g;
      g.merge(xmlsrc);
      g.getRoots().retainAll(base.getRoots());
      // TODO can we append as root here???
      g.processReachableNodes(new NodeProcessor<Object>() {
        @Override
        public Object process(ElementNode n) {
          ChoiceNode ch = (ChoiceNode)g.getNode(n.getContent());
          switch (stm.get(n.getIndex())) {
          case DEFINITE:
View Full Code Here

      boolean empty = checkXPathEmpty(s, g, stm);
      if (empty)
        return g;
      g.merge(xmlsrc);
      g.getRoots().retainAll(base.getRoots());
      g.processReachableNodes(new NodeProcessor<Object>() {
        @Override
        public Object process(ChoiceNode ch) {
          LinkedHashSet<Integer> cs = new LinkedHashSet<Integer>(ch.getContents());
          for (int child : ch.getContents()) {
            Node node = g.getNode(child);
View Full Code Here

    // TODO avoid recursive replacement for nodes that will not actually be replaced
    // because its ancestor got replaced instead.
    switch (s.getKind()) {
    case SET:
      // set(XPath, Object)
      g.processReachableNodes(new NodeProcessor<Object>() {
        @Override
        public Object process(ChoiceNode n) {
          LinkedHashSet<Integer> cs = new LinkedHashSet<Integer>(n.getContents());
          for (int child : n.getContents()) {
            Node node = g.getNode(child);
View Full Code Here

        }
      });
      break;

    case SETCONTENT:
      g.processReachableNodes(new NodeProcessor<Object>() {
        @Override
        public Object process(ElementNode n) {
          ChoiceNode ch = (ChoiceNode)g.getNode(n.getContent());
          LinkedHashSet<Integer> c = new LinkedHashSet<Integer>(ch.getContents());
          switch (stm.get(n.getIndex())) {
View Full Code Here

 
  private XMLGraph getGapAnnotatedGraph(final XMLGraph graph, final SchemaType schema, final XMLGraphBuilder b, final Origin origin) {
    //if (gaptypes == null || gaptypes.size() == 0)
    //  return graph;
    final XMLGraph g = graph.clone();
    g.processReachableNodes(new NodeProcessor<Object>() {
      @Override
      public Object process(ChoiceNode n) {
        if (!n.isGap() || !n.isOpen())
          return n;
        //String type = gaptypes == null ? null : gaptypes.get(n.getName());
View Full Code Here

    default:
        return g;
    }
    final FirstRootAnalysis first = new FirstRootAnalysis(g, emptiness, s.getKind() == CastStm.Kind.ASTEXT);
   
    g.processReachableNodes(new NodeProcessor<Object>() {
        @Override
        public Object process(ChoiceNode n) {
            if (!first.get(n.getIndex()).definitely())
                return this;
            LinkedList<Integer> remove = new LinkedList<Integer>();
View Full Code Here

  public XMLGraph transferConst(ConstStm s) {
    final XMLGraph g = global_xg.clone();
    g.useFragment(stm_nodes.getTemplateConstantXMLFragment(s.getConst()));
    // open gaps
    g.processReachableNodes(new NodeProcessor<Object>() {
      @Override
      public Object process(ChoiceNode n) {
        if (n.isGap() && !n.isOpen()) {
          n.setContentAndStatus(true, false, n.getContents(), g);
        }
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.