Skip to content
Snippets Groups Projects
Commit ad2410a1 authored by l21lecoe's avatar l21lecoe
Browse files

création classes Emetteur, EmetteurNRZ et EmetteurRZ

parent d7cb3c78
No related branches found
No related tags found
No related merge requests found
......@@ -4,3 +4,4 @@
/sources/
/transmetteurs/
/visualisations/
/emetteurs/
package transmetteurs;
import information.Information;
import information.InformationNonConformeException;
public abstract class Emetteur<Boolean, Float> extends Transmetteur<Boolean, Float>{
@Override
public void recevoir(Information<Boolean> information) throws InformationNonConformeException {
this.informationRecue = information;
}
@Override
public void emettre() throws InformationNonConformeException {
}
public abstract void conversion();
}
package transmetteurs;
import information.Information;
import information.InformationNonConformeException;
public class EmetteurNRZ<Boolean, Float> extends Emetteur<Boolean, Float>{
Information<java.lang.Float> signalEchantillonee;
private float vmax;
private float vmin;
private int nbTechantillon;
public EmetteurNRZ(float vmax, float vmin, int nbTechantillon)
{
this.vmax = vmax;
this.vmin = vmin;
this.nbTechantillon = nbTechantillon;
}
public void recevoir(Information<Boolean> information) throws InformationNonConformeException{
super.recevoir(information);
this.conversion();
this.emettre();
}
@Override
public void conversion() {
this.signalEchantillonee = new Information<java.lang.Float>();
for(Boolean bit : informationRecue)
{
for(int i=0; i<nbTechantillon; i++)
{
if(bit.equals(true)) signalEchantillonee.add(vmax);
else signalEchantillonee.add(vmin);
}
informationEmise = (Information<Float>) this.signalEchantillonee;
}
}
}
\ No newline at end of file
package transmetteurs;
import information.Information;
import information.InformationNonConformeException;
public class EmetteurRZ<Boolean, Float> extends Emetteur<Boolean, Float>{
Information<java.lang.Float> signalEchantillonee;
private float v;
private int nbTechantillon;
public EmetteurRZ(float v, int nbTechantillon)
{
this.v = v;
this.nbTechantillon = nbTechantillon;
}
public void recevoir(Information<Boolean> information) throws InformationNonConformeException {
super.recevoir(information);
this.conversion();
this.emettre();
}
@Override
public void conversion() {
this.signalEchantillonee = new Information<>();
for(Boolean bit : informationRecue)
{
if(bit.equals(true))
{
for(int i=0; i<nbTechantillon/3; i++) this.signalEchantillonee.add(0f);
for(int i=0; i<nbTechantillon/3; i++) this.signalEchantillonee.add(v);
for(int i=0; i<nbTechantillon/3; i++) this.signalEchantillonee.add(0f);
}
else
{
for(int i=0; i<nbTechantillon; i++) this.signalEchantillonee.add(0f);
}
informationEmise = (Information<Float>) signalEchantillonee;
}
}
}
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment