Class GenerateNetworkGraph

java.lang.Object
com.cyara.utilities.GenerateNetworkGraph

public class GenerateNetworkGraph
extends java.lang.Object
Class built for processing the failures found in MatchedConnectionFailures, primarily to generate the Json needed for the network graphs.

This is not an official Cyara product and is not officially supported. It is used for demonstration and training purposes. For assistance, contact chris.ryan@cyara.com

Version:
1.0
Author:
Chris Ryan
  • Constructor Summary

    Constructors 
    Modifier Constructor Description
    private GenerateNetworkGraph()
    Instantiates a new GenerateNetworkGraph.
  • Method Summary

    Modifier and Type Method Description
    private static java.lang.String createSphereJson​(int testResultId, java.util.ArrayList<java.lang.String> connections, int largeReferences, int medReferences)
    Based on the number of references, generates the Json for the sphere in the network graph.
    static java.lang.String generate​(java.lang.String fileName, java.lang.String graphTypeHeader, int largeReferences, int medReferences)
    Creates the Json necessary for the network graph.
    private static int getActualReferences​(int testResultId, java.util.ArrayList<java.lang.String> connections, java.util.ArrayList<java.lang.Integer> previouslyCheckedIds)
    Recursively grabs each matching failure to grab the true number of matches for a given parent failure.
    private static int getClosestTestResultId​(java.lang.String[] resultArr, int closestTestResultIdIndex, java.lang.String graphTypeHeader)
    Takes in a Step 1 Failed call row, as a String array, and finds the closest matching ID for the audio or the transcription, depending on what we pass in.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • GenerateNetworkGraph

      private GenerateNetworkGraph()
      Instantiates a new GenerateNetworkGraph. Private to prevent instantiation.
  • Method Details

    • generate

      public static java.lang.String generate​(java.lang.String fileName, java.lang.String graphTypeHeader, int largeReferences, int medReferences)
      Creates the Json necessary for the network graph.
      Parameters:
      fileName - The source file containing the rows of failures
      graphTypeHeader - The header in the file we want to examine, such as closestAudioFile or closestTranscriptionTestResultId
      largeReferences - The references needed for a large sphere
      medReferences - The references needed for a medium sphere
      Returns:
      The Json String for the network graph
      Since:
      1.0
    • getClosestTestResultId

      private static int getClosestTestResultId​(java.lang.String[] resultArr, int closestTestResultIdIndex, java.lang.String graphTypeHeader)
      Takes in a Step 1 Failed call row, as a String array, and finds the closest matching ID for the audio or the transcription, depending on what we pass in.
      Parameters:
      resultArr - The failed call row as a String arr
      closestTestResultIdIndex - The index for which closest ID we want
      graphTypeHeader - The type of closest ID we want (audio or transcription)
      Returns:
      The closest matching testResultId
      Since:
      1.0
    • createSphereJson

      private static java.lang.String createSphereJson​(int testResultId, java.util.ArrayList<java.lang.String> connections, int largeReferences, int medReferences)
      Based on the number of references, generates the Json for the sphere in the network graph.
      Parameters:
      testResultId - The failed call's testResultId
      connections - The list of calls and their respective closestTestResultId failure
      largeReferences - The number of connections for a large-sized sphere
      medReferences - The number of connections for a medium-sized sphere
      Returns:
      The Json String for this sphere
      Since:
      1.0
    • getActualReferences

      private static int getActualReferences​(int testResultId, java.util.ArrayList<java.lang.String> connections, java.util.ArrayList<java.lang.Integer> previouslyCheckedIds)
      Recursively grabs each matching failure to grab the true number of matches for a given parent failure.
      Parameters:
      testResultId - The failed call's testResultId
      connections - The list of calls and their respective closestTestResultId failure
      previouslyCheckedIds - The number of testResultIds we've already processed, prevent looping
      Returns:
      The number of references this parent failure has
      Since:
      1.0