summaryrefslogtreecommitdiffstats
path: root/searchlib/src/main/java/com/yahoo/searchlib/expression/GetYMUMChecksumFunctionNode.java
blob: 9fb47d0401c56fff654330fdd56c8d3ae9fe43de (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.searchlib.expression;

import com.yahoo.vespa.objects.Deserializer;
import com.yahoo.vespa.objects.ObjectVisitor;
import com.yahoo.vespa.objects.Serializer;

/**
 * This node is a request to retrieve the YMUM checksum of a document.
 *
 * @author baldersheim
 * @author Simon Thoresen Hult
 */
public class GetYMUMChecksumFunctionNode extends DocumentAccessorNode {

    public static final int classId = registerClass(0x4000 + 74, GetYMUMChecksumFunctionNode.class);
    private IntegerResultNode result = new IntegerResultNode(0);

    @Override
    public ResultNode getResult() {
        return result;
    }

    @Override
    protected int onGetClassId() {
        return classId;
    }

    @Override
    protected void onSerialize(Serializer buf) {
        super.onSerialize(buf);
        result.serialize(buf);
    }

    @Override
    protected void onDeserialize(Deserializer buf) {
        super.onDeserialize(buf);
        result.deserialize(buf);
    }

    @Override
    public GetYMUMChecksumFunctionNode clone() {
        GetYMUMChecksumFunctionNode obj = (GetYMUMChecksumFunctionNode)super.clone();
        if (result != null) {
            obj.result = (IntegerResultNode)result.clone();
        }
        return obj;
    }

    @Override
    public void visitMembers(ObjectVisitor visitor) {
        super.visitMembers(visitor);
        visitor.visit("result", result);
    }

    @Override
    protected boolean equalsExpression(ExpressionNode obj) {
        return equals(result, ((GetYMUMChecksumFunctionNode)obj).result);
    }
}