]> gerrit.simantics Code Review - simantics/platform.git/blob - bundles/org.simantics.db.server/src/org/simantics/db/server/protocol/GetClusterChangesFunction.java
Fixed all line endings of the repository
[simantics/platform.git] / bundles / org.simantics.db.server / src / org / simantics / db / server / protocol / GetClusterChangesFunction.java
1 /*******************************************************************************
2  * Copyright (c) 2007, 2010 Association for Decentralized Information Management
3  * in Industry THTH ry.
4  * All rights reserved. This program and the accompanying materials
5  * are made available under the terms of the Eclipse Public License v1.0
6  * which accompanies this distribution, and is available at
7  * http://www.eclipse.org/legal/epl-v10.html
8  *
9  * Contributors:
10  *     VTT Technical Research Centre of Finland - initial API and implementation
11  *******************************************************************************/
12 package org.simantics.db.server.protocol;
13
14 import java.nio.ByteOrder;
15
16 public class GetClusterChangesFunction extends AbstractFunction {
17     public long changeSetId = 0;
18     public byte[] clusterUID = null;
19     public long headChangeSetId = 0;
20     public int[] resourceIndex = null;
21     public int[] predicateIndex = null;
22     public long[] predicateFirst = null;
23     public long[] predicateSecond = null;
24     public int[] valueIndex = null;
25     public GetClusterChangesFunction() {
26         super(MessageNumber.GetClusterChangesRequest, MessageNumber.GetClusterChangesResponse);
27     }
28     public GetClusterChangesFunction(long changeSetId, byte[] clusterUID) {
29         super(MessageNumber.GetClusterChangesRequest, MessageNumber.GetClusterChangesResponse);
30         this.changeSetId = changeSetId;
31         this.clusterUID = clusterUID;
32     }
33     @Override
34     public DataBuffer serialize(ByteOrder byteOrder) {
35         buffer.clear();
36         buffer.order(byteOrder);
37         buffer.put(changeSetId);
38         buffer.put(clusterUID);
39         buffer.mark();
40         return buffer;
41     }
42     @Override
43     public void deserialize(int receivedNumber_, DataBuffer dataBuffer) {
44         receivedNumber = receivedNumber_;
45         if (notRightDataForUs())
46             return;
47         headChangeSetId = dataBuffer.get(headChangeSetId);
48         resourceIndex = dataBuffer.get(resourceIndex);
49         predicateIndex = dataBuffer.get(predicateIndex);
50         predicateFirst = dataBuffer.get(predicateFirst);
51         predicateSecond = dataBuffer.get(predicateSecond);
52         valueIndex = dataBuffer.get(valueIndex);
53         gotResponse();
54     }
55 }