📄 currentinfo.java
字号:
/*JAdhoc ver 0.11 - Java AODV (RFC 3561) Protocol HandlerCopyright 2003-2004 ComNets, University of BremenThis program is free software; you can redistribute it and/ormodify it under the terms of the GNU General Public Licenseas published by the Free Software Foundation; either version 2of the License, or (at your option) any later version.This program is distributed in the hope that it will be useful,but WITHOUT ANY WARRANTY; without even the implied warranty ofMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See theGNU General Public License for more details.You should have received a copy of the GNU General Public Licensealong with this program; if not, write to the Free SoftwareFoundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.*/package jadhoc.other;/*** This class provide common information for the current* invocation of the Protocol Handler.** @author : Asanga Udugama* @date : 28-jul-2003* @email : adu@comnets.uni-bremen.de**/public class CurrentInfo { public int lastSeqNum; public int lastRREQID; public Logging log; public static final int GREATER = 1; public static final int EQUAL = 0; public static final int LESS = (-1); /** * Constructor that creates a object and initializes * the current variables */ public CurrentInfo() { lastSeqNum = 0; lastRREQID = 0; } /** * Method to increment the local Sequence Number * TODO : code for number rollover * * @return int - the incremented sequence number */ public int incrementOwnSeqNum() { return ++lastSeqNum; } /** * Method to increment the local RREQ ID * * TODO : code for number rollover * * @return int - the incremented RREQ ID */ public int incrementOwnRREQID() { return ++lastRREQID; } /** * Method to compare Destination Sequence Numbers. Returns * 1, 0 or -1 based on whether first number is greater, equal * or less than the second number, respectively. * * TODO : code for number rollover * * @param int firstNum - 1st number to compare * @param int secondNum - 2nd number to compare * @return int - 1, 0 or -1 based on greater, equal or less */ public int destSeqCompare(int firstNum, int secondNum) { if(firstNum > secondNum) return GREATER; else if(firstNum < secondNum) return LESS; else return EQUAL; }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -