/**
   * Create a jump table for a SELECT node.
   *
   * @param node the SELECT node.
   * @return the jump table.
   */
  private HashMap<Object, ICodeNode> createJumpTable(ICodeNode node) {
    HashMap<Object, ICodeNode> jumpTable = new HashMap<Object, ICodeNode>();

    // Loop over children that are SELECT_BRANCH nodes.
    ArrayList<ICodeNode> selectChildren = node.getChildren();
    for (int i = 1; i < selectChildren.size(); ++i) {
      ICodeNode branchNode = selectChildren.get(i);
      ICodeNode constantsNode = branchNode.getChildren().get(0);
      ICodeNode statementNode = branchNode.getChildren().get(1);

      // Loop over the constants children of the branch's CONSTANTS_NODE.
      ArrayList<ICodeNode> constantsList = constantsNode.getChildren();
      for (ICodeNode constantNode : constantsList) {

        // Create a jump table entry.
        // Convert a single-character string constant to a character.
        Object value = constantNode.getAttribute(VALUE);
        if (constantNode.getType() == STRING_CONSTANT) {
          value = ((String) value).charAt(0);
        }
        jumpTable.put(value, statementNode);
      }
    }

    return jumpTable;
  }