Class FormatNodeVerification
java.lang.Object
com.github.tadukoo.parsing.fileformat.FormatNodeVerification
This class contains methods for verifying a file's format using
FormatNode
s.- Since:
- Alpha v.0.1
- Version:
- Alpha v.0.3
- Author:
- Logan Ferree (Tadukoo)
-
Constructor Summary
ModifierConstructorDescriptionprivate
Not allowed to instantiate Format Node Verification -
Method Summary
Modifier and TypeMethodDescriptionstatic 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
verifySingleNode
(NodeVerificationCriteria criteria) Verifies if the format of the Node given in the parameters is of the correct format.
-
Constructor Details
-
FormatNodeVerification
private FormatNodeVerification()Not allowed to instantiate Format Node Verification
-
-
Method Details
-
verifySingleNode
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
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 fileregex
- The formatting to match againstactual
- 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
- TheEasyLogger
to use to log any issuesnode
- The Node to check the parent ofparent
- The expected parent- Returns:
- Whether the parent matches the expected or not
-
assertNullParent
Checks that the parent on the given Node is null.- Parameters:
logger
- TheEasyLogger
to use to log any issuesnode
- 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
- TheEasyLogger
to use to log any issuesnode
- The Node to check the child ofchild
- The expected child- Returns:
- Whether the child matches the expected or not
-
assertNullChild
Checks that the child on the given Node is null.- Parameters:
logger
- TheEasyLogger
to use to log any issuesnode
- 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
- TheEasyLogger
to use to log any issuesnode
- The Node to check the previous sibling ofprevSibling
- 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
- TheEasyLogger
to use to log any issuesnode
- 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
- TheEasyLogger
to use to log any issuesnode
- The Node to check the next sibling ofnextSibling
- 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
- TheEasyLogger
to use to log any issuesnode
- The Node to check the next sibling of- Returns:
- Whether the next sibling is null or not
-