Skip to content

Commit

Permalink
README: Add example outputs
Browse files Browse the repository at this point in the history
  • Loading branch information
Ryan Scott Lewis authored Mar 23, 2017
1 parent f2f9748 commit a45aa53
Showing 1 changed file with 79 additions and 0 deletions.
79 changes: 79 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,10 @@ $ ucd --help

See the examples directory for UCD files and their generated DOT and PNG files.

#### Component Pattern

`component.ucd`

```ruby
abstract class Component {
method operation
Expand All @@ -45,6 +49,81 @@ class Composite {
}
```

`component.png`

![Component Pattern](https://github.com/RyanScottLewis/ucd/raw/master/examples/composite.png)

`component.dot`

```dot
digraph G {
graph [splines="ortho" rankdir="BT"]
edge [color="gray50"]
node [shape="plain"]
ClassComponent [label=<
<TABLE BORDER="0" CELLBORDER="1" CELLSPACING="0">
<TR>
<TD>«abstract»<BR/><I><B>Component</B></I></TD>
</TR>
<TR>
<TD></TD>
</TR>
<TR>
<TD>
<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="0">
<TR><TD ALIGN="LEFT">+ operation()</TD></TR>
</TABLE>
</TD>
</TR>
</TABLE>
>]
ClassLeaf [label=<
<TABLE BORDER="0" CELLBORDER="1" CELLSPACING="0">
<TR>
<TD><B>Leaf</B></TD>
</TR>
<TR>
<TD></TD>
</TR>
<TR>
<TD></TD>
</TR>
</TABLE>
>]
ClassComposite [label=<
<TABLE BORDER="0" CELLBORDER="1" CELLSPACING="0">
<TR>
<TD><B>Composite</B></TD>
</TR>
<TR>
<TD>
<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="0">
<TR><TD ALIGN="LEFT"># children : Component</TD></TR>
</TABLE>
</TD>
</TR>
<TR>
<TD>
<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="0">
<TR><TD ALIGN="LEFT">+ addChild(child : Component) : Component</TD></TR>
<TR><TD ALIGN="LEFT">+ removeChild(child : Component) : Component</TD></TR>
<TR><TD ALIGN="LEFT">+ getChild(index : Integer) : Component</TD></TR>
</TABLE>
</TD>
</TR>
</TABLE>
>]
ClassLeaf -> ClassComponent [arrowhead="onormal"]
ClassComposite -> ClassComponent [arrowhead="onormal"]
ClassComposite -> ClassComponent [dir="back" arrowtail="odiamond" headlabel="*"]
}
```

### Syntax

> Note: Syntax is represented in [ABNF](https://tools.ietf.org/html/rfc5234) and are omitting spaces for clarity
Expand Down

0 comments on commit a45aa53

Please sign in to comment.