package com.brilliance.isc.swift.swifteditor.tag.message;

import java.util.ArrayList;
import java.util.List;

public abstract class AbstractMessageArea implements MessageArea {

    private List<MessageArea> fields = new ArrayList<MessageArea>();
    private String name;
    private String anlyReg;
    private String desp;
    private MessageArea pattern;
    public int begNo=Integer.MAX_VALUE;
    public int endNo=Integer.MIN_VALUE;

    private boolean loaded;

    public boolean withIn(int index){
        AbstractMessageArea ama=((AbstractMessageArea)this.fields.get(0));
        return index>=ama.begNo && index<=ama.endNo;
    }

    public String getDesp() {
        return desp;
    }

    public void setDesp(String desp) {
        this.desp = desp;
    }

    public void toSwfMessage(StringBuilder sb) {
        for (MessageArea field : fields)
            field.toSwfMessage(sb);
    }

    public String getName() {
        // TODO Auto-generated method stub
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public List<MessageArea> getFields() {
        return fields;
    }

    public void addSubArea(MessageArea sub) {
        // TODO Auto-generated method stub
        fields.add(sub);
    }

    public MessageArea clone() {
        return (MessageArea) new Object();
    }

    public boolean isEnd() {
        return false;
    }

    public MessageArea getPattern() {
        return this.pattern;
    }

    public void setPattern(MessageArea pattern) {
        this.pattern = pattern;
    }

    public String getAnlyReg() {
        return anlyReg;
    }

    public void setAnlyReg(String anlyReg) {
        this.anlyReg = anlyReg;
    }

    public boolean isLoaded() {
        return loaded;
    }

    public void setLoaded(boolean loaded) {
        this.loaded = loaded;
    }

}
