📄 treenodeentry.java
字号:
/* * @(#)$Id: TreeNodeEntry.java,v 1.1 2005/07/10 16:42:39 huebsch Exp $ * * Copyright (c) 2001-2004 Regents of the University of California. * All rights reserved. * * This file is distributed under the terms in the attached BERKELEY-LICENSE * file. If you do not find these files, copies can be found by writing to: * Computer Science Division, Database Group, Universite of California, * 617 Soda Hall #1776, Berkeley, CA 94720-1776. Attention: Berkeley License * * Copyright (c) 2003-2004 Intel Corporation. All rights reserved. * * This file is distributed under the terms in the attached INTEL-LICENSE file. * If you do not find these files, copies can be found by writing to: * Intel Research Berkeley, 2150 Shattuck Avenue, Suite 1300, * Berkeley, CA, 94704. Attention: Intel License Inquiry. */package pier.helpers.trees;import java.net.InetSocketAddress;import services.LocalNode;import util.BitID;/** * Class Expression */public class TreeNodeEntry { protected BitID id; protected InetSocketAddress socketAddress; protected int advertisedSlots; protected long insertionTime; protected long deletionTime; protected long lastSendTime; /** * Constructor TreeNodeEntry * * @param id * @param socketAddress * @param advertisedSlots * @param lifetime */ public TreeNodeEntry(BitID id, InetSocketAddress socketAddress, int advertisedSlots, long lifetime) { this.id = id; this.socketAddress = socketAddress; this.advertisedSlots = advertisedSlots; long currentTime = LocalNode.myTimer.getCurrentTimeMS(); this.insertionTime = currentTime; this.deletionTime = currentTime + lifetime; this.lastSendTime = 0; } /** * Method updateLifetime * * @param advertisedSlots * @param lifetime */ protected void updateLifetime(int advertisedSlots, long lifetime) { long currentTime = LocalNode.myTimer.getCurrentTimeMS(); this.advertisedSlots = advertisedSlots; this.deletionTime = currentTime + lifetime; } /** * Method decrementSlots */ protected void decrementSlots() { advertisedSlots--; } /** * Method updateLastSendTime */ protected void updateLastSendTime() { long currentTime = LocalNode.myTimer.getCurrentTimeMS(); this.lastSendTime = currentTime; } /** * Method getID * @return */ public BitID getID() { return id; } /** * Method getSocketAddress * @return */ public InetSocketAddress getSocketAddress() { return socketAddress; } /** * Method getAdvertisedSlots * @return */ protected int getAdvertisedSlots() { return advertisedSlots; } /** * Method getInsertionTime * @return */ protected long getInsertionTime() { return insertionTime; } /** * Method getDeletionTime * @return */ protected long getDeletionTime() { return deletionTime; } /** * Method getLastSendTime * @return */ protected long getLastSendTime() { return lastSendTime; } /** * Method toString * @return */ public String toString() { return "<TreeEntry: ID:" + id + ", ADDR:" + socketAddress + ", SLOTS:" + advertisedSlots + ", LAST:" + lastSendTime + ", INS:" + insertionTime + ", DEL:" + deletionTime + ">"; }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -