view src/main/java/alice/codesegment/CodeSegment.java @ 523:145c425db88d dispose

add CompressedLDSM
author Nozomi Teruya <e125769@ie.u-ryukyu.ac.jp>
date Thu, 09 Apr 2015 18:36:26 +0900
parents f28087efa911
children 97bd6efa6e69 77adeb85c4d0
line wrap: on
line source

package alice.codesegment;

import java.util.ArrayList;

import alice.codesegment.InputDataSegment;
import alice.datasegment.Receiver;

public abstract class CodeSegment implements Runnable {

    public InputDataSegment ids = new InputDataSegment(this);
    public OutputDataSegment ods = new OutputDataSegment();
    private ArrayList<Receiver> list = new ArrayList<Receiver>();
    private int priority = Thread.NORM_PRIORITY;//?

    public void execute() {
        ids.receive();
    }

    public void register(Receiver receiver) {
        list.add(receiver);
    }//Receiverを作成?

    public void recycle(){//idsのリセット
        ids.init();
        ids.setCounter(list.size());
        for (Receiver receiver : list) {
            receiver.index = 0;
            ids.recommand(receiver);
        }
    }

    public int getPriority() {
        return priority;
    }

    public void setPriority(int priority) {
        this.priority = priority;
    }
}