/** * Pass the message through the selector chain. Whether the Message is * {@link #accept(Message) accepted} is based upon the tallied results of * the individual selectors' responses in accordance with this chain's * {@link VotingStrategy}. */ @Override public final boolean accept(Message<?> message) { int count = 0; int accepted = 0; for (MessageSelector next : this.selectors) { count++; if (next.accept(message)) { if (this.votingStrategy.equals(VotingStrategy.ANY)) { return true; } accepted++; } else if (this.votingStrategy.equals(VotingStrategy.ALL)) { return false; } } return this.decide(accepted, count); }
/** * Pass the message through the selector chain. Whether the Message is * {@link #accept(Message) accepted} is based upon the tallied results of * the individual selectors' responses in accordance with this chain's * {@link VotingStrategy}. */ @Override public final boolean accept(Message<?> message) { int count = 0; int accepted = 0; for (MessageSelector next : this.selectors) { count++; if (next.accept(message)) { if (this.votingStrategy.equals(VotingStrategy.ANY)) { return true; } accepted++; } else if (this.votingStrategy.equals(VotingStrategy.ALL)) { return false; } } return this.decide(accepted, count); }
/** * Pass the message through the selector chain. Whether the Message is * {@link #accept(Message) accepted} is based upon the tallied results of * the individual selectors' responses in accordance with this chain's * {@link VotingStrategy}. */ public final boolean accept(Message<?> message) { int count = 0; int accepted = 0; for (MessageSelector next : this.selectors) { count++; if (next.accept(message)) { if (this.votingStrategy.equals(VotingStrategy.ANY)) { return true; } accepted++; } else if (this.votingStrategy.equals(VotingStrategy.ALL)) { return false; } } return this.decide(accepted, count); }