Package org.wicketstuff.pageserializer.common.analyze

Examples of org.wicketstuff.pageserializer.common.analyze.ISerializedObjectTree


  public void dontChangeAnything()
  {
    ImmutableTree source = new ImmutableTree(new ObjectId(1), Root.class, "root", 10,
      noChildren());

    ISerializedObjectTree result = SimilarNodeTreeTransformator.transformTree(source);

    ImmutableTree expected = new ImmutableTree(new ObjectId(1), Root.class, "root", 10,
      noChildren());

    Trees.assertEqualsTree(expected, result);
View Full Code Here


  public void compressSubNodes()
  {
    ImmutableTree source = new ImmutableTree(new ObjectId(1), Root.class, "root", 10,
      sameChildren5Times());

    ISerializedObjectTree result = SimilarNodeTreeTransformator.transformTree(source);

    List<ISerializedObjectTree> oneSubNode = new ArrayList<>();
    List<ISerializedObjectTree> threeSubNodes = new ArrayList<>();
    threeSubNodes.add(new ImmutableTree(null, A.class, "a", 15, noChildren()));
    threeSubNodes.add(new ImmutableTree(null, B.class, "b", 20, noChildren()));
View Full Code Here

 
  @Test
  public void testCompression() throws IOException {
    IReportOutput reportOutput=new LoggerReportOutput();

    ISerializedObjectTree source = Trees.fromResource(getClass(), "sample1");
    Assert.assertEquals("asSample", source.label());
    ISerializedObjectTree result = SimilarNodeTreeTransformator.transformTree(source);
    new TreeSizeReport(reportOutput).process(result);
    ISerializedObjectTree match = Trees.fromResource(getClass(), "sample1-match");
    new TreeSizeReport(reportOutput).process(match);

    Trees.assertEqualsTree(match, result);
  }
View Full Code Here

 
  @Test
  public void secondNodeHasMoreChilds() throws IOException {
    IReportOutput reportOutput=new LoggerReportOutput();
   
    ISerializedObjectTree source = Trees.fromResource(getClass(), "nodeChildSize");
    Assert.assertEquals("asSample", source.label());
    new TreeSizeReport(reportOutput).process(source);
    ISerializedObjectTree result = SimilarNodeTreeTransformator.transformTree(source);
    new TreeSizeReport(reportOutput).process(result);
    ISerializedObjectTree match = Trees.fromResource(getClass(), "nodeChildSize-match");
    new TreeSizeReport(reportOutput).process(match);
   
    Trees.assertEqualsTree(match, result);
  }
View Full Code Here

    Trees.assertEqualsTree(match, result);
  }
 
  @Test
  public void testTreeType() throws IOException {
    ISerializedObjectTree sourceA = Trees.fromResource(getClass(), "treeType-A");
    ISerializedObjectTree sourceB = Trees.fromResource(getClass(), "treeType-B");
    TreeType treeTypeA=new TreeType(sourceA);
    TreeType treeTypeB=new TreeType(sourceB);
    Assert.assertEquals(treeTypeA, treeTypeB);
  }
View Full Code Here

        boolean changed = false;

        List<ISerializedObjectTree> filteredList = new ArrayList<ISerializedObjectTree>();
        for (ISerializedObjectTree child : source.children())
        {
          ISerializedObjectTree filtered = compact(child, filter, level.down());
          filteredList.add(filtered);
          if (filtered != child)
          {
            changed = true;
          }
View Full Code Here

   
    for (ISerializedObjectTree child : source.children())
    {
      if (filter.accept(child, levelOneDown))
      {
        ISerializedObjectTree filtered = strip(child, filter, levelOneDown);
        filteredList.add(filtered);
        if (filtered != child)
        {
          changed = true;
        }
      }
      else
      {
        changed = true;
        localSize = localSize + child.size();
        for (ISerializedObjectTree childOfChild : child.children())
        {
          ISerializedObjectTree filtered = strip(childOfChild, filter, levelOneDown);
          filteredList.add(filtered);
        }
      }
    }
View Full Code Here

  }

  @Override
  protected ISerializedObjectTree transform(ISerializedObjectTree tree)
  {
    ISerializedObjectTree current = tree;
    for (IFilter f : filter)
    {
      switch (f.filterType())
      {
        case COMPACT :
View Full Code Here

   * @param list
   *          source nodes
   * @return one node
   */
  protected static ISerializedObjectTree compress(List<? extends ISerializedObjectTree> list) {
    ISerializedObjectTree first = list.get(0);
    final Class<?> type = first.type();
    final String label = allLables(list);

    int size = 0;
    for (ISerializedObjectTree t : list) {
      size = size + t.size();
View Full Code Here

    for (int i = 0; i < columns; i++) {
      List<ISerializedObjectTree> columnValues = new ArrayList<ISerializedObjectTree>();
      for (List<? extends ISerializedObjectTree> line : childrens) {
        columnValues.add(line.get(i));
      }
      ISerializedObjectTree compressed = compress(columnValues);
      ret.add(compressed);
    }
    return ret;
  }
View Full Code Here

TOP

Related Classes of org.wicketstuff.pageserializer.common.analyze.ISerializedObjectTree

Copyright © 2018 www.massapicom. 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.