net.gdface.facedb.thrift.client.SearchResult Maven / Gradle / Ivy
// Automatically generated by the Thrifty compiler; do not edit!
// Generated on: 2019-09-24T07:53:45.889Z
// Source: J:\facedb\FaceDb.thrift at 95:1
package net.gdface.facedb.thrift.client;
import com.microsoft.thrifty.Adapter;
import com.microsoft.thrifty.Struct;
import com.microsoft.thrifty.StructBuilder;
import com.microsoft.thrifty.TType;
import com.microsoft.thrifty.ThriftField;
import com.microsoft.thrifty.protocol.FieldMetadata;
import com.microsoft.thrifty.protocol.ListMetadata;
import com.microsoft.thrifty.protocol.Protocol;
import com.microsoft.thrifty.util.ProtocolUtil;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import javax.annotation.Generated;
@Generated(
value = "com.microsoft.thrifty.gen.ThriftyCodeGenerator",
comments = "https://github.com/microsoft/thrifty"
)
public final class SearchResult implements Struct {
public static final Adapter ADAPTER = new SearchResultAdapter();
@ThriftField(
fieldId = 1,
isOptional = true
)
public final List featureIds;
@ThriftField(
fieldId = 2,
isOptional = true
)
public final List similartys;
private SearchResult(Builder builder) {
this.featureIds = builder.featureIds == null ? null : Collections.unmodifiableList(builder.featureIds);
this.similartys = builder.similartys == null ? null : Collections.unmodifiableList(builder.similartys);
}
@Override
public boolean equals(Object other) {
if (this == other) return true;
if (other == null) return false;
if (!(other instanceof SearchResult)) return false;
SearchResult that = (SearchResult) other;
return (this.featureIds == that.featureIds || (this.featureIds != null && this.featureIds.equals(that.featureIds)))
&& (this.similartys == that.similartys || (this.similartys != null && this.similartys.equals(that.similartys)));
}
@Override
public int hashCode() {
int code = 16777619;
code ^= (this.featureIds == null) ? 0 : this.featureIds.hashCode();
code *= 0x811c9dc5;
code ^= (this.similartys == null) ? 0 : this.similartys.hashCode();
code *= 0x811c9dc5;
return code;
}
@Override
public String toString() {
return "SearchResult{featureIds=" + this.featureIds + ", similartys=" + this.similartys + "}";
}
@Override
public void write(Protocol protocol) throws IOException {
ADAPTER.write(protocol, this);
}
public static final class Builder implements StructBuilder {
private List featureIds;
private List similartys;
public Builder() {
}
public Builder(SearchResult struct) {
this.featureIds = struct.featureIds;
this.similartys = struct.similartys;
}
public Builder featureIds(List featureIds) {
this.featureIds = featureIds;
return this;
}
public Builder similartys(List similartys) {
this.similartys = similartys;
return this;
}
@Override
public SearchResult build() {
return new SearchResult(this);
}
@Override
public void reset() {
this.featureIds = null;
this.similartys = null;
}
}
private static final class SearchResultAdapter implements Adapter {
@Override
public void write(Protocol protocol, SearchResult struct) throws IOException {
protocol.writeStructBegin("SearchResult");
if (struct.featureIds != null) {
protocol.writeFieldBegin("featureIds", 1, TType.LIST);
protocol.writeListBegin(TType.STRING, struct.featureIds.size());
for (String item0 : struct.featureIds) {
protocol.writeString(item0);
}
protocol.writeListEnd();
protocol.writeFieldEnd();
}
if (struct.similartys != null) {
protocol.writeFieldBegin("similartys", 2, TType.LIST);
protocol.writeListBegin(TType.DOUBLE, struct.similartys.size());
for (Double item0 : struct.similartys) {
protocol.writeDouble(item0);
}
protocol.writeListEnd();
protocol.writeFieldEnd();
}
protocol.writeFieldStop();
protocol.writeStructEnd();
}
@Override
public SearchResult read(Protocol protocol, Builder builder) throws IOException {
protocol.readStructBegin();
while (true) {
FieldMetadata field = protocol.readFieldBegin();
if (field.typeId == TType.STOP) {
break;
}
switch (field.fieldId) {
case 1: {
if (field.typeId == TType.LIST) {
ListMetadata listMetadata0 = protocol.readListBegin();
List value = new ArrayList(listMetadata0.size);
for (int i0 = 0; i0 < listMetadata0.size; ++i0) {
String item0 = protocol.readString();
value.add(item0);
}
protocol.readListEnd();
builder.featureIds(value);
} else {
ProtocolUtil.skip(protocol, field.typeId);
}
}
break;
case 2: {
if (field.typeId == TType.LIST) {
ListMetadata listMetadata0 = protocol.readListBegin();
List value = new ArrayList(listMetadata0.size);
for (int i0 = 0; i0 < listMetadata0.size; ++i0) {
double item0 = protocol.readDouble();
value.add(item0);
}
protocol.readListEnd();
builder.similartys(value);
} else {
ProtocolUtil.skip(protocol, field.typeId);
}
}
break;
default: {
ProtocolUtil.skip(protocol, field.typeId);
}
break;
}
protocol.readFieldEnd();
}
protocol.readStructEnd();
return builder.build();
}
@Override
public SearchResult read(Protocol protocol) throws IOException {
return read(protocol, new Builder());
}
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy