org.eclipse.actf.visualization.engines.blind

## Class TextChecker

- java.lang.Object
- - org.eclipse.actf.visualization.engines.blind.TextChecker

    public class TextChecker
    extends Object

Utility class to check alternative text

### Method Summary

Methods
`TextCheckResult` `checkAlt(String alt)`
`TextCheckResult` `checkAlt(String alt, Set<String> ngWords)`
`TextCheckResult` `checkAlt(String alt, String src)`
`TextCheckResult` `checkAlt(String alt, String src, Set<String> ngWords)` Check alt attribute string and returns result in one of the constants defined above.
`int` `checkInappropriateAlt(String alt)` Check possibly inappropriate alternative text.
`Set<String>` `getInappropriateALTSet()` Get inappropriate alternative text `Set`
`static TextChecker` `getInstance()` Get instance of `TextChecker`
`boolean` `isAsciiArtString(String str)`
`boolean` `isInappropriateAlt(String alt)` Check appropriateness of alternative text.
`boolean` `isRedundantText(String prevText, String curText)` Check redundancy of text
`boolean` `isSeparatedJapaneseChars(String target)` Check if the target String is space separated Japanese chars or not
`void` `setInappropriateAltSet(Set<String> inappAltSet)` Set inappropriate alternative text `Set`.

### Methods inherited from class java.lang.Object

`equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Method Detail

#### getInstance

    public static TextChecker getInstance()

Get instance of `TextChecker`

Returns:
  instance of `TextChecker`

#### isRedundantText

    public boolean isRedundantText(String prevText,
                          String curText)

Check redundancy of text

Parameters:
  `prevText` - previous text
  `curText` - target text to check
Returns:
  true if the target text is redundant with previous text

#### isInappropriateAlt

    public boolean isInappropriateAlt(String alt)

Check appropriateness of alternative text.

Parameters:
  `alt` - target alternative text
Returns:
  true if the alternative text matches with inappropriate alternative text `Set`

#### checkInappropriateAlt

    public int checkInappropriateAlt(String alt)

Check possibly inappropriate alternative text.

Parameters:
  `alt` - target alternative text
Returns:
  - 0: OK
  - 1: possibly inappropriate
  - 2: inappropriate
  - 3: space separated chars

#### isSeparatedJapaneseChars

    public boolean isSeparatedJapaneseChars(String target)

Check if the target String is space separated Japanese chars or not

Parameters:
  `target` - target String
Returns:
  true if the target String is space separated Japanese chars

#### getInappropriateALTSet

    public Set<String> getInappropriateALTSet()

Get inappropriate alternative text `Set`

Returns:
  `Set` of inappropriate alternative text

#### setInappropriateAltSet

    public void setInappropriateAltSet(Set<String> inappAltSet)

Set inappropriate alternative text `Set`. The new `Set` will be stored into `PreferenceStore`.

Parameters:
  `inappAltSet` - `Set` of inappropriate alternative text

#### checkAlt

    public TextCheckResult checkAlt(String alt)

#### checkAlt

    public TextCheckResult checkAlt(String alt,
                           String src)

#### checkAlt

    public TextCheckResult checkAlt(String alt,
                           Set<String> ngWords)

#### checkAlt

    public TextCheckResult checkAlt(String alt,
                           String src,
                           Set<String> ngWords)

Check alt attribute string and returns result in one of the constants defined above.

Parameters:
  `alt` - The value of the alt attributes of images, buttons, area elements, etc. It MUST NOT be null.
  `src` - The value of the src attribute. Set null if it does not exist.
  `ngWords` - additional NG words set; when we check ALT text of area element, we want to add "area" as additional NG word.
Returns:
  Check result as TextCheckerResult instance.

#### isAsciiArtString

    public boolean isAsciiArtString(String str)