コード例 #1
0
ファイル: GraphBuilder.cs プロジェクト: devoctomy/cachy
 public void CreateRoute(String key,
                         IGraphIO input,
                         IGraphIO output,
                         String startNode,
                         params String[] nodes)
 {
     if (!_routes.ContainsKey(key))
     {
         GraphRoute route = new GraphRoute(key,
                                           input,
                                           output,
                                           startNode,
                                           nodes);
         _routes.Add(key, route);
     }
     else
     {
         throw new DuplicateRouteKeyException(key);
     }
 }
コード例 #2
0
ファイル: GraphBuilder.cs プロジェクト: devoctomy/cachy
 public Boolean Process(Boolean initialise,
                        String routeKey,
                        Object inputValue,
                        out Object outputValue)
 {
     DLoggerManager.Instance.Logger.Log(DFramework.Logging.Interfaces.LoggerMessageType.VerboseHigh | DFramework.Logging.Interfaces.LoggerMessageType.Information | DFramework.Logging.Interfaces.LoggerMessageType.Sensitive, String.IsNullOrEmpty(Name) ? String.Format("Process route '{0}' on GraphBuilder.", routeKey) : String.Format("Process route '{0}' on named GraphBuilder '{0}'.", routeKey, Name));
     if (_routes.ContainsKey(routeKey))
     {
         if (initialise)
         {
             Initialise();
         }
         GraphRoute route = _routes[routeKey];
         Link(route.Nodes);
         outputValue = null;
         if (route.Input != null)
         {
             route.Input.SetValue(inputValue);
         }
         if (_nodes.ContainsKey(route.StartNode))
         {
             if (_nodes[route.StartNode].Process())
             {
                 outputValue = route.Output.Value;
                 return(true);
             }
             else
             {
                 return(false);
             }
         }
         else
         {
             throw new KeyNotFoundException(String.Format("Node with the key '{0}' was not found.", route.StartNode));
         }
     }
     else
     {
         throw new KeyNotFoundException(String.Format("Route with the key '{0}' was not found.", routeKey));
     }
 }