/*
 *  Environment element abstract class
 *
 *  2004 - 2011 Frantisek Zboril jr.
 *  Faculty of Information Technology
 *  zborilf@fit.vutbr.cz
 *  http://www.fit.vutbr.cz/~zborilf
 *
 * (C) Brno University of Technology
 * Freeware licence VUT v Brně
 * https://wis.fit.vutbr.cz/FIT/db/dir.php/dr/VZ2007/externiInformace/softwareNaWebu/Priloha2_rozh23.pdf

 */

package jTMass.core.jTMassEnvironment;

import jTMass.core.jTMassModel.TACLElement;
import jTMass.core.jTMassModel.TModelConnection;
import jTMass.core.jTMassModel.TModelElement;

public abstract class TEnvironment extends TModelElement {

    // ===== TERMINAL =====

    public void printEnvironment(){
        printGates();
    }

    @Override
    public void printModelElement(){
        printEnvironment();
    }

    // ===== STRING CONTENT READER =====

    @Override
    public String getTypeName(){
	return("Environment");
    }

    // ===== GUI =====

    @Override
    public abstract void refreshConnectionsPanel();

   // ===== ELEMENT BEHAVIOUR =====

    @Override
    public int setOutputs(){
        super.setOutputs();
        return(TModelElement._ESReady);
    };

    @Override
    public int evolveElement(){
        return(TModelElement._ESReady);
    };

    public abstract int processInputs();

    @Override
    public int readInputs(){
        super.readInputs();
        return(TModelElement._ESReady);
    };

    // ===== CONSTRUCTOR =====

    public TEnvironment(String name, int noPlatforms, boolean element){
        super(name, noPlatforms+1, noPlatforms+1, element);
	PType=TModelElement._Type_Environment;
        String environmentConName=TModelConnection.generateConnectionName(this, 1, null, -1);
	POutputGates.put(1,new TModelConnection
                (this,1,TModelElement._Type_Environment,TModelElement._Type_Simulator,environmentConName));
	setInputGateTypes(1,_Type_Simulator);

        for(int i=2;i<=(noPlatforms+1);i++){
            environmentConName=TModelConnection.generateConnectionName(this,i,null,-1);
            POutputGates.put(i,new TModelConnection
				(this,i,TModelElement._Type_Environment,TModelElement._Type_Platform,
                                environmentConName));
            setInputGateTypes(i,_Type_Platform);
        }
    }
		
}