예제 #1
0
파일: LayerChain.cs 프로젝트: nunb/code
        public static Tree InterpretChain(IEnumerable <LayerWrapper> layers, Tree start)
        {
            Tree.BatchTransform updater = new Tree.BatchTransform(start);
            Tree         tree           = start;
            LayerWrapper currLayer      = null;

            try
            {
                foreach (LayerWrapper wrapper in layers)
                {
                    currLayer = wrapper;
                    InterpretArgs args = new InterpretArgs(tree, updater, wrapper.Intent);

                    wrapper.Layer.Interpret(args);
                    tree = updater.GetUpdatedTree();
                    wrapper.Layer.AfterInterpret(tree);
                }
            }
            catch (Exception e)
            {
                Tree.BatchTransform newupdater = new Tree.BatchTransform(tree);
                LayerException      exception  = new LayerException(currLayer, e);
                newupdater.Tag(tree, "interpretation_exception", exception);
                tree = newupdater.GetUpdatedTree();
            }


            return(tree);
        }
예제 #2
0
		public static Tree InterpretChain(IEnumerable<LayerWrapper> layers, Tree start){
            Tree.BatchTransform updater = new Tree.BatchTransform(start);
            Tree tree = start;
            LayerWrapper currLayer = null;
            try
            {
                
                
                foreach (LayerWrapper wrapper in layers)
                {
                    currLayer = wrapper;
                    InterpretArgs args = new InterpretArgs(tree, updater, wrapper.Intent);

                    wrapper.Layer.Interpret(args);
                    tree = updater.GetUpdatedTree();
                    wrapper.Layer.AfterInterpret(tree);
                    
                }


            }
            catch(Exception e)
            {
                Tree.BatchTransform newupdater = new Tree.BatchTransform(tree);
                LayerException exception = new LayerException(currLayer, e);
                newupdater.Tag(tree, "interpretation_exception", exception);
                tree = newupdater.GetUpdatedTree();
            }


            return tree;
		}
예제 #3
0
        private static Tree InterpretSubchain(List <LayerWrapper> layers, int startInclusive, int endInclusive, Tree tree)
        {
            LayerWrapper currLayer = null;

            try
            {
                for (int i = startInclusive; i <= endInclusive; i++)
                {
                    currLayer = layers[i];
                    Tree.BatchTransform updater = new Tree.BatchTransform(tree);
                    InterpretArgs       args    = new InterpretArgs(tree, updater, currLayer.Intent);
                    currLayer.Layer.Interpret(args);
                    tree = updater.GetUpdatedTree();
                    currLayer.Layer.AfterInterpret(tree);
                }
            }
            catch (Exception e)
            {
                Tree.BatchTransform newupdater = new Tree.BatchTransform(tree);
                LayerException      exception  = new LayerException(currLayer, e);
                newupdater.Tag(tree, "interpretation_exception", exception);
                tree = newupdater.GetUpdatedTree();
            }

            return(tree);
        }
		private static Tree InterpretSubchain(List<LayerWrapper> layers, int startInclusive, int endInclusive, Tree tree){
			
			LayerWrapper currLayer = null;
			try
			{
				for (int i = startInclusive; i <= endInclusive; i++)
				{
					currLayer = layers[i];
					Tree.BatchTransform updater = new Tree.BatchTransform(tree);
					InterpretArgs args = new InterpretArgs(tree, updater, currLayer.Intent);
					currLayer.Layer.Interpret(args);
					tree = updater.GetUpdatedTree();
					currLayer.Layer.AfterInterpret(tree);
				}

			}
			catch (Exception e)
			{
                Tree.BatchTransform newupdater = new Tree.BatchTransform(tree);
                LayerException exception = new LayerException(currLayer, e);
                newupdater.Tag(tree, "interpretation_exception", exception);
                tree = newupdater.GetUpdatedTree();
			}

			return tree;
		}
예제 #5
0
파일: InterpretArgs.cs 프로젝트: nunb/code
 public void Tag(Tree node, string key, object value)
 {
     _updater.Tag(node, key, value);
 }