* パース処理の進行ステージ種別を表す。
* ループ構造の識別に用いられる。
*/
-public class ParseStage {
+public abstract class ParseStage {
private final String name;
/**
* コンストラクタ。
- * 進行ステージ名は空文字列が指定される。
+ * 進行ステージ名は実行時クラス名(パッケージ名抜き)が指定される。
*/
- public ParseStage(){
- this("");
+ protected ParseStage(){
+ super();
+
+ Class<?> klass = getClass();
+ String fullName = klass.getName();
+ int idx = fullName.lastIndexOf('.');
+
+ String stripName;
+ if(idx >= 0){
+ stripName = fullName.substring(idx + 1);
+ }else{
+ stripName = fullName;
+ }
+
+ this.name = stripName;
+
return;
}
/**
* コンストラクタ。
* @param name 進行ステージ名
+ * @throws NullPointerException 引数がnull
*/
- public ParseStage(String name){
+ protected ParseStage(String name) throws NullPointerException{
super();
+ if(name == null) throw new NullPointerException();
this.name = name;
return;
}