t.createInstance(c, "a:TransCoord", sync=False)
t.inactive()

c.active()
c.createInstance(a1, "a1:TransCheck", sync=False)
a1.active()

c.createInstance(a2, "a2:TransCheck", sync=False)
a2.active()

a1.message(c, "ok")
c.callMethod(c, "all done?")
c.inactive()
a1.delete()

diagram.step()

c.active()
a2.message(c, "ok")
c.callMethod(c, "all done?")
c.inactive()
a2.delete()

c.message(t, "beValid")

t.active()
diagram.step()

# Render the diagram into an SVG file
diagram.svg('concurrentProcessesActivations')
# This example is drawn from the example from the UMLGraph documentation
# http://umlgraph.org/doc/uml-appa.html

from sequenceplot import SequenceObject, Placeholder, SequenceDiagram

# declare objects
e = Placeholder()
t = SequenceObject("t:thread")
o = SequenceObject(":Toolkit")
p = Placeholder()

diagram = SequenceDiagram([e, t, o, p])
diagram.setParam('objectSpacing', 1.75)

# use pushMethod() to nest activations
e.pushMethod(t, "a1: run(3)")
t.pushMethod(o, "run()")
o.callMethod(o, "callbackLoop()")

o.createInstance(p, "p:Peer")
o.callMethod(p, "handleExpose()", "", responseSync=True)
o.destroyInstance(p)

t.inactive()
o.inactive()
diagram.step(2)

# Render the diagram into an SVG file named "authentication.svg".
diagram.svg('nestedActivation')
Esempio n. 3
0
# See the License for the specific language governing permissions and
# limitations under the License.
#
# Author: Charles Y. Choi

from sequenceplot import SequenceObject, SequenceDiagram

# declare client and server instances
client = SequenceObject('c: client')
server = SequenceObject('s: server')

# declare diagram instance, adding client and server to the diagram.
diagram = SequenceDiagram([client, server])

# configure diagram parameters
diagram.setParam('objectSpacing', 1.75)

client.callMethod(server, 'login(username, password)', response='sessionID, userInfo')

c1 = diagram.comment(server,
                     'This is an\nexample comment\nconnected to the\nclient and server.',
                     'down 0.35 left 0.5',
                     'wid 1.5 ht 0.7')

diagram.connectToComment(client, c1)
diagram.step(5)

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