summaryrefslogtreecommitdiff
path: root/core/src/main/java/org/elasticsearch/search/suggest/completion/RegexOptions.java
diff options
context:
space:
mode:
Diffstat (limited to 'core/src/main/java/org/elasticsearch/search/suggest/completion/RegexOptions.java')
-rw-r--r--core/src/main/java/org/elasticsearch/search/suggest/completion/RegexOptions.java36
1 files changed, 14 insertions, 22 deletions
diff --git a/core/src/main/java/org/elasticsearch/search/suggest/completion/RegexOptions.java b/core/src/main/java/org/elasticsearch/search/suggest/completion/RegexOptions.java
index 8503dbdf46..58464cddee 100644
--- a/core/src/main/java/org/elasticsearch/search/suggest/completion/RegexOptions.java
+++ b/core/src/main/java/org/elasticsearch/search/suggest/completion/RegexOptions.java
@@ -67,15 +67,26 @@ public class RegexOptions implements ToXContent, Writeable<RegexOptions> {
private int flagsValue;
private int maxDeterminizedStates;
- private RegexOptions() {
- }
-
private RegexOptions(int flagsValue, int maxDeterminizedStates) {
this.flagsValue = flagsValue;
this.maxDeterminizedStates = maxDeterminizedStates;
}
/**
+ * Read from a stream.
+ */
+ RegexOptions(StreamInput in) throws IOException {
+ this.flagsValue = in.readVInt();
+ this.maxDeterminizedStates = in.readVInt();
+ }
+
+ @Override
+ public void writeTo(StreamOutput out) throws IOException {
+ out.writeVInt(flagsValue);
+ out.writeVInt(maxDeterminizedStates);
+ }
+
+ /**
* Returns internal regular expression syntax flag value
* see {@link RegexpFlag#value()}
*/
@@ -126,25 +137,6 @@ public class RegexOptions implements ToXContent, Writeable<RegexOptions> {
return builder;
}
- public static RegexOptions readRegexOptions(StreamInput in) throws IOException {
- RegexOptions regexOptions = new RegexOptions();
- regexOptions.readFrom(in);
- return regexOptions;
- }
-
- @Override
- public RegexOptions readFrom(StreamInput in) throws IOException {
- this.flagsValue = in.readVInt();
- this.maxDeterminizedStates = in.readVInt();
- return this;
- }
-
- @Override
- public void writeTo(StreamOutput out) throws IOException {
- out.writeVInt(flagsValue);
- out.writeVInt(maxDeterminizedStates);
- }
-
/**
* Options for regular expression queries
*/