org.licas.parsers

## Class LinksParser

- java.lang.Object
- - org.licas.parsers.LinksParser

-     public class LinksParser
      extends java.lang.Object

  This class serialises and parses the different linking lists to or from XML.
  Author:
    Kieran Greer

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `LinksParser()` Creates a new instance of LinksParser

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `java.lang.String` | `dynamicLinksToString(LinkSpec linkSpec, org.ai_heuristic.tree.Tree linkStructure, boolean allLevels, java.lang.String indent)` Return all linked sources as a list of XML elements.
    `org.licas_xml.abs.Element` | `dynamicLinksToXml(java.lang.String uuid, LinkSpec linkSpec, org.ai_heuristic.tree.Tree linkStructure, boolean allLevels, boolean configValues)` Return all linked sources as a list of XML elements.
    `org.licas_xml.abs.Element` | `linkSourcesToXml(java.lang.String uuid, java.util.ArrayList sources)` Return all linked sources as a list of XML elements.
    `void` | `nextXmlToDynamicLinks(LinkSpec linkSpec, org.ai_heuristic.tree.TreeNode linkStructure, org.licas_xml.abs.Element linksElem)` Parse the xml description and fill the link spec and structure with the dynamic links.
    `void` | `xmlToDynamicLinks(LinkSpec linkSpec, org.ai_heuristic.tree.Tree linkStructure, org.licas_xml.abs.Element linksElem)` Parse the xml description and fill the link spec and structure with the dynamic links.
    `LinkSpec` | `xmlToThresholdsConfig(org.licas_xml.abs.Element thresholdsXml)` Get the initial threshold config for this component.

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

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

- - ### Constructor Detail

    - #### LinksParser

          public LinksParser()

      Creates a new instance of LinksParser

  - ### Method Detail

    - #### xmlToThresholdsConfig

          public LinkSpec xmlToThresholdsConfig(org.licas_xml.abs.Element thresholdsXml)
                                         throws java.lang.Exception

      Get the initial threshold config for this component. This is the method to call to initialise the threshold values. All other linking structures that are created in this service are then initialised with the same values that are set here.
      Parameters:
        `thresholdsXml` - the root config element.
      Returns:
        the parsed thresholds config spec.
      Throws:
        `java.lang.Exception` - any error.

    - #### dynamicLinksToString

          public java.lang.String dynamicLinksToString(LinkSpec linkSpec,
                                                       org.ai_heuristic.tree.Tree linkStructure,
                                                       boolean allLevels,
                                                       java.lang.String indent)
                                                throws java.lang.Exception

      Return all linked sources as a list of XML elements.
      Parameters:
        `linkSpec` - stores the original config values.
        `linkStructure` - the linking structure itself.
        `allLevels` - if true, return all 3 levels, if false only return the top link level references.
        `indent` - for formatting purposes, can be null.
      Returns:
        an XML representation of all linked sources.
      Throws:
        `java.lang.Exception` - any error.

    - #### dynamicLinksToXml

          public org.licas_xml.abs.Element dynamicLinksToXml(java.lang.String uuid,
                                                             LinkSpec linkSpec,
                                                             org.ai_heuristic.tree.Tree linkStructure,
                                                             boolean allLevels,
                                                             boolean configValues)
                                                      throws java.lang.Exception

      Return all linked sources as a list of XML elements.
      Parameters:
        `uuid` - a parent service uuid, for info purposes only.
        `linkSpec` - stores the original config values.
        `linkStructure` - the linking structure itself.
        `allLevels` - if true, return all 3 levels, if false only return the top link level references.
        `configValues` - if false, return just the path and source info. If true, include other values, such as config, as well.
      Returns:
        an XML representation of all linked sources.
      Throws:
        `java.lang.Exception` - any error.

    - #### linkSourcesToXml

          public org.licas_xml.abs.Element linkSourcesToXml(java.lang.String uuid,
                                                            java.util.ArrayList sources)
                                                     throws java.lang.Exception

      Return all linked sources as a list of XML elements.
      Parameters:
        `uuid` - a parent service uuid, for info purposes only.
        `sources` - list of selected link sources.
      Returns:
        an XML representation of all linked sources.
      Throws:
        `java.lang.Exception` - any error.

    - #### xmlToDynamicLinks

          public void xmlToDynamicLinks(LinkSpec linkSpec,
                                        org.ai_heuristic.tree.Tree linkStructure,
                                        org.licas_xml.abs.Element linksElem)
                                 throws java.lang.Exception

      Parse the xml description and fill the link spec and structure with the dynamic links.
      Parameters:
        `linkSpec` - an empty specification to fill.
        `linkStructure` - the tree structure to store the links.
        `linksElem` - the dynamic links description.
      Throws:
        `java.lang.Exception` - any error.

    - #### nextXmlToDynamicLinks

          public void nextXmlToDynamicLinks(LinkSpec linkSpec,
                                            org.ai_heuristic.tree.TreeNode linkStructure,
                                            org.licas_xml.abs.Element linksElem)
                                     throws java.lang.Exception

      Parse the xml description and fill the link spec and structure with the dynamic links.
      Parameters:
        `linkSpec` - the linking spec.
        `linkStructure` - the tree structure to store the links.
        `linksElem` - the dynamic links description.
      Throws:
        `java.lang.Exception` - any error.