Examples of ModifyingFunction


Examples of project.gluebooster.math.functions.ModifyingFunction

      Map<String, BoostFunction<? extends Object, Dimension,?>> typeDimensionGetter = new HashMap<String, BoostFunction<? extends Object, Dimension, ?>>();
      typeDimensionGetter.put(VERTEX, vertexDimensionGetter);
      typeDimensionGetter.put(EDGE, edgeLabelDimensionGetter);

      ModifyingFunction/*<Dimension>*/ newDimensionGetter = new ModifyingFunction(ModifyingFunction.Operation.useFunctionChooser, new FunctionByMap( typeDimensionGetter));
      //newDimensionGetter.setFunctions(typeDimensionGetter);
      newDimensionGetter.getInternalInformation().setShortDescription("newDimensionGetter");
      /*
       * TODO replace by ModifyingFunction.useFunctionChooser   you have to adapt the setFunctions method
       *
         private Map<?, Map<?,To>> functions;
         public To getInternal(Object defaultRef, Object context)
View Full Code Here

Examples of project.gluebooster.math.functions.ModifyingFunction

  public void testCreateLeafFilteringTreeNode() throws Exception
  {
    TreeNode rootNode = SampleTreeFactory.createSampleTree1();
    BoostFunction<String, Boolean, ?> leafFilter = new ReflectionFunctions(ReflectionFunctions.Operation.invokeMethod,"equals", "a");
   
    TreeNode newRootNode = TreeNodeFactory.createLeafFilteringTreeNode(rootNode, /*<TreeNode, Boolean>*/new ModifyingFunction(ModifyingFunction.Operation.concatenatedFunctions, new ReflectionFunctions(ReflectionFunctions.Operation.invokeMethod/*<ComputedTreeNode<File>, File>(*/,"getUserObject"), leafFilter), new InvocationContext());
    //only the a leaf is resulting, no other leafs or folder should be present

    JFrame frame1 = JComponentBoostUtils.createDisposingJFrameWithOneComponent("Original", new JTree(rootNode), 800, 800);
    JFrame frame = JComponentBoostUtils.createDisposingJFrameWithOneComponent("Filtered", new JTree(newRootNode), 800, 800);
    //ThreadBoostUtils.sleep(30000);
View Full Code Here

Examples of project.gluebooster.math.functions.ModifyingFunction

  public static ComputedTreeNode<File> createTreeNode(File file, InvocationContext context) throws Exception
  {
     ComputedTreeNode<File> toTreeNodeFunction = new ComputedTreeNode<File>();
     toTreeNodeFunction.setAllowsChildrenFunction( ReflectionFunctions.createInvokeMethod("isDirectory"));
     //toTreeNodeFunction.setChildrenFunction( FunctionFactory.concatenation(ReflectionFunctions.createInvokeMethod("listFiles"), new ToIteratorFunction<File>(), new ForEachFunction<File, TreeNode>(toTreeNodeFunction), new IteratorToListFunction<TreeNode>(), new CollectionToArrayFunction<TreeNode>(TreeNode.class)));
     toTreeNodeFunction.setChildrenFunction( FunctionFactory.concatenation( ReflectionFunctions.createInvokeMethod("listFiles"), new ModifyingFunction( ModifyingFunction.Operation.iterate, toTreeNodeFunction)));
     toTreeNodeFunction.setIsLeafFunction(FunctionFactory.concatenation(ReflectionFunctions.createInvokeMethod("isDirectory")new BooleanFunctions(BooleanFunctions.Operation.not)));
     toTreeNodeFunction.setParentFunction(FunctionFactory.concatenation( ReflectionFunctions.createInvokeMethod("getParentFile"), toTreeNodeFunction));
     return toTreeNodeFunction.valueOf(file, context);
  }
View Full Code Here

