title
stringclasses 1
value | text
stringlengths 49
954k
| id
stringlengths 27
30
|
---|---|---|
presto-geospatial-toolkit/src/main/java/io/prestosql/geospatial/serde/GeometrySerde.java/GeometrySerde/writeGeometry
class GeometrySerde: private static void writeGeometry(DynamicSliceOutput output, OGCGeometry geometry)
{
GeometryType type = GeometryType.getForEsriGeometryType(geometry.geometryType());
switch (type) {
case POINT:
writePoint(output, geometry);
break;
case MULTI_POINT:
writeSimpleGeometry(output, GeometrySerializationType.MULTI_POINT, geometry);
break;
case LINE_STRING:
writeSimpleGeometry(output, GeometrySerializationType.LINE_STRING, geometry);
break;
case MULTI_LINE_STRING:
writeSimpleGeometry(output, GeometrySerializationType.MULTI_LINE_STRING, geometry);
break;
case POLYGON:
writeSimpleGeometry(output, GeometrySerializationType.POLYGON, geometry);
break;
case MULTI_POLYGON:
writeSimpleGeometry(output, GeometrySerializationType.MULTI_POLYGON, geometry);
break;
case GEOMETRY_COLLECTION: {
verify(geometry instanceof OGCConcreteGeometryCollection);
writeGeometryCollection(output, (OGCConcreteGeometryCollection) geometry);
break;
}
default:
throw new IllegalArgumentException("Unexpected type: " + type);
}
}
|
negative_train_query0_00098
|
|
presto-geospatial-toolkit/src/main/java/io/prestosql/geospatial/serde/GeometrySerde.java/GeometrySerde/readEnvelope
class GeometrySerde: private static Envelope readEnvelope(SliceInput input)
{
verify(input.available() > 0);
double xMin = input.readDouble();
double yMin = input.readDouble();
double xMax = input.readDouble();
double yMax = input.readDouble();
if (isEsriNaN(xMin) || isEsriNaN(yMin) || isEsriNaN(xMax) || isEsriNaN(yMax)) {
return new Envelope();
}
return new Envelope(xMin, yMin, xMax, yMax);
}
|
negative_train_query0_00099
|
|
presto-geospatial-toolkit/src/main/java/io/prestosql/geospatial/serde/GeometrySerde.java/GeometrySerde/writeGeometryCollection
class GeometrySerde: private static void writeGeometryCollection(DynamicSliceOutput output, OGCGeometryCollection collection)
{
output.appendByte(GeometrySerializationType.GEOMETRY_COLLECTION.code());
for (int geometryIndex = 0; geometryIndex < collection.numGeometries(); geometryIndex++) {
OGCGeometry geometry = collection.geometryN(geometryIndex);
int startPosition = output.size();
// leave 4 bytes for the shape length
output.appendInt(0);
writeGeometry(output, geometry);
int endPosition = output.size();
int length = endPosition - startPosition - Integer.BYTES;
output.getUnderlyingSlice().setInt(startPosition, length);
}
}
|
negative_train_query0_00100
|
|
presto-geospatial-toolkit/src/main/java/io/prestosql/geospatial/serde/GeometrySerde.java/GeometrySerde/writeEnvelopeCoordinates
class GeometrySerde: private static void writeEnvelopeCoordinates(DynamicSliceOutput output, Envelope envelope)
{
if (envelope.isEmpty()) {
output.appendDouble(NaN);
output.appendDouble(NaN);
output.appendDouble(NaN);
output.appendDouble(NaN);
}
else {
output.appendDouble(envelope.getXMin());
output.appendDouble(envelope.getYMin());
output.appendDouble(envelope.getXMax());
output.appendDouble(envelope.getYMax());
}
}
|
negative_train_query0_00101
|
|
presto-geospatial-toolkit/src/main/java/io/prestosql/geospatial/serde/GeometrySerde.java/GeometrySerde/merge
class GeometrySerde: @Nullable
private static Envelope merge(@Nullable Envelope left, @Nullable Envelope right)
{
if (left == null) {
return right;
}
if (right == null) {
return left;
}
right.merge(left);
return right;
}
|
negative_train_query0_00102
|
|
presto-geospatial-toolkit/src/main/java/io/prestosql/geospatial/serde/GeometrySerde.java/GeometrySerde/serialize
class GeometrySerde: public static Slice serialize(OGCGeometry input)
{
requireNonNull(input, "input is null");
DynamicSliceOutput output = new DynamicSliceOutput(100);
writeGeometry(output, input);
return output.slice();
}
|
negative_train_query0_00103
|
|
presto-geospatial-toolkit/src/main/java/io/prestosql/geospatial/serde/GeometrySerde.java/GeometrySerde/deserializeType
class GeometrySerde: public static GeometrySerializationType deserializeType(Slice shape)
{
requireNonNull(shape, "shape is null");
BasicSliceInput input = shape.getInput();
verify(input.available() > 0);
return GeometrySerializationType.getForCode(input.readByte());
}
|
negative_train_query0_00104
|
|
presto-geospatial-toolkit/src/main/java/io/prestosql/geospatial/serde/GeometrySerde.java/GeometrySerde/readSimpleGeometry
class GeometrySerde: private static OGCGeometry readSimpleGeometry(BasicSliceInput input, Slice inputSlice, GeometrySerializationType type, int length)
{
int currentPosition = toIntExact(input.position());
ByteBuffer geometryBuffer = inputSlice.toByteBuffer(currentPosition, length).slice();
input.setPosition(currentPosition + length);
Geometry esriGeometry = OperatorImportFromESRIShape.local().execute(0, Unknown, geometryBuffer);
return createFromEsriGeometry(esriGeometry, type.geometryType().isMultitype());
}
|
negative_train_query0_00105
|
|
presto-geospatial-toolkit/src/main/java/io/prestosql/geospatial/serde/GeometrySerde.java/GeometrySerde/getSimpleGeometryEnvelope
class GeometrySerde: private static Envelope getSimpleGeometryEnvelope(BasicSliceInput input, int length)
{
// skip type injected by esri
input.readInt();
Envelope envelope = readEnvelope(input);
int skipLength = length - (4 * Double.BYTES) - Integer.BYTES;
verify(input.skip(skipLength) == skipLength);
return envelope;
}
|
negative_train_query0_00106
|
|
presto-geospatial-toolkit/src/main/java/io/prestosql/geospatial/serde/GeometrySerde.java/GeometrySerde/getGeometryType
class GeometrySerde: public static GeometryType getGeometryType(Slice shape)
{
return deserializeType(shape).geometryType();
}
|
negative_train_query0_00107
|
|
presto-geospatial-toolkit/src/main/java/io/prestosql/geospatial/serde/GeometrySerde.java/GeometrySerde/deserialize
class GeometrySerde: public static OGCGeometry deserialize(Slice shape)
{
requireNonNull(shape, "shape is null");
BasicSliceInput input = shape.getInput();
verify(input.available() > 0);
int length = input.available() - 1;
GeometrySerializationType type = GeometrySerializationType.getForCode(input.readByte());
return readGeometry(input, shape, type, length);
}
|
negative_train_query0_00108
|
|
presto-geospatial-toolkit/src/main/java/io/prestosql/geospatial/serde/GeometrySerde.java/GeometrySerde/createFromEsriGeometry
class GeometrySerde: private static OGCGeometry createFromEsriGeometry(Geometry geometry, boolean multiType)
{
Geometry.Type type = geometry.getType();
switch (type) {
case Polygon: {
if (!multiType && ((Polygon) geometry).getExteriorRingCount() <= 1) {
return new OGCPolygon((Polygon) geometry, null);
}
return new OGCMultiPolygon((Polygon) geometry, null);
}
case Polyline: {
if (!multiType && ((Polyline) geometry).getPathCount() <= 1) {
return new OGCLineString((Polyline) geometry, 0, null);
}
return new OGCMultiLineString((Polyline) geometry, null);
}
case MultiPoint: {
if (!multiType && ((MultiPoint) geometry).getPointCount() <= 1) {
if (geometry.isEmpty()) {
return new OGCPoint(new Point(), null);
}
return new OGCPoint(((MultiPoint) geometry).getPoint(0), null);
}
return new OGCMultiPoint((MultiPoint) geometry, null);
}
case Point: {
if (!multiType) {
return new OGCPoint((Point) geometry, null);
}
return new OGCMultiPoint((Point) geometry, null);
}
case Envelope: {
Polygon polygon = new Polygon();
polygon.addEnvelope((Envelope) geometry, false);
return new OGCPolygon(polygon, null);
}
default:
throw new IllegalArgumentException("Unexpected geometry type: " + type);
}
}
|
negative_train_query0_00109
|
|
presto-geospatial-toolkit/src/main/java/io/prestosql/geospatial/serde/GeometrySerde.java/GeometrySerde/getPointEnvelope
class GeometrySerde: private static Envelope getPointEnvelope(BasicSliceInput input)
{
double x = input.readDouble();
double y = input.readDouble();
if (isNaN(x) || isNaN(y)) {
return new Envelope();
}
return new Envelope(x, y, x, y);
}
|
negative_train_query0_00110
|
|
presto-geospatial-toolkit/src/main/java/io/prestosql/geospatial/serde/GeometrySerde.java/GeometrySerde/writeSimpleGeometry
class GeometrySerde: private static void writeSimpleGeometry(DynamicSliceOutput output, GeometrySerializationType type, OGCGeometry geometry)
{
output.appendByte(type.code());
Geometry esriGeometry = requireNonNull(geometry.getEsriGeometry(), "esriGeometry is null");
byte[] shape = geometryToEsriShape(esriGeometry);
output.appendBytes(shape);
}
|
negative_train_query0_00111
|
|
presto-geospatial-toolkit/src/main/java/io/prestosql/geospatial/serde/GeometrySerde.java/GeometrySerde/readGeometry
class GeometrySerde: private static OGCGeometry readGeometry(BasicSliceInput input, Slice inputSlice, GeometrySerializationType type, int length)
{
switch (type) {
case POINT:
return readPoint(input);
case MULTI_POINT:
case LINE_STRING:
case MULTI_LINE_STRING:
case POLYGON:
case MULTI_POLYGON:
return readSimpleGeometry(input, inputSlice, type, length);
case GEOMETRY_COLLECTION:
return readGeometryCollection(input, inputSlice);
case ENVELOPE:
return createFromEsriGeometry(readEnvelope(input), false);
default:
throw new IllegalArgumentException("Unexpected type: " + type);
}
}
|
negative_train_query0_00112
|
|
presto-geospatial-toolkit/src/main/java/io/prestosql/geospatial/serde/GeometrySerde.java/GeometrySerde/readPoint
class GeometrySerde: private static OGCPoint readPoint(BasicSliceInput input)
{
double x = input.readDouble();
double y = input.readDouble();
Point point;
if (isNaN(x) || isNaN(y)) {
point = new Point();
}
else {
point = new Point(x, y);
}
return new OGCPoint(point, null);
}
|
negative_train_query0_00113
|
|
presto-geospatial-toolkit/src/main/java/io/prestosql/geospatial/serde/GeometrySerde.java/GeometrySerde/writePoint
class GeometrySerde: private static void writePoint(DynamicSliceOutput output, OGCGeometry geometry)
{
Geometry esriGeometry = geometry.getEsriGeometry();
verify(esriGeometry instanceof Point, "geometry is expected to be an instance of Point");
Point point = (Point) esriGeometry;
verify(!point.hasAttribute(VertexDescription.Semantics.Z) &&
!point.hasAttribute(VertexDescription.Semantics.M) &&
!point.hasAttribute(VertexDescription.Semantics.ID),
"Only 2D points with no ID nor M attribute are supported");
output.appendByte(GeometrySerializationType.POINT.code());
if (!point.isEmpty()) {
output.appendDouble(point.getX());
output.appendDouble(point.getY());
}
else {
output.appendDouble(NaN);
output.appendDouble(NaN);
}
}
|
negative_train_query0_00114
|
|
presto-geospatial-toolkit/src/main/java/io/prestosql/geospatial/serde/GeometrySerde.java/GeometrySerde/readGeometryCollection
class GeometrySerde: private static OGCConcreteGeometryCollection readGeometryCollection(BasicSliceInput input, Slice inputSlice)
{
// GeometryCollection: geometryType|len-of-shape1|bytes-of-shape1|len-of-shape2|bytes-of-shape2...
List<OGCGeometry> geometries = new ArrayList<>();
while (input.available() > 0) {
int length = input.readInt() - 1;
GeometrySerializationType type = GeometrySerializationType.getForCode(input.readByte());
geometries.add(readGeometry(input, inputSlice, type, length));
}
return new OGCConcreteGeometryCollection(geometries, null);
}
|
negative_train_query0_00115
|
|
presto-geospatial-toolkit/src/main/java/io/prestosql/geospatial/serde/GeometrySerde.java/GeometrySerde/deserializeEnvelope
class GeometrySerde: @Nullable
public static Envelope deserializeEnvelope(Slice shape)
{
requireNonNull(shape, "shape is null");
BasicSliceInput input = shape.getInput();
verify(input.available() > 0);
int length = input.available() - 1;
GeometrySerializationType type = GeometrySerializationType.getForCode(input.readByte());
return getEnvelope(input, type, length);
}
|
negative_train_query0_00116
|
|
presto-geospatial-toolkit/src/main/java/io/prestosql/geospatial/serde/GeometrySerde.java/GeometrySerde/GeometrySerde
class GeometrySerde: private GeometrySerde() {}
|
negative_train_query0_00117
|
|
presto-geospatial-toolkit/src/main/java/io/prestosql/geospatial/serde/GeometrySerde.java/GeometrySerde/getEnvelope
class GeometrySerde: private static Envelope getEnvelope(BasicSliceInput input, GeometrySerializationType type, int length)
{
switch (type) {
case POINT:
return getPointEnvelope(input);
case MULTI_POINT:
case LINE_STRING:
case MULTI_LINE_STRING:
case POLYGON:
case MULTI_POLYGON:
return getSimpleGeometryEnvelope(input, length);
case GEOMETRY_COLLECTION:
return getGeometryCollectionOverallEnvelope(input);
case ENVELOPE:
return readEnvelope(input);
default:
throw new IllegalArgumentException("Unexpected type: " + type);
}
}
|
negative_train_query0_00118
|
|
presto-geospatial-toolkit/src/main/java/io/prestosql/geospatial/serde/GeometrySerde.java/GeometrySerde/getGeometryCollectionOverallEnvelope
class GeometrySerde: private static Envelope getGeometryCollectionOverallEnvelope(BasicSliceInput input)
{
Envelope overallEnvelope = new Envelope();
while (input.available() > 0) {
int length = input.readInt() - 1;
GeometrySerializationType type = GeometrySerializationType.getForCode(input.readByte());
Envelope envelope = getEnvelope(input, type, length);
overallEnvelope = merge(overallEnvelope, envelope);
}
return overallEnvelope;
}
|
negative_train_query0_00119
|
|
presto-geospatial-toolkit/src/main/java/io/prestosql/geospatial/serde/GeometrySerializationType.java/GeometrySerializationType/GeometrySerializationType
class GeometrySerializationType: GeometrySerializationType(int code, GeometryType geometryType)
{
this.code = code;
this.geometryType = geometryType;
}
|
negative_train_query0_00120
|
|
presto-geospatial-toolkit/src/main/java/io/prestosql/geospatial/serde/GeometrySerializationType.java/GeometrySerializationType/code
class GeometrySerializationType: public int code()
{
return code;
}
|
negative_train_query0_00121
|
|
presto-geospatial-toolkit/src/main/java/io/prestosql/geospatial/serde/GeometrySerializationType.java/GeometrySerializationType/geometryType
class GeometrySerializationType: public GeometryType geometryType()
{
return geometryType;
}
|
negative_train_query0_00122
|
|
presto-geospatial-toolkit/src/main/java/io/prestosql/geospatial/serde/GeometrySerializationType.java/GeometrySerializationType/getForCode
class GeometrySerializationType: public static GeometrySerializationType getForCode(int code)
{
switch (code) {
case 0:
return POINT;
case 1:
return MULTI_POINT;
case 2:
return LINE_STRING;
case 3:
return MULTI_LINE_STRING;
case 4:
return POLYGON;
case 5:
return MULTI_POLYGON;
case 6:
return GEOMETRY_COLLECTION;
case 7:
return ENVELOPE;
default:
throw new IllegalArgumentException("Invalid type code: " + code);
}
}
|
negative_train_query0_00123
|
|
presto-matching/src/main/java/io/prestosql/matching/Property.java/Property/property
class Property: public static <F, C, T> Property<F, C, T> property(String name, Function<F, T> function)
{
return property(name, (source, context) -> function.apply(source));
}
|
negative_train_query0_00124
|
|
presto-matching/src/main/java/io/prestosql/matching/Property.java/Property/optionalProperty
class Property: public static <F, C, T> Property<F, C, T> optionalProperty(String name, Function<F, Optional<T>> function)
{
return new Property<>(name, (source, context) -> function.apply(source));
}
|
negative_train_query0_00125
|
|
presto-matching/src/main/java/io/prestosql/matching/Property.java/Property/getName
class Property: public String getName()
{
return name;
}
|
negative_train_query0_00126
|
|
presto-matching/src/main/java/io/prestosql/matching/Property.java/Property/matching
class Property: public PropertyPattern<F, C, T> matching(BiPredicate<? super T, ?> predicate)
{
return matching(new FilterPattern<>(predicate, Optional.empty()));
}
|
negative_train_query0_00127
|
|
presto-matching/src/main/java/io/prestosql/matching/Property.java/Property/equalTo
class Property: public PropertyPattern<F, C, T> equalTo(T expectedValue)
{
return matching(new EqualsPattern<>(expectedValue, Optional.empty()));
}
|
negative_train_query0_00128
|
|
presto-matching/src/main/java/io/prestosql/matching/Property.java/Property/Property
class Property: public Property(String name, BiFunction<F, C, Optional<T>> function)
{
this.name = requireNonNull(name, "name is null");
this.function = requireNonNull(function, "function is null");
}
|
negative_train_query0_00129
|
|
presto-matching/src/main/java/io/prestosql/matching/Property.java/Property/getFunction
class Property: public BiFunction<F, C, Optional<?>> getFunction()
{
//without the ::apply below, the type system is unable to drop the R type from Optional
return function::apply;
}
|
negative_train_query0_00130
|
|
presto-matching/src/main/java/io/prestosql/matching/Property.java/Property/capturedAs
class Property: public PropertyPattern<F, C, T> capturedAs(Capture<T> capture)
{
Pattern<T> matchAll = (Pattern<T>) Pattern.any();
return matching(matchAll.capturedAs(capture));
}
|
negative_train_query0_00131
|
|
presto-matching/src/main/java/io/prestosql/matching/PatternVisitor.java/PatternVisitor/visitTypeOf
class PatternVisitor: void visitTypeOf(TypeOfPattern<?> pattern);
|
negative_train_query0_00132
|
|
presto-matching/src/main/java/io/prestosql/matching/PatternVisitor.java/PatternVisitor/visitEquals
class PatternVisitor: void visitEquals(EqualsPattern<?> equalsPattern);
|
negative_train_query0_00133
|
|
presto-matching/src/main/java/io/prestosql/matching/PatternVisitor.java/PatternVisitor/visitWith
class PatternVisitor: void visitWith(WithPattern<?> pattern);
|
negative_train_query0_00134
|
|
presto-matching/src/main/java/io/prestosql/matching/PatternVisitor.java/PatternVisitor/visitCapture
class PatternVisitor: void visitCapture(CapturePattern<?> pattern);
|
negative_train_query0_00135
|
|
presto-matching/src/main/java/io/prestosql/matching/PatternVisitor.java/PatternVisitor/visitFilter
class PatternVisitor: void visitFilter(FilterPattern<?> pattern);
|
negative_train_query0_00136
|
|
presto-matching/src/main/java/io/prestosql/matching/PatternVisitor.java/PatternVisitor/visitPrevious
class PatternVisitor: default void visitPrevious(Pattern<?> pattern)
{
Optional<Pattern<?>> previous = pattern.previous();
if (previous.isPresent()) {
previous.get().accept(this);
}
}
|
negative_train_query0_00137
|
|
presto-matching/src/main/java/io/prestosql/matching/Match.java/Match/of
class Match: public static Match of(Captures captures)
{
return new Match(captures);
}
|
negative_train_query0_00138
|
|
presto-matching/src/main/java/io/prestosql/matching/Match.java/Match/equals
class Match: @Override
public boolean equals(Object o)
{
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
Match match = (Match) o;
return Objects.equals(captures, match.captures);
}
|
negative_train_query0_00139
|
|
presto-matching/src/main/java/io/prestosql/matching/Match.java/Match/capture
class Match: public <T> T capture(Capture<T> capture)
{
return captures().get(capture);
}
|
negative_train_query0_00140
|
|
presto-matching/src/main/java/io/prestosql/matching/Match.java/Match/captures
class Match: public Captures captures()
{
return captures;
}
|
negative_train_query0_00141
|
|
presto-matching/src/main/java/io/prestosql/matching/Match.java/Match/Match
class Match: private Match(Captures captures)
{
this.captures = requireNonNull(captures, "captures is null");
}
|
negative_train_query0_00142
|
|
presto-matching/src/main/java/io/prestosql/matching/Match.java/Match/hashCode
class Match: @Override
public int hashCode()
{
return Objects.hash(captures);
}
|
negative_train_query0_00143
|
|
presto-matching/src/main/java/io/prestosql/matching/Match.java/Match/toString
class Match: @Override
public String toString()
{
return toStringHelper(this)
.add("captures", captures)
.toString();
}
|
negative_train_query0_00144
|
|
presto-matching/src/main/java/io/prestosql/matching/DefaultPrinter.java/DefaultPrinter/result
class DefaultPrinter: public String result()
{
return result.toString();
}
|
negative_train_query0_00145
|
|
presto-matching/src/main/java/io/prestosql/matching/DefaultPrinter.java/DefaultPrinter/visitWith
class DefaultPrinter: @Override
public void visitWith(WithPattern<?> pattern)
{
visitPrevious(pattern);
appendLine("with(%s)", pattern.getProperty().getName());
level += 1;
pattern.getPattern().accept(this);
level -= 1;
}
|
negative_train_query0_00146
|
|
presto-matching/src/main/java/io/prestosql/matching/DefaultPrinter.java/DefaultPrinter/visitEquals
class DefaultPrinter: @Override
public void visitEquals(EqualsPattern<?> pattern)
{
visitPrevious(pattern);
appendLine("equals(%s)", pattern.expectedValue());
}
|
negative_train_query0_00147
|
|
presto-matching/src/main/java/io/prestosql/matching/DefaultPrinter.java/DefaultPrinter/visitTypeOf
class DefaultPrinter: @Override
public void visitTypeOf(TypeOfPattern<?> pattern)
{
visitPrevious(pattern);
appendLine("typeOf(%s)", pattern.expectedClass().getSimpleName());
}
|
negative_train_query0_00148
|
|
presto-matching/src/main/java/io/prestosql/matching/DefaultPrinter.java/DefaultPrinter/visitCapture
class DefaultPrinter: @Override
public void visitCapture(CapturePattern<?> pattern)
{
visitPrevious(pattern);
appendLine("capturedAs(%s)", pattern.capture().description());
}
|
negative_train_query0_00149
|
|
presto-matching/src/main/java/io/prestosql/matching/DefaultPrinter.java/DefaultPrinter/visitFilter
class DefaultPrinter: @Override
public void visitFilter(FilterPattern<?> pattern)
{
visitPrevious(pattern);
appendLine("filter(%s)", pattern.predicate());
}
|
negative_train_query0_00150
|
|
presto-matching/src/main/java/io/prestosql/matching/DefaultPrinter.java/DefaultPrinter/appendLine
class DefaultPrinter: private void appendLine(String template, Object... arguments)
{
result.append(repeat("\t", level)).append(format(template + "\n", arguments));
}
|
negative_train_query0_00151
|
|
presto-matching/src/main/java/io/prestosql/matching/Capture.java/Capture/newCapture
class Capture: public static <T> Capture<T> newCapture(String description)
{
return new Capture<>(description + "@" + sequenceCounter.incrementAndGet());
}
|
negative_train_query0_00152
|
|
presto-matching/src/main/java/io/prestosql/matching/Capture.java/Capture/description
class Capture: public String description()
{
return description;
}
|
negative_train_query0_00153
|
|
presto-matching/src/main/java/io/prestosql/matching/Capture.java/Capture/Capture
class Capture: private Capture(String description)
{
this.description = description;
}
|
negative_train_query0_00154
|
|
presto-matching/src/main/java/io/prestosql/matching/Captures.java/Captures/Captures
class Captures: private Captures(Capture<?> capture, Object value, Captures tail)
{
this.capture = capture;
this.value = value;
this.tail = tail;
}
|
negative_train_query0_00155
|
|
presto-matching/src/main/java/io/prestosql/matching/Captures.java/Captures/get
class Captures: @SuppressWarnings("unchecked cast")
public <T> T get(Capture<T> capture)
{
if (this.equals(NIL)) {
throw new NoSuchElementException("Requested value for unknown Capture. Was it registered in the Pattern?");
}
else if (this.capture.equals(capture)) {
return (T) value;
}
else {
return tail.get(capture);
}
}
|
negative_train_query0_00156
|
|
presto-matching/src/main/java/io/prestosql/matching/Captures.java/Captures/ofNullable
class Captures: public static <T> Captures ofNullable(Capture<T> capture, T value)
{
return capture == null ? empty() : new Captures(capture, value, NIL);
}
|
negative_train_query0_00157
|
|
presto-matching/src/main/java/io/prestosql/matching/Captures.java/Captures/addAll
class Captures: public Captures addAll(Captures other)
{
if (this == NIL) {
return other;
}
else {
return new Captures(capture, value, tail.addAll(other));
}
}
|
negative_train_query0_00158
|
|
presto-matching/src/main/java/io/prestosql/matching/Captures.java/Captures/empty
class Captures: public static Captures empty()
{
return NIL;
}
|
negative_train_query0_00159
|
|
presto-matching/src/main/java/io/prestosql/matching/Captures.java/Captures/equals
class Captures: @Override
public boolean equals(Object o)
{
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
Captures captures = (Captures) o;
if (capture != null ? !capture.equals(captures.capture) : captures.capture != null) {
return false;
}
if (value != null ? !value.equals(captures.value) : captures.value != null) {
return false;
}
return tail != null ? tail.equals(captures.tail) : captures.tail == null;
}
|
negative_train_query0_00160
|
|
presto-matching/src/main/java/io/prestosql/matching/Captures.java/Captures/hashCode
class Captures: @Override
public int hashCode()
{
int result = capture != null ? capture.hashCode() : 0;
result = 31 * result + (value != null ? value.hashCode() : 0);
result = 31 * result + (tail != null ? tail.hashCode() : 0);
return result;
}
|
negative_train_query0_00161
|
|
presto-matching/src/main/java/io/prestosql/matching/PropertyPattern.java/PropertyPattern/of
class PropertyPattern: public static <F, C, T, R> PropertyPattern<F, C, R> of(Property<F, C, T> property, Pattern<R> pattern)
{
return new PropertyPattern<>(property, pattern);
}
|
negative_train_query0_00162
|
|
presto-matching/src/main/java/io/prestosql/matching/PropertyPattern.java/PropertyPattern/getProperty
class PropertyPattern: public Property<F, C, ?> getProperty()
{
return property;
}
|
negative_train_query0_00163
|
|
presto-matching/src/main/java/io/prestosql/matching/PropertyPattern.java/PropertyPattern/upcast
class PropertyPattern: @SuppressWarnings("unchecked cast")
public static <F, C, T> PropertyPattern<F, C, T> upcast(PropertyPattern<F, C, ? extends T> propertyPattern)
{
return (PropertyPattern<F, C, T>) propertyPattern;
}
|
negative_train_query0_00164
|
|
presto-matching/src/main/java/io/prestosql/matching/PropertyPattern.java/PropertyPattern/getPattern
class PropertyPattern: public Pattern<R> getPattern()
{
return pattern;
}
|
negative_train_query0_00165
|
|
presto-matching/src/main/java/io/prestosql/matching/PropertyPattern.java/PropertyPattern/PropertyPattern
class PropertyPattern: private PropertyPattern(Property<F, C, ?> property, Pattern<R> pattern)
{
this.property = requireNonNull(property, "property is null");
this.pattern = requireNonNull(pattern, "pattern is null");
}
|
negative_train_query0_00166
|
|
presto-matching/src/main/java/io/prestosql/matching/Pattern.java/Pattern/Pattern
class Pattern: protected Pattern(Pattern<?> previous)
{
this(Optional.of(requireNonNull(previous, "previous is null")));
}
|
negative_train_query0_00167
|
|
presto-matching/src/main/java/io/prestosql/matching/Pattern.java/Pattern/empty
class Pattern: public static <F, C, T extends Iterable<S>, S> PropertyPattern<F, C, T> empty(Property<F, C, T> property)
{
return PropertyPattern.upcast(property.matching(Iterables::isEmpty));
}
|
negative_train_query0_00168
|
|
presto-matching/src/main/java/io/prestosql/matching/Pattern.java/Pattern/typeOf
class Pattern: public static <T> Pattern<T> typeOf(Class<T> expectedClass)
{
return new TypeOfPattern<>(expectedClass);
}
|
negative_train_query0_00169
|
|
presto-matching/src/main/java/io/prestosql/matching/Pattern.java/Pattern/nonEmpty
class Pattern: public static <F, C, T extends Iterable<S>, S> PropertyPattern<F, C, T> nonEmpty(Property<F, C, T> property)
{
return PropertyPattern.upcast(property.matching(not(Iterables::isEmpty)));
}
|
negative_train_query0_00170
|
|
presto-matching/src/main/java/io/prestosql/matching/Pattern.java/Pattern/matching
class Pattern: public Pattern<T> matching(BiPredicate<? super T, ?> predicate)
{
return new FilterPattern<>(predicate, Optional.of(this));
}
|
negative_train_query0_00171
|
|
presto-matching/src/main/java/io/prestosql/matching/Pattern.java/Pattern/with
class Pattern: public Pattern<T> with(PropertyPattern<? super T, ?, ?> pattern)
{
return new WithPattern<>(pattern, this);
}
|
negative_train_query0_00172
|
|
presto-matching/src/main/java/io/prestosql/matching/Pattern.java/Pattern/accept
class Pattern: public abstract void accept(PatternVisitor patternVisitor);
|
negative_train_query0_00173
|
|
presto-matching/src/main/java/io/prestosql/matching/Pattern.java/Pattern/matches
class Pattern: public <C> boolean matches(Object object, C context)
{
return match(object, context)
.findFirst()
.isPresent();
}
|
negative_train_query0_00174
|
|
presto-matching/src/main/java/io/prestosql/matching/Pattern.java/Pattern/any
class Pattern: public static Pattern<Object> any()
{
return typeOf(Object.class);
}
|
negative_train_query0_00175
|
|
presto-matching/src/main/java/io/prestosql/matching/Pattern.java/Pattern/capturedAs
class Pattern: public Pattern<T> capturedAs(Capture<T> capture)
{
return new CapturePattern<>(capture, this);
}
|
negative_train_query0_00176
|
|
presto-matching/src/main/java/io/prestosql/matching/Pattern.java/Pattern/previous
class Pattern: public Optional<Pattern<?>> previous()
{
return previous;
}
|
negative_train_query0_00177
|
|
presto-matching/src/main/java/io/prestosql/matching/Pattern.java/Pattern/match
class Pattern: public final <C> Stream<Match> match(Object object, C context)
{
return match(object, Captures.empty(), context);
}
|
negative_train_query0_00178
|
|
presto-matching/src/main/java/io/prestosql/matching/Pattern.java/Pattern/toString
class Pattern: @Override
public String toString()
{
DefaultPrinter printer = new DefaultPrinter();
accept(printer);
return printer.result();
}
|
negative_train_query0_00179
|
|
presto-matching/src/main/java/io/prestosql/matching/pattern/CapturePattern.java/CapturePattern/CapturePattern
class CapturePattern: public CapturePattern(Capture<T> capture, Pattern<T> previous)
{
super(previous);
this.capture = requireNonNull(capture, "capture is null");
}
|
negative_train_query0_00180
|
|
presto-matching/src/main/java/io/prestosql/matching/pattern/CapturePattern.java/CapturePattern/capture
class CapturePattern: public Capture<T> capture()
{
return capture;
}
|
negative_train_query0_00181
|
|
presto-matching/src/main/java/io/prestosql/matching/pattern/CapturePattern.java/CapturePattern/accept
class CapturePattern: @Override
public <C> Stream<Match> accept(Object object, Captures captures, C context)
{
Captures newCaptures = captures.addAll(Captures.ofNullable(capture, (T) object));
return Stream.of(Match.of(newCaptures));
}
|
negative_train_query0_00182
|
|
presto-matching/src/main/java/io/prestosql/matching/pattern/TypeOfPattern.java/TypeOfPattern/expectedClass
class TypeOfPattern: public Class<T> expectedClass()
{
return expectedClass;
}
|
negative_train_query0_00183
|
|
presto-matching/src/main/java/io/prestosql/matching/pattern/TypeOfPattern.java/TypeOfPattern/TypeOfPattern
class TypeOfPattern: public TypeOfPattern(Class<T> expectedClass, Optional<Pattern<?>> previous)
{
super(previous);
this.expectedClass = requireNonNull(expectedClass, "expectedClass is null");
}
|
negative_train_query0_00184
|
|
presto-matching/src/main/java/io/prestosql/matching/pattern/TypeOfPattern.java/TypeOfPattern/accept
class TypeOfPattern: @Override
public <C> Stream<Match> accept(Object object, Captures captures, C context)
{
if (expectedClass.isInstance(object)) {
return Stream.of(Match.of(captures));
}
return Stream.of();
}
|
negative_train_query0_00185
|
|
presto-matching/src/main/java/io/prestosql/matching/pattern/EqualsPattern.java/EqualsPattern/EqualsPattern
class EqualsPattern: public EqualsPattern(T expectedValue, Optional<Pattern<?>> previous)
{
super(previous);
this.expectedValue = requireNonNull(expectedValue, "expectedValue can't be null. Use isNull() pattern instead.");
}
|
negative_train_query0_00186
|
|
presto-matching/src/main/java/io/prestosql/matching/pattern/EqualsPattern.java/EqualsPattern/accept
class EqualsPattern: @Override
public void accept(PatternVisitor patternVisitor)
{
patternVisitor.visitEquals(this);
}
|
negative_train_query0_00187
|
|
presto-matching/src/main/java/io/prestosql/matching/pattern/EqualsPattern.java/EqualsPattern/expectedValue
class EqualsPattern: public T expectedValue()
{
return expectedValue;
}
|
negative_train_query0_00188
|
|
presto-matching/src/main/java/io/prestosql/matching/pattern/WithPattern.java/WithPattern/getProperty
class WithPattern: public Property<? super T, ?, ?> getProperty()
{
return propertyPattern.getProperty();
}
|
negative_train_query0_00189
|
|
presto-matching/src/main/java/io/prestosql/matching/pattern/WithPattern.java/WithPattern/WithPattern
class WithPattern: public WithPattern(PropertyPattern<? super T, ?, ?> propertyPattern, Pattern<T> previous)
{
super(previous);
this.propertyPattern = requireNonNull(propertyPattern, "propertyPattern is null");
}
|
negative_train_query0_00190
|
|
presto-matching/src/main/java/io/prestosql/matching/pattern/WithPattern.java/WithPattern/accept
class WithPattern: @Override
public void accept(PatternVisitor patternVisitor)
{
patternVisitor.visitWith(this);
}
|
negative_train_query0_00191
|
|
presto-matching/src/main/java/io/prestosql/matching/pattern/WithPattern.java/WithPattern/getPattern
class WithPattern: public Pattern<?> getPattern()
{
return propertyPattern.getPattern();
}
|
negative_train_query0_00192
|
|
presto-matching/src/main/java/io/prestosql/matching/pattern/FilterPattern.java/FilterPattern/FilterPattern
class FilterPattern: public FilterPattern(BiPredicate<? super T, ?> predicate, Optional<Pattern<?>> previous)
{
super(previous);
this.predicate = requireNonNull(predicate, "predicate is null");
}
|
negative_train_query0_00193
|
|
presto-matching/src/main/java/io/prestosql/matching/pattern/FilterPattern.java/FilterPattern/accept
class FilterPattern: @Override
public void accept(PatternVisitor patternVisitor)
{
patternVisitor.visitFilter(this);
}
|
negative_train_query0_00194
|
|
presto-matching/src/main/java/io/prestosql/matching/pattern/FilterPattern.java/FilterPattern/predicate
class FilterPattern: public BiPredicate<? super T, ?> predicate()
{
return predicate;
}
|
negative_train_query0_00195
|
|
presto-redis/src/main/java/io/prestosql/plugin/redis/RedisConnectorModule.java/RedisConnectorModule/configure
class RedisConnectorModule: @Override
public void configure(Binder binder)
{
binder.bind(RedisConnector.class).in(Scopes.SINGLETON);
binder.bind(RedisMetadata.class).in(Scopes.SINGLETON);
binder.bind(RedisSplitManager.class).in(Scopes.SINGLETON);
binder.bind(RedisRecordSetProvider.class).in(Scopes.SINGLETON);
binder.bind(RedisJedisManager.class).in(Scopes.SINGLETON);
configBinder(binder).bindConfig(RedisConnectorConfig.class);
jsonBinder(binder).addDeserializerBinding(Type.class).to(TypeDeserializer.class);
jsonCodecBinder(binder).bindJsonCodec(RedisTableDescription.class);
binder.install(new RedisDecoderModule());
}
|
negative_train_query0_00196
|
|
presto-redis/src/main/java/io/prestosql/plugin/redis/RedisConnectorModule.java/RedisConnectorModule/_deserialize
class RedisConnectorModule: @Override
protected Type _deserialize(String value, DeserializationContext context)
{
return typeManager.getType(TypeId.of(value));
}
|
negative_train_query0_00197
|