public void simpleExpand(NodeExpander nodeExpander, string propname)
 {
     Data data = new Data();
     bool foundhi = false;
     OnChildNode l =
         delegate(Object from, String name, Object to)
           {
               if (name.Equals(propname) && to.Equals(data.Greeting))
               {
                   foundhi = true;
               }
           };
     nodeExpander.expand(data, l);
     Assert.AreEqual(true, foundhi, "expected to find greeting");
 }
        //, TypeAliaser aliaser
        public LeafDefaultSet getDefaultsForAllLinkedObjects(Object root, NodeExpander nodeExpander)
        {
            LeafDefaultSet result = new LeafDefaultSet();

            ObjectExplorerImpl explorer = new ObjectExplorerImpl();
                MoveAway down = ( from,  propertyName,  to,  isIndexed, index) =>
                {
                    return (isIndexed || (to != null && !result.Type2Defaults.ContainsKey(to.GetType())));
                };
             MoveBack  up = (from, propertyName, to, isIndexed) =>
                {

                };

             OnLeaf leaf = (from, propertyName, to, index) =>
                {
                    Defaults4Class defaults = null;
                    if (from==null) {return;}
                    Type fromType = from.GetType();
                    if (!result.Type2Defaults.ContainsKey(fromType))
                    {
                        defaults = new Defaults4Class();
                        defaults.FullClassName = fromType.FullName;
                        result.Type2Defaults[fromType] = defaults;
                    }
                    else
                    {
                        defaults = result.Type2Defaults[fromType];
                    }
                    defaults.PropertyName2DefaultValue[propertyName] = to;
                };

             explorer.NodeExpander = nodeExpander;
                explorer.explore(root, down, up, leaf);
                return result;
        }
 Object2Json createSecureObjectToJson(string[] currentPermissions, bool throwPermissionOnDenial, NodeExpander nodeExpander)
 {
     Object2Json o2j = new Object2Json();
     o2j.NodeExpander = nodeExpander;
     PermissionFilterExplorer pfe = new PermissionFilterExplorer();
     pfe.ThrowException = throwPermissionOnDenial;
     o2j.ExplorerFactory = () =>
     {
         pfe.UnderlyingExplorer = new ObjectExplorerImpl();
         pfe.CheckPermissionByName = (strPermission) =>
         {
             return currentPermissions.Contains(strPermission);
         };
         return pfe;
     };
     return o2j;
 }
示例#4
0
 public TreeSearch(NodeExpander nodeExpander) : base(nodeExpander)
 {
 }
 public GraphSearch(NodeExpander nodeExpander) : base(nodeExpander)
 {
 }
示例#6
0
 /** Stores the provided node expander and adds a node listener to it. */
 protected QueueSearch(NodeExpander <S, A> nodeExpander)
 {
     this.nodeExpander = nodeExpander;
     nodeExpander.addNodeListener((node) => metrics.incrementInt(METRIC_NODES_EXPANDED));
 }
示例#7
0
 public SimulatedAnnealingSearch(IToDoubleFunction <Node <S, A> > h, Scheduler scheduler, NodeExpander <S, A> nodeExpander)
 {
     this.h            = h;
     this.scheduler    = scheduler;
     this.nodeExpander = nodeExpander;
     nodeExpander.addNodeListener((node) => metrics.incrementInt(METRIC_NODES_EXPANDED));
 }
示例#8
0
 public GraphSearchBFS(NodeExpander <S, A> nodeExpander)
     : base(nodeExpander)
 {
 }
示例#9
0
 protected QueueSearch(NodeExpander nodeExpander)
 {
     this.nodeExpander = nodeExpander;
 }
示例#10
0
 protected QueueSearch(NodeExpander nodeExpander)
 {
     this.nodeExpander = nodeExpander;
 }
示例#11
0
 public HillClimbingSearch(IToDoubleFunction <Node <S, A> > h, NodeExpander <S, A> nodeExpander)
 {
     this.h            = h;
     this.nodeExpander = nodeExpander;
     nodeExpander.addNodeListener((node) => metrics.incrementInt(METRIC_NODES_EXPANDED));
 }