pub mod emit;
pub mod gaphor;
pub mod layout;
pub mod mdj;
pub mod svg;
#[derive(Debug, Clone, PartialEq, Eq)]
pub struct Sequence {
pub participants: Vec<Participant>,
pub items: Vec<Item>,
pub autonumber: bool,
pub auto_start: i64,
pub auto_step: i64,
pub title: String,
pub boxes: Vec<BoxGroup>,
}
#[derive(Debug, Clone, PartialEq, Eq)]
pub struct BoxGroup {
pub label: String,
pub members: Vec<String>,
}
#[derive(Debug, Clone, PartialEq, Eq)]
pub struct Participant {
pub id: String,
pub label: String,
pub is_actor: bool,
}
#[derive(Debug, Clone, PartialEq, Eq)]
pub enum Item {
Message(Message),
Activate(String),
Deactivate(String),
Note(Note),
Fragment(Fragment),
Autonumber(AutoNumber),
}
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum AutoNumber {
Set(i64, i64),
On,
Off,
}
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum MessageSort {
SynchCall,
AsynchCall,
AsynchSignal,
Reply,
CreateMessage,
DeleteMessage,
}
impl MessageSort {
pub fn uml(self) -> &'static str {
match self {
MessageSort::SynchCall => "synchCall",
MessageSort::AsynchCall => "asynchCall",
MessageSort::AsynchSignal => "asynchSignal",
MessageSort::Reply => "reply",
MessageSort::CreateMessage => "createMessage",
MessageSort::DeleteMessage => "deleteMessage",
}
}
}
#[derive(Debug, Clone, PartialEq, Eq)]
pub struct Message {
pub from: String,
pub to: String,
pub text: String,
pub sort: MessageSort,
pub activate_target: bool,
pub deactivate_source: bool,
pub bidirectional: bool,
}
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum NotePlacement {
LeftOf,
RightOf,
Over,
}
#[derive(Debug, Clone, PartialEq, Eq)]
pub struct Note {
pub placement: NotePlacement,
pub targets: Vec<String>,
pub text: String,
}
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum FragmentOp {
Loop,
Alt,
Opt,
Par,
Critical,
Break,
Rect,
}
impl FragmentOp {
pub fn uml(self) -> &'static str {
match self {
FragmentOp::Loop => "loop",
FragmentOp::Alt => "alt",
FragmentOp::Opt => "opt",
FragmentOp::Par => "par",
FragmentOp::Critical => "critical",
FragmentOp::Break => "break",
FragmentOp::Rect => "rect",
}
}
}
#[derive(Debug, Clone, PartialEq, Eq)]
pub struct Fragment {
pub operator: FragmentOp,
pub operands: Vec<Operand>,
}
#[derive(Debug, Clone, PartialEq, Eq)]
pub struct Operand {
pub guard: String,
pub items: Vec<Item>,
}