AnalyzedTokenInfo.java

  1. // Copyright (c) Microsoft Corporation. All rights reserved.
  2. // Licensed under the MIT License.
  3. //
  4. // Code generated by Microsoft (R) AutoRest Code Generator.
  5. // Changes may cause incorrect behavior and will be lost if the code is
  6. // regenerated.

  7. package com.azure.search.documents.indexes.models;

  8. import com.azure.core.annotation.Immutable;
  9. import com.fasterxml.jackson.annotation.JsonCreator;
  10. import com.fasterxml.jackson.annotation.JsonProperty;

  11. /** Information about a token returned by an analyzer. */
  12. @Immutable
  13. public final class AnalyzedTokenInfo {
  14.     /*
  15.      * The token returned by the analyzer.
  16.      */
  17.     @JsonProperty(value = "token", required = true, access = JsonProperty.Access.WRITE_ONLY)
  18.     private String token;

  19.     /*
  20.      * The index of the first character of the token in the input text.
  21.      */
  22.     @JsonProperty(value = "startOffset", required = true, access = JsonProperty.Access.WRITE_ONLY)
  23.     private int startOffset;

  24.     /*
  25.      * The index of the last character of the token in the input text.
  26.      */
  27.     @JsonProperty(value = "endOffset", required = true, access = JsonProperty.Access.WRITE_ONLY)
  28.     private int endOffset;

  29.     /*
  30.      * The position of the token in the input text relative to other tokens.
  31.      * The first token in the input text has position 0, the next has position
  32.      * 1, and so on. Depending on the analyzer used, some tokens might have the
  33.      * same position, for example if they are synonyms of each other.
  34.      */
  35.     @JsonProperty(value = "position", required = true, access = JsonProperty.Access.WRITE_ONLY)
  36.     private int position;

  37.     /**
  38.      * Creates an instance of AnalyzedTokenInfo class.
  39.      *
  40.      * @param token the token value to set.
  41.      * @param startOffset the startOffset value to set.
  42.      * @param endOffset the endOffset value to set.
  43.      * @param position the position value to set.
  44.      */
  45.     @JsonCreator
  46.     public AnalyzedTokenInfo(
  47.             @JsonProperty(value = "token", required = true, access = JsonProperty.Access.WRITE_ONLY) String token,
  48.             @JsonProperty(value = "startOffset", required = true, access = JsonProperty.Access.WRITE_ONLY)
  49.                     int startOffset,
  50.             @JsonProperty(value = "endOffset", required = true, access = JsonProperty.Access.WRITE_ONLY) int endOffset,
  51.             @JsonProperty(value = "position", required = true, access = JsonProperty.Access.WRITE_ONLY) int position) {
  52.         this.token = token;
  53.         this.startOffset = startOffset;
  54.         this.endOffset = endOffset;
  55.         this.position = position;
  56.     }

  57.     /**
  58.      * Get the token property: The token returned by the analyzer.
  59.      *
  60.      * @return the token value.
  61.      */
  62.     public String getToken() {
  63.         return this.token;
  64.     }

  65.     /**
  66.      * Get the startOffset property: The index of the first character of the token in the input text.
  67.      *
  68.      * @return the startOffset value.
  69.      */
  70.     public int getStartOffset() {
  71.         return this.startOffset;
  72.     }

  73.     /**
  74.      * Get the endOffset property: The index of the last character of the token in the input text.
  75.      *
  76.      * @return the endOffset value.
  77.      */
  78.     public int getEndOffset() {
  79.         return this.endOffset;
  80.     }

  81.     /**
  82.      * Get the position property: The position of the token in the input text relative to other tokens. The first token
  83.      * in the input text has position 0, the next has position 1, and so on. Depending on the analyzer used, some tokens
  84.      * might have the same position, for example if they are synonyms of each other.
  85.      *
  86.      * @return the position value.
  87.      */
  88.     public int getPosition() {
  89.         return this.position;
  90.     }
  91. }