// Path: action/src/main/java/io/cettia/asity/action/Actions.java
// class Options {
// 
//   private boolean once;
//   private boolean memory;
//   private boolean unique;
// 
//   public Options() {
//   }
// 
//   public Options(Options options) {
//     once = options.once;
//     memory = options.memory;
//     unique = options.unique;
//   }
// 
//   public boolean once() {
//     return once;
//   }
// 
//   /**
//    * Ensures the actions can only be fired once. The default value is
//    * false.
//    */
//   public Options once(boolean once) {
//     this.once = once;
//     return this;
//   }
// 
//   public boolean memory() {
//     return memory;
//   }
// 
//   /**
//    * Keeps track of previous values and will call any action added after
//    * the actions has been fired right away with the latest "memorized"
//    * values. The default value is false.
//    */
//   public Options memory(boolean memory) {
//     this.memory = memory;
//     return this;
//   }
// 
//   public boolean unique() {
//     return unique;
//   }
// 
//   /**
//    * Ensures an action can only be added once. The default value is false.
//    */
//   public Options unique(boolean unique) {
//     this.unique = unique;
//     return this;
//   }
// 
// }


import io.cettia.asity.action.Actions.Options;
import org.junit.Test;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import static org.hamcrest.Matchers.contains;
import static org.hamcrest.Matchers.empty;
import static org.hamcrest.Matchers.is;
import static org.junit.Assert.assertThat;
  }

  @Test
  public void testHas() {
    Actions<Void> actions = createActions();
    Action<Void> actionA = new EmptyAction<>();
    Action<Void> actionB = new EmptyAction<>();

    assertThat(actions.has(), is(false));
    assertThat(actions.has(actionA), is(false));
    assertThat(actions.has(actionB), is(false));
    actions.add(actionA);
    assertThat(actions.has(), is(true));
    assertThat(actions.has(actionA), is(true));
    assertThat(actions.has(actionB), is(false));
  }

  protected abstract <T> Actions<T> createActions();

  protected abstract <T> Actions<T> createActions(Options options);

  private static class EmptyAction<A> implements Action<A> {
    @Override
    public void on(A object) {
    }
  }

  private static class MemoryAction<T> implements Action<T> {
    private List<T> list = new ArrayList<>();

// Path: action/src/main/java/io/cettia/asity/action/Actions.java
// class Options {
// 
//   private boolean once;
//   private boolean memory;
//   private boolean unique;
// 
//   public Options() {
//   }
// 
//   public Options(Options options) {
//     once = options.once;
//     memory = options.memory;
//     unique = options.unique;
//   }
// 
//   public boolean once() {
//     return once;
//   }
// 
//   /**
//    * Ensures the actions can only be fired once. The default value is
//    * false.
//    */
//   public Options once(boolean once) {
//     this.once = once;
//     return this;
//   }
// 
//   public boolean memory() {
//     return memory;
//   }
// 
//   /**
//    * Keeps track of previous values and will call any action added after
//    * the actions has been fired right away with the latest "memorized"
//    * values. The default value is false.
//    */
//   public Options memory(boolean memory) {
//     this.memory = memory;
//     return this;
//   }
// 
//   public boolean unique() {
//     return unique;
//   }
// 
//   /**
//    * Ensures an action can only be added once. The default value is false.
//    */
//   public Options unique(boolean unique) {
//     this.unique = unique;
//     return this;
//   }
// 
// }


// Path: action/src/test/java/io/cettia/asity/action/ActionsTestBase.java
import io.cettia.asity.action.Actions.Options;
import org.junit.Test;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import static org.hamcrest.Matchers.contains;
import static org.hamcrest.Matchers.empty;
import static org.hamcrest.Matchers.is;
import static org.junit.Assert.assertThat;

  }

  @Test
  public void testHas() {
    Actions<Void> actions = createActions();
    Action<Void> actionA = new EmptyAction<>();
    Action<Void> actionB = new EmptyAction<>();

    assertThat(actions.has(), is(false));
    assertThat(actions.has(actionA), is(false));
    assertThat(actions.has(actionB), is(false));
    actions.add(actionA);
    assertThat(actions.has(), is(true));
    assertThat(actions.has(actionA), is(true));
    assertThat(actions.has(actionB), is(false));
  }

  protected abstract <T> Actions<T> createActions();

  protected abstract <T> Actions<T> createActions(Options options);

  private static class EmptyAction<A> implements Action<A> {
    @Override
    public void on(A object) {
    }
  }

  private static class MemoryAction<T> implements Action<T> {
    private List<T> list = new ArrayList<>();

    @Override