org.licas.service.link

## Class AnalyseLinks

- java.lang.Object
- - org.licas.service.link.AnalyseLinks

-     public class AnalyseLinks
      extends java.lang.Object

  This class can perform some basic analysis over the link structures as follows:
  1. If any links exist as part of the query then `exists` returns true.
  2. If the links are ThresholdSource structures in a tree, then only the top level is returned and the frequency count is the weight value for each source link.
  3. If the links are Objects or Strings in a list or tree, then the frequency count is the number of times each link occurs, as part of the query reply.
  Author:
    Kieran Greer

- - ### Constructor Summary

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

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `analyseLinks(java.util.ArrayList<?> links, LinkQueryConfig queryConfig)` Add analysis about the current set of link reference values.
    `void` | `analyseLinks(org.ai_heuristic.tree.TreeNode treeNode, LinkQueryConfig queryConfig)` Add analysis about the current set of tree nodes.
    `boolean` | `exists()` Return true if a link exists anywhere in the analysis.
    `java.util.ArrayList<java.lang.String>` | `getBestLinks()` Get the best reference link(s) over the analysis query.
    `java.util.HashMap<java.lang.String,java.lang.Float>` | `getValueCounts()` Get the unprocessed list of reference objects, with a count of occurrences for each one.
    `void` | `resetValues()` Reset for the start of an analysis.
    `java.lang.String` | `toString()` Convert the values into a string-based description.

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

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

- - ### Constructor Detail

    - #### AnalyseLinks

          public AnalyseLinks()
                       throws java.lang.Exception

      Create a new instance of AnalyseLinks.
      Throws:
        `java.lang.Exception` - any error.

  - ### Method Detail

    - #### resetValues

          public void resetValues()
                           throws java.lang.Exception

      Reset for the start of an analysis.
      Throws:
        `java.lang.Exception` - any error.

    - #### analyseLinks

          public void analyseLinks(org.ai_heuristic.tree.TreeNode treeNode,
                                   LinkQueryConfig queryConfig)
                            throws java.lang.Exception

      Add analysis about the current set of tree nodes. The analysis is for all of the calls to this method, without resetting the object. You can also call `finaliseAnalysis` after these calls, to perform some stats over the analysis objects.
      Parameters:
        `treeNode` - the tree node to add the analysis for.
        `queryConfig` - the query configuration.
      Throws:
        `java.lang.Exception` - any error.

    - #### analyseLinks

          public void analyseLinks(java.util.ArrayList<?> links,
                                   LinkQueryConfig queryConfig)
                            throws java.lang.Exception

      Add analysis about the current set of link reference values. The analysis is for all of the calls to this method, without resetting the object. You can also call `finaliseAnalysis` after these calls, to perform some stats over the analysis objects.
      Parameters:
        `links` - list of link reference values, probably of type String.
        `queryConfig` - the query configuration.
      Throws:
        `java.lang.Exception` - any error.

    - #### exists

          public boolean exists()

      Return true if a link exists anywhere in the analysis.
      Returns:
        the value of exists.

    - #### getBestLinks

          public java.util.ArrayList<java.lang.String> getBestLinks()

      Get the best reference link(s) over the analysis query.
      Returns:
        the value of `bestLinks` reference sources.

    - #### getValueCounts

          public java.util.HashMap<java.lang.String,java.lang.Float> getValueCounts()

      Get the unprocessed list of reference objects, with a count of occurrences for each one.
      Returns:
        the value of valueCounts.

    - #### toString

          public java.lang.String toString()

      Convert the values into a string-based description.
      Overrides:
        `toString` in class `java.lang.Object`
      Returns:
        a String-based description of this object.