All Downloads are FREE. Search and download functionalities are using the official Maven repository.

net.sf.okapi.proto.textunitflat.TextPart Maven / Gradle / Ivy

There is a newer version: 1.47.0
Show newest version
// Generated by the protocol buffer compiler.  DO NOT EDIT!
// source: TextUnitFlat.proto

package net.sf.okapi.proto.textunitflat;

/**
 * Protobuf type {@code TextPart}
 */
public final class TextPart extends
    com.google.protobuf.GeneratedMessageV3 implements
    // @@protoc_insertion_point(message_implements:TextPart)
    TextPartOrBuilder {
private static final long serialVersionUID = 0L;
  // Use TextPart.newBuilder() to construct.
  private TextPart(com.google.protobuf.GeneratedMessageV3.Builder builder) {
    super(builder);
  }
  private TextPart() {
    id_ = "";
    originalId_ = "";
    whitespaceStrategy_ = 0;
    properties_ = java.util.Collections.emptyList();
  }

  @java.lang.Override
  @SuppressWarnings({"unused"})
  protected java.lang.Object newInstance(
      UnusedPrivateParameter unused) {
    return new TextPart();
  }

  @java.lang.Override
  public final com.google.protobuf.UnknownFieldSet
  getUnknownFields() {
    return this.unknownFields;
  }
  private TextPart(
      com.google.protobuf.CodedInputStream input,
      com.google.protobuf.ExtensionRegistryLite extensionRegistry)
      throws com.google.protobuf.InvalidProtocolBufferException {
    this();
    if (extensionRegistry == null) {
      throw new java.lang.NullPointerException();
    }
    int mutable_bitField0_ = 0;
    com.google.protobuf.UnknownFieldSet.Builder unknownFields =
        com.google.protobuf.UnknownFieldSet.newBuilder();
    try {
      boolean done = false;
      while (!done) {
        int tag = input.readTag();
        switch (tag) {
          case 0:
            done = true;
            break;
          case 10: {
            java.lang.String s = input.readStringRequireUtf8();

            id_ = s;
            break;
          }
          case 18: {
            java.lang.String s = input.readStringRequireUtf8();
            bitField0_ |= 0x00000001;
            originalId_ = s;
            break;
          }
          case 26: {
            net.sf.okapi.proto.textunitflat.TextFragment.Builder subBuilder = null;
            if (text_ != null) {
              subBuilder = text_.toBuilder();
            }
            text_ = input.readMessage(net.sf.okapi.proto.textunitflat.TextFragment.parser(), extensionRegistry);
            if (subBuilder != null) {
              subBuilder.mergeFrom(text_);
              text_ = subBuilder.buildPartial();
            }

            break;
          }
          case 32: {
            int rawValue = input.readEnum();

            whitespaceStrategy_ = rawValue;
            break;
          }
          case 42: {
            if (!((mutable_bitField0_ & 0x00000002) != 0)) {
              properties_ = new java.util.ArrayList();
              mutable_bitField0_ |= 0x00000002;
            }
            properties_.add(
                input.readMessage(net.sf.okapi.proto.textunitflat.Property.parser(), extensionRegistry));
            break;
          }
          case 48: {

            segment_ = input.readBool();
            break;
          }
          default: {
            if (!parseUnknownField(
                input, unknownFields, extensionRegistry, tag)) {
              done = true;
            }
            break;
          }
        }
      }
    } catch (com.google.protobuf.InvalidProtocolBufferException e) {
      throw e.setUnfinishedMessage(this);
    } catch (com.google.protobuf.UninitializedMessageException e) {
      throw e.asInvalidProtocolBufferException().setUnfinishedMessage(this);
    } catch (java.io.IOException e) {
      throw new com.google.protobuf.InvalidProtocolBufferException(
          e).setUnfinishedMessage(this);
    } finally {
      if (((mutable_bitField0_ & 0x00000002) != 0)) {
        properties_ = java.util.Collections.unmodifiableList(properties_);
      }
      this.unknownFields = unknownFields.build();
      makeExtensionsImmutable();
    }
  }
  public static final com.google.protobuf.Descriptors.Descriptor
      getDescriptor() {
    return net.sf.okapi.proto.textunitflat.OkapiTextUnitFlatProtoMapping.internal_static_TextPart_descriptor;
  }

  @java.lang.Override
  protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
      internalGetFieldAccessorTable() {
    return net.sf.okapi.proto.textunitflat.OkapiTextUnitFlatProtoMapping.internal_static_TextPart_fieldAccessorTable
        .ensureFieldAccessorsInitialized(
            net.sf.okapi.proto.textunitflat.TextPart.class, net.sf.okapi.proto.textunitflat.TextPart.Builder.class);
  }

  /**
   * Protobuf enum {@code TextPart.WhitespaceStrategy}
   */
  public enum WhitespaceStrategy
      implements com.google.protobuf.ProtocolMessageEnum {
    /**
     * INHERIT = 0;
     */
    INHERIT(0),
    /**
     * PRESERVE = 1;
     */
    PRESERVE(1),
    /**
     * NORMALIZE = 2;
     */
    NORMALIZE(2),
    UNRECOGNIZED(-1),
    ;

    /**
     * INHERIT = 0;
     */
    public static final int INHERIT_VALUE = 0;
    /**
     * PRESERVE = 1;
     */
    public static final int PRESERVE_VALUE = 1;
    /**
     * NORMALIZE = 2;
     */
    public static final int NORMALIZE_VALUE = 2;


    public final int getNumber() {
      if (this == UNRECOGNIZED) {
        throw new java.lang.IllegalArgumentException(
            "Can't get the number of an unknown enum value.");
      }
      return value;
    }

    /**
     * @param value The numeric wire value of the corresponding enum entry.
     * @return The enum associated with the given numeric wire value.
     * @deprecated Use {@link #forNumber(int)} instead.
     */
    @java.lang.Deprecated
    public static WhitespaceStrategy valueOf(int value) {
      return forNumber(value);
    }

    /**
     * @param value The numeric wire value of the corresponding enum entry.
     * @return The enum associated with the given numeric wire value.
     */
    public static WhitespaceStrategy forNumber(int value) {
      switch (value) {
        case 0: return INHERIT;
        case 1: return PRESERVE;
        case 2: return NORMALIZE;
        default: return null;
      }
    }

    public static com.google.protobuf.Internal.EnumLiteMap
        internalGetValueMap() {
      return internalValueMap;
    }
    private static final com.google.protobuf.Internal.EnumLiteMap<
        WhitespaceStrategy> internalValueMap =
          new com.google.protobuf.Internal.EnumLiteMap() {
            public WhitespaceStrategy findValueByNumber(int number) {
              return WhitespaceStrategy.forNumber(number);
            }
          };

    public final com.google.protobuf.Descriptors.EnumValueDescriptor
        getValueDescriptor() {
      if (this == UNRECOGNIZED) {
        throw new java.lang.IllegalStateException(
            "Can't get the descriptor of an unrecognized enum value.");
      }
      return getDescriptor().getValues().get(ordinal());
    }
    public final com.google.protobuf.Descriptors.EnumDescriptor
        getDescriptorForType() {
      return getDescriptor();
    }
    public static final com.google.protobuf.Descriptors.EnumDescriptor
        getDescriptor() {
      return net.sf.okapi.proto.textunitflat.TextPart.getDescriptor().getEnumTypes().get(0);
    }

    private static final WhitespaceStrategy[] VALUES = values();

    public static WhitespaceStrategy valueOf(
        com.google.protobuf.Descriptors.EnumValueDescriptor desc) {
      if (desc.getType() != getDescriptor()) {
        throw new java.lang.IllegalArgumentException(
          "EnumValueDescriptor is not for this type.");
      }
      if (desc.getIndex() == -1) {
        return UNRECOGNIZED;
      }
      return VALUES[desc.getIndex()];
    }

    private final int value;

    private WhitespaceStrategy(int value) {
      this.value = value;
    }

    // @@protoc_insertion_point(enum_scope:TextPart.WhitespaceStrategy)
  }

  private int bitField0_;
  public static final int ID_FIELD_NUMBER = 1;
  private volatile java.lang.Object id_;
  /**
   * string id = 1;
   * @return The id.
   */
  @java.lang.Override
  public java.lang.String getId() {
    java.lang.Object ref = id_;
    if (ref instanceof java.lang.String) {
      return (java.lang.String) ref;
    } else {
      com.google.protobuf.ByteString bs = 
          (com.google.protobuf.ByteString) ref;
      java.lang.String s = bs.toStringUtf8();
      id_ = s;
      return s;
    }
  }
  /**
   * string id = 1;
   * @return The bytes for id.
   */
  @java.lang.Override
  public com.google.protobuf.ByteString
      getIdBytes() {
    java.lang.Object ref = id_;
    if (ref instanceof java.lang.String) {
      com.google.protobuf.ByteString b = 
          com.google.protobuf.ByteString.copyFromUtf8(
              (java.lang.String) ref);
      id_ = b;
      return b;
    } else {
      return (com.google.protobuf.ByteString) ref;
    }
  }

  public static final int ORIGINALID_FIELD_NUMBER = 2;
  private volatile java.lang.Object originalId_;
  /**
   * optional string originalId = 2;
   * @return Whether the originalId field is set.
   */
  @java.lang.Override
  public boolean hasOriginalId() {
    return ((bitField0_ & 0x00000001) != 0);
  }
  /**
   * optional string originalId = 2;
   * @return The originalId.
   */
  @java.lang.Override
  public java.lang.String getOriginalId() {
    java.lang.Object ref = originalId_;
    if (ref instanceof java.lang.String) {
      return (java.lang.String) ref;
    } else {
      com.google.protobuf.ByteString bs = 
          (com.google.protobuf.ByteString) ref;
      java.lang.String s = bs.toStringUtf8();
      originalId_ = s;
      return s;
    }
  }
  /**
   * optional string originalId = 2;
   * @return The bytes for originalId.
   */
  @java.lang.Override
  public com.google.protobuf.ByteString
      getOriginalIdBytes() {
    java.lang.Object ref = originalId_;
    if (ref instanceof java.lang.String) {
      com.google.protobuf.ByteString b = 
          com.google.protobuf.ByteString.copyFromUtf8(
              (java.lang.String) ref);
      originalId_ = b;
      return b;
    } else {
      return (com.google.protobuf.ByteString) ref;
    }
  }

  public static final int TEXT_FIELD_NUMBER = 3;
  private net.sf.okapi.proto.textunitflat.TextFragment text_;
  /**
   * .TextFragment text = 3;
   * @return Whether the text field is set.
   */
  @java.lang.Override
  public boolean hasText() {
    return text_ != null;
  }
  /**
   * .TextFragment text = 3;
   * @return The text.
   */
  @java.lang.Override
  public net.sf.okapi.proto.textunitflat.TextFragment getText() {
    return text_ == null ? net.sf.okapi.proto.textunitflat.TextFragment.getDefaultInstance() : text_;
  }
  /**
   * .TextFragment text = 3;
   */
  @java.lang.Override
  public net.sf.okapi.proto.textunitflat.TextFragmentOrBuilder getTextOrBuilder() {
    return getText();
  }

  public static final int WHITESPACESTRATEGY_FIELD_NUMBER = 4;
  private int whitespaceStrategy_;
  /**
   * .TextPart.WhitespaceStrategy whitespaceStrategy = 4;
   * @return The enum numeric value on the wire for whitespaceStrategy.
   */
  @java.lang.Override public int getWhitespaceStrategyValue() {
    return whitespaceStrategy_;
  }
  /**
   * .TextPart.WhitespaceStrategy whitespaceStrategy = 4;
   * @return The whitespaceStrategy.
   */
  @java.lang.Override public net.sf.okapi.proto.textunitflat.TextPart.WhitespaceStrategy getWhitespaceStrategy() {
    @SuppressWarnings("deprecation")
    net.sf.okapi.proto.textunitflat.TextPart.WhitespaceStrategy result = net.sf.okapi.proto.textunitflat.TextPart.WhitespaceStrategy.valueOf(whitespaceStrategy_);
    return result == null ? net.sf.okapi.proto.textunitflat.TextPart.WhitespaceStrategy.UNRECOGNIZED : result;
  }

  public static final int PROPERTIES_FIELD_NUMBER = 5;
  private java.util.List properties_;
  /**
   * repeated .Property properties = 5;
   */
  @java.lang.Override
  public java.util.List getPropertiesList() {
    return properties_;
  }
  /**
   * repeated .Property properties = 5;
   */
  @java.lang.Override
  public java.util.List 
      getPropertiesOrBuilderList() {
    return properties_;
  }
  /**
   * repeated .Property properties = 5;
   */
  @java.lang.Override
  public int getPropertiesCount() {
    return properties_.size();
  }
  /**
   * repeated .Property properties = 5;
   */
  @java.lang.Override
  public net.sf.okapi.proto.textunitflat.Property getProperties(int index) {
    return properties_.get(index);
  }
  /**
   * repeated .Property properties = 5;
   */
  @java.lang.Override
  public net.sf.okapi.proto.textunitflat.PropertyOrBuilder getPropertiesOrBuilder(
      int index) {
    return properties_.get(index);
  }

  public static final int SEGMENT_FIELD_NUMBER = 6;
  private boolean segment_;
  /**
   * bool segment = 6;
   * @return The segment.
   */
  @java.lang.Override
  public boolean getSegment() {
    return segment_;
  }

  private byte memoizedIsInitialized = -1;
  @java.lang.Override
  public final boolean isInitialized() {
    byte isInitialized = memoizedIsInitialized;
    if (isInitialized == 1) return true;
    if (isInitialized == 0) return false;

    memoizedIsInitialized = 1;
    return true;
  }

  @java.lang.Override
  public void writeTo(com.google.protobuf.CodedOutputStream output)
                      throws java.io.IOException {
    if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(id_)) {
      com.google.protobuf.GeneratedMessageV3.writeString(output, 1, id_);
    }
    if (((bitField0_ & 0x00000001) != 0)) {
      com.google.protobuf.GeneratedMessageV3.writeString(output, 2, originalId_);
    }
    if (text_ != null) {
      output.writeMessage(3, getText());
    }
    if (whitespaceStrategy_ != net.sf.okapi.proto.textunitflat.TextPart.WhitespaceStrategy.INHERIT.getNumber()) {
      output.writeEnum(4, whitespaceStrategy_);
    }
    for (int i = 0; i < properties_.size(); i++) {
      output.writeMessage(5, properties_.get(i));
    }
    if (segment_ != false) {
      output.writeBool(6, segment_);
    }
    unknownFields.writeTo(output);
  }

  @java.lang.Override
  public int getSerializedSize() {
    int size = memoizedSize;
    if (size != -1) return size;

    size = 0;
    if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(id_)) {
      size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, id_);
    }
    if (((bitField0_ & 0x00000001) != 0)) {
      size += com.google.protobuf.GeneratedMessageV3.computeStringSize(2, originalId_);
    }
    if (text_ != null) {
      size += com.google.protobuf.CodedOutputStream
        .computeMessageSize(3, getText());
    }
    if (whitespaceStrategy_ != net.sf.okapi.proto.textunitflat.TextPart.WhitespaceStrategy.INHERIT.getNumber()) {
      size += com.google.protobuf.CodedOutputStream
        .computeEnumSize(4, whitespaceStrategy_);
    }
    for (int i = 0; i < properties_.size(); i++) {
      size += com.google.protobuf.CodedOutputStream
        .computeMessageSize(5, properties_.get(i));
    }
    if (segment_ != false) {
      size += com.google.protobuf.CodedOutputStream
        .computeBoolSize(6, segment_);
    }
    size += unknownFields.getSerializedSize();
    memoizedSize = size;
    return size;
  }

  @java.lang.Override
  public boolean equals(final java.lang.Object obj) {
    if (obj == this) {
     return true;
    }
    if (!(obj instanceof net.sf.okapi.proto.textunitflat.TextPart)) {
      return super.equals(obj);
    }
    net.sf.okapi.proto.textunitflat.TextPart other = (net.sf.okapi.proto.textunitflat.TextPart) obj;

    if (!getId()
        .equals(other.getId())) return false;
    if (hasOriginalId() != other.hasOriginalId()) return false;
    if (hasOriginalId()) {
      if (!getOriginalId()
          .equals(other.getOriginalId())) return false;
    }
    if (hasText() != other.hasText()) return false;
    if (hasText()) {
      if (!getText()
          .equals(other.getText())) return false;
    }
    if (whitespaceStrategy_ != other.whitespaceStrategy_) return false;
    if (!getPropertiesList()
        .equals(other.getPropertiesList())) return false;
    if (getSegment()
        != other.getSegment()) return false;
    if (!unknownFields.equals(other.unknownFields)) return false;
    return true;
  }

  @java.lang.Override
  public int hashCode() {
    if (memoizedHashCode != 0) {
      return memoizedHashCode;
    }
    int hash = 41;
    hash = (19 * hash) + getDescriptor().hashCode();
    hash = (37 * hash) + ID_FIELD_NUMBER;
    hash = (53 * hash) + getId().hashCode();
    if (hasOriginalId()) {
      hash = (37 * hash) + ORIGINALID_FIELD_NUMBER;
      hash = (53 * hash) + getOriginalId().hashCode();
    }
    if (hasText()) {
      hash = (37 * hash) + TEXT_FIELD_NUMBER;
      hash = (53 * hash) + getText().hashCode();
    }
    hash = (37 * hash) + WHITESPACESTRATEGY_FIELD_NUMBER;
    hash = (53 * hash) + whitespaceStrategy_;
    if (getPropertiesCount() > 0) {
      hash = (37 * hash) + PROPERTIES_FIELD_NUMBER;
      hash = (53 * hash) + getPropertiesList().hashCode();
    }
    hash = (37 * hash) + SEGMENT_FIELD_NUMBER;
    hash = (53 * hash) + com.google.protobuf.Internal.hashBoolean(
        getSegment());
    hash = (29 * hash) + unknownFields.hashCode();
    memoizedHashCode = hash;
    return hash;
  }

  public static net.sf.okapi.proto.textunitflat.TextPart parseFrom(
      java.nio.ByteBuffer data)
      throws com.google.protobuf.InvalidProtocolBufferException {
    return PARSER.parseFrom(data);
  }
  public static net.sf.okapi.proto.textunitflat.TextPart parseFrom(
      java.nio.ByteBuffer data,
      com.google.protobuf.ExtensionRegistryLite extensionRegistry)
      throws com.google.protobuf.InvalidProtocolBufferException {
    return PARSER.parseFrom(data, extensionRegistry);
  }
  public static net.sf.okapi.proto.textunitflat.TextPart parseFrom(
      com.google.protobuf.ByteString data)
      throws com.google.protobuf.InvalidProtocolBufferException {
    return PARSER.parseFrom(data);
  }
  public static net.sf.okapi.proto.textunitflat.TextPart parseFrom(
      com.google.protobuf.ByteString data,
      com.google.protobuf.ExtensionRegistryLite extensionRegistry)
      throws com.google.protobuf.InvalidProtocolBufferException {
    return PARSER.parseFrom(data, extensionRegistry);
  }
  public static net.sf.okapi.proto.textunitflat.TextPart parseFrom(byte[] data)
      throws com.google.protobuf.InvalidProtocolBufferException {
    return PARSER.parseFrom(data);
  }
  public static net.sf.okapi.proto.textunitflat.TextPart parseFrom(
      byte[] data,
      com.google.protobuf.ExtensionRegistryLite extensionRegistry)
      throws com.google.protobuf.InvalidProtocolBufferException {
    return PARSER.parseFrom(data, extensionRegistry);
  }
  public static net.sf.okapi.proto.textunitflat.TextPart parseFrom(java.io.InputStream input)
      throws java.io.IOException {
    return com.google.protobuf.GeneratedMessageV3
        .parseWithIOException(PARSER, input);
  }
  public static net.sf.okapi.proto.textunitflat.TextPart parseFrom(
      java.io.InputStream input,
      com.google.protobuf.ExtensionRegistryLite extensionRegistry)
      throws java.io.IOException {
    return com.google.protobuf.GeneratedMessageV3
        .parseWithIOException(PARSER, input, extensionRegistry);
  }
  public static net.sf.okapi.proto.textunitflat.TextPart parseDelimitedFrom(java.io.InputStream input)
      throws java.io.IOException {
    return com.google.protobuf.GeneratedMessageV3
        .parseDelimitedWithIOException(PARSER, input);
  }
  public static net.sf.okapi.proto.textunitflat.TextPart parseDelimitedFrom(
      java.io.InputStream input,
      com.google.protobuf.ExtensionRegistryLite extensionRegistry)
      throws java.io.IOException {
    return com.google.protobuf.GeneratedMessageV3
        .parseDelimitedWithIOException(PARSER, input, extensionRegistry);
  }
  public static net.sf.okapi.proto.textunitflat.TextPart parseFrom(
      com.google.protobuf.CodedInputStream input)
      throws java.io.IOException {
    return com.google.protobuf.GeneratedMessageV3
        .parseWithIOException(PARSER, input);
  }
  public static net.sf.okapi.proto.textunitflat.TextPart parseFrom(
      com.google.protobuf.CodedInputStream input,
      com.google.protobuf.ExtensionRegistryLite extensionRegistry)
      throws java.io.IOException {
    return com.google.protobuf.GeneratedMessageV3
        .parseWithIOException(PARSER, input, extensionRegistry);
  }

  @java.lang.Override
  public Builder newBuilderForType() { return newBuilder(); }
  public static Builder newBuilder() {
    return DEFAULT_INSTANCE.toBuilder();
  }
  public static Builder newBuilder(net.sf.okapi.proto.textunitflat.TextPart prototype) {
    return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype);
  }
  @java.lang.Override
  public Builder toBuilder() {
    return this == DEFAULT_INSTANCE
        ? new Builder() : new Builder().mergeFrom(this);
  }

  @java.lang.Override
  protected Builder newBuilderForType(
      com.google.protobuf.GeneratedMessageV3.BuilderParent parent) {
    Builder builder = new Builder(parent);
    return builder;
  }
  /**
   * Protobuf type {@code TextPart}
   */
  public static final class Builder extends
      com.google.protobuf.GeneratedMessageV3.Builder implements
      // @@protoc_insertion_point(builder_implements:TextPart)
      net.sf.okapi.proto.textunitflat.TextPartOrBuilder {
    public static final com.google.protobuf.Descriptors.Descriptor
        getDescriptor() {
      return net.sf.okapi.proto.textunitflat.OkapiTextUnitFlatProtoMapping.internal_static_TextPart_descriptor;
    }

    @java.lang.Override
    protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
        internalGetFieldAccessorTable() {
      return net.sf.okapi.proto.textunitflat.OkapiTextUnitFlatProtoMapping.internal_static_TextPart_fieldAccessorTable
          .ensureFieldAccessorsInitialized(
              net.sf.okapi.proto.textunitflat.TextPart.class, net.sf.okapi.proto.textunitflat.TextPart.Builder.class);
    }

    // Construct using net.sf.okapi.proto.textunitflat.TextPart.newBuilder()
    private Builder() {
      maybeForceBuilderInitialization();
    }

    private Builder(
        com.google.protobuf.GeneratedMessageV3.BuilderParent parent) {
      super(parent);
      maybeForceBuilderInitialization();
    }
    private void maybeForceBuilderInitialization() {
      if (com.google.protobuf.GeneratedMessageV3
              .alwaysUseFieldBuilders) {
        getPropertiesFieldBuilder();
      }
    }
    @java.lang.Override
    public Builder clear() {
      super.clear();
      id_ = "";

      originalId_ = "";
      bitField0_ = (bitField0_ & ~0x00000001);
      if (textBuilder_ == null) {
        text_ = null;
      } else {
        text_ = null;
        textBuilder_ = null;
      }
      whitespaceStrategy_ = 0;

      if (propertiesBuilder_ == null) {
        properties_ = java.util.Collections.emptyList();
        bitField0_ = (bitField0_ & ~0x00000002);
      } else {
        propertiesBuilder_.clear();
      }
      segment_ = false;

      return this;
    }

    @java.lang.Override
    public com.google.protobuf.Descriptors.Descriptor
        getDescriptorForType() {
      return net.sf.okapi.proto.textunitflat.OkapiTextUnitFlatProtoMapping.internal_static_TextPart_descriptor;
    }

    @java.lang.Override
    public net.sf.okapi.proto.textunitflat.TextPart getDefaultInstanceForType() {
      return net.sf.okapi.proto.textunitflat.TextPart.getDefaultInstance();
    }

    @java.lang.Override
    public net.sf.okapi.proto.textunitflat.TextPart build() {
      net.sf.okapi.proto.textunitflat.TextPart result = buildPartial();
      if (!result.isInitialized()) {
        throw newUninitializedMessageException(result);
      }
      return result;
    }

    @java.lang.Override
    public net.sf.okapi.proto.textunitflat.TextPart buildPartial() {
      net.sf.okapi.proto.textunitflat.TextPart result = new net.sf.okapi.proto.textunitflat.TextPart(this);
      int from_bitField0_ = bitField0_;
      int to_bitField0_ = 0;
      result.id_ = id_;
      if (((from_bitField0_ & 0x00000001) != 0)) {
        to_bitField0_ |= 0x00000001;
      }
      result.originalId_ = originalId_;
      if (textBuilder_ == null) {
        result.text_ = text_;
      } else {
        result.text_ = textBuilder_.build();
      }
      result.whitespaceStrategy_ = whitespaceStrategy_;
      if (propertiesBuilder_ == null) {
        if (((bitField0_ & 0x00000002) != 0)) {
          properties_ = java.util.Collections.unmodifiableList(properties_);
          bitField0_ = (bitField0_ & ~0x00000002);
        }
        result.properties_ = properties_;
      } else {
        result.properties_ = propertiesBuilder_.build();
      }
      result.segment_ = segment_;
      result.bitField0_ = to_bitField0_;
      onBuilt();
      return result;
    }

    @java.lang.Override
    public Builder clone() {
      return super.clone();
    }
    @java.lang.Override
    public Builder setField(
        com.google.protobuf.Descriptors.FieldDescriptor field,
        java.lang.Object value) {
      return super.setField(field, value);
    }
    @java.lang.Override
    public Builder clearField(
        com.google.protobuf.Descriptors.FieldDescriptor field) {
      return super.clearField(field);
    }
    @java.lang.Override
    public Builder clearOneof(
        com.google.protobuf.Descriptors.OneofDescriptor oneof) {
      return super.clearOneof(oneof);
    }
    @java.lang.Override
    public Builder setRepeatedField(
        com.google.protobuf.Descriptors.FieldDescriptor field,
        int index, java.lang.Object value) {
      return super.setRepeatedField(field, index, value);
    }
    @java.lang.Override
    public Builder addRepeatedField(
        com.google.protobuf.Descriptors.FieldDescriptor field,
        java.lang.Object value) {
      return super.addRepeatedField(field, value);
    }
    @java.lang.Override
    public Builder mergeFrom(com.google.protobuf.Message other) {
      if (other instanceof net.sf.okapi.proto.textunitflat.TextPart) {
        return mergeFrom((net.sf.okapi.proto.textunitflat.TextPart)other);
      } else {
        super.mergeFrom(other);
        return this;
      }
    }

    public Builder mergeFrom(net.sf.okapi.proto.textunitflat.TextPart other) {
      if (other == net.sf.okapi.proto.textunitflat.TextPart.getDefaultInstance()) return this;
      if (!other.getId().isEmpty()) {
        id_ = other.id_;
        onChanged();
      }
      if (other.hasOriginalId()) {
        bitField0_ |= 0x00000001;
        originalId_ = other.originalId_;
        onChanged();
      }
      if (other.hasText()) {
        mergeText(other.getText());
      }
      if (other.whitespaceStrategy_ != 0) {
        setWhitespaceStrategyValue(other.getWhitespaceStrategyValue());
      }
      if (propertiesBuilder_ == null) {
        if (!other.properties_.isEmpty()) {
          if (properties_.isEmpty()) {
            properties_ = other.properties_;
            bitField0_ = (bitField0_ & ~0x00000002);
          } else {
            ensurePropertiesIsMutable();
            properties_.addAll(other.properties_);
          }
          onChanged();
        }
      } else {
        if (!other.properties_.isEmpty()) {
          if (propertiesBuilder_.isEmpty()) {
            propertiesBuilder_.dispose();
            propertiesBuilder_ = null;
            properties_ = other.properties_;
            bitField0_ = (bitField0_ & ~0x00000002);
            propertiesBuilder_ = 
              com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders ?
                 getPropertiesFieldBuilder() : null;
          } else {
            propertiesBuilder_.addAllMessages(other.properties_);
          }
        }
      }
      if (other.getSegment() != false) {
        setSegment(other.getSegment());
      }
      this.mergeUnknownFields(other.unknownFields);
      onChanged();
      return this;
    }

    @java.lang.Override
    public final boolean isInitialized() {
      return true;
    }

    @java.lang.Override
    public Builder mergeFrom(
        com.google.protobuf.CodedInputStream input,
        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
        throws java.io.IOException {
      net.sf.okapi.proto.textunitflat.TextPart parsedMessage = null;
      try {
        parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry);
      } catch (com.google.protobuf.InvalidProtocolBufferException e) {
        parsedMessage = (net.sf.okapi.proto.textunitflat.TextPart) e.getUnfinishedMessage();
        throw e.unwrapIOException();
      } finally {
        if (parsedMessage != null) {
          mergeFrom(parsedMessage);
        }
      }
      return this;
    }
    private int bitField0_;

    private java.lang.Object id_ = "";
    /**
     * string id = 1;
     * @return The id.
     */
    public java.lang.String getId() {
      java.lang.Object ref = id_;
      if (!(ref instanceof java.lang.String)) {
        com.google.protobuf.ByteString bs =
            (com.google.protobuf.ByteString) ref;
        java.lang.String s = bs.toStringUtf8();
        id_ = s;
        return s;
      } else {
        return (java.lang.String) ref;
      }
    }
    /**
     * string id = 1;
     * @return The bytes for id.
     */
    public com.google.protobuf.ByteString
        getIdBytes() {
      java.lang.Object ref = id_;
      if (ref instanceof String) {
        com.google.protobuf.ByteString b = 
            com.google.protobuf.ByteString.copyFromUtf8(
                (java.lang.String) ref);
        id_ = b;
        return b;
      } else {
        return (com.google.protobuf.ByteString) ref;
      }
    }
    /**
     * string id = 1;
     * @param value The id to set.
     * @return This builder for chaining.
     */
    public Builder setId(
        java.lang.String value) {
      if (value == null) {
    throw new NullPointerException();
  }
  
      id_ = value;
      onChanged();
      return this;
    }
    /**
     * string id = 1;
     * @return This builder for chaining.
     */
    public Builder clearId() {
      
      id_ = getDefaultInstance().getId();
      onChanged();
      return this;
    }
    /**
     * string id = 1;
     * @param value The bytes for id to set.
     * @return This builder for chaining.
     */
    public Builder setIdBytes(
        com.google.protobuf.ByteString value) {
      if (value == null) {
    throw new NullPointerException();
  }
  checkByteStringIsUtf8(value);
      
      id_ = value;
      onChanged();
      return this;
    }

    private java.lang.Object originalId_ = "";
    /**
     * optional string originalId = 2;
     * @return Whether the originalId field is set.
     */
    public boolean hasOriginalId() {
      return ((bitField0_ & 0x00000001) != 0);
    }
    /**
     * optional string originalId = 2;
     * @return The originalId.
     */
    public java.lang.String getOriginalId() {
      java.lang.Object ref = originalId_;
      if (!(ref instanceof java.lang.String)) {
        com.google.protobuf.ByteString bs =
            (com.google.protobuf.ByteString) ref;
        java.lang.String s = bs.toStringUtf8();
        originalId_ = s;
        return s;
      } else {
        return (java.lang.String) ref;
      }
    }
    /**
     * optional string originalId = 2;
     * @return The bytes for originalId.
     */
    public com.google.protobuf.ByteString
        getOriginalIdBytes() {
      java.lang.Object ref = originalId_;
      if (ref instanceof String) {
        com.google.protobuf.ByteString b = 
            com.google.protobuf.ByteString.copyFromUtf8(
                (java.lang.String) ref);
        originalId_ = b;
        return b;
      } else {
        return (com.google.protobuf.ByteString) ref;
      }
    }
    /**
     * optional string originalId = 2;
     * @param value The originalId to set.
     * @return This builder for chaining.
     */
    public Builder setOriginalId(
        java.lang.String value) {
      if (value == null) {
    throw new NullPointerException();
  }
  bitField0_ |= 0x00000001;
      originalId_ = value;
      onChanged();
      return this;
    }
    /**
     * optional string originalId = 2;
     * @return This builder for chaining.
     */
    public Builder clearOriginalId() {
      bitField0_ = (bitField0_ & ~0x00000001);
      originalId_ = getDefaultInstance().getOriginalId();
      onChanged();
      return this;
    }
    /**
     * optional string originalId = 2;
     * @param value The bytes for originalId to set.
     * @return This builder for chaining.
     */
    public Builder setOriginalIdBytes(
        com.google.protobuf.ByteString value) {
      if (value == null) {
    throw new NullPointerException();
  }
  checkByteStringIsUtf8(value);
      bitField0_ |= 0x00000001;
      originalId_ = value;
      onChanged();
      return this;
    }

    private net.sf.okapi.proto.textunitflat.TextFragment text_;
    private com.google.protobuf.SingleFieldBuilderV3<
        net.sf.okapi.proto.textunitflat.TextFragment, net.sf.okapi.proto.textunitflat.TextFragment.Builder, net.sf.okapi.proto.textunitflat.TextFragmentOrBuilder> textBuilder_;
    /**
     * .TextFragment text = 3;
     * @return Whether the text field is set.
     */
    public boolean hasText() {
      return textBuilder_ != null || text_ != null;
    }
    /**
     * .TextFragment text = 3;
     * @return The text.
     */
    public net.sf.okapi.proto.textunitflat.TextFragment getText() {
      if (textBuilder_ == null) {
        return text_ == null ? net.sf.okapi.proto.textunitflat.TextFragment.getDefaultInstance() : text_;
      } else {
        return textBuilder_.getMessage();
      }
    }
    /**
     * .TextFragment text = 3;
     */
    public Builder setText(net.sf.okapi.proto.textunitflat.TextFragment value) {
      if (textBuilder_ == null) {
        if (value == null) {
          throw new NullPointerException();
        }
        text_ = value;
        onChanged();
      } else {
        textBuilder_.setMessage(value);
      }

      return this;
    }
    /**
     * .TextFragment text = 3;
     */
    public Builder setText(
        net.sf.okapi.proto.textunitflat.TextFragment.Builder builderForValue) {
      if (textBuilder_ == null) {
        text_ = builderForValue.build();
        onChanged();
      } else {
        textBuilder_.setMessage(builderForValue.build());
      }

      return this;
    }
    /**
     * .TextFragment text = 3;
     */
    public Builder mergeText(net.sf.okapi.proto.textunitflat.TextFragment value) {
      if (textBuilder_ == null) {
        if (text_ != null) {
          text_ =
            net.sf.okapi.proto.textunitflat.TextFragment.newBuilder(text_).mergeFrom(value).buildPartial();
        } else {
          text_ = value;
        }
        onChanged();
      } else {
        textBuilder_.mergeFrom(value);
      }

      return this;
    }
    /**
     * .TextFragment text = 3;
     */
    public Builder clearText() {
      if (textBuilder_ == null) {
        text_ = null;
        onChanged();
      } else {
        text_ = null;
        textBuilder_ = null;
      }

      return this;
    }
    /**
     * .TextFragment text = 3;
     */
    public net.sf.okapi.proto.textunitflat.TextFragment.Builder getTextBuilder() {
      
      onChanged();
      return getTextFieldBuilder().getBuilder();
    }
    /**
     * .TextFragment text = 3;
     */
    public net.sf.okapi.proto.textunitflat.TextFragmentOrBuilder getTextOrBuilder() {
      if (textBuilder_ != null) {
        return textBuilder_.getMessageOrBuilder();
      } else {
        return text_ == null ?
            net.sf.okapi.proto.textunitflat.TextFragment.getDefaultInstance() : text_;
      }
    }
    /**
     * .TextFragment text = 3;
     */
    private com.google.protobuf.SingleFieldBuilderV3<
        net.sf.okapi.proto.textunitflat.TextFragment, net.sf.okapi.proto.textunitflat.TextFragment.Builder, net.sf.okapi.proto.textunitflat.TextFragmentOrBuilder> 
        getTextFieldBuilder() {
      if (textBuilder_ == null) {
        textBuilder_ = new com.google.protobuf.SingleFieldBuilderV3<
            net.sf.okapi.proto.textunitflat.TextFragment, net.sf.okapi.proto.textunitflat.TextFragment.Builder, net.sf.okapi.proto.textunitflat.TextFragmentOrBuilder>(
                getText(),
                getParentForChildren(),
                isClean());
        text_ = null;
      }
      return textBuilder_;
    }

    private int whitespaceStrategy_ = 0;
    /**
     * .TextPart.WhitespaceStrategy whitespaceStrategy = 4;
     * @return The enum numeric value on the wire for whitespaceStrategy.
     */
    @java.lang.Override public int getWhitespaceStrategyValue() {
      return whitespaceStrategy_;
    }
    /**
     * .TextPart.WhitespaceStrategy whitespaceStrategy = 4;
     * @param value The enum numeric value on the wire for whitespaceStrategy to set.
     * @return This builder for chaining.
     */
    public Builder setWhitespaceStrategyValue(int value) {
      
      whitespaceStrategy_ = value;
      onChanged();
      return this;
    }
    /**
     * .TextPart.WhitespaceStrategy whitespaceStrategy = 4;
     * @return The whitespaceStrategy.
     */
    @java.lang.Override
    public net.sf.okapi.proto.textunitflat.TextPart.WhitespaceStrategy getWhitespaceStrategy() {
      @SuppressWarnings("deprecation")
      net.sf.okapi.proto.textunitflat.TextPart.WhitespaceStrategy result = net.sf.okapi.proto.textunitflat.TextPart.WhitespaceStrategy.valueOf(whitespaceStrategy_);
      return result == null ? net.sf.okapi.proto.textunitflat.TextPart.WhitespaceStrategy.UNRECOGNIZED : result;
    }
    /**
     * .TextPart.WhitespaceStrategy whitespaceStrategy = 4;
     * @param value The whitespaceStrategy to set.
     * @return This builder for chaining.
     */
    public Builder setWhitespaceStrategy(net.sf.okapi.proto.textunitflat.TextPart.WhitespaceStrategy value) {
      if (value == null) {
        throw new NullPointerException();
      }
      
      whitespaceStrategy_ = value.getNumber();
      onChanged();
      return this;
    }
    /**
     * .TextPart.WhitespaceStrategy whitespaceStrategy = 4;
     * @return This builder for chaining.
     */
    public Builder clearWhitespaceStrategy() {
      
      whitespaceStrategy_ = 0;
      onChanged();
      return this;
    }

    private java.util.List properties_ =
      java.util.Collections.emptyList();
    private void ensurePropertiesIsMutable() {
      if (!((bitField0_ & 0x00000002) != 0)) {
        properties_ = new java.util.ArrayList(properties_);
        bitField0_ |= 0x00000002;
       }
    }

    private com.google.protobuf.RepeatedFieldBuilderV3<
        net.sf.okapi.proto.textunitflat.Property, net.sf.okapi.proto.textunitflat.Property.Builder, net.sf.okapi.proto.textunitflat.PropertyOrBuilder> propertiesBuilder_;

    /**
     * repeated .Property properties = 5;
     */
    public java.util.List getPropertiesList() {
      if (propertiesBuilder_ == null) {
        return java.util.Collections.unmodifiableList(properties_);
      } else {
        return propertiesBuilder_.getMessageList();
      }
    }
    /**
     * repeated .Property properties = 5;
     */
    public int getPropertiesCount() {
      if (propertiesBuilder_ == null) {
        return properties_.size();
      } else {
        return propertiesBuilder_.getCount();
      }
    }
    /**
     * repeated .Property properties = 5;
     */
    public net.sf.okapi.proto.textunitflat.Property getProperties(int index) {
      if (propertiesBuilder_ == null) {
        return properties_.get(index);
      } else {
        return propertiesBuilder_.getMessage(index);
      }
    }
    /**
     * repeated .Property properties = 5;
     */
    public Builder setProperties(
        int index, net.sf.okapi.proto.textunitflat.Property value) {
      if (propertiesBuilder_ == null) {
        if (value == null) {
          throw new NullPointerException();
        }
        ensurePropertiesIsMutable();
        properties_.set(index, value);
        onChanged();
      } else {
        propertiesBuilder_.setMessage(index, value);
      }
      return this;
    }
    /**
     * repeated .Property properties = 5;
     */
    public Builder setProperties(
        int index, net.sf.okapi.proto.textunitflat.Property.Builder builderForValue) {
      if (propertiesBuilder_ == null) {
        ensurePropertiesIsMutable();
        properties_.set(index, builderForValue.build());
        onChanged();
      } else {
        propertiesBuilder_.setMessage(index, builderForValue.build());
      }
      return this;
    }
    /**
     * repeated .Property properties = 5;
     */
    public Builder addProperties(net.sf.okapi.proto.textunitflat.Property value) {
      if (propertiesBuilder_ == null) {
        if (value == null) {
          throw new NullPointerException();
        }
        ensurePropertiesIsMutable();
        properties_.add(value);
        onChanged();
      } else {
        propertiesBuilder_.addMessage(value);
      }
      return this;
    }
    /**
     * repeated .Property properties = 5;
     */
    public Builder addProperties(
        int index, net.sf.okapi.proto.textunitflat.Property value) {
      if (propertiesBuilder_ == null) {
        if (value == null) {
          throw new NullPointerException();
        }
        ensurePropertiesIsMutable();
        properties_.add(index, value);
        onChanged();
      } else {
        propertiesBuilder_.addMessage(index, value);
      }
      return this;
    }
    /**
     * repeated .Property properties = 5;
     */
    public Builder addProperties(
        net.sf.okapi.proto.textunitflat.Property.Builder builderForValue) {
      if (propertiesBuilder_ == null) {
        ensurePropertiesIsMutable();
        properties_.add(builderForValue.build());
        onChanged();
      } else {
        propertiesBuilder_.addMessage(builderForValue.build());
      }
      return this;
    }
    /**
     * repeated .Property properties = 5;
     */
    public Builder addProperties(
        int index, net.sf.okapi.proto.textunitflat.Property.Builder builderForValue) {
      if (propertiesBuilder_ == null) {
        ensurePropertiesIsMutable();
        properties_.add(index, builderForValue.build());
        onChanged();
      } else {
        propertiesBuilder_.addMessage(index, builderForValue.build());
      }
      return this;
    }
    /**
     * repeated .Property properties = 5;
     */
    public Builder addAllProperties(
        java.lang.Iterable values) {
      if (propertiesBuilder_ == null) {
        ensurePropertiesIsMutable();
        com.google.protobuf.AbstractMessageLite.Builder.addAll(
            values, properties_);
        onChanged();
      } else {
        propertiesBuilder_.addAllMessages(values);
      }
      return this;
    }
    /**
     * repeated .Property properties = 5;
     */
    public Builder clearProperties() {
      if (propertiesBuilder_ == null) {
        properties_ = java.util.Collections.emptyList();
        bitField0_ = (bitField0_ & ~0x00000002);
        onChanged();
      } else {
        propertiesBuilder_.clear();
      }
      return this;
    }
    /**
     * repeated .Property properties = 5;
     */
    public Builder removeProperties(int index) {
      if (propertiesBuilder_ == null) {
        ensurePropertiesIsMutable();
        properties_.remove(index);
        onChanged();
      } else {
        propertiesBuilder_.remove(index);
      }
      return this;
    }
    /**
     * repeated .Property properties = 5;
     */
    public net.sf.okapi.proto.textunitflat.Property.Builder getPropertiesBuilder(
        int index) {
      return getPropertiesFieldBuilder().getBuilder(index);
    }
    /**
     * repeated .Property properties = 5;
     */
    public net.sf.okapi.proto.textunitflat.PropertyOrBuilder getPropertiesOrBuilder(
        int index) {
      if (propertiesBuilder_ == null) {
        return properties_.get(index);  } else {
        return propertiesBuilder_.getMessageOrBuilder(index);
      }
    }
    /**
     * repeated .Property properties = 5;
     */
    public java.util.List 
         getPropertiesOrBuilderList() {
      if (propertiesBuilder_ != null) {
        return propertiesBuilder_.getMessageOrBuilderList();
      } else {
        return java.util.Collections.unmodifiableList(properties_);
      }
    }
    /**
     * repeated .Property properties = 5;
     */
    public net.sf.okapi.proto.textunitflat.Property.Builder addPropertiesBuilder() {
      return getPropertiesFieldBuilder().addBuilder(
          net.sf.okapi.proto.textunitflat.Property.getDefaultInstance());
    }
    /**
     * repeated .Property properties = 5;
     */
    public net.sf.okapi.proto.textunitflat.Property.Builder addPropertiesBuilder(
        int index) {
      return getPropertiesFieldBuilder().addBuilder(
          index, net.sf.okapi.proto.textunitflat.Property.getDefaultInstance());
    }
    /**
     * repeated .Property properties = 5;
     */
    public java.util.List 
         getPropertiesBuilderList() {
      return getPropertiesFieldBuilder().getBuilderList();
    }
    private com.google.protobuf.RepeatedFieldBuilderV3<
        net.sf.okapi.proto.textunitflat.Property, net.sf.okapi.proto.textunitflat.Property.Builder, net.sf.okapi.proto.textunitflat.PropertyOrBuilder> 
        getPropertiesFieldBuilder() {
      if (propertiesBuilder_ == null) {
        propertiesBuilder_ = new com.google.protobuf.RepeatedFieldBuilderV3<
            net.sf.okapi.proto.textunitflat.Property, net.sf.okapi.proto.textunitflat.Property.Builder, net.sf.okapi.proto.textunitflat.PropertyOrBuilder>(
                properties_,
                ((bitField0_ & 0x00000002) != 0),
                getParentForChildren(),
                isClean());
        properties_ = null;
      }
      return propertiesBuilder_;
    }

    private boolean segment_ ;
    /**
     * bool segment = 6;
     * @return The segment.
     */
    @java.lang.Override
    public boolean getSegment() {
      return segment_;
    }
    /**
     * bool segment = 6;
     * @param value The segment to set.
     * @return This builder for chaining.
     */
    public Builder setSegment(boolean value) {
      
      segment_ = value;
      onChanged();
      return this;
    }
    /**
     * bool segment = 6;
     * @return This builder for chaining.
     */
    public Builder clearSegment() {
      
      segment_ = false;
      onChanged();
      return this;
    }
    @java.lang.Override
    public final Builder setUnknownFields(
        final com.google.protobuf.UnknownFieldSet unknownFields) {
      return super.setUnknownFields(unknownFields);
    }

    @java.lang.Override
    public final Builder mergeUnknownFields(
        final com.google.protobuf.UnknownFieldSet unknownFields) {
      return super.mergeUnknownFields(unknownFields);
    }


    // @@protoc_insertion_point(builder_scope:TextPart)
  }

  // @@protoc_insertion_point(class_scope:TextPart)
  private static final net.sf.okapi.proto.textunitflat.TextPart DEFAULT_INSTANCE;
  static {
    DEFAULT_INSTANCE = new net.sf.okapi.proto.textunitflat.TextPart();
  }

  public static net.sf.okapi.proto.textunitflat.TextPart getDefaultInstance() {
    return DEFAULT_INSTANCE;
  }

  private static final com.google.protobuf.Parser
      PARSER = new com.google.protobuf.AbstractParser() {
    @java.lang.Override
    public TextPart parsePartialFrom(
        com.google.protobuf.CodedInputStream input,
        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
        throws com.google.protobuf.InvalidProtocolBufferException {
      return new TextPart(input, extensionRegistry);
    }
  };

  public static com.google.protobuf.Parser parser() {
    return PARSER;
  }

  @java.lang.Override
  public com.google.protobuf.Parser getParserForType() {
    return PARSER;
  }

  @java.lang.Override
  public net.sf.okapi.proto.textunitflat.TextPart getDefaultInstanceForType() {
    return DEFAULT_INSTANCE;
  }

}





© 2015 - 2025 Weber Informatics LLC | Privacy Policy