org.thewonderlemming.c4plantuml.graphml.model

## Class GraphModel

- java.lang.Object
- - org.thewonderlemming.c4plantuml.graphml.model.GraphModel

-     public class GraphModel
      extends Object

  The <graph> part of the representation of a GraphML stream.

  It is based on JAXB.

  Author:
    thewonderlemming

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static String` | `TAG_NAME` The current model XML tag name.

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `addOrReplaceData(DataModel data)` Adds the given `DataModel` to the list if its `DataModel.getKey()` is not already there or replaces it else.
    `void` | `addOrReplaceEdge(EdgeModel edge)` Adds the given `EdgeModel` to the list if its `EdgeModel.getId()` is not already there or replaces it else.
    `void` | `addOrReplaceNode(NodeModel node)` Adds the given `NodeModel` to the list if its `NodeModel.getId()` is not already there or replaces it else.
    `static WithId<String,WithDirection<WithData<WithNodes<WithEdges<Build<GraphModel>>>>>>` | `builder()` A builder to the current `GraphModel` class.
    `List<DataModel>` | `getData()` Returns the current graph's properties list.
    `String` | `getEdgeDefault()` Returns the graph's <edgedefault> property.
    `List<EdgeModel>` | `getEdges()` Returns the graph's edges as a list.
    `String` | `getId()` Returns the graph ID.
    `List<NodeModel>` | `getNodes()` Returns the graph(s nodes as a list.
    `boolean` | `isChildOfNode(NodeModel node)` Tells whether or not the current graph is a child of a node (or if it stands alone).
    `boolean` | `isEmpty()` Tells whether or not the current graph is empty.
    `boolean` | `isNotEmpty()` Tells whether or not the current graph is not empty.
    `void` | `setAspect(String aspect)` Sets the graph's aspect.
    `void` | `setId(String id)` Sets the graph's ID.
    `void` | `setTitle(String title)` Sets a <data> tag of type `C4Keys.TITLE` and with the given value.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### TAG_NAME

          public static final String TAG_NAME

      The current model XML tag name.
      See Also:
        Constant Field Values

  - ### Method Detail

    - #### builder

          public static WithId<String,WithDirection<WithData<WithNodes<WithEdges<Build<GraphModel>>>>>> builder()

      A builder to the current `GraphModel` class.
      Returns:
        a new `GraphModel` instance.

    - #### addOrReplaceData

          public void addOrReplaceData(DataModel data)

      Adds the given `DataModel` to the list if its `DataModel.getKey()` is not already there or replaces it else.
      Parameters:
        `data` - the given `DataModel` to add/replace.

    - #### addOrReplaceEdge

          public void addOrReplaceEdge(EdgeModel edge)

      Adds the given `EdgeModel` to the list if its `EdgeModel.getId()` is not already there or replaces it else.
      Parameters:
        `edge` - the given `EdgeModel` to add/replace.

    - #### addOrReplaceNode

          public void addOrReplaceNode(NodeModel node)

      Adds the given `NodeModel` to the list if its `NodeModel.getId()` is not already there or replaces it else.
      Parameters:
        `node` - the given `NodeModel` to add/replace.

    - #### getData

          public List<DataModel> getData()

      Returns the current graph's properties list.
      Returns:
        the `DataModel` list.

    - #### getEdgeDefault

          public String getEdgeDefault()

      Returns the graph's <edgedefault> property.
      Returns:
        the <edgedefault> property.

    - #### getEdges

          public List<EdgeModel> getEdges()

      Returns the graph's edges as a list.
      Returns:
        the graph `EdgeModel` list.

    - #### getId

          public String getId()

      Returns the graph ID.
      Returns:
        the graph ID.

    - #### getNodes

          public List<NodeModel> getNodes()

      Returns the graph(s nodes as a list.
      Returns:
        the graph `NodeModel` list.

    - #### isChildOfNode

          public boolean isChildOfNode(NodeModel node)

      Tells whether or not the current graph is a child of a node (or if it stands alone).
      Parameters:
        `node` - the `NodeModel` that is supposed to be the the parent node.
      Returns:
        `true` if the graph is a child of the given `node`, `false` else.

    - #### isEmpty

          public boolean isEmpty()

      Tells whether or not the current graph is empty.
      Returns:
        `true` if the graph is empty, `false` else.

    - #### isNotEmpty

          public boolean isNotEmpty()

      Tells whether or not the current graph is not empty.
      Returns:
        `true` if the graph is not empty, `false` else.

    - #### setAspect

          public void setAspect(String aspect)

      Sets the graph's aspect.
      Parameters:
        `aspect` - the graph `aspect`.

    - #### setId

          public void setId(String id)

      Sets the graph's ID.
      Parameters:
        `id` - the graph `id`

    - #### setTitle

          public void setTitle(String title)

      Sets a <data> tag of type `C4Keys.TITLE` and with the given value.
      Parameters:
        `title` - the data value to set.

Copyright © 2020. All rights reserved.