コード例 #1
0
# declare objects

s = SequenceObject('s:Caller')
w = SequenceObject(':Switch')
c = Placeholder()
r = SequenceObject('r:Caller')

diagram = SequenceDiagram([s, w, c, r])
diagram.setParam('objectSpacing', 0.5)

diagram.step()
w.active()
diagram.async()

s.message(w, 'liftReceiver')
diagram.sync()
w.message(s, 'setDialTone()')
diagram.async()
s.message(w, '*dialDigit(d)')
w.lconstraint('{dialing.executionTime < 30s}')
w.callMethod(w, 'routeCalls(s,n)')

w.createInstance(c, 'c:Convers')
c.active()
c.pushMethod(r, 'ring()')
diagram.async()
r.message(c, 'liftReceiver')
diagram.sync()
c.message(w, 'connect(r,s)')
w.message(s, 'connect(r)')
コード例 #2
0
#      http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# Author: Charles Y. Choi

# This example is drawn from the example from the UMLGraph documentation
# http://umlgraph.org/doc/uml-appa.html

from sequenceplot import SequenceObject, Actor, SequenceDiagram

# declare objects
a = Actor()
t = SequenceObject(':OTager')
f = SequenceObject(':OFulfill')

diagram = SequenceDiagram([a, t, f])

diagram.step()
a.message(t, 'submitOrder')
t.message(f, 'placeOrder')
f.message(a, 'acknowledgeOrder')
diagram.step()

# Render the diagram into an SVG file
diagram.svg('externalActor')