Module edu.ntnu.idatt2001.paths
Class StoryFileValidation
java.lang.Object
edu.ntnu.idatt2001.paths.validation.StoryFileValidation
Class for story file validation.
- Version:
- 0.1 23.04.2023
- Author:
- Callum G.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic boolean
containsActions
(String link) Method to check if a link contains actions.static boolean
isValidAction
(String actionString) Method to check if an action is in a valid format.static <T extends File>
booleanisValidFileType
(T file) Method to check if the file extension is valid for the story file.static boolean
isValidLink
(String line) Method to check if a line has a valid link.static boolean
isValidPassageStart
(String line) Method to check if a line is a valid passage start.
-
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 nullBadFileNameException
- if the file name does not contain an extension
-
isValidPassageStart
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
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
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
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
-