001 /* 002 * NodeBehavior.java 003 * 004 * Developed for the "Rethinking CS101" project. See http://www.cs101.org, the 005 * CS101 homepage or email las@olin.edu. 006 * 007 * Please do not redistribute without obtaining permission. 008 */ 009 010 package nodenet; 011 012 import java.util.Vector; 013 014 /** 015 * NodeBehavior is the interface you must implement in your code. It 016 * defines a single method, act.<p> 017 * 018 * @author Todd C. Parnell, tparnell@ai.mit.edu 019 * @version $Id: NodeBehavior.java,v 1.3 2004/01/14 21:43:17 gus Exp $ 020 */ 021 public interface NodeBehavior { 022 023 /** 024 * TransmitPacket is the method you will write for this lab. It 025 * has two arguments, one which is an <code>InputChannelVector</code>, 026 * and the other an <code>OutputChannelVector</code>, 027 * corresponding to the inputs and outputs available to you. Note 028 * that the channels obtained from these vectors (if any) exist, but are 029 * perhaps disabled, full, or empty. You will need to be aware of 030 * these conditions. 031 * 032 * <p>TransmitPacket is called repeatedly by a <code>Node</code> 033 * from within a <code>while (true) {}</code> loop. You 034 * should deal with a single task on each iteration. Failure to 035 * return promptly will result in unpredictable behavior. 036 * 037 * @see nodenet.ChannelFullException 038 * @see nodenet.ChannelDisabledException 039 * @see nodenet.ChannelEmptyException 040 * @param inputChannels A vector that may contain input channels 041 * @param outputChannels A vector that may contain output channels 042 */ 043 public void transmitPacket( InputChannelVector inputChannels, 044 OutputChannelVector outputChannels ); 045 } 046 047 /* 048 * $Log: NodeBehavior.java,v $ 049 * Revision 1.3 2004/01/14 21:43:17 gus 050 * more javadoc, plus reformat 051 * 052 * Revision 1.2 2004/01/14 20:23:21 gus 053 * Javadoc and comment cleanup 054 * 055 * Revision 1.1 2002/06/13 17:33:21 gus 056 * Moved all java files into the nodenet directory (who let them out anyway?) 057 * 058 * Revision 1.1.1.1 2002/06/05 21:56:35 root 059 * CS101 comes to Olin finally. 060 * 061 * Revision 1.4 2000/05/09 06:03:54 mharder 062 * Changed packagename from nodeNet to nodenet. 063 * 064 * Revision 1.3 1999/08/04 09:08:53 jsmthng 065 * Added javadoc comments to InputChannelVector and OutputChannelVector; 066 * finished updating the rest of the nodeNet package to reflect new 067 * changes in name and code. 068 * 069 * Modified index.html to reflect the new nodeNet code, as well as to 070 * clarify some parts of the problem set. 071 * 072 * Revision 1.1 1999/07/30 01:09:22 jsmthng 073 * Renaming BinSort package to nodeNet; moving directories and files as 074 * necessary. 075 * 076 * Revision 1.4 1998/08/12 19:29:39 tparnell 077 * Another pass after comments from las & natashao. Added support to 078 * dynamically add NodeBehaviors. Add keyboard shortcuts to menus. Added 079 * workaround to jdk bug relating to lighweight components. Misc other 080 * bugfixes. 081 * 082 * Revision 1.3 1998/08/10 17:45:50 tparnell 083 * Revision to use JDK1.2 and Swing. Redesign of GUI. Removed old kludge 084 * for file I/O and replaced with object serialization. Channel no longer 085 * requires animacy. Removed unnessary dependencies between classes. 086 * Added ability to configure channel's latency and capacity. Added 087 * javadoc to all files. General code cleanup. 088 * 089 */ 090 091