File size: 6,559 Bytes
5070096
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
standard library package Connections {
    doc
    /*
     * This package defines the base types for connections and related structural elements 
     * in the SysML language.
     */

    private import Base::Anything;
    private import Occurrences::Occurrence;
    private import Occurrences::HappensDuring;
    private import Objects::LinkObject;
    private import Objects::linkObjects;
    private import Objects::BinaryLinkObject;
    private import Objects::binaryLinkObjects;
    private import Transfers::Transfer;
    private import Transfers::transfers;
    private import Transfers::FlowTransfer;
    private import Transfers::flowTransfers;
    private import Transfers::FlowTransferBefore;
    private import Transfers::flowTransfersBefore;
    private import ScalarValues::Natural;
    private import Parts::Part;
    private import Parts::parts;
    private import Actions::Action;
    private import Actions::actions;

    abstract connection def Connection :> LinkObject, Part {
        doc
        /*
         * Connection is the most general class of links between things within some 
         * containing structure. Connection is the base type of all ConnectionDefinitions.
         */
    }
     
    abstract connection def BinaryConnection :> Connection, BinaryLinkObject {
        doc
        /*
         * BinaryConnection is the most general class of binary links between two things 
         * within some containing structure. BinaryConnection is the base type of all 
         * ConnectionDefinitions with exactly two ends.
         */
    
        end source: Anything[0..*] :>> BinaryLinkObject::source;
        end target: Anything[0..*] :>> BinaryLinkObject::target;
    }
    
    abstract flow def MessageConnection :> BinaryConnection, Transfer, Action {
        doc
        /*
         * MessageConnection is the class of binary connections that represent a transfer 
         * of objects or values between two occurrences. It is the base type of all
         * FlowConnectionDefinitions.
         */
    
        end occurrence source: Occurrence[0..*] :>> BinaryConnection::source, Transfer::source;
        end occurrence target: Occurrence[0..*] :>> BinaryConnection::target, Transfer::target;
        
        ref payload :>> 'item';
        
        private ref part thisConnection = self;
        
        in event occurrence sourceEvent [1] default thisConnection.start {
            doc
            /* 
             * An occurrence happening during the source of this flow connection
             * that is either the start of the connection or happens before it.
             */
        }
        in event occurrence targetEvent [1] default thisConnection.done {
            doc
            /* 
             * An occurrence happening during the target of this flow connection
             * that is either the end of the connection or happens after it.
             */
        }
        
        connection :HappensDuring connect sourceEvent to source[1];
        connection :HappensDuring connect targetEvent to target[1];
        
        private attribute seBeforeNum: Natural[1] = if sourceEvent==thisConnection.start ? 0 else 1;
        private attribute teAfterNum: Natural[1] = if targetEvent==thisConnection.done ? 0 else 1;
        succession [seBeforeNum] first sourceEvent[0..1] then self[0..1];
        succession [teAfterNum] first self[0..1] then targetEvent[0..1];
    }
    
    abstract flow def FlowConnection :> MessageConnection, FlowTransfer {
        doc
        /*
         * FlowConnection is the subclass of message connections that a alsow flow transfers.
         * It is the base type for FlowConnectionUsages that identify their source output and
         * target input.
         */
        
        end occurrence source: Occurrence[0..*] :>> MessageConnection::source, FlowTransfer::source;
        end occurrence target: Occurrence[0..*] :>> MessageConnection::target, FlowTransfer::target;
    }
    
    abstract flow def SuccessionFlowConnection :> FlowConnection, FlowTransferBefore {
        doc
        /*
         * SuccessionFlowConnection is the subclass of flow connections that represent 
         * temporally ordered transfers. It is the base type for all SuccessionFlowConnectionUsages.
         */
    
        end occurrence source: Occurrence[0..*] :>> FlowConnection::source, FlowTransferBefore::source;
        end occurrence target: Occurrence[0..*] :>> FlowConnection::target, FlowTransferBefore::target;
    }
    
    abstract connection connections: Connection[0..*] nonunique :> linkObjects, parts {
        doc
        /*
         * connections is the base feature of all ConnectionUsages.
         */
    }
    
    abstract connection binaryConnections: Connection[0..*] nonunique :> connections, binaryLinkObjects {
        doc
        /*
         * binaryConnections is the base feature of all binary ConnectionUsages.
         */
    }
    
    abstract message messageConnections: MessageConnection[0..*] nonunique :> binaryConnections, transfers, actions {
        doc
        /*
         * messageConnections is the base feature of all FlowConnectionUsages.
         */
    
        end occurrence source: Occurrence[0..*] :>> MessageConnection::source, binaryConnections::source, transfers::source;
        end occurrence target: Occurrence[0..*] :>> MessageConnection::target, binaryConnections::target, transfers::target;
    }
    
    abstract message flowConnections: FlowConnection[0..*] nonunique :> messageConnections, flowTransfers {
        doc
        /*
         * flowConnections is the base feature of all FlowConnectionUsages that identify their source output
         * and target input.
         */
    
        end occurrence source: Occurrence[0..*] :>> FlowConnection::source, messageConnections::source, flowTransfers::source;
        end occurrence target: Occurrence[0..*] :>> FlowConnection::target, messageConnections::target, flowTransfers::target;
    }
    
    abstract message successionFlowConnections: SuccessionFlowConnection[0..*] nonunique :> flowConnections, flowTransfersBefore {
        doc
        /*
         * successionFlowConnections is the base feature of all SuccessionFlowConnectionUsages.
         */
    
        end occurrence source: Occurrence[0..*] :>> SuccessionFlowConnection::source, flowConnections::source, flowTransfersBefore::source;
        end occurrence target: Occurrence[0..*] :>> SuccessionFlowConnection::target, flowConnections::target, flowTransfersBefore::target;
    }
}