org.licas.parsers

## Class LinkSpecParser

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

- All Implemented Interfaces:
    org.ai_heuristic.def.ParserDef

      public class LinkSpecParser
      extends java.lang.Object
      implements org.ai_heuristic.def.ParserDef

  This class can read a `LinkSpec` script file and parse it to or from XML.
  Author:
    Kieran Greer

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `LinkSpecParser()` Create a new instance of LinkSpecParser.

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `java.lang.Object` | `parse(org.licas_xml.abs.Element toParse)` Parse the linking spec config back into a `LinkSpec` object.
    `static java.util.HashMap` | `parseOptions(org.licas_xml.abs.Element hashXml)` Parse the service script list of options as key-value pairs.
    `org.licas_xml.abs.Element` | `serialize(java.lang.Object toSerialize)` Serialize the link spec script specification into XML.
    `static org.licas_xml.abs.Element` | `serializeOptions(java.util.HashMap optionsList)` Serialize the list of options into an ML-based description.

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

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

- - ### Constructor Detail

    - #### LinkSpecParser

          public LinkSpecParser()

      Create a new instance of LinkSpecParser.

  - ### Method Detail

    - #### serialize

          public org.licas_xml.abs.Element serialize(java.lang.Object toSerialize)
                                              throws java.lang.Exception

      Serialize the link spec script specification into XML.
      Specified by:
        `serialize` in interface `org.ai_heuristic.def.ParserDef`
      Parameters:
        `toSerialize` - the `LinkSpec` object to serialize.
      Returns:
        the script in XML format.
      Throws:
        `java.lang.Exception` - any error.

    - #### parse

          public java.lang.Object parse(org.licas_xml.abs.Element toParse)
                                 throws java.lang.Exception

      Parse the linking spec config back into a `LinkSpec` object.
      Specified by:
        `parse` in interface `org.ai_heuristic.def.ParserDef`
      Parameters:
        `toParse` - the XML-based description.
      Returns:
        the parsed link spec object.
      Throws:
        `java.lang.Exception` - any error.

    - #### serializeOptions

          public static org.licas_xml.abs.Element serializeOptions(java.util.HashMap optionsList)
                                                            throws java.lang.Exception

      Serialize the list of options into an ML-based description.
      Parameters:
        `optionsList` - the list of options to serialize.
      Returns:
        the list as an XML-based description.
      Throws:
        `java.lang.Exception` - any error.

    - #### parseOptions

          public static java.util.HashMap parseOptions(org.licas_xml.abs.Element hashXml)

      Parse the service script list of options as key-value pairs.
      Parameters:
        `hashXml` - an XML-based description of the options list.
      Returns:
        the list as a HashMap. Create any objects where possible.