-
Notifications
You must be signed in to change notification settings - Fork 24
/
IProcess.cs
78 lines (66 loc) · 2.52 KB
/
IProcess.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
// Copyright (c) 2023, Phoenix Contact GmbH & Co. KG
// Licensed under the Apache License, Version 2.0
using System;
using System.Collections.Generic;
using Moryx.AbstractionLayer.Recipes;
namespace Moryx.AbstractionLayer
{
/// <summary>
/// Defines how activities should be loaded from a <see cref="IProcess"/>
/// </summary>
public enum ActivitySelectionType
{
/// <summary>
/// Will select the first activity. Throws if no activity is available.
/// </summary>
First,
/// <summary>
/// Will select the first activity. Returns null if no activity is available.
/// </summary>
FirstOrDefault,
/// <summary>
/// Will select the last activity. Throws if no activity is available.
/// </summary>
Last,
/// <summary>
/// Will select the last activity. Returns null if no activity is available.
/// </summary>
LastOrDefault
}
/// <summary>
/// A process is a sequence of activities defined and parameterized by a recipe.
/// All activities created for the process are stored with the process for tracing purposes.
/// All objects representing a process implement the <see cref="IProcess"/> interface.
/// </summary>
public interface IProcess : IPersistentObject, IConstraintContext
{
/// <summary>
/// A link to the recipe of this process.
/// </summary>
IRecipe Recipe { get; set; }
/// <summary>
/// The current and the finished activities of this process.
/// </summary>
IEnumerable<IActivity> GetActivities();
/// <summary>
/// The current and the finished activities of this process filtered by the given function.
/// </summary>
IEnumerable<IActivity> GetActivities(Func<IActivity, bool> predicate);
/// <summary>
/// Get an activity using the given selection type.
/// </summary>
IActivity GetActivity(ActivitySelectionType selectionType);
/// <summary>
/// Get an activity using the given selection type that complies to the given predicate.
/// </summary>
IActivity GetActivity(ActivitySelectionType selectionType, Func<IActivity, bool> predicate);
/// <summary>
/// Add an activity to the list
/// </summary>
void AddActivity(IActivity toAdd);
/// <summary>
/// Remove an activity from the list
/// </summary>
void RemoveActivity(IActivity toRemove);
}
}