RandAttr.java

jmud-0.11/src/RandAttr.java · 1.5 KB

From the archive jmud-0_11.tgz

Download the archive   « Back to the archive contents

import util.log.Log;
import util.nice.Niceable;
import util.nice.NiceKey;
import string.StrUtil;

class RandAttr implements Niceable {

    static final int T_ALL  = 0;
    static final int T_ATTR = 1;
    static final int T_ROW  = 2;
    static final int T_COL  = 3;

    static final String targetNames[] = {
	"todos",
	"atributo",
        "linha",
	"coluna"
    };

    static final int M_CHANGE = 0;
    static final int M_ADD    = 1;
    static final int M_SUB    = 2;

    static final String modeNames[] = {
	"mudar",
	"somar",
	"subtrair"
    };

    private int target;
    private int which;
    private int value;
    private int mode;

    RandAttr(int t, int w, int v, int m) {
	target = t;
	which  = w;
	value  = v;
	mode   = m;
    }

    int getTarget() {
	return target;
    }

    int getWhich() {
	return which;
    }

    int getValue() {
	return value;
    }

    int getMode() {
	return mode;
    }

    ////////////
    // Niceable:

    public boolean lessThan(Niceable n) {
	Log.err("RandAttr.lessThan(...) não pode ser usado!");
	return false;
    }

    public boolean hasKey(NiceKey n) {
	Log.err("RandAttr.hasKey(...) não pode ser usado!");
	return false;
    }

    public boolean keyLessThan(NiceKey n) {
	Log.err("RandAttr.keyLessThan(...) não pode ser usado!");
	return false;
    }
    
    //
    ////////////

    String getSheet() {
	return StrUtil.rightPad(targetNames[target], 8) + " " +
	    StrUtil.formatNumber(which, 3) + " " +
	    StrUtil.rightPad(modeNames[mode], 8) + " " +
	    StrUtil.formatNumber(value, 3);
    }
}

Site Stats

Snippets: 1791
Codebases: 571