/**
 * 全体で共通に使うメソッドを集めたクラス
 */

public class Util {

  /*****************/
  /* PUBLIC METHOD */
  /*****************/
  /**
   * 診断機能
   * <p>pが偽の場合、sをエラー出力に表示して異常終了する。
   * @param p		条件式
   * @param s		条件式文字列
   * @param lineno	発生行(中間表現ファイル)
   */
  public static void assert(boolean p, String s, int lineno) {
    if ( !p ) {
      System.err.println("Assertion failed: "+s+", line "+lineno);
      System.exit(2);
    }
  }

  /**
   * 異常終了
   * <p>sをエラー出力に表示して異常終了する。
   * @param s		表示メッセージ
   */
  public static void abort(String s) {
    System.err.println("Abort: "+s);
    System.exit(2);
  }
}

