/*
 * Copyright (c) 2013-2015 Falko Schumann <www.muspellheim.de>
 * Released under the terms of the MIT License.
 */

package de.muspellheim.signalslot;

import java.util.List;
import java.util.Objects;
import java.util.concurrent.CopyOnWriteArrayList;

/**
 * A signal act as source of data and can connect to any compatible slot.
 *
 * @param <T> value type
 * @author Falko Schumann &lt;www.muspellheim.de&gt;
 */
public class Signal<T> implements Slot<T> {

    private List<Slot<T>> slots = new CopyOnWriteArrayList<>();
    private boolean blocked;

    public final void connect(final Slot<T> slot) {
        Objects.requireNonNull(receiver, "slot");
        slots.add(slot);
    }

    public final void disconnect(final Slot<T> slot) {
        Objects.requireNonNull(receiver, "slot");
        slots.remove(slot);
    }

    public final void disconnectAll() {
        slots.clear();
    }

    public final void emit(final T value) {
        if (isBlocked()) {
            return;
        }

        for (Slot<T> e : slots) {
            e.receive(value);
        }
    }

    public final boolean isBlocked() {
        return blocked;
    }

    public final void setBlocked(final boolean blocked) {
        this.blocked = blocked;
    }

    @Override
    public final void receive(final T value) {
        emit(value);
    }

}

@@ -482,20 +482,24 @@
 lot%3CT%3E%3E 
-slot
+receiver
 s = new 
@@ -590,36 +590,40 @@
 t(final Slot%3CT%3E 
-slot
+receiver
 ) %7B%0A        Obje
@@ -644,36 +644,40 @@
 Null(receiver, %22
-slot
+receiver
 %22);%0A        slot
@@ -676,22 +676,30 @@
     
-slots.add(slot
+receivers.add(receiver
 );%0A 
@@ -751,20 +751,24 @@
 Slot%3CT%3E 
-slot
+receiver
 ) %7B%0A    
@@ -805,20 +805,24 @@
 eiver, %22
-slot
+receiver
 %22);%0A    
@@ -825,20 +825,24 @@
         
-slot
+receiver
 s.remove
@@ -842,20 +842,24 @@
 .remove(
-slot
+receiver
 );%0A    %7D
@@ -908,20 +908,24 @@
         
-slot
+receiver
 s.clear(
@@ -1061,20 +1061,24 @@
 %3CT%3E e : 
-slot
+receiver
 s) %7B%0A   

Correct compilation errors