Package nl.nuggit.words.language

Examples of nl.nuggit.words.language.Letter


    }
    // Word word = new Word(line, startPosition);
    for (Character c : wordStr.toCharArray()) {
      Square square = getSquare(col, row);
      if (square.getTile() == null) {
        Letter letter = language.getLetter(c);
        if(Character.isUpperCase(c)) {
          letter = new AppliedBlank(letter);
        }
        square.setTile(new Tile(letter));
      }
View Full Code Here


      throw new IllegalArgumentException(
          "Tile state should have length 1");
    }
    Tile tile = null;
    Character symbol = tileState.charAt(0);
    Letter letter = language.getLetter(symbol);
    if (letter != null) {
      if (Character.isLowerCase(symbol)) {
        letter = new AppliedBlank(letter);
      }
      tile = new Tile(letter);
View Full Code Here

    }
  }

  public void removeTiles(Collection<Tile> tilesToRemove) {
    for (Tile tileToRemove : tilesToRemove) {
      Letter letter = tileToRemove.getLetter();
      Character symbolToRemove;
      if (letter instanceof AppliedBlank) {
        symbolToRemove = Language.BLANK;
      } else {
        symbolToRemove = letter.getSymbol();
      }
      Iterator<Tile> it = tiles.iterator();
      while (it.hasNext()) {
        Tile tile = it.next();
        if (tile.getLetter().getSymbol() == symbolToRemove) {
View Full Code Here

  }

  public Set<Tile> remove(Collection<Tile> tilesToRemove) {
    Set<Tile> removedTiles = new HashSet<Tile>();
    for (Tile tile : tilesToRemove) {
      Letter letter = tile.getLetter();
      Character symbol = letter.getSymbol();
      if (letter instanceof AppliedBlank) {
        symbol = Language.BLANK;
      }
      Tile removedTile = remove(symbol);
      if (removedTile != null) {
View Full Code Here

          // tile mismatch on board
          fullMatch = false;
          break;
        }
      } else {
        Letter letter = language.getLetter(symbol);
        if (trayCopy.remove(symbol)) {
          // we place a matching tile
          tilesTakenFromTray++;
          word.getTiles().add(new Tile(letter));
          Booster booster = square.getBooster();
          letterValue = letter.getValue();
          if (booster != null) {
            letterValue = letterValue * booster.letterFactor();
            wordFactor = wordFactor * booster.wordFactor();
          }
        } else if (trayCopy.remove(Language.BLANK)) {
View Full Code Here

          }
        }
      } else {
        setBackground(COLOR_TILE);
        setForeground(Color.BLACK);
        Letter letter = square.getTile().getLetter();
        append(doc, String.valueOf(letter.getSymbol()), "large");
        if (letter.getValue() > 0) {
          append(doc, String.valueOf(letter.getValue()), "small");
        }
      }
    } catch (BadLocationException e) {
      throw new IllegalStateException(e);
    }
View Full Code Here

  private void updateContents() {
    try {
      StyledDocument tileDoc = getStyledDocument();
      setBackground(COLOR_TILE);
      setForeground(Color.BLACK);
      Letter letter = tile.getLetter();
      append(tileDoc, String.valueOf(letter.getSymbol()), "large");
      if (letter.getValue() > 0) {
        append(tileDoc, String.valueOf(letter.getValue()), "small");
      }
    } catch (BadLocationException e) {
      throw new IllegalStateException(e);
    }
  }
View Full Code Here

TOP

Related Classes of nl.nuggit.words.language.Letter

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.