📄 rawpastregrtest.java
字号:
existing.serialize(buf); } } } /** * DESCRIBE THE CLASS * * @version $Id: pretty.settings 2305 2005-03-11 20:22:33Z jeffh $ * @author jeffh */ protected static class VersionedTestPastContent extends TestPastContent { /** * DESCRIBE THE FIELD */ protected int version = 0; /** * DESCRIBE THE FIELD */ public final static short TYPE = 2; /** * Constructor for VersionedTestPastContent. * * @param id DESCRIBE THE PARAMETER * @param version DESCRIBE THE PARAMETER */ public VersionedTestPastContent(Id id, int version) { super(id); this.version = version; } /** * Constructor for VersionedTestPastContent. * * @param buf DESCRIBE THE PARAMETER * @param endpoint DESCRIBE THE PARAMETER * @param pcd DESCRIBE THE PARAMETER * @exception IOException DESCRIBE THE EXCEPTION */ public VersionedTestPastContent(InputBuffer buf, Endpoint endpoint, PastContentDeserializer pcd) throws IOException { super(buf, endpoint, pcd); version = buf.readInt(); } /** * Gets the Type attribute of the VersionedTestPastContent object * * @return The Type value */ public short getType() { return TYPE; } /** * DESCRIBE THE METHOD * * @param o DESCRIBE THE PARAMETER * @return DESCRIBE THE RETURN VALUE */ public boolean equals(Object o) { if (!(o instanceof VersionedTestPastContent)) { return false; } return (((VersionedTestPastContent) o).id.equals(id) && (((VersionedTestPastContent) o).version == version)); } /** * DESCRIBE THE METHOD * * @return DESCRIBE THE RETURN VALUE */ public String toString() { return "VersionedTestPastContent(" + id + ", " + version + ")"; } /** * DESCRIBE THE METHOD * * @param buf DESCRIBE THE PARAMETER * @exception IOException DESCRIBE THE EXCEPTION */ public void serialize(OutputBuffer buf) throws IOException { super.serialize(buf); buf.writeInt(version); } } /** * DESCRIBE THE CLASS * * @version $Id: pretty.settings 2305 2005-03-11 20:22:33Z jeffh $ * @author jeffh */ protected static class NonOverwritingTestPastContent extends VersionedTestPastContent { /** * Constructor for NonOverwritingTestPastContent. * * @param id DESCRIBE THE PARAMETER * @param version DESCRIBE THE PARAMETER */ public NonOverwritingTestPastContent(Id id, int version) { super(id, version); } /** * DESCRIBE THE METHOD * * @param id DESCRIBE THE PARAMETER * @param existingContent DESCRIBE THE PARAMETER * @return DESCRIBE THE RETURN VALUE * @exception PastException DESCRIBE THE EXCEPTION */ public PastContent checkInsert(Id id, PastContent existingContent) throws PastException { return existingContent; } } /** * DESCRIBE THE CLASS * * @version $Id: pretty.settings 2305 2005-03-11 20:22:33Z jeffh $ * @author jeffh */ protected static class NonMutableTestPastContent extends TestPastContent { /** * Constructor for NonMutableTestPastContent. * * @param id DESCRIBE THE PARAMETER */ public NonMutableTestPastContent(Id id) { super(id); } /** * Gets the Mutable attribute of the NonMutableTestPastContent object * * @return The Mutable value */ public boolean isMutable() { return false; } /** * DESCRIBE THE METHOD * * @param o DESCRIBE THE PARAMETER * @return DESCRIBE THE RETURN VALUE */ public boolean equals(Object o) { if (!(o instanceof NonMutableTestPastContent)) { return false; } return ((NonMutableTestPastContent) o).id.equals(id); } } /** * Utility class for past content object handles * * @version $Id: pretty.settings 2305 2005-03-11 20:22:33Z jeffh $ * @author jeffh */ protected static class TestPastContentHandle implements RawPastContentHandle { /** * DESCRIBE THE FIELD */ protected NodeHandle handle; /** * DESCRIBE THE FIELD */ protected Id id; /** * DESCRIBE THE FIELD */ public final static short TYPE = 1; /** * Constructor for TestPastContentHandle. * * @param past DESCRIBE THE PARAMETER * @param id DESCRIBE THE PARAMETER */ public TestPastContentHandle(Past past, Id id) { this.handle = past.getLocalNodeHandle(); this.id = id; } /** * Constructor for TestPastContentHandle. * * @param buf DESCRIBE THE PARAMETER * @param endpoint DESCRIBE THE PARAMETER * @exception IOException DESCRIBE THE EXCEPTION */ public TestPastContentHandle(InputBuffer buf, Endpoint endpoint) throws IOException { handle = endpoint.readNodeHandle(buf); id = endpoint.readId(buf, buf.readShort()); } /** * Gets the Id attribute of the TestPastContentHandle object * * @return The Id value */ public Id getId() { return id; } /** * Gets the NodeHandle attribute of the TestPastContentHandle object * * @return The NodeHandle value */ public NodeHandle getNodeHandle() { return handle; } /** * Gets the Type attribute of the TestPastContentHandle object * * @return The Type value */ public short getType() { return TYPE; } /** * DESCRIBE THE METHOD * * @param buf DESCRIBE THE PARAMETER * @exception IOException DESCRIBE THE EXCEPTION */ public void serialize(OutputBuffer buf) throws IOException { handle.serialize(buf); buf.writeShort(id.getType()); id.serialize(buf); } } /** * Utility class which simulates a route message * * @version $Id: pretty.settings 2305 2005-03-11 20:22:33Z jeffh $ * @author jeffh */ protected static class TestRouteMessage implements RouteMessage { private Id id; private NodeHandle nextHop; private Message message; /** * Constructor for TestRouteMessage. * * @param id DESCRIBE THE PARAMETER * @param nextHop DESCRIBE THE PARAMETER * @param message DESCRIBE THE PARAMETER */ public TestRouteMessage(Id id, NodeHandle nextHop, Message message) { this.id = id; this.nextHop = nextHop; this.message = message; } /** * Gets the DestinationId attribute of the TestRouteMessage object * * @return The DestinationId value */ public Id getDestinationId() { return id; } /** * Gets the NextHopHandle attribute of the TestRouteMessage object * * @return The NextHopHandle value */ public NodeHandle getNextHopHandle() { return nextHop; } /** * Gets the Message attribute of the TestRouteMessage object * * @return The Message value */ public Message getMessage() { return message; } /** * Gets the Message attribute of the TestRouteMessage object * * @param md DESCRIBE THE PARAMETER * @return The Message value */ public Message getMessage(MessageDeserializer md) { return message; } /** * Sets the DestinationId attribute of the TestRouteMessage object * * @param id The new DestinationId value */ public void setDestinationId(Id id) { this.id = id; } /** * Sets the NextHopHandle attribute of the TestRouteMessage object * * @param nextHop The new NextHopHandle value */ public void setNextHopHandle(NodeHandle nextHop) { this.nextHop = nextHop; } /** * Sets the Message attribute of the TestRouteMessage object * * @param message The new Message value */ public void setMessage(Message message) { this.message = message; } /** * Sets the Message attribute of the TestRouteMessage object * * @param message The new Message value */ public void setMessage(RawMessage message) { this.message = message; } }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -