Class AACMappings

java.lang.Object
AACMappings
All Implemented Interfaces:
AACPage

public class AACMappings extends Object implements 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

    Constructors
    Constructor
    Description
    AACMappings(String filename)
    Creates a set of mappings for the AAC based on the provided file.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    addItem(String imageLoc, String text)
    Adds the mapping to the current category (or the default category if that is the current category)
    Returns the name of the current category
    Provides an array of all the images in the current category
    boolean
    hasImage(String imageLoc)
    Determines if the provided image is in the set of images that can be displayed and false otherwise
    boolean
    isCategory(String imageLoc)
    Determines if the image represents a category or text to speak
    void
    Resets the current category of the AAC back to the default category
    select(String imageLoc)
    Given the image location selected, it determines the action to be taken.
    void
    writeToFile(String filename)
    Writes the ACC mappings stored to a file.

    Methods inherited from class java.lang.Object

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

    • AACMappings

      public AACMappings(String filename)
      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

      public String select(String imageLoc)
      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 interface AACPage
      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

      public String[] getImageLocs()
      Provides an array of all the images in the current category
      Specified by:
      getImageLocs in interface AACPage
      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

      public boolean isCategory(String imageLoc)
      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

      public void writeToFile(String filename)
      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

      public void addItem(String imageLoc, String text)
      Adds the mapping to the current category (or the default category if that is the current category)
      Specified by:
      addItem in interface AACPage
      Parameters:
      imageLoc - the location of the image
      text - the text associated with the image
    • getCategory

      public String getCategory()
      Returns the name of the current category
      Specified by:
      getCategory in interface AACPage
      Returns:
      the name of the current category
    • hasImage

      public boolean hasImage(String imageLoc)
      Determines if the provided image is in the set of images that can be displayed and false otherwise
      Specified by:
      hasImage in interface AACPage
      Parameters:
      imageLoc - the location of the category
      Returns:
      true if it is in the set of images that can be displayed, false otherwise