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>Port</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 interface Port<P extends PortType> { 032 033 /** 034 * Gets the port type. 035 * 036 * @return the port type 037 */ 038 public P getPortType(); 039 040 /** 041 * trigger event on this port 042 * 043 * @param event 044 * to be triggered 045 * @param wid 046 * ? 047 * @param channel 048 * that triggered the event 049 */ 050 public void doTrigger(KompicsEvent event, int wid, ChannelCore<?> channel); 051 052 /** 053 * trigger event on this port 054 * 055 * @param event 056 * to be triggered 057 * @param wid 058 * ? 059 * @param component 060 * that triggered the event 061 */ 062 public void doTrigger(KompicsEvent event, int wid, ComponentCore component); 063 064 /** 065 * 066 * @return the component the port is part of 067 */ 068 public ComponentCore getOwner(); 069 070 /** 071 * 072 * @return complement port this one is connected to (if any) 073 */ 074 public PortCore<P> getPair(); 075 076 /** 077 * 078 * @param port 079 * complement port 080 */ 081 public void setPair(PortCore<P> port); 082 083 public <E extends KompicsEvent> void doSubscribe(Handler<E> handler); 084 085 public void doSubscribe(MatchedHandler<?, ?, ?> handler); 086 087 public void addChannel(ChannelCore<P> channel); 088 089 public void addChannel(ChannelCore<P> channel, ChannelSelector<?, ?> filter); 090 091 public void removeChannel(ChannelCore<P> remotePort); 092 093 public void enqueue(KompicsEvent event); 094}