/*
 * Copyright 2007-2013 the original author or authors.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package com.fluxchess.jcpi.models;

public enum GenericChessman {

  PAWN('P'),
  KNIGHT('N'),
  BISHOP('B'),
  ROOK('R'),
  QUEEN('Q'),
  KING('K');

  private static final GenericChessman[] promotions = new GenericChessman[]{QUEEN, ROOK, BISHOP, KNIGHT};

  private final char token;

  private GenericChessman(char token) {
    this.token = token;
  }

  public static GenericChessman valueOf(char token) {
    for (GenericChessman chessman : values()) {
      if (Character.toLowerCase(token) == Character.toLowerCase(chessman.token)) {
        return chessman;
      }
    }

    return null;
  }

  public static GenericChessman valueOfPromotion(char token) {
    for (GenericChessman chessman : promotions) {
      if (Character.toLowerCase(token) == Character.toLowerCase(chessman.token)) {
        return chessman;
      }
    }

    return null;
  }

  public boolean isValidPromotion() {
    for (GenericChessman chessman : promotions) {
      if (this == chessman) {
        return true;
      }
    }

    return false;
  }

  public char toCharAlgebraic() {
    if (this == PAWN) {
      throw new UnsupportedOperationException();
    }

    return this.token;
  }

  public char toChar(GenericColor color) {
    if (color == null) throw new IllegalArgumentException();

    return color.transform(this.token);
  }

}

@@ -767,22 +767,21 @@
 ');%0A%0A  p
-rivate
+ublic
  static 
@@ -843,35 +843,35 @@
 n%5B%5D%7B
-QUEEN, ROOK, BISHOP, KNIGHT
+KNIGHT, BISHOP, ROOK, QUEEN
 %7D;%0A%0A

Make promotions public