public override void Handle(CompositeStateType Type, CompositeJob Context)
 {
     switch (Type)
     {
         case CompositeStateType.Iniciated:
             Console.WriteLine("CompositeJob Satet changed to initated");
             Context.state = new IniciatedState();
             break;
         case CompositeStateType.Suspended:
             Console.WriteLine("CompositeJob state changed to Suspended");
             Context.state = new SuspendedState();
             break;
         case CompositeStateType.Completed:
             Console.WriteLine("CompositeJob state changed to completed");
             Context.state = new CompositeCompletedState();
             break;
         case CompositeStateType.Active:
             Console.WriteLine("CompositeJob state changed to Active");
             break;
         case CompositeStateType.Terminated:
             Console.WriteLine("CompositeJob state changed to Terminated");
             Context.state = new TerminatedState();
             break;
         default:
             Console.WriteLine("Estado Invalido");
             break;
     }
 }
Beispiel #2
0
        static void Main(string[] args)
        {
            #region FirstPart
            //ParallelJob Job = new ParallelJob("Job1");

            //Job.GoToState(ParallelStatesTypes.Queue);
            //Job.GoToState(ParallelStatesTypes.Complete);
            //Job.GoToState(ParallelStatesTypes.Schedule);
            //Job.GoToState(ParallelStatesTypes.Start);
            //Job.GoToState(ParallelStatesTypes.Complete);
            //Job.GoToState(ParallelStatesTypes.Abort);
            //Console.ReadLine();
            #endregion

            List<CompositeNode> Nodes = new List<CompositeNode>(){
                new CompositeNode{ NodeId = "1", Job = new ParallelJob("Job2")},
                new CompositeNode{ NodeId = "2", Job = new ParallelJob("Job3")},
                new CompositeNode{ NodeId = "3", Job = new ParallelJob("Job4")},
                new CompositeNode{ NodeId = "4", Job = new ParallelJob("Job5")}
            };

            List<CompositeEdge> Edges = new List<CompositeEdge>(){
                new CompositeEdge{ StartingNode = Nodes[0], EndingNode = Nodes[1]},
                new CompositeEdge{ StartingNode = Nodes[0], EndingNode = Nodes[2]},
                new CompositeEdge{ StartingNode = Nodes[1], EndingNode = Nodes[3]},
                new CompositeEdge{ StartingNode = Nodes[2], EndingNode = Nodes[3]}
            };

            CompositeJob compositeJob = new CompositeJob(Nodes, Edges);
            compositeJob.StartJob();
            Console.ReadLine();
        }
 public override void Handle(CompositeStateType Type, CompositeJob Context)
 {
     switch (Type)
     {
         case CompositeStateType.Active:
             Context.state = new ActiveState();
             Console.WriteLine("CompositeJob State changed to Active");
             break;
         case CompositeStateType.Terminated:
             Context.state = new TerminatedState();
             Console.WriteLine("CompositeJob State changed to Terminated");
             break;
         default:
             Console.WriteLine("Invalid State");
             break;
     }
 }
 public override void Handle(CompositeStateType Type, CompositeJob Context)
 {
     Console.WriteLine("Invalid State");
 }
 public override void Handle(CompositeStateType Type, CompositeJob Context)
 {
     throw new NotImplementedException();
 }
 public abstract void Handle(CompositeStateType Type, CompositeJob Context);