public bool Equals(Edge <T> other) { return(other != null && StartVertex.Equals(other.StartVertex) && EndVertex.Equals(other.EndVertex) && Weight.Equals(other.Weight)); }
public void RunWithBlockingConditionOnSecondEdge() { var condition = new Mock <IScheduleCondition>(); { condition.Setup(c => c.CanTraverse(It.IsAny <CancellationToken>())) .Returns(false); } var conditionStorage = ScheduleConditionStorage.CreateInstanceWithoutTimeline(); var conditionInfo = conditionStorage.Add(condition.Object, "a", "b"); Schedule schedule; { var graph = new BidirectionalGraph <IScheduleVertex, ScheduleEdge>(); var start = new StartVertex(1); graph.AddVertex(start); var end = new EndVertex(2); graph.AddVertex(end); var middle1 = new InsertVertex(3); graph.AddVertex(middle1); var middle2 = new InsertVertex(4); graph.AddVertex(middle2); graph.AddEdge(new ScheduleEdge(start, middle1)); graph.AddEdge(new ScheduleEdge(start, middle2, conditionInfo.Id)); graph.AddEdge(new ScheduleEdge(middle1, end)); graph.AddEdge(new ScheduleEdge(middle2, end)); schedule = new Schedule(graph, start, end); } using (var info = new ScheduleExecutionInfo(new CurrentThreadTaskScheduler())) { using (var executor = new ScheduleExecutor( new List <IProcesExecutableScheduleVertices> { new StartVertexProcessor(), new EndVertexProcessor(), new InsertVertexProcessor(), }, conditionStorage, schedule, new ScheduleId(), info)) { var executionOrder = new List <int>(); executor.OnVertexProcess += (s, e) => executionOrder.Add(e.Vertex); executor.Start(); Assert.That(executionOrder, Is.EquivalentTo(new[] { 1, 3, 2 })); } } }
public void RunWithNonPassableEdgeSet() { var condition = new Mock <IScheduleCondition>(); { condition.Setup(c => c.CanTraverse(It.IsAny <CancellationToken>())) .Returns(false); } var conditionStorage = ScheduleConditionStorage.CreateInstanceWithoutTimeline(); var conditionInfo = conditionStorage.Add(condition.Object, "a", "b"); Schedule schedule; { var graph = new BidirectionalGraph <IScheduleVertex, ScheduleEdge>(); var start = new StartVertex(1); graph.AddVertex(start); var end = new EndVertex(2); graph.AddVertex(end); var middle1 = new InsertVertex(3); graph.AddVertex(middle1); var middle2 = new InsertVertex(4); graph.AddVertex(middle2); graph.AddEdge(new ScheduleEdge(start, middle1, conditionInfo.Id)); graph.AddEdge(new ScheduleEdge(start, middle2, conditionInfo.Id)); graph.AddEdge(new ScheduleEdge(middle1, end)); graph.AddEdge(new ScheduleEdge(middle2, end)); schedule = new Schedule(graph, start, end); } using (var info = new ScheduleExecutionInfo(new CurrentThreadTaskScheduler())) { using (var executor = new ScheduleExecutor( new List <IProcesExecutableScheduleVertices> { new StartVertexProcessor(), new EndVertexProcessor(), new InsertVertexProcessor(), }, conditionStorage, schedule, new ScheduleId(), info)) { var state = ScheduleExecutionState.None; executor.OnFinish += (s, e) => { state = e.State; }; executor.Start(); Assert.AreEqual(ScheduleExecutionState.NoTraversableEdgeFound, state); } } }
public void SubScheduleWithLinkBackToParent() { var id = new ScheduleId(); var subScheduleId = new ScheduleId(); ISchedule subSchedule; { var subGraph = new BidirectionalGraph <IScheduleVertex, ScheduleEdge>(); var start = new StartVertex(1); var end = new EndVertex(2); var vertex1 = new SubScheduleVertex(3, id); subGraph.AddVertex(start); subGraph.AddVertex(end); subGraph.AddVertex(vertex1); subGraph.AddEdge(new ScheduleEdge(start, vertex1)); subGraph.AddEdge(new ScheduleEdge(vertex1, end)); subSchedule = new Schedule(subGraph, start, end); } IScheduleVertex errorVertex; Schedule schedule; { var graph = new BidirectionalGraph <IScheduleVertex, ScheduleEdge>(); var start = new StartVertex(1); var end = new EndVertex(2); var vertex1 = new SubScheduleVertex(3, subScheduleId); graph.AddVertex(start); graph.AddVertex(end); graph.AddVertex(vertex1); graph.AddEdge(new ScheduleEdge(start, vertex1)); graph.AddEdge(new ScheduleEdge(vertex1, end)); schedule = new Schedule(graph, start, end); errorVertex = vertex1; } var knownSchedules = new Mock <IStoreSchedules>(); { knownSchedules.Setup(s => s.Contains(It.IsAny <ScheduleId>())) .Returns <ScheduleId>(subScheduleId.Equals); knownSchedules.Setup(s => s.Schedule(It.IsAny <ScheduleId>())) .Returns <ScheduleId>(scheduleId => subSchedule); } var failures = new List <Tuple <ScheduleIntegrityFailureType, IScheduleVertex> >(); var verifier = new ScheduleVerifier(knownSchedules.Object); var result = verifier.IsValid( id, schedule, (f, v) => failures.Add(new Tuple <ScheduleIntegrityFailureType, IScheduleVertex>(f, v))); Assert.IsFalse(result); Assert.AreEqual(1, failures.Count); Assert.AreEqual(ScheduleIntegrityFailureType.SubScheduleLinksBackToParentSchedule, failures[0].Item1); Assert.AreSame(errorVertex, failures[0].Item2); }
public bool ConnectsTo(Vertex <TV, TE, TF> vertex) { if (vertex == null) { return(false); } return(EndVertex.Equals(vertex) || StartVertex.Equals(vertex)); }
public void Create() { IScheduleVertex source = new StartVertex(10); IScheduleVertex target = new EndVertex(11); var condition = new ScheduleElementId(); var edge = new ScheduleEdge(source, target, condition); Assert.AreSame(source, edge.Source); Assert.AreSame(target, edge.Target); Assert.AreSame(condition, edge.TraversingCondition); }
public void CycleWithNoEdgesFromStart() { var knownSchedules = new Mock <IStoreSchedules>(); var verifier = new ScheduleVerifier(knownSchedules.Object); var graph = new BidirectionalGraph <IScheduleVertex, ScheduleEdge>(); var start = new StartVertex(1); graph.AddVertex(start); var end = new EndVertex(2); graph.AddVertex(end); var vertex1 = new InsertVertex(3); graph.AddVertex(vertex1); var vertex2 = new InsertVertex(4); graph.AddVertex(vertex2); var vertex3 = new InsertVertex(5); graph.AddVertex(vertex3); graph.AddEdge(new ScheduleEdge(start, end)); graph.AddEdge(new ScheduleEdge(vertex1, end)); graph.AddEdge(new ScheduleEdge(vertex1, vertex2)); graph.AddEdge(new ScheduleEdge(vertex2, vertex3)); graph.AddEdge(new ScheduleEdge(vertex3, vertex1)); var schedule = new Schedule(graph, start, end); var id = new ScheduleId(); var failures = new List <Tuple <ScheduleIntegrityFailureType, IScheduleVertex> >(); var result = verifier.IsValid( id, schedule, (f, v) => failures.Add(new Tuple <ScheduleIntegrityFailureType, IScheduleVertex>(f, v))); Assert.IsFalse(result); Assert.AreEqual(3, failures.Count); Assert.AreEqual(ScheduleIntegrityFailureType.ScheduleVertexIsNotReachableFromStart, failures[0].Item1); Assert.AreSame(vertex1, failures[0].Item2); Assert.AreEqual(ScheduleIntegrityFailureType.ScheduleVertexIsNotReachableFromStart, failures[1].Item1); Assert.AreSame(vertex2, failures[1].Item2); Assert.AreEqual(ScheduleIntegrityFailureType.ScheduleVertexIsNotReachableFromStart, failures[2].Item1); Assert.AreSame(vertex3, failures[2].Item2); }
private static Schedule CreateScheduleGraphWithOuterAndInnerLoop( ScheduleConditionInformation outerLoopConditionInfo, ScheduleConditionInformation innerLoopConditionInfo, ScheduleActionInformation outerLoopInfo, ScheduleActionInformation innerLoopInfo) { var graph = new BidirectionalGraph <IScheduleVertex, ScheduleEdge>(); var start = new StartVertex(1); graph.AddVertex(start); var end = new EndVertex(2); graph.AddVertex(end); var vertex1 = new InsertVertex(3); graph.AddVertex(vertex1); var vertex2 = new InsertVertex(4); graph.AddVertex(vertex2); var vertex3 = new ExecutingActionVertex(5, outerLoopInfo.Id); graph.AddVertex(vertex3); var vertex4 = new InsertVertex(6); graph.AddVertex(vertex4); var vertex5 = new ExecutingActionVertex(7, innerLoopInfo.Id); graph.AddVertex(vertex5); graph.AddEdge(new ScheduleEdge(start, vertex1)); graph.AddEdge(new ScheduleEdge(vertex1, vertex2)); graph.AddEdge(new ScheduleEdge(vertex2, end, outerLoopConditionInfo.Id)); graph.AddEdge(new ScheduleEdge(vertex2, vertex3)); graph.AddEdge(new ScheduleEdge(vertex3, vertex1, innerLoopConditionInfo.Id)); graph.AddEdge(new ScheduleEdge(vertex3, vertex4)); graph.AddEdge(new ScheduleEdge(vertex4, vertex5)); graph.AddEdge(new ScheduleEdge(vertex5, vertex3)); return(new Schedule(graph, start, end)); }
public void Register() { var graph = new BidirectionalGraph <IScheduleVertex, ScheduleEdge>(); var start = new StartVertex(1); graph.AddVertex(start); var end = new EndVertex(2); graph.AddVertex(end); graph.AddEdge(new ScheduleEdge(start, end)); var schedule = new Schedule(graph, start, end); var scheduleBuilder = new Mock <IBuildFixedSchedules>(); { scheduleBuilder.Setup(s => s.Build()) .Returns(schedule); scheduleBuilder.Setup(s => s.AddExecutingAction(It.IsAny <ScheduleElementId>())) .Returns <ScheduleElementId>(s => new ExecutingActionVertex(0, s)); } var actionId = new ScheduleActionRegistrationId(typeof(string), 0, "a"); var conditionId = new ScheduleConditionRegistrationId(typeof(string), 0, "a"); var owner = new Mock <IOwnScheduleDefinitions>(); { owner.Setup( o => o.StoreSchedule( It.IsAny <ISchedule>(), It.IsAny <Dictionary <ScheduleActionRegistrationId, ScheduleElementId> >(), It.IsAny <Dictionary <ScheduleConditionRegistrationId, ScheduleElementId> >())) .Callback <ISchedule, Dictionary <ScheduleActionRegistrationId, ScheduleElementId>, Dictionary <ScheduleConditionRegistrationId, ScheduleElementId> >( (s, a, c) => { Assert.That(a.Keys, Is.EquivalentTo(new List <ScheduleActionRegistrationId> { actionId })); Assert.That(c.Keys, Is.EquivalentTo(new List <ScheduleConditionRegistrationId> { conditionId })); }); } var builder = new ScheduleDefinitionBuilder(owner.Object, scheduleBuilder.Object); var vertex = builder.AddExecutingAction(actionId); builder.LinkToEnd(vertex, conditionId); builder.Register(); }
private static ISchedule BuildSchedule() { var graph = new BidirectionalGraph <IScheduleVertex, ScheduleEdge>(); var start = new StartVertex(1); graph.AddVertex(start); var end = new EndVertex(2); graph.AddVertex(end); graph.AddEdge(new ScheduleEdge(start, end)); return(new Schedule(graph, start, end)); }
public void TraverseScheduleWithLoop() { // Making a schedule that looks like: // start -> node1 --> node2 -> end // ^ | // |-- node3 <-| Schedule schedule; { var graph = new BidirectionalGraph <IScheduleVertex, ScheduleEdge>(); var start = new StartVertex(1); graph.AddVertex(start); var end = new EndVertex(2); graph.AddVertex(end); var vertex1 = new InsertVertex(3); graph.AddVertex(vertex1); var vertex2 = new InsertVertex(4); graph.AddVertex(vertex2); var vertex3 = new InsertVertex(5); graph.AddVertex(vertex3); graph.AddEdge(new ScheduleEdge(start, vertex1)); graph.AddEdge(new ScheduleEdge(vertex1, vertex2)); graph.AddEdge(new ScheduleEdge(vertex2, end)); graph.AddEdge(new ScheduleEdge(vertex2, vertex3)); graph.AddEdge(new ScheduleEdge(vertex3, vertex1)); schedule = new Schedule(graph, start, end); } var vertices = new List <int>(); schedule.TraverseAllScheduleVertices( schedule.Start, (vertex, edges) => { vertices.Add(vertex.Index); return(true); }); Assert.That(vertices, Is.EquivalentTo(new[] { 1, 3, 4, 2, 5 })); }
//public Line AsLine() //{ // return Line.ByStartPointEndPoint(StartVertex.AsPoint(), EndVertex.AsPoint()); //} #region override methods //TODO: Improve overriding equality methods as per http://www.loganfranken.com/blog/687/overriding-equals-in-c-part-1/ /// <summary> /// Override of Equal Method /// </summary> /// <param name="obj"></param> /// <returns></returns> public override bool Equals(object obj) { if (obj == null || GetType() != obj.GetType()) { return(false); } gEdge e = (gEdge)obj; if (StartVertex.Equals(e.StartVertex) && EndVertex.Equals(e.EndVertex)) { return(true); } if (StartVertex.Equals(e.EndVertex) && EndVertex.Equals(e.StartVertex)) { return(true); } return(false); }
public void EndVertexWithOutboundEdges() { var knownSchedules = new Mock <IStoreSchedules>(); var verifier = new ScheduleVerifier(knownSchedules.Object); Schedule schedule; { var graph = new BidirectionalGraph <IScheduleVertex, ScheduleEdge>(); var start = new StartVertex(1); graph.AddVertex(start); var end = new EndVertex(2); graph.AddVertex(end); var vertex1 = new InsertVertex(3); graph.AddVertex(vertex1); var vertex2 = new InsertVertex(4); graph.AddVertex(vertex2); graph.AddEdge(new ScheduleEdge(start, vertex1)); graph.AddEdge(new ScheduleEdge(vertex1, vertex2)); graph.AddEdge(new ScheduleEdge(vertex2, end)); graph.AddEdge(new ScheduleEdge(end, vertex1)); schedule = new Schedule(graph, start, end); } var id = new ScheduleId(); var failures = new List <Tuple <ScheduleIntegrityFailureType, IScheduleVertex> >(); var result = verifier.IsValid( id, schedule, (f, v) => failures.Add(new Tuple <ScheduleIntegrityFailureType, IScheduleVertex>(f, v))); Assert.IsFalse(result); Assert.AreEqual(1, failures.Count); Assert.AreEqual(ScheduleIntegrityFailureType.ScheduleIsMissingEnd, failures[0].Item1); Assert.AreSame(schedule.End, failures[0].Item2); }
public void Create() { var graph = new BidirectionalGraph <IScheduleVertex, ScheduleEdge>(); var start = new StartVertex(1); graph.AddVertex(start); var end = new EndVertex(2); graph.AddVertex(end); graph.AddEdge(new ScheduleEdge(start, end)); var schedule = new Schedule(graph, start, end); Assert.AreSame(start, schedule.Start); Assert.AreSame(end, schedule.End); Assert.That(schedule.Vertices, Is.EquivalentTo(new IScheduleVertex[] { start, end })); Assert.AreEqual(1, schedule.NumberOfOutboundConnections(start)); Assert.AreEqual(1, schedule.NumberOfInboundConnections(end)); }
public void VertexWithMultipleEdgesInOneDirection() { var knownSchedules = new Mock <IStoreSchedules>(); var verifier = new ScheduleVerifier(knownSchedules.Object); var graph = new BidirectionalGraph <IScheduleVertex, ScheduleEdge>(); var start = new StartVertex(1); graph.AddVertex(start); var end = new EndVertex(2); graph.AddVertex(end); var vertex1 = new InsertVertex(3); graph.AddVertex(vertex1); graph.AddEdge(new ScheduleEdge(start, vertex1)); graph.AddEdge(new ScheduleEdge(vertex1, end)); graph.AddEdge(new ScheduleEdge(vertex1, end)); var schedule = new Schedule(graph, start, end); var id = new ScheduleId(); var failures = new List <Tuple <ScheduleIntegrityFailureType, IScheduleVertex> >(); var result = verifier.IsValid( id, schedule, (f, v) => failures.Add(new Tuple <ScheduleIntegrityFailureType, IScheduleVertex>(f, v))); Assert.IsFalse(result); Assert.AreEqual(1, failures.Count); Assert.AreEqual(ScheduleIntegrityFailureType.VertexLinksToOtherVertexInMultipleWays, failures[0].Item1); Assert.AreSame(vertex1, failures[0].Item2); }
public void TraverseScheduleCompletely() { Schedule schedule; { var graph = new BidirectionalGraph <IScheduleVertex, ScheduleEdge>(); var start = new StartVertex(1); graph.AddVertex(start); var end = new EndVertex(2); graph.AddVertex(end); var vertex1 = new InsertVertex(3); graph.AddVertex(vertex1); var vertex2 = new InsertVertex(4); graph.AddVertex(vertex2); graph.AddEdge(new ScheduleEdge(start, vertex1)); graph.AddEdge(new ScheduleEdge(vertex1, vertex2)); graph.AddEdge(new ScheduleEdge(vertex2, end)); schedule = new Schedule(graph, start, end); } var vertices = new List <int>(); schedule.TraverseAllScheduleVertices( schedule.Start, (vertex, edges) => { vertices.Add(vertex.Index); return(true); }); Assert.That(vertices, Is.EquivalentTo(new[] { 1, 3, 4, 2 })); }
public double DistanceTo(gEdge edge) { // http://mathworld.wolfram.com/Line-LineDistance.html if (this.IsCoplanarTo(edge)) { var distances = new double[4] { StartVertex.DistanceTo(edge), EndVertex.DistanceTo(edge), edge.StartVertex.DistanceTo(this), edge.EndVertex.DistanceTo(this) }; return(distances.Min()); } else { var a = this.Direction; var b = edge.Direction; var c = gVector.ByTwoVertices(this.StartVertex, edge.StartVertex); gVector cross = a.Cross(b); double numerator = c.Dot(cross); double denominator = cross.Length; return(Math.Abs(numerator) / Math.Abs(denominator)); } }
public void RunWithLoop() { bool passThrough = false; var condition = new Mock <IScheduleCondition>(); { condition.Setup(c => c.CanTraverse(It.IsAny <CancellationToken>())) .Returns(() => passThrough); } var conditionStorage = ScheduleConditionStorage.CreateInstanceWithoutTimeline(); var conditionInfo = conditionStorage.Add(condition.Object, "a", "b"); var action = new Mock <IScheduleAction>(); { action.Setup(a => a.Execute(It.IsAny <CancellationToken>())) .Callback(() => passThrough = true); } var collection = ScheduleActionStorage.CreateInstanceWithoutTimeline(); var info = collection.Add( action.Object, "a", "b"); // Making a schedule that looks like: // start -> node1 --> node2 -> end // ^ | // |-- node3 <-| Schedule schedule; { var graph = new BidirectionalGraph <IScheduleVertex, ScheduleEdge>(); var start = new StartVertex(1); graph.AddVertex(start); var end = new EndVertex(2); graph.AddVertex(end); var vertex1 = new InsertVertex(3); graph.AddVertex(vertex1); var vertex2 = new InsertVertex(4); graph.AddVertex(vertex2); var vertex3 = new ExecutingActionVertex(5, info.Id); graph.AddVertex(vertex3); graph.AddEdge(new ScheduleEdge(start, vertex1)); graph.AddEdge(new ScheduleEdge(vertex1, vertex2)); graph.AddEdge(new ScheduleEdge(vertex2, end, conditionInfo.Id)); graph.AddEdge(new ScheduleEdge(vertex2, vertex3)); graph.AddEdge(new ScheduleEdge(vertex3, vertex1)); schedule = new Schedule(graph, start, end); } using (var executionInfo = new ScheduleExecutionInfo(new CurrentThreadTaskScheduler())) { using (var executor = new ScheduleExecutor( new List <IProcesExecutableScheduleVertices> { new StartVertexProcessor(), new EndVertexProcessor(), new InsertVertexProcessor(), new ActionVertexProcessor(collection), }, conditionStorage, schedule, new ScheduleId(), executionInfo)) { var executionOrder = new List <int>(); executor.OnVertexProcess += (s, e) => executionOrder.Add(e.Vertex); executor.Start(); Assert.That(executionOrder, Is.EquivalentTo(new[] { 1, 3, 4, 5, 3, 4, 2 })); } } }
/// <summary> /// Creates a String Representation of this HalfEdge. /// </summary> /// <returns>String representation of this HalfEdge.</returns> public override string ToString() { return($"From: {StartVertex.ToString()} " + $"To: {EndVertex.ToString()}"); }
public void RoundtripSerialize() { // Making a schedule that looks like: // start -> node1 --> node2 -> end // ^ | // |-- node3 <-| // ^ | // node5--| |-> node4 // ^ | // |--------------| Schedule schedule; { var graph = new BidirectionalGraph <IScheduleVertex, ScheduleEdge>(); var start = new StartVertex(1); graph.AddVertex(start); var end = new EndVertex(2); graph.AddVertex(end); var vertex1 = new InsertVertex(3); graph.AddVertex(vertex1); var vertex2 = new InsertVertex(4); graph.AddVertex(vertex2); var vertex3 = new InsertVertex(5); graph.AddVertex(vertex3); var vertex4 = new InsertVertex(6); graph.AddVertex(vertex4); var vertex5 = new InsertVertex(7); graph.AddVertex(vertex5); graph.AddEdge(new ScheduleEdge(start, vertex1)); graph.AddEdge(new ScheduleEdge(vertex1, vertex2)); graph.AddEdge(new ScheduleEdge(vertex2, end)); graph.AddEdge(new ScheduleEdge(vertex2, vertex3)); graph.AddEdge(new ScheduleEdge(vertex3, vertex1)); graph.AddEdge(new ScheduleEdge(vertex3, vertex4)); graph.AddEdge(new ScheduleEdge(vertex4, vertex5)); graph.AddEdge(new ScheduleEdge(vertex5, vertex3)); schedule = new Schedule(graph, start, end); } var otherSchedule = AssertExtensions.RoundTripSerialize(schedule); var vertices = new List <int>(); otherSchedule.TraverseAllScheduleVertices( otherSchedule.Start, (vertex, edges) => { vertices.Add(vertex.Index); return(true); }); Assert.That(vertices, Is.EquivalentTo(new[] { 1, 3, 4, 2, 5, 6, 7 })); }
public override int GetHashCode() { return(31 + (IsPrimaryEdge ? 17 : -29) + 11 * EndVertex.GetHashCode()); }
/// <summary> /// gEdge constructor by line /// </summary> /// <param name="line">line</param> /// <returns name="edge">edge</returns> //public static gEdge ByLine(Line line) //{ // gVertex start = gVertex.ByCoordinates(line.StartPoint.X, line.StartPoint.Y, line.StartPoint.Z); // gVertex end = gVertex.ByCoordinates(line.EndPoint.X, line.EndPoint.Y, line.EndPoint.Z); // return new gEdge(start, end); //} #endregion /// <summary> /// Method to check if vertex belongs to edge /// </summary> /// <param name="vertex"></param> /// <returns></returns> public bool Contains(gVertex vertex) { return(StartVertex.Equals(vertex) || EndVertex.Equals(vertex)); }
public bool Connects(Vertex <TV, TE, TF> start, Vertex <TV, TE, TF> end) { return(EndVertex.Equals(end) && StartVertex.Equals(start)); }
public override int GetHashCode() => StartVertex.GetHashCode() ^ EndVertex.GetHashCode() ^ Weight;
private void OnEndVertex(TVertex vertex) { Debug.Assert(vertex != null); EndVertex?.Invoke(vertex); }
private static Schedule BuildSchedule( ScheduleElementId action1, ScheduleElementId action2, ScheduleId scheduleId, ScheduleElementId exitCondition, ScheduleElementId passThroughCondition) { var variable = new Mock <IScheduleVariable>(); // Making a schedule that looks like: // start --> node1 -----------------------> node2 -> end // ^ | // |-- node5 <-- node4 <-- node3<-| // ^ | // node7--| |-> node6 // ^ | // |--------------| Schedule schedule = null; { var graph = new BidirectionalGraph <IScheduleVertex, ScheduleEdge>(); var start = new StartVertex(1); graph.AddVertex(start); var end = new EndVertex(2); graph.AddVertex(end); var vertex1 = new ExecutingActionVertex(3, action1); graph.AddVertex(vertex1); var vertex2 = new ExecutingActionVertex(4, action2); graph.AddVertex(vertex2); var vertex3 = new SynchronizationStartVertex(5, new IScheduleVariable[] { variable.Object }); graph.AddVertex(vertex3); var vertex4 = new ExecutingActionVertex(6, action2); graph.AddVertex(vertex4); var vertex5 = new SynchronizationEndVertex(7); graph.AddVertex(vertex5); var vertex6 = new SubScheduleVertex(8, scheduleId); graph.AddVertex(vertex6); var vertex7 = new InsertVertex(9); graph.AddVertex(vertex7); graph.AddEdge(new ScheduleEdge(start, vertex1)); graph.AddEdge(new ScheduleEdge(vertex1, vertex2)); graph.AddEdge(new ScheduleEdge(vertex2, end, exitCondition)); graph.AddEdge(new ScheduleEdge(vertex2, vertex3)); graph.AddEdge(new ScheduleEdge(vertex3, vertex4)); graph.AddEdge(new ScheduleEdge(vertex4, vertex5, passThroughCondition)); graph.AddEdge(new ScheduleEdge(vertex4, vertex6)); graph.AddEdge(new ScheduleEdge(vertex5, vertex1)); graph.AddEdge(new ScheduleEdge(vertex6, vertex7)); graph.AddEdge(new ScheduleEdge(vertex7, vertex4)); schedule = new Schedule(graph, start, end); } return(schedule); }
/// <summary> /// Override of GetHashCode Method /// </summary> /// <returns></returns> public override int GetHashCode() { return(StartVertex.GetHashCode() ^ EndVertex.GetHashCode()); }