https://hal.archives-ouvertes.fr/hal-02177293
Tip revision: a5c3a632ff52caf942ac0457ce1ec733926a867b authored by Software Heritage on 01 January 2004, 00:00:00 UTC
hal: Deposit 315 in collection hal
hal: Deposit 315 in collection hal
Tip revision: a5c3a63
SectionInformationEndogeneActivation.java
/*
* Créé le 24 aoűt 2004
*
*/
package traitement.section;
import principal.Commun;
import traitement.TraitementIncompletException;
import traitement.noeud.fonctionnel.NoeudFonctionnelEndogene;
import information.DomaineIncompatibleException;
import information.InformationIncompleteException;
import information.domaine.DomaineComplexe;
import information.magnitude.Magnitude;
import information.magnitude.VectorMagnitude;
import information.type.Type;
import information.type.VectorType;
import java.io.File;
import java.io.IOException;
import java.util.Vector;
import principal.copiercoller.HomonymeIntrouvableException;
import principal.copiercoller.InterfaceHomonyme;
import fichier.ContenuFichierIncompatibleException;
import fichier.TypeFichierIncompatibleException;
import fichier.VersionFichierIncompatibleException;
import fonction.FonctionListener;
import fonction.magnitude.InterfaceFonctionParentMagnitude;
import fonction.magnitude.MagnitudeBruit;
import fonction.type.InterfaceFonctionParentType;
import fonction.type.TypeConstante;
import fonction.type.TypeVide;
import traitement.modele.Modele;
/**
* constituants des NoeudEndogenes.
* Ce type de Section est utilisé pour gérer les parties d'activation ou d'émission d'un NoeudFonctionnelEndogene.
* Une SectionInformationEndogene possčde son propre Domaine, et des historiques de Magnitudes et de Types
* sous la forme d'un VectorMagnitude et d'un VectorType.
* Elle possčde également des fonction de magnitude et de type, et peut gérer un fichier d'observation.
*
* @author Vincent Labatut
* @version 1
* @see traitement.noeud.fonctionnel.NoeudFonctionnelEndogene
* @see traitement.section.SectionApprentissage
*/
public class SectionInformationEndogeneActivation extends AbstractSectionInformationEndogene implements FonctionListener, InterfaceFonctionParentMagnitude, InterfaceFonctionParentType
{
// ----------------------------------------
// Constructeurs
// ----------------------------------------
/**
* Constructeur pour créer une SectionInformationEndogene de parent le NoeudFonctionnelEndogene
* passé en paramčtre, et d'accčs la valeur passée en second paramčtre.
* L'accčs détermine si cette SectionInformationEndogene gčre l'activation ou l'émission
* de son parent.
*
* @param p parent de cette SectionInformationEndogene
*
*/
public SectionInformationEndogeneActivation(NoeudFonctionnelEndogene p)
{
parent = p;
//
vectorTraitementListener = new Vector();
// domaine
domaine = new DomaineComplexe(this);
domaine.addInformationListener(this);
// DEBUG
domaine.setDebbug("SectionInformationEndogeneActivation.SectionInformationEndogeneActivation()");
// historiques
vectorMagnitude = new VectorMagnitude();
Magnitude mag = new Magnitude(this);
mag.addInformationListener(this);
vectorMagnitude.addMagnitude(mag);
vectorType = new VectorType();
Type type = new Type(this);
type.addInformationListener(this);
vectorType.addType(type);
// fonctions bidons
fonctionMagnitude = new MagnitudeBruit(this);
fonctionMagnitude.addFonctionListener(this);
fonctionMagnitude.setParent(this);
try
{ fonctionType = new TypeConstante(domaine,this);
}
catch (DomaineIncompatibleException e)
{ e.printStackTrace();
}
fonctionType.addFonctionListener(this);
fonctionType.setParent(this);
//
File repertoire = ((NoeudFonctionnelEndogene)parent).getRepertoireObservation();
if (repertoire != null)
repertoireObservation = new File(((NoeudFonctionnelEndogene)parent).getRepertoireObservation().getPath()
+ Commun.STRING_SEPARATEUR
+ Commun.STRING_ACTIVATION);
else
repertoireObservation = null;
//
observationEditeur = new EditeurObservation(this);
observationEditeur.addTraitementListener(this);
setModifie();
}
/**
* initialise les fonctions de cette Section.
* Cette initialisation est absente du constructeur de cette Section, car il est
* possible que la fonction nécessite de faire référence au Noeud qui possčde cette
* Section. Il faut donc d'abord terminer la construction du Noeud. Ensuite seulement,
* les fonctions sont initialisées grâce ŕ cette méthode.
* Le problčme est le męme que quand on clone un Noeud ou une Section.
*
*/
public void initialiserFonction()
{ TypeVide tv;
try
{ tv = new TypeVide(domaine, this);
setFonctionType(tv);
}
catch (DomaineIncompatibleException e)
{ e.printStackTrace();
}
MagnitudeBruit mc = new MagnitudeBruit(this);
setFonctionMagnitude(mc);
}
// ----------------------------------------
// Simulation
// ----------------------------------------
/**
* prépare la Section ŕ la simulation.
*
*/
public void preparerSimulation() throws IOException, ContenuFichierIncompatibleException
{ // on prépare le répertoire de simulation
raffraichirRepertoireSimulation();
//
if (estObservable())
observationEditeur.preparerSimulation();
getTypeInitial().normaliser();
}
/*
*
*/
public void recupererResultat() throws VersionFichierIncompatibleException, TypeFichierIncompatibleException, ContenuFichierIncompatibleException, IOException, ClassNotFoundException, InformationIncompleteException, TraitementIncompletException
{ setRepertoireSimulation(new File
( getParent().getRepertoireSimulation().getPath()
+File.separator
+Commun.STRING_ACTIVATION
));
super.recupererResultat();
}
// ----------------------------------------
// Copier/Coller
// ----------------------------------------
/*
* renvoie une copie de cette SectionInformationEndogene.
* La nouvelle SectionInformationEndogene a le męme parent que cette SectionInformationEndogene,
* mais c'est temporaire : la copie est destinée ŕ
* ętre insérée dans un autre Noeud.
* Les historiques, les fonctions et le Domaine qui composent
* la copie sont des copies de celles de cette SectionInformationEndogene.
* Le fichier d'observation, s'il y en a un, est le męme.
* Le Domaine doit ętre cloné en premier.
*/
public AbstractSectionInformation cloner()
{ SectionInformationEndogeneActivation resultat;
// COPIE
resultat = new SectionInformationEndogeneActivation((NoeudFonctionnelEndogene)parent);
try
{ // Domaines
//resultat.setDomaine(domaine.cloner()); inutile de cloner puisque le domaine est recopié
resultat.setDomaine(domaine);
// Historiques
resultat.setMagnitudeInitiale(getMagnitudeInitiale().cloner());
resultat.setTypeInitial(getTypeInitial().cloner());
/*
for (int i=0;i<vectorMagnitude.size();i++)
resultat.addMagnitude(vectorMagnitude.getMagnitude(i).cloner());
for (int i=0;i<vectorType.size();i++)
resultat.addType(vectorType.getType(i).cloner());
*/
// observations
resultat.setObservationEditeur(observationEditeur.cloner());
}
catch (DomaineIncompatibleException e)
{ e.printStackTrace();
}
catch (IOException e)
{ e.printStackTrace();
}
resultat.setNonModifie();
return resultat;
}
/*
*
*/
public InterfaceHomonyme getHomonyme(Modele modele) throws HomonymeIntrouvableException
{ InterfaceHomonyme resultat = null;
if (modele==getModele())
resultat = this;
else
resultat = ((NoeudFonctionnelEndogene)parent.getHomonyme(modele)).getSectionActivation();
return resultat;
}
// ----------------------------------------
// Divers
// ----------------------------------------
/*
*
*/
public String toString()
{ StringBuffer resultat;
resultat = new StringBuffer();
resultat.append("Section d'Activation");
resultat.append("Domaine : "+domaine.getNom());
resultat.append("Type initial : "+getTypeInitial());
resultat.append("Magnitude initiale : "+getMagnitudeInitiale());
if (estObservable())
resultat.append("Fichier d'observation : "+getObservationFichier().getName());
else
resultat.append("Non-observable");
resultat.append("Fonction Type : "+fonctionType);
resultat.append("Fonction Magnitude : "+fonctionMagnitude);
return(resultat.toString());
}
/*
*
*/
public void raffraichirRepertoireObservation() throws IOException
{ File repertoire = ((NoeudFonctionnelEndogene)parent).getRepertoireObservation();
if (repertoire != null)
{ repertoireObservation = new File(repertoire.getPath()
+ Commun.STRING_SEPARATEUR
+ Commun.STRING_ACTIVATION);
}
else
repertoireObservation = null;
observationEditeur.raffraichirRepertoireObservation();
}
public void raffraichirRepertoireSimulation() throws IOException
{ File repertoire = getParent().getRepertoireSimulation();
if (repertoire != null)
setRepertoireSimulation(new File
( repertoire.getPath()
+File.separator
+Commun.STRING_ACTIVATION
));
else
setRepertoireSimulation(null);
}
/*
*
*/
public String getIdentification()
{ return parent.getIdentification()+">"+Commun.STRING_ACTIVATION;
}
}