/** * * * <pre> * RGB components of the color. * </pre> * * <code>.google.type.Color color = 1;</code> */ public com.google.type.Color getColor() { return color_ == null ? com.google.type.Color.getDefaultInstance() : color_; } /**
/** * * * <pre> * RGB components of the color. * </pre> * * <code>.google.type.Color color = 1;</code> */ public Builder mergeColor(com.google.type.Color value) { if (colorBuilder_ == null) { if (color_ != null) { color_ = com.google.type.Color.newBuilder(color_).mergeFrom(value).buildPartial(); } else { color_ = value; } onChanged(); } else { colorBuilder_.mergeFrom(value); } return this; } /**
public Builder mergeFrom(com.google.type.Color other) { if (other == com.google.type.Color.getDefaultInstance()) return this; if (other.getRed() != 0F) { setRed(other.getRed()); } if (other.getGreen() != 0F) { setGreen(other.getGreen()); } if (other.getBlue() != 0F) { setBlue(other.getBlue()); } if (other.hasAlpha()) { mergeAlpha(other.getAlpha()); } onChanged(); return this; }
@java.lang.Override public int hashCode() { if (memoizedHashCode != 0) { return memoizedHashCode; } int hash = 41; hash = (19 * hash) + getDescriptor().hashCode(); if (hasColor()) { hash = (37 * hash) + COLOR_FIELD_NUMBER; hash = (53 * hash) + getColor().hashCode(); } hash = (37 * hash) + SCORE_FIELD_NUMBER; hash = (53 * hash) + java.lang.Float.floatToIntBits(getScore()); hash = (37 * hash) + PIXEL_FRACTION_FIELD_NUMBER; hash = (53 * hash) + java.lang.Float.floatToIntBits(getPixelFraction()); hash = (29 * hash) + unknownFields.hashCode(); memoizedHashCode = hash; return hash; }
@java.lang.Override public boolean equals(final java.lang.Object obj) { if (obj == this) { return true; } if (!(obj instanceof com.google.cloud.vision.v1p2beta1.ColorInfo)) { return super.equals(obj); } com.google.cloud.vision.v1p2beta1.ColorInfo other = (com.google.cloud.vision.v1p2beta1.ColorInfo) obj; boolean result = true; result = result && (hasColor() == other.hasColor()); if (hasColor()) { result = result && getColor().equals(other.getColor()); } result = result && (java.lang.Float.floatToIntBits(getScore()) == java.lang.Float.floatToIntBits(other.getScore())); result = result && (java.lang.Float.floatToIntBits(getPixelFraction()) == java.lang.Float.floatToIntBits(other.getPixelFraction())); result = result && unknownFields.equals(other.unknownFields); return result; }
@Override public void serverStreamingRecognize( final Color color, final StreamObserver<Money> responseObserver) { if (color.getRed() < 0) { responseObserver.onError( Status.INVALID_ARGUMENT.withDescription("red must be positive").asRuntimeException()); if (color.getGreen() > 0) { new Thread(runnable).start(); } else {
public static Builder newBuilder() { return DEFAULT_INSTANCE.toBuilder(); } public static Builder newBuilder(com.google.type.Color prototype) {
@Override public Void answer(InvocationOnMock invocation) { Color color = invocation.getArgument(0); StreamObserver<Money> observer = invocation.getArgument(1); observer.onNext( Money.newBuilder() .setCurrencyCode("USD") .setUnits((long) (color.getRed() * 255)) .build()); observer.onCompleted(); return null; } })
@Override public void run() { try { Thread.sleep((long) color.getGreen()); } catch (InterruptedException e) { Thread.interrupted(); return; } responseObserver.onNext(convert(color)); responseObserver.onCompleted(); } };
@java.lang.Override public boolean equals(final java.lang.Object obj) { if (obj == this) { return true; } if (!(obj instanceof com.google.type.Color)) { return super.equals(obj); } com.google.type.Color other = (com.google.type.Color) obj; boolean result = true; result = result && ( java.lang.Float.floatToIntBits(getRed()) == java.lang.Float.floatToIntBits( other.getRed())); result = result && ( java.lang.Float.floatToIntBits(getGreen()) == java.lang.Float.floatToIntBits( other.getGreen())); result = result && ( java.lang.Float.floatToIntBits(getBlue()) == java.lang.Float.floatToIntBits( other.getBlue())); result = result && (hasAlpha() == other.hasAlpha()); if (hasAlpha()) { result = result && getAlpha() .equals(other.getAlpha()); } return result; }
@java.lang.Override public int hashCode() { if (memoizedHashCode != 0) { return memoizedHashCode; } int hash = 41; hash = (19 * hash) + getDescriptor().hashCode(); if (hasColor()) { hash = (37 * hash) + COLOR_FIELD_NUMBER; hash = (53 * hash) + getColor().hashCode(); } hash = (37 * hash) + SCORE_FIELD_NUMBER; hash = (53 * hash) + java.lang.Float.floatToIntBits(getScore()); hash = (37 * hash) + PIXEL_FRACTION_FIELD_NUMBER; hash = (53 * hash) + java.lang.Float.floatToIntBits(getPixelFraction()); hash = (29 * hash) + unknownFields.hashCode(); memoizedHashCode = hash; return hash; }
@java.lang.Override public boolean equals(final java.lang.Object obj) { if (obj == this) { return true; } if (!(obj instanceof com.google.cloud.vision.v1p3beta1.ColorInfo)) { return super.equals(obj); } com.google.cloud.vision.v1p3beta1.ColorInfo other = (com.google.cloud.vision.v1p3beta1.ColorInfo) obj; boolean result = true; result = result && (hasColor() == other.hasColor()); if (hasColor()) { result = result && getColor().equals(other.getColor()); } result = result && (java.lang.Float.floatToIntBits(getScore()) == java.lang.Float.floatToIntBits(other.getScore())); result = result && (java.lang.Float.floatToIntBits(getPixelFraction()) == java.lang.Float.floatToIntBits(other.getPixelFraction())); result = result && unknownFields.equals(other.unknownFields); return result; }
public static Builder newBuilder(com.google.type.Color prototype) { return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); } public Builder toBuilder() {
private static Money convert(Color color) { Money result = Money.newBuilder().setCurrencyCode("USD").setUnits((long) (color.getRed() * 255)).build(); return result; }
/** * * * <pre> * RGB components of the color. * </pre> * * <code>.google.type.Color color = 1;</code> */ public com.google.type.Color getColor() { return color_ == null ? com.google.type.Color.getDefaultInstance() : color_; } /**
@java.lang.Override public int hashCode() { if (memoizedHashCode != 0) { return memoizedHashCode; } int hash = 41; hash = (19 * hash) + getDescriptor().hashCode(); hash = (37 * hash) + RED_FIELD_NUMBER; hash = (53 * hash) + java.lang.Float.floatToIntBits( getRed()); hash = (37 * hash) + GREEN_FIELD_NUMBER; hash = (53 * hash) + java.lang.Float.floatToIntBits( getGreen()); hash = (37 * hash) + BLUE_FIELD_NUMBER; hash = (53 * hash) + java.lang.Float.floatToIntBits( getBlue()); if (hasAlpha()) { hash = (37 * hash) + ALPHA_FIELD_NUMBER; hash = (53 * hash) + getAlpha().hashCode(); } hash = (29 * hash) + unknownFields.hashCode(); memoizedHashCode = hash; return hash; }