Barrie Slaymaker

NAME

Chart::Sequence - A sequence class

SYNOPSIS

    use Chart::Sequence;
    my $s = Chart::Sequence->new(
        Nodes    => [qw( A B C )],
        Messages => [
            [ A => B => "Message 1" ],
            [ B => A => "Ack 1"     ],
            [ B => C => "Message 2" ],
        ],
    );

    # or #
    my $s = Chart::Sequence->new(
        SeqMLInput => "foo.seqml",
    );


    my $r = Chart::Sequence::Imager->new;
    my $png => $r->render( $s => "png" );
    $r->render_to_file( $s => "foo.png" );

DESCRIPTION

    ALPHA CODE ALERT: This is alpha code and the API will be
    changing.  For instance, I need to generalize "messages"
    in to "events". Feedback wanted.

A sequence chart portrays a sequence of events occuring among a set of objects or, as we refer to them, nodes.

So far, this class only supports portrayal of messages between nodes (and then not even from a node to itself). More events are planned.

So, a Chart::Sequence has a list of nodes and a list of messages. Nodes will be instantiated automatically from the messages destinations (an option to disable this will be forthcoming).

A sequence may created and populated in one or more of 3 ways:

  1. Messages and, optionally, nodes may be passed in to new()

  2. Messages and, optionally, nodes may be added or removed en masse using the appropriate methods.

  3. "SeqML" files may be parsed using Chart::Sequence::SAXBuilder. See the test scripts for examples

A small example (example_sequence_chart.png) is included in the tarball.

Once built, charts may be layed out using a pluggable layout and rendering system for which only one pixel-graphics oriented layout (Chart::Sequence::Layout) and one renderer (Chart::Sequence::Renderer::Imager) exist.

More docs forthcoming; feel free to ask.

METHODS

new
    my $s = Chart::Sequence->new;
name

Sets/gets the name of this sequence

nodes

A node is something that sends or receives a message.

    $s->nodes( $node1, $node2, ... );
    my @nodes = $s->nodes;

Sets / gets the list of nodes. If any messages refer to non-existent nodes, the missing nodes are created.

nodes_ref

Sets/gets an ARRAY reference to an array containing nodes.

push_nodes

Appends one or more nodes to the end of the current list.

node_named

Gets a node by name.

messages
    $s->messages( $msg1, $msg2, ... );
    my @messages = $s->messages;

Returns or sets the list of messages.

messages_ref

Returns or sets the list of messages as an ARRAY reference.

push_messages

Adds messages to the end of the sequence.

read_seqml
    my $s = Chart::Sequence->read_seqml( "some.seqml" );
    $s = Chart::Sequence->read_seqml( "more.seqml" );

Reads XML from a filehandle, a SCALAR reference, or a named file.

When called as a class method, returns a new Chart::Sequence object. When called as an instance method add additional events to the instance.

Requirese the optional prerequisite XML::SAX.

LIMITATIONS

Requires XML::SAX::PurePurl for now. The latest XML::LibXML::SAX seems to not notice <foo xmlns"http://bar/..."> declarations.

SEE ALSO

Chart::Sequence::SAXBuilder

COPYRIGHT

    Copyright 2002, R. Barrie Slaymaker, Jr., All Rights Reserved

LICENSE

You may use this module under the terms of the BSD, Artistic, oir GPL licenses, any version.

AUTHOR

Barrie Slaymaker <barries@slaysys.com>