aboutsummaryrefslogtreecommitdiffstats
path: root/config-model/src/main/java/com/yahoo/schema/parser/ParsedMatchSettings.java
blob: bac2c894283205624ffd705ef9a73e99172f768c (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
// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.schema.parser;

import com.yahoo.schema.document.Case;
import com.yahoo.schema.document.MatchType;
import com.yahoo.schema.document.MatchAlgorithm;

import java.util.Optional;

/**
 * This class holds the extracted information after parsing a "match"
 * block, using simple data structures as far as possible.  Do not put
 * advanced logic here!
 *
 * @author arnej27959
 */
public class ParsedMatchSettings {

    private MatchType matchType = null;
    private Case matchCase = null;
    private MatchAlgorithm matchAlgorithm = null;
    private String exactTerminator = null;
    private Integer gramSize = null;
    private Integer maxLength = null;
    private Integer maxTermOccurrences = null;
    private Integer maxTokenLength = null;

    Optional<MatchType> getMatchType() { return Optional.ofNullable(matchType); }
    Optional<Case> getMatchCase() { return Optional.ofNullable(matchCase); }
    Optional<MatchAlgorithm> getMatchAlgorithm() { return Optional.ofNullable(matchAlgorithm); }
    Optional<String> getExactTerminator() { return Optional.ofNullable(exactTerminator); }
    Optional<Integer> getGramSize() { return Optional.ofNullable(gramSize); }
    Optional<Integer> getMaxLength() { return Optional.ofNullable(maxLength); }
    Optional<Integer> getMaxTermOccurrences() { return Optional.ofNullable(maxTermOccurrences); }
    Optional<Integer> getMaxTokenLength() { return Optional.ofNullable(maxTokenLength); }

    // TODO - consider allowing each set only once:
    void setType(MatchType value) { this.matchType = value; }
    void setCase(Case value) { this.matchCase = value; }
    void setAlgorithm(MatchAlgorithm value) { this.matchAlgorithm = value; }
    void setExactTerminator(String value) { this.exactTerminator = value; }
    void setGramSize(int value) { this.gramSize = value; }
    void setMaxLength(int value) { this.maxLength = value; }
    void setMaxTermOccurrences(int value) { this.maxTermOccurrences = value; }
    void setMaxTokenLength(int value) { this.maxTokenLength = value; }

}