Skip to content

Commit 5f593e1

Browse files
committed
Merge pull request #610 from Systems-Modeling/ST6RI-813
ST6RI-813 Transfers across interfaces (SYSML2_-39)
2 parents 8074029 + 8a20b61 commit 5f593e1

5 files changed

Lines changed: 722 additions & 156 deletions

File tree

Lines changed: 87 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -1,48 +1,89 @@
11
standard library package Interfaces {
2-
doc
3-
/*
4-
* This package defines the base types for interfaces and related structural elements in the SysML language.
5-
*/
6-
7-
private import Connections::Connection;
8-
private import Connections::connections;
9-
private import Connections::BinaryConnection;
10-
private import Connections::binaryConnections;
11-
private import Ports::Port;
12-
13-
abstract interface def Interface :> Connection {
14-
doc
15-
/*
16-
* Interface is the most general class of links between Ports on Parts
17-
* within some containing structure. Interface is the base type of all
18-
* InterfaceDefinitions.
19-
*/
20-
}
21-
22-
abstract interface def BinaryInterface :> Interface, BinaryConnection {
23-
doc
24-
/*
25-
* BinaryInterface is the most general class of links between two Ports
26-
* on Parts within some containing structure. BinaryInterface is the base
27-
* type of all binary InterfaceDefinitions with exactly two ends.
28-
*/
29-
30-
end source: Port :>> BinaryConnection::source;
31-
end target: Port :>> BinaryConnection::target;
32-
}
33-
34-
abstract interface interfaces: Interface[0..*] nonunique :> connections {
35-
doc
36-
/*
37-
* interfaces is the base feature of all InterfaceUsages.
38-
*/
39-
}
40-
41-
abstract interface binaryInterfaces: BinaryInterface[0..*] nonunique :> interfaces, binaryConnections {
42-
doc
43-
/*
44-
* interfaces is the base feature of all binary InterfaceUsages.
45-
*/
46-
}
47-
2+
doc
3+
/*
4+
* This package defines the base types for interfaces and related structural elements in the SysML language.
5+
*/
6+
7+
private import Connections::Connection;
8+
private import Connections::connections;
9+
private import Connections::BinaryConnection;
10+
private import Connections::binaryConnections;
11+
private import Ports::Port;
12+
13+
private import ScalarValues::Natural;
14+
private import SequenceFunctions::size;
15+
private import SequenceFunctions::excludingAt;
16+
private import ControlFunctions::selectOne;
17+
18+
private import SequenceFunctions::notEmpty;
19+
20+
private calc def excludingOnce {
21+
doc
22+
/*
23+
* Return a sequence that is the same as the input sequence, but with a single
24+
* instance of a given value removed. The given value must be in the input sequence.
25+
*/
26+
in seq[1..*] nonunique ordered;
27+
in value[1] :> seq;
28+
29+
private attribute position : Natural[1] = (1..size(seq))->selectOne{in i; seq#(i) == value};
30+
seq->excludingAt(position)
31+
}
32+
33+
abstract interface def Interface :> Connection {
34+
doc
35+
/*
36+
* Interface is the most general class of links between Ports on Parts
37+
* within some containing structure. Interface is the base type of all
38+
* InterfaceDefinitions.
39+
*
40+
* Transfers outgoing from any one of the participant Ports of an Interface
41+
* may be targeted to one of the other participant Ports (depending on any
42+
* other Interfaces in which the Port is also participating).
43+
*/
44+
45+
ref port :>> participant : Port [2..*] nonunique ordered {
46+
doc
47+
/*
48+
* The participants of an Interface must be Ports. The interfacingPorts of
49+
* each participant Port include all the other participants in the Interface.
50+
*/
51+
52+
protected ref thisParticipant :>> self;
53+
protected ref otherParticipants : Port [1..*] nonunique :> interfacingPorts
54+
default participant->excludingOnce(thisParticipant);
55+
}
56+
}
57+
58+
abstract interface def BinaryInterface :> Interface, BinaryConnection {
59+
doc
60+
/*
61+
* BinaryInterface is the most general class of links between two Ports
62+
* on Parts within some containing structure. BinaryInterface is the base
63+
* type of all binary InterfaceDefinitions which have exactly two ends.
64+
*
65+
* Transfers outgoing from each participant Port of a BinaryInterface may be
66+
* targeted to the other participant Port (depending on any other Interfaces
67+
* in which the Port is also participating).
68+
*/
69+
70+
ref port :>> Interface::participant, BinaryConnection::participant[2] nonunique ordered;
71+
72+
end port source: Port :>> BinaryConnection::source;
73+
end port target: Port :>> BinaryConnection::target;
74+
}
75+
76+
abstract interface interfaces: Interface[0..*] nonunique :> connections {
77+
doc
78+
/*
79+
* interfaces is the base feature of all InterfaceUsages.
80+
*/
81+
}
82+
83+
abstract interface binaryInterfaces: BinaryInterface[0..*] nonunique :> interfaces, binaryConnections {
84+
doc
85+
/*
86+
* interfaces is the base feature of all binary InterfaceUsages.
87+
*/
88+
}
4889
}
Lines changed: 48 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,51 @@
11
standard library package Ports {
2-
doc
3-
/*
4-
* This package defines the base types for ports and related structural elements
5-
* in the SysML language.
6-
*/
2+
doc
3+
/*
4+
* This package defines the base types for ports and related structural elements
5+
* in the SysML language.
6+
*/
77

8-
private import Objects::Object;
9-
private import Objects::objects;
10-
11-
abstract port def Port :> Object {
12-
doc
13-
/*
14-
* Port is the most general class of objects that represent connection points
15-
* for interacting with a Part. Port is the base type of all PortDefinitions.
16-
*/
17-
18-
ref self: Port :>> Object::self;
19-
20-
port subports: Port :> timeEnclosedOccurrences {
21-
doc
22-
/*
23-
* The Ports that are subports of this Port.
24-
*/
25-
}
26-
}
27-
28-
abstract port ports : Port[0..*] nonunique :> objects {
29-
doc
30-
/*
31-
* ports is the base feature of all PortUsages.
32-
*/
33-
}
8+
private import Objects::Object;
9+
private import Objects::objects;
10+
11+
abstract port def Port :> Object {
12+
doc
13+
/*
14+
* Port is the most general class of objects that represent connection points
15+
* for interacting with a Part. Port is the base type of all PortDefinitions.
16+
*
17+
* Transfers outgoing from a Port are always targeted to a Port connected to
18+
* the original Port by an Interface.
19+
*/
20+
21+
ref self: Port :>> Object::self;
22+
23+
port subports: Port [0..*] :> ports, timeEnclosedOccurrences {
24+
doc
25+
/*
26+
* The Ports that are subports of this Port.
27+
*/
28+
}
29+
30+
abstract ref port interfacingPorts : Port[0..*] nonunique :> ports {
31+
doc
32+
/*
33+
* Ports that are connected to this Port by an Interface.
34+
*/
35+
}
36+
37+
ref :>> outgoingTransfersFromSelf :> interfacingPorts.incomingTransfersToSelf {
38+
doc
39+
/*
40+
* The target of each of the outgoingTransfersFromSelf of a Port must be an interfacingPort.
41+
*/
42+
}
43+
}
44+
45+
abstract port ports : Port[0..*] nonunique :> objects {
46+
doc
47+
/*
48+
* ports is the base feature of all PortUsages.
49+
*/
50+
}
3451
}

0 commit comments

Comments
 (0)