Generators implementiert
This commit is contained in:
@@ -0,0 +1,68 @@
|
||||
/*
|
||||
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
|
||||
* Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template
|
||||
*/
|
||||
|
||||
package bandit.Schnittstelle;
|
||||
|
||||
import bandit.Model.Zahlengenerator;
|
||||
import bandit.View.ZahlenView;
|
||||
import java.util.concurrent.Flow;
|
||||
import java.util.concurrent.Flow.Subscriber;
|
||||
import java.util.concurrent.Flow.Subscription;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author le
|
||||
*/
|
||||
public class WertAdapter implements Subscriber<Integer[]>
|
||||
{
|
||||
private ZahlenView view;
|
||||
private Zahlengenerator model;
|
||||
private Subscription subscription;
|
||||
|
||||
public WertAdapter(ZahlenView view, Zahlengenerator model)
|
||||
{
|
||||
this.view = view;
|
||||
this.model = model;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSubscribe(Flow.Subscription subscription)
|
||||
{
|
||||
this.subscription = subscription;
|
||||
this.subscription.request(1);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNext(Integer item[])
|
||||
{
|
||||
String strWert = String.valueOf(item[0]);
|
||||
|
||||
switch(item[1]){
|
||||
case 1:
|
||||
view.getLblZahl1().setText(strWert);
|
||||
break;
|
||||
case 2:
|
||||
view.getLblZahl2().setText(strWert);
|
||||
break;
|
||||
case 3:
|
||||
view.getLblZahl3().setText(strWert);
|
||||
break;
|
||||
}
|
||||
|
||||
this.subscription.request(1);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(Throwable throwable)
|
||||
{
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onComplete()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user