]> gerrit.simantics Code Review - simantics/platform.git/blob - bundles/org.simantics.db.server/src/org/simantics/db/server/protocol/NullFunction.java
Migrated source code from Simantics SVN
[simantics/platform.git] / bundles / org.simantics.db.server / src / org / simantics / db / server / protocol / NullFunction.java
1 /*******************************************************************************\r
2  * Copyright (c) 2007, 2010 Association for Decentralized Information Management\r
3  * in Industry THTH ry.\r
4  * All rights reserved. This program and the accompanying materials\r
5  * are made available under the terms of the Eclipse Public License v1.0\r
6  * which accompanies this distribution, and is available at\r
7  * http://www.eclipse.org/legal/epl-v10.html\r
8  *\r
9  * Contributors:\r
10  *     VTT Technical Research Centre of Finland - initial API and implementation\r
11  *******************************************************************************/\r
12 package org.simantics.db.server.protocol;\r
13 \r
14 import java.nio.ByteOrder;\r
15 \r
16 public class NullFunction extends AbstractFunction {\r
17     public int messageNumber = 0;\r
18     public NullFunction() {\r
19         super(MessageNumber.NullRequest, MessageNumber.NullResponse);\r
20     }\r
21     @Override\r
22     public DataBuffer serialize(ByteOrder byteOrder) {\r
23         buffer.clear();\r
24         buffer.order(byteOrder);\r
25         buffer.mark();\r
26         return buffer;\r
27     }\r
28     @Override\r
29     public void deserialize(int receivedNumber_, DataBuffer dataBuffer) {\r
30         receivedNumber = receivedNumber_;\r
31         if (notRightDataForUs())\r
32             return;\r
33         messageNumber = dataBuffer.get(messageNumber);\r
34         gotResponse();\r
35     }\r
36 }\r