001/* 002 * This file is part of the Kompics component model runtime. 003 * 004 * Copyright (C) 2009 Swedish Institute of Computer Science (SICS) 005 * Copyright (C) 2009 Royal Institute of Technology (KTH) 006 * 007 * Kompics is free software; you can redistribute it and/or 008 * modify it under the terms of the GNU General Public License 009 * as published by the Free Software Foundation; either version 2 010 * of the License, or (at your option) any later version. 011 * 012 * This program is distributed in the hope that it will be useful, 013 * but WITHOUT ANY WARRANTY; without even the implied warranty of 014 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 015 * GNU General Public License for more details. 016 * 017 * You should have received a copy of the GNU General Public License 018 * along with this program; if not, write to the Free Software 019 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 020 */ 021package se.sics.kompics; 022 023/** 024 * The <code>ChannelSelector</code> class. 025 * 026 * @author Cosmin Arad {@literal <[email protected]>} 027 * @author Jim Dowling {@literal <[email protected]>} 028 * @author Lars Kroll {@literal <[email protected]>} 029 * @version $Id$ 030 */ 031public abstract class ChannelSelector<E extends KompicsEvent, F> { 032 033 private final Class<E> eventType; 034 035 private final F value; 036 037 private final boolean positive; 038 039 protected ChannelSelector(Class<E> eventType, F value, boolean positive) { 040 this.eventType = eventType; 041 this.value = value; 042 this.positive = positive; 043 } 044 045 public abstract F getValue(E event); 046 047 public final F getValue() { 048 return value; 049 } 050 051 public final Class<E> getEventType() { 052 return eventType; 053 } 054 055 public final boolean isPositive() { 056 return positive; 057 } 058}