Examples of project.gluebooster.math.functions.ModifyingFunction

     filteredNode.setChildrenFunction( FunctionFactory.concatenation(
         ReflectionFunctions.createInvokeMethod("children"),
                 new EnumerationWithFilterFunction<TreeNode>(function, context),
                 //new ToListFunction<TreeNode>(),
                 new CollectionFunctions(CollectionFunctions.Operation.toIterator),
                 new ModifyingFunction(ModifyingFunction.Operation.iterate, new TreeNodeFactory(TreeNodeOperation.createChildrenFilteringTreeNode, function)),
                 new CollectionFunctions(CollectionFunctions.Operation.toList)
                 ));
     filteredNode.setUserObject(rootNode);
    
     return filteredNode;
View Full Code Here

Examples of project.gluebooster.math.functions.ModifyingFunction

      filteredNode.setChildrenFunction( FunctionFactory.concatenation(
          ReflectionFunctions.createInvokeMethod("children"),
                  new EnumerationWithFilterFunction<TreeNode>(childAllowedFunction, context),
                  //new ToListFunction<TreeNode>(),
                  new CollectionFunctions(CollectionFunctions.Operation.toIterator),
                  new ModifyingFunction(ModifyingFunction.Operation.iterate, new TreeNodeFactory(TreeNodeOperation.createChildrenFilteringTreeNode, childAllowedFunction)),
                  new CollectionFunctions(CollectionFunctions.Operation.toList)
                  ));
      filteredNode.setUserObject(rootNode);
     
      return filteredNode;
View Full Code Here

Examples of project.gluebooster.math.functions.ModifyingFunction

    */
   public static ComputedTreeNode<TreeNode> createLeafFilteringTreeNode(TreeNode rootNode, BoostFunction<TreeNode, Boolean,InvocationContext> leafAllowedFunction, InvocationContext context)
   throws Exception
   {
      BoostFunction<TreeNode, Boolean, InvocationContext> isNoLeafOrAllowed =  FunctionFactory.concatenation(
            new ModifyingFunction(ModifyingFunction.Operation.oneToArray,
                FunctionFactory.concatenation
                    ReflectionFunctions.createInvokeMethod("isLeaf"),
                    new BooleanFunctions(BooleanFunctions.Operation.not)),
                 leafAllowedFunction),
            new BooleanFunctions(BooleanFunctions.Operation.or));
View Full Code Here

Examples of project.gluebooster.math.functions.ModifyingFunction

   public PredicateByFunction(BoostFunction... evaluators)
   {
     if (evaluators.length == 1)
      evaluator = evaluators[0];
     else
      evaluator = new ModifyingFunction(ModifyingFunction.Operation.concatenatedFunctions, evaluators);
   }
View Full Code Here

Examples of project.gluebooster.math.functions.ModifyingFunction

      if (functionChains.containsKey(methodname))
        throw new IllegalStateException("duplicate methodName");
     
      if (Modifier.isPublic(method.getModifiers()))
      {
        ModifyingFunction function = new ModifyingFunction(ModifyingFunction.Operation.concatenatedFunctions);
        functionChains.put(methodname, function);
        if (hasDelegate)
        {
          BoostFunction delegateMethod = new ReflectionFunctions(ReflectionFunctions.Operation.invokeMethodOfOtherObject,null,methodname);//the delegate is not yet known
          function.addElementFunction(delegateMethod);
          delegateMethods.add(delegateMethod);
        }
      }
           
    }
View Full Code Here

Examples of project.gluebooster.math.functions.ModifyingFunction

  public void prependFunctions(String methodname, List<BoostFunction> functions) throws Exception
  {
    ArrayList<BoostFunction> functionlist = new ArrayList<BoostFunction>(functions);
    Collections.reverse(functionlist);
    ModifyingFunction chain = getFunctionChain(methodname);
    for (BoostFunction function: functionlist)
    {
      chain.getFunctions().add(0, function);
    }
  }
View Full Code Here

Examples of project.gluebooster.math.functions.ModifyingFunction

    }
  }
 
  public void appendFunctions(String methodname, List<BoostFunction> functions) throws Exception
  {
    ModifyingFunction chain = getFunctionChain(methodname);
    for (BoostFunction function: functions)
    {
      chain.getFunctions().add(function);
    }
  }
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.