// Path: src/main/java/com/kasirgalabs/etumulator/util/BaseDispatcher.java
// public class BaseDispatcher implements Dispatcher {
//     private final List<Observer> observers;
// 
//     public BaseDispatcher() {
//         observers = new ArrayList<>(10);
//     }
// 
//     @Override
//     public void addObserver(Observer observer) {
//         observers.add(observer);
//     }
// 
//     @Override
//     public void notifyObservers(Class<?> clazz, Object arg) {
//         for(int i = 0; i < observers.size(); i++) {
//             observers.get(i).update(clazz, arg);
//         }
//     }
// 
//     @Override
//     public void notifyObservers(Class<?> clazz) {
//         notifyObservers(clazz, null);
//     }
// }
// 
// Path: src/main/java/com/kasirgalabs/etumulator/util/Dispatcher.java
// public interface Dispatcher {
//     void addObserver(Observer observer);
// 
//     void notifyObservers(Class<?> clazz, Object arg);
// 
//     void notifyObservers(Class<?> clazz);
// }
// 
// Path: src/main/java/com/kasirgalabs/etumulator/util/Observable.java
// public interface Observable {
//     void addObserver(Observer observer);
// }
// 
// Path: src/main/java/com/kasirgalabs/etumulator/util/Observer.java
// public interface Observer {
//     void update(Class<?> clazz, Object arg);
// }


import com.google.inject.Inject;
import com.google.inject.Singleton;
import com.kasirgalabs.etumulator.util.BaseDispatcher;
import com.kasirgalabs.etumulator.util.Dispatcher;
import com.kasirgalabs.etumulator.util.Observable;
import com.kasirgalabs.etumulator.util.Observer;
package com.kasirgalabs.etumulator.processor;


/**
 * The Application Program Status Register (APSR) holds copies of the Arithmetic Logic Unit (ALU)
 * status flags. They are also known as the condition code flags. They are used to determine whether
 * conditional branches are executed or not. A branch with a condition code is only
 * executed if the condition code flags in the APSR meet the specified condition.
 * <p>
 * This class represents an observable object. After a state change on flags, all of it's observers
 * will be notified through default {@link BaseDispatcher} or the Dispatcher initialized during
 * construction.
 *
 * @author Görkem Mülayim
 * @see Dispatcher
 */
@Singleton
public class APSR implements Observable {
    private boolean negative;
    private boolean zero;
    private boolean carry;
    private boolean overflow;
    private final Dispatcher dispatcher;

    /**
     * Construct an APSR with {@link BaseDispatcher}.
     *
     * @see BaseDispatcher
     */
    public APSR() {
// Path: src/main/java/com/kasirgalabs/etumulator/util/BaseDispatcher.java
// public class BaseDispatcher implements Dispatcher {
//     private final List<Observer> observers;
// 
//     public BaseDispatcher() {
//         observers = new ArrayList<>(10);
//     }
// 
//     @Override
//     public void addObserver(Observer observer) {
//         observers.add(observer);
//     }
// 
//     @Override
//     public void notifyObservers(Class<?> clazz, Object arg) {
//         for(int i = 0; i < observers.size(); i++) {
//             observers.get(i).update(clazz, arg);
//         }
//     }
// 
//     @Override
//     public void notifyObservers(Class<?> clazz) {
//         notifyObservers(clazz, null);
//     }
// }
// 
// Path: src/main/java/com/kasirgalabs/etumulator/util/Dispatcher.java
// public interface Dispatcher {
//     void addObserver(Observer observer);
// 
//     void notifyObservers(Class<?> clazz, Object arg);
// 
//     void notifyObservers(Class<?> clazz);
// }
// 
// Path: src/main/java/com/kasirgalabs/etumulator/util/Observable.java
// public interface Observable {
//     void addObserver(Observer observer);
// }
// 
// Path: src/main/java/com/kasirgalabs/etumulator/util/Observer.java
// public interface Observer {
//     void update(Class<?> clazz, Object arg);
// }


// Path: src/main/java/com/kasirgalabs/etumulator/processor/APSR.java
import com.google.inject.Inject;
import com.google.inject.Singleton;
import com.kasirgalabs.etumulator.util.BaseDispatcher;
import com.kasirgalabs.etumulator.util.Dispatcher;
import com.kasirgalabs.etumulator.util.Observable;
import com.kasirgalabs.etumulator.util.Observer;

package com.kasirgalabs.etumulator.processor;


/**
 * The Application Program Status Register (APSR) holds copies of the Arithmetic Logic Unit (ALU)
 * status flags. They are also known as the condition code flags. They are used to determine whether
 * conditional branches are executed or not. A branch with a condition code is only
 * executed if the condition code flags in the APSR meet the specified condition.
 * <p>
 * This class represents an observable object. After a state change on flags, all of it's observers
 * will be notified through default {@link BaseDispatcher} or the Dispatcher initialized during
 * construction.
 *
 * @author Görkem Mülayim
 * @see Dispatcher
 */
@Singleton
public class APSR implements Observable {
    private boolean negative;
    private boolean zero;
    private boolean carry;
    private boolean overflow;
    private final Dispatcher dispatcher;

    /**
     * Construct an APSR with {@link BaseDispatcher}.
     *
     * @see BaseDispatcher
     */
    public APSR() {
        this.dispatcher = new BaseDispatcher();