Class AACMappings
java.lang.Object
AACMappings
- All Implemented Interfaces:
AACPage
Creates a set of mappings of an AAC that has two levels,
one for categories and then within each category, it has
images that have associated text to be spoken. This class
provides the methods for interacting with the categories
and updating the set of images that would be shown and handling
an interactions.
- Author:
- Catie Baker and YOUR NAME HERE
-
Constructor Summary
ConstructorDescriptionAACMappings
(String filename) Creates a set of mappings for the AAC based on the provided file. -
Method Summary
Modifier and TypeMethodDescriptionvoid
Adds the mapping to the current category (or the default category if that is the current category)Returns the name of the current categoryString[]
Provides an array of all the images in the current categoryboolean
Determines if the provided image is in the set of images that can be displayed and false otherwiseboolean
isCategory
(String imageLoc) Determines if the image represents a category or text to speakvoid
reset()
Resets the current category of the AAC back to the default categoryGiven the image location selected, it determines the action to be taken.void
writeToFile
(String filename) Writes the ACC mappings stored to a file.
-
Constructor Details
-
AACMappings
Creates a set of mappings for the AAC based on the provided file. The file is read in to create categories and fill each of the categories with initial items. The file is formatted as the text location of the category followed by the text name of the category and then one line per item in the category that starts with > and then has the file name and text of that image for instance: img/food/plate.png food >img/food/icons8-french-fries-96.png french fries >img/food/icons8-watermelon-96.png watermelon img/clothing/hanger.png clothing >img/clothing/collaredshirt.png collared shirt represents the file with two categories, food and clothing and food has french fries and watermelon and clothing has a collared shirt- Parameters:
filename
- the name of the file that stores the mapping information
-
-
Method Details
-
select
Given the image location selected, it determines the action to be taken. This can be updating the information that should be displayed or returning text to be spoken. If the image provided is a category, it updates the AAC's current category to be the category associated with that image and returns the empty string. If the AAC is currently in a category and the image provided is in that category, it returns the text to be spoken.- Specified by:
select
in interfaceAACPage
- Parameters:
imageLoc
- the location where the image is stored- Returns:
- if there is text to be spoken, it returns that information, otherwise it returns the empty string
- Throws:
NoSuchElementException
- if the image provided is not in the current category
-
getImageLocs
Provides an array of all the images in the current category- Specified by:
getImageLocs
in interfaceAACPage
- Returns:
- the array of images in the current category
-
reset
public void reset()Resets the current category of the AAC back to the default category -
isCategory
Determines if the image represents a category or text to speak- Parameters:
imageLoc
- the location where the image is stored- Returns:
- true if the image represents a category, false if the image represents text to speak
-
writeToFile
Writes the ACC mappings stored to a file. The file is formatted as the text location of the category followed by the text name of the category and then one line per item in the category that starts with > and then has the file name and text of that image for instance: img/food/plate.png food >img/food/icons8-french-fries-96.png french fries >img/food/icons8-watermelon-96.png watermelon img/clothing/hanger.png clothing >img/clothing/collaredshirt.png collared shirt represents the file with two categories, food and clothing and food has french fries and watermelon and clothing has a collared shirt- Parameters:
filename
- the name of the file to write the AAC mapping to
-
addItem
Adds the mapping to the current category (or the default category if that is the current category) -
getCategory
Returns the name of the current category- Specified by:
getCategory
in interfaceAACPage
- Returns:
- the name of the current category
-
hasImage
Determines if the provided image is in the set of images that can be displayed and false otherwise
-