75 lines
1.9 KiB
Java
75 lines
1.9 KiB
Java
package app.state;
|
|
|
|
import com.google.inject.Inject;
|
|
import domain.image.GrayScaleMatrix;
|
|
import domain.image.processing.complex.ComplexMatrix;
|
|
import presenters.fourier.DoubleMatrixListener;
|
|
|
|
import java.util.ArrayList;
|
|
import java.util.List;
|
|
|
|
public class DoubleMatrixState extends State {
|
|
private ComplexMatrix fourier;
|
|
private GrayScaleMatrix module;
|
|
private GrayScaleMatrix phase;
|
|
private GrayScaleMatrix real;
|
|
private GrayScaleMatrix imaginary;
|
|
|
|
private final List<DoubleMatrixListener> listeners = new ArrayList<>();
|
|
|
|
@Inject
|
|
public DoubleMatrixState() {}
|
|
|
|
public void subscribe(DoubleMatrixListener listener) {
|
|
listeners.add(listener);
|
|
}
|
|
|
|
public void unsubscribe(DoubleMatrixListener listener) {
|
|
listeners.remove(listener);
|
|
}
|
|
|
|
public ComplexMatrix getFourier() {
|
|
return fourier;
|
|
}
|
|
|
|
public void setFourier(ComplexMatrix fourier) {
|
|
this.fourier = fourier;
|
|
listeners.forEach(listener -> listener.onFourierChanged(fourier));
|
|
}
|
|
|
|
public void setModule(GrayScaleMatrix matrix) {
|
|
this.module = matrix;
|
|
listeners.forEach(listener -> listener.onModuleChanged(matrix));
|
|
}
|
|
|
|
public void setPhase(GrayScaleMatrix matrix) {
|
|
this.phase = matrix;
|
|
listeners.forEach(listener -> listener.onPhaseChanged(matrix));
|
|
}
|
|
|
|
public void setReal(GrayScaleMatrix matrix) {
|
|
this.real = matrix;
|
|
listeners.forEach(listener -> listener.onRealChanged(matrix));
|
|
}
|
|
|
|
public void setImaginary(GrayScaleMatrix matrix) {
|
|
this.imaginary = matrix;
|
|
listeners.forEach(listener -> listener.onImaginaryChanged(matrix));
|
|
}
|
|
|
|
public GrayScaleMatrix getModule() {
|
|
return module;
|
|
}
|
|
|
|
public GrayScaleMatrix getPhase() {
|
|
return phase;
|
|
}
|
|
|
|
public GrayScaleMatrix getReal() {
|
|
return real;
|
|
}
|
|
|
|
public GrayScaleMatrix getImaginary() {
|
|
return imaginary;
|
|
}
|
|
} |