Class StoryFileValidation

java.lang.Object
edu.ntnu.idatt2001.paths.validation.StoryFileValidation

public class StoryFileValidation extends Object
Class for story file validation.
Version:
0.1 23.04.2023
Author:
Callum G.
  • Constructor Details

    • StoryFileValidation

      public StoryFileValidation()
  • Method Details

    • isValidFileType

      public static <T extends File> boolean isValidFileType(T file) throws NullPointerException, BadFileNameException
      Method to check if the file extension is valid for the story file.
      Type Parameters:
      T - the file class that extends the File class
      Parameters:
      file - T - the file to check
      Returns:
      boolean - true if the extension is valid, false if not
      Throws:
      NullPointerException - if the file name is null
      BadFileNameException - if the file name does not contain an extension
    • isValidPassageStart

      public static boolean isValidPassageStart(String line) throws NullPointerException
      Method to check if a line is a valid passage start.
      Parameters:
      line - String - the line to check
      Returns:
      boolean - true if the file line is valid, false if not
      Throws:
      NullPointerException - if the line is null
    • isValidLink

      public static boolean isValidLink(String line) throws NullPointerException
      Method to check if a line has a valid link.
      Parameters:
      line - String - the line to check
      Returns:
      boolean - true if the file line is valid, false if not
      Throws:
      NullPointerException - if the line is null
    • isValidAction

      public static boolean isValidAction(String actionString) throws NullPointerException
      Method to check if an action is in a valid format.
      Parameters:
      actionString - String - the action to check
      Returns:
      boolean - true if the file action is valid, false if not
      Throws:
      NullPointerException - if the action is null
    • containsActions

      public static boolean containsActions(String link) throws NullPointerException
      Method to check if a link contains actions.
      Parameters:
      link - String - the link to check
      Returns:
      boolean - true if the link contains actions, false if not
      Throws:
      NullPointerException - if the link is null