Class FormatNodeVerification

java.lang.Object
com.github.tadukoo.parsing.fileformat.FormatNodeVerification

public class FormatNodeVerification extends Object
This class contains methods for verifying a file's format using FormatNodes.
Since:
Alpha v.0.1
Version:
Alpha v.0.3
Author:
Logan Ferree (Tadukoo)
  • Constructor Summary

    Constructors
    Modifier
    Constructor
    Description
    private
    Not allowed to instantiate Format Node Verification
  • Method Summary

    Modifier and Type
    Method
    Description
    static boolean
    assertChild(com.github.tadukoo.util.logger.EasyLogger logger, Node node, Node child)
    Checks that the given child matches the child on the given Node.
    static boolean
    assertNextSibling(com.github.tadukoo.util.logger.EasyLogger logger, Node node, Node nextSibling)
    Checks that the given next sibling matches the next sibling on the given Node.
    static boolean
    assertNullChild(com.github.tadukoo.util.logger.EasyLogger logger, Node node)
    Checks that the child on the given Node is null.
    static boolean
    assertNullNextSibling(com.github.tadukoo.util.logger.EasyLogger logger, Node node)
    Checks that the next sibling on the given Node is null.
    static boolean
    assertNullParent(com.github.tadukoo.util.logger.EasyLogger logger, Node node)
    Checks that the parent on the given Node is null.
    static boolean
    assertNullPrevSibling(com.github.tadukoo.util.logger.EasyLogger logger, Node node)
    Checks that the previous sibling on the given Node is null.
    static boolean
    assertParent(com.github.tadukoo.util.logger.EasyLogger logger, Node node, Node parent)
    Checks that the given parent matches the parent on the given Node.
    static boolean
    assertPrevSibling(com.github.tadukoo.util.logger.EasyLogger logger, Node node, Node prevSibling)
    Checks that the given previous sibling matches the previous sibling on the given Node.
    private static boolean
    verifyFormat(String filepath, String regex, String actual)
    Checks if the formatting of the given String matches the given formatting.
    static boolean
    Verifies if the format of the Node given in the parameters is of the correct format.

    Methods inherited from class java.lang.Object

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

    • FormatNodeVerification

      private FormatNodeVerification()
      Not allowed to instantiate Format Node Verification
  • Method Details

    • verifySingleNode

      public static boolean verifySingleNode(NodeVerificationCriteria criteria)
      Verifies if the format of the Node given in the parameters is of the correct format.
      Parameters:
      criteria - The parameters object that holds all the needed arguments
      Returns:
      If the Node had the correct format or not
    • verifyFormat

      private static boolean verifyFormat(String filepath, String regex, String actual)
      Checks if the formatting of the given String matches the given formatting. The filepath is passed in to be replaced in the regex if any TFormatting is present specific to filepath variables.
      Parameters:
      filepath - The path to the file
      regex - The formatting to match against
      actual - The String to be tested for formatting conformity
      Returns:
      If the String matches the formatting or not
    • assertParent

      public static boolean assertParent(com.github.tadukoo.util.logger.EasyLogger logger, Node node, Node parent)
      Checks that the given parent matches the parent on the given Node.
      Parameters:
      logger - The EasyLogger to use to log any issues
      node - The Node to check the parent of
      parent - The expected parent
      Returns:
      Whether the parent matches the expected or not
    • assertNullParent

      public static boolean assertNullParent(com.github.tadukoo.util.logger.EasyLogger logger, Node node)
      Checks that the parent on the given Node is null.
      Parameters:
      logger - The EasyLogger to use to log any issues
      node - The Node to check the parent of
      Returns:
      Whether the parent is null or not
    • assertChild

      public static boolean assertChild(com.github.tadukoo.util.logger.EasyLogger logger, Node node, Node child)
      Checks that the given child matches the child on the given Node.
      Parameters:
      logger - The EasyLogger to use to log any issues
      node - The Node to check the child of
      child - The expected child
      Returns:
      Whether the child matches the expected or not
    • assertNullChild

      public static boolean assertNullChild(com.github.tadukoo.util.logger.EasyLogger logger, Node node)
      Checks that the child on the given Node is null.
      Parameters:
      logger - The EasyLogger to use to log any issues
      node - The Node to check the child of
      Returns:
      Whether the child is null or not
    • assertPrevSibling

      public static boolean assertPrevSibling(com.github.tadukoo.util.logger.EasyLogger logger, Node node, Node prevSibling)
      Checks that the given previous sibling matches the previous sibling on the given Node.
      Parameters:
      logger - The EasyLogger to use to log any issues
      node - The Node to check the previous sibling of
      prevSibling - The expected previous sibling
      Returns:
      Whether the previous sibling matches the expected or not
    • assertNullPrevSibling

      public static boolean assertNullPrevSibling(com.github.tadukoo.util.logger.EasyLogger logger, Node node)
      Checks that the previous sibling on the given Node is null.
      Parameters:
      logger - The EasyLogger to use to log any issues
      node - The Node to check the previous sibling of
      Returns:
      Whether the previous sibling is null or not
    • assertNextSibling

      public static boolean assertNextSibling(com.github.tadukoo.util.logger.EasyLogger logger, Node node, Node nextSibling)
      Checks that the given next sibling matches the next sibling on the given Node.
      Parameters:
      logger - The EasyLogger to use to log any issues
      node - The Node to check the next sibling of
      nextSibling - The expected next sibling
      Returns:
      Whether the next sibling matches the expected or not
    • assertNullNextSibling

      public static boolean assertNullNextSibling(com.github.tadukoo.util.logger.EasyLogger logger, Node node)
      Checks that the next sibling on the given Node is null.
      Parameters:
      logger - The EasyLogger to use to log any issues
      node - The Node to check the next sibling of
      Returns:
      Whether the next sibling is null or not