@java.lang.Override public Builder newBuilderForType() { return newBuilder(); }
@java.lang.Override public int getSerializedSize() { int size = memoizedSize; if (size != -1) return size; size = 0; { int dataSize = 0; for (int i = 0; i < phrases_.size(); i++) { dataSize += computeStringSizeNoTag(phrases_.getRaw(i)); } size += dataSize; size += 1 * getPhrasesList().size(); } size += unknownFields.getSerializedSize(); memoizedSize = size; return size; }
@java.lang.Override public com.google.cloud.speech.v1.SpeechContext getDefaultInstanceForType() { return com.google.cloud.speech.v1.SpeechContext.getDefaultInstance(); }
@java.lang.Override public int hashCode() { if (memoizedHashCode != 0) { return memoizedHashCode; } int hash = 41; hash = (19 * hash) + getDescriptor().hashCode(); if (getPhrasesCount() > 0) { hash = (37 * hash) + PHRASES_FIELD_NUMBER; hash = (53 * hash) + getPhrasesList().hashCode(); } hash = (29 * hash) + unknownFields.hashCode(); memoizedHashCode = hash; return hash; }
if (!parseUnknownFieldProto3(input, unknownFields, extensionRegistry, tag)) { done = true; makeExtensionsImmutable();
@java.lang.Override public boolean equals(final java.lang.Object obj) { if (obj == this) { return true; } if (!(obj instanceof com.google.cloud.speech.v1.SpeechContext)) { return super.equals(obj); } com.google.cloud.speech.v1.SpeechContext other = (com.google.cloud.speech.v1.SpeechContext) obj; boolean result = true; result = result && getPhrasesList().equals(other.getPhrasesList()); result = result && unknownFields.equals(other.unknownFields); return result; }
@java.lang.Override public com.google.cloud.speech.v1.SpeechContext buildPartial() { com.google.cloud.speech.v1.SpeechContext result = new com.google.cloud.speech.v1.SpeechContext(this); int from_bitField0_ = bitField0_; if (((bitField0_ & 0x00000001) == 0x00000001)) { phrases_ = phrases_.getUnmodifiableView(); bitField0_ = (bitField0_ & ~0x00000001); } result.phrases_ = phrases_; onBuilt(); return result; }
@java.lang.Override public com.google.cloud.speech.v1.SpeechContext build() { com.google.cloud.speech.v1.SpeechContext result = buildPartial(); if (!result.isInitialized()) { throw newUninitializedMessageException(result); } return result; }
/** * Initialize speechContexts if needed, by getting all the phrases used * by the action handlers to detect commands to handle. * Inserts all speechContexts to the <tt>RecognitionConfig.Builder</tt>. * @param builder the builder where to add speech contexts. */ private void addSpeechContexts(RecognitionConfig.Builder builder) { if (speechContexts == null) { speechContexts = new ArrayList<>(); ActionServicesHandler.getInstance().getPhrases() .stream().map(ph -> speechContexts.add( SpeechContext.newBuilder().addPhrases(ph).build())); } speechContexts.stream().map(ctx -> builder.addSpeechContexts(ctx)); }
/** * * * <pre> * *Optional* array of [SpeechContext][google.cloud.speech.v1.SpeechContext]. * A means to provide context to assist the speech recognition. For more * information, see [Phrase Hints](/speech-to-text/docs/basics#phrase-hints). * </pre> * * <code>repeated .google.cloud.speech.v1.SpeechContext speech_contexts = 6;</code> */ public com.google.cloud.speech.v1.SpeechContext.Builder addSpeechContextsBuilder() { return getSpeechContextsFieldBuilder() .addBuilder(com.google.cloud.speech.v1.SpeechContext.getDefaultInstance()); } /**
/** * * * <pre> * *Optional* array of [SpeechContext][google.cloud.speech.v1.SpeechContext]. * A means to provide context to assist the speech recognition. For more * information, see [Phrase Hints](/speech-to-text/docs/basics#phrase-hints). * </pre> * * <code>repeated .google.cloud.speech.v1.SpeechContext speech_contexts = 6;</code> */ public com.google.cloud.speech.v1.SpeechContext.Builder addSpeechContextsBuilder(int index) { return getSpeechContextsFieldBuilder() .addBuilder(index, com.google.cloud.speech.v1.SpeechContext.getDefaultInstance()); } /**
public Builder mergeFrom(com.google.cloud.speech.v1.SpeechContext other) { if (other == com.google.cloud.speech.v1.SpeechContext.getDefaultInstance()) return this; if (!other.phrases_.isEmpty()) { if (phrases_.isEmpty()) { phrases_ = other.phrases_; bitField0_ = (bitField0_ & ~0x00000001); } else { ensurePhrasesIsMutable(); phrases_.addAll(other.phrases_); } onChanged(); } this.mergeUnknownFields(other.unknownFields); onChanged(); return this; }