@Override public boolean equals(Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } AbstractCompositeTrigger that = (AbstractCompositeTrigger) o; return triggers.equals(that.getTriggers()); }
public AbstractCompositeTrigger(Type type, List<T> triggers) { super(type); this.triggers = Collections.unmodifiableList(new ArrayList<>(triggers)); validate(); }
@Override public void validate() { if (!getType().equals(Type.AND) && !getType().equals(Type.OR)) { throw new IllegalArgumentException("Trigger type " + getType().name() + " is not a composite trigger."); } List<T> triggers = getTriggers(); if (triggers.isEmpty()) { throw new IllegalArgumentException(String.format("Triggers passed in to construct a trigger " + "of type %s cannot be empty.", getType().name())); } for (T trigger : triggers) { if (trigger == null) { throw new IllegalArgumentException(String.format("Triggers passed in to construct a trigger " + "of type %s cannot contain null.", getType().name())); } } }
@Override public void validate() { if (!getType().equals(Type.AND) && !getType().equals(Type.OR)) { throw new IllegalArgumentException("Trigger type " + getType().name() + " is not a composite trigger."); } List<T> triggers = getTriggers(); if (triggers.isEmpty()) { throw new IllegalArgumentException(String.format("Triggers passed in to construct a trigger " + "of type %s cannot be empty.", getType().name())); } for (T trigger : triggers) { if (trigger == null) { throw new IllegalArgumentException(String.format("Triggers passed in to construct a trigger " + "of type %s cannot contain null.", getType().name())); } } }
@Override public String toString() { return getType() + "Trigger{" + "triggers=" + triggers + '}'; } }
public AbstractCompositeTrigger(Type type, List<T> triggers) { super(type); this.triggers = Collections.unmodifiableList(new ArrayList<>(triggers)); validate(); }
@Override public boolean equals(Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } AbstractCompositeTrigger that = (AbstractCompositeTrigger) o; return triggers.equals(that.getTriggers()); }
@Override public String toString() { return getType() + "Trigger{" + "triggers=" + triggers + '}'; } }