mirror of
https://github.com/microsoft/HybridRow.git
synced 2026-06-20 11:27:01 +01:00
Excluding most tests with the expectation that we'll bring them in as we continue to expand our test matrix.
This commit is contained in:
+139
-139
@@ -1,140 +1,140 @@
|
|||||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||||
// Licensed under the MIT License.
|
// Licensed under the MIT License.
|
||||||
|
|
||||||
package com.azure.data.cosmos.serialization.hybridrow.perf;
|
package com.azure.data.cosmos.serialization.hybridrow.perf;
|
||||||
|
|
||||||
import com.azure.data.cosmos.core.Out;
|
import com.azure.data.cosmos.core.Out;
|
||||||
import com.azure.data.cosmos.core.Reference;
|
import com.azure.data.cosmos.core.Reference;
|
||||||
import com.azure.data.cosmos.serialization.hybridrow.HybridRowVersion;
|
import com.azure.data.cosmos.serialization.hybridrow.HybridRowVersion;
|
||||||
import com.azure.data.cosmos.serialization.hybridrow.MemorySpanResizer;
|
import com.azure.data.cosmos.serialization.hybridrow.MemorySpanResizer;
|
||||||
import com.azure.data.cosmos.serialization.hybridrow.Result;
|
import com.azure.data.cosmos.serialization.hybridrow.Result;
|
||||||
import com.azure.data.cosmos.serialization.hybridrow.RowBuffer;
|
import com.azure.data.cosmos.serialization.hybridrow.RowBuffer;
|
||||||
import com.azure.data.cosmos.serialization.hybridrow.io.RowReader;
|
import com.azure.data.cosmos.serialization.hybridrow.io.RowReader;
|
||||||
import com.azure.data.cosmos.serialization.hybridrow.layouts.Layout;
|
import com.azure.data.cosmos.serialization.hybridrow.layouts.Layout;
|
||||||
import com.azure.data.cosmos.serialization.hybridrow.layouts.LayoutResolver;
|
import com.azure.data.cosmos.serialization.hybridrow.layouts.LayoutResolver;
|
||||||
import com.azure.data.cosmos.serialization.hybridrow.layouts.LayoutResolverNamespace;
|
import com.azure.data.cosmos.serialization.hybridrow.layouts.LayoutResolverNamespace;
|
||||||
import com.azure.data.cosmos.serialization.hybridrow.layouts.SystemSchema;
|
import com.azure.data.cosmos.serialization.hybridrow.layouts.SystemSchema;
|
||||||
import com.azure.data.cosmos.serialization.hybridrow.recordio.RecordIOStream;
|
import com.azure.data.cosmos.serialization.hybridrow.recordio.RecordIOStream;
|
||||||
import com.azure.data.cosmos.serialization.hybridrow.io.Segment;
|
import com.azure.data.cosmos.serialization.hybridrow.io.Segment;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.stream.Stream;
|
import java.util.stream.Stream;
|
||||||
|
|
||||||
// TODO: C# TO JAVA CONVERTER: There is no preprocessor in Java:
|
// TODO: C# TO JAVA CONVERTER: There is no preprocessor in Java:
|
||||||
///#pragma warning disable SA1401 // Fields should be private
|
///#pragma warning disable SA1401 // Fields should be private
|
||||||
|
|
||||||
|
|
||||||
public class BenchmarkSuiteBase {
|
public class BenchmarkSuiteBase {
|
||||||
//C# TO JAVA CONVERTER WARNING: Java has no equivalent to C# 'private protected' access:
|
//C# TO JAVA CONVERTER WARNING: Java has no equivalent to C# 'private protected' access:
|
||||||
//ORIGINAL LINE: private protected const int InitialCapacity = 2 * 1024 * 1024;
|
//ORIGINAL LINE: private protected const int InitialCapacity = 2 * 1024 * 1024;
|
||||||
protected static final int InitialCapacity = 2 * 1024 * 1024;
|
protected static final int InitialCapacity = 2 * 1024 * 1024;
|
||||||
//C# TO JAVA CONVERTER WARNING: Java has no equivalent to C# 'private protected' access:
|
//C# TO JAVA CONVERTER WARNING: Java has no equivalent to C# 'private protected' access:
|
||||||
//ORIGINAL LINE: private protected LayoutResolverNamespace DefaultResolver = (LayoutResolverNamespace)
|
//ORIGINAL LINE: private protected LayoutResolverNamespace DefaultResolver = (LayoutResolverNamespace)
|
||||||
// SystemSchema.LayoutResolver;
|
// SystemSchema.LayoutResolver;
|
||||||
protected LayoutResolverNamespace DefaultResolver = (LayoutResolverNamespace)SystemSchema.layoutResolver;
|
protected LayoutResolverNamespace DefaultResolver = (LayoutResolverNamespace)SystemSchema.layoutResolver;
|
||||||
|
|
||||||
// TODO: C# TO JAVA CONVERTER: Methods returning tuples are not converted by C# to Java Converter:
|
// TODO: C# TO JAVA CONVERTER: Methods returning tuples are not converted by C# to Java Converter:
|
||||||
// private protected async Task<(List<Dictionary<Utf8String, object>>, LayoutResolverNamespace)>
|
// private protected async Task<(List<Dictionary<Utf8String, object>>, LayoutResolverNamespace)>
|
||||||
// LoadExpectedAsync(string expectedFile)
|
// LoadExpectedAsync(string expectedFile)
|
||||||
// {
|
// {
|
||||||
// LayoutResolverNamespace resolver = this.DefaultResolver;
|
// LayoutResolverNamespace resolver = this.DefaultResolver;
|
||||||
// List<Dictionary<Utf8String, object>> expected = new List<Dictionary<Utf8String, object>>();
|
// List<Dictionary<Utf8String, object>> expected = new List<Dictionary<Utf8String, object>>();
|
||||||
// using (Stream stm = new FileStream(expectedFile, FileMode.Open))
|
// using (Stream stm = new FileStream(expectedFile, FileMode.Open))
|
||||||
// {
|
// {
|
||||||
// // Read a RecordIO stream.
|
// // Read a RecordIO stream.
|
||||||
// MemorySpanResizer<byte> resizer = new MemorySpanResizer<byte>(BenchmarkSuiteBase.InitialCapacity);
|
// MemorySpanResizer<byte> resizer = new MemorySpanResizer<byte>(BenchmarkSuiteBase.InitialCapacity);
|
||||||
// Result r = await stm.ReadRecordIOAsync(record =>
|
// Result r = await stm.ReadRecordIOAsync(record =>
|
||||||
// {
|
// {
|
||||||
// r = BenchmarkSuiteBase.LoadOneRow(record, resolver, out Dictionary<Utf8String, object>
|
// r = BenchmarkSuiteBase.LoadOneRow(record, resolver, out Dictionary<Utf8String, object>
|
||||||
// rowValue);
|
// rowValue);
|
||||||
// ResultAssert.IsSuccess(r);
|
// ResultAssert.IsSuccess(r);
|
||||||
// expected.Add(rowValue);
|
// expected.Add(rowValue);
|
||||||
// return Result.Success;
|
// return Result.Success;
|
||||||
// }
|
// }
|
||||||
// , segment =>
|
// , segment =>
|
||||||
// {
|
// {
|
||||||
// r = SegmentSerializer.Read(segment.Span, SystemSchema.LayoutResolver, out Segment s);
|
// r = SegmentSerializer.Read(segment.Span, SystemSchema.LayoutResolver, out Segment s);
|
||||||
// ResultAssert.IsSuccess(r);
|
// ResultAssert.IsSuccess(r);
|
||||||
// Assert.IsNotNull(s.SDL);
|
// Assert.IsNotNull(s.SDL);
|
||||||
// resolver = new LayoutResolverNamespace(Namespace.Parse(s.SDL), resolver);
|
// resolver = new LayoutResolverNamespace(Namespace.Parse(s.SDL), resolver);
|
||||||
// return Result.Success;
|
// return Result.Success;
|
||||||
// }
|
// }
|
||||||
// , resizer);
|
// , resizer);
|
||||||
//
|
//
|
||||||
// ResultAssert.IsSuccess(r);
|
// ResultAssert.IsSuccess(r);
|
||||||
// }
|
// }
|
||||||
//
|
//
|
||||||
// return (expected, resolver);
|
// return (expected, resolver);
|
||||||
// }
|
// }
|
||||||
|
|
||||||
//C# TO JAVA CONVERTER WARNING: Java has no equivalent to C# 'private protected' access:
|
//C# TO JAVA CONVERTER WARNING: Java has no equivalent to C# 'private protected' access:
|
||||||
//ORIGINAL LINE: private protected static Result LoadOneRow(Memory<byte> buffer, LayoutResolver resolver, out
|
//ORIGINAL LINE: private protected static Result LoadOneRow(Memory<byte> buffer, LayoutResolver resolver, out
|
||||||
// Dictionary<Utf8String, object> rowValue)
|
// Dictionary<Utf8String, object> rowValue)
|
||||||
//C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java:
|
//C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java:
|
||||||
protected static Result LoadOneRow(Memory<Byte> buffer, LayoutResolver resolver,
|
protected static Result LoadOneRow(Memory<Byte> buffer, LayoutResolver resolver,
|
||||||
Out<HashMap<Utf8String, Object>> rowValue) {
|
Out<HashMap<Utf8String, Object>> rowValue) {
|
||||||
RowBuffer row = new RowBuffer(buffer.Span, HybridRowVersion.V1, resolver);
|
RowBuffer row = new RowBuffer(buffer.Span, HybridRowVersion.V1, resolver);
|
||||||
Reference<RowBuffer> tempReference_row =
|
Reference<RowBuffer> tempReference_row =
|
||||||
new Reference<RowBuffer>(row);
|
new Reference<RowBuffer>(row);
|
||||||
RowReader reader = new RowReader(tempReference_row);
|
RowReader reader = new RowReader(tempReference_row);
|
||||||
row = tempReference_row.get();
|
row = tempReference_row.get();
|
||||||
Reference<RowReader> tempReference_reader =
|
Reference<RowReader> tempReference_reader =
|
||||||
new Reference<RowReader>(reader);
|
new Reference<RowReader>(reader);
|
||||||
Result tempVar = DiagnosticConverter.ReaderToDynamic(tempReference_reader, rowValue);
|
Result tempVar = DiagnosticConverter.ReaderToDynamic(tempReference_reader, rowValue);
|
||||||
reader = tempReference_reader.get();
|
reader = tempReference_reader.get();
|
||||||
return tempVar;
|
return tempVar;
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: C# TO JAVA CONVERTER: There is no equivalent in Java to the 'async' keyword:
|
// TODO: C# TO JAVA CONVERTER: There is no equivalent in Java to the 'async' keyword:
|
||||||
//ORIGINAL LINE: private protected static async Task WriteAllRowsAsync(string file, string sdl, LayoutResolver
|
//ORIGINAL LINE: private protected static async Task WriteAllRowsAsync(string file, string sdl, LayoutResolver
|
||||||
// resolver, Layout layout, List<Dictionary<Utf8String, object>> rows)
|
// resolver, Layout layout, List<Dictionary<Utf8String, object>> rows)
|
||||||
//C# TO JAVA CONVERTER WARNING: Java has no equivalent to C# 'private protected' access:
|
//C# TO JAVA CONVERTER WARNING: Java has no equivalent to C# 'private protected' access:
|
||||||
protected static Task WriteAllRowsAsync(String file, String sdl, LayoutResolver resolver, Layout layout,
|
protected static Task WriteAllRowsAsync(String file, String sdl, LayoutResolver resolver, Layout layout,
|
||||||
ArrayList<HashMap<Utf8String, Object>> rows) {
|
ArrayList<HashMap<Utf8String, Object>> rows) {
|
||||||
try (Stream stm = new FileStream(file, FileMode.Truncate)) {
|
try (Stream stm = new FileStream(file, FileMode.Truncate)) {
|
||||||
// Create a reusable, resizable buffer.
|
// Create a reusable, resizable buffer.
|
||||||
//C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java:
|
//C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java:
|
||||||
//ORIGINAL LINE: MemorySpanResizer<byte> resizer = new MemorySpanResizer<byte>(BenchmarkSuiteBase
|
//ORIGINAL LINE: MemorySpanResizer<byte> resizer = new MemorySpanResizer<byte>(BenchmarkSuiteBase
|
||||||
// .InitialCapacity);
|
// .InitialCapacity);
|
||||||
MemorySpanResizer<Byte> resizer = new MemorySpanResizer<Byte>(BenchmarkSuiteBase.InitialCapacity);
|
MemorySpanResizer<Byte> resizer = new MemorySpanResizer<Byte>(BenchmarkSuiteBase.InitialCapacity);
|
||||||
|
|
||||||
// Write a RecordIO stream.
|
// Write a RecordIO stream.
|
||||||
// TODO: C# TO JAVA CONVERTER: There is no equivalent to 'await' in Java:
|
// TODO: C# TO JAVA CONVERTER: There is no equivalent to 'await' in Java:
|
||||||
// TODO: C# TO JAVA CONVERTER: The following lambda contained an unresolved 'out' keyword - these are
|
// TODO: C# TO JAVA CONVERTER: The following lambda contained an unresolved 'out' keyword - these are
|
||||||
// not converted by C# to Java Converter:
|
// not converted by C# to Java Converter:
|
||||||
//C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java:
|
//C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java:
|
||||||
//ORIGINAL LINE: Result r = await stm.WriteRecordIOAsync(new Segment("HybridRow.Tests.Perf Expected
|
//ORIGINAL LINE: Result r = await stm.WriteRecordIOAsync(new Segment("HybridRow.Tests.Perf Expected
|
||||||
// Results", sdl), (long index, out ReadOnlyMemory<byte> body) =>
|
// Results", sdl), (long index, out ReadOnlyMemory<byte> body) =>
|
||||||
Result r = await RecordIOStream.WriteRecordIOAsync(stm,
|
Result r = await RecordIOStream.WriteRecordIOAsync(stm,
|
||||||
new Segment("HybridRow.Tests.Perf Expected Results", sdl), (long index, out ReadOnlyMemory<Byte>body) ->
|
new Segment("HybridRow.Tests.Perf Expected Results", sdl), (long index, out ReadOnlyMemory<Byte>body) ->
|
||||||
{
|
{
|
||||||
body = null;
|
body = null;
|
||||||
if (index >= rows.size()) {
|
if (index >= rows.size()) {
|
||||||
return Result.SUCCESS;
|
return Result.SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
StreamingRowGenerator writer = new StreamingRowGenerator(BenchmarkSuiteBase.InitialCapacity, layout,
|
StreamingRowGenerator writer = new StreamingRowGenerator(BenchmarkSuiteBase.InitialCapacity, layout,
|
||||||
resolver, resizer);
|
resolver, resizer);
|
||||||
|
|
||||||
Result r2 = writer.WriteBuffer(rows.get((int)index));
|
Result r2 = writer.WriteBuffer(rows.get((int)index));
|
||||||
if (r2 != Result.SUCCESS) {
|
if (r2 != Result.SUCCESS) {
|
||||||
return r2;
|
return r2;
|
||||||
}
|
}
|
||||||
|
|
||||||
body = resizer.getMemory().Slice(0, writer.getLength());
|
body = resizer.getMemory().Slice(0, writer.getLength());
|
||||||
return Result.SUCCESS;
|
return Result.SUCCESS;
|
||||||
});
|
});
|
||||||
|
|
||||||
ResultAssert.IsSuccess(r);
|
ResultAssert.IsSuccess(r);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//C# TO JAVA CONVERTER WARNING: Java has no equivalent to C# 'private protected' access:
|
//C# TO JAVA CONVERTER WARNING: Java has no equivalent to C# 'private protected' access:
|
||||||
//ORIGINAL LINE: private protected static class ResultAssert
|
//ORIGINAL LINE: private protected static class ResultAssert
|
||||||
protected static class ResultAssert {
|
protected static class ResultAssert {
|
||||||
public static void IsSuccess(Result actual) {
|
public static void IsSuccess(Result actual) {
|
||||||
assert actual == Result.SUCCESS || Result.SUCCESS == actual;
|
assert actual == Result.SUCCESS || Result.SUCCESS == actual;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+129
-129
@@ -1,130 +1,130 @@
|
|||||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||||
// Licensed under the MIT License.
|
// Licensed under the MIT License.
|
||||||
|
|
||||||
package com.azure.data.cosmos.serialization.hybridrow.perf;
|
package com.azure.data.cosmos.serialization.hybridrow.perf;
|
||||||
|
|
||||||
import org.bson.BsonWriter;
|
import org.bson.BsonWriter;
|
||||||
import org.bson.BsonBinaryWriter
|
import org.bson.BsonBinaryWriter
|
||||||
import java.io.Closeable;
|
import java.io.Closeable;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
|
||||||
import static com.google.common.base.Strings.lenientFormat;
|
import static com.google.common.base.Strings.lenientFormat;
|
||||||
|
|
||||||
public final class BsonJsonModelRowGenerator implements Closeable {
|
public final class BsonJsonModelRowGenerator implements Closeable {
|
||||||
// TODO: C# TO JAVA CONVERTER: C# to Java Converter cannot determine whether this System.IO.MemoryStream is
|
// TODO: C# TO JAVA CONVERTER: C# to Java Converter cannot determine whether this System.IO.MemoryStream is
|
||||||
// input or output:
|
// input or output:
|
||||||
private MemoryStream stream;
|
private MemoryStream stream;
|
||||||
private BsonWriter writer;
|
private BsonWriter writer;
|
||||||
|
|
||||||
public BsonJsonModelRowGenerator(int capacity) {
|
public BsonJsonModelRowGenerator(int capacity) {
|
||||||
// TODO: C# TO JAVA CONVERTER: C# to Java Converter cannot determine whether this System.IO.MemoryStream
|
// TODO: C# TO JAVA CONVERTER: C# to Java Converter cannot determine whether this System.IO.MemoryStream
|
||||||
// is input or output:
|
// is input or output:
|
||||||
this.stream = new MemoryStream(capacity);
|
this.stream = new MemoryStream(capacity);
|
||||||
this.writer = new BsonBinaryWriter(this.stream);
|
this.writer = new BsonBinaryWriter(this.stream);
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getLength() {
|
public int getLength() {
|
||||||
return (int)this.stream.Position;
|
return (int)this.stream.Position;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Reset() {
|
public void Reset() {
|
||||||
this.stream.SetLength(0);
|
this.stream.SetLength(0);
|
||||||
this.stream.Position = 0;
|
this.stream.Position = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
//C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java:
|
//C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java:
|
||||||
//ORIGINAL LINE: public byte[] ToArray()
|
//ORIGINAL LINE: public byte[] ToArray()
|
||||||
public byte[] ToArray() {
|
public byte[] ToArray() {
|
||||||
return this.stream.ToArray();
|
return this.stream.ToArray();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void WriteBuffer(HashMap<Utf8String, Object> dict) {
|
public void WriteBuffer(HashMap<Utf8String, Object> dict) {
|
||||||
this.writer.writeStartDocument();
|
this.writer.writeStartDocument();
|
||||||
for ((Utf8String propPath,Object propValue) : dict)
|
for ((Utf8String propPath,Object propValue) : dict)
|
||||||
{
|
{
|
||||||
this.JsonModelSwitch(propPath, propValue);
|
this.JsonModelSwitch(propPath, propValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
this.writer.writeEndDocument();
|
this.writer.writeEndDocument();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void close() throws IOException {
|
public void close() throws IOException {
|
||||||
this.writer.Dispose();
|
this.writer.Dispose();
|
||||||
this.stream.Dispose();
|
this.stream.Dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void JsonModelSwitch(Utf8String path, Object value) {
|
private void JsonModelSwitch(Utf8String path, Object value) {
|
||||||
if (path != null) {
|
if (path != null) {
|
||||||
this.writer.writeName(path.toString());
|
this.writer.writeName(path.toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (value) {
|
switch (value) {
|
||||||
case null:
|
case null:
|
||||||
this.writer.writeNull();
|
this.writer.writeNull();
|
||||||
return;
|
return;
|
||||||
// TODO: C# TO JAVA CONVERTER: Java has no equivalent to C# pattern variables in 'case' statements:
|
// TODO: C# TO JAVA CONVERTER: Java has no equivalent to C# pattern variables in 'case' statements:
|
||||||
//ORIGINAL LINE: case bool x:
|
//ORIGINAL LINE: case bool x:
|
||||||
case
|
case
|
||||||
boolean x:
|
boolean x:
|
||||||
this.writer.writeBoolean(x);
|
this.writer.writeBoolean(x);
|
||||||
return;
|
return;
|
||||||
// TODO: C# TO JAVA CONVERTER: Java has no equivalent to C# pattern variables in 'case' statements:
|
// TODO: C# TO JAVA CONVERTER: Java has no equivalent to C# pattern variables in 'case' statements:
|
||||||
//ORIGINAL LINE: case long x:
|
//ORIGINAL LINE: case long x:
|
||||||
case
|
case
|
||||||
long x:
|
long x:
|
||||||
this.writer.writeInt64(x);
|
this.writer.writeInt64(x);
|
||||||
return;
|
return;
|
||||||
// TODO: C# TO JAVA CONVERTER: Java has no equivalent to C# pattern variables in 'case' statements:
|
// TODO: C# TO JAVA CONVERTER: Java has no equivalent to C# pattern variables in 'case' statements:
|
||||||
//ORIGINAL LINE: case double x:
|
//ORIGINAL LINE: case double x:
|
||||||
case
|
case
|
||||||
double x:
|
double x:
|
||||||
this.writer.writeDouble(x);
|
this.writer.writeDouble(x);
|
||||||
return;
|
return;
|
||||||
// TODO: C# TO JAVA CONVERTER: Java has no equivalent to C# pattern variables in 'case' statements:
|
// TODO: C# TO JAVA CONVERTER: Java has no equivalent to C# pattern variables in 'case' statements:
|
||||||
//ORIGINAL LINE: case string x:
|
//ORIGINAL LINE: case string x:
|
||||||
case String
|
case String
|
||||||
x:
|
x:
|
||||||
this.writer.writeString(x);
|
this.writer.writeString(x);
|
||||||
return;
|
return;
|
||||||
// TODO: C# TO JAVA CONVERTER: Java has no equivalent to C# pattern variables in 'case' statements:
|
// TODO: C# TO JAVA CONVERTER: Java has no equivalent to C# pattern variables in 'case' statements:
|
||||||
//ORIGINAL LINE: case Utf8String x:
|
//ORIGINAL LINE: case Utf8String x:
|
||||||
case Utf8String
|
case Utf8String
|
||||||
x:
|
x:
|
||||||
this.writer.writeString(x.toString());
|
this.writer.writeString(x.toString());
|
||||||
return;
|
return;
|
||||||
// TODO: C# TO JAVA CONVERTER: Java has no equivalent to C# pattern variables in 'case' statements:
|
// TODO: C# TO JAVA CONVERTER: Java has no equivalent to C# pattern variables in 'case' statements:
|
||||||
//ORIGINAL LINE: case byte[] x:
|
//ORIGINAL LINE: case byte[] x:
|
||||||
//C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java:
|
//C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java:
|
||||||
case
|
case
|
||||||
byte[] x:
|
byte[] x:
|
||||||
this.writer.writeBytes(x);
|
this.writer.writeBytes(x);
|
||||||
return;
|
return;
|
||||||
// TODO: C# TO JAVA CONVERTER: Java has no equivalent to C# pattern variables in 'case' statements:
|
// TODO: C# TO JAVA CONVERTER: Java has no equivalent to C# pattern variables in 'case' statements:
|
||||||
//ORIGINAL LINE: case Dictionary<Utf8String, object> x:
|
//ORIGINAL LINE: case Dictionary<Utf8String, object> x:
|
||||||
case HashMap < Utf8String, Object > x:
|
case HashMap < Utf8String, Object > x:
|
||||||
this.writer.writeStartDocument();
|
this.writer.writeStartDocument();
|
||||||
for ((Utf8String propPath,Object propValue) :x)
|
for ((Utf8String propPath,Object propValue) :x)
|
||||||
{
|
{
|
||||||
this.JsonModelSwitch(propPath, propValue);
|
this.JsonModelSwitch(propPath, propValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
this.writer.writeEndDocument();
|
this.writer.writeEndDocument();
|
||||||
return;
|
return;
|
||||||
// TODO: C# TO JAVA CONVERTER: Java has no equivalent to C# pattern variables in 'case' statements:
|
// TODO: C# TO JAVA CONVERTER: Java has no equivalent to C# pattern variables in 'case' statements:
|
||||||
//ORIGINAL LINE: case List<object> x:
|
//ORIGINAL LINE: case List<object> x:
|
||||||
case ArrayList < Object > x:
|
case ArrayList < Object > x:
|
||||||
this.writer.writeStartArray();
|
this.writer.writeStartArray();
|
||||||
for (Object item : x) {
|
for (Object item : x) {
|
||||||
this.JsonModelSwitch(null, item);
|
this.JsonModelSwitch(null, item);
|
||||||
}
|
}
|
||||||
|
|
||||||
this.writer.writeEndArray();
|
this.writer.writeEndArray();
|
||||||
|
|
||||||
return;
|
return;
|
||||||
default:
|
default:
|
||||||
throw new IllegalStateException(lenientFormat("Unknown type will be ignored: %s", value.getClass().getSimpleName()));
|
throw new IllegalStateException(lenientFormat("Unknown type will be ignored: %s", value.getClass().getSimpleName()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+53
-53
@@ -1,54 +1,54 @@
|
|||||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||||
// Licensed under the MIT License.
|
// Licensed under the MIT License.
|
||||||
|
|
||||||
package com.azure.data.cosmos.serialization.hybridrow.perf;
|
package com.azure.data.cosmos.serialization.hybridrow.perf;
|
||||||
|
|
||||||
import MongoDB.Bson.*;
|
import MongoDB.Bson.*;
|
||||||
import MongoDB.Bson.IO.*;
|
import MongoDB.Bson.IO.*;
|
||||||
|
|
||||||
public final class BsonReaderExtensions {
|
public final class BsonReaderExtensions {
|
||||||
public static void VisitBsonDocument(BsonReader bsonReader) {
|
public static void VisitBsonDocument(BsonReader bsonReader) {
|
||||||
bsonReader.ReadStartDocument();
|
bsonReader.ReadStartDocument();
|
||||||
BsonType type;
|
BsonType type;
|
||||||
while ((type = bsonReader.ReadBsonType()) != BsonType.EndOfDocument) {
|
while ((type = bsonReader.ReadBsonType()) != BsonType.EndOfDocument) {
|
||||||
String path = bsonReader.ReadName();
|
String path = bsonReader.ReadName();
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case BsonType.Array:
|
case BsonType.Array:
|
||||||
BsonReaderExtensions.VisitBsonArray(bsonReader);
|
BsonReaderExtensions.VisitBsonArray(bsonReader);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case BsonType.Document:
|
case BsonType.Document:
|
||||||
BsonReaderExtensions.VisitBsonDocument(bsonReader);
|
BsonReaderExtensions.VisitBsonDocument(bsonReader);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
bsonReader.SkipValue();
|
bsonReader.SkipValue();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bsonReader.ReadEndDocument();
|
bsonReader.ReadEndDocument();
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void VisitBsonArray(BsonReader bsonReader) {
|
private static void VisitBsonArray(BsonReader bsonReader) {
|
||||||
bsonReader.ReadStartArray();
|
bsonReader.ReadStartArray();
|
||||||
BsonType type;
|
BsonType type;
|
||||||
while ((type = bsonReader.ReadBsonType()) != BsonType.EndOfDocument) {
|
while ((type = bsonReader.ReadBsonType()) != BsonType.EndOfDocument) {
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case BsonType.Array:
|
case BsonType.Array:
|
||||||
BsonReaderExtensions.VisitBsonArray(bsonReader);
|
BsonReaderExtensions.VisitBsonArray(bsonReader);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case BsonType.Document:
|
case BsonType.Document:
|
||||||
BsonReaderExtensions.VisitBsonDocument(bsonReader);
|
BsonReaderExtensions.VisitBsonDocument(bsonReader);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
bsonReader.SkipValue();
|
bsonReader.SkipValue();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bsonReader.ReadEndArray();
|
bsonReader.ReadEndArray();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+313
-313
@@ -1,314 +1,314 @@
|
|||||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||||
// Licensed under the MIT License.
|
// Licensed under the MIT License.
|
||||||
|
|
||||||
package com.azure.data.cosmos.serialization.hybridrow.perf;
|
package com.azure.data.cosmos.serialization.hybridrow.perf;
|
||||||
|
|
||||||
import MongoDB.Bson.*;
|
import MongoDB.Bson.*;
|
||||||
import MongoDB.Bson.IO.*;
|
import MongoDB.Bson.IO.*;
|
||||||
import com.azure.data.cosmos.serialization.hybridrow.Float128;
|
import com.azure.data.cosmos.serialization.hybridrow.Float128;
|
||||||
import com.azure.data.cosmos.serialization.hybridrow.UnixDateTime;
|
import com.azure.data.cosmos.serialization.hybridrow.UnixDateTime;
|
||||||
import com.azure.data.cosmos.serialization.hybridrow.layouts.Layout;
|
import com.azure.data.cosmos.serialization.hybridrow.layouts.Layout;
|
||||||
import com.azure.data.cosmos.serialization.hybridrow.layouts.LayoutColumn;
|
import com.azure.data.cosmos.serialization.hybridrow.layouts.LayoutColumn;
|
||||||
import com.azure.data.cosmos.serialization.hybridrow.layouts.LayoutResolver;
|
import com.azure.data.cosmos.serialization.hybridrow.layouts.LayoutResolver;
|
||||||
import com.azure.data.cosmos.serialization.hybridrow.layouts.TypeArgument;
|
import com.azure.data.cosmos.serialization.hybridrow.layouts.TypeArgument;
|
||||||
import org.bson.BsonBinaryWriter;
|
import org.bson.BsonBinaryWriter;
|
||||||
import org.bson.BsonWriter;
|
import org.bson.BsonWriter;
|
||||||
|
|
||||||
import java.io.Closeable;
|
import java.io.Closeable;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
import static com.google.common.base.Preconditions.checkArgument;
|
import static com.google.common.base.Preconditions.checkArgument;
|
||||||
import static com.google.common.base.Strings.lenientFormat;
|
import static com.google.common.base.Strings.lenientFormat;
|
||||||
|
|
||||||
public final class BsonRowGenerator implements Closeable {
|
public final class BsonRowGenerator implements Closeable {
|
||||||
private Layout layout;
|
private Layout layout;
|
||||||
private LayoutResolver resolver;
|
private LayoutResolver resolver;
|
||||||
// TODO: C# TO JAVA CONVERTER: C# to Java Converter cannot determine whether this System.IO.MemoryStream is
|
// TODO: C# TO JAVA CONVERTER: C# to Java Converter cannot determine whether this System.IO.MemoryStream is
|
||||||
// input or output:
|
// input or output:
|
||||||
private MemoryStream stream;
|
private MemoryStream stream;
|
||||||
private BsonWriter writer;
|
private BsonWriter writer;
|
||||||
|
|
||||||
public BsonRowGenerator(int capacity, Layout layout, LayoutResolver resolver) {
|
public BsonRowGenerator(int capacity, Layout layout, LayoutResolver resolver) {
|
||||||
// TODO: C# TO JAVA CONVERTER: C# to Java Converter cannot determine whether this System.IO.MemoryStream
|
// TODO: C# TO JAVA CONVERTER: C# to Java Converter cannot determine whether this System.IO.MemoryStream
|
||||||
// is input or output:
|
// is input or output:
|
||||||
this.stream = new MemoryStream(capacity);
|
this.stream = new MemoryStream(capacity);
|
||||||
this.writer = new BsonBinaryWriter(this.stream);
|
this.writer = new BsonBinaryWriter(this.stream);
|
||||||
this.layout = layout;
|
this.layout = layout;
|
||||||
this.resolver = resolver;
|
this.resolver = resolver;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getLength() {
|
public int getLength() {
|
||||||
return (int)this.stream.Position;
|
return (int)this.stream.Position;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Reset() {
|
public void Reset() {
|
||||||
this.stream.SetLength(0);
|
this.stream.SetLength(0);
|
||||||
this.stream.Position = 0;
|
this.stream.Position = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
//C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java:
|
//C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java:
|
||||||
//ORIGINAL LINE: public byte[] ToArray()
|
//ORIGINAL LINE: public byte[] ToArray()
|
||||||
public byte[] ToArray() {
|
public byte[] ToArray() {
|
||||||
return this.stream.ToArray();
|
return this.stream.ToArray();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void WriteBuffer(HashMap<Utf8String, Object> dict) {
|
public void WriteBuffer(HashMap<Utf8String, Object> dict) {
|
||||||
this.writer.writeStartDocument();
|
this.writer.writeStartDocument();
|
||||||
for (LayoutColumn c : this.layout.columns()) {
|
for (LayoutColumn c : this.layout.columns()) {
|
||||||
this.LayoutCodeSwitch(c.path(), c.typeArg().clone(), dict.get(c.path()));
|
this.LayoutCodeSwitch(c.path(), c.typeArg().clone(), dict.get(c.path()));
|
||||||
}
|
}
|
||||||
|
|
||||||
this.writer.writeEndDocument();
|
this.writer.writeEndDocument();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void close() throws IOException {
|
public void close() throws IOException {
|
||||||
this.writer.Dispose();
|
this.writer.Dispose();
|
||||||
this.stream.Dispose();
|
this.stream.Dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void DispatchArray(TypeArgument typeArg, Object value) {
|
private void DispatchArray(TypeArgument typeArg, Object value) {
|
||||||
|
|
||||||
checkArgument(typeArg.typeArgs().count() == 1);
|
checkArgument(typeArg.typeArgs().count() == 1);
|
||||||
this.writer.writeStartArray();
|
this.writer.writeStartArray();
|
||||||
|
|
||||||
for (Object item : (ArrayList<Object>)value) {
|
for (Object item : (ArrayList<Object>)value) {
|
||||||
this.LayoutCodeSwitch(null, typeArg.typeArgs().get(0).clone(), item);
|
this.LayoutCodeSwitch(null, typeArg.typeArgs().get(0).clone(), item);
|
||||||
}
|
}
|
||||||
|
|
||||||
this.writer.writeEndArray();
|
this.writer.writeEndArray();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void DispatchMap(TypeArgument typeArg, Object value) {
|
private void DispatchMap(TypeArgument typeArg, Object value) {
|
||||||
checkArgument(typeArg.typeArgs().count() == 2);
|
checkArgument(typeArg.typeArgs().count() == 2);
|
||||||
|
|
||||||
this.writer.writeStartArray();
|
this.writer.writeStartArray();
|
||||||
for (Object item : (ArrayList<Object>)value) {
|
for (Object item : (ArrayList<Object>)value) {
|
||||||
this.DispatchTuple(typeArg.clone(), item);
|
this.DispatchTuple(typeArg.clone(), item);
|
||||||
}
|
}
|
||||||
|
|
||||||
this.writer.writeEndArray();
|
this.writer.writeEndArray();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void DispatchNullable(TypeArgument typeArg, Object value) {
|
private void DispatchNullable(TypeArgument typeArg, Object value) {
|
||||||
checkArgument(typeArg.typeArgs().count() == 1);
|
checkArgument(typeArg.typeArgs().count() == 1);
|
||||||
|
|
||||||
if (value != null) {
|
if (value != null) {
|
||||||
this.LayoutCodeSwitch(null, typeArg.typeArgs().get(0).clone(), value);
|
this.LayoutCodeSwitch(null, typeArg.typeArgs().get(0).clone(), value);
|
||||||
} else {
|
} else {
|
||||||
this.writer.writeNull();
|
this.writer.writeNull();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void DispatchObject(TypeArgument typeArg, Object value) {
|
private void DispatchObject(TypeArgument typeArg, Object value) {
|
||||||
this.writer.writeStartDocument();
|
this.writer.writeStartDocument();
|
||||||
// TODO: support properties in an object scope.
|
// TODO: support properties in an object scope.
|
||||||
this.writer.writeEndDocument();
|
this.writer.writeEndDocument();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void DispatchSet(TypeArgument typeArg, Object value) {
|
private void DispatchSet(TypeArgument typeArg, Object value) {
|
||||||
checkArgument(typeArg.typeArgs().count() == 1);
|
checkArgument(typeArg.typeArgs().count() == 1);
|
||||||
|
|
||||||
this.writer.WriteStartArray();
|
this.writer.WriteStartArray();
|
||||||
for (Object item : (ArrayList<Object>)value) {
|
for (Object item : (ArrayList<Object>)value) {
|
||||||
this.LayoutCodeSwitch(null, typeArg.typeArgs().get(0).clone(), item);
|
this.LayoutCodeSwitch(null, typeArg.typeArgs().get(0).clone(), item);
|
||||||
}
|
}
|
||||||
|
|
||||||
this.writer.WriteEndArray();
|
this.writer.WriteEndArray();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void DispatchTuple(TypeArgument typeArg, Object value) {
|
private void DispatchTuple(TypeArgument typeArg, Object value) {
|
||||||
checkArgument(typeArg.typeArgs().count() >= 2);
|
checkArgument(typeArg.typeArgs().count() >= 2);
|
||||||
ArrayList<Object> items = (ArrayList<Object>)value;
|
ArrayList<Object> items = (ArrayList<Object>)value;
|
||||||
checkArgument(items.size() == typeArg.typeArgs().count());
|
checkArgument(items.size() == typeArg.typeArgs().count());
|
||||||
|
|
||||||
this.writer.WriteStartArray();
|
this.writer.WriteStartArray();
|
||||||
for (int i = 0; i < items.size(); i++) {
|
for (int i = 0; i < items.size(); i++) {
|
||||||
Object item = items.get(i);
|
Object item = items.get(i);
|
||||||
this.LayoutCodeSwitch(null, typeArg.typeArgs().get(i).clone(), item);
|
this.LayoutCodeSwitch(null, typeArg.typeArgs().get(i).clone(), item);
|
||||||
}
|
}
|
||||||
|
|
||||||
this.writer.WriteEndArray();
|
this.writer.WriteEndArray();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void DispatchUDT(TypeArgument typeArg, Object value) {
|
private void DispatchUDT(TypeArgument typeArg, Object value) {
|
||||||
this.writer.WriteStartDocument();
|
this.writer.WriteStartDocument();
|
||||||
|
|
||||||
HashMap<Utf8String, Object> dict = (HashMap<Utf8String, Object>)value;
|
HashMap<Utf8String, Object> dict = (HashMap<Utf8String, Object>)value;
|
||||||
Layout udt = this.resolver.resolve(typeArg.typeArgs().schemaId().clone());
|
Layout udt = this.resolver.resolve(typeArg.typeArgs().schemaId().clone());
|
||||||
for (LayoutColumn c : udt.columns()) {
|
for (LayoutColumn c : udt.columns()) {
|
||||||
this.LayoutCodeSwitch(c.path(), c.typeArg().clone(), dict.get(c.path()));
|
this.LayoutCodeSwitch(c.path(), c.typeArg().clone(), dict.get(c.path()));
|
||||||
}
|
}
|
||||||
|
|
||||||
this.writer.WriteEndDocument();
|
this.writer.WriteEndDocument();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void LayoutCodeSwitch(UtfAnyString path, TypeArgument typeArg, Object value) {
|
private void LayoutCodeSwitch(UtfAnyString path, TypeArgument typeArg, Object value) {
|
||||||
if (!path.IsNull) {
|
if (!path.IsNull) {
|
||||||
this.writer.WriteName(path);
|
this.writer.WriteName(path);
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (typeArg.type().LayoutCode) {
|
switch (typeArg.type().LayoutCode) {
|
||||||
case Null:
|
case Null:
|
||||||
this.writer.WriteNull();
|
this.writer.WriteNull();
|
||||||
return;
|
return;
|
||||||
|
|
||||||
case Boolean:
|
case Boolean:
|
||||||
this.writer.WriteBoolean(value == null ? false : (Boolean)value);
|
this.writer.WriteBoolean(value == null ? false : (Boolean)value);
|
||||||
return;
|
return;
|
||||||
|
|
||||||
case Int8:
|
case Int8:
|
||||||
this.writer.WriteInt32(value == null ? 0 : (byte)value);
|
this.writer.WriteInt32(value == null ? 0 : (byte)value);
|
||||||
return;
|
return;
|
||||||
|
|
||||||
case Int16:
|
case Int16:
|
||||||
this.writer.WriteInt32(value == null ? 0 : (Short)value);
|
this.writer.WriteInt32(value == null ? 0 : (Short)value);
|
||||||
return;
|
return;
|
||||||
|
|
||||||
case Int32:
|
case Int32:
|
||||||
this.writer.WriteInt32(value == null ? 0 : (Integer)value);
|
this.writer.WriteInt32(value == null ? 0 : (Integer)value);
|
||||||
return;
|
return;
|
||||||
|
|
||||||
case Int64:
|
case Int64:
|
||||||
this.writer.WriteInt64(value == null ? 0 : (Long)value);
|
this.writer.WriteInt64(value == null ? 0 : (Long)value);
|
||||||
return;
|
return;
|
||||||
|
|
||||||
case UInt8:
|
case UInt8:
|
||||||
//C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java:
|
//C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java:
|
||||||
//ORIGINAL LINE: this.writer.WriteInt32(value == null ? default(byte) : (byte)value);
|
//ORIGINAL LINE: this.writer.WriteInt32(value == null ? default(byte) : (byte)value);
|
||||||
this.writer.WriteInt32(value == null ? 0 : (Byte)value);
|
this.writer.WriteInt32(value == null ? 0 : (Byte)value);
|
||||||
return;
|
return;
|
||||||
|
|
||||||
case UInt16:
|
case UInt16:
|
||||||
//C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java:
|
//C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java:
|
||||||
//ORIGINAL LINE: this.writer.WriteInt32(value == null ? default(ushort) : (ushort)value);
|
//ORIGINAL LINE: this.writer.WriteInt32(value == null ? default(ushort) : (ushort)value);
|
||||||
this.writer.WriteInt32(value == null ? 0 : (short)value);
|
this.writer.WriteInt32(value == null ? 0 : (short)value);
|
||||||
return;
|
return;
|
||||||
|
|
||||||
case UInt32:
|
case UInt32:
|
||||||
// TODO: C# TO JAVA CONVERTER: There is no Java equivalent to 'unchecked' in this context:
|
// TODO: C# TO JAVA CONVERTER: There is no Java equivalent to 'unchecked' in this context:
|
||||||
//ORIGINAL LINE: this.writer.WriteInt32(value == null ? default(int) : unchecked((int)(uint)value));
|
//ORIGINAL LINE: this.writer.WriteInt32(value == null ? default(int) : unchecked((int)(uint)value));
|
||||||
//C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java:
|
//C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java:
|
||||||
this.writer.WriteInt32(value == null ? 0 : (int)(int)value);
|
this.writer.WriteInt32(value == null ? 0 : (int)(int)value);
|
||||||
return;
|
return;
|
||||||
|
|
||||||
case UInt64:
|
case UInt64:
|
||||||
// TODO: C# TO JAVA CONVERTER: There is no Java equivalent to 'unchecked' in this context:
|
// TODO: C# TO JAVA CONVERTER: There is no Java equivalent to 'unchecked' in this context:
|
||||||
//ORIGINAL LINE: this.writer.WriteInt64(value == null ? default(long) : unchecked((long)(ulong)value));
|
//ORIGINAL LINE: this.writer.WriteInt64(value == null ? default(long) : unchecked((long)(ulong)value));
|
||||||
//C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java:
|
//C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java:
|
||||||
this.writer.WriteInt64(value == null ? 0 : (long)(long)value);
|
this.writer.WriteInt64(value == null ? 0 : (long)(long)value);
|
||||||
return;
|
return;
|
||||||
|
|
||||||
case VarInt:
|
case VarInt:
|
||||||
this.writer.WriteInt64(value == null ? 0 : (Long)value);
|
this.writer.WriteInt64(value == null ? 0 : (Long)value);
|
||||||
return;
|
return;
|
||||||
|
|
||||||
case VarUInt:
|
case VarUInt:
|
||||||
// TODO: C# TO JAVA CONVERTER: There is no Java equivalent to 'unchecked' in this context:
|
// TODO: C# TO JAVA CONVERTER: There is no Java equivalent to 'unchecked' in this context:
|
||||||
//ORIGINAL LINE: this.writer.WriteInt64(value == null ? default(long) : unchecked((long)(ulong)value));
|
//ORIGINAL LINE: this.writer.WriteInt64(value == null ? default(long) : unchecked((long)(ulong)value));
|
||||||
//C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java:
|
//C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java:
|
||||||
this.writer.WriteInt64(value == null ? 0 : (long)(long)value);
|
this.writer.WriteInt64(value == null ? 0 : (long)(long)value);
|
||||||
return;
|
return;
|
||||||
|
|
||||||
case Float32:
|
case Float32:
|
||||||
this.writer.WriteDouble(value == null ? 0 : (Float)value);
|
this.writer.WriteDouble(value == null ? 0 : (Float)value);
|
||||||
return;
|
return;
|
||||||
|
|
||||||
case Float64:
|
case Float64:
|
||||||
this.writer.WriteDouble(value == null ? 0 : (Double)value);
|
this.writer.WriteDouble(value == null ? 0 : (Double)value);
|
||||||
return;
|
return;
|
||||||
|
|
||||||
case Float128:
|
case Float128:
|
||||||
Decimal128 d128 = null;
|
Decimal128 d128 = null;
|
||||||
if (value != null) {
|
if (value != null) {
|
||||||
Float128 f128 = (Float128)value;
|
Float128 f128 = (Float128)value;
|
||||||
// TODO: C# TO JAVA CONVERTER: There is no Java equivalent to 'unchecked' in this context:
|
// TODO: C# TO JAVA CONVERTER: There is no Java equivalent to 'unchecked' in this context:
|
||||||
//ORIGINAL LINE: d128 = unchecked(Decimal128.FromIEEEBits((ulong)f128.High, (ulong)f128.Low));
|
//ORIGINAL LINE: d128 = unchecked(Decimal128.FromIEEEBits((ulong)f128.High, (ulong)f128.Low));
|
||||||
//C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java:
|
//C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java:
|
||||||
d128 = Decimal128.FromIEEEBits((long) f128.high(), (long) f128.low());
|
d128 = Decimal128.FromIEEEBits((long) f128.high(), (long) f128.low());
|
||||||
}
|
}
|
||||||
|
|
||||||
this.writer.WriteDecimal128(d128);
|
this.writer.WriteDecimal128(d128);
|
||||||
return;
|
return;
|
||||||
|
|
||||||
case Decimal:
|
case Decimal:
|
||||||
this.writer.WriteDecimal128(value == null ? null : new Decimal128((BigDecimal)value));
|
this.writer.WriteDecimal128(value == null ? null : new Decimal128((BigDecimal)value));
|
||||||
return;
|
return;
|
||||||
|
|
||||||
case DateTime:
|
case DateTime:
|
||||||
this.writer.WriteDateTime(value == null ? 0 : ((LocalDateTime)value).getTime());
|
this.writer.WriteDateTime(value == null ? 0 : ((LocalDateTime)value).getTime());
|
||||||
return;
|
return;
|
||||||
|
|
||||||
case UnixDateTime:
|
case UnixDateTime:
|
||||||
this.writer.WriteDateTime(value == null ? 0 : ((UnixDateTime)value).getMilliseconds());
|
this.writer.WriteDateTime(value == null ? 0 : ((UnixDateTime)value).getMilliseconds());
|
||||||
return;
|
return;
|
||||||
|
|
||||||
case Guid:
|
case Guid:
|
||||||
this.writer.WriteString(value == null ? "" : ((UUID)value).toString());
|
this.writer.WriteString(value == null ? "" : ((UUID)value).toString());
|
||||||
return;
|
return;
|
||||||
|
|
||||||
case MongoDbObjectId:
|
case MongoDbObjectId:
|
||||||
this.writer.WriteObjectId(value == null ? null : new ObjectId(((MongoDbObjectId)value).ToByteArray()));
|
this.writer.WriteObjectId(value == null ? null : new ObjectId(((MongoDbObjectId)value).ToByteArray()));
|
||||||
return;
|
return;
|
||||||
|
|
||||||
case Utf8:
|
case Utf8:
|
||||||
this.writer.WriteString(value == null ? "" : ((Utf8String)value).toString());
|
this.writer.WriteString(value == null ? "" : ((Utf8String)value).toString());
|
||||||
return;
|
return;
|
||||||
|
|
||||||
case Binary:
|
case Binary:
|
||||||
//C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java:
|
//C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java:
|
||||||
//ORIGINAL LINE: this.writer.WriteBytes(value == null ? default(byte[]) : (byte[])value);
|
//ORIGINAL LINE: this.writer.WriteBytes(value == null ? default(byte[]) : (byte[])value);
|
||||||
this.writer.WriteBytes(value == null ? null : (byte[])value);
|
this.writer.WriteBytes(value == null ? null : (byte[])value);
|
||||||
return;
|
return;
|
||||||
|
|
||||||
case ObjectScope:
|
case ObjectScope:
|
||||||
case ImmutableObjectScope:
|
case ImmutableObjectScope:
|
||||||
this.DispatchObject(typeArg.clone(), value);
|
this.DispatchObject(typeArg.clone(), value);
|
||||||
return;
|
return;
|
||||||
|
|
||||||
case TypedArrayScope:
|
case TypedArrayScope:
|
||||||
case ImmutableTypedArrayScope:
|
case ImmutableTypedArrayScope:
|
||||||
this.DispatchArray(typeArg.clone(), value);
|
this.DispatchArray(typeArg.clone(), value);
|
||||||
return;
|
return;
|
||||||
|
|
||||||
case TypedSetScope:
|
case TypedSetScope:
|
||||||
case ImmutableTypedSetScope:
|
case ImmutableTypedSetScope:
|
||||||
this.DispatchSet(typeArg.clone(), value);
|
this.DispatchSet(typeArg.clone(), value);
|
||||||
return;
|
return;
|
||||||
|
|
||||||
case TypedMapScope:
|
case TypedMapScope:
|
||||||
case ImmutableTypedMapScope:
|
case ImmutableTypedMapScope:
|
||||||
this.DispatchMap(typeArg.clone(), value);
|
this.DispatchMap(typeArg.clone(), value);
|
||||||
return;
|
return;
|
||||||
|
|
||||||
case TupleScope:
|
case TupleScope:
|
||||||
case ImmutableTupleScope:
|
case ImmutableTupleScope:
|
||||||
case TypedTupleScope:
|
case TypedTupleScope:
|
||||||
case ImmutableTypedTupleScope:
|
case ImmutableTypedTupleScope:
|
||||||
case TaggedScope:
|
case TaggedScope:
|
||||||
case ImmutableTaggedScope:
|
case ImmutableTaggedScope:
|
||||||
case Tagged2Scope:
|
case Tagged2Scope:
|
||||||
case ImmutableTagged2Scope:
|
case ImmutableTagged2Scope:
|
||||||
this.DispatchTuple(typeArg.clone(), value);
|
this.DispatchTuple(typeArg.clone(), value);
|
||||||
return;
|
return;
|
||||||
|
|
||||||
case NullableScope:
|
case NullableScope:
|
||||||
case ImmutableNullableScope:
|
case ImmutableNullableScope:
|
||||||
this.DispatchNullable(typeArg.clone(), value);
|
this.DispatchNullable(typeArg.clone(), value);
|
||||||
return;
|
return;
|
||||||
|
|
||||||
case Schema:
|
case Schema:
|
||||||
case ImmutableSchema:
|
case ImmutableSchema:
|
||||||
this.DispatchUDT(typeArg.clone(), value);
|
this.DispatchUDT(typeArg.clone(), value);
|
||||||
return;
|
return;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
throw new IllegalStateException(lenientFormat("Unknown type will be ignored: %s", typeArg.clone()));
|
throw new IllegalStateException(lenientFormat("Unknown type will be ignored: %s", typeArg.clone()));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+310
-310
@@ -1,311 +1,311 @@
|
|||||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||||
// Licensed under the MIT License.
|
// Licensed under the MIT License.
|
||||||
|
|
||||||
package com.azure.data.cosmos.serialization.hybridrow.perf;
|
package com.azure.data.cosmos.serialization.hybridrow.perf;
|
||||||
|
|
||||||
import com.azure.data.cosmos.core.Reference;
|
import com.azure.data.cosmos.core.Reference;
|
||||||
import com.azure.data.cosmos.core.Reference;
|
import com.azure.data.cosmos.core.Reference;
|
||||||
import com.azure.data.cosmos.serialization.hybridrow.Result;
|
import com.azure.data.cosmos.serialization.hybridrow.Result;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Tests involving generated (early bound) code compiled from schema based on a partial implementation
|
* Tests involving generated (early bound) code compiled from schema based on a partial implementation
|
||||||
* of Cassandra Hotel Schema described here: https: //www.oreilly.com/ideas/cassandra-data-modeling .
|
* of Cassandra Hotel Schema described here: https: //www.oreilly.com/ideas/cassandra-data-modeling .
|
||||||
* <p>
|
* <p>
|
||||||
* The tests here differ from {@link SchematizedMicroBenchmarkSuite} in that they rely on
|
* The tests here differ from {@link SchematizedMicroBenchmarkSuite} in that they rely on
|
||||||
* the schema being known at compile time instead of runtime. This allows code to be generated that
|
* the schema being known at compile time instead of runtime. This allows code to be generated that
|
||||||
* directly addresses the schema structure instead of dynamically discovering schema structure at
|
* directly addresses the schema structure instead of dynamically discovering schema structure at
|
||||||
* runtime.
|
* runtime.
|
||||||
* </p>
|
* </p>
|
||||||
*/
|
*/
|
||||||
// TODO: C# TO JAVA CONVERTER: Java annotations will not correspond to .NET attributes:
|
// TODO: C# TO JAVA CONVERTER: Java annotations will not correspond to .NET attributes:
|
||||||
//ORIGINAL LINE: [TestClass] public sealed class CodeGenMicroBenchmarkSuite : MicroBenchmarkSuiteBase
|
//ORIGINAL LINE: [TestClass] public sealed class CodeGenMicroBenchmarkSuite : MicroBenchmarkSuiteBase
|
||||||
public final class CodeGenMicroBenchmarkSuite extends MicroBenchmarkSuiteBase {
|
public final class CodeGenMicroBenchmarkSuite extends MicroBenchmarkSuiteBase {
|
||||||
private static final int GuestCount = 1000;
|
private static final int GuestCount = 1000;
|
||||||
private static final int HotelCount = 10000;
|
private static final int HotelCount = 10000;
|
||||||
private static final int RoomsCount = 10000;
|
private static final int RoomsCount = 10000;
|
||||||
|
|
||||||
// TODO: C# TO JAVA CONVERTER: Java annotations will not correspond to .NET attributes:
|
// TODO: C# TO JAVA CONVERTER: Java annotations will not correspond to .NET attributes:
|
||||||
//ORIGINAL LINE: [TestMethod][Owner("jthunter")][DeploymentItem(TestData.GuestsExpected, TestData.Target)] public
|
//ORIGINAL LINE: [TestMethod][Owner("jthunter")][DeploymentItem(TestData.GuestsExpected, TestData.Target)] public
|
||||||
// async Task CodeGenGuestsReadBenchmarkAsync()
|
// async Task CodeGenGuestsReadBenchmarkAsync()
|
||||||
// TODO: C# TO JAVA CONVERTER: There is no equivalent in Java to the 'async' keyword:
|
// TODO: C# TO JAVA CONVERTER: There is no equivalent in Java to the 'async' keyword:
|
||||||
//ORIGINAL LINE: [TestMethod][Owner("jthunter")][DeploymentItem(TestData.GuestsExpected, TestData.Target)] public
|
//ORIGINAL LINE: [TestMethod][Owner("jthunter")][DeploymentItem(TestData.GuestsExpected, TestData.Target)] public
|
||||||
// async Task CodeGenGuestsReadBenchmarkAsync()
|
// async Task CodeGenGuestsReadBenchmarkAsync()
|
||||||
public Task CodeGenGuestsReadBenchmarkAsync() {
|
public Task CodeGenGuestsReadBenchmarkAsync() {
|
||||||
String expectedFile = TestData.GuestsExpected;
|
String expectedFile = TestData.GuestsExpected;
|
||||||
// TODO: C# TO JAVA CONVERTER: Java has no equivalent to C# deconstruction declarations:
|
// TODO: C# TO JAVA CONVERTER: Java has no equivalent to C# deconstruction declarations:
|
||||||
(List < Dictionary < Utf8String, object >> expected, LayoutResolverNamespace resolver) =await
|
(List < Dictionary < Utf8String, object >> expected, LayoutResolverNamespace resolver) =await
|
||||||
this.LoadExpectedAsync(expectedFile);
|
this.LoadExpectedAsync(expectedFile);
|
||||||
CodeGenMicroBenchmarkSuite.CodeGenReadBenchmark(resolver, "Guests", "Guests",
|
CodeGenMicroBenchmarkSuite.CodeGenReadBenchmark(resolver, "Guests", "Guests",
|
||||||
CodeGenMicroBenchmarkSuite.GuestCount, expected);
|
CodeGenMicroBenchmarkSuite.GuestCount, expected);
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: C# TO JAVA CONVERTER: Java annotations will not correspond to .NET attributes:
|
// TODO: C# TO JAVA CONVERTER: Java annotations will not correspond to .NET attributes:
|
||||||
//ORIGINAL LINE: [TestMethod][Owner("jthunter")][DeploymentItem(TestData.GuestsExpected, TestData.Target)] public
|
//ORIGINAL LINE: [TestMethod][Owner("jthunter")][DeploymentItem(TestData.GuestsExpected, TestData.Target)] public
|
||||||
// async Task CodeGenGuestsWriteBenchmarkAsync()
|
// async Task CodeGenGuestsWriteBenchmarkAsync()
|
||||||
// TODO: C# TO JAVA CONVERTER: There is no equivalent in Java to the 'async' keyword:
|
// TODO: C# TO JAVA CONVERTER: There is no equivalent in Java to the 'async' keyword:
|
||||||
//ORIGINAL LINE: [TestMethod][Owner("jthunter")][DeploymentItem(TestData.GuestsExpected, TestData.Target)] public
|
//ORIGINAL LINE: [TestMethod][Owner("jthunter")][DeploymentItem(TestData.GuestsExpected, TestData.Target)] public
|
||||||
// async Task CodeGenGuestsWriteBenchmarkAsync()
|
// async Task CodeGenGuestsWriteBenchmarkAsync()
|
||||||
public Task CodeGenGuestsWriteBenchmarkAsync() {
|
public Task CodeGenGuestsWriteBenchmarkAsync() {
|
||||||
String expectedFile = TestData.GuestsExpected;
|
String expectedFile = TestData.GuestsExpected;
|
||||||
// TODO: C# TO JAVA CONVERTER: Java has no equivalent to C# deconstruction declarations:
|
// TODO: C# TO JAVA CONVERTER: Java has no equivalent to C# deconstruction declarations:
|
||||||
(List < Dictionary < Utf8String, object >> expected, LayoutResolverNamespace resolver) =await
|
(List < Dictionary < Utf8String, object >> expected, LayoutResolverNamespace resolver) =await
|
||||||
this.LoadExpectedAsync(expectedFile);
|
this.LoadExpectedAsync(expectedFile);
|
||||||
CodeGenMicroBenchmarkSuite.CodeGenWriteBenchmark(resolver, "Guests", "Guests",
|
CodeGenMicroBenchmarkSuite.CodeGenWriteBenchmark(resolver, "Guests", "Guests",
|
||||||
CodeGenMicroBenchmarkSuite.GuestCount, expected);
|
CodeGenMicroBenchmarkSuite.GuestCount, expected);
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: C# TO JAVA CONVERTER: Java annotations will not correspond to .NET attributes:
|
// TODO: C# TO JAVA CONVERTER: Java annotations will not correspond to .NET attributes:
|
||||||
//ORIGINAL LINE: [TestMethod][Owner("jthunter")][DeploymentItem(TestData.HotelExpected, TestData.Target)] public
|
//ORIGINAL LINE: [TestMethod][Owner("jthunter")][DeploymentItem(TestData.HotelExpected, TestData.Target)] public
|
||||||
// async Task CodeGenHotelReadBenchmarkAsync()
|
// async Task CodeGenHotelReadBenchmarkAsync()
|
||||||
// TODO: C# TO JAVA CONVERTER: There is no equivalent in Java to the 'async' keyword:
|
// TODO: C# TO JAVA CONVERTER: There is no equivalent in Java to the 'async' keyword:
|
||||||
//ORIGINAL LINE: [TestMethod][Owner("jthunter")][DeploymentItem(TestData.HotelExpected, TestData.Target)] public
|
//ORIGINAL LINE: [TestMethod][Owner("jthunter")][DeploymentItem(TestData.HotelExpected, TestData.Target)] public
|
||||||
// async Task CodeGenHotelReadBenchmarkAsync()
|
// async Task CodeGenHotelReadBenchmarkAsync()
|
||||||
public Task CodeGenHotelReadBenchmarkAsync() {
|
public Task CodeGenHotelReadBenchmarkAsync() {
|
||||||
String expectedFile = TestData.HotelExpected;
|
String expectedFile = TestData.HotelExpected;
|
||||||
// TODO: C# TO JAVA CONVERTER: Java has no equivalent to C# deconstruction declarations:
|
// TODO: C# TO JAVA CONVERTER: Java has no equivalent to C# deconstruction declarations:
|
||||||
(List < Dictionary < Utf8String, object >> expected, LayoutResolverNamespace resolver) =await
|
(List < Dictionary < Utf8String, object >> expected, LayoutResolverNamespace resolver) =await
|
||||||
this.LoadExpectedAsync(expectedFile);
|
this.LoadExpectedAsync(expectedFile);
|
||||||
CodeGenMicroBenchmarkSuite.CodeGenReadBenchmark(resolver, "Hotels", "Hotels",
|
CodeGenMicroBenchmarkSuite.CodeGenReadBenchmark(resolver, "Hotels", "Hotels",
|
||||||
CodeGenMicroBenchmarkSuite.HotelCount, expected);
|
CodeGenMicroBenchmarkSuite.HotelCount, expected);
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: C# TO JAVA CONVERTER: Java annotations will not correspond to .NET attributes:
|
// TODO: C# TO JAVA CONVERTER: Java annotations will not correspond to .NET attributes:
|
||||||
//ORIGINAL LINE: [TestMethod][Owner("jthunter")][DeploymentItem(TestData.HotelExpected, TestData.Target)] public
|
//ORIGINAL LINE: [TestMethod][Owner("jthunter")][DeploymentItem(TestData.HotelExpected, TestData.Target)] public
|
||||||
// async Task CodeGenHotelWriteBenchmarkAsync()
|
// async Task CodeGenHotelWriteBenchmarkAsync()
|
||||||
// TODO: C# TO JAVA CONVERTER: There is no equivalent in Java to the 'async' keyword:
|
// TODO: C# TO JAVA CONVERTER: There is no equivalent in Java to the 'async' keyword:
|
||||||
//ORIGINAL LINE: [TestMethod][Owner("jthunter")][DeploymentItem(TestData.HotelExpected, TestData.Target)] public
|
//ORIGINAL LINE: [TestMethod][Owner("jthunter")][DeploymentItem(TestData.HotelExpected, TestData.Target)] public
|
||||||
// async Task CodeGenHotelWriteBenchmarkAsync()
|
// async Task CodeGenHotelWriteBenchmarkAsync()
|
||||||
public Task CodeGenHotelWriteBenchmarkAsync() {
|
public Task CodeGenHotelWriteBenchmarkAsync() {
|
||||||
String expectedFile = TestData.HotelExpected;
|
String expectedFile = TestData.HotelExpected;
|
||||||
// TODO: C# TO JAVA CONVERTER: Java has no equivalent to C# deconstruction declarations:
|
// TODO: C# TO JAVA CONVERTER: Java has no equivalent to C# deconstruction declarations:
|
||||||
(List < Dictionary < Utf8String, object >> expected, LayoutResolverNamespace resolver) =await
|
(List < Dictionary < Utf8String, object >> expected, LayoutResolverNamespace resolver) =await
|
||||||
this.LoadExpectedAsync(expectedFile);
|
this.LoadExpectedAsync(expectedFile);
|
||||||
CodeGenMicroBenchmarkSuite.CodeGenWriteBenchmark(resolver, "Hotels", "Hotels",
|
CodeGenMicroBenchmarkSuite.CodeGenWriteBenchmark(resolver, "Hotels", "Hotels",
|
||||||
CodeGenMicroBenchmarkSuite.HotelCount, expected);
|
CodeGenMicroBenchmarkSuite.HotelCount, expected);
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: C# TO JAVA CONVERTER: Java annotations will not correspond to .NET attributes:
|
// TODO: C# TO JAVA CONVERTER: Java annotations will not correspond to .NET attributes:
|
||||||
//ORIGINAL LINE: [TestMethod][Owner("jthunter")][DeploymentItem(TestData.RoomsExpected, TestData.Target)] public
|
//ORIGINAL LINE: [TestMethod][Owner("jthunter")][DeploymentItem(TestData.RoomsExpected, TestData.Target)] public
|
||||||
// async Task CodeGenRoomsReadBenchmarkAsync()
|
// async Task CodeGenRoomsReadBenchmarkAsync()
|
||||||
// TODO: C# TO JAVA CONVERTER: There is no equivalent in Java to the 'async' keyword:
|
// TODO: C# TO JAVA CONVERTER: There is no equivalent in Java to the 'async' keyword:
|
||||||
//ORIGINAL LINE: [TestMethod][Owner("jthunter")][DeploymentItem(TestData.RoomsExpected, TestData.Target)] public
|
//ORIGINAL LINE: [TestMethod][Owner("jthunter")][DeploymentItem(TestData.RoomsExpected, TestData.Target)] public
|
||||||
// async Task CodeGenRoomsReadBenchmarkAsync()
|
// async Task CodeGenRoomsReadBenchmarkAsync()
|
||||||
public Task CodeGenRoomsReadBenchmarkAsync() {
|
public Task CodeGenRoomsReadBenchmarkAsync() {
|
||||||
String expectedFile = TestData.RoomsExpected;
|
String expectedFile = TestData.RoomsExpected;
|
||||||
// TODO: C# TO JAVA CONVERTER: Java has no equivalent to C# deconstruction declarations:
|
// TODO: C# TO JAVA CONVERTER: Java has no equivalent to C# deconstruction declarations:
|
||||||
(List < Dictionary < Utf8String, object >> expected, LayoutResolverNamespace resolver) =await
|
(List < Dictionary < Utf8String, object >> expected, LayoutResolverNamespace resolver) =await
|
||||||
this.LoadExpectedAsync(expectedFile);
|
this.LoadExpectedAsync(expectedFile);
|
||||||
CodeGenMicroBenchmarkSuite.CodeGenReadBenchmark(resolver, "Available_Rooms_By_Hotel_Date", "Rooms",
|
CodeGenMicroBenchmarkSuite.CodeGenReadBenchmark(resolver, "Available_Rooms_By_Hotel_Date", "Rooms",
|
||||||
CodeGenMicroBenchmarkSuite.RoomsCount, expected);
|
CodeGenMicroBenchmarkSuite.RoomsCount, expected);
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: C# TO JAVA CONVERTER: Java annotations will not correspond to .NET attributes:
|
// TODO: C# TO JAVA CONVERTER: Java annotations will not correspond to .NET attributes:
|
||||||
//ORIGINAL LINE: [TestMethod][Owner("jthunter")][DeploymentItem(TestData.RoomsExpected, TestData.Target)] public
|
//ORIGINAL LINE: [TestMethod][Owner("jthunter")][DeploymentItem(TestData.RoomsExpected, TestData.Target)] public
|
||||||
// async Task CodeGenRoomsWriteBenchmarkAsync()
|
// async Task CodeGenRoomsWriteBenchmarkAsync()
|
||||||
// TODO: C# TO JAVA CONVERTER: There is no equivalent in Java to the 'async' keyword:
|
// TODO: C# TO JAVA CONVERTER: There is no equivalent in Java to the 'async' keyword:
|
||||||
//ORIGINAL LINE: [TestMethod][Owner("jthunter")][DeploymentItem(TestData.RoomsExpected, TestData.Target)] public
|
//ORIGINAL LINE: [TestMethod][Owner("jthunter")][DeploymentItem(TestData.RoomsExpected, TestData.Target)] public
|
||||||
// async Task CodeGenRoomsWriteBenchmarkAsync()
|
// async Task CodeGenRoomsWriteBenchmarkAsync()
|
||||||
public Task CodeGenRoomsWriteBenchmarkAsync() {
|
public Task CodeGenRoomsWriteBenchmarkAsync() {
|
||||||
String expectedFile = TestData.RoomsExpected;
|
String expectedFile = TestData.RoomsExpected;
|
||||||
// TODO: C# TO JAVA CONVERTER: Java has no equivalent to C# deconstruction declarations:
|
// TODO: C# TO JAVA CONVERTER: Java has no equivalent to C# deconstruction declarations:
|
||||||
(List < Dictionary < Utf8String, object >> expected, LayoutResolverNamespace resolver) =await
|
(List < Dictionary < Utf8String, object >> expected, LayoutResolverNamespace resolver) =await
|
||||||
this.LoadExpectedAsync(expectedFile);
|
this.LoadExpectedAsync(expectedFile);
|
||||||
CodeGenMicroBenchmarkSuite.CodeGenWriteBenchmark(resolver, "Available_Rooms_By_Hotel_Date", "Rooms",
|
CodeGenMicroBenchmarkSuite.CodeGenWriteBenchmark(resolver, "Available_Rooms_By_Hotel_Date", "Rooms",
|
||||||
CodeGenMicroBenchmarkSuite.RoomsCount, expected);
|
CodeGenMicroBenchmarkSuite.RoomsCount, expected);
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: C# TO JAVA CONVERTER: Java annotations will not correspond to .NET attributes:
|
// TODO: C# TO JAVA CONVERTER: Java annotations will not correspond to .NET attributes:
|
||||||
//ORIGINAL LINE: [TestMethod][Owner("jthunter")][DeploymentItem(TestData.GuestsExpected, TestData.Target)] public
|
//ORIGINAL LINE: [TestMethod][Owner("jthunter")][DeploymentItem(TestData.GuestsExpected, TestData.Target)] public
|
||||||
// async Task ProtobufGuestsReadBenchmarkAsync()
|
// async Task ProtobufGuestsReadBenchmarkAsync()
|
||||||
// TODO: C# TO JAVA CONVERTER: There is no equivalent in Java to the 'async' keyword:
|
// TODO: C# TO JAVA CONVERTER: There is no equivalent in Java to the 'async' keyword:
|
||||||
//ORIGINAL LINE: [TestMethod][Owner("jthunter")][DeploymentItem(TestData.GuestsExpected, TestData.Target)] public
|
//ORIGINAL LINE: [TestMethod][Owner("jthunter")][DeploymentItem(TestData.GuestsExpected, TestData.Target)] public
|
||||||
// async Task ProtobufGuestsReadBenchmarkAsync()
|
// async Task ProtobufGuestsReadBenchmarkAsync()
|
||||||
public Task ProtobufGuestsReadBenchmarkAsync() {
|
public Task ProtobufGuestsReadBenchmarkAsync() {
|
||||||
String expectedFile = TestData.GuestsExpected;
|
String expectedFile = TestData.GuestsExpected;
|
||||||
// TODO: C# TO JAVA CONVERTER: Java has no equivalent to C# deconstruction declarations:
|
// TODO: C# TO JAVA CONVERTER: Java has no equivalent to C# deconstruction declarations:
|
||||||
(List < Dictionary < Utf8String, object >> expected, LayoutResolverNamespace _) =await
|
(List < Dictionary < Utf8String, object >> expected, LayoutResolverNamespace _) =await
|
||||||
this.LoadExpectedAsync(expectedFile);
|
this.LoadExpectedAsync(expectedFile);
|
||||||
CodeGenMicroBenchmarkSuite.ProtobufReadBenchmark("Guests", "Guests", CodeGenMicroBenchmarkSuite.GuestCount,
|
CodeGenMicroBenchmarkSuite.ProtobufReadBenchmark("Guests", "Guests", CodeGenMicroBenchmarkSuite.GuestCount,
|
||||||
expected);
|
expected);
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: C# TO JAVA CONVERTER: Java annotations will not correspond to .NET attributes:
|
// TODO: C# TO JAVA CONVERTER: Java annotations will not correspond to .NET attributes:
|
||||||
//ORIGINAL LINE: [TestMethod][Owner("jthunter")][DeploymentItem(TestData.GuestsExpected, TestData.Target)] public
|
//ORIGINAL LINE: [TestMethod][Owner("jthunter")][DeploymentItem(TestData.GuestsExpected, TestData.Target)] public
|
||||||
// async Task ProtobufGuestsWriteBenchmarkAsync()
|
// async Task ProtobufGuestsWriteBenchmarkAsync()
|
||||||
// TODO: C# TO JAVA CONVERTER: There is no equivalent in Java to the 'async' keyword:
|
// TODO: C# TO JAVA CONVERTER: There is no equivalent in Java to the 'async' keyword:
|
||||||
//ORIGINAL LINE: [TestMethod][Owner("jthunter")][DeploymentItem(TestData.GuestsExpected, TestData.Target)] public
|
//ORIGINAL LINE: [TestMethod][Owner("jthunter")][DeploymentItem(TestData.GuestsExpected, TestData.Target)] public
|
||||||
// async Task ProtobufGuestsWriteBenchmarkAsync()
|
// async Task ProtobufGuestsWriteBenchmarkAsync()
|
||||||
public Task ProtobufGuestsWriteBenchmarkAsync() {
|
public Task ProtobufGuestsWriteBenchmarkAsync() {
|
||||||
String expectedFile = TestData.GuestsExpected;
|
String expectedFile = TestData.GuestsExpected;
|
||||||
// TODO: C# TO JAVA CONVERTER: Java has no equivalent to C# deconstruction declarations:
|
// TODO: C# TO JAVA CONVERTER: Java has no equivalent to C# deconstruction declarations:
|
||||||
(List < Dictionary < Utf8String, object >> expected, LayoutResolverNamespace _) =await
|
(List < Dictionary < Utf8String, object >> expected, LayoutResolverNamespace _) =await
|
||||||
this.LoadExpectedAsync(expectedFile);
|
this.LoadExpectedAsync(expectedFile);
|
||||||
CodeGenMicroBenchmarkSuite.ProtobufWriteBenchmark("Guests", "Guests", CodeGenMicroBenchmarkSuite.GuestCount,
|
CodeGenMicroBenchmarkSuite.ProtobufWriteBenchmark("Guests", "Guests", CodeGenMicroBenchmarkSuite.GuestCount,
|
||||||
expected);
|
expected);
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: C# TO JAVA CONVERTER: Java annotations will not correspond to .NET attributes:
|
// TODO: C# TO JAVA CONVERTER: Java annotations will not correspond to .NET attributes:
|
||||||
//ORIGINAL LINE: [TestMethod][Owner("jthunter")][DeploymentItem(TestData.HotelExpected, TestData.Target)] public
|
//ORIGINAL LINE: [TestMethod][Owner("jthunter")][DeploymentItem(TestData.HotelExpected, TestData.Target)] public
|
||||||
// async Task ProtobufHotelReadBenchmarkAsync()
|
// async Task ProtobufHotelReadBenchmarkAsync()
|
||||||
// TODO: C# TO JAVA CONVERTER: There is no equivalent in Java to the 'async' keyword:
|
// TODO: C# TO JAVA CONVERTER: There is no equivalent in Java to the 'async' keyword:
|
||||||
//ORIGINAL LINE: [TestMethod][Owner("jthunter")][DeploymentItem(TestData.HotelExpected, TestData.Target)] public
|
//ORIGINAL LINE: [TestMethod][Owner("jthunter")][DeploymentItem(TestData.HotelExpected, TestData.Target)] public
|
||||||
// async Task ProtobufHotelReadBenchmarkAsync()
|
// async Task ProtobufHotelReadBenchmarkAsync()
|
||||||
public Task ProtobufHotelReadBenchmarkAsync() {
|
public Task ProtobufHotelReadBenchmarkAsync() {
|
||||||
String expectedFile = TestData.HotelExpected;
|
String expectedFile = TestData.HotelExpected;
|
||||||
// TODO: C# TO JAVA CONVERTER: Java has no equivalent to C# deconstruction declarations:
|
// TODO: C# TO JAVA CONVERTER: Java has no equivalent to C# deconstruction declarations:
|
||||||
(List < Dictionary < Utf8String, object >> expected, LayoutResolverNamespace _) =await
|
(List < Dictionary < Utf8String, object >> expected, LayoutResolverNamespace _) =await
|
||||||
this.LoadExpectedAsync(expectedFile);
|
this.LoadExpectedAsync(expectedFile);
|
||||||
CodeGenMicroBenchmarkSuite.ProtobufReadBenchmark("Hotels", "Hotels", CodeGenMicroBenchmarkSuite.HotelCount,
|
CodeGenMicroBenchmarkSuite.ProtobufReadBenchmark("Hotels", "Hotels", CodeGenMicroBenchmarkSuite.HotelCount,
|
||||||
expected);
|
expected);
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: C# TO JAVA CONVERTER: Java annotations will not correspond to .NET attributes:
|
// TODO: C# TO JAVA CONVERTER: Java annotations will not correspond to .NET attributes:
|
||||||
//ORIGINAL LINE: [TestMethod][Owner("jthunter")][DeploymentItem(TestData.HotelExpected, TestData.Target)] public
|
//ORIGINAL LINE: [TestMethod][Owner("jthunter")][DeploymentItem(TestData.HotelExpected, TestData.Target)] public
|
||||||
// async Task ProtobufHotelWriteBenchmarkAsync()
|
// async Task ProtobufHotelWriteBenchmarkAsync()
|
||||||
// TODO: C# TO JAVA CONVERTER: There is no equivalent in Java to the 'async' keyword:
|
// TODO: C# TO JAVA CONVERTER: There is no equivalent in Java to the 'async' keyword:
|
||||||
//ORIGINAL LINE: [TestMethod][Owner("jthunter")][DeploymentItem(TestData.HotelExpected, TestData.Target)] public
|
//ORIGINAL LINE: [TestMethod][Owner("jthunter")][DeploymentItem(TestData.HotelExpected, TestData.Target)] public
|
||||||
// async Task ProtobufHotelWriteBenchmarkAsync()
|
// async Task ProtobufHotelWriteBenchmarkAsync()
|
||||||
public Task ProtobufHotelWriteBenchmarkAsync() {
|
public Task ProtobufHotelWriteBenchmarkAsync() {
|
||||||
String expectedFile = TestData.HotelExpected;
|
String expectedFile = TestData.HotelExpected;
|
||||||
// TODO: C# TO JAVA CONVERTER: Java has no equivalent to C# deconstruction declarations:
|
// TODO: C# TO JAVA CONVERTER: Java has no equivalent to C# deconstruction declarations:
|
||||||
(List < Dictionary < Utf8String, object >> expected, LayoutResolverNamespace _) =await
|
(List < Dictionary < Utf8String, object >> expected, LayoutResolverNamespace _) =await
|
||||||
this.LoadExpectedAsync(expectedFile);
|
this.LoadExpectedAsync(expectedFile);
|
||||||
CodeGenMicroBenchmarkSuite.ProtobufWriteBenchmark("Hotels", "Hotels", CodeGenMicroBenchmarkSuite.HotelCount,
|
CodeGenMicroBenchmarkSuite.ProtobufWriteBenchmark("Hotels", "Hotels", CodeGenMicroBenchmarkSuite.HotelCount,
|
||||||
expected);
|
expected);
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: C# TO JAVA CONVERTER: Java annotations will not correspond to .NET attributes:
|
// TODO: C# TO JAVA CONVERTER: Java annotations will not correspond to .NET attributes:
|
||||||
//ORIGINAL LINE: [TestMethod][Owner("jthunter")][DeploymentItem(TestData.RoomsExpected, TestData.Target)] public
|
//ORIGINAL LINE: [TestMethod][Owner("jthunter")][DeploymentItem(TestData.RoomsExpected, TestData.Target)] public
|
||||||
// async Task ProtobufRoomsReadBenchmarkAsync()
|
// async Task ProtobufRoomsReadBenchmarkAsync()
|
||||||
// TODO: C# TO JAVA CONVERTER: There is no equivalent in Java to the 'async' keyword:
|
// TODO: C# TO JAVA CONVERTER: There is no equivalent in Java to the 'async' keyword:
|
||||||
//ORIGINAL LINE: [TestMethod][Owner("jthunter")][DeploymentItem(TestData.RoomsExpected, TestData.Target)] public
|
//ORIGINAL LINE: [TestMethod][Owner("jthunter")][DeploymentItem(TestData.RoomsExpected, TestData.Target)] public
|
||||||
// async Task ProtobufRoomsReadBenchmarkAsync()
|
// async Task ProtobufRoomsReadBenchmarkAsync()
|
||||||
public Task ProtobufRoomsReadBenchmarkAsync() {
|
public Task ProtobufRoomsReadBenchmarkAsync() {
|
||||||
String expectedFile = TestData.RoomsExpected;
|
String expectedFile = TestData.RoomsExpected;
|
||||||
// TODO: C# TO JAVA CONVERTER: Java has no equivalent to C# deconstruction declarations:
|
// TODO: C# TO JAVA CONVERTER: Java has no equivalent to C# deconstruction declarations:
|
||||||
(List < Dictionary < Utf8String, object >> expected, LayoutResolverNamespace _) =await
|
(List < Dictionary < Utf8String, object >> expected, LayoutResolverNamespace _) =await
|
||||||
this.LoadExpectedAsync(expectedFile);
|
this.LoadExpectedAsync(expectedFile);
|
||||||
CodeGenMicroBenchmarkSuite.ProtobufReadBenchmark("Available_Rooms_By_Hotel_Date", "Rooms",
|
CodeGenMicroBenchmarkSuite.ProtobufReadBenchmark("Available_Rooms_By_Hotel_Date", "Rooms",
|
||||||
CodeGenMicroBenchmarkSuite.RoomsCount, expected);
|
CodeGenMicroBenchmarkSuite.RoomsCount, expected);
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: C# TO JAVA CONVERTER: Java annotations will not correspond to .NET attributes:
|
// TODO: C# TO JAVA CONVERTER: Java annotations will not correspond to .NET attributes:
|
||||||
//ORIGINAL LINE: [TestMethod][Owner("jthunter")][DeploymentItem(TestData.RoomsExpected, TestData.Target)] public
|
//ORIGINAL LINE: [TestMethod][Owner("jthunter")][DeploymentItem(TestData.RoomsExpected, TestData.Target)] public
|
||||||
// async Task ProtobufRoomsWriteBenchmarkAsync()
|
// async Task ProtobufRoomsWriteBenchmarkAsync()
|
||||||
// TODO: C# TO JAVA CONVERTER: There is no equivalent in Java to the 'async' keyword:
|
// TODO: C# TO JAVA CONVERTER: There is no equivalent in Java to the 'async' keyword:
|
||||||
//ORIGINAL LINE: [TestMethod][Owner("jthunter")][DeploymentItem(TestData.RoomsExpected, TestData.Target)] public
|
//ORIGINAL LINE: [TestMethod][Owner("jthunter")][DeploymentItem(TestData.RoomsExpected, TestData.Target)] public
|
||||||
// async Task ProtobufRoomsWriteBenchmarkAsync()
|
// async Task ProtobufRoomsWriteBenchmarkAsync()
|
||||||
public Task ProtobufRoomsWriteBenchmarkAsync() {
|
public Task ProtobufRoomsWriteBenchmarkAsync() {
|
||||||
String expectedFile = TestData.RoomsExpected;
|
String expectedFile = TestData.RoomsExpected;
|
||||||
// TODO: C# TO JAVA CONVERTER: Java has no equivalent to C# deconstruction declarations:
|
// TODO: C# TO JAVA CONVERTER: Java has no equivalent to C# deconstruction declarations:
|
||||||
(List < Dictionary < Utf8String, object >> expected, LayoutResolverNamespace _) =await
|
(List < Dictionary < Utf8String, object >> expected, LayoutResolverNamespace _) =await
|
||||||
this.LoadExpectedAsync(expectedFile);
|
this.LoadExpectedAsync(expectedFile);
|
||||||
CodeGenMicroBenchmarkSuite.ProtobufWriteBenchmark("Available_Rooms_By_Hotel_Date", "Rooms",
|
CodeGenMicroBenchmarkSuite.ProtobufWriteBenchmark("Available_Rooms_By_Hotel_Date", "Rooms",
|
||||||
CodeGenMicroBenchmarkSuite.RoomsCount, expected);
|
CodeGenMicroBenchmarkSuite.RoomsCount, expected);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void CodeGenReadBenchmark(LayoutResolverNamespace resolver, String schemaName, String dataSetName,
|
private static void CodeGenReadBenchmark(LayoutResolverNamespace resolver, String schemaName, String dataSetName,
|
||||||
int innerLoopIterations, ArrayList<HashMap<Utf8String, Object>> expected) {
|
int innerLoopIterations, ArrayList<HashMap<Utf8String, Object>> expected) {
|
||||||
// Serialize input data to sequence of byte buffers.
|
// Serialize input data to sequence of byte buffers.
|
||||||
//C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java:
|
//C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java:
|
||||||
//ORIGINAL LINE: List<byte[]> expectedSerialized = new List<byte[]>(expected.Count);
|
//ORIGINAL LINE: List<byte[]> expectedSerialized = new List<byte[]>(expected.Count);
|
||||||
ArrayList<byte[]> expectedSerialized = new ArrayList<byte[]>(expected.size());
|
ArrayList<byte[]> expectedSerialized = new ArrayList<byte[]>(expected.size());
|
||||||
Layout layout = resolver.Resolve(tangible.ListHelper.find(resolver.getNamespace().getSchemas(), x =
|
Layout layout = resolver.Resolve(tangible.ListHelper.find(resolver.getNamespace().getSchemas(), x =
|
||||||
schemaName.equals( > x.Name)).SchemaId)
|
schemaName.equals( > x.Name)).SchemaId)
|
||||||
BenchmarkContext context = new BenchmarkContext();
|
BenchmarkContext context = new BenchmarkContext();
|
||||||
context.CodeGenWriter = new CodeGenRowGenerator(BenchmarkSuiteBase.InitialCapacity, layout, resolver);
|
context.CodeGenWriter = new CodeGenRowGenerator(BenchmarkSuiteBase.InitialCapacity, layout, resolver);
|
||||||
|
|
||||||
for (HashMap<Utf8String, Object> tableValue : expected) {
|
for (HashMap<Utf8String, Object> tableValue : expected) {
|
||||||
context.CodeGenWriter.Reset();
|
context.CodeGenWriter.Reset();
|
||||||
|
|
||||||
Result r = context.CodeGenWriter.WriteBuffer(tableValue);
|
Result r = context.CodeGenWriter.WriteBuffer(tableValue);
|
||||||
ResultAssert.IsSuccess(r);
|
ResultAssert.IsSuccess(r);
|
||||||
//C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java:
|
//C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java:
|
||||||
//ORIGINAL LINE: expectedSerialized.Add(context.CodeGenWriter.ToArray());
|
//ORIGINAL LINE: expectedSerialized.Add(context.CodeGenWriter.ToArray());
|
||||||
expectedSerialized.add(context.CodeGenWriter.ToArray());
|
expectedSerialized.add(context.CodeGenWriter.ToArray());
|
||||||
}
|
}
|
||||||
|
|
||||||
Reference<BenchmarkContext> tempReference_context = new Reference<BenchmarkContext>(context);
|
Reference<BenchmarkContext> tempReference_context = new Reference<BenchmarkContext>(context);
|
||||||
// TODO: C# TO JAVA CONVERTER: The following lambda contained an unresolved 'ref' keyword - these are not converted by C# to Java Converter:
|
// TODO: C# TO JAVA CONVERTER: The following lambda contained an unresolved 'ref' keyword - these are not converted by C# to Java Converter:
|
||||||
//C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java:
|
//C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java:
|
||||||
//ORIGINAL LINE: MicroBenchmarkSuiteBase.Benchmark("CodeGen", "Read", dataSetName, "HybridRowGen", innerLoopIterations, ref context, (ref BenchmarkContext ctx, byte[] tableValue) =>
|
//ORIGINAL LINE: MicroBenchmarkSuiteBase.Benchmark("CodeGen", "Read", dataSetName, "HybridRowGen", innerLoopIterations, ref context, (ref BenchmarkContext ctx, byte[] tableValue) =>
|
||||||
MicroBenchmarkSuiteBase.Benchmark("CodeGen", "Read", dataSetName, "HybridRowGen", innerLoopIterations,
|
MicroBenchmarkSuiteBase.Benchmark("CodeGen", "Read", dataSetName, "HybridRowGen", innerLoopIterations,
|
||||||
tempReference_context, (ref BenchmarkContext ctx, byte[] tableValue) ->
|
tempReference_context, (ref BenchmarkContext ctx, byte[] tableValue) ->
|
||||||
{
|
{
|
||||||
Result r = ctx.CodeGenWriter.ReadBuffer(tableValue);
|
Result r = ctx.CodeGenWriter.ReadBuffer(tableValue);
|
||||||
ResultAssert.IsSuccess(r);
|
ResultAssert.IsSuccess(r);
|
||||||
}, (ref BenchmarkContext ctx, byte[] tableValue) -> tableValue.length, expectedSerialized);
|
}, (ref BenchmarkContext ctx, byte[] tableValue) -> tableValue.length, expectedSerialized);
|
||||||
context = tempReference_context.get();
|
context = tempReference_context.get();
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void CodeGenWriteBenchmark(LayoutResolverNamespace resolver, String schemaName, String dataSetName
|
private static void CodeGenWriteBenchmark(LayoutResolverNamespace resolver, String schemaName, String dataSetName
|
||||||
, int innerLoopIterations, ArrayList<HashMap<Utf8String, Object>> expected) {
|
, int innerLoopIterations, ArrayList<HashMap<Utf8String, Object>> expected) {
|
||||||
Layout layout = resolver.Resolve(tangible.ListHelper.find(resolver.getNamespace().getSchemas(), x =
|
Layout layout = resolver.Resolve(tangible.ListHelper.find(resolver.getNamespace().getSchemas(), x =
|
||||||
schemaName.equals( > x.Name)).SchemaId)
|
schemaName.equals( > x.Name)).SchemaId)
|
||||||
BenchmarkContext context = new BenchmarkContext();
|
BenchmarkContext context = new BenchmarkContext();
|
||||||
context.CodeGenWriter = new CodeGenRowGenerator(BenchmarkSuiteBase.InitialCapacity, layout, resolver);
|
context.CodeGenWriter = new CodeGenRowGenerator(BenchmarkSuiteBase.InitialCapacity, layout, resolver);
|
||||||
|
|
||||||
Reference<BenchmarkContext> tempReference_context = new Reference<BenchmarkContext>(context);
|
Reference<BenchmarkContext> tempReference_context = new Reference<BenchmarkContext>(context);
|
||||||
// TODO: C# TO JAVA CONVERTER: The following lambda contained an unresolved 'ref' keyword - these are not
|
// TODO: C# TO JAVA CONVERTER: The following lambda contained an unresolved 'ref' keyword - these are not
|
||||||
// converted by C# to Java Converter:
|
// converted by C# to Java Converter:
|
||||||
MicroBenchmarkSuiteBase.Benchmark("CodeGen", "Write", dataSetName, "HybridRowGen", innerLoopIterations,
|
MicroBenchmarkSuiteBase.Benchmark("CodeGen", "Write", dataSetName, "HybridRowGen", innerLoopIterations,
|
||||||
tempReference_context, (ref BenchmarkContext ctx, HashMap<Utf8String, Object> tableValue) ->
|
tempReference_context, (ref BenchmarkContext ctx, HashMap<Utf8String, Object> tableValue) ->
|
||||||
{
|
{
|
||||||
ctx.CodeGenWriter.Reset();
|
ctx.CodeGenWriter.Reset();
|
||||||
|
|
||||||
Result r = ctx.CodeGenWriter.WriteBuffer(tableValue);
|
Result r = ctx.CodeGenWriter.WriteBuffer(tableValue);
|
||||||
ResultAssert.IsSuccess(r);
|
ResultAssert.IsSuccess(r);
|
||||||
}, (ref BenchmarkContext ctx, HashMap<Utf8String, Object> tableValue) -> ctx.CodeGenWriter.Length, expected);
|
}, (ref BenchmarkContext ctx, HashMap<Utf8String, Object> tableValue) -> ctx.CodeGenWriter.Length, expected);
|
||||||
context = tempReference_context.get();
|
context = tempReference_context.get();
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void ProtobufReadBenchmark(String schemaName, String dataSetName, int innerLoopIterations,
|
private static void ProtobufReadBenchmark(String schemaName, String dataSetName, int innerLoopIterations,
|
||||||
ArrayList<HashMap<Utf8String, Object>> expected) {
|
ArrayList<HashMap<Utf8String, Object>> expected) {
|
||||||
// Serialize input data to sequence of byte buffers.
|
// Serialize input data to sequence of byte buffers.
|
||||||
//C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java:
|
//C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java:
|
||||||
//ORIGINAL LINE: List<byte[]> expectedSerialized = new List<byte[]>(expected.Count);
|
//ORIGINAL LINE: List<byte[]> expectedSerialized = new List<byte[]>(expected.Count);
|
||||||
ArrayList<byte[]> expectedSerialized = new ArrayList<byte[]>(expected.size());
|
ArrayList<byte[]> expectedSerialized = new ArrayList<byte[]>(expected.size());
|
||||||
BenchmarkContext context = new BenchmarkContext();
|
BenchmarkContext context = new BenchmarkContext();
|
||||||
context.ProtobufWriter = new ProtobufRowGenerator(schemaName, BenchmarkSuiteBase.InitialCapacity);
|
context.ProtobufWriter = new ProtobufRowGenerator(schemaName, BenchmarkSuiteBase.InitialCapacity);
|
||||||
|
|
||||||
for (HashMap<Utf8String, Object> tableValue : expected) {
|
for (HashMap<Utf8String, Object> tableValue : expected) {
|
||||||
context.ProtobufWriter.WriteBuffer(tableValue);
|
context.ProtobufWriter.WriteBuffer(tableValue);
|
||||||
//C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java:
|
//C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java:
|
||||||
//ORIGINAL LINE: expectedSerialized.Add(context.ProtobufWriter.ToArray());
|
//ORIGINAL LINE: expectedSerialized.Add(context.ProtobufWriter.ToArray());
|
||||||
expectedSerialized.add(context.ProtobufWriter.ToArray());
|
expectedSerialized.add(context.ProtobufWriter.ToArray());
|
||||||
}
|
}
|
||||||
|
|
||||||
Reference<BenchmarkContext> tempReference_context = new Reference<BenchmarkContext>(context);
|
Reference<BenchmarkContext> tempReference_context = new Reference<BenchmarkContext>(context);
|
||||||
// TODO: C# TO JAVA CONVERTER: The following lambda contained an unresolved 'ref' keyword - these are not
|
// TODO: C# TO JAVA CONVERTER: The following lambda contained an unresolved 'ref' keyword - these are not
|
||||||
// converted by C# to Java Converter:
|
// converted by C# to Java Converter:
|
||||||
//C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java:
|
//C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java:
|
||||||
//ORIGINAL LINE: MicroBenchmarkSuiteBase.Benchmark("CodeGen", "Read", dataSetName, "Protobuf",
|
//ORIGINAL LINE: MicroBenchmarkSuiteBase.Benchmark("CodeGen", "Read", dataSetName, "Protobuf",
|
||||||
// innerLoopIterations, ref context, (ref BenchmarkContext ctx, byte[] tableValue) => ctx.ProtobufWriter
|
// innerLoopIterations, ref context, (ref BenchmarkContext ctx, byte[] tableValue) => ctx.ProtobufWriter
|
||||||
// .ReadBuffer(tableValue), (ref BenchmarkContext ctx, byte[] tableValue) => tableValue.Length,
|
// .ReadBuffer(tableValue), (ref BenchmarkContext ctx, byte[] tableValue) => tableValue.Length,
|
||||||
// expectedSerialized);
|
// expectedSerialized);
|
||||||
MicroBenchmarkSuiteBase.Benchmark("CodeGen", "Read", dataSetName, "Protobuf", innerLoopIterations,
|
MicroBenchmarkSuiteBase.Benchmark("CodeGen", "Read", dataSetName, "Protobuf", innerLoopIterations,
|
||||||
tempReference_context,
|
tempReference_context,
|
||||||
(ref BenchmarkContext ctx, byte[] tableValue) -> ctx.ProtobufWriter.ReadBuffer(tableValue),
|
(ref BenchmarkContext ctx, byte[] tableValue) -> ctx.ProtobufWriter.ReadBuffer(tableValue),
|
||||||
(ref BenchmarkContext ctx, byte[] tableValue) -> tableValue.length, expectedSerialized);
|
(ref BenchmarkContext ctx, byte[] tableValue) -> tableValue.length, expectedSerialized);
|
||||||
context = tempReference_context.get();
|
context = tempReference_context.get();
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void ProtobufWriteBenchmark(String schemaName, String dataSetName, int innerLoopIterations,
|
private static void ProtobufWriteBenchmark(String schemaName, String dataSetName, int innerLoopIterations,
|
||||||
ArrayList<HashMap<Utf8String, Object>> expected) {
|
ArrayList<HashMap<Utf8String, Object>> expected) {
|
||||||
BenchmarkContext context = new BenchmarkContext();
|
BenchmarkContext context = new BenchmarkContext();
|
||||||
context.ProtobufWriter = new ProtobufRowGenerator(schemaName, BenchmarkSuiteBase.InitialCapacity);
|
context.ProtobufWriter = new ProtobufRowGenerator(schemaName, BenchmarkSuiteBase.InitialCapacity);
|
||||||
|
|
||||||
Reference<BenchmarkContext> tempReference_context = new Reference<BenchmarkContext>(context);
|
Reference<BenchmarkContext> tempReference_context = new Reference<BenchmarkContext>(context);
|
||||||
// TODO: C# TO JAVA CONVERTER: The following lambda contained an unresolved 'ref' keyword - these are not
|
// TODO: C# TO JAVA CONVERTER: The following lambda contained an unresolved 'ref' keyword - these are not
|
||||||
// converted by C# to Java Converter:
|
// converted by C# to Java Converter:
|
||||||
MicroBenchmarkSuiteBase.Benchmark("CodeGen", "Write", dataSetName, "Protobuf", innerLoopIterations,
|
MicroBenchmarkSuiteBase.Benchmark("CodeGen", "Write", dataSetName, "Protobuf", innerLoopIterations,
|
||||||
tempReference_context, (ref BenchmarkContext ctx, HashMap<Utf8String, Object> tableValue) ->
|
tempReference_context, (ref BenchmarkContext ctx, HashMap<Utf8String, Object> tableValue) ->
|
||||||
{
|
{
|
||||||
ctx.ProtobufWriter.WriteBuffer(tableValue);
|
ctx.ProtobufWriter.WriteBuffer(tableValue);
|
||||||
}, (ref BenchmarkContext ctx, HashMap<Utf8String, Object> tableValue) -> ctx.ProtobufWriter.Length, expected);
|
}, (ref BenchmarkContext ctx, HashMap<Utf8String, Object> tableValue) -> ctx.ProtobufWriter.Length, expected);
|
||||||
context = tempReference_context.get();
|
context = tempReference_context.get();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+1168
-1168
File diff suppressed because it is too large
Load Diff
+107
-107
@@ -1,108 +1,108 @@
|
|||||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||||
// Licensed under the MIT License.
|
// Licensed under the MIT License.
|
||||||
|
|
||||||
package com.azure.data.cosmos.serialization.hybridrow.perf;
|
package com.azure.data.cosmos.serialization.hybridrow.perf;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.nio.file.Files;
|
import java.nio.file.Files;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Random;
|
import java.util.Random;
|
||||||
|
|
||||||
// TODO: C# TO JAVA CONVERTER: Java annotations will not correspond to .NET attributes:
|
// TODO: C# TO JAVA CONVERTER: Java annotations will not correspond to .NET attributes:
|
||||||
//ORIGINAL LINE: [TestClass][DeploymentItem(TestData.SchemaFile, TestData.Target)] public sealed class
|
//ORIGINAL LINE: [TestClass][DeploymentItem(TestData.SchemaFile, TestData.Target)] public sealed class
|
||||||
// GenerateBenchmarkSuite : BenchmarkSuiteBase
|
// GenerateBenchmarkSuite : BenchmarkSuiteBase
|
||||||
public final class GenerateBenchmarkSuite extends BenchmarkSuiteBase {
|
public final class GenerateBenchmarkSuite extends BenchmarkSuiteBase {
|
||||||
private String sdl;
|
private String sdl;
|
||||||
|
|
||||||
// TODO: C# TO JAVA CONVERTER: Java annotations will not correspond to .NET attributes:
|
// TODO: C# TO JAVA CONVERTER: Java annotations will not correspond to .NET attributes:
|
||||||
//ORIGINAL LINE: [TestMethod][Owner("jthunter")][DeploymentItem(TestData.GuestsExpected, TestData.Target)] public
|
//ORIGINAL LINE: [TestMethod][Owner("jthunter")][DeploymentItem(TestData.GuestsExpected, TestData.Target)] public
|
||||||
// async Task GenerateGuestsBenchmarkAsync()
|
// async Task GenerateGuestsBenchmarkAsync()
|
||||||
// TODO: C# TO JAVA CONVERTER: There is no equivalent in Java to the 'async' keyword:
|
// TODO: C# TO JAVA CONVERTER: There is no equivalent in Java to the 'async' keyword:
|
||||||
//ORIGINAL LINE: [TestMethod][Owner("jthunter")][DeploymentItem(TestData.GuestsExpected, TestData.Target)] public
|
//ORIGINAL LINE: [TestMethod][Owner("jthunter")][DeploymentItem(TestData.GuestsExpected, TestData.Target)] public
|
||||||
// async Task GenerateGuestsBenchmarkAsync()
|
// async Task GenerateGuestsBenchmarkAsync()
|
||||||
public Task GenerateGuestsBenchmarkAsync() {
|
public Task GenerateGuestsBenchmarkAsync() {
|
||||||
// TODO: C# TO JAVA CONVERTER: There is no equivalent to 'await' in Java:
|
// TODO: C# TO JAVA CONVERTER: There is no equivalent to 'await' in Java:
|
||||||
await this.GenerateBenchmarkAsync("Guests", 50, TestData.GuestsExpected);
|
await this.GenerateBenchmarkAsync("Guests", 50, TestData.GuestsExpected);
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: C# TO JAVA CONVERTER: Java annotations will not correspond to .NET attributes:
|
// TODO: C# TO JAVA CONVERTER: Java annotations will not correspond to .NET attributes:
|
||||||
//ORIGINAL LINE: [TestMethod][Owner("jthunter")][DeploymentItem(TestData.HotelExpected, TestData.Target)] public
|
//ORIGINAL LINE: [TestMethod][Owner("jthunter")][DeploymentItem(TestData.HotelExpected, TestData.Target)] public
|
||||||
// async Task GenerateHotelBenchmarkAsync()
|
// async Task GenerateHotelBenchmarkAsync()
|
||||||
// TODO: C# TO JAVA CONVERTER: There is no equivalent in Java to the 'async' keyword:
|
// TODO: C# TO JAVA CONVERTER: There is no equivalent in Java to the 'async' keyword:
|
||||||
//ORIGINAL LINE: [TestMethod][Owner("jthunter")][DeploymentItem(TestData.HotelExpected, TestData.Target)] public
|
//ORIGINAL LINE: [TestMethod][Owner("jthunter")][DeploymentItem(TestData.HotelExpected, TestData.Target)] public
|
||||||
// async Task GenerateHotelBenchmarkAsync()
|
// async Task GenerateHotelBenchmarkAsync()
|
||||||
public Task GenerateHotelBenchmarkAsync() {
|
public Task GenerateHotelBenchmarkAsync() {
|
||||||
// TODO: C# TO JAVA CONVERTER: There is no equivalent to 'await' in Java:
|
// TODO: C# TO JAVA CONVERTER: There is no equivalent to 'await' in Java:
|
||||||
await this.GenerateBenchmarkAsync("Hotels", 100, TestData.HotelExpected);
|
await this.GenerateBenchmarkAsync("Hotels", 100, TestData.HotelExpected);
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: C# TO JAVA CONVERTER: Java annotations will not correspond to .NET attributes:
|
// TODO: C# TO JAVA CONVERTER: Java annotations will not correspond to .NET attributes:
|
||||||
//ORIGINAL LINE: [TestMethod][Owner("jthunter")][DeploymentItem(TestData.RoomsExpected, TestData.Target)] public
|
//ORIGINAL LINE: [TestMethod][Owner("jthunter")][DeploymentItem(TestData.RoomsExpected, TestData.Target)] public
|
||||||
// async Task GenerateRoomsBenchmarkAsync()
|
// async Task GenerateRoomsBenchmarkAsync()
|
||||||
// TODO: C# TO JAVA CONVERTER: There is no equivalent in Java to the 'async' keyword:
|
// TODO: C# TO JAVA CONVERTER: There is no equivalent in Java to the 'async' keyword:
|
||||||
//ORIGINAL LINE: [TestMethod][Owner("jthunter")][DeploymentItem(TestData.RoomsExpected, TestData.Target)] public
|
//ORIGINAL LINE: [TestMethod][Owner("jthunter")][DeploymentItem(TestData.RoomsExpected, TestData.Target)] public
|
||||||
// async Task GenerateRoomsBenchmarkAsync()
|
// async Task GenerateRoomsBenchmarkAsync()
|
||||||
public Task GenerateRoomsBenchmarkAsync() {
|
public Task GenerateRoomsBenchmarkAsync() {
|
||||||
// TODO: C# TO JAVA CONVERTER: There is no equivalent to 'await' in Java:
|
// TODO: C# TO JAVA CONVERTER: There is no equivalent to 'await' in Java:
|
||||||
await this.GenerateBenchmarkAsync("Available_Rooms_By_Hotel_Date", 100, TestData.RoomsExpected);
|
await this.GenerateBenchmarkAsync("Available_Rooms_By_Hotel_Date", 100, TestData.RoomsExpected);
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: C# TO JAVA CONVERTER: Java annotations will not correspond to .NET attributes:
|
// TODO: C# TO JAVA CONVERTER: Java annotations will not correspond to .NET attributes:
|
||||||
//ORIGINAL LINE: [TestInitialize] public void ParseNamespaceExample()
|
//ORIGINAL LINE: [TestInitialize] public void ParseNamespaceExample()
|
||||||
public void ParseNamespaceExample() {
|
public void ParseNamespaceExample() {
|
||||||
this.sdl = Files.readString(TestData.SchemaFile);
|
this.sdl = Files.readString(TestData.SchemaFile);
|
||||||
Namespace schema = Namespace.Parse(this.sdl);
|
Namespace schema = Namespace.Parse(this.sdl);
|
||||||
this.DefaultResolver = new LayoutResolverNamespace(schema, SystemSchema.LayoutResolver);
|
this.DefaultResolver = new LayoutResolverNamespace(schema, SystemSchema.LayoutResolver);
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: C# TO JAVA CONVERTER: There is no equivalent in Java to the 'async' keyword:
|
// TODO: C# TO JAVA CONVERTER: There is no equivalent in Java to the 'async' keyword:
|
||||||
//ORIGINAL LINE: private async Task GenerateBenchmarkAsync(string schemaName, int outerLoopIterations, string
|
//ORIGINAL LINE: private async Task GenerateBenchmarkAsync(string schemaName, int outerLoopIterations, string
|
||||||
// expectedFile)
|
// expectedFile)
|
||||||
private Task GenerateBenchmarkAsync(String schemaName, int outerLoopIterations, String expectedFile) {
|
private Task GenerateBenchmarkAsync(String schemaName, int outerLoopIterations, String expectedFile) {
|
||||||
// TODO: C# TO JAVA CONVERTER: Java has no equivalent to C# deconstruction declarations:
|
// TODO: C# TO JAVA CONVERTER: Java has no equivalent to C# deconstruction declarations:
|
||||||
(List < Dictionary < Utf8String, object >> expected, LayoutResolverNamespace resolver) =await
|
(List < Dictionary < Utf8String, object >> expected, LayoutResolverNamespace resolver) =await
|
||||||
this.LoadExpectedAsync(expectedFile);
|
this.LoadExpectedAsync(expectedFile);
|
||||||
ArrayList<HashMap<Utf8String, Object>> rows = GenerateBenchmarkSuite.GenerateBenchmarkInputs(resolver,
|
ArrayList<HashMap<Utf8String, Object>> rows = GenerateBenchmarkSuite.GenerateBenchmarkInputs(resolver,
|
||||||
schemaName, outerLoopIterations);
|
schemaName, outerLoopIterations);
|
||||||
|
|
||||||
Schema tableSchema = resolver.Namespace.Schemas.Find(x = schemaName.equals( > x.Name))
|
Schema tableSchema = resolver.Namespace.Schemas.Find(x = schemaName.equals( > x.Name))
|
||||||
TypeArgument typeArg = new TypeArgument(LayoutType.UDT,
|
TypeArgument typeArg = new TypeArgument(LayoutType.UDT,
|
||||||
new TypeArgumentList(tableSchema.getSchemaId().clone()));
|
new TypeArgumentList(tableSchema.getSchemaId().clone()));
|
||||||
|
|
||||||
boolean allMatch = rows.size() == expected.Count;
|
boolean allMatch = rows.size() == expected.Count;
|
||||||
for (int i = 0; allMatch && i < rows.size(); i++) {
|
for (int i = 0; allMatch && i < rows.size(); i++) {
|
||||||
allMatch |= HybridRowValueGenerator.DynamicTypeArgumentEquals(resolver, expected[i], rows.get(i),
|
allMatch |= HybridRowValueGenerator.DynamicTypeArgumentEquals(resolver, expected[i], rows.get(i),
|
||||||
typeArg.clone());
|
typeArg.clone());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!allMatch) {
|
if (!allMatch) {
|
||||||
// TODO: C# TO JAVA CONVERTER: There is no equivalent to 'await' in Java:
|
// TODO: C# TO JAVA CONVERTER: There is no equivalent to 'await' in Java:
|
||||||
await BenchmarkSuiteBase.
|
await BenchmarkSuiteBase.
|
||||||
WriteAllRowsAsync(expectedFile, this.sdl, resolver, resolver.Resolve(tableSchema.getSchemaId().clone()), rows);
|
WriteAllRowsAsync(expectedFile, this.sdl, resolver, resolver.Resolve(tableSchema.getSchemaId().clone()), rows);
|
||||||
System.out.printf("Updated expected file at: %1$s" + "\r\n", (new File(expectedFile)).getAbsolutePath());
|
System.out.printf("Updated expected file at: %1$s" + "\r\n", (new File(expectedFile)).getAbsolutePath());
|
||||||
Assert.IsTrue(allMatch, "Expected output does not match expected file.");
|
Assert.IsTrue(allMatch, "Expected output does not match expected file.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static ArrayList<HashMap<Utf8String, Object>> GenerateBenchmarkInputs(LayoutResolverNamespace resolver,
|
private static ArrayList<HashMap<Utf8String, Object>> GenerateBenchmarkInputs(LayoutResolverNamespace resolver,
|
||||||
String schemaName,
|
String schemaName,
|
||||||
int outerLoopIterations) {
|
int outerLoopIterations) {
|
||||||
HybridRowGeneratorConfig generatorConfig = new HybridRowGeneratorConfig();
|
HybridRowGeneratorConfig generatorConfig = new HybridRowGeneratorConfig();
|
||||||
final int seed = 42;
|
final int seed = 42;
|
||||||
RandomGenerator rand = new RandomGenerator(new Random(seed));
|
RandomGenerator rand = new RandomGenerator(new Random(seed));
|
||||||
HybridRowValueGenerator valueGenerator = new HybridRowValueGenerator(rand, generatorConfig);
|
HybridRowValueGenerator valueGenerator = new HybridRowValueGenerator(rand, generatorConfig);
|
||||||
|
|
||||||
Layout layout = resolver.Resolve(tangible.ListHelper.find(resolver.getNamespace().getSchemas(), x =
|
Layout layout = resolver.Resolve(tangible.ListHelper.find(resolver.getNamespace().getSchemas(), x =
|
||||||
schemaName.equals( > x.Name)).SchemaId)
|
schemaName.equals( > x.Name)).SchemaId)
|
||||||
ArrayList<HashMap<Utf8String, Object>> rows = new ArrayList<HashMap<Utf8String, Object>>(outerLoopIterations);
|
ArrayList<HashMap<Utf8String, Object>> rows = new ArrayList<HashMap<Utf8String, Object>>(outerLoopIterations);
|
||||||
for (int iteration = 0; iteration != outerLoopIterations; iteration += outerLoopIterations < 0 ? 0 : 1) {
|
for (int iteration = 0; iteration != outerLoopIterations; iteration += outerLoopIterations < 0 ? 0 : 1) {
|
||||||
TypeArgument typeArg = new TypeArgument(LayoutType.UDT, new TypeArgumentList(layout.getSchemaId().clone()));
|
TypeArgument typeArg = new TypeArgument(LayoutType.UDT, new TypeArgumentList(layout.getSchemaId().clone()));
|
||||||
HashMap<Utf8String, Object> rowValue =
|
HashMap<Utf8String, Object> rowValue =
|
||||||
(HashMap<Utf8String, Object>)valueGenerator.GenerateLayoutType(resolver, typeArg.clone());
|
(HashMap<Utf8String, Object>)valueGenerator.GenerateLayoutType(resolver, typeArg.clone());
|
||||||
rows.add(rowValue);
|
rows.add(rowValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
return rows;
|
return rows;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+192
-192
@@ -1,193 +1,193 @@
|
|||||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||||
// Licensed under the MIT License.
|
// Licensed under the MIT License.
|
||||||
|
|
||||||
package com.azure.data.cosmos.serialization.hybridrow.perf;
|
package com.azure.data.cosmos.serialization.hybridrow.perf;
|
||||||
|
|
||||||
import com.azure.data.cosmos.core.Reference;
|
import com.azure.data.cosmos.core.Reference;
|
||||||
import com.azure.data.cosmos.serialization.hybridrow.HybridRowVersion;
|
import com.azure.data.cosmos.serialization.hybridrow.HybridRowVersion;
|
||||||
import com.azure.data.cosmos.serialization.hybridrow.ISpanResizer;
|
import com.azure.data.cosmos.serialization.hybridrow.ISpanResizer;
|
||||||
import com.azure.data.cosmos.serialization.hybridrow.Result;
|
import com.azure.data.cosmos.serialization.hybridrow.Result;
|
||||||
import com.azure.data.cosmos.serialization.hybridrow.RowBuffer;
|
import com.azure.data.cosmos.serialization.hybridrow.RowBuffer;
|
||||||
import com.azure.data.cosmos.serialization.hybridrow.io.RowReader;
|
import com.azure.data.cosmos.serialization.hybridrow.io.RowReader;
|
||||||
import com.azure.data.cosmos.serialization.hybridrow.io.RowWriter;
|
import com.azure.data.cosmos.serialization.hybridrow.io.RowWriter;
|
||||||
import com.azure.data.cosmos.serialization.hybridrow.layouts.Layout;
|
import com.azure.data.cosmos.serialization.hybridrow.layouts.Layout;
|
||||||
import com.azure.data.cosmos.serialization.hybridrow.layouts.LayoutResolver;
|
import com.azure.data.cosmos.serialization.hybridrow.layouts.LayoutResolver;
|
||||||
import com.azure.data.cosmos.serialization.hybridrow.layouts.LayoutType;
|
import com.azure.data.cosmos.serialization.hybridrow.layouts.LayoutType;
|
||||||
import com.azure.data.cosmos.serialization.hybridrow.layouts.TypeArgument;
|
import com.azure.data.cosmos.serialization.hybridrow.layouts.TypeArgument;
|
||||||
|
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
import java.io.OutputStream;
|
import java.io.OutputStream;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
|
||||||
import static com.google.common.base.Strings.lenientFormat;
|
import static com.google.common.base.Strings.lenientFormat;
|
||||||
|
|
||||||
//C# TO JAVA CONVERTER WARNING: Java does not allow user-defined value types. The behavior of this class may differ
|
//C# TO JAVA CONVERTER WARNING: Java does not allow user-defined value types. The behavior of this class may differ
|
||||||
// from the original:
|
// from the original:
|
||||||
//ORIGINAL LINE: public ref struct JsonModelRowGenerator
|
//ORIGINAL LINE: public ref struct JsonModelRowGenerator
|
||||||
//C# TO JAVA CONVERTER WARNING: Java has no equivalent to the C# ref struct:
|
//C# TO JAVA CONVERTER WARNING: Java has no equivalent to the C# ref struct:
|
||||||
public final class JsonModelRowGenerator {
|
public final class JsonModelRowGenerator {
|
||||||
private RowBuffer row = new RowBuffer();
|
private RowBuffer row = new RowBuffer();
|
||||||
|
|
||||||
|
|
||||||
public JsonModelRowGenerator(int capacity, Layout layout, LayoutResolver resolver) {
|
public JsonModelRowGenerator(int capacity, Layout layout, LayoutResolver resolver) {
|
||||||
this(capacity, layout, resolver, null);
|
this(capacity, layout, resolver, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
public JsonModelRowGenerator() {
|
public JsonModelRowGenerator() {
|
||||||
}
|
}
|
||||||
|
|
||||||
//C# TO JAVA CONVERTER NOTE: Java does not support optional parameters. Overloaded method(s) are created above:
|
//C# TO JAVA CONVERTER NOTE: Java does not support optional parameters. Overloaded method(s) are created above:
|
||||||
//ORIGINAL LINE: public JsonModelRowGenerator(int capacity, Layout layout, LayoutResolver resolver,
|
//ORIGINAL LINE: public JsonModelRowGenerator(int capacity, Layout layout, LayoutResolver resolver,
|
||||||
// ISpanResizer<byte> resizer = default)
|
// ISpanResizer<byte> resizer = default)
|
||||||
//C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java:
|
//C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java:
|
||||||
public JsonModelRowGenerator(int capacity, Layout layout, LayoutResolver resolver, ISpanResizer<Byte> resizer) {
|
public JsonModelRowGenerator(int capacity, Layout layout, LayoutResolver resolver, ISpanResizer<Byte> resizer) {
|
||||||
this.row = new RowBuffer(capacity, resizer);
|
this.row = new RowBuffer(capacity, resizer);
|
||||||
this.row.initLayout(HybridRowVersion.V1, layout, resolver);
|
this.row.initLayout(HybridRowVersion.V1, layout, resolver);
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getLength() {
|
public int getLength() {
|
||||||
return this.row.length();
|
return this.row.length();
|
||||||
}
|
}
|
||||||
|
|
||||||
public RowReader GetReader() {
|
public RowReader GetReader() {
|
||||||
Reference<RowBuffer> tempReference_row = new Reference<RowBuffer>(this.row);
|
Reference<RowBuffer> tempReference_row = new Reference<RowBuffer>(this.row);
|
||||||
// TODO: C# TO JAVA CONVERTER: The following line could not be converted:
|
// TODO: C# TO JAVA CONVERTER: The following line could not be converted:
|
||||||
return new RowReader(ref this.row)
|
return new RowReader(ref this.row)
|
||||||
this.row = tempReference_row.get();
|
this.row = tempReference_row.get();
|
||||||
return tempVar;
|
return tempVar;
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: C# TO JAVA CONVERTER: C# to Java Converter cannot determine whether this System.IO.Stream is input or
|
// TODO: C# TO JAVA CONVERTER: C# to Java Converter cannot determine whether this System.IO.Stream is input or
|
||||||
// output:
|
// output:
|
||||||
public boolean ReadFrom(InputStream stream, int length) {
|
public boolean ReadFrom(InputStream stream, int length) {
|
||||||
return this.row.readFrom(stream, length, HybridRowVersion.V1, this.row.resolver());
|
return this.row.readFrom(stream, length, HybridRowVersion.V1, this.row.resolver());
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Reset() {
|
public void Reset() {
|
||||||
Layout layout = this.row.resolver().resolve(this.row.header().schemaId().clone());
|
Layout layout = this.row.resolver().resolve(this.row.header().schemaId().clone());
|
||||||
this.row.initLayout(HybridRowVersion.V1, layout, this.row.resolver());
|
this.row.initLayout(HybridRowVersion.V1, layout, this.row.resolver());
|
||||||
}
|
}
|
||||||
|
|
||||||
//C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java:
|
//C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java:
|
||||||
//ORIGINAL LINE: public byte[] ToArray()
|
//ORIGINAL LINE: public byte[] ToArray()
|
||||||
public byte[] ToArray() {
|
public byte[] ToArray() {
|
||||||
return this.row.toArray();
|
return this.row.toArray();
|
||||||
}
|
}
|
||||||
|
|
||||||
public Result WriteBuffer(HashMap<Utf8String, Object> value) {
|
public Result WriteBuffer(HashMap<Utf8String, Object> value) {
|
||||||
Reference<RowBuffer> tempReference_row =
|
Reference<RowBuffer> tempReference_row =
|
||||||
new Reference<RowBuffer>(this.row);
|
new Reference<RowBuffer>(this.row);
|
||||||
// TODO: C# TO JAVA CONVERTER: The following lambda contained an unresolved 'ref' keyword - these are not
|
// TODO: C# TO JAVA CONVERTER: The following lambda contained an unresolved 'ref' keyword - these are not
|
||||||
// converted by C# to Java Converter:
|
// converted by C# to Java Converter:
|
||||||
Result tempVar = RowWriter.writeBuffer(tempReference_row, value, (RowWriter RowWriter writer, TypeArgument typeArg,
|
Result tempVar = RowWriter.writeBuffer(tempReference_row, value, (RowWriter RowWriter writer, TypeArgument typeArg,
|
||||||
HashMap<Utf8String, Object> dict) ->
|
HashMap<Utf8String, Object> dict) ->
|
||||||
{
|
{
|
||||||
for ((Utf8String propPath,Object propValue) :dict)
|
for ((Utf8String propPath,Object propValue) :dict)
|
||||||
{
|
{
|
||||||
Reference<com.azure.data.cosmos.serialization.hybridrow.io.RowWriter> tempReference_writer =
|
Reference<com.azure.data.cosmos.serialization.hybridrow.io.RowWriter> tempReference_writer =
|
||||||
new Reference<com.azure.data.cosmos.serialization.hybridrow.io.RowWriter>(writer);
|
new Reference<com.azure.data.cosmos.serialization.hybridrow.io.RowWriter>(writer);
|
||||||
Result result = JsonModelRowGenerator.JsonModelSwitch(tempReference_writer, propPath, propValue);
|
Result result = JsonModelRowGenerator.JsonModelSwitch(tempReference_writer, propPath, propValue);
|
||||||
writer = tempReference_writer.get();
|
writer = tempReference_writer.get();
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
return Result.SUCCESS;
|
return Result.SUCCESS;
|
||||||
});
|
});
|
||||||
this.row = tempReference_row.get();
|
this.row = tempReference_row.get();
|
||||||
return tempVar;
|
return tempVar;
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: C# TO JAVA CONVERTER: C# to Java Converter cannot determine whether this System.IO.Stream is input or
|
// TODO: C# TO JAVA CONVERTER: C# to Java Converter cannot determine whether this System.IO.Stream is input or
|
||||||
// output:
|
// output:
|
||||||
public void WriteTo(OutputStream stream) {
|
public void WriteTo(OutputStream stream) {
|
||||||
this.row.writeTo(stream);
|
this.row.writeTo(stream);
|
||||||
}
|
}
|
||||||
|
|
||||||
public JsonModelRowGenerator clone() {
|
public JsonModelRowGenerator clone() {
|
||||||
JsonModelRowGenerator varCopy = new JsonModelRowGenerator();
|
JsonModelRowGenerator varCopy = new JsonModelRowGenerator();
|
||||||
varCopy.row = this.row.clone();
|
varCopy.row = this.row.clone();
|
||||||
return varCopy;
|
return varCopy;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static Result JsonModelSwitch(Reference<RowWriter> writer, Utf8String path, Object value) {
|
private static Result JsonModelSwitch(Reference<RowWriter> writer, Utf8String path, Object value) {
|
||||||
switch (value) {
|
switch (value) {
|
||||||
case null:
|
case null:
|
||||||
return writer.get().writeNull(path);
|
return writer.get().writeNull(path);
|
||||||
// TODO: C# TO JAVA CONVERTER: Java has no equivalent to C# pattern variables in 'case' statements:
|
// TODO: C# TO JAVA CONVERTER: Java has no equivalent to C# pattern variables in 'case' statements:
|
||||||
//ORIGINAL LINE: case bool x:
|
//ORIGINAL LINE: case bool x:
|
||||||
case
|
case
|
||||||
boolean x:
|
boolean x:
|
||||||
return writer.get().writeBoolean(path, x);
|
return writer.get().writeBoolean(path, x);
|
||||||
// TODO: C# TO JAVA CONVERTER: Java has no equivalent to C# pattern variables in 'case' statements:
|
// TODO: C# TO JAVA CONVERTER: Java has no equivalent to C# pattern variables in 'case' statements:
|
||||||
//ORIGINAL LINE: case long x:
|
//ORIGINAL LINE: case long x:
|
||||||
case
|
case
|
||||||
long x:
|
long x:
|
||||||
return writer.get().writeInt64(path, x);
|
return writer.get().writeInt64(path, x);
|
||||||
// TODO: C# TO JAVA CONVERTER: Java has no equivalent to C# pattern variables in 'case' statements:
|
// TODO: C# TO JAVA CONVERTER: Java has no equivalent to C# pattern variables in 'case' statements:
|
||||||
//ORIGINAL LINE: case double x:
|
//ORIGINAL LINE: case double x:
|
||||||
case
|
case
|
||||||
double x:
|
double x:
|
||||||
return writer.get().writeFloat64(path, x);
|
return writer.get().writeFloat64(path, x);
|
||||||
// TODO: C# TO JAVA CONVERTER: Java has no equivalent to C# pattern variables in 'case' statements:
|
// TODO: C# TO JAVA CONVERTER: Java has no equivalent to C# pattern variables in 'case' statements:
|
||||||
//ORIGINAL LINE: case string x:
|
//ORIGINAL LINE: case string x:
|
||||||
case String
|
case String
|
||||||
x:
|
x:
|
||||||
return writer.get().WriteString(path, x);
|
return writer.get().WriteString(path, x);
|
||||||
// TODO: C# TO JAVA CONVERTER: Java has no equivalent to C# pattern variables in 'case' statements:
|
// TODO: C# TO JAVA CONVERTER: Java has no equivalent to C# pattern variables in 'case' statements:
|
||||||
//ORIGINAL LINE: case Utf8String x:
|
//ORIGINAL LINE: case Utf8String x:
|
||||||
case Utf8String
|
case Utf8String
|
||||||
x:
|
x:
|
||||||
return writer.get().WriteString(path, x.Span);
|
return writer.get().WriteString(path, x.Span);
|
||||||
// TODO: C# TO JAVA CONVERTER: Java has no equivalent to C# pattern variables in 'case' statements:
|
// TODO: C# TO JAVA CONVERTER: Java has no equivalent to C# pattern variables in 'case' statements:
|
||||||
//ORIGINAL LINE: case byte[] x:
|
//ORIGINAL LINE: case byte[] x:
|
||||||
//C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java:
|
//C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java:
|
||||||
case
|
case
|
||||||
byte[] x:
|
byte[] x:
|
||||||
return writer.get().WriteBinary(path, x);
|
return writer.get().WriteBinary(path, x);
|
||||||
// TODO: C# TO JAVA CONVERTER: Java has no equivalent to C# pattern variables in 'case' statements:
|
// TODO: C# TO JAVA CONVERTER: Java has no equivalent to C# pattern variables in 'case' statements:
|
||||||
//ORIGINAL LINE: case ReadOnlyMemory<byte> x:
|
//ORIGINAL LINE: case ReadOnlyMemory<byte> x:
|
||||||
//C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java:
|
//C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java:
|
||||||
case ReadOnlyMemory < Byte > x:
|
case ReadOnlyMemory < Byte > x:
|
||||||
return writer.get().WriteBinary(path, x.Span);
|
return writer.get().WriteBinary(path, x.Span);
|
||||||
// TODO: C# TO JAVA CONVERTER: Java has no equivalent to C# pattern variables in 'case' statements:
|
// TODO: C# TO JAVA CONVERTER: Java has no equivalent to C# pattern variables in 'case' statements:
|
||||||
//ORIGINAL LINE: case Dictionary<Utf8String, object> x:
|
//ORIGINAL LINE: case Dictionary<Utf8String, object> x:
|
||||||
case HashMap < Utf8String, Object > x:
|
case HashMap < Utf8String, Object > x:
|
||||||
// TODO: C# TO JAVA CONVERTER: The following lambda contained an unresolved 'ref' keyword - these
|
// TODO: C# TO JAVA CONVERTER: The following lambda contained an unresolved 'ref' keyword - these
|
||||||
// are not converted by C# to Java Converter:
|
// are not converted by C# to Java Converter:
|
||||||
return writer.get().writeScope(path, new TypeArgument(LayoutType.Object), x,
|
return writer.get().writeScope(path, new TypeArgument(LayoutType.Object), x,
|
||||||
(RowWriter RowWriter writer2, TypeArgument typeArg, HashMap<Utf8String, Object> dict) ->
|
(RowWriter RowWriter writer2, TypeArgument typeArg, HashMap<Utf8String, Object> dict) ->
|
||||||
{
|
{
|
||||||
for ((Utf8String propPath,Object propValue) :dict)
|
for ((Utf8String propPath,Object propValue) :dict)
|
||||||
{
|
{
|
||||||
Reference<com.azure.data.cosmos.serialization.hybridrow.io.RowWriter> tempReference_writer2 = new Reference<com.azure.data.cosmos.serialization.hybridrow.io.RowWriter>(writer2);
|
Reference<com.azure.data.cosmos.serialization.hybridrow.io.RowWriter> tempReference_writer2 = new Reference<com.azure.data.cosmos.serialization.hybridrow.io.RowWriter>(writer2);
|
||||||
Result result = JsonModelRowGenerator.JsonModelSwitch(tempReference_writer2, propPath, propValue);
|
Result result = JsonModelRowGenerator.JsonModelSwitch(tempReference_writer2, propPath, propValue);
|
||||||
writer2 = tempReference_writer2.get();
|
writer2 = tempReference_writer2.get();
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
return Result.SUCCESS;
|
return Result.SUCCESS;
|
||||||
});
|
});
|
||||||
// TODO: C# TO JAVA CONVERTER: Java has no equivalent to C# pattern variables in 'case' statements:
|
// TODO: C# TO JAVA CONVERTER: Java has no equivalent to C# pattern variables in 'case' statements:
|
||||||
//ORIGINAL LINE: case List<object> x:
|
//ORIGINAL LINE: case List<object> x:
|
||||||
case ArrayList < Object > x:
|
case ArrayList < Object > x:
|
||||||
// TODO: C# TO JAVA CONVERTER: The following lambda contained an unresolved 'ref' keyword - these are not converted by C# to Java Converter:
|
// TODO: C# TO JAVA CONVERTER: The following lambda contained an unresolved 'ref' keyword - these are not converted by C# to Java Converter:
|
||||||
return writer.get().writeScope(path, new TypeArgument(LayoutType.Array), x, (RowWriter RowWriter writer2, TypeArgument typeArg, ArrayList<Object> list) ->
|
return writer.get().writeScope(path, new TypeArgument(LayoutType.Array), x, (RowWriter RowWriter writer2, TypeArgument typeArg, ArrayList<Object> list) ->
|
||||||
{
|
{
|
||||||
for (Object elm : list) {
|
for (Object elm : list) {
|
||||||
Reference<com.azure.data.cosmos.serialization.hybridrow.io.RowWriter> tempReference_writer2 = new Reference<com.azure.data.cosmos.serialization.hybridrow.io.RowWriter>(writer2);
|
Reference<com.azure.data.cosmos.serialization.hybridrow.io.RowWriter> tempReference_writer2 = new Reference<com.azure.data.cosmos.serialization.hybridrow.io.RowWriter>(writer2);
|
||||||
Result result = JsonModelRowGenerator.JsonModelSwitch(tempReference_writer2, null, elm);
|
Result result = JsonModelRowGenerator.JsonModelSwitch(tempReference_writer2, null, elm);
|
||||||
writer2 = tempReference_writer2.get();
|
writer2 = tempReference_writer2.get();
|
||||||
if (result != Result.SUCCESS) {
|
if (result != Result.SUCCESS) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return Result.SUCCESS;
|
return Result.SUCCESS;
|
||||||
});
|
});
|
||||||
default:
|
default:
|
||||||
throw new IllegalStateException(lenientFormat("Unknown type will be ignored: %s", value.getClass().getSimpleName()));
|
throw new IllegalStateException(lenientFormat("Unknown type will be ignored: %s", value.getClass().getSimpleName()));
|
||||||
return Result.FAILURE;
|
return Result.FAILURE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+61
-61
@@ -1,62 +1,62 @@
|
|||||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||||
// Licensed under the MIT License.
|
// Licensed under the MIT License.
|
||||||
|
|
||||||
package com.azure.data.cosmos.serialization.hybridrow.perf;
|
package com.azure.data.cosmos.serialization.hybridrow.perf;
|
||||||
|
|
||||||
import java.io.Closeable;
|
import java.io.Closeable;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.FileOutputStream;
|
import java.io.FileOutputStream;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.OutputStreamWriter;
|
import java.io.OutputStreamWriter;
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
public class Measurements implements Closeable {
|
public class Measurements implements Closeable {
|
||||||
private static final long RunId = LocalDateTime.UtcNow.getTime();
|
private static final long RunId = LocalDateTime.UtcNow.getTime();
|
||||||
// TODO: C# TO JAVA CONVERTER: C# to Java Converter cannot determine whether this System.IO.FileStream is
|
// TODO: C# TO JAVA CONVERTER: C# to Java Converter cannot determine whether this System.IO.FileStream is
|
||||||
// input or output:
|
// input or output:
|
||||||
private FileStream file;
|
private FileStream file;
|
||||||
private TextWriter writer;
|
private TextWriter writer;
|
||||||
|
|
||||||
public Measurements(String path) {
|
public Measurements(String path) {
|
||||||
File info = new File(path);
|
File info = new File(path);
|
||||||
if (info.exists()) {
|
if (info.exists()) {
|
||||||
this.file = new FileOutputStream(path, true);
|
this.file = new FileOutputStream(path, true);
|
||||||
this.writer = new OutputStreamWriter(this.file, java.nio.charset.StandardCharsets.US_ASCII);
|
this.writer = new OutputStreamWriter(this.file, java.nio.charset.StandardCharsets.US_ASCII);
|
||||||
} else {
|
} else {
|
||||||
// TODO: C# TO JAVA CONVERTER: C# to Java Converter cannot determine whether this System.IO.FileStream
|
// TODO: C# TO JAVA CONVERTER: C# to Java Converter cannot determine whether this System.IO.FileStream
|
||||||
// is input or output:
|
// is input or output:
|
||||||
this.file = new FileStream(path, FileMode.CreateNew);
|
this.file = new FileStream(path, FileMode.CreateNew);
|
||||||
this.writer = new OutputStreamWriter(this.file, java.nio.charset.StandardCharsets.US_ASCII);
|
this.writer = new OutputStreamWriter(this.file, java.nio.charset.StandardCharsets.US_ASCII);
|
||||||
this.writer.WriteLine("RunId,Model,Operation,Schema,API,Iterations,Size (bytes),Total (ms),Duration (ms)," +
|
this.writer.WriteLine("RunId,Model,Operation,Schema,API,Iterations,Size (bytes),Total (ms),Duration (ms)," +
|
||||||
"Allocated (bytes),ThreadId,Gen0,Gen1,Gen2,Total Allocated (bytes)");
|
"Allocated (bytes),ThreadId,Gen0,Gen1,Gen2,Total Allocated (bytes)");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public final void WriteMeasurement(String model, String operation, String schema, String api,
|
public final void WriteMeasurement(String model, String operation, String schema, String api,
|
||||||
int outerLoopIterations, int innerLoopIterations, long totalSize,
|
int outerLoopIterations, int innerLoopIterations, long totalSize,
|
||||||
double totalDurationMs, int threadId, int gen0, int gen1, int gen2,
|
double totalDurationMs, int threadId, int gen0, int gen1, int gen2,
|
||||||
long totalAllocatedBytes) {
|
long totalAllocatedBytes) {
|
||||||
System.out.printf("RunId: %1$s, \nModel: %2$s \nOperation: %3$s \nSchema: %4$s \nAPI: %5$s" + "\r\n",
|
System.out.printf("RunId: %1$s, \nModel: %2$s \nOperation: %3$s \nSchema: %4$s \nAPI: %5$s" + "\r\n",
|
||||||
Measurements.RunId, model, operation, schema, api);
|
Measurements.RunId, model, operation, schema, api);
|
||||||
|
|
||||||
System.out.printf("\n\nIterations: %1$s \nSize (bytes): %1.0f \nTotal (ms): %2.4f \nDuration (ms): %3.4f " +
|
System.out.printf("\n\nIterations: %1$s \nSize (bytes): %1.0f \nTotal (ms): %2.4f \nDuration (ms): %3.4f " +
|
||||||
"\nAllocated (bytes): %4.4f" + "\r\n", outerLoopIterations, totalSize / outerLoopIterations,
|
"\nAllocated (bytes): %4.4f" + "\r\n", outerLoopIterations, totalSize / outerLoopIterations,
|
||||||
totalDurationMs, totalDurationMs / (outerLoopIterations * innerLoopIterations),
|
totalDurationMs, totalDurationMs / (outerLoopIterations * innerLoopIterations),
|
||||||
totalAllocatedBytes / (outerLoopIterations * innerLoopIterations));
|
totalAllocatedBytes / (outerLoopIterations * innerLoopIterations));
|
||||||
|
|
||||||
// TODO: C# TO JAVA CONVERTER: The '4:n0' format specifier is not converted to Java:
|
// TODO: C# TO JAVA CONVERTER: The '4:n0' format specifier is not converted to Java:
|
||||||
System.out.printf("\n\nThread: %1$s \nCollections: %2$s, %3$s, %4$s \nTotal Allocated: {4:n0} (bytes)" + "\r" +
|
System.out.printf("\n\nThread: %1$s \nCollections: %2$s, %3$s, %4$s \nTotal Allocated: {4:n0} (bytes)" + "\r" +
|
||||||
"\n", threadId, gen0, gen1, gen2, totalAllocatedBytes);
|
"\n", threadId, gen0, gen1, gen2, totalAllocatedBytes);
|
||||||
|
|
||||||
|
|
||||||
this.writer.WriteLine("{0},{1},{2},{3},{4},{5},{6:F0},{7:F8},{8:F8},{9:F8},{10},{11},{12},{13},{14:0}",
|
this.writer.WriteLine("{0},{1},{2},{3},{4},{5},{6:F0},{7:F8},{8:F8},{9:F8},{10},{11},{12},{13},{14:0}",
|
||||||
Measurements.RunId, model, operation, schema, api, outerLoopIterations, totalSize / outerLoopIterations,
|
Measurements.RunId, model, operation, schema, api, outerLoopIterations, totalSize / outerLoopIterations,
|
||||||
totalDurationMs, totalDurationMs / (outerLoopIterations * innerLoopIterations), totalAllocatedBytes / (outerLoopIterations * innerLoopIterations), threadId, gen0, gen1, gen2, totalAllocatedBytes);
|
totalDurationMs, totalDurationMs / (outerLoopIterations * innerLoopIterations), totalAllocatedBytes / (outerLoopIterations * innerLoopIterations), threadId, gen0, gen1, gen2, totalAllocatedBytes);
|
||||||
}
|
}
|
||||||
|
|
||||||
public final void close() throws IOException {
|
public final void close() throws IOException {
|
||||||
this.writer.Flush();
|
this.writer.Flush();
|
||||||
this.writer.Dispose();
|
this.writer.Dispose();
|
||||||
this.file.Dispose();
|
this.file.Dispose();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+126
-126
@@ -1,127 +1,127 @@
|
|||||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||||
// Licensed under the MIT License.
|
// Licensed under the MIT License.
|
||||||
|
|
||||||
package com.azure.data.cosmos.serialization.hybridrow.perf;
|
package com.azure.data.cosmos.serialization.hybridrow.perf;
|
||||||
|
|
||||||
import JetBrains.Profiler.Api.*;
|
import JetBrains.Profiler.Api.*;
|
||||||
import com.azure.data.cosmos.core.Reference;
|
import com.azure.data.cosmos.core.Reference;
|
||||||
import com.azure.data.cosmos.core.Reference;
|
import com.azure.data.cosmos.core.Reference;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
|
||||||
// TODO: C# TO JAVA CONVERTER: Java annotations will not correspond to .NET attributes:
|
// TODO: C# TO JAVA CONVERTER: Java annotations will not correspond to .NET attributes:
|
||||||
//ORIGINAL LINE: [SuppressMessage("Microsoft.Reliability", "CA2001:Avoid calling problematic methods", Justification
|
//ORIGINAL LINE: [SuppressMessage("Microsoft.Reliability", "CA2001:Avoid calling problematic methods", Justification
|
||||||
// = "Perf Benchmark")] public class MicroBenchmarkSuiteBase : BenchmarkSuiteBase
|
// = "Perf Benchmark")] public class MicroBenchmarkSuiteBase : BenchmarkSuiteBase
|
||||||
public class MicroBenchmarkSuiteBase extends BenchmarkSuiteBase {
|
public class MicroBenchmarkSuiteBase extends BenchmarkSuiteBase {
|
||||||
private static final String MetricsResultFile = "HybridRowPerf.csv";
|
private static final String MetricsResultFile = "HybridRowPerf.csv";
|
||||||
private static final int WarmCount = 5;
|
private static final int WarmCount = 5;
|
||||||
|
|
||||||
// TODO: C# TO JAVA CONVERTER: Java annotations will not correspond to .NET attributes:
|
// TODO: C# TO JAVA CONVERTER: Java annotations will not correspond to .NET attributes:
|
||||||
//ORIGINAL LINE: [SuppressMessage("Microsoft.Reliability", "CA2001:Avoid calling problematic methods",
|
//ORIGINAL LINE: [SuppressMessage("Microsoft.Reliability", "CA2001:Avoid calling problematic methods",
|
||||||
// Justification = "Perf Benchmark")] private protected static void Benchmark<TValue>(string model, string
|
// Justification = "Perf Benchmark")] private protected static void Benchmark<TValue>(string model, string
|
||||||
// operation, string schema, string api, int innerLoopIterations, ref BenchmarkContext context,
|
// operation, string schema, string api, int innerLoopIterations, ref BenchmarkContext context,
|
||||||
// BenchmarkBody<TValue> loopBody, BenchmarkMeasure<TValue> measure, List<TValue> expected)
|
// BenchmarkBody<TValue> loopBody, BenchmarkMeasure<TValue> measure, List<TValue> expected)
|
||||||
//C# TO JAVA CONVERTER WARNING: Java has no equivalent to C# 'private protected' access:
|
//C# TO JAVA CONVERTER WARNING: Java has no equivalent to C# 'private protected' access:
|
||||||
//ORIGINAL LINE: [SuppressMessage("Microsoft.Reliability", "CA2001:Avoid calling problematic methods",
|
//ORIGINAL LINE: [SuppressMessage("Microsoft.Reliability", "CA2001:Avoid calling problematic methods",
|
||||||
// Justification = "Perf Benchmark")] private protected static void Benchmark<TValue>(string model, string
|
// Justification = "Perf Benchmark")] private protected static void Benchmark<TValue>(string model, string
|
||||||
// operation, string schema, string api, int innerLoopIterations, ref BenchmarkContext context,
|
// operation, string schema, string api, int innerLoopIterations, ref BenchmarkContext context,
|
||||||
// BenchmarkBody<TValue> loopBody, BenchmarkMeasure<TValue> measure, List<TValue> expected)
|
// BenchmarkBody<TValue> loopBody, BenchmarkMeasure<TValue> measure, List<TValue> expected)
|
||||||
protected static <TValue> void Benchmark(String model, String operation, String schema, String api,
|
protected static <TValue> void Benchmark(String model, String operation, String schema, String api,
|
||||||
int innerLoopIterations, Reference<BenchmarkContext> context,
|
int innerLoopIterations, Reference<BenchmarkContext> context,
|
||||||
BenchmarkBody<TValue> loopBody, BenchmarkMeasure<TValue> measure,
|
BenchmarkBody<TValue> loopBody, BenchmarkMeasure<TValue> measure,
|
||||||
ArrayList<TValue> expected) {
|
ArrayList<TValue> expected) {
|
||||||
Stopwatch sw = new Stopwatch();
|
Stopwatch sw = new Stopwatch();
|
||||||
double durationMs = 0;
|
double durationMs = 0;
|
||||||
long rowSize = 0;
|
long rowSize = 0;
|
||||||
|
|
||||||
// Warm
|
// Warm
|
||||||
int warm = Math.min(MicroBenchmarkSuiteBase.WarmCount, expected.size());
|
int warm = Math.min(MicroBenchmarkSuiteBase.WarmCount, expected.size());
|
||||||
for (int i = 0; i < warm; i++) {
|
for (int i = 0; i < warm; i++) {
|
||||||
for (int innerLoop = 0; innerLoop < innerLoopIterations; innerLoop++) {
|
for (int innerLoop = 0; innerLoop < innerLoopIterations; innerLoop++) {
|
||||||
loopBody.invoke(context, expected.get(i));
|
loopBody.invoke(context, expected.get(i));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Execute
|
// Execute
|
||||||
System.gc();
|
System.gc();
|
||||||
System.runFinalization();
|
System.runFinalization();
|
||||||
Thread.sleep(1000);
|
Thread.sleep(1000);
|
||||||
int gen0 = GC.CollectionCount(0);
|
int gen0 = GC.CollectionCount(0);
|
||||||
int gen1 = GC.CollectionCount(1);
|
int gen1 = GC.CollectionCount(1);
|
||||||
int gen2 = GC.CollectionCount(2);
|
int gen2 = GC.CollectionCount(2);
|
||||||
long allocated = GC.GetAllocatedBytesForCurrentThread();
|
long allocated = GC.GetAllocatedBytesForCurrentThread();
|
||||||
int threadId = Thread.currentThread().ManagedThreadId;
|
int threadId = Thread.currentThread().ManagedThreadId;
|
||||||
ThreadPriority currentPriority = Thread.currentThread().Priority;
|
ThreadPriority currentPriority = Thread.currentThread().Priority;
|
||||||
Thread.currentThread().Priority = ThreadPriority.Highest;
|
Thread.currentThread().Priority = ThreadPriority.Highest;
|
||||||
MemoryProfiler.CollectAllocations(true);
|
MemoryProfiler.CollectAllocations(true);
|
||||||
MemoryProfiler.GetSnapshot();
|
MemoryProfiler.GetSnapshot();
|
||||||
try {
|
try {
|
||||||
for (TValue tableValue : expected) {
|
for (TValue tableValue : expected) {
|
||||||
sw.Restart();
|
sw.Restart();
|
||||||
MicroBenchmarkSuiteBase.BenchmarkInnerLoop(innerLoopIterations, tableValue, context, loopBody);
|
MicroBenchmarkSuiteBase.BenchmarkInnerLoop(innerLoopIterations, tableValue, context, loopBody);
|
||||||
sw.Stop();
|
sw.Stop();
|
||||||
durationMs += sw.Elapsed.TotalMilliseconds;
|
durationMs += sw.Elapsed.TotalMilliseconds;
|
||||||
rowSize += measure.invoke(context, tableValue);
|
rowSize += measure.invoke(context, tableValue);
|
||||||
}
|
}
|
||||||
} finally {
|
} finally {
|
||||||
Thread.currentThread().Priority = currentPriority;
|
Thread.currentThread().Priority = currentPriority;
|
||||||
gen0 = GC.CollectionCount(0) - gen0;
|
gen0 = GC.CollectionCount(0) - gen0;
|
||||||
gen1 = GC.CollectionCount(1) - gen1;
|
gen1 = GC.CollectionCount(1) - gen1;
|
||||||
gen2 = GC.CollectionCount(2) - gen2;
|
gen2 = GC.CollectionCount(2) - gen2;
|
||||||
allocated = GC.GetAllocatedBytesForCurrentThread() - allocated;
|
allocated = GC.GetAllocatedBytesForCurrentThread() - allocated;
|
||||||
MemoryProfiler.GetSnapshot();
|
MemoryProfiler.GetSnapshot();
|
||||||
MemoryProfiler.CollectAllocations(false);
|
MemoryProfiler.CollectAllocations(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
try (Measurements m = new Measurements(MicroBenchmarkSuiteBase.MetricsResultFile)) {
|
try (Measurements m = new Measurements(MicroBenchmarkSuiteBase.MetricsResultFile)) {
|
||||||
m.WriteMeasurement(model, operation, schema, api, expected.size(), innerLoopIterations, rowSize,
|
m.WriteMeasurement(model, operation, schema, api, expected.size(), innerLoopIterations, rowSize,
|
||||||
durationMs, threadId, gen0, gen1, gen2, allocated);
|
durationMs, threadId, gen0, gen1, gen2, allocated);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: C# TO JAVA CONVERTER: Java annotations will not correspond to .NET attributes:
|
// TODO: C# TO JAVA CONVERTER: Java annotations will not correspond to .NET attributes:
|
||||||
//ORIGINAL LINE: [MethodImpl(MethodImplOptions.NoInlining)] private static void BenchmarkInnerLoop<TValue>(int
|
//ORIGINAL LINE: [MethodImpl(MethodImplOptions.NoInlining)] private static void BenchmarkInnerLoop<TValue>(int
|
||||||
// innerLoopIterations, TValue tableValue, ref BenchmarkContext context, BenchmarkBody<TValue> loopBody)
|
// innerLoopIterations, TValue tableValue, ref BenchmarkContext context, BenchmarkBody<TValue> loopBody)
|
||||||
private static <TValue> void BenchmarkInnerLoop(int innerLoopIterations, TValue tableValue,
|
private static <TValue> void BenchmarkInnerLoop(int innerLoopIterations, TValue tableValue,
|
||||||
Reference<BenchmarkContext> context,
|
Reference<BenchmarkContext> context,
|
||||||
BenchmarkBody<TValue> loopBody) {
|
BenchmarkBody<TValue> loopBody) {
|
||||||
for (int innerLoop = 0; innerLoop < innerLoopIterations; innerLoop++) {
|
for (int innerLoop = 0; innerLoop < innerLoopIterations; innerLoop++) {
|
||||||
loopBody.invoke(context, tableValue);
|
loopBody.invoke(context, tableValue);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@FunctionalInterface
|
@FunctionalInterface
|
||||||
public interface BenchmarkBody<TValue> {
|
public interface BenchmarkBody<TValue> {
|
||||||
void invoke(Reference<BenchmarkContext> context, TValue value);
|
void invoke(Reference<BenchmarkContext> context, TValue value);
|
||||||
}
|
}
|
||||||
|
|
||||||
@FunctionalInterface
|
@FunctionalInterface
|
||||||
public interface BenchmarkMeasure<TValue> {
|
public interface BenchmarkMeasure<TValue> {
|
||||||
long invoke(Reference<BenchmarkContext> context, TValue value);
|
long invoke(Reference<BenchmarkContext> context, TValue value);
|
||||||
}
|
}
|
||||||
|
|
||||||
//C# TO JAVA CONVERTER WARNING: Java does not allow user-defined value types. The behavior of this class may
|
//C# TO JAVA CONVERTER WARNING: Java does not allow user-defined value types. The behavior of this class may
|
||||||
// differ from the original:
|
// differ from the original:
|
||||||
//ORIGINAL LINE: private protected ref struct BenchmarkContext
|
//ORIGINAL LINE: private protected ref struct BenchmarkContext
|
||||||
//C# TO JAVA CONVERTER WARNING: Java has no equivalent to the C# ref struct:
|
//C# TO JAVA CONVERTER WARNING: Java has no equivalent to the C# ref struct:
|
||||||
//C# TO JAVA CONVERTER WARNING: Java has no equivalent to C# 'private protected' access:
|
//C# TO JAVA CONVERTER WARNING: Java has no equivalent to C# 'private protected' access:
|
||||||
protected final static class BenchmarkContext {
|
protected final static class BenchmarkContext {
|
||||||
public CodeGenRowGenerator CodeGenWriter = new CodeGenRowGenerator();
|
public CodeGenRowGenerator CodeGenWriter = new CodeGenRowGenerator();
|
||||||
public JsonModelRowGenerator JsonModelWriter = new JsonModelRowGenerator();
|
public JsonModelRowGenerator JsonModelWriter = new JsonModelRowGenerator();
|
||||||
public WriteRowGenerator PatchWriter = new WriteRowGenerator();
|
public WriteRowGenerator PatchWriter = new WriteRowGenerator();
|
||||||
public ProtobufRowGenerator ProtobufWriter = new ProtobufRowGenerator();
|
public ProtobufRowGenerator ProtobufWriter = new ProtobufRowGenerator();
|
||||||
public StreamingRowGenerator StreamingWriter = new StreamingRowGenerator();
|
public StreamingRowGenerator StreamingWriter = new StreamingRowGenerator();
|
||||||
|
|
||||||
public BenchmarkContext clone() {
|
public BenchmarkContext clone() {
|
||||||
BenchmarkContext varCopy = new BenchmarkContext();
|
BenchmarkContext varCopy = new BenchmarkContext();
|
||||||
|
|
||||||
varCopy.CodeGenWriter = this.CodeGenWriter.clone();
|
varCopy.CodeGenWriter = this.CodeGenWriter.clone();
|
||||||
varCopy.ProtobufWriter = this.ProtobufWriter.clone();
|
varCopy.ProtobufWriter = this.ProtobufWriter.clone();
|
||||||
varCopy.PatchWriter = this.PatchWriter.clone();
|
varCopy.PatchWriter = this.PatchWriter.clone();
|
||||||
varCopy.StreamingWriter = this.StreamingWriter.clone();
|
varCopy.StreamingWriter = this.StreamingWriter.clone();
|
||||||
varCopy.JsonModelWriter = this.JsonModelWriter.clone();
|
varCopy.JsonModelWriter = this.JsonModelWriter.clone();
|
||||||
|
|
||||||
return varCopy;
|
return varCopy;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+337
-337
@@ -1,338 +1,338 @@
|
|||||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||||
// Licensed under the MIT License.
|
// Licensed under the MIT License.
|
||||||
|
|
||||||
package com.azure.data.cosmos.serialization.hybridrow.perf;
|
package com.azure.data.cosmos.serialization.hybridrow.perf;
|
||||||
|
|
||||||
import Google.Protobuf.*;
|
import Google.Protobuf.*;
|
||||||
import Google.Protobuf.Collections.*;
|
import Google.Protobuf.Collections.*;
|
||||||
import com.azure.data.cosmos.serialization.hybridrow.perf.CassandraHotel.Protobuf.Address;
|
import com.azure.data.cosmos.serialization.hybridrow.perf.CassandraHotel.Protobuf.Address;
|
||||||
import com.azure.data.cosmos.serialization.hybridrow.perf.CassandraHotel.Protobuf.Available_Rooms_By_Hotel_Date;
|
import com.azure.data.cosmos.serialization.hybridrow.perf.CassandraHotel.Protobuf.Available_Rooms_By_Hotel_Date;
|
||||||
import com.azure.data.cosmos.serialization.hybridrow.perf.CassandraHotel.Protobuf.Guests;
|
import com.azure.data.cosmos.serialization.hybridrow.perf.CassandraHotel.Protobuf.Guests;
|
||||||
import com.azure.data.cosmos.serialization.hybridrow.perf.CassandraHotel.Protobuf.Hotels;
|
import com.azure.data.cosmos.serialization.hybridrow.perf.CassandraHotel.Protobuf.Hotels;
|
||||||
import com.azure.data.cosmos.serialization.hybridrow.perf.CassandraHotel.Protobuf.PostalCode;
|
import com.azure.data.cosmos.serialization.hybridrow.perf.CassandraHotel.Protobuf.PostalCode;
|
||||||
|
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
import static com.google.common.base.Strings.lenientFormat;
|
import static com.google.common.base.Strings.lenientFormat;
|
||||||
|
|
||||||
// TODO: C# TO JAVA CONVERTER: There is no preprocessor in Java:
|
// TODO: C# TO JAVA CONVERTER: There is no preprocessor in Java:
|
||||||
///#pragma warning disable DontUseNamespaceAliases // Namespace Aliases should be avoided
|
///#pragma warning disable DontUseNamespaceAliases // Namespace Aliases should be avoided
|
||||||
|
|
||||||
// TODO: C# TO JAVA CONVERTER: There is no preprocessor in Java:
|
// TODO: C# TO JAVA CONVERTER: There is no preprocessor in Java:
|
||||||
///#pragma warning restore DontUseNamespaceAliases // Namespace Aliases should be avoided
|
///#pragma warning restore DontUseNamespaceAliases // Namespace Aliases should be avoided
|
||||||
|
|
||||||
//C# TO JAVA CONVERTER WARNING: Java does not allow user-defined value types. The behavior of this class may differ
|
//C# TO JAVA CONVERTER WARNING: Java does not allow user-defined value types. The behavior of this class may differ
|
||||||
// from the original:
|
// from the original:
|
||||||
//ORIGINAL LINE: internal ref struct ProtobufRowGenerator
|
//ORIGINAL LINE: internal ref struct ProtobufRowGenerator
|
||||||
//C# TO JAVA CONVERTER WARNING: Java has no equivalent to the C# ref struct:
|
//C# TO JAVA CONVERTER WARNING: Java has no equivalent to the C# ref struct:
|
||||||
public final class ProtobufRowGenerator {
|
public final class ProtobufRowGenerator {
|
||||||
//C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java:
|
//C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java:
|
||||||
//ORIGINAL LINE: private ReadOnlySpan<byte> active;
|
//ORIGINAL LINE: private ReadOnlySpan<byte> active;
|
||||||
private ReadOnlySpan<Byte> active;
|
private ReadOnlySpan<Byte> active;
|
||||||
//C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java:
|
//C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java:
|
||||||
//ORIGINAL LINE: private readonly byte[] buffer;
|
//ORIGINAL LINE: private readonly byte[] buffer;
|
||||||
private byte[] buffer;
|
private byte[] buffer;
|
||||||
private String schemaName;
|
private String schemaName;
|
||||||
|
|
||||||
public ProtobufRowGenerator() {
|
public ProtobufRowGenerator() {
|
||||||
}
|
}
|
||||||
|
|
||||||
public ProtobufRowGenerator(String schemaName, int capacity) {
|
public ProtobufRowGenerator(String schemaName, int capacity) {
|
||||||
this.schemaName = schemaName;
|
this.schemaName = schemaName;
|
||||||
//C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java:
|
//C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java:
|
||||||
//ORIGINAL LINE: this.buffer = new byte[capacity];
|
//ORIGINAL LINE: this.buffer = new byte[capacity];
|
||||||
this.buffer = new byte[capacity];
|
this.buffer = new byte[capacity];
|
||||||
this.active = this.buffer;
|
this.active = this.buffer;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getLength() {
|
public int getLength() {
|
||||||
return this.active.Length;
|
return this.active.Length;
|
||||||
}
|
}
|
||||||
|
|
||||||
//C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java:
|
//C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java:
|
||||||
//ORIGINAL LINE: public void ReadBuffer(byte[] buffer)
|
//ORIGINAL LINE: public void ReadBuffer(byte[] buffer)
|
||||||
public void ReadBuffer(byte[] buffer) {
|
public void ReadBuffer(byte[] buffer) {
|
||||||
switch (this.schemaName) {
|
switch (this.schemaName) {
|
||||||
case "Hotels":
|
case "Hotels":
|
||||||
ProtobufRowGenerator.ReadBufferHotel(buffer);
|
ProtobufRowGenerator.ReadBufferHotel(buffer);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "Guests":
|
case "Guests":
|
||||||
ProtobufRowGenerator.ReadBufferGuest(buffer);
|
ProtobufRowGenerator.ReadBufferGuest(buffer);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "Available_Rooms_By_Hotel_Date":
|
case "Available_Rooms_By_Hotel_Date":
|
||||||
ProtobufRowGenerator.ReadBufferRoom(buffer);
|
ProtobufRowGenerator.ReadBufferRoom(buffer);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
throw new IllegalStateException(lenientFormat("Unknown schema will be ignored: %s", this.schemaName));
|
throw new IllegalStateException(lenientFormat("Unknown schema will be ignored: %s", this.schemaName));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java:
|
//C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java:
|
||||||
//ORIGINAL LINE: public byte[] ToArray()
|
//ORIGINAL LINE: public byte[] ToArray()
|
||||||
public byte[] ToArray() {
|
public byte[] ToArray() {
|
||||||
return this.active.ToArray();
|
return this.active.ToArray();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void WriteBuffer(HashMap<Utf8String, Object> tableValue) {
|
public void WriteBuffer(HashMap<Utf8String, Object> tableValue) {
|
||||||
switch (this.schemaName) {
|
switch (this.schemaName) {
|
||||||
case "Hotels":
|
case "Hotels":
|
||||||
this.WriteBufferHotel(tableValue);
|
this.WriteBufferHotel(tableValue);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "Guests":
|
case "Guests":
|
||||||
this.WriteBufferGuest(tableValue);
|
this.WriteBufferGuest(tableValue);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "Available_Rooms_By_Hotel_Date":
|
case "Available_Rooms_By_Hotel_Date":
|
||||||
this.WriteBufferRoom(tableValue);
|
this.WriteBufferRoom(tableValue);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
throw new IllegalStateException(lenientFormat("Unknown schema will be ignored: %s", this.schemaName));
|
throw new IllegalStateException(lenientFormat("Unknown schema will be ignored: %s", this.schemaName));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public ProtobufRowGenerator clone() {
|
public ProtobufRowGenerator clone() {
|
||||||
ProtobufRowGenerator varCopy = new ProtobufRowGenerator();
|
ProtobufRowGenerator varCopy = new ProtobufRowGenerator();
|
||||||
|
|
||||||
varCopy.schemaName = this.schemaName;
|
varCopy.schemaName = this.schemaName;
|
||||||
varCopy.buffer = this.buffer;
|
varCopy.buffer = this.buffer;
|
||||||
varCopy.active = this.active;
|
varCopy.active = this.active;
|
||||||
|
|
||||||
return varCopy;
|
return varCopy;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static Address MakeAddress(HashMap<Utf8String, Object> tableValue) {
|
private static Address MakeAddress(HashMap<Utf8String, Object> tableValue) {
|
||||||
Address address = new Address();
|
Address address = new Address();
|
||||||
for ((Utf8String key,Object value) :tableValue)
|
for ((Utf8String key,Object value) :tableValue)
|
||||||
{
|
{
|
||||||
switch (key.toString()) {
|
switch (key.toString()) {
|
||||||
case "street":
|
case "street":
|
||||||
address.setStreet(value == null ? null : ((Utf8String)value).toString());
|
address.setStreet(value == null ? null : ((Utf8String)value).toString());
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "city":
|
case "city":
|
||||||
address.setCity(value == null ? null : ((Utf8String)value).toString());
|
address.setCity(value == null ? null : ((Utf8String)value).toString());
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "state":
|
case "state":
|
||||||
address.setState(value == null ? null : ((Utf8String)value).toString());
|
address.setState(value == null ? null : ((Utf8String)value).toString());
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "postal_code":
|
case "postal_code":
|
||||||
address.setPostalCode(value == null ? null : ProtobufRowGenerator.MakePostalCode((HashMap<Utf8String, Object>)value));
|
address.setPostalCode(value == null ? null : ProtobufRowGenerator.MakePostalCode((HashMap<Utf8String, Object>)value));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
throw new IllegalStateException();
|
throw new IllegalStateException();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return address;
|
return address;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static PostalCode MakePostalCode(HashMap<Utf8String, Object> tableValue) {
|
private static PostalCode MakePostalCode(HashMap<Utf8String, Object> tableValue) {
|
||||||
PostalCode postalCode = new PostalCode();
|
PostalCode postalCode = new PostalCode();
|
||||||
for ((Utf8String key,Object value) :tableValue)
|
for ((Utf8String key,Object value) :tableValue)
|
||||||
{
|
{
|
||||||
switch (key.toString()) {
|
switch (key.toString()) {
|
||||||
case "zip":
|
case "zip":
|
||||||
postalCode.setZip((Integer)value);
|
postalCode.setZip((Integer)value);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "plus4":
|
case "plus4":
|
||||||
postalCode.setPlus4((Short)value);
|
postalCode.setPlus4((Short)value);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
throw new IllegalStateException();
|
throw new IllegalStateException();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return postalCode;
|
return postalCode;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void PopulateStringAddressMap(MapField<String,
|
private static void PopulateStringAddressMap(MapField<String,
|
||||||
Address> field,
|
Address> field,
|
||||||
ArrayList<Object> list) {
|
ArrayList<Object> list) {
|
||||||
for (Object item : list) {
|
for (Object item : list) {
|
||||||
ArrayList<Object> tuple = (ArrayList<Object>)item;
|
ArrayList<Object> tuple = (ArrayList<Object>)item;
|
||||||
String key = ((Utf8String)tuple.get(0)).toString();
|
String key = ((Utf8String)tuple.get(0)).toString();
|
||||||
Address value =
|
Address value =
|
||||||
ProtobufRowGenerator.MakeAddress((HashMap<Utf8String, Object>)tuple.get(1));
|
ProtobufRowGenerator.MakeAddress((HashMap<Utf8String, Object>)tuple.get(1));
|
||||||
field.Add(key, value);
|
field.Add(key, value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void PopulateStringList(RepeatedField<String> field, ArrayList<Object> list) {
|
private static void PopulateStringList(RepeatedField<String> field, ArrayList<Object> list) {
|
||||||
for (Object item : list) {
|
for (Object item : list) {
|
||||||
field.Add(((Utf8String)item).toString());
|
field.Add(((Utf8String)item).toString());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java:
|
//C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java:
|
||||||
//ORIGINAL LINE: private static void ReadBufferGuest(byte[] buffer)
|
//ORIGINAL LINE: private static void ReadBufferGuest(byte[] buffer)
|
||||||
private static void ReadBufferGuest(byte[] buffer) {
|
private static void ReadBufferGuest(byte[] buffer) {
|
||||||
Guests item =
|
Guests item =
|
||||||
new Guests();
|
new Guests();
|
||||||
item.MergeFrom(buffer);
|
item.MergeFrom(buffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
//C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java:
|
//C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java:
|
||||||
//ORIGINAL LINE: private static void ReadBufferHotel(byte[] buffer)
|
//ORIGINAL LINE: private static void ReadBufferHotel(byte[] buffer)
|
||||||
private static void ReadBufferHotel(byte[] buffer) {
|
private static void ReadBufferHotel(byte[] buffer) {
|
||||||
Hotels item =
|
Hotels item =
|
||||||
new Hotels();
|
new Hotels();
|
||||||
item.MergeFrom(buffer);
|
item.MergeFrom(buffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
//C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java:
|
//C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java:
|
||||||
//ORIGINAL LINE: private static void ReadBufferRoom(byte[] buffer)
|
//ORIGINAL LINE: private static void ReadBufferRoom(byte[] buffer)
|
||||||
private static void ReadBufferRoom(byte[] buffer) {
|
private static void ReadBufferRoom(byte[] buffer) {
|
||||||
Available_Rooms_By_Hotel_Date item = new azure.data.cosmos.serialization.hybridrow.perf.CassandraHotel.Protobuf.Available_Rooms_By_Hotel_Date();
|
Available_Rooms_By_Hotel_Date item = new azure.data.cosmos.serialization.hybridrow.perf.CassandraHotel.Protobuf.Available_Rooms_By_Hotel_Date();
|
||||||
item.MergeFrom(buffer);
|
item.MergeFrom(buffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void WriteBufferGuest(HashMap<Utf8String, Object> tableValue) {
|
private void WriteBufferGuest(HashMap<Utf8String, Object> tableValue) {
|
||||||
azure.data.cosmos.serialization.hybridrow.perf.CassandraHotel.Protobuf.Guests room =
|
azure.data.cosmos.serialization.hybridrow.perf.CassandraHotel.Protobuf.Guests room =
|
||||||
new azure.data.cosmos.serialization.hybridrow.perf.CassandraHotel.Protobuf.Guests();
|
new azure.data.cosmos.serialization.hybridrow.perf.CassandraHotel.Protobuf.Guests();
|
||||||
try (CodedOutputStream stm = new CodedOutputStream(this.buffer)) {
|
try (CodedOutputStream stm = new CodedOutputStream(this.buffer)) {
|
||||||
for ((Utf8String key,Object value) :tableValue)
|
for ((Utf8String key,Object value) :tableValue)
|
||||||
{
|
{
|
||||||
switch (key.toString()) {
|
switch (key.toString()) {
|
||||||
case "guest_id":
|
case "guest_id":
|
||||||
room.setGuestId(value == null ? null : ((UUID)value).toString());
|
room.setGuestId(value == null ? null : ((UUID)value).toString());
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "first_name":
|
case "first_name":
|
||||||
room.setFirstName(value == null ? null : ((Utf8String)value).toString());
|
room.setFirstName(value == null ? null : ((Utf8String)value).toString());
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "last_name":
|
case "last_name":
|
||||||
room.setLastName(value == null ? null : ((Utf8String)value).toString());
|
room.setLastName(value == null ? null : ((Utf8String)value).toString());
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "title":
|
case "title":
|
||||||
room.setTitle(value == null ? null : ((Utf8String)value).toString());
|
room.setTitle(value == null ? null : ((Utf8String)value).toString());
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "emails":
|
case "emails":
|
||||||
if (value != null) {
|
if (value != null) {
|
||||||
ProtobufRowGenerator.PopulateStringList(room.getEmails(), (ArrayList<Object>)value);
|
ProtobufRowGenerator.PopulateStringList(room.getEmails(), (ArrayList<Object>)value);
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "phone_numbers":
|
case "phone_numbers":
|
||||||
if (value != null) {
|
if (value != null) {
|
||||||
ProtobufRowGenerator.PopulateStringList(room.getPhoneNumbers(), (ArrayList<Object>)value);
|
ProtobufRowGenerator.PopulateStringList(room.getPhoneNumbers(), (ArrayList<Object>)value);
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "addresses":
|
case "addresses":
|
||||||
if (value != null) {
|
if (value != null) {
|
||||||
ProtobufRowGenerator.PopulateStringAddressMap(room.getAddresses(),
|
ProtobufRowGenerator.PopulateStringAddressMap(room.getAddresses(),
|
||||||
(ArrayList<Object>)value);
|
(ArrayList<Object>)value);
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "confirm_number":
|
case "confirm_number":
|
||||||
room.setConfirmNumber(value == null ? null : ((Utf8String)value).toString());
|
room.setConfirmNumber(value == null ? null : ((Utf8String)value).toString());
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
Assert.Fail("should never happen");
|
Assert.Fail("should never happen");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
room.WriteTo(stm);
|
room.WriteTo(stm);
|
||||||
stm.Flush();
|
stm.Flush();
|
||||||
this.active = this.buffer.AsSpan(0, (int)stm.Position);
|
this.active = this.buffer.AsSpan(0, (int)stm.Position);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void WriteBufferHotel(HashMap<Utf8String, Object> tableValue) {
|
private void WriteBufferHotel(HashMap<Utf8String, Object> tableValue) {
|
||||||
azure.data.cosmos.serialization.hybridrow.perf.CassandraHotel.Protobuf.Hotels room =
|
azure.data.cosmos.serialization.hybridrow.perf.CassandraHotel.Protobuf.Hotels room =
|
||||||
new azure.data.cosmos.serialization.hybridrow.perf.CassandraHotel.Protobuf.Hotels();
|
new azure.data.cosmos.serialization.hybridrow.perf.CassandraHotel.Protobuf.Hotels();
|
||||||
try (CodedOutputStream stm = new CodedOutputStream(this.buffer)) {
|
try (CodedOutputStream stm = new CodedOutputStream(this.buffer)) {
|
||||||
for ((Utf8String key,Object value) :tableValue)
|
for ((Utf8String key,Object value) :tableValue)
|
||||||
{
|
{
|
||||||
switch (key.toString()) {
|
switch (key.toString()) {
|
||||||
case "hotel_id":
|
case "hotel_id":
|
||||||
room.setHotelId(value == null ? null : ((Utf8String)value).toString());
|
room.setHotelId(value == null ? null : ((Utf8String)value).toString());
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "name":
|
case "name":
|
||||||
room.setName(value == null ? null : ((Utf8String)value).toString());
|
room.setName(value == null ? null : ((Utf8String)value).toString());
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "phone":
|
case "phone":
|
||||||
room.setPhone(value == null ? null : ((Utf8String)value).toString());
|
room.setPhone(value == null ? null : ((Utf8String)value).toString());
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "address":
|
case "address":
|
||||||
room.setAddress(value == null ? null : ProtobufRowGenerator.MakeAddress((HashMap<Utf8String,
|
room.setAddress(value == null ? null : ProtobufRowGenerator.MakeAddress((HashMap<Utf8String,
|
||||||
Object>)value));
|
Object>)value));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
Assert.Fail("should never happen");
|
Assert.Fail("should never happen");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
room.WriteTo(stm);
|
room.WriteTo(stm);
|
||||||
stm.Flush();
|
stm.Flush();
|
||||||
this.active = this.buffer.AsSpan(0, (int)stm.Position);
|
this.active = this.buffer.AsSpan(0, (int)stm.Position);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void WriteBufferRoom(HashMap<Utf8String, Object> tableValue) {
|
private void WriteBufferRoom(HashMap<Utf8String, Object> tableValue) {
|
||||||
azure.data.cosmos.serialization.hybridrow.perf.CassandraHotel.Protobuf.Available_Rooms_By_Hotel_Date room = new azure.data.cosmos.serialization.hybridrow.perf.CassandraHotel.Protobuf.Available_Rooms_By_Hotel_Date();
|
azure.data.cosmos.serialization.hybridrow.perf.CassandraHotel.Protobuf.Available_Rooms_By_Hotel_Date room = new azure.data.cosmos.serialization.hybridrow.perf.CassandraHotel.Protobuf.Available_Rooms_By_Hotel_Date();
|
||||||
try (CodedOutputStream stm = new CodedOutputStream(this.buffer)) {
|
try (CodedOutputStream stm = new CodedOutputStream(this.buffer)) {
|
||||||
for ((Utf8String key,Object value) :tableValue)
|
for ((Utf8String key,Object value) :tableValue)
|
||||||
{
|
{
|
||||||
switch (key.toString()) {
|
switch (key.toString()) {
|
||||||
case "hotel_id":
|
case "hotel_id":
|
||||||
room.setHotelId(value == null ? null : ((Utf8String)value).toString());
|
room.setHotelId(value == null ? null : ((Utf8String)value).toString());
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "date":
|
case "date":
|
||||||
room.setDate(value == null ? null : ((LocalDateTime)value).getTime());
|
room.setDate(value == null ? null : ((LocalDateTime)value).getTime());
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "room_number":
|
case "room_number":
|
||||||
//C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java:
|
//C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java:
|
||||||
//ORIGINAL LINE: room.RoomNumber = (Nullable<byte>)value;
|
//ORIGINAL LINE: room.RoomNumber = (Nullable<byte>)value;
|
||||||
room.setRoomNumber((Byte)value);
|
room.setRoomNumber((Byte)value);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "is_available":
|
case "is_available":
|
||||||
room.setIsAvailable((Boolean)value);
|
room.setIsAvailable((Boolean)value);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
Assert.Fail("should never happen");
|
Assert.Fail("should never happen");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
room.WriteTo(stm);
|
room.WriteTo(stm);
|
||||||
stm.Flush();
|
stm.Flush();
|
||||||
this.active = this.buffer.AsSpan(0, (int)stm.Position);
|
this.active = this.buffer.AsSpan(0, (int)stm.Position);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+316
-316
@@ -1,317 +1,317 @@
|
|||||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||||
// Licensed under the MIT License.
|
// Licensed under the MIT License.
|
||||||
|
|
||||||
package com.azure.data.cosmos.serialization.hybridrow.perf;
|
package com.azure.data.cosmos.serialization.hybridrow.perf;
|
||||||
|
|
||||||
import com.azure.data.cosmos.core.Out;
|
import com.azure.data.cosmos.core.Out;
|
||||||
import com.azure.data.cosmos.core.Reference;
|
import com.azure.data.cosmos.core.Reference;
|
||||||
import com.azure.data.cosmos.serialization.hybridrow.HybridRowVersion;
|
import com.azure.data.cosmos.serialization.hybridrow.HybridRowVersion;
|
||||||
import com.azure.data.cosmos.serialization.hybridrow.MemorySpanResizer;
|
import com.azure.data.cosmos.serialization.hybridrow.MemorySpanResizer;
|
||||||
import com.azure.data.cosmos.serialization.hybridrow.Result;
|
import com.azure.data.cosmos.serialization.hybridrow.Result;
|
||||||
import com.azure.data.cosmos.serialization.hybridrow.RowBuffer;
|
import com.azure.data.cosmos.serialization.hybridrow.RowBuffer;
|
||||||
import com.azure.data.cosmos.serialization.hybridrow.recordio.RecordIOStream;
|
import com.azure.data.cosmos.serialization.hybridrow.recordio.RecordIOStream;
|
||||||
import com.azure.data.cosmos.serialization.hybridrow.io.Segment;
|
import com.azure.data.cosmos.serialization.hybridrow.io.Segment;
|
||||||
|
|
||||||
import java.io.Closeable;
|
import java.io.Closeable;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
||||||
// TODO: C# TO JAVA CONVERTER: Java annotations will not correspond to .NET attributes:
|
// TODO: C# TO JAVA CONVERTER: Java annotations will not correspond to .NET attributes:
|
||||||
//ORIGINAL LINE: [TestClass][SuppressMessage("Microsoft.Reliability", "CA2001:Avoid calling problematic methods",
|
//ORIGINAL LINE: [TestClass][SuppressMessage("Microsoft.Reliability", "CA2001:Avoid calling problematic methods",
|
||||||
// Justification = "Perf Benchmark")][DeploymentItem("TestData\\*.hr", "TestData")] public sealed class ReaderBenchmark
|
// Justification = "Perf Benchmark")][DeploymentItem("TestData\\*.hr", "TestData")] public sealed class ReaderBenchmark
|
||||||
public final class ReaderBenchmark {
|
public final class ReaderBenchmark {
|
||||||
private static final String CombinedScriptsData = "TestData\\CombinedScriptsData.hr";
|
private static final String CombinedScriptsData = "TestData\\CombinedScriptsData.hr";
|
||||||
private static final int InitialCapacity = 2 * 1024 * 1024;
|
private static final int InitialCapacity = 2 * 1024 * 1024;
|
||||||
private static final int MeasureCount = 10;
|
private static final int MeasureCount = 10;
|
||||||
private static final int WarmCount = 5;
|
private static final int WarmCount = 5;
|
||||||
|
|
||||||
// TODO: C# TO JAVA CONVERTER: Java annotations will not correspond to .NET attributes:
|
// TODO: C# TO JAVA CONVERTER: Java annotations will not correspond to .NET attributes:
|
||||||
//ORIGINAL LINE: [TestMethod][Owner("jthunter")][Ignore] public async Task AllAsync()
|
//ORIGINAL LINE: [TestMethod][Owner("jthunter")][Ignore] public async Task AllAsync()
|
||||||
// TODO: C# TO JAVA CONVERTER: There is no equivalent in Java to the 'async' keyword:
|
// TODO: C# TO JAVA CONVERTER: There is no equivalent in Java to the 'async' keyword:
|
||||||
//ORIGINAL LINE: [TestMethod][Owner("jthunter")][Ignore] public async Task AllAsync()
|
//ORIGINAL LINE: [TestMethod][Owner("jthunter")][Ignore] public async Task AllAsync()
|
||||||
public Task AllAsync() {
|
public Task AllAsync() {
|
||||||
final String dir = "E:\\TestData\\HybridRow";
|
final String dir = "E:\\TestData\\HybridRow";
|
||||||
for (File childFile : (new File(dir)).EnumerateFiles("*.hr")) {
|
for (File childFile : (new File(dir)).EnumerateFiles("*.hr")) {
|
||||||
try (BenchmarkContext context = new BenchmarkContext(childFile.getPath(), false, false)) {
|
try (BenchmarkContext context = new BenchmarkContext(childFile.getPath(), false, false)) {
|
||||||
// TODO: C# TO JAVA CONVERTER: There is no equivalent to 'await' in Java:
|
// TODO: C# TO JAVA CONVERTER: There is no equivalent to 'await' in Java:
|
||||||
await ReaderBenchmark.
|
await ReaderBenchmark.
|
||||||
BenchmarkAsync(context, (object arg) -> ReaderBenchmark.RowReaderBenchmarkAsync(arg));
|
BenchmarkAsync(context, (object arg) -> ReaderBenchmark.RowReaderBenchmarkAsync(arg));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: C# TO JAVA CONVERTER: Java annotations will not correspond to .NET attributes:
|
// TODO: C# TO JAVA CONVERTER: Java annotations will not correspond to .NET attributes:
|
||||||
//ORIGINAL LINE: [TestMethod][Owner("jthunter")][DeploymentItem(ReaderBenchmark.CombinedScriptsData, "TestData")]
|
//ORIGINAL LINE: [TestMethod][Owner("jthunter")][DeploymentItem(ReaderBenchmark.CombinedScriptsData, "TestData")]
|
||||||
// public async Task RowReaderAsync()
|
// public async Task RowReaderAsync()
|
||||||
// TODO: C# TO JAVA CONVERTER: There is no equivalent in Java to the 'async' keyword:
|
// TODO: C# TO JAVA CONVERTER: There is no equivalent in Java to the 'async' keyword:
|
||||||
//ORIGINAL LINE: [TestMethod][Owner("jthunter")][DeploymentItem(ReaderBenchmark.CombinedScriptsData, "TestData")]
|
//ORIGINAL LINE: [TestMethod][Owner("jthunter")][DeploymentItem(ReaderBenchmark.CombinedScriptsData, "TestData")]
|
||||||
// public async Task RowReaderAsync()
|
// public async Task RowReaderAsync()
|
||||||
public Task RowReaderAsync() {
|
public Task RowReaderAsync() {
|
||||||
try (BenchmarkContext context = new BenchmarkContext(ReaderBenchmark.CombinedScriptsData, true, true)) {
|
try (BenchmarkContext context = new BenchmarkContext(ReaderBenchmark.CombinedScriptsData, true, true)) {
|
||||||
// TODO: C# TO JAVA CONVERTER: There is no equivalent to 'await' in Java:
|
// TODO: C# TO JAVA CONVERTER: There is no equivalent to 'await' in Java:
|
||||||
await ReaderBenchmark.BenchmarkAsync(context, (object arg) -> ReaderBenchmark.RowReaderBenchmarkAsync(arg));
|
await ReaderBenchmark.BenchmarkAsync(context, (object arg) -> ReaderBenchmark.RowReaderBenchmarkAsync(arg));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: C# TO JAVA CONVERTER: Java annotations will not correspond to .NET attributes:
|
// TODO: C# TO JAVA CONVERTER: Java annotations will not correspond to .NET attributes:
|
||||||
//ORIGINAL LINE: [TestMethod][Owner("jthunter")][Ignore] public async Task SpecificFileAsync()
|
//ORIGINAL LINE: [TestMethod][Owner("jthunter")][Ignore] public async Task SpecificFileAsync()
|
||||||
// TODO: C# TO JAVA CONVERTER: There is no equivalent in Java to the 'async' keyword:
|
// TODO: C# TO JAVA CONVERTER: There is no equivalent in Java to the 'async' keyword:
|
||||||
//ORIGINAL LINE: [TestMethod][Owner("jthunter")][Ignore] public async Task SpecificFileAsync()
|
//ORIGINAL LINE: [TestMethod][Owner("jthunter")][Ignore] public async Task SpecificFileAsync()
|
||||||
public Task SpecificFileAsync() {
|
public Task SpecificFileAsync() {
|
||||||
final String filename = "E:\\TestData\\HybridRow\\Lastfm.hr";
|
final String filename = "E:\\TestData\\HybridRow\\Lastfm.hr";
|
||||||
try (BenchmarkContext context = new BenchmarkContext(filename, true, true)) {
|
try (BenchmarkContext context = new BenchmarkContext(filename, true, true)) {
|
||||||
// TODO: C# TO JAVA CONVERTER: There is no equivalent to 'await' in Java:
|
// TODO: C# TO JAVA CONVERTER: There is no equivalent to 'await' in Java:
|
||||||
await ReaderBenchmark.BenchmarkAsync(context, (object arg) -> ReaderBenchmark.RowReaderBenchmarkAsync(arg));
|
await ReaderBenchmark.BenchmarkAsync(context, (object arg) -> ReaderBenchmark.RowReaderBenchmarkAsync(arg));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: C# TO JAVA CONVERTER: Java annotations will not correspond to .NET attributes:
|
// TODO: C# TO JAVA CONVERTER: Java annotations will not correspond to .NET attributes:
|
||||||
//ORIGINAL LINE: [SuppressMessage("Microsoft.Reliability", "CA2001:Avoid calling problematic methods",
|
//ORIGINAL LINE: [SuppressMessage("Microsoft.Reliability", "CA2001:Avoid calling problematic methods",
|
||||||
// Justification = "Perf Benchmark")] private static async Task BenchmarkAsync(BenchmarkContext context,
|
// Justification = "Perf Benchmark")] private static async Task BenchmarkAsync(BenchmarkContext context,
|
||||||
// Func<object, Task> body)
|
// Func<object, Task> body)
|
||||||
// TODO: C# TO JAVA CONVERTER: There is no equivalent in Java to the 'async' keyword:
|
// TODO: C# TO JAVA CONVERTER: There is no equivalent in Java to the 'async' keyword:
|
||||||
//ORIGINAL LINE: [SuppressMessage("Microsoft.Reliability", "CA2001:Avoid calling problematic methods",
|
//ORIGINAL LINE: [SuppressMessage("Microsoft.Reliability", "CA2001:Avoid calling problematic methods",
|
||||||
// Justification = "Perf Benchmark")] private static async Task BenchmarkAsync(BenchmarkContext context,
|
// Justification = "Perf Benchmark")] private static async Task BenchmarkAsync(BenchmarkContext context,
|
||||||
// Func<object, Task> body)
|
// Func<object, Task> body)
|
||||||
private static Task BenchmarkAsync(BenchmarkContext context, tangible.Func1Param<Object, Task> body) {
|
private static Task BenchmarkAsync(BenchmarkContext context, tangible.Func1Param<Object, Task> body) {
|
||||||
try (SingleThreadedTaskScheduler scheduler = new SingleThreadedTaskScheduler()) {
|
try (SingleThreadedTaskScheduler scheduler = new SingleThreadedTaskScheduler()) {
|
||||||
// Warm
|
// Warm
|
||||||
System.Diagnostics.Stopwatch sw = new System.Diagnostics.Stopwatch();
|
System.Diagnostics.Stopwatch sw = new System.Diagnostics.Stopwatch();
|
||||||
for (int i = 0; i < ReaderBenchmark.WarmCount; i++) {
|
for (int i = 0; i < ReaderBenchmark.WarmCount; i++) {
|
||||||
context.Reset();
|
context.Reset();
|
||||||
sw.Restart();
|
sw.Restart();
|
||||||
// TODO: C# TO JAVA CONVERTER: There is no equivalent to 'await' in Java:
|
// TODO: C# TO JAVA CONVERTER: There is no equivalent to 'await' in Java:
|
||||||
await Task.
|
await Task.
|
||||||
Factory.StartNew(body, context, CancellationToken.None, TaskCreationOptions.None, scheduler).Unwrap();
|
Factory.StartNew(body, context, CancellationToken.None, TaskCreationOptions.None, scheduler).Unwrap();
|
||||||
sw.Stop();
|
sw.Stop();
|
||||||
if (context.getShowWarmSummary()) {
|
if (context.getShowWarmSummary()) {
|
||||||
context.Summarize(sw.Elapsed);
|
context.Summarize(sw.Elapsed);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Execute
|
// Execute
|
||||||
double[] timing = new double[ReaderBenchmark.MeasureCount];
|
double[] timing = new double[ReaderBenchmark.MeasureCount];
|
||||||
for (int i = 0; i < ReaderBenchmark.MeasureCount; i++) {
|
for (int i = 0; i < ReaderBenchmark.MeasureCount; i++) {
|
||||||
System.gc();
|
System.gc();
|
||||||
System.runFinalization();
|
System.runFinalization();
|
||||||
context.Reset();
|
context.Reset();
|
||||||
sw.Restart();
|
sw.Restart();
|
||||||
// TODO: C# TO JAVA CONVERTER: There is no equivalent to 'await' in Java:
|
// TODO: C# TO JAVA CONVERTER: There is no equivalent to 'await' in Java:
|
||||||
await Task.
|
await Task.
|
||||||
Factory.StartNew(body, context, CancellationToken.None, TaskCreationOptions.None, scheduler).Unwrap();
|
Factory.StartNew(body, context, CancellationToken.None, TaskCreationOptions.None, scheduler).Unwrap();
|
||||||
sw.Stop();
|
sw.Stop();
|
||||||
if (context.getShowSummary()) {
|
if (context.getShowSummary()) {
|
||||||
context.Summarize(sw.Elapsed);
|
context.Summarize(sw.Elapsed);
|
||||||
}
|
}
|
||||||
|
|
||||||
timing[i] = sw.Elapsed.TotalMilliseconds;
|
timing[i] = sw.Elapsed.TotalMilliseconds;
|
||||||
}
|
}
|
||||||
|
|
||||||
Arrays.sort(timing);
|
Arrays.sort(timing);
|
||||||
System.out.println(String.format("File: %1$s, Mean: %1.4f",
|
System.out.println(String.format("File: %1$s, Mean: %1.4f",
|
||||||
Path.GetFileNameWithoutExtension(context.getInputFile()), timing[ReaderBenchmark.MeasureCount / 2]));
|
Path.GetFileNameWithoutExtension(context.getInputFile()), timing[ReaderBenchmark.MeasureCount / 2]));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: C# TO JAVA CONVERTER: There is no equivalent in Java to the 'async' keyword:
|
// TODO: C# TO JAVA CONVERTER: There is no equivalent in Java to the 'async' keyword:
|
||||||
//ORIGINAL LINE: private static async Task RowReaderBenchmarkAsync(object ctx)
|
//ORIGINAL LINE: private static async Task RowReaderBenchmarkAsync(object ctx)
|
||||||
private static Task RowReaderBenchmarkAsync(Object ctx) {
|
private static Task RowReaderBenchmarkAsync(Object ctx) {
|
||||||
BenchmarkContext context = (BenchmarkContext)ctx;
|
BenchmarkContext context = (BenchmarkContext)ctx;
|
||||||
//C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java:
|
//C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java:
|
||||||
//ORIGINAL LINE: MemorySpanResizer<byte> resizer = new MemorySpanResizer<byte>(ReaderBenchmark.InitialCapacity);
|
//ORIGINAL LINE: MemorySpanResizer<byte> resizer = new MemorySpanResizer<byte>(ReaderBenchmark.InitialCapacity);
|
||||||
MemorySpanResizer<Byte> resizer = new MemorySpanResizer<Byte>(ReaderBenchmark.InitialCapacity);
|
MemorySpanResizer<Byte> resizer = new MemorySpanResizer<Byte>(ReaderBenchmark.InitialCapacity);
|
||||||
// TODO: C# TO JAVA CONVERTER: There is no equivalent to 'await' in Java:
|
// TODO: C# TO JAVA CONVERTER: There is no equivalent to 'await' in Java:
|
||||||
Result r = await
|
Result r = await
|
||||||
RecordIOStream.ReadRecordIOAsync(context.getInput(),
|
RecordIOStream.ReadRecordIOAsync(context.getInput(),
|
||||||
record ->
|
record ->
|
||||||
{
|
{
|
||||||
context.IncrementRecordCount();
|
context.IncrementRecordCount();
|
||||||
r = ReaderBenchmark.VisitOneRow(record, context.getResolver());
|
r = ReaderBenchmark.VisitOneRow(record, context.getResolver());
|
||||||
assert Result.SUCCESS == r;
|
assert Result.SUCCESS == r;
|
||||||
return Result.SUCCESS;
|
return Result.SUCCESS;
|
||||||
}, segment ->
|
}, segment ->
|
||||||
{
|
{
|
||||||
Segment _;
|
Segment _;
|
||||||
Out<Segment> tempOut__ =
|
Out<Segment> tempOut__ =
|
||||||
new Out<Segment>();
|
new Out<Segment>();
|
||||||
r = SegmentSerializer.Read(segment.Span, context.getResolver(), tempOut__);
|
r = SegmentSerializer.Read(segment.Span, context.getResolver(), tempOut__);
|
||||||
_ = tempOut__.get();
|
_ = tempOut__.get();
|
||||||
assert Result.SUCCESS == r;
|
assert Result.SUCCESS == r;
|
||||||
|
|
||||||
// TODO: do something with embedded schema.
|
// TODO: do something with embedded schema.
|
||||||
return Result.SUCCESS;
|
return Result.SUCCESS;
|
||||||
}, resizer);
|
}, resizer);
|
||||||
|
|
||||||
assert Result.SUCCESS == r;
|
assert Result.SUCCESS == r;
|
||||||
}
|
}
|
||||||
|
|
||||||
//C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java:
|
//C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java:
|
||||||
//ORIGINAL LINE: private static Result VisitOneRow(Memory<byte> buffer, LayoutResolver resolver)
|
//ORIGINAL LINE: private static Result VisitOneRow(Memory<byte> buffer, LayoutResolver resolver)
|
||||||
private static Result VisitOneRow(Memory<Byte> buffer, LayoutResolver resolver) {
|
private static Result VisitOneRow(Memory<Byte> buffer, LayoutResolver resolver) {
|
||||||
RowBuffer row = new RowBuffer(buffer.Span, HybridRowVersion.V1, resolver);
|
RowBuffer row = new RowBuffer(buffer.Span, HybridRowVersion.V1, resolver);
|
||||||
Reference<RowBuffer> tempReference_row =
|
Reference<RowBuffer> tempReference_row =
|
||||||
new Reference<RowBuffer>(row);
|
new Reference<RowBuffer>(row);
|
||||||
RowReader reader = new RowReader(tempReference_row);
|
RowReader reader = new RowReader(tempReference_row);
|
||||||
row = tempReference_row.get();
|
row = tempReference_row.get();
|
||||||
return RowReaderExtensions.VisitReader(reader.clone());
|
return RowReaderExtensions.VisitReader(reader.clone());
|
||||||
}
|
}
|
||||||
|
|
||||||
private final static class BenchmarkContext implements Closeable {
|
private final static class BenchmarkContext implements Closeable {
|
||||||
// TODO: C# TO JAVA CONVERTER: C# to Java Converter cannot determine whether this System.IO.Stream is
|
// TODO: C# TO JAVA CONVERTER: C# to Java Converter cannot determine whether this System.IO.Stream is
|
||||||
// input or output:
|
// input or output:
|
||||||
private Stream input;
|
private Stream input;
|
||||||
private String inputFile;
|
private String inputFile;
|
||||||
private long recordCount;
|
private long recordCount;
|
||||||
private LayoutResolver resolver;
|
private LayoutResolver resolver;
|
||||||
private boolean showSummary;
|
private boolean showSummary;
|
||||||
private boolean showWarmSummary;
|
private boolean showWarmSummary;
|
||||||
|
|
||||||
|
|
||||||
public BenchmarkContext(String inputFile, boolean showSummary) {
|
public BenchmarkContext(String inputFile, boolean showSummary) {
|
||||||
this(inputFile, showSummary, false);
|
this(inputFile, showSummary, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
public BenchmarkContext(String inputFile) {
|
public BenchmarkContext(String inputFile) {
|
||||||
this(inputFile, true, false);
|
this(inputFile, true, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
//C# TO JAVA CONVERTER NOTE: Java does not support optional parameters. Overloaded method(s) are created above:
|
//C# TO JAVA CONVERTER NOTE: Java does not support optional parameters. Overloaded method(s) are created above:
|
||||||
//ORIGINAL LINE: public BenchmarkContext(string inputFile, bool showSummary = true, bool showWarmSummary =
|
//ORIGINAL LINE: public BenchmarkContext(string inputFile, bool showSummary = true, bool showWarmSummary =
|
||||||
// false)
|
// false)
|
||||||
public BenchmarkContext(String inputFile, boolean showSummary, boolean showWarmSummary) {
|
public BenchmarkContext(String inputFile, boolean showSummary, boolean showWarmSummary) {
|
||||||
this.inputFile = inputFile;
|
this.inputFile = inputFile;
|
||||||
this.showSummary = showSummary;
|
this.showSummary = showSummary;
|
||||||
this.showWarmSummary = showWarmSummary;
|
this.showWarmSummary = showWarmSummary;
|
||||||
// TODO: C# TO JAVA CONVERTER: C# to Java Converter cannot determine whether this System.IO.FileStream
|
// TODO: C# TO JAVA CONVERTER: C# to Java Converter cannot determine whether this System.IO.FileStream
|
||||||
// is input or output:
|
// is input or output:
|
||||||
this.input = new FileStream(inputFile, FileMode.Open);
|
this.input = new FileStream(inputFile, FileMode.Open);
|
||||||
this.resolver = SystemSchema.LayoutResolver;
|
this.resolver = SystemSchema.LayoutResolver;
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: C# TO JAVA CONVERTER: C# to Java Converter cannot determine whether this System.IO.Stream is
|
// TODO: C# TO JAVA CONVERTER: C# to Java Converter cannot determine whether this System.IO.Stream is
|
||||||
// input or output:
|
// input or output:
|
||||||
public Stream getInput() {
|
public Stream getInput() {
|
||||||
return this.input;
|
return this.input;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getInputFile() {
|
public String getInputFile() {
|
||||||
return this.inputFile;
|
return this.inputFile;
|
||||||
}
|
}
|
||||||
|
|
||||||
public LayoutResolver getResolver() {
|
public LayoutResolver getResolver() {
|
||||||
return this.resolver;
|
return this.resolver;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean getShowSummary() {
|
public boolean getShowSummary() {
|
||||||
return this.showSummary;
|
return this.showSummary;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean getShowWarmSummary() {
|
public boolean getShowWarmSummary() {
|
||||||
return this.showWarmSummary;
|
return this.showWarmSummary;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void IncrementRecordCount() {
|
public void IncrementRecordCount() {
|
||||||
this.recordCount++;
|
this.recordCount++;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Reset() {
|
public void Reset() {
|
||||||
this.recordCount = 0;
|
this.recordCount = 0;
|
||||||
this.input.Seek(0, SeekOrigin.Begin);
|
this.input.Seek(0, SeekOrigin.Begin);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Summarize(TimeSpan duration) {
|
public void Summarize(TimeSpan duration) {
|
||||||
System.out.print(String.format("Total Time: %0.4f, ", duration.TotalMilliseconds));
|
System.out.print(String.format("Total Time: %0.4f, ", duration.TotalMilliseconds));
|
||||||
System.out.println(String.format("Record Count: %1$s", this.recordCount));
|
System.out.println(String.format("Record Count: %1$s", this.recordCount));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void close() throws IOException {
|
public void close() throws IOException {
|
||||||
this.input.Dispose();
|
this.input.Dispose();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private final static class SingleThreadedTaskScheduler extends TaskScheduler implements Closeable {
|
private final static class SingleThreadedTaskScheduler extends TaskScheduler implements Closeable {
|
||||||
private CancellationTokenSource cancel;
|
private CancellationTokenSource cancel;
|
||||||
private EventWaitHandle ready;
|
private EventWaitHandle ready;
|
||||||
private ConcurrentQueue<Task> tasks;
|
private ConcurrentQueue<Task> tasks;
|
||||||
private Thread worker;
|
private Thread worker;
|
||||||
|
|
||||||
// Creates a new instance with the specified degree of parallelism.
|
// Creates a new instance with the specified degree of parallelism.
|
||||||
public SingleThreadedTaskScheduler() {
|
public SingleThreadedTaskScheduler() {
|
||||||
this.tasks = new ConcurrentQueue<Task>();
|
this.tasks = new ConcurrentQueue<Task>();
|
||||||
this.ready = new ManualResetEvent(false);
|
this.ready = new ManualResetEvent(false);
|
||||||
this.worker = new Thread() {
|
this.worker = new Thread() {
|
||||||
void run() {
|
void run() {
|
||||||
this.DoWork();
|
this.DoWork();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
this.cancel = new CancellationTokenSource();
|
this.cancel = new CancellationTokenSource();
|
||||||
this.worker.start();
|
this.worker.start();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Gets the maximum concurrency level supported by this scheduler.
|
// Gets the maximum concurrency level supported by this scheduler.
|
||||||
@Override
|
@Override
|
||||||
public int getMaximumConcurrencyLevel() {
|
public int getMaximumConcurrencyLevel() {
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void close() throws IOException {
|
public void close() throws IOException {
|
||||||
if (!this.cancel.IsCancellationRequested) {
|
if (!this.cancel.IsCancellationRequested) {
|
||||||
this.cancel.Cancel();
|
this.cancel.Cancel();
|
||||||
this.worker.join();
|
this.worker.join();
|
||||||
this.ready == null ? null : this.ready.Dispose();
|
this.ready == null ? null : this.ready.Dispose();
|
||||||
this.cancel == null ? null : this.cancel.Dispose();
|
this.cancel == null ? null : this.cancel.Dispose();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected java.lang.Iterable<Task> GetScheduledTasks() {
|
protected java.lang.Iterable<Task> GetScheduledTasks() {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Queues a task to the scheduler.
|
// Queues a task to the scheduler.
|
||||||
@Override
|
@Override
|
||||||
protected void QueueTask(Task task) {
|
protected void QueueTask(Task task) {
|
||||||
synchronized (this.tasks) {
|
synchronized (this.tasks) {
|
||||||
this.tasks.Enqueue(task);
|
this.tasks.Enqueue(task);
|
||||||
if (Thread.currentThread() != this.worker) {
|
if (Thread.currentThread() != this.worker) {
|
||||||
this.ready.Set();
|
this.ready.Set();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected boolean TryDequeue(Task task) {
|
protected boolean TryDequeue(Task task) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Attempts to execute the specified task on the current thread.
|
// Attempts to execute the specified task on the current thread.
|
||||||
@Override
|
@Override
|
||||||
protected boolean TryExecuteTaskInline(Task task, boolean taskWasPreviouslyQueued) {
|
protected boolean TryExecuteTaskInline(Task task, boolean taskWasPreviouslyQueued) {
|
||||||
// If this thread isn't already processing a task, we don't support inlining
|
// If this thread isn't already processing a task, we don't support inlining
|
||||||
if (Thread.currentThread() != this.worker) {
|
if (Thread.currentThread() != this.worker) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// If the task was previously queued, then skip it.
|
// If the task was previously queued, then skip it.
|
||||||
if (taskWasPreviouslyQueued) {
|
if (taskWasPreviouslyQueued) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return this.TryExecuteTask(task);
|
return this.TryExecuteTask(task);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void DoWork() {
|
private void DoWork() {
|
||||||
while (!this.cancel.IsCancellationRequested) {
|
while (!this.cancel.IsCancellationRequested) {
|
||||||
Task item;
|
Task item;
|
||||||
Out<Task> tempOut_item = new Out<Task>();
|
Out<Task> tempOut_item = new Out<Task>();
|
||||||
if (this.tasks.TryDequeue(tempOut_item)) {
|
if (this.tasks.TryDequeue(tempOut_item)) {
|
||||||
item = tempOut_item.get();
|
item = tempOut_item.get();
|
||||||
this.TryExecuteTask(item);
|
this.TryExecuteTask(item);
|
||||||
} else {
|
} else {
|
||||||
item = tempOut_item.get();
|
item = tempOut_item.get();
|
||||||
this.ready.WaitOne(TimeSpan.FromSeconds(1));
|
this.ready.WaitOne(TimeSpan.FromSeconds(1));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+87
-87
@@ -1,88 +1,88 @@
|
|||||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||||
// Licensed under the MIT License.
|
// Licensed under the MIT License.
|
||||||
|
|
||||||
package com.azure.data.cosmos.serialization.hybridrow.perf;
|
package com.azure.data.cosmos.serialization.hybridrow.perf;
|
||||||
|
|
||||||
import com.azure.data.cosmos.core.Reference;
|
import com.azure.data.cosmos.core.Reference;
|
||||||
import com.azure.data.cosmos.serialization.hybridrow.Result;
|
import com.azure.data.cosmos.serialization.hybridrow.Result;
|
||||||
|
|
||||||
import static com.azure.data.cosmos.serialization.hybridrow.layouts.LayoutCode.IMMUTABLE_TAGGED2_SCOPE;
|
import static com.azure.data.cosmos.serialization.hybridrow.layouts.LayoutCode.IMMUTABLE_TAGGED2_SCOPE;
|
||||||
|
|
||||||
public final class RowReaderExtensions {
|
public final class RowReaderExtensions {
|
||||||
public static Result VisitReader(Reference<RowReader> reader) {
|
public static Result VisitReader(Reference<RowReader> reader) {
|
||||||
while (reader.get().Read()) {
|
while (reader.get().Read()) {
|
||||||
Utf8Span path = reader.get().getPathSpan();
|
Utf8Span path = reader.get().getPathSpan();
|
||||||
switch (reader.get().getType().LayoutCode) {
|
switch (reader.get().getType().LayoutCode) {
|
||||||
case Null:
|
case Null:
|
||||||
case Boolean:
|
case Boolean:
|
||||||
case Int8:
|
case Int8:
|
||||||
case Int16:
|
case Int16:
|
||||||
case Int32:
|
case Int32:
|
||||||
case Int64:
|
case Int64:
|
||||||
case UInt8:
|
case UInt8:
|
||||||
case UInt16:
|
case UInt16:
|
||||||
case UInt32:
|
case UInt32:
|
||||||
case UInt64:
|
case UInt64:
|
||||||
case VarInt:
|
case VarInt:
|
||||||
case VarUInt:
|
case VarUInt:
|
||||||
case Float32:
|
case Float32:
|
||||||
case Float64:
|
case Float64:
|
||||||
case Float128:
|
case Float128:
|
||||||
case Decimal:
|
case Decimal:
|
||||||
case DateTime:
|
case DateTime:
|
||||||
case UnixDateTime:
|
case UnixDateTime:
|
||||||
case Guid:
|
case Guid:
|
||||||
case MongoDbObjectId:
|
case MongoDbObjectId:
|
||||||
case Utf8:
|
case Utf8:
|
||||||
case Binary:
|
case Binary:
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case NullableScope:
|
case NullableScope:
|
||||||
case ImmutableNullableScope: {
|
case ImmutableNullableScope: {
|
||||||
if (!reader.get().getHasValue()) {
|
if (!reader.get().getHasValue()) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: C# TO JAVA CONVERTER: There is no 'goto' in Java:
|
// TODO: C# TO JAVA CONVERTER: There is no 'goto' in Java:
|
||||||
goto case LayoutCode.TypedTupleScope
|
goto case LayoutCode.TypedTupleScope
|
||||||
}
|
}
|
||||||
|
|
||||||
case ObjectScope:
|
case ObjectScope:
|
||||||
case ImmutableObjectScope:
|
case ImmutableObjectScope:
|
||||||
case Schema:
|
case Schema:
|
||||||
case ImmutableSchema:
|
case ImmutableSchema:
|
||||||
case ArrayScope:
|
case ArrayScope:
|
||||||
case ImmutableArrayScope:
|
case ImmutableArrayScope:
|
||||||
case TypedArrayScope:
|
case TypedArrayScope:
|
||||||
case ImmutableTypedArrayScope:
|
case ImmutableTypedArrayScope:
|
||||||
case TypedSetScope:
|
case TypedSetScope:
|
||||||
case ImmutableTypedSetScope:
|
case ImmutableTypedSetScope:
|
||||||
case TypedMapScope:
|
case TypedMapScope:
|
||||||
case ImmutableTypedMapScope:
|
case ImmutableTypedMapScope:
|
||||||
case TupleScope:
|
case TupleScope:
|
||||||
case ImmutableTupleScope:
|
case ImmutableTupleScope:
|
||||||
case TypedTupleScope:
|
case TypedTupleScope:
|
||||||
case ImmutableTypedTupleScope:
|
case ImmutableTypedTupleScope:
|
||||||
case TaggedScope:
|
case TaggedScope:
|
||||||
case ImmutableTaggedScope:
|
case ImmutableTaggedScope:
|
||||||
case Tagged2Scope:
|
case Tagged2Scope:
|
||||||
case IMMUTABLE_TAGGED2_SCOPE: {
|
case IMMUTABLE_TAGGED2_SCOPE: {
|
||||||
// TODO: C# TO JAVA CONVERTER: The following lambda contained an unresolved 'ref' keyword - these are not converted by C# to Java Converter:
|
// TODO: C# TO JAVA CONVERTER: The following lambda contained an unresolved 'ref' keyword - these are not converted by C# to Java Converter:
|
||||||
Result r = reader.get().ReadScope(null, (ref RowReader child, Object _) -> child.VisitReader());
|
Result r = reader.get().ReadScope(null, (ref RowReader child, Object _) -> child.VisitReader());
|
||||||
if (r != Result.SUCCESS) {
|
if (r != Result.SUCCESS) {
|
||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
default: {
|
default: {
|
||||||
throw new IllegalStateException(lenientFormat("Unknown type will be ignored: %s", reader.get().getType().LayoutCode));
|
throw new IllegalStateException(lenientFormat("Unknown type will be ignored: %s", reader.get().getType().LayoutCode));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return Result.SUCCESS;
|
return Result.SUCCESS;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+638
-638
File diff suppressed because it is too large
Load Diff
+18
-18
@@ -1,19 +1,19 @@
|
|||||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||||
// Licensed under the MIT License.
|
// Licensed under the MIT License.
|
||||||
|
|
||||||
package com.azure.data.cosmos.serialization.hybridrow.perf;
|
package com.azure.data.cosmos.serialization.hybridrow.perf;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Names of assets in the TestData folder.
|
* Names of assets in the TestData folder.
|
||||||
*/
|
*/
|
||||||
public class TestData {
|
public class TestData {
|
||||||
public static final String GuestsExpected = "TestData\\GuestsSchemaExpected.hr";
|
public static final String GuestsExpected = "TestData\\GuestsSchemaExpected.hr";
|
||||||
public static final String HotelExpected = "TestData\\HotelSchemaExpected.hr";
|
public static final String HotelExpected = "TestData\\HotelSchemaExpected.hr";
|
||||||
public static final String Messages1KExpected = "TestData\\Messages1KExpected.hr";
|
public static final String Messages1KExpected = "TestData\\Messages1KExpected.hr";
|
||||||
public static final String RoomsExpected = "TestData\\RoomsSchemaExpected.hr";
|
public static final String RoomsExpected = "TestData\\RoomsSchemaExpected.hr";
|
||||||
public static final String SchemaFile = "TestData\\CassandraHotelSchema.json";
|
public static final String SchemaFile = "TestData\\CassandraHotelSchema.json";
|
||||||
/**
|
/**
|
||||||
* The folder to which TestData assets should be copied during deployment.
|
* The folder to which TestData assets should be copied during deployment.
|
||||||
*/
|
*/
|
||||||
public static final String Target = "TestData";
|
public static final String Target = "TestData";
|
||||||
}
|
}
|
||||||
+338
-338
@@ -1,339 +1,339 @@
|
|||||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||||
// Licensed under the MIT License.
|
// Licensed under the MIT License.
|
||||||
|
|
||||||
package com.azure.data.cosmos.serialization.hybridrow.perf;
|
package com.azure.data.cosmos.serialization.hybridrow.perf;
|
||||||
|
|
||||||
import MongoDB.Bson.IO.*;
|
import MongoDB.Bson.IO.*;
|
||||||
import Newtonsoft.Json.*;
|
import Newtonsoft.Json.*;
|
||||||
import com.azure.data.cosmos.core.Reference;
|
import com.azure.data.cosmos.core.Reference;
|
||||||
import com.azure.data.cosmos.serialization.hybridrow.HybridRowVersion;
|
import com.azure.data.cosmos.serialization.hybridrow.HybridRowVersion;
|
||||||
import com.azure.data.cosmos.serialization.hybridrow.Result;
|
import com.azure.data.cosmos.serialization.hybridrow.Result;
|
||||||
import com.azure.data.cosmos.serialization.hybridrow.RowBuffer;
|
import com.azure.data.cosmos.serialization.hybridrow.RowBuffer;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Tests involving fully (or mostly) unschematized test data.
|
* Tests involving fully (or mostly) unschematized test data.
|
||||||
*/
|
*/
|
||||||
// TODO: C# TO JAVA CONVERTER: Java annotations will not correspond to .NET attributes:
|
// TODO: C# TO JAVA CONVERTER: Java annotations will not correspond to .NET attributes:
|
||||||
//ORIGINAL LINE: [TestClass] public sealed class UnschematizedMicroBenchmarkSuite : MicroBenchmarkSuiteBase
|
//ORIGINAL LINE: [TestClass] public sealed class UnschematizedMicroBenchmarkSuite : MicroBenchmarkSuiteBase
|
||||||
public final class UnschematizedMicroBenchmarkSuite extends MicroBenchmarkSuiteBase {
|
public final class UnschematizedMicroBenchmarkSuite extends MicroBenchmarkSuiteBase {
|
||||||
private static final JsonSerializerSettings JsonSettings = new JsonSerializerSettings
|
private static final JsonSerializerSettings JsonSettings = new JsonSerializerSettings
|
||||||
|
|
||||||
{
|
{
|
||||||
NullValueHandling = NullValueHandling.Ignore, Formatting = Formatting.Indented
|
NullValueHandling = NullValueHandling.Ignore, Formatting = Formatting.Indented
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: C# TO JAVA CONVERTER: Java annotations will not correspond to .NET attributes:
|
// TODO: C# TO JAVA CONVERTER: Java annotations will not correspond to .NET attributes:
|
||||||
//ORIGINAL LINE: [TestMethod][Owner("jthunter")][DeploymentItem(TestData.Messages1KExpected, TestData.Target)]
|
//ORIGINAL LINE: [TestMethod][Owner("jthunter")][DeploymentItem(TestData.Messages1KExpected, TestData.Target)]
|
||||||
// public async Task BsonMessages1KReadBenchmarkAsync()
|
// public async Task BsonMessages1KReadBenchmarkAsync()
|
||||||
// TODO: C# TO JAVA CONVERTER: There is no equivalent in Java to the 'async' keyword:
|
// TODO: C# TO JAVA CONVERTER: There is no equivalent in Java to the 'async' keyword:
|
||||||
//ORIGINAL LINE: [TestMethod][Owner("jthunter")][DeploymentItem(TestData.Messages1KExpected, TestData.Target)]
|
//ORIGINAL LINE: [TestMethod][Owner("jthunter")][DeploymentItem(TestData.Messages1KExpected, TestData.Target)]
|
||||||
// public async Task BsonMessages1KReadBenchmarkAsync()
|
// public async Task BsonMessages1KReadBenchmarkAsync()
|
||||||
public Task BsonMessages1KReadBenchmarkAsync() {
|
public Task BsonMessages1KReadBenchmarkAsync() {
|
||||||
// TODO: C# TO JAVA CONVERTER: There is no preprocessor in Java:
|
// TODO: C# TO JAVA CONVERTER: There is no preprocessor in Java:
|
||||||
//#if DEBUG
|
//#if DEBUG
|
||||||
final int innerLoopIterations = 1;
|
final int innerLoopIterations = 1;
|
||||||
//#else
|
//#else
|
||||||
final int innerLoopIterations = 10;
|
final int innerLoopIterations = 10;
|
||||||
//#endif
|
//#endif
|
||||||
String expectedFile = TestData.Messages1KExpected;
|
String expectedFile = TestData.Messages1KExpected;
|
||||||
// TODO: C# TO JAVA CONVERTER: Java has no equivalent to C# deconstruction declarations:
|
// TODO: C# TO JAVA CONVERTER: Java has no equivalent to C# deconstruction declarations:
|
||||||
(List < Dictionary < Utf8String, object >> expected, LayoutResolverNamespace resolver) =await
|
(List < Dictionary < Utf8String, object >> expected, LayoutResolverNamespace resolver) =await
|
||||||
this.LoadExpectedAsync(expectedFile);
|
this.LoadExpectedAsync(expectedFile);
|
||||||
UnschematizedMicroBenchmarkSuite.BsonReadBenchmark("Messages1K", innerLoopIterations, expected);
|
UnschematizedMicroBenchmarkSuite.BsonReadBenchmark("Messages1K", innerLoopIterations, expected);
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: C# TO JAVA CONVERTER: Java annotations will not correspond to .NET attributes:
|
// TODO: C# TO JAVA CONVERTER: Java annotations will not correspond to .NET attributes:
|
||||||
//ORIGINAL LINE: [TestMethod][Owner("jthunter")][DeploymentItem(TestData.Messages1KExpected, TestData.Target)]
|
//ORIGINAL LINE: [TestMethod][Owner("jthunter")][DeploymentItem(TestData.Messages1KExpected, TestData.Target)]
|
||||||
// public async Task BsonMessages1KWriteBenchmarkAsync()
|
// public async Task BsonMessages1KWriteBenchmarkAsync()
|
||||||
// TODO: C# TO JAVA CONVERTER: There is no equivalent in Java to the 'async' keyword:
|
// TODO: C# TO JAVA CONVERTER: There is no equivalent in Java to the 'async' keyword:
|
||||||
//ORIGINAL LINE: [TestMethod][Owner("jthunter")][DeploymentItem(TestData.Messages1KExpected, TestData.Target)]
|
//ORIGINAL LINE: [TestMethod][Owner("jthunter")][DeploymentItem(TestData.Messages1KExpected, TestData.Target)]
|
||||||
// public async Task BsonMessages1KWriteBenchmarkAsync()
|
// public async Task BsonMessages1KWriteBenchmarkAsync()
|
||||||
public Task BsonMessages1KWriteBenchmarkAsync() {
|
public Task BsonMessages1KWriteBenchmarkAsync() {
|
||||||
// TODO: C# TO JAVA CONVERTER: There is no preprocessor in Java:
|
// TODO: C# TO JAVA CONVERTER: There is no preprocessor in Java:
|
||||||
//#if DEBUG
|
//#if DEBUG
|
||||||
final int innerLoopIterations = 1;
|
final int innerLoopIterations = 1;
|
||||||
//#else
|
//#else
|
||||||
final int innerLoopIterations = 10;
|
final int innerLoopIterations = 10;
|
||||||
//#endif
|
//#endif
|
||||||
String expectedFile = TestData.Messages1KExpected;
|
String expectedFile = TestData.Messages1KExpected;
|
||||||
// TODO: C# TO JAVA CONVERTER: Java has no equivalent to C# deconstruction declarations:
|
// TODO: C# TO JAVA CONVERTER: Java has no equivalent to C# deconstruction declarations:
|
||||||
(List < Dictionary < Utf8String, object >> expected, LayoutResolverNamespace resolver) =await
|
(List < Dictionary < Utf8String, object >> expected, LayoutResolverNamespace resolver) =await
|
||||||
this.LoadExpectedAsync(expectedFile);
|
this.LoadExpectedAsync(expectedFile);
|
||||||
UnschematizedMicroBenchmarkSuite.BsonWriteBenchmark("Messages1K", innerLoopIterations, expected);
|
UnschematizedMicroBenchmarkSuite.BsonWriteBenchmark("Messages1K", innerLoopIterations, expected);
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: C# TO JAVA CONVERTER: Java annotations will not correspond to .NET attributes:
|
// TODO: C# TO JAVA CONVERTER: Java annotations will not correspond to .NET attributes:
|
||||||
//ORIGINAL LINE: [TestMethod][Owner("jthunter")][DeploymentItem(TestData.Messages1KExpected, TestData.Target)]
|
//ORIGINAL LINE: [TestMethod][Owner("jthunter")][DeploymentItem(TestData.Messages1KExpected, TestData.Target)]
|
||||||
// public async Task JsonMessages1KReadBenchmarkAsync()
|
// public async Task JsonMessages1KReadBenchmarkAsync()
|
||||||
// TODO: C# TO JAVA CONVERTER: There is no equivalent in Java to the 'async' keyword:
|
// TODO: C# TO JAVA CONVERTER: There is no equivalent in Java to the 'async' keyword:
|
||||||
//ORIGINAL LINE: [TestMethod][Owner("jthunter")][DeploymentItem(TestData.Messages1KExpected, TestData.Target)]
|
//ORIGINAL LINE: [TestMethod][Owner("jthunter")][DeploymentItem(TestData.Messages1KExpected, TestData.Target)]
|
||||||
// public async Task JsonMessages1KReadBenchmarkAsync()
|
// public async Task JsonMessages1KReadBenchmarkAsync()
|
||||||
public Task JsonMessages1KReadBenchmarkAsync() {
|
public Task JsonMessages1KReadBenchmarkAsync() {
|
||||||
// TODO: C# TO JAVA CONVERTER: There is no preprocessor in Java:
|
// TODO: C# TO JAVA CONVERTER: There is no preprocessor in Java:
|
||||||
//#if DEBUG
|
//#if DEBUG
|
||||||
final int innerLoopIterations = 1;
|
final int innerLoopIterations = 1;
|
||||||
//#else
|
//#else
|
||||||
final int innerLoopIterations = 10;
|
final int innerLoopIterations = 10;
|
||||||
//#endif
|
//#endif
|
||||||
String expectedFile = TestData.Messages1KExpected;
|
String expectedFile = TestData.Messages1KExpected;
|
||||||
// TODO: C# TO JAVA CONVERTER: Java has no equivalent to C# deconstruction declarations:
|
// TODO: C# TO JAVA CONVERTER: Java has no equivalent to C# deconstruction declarations:
|
||||||
(List < Dictionary < Utf8String, object >> expected, LayoutResolverNamespace resolver) =await
|
(List < Dictionary < Utf8String, object >> expected, LayoutResolverNamespace resolver) =await
|
||||||
this.LoadExpectedAsync(expectedFile);
|
this.LoadExpectedAsync(expectedFile);
|
||||||
UnschematizedMicroBenchmarkSuite.JsonReadBenchmark("Messages1K", innerLoopIterations, expected);
|
UnschematizedMicroBenchmarkSuite.JsonReadBenchmark("Messages1K", innerLoopIterations, expected);
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: C# TO JAVA CONVERTER: Java annotations will not correspond to .NET attributes:
|
// TODO: C# TO JAVA CONVERTER: Java annotations will not correspond to .NET attributes:
|
||||||
//ORIGINAL LINE: [TestMethod][Owner("jthunter")][DeploymentItem(TestData.Messages1KExpected, TestData.Target)]
|
//ORIGINAL LINE: [TestMethod][Owner("jthunter")][DeploymentItem(TestData.Messages1KExpected, TestData.Target)]
|
||||||
// public async Task JsonMessages1KWriteBenchmarkAsync()
|
// public async Task JsonMessages1KWriteBenchmarkAsync()
|
||||||
// TODO: C# TO JAVA CONVERTER: There is no equivalent in Java to the 'async' keyword:
|
// TODO: C# TO JAVA CONVERTER: There is no equivalent in Java to the 'async' keyword:
|
||||||
//ORIGINAL LINE: [TestMethod][Owner("jthunter")][DeploymentItem(TestData.Messages1KExpected, TestData.Target)]
|
//ORIGINAL LINE: [TestMethod][Owner("jthunter")][DeploymentItem(TestData.Messages1KExpected, TestData.Target)]
|
||||||
// public async Task JsonMessages1KWriteBenchmarkAsync()
|
// public async Task JsonMessages1KWriteBenchmarkAsync()
|
||||||
public Task JsonMessages1KWriteBenchmarkAsync() {
|
public Task JsonMessages1KWriteBenchmarkAsync() {
|
||||||
// TODO: C# TO JAVA CONVERTER: There is no preprocessor in Java:
|
// TODO: C# TO JAVA CONVERTER: There is no preprocessor in Java:
|
||||||
//#if DEBUG
|
//#if DEBUG
|
||||||
final int innerLoopIterations = 1;
|
final int innerLoopIterations = 1;
|
||||||
//#else
|
//#else
|
||||||
final int innerLoopIterations = 10;
|
final int innerLoopIterations = 10;
|
||||||
//#endif
|
//#endif
|
||||||
String expectedFile = TestData.Messages1KExpected;
|
String expectedFile = TestData.Messages1KExpected;
|
||||||
// TODO: C# TO JAVA CONVERTER: Java has no equivalent to C# deconstruction declarations:
|
// TODO: C# TO JAVA CONVERTER: Java has no equivalent to C# deconstruction declarations:
|
||||||
(List < Dictionary < Utf8String, object >> expected, LayoutResolverNamespace resolver) =await
|
(List < Dictionary < Utf8String, object >> expected, LayoutResolverNamespace resolver) =await
|
||||||
this.LoadExpectedAsync(expectedFile);
|
this.LoadExpectedAsync(expectedFile);
|
||||||
UnschematizedMicroBenchmarkSuite.JsonWriteBenchmark("Messages1K", innerLoopIterations, expected);
|
UnschematizedMicroBenchmarkSuite.JsonWriteBenchmark("Messages1K", innerLoopIterations, expected);
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: C# TO JAVA CONVERTER: Java annotations will not correspond to .NET attributes:
|
// TODO: C# TO JAVA CONVERTER: Java annotations will not correspond to .NET attributes:
|
||||||
//ORIGINAL LINE: [TestMethod][Owner("jthunter")][DeploymentItem(TestData.Messages1KExpected, TestData.Target)]
|
//ORIGINAL LINE: [TestMethod][Owner("jthunter")][DeploymentItem(TestData.Messages1KExpected, TestData.Target)]
|
||||||
// public async Task Messages1KReadBenchmarkAsync()
|
// public async Task Messages1KReadBenchmarkAsync()
|
||||||
// TODO: C# TO JAVA CONVERTER: There is no equivalent in Java to the 'async' keyword:
|
// TODO: C# TO JAVA CONVERTER: There is no equivalent in Java to the 'async' keyword:
|
||||||
//ORIGINAL LINE: [TestMethod][Owner("jthunter")][DeploymentItem(TestData.Messages1KExpected, TestData.Target)]
|
//ORIGINAL LINE: [TestMethod][Owner("jthunter")][DeploymentItem(TestData.Messages1KExpected, TestData.Target)]
|
||||||
// public async Task Messages1KReadBenchmarkAsync()
|
// public async Task Messages1KReadBenchmarkAsync()
|
||||||
public Task Messages1KReadBenchmarkAsync() {
|
public Task Messages1KReadBenchmarkAsync() {
|
||||||
// TODO: C# TO JAVA CONVERTER: There is no preprocessor in Java:
|
// TODO: C# TO JAVA CONVERTER: There is no preprocessor in Java:
|
||||||
//#if DEBUG
|
//#if DEBUG
|
||||||
final int innerLoopIterations = 1;
|
final int innerLoopIterations = 1;
|
||||||
//#else
|
//#else
|
||||||
final int innerLoopIterations = 10;
|
final int innerLoopIterations = 10;
|
||||||
//#endif
|
//#endif
|
||||||
String expectedFile = TestData.Messages1KExpected;
|
String expectedFile = TestData.Messages1KExpected;
|
||||||
// TODO: C# TO JAVA CONVERTER: Java has no equivalent to C# deconstruction declarations:
|
// TODO: C# TO JAVA CONVERTER: Java has no equivalent to C# deconstruction declarations:
|
||||||
(List < Dictionary < Utf8String, object >> expected, LayoutResolverNamespace resolver) =await
|
(List < Dictionary < Utf8String, object >> expected, LayoutResolverNamespace resolver) =await
|
||||||
this.LoadExpectedAsync(expectedFile);
|
this.LoadExpectedAsync(expectedFile);
|
||||||
UnschematizedMicroBenchmarkSuite.JsonModelReadBenchmark(resolver, "TypedJsonHybridRowSchema", "Messages1K",
|
UnschematizedMicroBenchmarkSuite.JsonModelReadBenchmark(resolver, "TypedJsonHybridRowSchema", "Messages1K",
|
||||||
innerLoopIterations, expected);
|
innerLoopIterations, expected);
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: C# TO JAVA CONVERTER: Java annotations will not correspond to .NET attributes:
|
// TODO: C# TO JAVA CONVERTER: Java annotations will not correspond to .NET attributes:
|
||||||
//ORIGINAL LINE: [TestMethod][Owner("jthunter")][DeploymentItem(TestData.Messages1KExpected, TestData.Target)]
|
//ORIGINAL LINE: [TestMethod][Owner("jthunter")][DeploymentItem(TestData.Messages1KExpected, TestData.Target)]
|
||||||
// public async Task Messages1KWriteBenchmarkAsync()
|
// public async Task Messages1KWriteBenchmarkAsync()
|
||||||
// TODO: C# TO JAVA CONVERTER: There is no equivalent in Java to the 'async' keyword:
|
// TODO: C# TO JAVA CONVERTER: There is no equivalent in Java to the 'async' keyword:
|
||||||
//ORIGINAL LINE: [TestMethod][Owner("jthunter")][DeploymentItem(TestData.Messages1KExpected, TestData.Target)]
|
//ORIGINAL LINE: [TestMethod][Owner("jthunter")][DeploymentItem(TestData.Messages1KExpected, TestData.Target)]
|
||||||
// public async Task Messages1KWriteBenchmarkAsync()
|
// public async Task Messages1KWriteBenchmarkAsync()
|
||||||
public Task Messages1KWriteBenchmarkAsync() {
|
public Task Messages1KWriteBenchmarkAsync() {
|
||||||
// TODO: C# TO JAVA CONVERTER: There is no preprocessor in Java:
|
// TODO: C# TO JAVA CONVERTER: There is no preprocessor in Java:
|
||||||
//#if DEBUG
|
//#if DEBUG
|
||||||
final int innerLoopIterations = 1;
|
final int innerLoopIterations = 1;
|
||||||
//#else
|
//#else
|
||||||
final int innerLoopIterations = 10;
|
final int innerLoopIterations = 10;
|
||||||
//#endif
|
//#endif
|
||||||
String expectedFile = TestData.Messages1KExpected;
|
String expectedFile = TestData.Messages1KExpected;
|
||||||
// TODO: C# TO JAVA CONVERTER: Java has no equivalent to C# deconstruction declarations:
|
// TODO: C# TO JAVA CONVERTER: Java has no equivalent to C# deconstruction declarations:
|
||||||
(List < Dictionary < Utf8String, object >> expected, LayoutResolverNamespace resolver) =await
|
(List < Dictionary < Utf8String, object >> expected, LayoutResolverNamespace resolver) =await
|
||||||
this.LoadExpectedAsync(expectedFile);
|
this.LoadExpectedAsync(expectedFile);
|
||||||
UnschematizedMicroBenchmarkSuite.JsonModelWriteBenchmark(resolver, "TypedJsonHybridRowSchema", "Messages1K",
|
UnschematizedMicroBenchmarkSuite.JsonModelWriteBenchmark(resolver, "TypedJsonHybridRowSchema", "Messages1K",
|
||||||
innerLoopIterations, expected);
|
innerLoopIterations, expected);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void BsonReadBenchmark(String dataSetName, int innerLoopIterations, ArrayList<HashMap<Utf8String,
|
private static void BsonReadBenchmark(String dataSetName, int innerLoopIterations, ArrayList<HashMap<Utf8String,
|
||||||
Object>> expected) {
|
Object>> expected) {
|
||||||
// Serialize input data to sequence of byte buffers.
|
// Serialize input data to sequence of byte buffers.
|
||||||
//C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java:
|
//C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java:
|
||||||
//ORIGINAL LINE: List<byte[]> expectedSerialized = new List<byte[]>(expected.Count);
|
//ORIGINAL LINE: List<byte[]> expectedSerialized = new List<byte[]>(expected.Count);
|
||||||
ArrayList<byte[]> expectedSerialized = new ArrayList<byte[]>(expected.size());
|
ArrayList<byte[]> expectedSerialized = new ArrayList<byte[]>(expected.size());
|
||||||
try (BsonJsonModelRowGenerator writer = new BsonJsonModelRowGenerator(InitialCapacity)) {
|
try (BsonJsonModelRowGenerator writer = new BsonJsonModelRowGenerator(InitialCapacity)) {
|
||||||
for (HashMap<Utf8String, Object> tableValue : expected) {
|
for (HashMap<Utf8String, Object> tableValue : expected) {
|
||||||
writer.Reset();
|
writer.Reset();
|
||||||
writer.WriteBuffer(tableValue);
|
writer.WriteBuffer(tableValue);
|
||||||
//C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java:
|
//C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java:
|
||||||
//ORIGINAL LINE: expectedSerialized.Add(writer.ToArray());
|
//ORIGINAL LINE: expectedSerialized.Add(writer.ToArray());
|
||||||
expectedSerialized.add(writer.ToArray());
|
expectedSerialized.add(writer.ToArray());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
BenchmarkContext ignoredContext = null;
|
BenchmarkContext ignoredContext = null;
|
||||||
Reference<BenchmarkContext> tempReference_ignoredContext = new Reference<BenchmarkContext>(ignoredContext);
|
Reference<BenchmarkContext> tempReference_ignoredContext = new Reference<BenchmarkContext>(ignoredContext);
|
||||||
// TODO: C# TO JAVA CONVERTER: The following lambda contained an unresolved 'ref' keyword - these are not converted by C# to Java Converter:
|
// TODO: C# TO JAVA CONVERTER: The following lambda contained an unresolved 'ref' keyword - these are not converted by C# to Java Converter:
|
||||||
//C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java:
|
//C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java:
|
||||||
//ORIGINAL LINE: MicroBenchmarkSuiteBase.Benchmark("Unschematized", "Read", dataSetName, "BSON", innerLoopIterations, ref ignoredContext, (ref BenchmarkContext _, byte[] tableValue) =>
|
//ORIGINAL LINE: MicroBenchmarkSuiteBase.Benchmark("Unschematized", "Read", dataSetName, "BSON", innerLoopIterations, ref ignoredContext, (ref BenchmarkContext _, byte[] tableValue) =>
|
||||||
Benchmark("Unschematized", "Read", dataSetName, "BSON", innerLoopIterations, tempReference_ignoredContext, (ref BenchmarkContext _, byte[] tableValue) ->
|
Benchmark("Unschematized", "Read", dataSetName, "BSON", innerLoopIterations, tempReference_ignoredContext, (ref BenchmarkContext _, byte[] tableValue) ->
|
||||||
{
|
{
|
||||||
try (MemoryStream stm = new MemoryStream(tableValue)) {
|
try (MemoryStream stm = new MemoryStream(tableValue)) {
|
||||||
try (BsonBinaryReader bsonReader = new BsonBinaryReader(stm)) {
|
try (BsonBinaryReader bsonReader = new BsonBinaryReader(stm)) {
|
||||||
bsonReader.VisitBsonDocument();
|
bsonReader.VisitBsonDocument();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}, (ref BenchmarkContext _, byte[] tableValue) -> tableValue.length, expectedSerialized);
|
}, (ref BenchmarkContext _, byte[] tableValue) -> tableValue.length, expectedSerialized);
|
||||||
ignoredContext = tempReference_ignoredContext.get();
|
ignoredContext = tempReference_ignoredContext.get();
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void BsonWriteBenchmark(String dataSetName, int innerLoopIterations, ArrayList<HashMap<Utf8String,
|
private static void BsonWriteBenchmark(String dataSetName, int innerLoopIterations, ArrayList<HashMap<Utf8String,
|
||||||
Object>> expected) {
|
Object>> expected) {
|
||||||
try (BsonJsonModelRowGenerator writer = new BsonJsonModelRowGenerator(InitialCapacity)) {
|
try (BsonJsonModelRowGenerator writer = new BsonJsonModelRowGenerator(InitialCapacity)) {
|
||||||
BenchmarkContext ignoredContext = null;
|
BenchmarkContext ignoredContext = null;
|
||||||
|
|
||||||
Reference<BenchmarkContext> tempReference_ignoredContext = new Reference<BenchmarkContext>(ignoredContext);
|
Reference<BenchmarkContext> tempReference_ignoredContext = new Reference<BenchmarkContext>(ignoredContext);
|
||||||
// TODO: C# TO JAVA CONVERTER: The following lambda contained an unresolved 'ref' keyword - these are
|
// TODO: C# TO JAVA CONVERTER: The following lambda contained an unresolved 'ref' keyword - these are
|
||||||
// not converted by C# to Java Converter:
|
// not converted by C# to Java Converter:
|
||||||
Benchmark("Unschematized", "Write", dataSetName, "BSON", innerLoopIterations,
|
Benchmark("Unschematized", "Write", dataSetName, "BSON", innerLoopIterations,
|
||||||
tempReference_ignoredContext, (ref BenchmarkContext _, HashMap<Utf8String, Object> tableValue) ->
|
tempReference_ignoredContext, (ref BenchmarkContext _, HashMap<Utf8String, Object> tableValue) ->
|
||||||
{
|
{
|
||||||
writer.Reset();
|
writer.Reset();
|
||||||
writer.WriteBuffer(tableValue);
|
writer.WriteBuffer(tableValue);
|
||||||
}, (ref BenchmarkContext _, HashMap<Utf8String, Object> tableValue) -> writer.getLength(), expected);
|
}, (ref BenchmarkContext _, HashMap<Utf8String, Object> tableValue) -> writer.getLength(), expected);
|
||||||
ignoredContext = tempReference_ignoredContext.get();
|
ignoredContext = tempReference_ignoredContext.get();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void JsonModelReadBenchmark(LayoutResolverNamespace resolver, String schemaName,
|
private static void JsonModelReadBenchmark(LayoutResolverNamespace resolver, String schemaName,
|
||||||
String dataSetName, int innerLoopIterations,
|
String dataSetName, int innerLoopIterations,
|
||||||
ArrayList<HashMap<Utf8String, Object>> expected) {
|
ArrayList<HashMap<Utf8String, Object>> expected) {
|
||||||
// Serialize input data to sequence of byte buffers.
|
// Serialize input data to sequence of byte buffers.
|
||||||
//C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java:
|
//C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java:
|
||||||
//ORIGINAL LINE: List<byte[]> expectedSerialized = new List<byte[]>(expected.Count);
|
//ORIGINAL LINE: List<byte[]> expectedSerialized = new List<byte[]>(expected.Count);
|
||||||
ArrayList<byte[]> expectedSerialized = new ArrayList<byte[]>(expected.size());
|
ArrayList<byte[]> expectedSerialized = new ArrayList<byte[]>(expected.size());
|
||||||
Layout layout = resolver.Resolve(tangible.ListHelper.find(resolver.getNamespace().getSchemas(), x =
|
Layout layout = resolver.Resolve(tangible.ListHelper.find(resolver.getNamespace().getSchemas(), x =
|
||||||
schemaName.equals( > x.Name)).SchemaId)
|
schemaName.equals( > x.Name)).SchemaId)
|
||||||
BenchmarkContext context = new BenchmarkContext();
|
BenchmarkContext context = new BenchmarkContext();
|
||||||
context.JsonModelWriter = new JsonModelRowGenerator(InitialCapacity, layout, resolver);
|
context.JsonModelWriter = new JsonModelRowGenerator(InitialCapacity, layout, resolver);
|
||||||
|
|
||||||
for (HashMap<Utf8String, Object> tableValue : expected) {
|
for (HashMap<Utf8String, Object> tableValue : expected) {
|
||||||
context.JsonModelWriter.Reset();
|
context.JsonModelWriter.Reset();
|
||||||
|
|
||||||
Result r = context.JsonModelWriter.WriteBuffer(tableValue);
|
Result r = context.JsonModelWriter.WriteBuffer(tableValue);
|
||||||
ResultAssert.IsSuccess(r);
|
ResultAssert.IsSuccess(r);
|
||||||
//C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java:
|
//C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java:
|
||||||
//ORIGINAL LINE: expectedSerialized.Add(context.JsonModelWriter.ToArray());
|
//ORIGINAL LINE: expectedSerialized.Add(context.JsonModelWriter.ToArray());
|
||||||
expectedSerialized.add(context.JsonModelWriter.ToArray());
|
expectedSerialized.add(context.JsonModelWriter.ToArray());
|
||||||
}
|
}
|
||||||
|
|
||||||
Reference<BenchmarkContext> tempReference_context = new Reference<BenchmarkContext>(context);
|
Reference<BenchmarkContext> tempReference_context = new Reference<BenchmarkContext>(context);
|
||||||
// TODO: C# TO JAVA CONVERTER: The following lambda contained an unresolved 'ref' keyword - these are not
|
// TODO: C# TO JAVA CONVERTER: The following lambda contained an unresolved 'ref' keyword - these are not
|
||||||
// converted by C# to Java Converter:
|
// converted by C# to Java Converter:
|
||||||
//C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java:
|
//C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java:
|
||||||
//ORIGINAL LINE: MicroBenchmarkSuiteBase.Benchmark("Unschematized", "Read", dataSetName, "HybridRowSparse",
|
//ORIGINAL LINE: MicroBenchmarkSuiteBase.Benchmark("Unschematized", "Read", dataSetName, "HybridRowSparse",
|
||||||
// innerLoopIterations, ref context, (ref BenchmarkContext ctx, byte[] tableValue) =>
|
// innerLoopIterations, ref context, (ref BenchmarkContext ctx, byte[] tableValue) =>
|
||||||
Benchmark("Unschematized", "Read", dataSetName, "HybridRowSparse",
|
Benchmark("Unschematized", "Read", dataSetName, "HybridRowSparse",
|
||||||
innerLoopIterations, tempReference_context, (ref BenchmarkContext ctx, byte[] tableValue) ->
|
innerLoopIterations, tempReference_context, (ref BenchmarkContext ctx, byte[] tableValue) ->
|
||||||
{
|
{
|
||||||
RowBuffer row = new RowBuffer(tableValue.AsSpan(), HybridRowVersion.V1, resolver);
|
RowBuffer row = new RowBuffer(tableValue.AsSpan(), HybridRowVersion.V1, resolver);
|
||||||
Reference<RowBuffer> tempReference_row =
|
Reference<RowBuffer> tempReference_row =
|
||||||
new Reference<RowBuffer>(row);
|
new Reference<RowBuffer>(row);
|
||||||
RowReader reader = new RowReader(tempReference_row);
|
RowReader reader = new RowReader(tempReference_row);
|
||||||
row = tempReference_row.get();
|
row = tempReference_row.get();
|
||||||
RowReaderExtensions.VisitReader(reader.clone());
|
RowReaderExtensions.VisitReader(reader.clone());
|
||||||
}, (ref BenchmarkContext ctx, byte[] tableValue) -> tableValue.length, expectedSerialized);
|
}, (ref BenchmarkContext ctx, byte[] tableValue) -> tableValue.length, expectedSerialized);
|
||||||
context = tempReference_context.get();
|
context = tempReference_context.get();
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void JsonModelWriteBenchmark(LayoutResolverNamespace resolver, String schemaName,
|
private static void JsonModelWriteBenchmark(LayoutResolverNamespace resolver, String schemaName,
|
||||||
String dataSetName, int innerLoopIterations,
|
String dataSetName, int innerLoopIterations,
|
||||||
ArrayList<HashMap<Utf8String, Object>> expected) {
|
ArrayList<HashMap<Utf8String, Object>> expected) {
|
||||||
Layout layout = resolver.Resolve(tangible.ListHelper.find(resolver.getNamespace().getSchemas(), x =
|
Layout layout = resolver.Resolve(tangible.ListHelper.find(resolver.getNamespace().getSchemas(), x =
|
||||||
schemaName.equals( > x.Name)).SchemaId)
|
schemaName.equals( > x.Name)).SchemaId)
|
||||||
BenchmarkContext context = new BenchmarkContext();
|
BenchmarkContext context = new BenchmarkContext();
|
||||||
context.JsonModelWriter = new JsonModelRowGenerator(InitialCapacity, layout, resolver);
|
context.JsonModelWriter = new JsonModelRowGenerator(InitialCapacity, layout, resolver);
|
||||||
|
|
||||||
Reference<BenchmarkContext> tempReference_context = new Reference<BenchmarkContext>(context);
|
Reference<BenchmarkContext> tempReference_context = new Reference<BenchmarkContext>(context);
|
||||||
// TODO: C# TO JAVA CONVERTER: The following lambda contained an unresolved 'ref' keyword - these are not
|
// TODO: C# TO JAVA CONVERTER: The following lambda contained an unresolved 'ref' keyword - these are not
|
||||||
// converted by C# to Java Converter:
|
// converted by C# to Java Converter:
|
||||||
Benchmark("Unschematized", "Write", dataSetName, "HybridRowSparse",
|
Benchmark("Unschematized", "Write", dataSetName, "HybridRowSparse",
|
||||||
innerLoopIterations, tempReference_context, (ref BenchmarkContext ctx, HashMap<Utf8String, Object> tableValue) ->
|
innerLoopIterations, tempReference_context, (ref BenchmarkContext ctx, HashMap<Utf8String, Object> tableValue) ->
|
||||||
{
|
{
|
||||||
ctx.JsonModelWriter.Reset();
|
ctx.JsonModelWriter.Reset();
|
||||||
|
|
||||||
Result r = ctx.JsonModelWriter.WriteBuffer(tableValue);
|
Result r = ctx.JsonModelWriter.WriteBuffer(tableValue);
|
||||||
ResultAssert.IsSuccess(r);
|
ResultAssert.IsSuccess(r);
|
||||||
}, (ref BenchmarkContext ctx, HashMap<Utf8String, Object> tableValue) -> ctx.JsonModelWriter.Length, expected);
|
}, (ref BenchmarkContext ctx, HashMap<Utf8String, Object> tableValue) -> ctx.JsonModelWriter.Length, expected);
|
||||||
context = tempReference_context.get();
|
context = tempReference_context.get();
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void JsonReadBenchmark(String dataSetName, int innerLoopIterations, ArrayList<HashMap<Utf8String,
|
private static void JsonReadBenchmark(String dataSetName, int innerLoopIterations, ArrayList<HashMap<Utf8String,
|
||||||
Object>> expected) {
|
Object>> expected) {
|
||||||
// Serialize input data to sequence of byte buffers.
|
// Serialize input data to sequence of byte buffers.
|
||||||
//C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java:
|
//C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java:
|
||||||
//ORIGINAL LINE: List<byte[]> expectedSerialized = new List<byte[]>(expected.Count);
|
//ORIGINAL LINE: List<byte[]> expectedSerialized = new List<byte[]>(expected.Count);
|
||||||
ArrayList<byte[]> expectedSerialized = new ArrayList<byte[]>(expected.size());
|
ArrayList<byte[]> expectedSerialized = new ArrayList<byte[]>(expected.size());
|
||||||
Encoding utf8Encoding = new UTF8Encoding();
|
Encoding utf8Encoding = new UTF8Encoding();
|
||||||
JsonSerializer jsonSerializer = JsonSerializer.Create(UnschematizedMicroBenchmarkSuite.JsonSettings);
|
JsonSerializer jsonSerializer = JsonSerializer.Create(UnschematizedMicroBenchmarkSuite.JsonSettings);
|
||||||
try (MemoryStream jsonStream = new MemoryStream(InitialCapacity)) {
|
try (MemoryStream jsonStream = new MemoryStream(InitialCapacity)) {
|
||||||
try (OutputStreamWriter textWriter = new OutputStreamWriter(jsonStream)) {
|
try (OutputStreamWriter textWriter = new OutputStreamWriter(jsonStream)) {
|
||||||
try (JsonTextWriter jsonWriter = new JsonTextWriter(textWriter)) {
|
try (JsonTextWriter jsonWriter = new JsonTextWriter(textWriter)) {
|
||||||
jsonSerializer.Converters.Add(new Utf8StringJsonConverter());
|
jsonSerializer.Converters.Add(new Utf8StringJsonConverter());
|
||||||
|
|
||||||
for (HashMap<Utf8String, Object> tableValue : expected) {
|
for (HashMap<Utf8String, Object> tableValue : expected) {
|
||||||
jsonSerializer.Serialize(jsonWriter, tableValue);
|
jsonSerializer.Serialize(jsonWriter, tableValue);
|
||||||
jsonWriter.Flush();
|
jsonWriter.Flush();
|
||||||
//C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java:
|
//C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java:
|
||||||
//ORIGINAL LINE: expectedSerialized.Add(jsonStream.ToArray());
|
//ORIGINAL LINE: expectedSerialized.Add(jsonStream.ToArray());
|
||||||
expectedSerialized.add((Byte)jsonStream.ToArray());
|
expectedSerialized.add((Byte)jsonStream.ToArray());
|
||||||
jsonStream.SetLength(0);
|
jsonStream.SetLength(0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
BenchmarkContext ignoredContext = null;
|
BenchmarkContext ignoredContext = null;
|
||||||
jsonSerializer.Converters.Add(new Utf8StringJsonConverter());
|
jsonSerializer.Converters.Add(new Utf8StringJsonConverter());
|
||||||
|
|
||||||
Reference<BenchmarkContext> tempReference_ignoredContext = new Reference<BenchmarkContext>(ignoredContext);
|
Reference<BenchmarkContext> tempReference_ignoredContext = new Reference<BenchmarkContext>(ignoredContext);
|
||||||
// TODO: C# TO JAVA CONVERTER: The following lambda contained an unresolved 'ref' keyword - these are not
|
// TODO: C# TO JAVA CONVERTER: The following lambda contained an unresolved 'ref' keyword - these are not
|
||||||
// converted by C# to Java Converter:
|
// converted by C# to Java Converter:
|
||||||
//C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java:
|
//C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java:
|
||||||
//ORIGINAL LINE: MicroBenchmarkSuiteBase.Benchmark("Unschematized", "Read", dataSetName, "JSON",
|
//ORIGINAL LINE: MicroBenchmarkSuiteBase.Benchmark("Unschematized", "Read", dataSetName, "JSON",
|
||||||
// innerLoopIterations, ref ignoredContext, (ref BenchmarkContext _, byte[] tableValue) =>
|
// innerLoopIterations, ref ignoredContext, (ref BenchmarkContext _, byte[] tableValue) =>
|
||||||
Benchmark("Unschematized", "Read", dataSetName, "JSON", innerLoopIterations,
|
Benchmark("Unschematized", "Read", dataSetName, "JSON", innerLoopIterations,
|
||||||
tempReference_ignoredContext, (ref BenchmarkContext _, byte[] tableValue) ->
|
tempReference_ignoredContext, (ref BenchmarkContext _, byte[] tableValue) ->
|
||||||
{
|
{
|
||||||
try (MemoryStream jsonStream = new MemoryStream(tableValue)) {
|
try (MemoryStream jsonStream = new MemoryStream(tableValue)) {
|
||||||
try (InputStreamReader textReader = new InputStreamReader(jsonStream)) {
|
try (InputStreamReader textReader = new InputStreamReader(jsonStream)) {
|
||||||
try (JsonTextReader jsonReader = new JsonTextReader(textReader)) {
|
try (JsonTextReader jsonReader = new JsonTextReader(textReader)) {
|
||||||
while (jsonReader.Read()) {
|
while (jsonReader.Read()) {
|
||||||
// Just visit the entire structure without materializing any of the values.
|
// Just visit the entire structure without materializing any of the values.
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}, (ref BenchmarkContext _, byte[] tableValue) -> tableValue.length, expectedSerialized);
|
}, (ref BenchmarkContext _, byte[] tableValue) -> tableValue.length, expectedSerialized);
|
||||||
ignoredContext = tempReference_ignoredContext.get();
|
ignoredContext = tempReference_ignoredContext.get();
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void JsonWriteBenchmark(String dataSetName, int innerLoopIterations, ArrayList<HashMap<Utf8String,
|
private static void JsonWriteBenchmark(String dataSetName, int innerLoopIterations, ArrayList<HashMap<Utf8String,
|
||||||
Object>> expected) {
|
Object>> expected) {
|
||||||
Encoding utf8Encoding = new UTF8Encoding();
|
Encoding utf8Encoding = new UTF8Encoding();
|
||||||
JsonSerializer jsonSerializer = JsonSerializer.Create(UnschematizedMicroBenchmarkSuite.JsonSettings);
|
JsonSerializer jsonSerializer = JsonSerializer.Create(UnschematizedMicroBenchmarkSuite.JsonSettings);
|
||||||
try (MemoryStream jsonStream = new MemoryStream(InitialCapacity)) {
|
try (MemoryStream jsonStream = new MemoryStream(InitialCapacity)) {
|
||||||
try (OutputStreamWriter textWriter = new OutputStreamWriter(jsonStream)) {
|
try (OutputStreamWriter textWriter = new OutputStreamWriter(jsonStream)) {
|
||||||
try (JsonTextWriter jsonWriter = new JsonTextWriter(textWriter)) {
|
try (JsonTextWriter jsonWriter = new JsonTextWriter(textWriter)) {
|
||||||
BenchmarkContext ignoredContext = null;
|
BenchmarkContext ignoredContext = null;
|
||||||
jsonSerializer.Converters.Add(new Utf8StringJsonConverter());
|
jsonSerializer.Converters.Add(new Utf8StringJsonConverter());
|
||||||
|
|
||||||
Reference<BenchmarkContext> tempReference_ignoredContext = new Reference<BenchmarkContext>(ignoredContext);
|
Reference<BenchmarkContext> tempReference_ignoredContext = new Reference<BenchmarkContext>(ignoredContext);
|
||||||
// TODO: C# TO JAVA CONVERTER: The following lambda contained an unresolved 'ref' keyword -
|
// TODO: C# TO JAVA CONVERTER: The following lambda contained an unresolved 'ref' keyword -
|
||||||
// these are not converted by C# to Java Converter:
|
// these are not converted by C# to Java Converter:
|
||||||
Benchmark("Unschematized", "Write", dataSetName, "JSON",
|
Benchmark("Unschematized", "Write", dataSetName, "JSON",
|
||||||
innerLoopIterations, tempReference_ignoredContext, (ref BenchmarkContext _, HashMap<Utf8String,
|
innerLoopIterations, tempReference_ignoredContext, (ref BenchmarkContext _, HashMap<Utf8String,
|
||||||
Object> tableValue) ->
|
Object> tableValue) ->
|
||||||
{
|
{
|
||||||
jsonStream.SetLength(0);
|
jsonStream.SetLength(0);
|
||||||
jsonSerializer.Serialize(jsonWriter, tableValue);
|
jsonSerializer.Serialize(jsonWriter, tableValue);
|
||||||
jsonWriter.Flush();
|
jsonWriter.Flush();
|
||||||
}, (ref BenchmarkContext _, HashMap<Utf8String, Object> value) -> jsonStream.Length, expected);
|
}, (ref BenchmarkContext _, HashMap<Utf8String, Object> value) -> jsonStream.Length, expected);
|
||||||
ignoredContext = tempReference_ignoredContext.get();
|
ignoredContext = tempReference_ignoredContext.get();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+315
-315
@@ -1,316 +1,316 @@
|
|||||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||||
// Licensed under the MIT License.
|
// Licensed under the MIT License.
|
||||||
|
|
||||||
package com.azure.data.cosmos.serialization.hybridrow.perf.cassandrahotel.protobuf;
|
package com.azure.data.cosmos.serialization.hybridrow.perf.cassandrahotel.protobuf;
|
||||||
|
|
||||||
import com.azure.data.cosmos.serialization.hybridrow.perf.*;
|
import com.azure.data.cosmos.serialization.hybridrow.perf.*;
|
||||||
import com.google.protobuf.Message;
|
import com.google.protobuf.Message;
|
||||||
import com.google.protobuf.Parser;
|
import com.google.protobuf.Parser;
|
||||||
|
|
||||||
// <auto-generated>
|
// <auto-generated>
|
||||||
// Generated by the protocol buffer compiler. DO NOT EDIT!
|
// Generated by the protocol buffer compiler. DO NOT EDIT!
|
||||||
// source: TestData/CassandraHotelSchema.proto
|
// source: TestData/CassandraHotelSchema.proto
|
||||||
// </auto-generated>
|
// </auto-generated>
|
||||||
|
|
||||||
//C# TO JAVA CONVERTER NOTE: There is no Java equivalent to C# namespace aliases:
|
//C# TO JAVA CONVERTER NOTE: There is no Java equivalent to C# namespace aliases:
|
||||||
//using pb = Google.Protobuf;
|
//using pb = Google.Protobuf;
|
||||||
//C# TO JAVA CONVERTER NOTE: There is no Java equivalent to C# namespace aliases:
|
//C# TO JAVA CONVERTER NOTE: There is no Java equivalent to C# namespace aliases:
|
||||||
//using pbc = Google.Protobuf.Collections;
|
//using pbc = Google.Protobuf.Collections;
|
||||||
//C# TO JAVA CONVERTER NOTE: There is no Java equivalent to C# namespace aliases:
|
//C# TO JAVA CONVERTER NOTE: There is no Java equivalent to C# namespace aliases:
|
||||||
//using pbr = Google.Protobuf.Reflection;
|
//using pbr = Google.Protobuf.Reflection;
|
||||||
|
|
||||||
public final class Address implements Message<Address> {
|
public final class Address implements Message<Address> {
|
||||||
/**
|
/**
|
||||||
* Field number for the "city" field.
|
* Field number for the "city" field.
|
||||||
*/
|
*/
|
||||||
public static final int CityFieldNumber = 2;
|
public static final int CityFieldNumber = 2;
|
||||||
/**
|
/**
|
||||||
* Field number for the "postal_code" field.
|
* Field number for the "postal_code" field.
|
||||||
*/
|
*/
|
||||||
public static final int PostalCodeFieldNumber = 4;
|
public static final int PostalCodeFieldNumber = 4;
|
||||||
/**
|
/**
|
||||||
* Field number for the "state" field.
|
* Field number for the "state" field.
|
||||||
*/
|
*/
|
||||||
public static final int StateFieldNumber = 3;
|
public static final int StateFieldNumber = 3;
|
||||||
/**
|
/**
|
||||||
* Field number for the "street" field.
|
* Field number for the "street" field.
|
||||||
*/
|
*/
|
||||||
public static final int StreetFieldNumber = 1;
|
public static final int StreetFieldNumber = 1;
|
||||||
private static final Parser<?> _parser = new Address().getParserForType();
|
private static final Parser<?> _parser = new Address().getParserForType();
|
||||||
private static final Google.Protobuf.FieldCodec<String> _single_city_codec = Google.Protobuf.FieldCodec.<String>ForClassWrapper(18);
|
private static final Google.Protobuf.FieldCodec<String> _single_city_codec = Google.Protobuf.FieldCodec.<String>ForClassWrapper(18);
|
||||||
|
|
||||||
// TODO: C# TO JAVA CONVERTER: Java does not support 'partial' methods:
|
// TODO: C# TO JAVA CONVERTER: Java does not support 'partial' methods:
|
||||||
// partial void OnConstruction();
|
// partial void OnConstruction();
|
||||||
private static final Google.Protobuf.FieldCodec<String> _single_state_codec =
|
private static final Google.Protobuf.FieldCodec<String> _single_state_codec =
|
||||||
Google.Protobuf.FieldCodec.<String>ForClassWrapper(26);
|
Google.Protobuf.FieldCodec.<String>ForClassWrapper(26);
|
||||||
private static final Google.Protobuf.FieldCodec<String> _single_street_codec =
|
private static final Google.Protobuf.FieldCodec<String> _single_street_codec =
|
||||||
Google.Protobuf.FieldCodec.<String>ForClassWrapper(10);
|
Google.Protobuf.FieldCodec.<String>ForClassWrapper(10);
|
||||||
private Google.Protobuf.UnknownFieldSet _unknownFields;
|
private Google.Protobuf.UnknownFieldSet _unknownFields;
|
||||||
private String city_;
|
private String city_;
|
||||||
private PostalCode postalCode_;
|
private PostalCode postalCode_;
|
||||||
private String state_;
|
private String state_;
|
||||||
private String street_;
|
private String street_;
|
||||||
|
|
||||||
// TODO: C# TO JAVA CONVERTER: Java annotations will not correspond to .NET attributes:
|
// TODO: C# TO JAVA CONVERTER: Java annotations will not correspond to .NET attributes:
|
||||||
//ORIGINAL LINE: [System.Diagnostics.DebuggerNonUserCodeAttribute] public Address()
|
//ORIGINAL LINE: [System.Diagnostics.DebuggerNonUserCodeAttribute] public Address()
|
||||||
public Address() {
|
public Address() {
|
||||||
OnConstruction();
|
OnConstruction();
|
||||||
}
|
}
|
||||||
// TODO: C# TO JAVA CONVERTER: Java annotations will not correspond to .NET attributes:
|
// TODO: C# TO JAVA CONVERTER: Java annotations will not correspond to .NET attributes:
|
||||||
//ORIGINAL LINE: [System.Diagnostics.DebuggerNonUserCodeAttribute] public Address(Address other)
|
//ORIGINAL LINE: [System.Diagnostics.DebuggerNonUserCodeAttribute] public Address(Address other)
|
||||||
public Address(Address other) {
|
public Address(Address other) {
|
||||||
this();
|
this();
|
||||||
setStreet(other.getStreet());
|
setStreet(other.getStreet());
|
||||||
setCity(other.getCity());
|
setCity(other.getCity());
|
||||||
setState(other.getState());
|
setState(other.getState());
|
||||||
setPostalCode(other.postalCode_ != null ? other.getPostalCode().Clone() : null);
|
setPostalCode(other.postalCode_ != null ? other.getPostalCode().Clone() : null);
|
||||||
_unknownFields = Google.Protobuf.UnknownFieldSet.Clone(other._unknownFields);
|
_unknownFields = Google.Protobuf.UnknownFieldSet.Clone(other._unknownFields);
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: C# TO JAVA CONVERTER: Java annotations will not correspond to .NET attributes:
|
// TODO: C# TO JAVA CONVERTER: Java annotations will not correspond to .NET attributes:
|
||||||
//ORIGINAL LINE: [System.Diagnostics.DebuggerNonUserCodeAttribute] public string City
|
//ORIGINAL LINE: [System.Diagnostics.DebuggerNonUserCodeAttribute] public string City
|
||||||
public String getCity() {
|
public String getCity() {
|
||||||
return city_;
|
return city_;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setCity(String value) {
|
public void setCity(String value) {
|
||||||
city_ = value;
|
city_ = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: C# TO JAVA CONVERTER: Java annotations will not correspond to .NET attributes:
|
// TODO: C# TO JAVA CONVERTER: Java annotations will not correspond to .NET attributes:
|
||||||
//ORIGINAL LINE: [System.Diagnostics.DebuggerNonUserCodeAttribute] pbr::MessageDescriptor pb::IMessage.Descriptor
|
//ORIGINAL LINE: [System.Diagnostics.DebuggerNonUserCodeAttribute] pbr::MessageDescriptor pb::IMessage.Descriptor
|
||||||
public Google.Protobuf.Reflection getDescriptor() {
|
public Google.Protobuf.Reflection getDescriptor() {
|
||||||
return getDescriptor();
|
return getDescriptor();
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: C# TO JAVA CONVERTER: Java annotations will not correspond to .NET attributes:
|
// TODO: C# TO JAVA CONVERTER: Java annotations will not correspond to .NET attributes:
|
||||||
//ORIGINAL LINE: [System.Diagnostics.DebuggerNonUserCodeAttribute] public static Google.Protobuf.Reflection
|
//ORIGINAL LINE: [System.Diagnostics.DebuggerNonUserCodeAttribute] public static Google.Protobuf.Reflection
|
||||||
// .MessageDescriptor Descriptor
|
// .MessageDescriptor Descriptor
|
||||||
public static Google.Protobuf.Reflection.MessageDescriptor getDescriptor() {
|
public static Google.Protobuf.Reflection.MessageDescriptor getDescriptor() {
|
||||||
return CassandraHotelSchemaReflection.getDescriptor().MessageTypes[1];
|
return CassandraHotelSchemaReflection.getDescriptor().MessageTypes[1];
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: C# TO JAVA CONVERTER: Java annotations will not correspond to .NET attributes:
|
// TODO: C# TO JAVA CONVERTER: Java annotations will not correspond to .NET attributes:
|
||||||
//ORIGINAL LINE: [System.Diagnostics.DebuggerNonUserCodeAttribute] public static Google.Protobuf
|
//ORIGINAL LINE: [System.Diagnostics.DebuggerNonUserCodeAttribute] public static Google.Protobuf
|
||||||
// .MessageParser<Address> Parser
|
// .MessageParser<Address> Parser
|
||||||
public static Google.Protobuf.MessageParser<Address> getParser() {
|
public static Google.Protobuf.MessageParser<Address> getParser() {
|
||||||
return _parser;
|
return _parser;
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: C# TO JAVA CONVERTER: Java annotations will not correspond to .NET attributes:
|
// TODO: C# TO JAVA CONVERTER: Java annotations will not correspond to .NET attributes:
|
||||||
//ORIGINAL LINE: [System.Diagnostics.DebuggerNonUserCodeAttribute] public Microsoft.Azure.Cosmos.Serialization
|
//ORIGINAL LINE: [System.Diagnostics.DebuggerNonUserCodeAttribute] public Microsoft.Azure.Cosmos.Serialization
|
||||||
// .HybridRow.Tests.Perf.CassandraHotel.Protobuf.PostalCode PostalCode
|
// .HybridRow.Tests.Perf.CassandraHotel.Protobuf.PostalCode PostalCode
|
||||||
public PostalCode getPostalCode() {
|
public PostalCode getPostalCode() {
|
||||||
return postalCode_;
|
return postalCode_;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setPostalCode(PostalCode value) {
|
public void setPostalCode(PostalCode value) {
|
||||||
postalCode_ = value;
|
postalCode_ = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: C# TO JAVA CONVERTER: Java annotations will not correspond to .NET attributes:
|
// TODO: C# TO JAVA CONVERTER: Java annotations will not correspond to .NET attributes:
|
||||||
//ORIGINAL LINE: [System.Diagnostics.DebuggerNonUserCodeAttribute] public string State
|
//ORIGINAL LINE: [System.Diagnostics.DebuggerNonUserCodeAttribute] public string State
|
||||||
public String getState() {
|
public String getState() {
|
||||||
return state_;
|
return state_;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setState(String value) {
|
public void setState(String value) {
|
||||||
state_ = value;
|
state_ = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: C# TO JAVA CONVERTER: Java annotations will not correspond to .NET attributes:
|
// TODO: C# TO JAVA CONVERTER: Java annotations will not correspond to .NET attributes:
|
||||||
//ORIGINAL LINE: [System.Diagnostics.DebuggerNonUserCodeAttribute] public string Street
|
//ORIGINAL LINE: [System.Diagnostics.DebuggerNonUserCodeAttribute] public string Street
|
||||||
public String getStreet() {
|
public String getStreet() {
|
||||||
return street_;
|
return street_;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setStreet(String value) {
|
public void setStreet(String value) {
|
||||||
street_ = value;
|
street_ = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: C# TO JAVA CONVERTER: Java annotations will not correspond to .NET attributes:
|
// TODO: C# TO JAVA CONVERTER: Java annotations will not correspond to .NET attributes:
|
||||||
//ORIGINAL LINE: [System.Diagnostics.DebuggerNonUserCodeAttribute] public int CalculateSize()
|
//ORIGINAL LINE: [System.Diagnostics.DebuggerNonUserCodeAttribute] public int CalculateSize()
|
||||||
public int CalculateSize() {
|
public int CalculateSize() {
|
||||||
int size = 0;
|
int size = 0;
|
||||||
if (street_ != null) {
|
if (street_ != null) {
|
||||||
size += _single_street_codec.CalculateSizeWithTag(getStreet());
|
size += _single_street_codec.CalculateSizeWithTag(getStreet());
|
||||||
}
|
}
|
||||||
if (city_ != null) {
|
if (city_ != null) {
|
||||||
size += _single_city_codec.CalculateSizeWithTag(getCity());
|
size += _single_city_codec.CalculateSizeWithTag(getCity());
|
||||||
}
|
}
|
||||||
if (state_ != null) {
|
if (state_ != null) {
|
||||||
size += _single_state_codec.CalculateSizeWithTag(getState());
|
size += _single_state_codec.CalculateSizeWithTag(getState());
|
||||||
}
|
}
|
||||||
if (postalCode_ != null) {
|
if (postalCode_ != null) {
|
||||||
size += 1 + Google.Protobuf.CodedOutputStream.ComputeMessageSize(getPostalCode());
|
size += 1 + Google.Protobuf.CodedOutputStream.ComputeMessageSize(getPostalCode());
|
||||||
}
|
}
|
||||||
if (_unknownFields != null) {
|
if (_unknownFields != null) {
|
||||||
size += _unknownFields.CalculateSize();
|
size += _unknownFields.CalculateSize();
|
||||||
}
|
}
|
||||||
return size;
|
return size;
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: C# TO JAVA CONVERTER: Java annotations will not correspond to .NET attributes:
|
// TODO: C# TO JAVA CONVERTER: Java annotations will not correspond to .NET attributes:
|
||||||
//ORIGINAL LINE: [System.Diagnostics.DebuggerNonUserCodeAttribute] public Address Clone()
|
//ORIGINAL LINE: [System.Diagnostics.DebuggerNonUserCodeAttribute] public Address Clone()
|
||||||
public Address Clone() {
|
public Address Clone() {
|
||||||
return new Address(this);
|
return new Address(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: C# TO JAVA CONVERTER: Java annotations will not correspond to .NET attributes:
|
// TODO: C# TO JAVA CONVERTER: Java annotations will not correspond to .NET attributes:
|
||||||
//ORIGINAL LINE: [System.Diagnostics.DebuggerNonUserCodeAttribute] public void MergeFrom(Address other)
|
//ORIGINAL LINE: [System.Diagnostics.DebuggerNonUserCodeAttribute] public void MergeFrom(Address other)
|
||||||
public void MergeFrom(Address other) {
|
public void MergeFrom(Address other) {
|
||||||
if (other == null) {
|
if (other == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (other.street_ != null) {
|
if (other.street_ != null) {
|
||||||
if (street_ == null || !other.getStreet().equals("")) {
|
if (street_ == null || !other.getStreet().equals("")) {
|
||||||
setStreet(other.getStreet());
|
setStreet(other.getStreet());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (other.city_ != null) {
|
if (other.city_ != null) {
|
||||||
if (city_ == null || !other.getCity().equals("")) {
|
if (city_ == null || !other.getCity().equals("")) {
|
||||||
setCity(other.getCity());
|
setCity(other.getCity());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (other.state_ != null) {
|
if (other.state_ != null) {
|
||||||
if (state_ == null || !other.getState().equals("")) {
|
if (state_ == null || !other.getState().equals("")) {
|
||||||
setState(other.getState());
|
setState(other.getState());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (other.postalCode_ != null) {
|
if (other.postalCode_ != null) {
|
||||||
if (postalCode_ == null) {
|
if (postalCode_ == null) {
|
||||||
postalCode_ = new PostalCode();
|
postalCode_ = new PostalCode();
|
||||||
}
|
}
|
||||||
getPostalCode().MergeFrom(other.getPostalCode());
|
getPostalCode().MergeFrom(other.getPostalCode());
|
||||||
}
|
}
|
||||||
_unknownFields = Google.Protobuf.UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields);
|
_unknownFields = Google.Protobuf.UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields);
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: C# TO JAVA CONVERTER: Java annotations will not correspond to .NET attributes:
|
// TODO: C# TO JAVA CONVERTER: Java annotations will not correspond to .NET attributes:
|
||||||
//ORIGINAL LINE: [System.Diagnostics.DebuggerNonUserCodeAttribute] public void MergeFrom(Google.Protobuf
|
//ORIGINAL LINE: [System.Diagnostics.DebuggerNonUserCodeAttribute] public void MergeFrom(Google.Protobuf
|
||||||
// .CodedInputStream input)
|
// .CodedInputStream input)
|
||||||
public void MergeFrom(Google.Protobuf.CodedInputStream input) {
|
public void MergeFrom(Google.Protobuf.CodedInputStream input) {
|
||||||
//C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java:
|
//C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java:
|
||||||
//ORIGINAL LINE: uint tag;
|
//ORIGINAL LINE: uint tag;
|
||||||
int tag;
|
int tag;
|
||||||
while ((tag = input.ReadTag()) != 0) {
|
while ((tag = input.ReadTag()) != 0) {
|
||||||
switch (tag) {
|
switch (tag) {
|
||||||
default:
|
default:
|
||||||
_unknownFields = Google.Protobuf.UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
|
_unknownFields = Google.Protobuf.UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
|
||||||
break;
|
break;
|
||||||
case 10: {
|
case 10: {
|
||||||
String value = _single_street_codec.Read(input);
|
String value = _single_street_codec.Read(input);
|
||||||
if (street_ == null || !value.equals("")) {
|
if (street_ == null || !value.equals("")) {
|
||||||
setStreet(value);
|
setStreet(value);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 18: {
|
case 18: {
|
||||||
String value = _single_city_codec.Read(input);
|
String value = _single_city_codec.Read(input);
|
||||||
if (city_ == null || !value.equals("")) {
|
if (city_ == null || !value.equals("")) {
|
||||||
setCity(value);
|
setCity(value);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 26: {
|
case 26: {
|
||||||
String value = _single_state_codec.Read(input);
|
String value = _single_state_codec.Read(input);
|
||||||
if (state_ == null || !value.equals("")) {
|
if (state_ == null || !value.equals("")) {
|
||||||
setState(value);
|
setState(value);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 34: {
|
case 34: {
|
||||||
if (postalCode_ == null) {
|
if (postalCode_ == null) {
|
||||||
postalCode_ = new PostalCode();
|
postalCode_ = new PostalCode();
|
||||||
}
|
}
|
||||||
input.ReadMessage(postalCode_);
|
input.ReadMessage(postalCode_);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: C# TO JAVA CONVERTER: Java annotations will not correspond to .NET attributes:
|
// TODO: C# TO JAVA CONVERTER: Java annotations will not correspond to .NET attributes:
|
||||||
//ORIGINAL LINE: [System.Diagnostics.DebuggerNonUserCodeAttribute] public void WriteTo(Google.Protobuf
|
//ORIGINAL LINE: [System.Diagnostics.DebuggerNonUserCodeAttribute] public void WriteTo(Google.Protobuf
|
||||||
// .CodedOutputStream output)
|
// .CodedOutputStream output)
|
||||||
public void WriteTo(Google.Protobuf.CodedOutputStream output) {
|
public void WriteTo(Google.Protobuf.CodedOutputStream output) {
|
||||||
if (street_ != null) {
|
if (street_ != null) {
|
||||||
_single_street_codec.WriteTagAndValue(output, getStreet());
|
_single_street_codec.WriteTagAndValue(output, getStreet());
|
||||||
}
|
}
|
||||||
if (city_ != null) {
|
if (city_ != null) {
|
||||||
_single_city_codec.WriteTagAndValue(output, getCity());
|
_single_city_codec.WriteTagAndValue(output, getCity());
|
||||||
}
|
}
|
||||||
if (state_ != null) {
|
if (state_ != null) {
|
||||||
_single_state_codec.WriteTagAndValue(output, getState());
|
_single_state_codec.WriteTagAndValue(output, getState());
|
||||||
}
|
}
|
||||||
if (postalCode_ != null) {
|
if (postalCode_ != null) {
|
||||||
output.WriteRawTag(34);
|
output.WriteRawTag(34);
|
||||||
output.WriteMessage(getPostalCode());
|
output.WriteMessage(getPostalCode());
|
||||||
}
|
}
|
||||||
if (_unknownFields != null) {
|
if (_unknownFields != null) {
|
||||||
_unknownFields.WriteTo(output);
|
_unknownFields.WriteTo(output);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: C# TO JAVA CONVERTER: Java annotations will not correspond to .NET attributes:
|
// TODO: C# TO JAVA CONVERTER: Java annotations will not correspond to .NET attributes:
|
||||||
//ORIGINAL LINE: [System.Diagnostics.DebuggerNonUserCodeAttribute] public override bool Equals(object other)
|
//ORIGINAL LINE: [System.Diagnostics.DebuggerNonUserCodeAttribute] public override bool Equals(object other)
|
||||||
@Override
|
@Override
|
||||||
public boolean equals(Object other) {
|
public boolean equals(Object other) {
|
||||||
return Equals(other instanceof Address ? (Address)other : null);
|
return Equals(other instanceof Address ? (Address)other : null);
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: C# TO JAVA CONVERTER: Java annotations will not correspond to .NET attributes:
|
// TODO: C# TO JAVA CONVERTER: Java annotations will not correspond to .NET attributes:
|
||||||
//ORIGINAL LINE: [System.Diagnostics.DebuggerNonUserCodeAttribute] public bool Equals(Address other)
|
//ORIGINAL LINE: [System.Diagnostics.DebuggerNonUserCodeAttribute] public bool Equals(Address other)
|
||||||
public boolean equals(Address other) {
|
public boolean equals(Address other) {
|
||||||
if (ReferenceEquals(other, null)) {
|
if (ReferenceEquals(other, null)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (ReferenceEquals(other, this)) {
|
if (ReferenceEquals(other, this)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (!getStreet().equals(other.getStreet())) {
|
if (!getStreet().equals(other.getStreet())) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (!getCity().equals(other.getCity())) {
|
if (!getCity().equals(other.getCity())) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (!getState().equals(other.getState())) {
|
if (!getState().equals(other.getState())) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (!getPostalCode().equals(other.getPostalCode())) {
|
if (!getPostalCode().equals(other.getPostalCode())) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return Equals(_unknownFields, other._unknownFields);
|
return Equals(_unknownFields, other._unknownFields);
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: C# TO JAVA CONVERTER: Java annotations will not correspond to .NET attributes:
|
// TODO: C# TO JAVA CONVERTER: Java annotations will not correspond to .NET attributes:
|
||||||
//ORIGINAL LINE: [System.Diagnostics.DebuggerNonUserCodeAttribute] public override int GetHashCode()
|
//ORIGINAL LINE: [System.Diagnostics.DebuggerNonUserCodeAttribute] public override int GetHashCode()
|
||||||
@Override
|
@Override
|
||||||
public int hashCode() {
|
public int hashCode() {
|
||||||
int hash = 1;
|
int hash = 1;
|
||||||
if (street_ != null) {
|
if (street_ != null) {
|
||||||
hash ^= getStreet().hashCode();
|
hash ^= getStreet().hashCode();
|
||||||
}
|
}
|
||||||
if (city_ != null) {
|
if (city_ != null) {
|
||||||
hash ^= getCity().hashCode();
|
hash ^= getCity().hashCode();
|
||||||
}
|
}
|
||||||
if (state_ != null) {
|
if (state_ != null) {
|
||||||
hash ^= getState().hashCode();
|
hash ^= getState().hashCode();
|
||||||
}
|
}
|
||||||
if (postalCode_ != null) {
|
if (postalCode_ != null) {
|
||||||
hash ^= getPostalCode().hashCode();
|
hash ^= getPostalCode().hashCode();
|
||||||
}
|
}
|
||||||
if (_unknownFields != null) {
|
if (_unknownFields != null) {
|
||||||
hash ^= _unknownFields.hashCode();
|
hash ^= _unknownFields.hashCode();
|
||||||
}
|
}
|
||||||
return hash;
|
return hash;
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: C# TO JAVA CONVERTER: Java annotations will not correspond to .NET attributes:
|
// TODO: C# TO JAVA CONVERTER: Java annotations will not correspond to .NET attributes:
|
||||||
//ORIGINAL LINE: [System.Diagnostics.DebuggerNonUserCodeAttribute] public override string ToString()
|
//ORIGINAL LINE: [System.Diagnostics.DebuggerNonUserCodeAttribute] public override string ToString()
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return Google.Protobuf.JsonFormatter.ToDiagnosticString(this);
|
return Google.Protobuf.JsonFormatter.ToDiagnosticString(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
+319
-319
@@ -1,320 +1,320 @@
|
|||||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||||
// Licensed under the MIT License.
|
// Licensed under the MIT License.
|
||||||
|
|
||||||
package com.azure.data.cosmos.serialization.hybridrow.perf.cassandrahotel.protobuf;
|
package com.azure.data.cosmos.serialization.hybridrow.perf.cassandrahotel.protobuf;
|
||||||
|
|
||||||
import com.azure.data.cosmos.serialization.hybridrow.perf.*;
|
import com.azure.data.cosmos.serialization.hybridrow.perf.*;
|
||||||
|
|
||||||
// <auto-generated>
|
// <auto-generated>
|
||||||
// Generated by the protocol buffer compiler. DO NOT EDIT!
|
// Generated by the protocol buffer compiler. DO NOT EDIT!
|
||||||
// source: TestData/CassandraHotelSchema.proto
|
// source: TestData/CassandraHotelSchema.proto
|
||||||
// </auto-generated>
|
// </auto-generated>
|
||||||
|
|
||||||
//C# TO JAVA CONVERTER NOTE: There is no Java equivalent to C# namespace aliases:
|
//C# TO JAVA CONVERTER NOTE: There is no Java equivalent to C# namespace aliases:
|
||||||
//using pb = Google.Protobuf;
|
//using pb = Google.Protobuf;
|
||||||
//C# TO JAVA CONVERTER NOTE: There is no Java equivalent to C# namespace aliases:
|
//C# TO JAVA CONVERTER NOTE: There is no Java equivalent to C# namespace aliases:
|
||||||
//using pbc = Google.Protobuf.Collections;
|
//using pbc = Google.Protobuf.Collections;
|
||||||
//C# TO JAVA CONVERTER NOTE: There is no Java equivalent to C# namespace aliases:
|
//C# TO JAVA CONVERTER NOTE: There is no Java equivalent to C# namespace aliases:
|
||||||
//using pbr = Google.Protobuf.Reflection;
|
//using pbr = Google.Protobuf.Reflection;
|
||||||
|
|
||||||
public final class Available_Rooms_By_Hotel_Date implements Google.Protobuf.IMessage<Available_Rooms_By_Hotel_Date> {
|
public final class Available_Rooms_By_Hotel_Date implements Google.Protobuf.IMessage<Available_Rooms_By_Hotel_Date> {
|
||||||
/**
|
/**
|
||||||
* Field number for the "date" field.
|
* Field number for the "date" field.
|
||||||
*/
|
*/
|
||||||
public static final int DateFieldNumber = 2;
|
public static final int DateFieldNumber = 2;
|
||||||
/**
|
/**
|
||||||
* Field number for the "hotel_id" field.
|
* Field number for the "hotel_id" field.
|
||||||
*/
|
*/
|
||||||
public static final int HotelIdFieldNumber = 1;
|
public static final int HotelIdFieldNumber = 1;
|
||||||
/**
|
/**
|
||||||
* Field number for the "is_available" field.
|
* Field number for the "is_available" field.
|
||||||
*/
|
*/
|
||||||
public static final int IsAvailableFieldNumber = 4;
|
public static final int IsAvailableFieldNumber = 4;
|
||||||
/**
|
/**
|
||||||
* Field number for the "room_number" field.
|
* Field number for the "room_number" field.
|
||||||
*/
|
*/
|
||||||
public static final int RoomNumberFieldNumber = 3;
|
public static final int RoomNumberFieldNumber = 3;
|
||||||
private static final Google.Protobuf.MessageParser<Available_Rooms_By_Hotel_Date> _parser =
|
private static final Google.Protobuf.MessageParser<Available_Rooms_By_Hotel_Date> _parser =
|
||||||
new Google.Protobuf.MessageParser<Available_Rooms_By_Hotel_Date>(() -> new Available_Rooms_By_Hotel_Date());
|
new Google.Protobuf.MessageParser<Available_Rooms_By_Hotel_Date>(() -> new Available_Rooms_By_Hotel_Date());
|
||||||
private static final Google.Protobuf.FieldCodec<Long> _single_date_codec =
|
private static final Google.Protobuf.FieldCodec<Long> _single_date_codec =
|
||||||
Google.Protobuf.FieldCodec.<Long>ForStructWrapper(18);
|
Google.Protobuf.FieldCodec.<Long>ForStructWrapper(18);
|
||||||
|
|
||||||
// TODO: C# TO JAVA CONVERTER: Java does not support 'partial' methods:
|
// TODO: C# TO JAVA CONVERTER: Java does not support 'partial' methods:
|
||||||
// partial void OnConstruction();
|
// partial void OnConstruction();
|
||||||
private static final Google.Protobuf.FieldCodec<String> _single_hotelId_codec =
|
private static final Google.Protobuf.FieldCodec<String> _single_hotelId_codec =
|
||||||
Google.Protobuf.FieldCodec.<String>ForClassWrapper(10);
|
Google.Protobuf.FieldCodec.<String>ForClassWrapper(10);
|
||||||
private static final Google.Protobuf.FieldCodec<Boolean> _single_isAvailable_codec =
|
private static final Google.Protobuf.FieldCodec<Boolean> _single_isAvailable_codec =
|
||||||
Google.Protobuf.FieldCodec.<Boolean>ForStructWrapper(34);
|
Google.Protobuf.FieldCodec.<Boolean>ForStructWrapper(34);
|
||||||
private static final Google.Protobuf.FieldCodec<Integer> _single_roomNumber_codec =
|
private static final Google.Protobuf.FieldCodec<Integer> _single_roomNumber_codec =
|
||||||
Google.Protobuf.FieldCodec.<Integer>ForStructWrapper(26);
|
Google.Protobuf.FieldCodec.<Integer>ForStructWrapper(26);
|
||||||
private Google.Protobuf.UnknownFieldSet _unknownFields;
|
private Google.Protobuf.UnknownFieldSet _unknownFields;
|
||||||
private Long date_;
|
private Long date_;
|
||||||
private String hotelId_;
|
private String hotelId_;
|
||||||
private Boolean isAvailable_;
|
private Boolean isAvailable_;
|
||||||
private Integer roomNumber_;
|
private Integer roomNumber_;
|
||||||
// TODO: C# TO JAVA CONVERTER: Java annotations will not correspond to .NET attributes:
|
// TODO: C# TO JAVA CONVERTER: Java annotations will not correspond to .NET attributes:
|
||||||
//ORIGINAL LINE: [System.Diagnostics.DebuggerNonUserCodeAttribute] public Available_Rooms_By_Hotel_Date()
|
//ORIGINAL LINE: [System.Diagnostics.DebuggerNonUserCodeAttribute] public Available_Rooms_By_Hotel_Date()
|
||||||
public Available_Rooms_By_Hotel_Date() {
|
public Available_Rooms_By_Hotel_Date() {
|
||||||
OnConstruction();
|
OnConstruction();
|
||||||
}
|
}
|
||||||
// TODO: C# TO JAVA CONVERTER: Java annotations will not correspond to .NET attributes:
|
// TODO: C# TO JAVA CONVERTER: Java annotations will not correspond to .NET attributes:
|
||||||
//ORIGINAL LINE: [System.Diagnostics.DebuggerNonUserCodeAttribute] public Available_Rooms_By_Hotel_Date
|
//ORIGINAL LINE: [System.Diagnostics.DebuggerNonUserCodeAttribute] public Available_Rooms_By_Hotel_Date
|
||||||
// (Available_Rooms_By_Hotel_Date other)
|
// (Available_Rooms_By_Hotel_Date other)
|
||||||
public Available_Rooms_By_Hotel_Date(Available_Rooms_By_Hotel_Date other) {
|
public Available_Rooms_By_Hotel_Date(Available_Rooms_By_Hotel_Date other) {
|
||||||
this();
|
this();
|
||||||
setHotelId(other.getHotelId());
|
setHotelId(other.getHotelId());
|
||||||
setDate(other.getDate());
|
setDate(other.getDate());
|
||||||
setRoomNumber(other.getRoomNumber());
|
setRoomNumber(other.getRoomNumber());
|
||||||
setIsAvailable(other.getIsAvailable());
|
setIsAvailable(other.getIsAvailable());
|
||||||
_unknownFields = Google.Protobuf.UnknownFieldSet.Clone(other._unknownFields);
|
_unknownFields = Google.Protobuf.UnknownFieldSet.Clone(other._unknownFields);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* datetime
|
* datetime
|
||||||
*/
|
*/
|
||||||
// TODO: C# TO JAVA CONVERTER: Java annotations will not correspond to .NET attributes:
|
// TODO: C# TO JAVA CONVERTER: Java annotations will not correspond to .NET attributes:
|
||||||
//ORIGINAL LINE: [System.Diagnostics.DebuggerNonUserCodeAttribute] public Nullable<long> Date
|
//ORIGINAL LINE: [System.Diagnostics.DebuggerNonUserCodeAttribute] public Nullable<long> Date
|
||||||
public Long getDate() {
|
public Long getDate() {
|
||||||
return date_;
|
return date_;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setDate(Long value) {
|
public void setDate(Long value) {
|
||||||
date_ = value;
|
date_ = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: C# TO JAVA CONVERTER: Java annotations will not correspond to .NET attributes:
|
// TODO: C# TO JAVA CONVERTER: Java annotations will not correspond to .NET attributes:
|
||||||
//ORIGINAL LINE: [System.Diagnostics.DebuggerNonUserCodeAttribute] pbr::MessageDescriptor pb::IMessage.Descriptor
|
//ORIGINAL LINE: [System.Diagnostics.DebuggerNonUserCodeAttribute] pbr::MessageDescriptor pb::IMessage.Descriptor
|
||||||
public Google.Protobuf.Reflection getDescriptor() {
|
public Google.Protobuf.Reflection getDescriptor() {
|
||||||
return getDescriptor();
|
return getDescriptor();
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: C# TO JAVA CONVERTER: Java annotations will not correspond to .NET attributes:
|
// TODO: C# TO JAVA CONVERTER: Java annotations will not correspond to .NET attributes:
|
||||||
//ORIGINAL LINE: [System.Diagnostics.DebuggerNonUserCodeAttribute] public static Google.Protobuf.Reflection
|
//ORIGINAL LINE: [System.Diagnostics.DebuggerNonUserCodeAttribute] public static Google.Protobuf.Reflection
|
||||||
// .MessageDescriptor Descriptor
|
// .MessageDescriptor Descriptor
|
||||||
public static Google.Protobuf.Reflection.MessageDescriptor getDescriptor() {
|
public static Google.Protobuf.Reflection.MessageDescriptor getDescriptor() {
|
||||||
return CassandraHotelSchemaReflection.getDescriptor().MessageTypes[3];
|
return CassandraHotelSchemaReflection.getDescriptor().MessageTypes[3];
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: C# TO JAVA CONVERTER: Java annotations will not correspond to .NET attributes:
|
// TODO: C# TO JAVA CONVERTER: Java annotations will not correspond to .NET attributes:
|
||||||
//ORIGINAL LINE: [System.Diagnostics.DebuggerNonUserCodeAttribute] public string HotelId
|
//ORIGINAL LINE: [System.Diagnostics.DebuggerNonUserCodeAttribute] public string HotelId
|
||||||
public String getHotelId() {
|
public String getHotelId() {
|
||||||
return hotelId_;
|
return hotelId_;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setHotelId(String value) {
|
public void setHotelId(String value) {
|
||||||
hotelId_ = value;
|
hotelId_ = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: C# TO JAVA CONVERTER: Java annotations will not correspond to .NET attributes:
|
// TODO: C# TO JAVA CONVERTER: Java annotations will not correspond to .NET attributes:
|
||||||
//ORIGINAL LINE: [System.Diagnostics.DebuggerNonUserCodeAttribute] public Nullable<bool> IsAvailable
|
//ORIGINAL LINE: [System.Diagnostics.DebuggerNonUserCodeAttribute] public Nullable<bool> IsAvailable
|
||||||
public Boolean getIsAvailable() {
|
public Boolean getIsAvailable() {
|
||||||
return isAvailable_;
|
return isAvailable_;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setIsAvailable(Boolean value) {
|
public void setIsAvailable(Boolean value) {
|
||||||
isAvailable_ = value;
|
isAvailable_ = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: C# TO JAVA CONVERTER: Java annotations will not correspond to .NET attributes:
|
// TODO: C# TO JAVA CONVERTER: Java annotations will not correspond to .NET attributes:
|
||||||
//ORIGINAL LINE: [System.Diagnostics.DebuggerNonUserCodeAttribute] public static Google.Protobuf
|
//ORIGINAL LINE: [System.Diagnostics.DebuggerNonUserCodeAttribute] public static Google.Protobuf
|
||||||
// .MessageParser<Available_Rooms_By_Hotel_Date> Parser
|
// .MessageParser<Available_Rooms_By_Hotel_Date> Parser
|
||||||
public static Google.Protobuf.MessageParser<Available_Rooms_By_Hotel_Date> getParser() {
|
public static Google.Protobuf.MessageParser<Available_Rooms_By_Hotel_Date> getParser() {
|
||||||
return _parser;
|
return _parser;
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: C# TO JAVA CONVERTER: Java annotations will not correspond to .NET attributes:
|
// TODO: C# TO JAVA CONVERTER: Java annotations will not correspond to .NET attributes:
|
||||||
//ORIGINAL LINE: [System.Diagnostics.DebuggerNonUserCodeAttribute] public Nullable<int> RoomNumber
|
//ORIGINAL LINE: [System.Diagnostics.DebuggerNonUserCodeAttribute] public Nullable<int> RoomNumber
|
||||||
public Integer getRoomNumber() {
|
public Integer getRoomNumber() {
|
||||||
return roomNumber_;
|
return roomNumber_;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setRoomNumber(Integer value) {
|
public void setRoomNumber(Integer value) {
|
||||||
roomNumber_ = value;
|
roomNumber_ = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: C# TO JAVA CONVERTER: Java annotations will not correspond to .NET attributes:
|
// TODO: C# TO JAVA CONVERTER: Java annotations will not correspond to .NET attributes:
|
||||||
//ORIGINAL LINE: [System.Diagnostics.DebuggerNonUserCodeAttribute] public int CalculateSize()
|
//ORIGINAL LINE: [System.Diagnostics.DebuggerNonUserCodeAttribute] public int CalculateSize()
|
||||||
public int CalculateSize() {
|
public int CalculateSize() {
|
||||||
int size = 0;
|
int size = 0;
|
||||||
if (hotelId_ != null) {
|
if (hotelId_ != null) {
|
||||||
size += _single_hotelId_codec.CalculateSizeWithTag(getHotelId());
|
size += _single_hotelId_codec.CalculateSizeWithTag(getHotelId());
|
||||||
}
|
}
|
||||||
if (date_ != null) {
|
if (date_ != null) {
|
||||||
size += _single_date_codec.CalculateSizeWithTag(getDate());
|
size += _single_date_codec.CalculateSizeWithTag(getDate());
|
||||||
}
|
}
|
||||||
if (roomNumber_ != null) {
|
if (roomNumber_ != null) {
|
||||||
size += _single_roomNumber_codec.CalculateSizeWithTag(getRoomNumber());
|
size += _single_roomNumber_codec.CalculateSizeWithTag(getRoomNumber());
|
||||||
}
|
}
|
||||||
if (isAvailable_ != null) {
|
if (isAvailable_ != null) {
|
||||||
size += _single_isAvailable_codec.CalculateSizeWithTag(getIsAvailable());
|
size += _single_isAvailable_codec.CalculateSizeWithTag(getIsAvailable());
|
||||||
}
|
}
|
||||||
if (_unknownFields != null) {
|
if (_unknownFields != null) {
|
||||||
size += _unknownFields.CalculateSize();
|
size += _unknownFields.CalculateSize();
|
||||||
}
|
}
|
||||||
return size;
|
return size;
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: C# TO JAVA CONVERTER: Java annotations will not correspond to .NET attributes:
|
// TODO: C# TO JAVA CONVERTER: Java annotations will not correspond to .NET attributes:
|
||||||
//ORIGINAL LINE: [System.Diagnostics.DebuggerNonUserCodeAttribute] public Available_Rooms_By_Hotel_Date Clone()
|
//ORIGINAL LINE: [System.Diagnostics.DebuggerNonUserCodeAttribute] public Available_Rooms_By_Hotel_Date Clone()
|
||||||
public Available_Rooms_By_Hotel_Date Clone() {
|
public Available_Rooms_By_Hotel_Date Clone() {
|
||||||
return new Available_Rooms_By_Hotel_Date(this);
|
return new Available_Rooms_By_Hotel_Date(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: C# TO JAVA CONVERTER: Java annotations will not correspond to .NET attributes:
|
// TODO: C# TO JAVA CONVERTER: Java annotations will not correspond to .NET attributes:
|
||||||
//ORIGINAL LINE: [System.Diagnostics.DebuggerNonUserCodeAttribute] public void MergeFrom
|
//ORIGINAL LINE: [System.Diagnostics.DebuggerNonUserCodeAttribute] public void MergeFrom
|
||||||
// (Available_Rooms_By_Hotel_Date other)
|
// (Available_Rooms_By_Hotel_Date other)
|
||||||
public void MergeFrom(Available_Rooms_By_Hotel_Date other) {
|
public void MergeFrom(Available_Rooms_By_Hotel_Date other) {
|
||||||
if (other == null) {
|
if (other == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (other.hotelId_ != null) {
|
if (other.hotelId_ != null) {
|
||||||
if (hotelId_ == null || !other.getHotelId().equals("")) {
|
if (hotelId_ == null || !other.getHotelId().equals("")) {
|
||||||
setHotelId(other.getHotelId());
|
setHotelId(other.getHotelId());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (other.date_ != null) {
|
if (other.date_ != null) {
|
||||||
if (date_ == null || other.getDate() != 0L) {
|
if (date_ == null || other.getDate() != 0L) {
|
||||||
setDate(other.getDate());
|
setDate(other.getDate());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (other.roomNumber_ != null) {
|
if (other.roomNumber_ != null) {
|
||||||
if (roomNumber_ == null || other.getRoomNumber() != 0) {
|
if (roomNumber_ == null || other.getRoomNumber() != 0) {
|
||||||
setRoomNumber(other.getRoomNumber());
|
setRoomNumber(other.getRoomNumber());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (other.isAvailable_ != null) {
|
if (other.isAvailable_ != null) {
|
||||||
if (isAvailable_ == null || other.getIsAvailable() != false) {
|
if (isAvailable_ == null || other.getIsAvailable() != false) {
|
||||||
setIsAvailable(other.getIsAvailable());
|
setIsAvailable(other.getIsAvailable());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
_unknownFields = Google.Protobuf.UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields);
|
_unknownFields = Google.Protobuf.UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields);
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: C# TO JAVA CONVERTER: Java annotations will not correspond to .NET attributes:
|
// TODO: C# TO JAVA CONVERTER: Java annotations will not correspond to .NET attributes:
|
||||||
//ORIGINAL LINE: [System.Diagnostics.DebuggerNonUserCodeAttribute] public void MergeFrom(Google.Protobuf
|
//ORIGINAL LINE: [System.Diagnostics.DebuggerNonUserCodeAttribute] public void MergeFrom(Google.Protobuf
|
||||||
// .CodedInputStream input)
|
// .CodedInputStream input)
|
||||||
public void MergeFrom(Google.Protobuf.CodedInputStream input) {
|
public void MergeFrom(Google.Protobuf.CodedInputStream input) {
|
||||||
//C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java:
|
//C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java:
|
||||||
//ORIGINAL LINE: uint tag;
|
//ORIGINAL LINE: uint tag;
|
||||||
int tag;
|
int tag;
|
||||||
while ((tag = input.ReadTag()) != 0) {
|
while ((tag = input.ReadTag()) != 0) {
|
||||||
switch (tag) {
|
switch (tag) {
|
||||||
default:
|
default:
|
||||||
_unknownFields = Google.Protobuf.UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
|
_unknownFields = Google.Protobuf.UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
|
||||||
break;
|
break;
|
||||||
case 10: {
|
case 10: {
|
||||||
String value = _single_hotelId_codec.Read(input);
|
String value = _single_hotelId_codec.Read(input);
|
||||||
if (hotelId_ == null || !value.equals("")) {
|
if (hotelId_ == null || !value.equals("")) {
|
||||||
setHotelId(value);
|
setHotelId(value);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 18: {
|
case 18: {
|
||||||
Long value = _single_date_codec.Read(input);
|
Long value = _single_date_codec.Read(input);
|
||||||
if (date_ == null || value != 0L) {
|
if (date_ == null || value != 0L) {
|
||||||
setDate(value);
|
setDate(value);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 26: {
|
case 26: {
|
||||||
Integer value = _single_roomNumber_codec.Read(input);
|
Integer value = _single_roomNumber_codec.Read(input);
|
||||||
if (roomNumber_ == null || value != 0) {
|
if (roomNumber_ == null || value != 0) {
|
||||||
setRoomNumber(value);
|
setRoomNumber(value);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 34: {
|
case 34: {
|
||||||
Boolean value = _single_isAvailable_codec.Read(input);
|
Boolean value = _single_isAvailable_codec.Read(input);
|
||||||
if (isAvailable_ == null || value != false) {
|
if (isAvailable_ == null || value != false) {
|
||||||
setIsAvailable(value);
|
setIsAvailable(value);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: C# TO JAVA CONVERTER: Java annotations will not correspond to .NET attributes:
|
// TODO: C# TO JAVA CONVERTER: Java annotations will not correspond to .NET attributes:
|
||||||
//ORIGINAL LINE: [System.Diagnostics.DebuggerNonUserCodeAttribute] public void WriteTo(Google.Protobuf
|
//ORIGINAL LINE: [System.Diagnostics.DebuggerNonUserCodeAttribute] public void WriteTo(Google.Protobuf
|
||||||
// .CodedOutputStream output)
|
// .CodedOutputStream output)
|
||||||
public void WriteTo(Google.Protobuf.CodedOutputStream output) {
|
public void WriteTo(Google.Protobuf.CodedOutputStream output) {
|
||||||
if (hotelId_ != null) {
|
if (hotelId_ != null) {
|
||||||
_single_hotelId_codec.WriteTagAndValue(output, getHotelId());
|
_single_hotelId_codec.WriteTagAndValue(output, getHotelId());
|
||||||
}
|
}
|
||||||
if (date_ != null) {
|
if (date_ != null) {
|
||||||
_single_date_codec.WriteTagAndValue(output, getDate());
|
_single_date_codec.WriteTagAndValue(output, getDate());
|
||||||
}
|
}
|
||||||
if (roomNumber_ != null) {
|
if (roomNumber_ != null) {
|
||||||
_single_roomNumber_codec.WriteTagAndValue(output, getRoomNumber());
|
_single_roomNumber_codec.WriteTagAndValue(output, getRoomNumber());
|
||||||
}
|
}
|
||||||
if (isAvailable_ != null) {
|
if (isAvailable_ != null) {
|
||||||
_single_isAvailable_codec.WriteTagAndValue(output, getIsAvailable());
|
_single_isAvailable_codec.WriteTagAndValue(output, getIsAvailable());
|
||||||
}
|
}
|
||||||
if (_unknownFields != null) {
|
if (_unknownFields != null) {
|
||||||
_unknownFields.WriteTo(output);
|
_unknownFields.WriteTo(output);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: C# TO JAVA CONVERTER: Java annotations will not correspond to .NET attributes:
|
// TODO: C# TO JAVA CONVERTER: Java annotations will not correspond to .NET attributes:
|
||||||
//ORIGINAL LINE: [System.Diagnostics.DebuggerNonUserCodeAttribute] public override bool Equals(object other)
|
//ORIGINAL LINE: [System.Diagnostics.DebuggerNonUserCodeAttribute] public override bool Equals(object other)
|
||||||
@Override
|
@Override
|
||||||
public boolean equals(Object other) {
|
public boolean equals(Object other) {
|
||||||
return Equals(other instanceof Available_Rooms_By_Hotel_Date ? (Available_Rooms_By_Hotel_Date)other : null);
|
return Equals(other instanceof Available_Rooms_By_Hotel_Date ? (Available_Rooms_By_Hotel_Date)other : null);
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: C# TO JAVA CONVERTER: Java annotations will not correspond to .NET attributes:
|
// TODO: C# TO JAVA CONVERTER: Java annotations will not correspond to .NET attributes:
|
||||||
//ORIGINAL LINE: [System.Diagnostics.DebuggerNonUserCodeAttribute] public bool Equals
|
//ORIGINAL LINE: [System.Diagnostics.DebuggerNonUserCodeAttribute] public bool Equals
|
||||||
// (Available_Rooms_By_Hotel_Date other)
|
// (Available_Rooms_By_Hotel_Date other)
|
||||||
public boolean equals(Available_Rooms_By_Hotel_Date other) {
|
public boolean equals(Available_Rooms_By_Hotel_Date other) {
|
||||||
if (ReferenceEquals(other, null)) {
|
if (ReferenceEquals(other, null)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (ReferenceEquals(other, this)) {
|
if (ReferenceEquals(other, this)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (!getHotelId().equals(other.getHotelId())) {
|
if (!getHotelId().equals(other.getHotelId())) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (getDate() != other.getDate()) {
|
if (getDate() != other.getDate()) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (getRoomNumber() != other.getRoomNumber()) {
|
if (getRoomNumber() != other.getRoomNumber()) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (getIsAvailable() != other.getIsAvailable()) {
|
if (getIsAvailable() != other.getIsAvailable()) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return Equals(_unknownFields, other._unknownFields);
|
return Equals(_unknownFields, other._unknownFields);
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: C# TO JAVA CONVERTER: Java annotations will not correspond to .NET attributes:
|
// TODO: C# TO JAVA CONVERTER: Java annotations will not correspond to .NET attributes:
|
||||||
//ORIGINAL LINE: [System.Diagnostics.DebuggerNonUserCodeAttribute] public override int GetHashCode()
|
//ORIGINAL LINE: [System.Diagnostics.DebuggerNonUserCodeAttribute] public override int GetHashCode()
|
||||||
@Override
|
@Override
|
||||||
public int hashCode() {
|
public int hashCode() {
|
||||||
int hash = 1;
|
int hash = 1;
|
||||||
if (hotelId_ != null) {
|
if (hotelId_ != null) {
|
||||||
hash ^= getHotelId().hashCode();
|
hash ^= getHotelId().hashCode();
|
||||||
}
|
}
|
||||||
if (date_ != null) {
|
if (date_ != null) {
|
||||||
hash ^= getDate().hashCode();
|
hash ^= getDate().hashCode();
|
||||||
}
|
}
|
||||||
if (roomNumber_ != null) {
|
if (roomNumber_ != null) {
|
||||||
hash ^= getRoomNumber().hashCode();
|
hash ^= getRoomNumber().hashCode();
|
||||||
}
|
}
|
||||||
if (isAvailable_ != null) {
|
if (isAvailable_ != null) {
|
||||||
hash ^= getIsAvailable().hashCode();
|
hash ^= getIsAvailable().hashCode();
|
||||||
}
|
}
|
||||||
if (_unknownFields != null) {
|
if (_unknownFields != null) {
|
||||||
hash ^= _unknownFields.hashCode();
|
hash ^= _unknownFields.hashCode();
|
||||||
}
|
}
|
||||||
return hash;
|
return hash;
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: C# TO JAVA CONVERTER: Java annotations will not correspond to .NET attributes:
|
// TODO: C# TO JAVA CONVERTER: Java annotations will not correspond to .NET attributes:
|
||||||
//ORIGINAL LINE: [System.Diagnostics.DebuggerNonUserCodeAttribute] public override string ToString()
|
//ORIGINAL LINE: [System.Diagnostics.DebuggerNonUserCodeAttribute] public override string ToString()
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return Google.Protobuf.JsonFormatter.ToDiagnosticString(this);
|
return Google.Protobuf.JsonFormatter.ToDiagnosticString(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
+119
-119
@@ -1,120 +1,120 @@
|
|||||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||||
// Licensed under the MIT License.
|
// Licensed under the MIT License.
|
||||||
|
|
||||||
package com.azure.data.cosmos.serialization.hybridrow.perf.cassandrahotel.protobuf;
|
package com.azure.data.cosmos.serialization.hybridrow.perf.cassandrahotel.protobuf;
|
||||||
|
|
||||||
import com.azure.data.cosmos.serialization.hybridrow.perf.*;
|
import com.azure.data.cosmos.serialization.hybridrow.perf.*;
|
||||||
|
|
||||||
// <auto-generated>
|
// <auto-generated>
|
||||||
// Generated by the protocol buffer compiler. DO NOT EDIT!
|
// Generated by the protocol buffer compiler. DO NOT EDIT!
|
||||||
// source: TestData/CassandraHotelSchema.proto
|
// source: TestData/CassandraHotelSchema.proto
|
||||||
// </auto-generated>
|
// </auto-generated>
|
||||||
|
|
||||||
//C# TO JAVA CONVERTER NOTE: There is no Java equivalent to C# namespace aliases:
|
//C# TO JAVA CONVERTER NOTE: There is no Java equivalent to C# namespace aliases:
|
||||||
//using pb = Google.Protobuf;
|
//using pb = Google.Protobuf;
|
||||||
//C# TO JAVA CONVERTER NOTE: There is no Java equivalent to C# namespace aliases:
|
//C# TO JAVA CONVERTER NOTE: There is no Java equivalent to C# namespace aliases:
|
||||||
//using pbc = Google.Protobuf.Collections;
|
//using pbc = Google.Protobuf.Collections;
|
||||||
//C# TO JAVA CONVERTER NOTE: There is no Java equivalent to C# namespace aliases:
|
//C# TO JAVA CONVERTER NOTE: There is no Java equivalent to C# namespace aliases:
|
||||||
//using pbr = Google.Protobuf.Reflection;
|
//using pbr = Google.Protobuf.Reflection;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Holder for reflection information generated from TestData/CassandraHotelSchema.proto
|
* Holder for reflection information generated from TestData/CassandraHotelSchema.proto
|
||||||
*/
|
*/
|
||||||
public final class CassandraHotelSchemaReflection {
|
public final class CassandraHotelSchemaReflection {
|
||||||
|
|
||||||
// TODO: C# TO JAVA CONVERTER: There is no preprocessor in Java:
|
// TODO: C# TO JAVA CONVERTER: There is no preprocessor in Java:
|
||||||
///#region Descriptor
|
///#region Descriptor
|
||||||
|
|
||||||
private static Google.Protobuf.Reflection.FileDescriptor descriptor;
|
private static Google.Protobuf.Reflection.FileDescriptor descriptor;
|
||||||
|
|
||||||
static {
|
static {
|
||||||
//C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java:
|
//C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java:
|
||||||
//ORIGINAL LINE: byte[] descriptorData = System.Convert.FromBase64String(string.Concat
|
//ORIGINAL LINE: byte[] descriptorData = System.Convert.FromBase64String(string.Concat
|
||||||
// ("CiNUZXN0RGF0YS9DYXNzYW5kcmFIb3RlbFNjaGVtYS5wcm90bxJITWljcm9z",
|
// ("CiNUZXN0RGF0YS9DYXNzYW5kcmFIb3RlbFNjaGVtYS5wcm90bxJITWljcm9z",
|
||||||
// "b2Z0LkF6dXJlLkNvc21vcy5TZXJpYWxpemF0aW9uLkh5YnJpZFJvdy5UZXN0",
|
// "b2Z0LkF6dXJlLkNvc21vcy5TZXJpYWxpemF0aW9uLkh5YnJpZFJvdy5UZXN0",
|
||||||
// "cy5QZXJmLkNhc3NhbmRyYUhvdGVsGh5nb29nbGUvcHJvdG9idWYvd3JhcHBl",
|
// "cy5QZXJmLkNhc3NhbmRyYUhvdGVsGh5nb29nbGUvcHJvdG9idWYvd3JhcHBl",
|
||||||
// "cnMucHJvdG8iYgoKUG9zdGFsQ29kZRIoCgN6aXAYASABKAsyGy5nb29nbGUu",
|
// "cnMucHJvdG8iYgoKUG9zdGFsQ29kZRIoCgN6aXAYASABKAsyGy5nb29nbGUu",
|
||||||
// "cHJvdG9idWYuSW50MzJWYWx1ZRIqCgVwbHVzNBgCIAEoCzIbLmdvb2dsZS5w",
|
// "cHJvdG9idWYuSW50MzJWYWx1ZRIqCgVwbHVzNBgCIAEoCzIbLmdvb2dsZS5w",
|
||||||
// "cm90b2J1Zi5JbnQzMlZhbHVlIvsBCgdBZGRyZXNzEiwKBnN0cmVldBgBIAEo",
|
// "cm90b2J1Zi5JbnQzMlZhbHVlIvsBCgdBZGRyZXNzEiwKBnN0cmVldBgBIAEo",
|
||||||
// "CzIcLmdvb2dsZS5wcm90b2J1Zi5TdHJpbmdWYWx1ZRIqCgRjaXR5GAIgASgL",
|
// "CzIcLmdvb2dsZS5wcm90b2J1Zi5TdHJpbmdWYWx1ZRIqCgRjaXR5GAIgASgL",
|
||||||
// "MhwuZ29vZ2xlLnByb3RvYnVmLlN0cmluZ1ZhbHVlEisKBXN0YXRlGAMgASgL",
|
// "MhwuZ29vZ2xlLnByb3RvYnVmLlN0cmluZ1ZhbHVlEisKBXN0YXRlGAMgASgL",
|
||||||
// "MhwuZ29vZ2xlLnByb3RvYnVmLlN0cmluZ1ZhbHVlEmkKC3Bvc3RhbF9jb2Rl",
|
// "MhwuZ29vZ2xlLnByb3RvYnVmLlN0cmluZ1ZhbHVlEmkKC3Bvc3RhbF9jb2Rl",
|
||||||
// "GAQgASgLMlQuTWljcm9zb2Z0LkF6dXJlLkNvc21vcy5TZXJpYWxpemF0aW9u",
|
// "GAQgASgLMlQuTWljcm9zb2Z0LkF6dXJlLkNvc21vcy5TZXJpYWxpemF0aW9u",
|
||||||
// "Lkh5YnJpZFJvdy5UZXN0cy5QZXJmLkNhc3NhbmRyYUhvdGVsLlBvc3RhbENv",
|
// "Lkh5YnJpZFJvdy5UZXN0cy5QZXJmLkNhc3NhbmRyYUhvdGVsLlBvc3RhbENv",
|
||||||
// "ZGUi9QEKBkhvdGVscxIuCghob3RlbF9pZBgBIAEoCzIcLmdvb2dsZS5wcm90",
|
// "ZGUi9QEKBkhvdGVscxIuCghob3RlbF9pZBgBIAEoCzIcLmdvb2dsZS5wcm90",
|
||||||
// "b2J1Zi5TdHJpbmdWYWx1ZRIqCgRuYW1lGAIgASgLMhwuZ29vZ2xlLnByb3Rv",
|
// "b2J1Zi5TdHJpbmdWYWx1ZRIqCgRuYW1lGAIgASgLMhwuZ29vZ2xlLnByb3Rv",
|
||||||
// "YnVmLlN0cmluZ1ZhbHVlEisKBXBob25lGAMgASgLMhwuZ29vZ2xlLnByb3Rv",
|
// "YnVmLlN0cmluZ1ZhbHVlEisKBXBob25lGAMgASgLMhwuZ29vZ2xlLnByb3Rv",
|
||||||
// "YnVmLlN0cmluZ1ZhbHVlEmIKB2FkZHJlc3MYBCABKAsyUS5NaWNyb3NvZnQu",
|
// "YnVmLlN0cmluZ1ZhbHVlEmIKB2FkZHJlc3MYBCABKAsyUS5NaWNyb3NvZnQu",
|
||||||
// "QXp1cmUuQ29zbW9zLlNlcmlhbGl6YXRpb24uSHlicmlkUm93LlRlc3RzLlBl",
|
// "QXp1cmUuQ29zbW9zLlNlcmlhbGl6YXRpb24uSHlicmlkUm93LlRlc3RzLlBl",
|
||||||
// "cmYuQ2Fzc2FuZHJhSG90ZWwuQWRkcmVzcyLeAQodQXZhaWxhYmxlX1Jvb21z",
|
// "cmYuQ2Fzc2FuZHJhSG90ZWwuQWRkcmVzcyLeAQodQXZhaWxhYmxlX1Jvb21z",
|
||||||
// "X0J5X0hvdGVsX0RhdGUSLgoIaG90ZWxfaWQYASABKAsyHC5nb29nbGUucHJv",
|
// "X0J5X0hvdGVsX0RhdGUSLgoIaG90ZWxfaWQYASABKAsyHC5nb29nbGUucHJv",
|
||||||
// "dG9idWYuU3RyaW5nVmFsdWUSKQoEZGF0ZRgCIAEoCzIbLmdvb2dsZS5wcm90",
|
// "dG9idWYuU3RyaW5nVmFsdWUSKQoEZGF0ZRgCIAEoCzIbLmdvb2dsZS5wcm90",
|
||||||
// "b2J1Zi5JbnQ2NFZhbHVlEjAKC3Jvb21fbnVtYmVyGAMgASgLMhsuZ29vZ2xl",
|
// "b2J1Zi5JbnQ2NFZhbHVlEjAKC3Jvb21fbnVtYmVyGAMgASgLMhsuZ29vZ2xl",
|
||||||
// "LnByb3RvYnVmLkludDMyVmFsdWUSMAoMaXNfYXZhaWxhYmxlGAQgASgLMhou",
|
// "LnByb3RvYnVmLkludDMyVmFsdWUSMAoMaXNfYXZhaWxhYmxlGAQgASgLMhou",
|
||||||
// "Z29vZ2xlLnByb3RvYnVmLkJvb2xWYWx1ZSKfBAoGR3Vlc3RzEi4KCGd1ZXN0",
|
// "Z29vZ2xlLnByb3RvYnVmLkJvb2xWYWx1ZSKfBAoGR3Vlc3RzEi4KCGd1ZXN0",
|
||||||
// "X2lkGAEgASgLMhwuZ29vZ2xlLnByb3RvYnVmLlN0cmluZ1ZhbHVlEjAKCmZp",
|
// "X2lkGAEgASgLMhwuZ29vZ2xlLnByb3RvYnVmLlN0cmluZ1ZhbHVlEjAKCmZp",
|
||||||
// "cnN0X25hbWUYAiABKAsyHC5nb29nbGUucHJvdG9idWYuU3RyaW5nVmFsdWUS",
|
// "cnN0X25hbWUYAiABKAsyHC5nb29nbGUucHJvdG9idWYuU3RyaW5nVmFsdWUS",
|
||||||
// "LwoJbGFzdF9uYW1lGAMgASgLMhwuZ29vZ2xlLnByb3RvYnVmLlN0cmluZ1Zh",
|
// "LwoJbGFzdF9uYW1lGAMgASgLMhwuZ29vZ2xlLnByb3RvYnVmLlN0cmluZ1Zh",
|
||||||
// "bHVlEisKBXRpdGxlGAQgASgLMhwuZ29vZ2xlLnByb3RvYnVmLlN0cmluZ1Zh",
|
// "bHVlEisKBXRpdGxlGAQgASgLMhwuZ29vZ2xlLnByb3RvYnVmLlN0cmluZ1Zh",
|
||||||
// "bHVlEg4KBmVtYWlscxgFIAMoCRIVCg1waG9uZV9udW1iZXJzGAYgAygJEnIK",
|
// "bHVlEg4KBmVtYWlscxgFIAMoCRIVCg1waG9uZV9udW1iZXJzGAYgAygJEnIK",
|
||||||
// "CWFkZHJlc3NlcxgHIAMoCzJfLk1pY3Jvc29mdC5BenVyZS5Db3Ntb3MuU2Vy",
|
// "CWFkZHJlc3NlcxgHIAMoCzJfLk1pY3Jvc29mdC5BenVyZS5Db3Ntb3MuU2Vy",
|
||||||
// "aWFsaXphdGlvbi5IeWJyaWRSb3cuVGVzdHMuUGVyZi5DYXNzYW5kcmFIb3Rl",
|
// "aWFsaXphdGlvbi5IeWJyaWRSb3cuVGVzdHMuUGVyZi5DYXNzYW5kcmFIb3Rl",
|
||||||
// "bC5HdWVzdHMuQWRkcmVzc2VzRW50cnkSNAoOY29uZmlybV9udW1iZXIYCCAB",
|
// "bC5HdWVzdHMuQWRkcmVzc2VzRW50cnkSNAoOY29uZmlybV9udW1iZXIYCCAB",
|
||||||
// "KAsyHC5nb29nbGUucHJvdG9idWYuU3RyaW5nVmFsdWUagwEKDkFkZHJlc3Nl",
|
// "KAsyHC5nb29nbGUucHJvdG9idWYuU3RyaW5nVmFsdWUagwEKDkFkZHJlc3Nl",
|
||||||
// "c0VudHJ5EgsKA2tleRgBIAEoCRJgCgV2YWx1ZRgCIAEoCzJRLk1pY3Jvc29m",
|
// "c0VudHJ5EgsKA2tleRgBIAEoCRJgCgV2YWx1ZRgCIAEoCzJRLk1pY3Jvc29m",
|
||||||
// "dC5BenVyZS5Db3Ntb3MuU2VyaWFsaXphdGlvbi5IeWJyaWRSb3cuVGVzdHMu",
|
// "dC5BenVyZS5Db3Ntb3MuU2VyaWFsaXphdGlvbi5IeWJyaWRSb3cuVGVzdHMu",
|
||||||
// "UGVyZi5DYXNzYW5kcmFIb3RlbC5BZGRyZXNzOgI4AUJUqgJRTWljcm9zb2Z0",
|
// "UGVyZi5DYXNzYW5kcmFIb3RlbC5BZGRyZXNzOgI4AUJUqgJRTWljcm9zb2Z0",
|
||||||
// "LkF6dXJlLkNvc21vcy5TZXJpYWxpemF0aW9uLkh5YnJpZFJvdy5UZXN0cy5Q",
|
// "LkF6dXJlLkNvc21vcy5TZXJpYWxpemF0aW9uLkh5YnJpZFJvdy5UZXN0cy5Q",
|
||||||
// "ZXJmLkNhc3NhbmRyYUhvdGVsLlByb3RvYnVmYgZwcm90bzM="));
|
// "ZXJmLkNhc3NhbmRyYUhvdGVsLlByb3RvYnVmYgZwcm90bzM="));
|
||||||
byte[] descriptorData = System.Convert.FromBase64String(String.Concat(
|
byte[] descriptorData = System.Convert.FromBase64String(String.Concat(
|
||||||
"CiNUZXN0RGF0YS9DYXNzYW5kcmFIb3RlbFNjaGVtYS5wcm90bxJITWljcm9z",
|
"CiNUZXN0RGF0YS9DYXNzYW5kcmFIb3RlbFNjaGVtYS5wcm90bxJITWljcm9z",
|
||||||
"b2Z0LkF6dXJlLkNvc21vcy5TZXJpYWxpemF0aW9uLkh5YnJpZFJvdy5UZXN0",
|
"b2Z0LkF6dXJlLkNvc21vcy5TZXJpYWxpemF0aW9uLkh5YnJpZFJvdy5UZXN0",
|
||||||
"cy5QZXJmLkNhc3NhbmRyYUhvdGVsGh5nb29nbGUvcHJvdG9idWYvd3JhcHBl",
|
"cy5QZXJmLkNhc3NhbmRyYUhvdGVsGh5nb29nbGUvcHJvdG9idWYvd3JhcHBl",
|
||||||
"cnMucHJvdG8iYgoKUG9zdGFsQ29kZRIoCgN6aXAYASABKAsyGy5nb29nbGUu",
|
"cnMucHJvdG8iYgoKUG9zdGFsQ29kZRIoCgN6aXAYASABKAsyGy5nb29nbGUu",
|
||||||
"cHJvdG9idWYuSW50MzJWYWx1ZRIqCgVwbHVzNBgCIAEoCzIbLmdvb2dsZS5w",
|
"cHJvdG9idWYuSW50MzJWYWx1ZRIqCgVwbHVzNBgCIAEoCzIbLmdvb2dsZS5w",
|
||||||
"cm90b2J1Zi5JbnQzMlZhbHVlIvsBCgdBZGRyZXNzEiwKBnN0cmVldBgBIAEo",
|
"cm90b2J1Zi5JbnQzMlZhbHVlIvsBCgdBZGRyZXNzEiwKBnN0cmVldBgBIAEo",
|
||||||
"CzIcLmdvb2dsZS5wcm90b2J1Zi5TdHJpbmdWYWx1ZRIqCgRjaXR5GAIgASgL",
|
"CzIcLmdvb2dsZS5wcm90b2J1Zi5TdHJpbmdWYWx1ZRIqCgRjaXR5GAIgASgL",
|
||||||
"MhwuZ29vZ2xlLnByb3RvYnVmLlN0cmluZ1ZhbHVlEisKBXN0YXRlGAMgASgL",
|
"MhwuZ29vZ2xlLnByb3RvYnVmLlN0cmluZ1ZhbHVlEisKBXN0YXRlGAMgASgL",
|
||||||
"MhwuZ29vZ2xlLnByb3RvYnVmLlN0cmluZ1ZhbHVlEmkKC3Bvc3RhbF9jb2Rl",
|
"MhwuZ29vZ2xlLnByb3RvYnVmLlN0cmluZ1ZhbHVlEmkKC3Bvc3RhbF9jb2Rl",
|
||||||
"GAQgASgLMlQuTWljcm9zb2Z0LkF6dXJlLkNvc21vcy5TZXJpYWxpemF0aW9u",
|
"GAQgASgLMlQuTWljcm9zb2Z0LkF6dXJlLkNvc21vcy5TZXJpYWxpemF0aW9u",
|
||||||
"Lkh5YnJpZFJvdy5UZXN0cy5QZXJmLkNhc3NhbmRyYUhvdGVsLlBvc3RhbENv",
|
"Lkh5YnJpZFJvdy5UZXN0cy5QZXJmLkNhc3NhbmRyYUhvdGVsLlBvc3RhbENv",
|
||||||
"ZGUi9QEKBkhvdGVscxIuCghob3RlbF9pZBgBIAEoCzIcLmdvb2dsZS5wcm90",
|
"ZGUi9QEKBkhvdGVscxIuCghob3RlbF9pZBgBIAEoCzIcLmdvb2dsZS5wcm90",
|
||||||
"b2J1Zi5TdHJpbmdWYWx1ZRIqCgRuYW1lGAIgASgLMhwuZ29vZ2xlLnByb3Rv",
|
"b2J1Zi5TdHJpbmdWYWx1ZRIqCgRuYW1lGAIgASgLMhwuZ29vZ2xlLnByb3Rv",
|
||||||
"YnVmLlN0cmluZ1ZhbHVlEisKBXBob25lGAMgASgLMhwuZ29vZ2xlLnByb3Rv",
|
"YnVmLlN0cmluZ1ZhbHVlEisKBXBob25lGAMgASgLMhwuZ29vZ2xlLnByb3Rv",
|
||||||
"YnVmLlN0cmluZ1ZhbHVlEmIKB2FkZHJlc3MYBCABKAsyUS5NaWNyb3NvZnQu",
|
"YnVmLlN0cmluZ1ZhbHVlEmIKB2FkZHJlc3MYBCABKAsyUS5NaWNyb3NvZnQu",
|
||||||
"QXp1cmUuQ29zbW9zLlNlcmlhbGl6YXRpb24uSHlicmlkUm93LlRlc3RzLlBl",
|
"QXp1cmUuQ29zbW9zLlNlcmlhbGl6YXRpb24uSHlicmlkUm93LlRlc3RzLlBl",
|
||||||
"cmYuQ2Fzc2FuZHJhSG90ZWwuQWRkcmVzcyLeAQodQXZhaWxhYmxlX1Jvb21z",
|
"cmYuQ2Fzc2FuZHJhSG90ZWwuQWRkcmVzcyLeAQodQXZhaWxhYmxlX1Jvb21z",
|
||||||
"X0J5X0hvdGVsX0RhdGUSLgoIaG90ZWxfaWQYASABKAsyHC5nb29nbGUucHJv",
|
"X0J5X0hvdGVsX0RhdGUSLgoIaG90ZWxfaWQYASABKAsyHC5nb29nbGUucHJv",
|
||||||
"dG9idWYuU3RyaW5nVmFsdWUSKQoEZGF0ZRgCIAEoCzIbLmdvb2dsZS5wcm90",
|
"dG9idWYuU3RyaW5nVmFsdWUSKQoEZGF0ZRgCIAEoCzIbLmdvb2dsZS5wcm90",
|
||||||
"b2J1Zi5JbnQ2NFZhbHVlEjAKC3Jvb21fbnVtYmVyGAMgASgLMhsuZ29vZ2xl",
|
"b2J1Zi5JbnQ2NFZhbHVlEjAKC3Jvb21fbnVtYmVyGAMgASgLMhsuZ29vZ2xl",
|
||||||
"LnByb3RvYnVmLkludDMyVmFsdWUSMAoMaXNfYXZhaWxhYmxlGAQgASgLMhou",
|
"LnByb3RvYnVmLkludDMyVmFsdWUSMAoMaXNfYXZhaWxhYmxlGAQgASgLMhou",
|
||||||
"Z29vZ2xlLnByb3RvYnVmLkJvb2xWYWx1ZSKfBAoGR3Vlc3RzEi4KCGd1ZXN0",
|
"Z29vZ2xlLnByb3RvYnVmLkJvb2xWYWx1ZSKfBAoGR3Vlc3RzEi4KCGd1ZXN0",
|
||||||
"X2lkGAEgASgLMhwuZ29vZ2xlLnByb3RvYnVmLlN0cmluZ1ZhbHVlEjAKCmZp",
|
"X2lkGAEgASgLMhwuZ29vZ2xlLnByb3RvYnVmLlN0cmluZ1ZhbHVlEjAKCmZp",
|
||||||
"cnN0X25hbWUYAiABKAsyHC5nb29nbGUucHJvdG9idWYuU3RyaW5nVmFsdWUS",
|
"cnN0X25hbWUYAiABKAsyHC5nb29nbGUucHJvdG9idWYuU3RyaW5nVmFsdWUS",
|
||||||
"LwoJbGFzdF9uYW1lGAMgASgLMhwuZ29vZ2xlLnByb3RvYnVmLlN0cmluZ1Zh",
|
"LwoJbGFzdF9uYW1lGAMgASgLMhwuZ29vZ2xlLnByb3RvYnVmLlN0cmluZ1Zh",
|
||||||
"bHVlEisKBXRpdGxlGAQgASgLMhwuZ29vZ2xlLnByb3RvYnVmLlN0cmluZ1Zh",
|
"bHVlEisKBXRpdGxlGAQgASgLMhwuZ29vZ2xlLnByb3RvYnVmLlN0cmluZ1Zh",
|
||||||
"bHVlEg4KBmVtYWlscxgFIAMoCRIVCg1waG9uZV9udW1iZXJzGAYgAygJEnIK",
|
"bHVlEg4KBmVtYWlscxgFIAMoCRIVCg1waG9uZV9udW1iZXJzGAYgAygJEnIK",
|
||||||
"CWFkZHJlc3NlcxgHIAMoCzJfLk1pY3Jvc29mdC5BenVyZS5Db3Ntb3MuU2Vy",
|
"CWFkZHJlc3NlcxgHIAMoCzJfLk1pY3Jvc29mdC5BenVyZS5Db3Ntb3MuU2Vy",
|
||||||
"aWFsaXphdGlvbi5IeWJyaWRSb3cuVGVzdHMuUGVyZi5DYXNzYW5kcmFIb3Rl",
|
"aWFsaXphdGlvbi5IeWJyaWRSb3cuVGVzdHMuUGVyZi5DYXNzYW5kcmFIb3Rl",
|
||||||
"bC5HdWVzdHMuQWRkcmVzc2VzRW50cnkSNAoOY29uZmlybV9udW1iZXIYCCAB",
|
"bC5HdWVzdHMuQWRkcmVzc2VzRW50cnkSNAoOY29uZmlybV9udW1iZXIYCCAB",
|
||||||
"KAsyHC5nb29nbGUucHJvdG9idWYuU3RyaW5nVmFsdWUagwEKDkFkZHJlc3Nl",
|
"KAsyHC5nb29nbGUucHJvdG9idWYuU3RyaW5nVmFsdWUagwEKDkFkZHJlc3Nl",
|
||||||
"c0VudHJ5EgsKA2tleRgBIAEoCRJgCgV2YWx1ZRgCIAEoCzJRLk1pY3Jvc29m",
|
"c0VudHJ5EgsKA2tleRgBIAEoCRJgCgV2YWx1ZRgCIAEoCzJRLk1pY3Jvc29m",
|
||||||
"dC5BenVyZS5Db3Ntb3MuU2VyaWFsaXphdGlvbi5IeWJyaWRSb3cuVGVzdHMu",
|
"dC5BenVyZS5Db3Ntb3MuU2VyaWFsaXphdGlvbi5IeWJyaWRSb3cuVGVzdHMu",
|
||||||
"UGVyZi5DYXNzYW5kcmFIb3RlbC5BZGRyZXNzOgI4AUJUqgJRTWljcm9zb2Z0",
|
"UGVyZi5DYXNzYW5kcmFIb3RlbC5BZGRyZXNzOgI4AUJUqgJRTWljcm9zb2Z0",
|
||||||
"LkF6dXJlLkNvc21vcy5TZXJpYWxpemF0aW9uLkh5YnJpZFJvdy5UZXN0cy5Q",
|
"LkF6dXJlLkNvc21vcy5TZXJpYWxpemF0aW9uLkh5YnJpZFJvdy5UZXN0cy5Q",
|
||||||
"ZXJmLkNhc3NhbmRyYUhvdGVsLlByb3RvYnVmYgZwcm90bzM="));
|
"ZXJmLkNhc3NhbmRyYUhvdGVsLlByb3RvYnVmYgZwcm90bzM="));
|
||||||
descriptor = Google.Protobuf.Reflection.FileDescriptor.FromGeneratedCode(descriptorData,
|
descriptor = Google.Protobuf.Reflection.FileDescriptor.FromGeneratedCode(descriptorData,
|
||||||
new Google.Protobuf.Reflection.FileDescriptor[] { Google.Protobuf.WellKnownTypes.WrappersReflection.Descriptor }, new Google.Protobuf.Reflection.GeneratedClrTypeInfo(null, new Google.Protobuf.Reflection.GeneratedClrTypeInfo[] { new Google.Protobuf.Reflection.GeneratedClrTypeInfo(PostalCode.class, PostalCode.getParser(), new String[] { "Zip", "Plus4" }, null, null, null), new Google.Protobuf.Reflection.GeneratedClrTypeInfo(Address.class, Address.getParser(), new String[] { "Street", "City", "State", "PostalCode" }, null, null, null), new Google.Protobuf.Reflection.GeneratedClrTypeInfo(Hotels.class, Hotels.getParser(), new String[] { "HotelId", "Name", "Phone", "Address" }, null, null, null), new Google.Protobuf.Reflection.GeneratedClrTypeInfo(Available_Rooms_By_Hotel_Date.class, Available_Rooms_By_Hotel_Date.getParser(), new String[] { "HotelId", "Date", "RoomNumber", "IsAvailable" }, null, null, null), new Google.Protobuf.Reflection.GeneratedClrTypeInfo(Guests.class, Guests.getParser(), new String[] { "GuestId", "FirstName", "LastName", "Title", "Emails", "PhoneNumbers", "Addresses", "ConfirmNumber" }, null, null, new Google.Protobuf.Reflection.GeneratedClrTypeInfo[] { null }) }));
|
new Google.Protobuf.Reflection.FileDescriptor[] { Google.Protobuf.WellKnownTypes.WrappersReflection.Descriptor }, new Google.Protobuf.Reflection.GeneratedClrTypeInfo(null, new Google.Protobuf.Reflection.GeneratedClrTypeInfo[] { new Google.Protobuf.Reflection.GeneratedClrTypeInfo(PostalCode.class, PostalCode.getParser(), new String[] { "Zip", "Plus4" }, null, null, null), new Google.Protobuf.Reflection.GeneratedClrTypeInfo(Address.class, Address.getParser(), new String[] { "Street", "City", "State", "PostalCode" }, null, null, null), new Google.Protobuf.Reflection.GeneratedClrTypeInfo(Hotels.class, Hotels.getParser(), new String[] { "HotelId", "Name", "Phone", "Address" }, null, null, null), new Google.Protobuf.Reflection.GeneratedClrTypeInfo(Available_Rooms_By_Hotel_Date.class, Available_Rooms_By_Hotel_Date.getParser(), new String[] { "HotelId", "Date", "RoomNumber", "IsAvailable" }, null, null, null), new Google.Protobuf.Reflection.GeneratedClrTypeInfo(Guests.class, Guests.getParser(), new String[] { "GuestId", "FirstName", "LastName", "Title", "Emails", "PhoneNumbers", "Addresses", "ConfirmNumber" }, null, null, new Google.Protobuf.Reflection.GeneratedClrTypeInfo[] { null }) }));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* File descriptor for TestData/CassandraHotelSchema.proto
|
* File descriptor for TestData/CassandraHotelSchema.proto
|
||||||
*/
|
*/
|
||||||
public static Google.Protobuf.Reflection.FileDescriptor getDescriptor() {
|
public static Google.Protobuf.Reflection.FileDescriptor getDescriptor() {
|
||||||
return descriptor;
|
return descriptor;
|
||||||
}
|
}
|
||||||
// TODO: C# TO JAVA CONVERTER: There is no preprocessor in Java:
|
// TODO: C# TO JAVA CONVERTER: There is no preprocessor in Java:
|
||||||
///#endregion
|
///#endregion
|
||||||
|
|
||||||
}
|
}
|
||||||
+444
-444
@@ -1,445 +1,445 @@
|
|||||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||||
// Licensed under the MIT License.
|
// Licensed under the MIT License.
|
||||||
|
|
||||||
package com.azure.data.cosmos.serialization.hybridrow.perf.cassandrahotel.protobuf;
|
package com.azure.data.cosmos.serialization.hybridrow.perf.cassandrahotel.protobuf;
|
||||||
|
|
||||||
import com.azure.data.cosmos.serialization.hybridrow.perf.*;
|
import com.azure.data.cosmos.serialization.hybridrow.perf.*;
|
||||||
|
|
||||||
// <auto-generated>
|
// <auto-generated>
|
||||||
// Generated by the protocol buffer compiler. DO NOT EDIT!
|
// Generated by the protocol buffer compiler. DO NOT EDIT!
|
||||||
// source: TestData/CassandraHotelSchema.proto
|
// source: TestData/CassandraHotelSchema.proto
|
||||||
// </auto-generated>
|
// </auto-generated>
|
||||||
|
|
||||||
//C# TO JAVA CONVERTER NOTE: There is no Java equivalent to C# namespace aliases:
|
//C# TO JAVA CONVERTER NOTE: There is no Java equivalent to C# namespace aliases:
|
||||||
//using pb = Google.Protobuf;
|
//using pb = Google.Protobuf;
|
||||||
//C# TO JAVA CONVERTER NOTE: There is no Java equivalent to C# namespace aliases:
|
//C# TO JAVA CONVERTER NOTE: There is no Java equivalent to C# namespace aliases:
|
||||||
//using pbc = Google.Protobuf.Collections;
|
//using pbc = Google.Protobuf.Collections;
|
||||||
//C# TO JAVA CONVERTER NOTE: There is no Java equivalent to C# namespace aliases:
|
//C# TO JAVA CONVERTER NOTE: There is no Java equivalent to C# namespace aliases:
|
||||||
//using pbr = Google.Protobuf.Reflection;
|
//using pbr = Google.Protobuf.Reflection;
|
||||||
|
|
||||||
public final class Guests implements Google.Protobuf.IMessage<Guests> {
|
public final class Guests implements Google.Protobuf.IMessage<Guests> {
|
||||||
/**
|
/**
|
||||||
* Field number for the "addresses" field.
|
* Field number for the "addresses" field.
|
||||||
*/
|
*/
|
||||||
public static final int AddressesFieldNumber = 7;
|
public static final int AddressesFieldNumber = 7;
|
||||||
/**
|
/**
|
||||||
* Field number for the "confirm_number" field.
|
* Field number for the "confirm_number" field.
|
||||||
*/
|
*/
|
||||||
public static final int ConfirmNumberFieldNumber = 8;
|
public static final int ConfirmNumberFieldNumber = 8;
|
||||||
/**
|
/**
|
||||||
* Field number for the "emails" field.
|
* Field number for the "emails" field.
|
||||||
*/
|
*/
|
||||||
public static final int EmailsFieldNumber = 5;
|
public static final int EmailsFieldNumber = 5;
|
||||||
/**
|
/**
|
||||||
* Field number for the "first_name" field.
|
* Field number for the "first_name" field.
|
||||||
*/
|
*/
|
||||||
public static final int FirstNameFieldNumber = 2;
|
public static final int FirstNameFieldNumber = 2;
|
||||||
/**
|
/**
|
||||||
* Field number for the "guest_id" field.
|
* Field number for the "guest_id" field.
|
||||||
*/
|
*/
|
||||||
public static final int GuestIdFieldNumber = 1;
|
public static final int GuestIdFieldNumber = 1;
|
||||||
/**
|
/**
|
||||||
* Field number for the "last_name" field.
|
* Field number for the "last_name" field.
|
||||||
*/
|
*/
|
||||||
public static final int LastNameFieldNumber = 3;
|
public static final int LastNameFieldNumber = 3;
|
||||||
|
|
||||||
// TODO: C# TO JAVA CONVERTER: Java does not support 'partial' methods:
|
// TODO: C# TO JAVA CONVERTER: Java does not support 'partial' methods:
|
||||||
// partial void OnConstruction();
|
// partial void OnConstruction();
|
||||||
/**
|
/**
|
||||||
* Field number for the "phone_numbers" field.
|
* Field number for the "phone_numbers" field.
|
||||||
*/
|
*/
|
||||||
public static final int PhoneNumbersFieldNumber = 6;
|
public static final int PhoneNumbersFieldNumber = 6;
|
||||||
/**
|
/**
|
||||||
* Field number for the "title" field.
|
* Field number for the "title" field.
|
||||||
*/
|
*/
|
||||||
public static final int TitleFieldNumber = 4;
|
public static final int TitleFieldNumber = 4;
|
||||||
private static final Google.Protobuf.Collections.MapField<String, Address>.Codec _map_addresses_codec =
|
private static final Google.Protobuf.Collections.MapField<String, Address>.Codec _map_addresses_codec =
|
||||||
new Google.Protobuf.Collections.MapField<String, Address>.Codec(Google.Protobuf.FieldCodec.ForString(10),
|
new Google.Protobuf.Collections.MapField<String, Address>.Codec(Google.Protobuf.FieldCodec.ForString(10),
|
||||||
Google.Protobuf.FieldCodec.ForMessage(18,
|
Google.Protobuf.FieldCodec.ForMessage(18,
|
||||||
Address.getParser()), 58);
|
Address.getParser()), 58);
|
||||||
private static final Google.Protobuf.MessageParser<Guests> _parser =
|
private static final Google.Protobuf.MessageParser<Guests> _parser =
|
||||||
new Google.Protobuf.MessageParser<Guests>(() -> new Guests());
|
new Google.Protobuf.MessageParser<Guests>(() -> new Guests());
|
||||||
private static final Google.Protobuf.FieldCodec<String> _repeated_emails_codec =
|
private static final Google.Protobuf.FieldCodec<String> _repeated_emails_codec =
|
||||||
Google.Protobuf.FieldCodec.ForString(42);
|
Google.Protobuf.FieldCodec.ForString(42);
|
||||||
private static final Google.Protobuf.FieldCodec<String> _repeated_phoneNumbers_codec =
|
private static final Google.Protobuf.FieldCodec<String> _repeated_phoneNumbers_codec =
|
||||||
Google.Protobuf.FieldCodec.ForString(50);
|
Google.Protobuf.FieldCodec.ForString(50);
|
||||||
private static final Google.Protobuf.FieldCodec<String> _single_confirmNumber_codec =
|
private static final Google.Protobuf.FieldCodec<String> _single_confirmNumber_codec =
|
||||||
Google.Protobuf.FieldCodec.<String>ForClassWrapper(66);
|
Google.Protobuf.FieldCodec.<String>ForClassWrapper(66);
|
||||||
private static final Google.Protobuf.FieldCodec<String> _single_firstName_codec =
|
private static final Google.Protobuf.FieldCodec<String> _single_firstName_codec =
|
||||||
Google.Protobuf.FieldCodec.<String>ForClassWrapper(18);
|
Google.Protobuf.FieldCodec.<String>ForClassWrapper(18);
|
||||||
private static final Google.Protobuf.FieldCodec<String> _single_guestId_codec =
|
private static final Google.Protobuf.FieldCodec<String> _single_guestId_codec =
|
||||||
Google.Protobuf.FieldCodec.<String>ForClassWrapper(10);
|
Google.Protobuf.FieldCodec.<String>ForClassWrapper(10);
|
||||||
private static final Google.Protobuf.FieldCodec<String> _single_lastName_codec =
|
private static final Google.Protobuf.FieldCodec<String> _single_lastName_codec =
|
||||||
Google.Protobuf.FieldCodec.<String>ForClassWrapper(26);
|
Google.Protobuf.FieldCodec.<String>ForClassWrapper(26);
|
||||||
private static final Google.Protobuf.FieldCodec<String> _single_title_codec =
|
private static final Google.Protobuf.FieldCodec<String> _single_title_codec =
|
||||||
Google.Protobuf.FieldCodec.<String>ForClassWrapper(34);
|
Google.Protobuf.FieldCodec.<String>ForClassWrapper(34);
|
||||||
private final Google.Protobuf.Collections.MapField<String, Address> addresses_ =
|
private final Google.Protobuf.Collections.MapField<String, Address> addresses_ =
|
||||||
new Google.Protobuf.Collections.MapField<String, Address>();
|
new Google.Protobuf.Collections.MapField<String, Address>();
|
||||||
private final Google.Protobuf.Collections.RepeatedField<String> emails_ =
|
private final Google.Protobuf.Collections.RepeatedField<String> emails_ =
|
||||||
new Google.Protobuf.Collections.RepeatedField<String>();
|
new Google.Protobuf.Collections.RepeatedField<String>();
|
||||||
private final Google.Protobuf.Collections.RepeatedField<String> phoneNumbers_ =
|
private final Google.Protobuf.Collections.RepeatedField<String> phoneNumbers_ =
|
||||||
new Google.Protobuf.Collections.RepeatedField<String>();
|
new Google.Protobuf.Collections.RepeatedField<String>();
|
||||||
private Google.Protobuf.UnknownFieldSet _unknownFields;
|
private Google.Protobuf.UnknownFieldSet _unknownFields;
|
||||||
private String confirmNumber_;
|
private String confirmNumber_;
|
||||||
private String firstName_;
|
private String firstName_;
|
||||||
private String guestId_;
|
private String guestId_;
|
||||||
private String lastName_;
|
private String lastName_;
|
||||||
private String title_;
|
private String title_;
|
||||||
|
|
||||||
// TODO: C# TO JAVA CONVERTER: Java annotations will not correspond to .NET attributes:
|
// TODO: C# TO JAVA CONVERTER: Java annotations will not correspond to .NET attributes:
|
||||||
//ORIGINAL LINE: [System.Diagnostics.DebuggerNonUserCodeAttribute] public Guests()
|
//ORIGINAL LINE: [System.Diagnostics.DebuggerNonUserCodeAttribute] public Guests()
|
||||||
public Guests() {
|
public Guests() {
|
||||||
OnConstruction();
|
OnConstruction();
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: C# TO JAVA CONVERTER: Java annotations will not correspond to .NET attributes:
|
// TODO: C# TO JAVA CONVERTER: Java annotations will not correspond to .NET attributes:
|
||||||
//ORIGINAL LINE: [System.Diagnostics.DebuggerNonUserCodeAttribute] public Guests(Guests other)
|
//ORIGINAL LINE: [System.Diagnostics.DebuggerNonUserCodeAttribute] public Guests(Guests other)
|
||||||
public Guests(Guests other) {
|
public Guests(Guests other) {
|
||||||
this();
|
this();
|
||||||
setGuestId(other.getGuestId());
|
setGuestId(other.getGuestId());
|
||||||
setFirstName(other.getFirstName());
|
setFirstName(other.getFirstName());
|
||||||
setLastName(other.getLastName());
|
setLastName(other.getLastName());
|
||||||
setTitle(other.getTitle());
|
setTitle(other.getTitle());
|
||||||
emails_ = other.emails_.Clone();
|
emails_ = other.emails_.Clone();
|
||||||
phoneNumbers_ = other.phoneNumbers_.Clone();
|
phoneNumbers_ = other.phoneNumbers_.Clone();
|
||||||
addresses_ = other.addresses_.Clone();
|
addresses_ = other.addresses_.Clone();
|
||||||
setConfirmNumber(other.getConfirmNumber());
|
setConfirmNumber(other.getConfirmNumber());
|
||||||
_unknownFields = Google.Protobuf.UnknownFieldSet.Clone(other._unknownFields);
|
_unknownFields = Google.Protobuf.UnknownFieldSet.Clone(other._unknownFields);
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: C# TO JAVA CONVERTER: Java annotations will not correspond to .NET attributes:
|
// TODO: C# TO JAVA CONVERTER: Java annotations will not correspond to .NET attributes:
|
||||||
//ORIGINAL LINE: [System.Diagnostics.DebuggerNonUserCodeAttribute] public Google.Protobuf.Collections
|
//ORIGINAL LINE: [System.Diagnostics.DebuggerNonUserCodeAttribute] public Google.Protobuf.Collections
|
||||||
// .MapField<string, azure.data.cosmos.serialization.hybridrow.perf.cassandrahotel.Protobuf.Address>
|
// .MapField<string, azure.data.cosmos.serialization.hybridrow.perf.cassandrahotel.Protobuf.Address>
|
||||||
// Addresses
|
// Addresses
|
||||||
public Google.Protobuf.Collections.MapField<String, Address> getAddresses() {
|
public Google.Protobuf.Collections.MapField<String, Address> getAddresses() {
|
||||||
return addresses_;
|
return addresses_;
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: C# TO JAVA CONVERTER: Java annotations will not correspond to .NET attributes:
|
// TODO: C# TO JAVA CONVERTER: Java annotations will not correspond to .NET attributes:
|
||||||
//ORIGINAL LINE: [System.Diagnostics.DebuggerNonUserCodeAttribute] public string ConfirmNumber
|
//ORIGINAL LINE: [System.Diagnostics.DebuggerNonUserCodeAttribute] public string ConfirmNumber
|
||||||
public String getConfirmNumber() {
|
public String getConfirmNumber() {
|
||||||
return confirmNumber_;
|
return confirmNumber_;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setConfirmNumber(String value) {
|
public void setConfirmNumber(String value) {
|
||||||
confirmNumber_ = value;
|
confirmNumber_ = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: C# TO JAVA CONVERTER: Java annotations will not correspond to .NET attributes:
|
// TODO: C# TO JAVA CONVERTER: Java annotations will not correspond to .NET attributes:
|
||||||
//ORIGINAL LINE: [System.Diagnostics.DebuggerNonUserCodeAttribute] public static Google.Protobuf.Reflection
|
//ORIGINAL LINE: [System.Diagnostics.DebuggerNonUserCodeAttribute] public static Google.Protobuf.Reflection
|
||||||
// .MessageDescriptor Descriptor
|
// .MessageDescriptor Descriptor
|
||||||
public static Google.Protobuf.Reflection.MessageDescriptor getDescriptor() {
|
public static Google.Protobuf.Reflection.MessageDescriptor getDescriptor() {
|
||||||
return CassandraHotelSchemaReflection.getDescriptor().MessageTypes[4];
|
return CassandraHotelSchemaReflection.getDescriptor().MessageTypes[4];
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: C# TO JAVA CONVERTER: Java annotations will not correspond to .NET attributes:
|
// TODO: C# TO JAVA CONVERTER: Java annotations will not correspond to .NET attributes:
|
||||||
//ORIGINAL LINE: [System.Diagnostics.DebuggerNonUserCodeAttribute] pbr::MessageDescriptor pb::IMessage.Descriptor
|
//ORIGINAL LINE: [System.Diagnostics.DebuggerNonUserCodeAttribute] pbr::MessageDescriptor pb::IMessage.Descriptor
|
||||||
public Google.Protobuf.Reflection getDescriptor() {
|
public Google.Protobuf.Reflection getDescriptor() {
|
||||||
return getDescriptor();
|
return getDescriptor();
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: C# TO JAVA CONVERTER: Java annotations will not correspond to .NET attributes:
|
// TODO: C# TO JAVA CONVERTER: Java annotations will not correspond to .NET attributes:
|
||||||
//ORIGINAL LINE: [System.Diagnostics.DebuggerNonUserCodeAttribute] public Google.Protobuf.Collections
|
//ORIGINAL LINE: [System.Diagnostics.DebuggerNonUserCodeAttribute] public Google.Protobuf.Collections
|
||||||
// .RepeatedField<string> Emails
|
// .RepeatedField<string> Emails
|
||||||
public Google.Protobuf.Collections.RepeatedField<String> getEmails() {
|
public Google.Protobuf.Collections.RepeatedField<String> getEmails() {
|
||||||
return emails_;
|
return emails_;
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: C# TO JAVA CONVERTER: Java annotations will not correspond to .NET attributes:
|
// TODO: C# TO JAVA CONVERTER: Java annotations will not correspond to .NET attributes:
|
||||||
//ORIGINAL LINE: [System.Diagnostics.DebuggerNonUserCodeAttribute] public string FirstName
|
//ORIGINAL LINE: [System.Diagnostics.DebuggerNonUserCodeAttribute] public string FirstName
|
||||||
public String getFirstName() {
|
public String getFirstName() {
|
||||||
return firstName_;
|
return firstName_;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setFirstName(String value) {
|
public void setFirstName(String value) {
|
||||||
firstName_ = value;
|
firstName_ = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* guid
|
* guid
|
||||||
*/
|
*/
|
||||||
// TODO: C# TO JAVA CONVERTER: Java annotations will not correspond to .NET attributes:
|
// TODO: C# TO JAVA CONVERTER: Java annotations will not correspond to .NET attributes:
|
||||||
//ORIGINAL LINE: [System.Diagnostics.DebuggerNonUserCodeAttribute] public string GuestId
|
//ORIGINAL LINE: [System.Diagnostics.DebuggerNonUserCodeAttribute] public string GuestId
|
||||||
public String getGuestId() {
|
public String getGuestId() {
|
||||||
return guestId_;
|
return guestId_;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setGuestId(String value) {
|
public void setGuestId(String value) {
|
||||||
guestId_ = value;
|
guestId_ = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: C# TO JAVA CONVERTER: Java annotations will not correspond to .NET attributes:
|
// TODO: C# TO JAVA CONVERTER: Java annotations will not correspond to .NET attributes:
|
||||||
//ORIGINAL LINE: [System.Diagnostics.DebuggerNonUserCodeAttribute] public string LastName
|
//ORIGINAL LINE: [System.Diagnostics.DebuggerNonUserCodeAttribute] public string LastName
|
||||||
public String getLastName() {
|
public String getLastName() {
|
||||||
return lastName_;
|
return lastName_;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setLastName(String value) {
|
public void setLastName(String value) {
|
||||||
lastName_ = value;
|
lastName_ = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: C# TO JAVA CONVERTER: Java annotations will not correspond to .NET attributes:
|
// TODO: C# TO JAVA CONVERTER: Java annotations will not correspond to .NET attributes:
|
||||||
//ORIGINAL LINE: [System.Diagnostics.DebuggerNonUserCodeAttribute] public static Google.Protobuf
|
//ORIGINAL LINE: [System.Diagnostics.DebuggerNonUserCodeAttribute] public static Google.Protobuf
|
||||||
// .MessageParser<Guests> Parser
|
// .MessageParser<Guests> Parser
|
||||||
public static Google.Protobuf.MessageParser<Guests> getParser() {
|
public static Google.Protobuf.MessageParser<Guests> getParser() {
|
||||||
return _parser;
|
return _parser;
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: C# TO JAVA CONVERTER: Java annotations will not correspond to .NET attributes:
|
// TODO: C# TO JAVA CONVERTER: Java annotations will not correspond to .NET attributes:
|
||||||
//ORIGINAL LINE: [System.Diagnostics.DebuggerNonUserCodeAttribute] public Google.Protobuf.Collections
|
//ORIGINAL LINE: [System.Diagnostics.DebuggerNonUserCodeAttribute] public Google.Protobuf.Collections
|
||||||
// .RepeatedField<string> PhoneNumbers
|
// .RepeatedField<string> PhoneNumbers
|
||||||
public Google.Protobuf.Collections.RepeatedField<String> getPhoneNumbers() {
|
public Google.Protobuf.Collections.RepeatedField<String> getPhoneNumbers() {
|
||||||
return phoneNumbers_;
|
return phoneNumbers_;
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: C# TO JAVA CONVERTER: Java annotations will not correspond to .NET attributes:
|
// TODO: C# TO JAVA CONVERTER: Java annotations will not correspond to .NET attributes:
|
||||||
//ORIGINAL LINE: [System.Diagnostics.DebuggerNonUserCodeAttribute] public string Title
|
//ORIGINAL LINE: [System.Diagnostics.DebuggerNonUserCodeAttribute] public string Title
|
||||||
public String getTitle() {
|
public String getTitle() {
|
||||||
return title_;
|
return title_;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setTitle(String value) {
|
public void setTitle(String value) {
|
||||||
title_ = value;
|
title_ = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: C# TO JAVA CONVERTER: Java annotations will not correspond to .NET attributes:
|
// TODO: C# TO JAVA CONVERTER: Java annotations will not correspond to .NET attributes:
|
||||||
//ORIGINAL LINE: [System.Diagnostics.DebuggerNonUserCodeAttribute] public int CalculateSize()
|
//ORIGINAL LINE: [System.Diagnostics.DebuggerNonUserCodeAttribute] public int CalculateSize()
|
||||||
public int CalculateSize() {
|
public int CalculateSize() {
|
||||||
int size = 0;
|
int size = 0;
|
||||||
if (guestId_ != null) {
|
if (guestId_ != null) {
|
||||||
size += _single_guestId_codec.CalculateSizeWithTag(getGuestId());
|
size += _single_guestId_codec.CalculateSizeWithTag(getGuestId());
|
||||||
}
|
}
|
||||||
if (firstName_ != null) {
|
if (firstName_ != null) {
|
||||||
size += _single_firstName_codec.CalculateSizeWithTag(getFirstName());
|
size += _single_firstName_codec.CalculateSizeWithTag(getFirstName());
|
||||||
}
|
}
|
||||||
if (lastName_ != null) {
|
if (lastName_ != null) {
|
||||||
size += _single_lastName_codec.CalculateSizeWithTag(getLastName());
|
size += _single_lastName_codec.CalculateSizeWithTag(getLastName());
|
||||||
}
|
}
|
||||||
if (title_ != null) {
|
if (title_ != null) {
|
||||||
size += _single_title_codec.CalculateSizeWithTag(getTitle());
|
size += _single_title_codec.CalculateSizeWithTag(getTitle());
|
||||||
}
|
}
|
||||||
size += emails_.CalculateSize(_repeated_emails_codec);
|
size += emails_.CalculateSize(_repeated_emails_codec);
|
||||||
size += phoneNumbers_.CalculateSize(_repeated_phoneNumbers_codec);
|
size += phoneNumbers_.CalculateSize(_repeated_phoneNumbers_codec);
|
||||||
size += addresses_.CalculateSize(_map_addresses_codec);
|
size += addresses_.CalculateSize(_map_addresses_codec);
|
||||||
if (confirmNumber_ != null) {
|
if (confirmNumber_ != null) {
|
||||||
size += _single_confirmNumber_codec.CalculateSizeWithTag(getConfirmNumber());
|
size += _single_confirmNumber_codec.CalculateSizeWithTag(getConfirmNumber());
|
||||||
}
|
}
|
||||||
if (_unknownFields != null) {
|
if (_unknownFields != null) {
|
||||||
size += _unknownFields.CalculateSize();
|
size += _unknownFields.CalculateSize();
|
||||||
}
|
}
|
||||||
return size;
|
return size;
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: C# TO JAVA CONVERTER: Java annotations will not correspond to .NET attributes:
|
// TODO: C# TO JAVA CONVERTER: Java annotations will not correspond to .NET attributes:
|
||||||
//ORIGINAL LINE: [System.Diagnostics.DebuggerNonUserCodeAttribute] public Guests Clone()
|
//ORIGINAL LINE: [System.Diagnostics.DebuggerNonUserCodeAttribute] public Guests Clone()
|
||||||
public Guests Clone() {
|
public Guests Clone() {
|
||||||
return new Guests(this);
|
return new Guests(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: C# TO JAVA CONVERTER: Java annotations will not correspond to .NET attributes:
|
// TODO: C# TO JAVA CONVERTER: Java annotations will not correspond to .NET attributes:
|
||||||
//ORIGINAL LINE: [System.Diagnostics.DebuggerNonUserCodeAttribute] public void MergeFrom(Guests other)
|
//ORIGINAL LINE: [System.Diagnostics.DebuggerNonUserCodeAttribute] public void MergeFrom(Guests other)
|
||||||
public void MergeFrom(Guests other) {
|
public void MergeFrom(Guests other) {
|
||||||
if (other == null) {
|
if (other == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (other.guestId_ != null) {
|
if (other.guestId_ != null) {
|
||||||
if (guestId_ == null || !other.getGuestId().equals("")) {
|
if (guestId_ == null || !other.getGuestId().equals("")) {
|
||||||
setGuestId(other.getGuestId());
|
setGuestId(other.getGuestId());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (other.firstName_ != null) {
|
if (other.firstName_ != null) {
|
||||||
if (firstName_ == null || !other.getFirstName().equals("")) {
|
if (firstName_ == null || !other.getFirstName().equals("")) {
|
||||||
setFirstName(other.getFirstName());
|
setFirstName(other.getFirstName());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (other.lastName_ != null) {
|
if (other.lastName_ != null) {
|
||||||
if (lastName_ == null || !other.getLastName().equals("")) {
|
if (lastName_ == null || !other.getLastName().equals("")) {
|
||||||
setLastName(other.getLastName());
|
setLastName(other.getLastName());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (other.title_ != null) {
|
if (other.title_ != null) {
|
||||||
if (title_ == null || !other.getTitle().equals("")) {
|
if (title_ == null || !other.getTitle().equals("")) {
|
||||||
setTitle(other.getTitle());
|
setTitle(other.getTitle());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
emails_.Add(other.emails_);
|
emails_.Add(other.emails_);
|
||||||
phoneNumbers_.Add(other.phoneNumbers_);
|
phoneNumbers_.Add(other.phoneNumbers_);
|
||||||
addresses_.Add(other.addresses_);
|
addresses_.Add(other.addresses_);
|
||||||
if (other.confirmNumber_ != null) {
|
if (other.confirmNumber_ != null) {
|
||||||
if (confirmNumber_ == null || !other.getConfirmNumber().equals("")) {
|
if (confirmNumber_ == null || !other.getConfirmNumber().equals("")) {
|
||||||
setConfirmNumber(other.getConfirmNumber());
|
setConfirmNumber(other.getConfirmNumber());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
_unknownFields = Google.Protobuf.UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields);
|
_unknownFields = Google.Protobuf.UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields);
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: C# TO JAVA CONVERTER: Java annotations will not correspond to .NET attributes:
|
// TODO: C# TO JAVA CONVERTER: Java annotations will not correspond to .NET attributes:
|
||||||
//ORIGINAL LINE: [System.Diagnostics.DebuggerNonUserCodeAttribute] public void MergeFrom(Google.Protobuf
|
//ORIGINAL LINE: [System.Diagnostics.DebuggerNonUserCodeAttribute] public void MergeFrom(Google.Protobuf
|
||||||
// .CodedInputStream input)
|
// .CodedInputStream input)
|
||||||
public void MergeFrom(Google.Protobuf.CodedInputStream input) {
|
public void MergeFrom(Google.Protobuf.CodedInputStream input) {
|
||||||
//C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java:
|
//C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java:
|
||||||
//ORIGINAL LINE: uint tag;
|
//ORIGINAL LINE: uint tag;
|
||||||
int tag;
|
int tag;
|
||||||
while ((tag = input.ReadTag()) != 0) {
|
while ((tag = input.ReadTag()) != 0) {
|
||||||
switch (tag) {
|
switch (tag) {
|
||||||
default:
|
default:
|
||||||
_unknownFields = Google.Protobuf.UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
|
_unknownFields = Google.Protobuf.UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
|
||||||
break;
|
break;
|
||||||
case 10: {
|
case 10: {
|
||||||
String value = _single_guestId_codec.Read(input);
|
String value = _single_guestId_codec.Read(input);
|
||||||
if (guestId_ == null || !value.equals("")) {
|
if (guestId_ == null || !value.equals("")) {
|
||||||
setGuestId(value);
|
setGuestId(value);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 18: {
|
case 18: {
|
||||||
String value = _single_firstName_codec.Read(input);
|
String value = _single_firstName_codec.Read(input);
|
||||||
if (firstName_ == null || !value.equals("")) {
|
if (firstName_ == null || !value.equals("")) {
|
||||||
setFirstName(value);
|
setFirstName(value);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 26: {
|
case 26: {
|
||||||
String value = _single_lastName_codec.Read(input);
|
String value = _single_lastName_codec.Read(input);
|
||||||
if (lastName_ == null || !value.equals("")) {
|
if (lastName_ == null || !value.equals("")) {
|
||||||
setLastName(value);
|
setLastName(value);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 34: {
|
case 34: {
|
||||||
String value = _single_title_codec.Read(input);
|
String value = _single_title_codec.Read(input);
|
||||||
if (title_ == null || !value.equals("")) {
|
if (title_ == null || !value.equals("")) {
|
||||||
setTitle(value);
|
setTitle(value);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 42: {
|
case 42: {
|
||||||
emails_.AddEntriesFrom(input, _repeated_emails_codec);
|
emails_.AddEntriesFrom(input, _repeated_emails_codec);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 50: {
|
case 50: {
|
||||||
phoneNumbers_.AddEntriesFrom(input, _repeated_phoneNumbers_codec);
|
phoneNumbers_.AddEntriesFrom(input, _repeated_phoneNumbers_codec);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 58: {
|
case 58: {
|
||||||
addresses_.AddEntriesFrom(input, _map_addresses_codec);
|
addresses_.AddEntriesFrom(input, _map_addresses_codec);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 66: {
|
case 66: {
|
||||||
String value = _single_confirmNumber_codec.Read(input);
|
String value = _single_confirmNumber_codec.Read(input);
|
||||||
if (confirmNumber_ == null || !value.equals("")) {
|
if (confirmNumber_ == null || !value.equals("")) {
|
||||||
setConfirmNumber(value);
|
setConfirmNumber(value);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: C# TO JAVA CONVERTER: Java annotations will not correspond to .NET attributes:
|
// TODO: C# TO JAVA CONVERTER: Java annotations will not correspond to .NET attributes:
|
||||||
//ORIGINAL LINE: [System.Diagnostics.DebuggerNonUserCodeAttribute] public void WriteTo(Google.Protobuf
|
//ORIGINAL LINE: [System.Diagnostics.DebuggerNonUserCodeAttribute] public void WriteTo(Google.Protobuf
|
||||||
// .CodedOutputStream output)
|
// .CodedOutputStream output)
|
||||||
public void WriteTo(Google.Protobuf.CodedOutputStream output) {
|
public void WriteTo(Google.Protobuf.CodedOutputStream output) {
|
||||||
if (guestId_ != null) {
|
if (guestId_ != null) {
|
||||||
_single_guestId_codec.WriteTagAndValue(output, getGuestId());
|
_single_guestId_codec.WriteTagAndValue(output, getGuestId());
|
||||||
}
|
}
|
||||||
if (firstName_ != null) {
|
if (firstName_ != null) {
|
||||||
_single_firstName_codec.WriteTagAndValue(output, getFirstName());
|
_single_firstName_codec.WriteTagAndValue(output, getFirstName());
|
||||||
}
|
}
|
||||||
if (lastName_ != null) {
|
if (lastName_ != null) {
|
||||||
_single_lastName_codec.WriteTagAndValue(output, getLastName());
|
_single_lastName_codec.WriteTagAndValue(output, getLastName());
|
||||||
}
|
}
|
||||||
if (title_ != null) {
|
if (title_ != null) {
|
||||||
_single_title_codec.WriteTagAndValue(output, getTitle());
|
_single_title_codec.WriteTagAndValue(output, getTitle());
|
||||||
}
|
}
|
||||||
emails_.WriteTo(output, _repeated_emails_codec);
|
emails_.WriteTo(output, _repeated_emails_codec);
|
||||||
phoneNumbers_.WriteTo(output, _repeated_phoneNumbers_codec);
|
phoneNumbers_.WriteTo(output, _repeated_phoneNumbers_codec);
|
||||||
addresses_.WriteTo(output, _map_addresses_codec);
|
addresses_.WriteTo(output, _map_addresses_codec);
|
||||||
if (confirmNumber_ != null) {
|
if (confirmNumber_ != null) {
|
||||||
_single_confirmNumber_codec.WriteTagAndValue(output, getConfirmNumber());
|
_single_confirmNumber_codec.WriteTagAndValue(output, getConfirmNumber());
|
||||||
}
|
}
|
||||||
if (_unknownFields != null) {
|
if (_unknownFields != null) {
|
||||||
_unknownFields.WriteTo(output);
|
_unknownFields.WriteTo(output);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: C# TO JAVA CONVERTER: Java annotations will not correspond to .NET attributes:
|
// TODO: C# TO JAVA CONVERTER: Java annotations will not correspond to .NET attributes:
|
||||||
//ORIGINAL LINE: [System.Diagnostics.DebuggerNonUserCodeAttribute] public override bool Equals(object other)
|
//ORIGINAL LINE: [System.Diagnostics.DebuggerNonUserCodeAttribute] public override bool Equals(object other)
|
||||||
@Override
|
@Override
|
||||||
public boolean equals(Object other) {
|
public boolean equals(Object other) {
|
||||||
return Equals(other instanceof Guests ? (Guests)other : null);
|
return Equals(other instanceof Guests ? (Guests)other : null);
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: C# TO JAVA CONVERTER: Java annotations will not correspond to .NET attributes:
|
// TODO: C# TO JAVA CONVERTER: Java annotations will not correspond to .NET attributes:
|
||||||
//ORIGINAL LINE: [System.Diagnostics.DebuggerNonUserCodeAttribute] public bool Equals(Guests other)
|
//ORIGINAL LINE: [System.Diagnostics.DebuggerNonUserCodeAttribute] public bool Equals(Guests other)
|
||||||
public boolean equals(Guests other) {
|
public boolean equals(Guests other) {
|
||||||
if (ReferenceEquals(other, null)) {
|
if (ReferenceEquals(other, null)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (ReferenceEquals(other, this)) {
|
if (ReferenceEquals(other, this)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (!getGuestId().equals(other.getGuestId())) {
|
if (!getGuestId().equals(other.getGuestId())) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (!getFirstName().equals(other.getFirstName())) {
|
if (!getFirstName().equals(other.getFirstName())) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (!getLastName().equals(other.getLastName())) {
|
if (!getLastName().equals(other.getLastName())) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (!getTitle().equals(other.getTitle())) {
|
if (!getTitle().equals(other.getTitle())) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (!emails_.equals(other.emails_)) {
|
if (!emails_.equals(other.emails_)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (!phoneNumbers_.equals(other.phoneNumbers_)) {
|
if (!phoneNumbers_.equals(other.phoneNumbers_)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (!getAddresses().equals(other.getAddresses())) {
|
if (!getAddresses().equals(other.getAddresses())) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (!getConfirmNumber().equals(other.getConfirmNumber())) {
|
if (!getConfirmNumber().equals(other.getConfirmNumber())) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return Equals(_unknownFields, other._unknownFields);
|
return Equals(_unknownFields, other._unknownFields);
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: C# TO JAVA CONVERTER: Java annotations will not correspond to .NET attributes:
|
// TODO: C# TO JAVA CONVERTER: Java annotations will not correspond to .NET attributes:
|
||||||
//ORIGINAL LINE: [System.Diagnostics.DebuggerNonUserCodeAttribute] public override int GetHashCode()
|
//ORIGINAL LINE: [System.Diagnostics.DebuggerNonUserCodeAttribute] public override int GetHashCode()
|
||||||
@Override
|
@Override
|
||||||
public int hashCode() {
|
public int hashCode() {
|
||||||
int hash = 1;
|
int hash = 1;
|
||||||
if (guestId_ != null) {
|
if (guestId_ != null) {
|
||||||
hash ^= getGuestId().hashCode();
|
hash ^= getGuestId().hashCode();
|
||||||
}
|
}
|
||||||
if (firstName_ != null) {
|
if (firstName_ != null) {
|
||||||
hash ^= getFirstName().hashCode();
|
hash ^= getFirstName().hashCode();
|
||||||
}
|
}
|
||||||
if (lastName_ != null) {
|
if (lastName_ != null) {
|
||||||
hash ^= getLastName().hashCode();
|
hash ^= getLastName().hashCode();
|
||||||
}
|
}
|
||||||
if (title_ != null) {
|
if (title_ != null) {
|
||||||
hash ^= getTitle().hashCode();
|
hash ^= getTitle().hashCode();
|
||||||
}
|
}
|
||||||
hash ^= emails_.hashCode();
|
hash ^= emails_.hashCode();
|
||||||
hash ^= phoneNumbers_.hashCode();
|
hash ^= phoneNumbers_.hashCode();
|
||||||
hash ^= getAddresses().hashCode();
|
hash ^= getAddresses().hashCode();
|
||||||
if (confirmNumber_ != null) {
|
if (confirmNumber_ != null) {
|
||||||
hash ^= getConfirmNumber().hashCode();
|
hash ^= getConfirmNumber().hashCode();
|
||||||
}
|
}
|
||||||
if (_unknownFields != null) {
|
if (_unknownFields != null) {
|
||||||
hash ^= _unknownFields.hashCode();
|
hash ^= _unknownFields.hashCode();
|
||||||
}
|
}
|
||||||
return hash;
|
return hash;
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: C# TO JAVA CONVERTER: Java annotations will not correspond to .NET attributes:
|
// TODO: C# TO JAVA CONVERTER: Java annotations will not correspond to .NET attributes:
|
||||||
//ORIGINAL LINE: [System.Diagnostics.DebuggerNonUserCodeAttribute] public override string ToString()
|
//ORIGINAL LINE: [System.Diagnostics.DebuggerNonUserCodeAttribute] public override string ToString()
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return Google.Protobuf.JsonFormatter.ToDiagnosticString(this);
|
return Google.Protobuf.JsonFormatter.ToDiagnosticString(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
+315
-315
@@ -1,316 +1,316 @@
|
|||||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||||
// Licensed under the MIT License.
|
// Licensed under the MIT License.
|
||||||
|
|
||||||
package com.azure.data.cosmos.serialization.hybridrow.perf.cassandrahotel.protobuf;
|
package com.azure.data.cosmos.serialization.hybridrow.perf.cassandrahotel.protobuf;
|
||||||
|
|
||||||
import com.azure.data.cosmos.serialization.hybridrow.perf.*;
|
import com.azure.data.cosmos.serialization.hybridrow.perf.*;
|
||||||
|
|
||||||
// <auto-generated>
|
// <auto-generated>
|
||||||
// Generated by the protocol buffer compiler. DO NOT EDIT!
|
// Generated by the protocol buffer compiler. DO NOT EDIT!
|
||||||
// source: TestData/CassandraHotelSchema.proto
|
// source: TestData/CassandraHotelSchema.proto
|
||||||
// </auto-generated>
|
// </auto-generated>
|
||||||
|
|
||||||
//C# TO JAVA CONVERTER NOTE: There is no Java equivalent to C# namespace aliases:
|
//C# TO JAVA CONVERTER NOTE: There is no Java equivalent to C# namespace aliases:
|
||||||
//using pb = Google.Protobuf;
|
//using pb = Google.Protobuf;
|
||||||
//C# TO JAVA CONVERTER NOTE: There is no Java equivalent to C# namespace aliases:
|
//C# TO JAVA CONVERTER NOTE: There is no Java equivalent to C# namespace aliases:
|
||||||
//using pbc = Google.Protobuf.Collections;
|
//using pbc = Google.Protobuf.Collections;
|
||||||
//C# TO JAVA CONVERTER NOTE: There is no Java equivalent to C# namespace aliases:
|
//C# TO JAVA CONVERTER NOTE: There is no Java equivalent to C# namespace aliases:
|
||||||
//using pbr = Google.Protobuf.Reflection;
|
//using pbr = Google.Protobuf.Reflection;
|
||||||
|
|
||||||
public final class Hotels implements Google.Protobuf.IMessage<Hotels> {
|
public final class Hotels implements Google.Protobuf.IMessage<Hotels> {
|
||||||
/**
|
/**
|
||||||
* Field number for the "address" field.
|
* Field number for the "address" field.
|
||||||
*/
|
*/
|
||||||
public static final int AddressFieldNumber = 4;
|
public static final int AddressFieldNumber = 4;
|
||||||
/**
|
/**
|
||||||
* Field number for the "hotel_id" field.
|
* Field number for the "hotel_id" field.
|
||||||
*/
|
*/
|
||||||
public static final int HotelIdFieldNumber = 1;
|
public static final int HotelIdFieldNumber = 1;
|
||||||
/**
|
/**
|
||||||
* Field number for the "name" field.
|
* Field number for the "name" field.
|
||||||
*/
|
*/
|
||||||
public static final int NameFieldNumber = 2;
|
public static final int NameFieldNumber = 2;
|
||||||
/**
|
/**
|
||||||
* Field number for the "phone" field.
|
* Field number for the "phone" field.
|
||||||
*/
|
*/
|
||||||
public static final int PhoneFieldNumber = 3;
|
public static final int PhoneFieldNumber = 3;
|
||||||
private static final Google.Protobuf.MessageParser<Hotels> _parser =
|
private static final Google.Protobuf.MessageParser<Hotels> _parser =
|
||||||
new Google.Protobuf.MessageParser<Hotels>(() -> new Hotels());
|
new Google.Protobuf.MessageParser<Hotels>(() -> new Hotels());
|
||||||
private static final Google.Protobuf.FieldCodec<String> _single_hotelId_codec =
|
private static final Google.Protobuf.FieldCodec<String> _single_hotelId_codec =
|
||||||
Google.Protobuf.FieldCodec.<String>ForClassWrapper(10);
|
Google.Protobuf.FieldCodec.<String>ForClassWrapper(10);
|
||||||
|
|
||||||
// TODO: C# TO JAVA CONVERTER: Java does not support 'partial' methods:
|
// TODO: C# TO JAVA CONVERTER: Java does not support 'partial' methods:
|
||||||
// partial void OnConstruction();
|
// partial void OnConstruction();
|
||||||
private static final Google.Protobuf.FieldCodec<String> _single_name_codec =
|
private static final Google.Protobuf.FieldCodec<String> _single_name_codec =
|
||||||
Google.Protobuf.FieldCodec.<String>ForClassWrapper(18);
|
Google.Protobuf.FieldCodec.<String>ForClassWrapper(18);
|
||||||
private static final Google.Protobuf.FieldCodec<String> _single_phone_codec =
|
private static final Google.Protobuf.FieldCodec<String> _single_phone_codec =
|
||||||
Google.Protobuf.FieldCodec.<String>ForClassWrapper(26);
|
Google.Protobuf.FieldCodec.<String>ForClassWrapper(26);
|
||||||
private Google.Protobuf.UnknownFieldSet _unknownFields;
|
private Google.Protobuf.UnknownFieldSet _unknownFields;
|
||||||
private Address address_;
|
private Address address_;
|
||||||
private String hotelId_;
|
private String hotelId_;
|
||||||
private String name_;
|
private String name_;
|
||||||
private String phone_;
|
private String phone_;
|
||||||
|
|
||||||
// TODO: C# TO JAVA CONVERTER: Java annotations will not correspond to .NET attributes:
|
// TODO: C# TO JAVA CONVERTER: Java annotations will not correspond to .NET attributes:
|
||||||
//ORIGINAL LINE: [System.Diagnostics.DebuggerNonUserCodeAttribute] public Hotels()
|
//ORIGINAL LINE: [System.Diagnostics.DebuggerNonUserCodeAttribute] public Hotels()
|
||||||
public Hotels() {
|
public Hotels() {
|
||||||
OnConstruction();
|
OnConstruction();
|
||||||
}
|
}
|
||||||
// TODO: C# TO JAVA CONVERTER: Java annotations will not correspond to .NET attributes:
|
// TODO: C# TO JAVA CONVERTER: Java annotations will not correspond to .NET attributes:
|
||||||
//ORIGINAL LINE: [System.Diagnostics.DebuggerNonUserCodeAttribute] public Hotels(Hotels other)
|
//ORIGINAL LINE: [System.Diagnostics.DebuggerNonUserCodeAttribute] public Hotels(Hotels other)
|
||||||
public Hotels(Hotels other) {
|
public Hotels(Hotels other) {
|
||||||
this();
|
this();
|
||||||
setHotelId(other.getHotelId());
|
setHotelId(other.getHotelId());
|
||||||
setName(other.getName());
|
setName(other.getName());
|
||||||
setPhone(other.getPhone());
|
setPhone(other.getPhone());
|
||||||
setAddress(other.address_ != null ? other.getAddress().Clone() : null);
|
setAddress(other.address_ != null ? other.getAddress().Clone() : null);
|
||||||
_unknownFields = Google.Protobuf.UnknownFieldSet.Clone(other._unknownFields);
|
_unknownFields = Google.Protobuf.UnknownFieldSet.Clone(other._unknownFields);
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: C# TO JAVA CONVERTER: Java annotations will not correspond to .NET attributes:
|
// TODO: C# TO JAVA CONVERTER: Java annotations will not correspond to .NET attributes:
|
||||||
//ORIGINAL LINE: [System.Diagnostics.DebuggerNonUserCodeAttribute] public Microsoft.Azure.Cosmos.Serialization
|
//ORIGINAL LINE: [System.Diagnostics.DebuggerNonUserCodeAttribute] public Microsoft.Azure.Cosmos.Serialization
|
||||||
// .HybridRow.Tests.Perf.CassandraHotel.Protobuf.Address Address
|
// .HybridRow.Tests.Perf.CassandraHotel.Protobuf.Address Address
|
||||||
public Address getAddress() {
|
public Address getAddress() {
|
||||||
return address_;
|
return address_;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setAddress(Address value) {
|
public void setAddress(Address value) {
|
||||||
address_ = value;
|
address_ = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: C# TO JAVA CONVERTER: Java annotations will not correspond to .NET attributes:
|
// TODO: C# TO JAVA CONVERTER: Java annotations will not correspond to .NET attributes:
|
||||||
//ORIGINAL LINE: [System.Diagnostics.DebuggerNonUserCodeAttribute] pbr::MessageDescriptor pb::IMessage.Descriptor
|
//ORIGINAL LINE: [System.Diagnostics.DebuggerNonUserCodeAttribute] pbr::MessageDescriptor pb::IMessage.Descriptor
|
||||||
public Google.Protobuf.Reflection getDescriptor() {
|
public Google.Protobuf.Reflection getDescriptor() {
|
||||||
return getDescriptor();
|
return getDescriptor();
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: C# TO JAVA CONVERTER: Java annotations will not correspond to .NET attributes:
|
// TODO: C# TO JAVA CONVERTER: Java annotations will not correspond to .NET attributes:
|
||||||
//ORIGINAL LINE: [System.Diagnostics.DebuggerNonUserCodeAttribute] public static Google.Protobuf.Reflection
|
//ORIGINAL LINE: [System.Diagnostics.DebuggerNonUserCodeAttribute] public static Google.Protobuf.Reflection
|
||||||
// .MessageDescriptor Descriptor
|
// .MessageDescriptor Descriptor
|
||||||
public static Google.Protobuf.Reflection.MessageDescriptor getDescriptor() {
|
public static Google.Protobuf.Reflection.MessageDescriptor getDescriptor() {
|
||||||
return CassandraHotelSchemaReflection.getDescriptor().MessageTypes[2];
|
return CassandraHotelSchemaReflection.getDescriptor().MessageTypes[2];
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: C# TO JAVA CONVERTER: Java annotations will not correspond to .NET attributes:
|
// TODO: C# TO JAVA CONVERTER: Java annotations will not correspond to .NET attributes:
|
||||||
//ORIGINAL LINE: [System.Diagnostics.DebuggerNonUserCodeAttribute] public string HotelId
|
//ORIGINAL LINE: [System.Diagnostics.DebuggerNonUserCodeAttribute] public string HotelId
|
||||||
public String getHotelId() {
|
public String getHotelId() {
|
||||||
return hotelId_;
|
return hotelId_;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setHotelId(String value) {
|
public void setHotelId(String value) {
|
||||||
hotelId_ = value;
|
hotelId_ = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: C# TO JAVA CONVERTER: Java annotations will not correspond to .NET attributes:
|
// TODO: C# TO JAVA CONVERTER: Java annotations will not correspond to .NET attributes:
|
||||||
//ORIGINAL LINE: [System.Diagnostics.DebuggerNonUserCodeAttribute] public string Name
|
//ORIGINAL LINE: [System.Diagnostics.DebuggerNonUserCodeAttribute] public string Name
|
||||||
public String getName() {
|
public String getName() {
|
||||||
return name_;
|
return name_;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setName(String value) {
|
public void setName(String value) {
|
||||||
name_ = value;
|
name_ = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: C# TO JAVA CONVERTER: Java annotations will not correspond to .NET attributes:
|
// TODO: C# TO JAVA CONVERTER: Java annotations will not correspond to .NET attributes:
|
||||||
//ORIGINAL LINE: [System.Diagnostics.DebuggerNonUserCodeAttribute] public static Google.Protobuf
|
//ORIGINAL LINE: [System.Diagnostics.DebuggerNonUserCodeAttribute] public static Google.Protobuf
|
||||||
// .MessageParser<Hotels> Parser
|
// .MessageParser<Hotels> Parser
|
||||||
public static Google.Protobuf.MessageParser<Hotels> getParser() {
|
public static Google.Protobuf.MessageParser<Hotels> getParser() {
|
||||||
return _parser;
|
return _parser;
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: C# TO JAVA CONVERTER: Java annotations will not correspond to .NET attributes:
|
// TODO: C# TO JAVA CONVERTER: Java annotations will not correspond to .NET attributes:
|
||||||
//ORIGINAL LINE: [System.Diagnostics.DebuggerNonUserCodeAttribute] public string Phone
|
//ORIGINAL LINE: [System.Diagnostics.DebuggerNonUserCodeAttribute] public string Phone
|
||||||
public String getPhone() {
|
public String getPhone() {
|
||||||
return phone_;
|
return phone_;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setPhone(String value) {
|
public void setPhone(String value) {
|
||||||
phone_ = value;
|
phone_ = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: C# TO JAVA CONVERTER: Java annotations will not correspond to .NET attributes:
|
// TODO: C# TO JAVA CONVERTER: Java annotations will not correspond to .NET attributes:
|
||||||
//ORIGINAL LINE: [System.Diagnostics.DebuggerNonUserCodeAttribute] public int CalculateSize()
|
//ORIGINAL LINE: [System.Diagnostics.DebuggerNonUserCodeAttribute] public int CalculateSize()
|
||||||
public int CalculateSize() {
|
public int CalculateSize() {
|
||||||
int size = 0;
|
int size = 0;
|
||||||
if (hotelId_ != null) {
|
if (hotelId_ != null) {
|
||||||
size += _single_hotelId_codec.CalculateSizeWithTag(getHotelId());
|
size += _single_hotelId_codec.CalculateSizeWithTag(getHotelId());
|
||||||
}
|
}
|
||||||
if (name_ != null) {
|
if (name_ != null) {
|
||||||
size += _single_name_codec.CalculateSizeWithTag(getName());
|
size += _single_name_codec.CalculateSizeWithTag(getName());
|
||||||
}
|
}
|
||||||
if (phone_ != null) {
|
if (phone_ != null) {
|
||||||
size += _single_phone_codec.CalculateSizeWithTag(getPhone());
|
size += _single_phone_codec.CalculateSizeWithTag(getPhone());
|
||||||
}
|
}
|
||||||
if (address_ != null) {
|
if (address_ != null) {
|
||||||
size += 1 + Google.Protobuf.CodedOutputStream.ComputeMessageSize(getAddress());
|
size += 1 + Google.Protobuf.CodedOutputStream.ComputeMessageSize(getAddress());
|
||||||
}
|
}
|
||||||
if (_unknownFields != null) {
|
if (_unknownFields != null) {
|
||||||
size += _unknownFields.CalculateSize();
|
size += _unknownFields.CalculateSize();
|
||||||
}
|
}
|
||||||
return size;
|
return size;
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: C# TO JAVA CONVERTER: Java annotations will not correspond to .NET attributes:
|
// TODO: C# TO JAVA CONVERTER: Java annotations will not correspond to .NET attributes:
|
||||||
//ORIGINAL LINE: [System.Diagnostics.DebuggerNonUserCodeAttribute] public Hotels Clone()
|
//ORIGINAL LINE: [System.Diagnostics.DebuggerNonUserCodeAttribute] public Hotels Clone()
|
||||||
public Hotels Clone() {
|
public Hotels Clone() {
|
||||||
return new Hotels(this);
|
return new Hotels(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: C# TO JAVA CONVERTER: Java annotations will not correspond to .NET attributes:
|
// TODO: C# TO JAVA CONVERTER: Java annotations will not correspond to .NET attributes:
|
||||||
//ORIGINAL LINE: [System.Diagnostics.DebuggerNonUserCodeAttribute] public void MergeFrom(Hotels other)
|
//ORIGINAL LINE: [System.Diagnostics.DebuggerNonUserCodeAttribute] public void MergeFrom(Hotels other)
|
||||||
public void MergeFrom(Hotels other) {
|
public void MergeFrom(Hotels other) {
|
||||||
if (other == null) {
|
if (other == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (other.hotelId_ != null) {
|
if (other.hotelId_ != null) {
|
||||||
if (hotelId_ == null || !other.getHotelId().equals("")) {
|
if (hotelId_ == null || !other.getHotelId().equals("")) {
|
||||||
setHotelId(other.getHotelId());
|
setHotelId(other.getHotelId());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (other.name_ != null) {
|
if (other.name_ != null) {
|
||||||
if (name_ == null || !other.getName().equals("")) {
|
if (name_ == null || !other.getName().equals("")) {
|
||||||
setName(other.getName());
|
setName(other.getName());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (other.phone_ != null) {
|
if (other.phone_ != null) {
|
||||||
if (phone_ == null || !other.getPhone().equals("")) {
|
if (phone_ == null || !other.getPhone().equals("")) {
|
||||||
setPhone(other.getPhone());
|
setPhone(other.getPhone());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (other.address_ != null) {
|
if (other.address_ != null) {
|
||||||
if (address_ == null) {
|
if (address_ == null) {
|
||||||
address_ = new Address();
|
address_ = new Address();
|
||||||
}
|
}
|
||||||
getAddress().MergeFrom(other.getAddress());
|
getAddress().MergeFrom(other.getAddress());
|
||||||
}
|
}
|
||||||
_unknownFields = Google.Protobuf.UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields);
|
_unknownFields = Google.Protobuf.UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields);
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: C# TO JAVA CONVERTER: Java annotations will not correspond to .NET attributes:
|
// TODO: C# TO JAVA CONVERTER: Java annotations will not correspond to .NET attributes:
|
||||||
//ORIGINAL LINE: [System.Diagnostics.DebuggerNonUserCodeAttribute] public void MergeFrom(Google.Protobuf
|
//ORIGINAL LINE: [System.Diagnostics.DebuggerNonUserCodeAttribute] public void MergeFrom(Google.Protobuf
|
||||||
// .CodedInputStream input)
|
// .CodedInputStream input)
|
||||||
public void MergeFrom(Google.Protobuf.CodedInputStream input) {
|
public void MergeFrom(Google.Protobuf.CodedInputStream input) {
|
||||||
//C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java:
|
//C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java:
|
||||||
//ORIGINAL LINE: uint tag;
|
//ORIGINAL LINE: uint tag;
|
||||||
int tag;
|
int tag;
|
||||||
while ((tag = input.ReadTag()) != 0) {
|
while ((tag = input.ReadTag()) != 0) {
|
||||||
switch (tag) {
|
switch (tag) {
|
||||||
default:
|
default:
|
||||||
_unknownFields = Google.Protobuf.UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
|
_unknownFields = Google.Protobuf.UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
|
||||||
break;
|
break;
|
||||||
case 10: {
|
case 10: {
|
||||||
String value = _single_hotelId_codec.Read(input);
|
String value = _single_hotelId_codec.Read(input);
|
||||||
if (hotelId_ == null || !value.equals("")) {
|
if (hotelId_ == null || !value.equals("")) {
|
||||||
setHotelId(value);
|
setHotelId(value);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 18: {
|
case 18: {
|
||||||
String value = _single_name_codec.Read(input);
|
String value = _single_name_codec.Read(input);
|
||||||
if (name_ == null || !value.equals("")) {
|
if (name_ == null || !value.equals("")) {
|
||||||
setName(value);
|
setName(value);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 26: {
|
case 26: {
|
||||||
String value = _single_phone_codec.Read(input);
|
String value = _single_phone_codec.Read(input);
|
||||||
if (phone_ == null || !value.equals("")) {
|
if (phone_ == null || !value.equals("")) {
|
||||||
setPhone(value);
|
setPhone(value);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 34: {
|
case 34: {
|
||||||
if (address_ == null) {
|
if (address_ == null) {
|
||||||
address_ = new Address();
|
address_ = new Address();
|
||||||
}
|
}
|
||||||
input.ReadMessage(address_);
|
input.ReadMessage(address_);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: C# TO JAVA CONVERTER: Java annotations will not correspond to .NET attributes:
|
// TODO: C# TO JAVA CONVERTER: Java annotations will not correspond to .NET attributes:
|
||||||
//ORIGINAL LINE: [System.Diagnostics.DebuggerNonUserCodeAttribute] public void WriteTo(Google.Protobuf
|
//ORIGINAL LINE: [System.Diagnostics.DebuggerNonUserCodeAttribute] public void WriteTo(Google.Protobuf
|
||||||
// .CodedOutputStream output)
|
// .CodedOutputStream output)
|
||||||
public void WriteTo(Google.Protobuf.CodedOutputStream output) {
|
public void WriteTo(Google.Protobuf.CodedOutputStream output) {
|
||||||
if (hotelId_ != null) {
|
if (hotelId_ != null) {
|
||||||
_single_hotelId_codec.WriteTagAndValue(output, getHotelId());
|
_single_hotelId_codec.WriteTagAndValue(output, getHotelId());
|
||||||
}
|
}
|
||||||
if (name_ != null) {
|
if (name_ != null) {
|
||||||
_single_name_codec.WriteTagAndValue(output, getName());
|
_single_name_codec.WriteTagAndValue(output, getName());
|
||||||
}
|
}
|
||||||
if (phone_ != null) {
|
if (phone_ != null) {
|
||||||
_single_phone_codec.WriteTagAndValue(output, getPhone());
|
_single_phone_codec.WriteTagAndValue(output, getPhone());
|
||||||
}
|
}
|
||||||
if (address_ != null) {
|
if (address_ != null) {
|
||||||
output.WriteRawTag(34);
|
output.WriteRawTag(34);
|
||||||
output.WriteMessage(getAddress());
|
output.WriteMessage(getAddress());
|
||||||
}
|
}
|
||||||
if (_unknownFields != null) {
|
if (_unknownFields != null) {
|
||||||
_unknownFields.WriteTo(output);
|
_unknownFields.WriteTo(output);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: C# TO JAVA CONVERTER: Java annotations will not correspond to .NET attributes:
|
// TODO: C# TO JAVA CONVERTER: Java annotations will not correspond to .NET attributes:
|
||||||
//ORIGINAL LINE: [System.Diagnostics.DebuggerNonUserCodeAttribute] public override bool Equals(object other)
|
//ORIGINAL LINE: [System.Diagnostics.DebuggerNonUserCodeAttribute] public override bool Equals(object other)
|
||||||
@Override
|
@Override
|
||||||
public boolean equals(Object other) {
|
public boolean equals(Object other) {
|
||||||
return Equals(other instanceof Hotels ? (Hotels)other : null);
|
return Equals(other instanceof Hotels ? (Hotels)other : null);
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: C# TO JAVA CONVERTER: Java annotations will not correspond to .NET attributes:
|
// TODO: C# TO JAVA CONVERTER: Java annotations will not correspond to .NET attributes:
|
||||||
//ORIGINAL LINE: [System.Diagnostics.DebuggerNonUserCodeAttribute] public bool Equals(Hotels other)
|
//ORIGINAL LINE: [System.Diagnostics.DebuggerNonUserCodeAttribute] public bool Equals(Hotels other)
|
||||||
public boolean equals(Hotels other) {
|
public boolean equals(Hotels other) {
|
||||||
if (ReferenceEquals(other, null)) {
|
if (ReferenceEquals(other, null)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (ReferenceEquals(other, this)) {
|
if (ReferenceEquals(other, this)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (!getHotelId().equals(other.getHotelId())) {
|
if (!getHotelId().equals(other.getHotelId())) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (!getName().equals(other.getName())) {
|
if (!getName().equals(other.getName())) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (!getPhone().equals(other.getPhone())) {
|
if (!getPhone().equals(other.getPhone())) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (!getAddress().equals(other.getAddress())) {
|
if (!getAddress().equals(other.getAddress())) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return Equals(_unknownFields, other._unknownFields);
|
return Equals(_unknownFields, other._unknownFields);
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: C# TO JAVA CONVERTER: Java annotations will not correspond to .NET attributes:
|
// TODO: C# TO JAVA CONVERTER: Java annotations will not correspond to .NET attributes:
|
||||||
//ORIGINAL LINE: [System.Diagnostics.DebuggerNonUserCodeAttribute] public override int GetHashCode()
|
//ORIGINAL LINE: [System.Diagnostics.DebuggerNonUserCodeAttribute] public override int GetHashCode()
|
||||||
@Override
|
@Override
|
||||||
public int hashCode() {
|
public int hashCode() {
|
||||||
int hash = 1;
|
int hash = 1;
|
||||||
if (hotelId_ != null) {
|
if (hotelId_ != null) {
|
||||||
hash ^= getHotelId().hashCode();
|
hash ^= getHotelId().hashCode();
|
||||||
}
|
}
|
||||||
if (name_ != null) {
|
if (name_ != null) {
|
||||||
hash ^= getName().hashCode();
|
hash ^= getName().hashCode();
|
||||||
}
|
}
|
||||||
if (phone_ != null) {
|
if (phone_ != null) {
|
||||||
hash ^= getPhone().hashCode();
|
hash ^= getPhone().hashCode();
|
||||||
}
|
}
|
||||||
if (address_ != null) {
|
if (address_ != null) {
|
||||||
hash ^= getAddress().hashCode();
|
hash ^= getAddress().hashCode();
|
||||||
}
|
}
|
||||||
if (_unknownFields != null) {
|
if (_unknownFields != null) {
|
||||||
hash ^= _unknownFields.hashCode();
|
hash ^= _unknownFields.hashCode();
|
||||||
}
|
}
|
||||||
return hash;
|
return hash;
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: C# TO JAVA CONVERTER: Java annotations will not correspond to .NET attributes:
|
// TODO: C# TO JAVA CONVERTER: Java annotations will not correspond to .NET attributes:
|
||||||
//ORIGINAL LINE: [System.Diagnostics.DebuggerNonUserCodeAttribute] public override string ToString()
|
//ORIGINAL LINE: [System.Diagnostics.DebuggerNonUserCodeAttribute] public override string ToString()
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return Google.Protobuf.JsonFormatter.ToDiagnosticString(this);
|
return Google.Protobuf.JsonFormatter.ToDiagnosticString(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
+231
-231
@@ -1,232 +1,232 @@
|
|||||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||||
// Licensed under the MIT License.
|
// Licensed under the MIT License.
|
||||||
|
|
||||||
package com.azure.data.cosmos.serialization.hybridrow.perf.cassandrahotel.protobuf;
|
package com.azure.data.cosmos.serialization.hybridrow.perf.cassandrahotel.protobuf;
|
||||||
|
|
||||||
import com.azure.data.cosmos.serialization.hybridrow.perf.*;
|
import com.azure.data.cosmos.serialization.hybridrow.perf.*;
|
||||||
import com.google.protobuf.Message;
|
import com.google.protobuf.Message;
|
||||||
import com.google.protobuf.Parser;
|
import com.google.protobuf.Parser;
|
||||||
|
|
||||||
// <auto-generated>
|
// <auto-generated>
|
||||||
// Generated by the protocol buffer compiler. DO NOT EDIT!
|
// Generated by the protocol buffer compiler. DO NOT EDIT!
|
||||||
// source: TestData/CassandraHotelSchema.proto
|
// source: TestData/CassandraHotelSchema.proto
|
||||||
// </auto-generated>
|
// </auto-generated>
|
||||||
|
|
||||||
//C# TO JAVA CONVERTER NOTE: There is no Java equivalent to C# namespace aliases:
|
//C# TO JAVA CONVERTER NOTE: There is no Java equivalent to C# namespace aliases:
|
||||||
//using pb = Google.Protobuf;
|
//using pb = Google.Protobuf;
|
||||||
//C# TO JAVA CONVERTER NOTE: There is no Java equivalent to C# namespace aliases:
|
//C# TO JAVA CONVERTER NOTE: There is no Java equivalent to C# namespace aliases:
|
||||||
//using pbc = Google.Protobuf.Collections;
|
//using pbc = Google.Protobuf.Collections;
|
||||||
//C# TO JAVA CONVERTER NOTE: There is no Java equivalent to C# namespace aliases:
|
//C# TO JAVA CONVERTER NOTE: There is no Java equivalent to C# namespace aliases:
|
||||||
//using pbr = Google.Protobuf.Reflection;
|
//using pbr = Google.Protobuf.Reflection;
|
||||||
|
|
||||||
public final class PostalCode implements Message<PostalCode> {
|
public final class PostalCode implements Message<PostalCode> {
|
||||||
/**
|
/**
|
||||||
* Field number for the "plus4" field.
|
* Field number for the "plus4" field.
|
||||||
*/
|
*/
|
||||||
public static final int Plus4FieldNumber = 2;
|
public static final int Plus4FieldNumber = 2;
|
||||||
/**
|
/**
|
||||||
* Field number for the "zip" field.
|
* Field number for the "zip" field.
|
||||||
*/
|
*/
|
||||||
public static final int ZipFieldNumber = 1;
|
public static final int ZipFieldNumber = 1;
|
||||||
private static final Parser<PostalCode> _parser = new Parser<PostalCode>(() -> new PostalCode());
|
private static final Parser<PostalCode> _parser = new Parser<PostalCode>(() -> new PostalCode());
|
||||||
private static final Google.Protobuf.FieldCodec<Integer> _single_plus4_codec =
|
private static final Google.Protobuf.FieldCodec<Integer> _single_plus4_codec =
|
||||||
Google.Protobuf.FieldCodec.<Integer>ForStructWrapper(18);
|
Google.Protobuf.FieldCodec.<Integer>ForStructWrapper(18);
|
||||||
private static final Google.Protobuf.FieldCodec<Integer> _single_zip_codec =
|
private static final Google.Protobuf.FieldCodec<Integer> _single_zip_codec =
|
||||||
Google.Protobuf.FieldCodec.<Integer>ForStructWrapper(10);
|
Google.Protobuf.FieldCodec.<Integer>ForStructWrapper(10);
|
||||||
private Google.Protobuf.UnknownFieldSet _unknownFields;
|
private Google.Protobuf.UnknownFieldSet _unknownFields;
|
||||||
|
|
||||||
// TODO: C# TO JAVA CONVERTER: Java does not support 'partial' methods:
|
// TODO: C# TO JAVA CONVERTER: Java does not support 'partial' methods:
|
||||||
// partial void OnConstruction();
|
// partial void OnConstruction();
|
||||||
private Integer plus4_;
|
private Integer plus4_;
|
||||||
private Integer zip_;
|
private Integer zip_;
|
||||||
|
|
||||||
// TODO: C# TO JAVA CONVERTER: Java annotations will not correspond to .NET attributes:
|
// TODO: C# TO JAVA CONVERTER: Java annotations will not correspond to .NET attributes:
|
||||||
//ORIGINAL LINE: [System.Diagnostics.DebuggerNonUserCodeAttribute] public PostalCode()
|
//ORIGINAL LINE: [System.Diagnostics.DebuggerNonUserCodeAttribute] public PostalCode()
|
||||||
public PostalCode() {
|
public PostalCode() {
|
||||||
OnConstruction();
|
OnConstruction();
|
||||||
}
|
}
|
||||||
// TODO: C# TO JAVA CONVERTER: Java annotations will not correspond to .NET attributes:
|
// TODO: C# TO JAVA CONVERTER: Java annotations will not correspond to .NET attributes:
|
||||||
//ORIGINAL LINE: [System.Diagnostics.DebuggerNonUserCodeAttribute] public PostalCode(PostalCode other)
|
//ORIGINAL LINE: [System.Diagnostics.DebuggerNonUserCodeAttribute] public PostalCode(PostalCode other)
|
||||||
public PostalCode(PostalCode other) {
|
public PostalCode(PostalCode other) {
|
||||||
this();
|
this();
|
||||||
setZip(other.getZip());
|
setZip(other.getZip());
|
||||||
setPlus4(other.getPlus4());
|
setPlus4(other.getPlus4());
|
||||||
_unknownFields = Google.Protobuf.UnknownFieldSet.Clone(other._unknownFields);
|
_unknownFields = Google.Protobuf.UnknownFieldSet.Clone(other._unknownFields);
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: C# TO JAVA CONVERTER: Java annotations will not correspond to .NET attributes:
|
// TODO: C# TO JAVA CONVERTER: Java annotations will not correspond to .NET attributes:
|
||||||
//ORIGINAL LINE: [System.Diagnostics.DebuggerNonUserCodeAttribute] public static Google.Protobuf.Reflection
|
//ORIGINAL LINE: [System.Diagnostics.DebuggerNonUserCodeAttribute] public static Google.Protobuf.Reflection
|
||||||
// .MessageDescriptor Descriptor
|
// .MessageDescriptor Descriptor
|
||||||
public static Google.Protobuf.Reflection.MessageDescriptor getDescriptor() {
|
public static Google.Protobuf.Reflection.MessageDescriptor getDescriptor() {
|
||||||
return CassandraHotelSchemaReflection.getDescriptor().MessageTypes[0];
|
return CassandraHotelSchemaReflection.getDescriptor().MessageTypes[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: C# TO JAVA CONVERTER: Java annotations will not correspond to .NET attributes:
|
// TODO: C# TO JAVA CONVERTER: Java annotations will not correspond to .NET attributes:
|
||||||
//ORIGINAL LINE: [System.Diagnostics.DebuggerNonUserCodeAttribute] pbr::MessageDescriptor pb::IMessage.Descriptor
|
//ORIGINAL LINE: [System.Diagnostics.DebuggerNonUserCodeAttribute] pbr::MessageDescriptor pb::IMessage.Descriptor
|
||||||
public Google.Protobuf.Reflection getDescriptor() {
|
public Google.Protobuf.Reflection getDescriptor() {
|
||||||
return getDescriptor();
|
return getDescriptor();
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: C# TO JAVA CONVERTER: Java annotations will not correspond to .NET attributes:
|
// TODO: C# TO JAVA CONVERTER: Java annotations will not correspond to .NET attributes:
|
||||||
//ORIGINAL LINE: [System.Diagnostics.DebuggerNonUserCodeAttribute] public static Google.Protobuf
|
//ORIGINAL LINE: [System.Diagnostics.DebuggerNonUserCodeAttribute] public static Google.Protobuf
|
||||||
// .MessageParser<PostalCode> Parser
|
// .MessageParser<PostalCode> Parser
|
||||||
public static Google.Protobuf.MessageParser<PostalCode> getParser() {
|
public static Google.Protobuf.MessageParser<PostalCode> getParser() {
|
||||||
return _parser;
|
return _parser;
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: C# TO JAVA CONVERTER: Java annotations will not correspond to .NET attributes:
|
// TODO: C# TO JAVA CONVERTER: Java annotations will not correspond to .NET attributes:
|
||||||
//ORIGINAL LINE: [System.Diagnostics.DebuggerNonUserCodeAttribute] public Nullable<int> Plus4
|
//ORIGINAL LINE: [System.Diagnostics.DebuggerNonUserCodeAttribute] public Nullable<int> Plus4
|
||||||
public Integer getPlus4() {
|
public Integer getPlus4() {
|
||||||
return plus4_;
|
return plus4_;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setPlus4(Integer value) {
|
public void setPlus4(Integer value) {
|
||||||
plus4_ = value;
|
plus4_ = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: C# TO JAVA CONVERTER: Java annotations will not correspond to .NET attributes:
|
// TODO: C# TO JAVA CONVERTER: Java annotations will not correspond to .NET attributes:
|
||||||
//ORIGINAL LINE: [System.Diagnostics.DebuggerNonUserCodeAttribute] public Nullable<int> Zip
|
//ORIGINAL LINE: [System.Diagnostics.DebuggerNonUserCodeAttribute] public Nullable<int> Zip
|
||||||
public Integer getZip() {
|
public Integer getZip() {
|
||||||
return zip_;
|
return zip_;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setZip(Integer value) {
|
public void setZip(Integer value) {
|
||||||
zip_ = value;
|
zip_ = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: C# TO JAVA CONVERTER: Java annotations will not correspond to .NET attributes:
|
// TODO: C# TO JAVA CONVERTER: Java annotations will not correspond to .NET attributes:
|
||||||
//ORIGINAL LINE: [System.Diagnostics.DebuggerNonUserCodeAttribute] public int CalculateSize()
|
//ORIGINAL LINE: [System.Diagnostics.DebuggerNonUserCodeAttribute] public int CalculateSize()
|
||||||
public int CalculateSize() {
|
public int CalculateSize() {
|
||||||
int size = 0;
|
int size = 0;
|
||||||
if (zip_ != null) {
|
if (zip_ != null) {
|
||||||
size += _single_zip_codec.CalculateSizeWithTag(getZip());
|
size += _single_zip_codec.CalculateSizeWithTag(getZip());
|
||||||
}
|
}
|
||||||
if (plus4_ != null) {
|
if (plus4_ != null) {
|
||||||
size += _single_plus4_codec.CalculateSizeWithTag(getPlus4());
|
size += _single_plus4_codec.CalculateSizeWithTag(getPlus4());
|
||||||
}
|
}
|
||||||
if (_unknownFields != null) {
|
if (_unknownFields != null) {
|
||||||
size += _unknownFields.CalculateSize();
|
size += _unknownFields.CalculateSize();
|
||||||
}
|
}
|
||||||
return size;
|
return size;
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: C# TO JAVA CONVERTER: Java annotations will not correspond to .NET attributes:
|
// TODO: C# TO JAVA CONVERTER: Java annotations will not correspond to .NET attributes:
|
||||||
//ORIGINAL LINE: [System.Diagnostics.DebuggerNonUserCodeAttribute] public PostalCode Clone()
|
//ORIGINAL LINE: [System.Diagnostics.DebuggerNonUserCodeAttribute] public PostalCode Clone()
|
||||||
public PostalCode Clone() {
|
public PostalCode Clone() {
|
||||||
return new PostalCode(this);
|
return new PostalCode(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: C# TO JAVA CONVERTER: Java annotations will not correspond to .NET attributes:
|
// TODO: C# TO JAVA CONVERTER: Java annotations will not correspond to .NET attributes:
|
||||||
//ORIGINAL LINE: [System.Diagnostics.DebuggerNonUserCodeAttribute] public void MergeFrom(PostalCode other)
|
//ORIGINAL LINE: [System.Diagnostics.DebuggerNonUserCodeAttribute] public void MergeFrom(PostalCode other)
|
||||||
public void MergeFrom(PostalCode other) {
|
public void MergeFrom(PostalCode other) {
|
||||||
if (other == null) {
|
if (other == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (other.zip_ != null) {
|
if (other.zip_ != null) {
|
||||||
if (zip_ == null || other.getZip() != 0) {
|
if (zip_ == null || other.getZip() != 0) {
|
||||||
setZip(other.getZip());
|
setZip(other.getZip());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (other.plus4_ != null) {
|
if (other.plus4_ != null) {
|
||||||
if (plus4_ == null || other.getPlus4() != 0) {
|
if (plus4_ == null || other.getPlus4() != 0) {
|
||||||
setPlus4(other.getPlus4());
|
setPlus4(other.getPlus4());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
_unknownFields = Google.Protobuf.UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields);
|
_unknownFields = Google.Protobuf.UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields);
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: C# TO JAVA CONVERTER: Java annotations will not correspond to .NET attributes:
|
// TODO: C# TO JAVA CONVERTER: Java annotations will not correspond to .NET attributes:
|
||||||
//ORIGINAL LINE: [System.Diagnostics.DebuggerNonUserCodeAttribute] public void MergeFrom(Google.Protobuf
|
//ORIGINAL LINE: [System.Diagnostics.DebuggerNonUserCodeAttribute] public void MergeFrom(Google.Protobuf
|
||||||
// .CodedInputStream input)
|
// .CodedInputStream input)
|
||||||
public void MergeFrom(Google.Protobuf.CodedInputStream input) {
|
public void MergeFrom(Google.Protobuf.CodedInputStream input) {
|
||||||
//C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java:
|
//C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java:
|
||||||
//ORIGINAL LINE: uint tag;
|
//ORIGINAL LINE: uint tag;
|
||||||
int tag;
|
int tag;
|
||||||
while ((tag = input.ReadTag()) != 0) {
|
while ((tag = input.ReadTag()) != 0) {
|
||||||
switch (tag) {
|
switch (tag) {
|
||||||
default:
|
default:
|
||||||
_unknownFields = Google.Protobuf.UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
|
_unknownFields = Google.Protobuf.UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
|
||||||
break;
|
break;
|
||||||
case 10: {
|
case 10: {
|
||||||
Integer value = _single_zip_codec.Read(input);
|
Integer value = _single_zip_codec.Read(input);
|
||||||
if (zip_ == null || value != 0) {
|
if (zip_ == null || value != 0) {
|
||||||
setZip(value);
|
setZip(value);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 18: {
|
case 18: {
|
||||||
Integer value = _single_plus4_codec.Read(input);
|
Integer value = _single_plus4_codec.Read(input);
|
||||||
if (plus4_ == null || value != 0) {
|
if (plus4_ == null || value != 0) {
|
||||||
setPlus4(value);
|
setPlus4(value);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: C# TO JAVA CONVERTER: Java annotations will not correspond to .NET attributes:
|
// TODO: C# TO JAVA CONVERTER: Java annotations will not correspond to .NET attributes:
|
||||||
//ORIGINAL LINE: [System.Diagnostics.DebuggerNonUserCodeAttribute] public void WriteTo(Google.Protobuf
|
//ORIGINAL LINE: [System.Diagnostics.DebuggerNonUserCodeAttribute] public void WriteTo(Google.Protobuf
|
||||||
// .CodedOutputStream output)
|
// .CodedOutputStream output)
|
||||||
public void WriteTo(Google.Protobuf.CodedOutputStream output) {
|
public void WriteTo(Google.Protobuf.CodedOutputStream output) {
|
||||||
if (zip_ != null) {
|
if (zip_ != null) {
|
||||||
_single_zip_codec.WriteTagAndValue(output, getZip());
|
_single_zip_codec.WriteTagAndValue(output, getZip());
|
||||||
}
|
}
|
||||||
if (plus4_ != null) {
|
if (plus4_ != null) {
|
||||||
_single_plus4_codec.WriteTagAndValue(output, getPlus4());
|
_single_plus4_codec.WriteTagAndValue(output, getPlus4());
|
||||||
}
|
}
|
||||||
if (_unknownFields != null) {
|
if (_unknownFields != null) {
|
||||||
_unknownFields.WriteTo(output);
|
_unknownFields.WriteTo(output);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: C# TO JAVA CONVERTER: Java annotations will not correspond to .NET attributes:
|
// TODO: C# TO JAVA CONVERTER: Java annotations will not correspond to .NET attributes:
|
||||||
//ORIGINAL LINE: [System.Diagnostics.DebuggerNonUserCodeAttribute] public override bool Equals(object other)
|
//ORIGINAL LINE: [System.Diagnostics.DebuggerNonUserCodeAttribute] public override bool Equals(object other)
|
||||||
@Override
|
@Override
|
||||||
public boolean equals(Object other) {
|
public boolean equals(Object other) {
|
||||||
return Equals(other instanceof PostalCode ? (PostalCode)other : null);
|
return Equals(other instanceof PostalCode ? (PostalCode)other : null);
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: C# TO JAVA CONVERTER: Java annotations will not correspond to .NET attributes:
|
// TODO: C# TO JAVA CONVERTER: Java annotations will not correspond to .NET attributes:
|
||||||
//ORIGINAL LINE: [System.Diagnostics.DebuggerNonUserCodeAttribute] public bool Equals(PostalCode other)
|
//ORIGINAL LINE: [System.Diagnostics.DebuggerNonUserCodeAttribute] public bool Equals(PostalCode other)
|
||||||
public boolean equals(PostalCode other) {
|
public boolean equals(PostalCode other) {
|
||||||
if (ReferenceEquals(other, null)) {
|
if (ReferenceEquals(other, null)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (ReferenceEquals(other, this)) {
|
if (ReferenceEquals(other, this)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (getZip() != other.getZip()) {
|
if (getZip() != other.getZip()) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (getPlus4() != other.getPlus4()) {
|
if (getPlus4() != other.getPlus4()) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return Equals(_unknownFields, other._unknownFields);
|
return Equals(_unknownFields, other._unknownFields);
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: C# TO JAVA CONVERTER: Java annotations will not correspond to .NET attributes:
|
// TODO: C# TO JAVA CONVERTER: Java annotations will not correspond to .NET attributes:
|
||||||
//ORIGINAL LINE: [System.Diagnostics.DebuggerNonUserCodeAttribute] public override int GetHashCode()
|
//ORIGINAL LINE: [System.Diagnostics.DebuggerNonUserCodeAttribute] public override int GetHashCode()
|
||||||
@Override
|
@Override
|
||||||
public int hashCode() {
|
public int hashCode() {
|
||||||
int hash = 1;
|
int hash = 1;
|
||||||
if (zip_ != null) {
|
if (zip_ != null) {
|
||||||
hash ^= getZip().hashCode();
|
hash ^= getZip().hashCode();
|
||||||
}
|
}
|
||||||
if (plus4_ != null) {
|
if (plus4_ != null) {
|
||||||
hash ^= getPlus4().hashCode();
|
hash ^= getPlus4().hashCode();
|
||||||
}
|
}
|
||||||
if (_unknownFields != null) {
|
if (_unknownFields != null) {
|
||||||
hash ^= _unknownFields.hashCode();
|
hash ^= _unknownFields.hashCode();
|
||||||
}
|
}
|
||||||
return hash;
|
return hash;
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: C# TO JAVA CONVERTER: Java annotations will not correspond to .NET attributes:
|
// TODO: C# TO JAVA CONVERTER: Java annotations will not correspond to .NET attributes:
|
||||||
//ORIGINAL LINE: [System.Diagnostics.DebuggerNonUserCodeAttribute] public override string ToString()
|
//ORIGINAL LINE: [System.Diagnostics.DebuggerNonUserCodeAttribute] public override string ToString()
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return Google.Protobuf.JsonFormatter.ToDiagnosticString(this);
|
return Google.Protobuf.JsonFormatter.ToDiagnosticString(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
+44
-44
@@ -1,45 +1,45 @@
|
|||||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||||
// Licensed under the MIT License.
|
// Licensed under the MIT License.
|
||||||
|
|
||||||
package com.azure.data.cosmos.serialization.hybridrow.unit;
|
package com.azure.data.cosmos.serialization.hybridrow.unit;
|
||||||
|
|
||||||
public final class ArrayAssert {
|
public final class ArrayAssert {
|
||||||
public static <T> void AreEqual(T[] expected, T[] actual) {
|
public static <T> void AreEqual(T[] expected, T[] actual) {
|
||||||
if (expected == null) {
|
if (expected == null) {
|
||||||
assert actual == null;
|
assert actual == null;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
assert actual != null;
|
assert actual != null;
|
||||||
assert expected.length == actual.length;
|
assert expected.length == actual.length;
|
||||||
for (int i = 0; i < expected.length; i++) {
|
for (int i = 0; i < expected.length; i++) {
|
||||||
assert expected[i] == actual[i];
|
assert expected[i] == actual[i];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static <T> void AreEqual(T[] expected, T[] actual, String message) {
|
public static <T> void AreEqual(T[] expected, T[] actual, String message) {
|
||||||
if (expected == null) {
|
if (expected == null) {
|
||||||
Assert.IsNull(actual, message);
|
Assert.IsNull(actual, message);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Assert.IsNotNull(actual, message);
|
Assert.IsNotNull(actual, message);
|
||||||
Assert.AreEqual(expected.length, actual.length, message);
|
Assert.AreEqual(expected.length, actual.length, message);
|
||||||
for (int i = 0; i < expected.length; i++) {
|
for (int i = 0; i < expected.length; i++) {
|
||||||
Assert.AreEqual(expected[i], actual[i], message);
|
Assert.AreEqual(expected[i], actual[i], message);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static <T> void AreEqual(T[] expected, T[] actual, String message, Object... parameters) {
|
public static <T> void AreEqual(T[] expected, T[] actual, String message, Object... parameters) {
|
||||||
if (expected == null) {
|
if (expected == null) {
|
||||||
Assert.IsNull(actual, message, parameters);
|
Assert.IsNull(actual, message, parameters);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Assert.IsNotNull(actual, message, parameters);
|
Assert.IsNotNull(actual, message, parameters);
|
||||||
Assert.AreEqual(expected.length, actual.length, message, parameters);
|
Assert.AreEqual(expected.length, actual.length, message, parameters);
|
||||||
for (int i = 0; i < expected.length; i++) {
|
for (int i = 0; i < expected.length; i++) {
|
||||||
Assert.AreEqual(expected[i], actual[i], message, parameters);
|
Assert.AreEqual(expected[i], actual[i], message, parameters);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+108
-108
@@ -1,109 +1,109 @@
|
|||||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||||
// Licensed under the MIT License.
|
// Licensed under the MIT License.
|
||||||
|
|
||||||
package com.azure.data.cosmos.serialization.hybridrow.unit;
|
package com.azure.data.cosmos.serialization.hybridrow.unit;
|
||||||
|
|
||||||
public final class AssertThrowsException {
|
public final class AssertThrowsException {
|
||||||
/**
|
/**
|
||||||
* Safely converts an object to a string, handling null values and null characters. Null
|
* Safely converts an object to a string, handling null values and null characters. Null
|
||||||
* values are converted to "(null)". Null characters are converted to "\\0".
|
* values are converted to "(null)". Null characters are converted to "\\0".
|
||||||
*
|
*
|
||||||
* @param input The object to convert to a string.
|
* @param input The object to convert to a string.
|
||||||
* @return The converted string.
|
* @return The converted string.
|
||||||
*/
|
*/
|
||||||
public static String ReplaceNulls(Object input) {
|
public static String ReplaceNulls(Object input) {
|
||||||
String input1 = input == null ? null : input.toString();
|
String input1 = input == null ? null : input.toString();
|
||||||
if (input1 == null) {
|
if (input1 == null) {
|
||||||
return "(null)";
|
return "(null)";
|
||||||
}
|
}
|
||||||
return Assert.ReplaceNullChars(input1);
|
return Assert.ReplaceNullChars(input1);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Tests whether the code specified by delegate <paramref name="action" /> throws exact given
|
* Tests whether the code specified by delegate <paramref name="action" /> throws exact given
|
||||||
* exception of type <typeparamref name="T" /> (and not of derived type) and throws <code>
|
* exception of type <typeparamref name="T" /> (and not of derived type) and throws <code>
|
||||||
* AssertFailedException
|
* AssertFailedException
|
||||||
* </code> if code does not throws exception or throws exception of type other than
|
* </code> if code does not throws exception or throws exception of type other than
|
||||||
* <typeparamref name="T" />.
|
* <typeparamref name="T" />.
|
||||||
*
|
*
|
||||||
* @param action Delegate to code to be tested and which is expected to throw exception.
|
* @param action Delegate to code to be tested and which is expected to throw exception.
|
||||||
* @param message The message to include in the exception when <paramref name="action" /> does
|
* @param message The message to include in the exception when <paramref name="action" /> does
|
||||||
* not throws exception of type <typeparamref name="T" />.
|
* not throws exception of type <typeparamref name="T" />.
|
||||||
*
|
*
|
||||||
* <typeparam name="T">Type of exception expected to be thrown.</typeparam>
|
* <typeparam name="T">Type of exception expected to be thrown.</typeparam>
|
||||||
* @return The exception that was thrown.
|
* @return The exception that was thrown.
|
||||||
* @throws T:Microsoft.VisualStudio.TestTools.UnitTesting.AssertFailedException Thrown if
|
* @throws T:Microsoft.VisualStudio.TestTools.UnitTesting.AssertFailedException Thrown if
|
||||||
* <paramref name="action" /> does
|
* <paramref name="action" /> does
|
||||||
* not throws exception of type
|
* not throws exception of type
|
||||||
* <typeparamref name="T" />.
|
* <typeparamref name="T" />.
|
||||||
*/
|
*/
|
||||||
public static <T extends RuntimeException> T ThrowsException(tangible.Action0Param action, String message) {
|
public static <T extends RuntimeException> T ThrowsException(tangible.Action0Param action, String message) {
|
||||||
return AssertThrowsException.ThrowsException(action, message, null);
|
return AssertThrowsException.ThrowsException(action, message, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Tests whether the code specified by delegate <paramref name="action" /> throws exact given
|
* Tests whether the code specified by delegate <paramref name="action" /> throws exact given
|
||||||
* exception of type <typeparamref name="T" /> (and not of derived type) and throws <code>
|
* exception of type <typeparamref name="T" /> (and not of derived type) and throws <code>
|
||||||
* AssertFailedException
|
* AssertFailedException
|
||||||
* </code> if code does not throws exception or throws exception of type other than
|
* </code> if code does not throws exception or throws exception of type other than
|
||||||
* <typeparamref name="T" />.
|
* <typeparamref name="T" />.
|
||||||
*
|
*
|
||||||
* @param action Delegate to code to be tested and which is expected to throw exception.
|
* @param action Delegate to code to be tested and which is expected to throw exception.
|
||||||
* @param message The message to include in the exception when <paramref name="action" /> does
|
* @param message The message to include in the exception when <paramref name="action" /> does
|
||||||
* not throws exception of type <typeparamref name="T" />.
|
* not throws exception of type <typeparamref name="T" />.
|
||||||
* @param parameters An array of parameters to use when formatting <paramref name="message" />.
|
* @param parameters An array of parameters to use when formatting <paramref name="message" />.
|
||||||
* <typeparam name="T">Type of exception expected to be thrown.</typeparam>
|
* <typeparam name="T">Type of exception expected to be thrown.</typeparam>
|
||||||
* @return The exception that was thrown.
|
* @return The exception that was thrown.
|
||||||
* @throws T:Microsoft.VisualStudio.TestTools.UnitTesting.AssertFailedException Thrown if
|
* @throws T:Microsoft.VisualStudio.TestTools.UnitTesting.AssertFailedException Thrown if
|
||||||
* <paramref name="action" /> does
|
* <paramref name="action" /> does
|
||||||
* not throws exception of type
|
* not throws exception of type
|
||||||
* <typeparamref name="T" />.
|
* <typeparamref name="T" />.
|
||||||
*/
|
*/
|
||||||
public static <T extends RuntimeException> T ThrowsException(tangible.Action0Param action, String message,
|
public static <T extends RuntimeException> T ThrowsException(tangible.Action0Param action, String message,
|
||||||
Object... parameters) {
|
Object... parameters) {
|
||||||
if (action == null) {
|
if (action == null) {
|
||||||
throw new NullPointerException("action");
|
throw new NullPointerException("action");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (message == null) {
|
if (message == null) {
|
||||||
throw new NullPointerException("message");
|
throw new NullPointerException("message");
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
action.invoke();
|
action.invoke();
|
||||||
} catch (RuntimeException ex) {
|
} catch (RuntimeException ex) {
|
||||||
if (T.class != ex.getClass()) {
|
if (T.class != ex.getClass()) {
|
||||||
Assert.Fail(String.format("Threw exception %3$s, but exception %2$s was expected. %1$s\nException " +
|
Assert.Fail(String.format("Threw exception %3$s, but exception %2$s was expected. %1$s\nException " +
|
||||||
"Message: %4$s\nStack Trace: %5$s", AssertThrowsException.ReplaceNulls(message),
|
"Message: %4$s\nStack Trace: %5$s", AssertThrowsException.ReplaceNulls(message),
|
||||||
(Object)T.class.Name, ex.getClass().getSimpleName(), ex.getMessage(),
|
(Object)T.class.Name, ex.getClass().getSimpleName(), ex.getMessage(),
|
||||||
(Object)ex.StackTrace), parameters);
|
(Object)ex.StackTrace), parameters);
|
||||||
}
|
}
|
||||||
|
|
||||||
return (T)ex;
|
return (T)ex;
|
||||||
}
|
}
|
||||||
|
|
||||||
Assert.Fail(String.format("No exception thrown. %2$s exception was expected. %1$s",
|
Assert.Fail(String.format("No exception thrown. %2$s exception was expected. %1$s",
|
||||||
AssertThrowsException.ReplaceNulls(message), T.class.Name), parameters);
|
AssertThrowsException.ReplaceNulls(message), T.class.Name), parameters);
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Tests whether the code specified by delegate <paramref name="action" /> throws exact given
|
* Tests whether the code specified by delegate <paramref name="action" /> throws exact given
|
||||||
* exception of type <typeparamref name="T" /> (and not of derived type) and throws <code>
|
* exception of type <typeparamref name="T" /> (and not of derived type) and throws <code>
|
||||||
* AssertFailedException
|
* AssertFailedException
|
||||||
* </code> if code does not throws exception or throws exception of type other than
|
* </code> if code does not throws exception or throws exception of type other than
|
||||||
* <typeparamref name="T" />.
|
* <typeparamref name="T" />.
|
||||||
*
|
*
|
||||||
* @param action Delegate to code to be tested and which is expected to throw exception.
|
* @param action Delegate to code to be tested and which is expected to throw exception.
|
||||||
* <typeparam name="T">Type of exception expected to be thrown.</typeparam>
|
* <typeparam name="T">Type of exception expected to be thrown.</typeparam>
|
||||||
* @return The exception that was thrown.
|
* @return The exception that was thrown.
|
||||||
* @throws T:Microsoft.VisualStudio.TestTools.UnitTesting.AssertFailedException Thrown if
|
* @throws T:Microsoft.VisualStudio.TestTools.UnitTesting.AssertFailedException Thrown if
|
||||||
* <paramref name="action" /> does
|
* <paramref name="action" /> does
|
||||||
* not throws exception of type
|
* not throws exception of type
|
||||||
* <typeparamref name="T" />.
|
* <typeparamref name="T" />.
|
||||||
*/
|
*/
|
||||||
public static <T extends RuntimeException> T ThrowsException(tangible.Action0Param action) {
|
public static <T extends RuntimeException> T ThrowsException(tangible.Action0Param action) {
|
||||||
return AssertThrowsException.ThrowsException(action, "", null);
|
return AssertThrowsException.ThrowsException(action, "", null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+613
-613
File diff suppressed because it is too large
Load Diff
+891
-891
File diff suppressed because it is too large
Load Diff
+166
-166
@@ -1,167 +1,167 @@
|
|||||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||||
// Licensed under the MIT License.
|
// Licensed under the MIT License.
|
||||||
|
|
||||||
package com.azure.data.cosmos.serialization.hybridrow.unit;
|
package com.azure.data.cosmos.serialization.hybridrow.unit;
|
||||||
|
|
||||||
import com.azure.data.cosmos.core.Out;
|
import com.azure.data.cosmos.core.Out;
|
||||||
import com.azure.data.cosmos.core.Reference;
|
import com.azure.data.cosmos.core.Reference;
|
||||||
import com.azure.data.cosmos.serialization.hybridrow.RowBuffer;
|
import com.azure.data.cosmos.serialization.hybridrow.RowBuffer;
|
||||||
import com.azure.data.cosmos.serialization.hybridrow.RowCursor;
|
import com.azure.data.cosmos.serialization.hybridrow.RowCursor;
|
||||||
import com.azure.data.cosmos.serialization.hybridrow.layouts.LayoutIndexedScope;
|
import com.azure.data.cosmos.serialization.hybridrow.layouts.LayoutIndexedScope;
|
||||||
import com.azure.data.cosmos.serialization.hybridrow.layouts.LayoutType;
|
import com.azure.data.cosmos.serialization.hybridrow.layouts.LayoutType;
|
||||||
import com.azure.data.cosmos.serialization.hybridrow.layouts.LayoutTypedSet;
|
import com.azure.data.cosmos.serialization.hybridrow.layouts.LayoutTypedSet;
|
||||||
import com.azure.data.cosmos.serialization.hybridrow.layouts.TypeArgumentList;
|
import com.azure.data.cosmos.serialization.hybridrow.layouts.TypeArgumentList;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
//C# TO JAVA CONVERTER WARNING: Java does not allow user-defined value types. The behavior of this class may differ
|
//C# TO JAVA CONVERTER WARNING: Java does not allow user-defined value types. The behavior of this class may differ
|
||||||
// from the original:
|
// from the original:
|
||||||
//ORIGINAL LINE: internal struct DeleteRowDispatcher : IDispatcher
|
//ORIGINAL LINE: internal struct DeleteRowDispatcher : IDispatcher
|
||||||
public final class DeleteRowDispatcher implements IDispatcher {
|
public final class DeleteRowDispatcher implements IDispatcher {
|
||||||
|
|
||||||
public <TLayout extends LayoutType<TValue>, TValue> void Dispatch(Reference<RowOperationDispatcher> dispatcher, Reference<RowCursor> root, LayoutColumn col, LayoutType t) {
|
public <TLayout extends LayoutType<TValue>, TValue> void Dispatch(Reference<RowOperationDispatcher> dispatcher, Reference<RowCursor> root, LayoutColumn col, LayoutType t) {
|
||||||
Dispatch(dispatcher, root, col, t, null);
|
Dispatch(dispatcher, root, col, t, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
//C# TO JAVA CONVERTER NOTE: Java does not support optional parameters. Overloaded method(s) are created above:
|
//C# TO JAVA CONVERTER NOTE: Java does not support optional parameters. Overloaded method(s) are created above:
|
||||||
//ORIGINAL LINE: public void Dispatch<TLayout, TValue>(ref RowOperationDispatcher dispatcher, ref RowCursor root,
|
//ORIGINAL LINE: public void Dispatch<TLayout, TValue>(ref RowOperationDispatcher dispatcher, ref RowCursor root,
|
||||||
// LayoutColumn col, LayoutType t, TValue value = default) where TLayout : LayoutType<TValue>
|
// LayoutColumn col, LayoutType t, TValue value = default) where TLayout : LayoutType<TValue>
|
||||||
public <TLayout extends LayoutType<TValue>, TValue> void Dispatch(Reference<RowOperationDispatcher> dispatcher, Reference<RowCursor> root, LayoutColumn col, LayoutType t, TValue value) {
|
public <TLayout extends LayoutType<TValue>, TValue> void Dispatch(Reference<RowOperationDispatcher> dispatcher, Reference<RowCursor> root, LayoutColumn col, LayoutType t, TValue value) {
|
||||||
Reference<RowBuffer> tempReference_Row =
|
Reference<RowBuffer> tempReference_Row =
|
||||||
new Reference<RowBuffer>(dispatcher.get().Row);
|
new Reference<RowBuffer>(dispatcher.get().Row);
|
||||||
ResultAssert.IsSuccess(t.<TLayout>typeAs().deleteSparse(tempReference_Row, root));
|
ResultAssert.IsSuccess(t.<TLayout>typeAs().deleteSparse(tempReference_Row, root));
|
||||||
dispatcher.get().argValue.Row = tempReference_Row.get();
|
dispatcher.get().argValue.Row = tempReference_Row.get();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void DispatchArray(Reference<RowOperationDispatcher> dispatcher,
|
public void DispatchArray(Reference<RowOperationDispatcher> dispatcher,
|
||||||
Reference<RowCursor> scope, LayoutType t, TypeArgumentList typeArgs,
|
Reference<RowCursor> scope, LayoutType t, TypeArgumentList typeArgs,
|
||||||
Object value) {
|
Object value) {
|
||||||
checkArgument(typeArgs.count() == 1);
|
checkArgument(typeArgs.count() == 1);
|
||||||
|
|
||||||
Reference<RowBuffer> tempReference_Row =
|
Reference<RowBuffer> tempReference_Row =
|
||||||
new Reference<RowBuffer>(dispatcher.get().Row);
|
new Reference<RowBuffer>(dispatcher.get().Row);
|
||||||
RowCursor arrayScope;
|
RowCursor arrayScope;
|
||||||
Out<RowCursor> tempOut_arrayScope =
|
Out<RowCursor> tempOut_arrayScope =
|
||||||
new Out<RowCursor>();
|
new Out<RowCursor>();
|
||||||
ResultAssert.IsSuccess(t.<LayoutTypedArray>typeAs().ReadScope(tempReference_Row, scope, tempOut_arrayScope));
|
ResultAssert.IsSuccess(t.<LayoutTypedArray>typeAs().ReadScope(tempReference_Row, scope, tempOut_arrayScope));
|
||||||
arrayScope = tempOut_arrayScope.get();
|
arrayScope = tempOut_arrayScope.get();
|
||||||
dispatcher.get().argValue.Row = tempReference_Row.get();
|
dispatcher.get().argValue.Row = tempReference_Row.get();
|
||||||
|
|
||||||
if (!arrayScope.Immutable) {
|
if (!arrayScope.Immutable) {
|
||||||
List items = (List)value;
|
List items = (List)value;
|
||||||
for (Object item : items) {
|
for (Object item : items) {
|
||||||
Reference<RowBuffer> tempReference_Row2 =
|
Reference<RowBuffer> tempReference_Row2 =
|
||||||
new Reference<RowBuffer>(dispatcher.get().Row);
|
new Reference<RowBuffer>(dispatcher.get().Row);
|
||||||
assert arrayScope.MoveNext(tempReference_Row2);
|
assert arrayScope.MoveNext(tempReference_Row2);
|
||||||
dispatcher.get().argValue.Row = tempReference_Row2.get();
|
dispatcher.get().argValue.Row = tempReference_Row2.get();
|
||||||
// TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'ref' keyword -
|
// TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'ref' keyword -
|
||||||
// these cannot be converted using the 'Ref' helper class unless the method is within the code
|
// these cannot be converted using the 'Ref' helper class unless the method is within the code
|
||||||
// being modified:
|
// being modified:
|
||||||
dispatcher.get().LayoutCodeSwitch(ref arrayScope, null, typeArgs.get(0).type(),
|
dispatcher.get().LayoutCodeSwitch(ref arrayScope, null, typeArgs.get(0).type(),
|
||||||
typeArgs.get(0).typeArgs().clone(), item);
|
typeArgs.get(0).typeArgs().clone(), item);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Reference<RowBuffer> tempReference_Row3 =
|
Reference<RowBuffer> tempReference_Row3 =
|
||||||
new Reference<RowBuffer>(dispatcher.get().Row);
|
new Reference<RowBuffer>(dispatcher.get().Row);
|
||||||
ResultAssert.IsSuccess(t.<LayoutTypedArray>typeAs().DeleteScope(tempReference_Row3, scope));
|
ResultAssert.IsSuccess(t.<LayoutTypedArray>typeAs().DeleteScope(tempReference_Row3, scope));
|
||||||
dispatcher.get().argValue.Row = tempReference_Row3.get();
|
dispatcher.get().argValue.Row = tempReference_Row3.get();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void DispatchMap(Reference<RowOperationDispatcher> dispatcher,
|
public void DispatchMap(Reference<RowOperationDispatcher> dispatcher,
|
||||||
Reference<RowCursor> scope, LayoutType t, TypeArgumentList typeArgs,
|
Reference<RowCursor> scope, LayoutType t, TypeArgumentList typeArgs,
|
||||||
Object value) {
|
Object value) {
|
||||||
checkArgument(typeArgs.count() == 2);
|
checkArgument(typeArgs.count() == 2);
|
||||||
|
|
||||||
Reference<RowBuffer> tempReference_Row =
|
Reference<RowBuffer> tempReference_Row =
|
||||||
new Reference<RowBuffer>(dispatcher.get().Row);
|
new Reference<RowBuffer>(dispatcher.get().Row);
|
||||||
RowCursor mapScope;
|
RowCursor mapScope;
|
||||||
Out<RowCursor> tempOut_mapScope =
|
Out<RowCursor> tempOut_mapScope =
|
||||||
new Out<RowCursor>();
|
new Out<RowCursor>();
|
||||||
ResultAssert.IsSuccess(t.<LayoutTypedMap>typeAs().ReadScope(tempReference_Row, scope, tempOut_mapScope));
|
ResultAssert.IsSuccess(t.<LayoutTypedMap>typeAs().ReadScope(tempReference_Row, scope, tempOut_mapScope));
|
||||||
mapScope = tempOut_mapScope.get();
|
mapScope = tempOut_mapScope.get();
|
||||||
dispatcher.get().argValue.Row = tempReference_Row.get();
|
dispatcher.get().argValue.Row = tempReference_Row.get();
|
||||||
if (!mapScope.Immutable) {
|
if (!mapScope.Immutable) {
|
||||||
List items = (List)value;
|
List items = (List)value;
|
||||||
for (Object item : items) {
|
for (Object item : items) {
|
||||||
Reference<RowBuffer> tempReference_Row2 =
|
Reference<RowBuffer> tempReference_Row2 =
|
||||||
new Reference<RowBuffer>(dispatcher.get().Row);
|
new Reference<RowBuffer>(dispatcher.get().Row);
|
||||||
assert mapScope.MoveNext(tempReference_Row2);
|
assert mapScope.MoveNext(tempReference_Row2);
|
||||||
dispatcher.get().argValue.Row = tempReference_Row2.get();
|
dispatcher.get().argValue.Row = tempReference_Row2.get();
|
||||||
// TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'ref' keyword -
|
// TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'ref' keyword -
|
||||||
// these cannot be converted using the 'Ref' helper class unless the method is within the code
|
// these cannot be converted using the 'Ref' helper class unless the method is within the code
|
||||||
// being modified:
|
// being modified:
|
||||||
dispatcher.get().LayoutCodeSwitch(ref mapScope, null, LayoutType.TypedTuple, typeArgs.clone(), item);
|
dispatcher.get().LayoutCodeSwitch(ref mapScope, null, LayoutType.TypedTuple, typeArgs.clone(), item);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Reference<RowBuffer> tempReference_Row3 =
|
Reference<RowBuffer> tempReference_Row3 =
|
||||||
new Reference<RowBuffer>(dispatcher.get().Row);
|
new Reference<RowBuffer>(dispatcher.get().Row);
|
||||||
ResultAssert.IsSuccess(t.<LayoutTypedMap>typeAs().DeleteScope(tempReference_Row3, scope));
|
ResultAssert.IsSuccess(t.<LayoutTypedMap>typeAs().DeleteScope(tempReference_Row3, scope));
|
||||||
dispatcher.get().argValue.Row = tempReference_Row3.get();
|
dispatcher.get().argValue.Row = tempReference_Row3.get();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void DispatchNullable(Reference<RowOperationDispatcher> dispatcher,
|
public void DispatchNullable(Reference<RowOperationDispatcher> dispatcher,
|
||||||
Reference<RowCursor> scope, LayoutType t, TypeArgumentList typeArgs,
|
Reference<RowCursor> scope, LayoutType t, TypeArgumentList typeArgs,
|
||||||
Object value) {
|
Object value) {
|
||||||
checkArgument(typeArgs.count() == 1);
|
checkArgument(typeArgs.count() == 1);
|
||||||
Reference<RowBuffer> tempReference_Row =
|
Reference<RowBuffer> tempReference_Row =
|
||||||
new Reference<RowBuffer>(dispatcher.get().Row);
|
new Reference<RowBuffer>(dispatcher.get().Row);
|
||||||
ResultAssert.IsSuccess(t.<LayoutNullable>typeAs().DeleteScope(tempReference_Row, scope));
|
ResultAssert.IsSuccess(t.<LayoutNullable>typeAs().DeleteScope(tempReference_Row, scope));
|
||||||
dispatcher.get().argValue.Row = tempReference_Row.get();
|
dispatcher.get().argValue.Row = tempReference_Row.get();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void DispatchObject(Reference<RowOperationDispatcher> dispatcher,
|
public void DispatchObject(Reference<RowOperationDispatcher> dispatcher,
|
||||||
Reference<RowCursor> scope) {
|
Reference<RowCursor> scope) {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void DispatchSet(Reference<RowOperationDispatcher> dispatcher,
|
public void DispatchSet(Reference<RowOperationDispatcher> dispatcher,
|
||||||
Reference<RowCursor> scope, LayoutType t, TypeArgumentList typeArgs,
|
Reference<RowCursor> scope, LayoutType t, TypeArgumentList typeArgs,
|
||||||
Object value) {
|
Object value) {
|
||||||
checkArgument(typeArgs.count() == 1);
|
checkArgument(typeArgs.count() == 1);
|
||||||
|
|
||||||
Reference<RowBuffer> tempReference_Row =
|
Reference<RowBuffer> tempReference_Row =
|
||||||
new Reference<RowBuffer>(dispatcher.get().Row);
|
new Reference<RowBuffer>(dispatcher.get().Row);
|
||||||
RowCursor setScope;
|
RowCursor setScope;
|
||||||
Out<RowCursor> tempOut_setScope =
|
Out<RowCursor> tempOut_setScope =
|
||||||
new Out<RowCursor>();
|
new Out<RowCursor>();
|
||||||
ResultAssert.IsSuccess(t.<LayoutTypedSet>typeAs().ReadScope(tempReference_Row, scope, tempOut_setScope));
|
ResultAssert.IsSuccess(t.<LayoutTypedSet>typeAs().ReadScope(tempReference_Row, scope, tempOut_setScope));
|
||||||
setScope = tempOut_setScope.get();
|
setScope = tempOut_setScope.get();
|
||||||
dispatcher.get().argValue.Row = tempReference_Row.get();
|
dispatcher.get().argValue.Row = tempReference_Row.get();
|
||||||
if (!setScope.Immutable) {
|
if (!setScope.Immutable) {
|
||||||
List items = (List)value;
|
List items = (List)value;
|
||||||
for (Object item : items) {
|
for (Object item : items) {
|
||||||
Reference<RowBuffer> tempReference_Row2 =
|
Reference<RowBuffer> tempReference_Row2 =
|
||||||
new Reference<RowBuffer>(dispatcher.get().Row);
|
new Reference<RowBuffer>(dispatcher.get().Row);
|
||||||
assert setScope.MoveNext(tempReference_Row2);
|
assert setScope.MoveNext(tempReference_Row2);
|
||||||
dispatcher.get().argValue.Row = tempReference_Row2.get();
|
dispatcher.get().argValue.Row = tempReference_Row2.get();
|
||||||
// TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'ref' keyword -
|
// TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'ref' keyword -
|
||||||
// these cannot be converted using the 'Ref' helper class unless the method is within the code
|
// these cannot be converted using the 'Ref' helper class unless the method is within the code
|
||||||
// being modified:
|
// being modified:
|
||||||
dispatcher.get().LayoutCodeSwitch(ref setScope, null, typeArgs.get(0).type(),
|
dispatcher.get().LayoutCodeSwitch(ref setScope, null, typeArgs.get(0).type(),
|
||||||
typeArgs.get(0).typeArgs().clone(), item);
|
typeArgs.get(0).typeArgs().clone(), item);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Reference<RowBuffer> tempReference_Row3 =
|
Reference<RowBuffer> tempReference_Row3 =
|
||||||
new Reference<RowBuffer>(dispatcher.get().Row);
|
new Reference<RowBuffer>(dispatcher.get().Row);
|
||||||
ResultAssert.IsSuccess(t.<LayoutTypedSet>typeAs().DeleteScope(tempReference_Row3, scope));
|
ResultAssert.IsSuccess(t.<LayoutTypedSet>typeAs().DeleteScope(tempReference_Row3, scope));
|
||||||
dispatcher.get().argValue.Row = tempReference_Row3.get();
|
dispatcher.get().argValue.Row = tempReference_Row3.get();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void DispatchTuple(Reference<RowOperationDispatcher> dispatcher,
|
public void DispatchTuple(Reference<RowOperationDispatcher> dispatcher,
|
||||||
Reference<RowCursor> scope, LayoutType t, TypeArgumentList typeArgs,
|
Reference<RowCursor> scope, LayoutType t, TypeArgumentList typeArgs,
|
||||||
Object value) {
|
Object value) {
|
||||||
checkArgument(typeArgs.count() >= 2);
|
checkArgument(typeArgs.count() >= 2);
|
||||||
Reference<RowBuffer> tempReference_Row =
|
Reference<RowBuffer> tempReference_Row =
|
||||||
new Reference<RowBuffer>(dispatcher.get().Row);
|
new Reference<RowBuffer>(dispatcher.get().Row);
|
||||||
ResultAssert.IsSuccess(t.<LayoutIndexedScope>typeAs().DeleteScope(tempReference_Row, scope));
|
ResultAssert.IsSuccess(t.<LayoutIndexedScope>typeAs().DeleteScope(tempReference_Row, scope));
|
||||||
dispatcher.get().argValue.Row = tempReference_Row.get();
|
dispatcher.get().argValue.Row = tempReference_Row.get();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void DispatchUDT(Reference<RowOperationDispatcher> dispatcher, Reference<RowCursor> scope, LayoutType t, TypeArgumentList typeArgs, Object value) {
|
public void DispatchUDT(Reference<RowOperationDispatcher> dispatcher, Reference<RowCursor> scope, LayoutType t, TypeArgumentList typeArgs, Object value) {
|
||||||
Reference<RowBuffer> tempReference_Row = new Reference<RowBuffer>(dispatcher.get().Row);
|
Reference<RowBuffer> tempReference_Row = new Reference<RowBuffer>(dispatcher.get().Row);
|
||||||
ResultAssert.IsSuccess(t.<LayoutUDT>typeAs().DeleteScope(tempReference_Row, scope));
|
ResultAssert.IsSuccess(t.<LayoutUDT>typeAs().DeleteScope(tempReference_Row, scope));
|
||||||
dispatcher.get().argValue.Row = tempReference_Row.get();
|
dispatcher.get().argValue.Row = tempReference_Row.get();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+10
-10
@@ -1,11 +1,11 @@
|
|||||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||||
// Licensed under the MIT License.
|
// Licensed under the MIT License.
|
||||||
|
|
||||||
package com.azure.data.cosmos.serialization.hybridrow.unit;
|
package com.azure.data.cosmos.serialization.hybridrow.unit;
|
||||||
|
|
||||||
import com.azure.data.cosmos.core.Reference;
|
import com.azure.data.cosmos.core.Reference;
|
||||||
import com.azure.data.cosmos.serialization.hybridrow.RowCursor;
|
import com.azure.data.cosmos.serialization.hybridrow.RowCursor;
|
||||||
|
|
||||||
public interface IDispatchable {
|
public interface IDispatchable {
|
||||||
void Dispatch(Reference<RowOperationDispatcher> dispatcher, Reference<RowCursor> scope);
|
void Dispatch(Reference<RowOperationDispatcher> dispatcher, Reference<RowCursor> scope);
|
||||||
}
|
}
|
||||||
+41
-41
@@ -1,42 +1,42 @@
|
|||||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||||
// Licensed under the MIT License.
|
// Licensed under the MIT License.
|
||||||
|
|
||||||
package com.azure.data.cosmos.serialization.hybridrow.unit;
|
package com.azure.data.cosmos.serialization.hybridrow.unit;
|
||||||
|
|
||||||
import com.azure.data.cosmos.core.Reference;
|
import com.azure.data.cosmos.core.Reference;
|
||||||
import com.azure.data.cosmos.core.Reference;
|
import com.azure.data.cosmos.core.Reference;
|
||||||
import com.azure.data.cosmos.serialization.hybridrow.RowCursor;
|
import com.azure.data.cosmos.serialization.hybridrow.RowCursor;
|
||||||
|
|
||||||
public interface IDispatcher {
|
public interface IDispatcher {
|
||||||
|
|
||||||
<TLayout extends LayoutType<TValue>, TValue> void Dispatch(Reference<RowOperationDispatcher> dispatcher,
|
<TLayout extends LayoutType<TValue>, TValue> void Dispatch(Reference<RowOperationDispatcher> dispatcher,
|
||||||
Reference<RowCursor> scope, LayoutColumn col,
|
Reference<RowCursor> scope, LayoutColumn col,
|
||||||
LayoutType t);
|
LayoutType t);
|
||||||
|
|
||||||
//C# TO JAVA CONVERTER NOTE: Java does not support optional parameters. Overloaded method(s) are created above:
|
//C# TO JAVA CONVERTER NOTE: Java does not support optional parameters. Overloaded method(s) are created above:
|
||||||
//ORIGINAL LINE: void Dispatch<TLayout, TValue>(ref RowOperationDispatcher dispatcher, ref RowCursor scope,
|
//ORIGINAL LINE: void Dispatch<TLayout, TValue>(ref RowOperationDispatcher dispatcher, ref RowCursor scope,
|
||||||
// LayoutColumn col, LayoutType t, TValue value = default) where TLayout : LayoutType<TValue>;
|
// LayoutColumn col, LayoutType t, TValue value = default) where TLayout : LayoutType<TValue>;
|
||||||
<TLayout extends LayoutType<TValue>, TValue> void Dispatch(Reference<RowOperationDispatcher> dispatcher,
|
<TLayout extends LayoutType<TValue>, TValue> void Dispatch(Reference<RowOperationDispatcher> dispatcher,
|
||||||
Reference<RowCursor> scope, LayoutColumn col,
|
Reference<RowCursor> scope, LayoutColumn col,
|
||||||
LayoutType t, TValue value);
|
LayoutType t, TValue value);
|
||||||
|
|
||||||
void DispatchArray(Reference<RowOperationDispatcher> dispatcher, Reference<RowCursor> scope,
|
void DispatchArray(Reference<RowOperationDispatcher> dispatcher, Reference<RowCursor> scope,
|
||||||
LayoutType t, TypeArgumentList typeArgs, Object value);
|
LayoutType t, TypeArgumentList typeArgs, Object value);
|
||||||
|
|
||||||
void DispatchMap(Reference<RowOperationDispatcher> dispatcher, Reference<RowCursor> scope,
|
void DispatchMap(Reference<RowOperationDispatcher> dispatcher, Reference<RowCursor> scope,
|
||||||
LayoutType t, TypeArgumentList typeArgs, Object value);
|
LayoutType t, TypeArgumentList typeArgs, Object value);
|
||||||
|
|
||||||
void DispatchNullable(Reference<RowOperationDispatcher> dispatcher, Reference<RowCursor> scope,
|
void DispatchNullable(Reference<RowOperationDispatcher> dispatcher, Reference<RowCursor> scope,
|
||||||
LayoutType t, TypeArgumentList typeArgs, Object value);
|
LayoutType t, TypeArgumentList typeArgs, Object value);
|
||||||
|
|
||||||
void DispatchObject(Reference<RowOperationDispatcher> dispatcher, Reference<RowCursor> scope);
|
void DispatchObject(Reference<RowOperationDispatcher> dispatcher, Reference<RowCursor> scope);
|
||||||
|
|
||||||
void DispatchSet(Reference<RowOperationDispatcher> dispatcher, Reference<RowCursor> scope,
|
void DispatchSet(Reference<RowOperationDispatcher> dispatcher, Reference<RowCursor> scope,
|
||||||
LayoutType t, TypeArgumentList typeArgs, Object value);
|
LayoutType t, TypeArgumentList typeArgs, Object value);
|
||||||
|
|
||||||
void DispatchTuple(Reference<RowOperationDispatcher> dispatcher, Reference<RowCursor> scope,
|
void DispatchTuple(Reference<RowOperationDispatcher> dispatcher, Reference<RowCursor> scope,
|
||||||
LayoutType t, TypeArgumentList typeArgs, Object value);
|
LayoutType t, TypeArgumentList typeArgs, Object value);
|
||||||
|
|
||||||
void DispatchUDT(Reference<RowOperationDispatcher> dispatcher, Reference<RowCursor> scope,
|
void DispatchUDT(Reference<RowOperationDispatcher> dispatcher, Reference<RowCursor> scope,
|
||||||
LayoutType type, TypeArgumentList typeArgs, Object value);
|
LayoutType type, TypeArgumentList typeArgs, Object value);
|
||||||
}
|
}
|
||||||
+3237
-3237
File diff suppressed because it is too large
Load Diff
+45
-45
@@ -1,46 +1,46 @@
|
|||||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||||
// Licensed under the MIT License.
|
// Licensed under the MIT License.
|
||||||
|
|
||||||
package com.azure.data.cosmos.serialization.hybridrow.unit;
|
package com.azure.data.cosmos.serialization.hybridrow.unit;
|
||||||
|
|
||||||
// TODO: C# TO JAVA CONVERTER: Java annotations will not correspond to .NET attributes:
|
// TODO: C# TO JAVA CONVERTER: Java annotations will not correspond to .NET attributes:
|
||||||
//ORIGINAL LINE: [TestClass] public class LayoutTypeUnitTests
|
//ORIGINAL LINE: [TestClass] public class LayoutTypeUnitTests
|
||||||
public class LayoutTypeUnitTests {
|
public class LayoutTypeUnitTests {
|
||||||
// TODO: C# TO JAVA CONVERTER: Java annotations will not correspond to .NET attributes:
|
// TODO: C# TO JAVA CONVERTER: Java annotations will not correspond to .NET attributes:
|
||||||
//ORIGINAL LINE: [TestMethod][Owner("jthunter")] public void LayoutTypeTest()
|
//ORIGINAL LINE: [TestMethod][Owner("jthunter")] public void LayoutTypeTest()
|
||||||
public final void LayoutTypeTest() {
|
public final void LayoutTypeTest() {
|
||||||
LayoutTypeUnitTests.TestLayoutTypeApi(LayoutType.Boolean);
|
LayoutTypeUnitTests.TestLayoutTypeApi(LayoutType.Boolean);
|
||||||
LayoutTypeUnitTests.TestLayoutTypeApi(LayoutType.Int8);
|
LayoutTypeUnitTests.TestLayoutTypeApi(LayoutType.Int8);
|
||||||
LayoutTypeUnitTests.TestLayoutTypeApi(LayoutType.Int16);
|
LayoutTypeUnitTests.TestLayoutTypeApi(LayoutType.Int16);
|
||||||
LayoutTypeUnitTests.TestLayoutTypeApi(LayoutType.Int32);
|
LayoutTypeUnitTests.TestLayoutTypeApi(LayoutType.Int32);
|
||||||
LayoutTypeUnitTests.TestLayoutTypeApi(LayoutType.Int64);
|
LayoutTypeUnitTests.TestLayoutTypeApi(LayoutType.Int64);
|
||||||
LayoutTypeUnitTests.TestLayoutTypeApi(LayoutType.UInt8);
|
LayoutTypeUnitTests.TestLayoutTypeApi(LayoutType.UInt8);
|
||||||
LayoutTypeUnitTests.TestLayoutTypeApi(LayoutType.UInt16);
|
LayoutTypeUnitTests.TestLayoutTypeApi(LayoutType.UInt16);
|
||||||
LayoutTypeUnitTests.TestLayoutTypeApi(LayoutType.UInt32);
|
LayoutTypeUnitTests.TestLayoutTypeApi(LayoutType.UInt32);
|
||||||
LayoutTypeUnitTests.TestLayoutTypeApi(LayoutType.UInt64);
|
LayoutTypeUnitTests.TestLayoutTypeApi(LayoutType.UInt64);
|
||||||
LayoutTypeUnitTests.TestLayoutTypeApi(LayoutType.VarInt);
|
LayoutTypeUnitTests.TestLayoutTypeApi(LayoutType.VarInt);
|
||||||
LayoutTypeUnitTests.TestLayoutTypeApi(LayoutType.VarUInt);
|
LayoutTypeUnitTests.TestLayoutTypeApi(LayoutType.VarUInt);
|
||||||
LayoutTypeUnitTests.TestLayoutTypeApi(LayoutType.Float32);
|
LayoutTypeUnitTests.TestLayoutTypeApi(LayoutType.Float32);
|
||||||
LayoutTypeUnitTests.TestLayoutTypeApi(LayoutType.Float64);
|
LayoutTypeUnitTests.TestLayoutTypeApi(LayoutType.Float64);
|
||||||
LayoutTypeUnitTests.TestLayoutTypeApi(LayoutType.Decimal);
|
LayoutTypeUnitTests.TestLayoutTypeApi(LayoutType.Decimal);
|
||||||
LayoutTypeUnitTests.TestLayoutTypeApi(LayoutType.Null);
|
LayoutTypeUnitTests.TestLayoutTypeApi(LayoutType.Null);
|
||||||
LayoutTypeUnitTests.TestLayoutTypeApi(LayoutType.Boolean);
|
LayoutTypeUnitTests.TestLayoutTypeApi(LayoutType.Boolean);
|
||||||
LayoutTypeUnitTests.TestLayoutTypeApi(LayoutType.DateTime);
|
LayoutTypeUnitTests.TestLayoutTypeApi(LayoutType.DateTime);
|
||||||
LayoutTypeUnitTests.TestLayoutTypeApi(LayoutType.Guid);
|
LayoutTypeUnitTests.TestLayoutTypeApi(LayoutType.Guid);
|
||||||
LayoutTypeUnitTests.TestLayoutTypeApi(LayoutType.Utf8);
|
LayoutTypeUnitTests.TestLayoutTypeApi(LayoutType.Utf8);
|
||||||
LayoutTypeUnitTests.TestLayoutTypeApi(LayoutType.Binary);
|
LayoutTypeUnitTests.TestLayoutTypeApi(LayoutType.Binary);
|
||||||
LayoutTypeUnitTests.TestLayoutTypeApi(LayoutType.Object);
|
LayoutTypeUnitTests.TestLayoutTypeApi(LayoutType.Object);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void TestLayoutTypeApi(LayoutType t) {
|
private static void TestLayoutTypeApi(LayoutType t) {
|
||||||
assert t.getName() != null;
|
assert t.getName() != null;
|
||||||
assert !tangible.StringHelper.isNullOrWhiteSpace(t.getName());
|
assert !tangible.StringHelper.isNullOrWhiteSpace(t.getName());
|
||||||
Assert.AreNotSame(null, t.getIsFixed(), t.getName());
|
Assert.AreNotSame(null, t.getIsFixed(), t.getName());
|
||||||
Assert.AreNotSame(null, t.getAllowVariable(), t.getName());
|
Assert.AreNotSame(null, t.getAllowVariable(), t.getName());
|
||||||
Assert.AreNotSame(null, t.getIsBool(), t.getName());
|
Assert.AreNotSame(null, t.getIsBool(), t.getName());
|
||||||
Assert.AreNotSame(null, t.getIsNull(), t.getName());
|
Assert.AreNotSame(null, t.getIsNull(), t.getName());
|
||||||
Assert.AreNotSame(null, t.getIsVarint(), t.getName());
|
Assert.AreNotSame(null, t.getIsVarint(), t.getName());
|
||||||
Assert.IsTrue(t.Size >= 0, t.getName());
|
Assert.IsTrue(t.Size >= 0, t.getName());
|
||||||
Assert.AreNotEqual(LayoutCode.Invalid, t.LayoutCode, t.getName());
|
Assert.AreNotEqual(LayoutCode.Invalid, t.LayoutCode, t.getName());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+86
-86
@@ -1,87 +1,87 @@
|
|||||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||||
// Licensed under the MIT License.
|
// Licensed under the MIT License.
|
||||||
|
|
||||||
package com.azure.data.cosmos.serialization.hybridrow.unit;
|
package com.azure.data.cosmos.serialization.hybridrow.unit;
|
||||||
|
|
||||||
import com.azure.data.cosmos.core.Reference;
|
import com.azure.data.cosmos.core.Reference;
|
||||||
import com.azure.data.cosmos.core.Reference;
|
import com.azure.data.cosmos.core.Reference;
|
||||||
import com.azure.data.cosmos.serialization.hybridrow.RowBuffer;
|
import com.azure.data.cosmos.serialization.hybridrow.RowBuffer;
|
||||||
import com.azure.data.cosmos.serialization.hybridrow.RowCursor;
|
import com.azure.data.cosmos.serialization.hybridrow.RowCursor;
|
||||||
|
|
||||||
//C# TO JAVA CONVERTER WARNING: Java does not allow user-defined value types. The behavior of this class may differ
|
//C# TO JAVA CONVERTER WARNING: Java does not allow user-defined value types. The behavior of this class may differ
|
||||||
// from the original:
|
// from the original:
|
||||||
//ORIGINAL LINE: internal struct NullRowDispatcher : IDispatcher
|
//ORIGINAL LINE: internal struct NullRowDispatcher : IDispatcher
|
||||||
public final class NullRowDispatcher implements IDispatcher {
|
public final class NullRowDispatcher implements IDispatcher {
|
||||||
|
|
||||||
public <TLayout extends LayoutType<TValue>, TValue> void Dispatch(Reference<RowOperationDispatcher> dispatcher, Reference<RowCursor> root, LayoutColumn col, LayoutType t) {
|
public <TLayout extends LayoutType<TValue>, TValue> void Dispatch(Reference<RowOperationDispatcher> dispatcher, Reference<RowCursor> root, LayoutColumn col, LayoutType t) {
|
||||||
Dispatch(dispatcher, root, col, t, null);
|
Dispatch(dispatcher, root, col, t, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
//C# TO JAVA CONVERTER NOTE: Java does not support optional parameters. Overloaded method(s) are created above:
|
//C# TO JAVA CONVERTER NOTE: Java does not support optional parameters. Overloaded method(s) are created above:
|
||||||
//ORIGINAL LINE: public void Dispatch<TLayout, TValue>(ref RowOperationDispatcher dispatcher, ref RowCursor root,
|
//ORIGINAL LINE: public void Dispatch<TLayout, TValue>(ref RowOperationDispatcher dispatcher, ref RowCursor root,
|
||||||
// LayoutColumn col, LayoutType t, TValue expected = default) where TLayout : LayoutType<TValue>
|
// LayoutColumn col, LayoutType t, TValue expected = default) where TLayout : LayoutType<TValue>
|
||||||
public <TLayout extends LayoutType<TValue>, TValue> void Dispatch(Reference<RowOperationDispatcher> dispatcher, Reference<RowCursor> root, LayoutColumn col, LayoutType t, TValue expected) {
|
public <TLayout extends LayoutType<TValue>, TValue> void Dispatch(Reference<RowOperationDispatcher> dispatcher, Reference<RowCursor> root, LayoutColumn col, LayoutType t, TValue expected) {
|
||||||
switch (col == null ? null : col.getStorage()) {
|
switch (col == null ? null : col.getStorage()) {
|
||||||
case Fixed:
|
case Fixed:
|
||||||
Reference<RowBuffer> tempReference_Row =
|
Reference<RowBuffer> tempReference_Row =
|
||||||
new Reference<RowBuffer>(dispatcher.get().Row);
|
new Reference<RowBuffer>(dispatcher.get().Row);
|
||||||
TValue _;
|
TValue _;
|
||||||
// TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'out' keyword -
|
// TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'out' keyword -
|
||||||
// these cannot be converted using the 'Out' helper class unless the method is within the code
|
// these cannot be converted using the 'Out' helper class unless the method is within the code
|
||||||
// being modified:
|
// being modified:
|
||||||
ResultAssert.NotFound(t.<TLayout>TypeAs().ReadFixed(tempReference_Row, root, col, out _));
|
ResultAssert.NotFound(t.<TLayout>TypeAs().ReadFixed(tempReference_Row, root, col, out _));
|
||||||
dispatcher.get().argValue.Row = tempReference_Row.get();
|
dispatcher.get().argValue.Row = tempReference_Row.get();
|
||||||
break;
|
break;
|
||||||
case Variable:
|
case Variable:
|
||||||
Reference<RowBuffer> tempReference_Row2 =
|
Reference<RowBuffer> tempReference_Row2 =
|
||||||
new Reference<RowBuffer>(dispatcher.get().Row);
|
new Reference<RowBuffer>(dispatcher.get().Row);
|
||||||
TValue _;
|
TValue _;
|
||||||
// TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'out' keyword -
|
// TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'out' keyword -
|
||||||
// these cannot be converted using the 'Out' helper class unless the method is within the code
|
// these cannot be converted using the 'Out' helper class unless the method is within the code
|
||||||
// being modified:
|
// being modified:
|
||||||
ResultAssert.NotFound(t.<TLayout>TypeAs().ReadVariable(tempReference_Row2, root, col, out _));
|
ResultAssert.NotFound(t.<TLayout>TypeAs().ReadVariable(tempReference_Row2, root, col, out _));
|
||||||
dispatcher.get().argValue.Row = tempReference_Row2.get();
|
dispatcher.get().argValue.Row = tempReference_Row2.get();
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
Reference<RowBuffer> tempReference_Row3 =
|
Reference<RowBuffer> tempReference_Row3 =
|
||||||
new Reference<RowBuffer>(dispatcher.get().Row);
|
new Reference<RowBuffer>(dispatcher.get().Row);
|
||||||
TValue _;
|
TValue _;
|
||||||
// TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'out' keyword -
|
// TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'out' keyword -
|
||||||
// these cannot be converted using the 'Out' helper class unless the method is within the code
|
// these cannot be converted using the 'Out' helper class unless the method is within the code
|
||||||
// being modified:
|
// being modified:
|
||||||
ResultAssert.NotFound(t.<TLayout>TypeAs().ReadSparse(tempReference_Row3, root, out _));
|
ResultAssert.NotFound(t.<TLayout>TypeAs().ReadSparse(tempReference_Row3, root, out _));
|
||||||
dispatcher.get().argValue.Row = tempReference_Row3.get();
|
dispatcher.get().argValue.Row = tempReference_Row3.get();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void DispatchArray(Reference<RowOperationDispatcher> dispatcher,
|
public void DispatchArray(Reference<RowOperationDispatcher> dispatcher,
|
||||||
Reference<RowCursor> scope, LayoutType t, TypeArgumentList typeArgs,
|
Reference<RowCursor> scope, LayoutType t, TypeArgumentList typeArgs,
|
||||||
Object value) {
|
Object value) {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void DispatchMap(Reference<RowOperationDispatcher> dispatcher, Reference<RowCursor> scope, LayoutType t, TypeArgumentList typeArgs, Object value) {
|
public void DispatchMap(Reference<RowOperationDispatcher> dispatcher, Reference<RowCursor> scope, LayoutType t, TypeArgumentList typeArgs, Object value) {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void DispatchNullable(Reference<RowOperationDispatcher> dispatcher,
|
public void DispatchNullable(Reference<RowOperationDispatcher> dispatcher,
|
||||||
Reference<RowCursor> scope, LayoutType t, TypeArgumentList typeArgs,
|
Reference<RowCursor> scope, LayoutType t, TypeArgumentList typeArgs,
|
||||||
Object value) {
|
Object value) {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void DispatchObject(Reference<RowOperationDispatcher> dispatcher,
|
public void DispatchObject(Reference<RowOperationDispatcher> dispatcher,
|
||||||
Reference<RowCursor> scope) {
|
Reference<RowCursor> scope) {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void DispatchSet(Reference<RowOperationDispatcher> dispatcher,
|
public void DispatchSet(Reference<RowOperationDispatcher> dispatcher,
|
||||||
Reference<RowCursor> scope, LayoutType t, TypeArgumentList typeArgs,
|
Reference<RowCursor> scope, LayoutType t, TypeArgumentList typeArgs,
|
||||||
Object value) {
|
Object value) {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void DispatchTuple(Reference<RowOperationDispatcher> dispatcher,
|
public void DispatchTuple(Reference<RowOperationDispatcher> dispatcher,
|
||||||
Reference<RowCursor> scope, LayoutType t, TypeArgumentList typeArgs,
|
Reference<RowCursor> scope, LayoutType t, TypeArgumentList typeArgs,
|
||||||
Object value) {
|
Object value) {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void DispatchUDT(Reference<RowOperationDispatcher> dispatcher, Reference<RowCursor> scope, LayoutType t, TypeArgumentList typeArgs, Object value) {
|
public void DispatchUDT(Reference<RowOperationDispatcher> dispatcher, Reference<RowCursor> scope, LayoutType t, TypeArgumentList typeArgs, Object value) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+752
-752
File diff suppressed because it is too large
Load Diff
+32
-32
@@ -1,33 +1,33 @@
|
|||||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||||
// Licensed under the MIT License.
|
// Licensed under the MIT License.
|
||||||
|
|
||||||
package com.azure.data.cosmos.serialization.hybridrow.unit;
|
package com.azure.data.cosmos.serialization.hybridrow.unit;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Extension methods for computing permutations of {@link IEnumerable{T}}.
|
* Extension methods for computing permutations of {@link IEnumerable{T}}.
|
||||||
*/
|
*/
|
||||||
public final class PermuteExtensions {
|
public final class PermuteExtensions {
|
||||||
/**
|
/**
|
||||||
* Generate all permutations of a given enumerable.
|
* Generate all permutations of a given enumerable.
|
||||||
*/
|
*/
|
||||||
public static <T> java.lang.Iterable<java.lang.Iterable<T>> Permute(java.lang.Iterable<T> list) {
|
public static <T> java.lang.Iterable<java.lang.Iterable<T>> Permute(java.lang.Iterable<T> list) {
|
||||||
int start = 0;
|
int start = 0;
|
||||||
for (T element : list) {
|
for (T element : list) {
|
||||||
int index = start;
|
int index = start;
|
||||||
T[] first = { element };
|
T[] first = { element };
|
||||||
java.lang.Iterable<T> rest = list.Where((s, i) -> i != index);
|
java.lang.Iterable<T> rest = list.Where((s, i) -> i != index);
|
||||||
if (!rest.Any()) {
|
if (!rest.Any()) {
|
||||||
// TODO: C# TO JAVA CONVERTER: Java does not have an equivalent to the C# 'yield' keyword:
|
// TODO: C# TO JAVA CONVERTER: Java does not have an equivalent to the C# 'yield' keyword:
|
||||||
yield return first;
|
yield return first;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (java.lang.Iterable<T> sub :
|
for (java.lang.Iterable<T> sub :
|
||||||
PermuteExtensions.Permute(rest)) {
|
PermuteExtensions.Permute(rest)) {
|
||||||
// TODO: C# TO JAVA CONVERTER: Java does not have an equivalent to the C# 'yield' keyword:
|
// TODO: C# TO JAVA CONVERTER: Java does not have an equivalent to the C# 'yield' keyword:
|
||||||
yield return first.Concat(sub);
|
yield return first.Concat(sub);
|
||||||
}
|
}
|
||||||
|
|
||||||
start++;
|
start++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+76
-76
@@ -1,77 +1,77 @@
|
|||||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||||
// Licensed under the MIT License.
|
// Licensed under the MIT License.
|
||||||
|
|
||||||
package com.azure.data.cosmos.serialization.hybridrow.unit;
|
package com.azure.data.cosmos.serialization.hybridrow.unit;
|
||||||
|
|
||||||
import java.util.Random;
|
import java.util.Random;
|
||||||
|
|
||||||
// TODO: C# TO JAVA CONVERTER: Java annotations will not correspond to .NET attributes:
|
// TODO: C# TO JAVA CONVERTER: Java annotations will not correspond to .NET attributes:
|
||||||
//ORIGINAL LINE: [TestClass] public class RandomGeneratorUnitTests
|
//ORIGINAL LINE: [TestClass] public class RandomGeneratorUnitTests
|
||||||
public class RandomGeneratorUnitTests {
|
public class RandomGeneratorUnitTests {
|
||||||
// TODO: C# TO JAVA CONVERTER: Java annotations will not correspond to .NET attributes:
|
// TODO: C# TO JAVA CONVERTER: Java annotations will not correspond to .NET attributes:
|
||||||
//ORIGINAL LINE: [TestMethod][Owner("jthunter")] public void RangeTest()
|
//ORIGINAL LINE: [TestMethod][Owner("jthunter")] public void RangeTest()
|
||||||
public final void RangeTest() {
|
public final void RangeTest() {
|
||||||
int seed = 42;
|
int seed = 42;
|
||||||
RandomGenerator rand = new RandomGenerator(new Random(seed));
|
RandomGenerator rand = new RandomGenerator(new Random(seed));
|
||||||
//C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java:
|
//C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java:
|
||||||
//ORIGINAL LINE: ulong l1 = rand.NextUInt64();
|
//ORIGINAL LINE: ulong l1 = rand.NextUInt64();
|
||||||
long l1 = rand.NextUInt64();
|
long l1 = rand.NextUInt64();
|
||||||
//C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java:
|
//C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java:
|
||||||
//ORIGINAL LINE: ulong l2 = rand.NextUInt64();
|
//ORIGINAL LINE: ulong l2 = rand.NextUInt64();
|
||||||
long l2 = rand.NextUInt64();
|
long l2 = rand.NextUInt64();
|
||||||
assert l1 != l2;
|
assert l1 != l2;
|
||||||
|
|
||||||
System.out.println("Check full range of min/max for ushort.");
|
System.out.println("Check full range of min/max for ushort.");
|
||||||
//C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java:
|
//C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java:
|
||||||
//ORIGINAL LINE: for (int min = 0; min <= ushort.MaxValue; min++)
|
//ORIGINAL LINE: for (int min = 0; min <= ushort.MaxValue; min++)
|
||||||
for (int min = 0; min <= Short.MAX_VALUE; min++) {
|
for (int min = 0; min <= Short.MAX_VALUE; min++) {
|
||||||
//C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java:
|
//C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java:
|
||||||
//ORIGINAL LINE: ushort i1 = rand.NextUInt16((ushort)min, ushort.MaxValue);
|
//ORIGINAL LINE: ushort i1 = rand.NextUInt16((ushort)min, ushort.MaxValue);
|
||||||
short i1 = rand.NextUInt16((short)min, Short.MAX_VALUE);
|
short i1 = rand.NextUInt16((short)min, Short.MAX_VALUE);
|
||||||
assert i1 >= min;
|
assert i1 >= min;
|
||||||
}
|
}
|
||||||
|
|
||||||
System.out.println("Check ushort range of min/max for uint.");
|
System.out.println("Check ushort range of min/max for uint.");
|
||||||
//C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java:
|
//C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java:
|
||||||
//ORIGINAL LINE: for (uint min = 0; min <= (uint)ushort.MaxValue; min++)
|
//ORIGINAL LINE: for (uint min = 0; min <= (uint)ushort.MaxValue; min++)
|
||||||
for (int min = 0; min <= (int)Short.MAX_VALUE; min++) {
|
for (int min = 0; min <= (int)Short.MAX_VALUE; min++) {
|
||||||
//C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java:
|
//C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java:
|
||||||
//ORIGINAL LINE: uint i1 = rand.NextUInt32(min, (uint)ushort.MaxValue);
|
//ORIGINAL LINE: uint i1 = rand.NextUInt32(min, (uint)ushort.MaxValue);
|
||||||
int i1 = rand.NextUInt32(min, (int)Short.MAX_VALUE);
|
int i1 = rand.NextUInt32(min, (int)Short.MAX_VALUE);
|
||||||
assert i1 >= min;
|
assert i1 >= min;
|
||||||
//C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java:
|
//C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java:
|
||||||
//ORIGINAL LINE: Assert.IsTrue(i1 <= ushort.MaxValue);
|
//ORIGINAL LINE: Assert.IsTrue(i1 <= ushort.MaxValue);
|
||||||
assert i1 <= Short.MAX_VALUE;
|
assert i1 <= Short.MAX_VALUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
boolean seenMax = false;
|
boolean seenMax = false;
|
||||||
boolean seenMin = false;
|
boolean seenMin = false;
|
||||||
//C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java:
|
//C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java:
|
||||||
//ORIGINAL LINE: const ushort maxUShortRange = 10;
|
//ORIGINAL LINE: const ushort maxUShortRange = 10;
|
||||||
final short maxUShortRange = 10;
|
final short maxUShortRange = 10;
|
||||||
System.out.println("Check inclusivity for ushort.");
|
System.out.println("Check inclusivity for ushort.");
|
||||||
while (!(seenMax && seenMin)) {
|
while (!(seenMax && seenMin)) {
|
||||||
//C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java:
|
//C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java:
|
||||||
//ORIGINAL LINE: ushort i1 = rand.NextUInt16(ushort.MinValue, maxUShortRange);
|
//ORIGINAL LINE: ushort i1 = rand.NextUInt16(ushort.MinValue, maxUShortRange);
|
||||||
short i1 = rand.NextUInt16(Short.MIN_VALUE, maxUShortRange);
|
short i1 = rand.NextUInt16(Short.MIN_VALUE, maxUShortRange);
|
||||||
//C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java:
|
//C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java:
|
||||||
//ORIGINAL LINE: seenMin = seenMin || i1 == ushort.MinValue;
|
//ORIGINAL LINE: seenMin = seenMin || i1 == ushort.MinValue;
|
||||||
seenMin = seenMin || i1 == Short.MIN_VALUE;
|
seenMin = seenMin || i1 == Short.MIN_VALUE;
|
||||||
seenMax = seenMax || i1 == maxUShortRange;
|
seenMax = seenMax || i1 == maxUShortRange;
|
||||||
assert i1 <= maxUShortRange;
|
assert i1 <= maxUShortRange;
|
||||||
}
|
}
|
||||||
|
|
||||||
seenMax = false;
|
seenMax = false;
|
||||||
seenMin = false;
|
seenMin = false;
|
||||||
System.out.println("Check inclusivity for short.");
|
System.out.println("Check inclusivity for short.");
|
||||||
final short minShortRange = -10;
|
final short minShortRange = -10;
|
||||||
final short maxShortRange = 10;
|
final short maxShortRange = 10;
|
||||||
while (!(seenMax && seenMin)) {
|
while (!(seenMax && seenMin)) {
|
||||||
short i1 = rand.NextInt16(minShortRange, maxShortRange);
|
short i1 = rand.NextInt16(minShortRange, maxShortRange);
|
||||||
seenMin = seenMin || i1 == -10;
|
seenMin = seenMin || i1 == -10;
|
||||||
seenMax = seenMax || i1 == 10;
|
seenMax = seenMax || i1 == 10;
|
||||||
assert i1 >= minShortRange;
|
assert i1 >= minShortRange;
|
||||||
assert i1 <= maxShortRange;
|
assert i1 <= maxShortRange;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+238
-238
@@ -1,239 +1,239 @@
|
|||||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||||
// Licensed under the MIT License.
|
// Licensed under the MIT License.
|
||||||
|
|
||||||
package com.azure.data.cosmos.serialization.hybridrow.unit;
|
package com.azure.data.cosmos.serialization.hybridrow.unit;
|
||||||
|
|
||||||
import com.azure.data.cosmos.core.Out;
|
import com.azure.data.cosmos.core.Out;
|
||||||
import com.azure.data.cosmos.core.Reference;
|
import com.azure.data.cosmos.core.Reference;
|
||||||
import com.azure.data.cosmos.serialization.hybridrow.RowBuffer;
|
import com.azure.data.cosmos.serialization.hybridrow.RowBuffer;
|
||||||
import com.azure.data.cosmos.serialization.hybridrow.RowCursor;
|
import com.azure.data.cosmos.serialization.hybridrow.RowCursor;
|
||||||
import com.azure.data.cosmos.serialization.hybridrow.layouts.LayoutType;
|
import com.azure.data.cosmos.serialization.hybridrow.layouts.LayoutType;
|
||||||
import com.azure.data.cosmos.serialization.hybridrow.layouts.LayoutTypedArray;
|
import com.azure.data.cosmos.serialization.hybridrow.layouts.LayoutTypedArray;
|
||||||
import com.azure.data.cosmos.serialization.hybridrow.layouts.TypeArgumentList;
|
import com.azure.data.cosmos.serialization.hybridrow.layouts.TypeArgumentList;
|
||||||
|
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
//C# TO JAVA CONVERTER WARNING: Java does not allow user-defined value types. The behavior of this class may differ
|
//C# TO JAVA CONVERTER WARNING: Java does not allow user-defined value types. The behavior of this class may differ
|
||||||
// from the original:
|
// from the original:
|
||||||
//ORIGINAL LINE: internal struct ReadRowDispatcher : IDispatcher
|
//ORIGINAL LINE: internal struct ReadRowDispatcher : IDispatcher
|
||||||
public final class ReadRowDispatcher implements IDispatcher {
|
public final class ReadRowDispatcher implements IDispatcher {
|
||||||
|
|
||||||
public <TLayout extends LayoutType<TValue>, TValue> void Dispatch(Reference<RowOperationDispatcher> dispatcher, Reference<RowCursor> root, LayoutColumn col, LayoutType t) {
|
public <TLayout extends LayoutType<TValue>, TValue> void Dispatch(Reference<RowOperationDispatcher> dispatcher, Reference<RowCursor> root, LayoutColumn col, LayoutType t) {
|
||||||
Dispatch(dispatcher, root, col, t, null);
|
Dispatch(dispatcher, root, col, t, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
//C# TO JAVA CONVERTER NOTE: Java does not support optional parameters. Overloaded method(s) are created above:
|
//C# TO JAVA CONVERTER NOTE: Java does not support optional parameters. Overloaded method(s) are created above:
|
||||||
//ORIGINAL LINE: public void Dispatch<TLayout, TValue>(ref RowOperationDispatcher dispatcher, ref RowCursor root,
|
//ORIGINAL LINE: public void Dispatch<TLayout, TValue>(ref RowOperationDispatcher dispatcher, ref RowCursor root,
|
||||||
// LayoutColumn col, LayoutType t, TValue expected = default) where TLayout : LayoutType<TValue>
|
// LayoutColumn col, LayoutType t, TValue expected = default) where TLayout : LayoutType<TValue>
|
||||||
public <TLayout extends LayoutType<TValue>, TValue> void Dispatch(Reference<RowOperationDispatcher> dispatcher, Reference<RowCursor> root, LayoutColumn col, LayoutType t, TValue expected) {
|
public <TLayout extends LayoutType<TValue>, TValue> void Dispatch(Reference<RowOperationDispatcher> dispatcher, Reference<RowCursor> root, LayoutColumn col, LayoutType t, TValue expected) {
|
||||||
TValue value;
|
TValue value;
|
||||||
switch (col == null ? null : col.getStorage()) {
|
switch (col == null ? null : col.getStorage()) {
|
||||||
case Fixed:
|
case Fixed:
|
||||||
Reference<RowBuffer> tempReference_Row =
|
Reference<RowBuffer> tempReference_Row =
|
||||||
new Reference<RowBuffer>(dispatcher.get().Row);
|
new Reference<RowBuffer>(dispatcher.get().Row);
|
||||||
Out<TValue> tempOut_value = new Out<TValue>();
|
Out<TValue> tempOut_value = new Out<TValue>();
|
||||||
ResultAssert.IsSuccess(t.<TLayout>typeAs().readFixed(tempReference_Row, root, col, tempOut_value));
|
ResultAssert.IsSuccess(t.<TLayout>typeAs().readFixed(tempReference_Row, root, col, tempOut_value));
|
||||||
value = tempOut_value.get();
|
value = tempOut_value.get();
|
||||||
dispatcher.get().argValue.Row = tempReference_Row.get();
|
dispatcher.get().argValue.Row = tempReference_Row.get();
|
||||||
break;
|
break;
|
||||||
case Variable:
|
case Variable:
|
||||||
Reference<RowBuffer> tempReference_Row2 =
|
Reference<RowBuffer> tempReference_Row2 =
|
||||||
new Reference<RowBuffer>(dispatcher.get().Row);
|
new Reference<RowBuffer>(dispatcher.get().Row);
|
||||||
Out<TValue> tempOut_value2 = new Out<TValue>();
|
Out<TValue> tempOut_value2 = new Out<TValue>();
|
||||||
ResultAssert.IsSuccess(t.<TLayout>typeAs().readVariable(tempReference_Row2, root, col, tempOut_value2));
|
ResultAssert.IsSuccess(t.<TLayout>typeAs().readVariable(tempReference_Row2, root, col, tempOut_value2));
|
||||||
value = tempOut_value2.get();
|
value = tempOut_value2.get();
|
||||||
dispatcher.get().argValue.Row = tempReference_Row2.get();
|
dispatcher.get().argValue.Row = tempReference_Row2.get();
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
Reference<RowBuffer> tempReference_Row3 =
|
Reference<RowBuffer> tempReference_Row3 =
|
||||||
new Reference<RowBuffer>(dispatcher.get().Row);
|
new Reference<RowBuffer>(dispatcher.get().Row);
|
||||||
Out<TValue> tempOut_value3 = new Out<TValue>();
|
Out<TValue> tempOut_value3 = new Out<TValue>();
|
||||||
ResultAssert.IsSuccess(t.<TLayout>typeAs().readSparse(tempReference_Row3, root, tempOut_value3));
|
ResultAssert.IsSuccess(t.<TLayout>typeAs().readSparse(tempReference_Row3, root, tempOut_value3));
|
||||||
value = tempOut_value3.get();
|
value = tempOut_value3.get();
|
||||||
dispatcher.get().argValue.Row = tempReference_Row3.get();
|
dispatcher.get().argValue.Row = tempReference_Row3.get();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (TValue.class.IsArray) {
|
if (TValue.class.IsArray) {
|
||||||
CollectionAssert.AreEqual((Collection)expected, (Collection)value);
|
CollectionAssert.AreEqual((Collection)expected, (Collection)value);
|
||||||
} else {
|
} else {
|
||||||
assert expected == value;
|
assert expected == value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void DispatchArray(Reference<RowOperationDispatcher> dispatcher,
|
public void DispatchArray(Reference<RowOperationDispatcher> dispatcher,
|
||||||
Reference<RowCursor> scope, LayoutType t, TypeArgumentList typeArgs,
|
Reference<RowCursor> scope, LayoutType t, TypeArgumentList typeArgs,
|
||||||
Object value) {
|
Object value) {
|
||||||
checkArgument(typeArgs.count() == 1);
|
checkArgument(typeArgs.count() == 1);
|
||||||
|
|
||||||
Reference<RowBuffer> tempReference_Row =
|
Reference<RowBuffer> tempReference_Row =
|
||||||
new Reference<RowBuffer>(dispatcher.get().Row);
|
new Reference<RowBuffer>(dispatcher.get().Row);
|
||||||
RowCursor arrayScope;
|
RowCursor arrayScope;
|
||||||
Out<RowCursor> tempOut_arrayScope =
|
Out<RowCursor> tempOut_arrayScope =
|
||||||
new Out<RowCursor>();
|
new Out<RowCursor>();
|
||||||
ResultAssert.IsSuccess(t.<LayoutTypedArray>typeAs().ReadScope(tempReference_Row, scope, tempOut_arrayScope));
|
ResultAssert.IsSuccess(t.<LayoutTypedArray>typeAs().ReadScope(tempReference_Row, scope, tempOut_arrayScope));
|
||||||
arrayScope = tempOut_arrayScope.get();
|
arrayScope = tempOut_arrayScope.get();
|
||||||
dispatcher.get().argValue.Row = tempReference_Row.get();
|
dispatcher.get().argValue.Row = tempReference_Row.get();
|
||||||
|
|
||||||
int i = 0;
|
int i = 0;
|
||||||
List items = (List)value;
|
List items = (List)value;
|
||||||
Reference<RowBuffer> tempReference_Row2 =
|
Reference<RowBuffer> tempReference_Row2 =
|
||||||
new Reference<RowBuffer>(dispatcher.get().Row);
|
new Reference<RowBuffer>(dispatcher.get().Row);
|
||||||
while (arrayScope.MoveNext(tempReference_Row2)) {
|
while (arrayScope.MoveNext(tempReference_Row2)) {
|
||||||
dispatcher.get().argValue.Row = tempReference_Row2.get();
|
dispatcher.get().argValue.Row = tempReference_Row2.get();
|
||||||
// TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'ref' keyword - these
|
// TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'ref' keyword - these
|
||||||
// cannot be converted using the 'Ref' helper class unless the method is within the code being
|
// cannot be converted using the 'Ref' helper class unless the method is within the code being
|
||||||
// modified:
|
// modified:
|
||||||
dispatcher.get().LayoutCodeSwitch(ref arrayScope, null, typeArgs.get(0).type(),
|
dispatcher.get().LayoutCodeSwitch(ref arrayScope, null, typeArgs.get(0).type(),
|
||||||
typeArgs.get(0).typeArgs().clone(), items.get(i++));
|
typeArgs.get(0).typeArgs().clone(), items.get(i++));
|
||||||
}
|
}
|
||||||
dispatcher.get().argValue.Row = tempReference_Row2.get();
|
dispatcher.get().argValue.Row = tempReference_Row2.get();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void DispatchMap(Reference<RowOperationDispatcher> dispatcher,
|
public void DispatchMap(Reference<RowOperationDispatcher> dispatcher,
|
||||||
Reference<RowCursor> scope, LayoutType t, TypeArgumentList typeArgs,
|
Reference<RowCursor> scope, LayoutType t, TypeArgumentList typeArgs,
|
||||||
Object value) {
|
Object value) {
|
||||||
checkArgument(typeArgs.count() == 2);
|
checkArgument(typeArgs.count() == 2);
|
||||||
|
|
||||||
Reference<RowBuffer> tempReference_Row =
|
Reference<RowBuffer> tempReference_Row =
|
||||||
new Reference<RowBuffer>(dispatcher.get().Row);
|
new Reference<RowBuffer>(dispatcher.get().Row);
|
||||||
RowCursor mapScope;
|
RowCursor mapScope;
|
||||||
Out<RowCursor> tempOut_mapScope =
|
Out<RowCursor> tempOut_mapScope =
|
||||||
new Out<RowCursor>();
|
new Out<RowCursor>();
|
||||||
ResultAssert.IsSuccess(t.<LayoutTypedMap>typeAs().ReadScope(tempReference_Row, scope, tempOut_mapScope));
|
ResultAssert.IsSuccess(t.<LayoutTypedMap>typeAs().ReadScope(tempReference_Row, scope, tempOut_mapScope));
|
||||||
mapScope = tempOut_mapScope.get();
|
mapScope = tempOut_mapScope.get();
|
||||||
dispatcher.get().argValue.Row = tempReference_Row.get();
|
dispatcher.get().argValue.Row = tempReference_Row.get();
|
||||||
int i = 0;
|
int i = 0;
|
||||||
List items = (List)value;
|
List items = (List)value;
|
||||||
Reference<RowBuffer> tempReference_Row2 =
|
Reference<RowBuffer> tempReference_Row2 =
|
||||||
new Reference<RowBuffer>(dispatcher.get().Row);
|
new Reference<RowBuffer>(dispatcher.get().Row);
|
||||||
while (mapScope.MoveNext(tempReference_Row2)) {
|
while (mapScope.MoveNext(tempReference_Row2)) {
|
||||||
dispatcher.get().argValue.Row = tempReference_Row2.get();
|
dispatcher.get().argValue.Row = tempReference_Row2.get();
|
||||||
// TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'ref' keyword - these
|
// TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'ref' keyword - these
|
||||||
// cannot be converted using the 'Ref' helper class unless the method is within the code being
|
// cannot be converted using the 'Ref' helper class unless the method is within the code being
|
||||||
// modified:
|
// modified:
|
||||||
dispatcher.get().LayoutCodeSwitch(ref mapScope, null, LayoutType.TypedTuple, typeArgs.clone(),
|
dispatcher.get().LayoutCodeSwitch(ref mapScope, null, LayoutType.TypedTuple, typeArgs.clone(),
|
||||||
items.get(i++));
|
items.get(i++));
|
||||||
}
|
}
|
||||||
dispatcher.get().argValue.Row = tempReference_Row2.get();
|
dispatcher.get().argValue.Row = tempReference_Row2.get();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void DispatchNullable(Reference<RowOperationDispatcher> dispatcher,
|
public void DispatchNullable(Reference<RowOperationDispatcher> dispatcher,
|
||||||
Reference<RowCursor> scope, LayoutType t, TypeArgumentList typeArgs,
|
Reference<RowCursor> scope, LayoutType t, TypeArgumentList typeArgs,
|
||||||
Object value) {
|
Object value) {
|
||||||
checkArgument(typeArgs.count() == 1);
|
checkArgument(typeArgs.count() == 1);
|
||||||
|
|
||||||
Reference<RowBuffer> tempReference_Row =
|
Reference<RowBuffer> tempReference_Row =
|
||||||
new Reference<RowBuffer>(dispatcher.get().Row);
|
new Reference<RowBuffer>(dispatcher.get().Row);
|
||||||
RowCursor nullableScope;
|
RowCursor nullableScope;
|
||||||
Out<RowCursor> tempOut_nullableScope =
|
Out<RowCursor> tempOut_nullableScope =
|
||||||
new Out<RowCursor>();
|
new Out<RowCursor>();
|
||||||
ResultAssert.IsSuccess(t.<LayoutNullable>typeAs().ReadScope(tempReference_Row, scope, tempOut_nullableScope));
|
ResultAssert.IsSuccess(t.<LayoutNullable>typeAs().ReadScope(tempReference_Row, scope, tempOut_nullableScope));
|
||||||
nullableScope = tempOut_nullableScope.get();
|
nullableScope = tempOut_nullableScope.get();
|
||||||
dispatcher.get().argValue.Row = tempReference_Row.get();
|
dispatcher.get().argValue.Row = tempReference_Row.get();
|
||||||
|
|
||||||
if (value != null) {
|
if (value != null) {
|
||||||
Reference<RowBuffer> tempReference_Row2 =
|
Reference<RowBuffer> tempReference_Row2 =
|
||||||
new Reference<RowBuffer>(dispatcher.get().Row);
|
new Reference<RowBuffer>(dispatcher.get().Row);
|
||||||
Reference<RowCursor> tempReference_nullableScope =
|
Reference<RowCursor> tempReference_nullableScope =
|
||||||
new Reference<RowCursor>(nullableScope);
|
new Reference<RowCursor>(nullableScope);
|
||||||
ResultAssert.IsSuccess(LayoutNullable.HasValue(tempReference_Row2, tempReference_nullableScope));
|
ResultAssert.IsSuccess(LayoutNullable.HasValue(tempReference_Row2, tempReference_nullableScope));
|
||||||
nullableScope = tempReference_nullableScope.get();
|
nullableScope = tempReference_nullableScope.get();
|
||||||
dispatcher.get().argValue.Row = tempReference_Row2.get();
|
dispatcher.get().argValue.Row = tempReference_Row2.get();
|
||||||
Reference<RowBuffer> tempReference_Row3 =
|
Reference<RowBuffer> tempReference_Row3 =
|
||||||
new Reference<RowBuffer>(dispatcher.get().Row);
|
new Reference<RowBuffer>(dispatcher.get().Row);
|
||||||
nullableScope.MoveNext(tempReference_Row3);
|
nullableScope.MoveNext(tempReference_Row3);
|
||||||
dispatcher.get().argValue.Row = tempReference_Row3.get();
|
dispatcher.get().argValue.Row = tempReference_Row3.get();
|
||||||
// TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'ref' keyword - these
|
// TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'ref' keyword - these
|
||||||
// cannot be converted using the 'Ref' helper class unless the method is within the code being
|
// cannot be converted using the 'Ref' helper class unless the method is within the code being
|
||||||
// modified:
|
// modified:
|
||||||
dispatcher.get().LayoutCodeSwitch(ref nullableScope, null, typeArgs.get(0).type(),
|
dispatcher.get().LayoutCodeSwitch(ref nullableScope, null, typeArgs.get(0).type(),
|
||||||
typeArgs.get(0).typeArgs().clone(), value);
|
typeArgs.get(0).typeArgs().clone(), value);
|
||||||
} else {
|
} else {
|
||||||
Reference<RowBuffer> tempReference_Row4 =
|
Reference<RowBuffer> tempReference_Row4 =
|
||||||
new Reference<RowBuffer>(dispatcher.get().Row);
|
new Reference<RowBuffer>(dispatcher.get().Row);
|
||||||
Reference<RowCursor> tempReference_nullableScope2 =
|
Reference<RowCursor> tempReference_nullableScope2 =
|
||||||
new Reference<RowCursor>(nullableScope);
|
new Reference<RowCursor>(nullableScope);
|
||||||
ResultAssert.NotFound(LayoutNullable.HasValue(tempReference_Row4, tempReference_nullableScope2));
|
ResultAssert.NotFound(LayoutNullable.HasValue(tempReference_Row4, tempReference_nullableScope2));
|
||||||
nullableScope = tempReference_nullableScope2.get();
|
nullableScope = tempReference_nullableScope2.get();
|
||||||
dispatcher.get().argValue.Row = tempReference_Row4.get();
|
dispatcher.get().argValue.Row = tempReference_Row4.get();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void DispatchObject(Reference<RowOperationDispatcher> dispatcher,
|
public void DispatchObject(Reference<RowOperationDispatcher> dispatcher,
|
||||||
Reference<RowCursor> scope) {
|
Reference<RowCursor> scope) {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void DispatchSet(Reference<RowOperationDispatcher> dispatcher,
|
public void DispatchSet(Reference<RowOperationDispatcher> dispatcher,
|
||||||
Reference<RowCursor> scope, LayoutType t, TypeArgumentList typeArgs,
|
Reference<RowCursor> scope, LayoutType t, TypeArgumentList typeArgs,
|
||||||
Object value) {
|
Object value) {
|
||||||
checkArgument(typeArgs.count() == 1);
|
checkArgument(typeArgs.count() == 1);
|
||||||
|
|
||||||
Reference<RowBuffer> tempReference_Row =
|
Reference<RowBuffer> tempReference_Row =
|
||||||
new Reference<RowBuffer>(dispatcher.get().Row);
|
new Reference<RowBuffer>(dispatcher.get().Row);
|
||||||
RowCursor setScope;
|
RowCursor setScope;
|
||||||
Out<RowCursor> tempOut_setScope =
|
Out<RowCursor> tempOut_setScope =
|
||||||
new Out<RowCursor>();
|
new Out<RowCursor>();
|
||||||
ResultAssert.IsSuccess(t.<LayoutTypedSet>typeAs().ReadScope(tempReference_Row, scope, tempOut_setScope));
|
ResultAssert.IsSuccess(t.<LayoutTypedSet>typeAs().ReadScope(tempReference_Row, scope, tempOut_setScope));
|
||||||
setScope = tempOut_setScope.get();
|
setScope = tempOut_setScope.get();
|
||||||
dispatcher.get().argValue.Row = tempReference_Row.get();
|
dispatcher.get().argValue.Row = tempReference_Row.get();
|
||||||
int i = 0;
|
int i = 0;
|
||||||
List items = (List)value;
|
List items = (List)value;
|
||||||
Reference<RowBuffer> tempReference_Row2 =
|
Reference<RowBuffer> tempReference_Row2 =
|
||||||
new Reference<RowBuffer>(dispatcher.get().Row);
|
new Reference<RowBuffer>(dispatcher.get().Row);
|
||||||
while (setScope.MoveNext(tempReference_Row2)) {
|
while (setScope.MoveNext(tempReference_Row2)) {
|
||||||
dispatcher.get().argValue.Row = tempReference_Row2.get();
|
dispatcher.get().argValue.Row = tempReference_Row2.get();
|
||||||
// TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'ref' keyword - these
|
// TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'ref' keyword - these
|
||||||
// cannot be converted using the 'Ref' helper class unless the method is within the code being
|
// cannot be converted using the 'Ref' helper class unless the method is within the code being
|
||||||
// modified:
|
// modified:
|
||||||
dispatcher.get().LayoutCodeSwitch(ref setScope, null, typeArgs.get(0).type(),
|
dispatcher.get().LayoutCodeSwitch(ref setScope, null, typeArgs.get(0).type(),
|
||||||
typeArgs.get(0).typeArgs().clone(), items.get(i++));
|
typeArgs.get(0).typeArgs().clone(), items.get(i++));
|
||||||
}
|
}
|
||||||
dispatcher.get().argValue.Row = tempReference_Row2.get();
|
dispatcher.get().argValue.Row = tempReference_Row2.get();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void DispatchTuple(Reference<RowOperationDispatcher> dispatcher,
|
public void DispatchTuple(Reference<RowOperationDispatcher> dispatcher,
|
||||||
Reference<RowCursor> scope, LayoutType t, TypeArgumentList typeArgs,
|
Reference<RowCursor> scope, LayoutType t, TypeArgumentList typeArgs,
|
||||||
Object value) {
|
Object value) {
|
||||||
checkArgument(typeArgs.count() >= 2);
|
checkArgument(typeArgs.count() >= 2);
|
||||||
|
|
||||||
Reference<RowBuffer> tempReference_Row =
|
Reference<RowBuffer> tempReference_Row =
|
||||||
new Reference<RowBuffer>(dispatcher.get().Row);
|
new Reference<RowBuffer>(dispatcher.get().Row);
|
||||||
RowCursor tupleScope;
|
RowCursor tupleScope;
|
||||||
Out<RowCursor> tempOut_tupleScope =
|
Out<RowCursor> tempOut_tupleScope =
|
||||||
new Out<RowCursor>();
|
new Out<RowCursor>();
|
||||||
ResultAssert.IsSuccess(t.<LayoutIndexedScope>typeAs().ReadScope(tempReference_Row, scope, tempOut_tupleScope));
|
ResultAssert.IsSuccess(t.<LayoutIndexedScope>typeAs().ReadScope(tempReference_Row, scope, tempOut_tupleScope));
|
||||||
tupleScope = tempOut_tupleScope.get();
|
tupleScope = tempOut_tupleScope.get();
|
||||||
dispatcher.get().argValue.Row = tempReference_Row.get();
|
dispatcher.get().argValue.Row = tempReference_Row.get();
|
||||||
|
|
||||||
for (int i = 0; i < typeArgs.count(); i++) {
|
for (int i = 0; i < typeArgs.count(); i++) {
|
||||||
Reference<RowBuffer> tempReference_Row2 =
|
Reference<RowBuffer> tempReference_Row2 =
|
||||||
new Reference<RowBuffer>(dispatcher.get().Row);
|
new Reference<RowBuffer>(dispatcher.get().Row);
|
||||||
tupleScope.MoveNext(tempReference_Row2);
|
tupleScope.MoveNext(tempReference_Row2);
|
||||||
dispatcher.get().argValue.Row = tempReference_Row2.get();
|
dispatcher.get().argValue.Row = tempReference_Row2.get();
|
||||||
PropertyInfo valueAccessor = value.getClass().GetProperty(String.format("Item%1$s", i + 1));
|
PropertyInfo valueAccessor = value.getClass().GetProperty(String.format("Item%1$s", i + 1));
|
||||||
// TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'ref' keyword - these
|
// TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'ref' keyword - these
|
||||||
// cannot be converted using the 'Ref' helper class unless the method is within the code being
|
// cannot be converted using the 'Ref' helper class unless the method is within the code being
|
||||||
// modified:
|
// modified:
|
||||||
dispatcher.get().LayoutCodeSwitch(ref tupleScope, null, typeArgs.get(i).type(),
|
dispatcher.get().LayoutCodeSwitch(ref tupleScope, null, typeArgs.get(i).type(),
|
||||||
typeArgs.get(i).typeArgs().clone(), valueAccessor.GetValue(value));
|
typeArgs.get(i).typeArgs().clone(), valueAccessor.GetValue(value));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void DispatchUDT(Reference<RowOperationDispatcher> dispatcher,
|
public void DispatchUDT(Reference<RowOperationDispatcher> dispatcher,
|
||||||
Reference<RowCursor> scope, LayoutType t, TypeArgumentList typeArgs,
|
Reference<RowCursor> scope, LayoutType t, TypeArgumentList typeArgs,
|
||||||
Object value) {
|
Object value) {
|
||||||
Reference<RowBuffer> tempReference_Row = new Reference<RowBuffer>(dispatcher.get().Row);
|
Reference<RowBuffer> tempReference_Row = new Reference<RowBuffer>(dispatcher.get().Row);
|
||||||
RowCursor udtScope;
|
RowCursor udtScope;
|
||||||
Out<RowCursor> tempOut_udtScope = new Out<RowCursor>();
|
Out<RowCursor> tempOut_udtScope = new Out<RowCursor>();
|
||||||
ResultAssert.IsSuccess(t.<LayoutUDT>typeAs().ReadScope(tempReference_Row, scope, tempOut_udtScope));
|
ResultAssert.IsSuccess(t.<LayoutUDT>typeAs().ReadScope(tempReference_Row, scope, tempOut_udtScope));
|
||||||
udtScope = tempOut_udtScope.get();
|
udtScope = tempOut_udtScope.get();
|
||||||
dispatcher.get().argValue.Row = tempReference_Row.get();
|
dispatcher.get().argValue.Row = tempReference_Row.get();
|
||||||
IDispatchable valueDispatcher = value instanceof IDispatchable ? (IDispatchable)value : null;
|
IDispatchable valueDispatcher = value instanceof IDispatchable ? (IDispatchable)value : null;
|
||||||
assert valueDispatcher != null;
|
assert valueDispatcher != null;
|
||||||
Reference<RowCursor> tempReference_udtScope = new Reference<RowCursor>(udtScope);
|
Reference<RowCursor> tempReference_udtScope = new Reference<RowCursor>(udtScope);
|
||||||
valueDispatcher.Dispatch(dispatcher, tempReference_udtScope);
|
valueDispatcher.Dispatch(dispatcher, tempReference_udtScope);
|
||||||
udtScope = tempReference_udtScope.get();
|
udtScope = tempReference_udtScope.get();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+241
-241
@@ -1,242 +1,242 @@
|
|||||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||||
// Licensed under the MIT License.
|
// Licensed under the MIT License.
|
||||||
|
|
||||||
package com.azure.data.cosmos.serialization.hybridrow.unit;
|
package com.azure.data.cosmos.serialization.hybridrow.unit;
|
||||||
|
|
||||||
import com.azure.data.cosmos.core.Out;
|
import com.azure.data.cosmos.core.Out;
|
||||||
import com.azure.data.cosmos.core.Reference;
|
import com.azure.data.cosmos.core.Reference;
|
||||||
import com.azure.data.cosmos.serialization.hybridrow.HybridRowVersion;
|
import com.azure.data.cosmos.serialization.hybridrow.HybridRowVersion;
|
||||||
import com.azure.data.cosmos.serialization.hybridrow.MemorySpanResizer;
|
import com.azure.data.cosmos.serialization.hybridrow.MemorySpanResizer;
|
||||||
import com.azure.data.cosmos.serialization.hybridrow.Result;
|
import com.azure.data.cosmos.serialization.hybridrow.Result;
|
||||||
import com.azure.data.cosmos.serialization.hybridrow.RowBuffer;
|
import com.azure.data.cosmos.serialization.hybridrow.RowBuffer;
|
||||||
import com.azure.data.cosmos.serialization.hybridrow.io.RowReader;
|
import com.azure.data.cosmos.serialization.hybridrow.io.RowReader;
|
||||||
import com.azure.data.cosmos.serialization.hybridrow.recordio.RecordIOStream;
|
import com.azure.data.cosmos.serialization.hybridrow.recordio.RecordIOStream;
|
||||||
import com.azure.data.cosmos.serialization.hybridrow.io.Segment;
|
import com.azure.data.cosmos.serialization.hybridrow.io.Segment;
|
||||||
import com.azure.data.cosmos.serialization.hybridrow.unit.customerschema.Address;
|
import com.azure.data.cosmos.serialization.hybridrow.unit.customerschema.Address;
|
||||||
|
|
||||||
import java.nio.file.Files;
|
import java.nio.file.Files;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
|
||||||
// TODO: C# TO JAVA CONVERTER: There is no preprocessor in Java:
|
// TODO: C# TO JAVA CONVERTER: There is no preprocessor in Java:
|
||||||
///#pragma warning disable SA1401 // Fields should be private
|
///#pragma warning disable SA1401 // Fields should be private
|
||||||
|
|
||||||
|
|
||||||
// TODO: C# TO JAVA CONVERTER: Java annotations will not correspond to .NET attributes:
|
// TODO: C# TO JAVA CONVERTER: Java annotations will not correspond to .NET attributes:
|
||||||
//ORIGINAL LINE: [TestClass][DeploymentItem(RecordIOUnitTests.SchemaFile, "TestData")] public class RecordIOUnitTests
|
//ORIGINAL LINE: [TestClass][DeploymentItem(RecordIOUnitTests.SchemaFile, "TestData")] public class RecordIOUnitTests
|
||||||
public class RecordIOUnitTests {
|
public class RecordIOUnitTests {
|
||||||
private static final int InitialRowSize = 0;
|
private static final int InitialRowSize = 0;
|
||||||
private static final String SchemaFile = "TestData\\CustomerSchema.json";
|
private static final String SchemaFile = "TestData\\CustomerSchema.json";
|
||||||
private Layout addressLayout;
|
private Layout addressLayout;
|
||||||
private Namespace ns;
|
private Namespace ns;
|
||||||
private LayoutResolver resolver;
|
private LayoutResolver resolver;
|
||||||
|
|
||||||
// TODO: C# TO JAVA CONVERTER: Java annotations will not correspond to .NET attributes:
|
// TODO: C# TO JAVA CONVERTER: Java annotations will not correspond to .NET attributes:
|
||||||
//ORIGINAL LINE: [TestMethod][Owner("jthunter")] public void LoadSchema()
|
//ORIGINAL LINE: [TestMethod][Owner("jthunter")] public void LoadSchema()
|
||||||
public final void LoadSchema() {
|
public final void LoadSchema() {
|
||||||
LayoutResolver systemResolver = SystemSchema.LayoutResolver;
|
LayoutResolver systemResolver = SystemSchema.LayoutResolver;
|
||||||
Layout segmentLayout = systemResolver.Resolve(SystemSchema.SegmentSchemaId);
|
Layout segmentLayout = systemResolver.Resolve(SystemSchema.SegmentSchemaId);
|
||||||
assert segmentLayout.getName().equals("Segment");
|
assert segmentLayout.getName().equals("Segment");
|
||||||
assert segmentLayout.getSchemaId().clone() == SystemSchema.SegmentSchemaId;
|
assert segmentLayout.getSchemaId().clone() == SystemSchema.SegmentSchemaId;
|
||||||
|
|
||||||
Layout recordLayout = systemResolver.Resolve(SystemSchema.RecordSchemaId);
|
Layout recordLayout = systemResolver.Resolve(SystemSchema.RecordSchemaId);
|
||||||
assert recordLayout.getName().equals("Record");
|
assert recordLayout.getName().equals("Record");
|
||||||
assert recordLayout.getSchemaId().clone() == SystemSchema.RecordSchemaId;
|
assert recordLayout.getSchemaId().clone() == SystemSchema.RecordSchemaId;
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: C# TO JAVA CONVERTER: Java annotations will not correspond to .NET attributes:
|
// TODO: C# TO JAVA CONVERTER: Java annotations will not correspond to .NET attributes:
|
||||||
//ORIGINAL LINE: [TestInitialize] public void ParseNamespaceExample()
|
//ORIGINAL LINE: [TestInitialize] public void ParseNamespaceExample()
|
||||||
public final void ParseNamespaceExample() {
|
public final void ParseNamespaceExample() {
|
||||||
String json = Files.readString(RecordIOUnitTests.SchemaFile);
|
String json = Files.readString(RecordIOUnitTests.SchemaFile);
|
||||||
this.ns = Namespace.Parse(json);
|
this.ns = Namespace.Parse(json);
|
||||||
this.resolver = new LayoutResolverNamespace(this.ns);
|
this.resolver = new LayoutResolverNamespace(this.ns);
|
||||||
this.addressLayout = this.resolver.Resolve(tangible.ListHelper.find(this.ns.getSchemas(), x -> x.Name.equals(
|
this.addressLayout = this.resolver.Resolve(tangible.ListHelper.find(this.ns.getSchemas(), x -> x.Name.equals(
|
||||||
"Address")).SchemaId);
|
"Address")).SchemaId);
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: C# TO JAVA CONVERTER: Java annotations will not correspond to .NET attributes:
|
// TODO: C# TO JAVA CONVERTER: Java annotations will not correspond to .NET attributes:
|
||||||
//ORIGINAL LINE: [TestMethod][Owner("jthunter")] public async Task RoundTripAsync()
|
//ORIGINAL LINE: [TestMethod][Owner("jthunter")] public async Task RoundTripAsync()
|
||||||
// TODO: C# TO JAVA CONVERTER: There is no equivalent in Java to the 'async' keyword:
|
// TODO: C# TO JAVA CONVERTER: There is no equivalent in Java to the 'async' keyword:
|
||||||
//ORIGINAL LINE: [TestMethod][Owner("jthunter")] public async Task RoundTripAsync()
|
//ORIGINAL LINE: [TestMethod][Owner("jthunter")] public async Task RoundTripAsync()
|
||||||
public final Task RoundTripAsync() {
|
public final Task RoundTripAsync() {
|
||||||
Address tempVar = new Address();
|
Address tempVar = new Address();
|
||||||
tempVar.setStreet("300B Chocolate Hole");
|
tempVar.setStreet("300B Chocolate Hole");
|
||||||
tempVar.setCity("Great Cruz Bay");
|
tempVar.setCity("Great Cruz Bay");
|
||||||
tempVar.setState("VI");
|
tempVar.setState("VI");
|
||||||
PostalCode tempVar2 = new PostalCode();
|
PostalCode tempVar2 = new PostalCode();
|
||||||
tempVar2.setZip(00830);
|
tempVar2.setZip(00830);
|
||||||
tempVar2.setPlus4(0001);
|
tempVar2.setPlus4(0001);
|
||||||
tempVar.setPostalCode(tempVar2);
|
tempVar.setPostalCode(tempVar2);
|
||||||
Address tempVar3 = new Address();
|
Address tempVar3 = new Address();
|
||||||
tempVar3.setStreet("1 Microsoft Way");
|
tempVar3.setStreet("1 Microsoft Way");
|
||||||
tempVar3.setCity("Redmond");
|
tempVar3.setCity("Redmond");
|
||||||
tempVar3.setState("WA");
|
tempVar3.setState("WA");
|
||||||
PostalCode tempVar4 = new PostalCode();
|
PostalCode tempVar4 = new PostalCode();
|
||||||
tempVar4.setZip(98052);
|
tempVar4.setZip(98052);
|
||||||
tempVar3.setPostalCode(tempVar4);
|
tempVar3.setPostalCode(tempVar4);
|
||||||
Address[] addresses = { tempVar, tempVar3 };
|
Address[] addresses = { tempVar, tempVar3 };
|
||||||
|
|
||||||
String sampleComment = "hello there";
|
String sampleComment = "hello there";
|
||||||
String sampleSDL = "some SDL";
|
String sampleSDL = "some SDL";
|
||||||
|
|
||||||
try (Stream stm = new MemoryStream()) {
|
try (Stream stm = new MemoryStream()) {
|
||||||
// Create a reusable, resizable buffer.
|
// Create a reusable, resizable buffer.
|
||||||
//C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java:
|
//C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java:
|
||||||
//ORIGINAL LINE: MemorySpanResizer<byte> resizer = new MemorySpanResizer<byte>(RecordIOUnitTests
|
//ORIGINAL LINE: MemorySpanResizer<byte> resizer = new MemorySpanResizer<byte>(RecordIOUnitTests
|
||||||
// .InitialRowSize);
|
// .InitialRowSize);
|
||||||
MemorySpanResizer<Byte> resizer = new MemorySpanResizer<Byte>(RecordIOUnitTests.InitialRowSize);
|
MemorySpanResizer<Byte> resizer = new MemorySpanResizer<Byte>(RecordIOUnitTests.InitialRowSize);
|
||||||
|
|
||||||
// Write a RecordIO stream.
|
// Write a RecordIO stream.
|
||||||
// TODO: C# TO JAVA CONVERTER: There is no equivalent to 'await' in Java:
|
// TODO: C# TO JAVA CONVERTER: There is no equivalent to 'await' in Java:
|
||||||
// TODO: C# TO JAVA CONVERTER: The following lambda contained an unresolved 'out' keyword - these are
|
// TODO: C# TO JAVA CONVERTER: The following lambda contained an unresolved 'out' keyword - these are
|
||||||
// not converted by C# to Java Converter:
|
// not converted by C# to Java Converter:
|
||||||
//C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java:
|
//C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java:
|
||||||
//ORIGINAL LINE: Result r = await stm.WriteRecordIOAsync(new Segment(sampleComment, sampleSDL), (long
|
//ORIGINAL LINE: Result r = await stm.WriteRecordIOAsync(new Segment(sampleComment, sampleSDL), (long
|
||||||
// index, out ReadOnlyMemory<byte> body) =>
|
// index, out ReadOnlyMemory<byte> body) =>
|
||||||
Result r = await
|
Result r = await
|
||||||
RecordIOStream.WriteRecordIOAsync(stm,
|
RecordIOStream.WriteRecordIOAsync(stm,
|
||||||
new Segment(sampleComment, sampleSDL), (long index, out ReadOnlyMemory<Byte>body) ->
|
new Segment(sampleComment, sampleSDL), (long index, out ReadOnlyMemory<Byte>body) ->
|
||||||
{
|
{
|
||||||
body = null;
|
body = null;
|
||||||
if (index >= addresses.length) {
|
if (index >= addresses.length) {
|
||||||
return Result.SUCCESS;
|
return Result.SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
Out<ReadOnlyMemory<Byte>> tempOut_body = new Out<ReadOnlyMemory<Byte>>();
|
Out<ReadOnlyMemory<Byte>> tempOut_body = new Out<ReadOnlyMemory<Byte>>();
|
||||||
Task tempVar5 = this.WriteAddress(resizer, addresses[index], tempOut_body);
|
Task tempVar5 = this.WriteAddress(resizer, addresses[index], tempOut_body);
|
||||||
body = tempOut_body.get();
|
body = tempOut_body.get();
|
||||||
return tempVar5;
|
return tempVar5;
|
||||||
});
|
});
|
||||||
|
|
||||||
// Read a RecordIO stream.
|
// Read a RecordIO stream.
|
||||||
ArrayList<Address> addressesRead = new ArrayList<Address>();
|
ArrayList<Address> addressesRead = new ArrayList<Address>();
|
||||||
stm.Position = 0;
|
stm.Position = 0;
|
||||||
//C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java:
|
//C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java:
|
||||||
//ORIGINAL LINE: resizer = new MemorySpanResizer<byte>(1);
|
//ORIGINAL LINE: resizer = new MemorySpanResizer<byte>(1);
|
||||||
resizer = new MemorySpanResizer<Byte>(1);
|
resizer = new MemorySpanResizer<Byte>(1);
|
||||||
// TODO: C# TO JAVA CONVERTER: There is no equivalent to 'await' in Java:
|
// TODO: C# TO JAVA CONVERTER: There is no equivalent to 'await' in Java:
|
||||||
r = await
|
r = await
|
||||||
RecordIOStream.ReadRecordIOAsync(stm, record ->
|
RecordIOStream.ReadRecordIOAsync(stm, record ->
|
||||||
{
|
{
|
||||||
assert !record.IsEmpty;
|
assert !record.IsEmpty;
|
||||||
|
|
||||||
Address obj;
|
Address obj;
|
||||||
Out<Address> tempOut_obj = new Out<Address>();
|
Out<Address> tempOut_obj = new Out<Address>();
|
||||||
r = this.ReadAddress(record, tempOut_obj);
|
r = this.ReadAddress(record, tempOut_obj);
|
||||||
obj = tempOut_obj.get();
|
obj = tempOut_obj.get();
|
||||||
ResultAssert.IsSuccess(r);
|
ResultAssert.IsSuccess(r);
|
||||||
addressesRead.add(obj);
|
addressesRead.add(obj);
|
||||||
return Result.SUCCESS;
|
return Result.SUCCESS;
|
||||||
}, segment ->
|
}, segment ->
|
||||||
{
|
{
|
||||||
assert !segment.IsEmpty;
|
assert !segment.IsEmpty;
|
||||||
|
|
||||||
Segment obj;
|
Segment obj;
|
||||||
Out<Segment> tempOut_obj =
|
Out<Segment> tempOut_obj =
|
||||||
new Out<Segment>();
|
new Out<Segment>();
|
||||||
r = this.ReadSegment(segment, tempOut_obj);
|
r = this.ReadSegment(segment, tempOut_obj);
|
||||||
obj = tempOut_obj.get();
|
obj = tempOut_obj.get();
|
||||||
ResultAssert.IsSuccess(r);
|
ResultAssert.IsSuccess(r);
|
||||||
assert obj.comment() == sampleComment;
|
assert obj.comment() == sampleComment;
|
||||||
assert obj.sdl() == sampleSDL;
|
assert obj.sdl() == sampleSDL;
|
||||||
return Result.SUCCESS;
|
return Result.SUCCESS;
|
||||||
}, resizer);
|
}, resizer);
|
||||||
|
|
||||||
ResultAssert.IsSuccess(r);
|
ResultAssert.IsSuccess(r);
|
||||||
|
|
||||||
// Check that the values all round-tripped.
|
// Check that the values all round-tripped.
|
||||||
assert addresses.length == addressesRead.size();
|
assert addresses.length == addressesRead.size();
|
||||||
for (int i = 0; i < addresses.length; i++) {
|
for (int i = 0; i < addresses.length; i++) {
|
||||||
assert addresses[i] == addressesRead.get(i);
|
assert addresses[i] == addressesRead.get(i);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java:
|
//C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java:
|
||||||
//ORIGINAL LINE: private Result ReadAddress(Memory<byte> buffer, out Address obj)
|
//ORIGINAL LINE: private Result ReadAddress(Memory<byte> buffer, out Address obj)
|
||||||
private Result ReadAddress(Memory<Byte> buffer, Out<Address> obj) {
|
private Result ReadAddress(Memory<Byte> buffer, Out<Address> obj) {
|
||||||
RowBuffer row = new RowBuffer(buffer.Span, HybridRowVersion.V1, this.resolver);
|
RowBuffer row = new RowBuffer(buffer.Span, HybridRowVersion.V1, this.resolver);
|
||||||
Reference<RowBuffer> tempReference_row =
|
Reference<RowBuffer> tempReference_row =
|
||||||
new Reference<RowBuffer>(row);
|
new Reference<RowBuffer>(row);
|
||||||
RowReader reader = new RowReader(tempReference_row);
|
RowReader reader = new RowReader(tempReference_row);
|
||||||
row = tempReference_row.get();
|
row = tempReference_row.get();
|
||||||
|
|
||||||
// Use the reader to dump to the screen.
|
// Use the reader to dump to the screen.
|
||||||
Reference<RowReader> tempReference_reader =
|
Reference<RowReader> tempReference_reader =
|
||||||
new Reference<RowReader>(reader);
|
new Reference<RowReader>(reader);
|
||||||
String str;
|
String str;
|
||||||
// TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'out' keyword - these
|
// TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'out' keyword - these
|
||||||
// cannot be converted using the 'Out' helper class unless the method is within the code being modified:
|
// cannot be converted using the 'Out' helper class unless the method is within the code being modified:
|
||||||
Result r = DiagnosticConverter.ReaderToString(tempReference_reader, out str);
|
Result r = DiagnosticConverter.ReaderToString(tempReference_reader, out str);
|
||||||
reader = tempReference_reader.get();
|
reader = tempReference_reader.get();
|
||||||
if (r != Result.SUCCESS) {
|
if (r != Result.SUCCESS) {
|
||||||
obj.setAndGet(null);
|
obj.setAndGet(null);
|
||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
|
|
||||||
System.out.println(str);
|
System.out.println(str);
|
||||||
|
|
||||||
// Reset the reader and materialize the object.
|
// Reset the reader and materialize the object.
|
||||||
Reference<RowBuffer> tempReference_row2 =
|
Reference<RowBuffer> tempReference_row2 =
|
||||||
new Reference<RowBuffer>(row);
|
new Reference<RowBuffer>(row);
|
||||||
reader = new RowReader(tempReference_row2);
|
reader = new RowReader(tempReference_row2);
|
||||||
row = tempReference_row2.get();
|
row = tempReference_row2.get();
|
||||||
Reference<RowReader> tempReference_reader2 =
|
Reference<RowReader> tempReference_reader2 =
|
||||||
new Reference<RowReader>(reader);
|
new Reference<RowReader>(reader);
|
||||||
Result tempVar = AddressSerializer.Read(tempReference_reader2, obj);
|
Result tempVar = AddressSerializer.Read(tempReference_reader2, obj);
|
||||||
reader = tempReference_reader2.get();
|
reader = tempReference_reader2.get();
|
||||||
return tempVar;
|
return tempVar;
|
||||||
}
|
}
|
||||||
|
|
||||||
//C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java:
|
//C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java:
|
||||||
//ORIGINAL LINE: private Result ReadSegment(Memory<byte> buffer, out Segment obj)
|
//ORIGINAL LINE: private Result ReadSegment(Memory<byte> buffer, out Segment obj)
|
||||||
private Result ReadSegment(Memory<Byte> buffer, Out<Segment> obj) {
|
private Result ReadSegment(Memory<Byte> buffer, Out<Segment> obj) {
|
||||||
RowBuffer row = new RowBuffer(buffer.Span, HybridRowVersion.V1, SystemSchema.LayoutResolver);
|
RowBuffer row = new RowBuffer(buffer.Span, HybridRowVersion.V1, SystemSchema.LayoutResolver);
|
||||||
Reference<RowBuffer> tempReference_row =
|
Reference<RowBuffer> tempReference_row =
|
||||||
new Reference<RowBuffer>(row);
|
new Reference<RowBuffer>(row);
|
||||||
RowReader reader = new RowReader(tempReference_row);
|
RowReader reader = new RowReader(tempReference_row);
|
||||||
row = tempReference_row.get();
|
row = tempReference_row.get();
|
||||||
|
|
||||||
// Use the reader to dump to the screen.
|
// Use the reader to dump to the screen.
|
||||||
Reference<RowReader> tempReference_reader =
|
Reference<RowReader> tempReference_reader =
|
||||||
new Reference<RowReader>(reader);
|
new Reference<RowReader>(reader);
|
||||||
String str;
|
String str;
|
||||||
// TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'out' keyword - these cannot be converted using the 'Out' helper class unless the method is within the code being modified:
|
// TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'out' keyword - these cannot be converted using the 'Out' helper class unless the method is within the code being modified:
|
||||||
Result r = DiagnosticConverter.ReaderToString(tempReference_reader, out str);
|
Result r = DiagnosticConverter.ReaderToString(tempReference_reader, out str);
|
||||||
reader = tempReference_reader.get();
|
reader = tempReference_reader.get();
|
||||||
if (r != Result.SUCCESS) {
|
if (r != Result.SUCCESS) {
|
||||||
obj.setAndGet(null);
|
obj.setAndGet(null);
|
||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
|
|
||||||
System.out.println(str);
|
System.out.println(str);
|
||||||
|
|
||||||
// Reset the reader and materialize the object.
|
// Reset the reader and materialize the object.
|
||||||
Reference<RowBuffer> tempReference_row2 = new Reference<RowBuffer>(row);
|
Reference<RowBuffer> tempReference_row2 = new Reference<RowBuffer>(row);
|
||||||
reader = new RowReader(tempReference_row2);
|
reader = new RowReader(tempReference_row2);
|
||||||
row = tempReference_row2.get();
|
row = tempReference_row2.get();
|
||||||
Reference<RowReader> tempReference_reader2 = new Reference<RowReader>(reader);
|
Reference<RowReader> tempReference_reader2 = new Reference<RowReader>(reader);
|
||||||
Result tempVar = SegmentSerializer.Read(tempReference_reader2, obj.clone());
|
Result tempVar = SegmentSerializer.Read(tempReference_reader2, obj.clone());
|
||||||
reader = tempReference_reader2.get();
|
reader = tempReference_reader2.get();
|
||||||
return tempVar;
|
return tempVar;
|
||||||
}
|
}
|
||||||
|
|
||||||
//C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java:
|
//C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java:
|
||||||
//ORIGINAL LINE: private Result WriteAddress(MemorySpanResizer<byte> resizer, Address obj, out
|
//ORIGINAL LINE: private Result WriteAddress(MemorySpanResizer<byte> resizer, Address obj, out
|
||||||
// ReadOnlyMemory<byte> buffer)
|
// ReadOnlyMemory<byte> buffer)
|
||||||
private Result WriteAddress(MemorySpanResizer<Byte> resizer, Address obj,
|
private Result WriteAddress(MemorySpanResizer<Byte> resizer, Address obj,
|
||||||
Out<ReadOnlyMemory<Byte>> buffer) {
|
Out<ReadOnlyMemory<Byte>> buffer) {
|
||||||
RowBuffer row = new RowBuffer(RecordIOUnitTests.InitialRowSize, resizer);
|
RowBuffer row = new RowBuffer(RecordIOUnitTests.InitialRowSize, resizer);
|
||||||
row.initLayout(HybridRowVersion.V1, this.addressLayout, this.resolver);
|
row.initLayout(HybridRowVersion.V1, this.addressLayout, this.resolver);
|
||||||
Reference<RowBuffer> tempReference_row =
|
Reference<RowBuffer> tempReference_row =
|
||||||
new Reference<RowBuffer>(row);
|
new Reference<RowBuffer>(row);
|
||||||
Result r = RowWriter.WriteBuffer(tempReference_row, obj, AddressSerializer.Write);
|
Result r = RowWriter.WriteBuffer(tempReference_row, obj, AddressSerializer.Write);
|
||||||
row = tempReference_row.get();
|
row = tempReference_row.get();
|
||||||
if (r != Result.SUCCESS) {
|
if (r != Result.SUCCESS) {
|
||||||
buffer.setAndGet(null);
|
buffer.setAndGet(null);
|
||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
|
|
||||||
buffer.setAndGet(resizer.getMemory().Slice(0, row.length()));
|
buffer.setAndGet(resizer.getMemory().Slice(0, row.length()));
|
||||||
return Result.SUCCESS;
|
return Result.SUCCESS;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+79
-79
@@ -1,80 +1,80 @@
|
|||||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||||
// Licensed under the MIT License.
|
// Licensed under the MIT License.
|
||||||
|
|
||||||
package com.azure.data.cosmos.serialization.hybridrow.unit;
|
package com.azure.data.cosmos.serialization.hybridrow.unit;
|
||||||
|
|
||||||
import com.azure.data.cosmos.serialization.hybridrow.Result;
|
import com.azure.data.cosmos.serialization.hybridrow.Result;
|
||||||
|
|
||||||
public final class ResultAssert {
|
public final class ResultAssert {
|
||||||
public static void Exists(Result actual) {
|
public static void Exists(Result actual) {
|
||||||
assert Result.EXISTS == actual;
|
assert Result.EXISTS == actual;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void Exists(Result actual, String message) {
|
public static void Exists(Result actual, String message) {
|
||||||
Assert.AreEqual(Result.EXISTS, actual, message);
|
Assert.AreEqual(Result.EXISTS, actual, message);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void Exists(Result actual, String message, Object... parameters) {
|
public static void Exists(Result actual, String message, Object... parameters) {
|
||||||
Assert.AreEqual(Result.EXISTS, actual, message, parameters);
|
Assert.AreEqual(Result.EXISTS, actual, message, parameters);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void InsufficientPermissions(Result actual) {
|
public static void InsufficientPermissions(Result actual) {
|
||||||
assert Result.INSUFFICIENT_PERMISSIONS == actual;
|
assert Result.INSUFFICIENT_PERMISSIONS == actual;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void InsufficientPermissions(Result actual, String message) {
|
public static void InsufficientPermissions(Result actual, String message) {
|
||||||
Assert.AreEqual(Result.INSUFFICIENT_PERMISSIONS, actual, message);
|
Assert.AreEqual(Result.INSUFFICIENT_PERMISSIONS, actual, message);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void InsufficientPermissions(Result actual, String message, Object... parameters) {
|
public static void InsufficientPermissions(Result actual, String message, Object... parameters) {
|
||||||
Assert.AreEqual(Result.INSUFFICIENT_PERMISSIONS, actual, message, parameters);
|
Assert.AreEqual(Result.INSUFFICIENT_PERMISSIONS, actual, message, parameters);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void IsSuccess(Result actual) {
|
public static void IsSuccess(Result actual) {
|
||||||
assert Result.SUCCESS == actual;
|
assert Result.SUCCESS == actual;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void IsSuccess(Result actual, String message) {
|
public static void IsSuccess(Result actual, String message) {
|
||||||
Assert.AreEqual(Result.SUCCESS, actual, message);
|
Assert.AreEqual(Result.SUCCESS, actual, message);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void IsSuccess(Result actual, String message, Object... parameters) {
|
public static void IsSuccess(Result actual, String message, Object... parameters) {
|
||||||
Assert.AreEqual(Result.SUCCESS, actual, message, parameters);
|
Assert.AreEqual(Result.SUCCESS, actual, message, parameters);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void NotFound(Result actual) {
|
public static void NotFound(Result actual) {
|
||||||
assert Result.NOT_FOUND == actual;
|
assert Result.NOT_FOUND == actual;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void NotFound(Result actual, String message) {
|
public static void NotFound(Result actual, String message) {
|
||||||
Assert.AreEqual(Result.NOT_FOUND, actual, message);
|
Assert.AreEqual(Result.NOT_FOUND, actual, message);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void NotFound(Result actual, String message, Object... parameters) {
|
public static void NotFound(Result actual, String message, Object... parameters) {
|
||||||
Assert.AreEqual(Result.NOT_FOUND, actual, message, parameters);
|
Assert.AreEqual(Result.NOT_FOUND, actual, message, parameters);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void TypeConstraint(Result actual) {
|
public static void TypeConstraint(Result actual) {
|
||||||
assert Result.TYPE_CONSTRAINT == actual;
|
assert Result.TYPE_CONSTRAINT == actual;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void TypeConstraint(Result actual, String message) {
|
public static void TypeConstraint(Result actual, String message) {
|
||||||
Assert.AreEqual(Result.TYPE_CONSTRAINT, actual, message);
|
Assert.AreEqual(Result.TYPE_CONSTRAINT, actual, message);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void TypeConstraint(Result actual, String message, Object... parameters) {
|
public static void TypeConstraint(Result actual, String message, Object... parameters) {
|
||||||
Assert.AreEqual(Result.TYPE_CONSTRAINT, actual, message, parameters);
|
Assert.AreEqual(Result.TYPE_CONSTRAINT, actual, message, parameters);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void TypeMismatch(Result actual) {
|
public static void TypeMismatch(Result actual) {
|
||||||
assert Result.TYPE_MISMATCH == actual;
|
assert Result.TYPE_MISMATCH == actual;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void TypeMismatch(Result actual, String message) {
|
public static void TypeMismatch(Result actual, String message) {
|
||||||
Assert.AreEqual(Result.TYPE_MISMATCH, actual, message);
|
Assert.AreEqual(Result.TYPE_MISMATCH, actual, message);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void TypeMismatch(Result actual, String message, Object... parameters) {
|
public static void TypeMismatch(Result actual, String message, Object... parameters) {
|
||||||
Assert.AreEqual(Result.TYPE_MISMATCH, actual, message, parameters);
|
Assert.AreEqual(Result.TYPE_MISMATCH, actual, message, parameters);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+69
-69
@@ -1,70 +1,70 @@
|
|||||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||||
// Licensed under the MIT License.
|
// Licensed under the MIT License.
|
||||||
|
|
||||||
package com.azure.data.cosmos.serialization.hybridrow.unit;
|
package com.azure.data.cosmos.serialization.hybridrow.unit;
|
||||||
|
|
||||||
import com.azure.data.cosmos.serialization.hybridrow.RowBuffer;
|
import com.azure.data.cosmos.serialization.hybridrow.RowBuffer;
|
||||||
|
|
||||||
// TODO: C# TO JAVA CONVERTER: Java annotations will not correspond to .NET attributes:
|
// TODO: C# TO JAVA CONVERTER: Java annotations will not correspond to .NET attributes:
|
||||||
//ORIGINAL LINE: [TestClass] public class RowBufferUnitTests
|
//ORIGINAL LINE: [TestClass] public class RowBufferUnitTests
|
||||||
public class RowBufferUnitTests {
|
public class RowBufferUnitTests {
|
||||||
// TODO: C# TO JAVA CONVERTER: Java annotations will not correspond to .NET attributes:
|
// TODO: C# TO JAVA CONVERTER: Java annotations will not correspond to .NET attributes:
|
||||||
//ORIGINAL LINE: [TestMethod][Owner("jthunter")][SuppressMessage("StyleCop.CSharp.ReadabilityRules",
|
//ORIGINAL LINE: [TestMethod][Owner("jthunter")][SuppressMessage("StyleCop.CSharp.ReadabilityRules",
|
||||||
// "SA1139:UseLiteralsSuffixNotationInsteadOfCasting", Justification = "Explicit")] public void VarIntTest()
|
// "SA1139:UseLiteralsSuffixNotationInsteadOfCasting", Justification = "Explicit")] public void VarIntTest()
|
||||||
public final void VarIntTest() {
|
public final void VarIntTest() {
|
||||||
// Brute force test all signed 16-bit values.
|
// Brute force test all signed 16-bit values.
|
||||||
for (int i = Short.MIN_VALUE; i <= Short.MAX_VALUE; i++) {
|
for (int i = Short.MIN_VALUE; i <= Short.MAX_VALUE; i++) {
|
||||||
short s = (short)i;
|
short s = (short)i;
|
||||||
this.RoundTripVarInt(s);
|
this.RoundTripVarInt(s);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Test boundary conditions for larger values.
|
// Test boundary conditions for larger values.
|
||||||
this.RoundTripVarInt(0);
|
this.RoundTripVarInt(0);
|
||||||
this.RoundTripVarInt(Integer.MIN_VALUE);
|
this.RoundTripVarInt(Integer.MIN_VALUE);
|
||||||
// TODO: C# TO JAVA CONVERTER: There is no Java equivalent to 'unchecked' in this context:
|
// TODO: C# TO JAVA CONVERTER: There is no Java equivalent to 'unchecked' in this context:
|
||||||
//ORIGINAL LINE: this.RoundTripVarInt(unchecked((int)0x80000000ul));
|
//ORIGINAL LINE: this.RoundTripVarInt(unchecked((int)0x80000000ul));
|
||||||
this.RoundTripVarInt(0x80000000);
|
this.RoundTripVarInt(0x80000000);
|
||||||
// TODO: C# TO JAVA CONVERTER: There is no Java equivalent to 'unchecked' in this context:
|
// TODO: C# TO JAVA CONVERTER: There is no Java equivalent to 'unchecked' in this context:
|
||||||
//ORIGINAL LINE: this.RoundTripVarInt(unchecked((int)0x7FFFFFFFul));
|
//ORIGINAL LINE: this.RoundTripVarInt(unchecked((int)0x7FFFFFFFul));
|
||||||
this.RoundTripVarInt(0x7FFFFFFF);
|
this.RoundTripVarInt(0x7FFFFFFF);
|
||||||
this.RoundTripVarInt(Integer.MAX_VALUE);
|
this.RoundTripVarInt(Integer.MAX_VALUE);
|
||||||
this.RoundTripVarInt(Long.MIN_VALUE);
|
this.RoundTripVarInt(Long.MIN_VALUE);
|
||||||
// TODO: C# TO JAVA CONVERTER: There is no Java equivalent to 'unchecked' in this context:
|
// TODO: C# TO JAVA CONVERTER: There is no Java equivalent to 'unchecked' in this context:
|
||||||
//ORIGINAL LINE: this.RoundTripVarInt(unchecked((long)0x8000000000000000ul));
|
//ORIGINAL LINE: this.RoundTripVarInt(unchecked((long)0x8000000000000000ul));
|
||||||
this.RoundTripVarInt((long)0x8000000000000000);
|
this.RoundTripVarInt((long)0x8000000000000000);
|
||||||
// TODO: C# TO JAVA CONVERTER: There is no Java equivalent to 'unchecked' in this context:
|
// TODO: C# TO JAVA CONVERTER: There is no Java equivalent to 'unchecked' in this context:
|
||||||
//ORIGINAL LINE: this.RoundTripVarInt(unchecked((long)0x7FFFFFFFFFFFFFFFul));
|
//ORIGINAL LINE: this.RoundTripVarInt(unchecked((long)0x7FFFFFFFFFFFFFFFul));
|
||||||
this.RoundTripVarInt((long)0x7FFFFFFFFFFFFFFF);
|
this.RoundTripVarInt((long)0x7FFFFFFFFFFFFFFF);
|
||||||
this.RoundTripVarInt(Long.MAX_VALUE);
|
this.RoundTripVarInt(Long.MAX_VALUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void RoundTripVarInt(short s) {
|
private void RoundTripVarInt(short s) {
|
||||||
//C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java:
|
//C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java:
|
||||||
//ORIGINAL LINE: ulong encoded = RowBuffer.RotateSignToLsb(s);
|
//ORIGINAL LINE: ulong encoded = RowBuffer.RotateSignToLsb(s);
|
||||||
long encoded = RowBuffer.rotateSignToLsb(s);
|
long encoded = RowBuffer.rotateSignToLsb(s);
|
||||||
long decoded = RowBuffer.rotateSignToMsb(encoded);
|
long decoded = RowBuffer.rotateSignToMsb(encoded);
|
||||||
// TODO: C# TO JAVA CONVERTER: There is no Java equivalent to 'unchecked' in this context:
|
// TODO: C# TO JAVA CONVERTER: There is no Java equivalent to 'unchecked' in this context:
|
||||||
//ORIGINAL LINE: short t = unchecked((short)decoded);
|
//ORIGINAL LINE: short t = unchecked((short)decoded);
|
||||||
short t = (short)decoded;
|
short t = (short)decoded;
|
||||||
Assert.AreEqual(s, t, "Value: {0}", s);
|
Assert.AreEqual(s, t, "Value: {0}", s);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void RoundTripVarInt(int s) {
|
private void RoundTripVarInt(int s) {
|
||||||
//C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java:
|
//C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java:
|
||||||
//ORIGINAL LINE: ulong encoded = RowBuffer.RotateSignToLsb(s);
|
//ORIGINAL LINE: ulong encoded = RowBuffer.RotateSignToLsb(s);
|
||||||
long encoded = RowBuffer.rotateSignToLsb(s);
|
long encoded = RowBuffer.rotateSignToLsb(s);
|
||||||
long decoded = RowBuffer.rotateSignToMsb(encoded);
|
long decoded = RowBuffer.rotateSignToMsb(encoded);
|
||||||
// TODO: C# TO JAVA CONVERTER: There is no Java equivalent to 'unchecked' in this context:
|
// TODO: C# TO JAVA CONVERTER: There is no Java equivalent to 'unchecked' in this context:
|
||||||
//ORIGINAL LINE: int t = unchecked((int)decoded);
|
//ORIGINAL LINE: int t = unchecked((int)decoded);
|
||||||
int t = (int)decoded;
|
int t = (int)decoded;
|
||||||
Assert.AreEqual(s, t, "Value: {0}", s);
|
Assert.AreEqual(s, t, "Value: {0}", s);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void RoundTripVarInt(long s) {
|
private void RoundTripVarInt(long s) {
|
||||||
//C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java:
|
//C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java:
|
||||||
//ORIGINAL LINE: ulong encoded = RowBuffer.RotateSignToLsb(s);
|
//ORIGINAL LINE: ulong encoded = RowBuffer.RotateSignToLsb(s);
|
||||||
long encoded = RowBuffer.rotateSignToLsb(s);
|
long encoded = RowBuffer.rotateSignToLsb(s);
|
||||||
long decoded = RowBuffer.rotateSignToMsb(encoded);
|
long decoded = RowBuffer.rotateSignToMsb(encoded);
|
||||||
Assert.AreEqual(s, decoded, "Value: {0}", s);
|
Assert.AreEqual(s, decoded, "Value: {0}", s);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+436
-436
@@ -1,437 +1,437 @@
|
|||||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||||
// Licensed under the MIT License.
|
// Licensed under the MIT License.
|
||||||
|
|
||||||
package com.azure.data.cosmos.serialization.hybridrow.unit;
|
package com.azure.data.cosmos.serialization.hybridrow.unit;
|
||||||
|
|
||||||
import com.azure.data.cosmos.core.Out;
|
import com.azure.data.cosmos.core.Out;
|
||||||
import com.azure.data.cosmos.core.Reference;
|
import com.azure.data.cosmos.core.Reference;
|
||||||
import com.azure.data.cosmos.serialization.hybridrow.Float128;
|
import com.azure.data.cosmos.serialization.hybridrow.Float128;
|
||||||
import com.azure.data.cosmos.serialization.hybridrow.HybridRowVersion;
|
import com.azure.data.cosmos.serialization.hybridrow.HybridRowVersion;
|
||||||
import com.azure.data.cosmos.serialization.hybridrow.NullValue;
|
import com.azure.data.cosmos.serialization.hybridrow.NullValue;
|
||||||
import com.azure.data.cosmos.serialization.hybridrow.RowBuffer;
|
import com.azure.data.cosmos.serialization.hybridrow.RowBuffer;
|
||||||
import com.azure.data.cosmos.serialization.hybridrow.RowCursor;
|
import com.azure.data.cosmos.serialization.hybridrow.RowCursor;
|
||||||
import com.azure.data.cosmos.serialization.hybridrow.UnixDateTime;
|
import com.azure.data.cosmos.serialization.hybridrow.UnixDateTime;
|
||||||
import com.azure.data.cosmos.serialization.hybridrow.io.RowReader;
|
import com.azure.data.cosmos.serialization.hybridrow.io.RowReader;
|
||||||
import com.azure.data.cosmos.serialization.hybridrow.layouts.Layout;
|
import com.azure.data.cosmos.serialization.hybridrow.layouts.Layout;
|
||||||
import com.azure.data.cosmos.serialization.hybridrow.layouts.LayoutBinary;
|
import com.azure.data.cosmos.serialization.hybridrow.layouts.LayoutBinary;
|
||||||
import com.azure.data.cosmos.serialization.hybridrow.layouts.LayoutBoolean;
|
import com.azure.data.cosmos.serialization.hybridrow.layouts.LayoutBoolean;
|
||||||
import com.azure.data.cosmos.serialization.hybridrow.layouts.LayoutColumn;
|
import com.azure.data.cosmos.serialization.hybridrow.layouts.LayoutColumn;
|
||||||
import com.azure.data.cosmos.serialization.hybridrow.layouts.LayoutDateTime;
|
import com.azure.data.cosmos.serialization.hybridrow.layouts.LayoutDateTime;
|
||||||
import com.azure.data.cosmos.serialization.hybridrow.layouts.LayoutDecimal;
|
import com.azure.data.cosmos.serialization.hybridrow.layouts.LayoutDecimal;
|
||||||
import com.azure.data.cosmos.serialization.hybridrow.layouts.LayoutFloat128;
|
import com.azure.data.cosmos.serialization.hybridrow.layouts.LayoutFloat128;
|
||||||
import com.azure.data.cosmos.serialization.hybridrow.layouts.LayoutFloat32;
|
import com.azure.data.cosmos.serialization.hybridrow.layouts.LayoutFloat32;
|
||||||
import com.azure.data.cosmos.serialization.hybridrow.layouts.LayoutFloat64;
|
import com.azure.data.cosmos.serialization.hybridrow.layouts.LayoutFloat64;
|
||||||
import com.azure.data.cosmos.serialization.hybridrow.layouts.LayoutGuid;
|
import com.azure.data.cosmos.serialization.hybridrow.layouts.LayoutGuid;
|
||||||
import com.azure.data.cosmos.serialization.hybridrow.layouts.LayoutInt16;
|
import com.azure.data.cosmos.serialization.hybridrow.layouts.LayoutInt16;
|
||||||
import com.azure.data.cosmos.serialization.hybridrow.layouts.LayoutInt32;
|
import com.azure.data.cosmos.serialization.hybridrow.layouts.LayoutInt32;
|
||||||
import com.azure.data.cosmos.serialization.hybridrow.layouts.LayoutInt64;
|
import com.azure.data.cosmos.serialization.hybridrow.layouts.LayoutInt64;
|
||||||
import com.azure.data.cosmos.serialization.hybridrow.layouts.LayoutInt8;
|
import com.azure.data.cosmos.serialization.hybridrow.layouts.LayoutInt8;
|
||||||
import com.azure.data.cosmos.serialization.hybridrow.layouts.LayoutMongoDbObjectId;
|
import com.azure.data.cosmos.serialization.hybridrow.layouts.LayoutMongoDbObjectId;
|
||||||
import com.azure.data.cosmos.serialization.hybridrow.layouts.LayoutNull;
|
import com.azure.data.cosmos.serialization.hybridrow.layouts.LayoutNull;
|
||||||
import com.azure.data.cosmos.serialization.hybridrow.layouts.LayoutResolver;
|
import com.azure.data.cosmos.serialization.hybridrow.layouts.LayoutResolver;
|
||||||
import com.azure.data.cosmos.serialization.hybridrow.layouts.LayoutType;
|
import com.azure.data.cosmos.serialization.hybridrow.layouts.LayoutType;
|
||||||
import com.azure.data.cosmos.serialization.hybridrow.layouts.LayoutUInt16;
|
import com.azure.data.cosmos.serialization.hybridrow.layouts.LayoutUInt16;
|
||||||
import com.azure.data.cosmos.serialization.hybridrow.layouts.LayoutUInt32;
|
import com.azure.data.cosmos.serialization.hybridrow.layouts.LayoutUInt32;
|
||||||
import com.azure.data.cosmos.serialization.hybridrow.layouts.LayoutUInt64;
|
import com.azure.data.cosmos.serialization.hybridrow.layouts.LayoutUInt64;
|
||||||
import com.azure.data.cosmos.serialization.hybridrow.layouts.LayoutUInt8;
|
import com.azure.data.cosmos.serialization.hybridrow.layouts.LayoutUInt8;
|
||||||
import com.azure.data.cosmos.serialization.hybridrow.layouts.LayoutUnixDateTime;
|
import com.azure.data.cosmos.serialization.hybridrow.layouts.LayoutUnixDateTime;
|
||||||
import com.azure.data.cosmos.serialization.hybridrow.layouts.LayoutUtf8;
|
import com.azure.data.cosmos.serialization.hybridrow.layouts.LayoutUtf8;
|
||||||
import com.azure.data.cosmos.serialization.hybridrow.layouts.LayoutVarInt;
|
import com.azure.data.cosmos.serialization.hybridrow.layouts.LayoutVarInt;
|
||||||
import com.azure.data.cosmos.serialization.hybridrow.layouts.LayoutVarUInt;
|
import com.azure.data.cosmos.serialization.hybridrow.layouts.LayoutVarUInt;
|
||||||
import com.azure.data.cosmos.serialization.hybridrow.layouts.TypeArgumentList;
|
import com.azure.data.cosmos.serialization.hybridrow.layouts.TypeArgumentList;
|
||||||
import com.azure.data.cosmos.serialization.hybridrow.schemas.StorageKind;
|
import com.azure.data.cosmos.serialization.hybridrow.schemas.StorageKind;
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
// TODO: C# TO JAVA CONVERTER: There is no preprocessor in Java:
|
// TODO: C# TO JAVA CONVERTER: There is no preprocessor in Java:
|
||||||
///#pragma warning disable SA1402 // FileMayOnlyContainASingleType
|
///#pragma warning disable SA1402 // FileMayOnlyContainASingleType
|
||||||
// TODO: C# TO JAVA CONVERTER: There is no preprocessor in Java:
|
// TODO: C# TO JAVA CONVERTER: There is no preprocessor in Java:
|
||||||
///#pragma warning disable SA1201 // OrderingRules
|
///#pragma warning disable SA1201 // OrderingRules
|
||||||
// TODO: C# TO JAVA CONVERTER: There is no preprocessor in Java:
|
// TODO: C# TO JAVA CONVERTER: There is no preprocessor in Java:
|
||||||
///#pragma warning disable SA1401 // Public Fields
|
///#pragma warning disable SA1401 // Public Fields
|
||||||
|
|
||||||
|
|
||||||
//C# TO JAVA CONVERTER WARNING: Java does not allow user-defined value types. The behavior of this class may differ
|
//C# TO JAVA CONVERTER WARNING: Java does not allow user-defined value types. The behavior of this class may differ
|
||||||
// from the original:
|
// from the original:
|
||||||
//ORIGINAL LINE: internal ref struct RowOperationDispatcher
|
//ORIGINAL LINE: internal ref struct RowOperationDispatcher
|
||||||
//C# TO JAVA CONVERTER WARNING: Java has no equivalent to the C# ref struct:
|
//C# TO JAVA CONVERTER WARNING: Java has no equivalent to the C# ref struct:
|
||||||
public final class RowOperationDispatcher {
|
public final class RowOperationDispatcher {
|
||||||
private static final int InitialRowSize = 2 * 1024 * 1024;
|
private static final int InitialRowSize = 2 * 1024 * 1024;
|
||||||
public LayoutResolver Resolver;
|
public LayoutResolver Resolver;
|
||||||
public RowBuffer Row = new RowBuffer();
|
public RowBuffer Row = new RowBuffer();
|
||||||
private IDispatcher dispatcher;
|
private IDispatcher dispatcher;
|
||||||
|
|
||||||
public RowOperationDispatcher() {
|
public RowOperationDispatcher() {
|
||||||
}
|
}
|
||||||
|
|
||||||
private RowOperationDispatcher(IDispatcher dispatcher, Layout layout, LayoutResolver resolver) {
|
private RowOperationDispatcher(IDispatcher dispatcher, Layout layout, LayoutResolver resolver) {
|
||||||
this.dispatcher = dispatcher;
|
this.dispatcher = dispatcher;
|
||||||
this.Row = new RowBuffer(RowOperationDispatcher.InitialRowSize);
|
this.Row = new RowBuffer(RowOperationDispatcher.InitialRowSize);
|
||||||
this.Resolver = resolver;
|
this.Resolver = resolver;
|
||||||
this.Row.initLayout(HybridRowVersion.V1, layout, this.Resolver);
|
this.Row.initLayout(HybridRowVersion.V1, layout, this.Resolver);
|
||||||
}
|
}
|
||||||
|
|
||||||
private RowOperationDispatcher(IDispatcher dispatcher, LayoutResolver resolver, String expected) {
|
private RowOperationDispatcher(IDispatcher dispatcher, LayoutResolver resolver, String expected) {
|
||||||
this.dispatcher = dispatcher;
|
this.dispatcher = dispatcher;
|
||||||
this.Row = new RowBuffer(RowOperationDispatcher.InitialRowSize);
|
this.Row = new RowBuffer(RowOperationDispatcher.InitialRowSize);
|
||||||
this.Resolver = resolver;
|
this.Resolver = resolver;
|
||||||
//C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java:
|
//C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java:
|
||||||
//ORIGINAL LINE: byte[] bytes = ByteConverter.ToBytes(expected);
|
//ORIGINAL LINE: byte[] bytes = ByteConverter.ToBytes(expected);
|
||||||
byte[] bytes = ByteConverter.ToBytes(expected);
|
byte[] bytes = ByteConverter.ToBytes(expected);
|
||||||
this.Row.readFrom(bytes, HybridRowVersion.V1, this.Resolver);
|
this.Row.readFrom(bytes, HybridRowVersion.V1, this.Resolver);
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: C# TO JAVA CONVERTER: The C# 'struct' constraint has no equivalent in Java:
|
// TODO: C# TO JAVA CONVERTER: The C# 'struct' constraint has no equivalent in Java:
|
||||||
//ORIGINAL LINE: public static RowOperationDispatcher Create<TDispatcher>(Layout layout, LayoutResolver resolver)
|
//ORIGINAL LINE: public static RowOperationDispatcher Create<TDispatcher>(Layout layout, LayoutResolver resolver)
|
||||||
// where TDispatcher : struct, IDispatcher
|
// where TDispatcher : struct, IDispatcher
|
||||||
public static <TDispatcher extends IDispatcher> RowOperationDispatcher Create(Layout layout,
|
public static <TDispatcher extends IDispatcher> RowOperationDispatcher Create(Layout layout,
|
||||||
LayoutResolver resolver) {
|
LayoutResolver resolver) {
|
||||||
return new RowOperationDispatcher(null, layout, resolver);
|
return new RowOperationDispatcher(null, layout, resolver);
|
||||||
}
|
}
|
||||||
|
|
||||||
public RowReader GetReader() {
|
public RowReader GetReader() {
|
||||||
Reference<RowBuffer> tempReference_Row =
|
Reference<RowBuffer> tempReference_Row =
|
||||||
new Reference<RowBuffer>(this.Row);
|
new Reference<RowBuffer>(this.Row);
|
||||||
// TODO: C# TO JAVA CONVERTER: The following line could not be converted:
|
// TODO: C# TO JAVA CONVERTER: The following line could not be converted:
|
||||||
return new RowReader(ref this.Row)
|
return new RowReader(ref this.Row)
|
||||||
this.Row = tempReference_Row.get();
|
this.Row = tempReference_Row.get();
|
||||||
return tempVar;
|
return tempVar;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void LayoutCodeSwitch(String path, LayoutType type, TypeArgumentList typeArgs) {
|
public void LayoutCodeSwitch(String path, LayoutType type, TypeArgumentList typeArgs) {
|
||||||
LayoutCodeSwitch(path, type, typeArgs, null);
|
LayoutCodeSwitch(path, type, typeArgs, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void LayoutCodeSwitch(String path, LayoutType type) {
|
public void LayoutCodeSwitch(String path, LayoutType type) {
|
||||||
LayoutCodeSwitch(path, type, null, null);
|
LayoutCodeSwitch(path, type, null, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void LayoutCodeSwitch(String path) {
|
public void LayoutCodeSwitch(String path) {
|
||||||
LayoutCodeSwitch(path, null, null, null);
|
LayoutCodeSwitch(path, null, null, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void LayoutCodeSwitch() {
|
public void LayoutCodeSwitch() {
|
||||||
LayoutCodeSwitch(null, null, null, null);
|
LayoutCodeSwitch(null, null, null, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
//C# TO JAVA CONVERTER NOTE: Java does not support optional parameters. Overloaded method(s) are created above:
|
//C# TO JAVA CONVERTER NOTE: Java does not support optional parameters. Overloaded method(s) are created above:
|
||||||
//ORIGINAL LINE: public void LayoutCodeSwitch(string path = null, LayoutType type = null, TypeArgumentList
|
//ORIGINAL LINE: public void LayoutCodeSwitch(string path = null, LayoutType type = null, TypeArgumentList
|
||||||
// typeArgs = default, object value = null)
|
// typeArgs = default, object value = null)
|
||||||
public void LayoutCodeSwitch(String path, LayoutType type, TypeArgumentList typeArgs, Object value) {
|
public void LayoutCodeSwitch(String path, LayoutType type, TypeArgumentList typeArgs, Object value) {
|
||||||
Reference<RowBuffer> tempReference_Row =
|
Reference<RowBuffer> tempReference_Row =
|
||||||
new Reference<RowBuffer>(this.Row);
|
new Reference<RowBuffer>(this.Row);
|
||||||
RowCursor root = RowCursor.create(tempReference_Row);
|
RowCursor root = RowCursor.create(tempReference_Row);
|
||||||
this.Row = tempReference_Row.get();
|
this.Row = tempReference_Row.get();
|
||||||
Reference<RowCursor> tempReference_root =
|
Reference<RowCursor> tempReference_root =
|
||||||
new Reference<RowCursor>(root);
|
new Reference<RowCursor>(root);
|
||||||
this.LayoutCodeSwitch(tempReference_root, path, type, typeArgs.clone(), value);
|
this.LayoutCodeSwitch(tempReference_root, path, type, typeArgs.clone(), value);
|
||||||
root = tempReference_root.get();
|
root = tempReference_root.get();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void LayoutCodeSwitch(Reference<RowCursor> scope, String path, LayoutType type,
|
public void LayoutCodeSwitch(Reference<RowCursor> scope, String path, LayoutType type,
|
||||||
TypeArgumentList typeArgs) {
|
TypeArgumentList typeArgs) {
|
||||||
LayoutCodeSwitch(scope, path, type, typeArgs, null);
|
LayoutCodeSwitch(scope, path, type, typeArgs, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void LayoutCodeSwitch(Reference<RowCursor> scope, String path, LayoutType type) {
|
public void LayoutCodeSwitch(Reference<RowCursor> scope, String path, LayoutType type) {
|
||||||
LayoutCodeSwitch(scope, path, type, null, null);
|
LayoutCodeSwitch(scope, path, type, null, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void LayoutCodeSwitch(Reference<RowCursor> scope, String path) {
|
public void LayoutCodeSwitch(Reference<RowCursor> scope, String path) {
|
||||||
LayoutCodeSwitch(scope, path, null, null, null);
|
LayoutCodeSwitch(scope, path, null, null, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void LayoutCodeSwitch(Reference<RowCursor> scope) {
|
public void LayoutCodeSwitch(Reference<RowCursor> scope) {
|
||||||
LayoutCodeSwitch(scope, null, null, null, null);
|
LayoutCodeSwitch(scope, null, null, null, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
//C# TO JAVA CONVERTER NOTE: Java does not support optional parameters. Overloaded method(s) are created above:
|
//C# TO JAVA CONVERTER NOTE: Java does not support optional parameters. Overloaded method(s) are created above:
|
||||||
//ORIGINAL LINE: public void LayoutCodeSwitch(ref RowCursor scope, string path = null, LayoutType type = null,
|
//ORIGINAL LINE: public void LayoutCodeSwitch(ref RowCursor scope, string path = null, LayoutType type = null,
|
||||||
// TypeArgumentList typeArgs = default, object value = null)
|
// TypeArgumentList typeArgs = default, object value = null)
|
||||||
public void LayoutCodeSwitch(Reference<RowCursor> scope, String path, LayoutType type,
|
public void LayoutCodeSwitch(Reference<RowCursor> scope, String path, LayoutType type,
|
||||||
TypeArgumentList typeArgs, Object value) {
|
TypeArgumentList typeArgs, Object value) {
|
||||||
LayoutColumn col = null;
|
LayoutColumn col = null;
|
||||||
if (type == null) {
|
if (type == null) {
|
||||||
assert path != null;
|
assert path != null;
|
||||||
Out<LayoutColumn> tempOut_col =
|
Out<LayoutColumn> tempOut_col =
|
||||||
new Out<LayoutColumn>();
|
new Out<LayoutColumn>();
|
||||||
assert scope.get().getLayout().TryFind(path, tempOut_col);
|
assert scope.get().getLayout().TryFind(path, tempOut_col);
|
||||||
col = tempOut_col.get();
|
col = tempOut_col.get();
|
||||||
assert col != null;
|
assert col != null;
|
||||||
type = col.type();
|
type = col.type();
|
||||||
typeArgs = col.typeArgs().clone();
|
typeArgs = col.typeArgs().clone();
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((path != null) && (col == null || col.storage() == StorageKind.SPARSE)) {
|
if ((path != null) && (col == null || col.storage() == StorageKind.SPARSE)) {
|
||||||
Reference<RowBuffer> tempReference_Row =
|
Reference<RowBuffer> tempReference_Row =
|
||||||
new Reference<RowBuffer>(this.Row);
|
new Reference<RowBuffer>(this.Row);
|
||||||
scope.get().Find(tempReference_Row, path);
|
scope.get().Find(tempReference_Row, path);
|
||||||
this.Row = tempReference_Row.get();
|
this.Row = tempReference_Row.get();
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (type.LayoutCode) {
|
switch (type.LayoutCode) {
|
||||||
case Null:
|
case Null:
|
||||||
Reference<RowOperationDispatcher> tempReference_this = new Reference<RowOperationDispatcher>(this);
|
Reference<RowOperationDispatcher> tempReference_this = new Reference<RowOperationDispatcher>(this);
|
||||||
this.dispatcher.<LayoutNull, NullValue>Dispatch(tempReference_this, scope, col, type, NullValue.DEFAULT);
|
this.dispatcher.<LayoutNull, NullValue>Dispatch(tempReference_this, scope, col, type, NullValue.DEFAULT);
|
||||||
this = tempReference_this.get();
|
this = tempReference_this.get();
|
||||||
break;
|
break;
|
||||||
case Boolean:
|
case Boolean:
|
||||||
Reference<RowOperationDispatcher> tempReference_this2 = new Reference<RowOperationDispatcher>(this);
|
Reference<RowOperationDispatcher> tempReference_this2 = new Reference<RowOperationDispatcher>(this);
|
||||||
this.dispatcher.<LayoutBoolean, Boolean>Dispatch(tempReference_this2, scope, col, type,
|
this.dispatcher.<LayoutBoolean, Boolean>Dispatch(tempReference_this2, scope, col, type,
|
||||||
value != null ? value :
|
value != null ? value :
|
||||||
default)
|
default)
|
||||||
this = tempReference_this2.get();
|
this = tempReference_this2.get();
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case Int8:
|
case Int8:
|
||||||
Reference<RowOperationDispatcher> tempReference_this3 = new Reference<RowOperationDispatcher>(this);
|
Reference<RowOperationDispatcher> tempReference_this3 = new Reference<RowOperationDispatcher>(this);
|
||||||
this.dispatcher.<LayoutInt8, Byte>Dispatch(tempReference_this3, scope, col, type, value != null ?
|
this.dispatcher.<LayoutInt8, Byte>Dispatch(tempReference_this3, scope, col, type, value != null ?
|
||||||
value :
|
value :
|
||||||
default)
|
default)
|
||||||
this = tempReference_this3.get();
|
this = tempReference_this3.get();
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case Int16:
|
case Int16:
|
||||||
Reference<RowOperationDispatcher> tempReference_this4 = new Reference<RowOperationDispatcher>(this);
|
Reference<RowOperationDispatcher> tempReference_this4 = new Reference<RowOperationDispatcher>(this);
|
||||||
this.dispatcher.<LayoutInt16, Short>Dispatch(tempReference_this4, scope, col, type, value != null ?
|
this.dispatcher.<LayoutInt16, Short>Dispatch(tempReference_this4, scope, col, type, value != null ?
|
||||||
value :
|
value :
|
||||||
default)
|
default)
|
||||||
this = tempReference_this4.get();
|
this = tempReference_this4.get();
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case Int32:
|
case Int32:
|
||||||
Reference<RowOperationDispatcher> tempReference_this5 = new Reference<RowOperationDispatcher>(this);
|
Reference<RowOperationDispatcher> tempReference_this5 = new Reference<RowOperationDispatcher>(this);
|
||||||
this.dispatcher.<LayoutInt32, Integer>Dispatch(tempReference_this5, scope, col, type,
|
this.dispatcher.<LayoutInt32, Integer>Dispatch(tempReference_this5, scope, col, type,
|
||||||
value != null ? value :
|
value != null ? value :
|
||||||
default)
|
default)
|
||||||
this = tempReference_this5.get();
|
this = tempReference_this5.get();
|
||||||
break;
|
break;
|
||||||
case Int64:
|
case Int64:
|
||||||
Reference<RowOperationDispatcher> tempReference_this6 = new Reference<RowOperationDispatcher>(this);
|
Reference<RowOperationDispatcher> tempReference_this6 = new Reference<RowOperationDispatcher>(this);
|
||||||
this.dispatcher.<LayoutInt64, Long>Dispatch(tempReference_this6, scope, col, type, value != null ?
|
this.dispatcher.<LayoutInt64, Long>Dispatch(tempReference_this6, scope, col, type, value != null ?
|
||||||
value :
|
value :
|
||||||
default)
|
default)
|
||||||
this = tempReference_this6.get();
|
this = tempReference_this6.get();
|
||||||
break;
|
break;
|
||||||
case UInt8:
|
case UInt8:
|
||||||
Reference<RowOperationDispatcher> tempReference_this7 = new Reference<RowOperationDispatcher>(this);
|
Reference<RowOperationDispatcher> tempReference_this7 = new Reference<RowOperationDispatcher>(this);
|
||||||
//C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java:
|
//C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java:
|
||||||
//ORIGINAL LINE: this.dispatcher.Dispatch<LayoutUInt8, byte>(tempRef_this7, scope, col, type,
|
//ORIGINAL LINE: this.dispatcher.Dispatch<LayoutUInt8, byte>(tempRef_this7, scope, col, type,
|
||||||
// (Nullable<byte>)value != null ? value : default);
|
// (Nullable<byte>)value != null ? value : default);
|
||||||
this.dispatcher.<LayoutUInt8, Byte>Dispatch(tempReference_this7, scope, col, type, value != null ?
|
this.dispatcher.<LayoutUInt8, Byte>Dispatch(tempReference_this7, scope, col, type, value != null ?
|
||||||
value :
|
value :
|
||||||
default)
|
default)
|
||||||
this = tempReference_this7.get();
|
this = tempReference_this7.get();
|
||||||
break;
|
break;
|
||||||
case UInt16:
|
case UInt16:
|
||||||
Reference<RowOperationDispatcher> tempReference_this8 = new Reference<RowOperationDispatcher>(this);
|
Reference<RowOperationDispatcher> tempReference_this8 = new Reference<RowOperationDispatcher>(this);
|
||||||
//C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java:
|
//C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java:
|
||||||
//ORIGINAL LINE: this.dispatcher.Dispatch<LayoutUInt16, ushort>(tempRef_this8, scope, col, type,
|
//ORIGINAL LINE: this.dispatcher.Dispatch<LayoutUInt16, ushort>(tempRef_this8, scope, col, type,
|
||||||
// (Nullable<ushort>)value != null ? value : default);
|
// (Nullable<ushort>)value != null ? value : default);
|
||||||
this.dispatcher.<LayoutUInt16, Short>Dispatch(tempReference_this8, scope, col, type, value != null ?
|
this.dispatcher.<LayoutUInt16, Short>Dispatch(tempReference_this8, scope, col, type, value != null ?
|
||||||
value :
|
value :
|
||||||
default)
|
default)
|
||||||
this = tempReference_this8.get();
|
this = tempReference_this8.get();
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case UInt32:
|
case UInt32:
|
||||||
Reference<RowOperationDispatcher> tempReference_this9 = new Reference<RowOperationDispatcher>(this);
|
Reference<RowOperationDispatcher> tempReference_this9 = new Reference<RowOperationDispatcher>(this);
|
||||||
//C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java:
|
//C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java:
|
||||||
//ORIGINAL LINE: this.dispatcher.Dispatch<LayoutUInt32, uint>(tempRef_this9, scope, col, type,
|
//ORIGINAL LINE: this.dispatcher.Dispatch<LayoutUInt32, uint>(tempRef_this9, scope, col, type,
|
||||||
// (Nullable<uint>)value != null ? value : default);
|
// (Nullable<uint>)value != null ? value : default);
|
||||||
this.dispatcher.<LayoutUInt32, Integer>Dispatch(tempReference_this9, scope, col, type,
|
this.dispatcher.<LayoutUInt32, Integer>Dispatch(tempReference_this9, scope, col, type,
|
||||||
value != null ? value :
|
value != null ? value :
|
||||||
default)
|
default)
|
||||||
this = tempReference_this9.get();
|
this = tempReference_this9.get();
|
||||||
break;
|
break;
|
||||||
case UInt64:
|
case UInt64:
|
||||||
Reference<RowOperationDispatcher> tempReference_this10 = new Reference<RowOperationDispatcher>(this);
|
Reference<RowOperationDispatcher> tempReference_this10 = new Reference<RowOperationDispatcher>(this);
|
||||||
//C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java:
|
//C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java:
|
||||||
//ORIGINAL LINE: this.dispatcher.Dispatch<LayoutUInt64, ulong>(tempRef_this10, scope, col, type,
|
//ORIGINAL LINE: this.dispatcher.Dispatch<LayoutUInt64, ulong>(tempRef_this10, scope, col, type,
|
||||||
// (Nullable<ulong>)value != null ? value : default);
|
// (Nullable<ulong>)value != null ? value : default);
|
||||||
this.dispatcher.<LayoutUInt64, Long>Dispatch(tempReference_this10, scope, col, type, value != null ?
|
this.dispatcher.<LayoutUInt64, Long>Dispatch(tempReference_this10, scope, col, type, value != null ?
|
||||||
value :
|
value :
|
||||||
default)
|
default)
|
||||||
this = tempReference_this10.get();
|
this = tempReference_this10.get();
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case VarInt:
|
case VarInt:
|
||||||
Reference<RowOperationDispatcher> tempReference_this11 = new Reference<RowOperationDispatcher>(this);
|
Reference<RowOperationDispatcher> tempReference_this11 = new Reference<RowOperationDispatcher>(this);
|
||||||
this.dispatcher.<LayoutVarInt, Long>Dispatch(tempReference_this11, scope, col, type, value != null ?
|
this.dispatcher.<LayoutVarInt, Long>Dispatch(tempReference_this11, scope, col, type, value != null ?
|
||||||
value :
|
value :
|
||||||
default)
|
default)
|
||||||
this = tempReference_this11.get();
|
this = tempReference_this11.get();
|
||||||
break;
|
break;
|
||||||
case VarUInt:
|
case VarUInt:
|
||||||
Reference<RowOperationDispatcher> tempReference_this12 = new Reference<RowOperationDispatcher>(this);
|
Reference<RowOperationDispatcher> tempReference_this12 = new Reference<RowOperationDispatcher>(this);
|
||||||
//C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java:
|
//C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java:
|
||||||
//ORIGINAL LINE: this.dispatcher.Dispatch<LayoutVarUInt, ulong>(tempRef_this12, scope, col, type,
|
//ORIGINAL LINE: this.dispatcher.Dispatch<LayoutVarUInt, ulong>(tempRef_this12, scope, col, type,
|
||||||
// (Nullable<ulong>)value != null ? value : default);
|
// (Nullable<ulong>)value != null ? value : default);
|
||||||
this.dispatcher.<LayoutVarUInt, Long>Dispatch(tempReference_this12, scope, col, type, value != null ?
|
this.dispatcher.<LayoutVarUInt, Long>Dispatch(tempReference_this12, scope, col, type, value != null ?
|
||||||
value :
|
value :
|
||||||
default)
|
default)
|
||||||
this = tempReference_this12.get();
|
this = tempReference_this12.get();
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case Float32:
|
case Float32:
|
||||||
Reference<RowOperationDispatcher> tempReference_this13 = new Reference<RowOperationDispatcher>(this);
|
Reference<RowOperationDispatcher> tempReference_this13 = new Reference<RowOperationDispatcher>(this);
|
||||||
this.dispatcher.<LayoutFloat32, Float>Dispatch(tempReference_this13, scope, col, type,
|
this.dispatcher.<LayoutFloat32, Float>Dispatch(tempReference_this13, scope, col, type,
|
||||||
value != null ? value :
|
value != null ? value :
|
||||||
default)
|
default)
|
||||||
this = tempReference_this13.get();
|
this = tempReference_this13.get();
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case Float64:
|
case Float64:
|
||||||
Reference<RowOperationDispatcher> tempReference_this14 = new Reference<RowOperationDispatcher>(this);
|
Reference<RowOperationDispatcher> tempReference_this14 = new Reference<RowOperationDispatcher>(this);
|
||||||
this.dispatcher.<LayoutFloat64, Double>Dispatch(tempReference_this14, scope, col, type,
|
this.dispatcher.<LayoutFloat64, Double>Dispatch(tempReference_this14, scope, col, type,
|
||||||
value != null ? value :
|
value != null ? value :
|
||||||
default)
|
default)
|
||||||
this = tempReference_this14.get();
|
this = tempReference_this14.get();
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case Float128:
|
case Float128:
|
||||||
Reference<RowOperationDispatcher> tempReference_this15 = new Reference<RowOperationDispatcher>(this);
|
Reference<RowOperationDispatcher> tempReference_this15 = new Reference<RowOperationDispatcher>(this);
|
||||||
this.dispatcher.<LayoutFloat128, Float128>Dispatch(tempReference_this15, scope, col, type,
|
this.dispatcher.<LayoutFloat128, Float128>Dispatch(tempReference_this15, scope, col, type,
|
||||||
value != null ? value :
|
value != null ? value :
|
||||||
default)
|
default)
|
||||||
this = tempReference_this15.get();
|
this = tempReference_this15.get();
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case Decimal:
|
case Decimal:
|
||||||
Reference<RowOperationDispatcher> tempReference_this16 = new Reference<RowOperationDispatcher>(this);
|
Reference<RowOperationDispatcher> tempReference_this16 = new Reference<RowOperationDispatcher>(this);
|
||||||
this.dispatcher.<LayoutDecimal, BigDecimal>Dispatch(tempReference_this16, scope, col, type,
|
this.dispatcher.<LayoutDecimal, BigDecimal>Dispatch(tempReference_this16, scope, col, type,
|
||||||
value != null ? value :
|
value != null ? value :
|
||||||
default)
|
default)
|
||||||
this = tempReference_this16.get();
|
this = tempReference_this16.get();
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case DateTime:
|
case DateTime:
|
||||||
Reference<RowOperationDispatcher> tempReference_this17 = new Reference<RowOperationDispatcher>(this);
|
Reference<RowOperationDispatcher> tempReference_this17 = new Reference<RowOperationDispatcher>(this);
|
||||||
this.dispatcher.<LayoutDateTime, LocalDateTime>Dispatch(tempReference_this17, scope, col, type,
|
this.dispatcher.<LayoutDateTime, LocalDateTime>Dispatch(tempReference_this17, scope, col, type,
|
||||||
value != null ? value :
|
value != null ? value :
|
||||||
default)
|
default)
|
||||||
this = tempReference_this17.get();
|
this = tempReference_this17.get();
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case UnixDateTime:
|
case UnixDateTime:
|
||||||
Reference<RowOperationDispatcher> tempReference_this18 = new Reference<RowOperationDispatcher>(this);
|
Reference<RowOperationDispatcher> tempReference_this18 = new Reference<RowOperationDispatcher>(this);
|
||||||
this.dispatcher.<LayoutUnixDateTime, UnixDateTime>Dispatch(tempReference_this18, scope, col, type,
|
this.dispatcher.<LayoutUnixDateTime, UnixDateTime>Dispatch(tempReference_this18, scope, col, type,
|
||||||
value != null ? value :
|
value != null ? value :
|
||||||
default)
|
default)
|
||||||
this = tempReference_this18.get();
|
this = tempReference_this18.get();
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case Guid:
|
case Guid:
|
||||||
Reference<RowOperationDispatcher> tempReference_this19 = new Reference<RowOperationDispatcher>(this);
|
Reference<RowOperationDispatcher> tempReference_this19 = new Reference<RowOperationDispatcher>(this);
|
||||||
this.dispatcher.<LayoutGuid, UUID>Dispatch(tempReference_this19, scope, col, type, value != null ?
|
this.dispatcher.<LayoutGuid, UUID>Dispatch(tempReference_this19, scope, col, type, value != null ?
|
||||||
value :
|
value :
|
||||||
default)
|
default)
|
||||||
this = tempReference_this19.get();
|
this = tempReference_this19.get();
|
||||||
break;
|
break;
|
||||||
case MongoDbObjectId:
|
case MongoDbObjectId:
|
||||||
Reference<RowOperationDispatcher> tempReference_this20 = new Reference<RowOperationDispatcher>(this);
|
Reference<RowOperationDispatcher> tempReference_this20 = new Reference<RowOperationDispatcher>(this);
|
||||||
this.dispatcher.<LayoutMongoDbObjectId, MongoDbObjectId>Dispatch(tempReference_this20, scope, col, type,
|
this.dispatcher.<LayoutMongoDbObjectId, MongoDbObjectId>Dispatch(tempReference_this20, scope, col, type,
|
||||||
value != null ? value :
|
value != null ? value :
|
||||||
default)
|
default)
|
||||||
this = tempReference_this20.get();
|
this = tempReference_this20.get();
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case Utf8:
|
case Utf8:
|
||||||
Reference<RowOperationDispatcher> tempReference_this21 = new Reference<RowOperationDispatcher>(this);
|
Reference<RowOperationDispatcher> tempReference_this21 = new Reference<RowOperationDispatcher>(this);
|
||||||
this.dispatcher.<LayoutUtf8, String>Dispatch(tempReference_this21, scope, col, type, (String)value);
|
this.dispatcher.<LayoutUtf8, String>Dispatch(tempReference_this21, scope, col, type, (String)value);
|
||||||
this = tempReference_this21.get();
|
this = tempReference_this21.get();
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case Binary:
|
case Binary:
|
||||||
Reference<RowOperationDispatcher> tempReference_this22 = new Reference<RowOperationDispatcher>(this);
|
Reference<RowOperationDispatcher> tempReference_this22 = new Reference<RowOperationDispatcher>(this);
|
||||||
//C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java:
|
//C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java:
|
||||||
//ORIGINAL LINE: this.dispatcher.Dispatch<LayoutBinary, byte[]>(ref this, ref scope, col, type,
|
//ORIGINAL LINE: this.dispatcher.Dispatch<LayoutBinary, byte[]>(ref this, ref scope, col, type,
|
||||||
// (byte[])value);
|
// (byte[])value);
|
||||||
this.dispatcher.<LayoutBinary, byte[]>Dispatch(tempReference_this22, scope, col, type, (byte[])value);
|
this.dispatcher.<LayoutBinary, byte[]>Dispatch(tempReference_this22, scope, col, type, (byte[])value);
|
||||||
this = tempReference_this22.get();
|
this = tempReference_this22.get();
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case ObjectScope:
|
case ObjectScope:
|
||||||
case ImmutableObjectScope:
|
case ImmutableObjectScope:
|
||||||
Reference<RowOperationDispatcher> tempReference_this23 = new Reference<RowOperationDispatcher>(this);
|
Reference<RowOperationDispatcher> tempReference_this23 = new Reference<RowOperationDispatcher>(this);
|
||||||
this.dispatcher.DispatchObject(tempReference_this23, scope);
|
this.dispatcher.DispatchObject(tempReference_this23, scope);
|
||||||
this = tempReference_this23.get();
|
this = tempReference_this23.get();
|
||||||
break;
|
break;
|
||||||
case TypedArrayScope:
|
case TypedArrayScope:
|
||||||
case ImmutableTypedArrayScope:
|
case ImmutableTypedArrayScope:
|
||||||
Reference<RowOperationDispatcher> tempReference_this24 = new Reference<RowOperationDispatcher>(this);
|
Reference<RowOperationDispatcher> tempReference_this24 = new Reference<RowOperationDispatcher>(this);
|
||||||
this.dispatcher.DispatchArray(tempReference_this24, scope, type, typeArgs.clone(), value);
|
this.dispatcher.DispatchArray(tempReference_this24, scope, type, typeArgs.clone(), value);
|
||||||
this = tempReference_this24.get();
|
this = tempReference_this24.get();
|
||||||
break;
|
break;
|
||||||
case TypedSetScope:
|
case TypedSetScope:
|
||||||
case ImmutableTypedSetScope:
|
case ImmutableTypedSetScope:
|
||||||
Reference<RowOperationDispatcher> tempReference_this25 = new Reference<RowOperationDispatcher>(this);
|
Reference<RowOperationDispatcher> tempReference_this25 = new Reference<RowOperationDispatcher>(this);
|
||||||
this.dispatcher.DispatchSet(tempReference_this25, scope, type, typeArgs.clone(), value);
|
this.dispatcher.DispatchSet(tempReference_this25, scope, type, typeArgs.clone(), value);
|
||||||
this = tempReference_this25.get();
|
this = tempReference_this25.get();
|
||||||
break;
|
break;
|
||||||
case TypedMapScope:
|
case TypedMapScope:
|
||||||
case ImmutableTypedMapScope:
|
case ImmutableTypedMapScope:
|
||||||
Reference<RowOperationDispatcher> tempReference_this26 = new Reference<RowOperationDispatcher>(this);
|
Reference<RowOperationDispatcher> tempReference_this26 = new Reference<RowOperationDispatcher>(this);
|
||||||
this.dispatcher.DispatchMap(tempReference_this26, scope, type, typeArgs.clone(), value);
|
this.dispatcher.DispatchMap(tempReference_this26, scope, type, typeArgs.clone(), value);
|
||||||
this = tempReference_this26.get();
|
this = tempReference_this26.get();
|
||||||
break;
|
break;
|
||||||
case TupleScope:
|
case TupleScope:
|
||||||
case ImmutableTupleScope:
|
case ImmutableTupleScope:
|
||||||
case TypedTupleScope:
|
case TypedTupleScope:
|
||||||
case ImmutableTypedTupleScope:
|
case ImmutableTypedTupleScope:
|
||||||
case TaggedScope:
|
case TaggedScope:
|
||||||
case ImmutableTaggedScope:
|
case ImmutableTaggedScope:
|
||||||
case Tagged2Scope:
|
case Tagged2Scope:
|
||||||
case ImmutableTagged2Scope:
|
case ImmutableTagged2Scope:
|
||||||
Reference<RowOperationDispatcher> tempReference_this27 = new Reference<RowOperationDispatcher>(this);
|
Reference<RowOperationDispatcher> tempReference_this27 = new Reference<RowOperationDispatcher>(this);
|
||||||
this.dispatcher.DispatchTuple(tempReference_this27, scope, type, typeArgs.clone(), value);
|
this.dispatcher.DispatchTuple(tempReference_this27, scope, type, typeArgs.clone(), value);
|
||||||
this = tempReference_this27.get();
|
this = tempReference_this27.get();
|
||||||
break;
|
break;
|
||||||
case NullableScope:
|
case NullableScope:
|
||||||
Reference<RowOperationDispatcher> tempReference_this28 = new Reference<RowOperationDispatcher>(this);
|
Reference<RowOperationDispatcher> tempReference_this28 = new Reference<RowOperationDispatcher>(this);
|
||||||
this.dispatcher.DispatchNullable(tempReference_this28, scope, type, typeArgs.clone(), value);
|
this.dispatcher.DispatchNullable(tempReference_this28, scope, type, typeArgs.clone(), value);
|
||||||
this = tempReference_this28.get();
|
this = tempReference_this28.get();
|
||||||
break;
|
break;
|
||||||
case Schema:
|
case Schema:
|
||||||
case ImmutableSchema:
|
case ImmutableSchema:
|
||||||
Reference<RowOperationDispatcher> tempReference_this29 = new Reference<RowOperationDispatcher>(this);
|
Reference<RowOperationDispatcher> tempReference_this29 = new Reference<RowOperationDispatcher>(this);
|
||||||
this.dispatcher.DispatchUDT(tempReference_this29, scope, type, typeArgs.clone(), value);
|
this.dispatcher.DispatchUDT(tempReference_this29, scope, type, typeArgs.clone(), value);
|
||||||
this = tempReference_this29.get();
|
this = tempReference_this29.get();
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
if (logger.)
|
if (logger.)
|
||||||
throw new IllegalStateException(lenientFormat("Unknown type will be ignored: %s", type.LayoutCode));
|
throw new IllegalStateException(lenientFormat("Unknown type will be ignored: %s", type.LayoutCode));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: C# TO JAVA CONVERTER: The C# 'struct' constraint has no equivalent in Java:
|
// TODO: C# TO JAVA CONVERTER: The C# 'struct' constraint has no equivalent in Java:
|
||||||
//ORIGINAL LINE: public static RowOperationDispatcher ReadFrom<TDispatcher>(LayoutResolver resolver, string
|
//ORIGINAL LINE: public static RowOperationDispatcher ReadFrom<TDispatcher>(LayoutResolver resolver, string
|
||||||
// expected) where TDispatcher : struct, IDispatcher
|
// expected) where TDispatcher : struct, IDispatcher
|
||||||
public static <TDispatcher extends IDispatcher> RowOperationDispatcher ReadFrom(LayoutResolver resolver,
|
public static <TDispatcher extends IDispatcher> RowOperationDispatcher ReadFrom(LayoutResolver resolver,
|
||||||
String expected) {
|
String expected) {
|
||||||
return new RowOperationDispatcher(null, resolver, expected);
|
return new RowOperationDispatcher(null, resolver, expected);
|
||||||
}
|
}
|
||||||
|
|
||||||
public String RowToHex() {
|
public String RowToHex() {
|
||||||
try (MemoryStream stm = new MemoryStream()) {
|
try (MemoryStream stm = new MemoryStream()) {
|
||||||
this.Row.writeTo(stm);
|
this.Row.writeTo(stm);
|
||||||
//C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java:
|
//C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java:
|
||||||
//ORIGINAL LINE: ReadOnlyMemory<byte> bytes = stm.GetBuffer().AsMemory(0, (int)stm.Position);
|
//ORIGINAL LINE: ReadOnlyMemory<byte> bytes = stm.GetBuffer().AsMemory(0, (int)stm.Position);
|
||||||
ReadOnlyMemory<Byte> bytes = stm.GetBuffer().AsMemory(0, (int)stm.Position);
|
ReadOnlyMemory<Byte> bytes = stm.GetBuffer().AsMemory(0, (int)stm.Position);
|
||||||
return ByteConverter.ToHex(bytes.Span);
|
return ByteConverter.ToHex(bytes.Span);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public RowOperationDispatcher clone() {
|
public RowOperationDispatcher clone() {
|
||||||
RowOperationDispatcher varCopy = new RowOperationDispatcher();
|
RowOperationDispatcher varCopy = new RowOperationDispatcher();
|
||||||
|
|
||||||
varCopy.Resolver = this.Resolver;
|
varCopy.Resolver = this.Resolver;
|
||||||
varCopy.Row = this.Row.clone();
|
varCopy.Row = this.Row.clone();
|
||||||
varCopy.dispatcher = this.dispatcher;
|
varCopy.dispatcher = this.dispatcher;
|
||||||
|
|
||||||
return varCopy;
|
return varCopy;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+425
-425
@@ -1,426 +1,426 @@
|
|||||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||||
// Licensed under the MIT License.
|
// Licensed under the MIT License.
|
||||||
|
|
||||||
package com.azure.data.cosmos.serialization.hybridrow.unit;
|
package com.azure.data.cosmos.serialization.hybridrow.unit;
|
||||||
|
|
||||||
import com.azure.data.cosmos.core.Out;
|
import com.azure.data.cosmos.core.Out;
|
||||||
import com.azure.data.cosmos.core.Reference;
|
import com.azure.data.cosmos.core.Reference;
|
||||||
import com.azure.data.cosmos.serialization.hybridrow.Float128;
|
import com.azure.data.cosmos.serialization.hybridrow.Float128;
|
||||||
import com.azure.data.cosmos.serialization.hybridrow.HybridRowVersion;
|
import com.azure.data.cosmos.serialization.hybridrow.HybridRowVersion;
|
||||||
import com.azure.data.cosmos.serialization.hybridrow.MemorySpanResizer;
|
import com.azure.data.cosmos.serialization.hybridrow.MemorySpanResizer;
|
||||||
import com.azure.data.cosmos.serialization.hybridrow.NullValue;
|
import com.azure.data.cosmos.serialization.hybridrow.NullValue;
|
||||||
import com.azure.data.cosmos.serialization.hybridrow.Result;
|
import com.azure.data.cosmos.serialization.hybridrow.Result;
|
||||||
import com.azure.data.cosmos.serialization.hybridrow.RowBuffer;
|
import com.azure.data.cosmos.serialization.hybridrow.RowBuffer;
|
||||||
import com.azure.data.cosmos.serialization.hybridrow.RowCursor;
|
import com.azure.data.cosmos.serialization.hybridrow.RowCursor;
|
||||||
import com.azure.data.cosmos.serialization.hybridrow.UnixDateTime;
|
import com.azure.data.cosmos.serialization.hybridrow.UnixDateTime;
|
||||||
import com.azure.data.cosmos.serialization.hybridrow.io.RowReader;
|
import com.azure.data.cosmos.serialization.hybridrow.io.RowReader;
|
||||||
|
|
||||||
import java.nio.file.Files;
|
import java.nio.file.Files;
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
// TODO: C# TO JAVA CONVERTER: Java annotations will not correspond to .NET attributes:
|
// TODO: C# TO JAVA CONVERTER: Java annotations will not correspond to .NET attributes:
|
||||||
//ORIGINAL LINE: [TestClass][SuppressMessage("StyleCop.CSharp.ReadabilityRules",
|
//ORIGINAL LINE: [TestClass][SuppressMessage("StyleCop.CSharp.ReadabilityRules",
|
||||||
// "SA1118:ParameterMustNotSpanMultipleLines", Justification = "Test code.")][DeploymentItem(RowReaderUnitTests
|
// "SA1118:ParameterMustNotSpanMultipleLines", Justification = "Test code.")][DeploymentItem(RowReaderUnitTests
|
||||||
// .SchemaFile, "TestData")] public sealed class RowReaderUnitTests
|
// .SchemaFile, "TestData")] public sealed class RowReaderUnitTests
|
||||||
public final class RowReaderUnitTests {
|
public final class RowReaderUnitTests {
|
||||||
private static final LocalDateTime SampleDateTime = LocalDateTime.parse("2018-08-14 02:05:00.0000000");
|
private static final LocalDateTime SampleDateTime = LocalDateTime.parse("2018-08-14 02:05:00.0000000");
|
||||||
private static final Float128 SampleFloat128 = new Float128(0, 42);
|
private static final Float128 SampleFloat128 = new Float128(0, 42);
|
||||||
private static final UUID SampleGuid = UUID.fromString("{2A9C25B9-922E-4611-BB0A-244A9496503C}");
|
private static final UUID SampleGuid = UUID.fromString("{2A9C25B9-922E-4611-BB0A-244A9496503C}");
|
||||||
private static final MongoDbObjectId SampleMongoDbObjectId = new MongoDbObjectId(0, 42);
|
private static final MongoDbObjectId SampleMongoDbObjectId = new MongoDbObjectId(0, 42);
|
||||||
private static final UnixDateTime SampleUnixDateTime = new UnixDateTime(42);
|
private static final UnixDateTime SampleUnixDateTime = new UnixDateTime(42);
|
||||||
private static final String SchemaFile = "TestData\\ReaderSchema.json";
|
private static final String SchemaFile = "TestData\\ReaderSchema.json";
|
||||||
private LayoutResolver resolver;
|
private LayoutResolver resolver;
|
||||||
private Namespace schema;
|
private Namespace schema;
|
||||||
|
|
||||||
// TODO: C# TO JAVA CONVERTER: Java annotations will not correspond to .NET attributes:
|
// TODO: C# TO JAVA CONVERTER: Java annotations will not correspond to .NET attributes:
|
||||||
//ORIGINAL LINE: [TestInitialize] public void ParseNamespaceExample()
|
//ORIGINAL LINE: [TestInitialize] public void ParseNamespaceExample()
|
||||||
public void ParseNamespaceExample() {
|
public void ParseNamespaceExample() {
|
||||||
String json = Files.readString(RowReaderUnitTests.SchemaFile);
|
String json = Files.readString(RowReaderUnitTests.SchemaFile);
|
||||||
this.schema = Namespace.Parse(json);
|
this.schema = Namespace.Parse(json);
|
||||||
this.resolver = new LayoutResolverNamespace(this.schema);
|
this.resolver = new LayoutResolverNamespace(this.schema);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void PrintReader(Reference<RowReader> reader, int indent) {
|
public static void PrintReader(Reference<RowReader> reader, int indent) {
|
||||||
String str;
|
String str;
|
||||||
Out<String> tempOut_str = new Out<String>();
|
Out<String> tempOut_str = new Out<String>();
|
||||||
ResultAssert.IsSuccess(DiagnosticConverter.ReaderToString(reader, tempOut_str));
|
ResultAssert.IsSuccess(DiagnosticConverter.ReaderToString(reader, tempOut_str));
|
||||||
str = tempOut_str.get();
|
str = tempOut_str.get();
|
||||||
System.out.println(str);
|
System.out.println(str);
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: C# TO JAVA CONVERTER: Java annotations will not correspond to .NET attributes:
|
// TODO: C# TO JAVA CONVERTER: Java annotations will not correspond to .NET attributes:
|
||||||
//ORIGINAL LINE: [TestMethod][Owner("jthunter")] public void ReadMixed()
|
//ORIGINAL LINE: [TestMethod][Owner("jthunter")] public void ReadMixed()
|
||||||
public void ReadMixed() {
|
public void ReadMixed() {
|
||||||
Layout layout = this.resolver.Resolve(tangible.ListHelper.find(this.schema.getSchemas(), x -> x.Name.equals(
|
Layout layout = this.resolver.Resolve(tangible.ListHelper.find(this.schema.getSchemas(), x -> x.Name.equals(
|
||||||
"Mixed")).SchemaId);
|
"Mixed")).SchemaId);
|
||||||
assert layout != null;
|
assert layout != null;
|
||||||
|
|
||||||
RowOperationDispatcher d = RowOperationDispatcher.<WriteRowDispatcher>Create(layout, this.resolver);
|
RowOperationDispatcher d = RowOperationDispatcher.<WriteRowDispatcher>Create(layout, this.resolver);
|
||||||
d.LayoutCodeSwitch("null");
|
d.LayoutCodeSwitch("null");
|
||||||
d.LayoutCodeSwitch("bool", value:true)
|
d.LayoutCodeSwitch("bool", value:true)
|
||||||
d.LayoutCodeSwitch("int8", value:(byte)-86)
|
d.LayoutCodeSwitch("int8", value:(byte)-86)
|
||||||
d.LayoutCodeSwitch("int16", value:(short)-21846)
|
d.LayoutCodeSwitch("int16", value:(short)-21846)
|
||||||
d.LayoutCodeSwitch("int32", value:-1431655766)
|
d.LayoutCodeSwitch("int32", value:-1431655766)
|
||||||
d.LayoutCodeSwitch("int64", value:-6148914691236517206L)
|
d.LayoutCodeSwitch("int64", value:-6148914691236517206L)
|
||||||
//C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java:
|
//C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java:
|
||||||
//ORIGINAL LINE: d.LayoutCodeSwitch("uint8", value: (byte)0xAA);
|
//ORIGINAL LINE: d.LayoutCodeSwitch("uint8", value: (byte)0xAA);
|
||||||
d.LayoutCodeSwitch("uint8", value:(byte)0xAA)
|
d.LayoutCodeSwitch("uint8", value:(byte)0xAA)
|
||||||
//C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java:
|
//C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java:
|
||||||
//ORIGINAL LINE: d.LayoutCodeSwitch("uint16", value: (ushort)0xAAAA);
|
//ORIGINAL LINE: d.LayoutCodeSwitch("uint16", value: (ushort)0xAAAA);
|
||||||
d.LayoutCodeSwitch("uint16", value:(short)0xAAAA)
|
d.LayoutCodeSwitch("uint16", value:(short)0xAAAA)
|
||||||
d.LayoutCodeSwitch("uint32", value:0xAAAAAAAA)
|
d.LayoutCodeSwitch("uint32", value:0xAAAAAAAA)
|
||||||
d.LayoutCodeSwitch("uint64", value:0xAAAAAAAAAAAAAAAAL)
|
d.LayoutCodeSwitch("uint64", value:0xAAAAAAAAAAAAAAAAL)
|
||||||
d.LayoutCodeSwitch("float32", value:1.0F / 3.0F)
|
d.LayoutCodeSwitch("float32", value:1.0F / 3.0F)
|
||||||
d.LayoutCodeSwitch("float64", value:1.0 / 3.0)
|
d.LayoutCodeSwitch("float64", value:1.0 / 3.0)
|
||||||
d.LayoutCodeSwitch("float128", value:RowReaderUnitTests.SampleFloat128)
|
d.LayoutCodeSwitch("float128", value:RowReaderUnitTests.SampleFloat128)
|
||||||
d.LayoutCodeSwitch("decimal", value:java.math.BigDecimal.ONE / 3.0)
|
d.LayoutCodeSwitch("decimal", value:java.math.BigDecimal.ONE / 3.0)
|
||||||
d.LayoutCodeSwitch("datetime", value:RowReaderUnitTests.SampleDateTime)
|
d.LayoutCodeSwitch("datetime", value:RowReaderUnitTests.SampleDateTime)
|
||||||
d.LayoutCodeSwitch("unixdatetime", value:RowReaderUnitTests.SampleUnixDateTime)
|
d.LayoutCodeSwitch("unixdatetime", value:RowReaderUnitTests.SampleUnixDateTime)
|
||||||
d.LayoutCodeSwitch("guid", value:RowReaderUnitTests.SampleGuid)
|
d.LayoutCodeSwitch("guid", value:RowReaderUnitTests.SampleGuid)
|
||||||
d.LayoutCodeSwitch("mongodbobjectid", value:RowReaderUnitTests.SampleMongoDbObjectId)
|
d.LayoutCodeSwitch("mongodbobjectid", value:RowReaderUnitTests.SampleMongoDbObjectId)
|
||||||
d.LayoutCodeSwitch("utf8", value:"abc")
|
d.LayoutCodeSwitch("utf8", value:"abc")
|
||||||
d.LayoutCodeSwitch("utf8_span", value:"abc")
|
d.LayoutCodeSwitch("utf8_span", value:"abc")
|
||||||
//C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java:
|
//C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java:
|
||||||
//ORIGINAL LINE: d.LayoutCodeSwitch("binary", value: new[] { (byte)0, (byte)1, (byte)2 });
|
//ORIGINAL LINE: d.LayoutCodeSwitch("binary", value: new[] { (byte)0, (byte)1, (byte)2 });
|
||||||
d.LayoutCodeSwitch("binary", value:new byte[] { (byte)0, (byte)1, (byte)2 })
|
d.LayoutCodeSwitch("binary", value:new byte[] { (byte)0, (byte)1, (byte)2 })
|
||||||
//C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java:
|
//C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java:
|
||||||
//ORIGINAL LINE: d.LayoutCodeSwitch("binary_span", value: new[] { (byte)0, (byte)1, (byte)2 });
|
//ORIGINAL LINE: d.LayoutCodeSwitch("binary_span", value: new[] { (byte)0, (byte)1, (byte)2 });
|
||||||
d.LayoutCodeSwitch("binary_span", value:new byte[] { (byte)0, (byte)1, (byte)2 })
|
d.LayoutCodeSwitch("binary_span", value:new byte[] { (byte)0, (byte)1, (byte)2 })
|
||||||
d.LayoutCodeSwitch("var_varint", value:-6148914691236517206L)
|
d.LayoutCodeSwitch("var_varint", value:-6148914691236517206L)
|
||||||
d.LayoutCodeSwitch("var_varuint", value:0xAAAAAAAAAAAAAAAAL)
|
d.LayoutCodeSwitch("var_varuint", value:0xAAAAAAAAAAAAAAAAL)
|
||||||
d.LayoutCodeSwitch("var_utf8", value:"abc")
|
d.LayoutCodeSwitch("var_utf8", value:"abc")
|
||||||
d.LayoutCodeSwitch("var_utf8_span", value:"abc")
|
d.LayoutCodeSwitch("var_utf8_span", value:"abc")
|
||||||
//C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java:
|
//C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java:
|
||||||
//ORIGINAL LINE: d.LayoutCodeSwitch("var_binary", value: new[] { (byte)0, (byte)1, (byte)2 });
|
//ORIGINAL LINE: d.LayoutCodeSwitch("var_binary", value: new[] { (byte)0, (byte)1, (byte)2 });
|
||||||
d.LayoutCodeSwitch("var_binary", value:new byte[] { (byte)0, (byte)1, (byte)2 })
|
d.LayoutCodeSwitch("var_binary", value:new byte[] { (byte)0, (byte)1, (byte)2 })
|
||||||
//C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java:
|
//C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java:
|
||||||
//ORIGINAL LINE: d.LayoutCodeSwitch("var_binary_span", value: new[] { (byte)0, (byte)1, (byte)2 });
|
//ORIGINAL LINE: d.LayoutCodeSwitch("var_binary_span", value: new[] { (byte)0, (byte)1, (byte)2 });
|
||||||
d.LayoutCodeSwitch("var_binary_span", value:new byte[] { (byte)0, (byte)1, (byte)2 })
|
d.LayoutCodeSwitch("var_binary_span", value:new byte[] { (byte)0, (byte)1, (byte)2 })
|
||||||
d.LayoutCodeSwitch("sparse_null");
|
d.LayoutCodeSwitch("sparse_null");
|
||||||
d.LayoutCodeSwitch("sparse_bool", value:true)
|
d.LayoutCodeSwitch("sparse_bool", value:true)
|
||||||
d.LayoutCodeSwitch("sparse_int8", value:(byte)-86)
|
d.LayoutCodeSwitch("sparse_int8", value:(byte)-86)
|
||||||
d.LayoutCodeSwitch("sparse_int16", value:(short)-21846)
|
d.LayoutCodeSwitch("sparse_int16", value:(short)-21846)
|
||||||
d.LayoutCodeSwitch("sparse_int32", value:-1431655766)
|
d.LayoutCodeSwitch("sparse_int32", value:-1431655766)
|
||||||
d.LayoutCodeSwitch("sparse_int64", value:-6148914691236517206L)
|
d.LayoutCodeSwitch("sparse_int64", value:-6148914691236517206L)
|
||||||
//C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java:
|
//C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java:
|
||||||
//ORIGINAL LINE: d.LayoutCodeSwitch("sparse_uint8", value: (byte)0xAA);
|
//ORIGINAL LINE: d.LayoutCodeSwitch("sparse_uint8", value: (byte)0xAA);
|
||||||
d.LayoutCodeSwitch("sparse_uint8", value:(byte)0xAA)
|
d.LayoutCodeSwitch("sparse_uint8", value:(byte)0xAA)
|
||||||
//C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java:
|
//C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java:
|
||||||
//ORIGINAL LINE: d.LayoutCodeSwitch("sparse_uint16", value: (ushort)0xAAAA);
|
//ORIGINAL LINE: d.LayoutCodeSwitch("sparse_uint16", value: (ushort)0xAAAA);
|
||||||
d.LayoutCodeSwitch("sparse_uint16", value:(short)0xAAAA)
|
d.LayoutCodeSwitch("sparse_uint16", value:(short)0xAAAA)
|
||||||
d.LayoutCodeSwitch("sparse_uint32", value:0xAAAAAAAA)
|
d.LayoutCodeSwitch("sparse_uint32", value:0xAAAAAAAA)
|
||||||
d.LayoutCodeSwitch("sparse_uint64", value:0xAAAAAAAAAAAAAAAAL)
|
d.LayoutCodeSwitch("sparse_uint64", value:0xAAAAAAAAAAAAAAAAL)
|
||||||
d.LayoutCodeSwitch("sparse_float32", value:1.0F / 3.0F)
|
d.LayoutCodeSwitch("sparse_float32", value:1.0F / 3.0F)
|
||||||
d.LayoutCodeSwitch("sparse_float64", value:1.0 / 3.0)
|
d.LayoutCodeSwitch("sparse_float64", value:1.0 / 3.0)
|
||||||
d.LayoutCodeSwitch("sparse_float128", value:RowReaderUnitTests.SampleFloat128)
|
d.LayoutCodeSwitch("sparse_float128", value:RowReaderUnitTests.SampleFloat128)
|
||||||
d.LayoutCodeSwitch("sparse_decimal", value:java.math.BigDecimal.ONE / 3.0)
|
d.LayoutCodeSwitch("sparse_decimal", value:java.math.BigDecimal.ONE / 3.0)
|
||||||
d.LayoutCodeSwitch("sparse_datetime", value:RowReaderUnitTests.SampleDateTime)
|
d.LayoutCodeSwitch("sparse_datetime", value:RowReaderUnitTests.SampleDateTime)
|
||||||
d.LayoutCodeSwitch("sparse_unixdatetime", value:RowReaderUnitTests.SampleUnixDateTime)
|
d.LayoutCodeSwitch("sparse_unixdatetime", value:RowReaderUnitTests.SampleUnixDateTime)
|
||||||
d.LayoutCodeSwitch("sparse_guid", value:RowReaderUnitTests.SampleGuid)
|
d.LayoutCodeSwitch("sparse_guid", value:RowReaderUnitTests.SampleGuid)
|
||||||
d.LayoutCodeSwitch("sparse_mongodbobjectid", value:RowReaderUnitTests.SampleMongoDbObjectId)
|
d.LayoutCodeSwitch("sparse_mongodbobjectid", value:RowReaderUnitTests.SampleMongoDbObjectId)
|
||||||
d.LayoutCodeSwitch("sparse_utf8", value:"abc")
|
d.LayoutCodeSwitch("sparse_utf8", value:"abc")
|
||||||
d.LayoutCodeSwitch("sparse_utf8_span", value:"abc")
|
d.LayoutCodeSwitch("sparse_utf8_span", value:"abc")
|
||||||
//C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java:
|
//C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java:
|
||||||
//ORIGINAL LINE: d.LayoutCodeSwitch("sparse_binary", value: new[] { (byte)0, (byte)1, (byte)2 });
|
//ORIGINAL LINE: d.LayoutCodeSwitch("sparse_binary", value: new[] { (byte)0, (byte)1, (byte)2 });
|
||||||
d.LayoutCodeSwitch("sparse_binary", value:new byte[] { (byte)0, (byte)1, (byte)2 })
|
d.LayoutCodeSwitch("sparse_binary", value:new byte[] { (byte)0, (byte)1, (byte)2 })
|
||||||
//C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java:
|
//C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java:
|
||||||
//ORIGINAL LINE: d.LayoutCodeSwitch("sparse_binary_span", value: new[] { (byte)0, (byte)1, (byte)2 });
|
//ORIGINAL LINE: d.LayoutCodeSwitch("sparse_binary_span", value: new[] { (byte)0, (byte)1, (byte)2 });
|
||||||
d.LayoutCodeSwitch("sparse_binary_span", value:new byte[] { (byte)0, (byte)1, (byte)2 })
|
d.LayoutCodeSwitch("sparse_binary_span", value:new byte[] { (byte)0, (byte)1, (byte)2 })
|
||||||
d.LayoutCodeSwitch("array_t<int8>", value:new byte[] { -86, -86, -86 })
|
d.LayoutCodeSwitch("array_t<int8>", value:new byte[] { -86, -86, -86 })
|
||||||
d.LayoutCodeSwitch("array_t<array_t<float32>>", value:new float[][]
|
d.LayoutCodeSwitch("array_t<array_t<float32>>", value:new float[][]
|
||||||
{
|
{
|
||||||
new float[] { 1, 2, 3 },
|
new float[] { 1, 2, 3 },
|
||||||
new float[] { 1, 2, 3 }
|
new float[] { 1, 2, 3 }
|
||||||
})
|
})
|
||||||
d.LayoutCodeSwitch("array_t<utf8>", value:new String[] { "abc", "def", "hij" })
|
d.LayoutCodeSwitch("array_t<utf8>", value:new String[] { "abc", "def", "hij" })
|
||||||
d.LayoutCodeSwitch("tuple<varint,int64>", value:Tuple.Create(-6148914691236517206L, -6148914691236517206L))
|
d.LayoutCodeSwitch("tuple<varint,int64>", value:Tuple.Create(-6148914691236517206L, -6148914691236517206L))
|
||||||
d.LayoutCodeSwitch("tuple<null,tuple<int8,int8>>", value:
|
d.LayoutCodeSwitch("tuple<null,tuple<int8,int8>>", value:
|
||||||
Tuple.Create(NullValue.DEFAULT, Tuple.Create((byte)-86, (byte)-86)))
|
Tuple.Create(NullValue.DEFAULT, Tuple.Create((byte)-86, (byte)-86)))
|
||||||
d.LayoutCodeSwitch("tuple<bool,udt>", value:Tuple.Create(false, new Point(1, 2)))
|
d.LayoutCodeSwitch("tuple<bool,udt>", value:Tuple.Create(false, new Point(1, 2)))
|
||||||
d.LayoutCodeSwitch("nullable<int32,int64>", value:Tuple.Create(null, (Long)123L))
|
d.LayoutCodeSwitch("nullable<int32,int64>", value:Tuple.Create(null, (Long)123L))
|
||||||
//C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java:
|
//C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java:
|
||||||
//ORIGINAL LINE: d.LayoutCodeSwitch("tagged<utf8>", value: Tuple.Create((byte)3, "hello"));
|
//ORIGINAL LINE: d.LayoutCodeSwitch("tagged<utf8>", value: Tuple.Create((byte)3, "hello"));
|
||||||
d.LayoutCodeSwitch("tagged<utf8>", value:Tuple.Create((byte)3, "hello"))
|
d.LayoutCodeSwitch("tagged<utf8>", value:Tuple.Create((byte)3, "hello"))
|
||||||
//C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java:
|
//C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java:
|
||||||
//ORIGINAL LINE: d.LayoutCodeSwitch("tagged<bool,utf8>", value: Tuple.Create((byte)5, true, "bye"));
|
//ORIGINAL LINE: d.LayoutCodeSwitch("tagged<bool,utf8>", value: Tuple.Create((byte)5, true, "bye"));
|
||||||
d.LayoutCodeSwitch("tagged<bool,utf8>", value:Tuple.Create((byte)5, true, "bye"))
|
d.LayoutCodeSwitch("tagged<bool,utf8>", value:Tuple.Create((byte)5, true, "bye"))
|
||||||
d.LayoutCodeSwitch("set_t<utf8>", value:new String[] { "abc", "efg", "xzy" })
|
d.LayoutCodeSwitch("set_t<utf8>", value:new String[] { "abc", "efg", "xzy" })
|
||||||
d.LayoutCodeSwitch("set_t<array_t<int8>>", value:new byte[][]
|
d.LayoutCodeSwitch("set_t<array_t<int8>>", value:new byte[][]
|
||||||
{
|
{
|
||||||
new byte[] { 1, 2, 3 },
|
new byte[] { 1, 2, 3 },
|
||||||
new byte[] { 4, 5, 6 },
|
new byte[] { 4, 5, 6 },
|
||||||
new byte[] { 7, 8, 9 }
|
new byte[] { 7, 8, 9 }
|
||||||
})
|
})
|
||||||
d.LayoutCodeSwitch("set_t<set_t<int32>>", value:new int[][]
|
d.LayoutCodeSwitch("set_t<set_t<int32>>", value:new int[][]
|
||||||
{
|
{
|
||||||
new int[] { 1, 2, 3 },
|
new int[] { 1, 2, 3 },
|
||||||
new int[] { 4, 5, 6 },
|
new int[] { 4, 5, 6 },
|
||||||
new int[] { 7, 8, 9 }
|
new int[] { 7, 8, 9 }
|
||||||
})
|
})
|
||||||
d.LayoutCodeSwitch("set_t<udt>", value:new Point[]
|
d.LayoutCodeSwitch("set_t<udt>", value:new Point[]
|
||||||
{
|
{
|
||||||
new Point(1, 2),
|
new Point(1, 2),
|
||||||
new Point(3, 4),
|
new Point(3, 4),
|
||||||
new Point(5, 6)
|
new Point(5, 6)
|
||||||
})
|
})
|
||||||
d.LayoutCodeSwitch("map_t<utf8,utf8>", value:
|
d.LayoutCodeSwitch("map_t<utf8,utf8>", value:
|
||||||
new System.Tuple<T1, T2>[] { Tuple.Create("Mark", "Luke"), Tuple.Create("Harrison", "Han") })
|
new System.Tuple<T1, T2>[] { Tuple.Create("Mark", "Luke"), Tuple.Create("Harrison", "Han") })
|
||||||
d.LayoutCodeSwitch("map_t<int8,array_t<int8>>", value:
|
d.LayoutCodeSwitch("map_t<int8,array_t<int8>>", value:
|
||||||
new System.Tuple<T1, T2>[] { Tuple.Create((byte)1, new byte[] { 1, 2, 3 }), Tuple.Create((byte)2,
|
new System.Tuple<T1, T2>[] { Tuple.Create((byte)1, new byte[] { 1, 2, 3 }), Tuple.Create((byte)2,
|
||||||
new byte[] { 4, 5, 6 }) })
|
new byte[] { 4, 5, 6 }) })
|
||||||
|
|
||||||
d.LayoutCodeSwitch("map_t<int16,map_t<int32,int32>>", value:
|
d.LayoutCodeSwitch("map_t<int16,map_t<int32,int32>>", value:
|
||||||
new System.Tuple<T1, T2>[] { Tuple.Create((short)1, new System.Tuple<T1, T2>[] { Tuple.Create(1, 2),
|
new System.Tuple<T1, T2>[] { Tuple.Create((short)1, new System.Tuple<T1, T2>[] { Tuple.Create(1, 2),
|
||||||
Tuple.Create(3, 4) }), Tuple.Create((short)2, new System.Tuple<T1, T2>[] { Tuple.Create(5, 6),
|
Tuple.Create(3, 4) }), Tuple.Create((short)2, new System.Tuple<T1, T2>[] { Tuple.Create(5, 6),
|
||||||
Tuple.Create(7, 8) }) })
|
Tuple.Create(7, 8) }) })
|
||||||
|
|
||||||
d.LayoutCodeSwitch("map_t<float64,udt>", value:
|
d.LayoutCodeSwitch("map_t<float64,udt>", value:
|
||||||
new System.Tuple<T1, T2>[] { Tuple.Create(1.0, new Point(1, 2)), Tuple.Create(2.0, new Point(3, 4)),
|
new System.Tuple<T1, T2>[] { Tuple.Create(1.0, new Point(1, 2)), Tuple.Create(2.0, new Point(3, 4)),
|
||||||
Tuple.Create(3.0, new Point(5, 6)) })
|
Tuple.Create(3.0, new Point(5, 6)) })
|
||||||
|
|
||||||
RowReader reader = d.GetReader().clone();
|
RowReader reader = d.GetReader().clone();
|
||||||
assert reader.length() == d.Row.length();
|
assert reader.length() == d.Row.length();
|
||||||
Reference<RowReader> tempReference_reader =
|
Reference<RowReader> tempReference_reader =
|
||||||
new Reference<RowReader>(reader);
|
new Reference<RowReader>(reader);
|
||||||
RowReaderUnitTests.PrintReader(tempReference_reader, 0);
|
RowReaderUnitTests.PrintReader(tempReference_reader, 0);
|
||||||
reader = tempReference_reader.get();
|
reader = tempReference_reader.get();
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: C# TO JAVA CONVERTER: Java annotations will not correspond to .NET attributes:
|
// TODO: C# TO JAVA CONVERTER: Java annotations will not correspond to .NET attributes:
|
||||||
//ORIGINAL LINE: [TestMethod][Owner("jthunter")] public void ReadScopes()
|
//ORIGINAL LINE: [TestMethod][Owner("jthunter")] public void ReadScopes()
|
||||||
public void ReadScopes() {
|
public void ReadScopes() {
|
||||||
//C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java:
|
//C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java:
|
||||||
//ORIGINAL LINE: MemorySpanResizer<byte> resizer = new MemorySpanResizer<byte>(0);
|
//ORIGINAL LINE: MemorySpanResizer<byte> resizer = new MemorySpanResizer<byte>(0);
|
||||||
MemorySpanResizer<Byte> resizer = new MemorySpanResizer<Byte>(0);
|
MemorySpanResizer<Byte> resizer = new MemorySpanResizer<Byte>(0);
|
||||||
RowBuffer row = new RowBuffer(0, resizer);
|
RowBuffer row = new RowBuffer(0, resizer);
|
||||||
Layout layout = this.resolver.Resolve(tangible.ListHelper.find(this.schema.getSchemas(), x -> x.Name.equals(
|
Layout layout = this.resolver.Resolve(tangible.ListHelper.find(this.schema.getSchemas(), x -> x.Name.equals(
|
||||||
"Mixed")).SchemaId);
|
"Mixed")).SchemaId);
|
||||||
row.initLayout(HybridRowVersion.V1, layout, this.resolver);
|
row.initLayout(HybridRowVersion.V1, layout, this.resolver);
|
||||||
|
|
||||||
Reference<RowBuffer> tempReference_row =
|
Reference<RowBuffer> tempReference_row =
|
||||||
new Reference<RowBuffer>(row);
|
new Reference<RowBuffer>(row);
|
||||||
ResultAssert.IsSuccess(RowWriter.WriteBuffer(tempReference_row, 2, RowReaderUnitTests.WriteNestedDocument));
|
ResultAssert.IsSuccess(RowWriter.WriteBuffer(tempReference_row, 2, RowReaderUnitTests.WriteNestedDocument));
|
||||||
row = tempReference_row.get();
|
row = tempReference_row.get();
|
||||||
Reference<RowBuffer> tempReference_row2 =
|
Reference<RowBuffer> tempReference_row2 =
|
||||||
new Reference<RowBuffer>(row);
|
new Reference<RowBuffer>(row);
|
||||||
RowReader rowReader = new RowReader(tempReference_row2);
|
RowReader rowReader = new RowReader(tempReference_row2);
|
||||||
row = tempReference_row2.get();
|
row = tempReference_row2.get();
|
||||||
|
|
||||||
Reference<RowReader> tempReference_rowReader =
|
Reference<RowReader> tempReference_rowReader =
|
||||||
new Reference<RowReader>(rowReader);
|
new Reference<RowReader>(rowReader);
|
||||||
ResultAssert.IsSuccess(RowReaderUnitTests.ReadNestedDocumentDelegate(tempReference_rowReader, 0));
|
ResultAssert.IsSuccess(RowReaderUnitTests.ReadNestedDocumentDelegate(tempReference_rowReader, 0));
|
||||||
rowReader = tempReference_rowReader.get();
|
rowReader = tempReference_rowReader.get();
|
||||||
|
|
||||||
Reference<RowBuffer> tempReference_row3 =
|
Reference<RowBuffer> tempReference_row3 =
|
||||||
new Reference<RowBuffer>(row);
|
new Reference<RowBuffer>(row);
|
||||||
rowReader = new RowReader(tempReference_row3);
|
rowReader = new RowReader(tempReference_row3);
|
||||||
row = tempReference_row3.get();
|
row = tempReference_row3.get();
|
||||||
Reference<RowReader> tempReference_rowReader2 =
|
Reference<RowReader> tempReference_rowReader2 =
|
||||||
new Reference<RowReader>(rowReader);
|
new Reference<RowReader>(rowReader);
|
||||||
ResultAssert.IsSuccess(RowReaderUnitTests.ReadNestedDocumentNonDelegate(tempReference_rowReader2, 0));
|
ResultAssert.IsSuccess(RowReaderUnitTests.ReadNestedDocumentNonDelegate(tempReference_rowReader2, 0));
|
||||||
rowReader = tempReference_rowReader2.get();
|
rowReader = tempReference_rowReader2.get();
|
||||||
|
|
||||||
Reference<RowBuffer> tempReference_row4 =
|
Reference<RowBuffer> tempReference_row4 =
|
||||||
new Reference<RowBuffer>(row);
|
new Reference<RowBuffer>(row);
|
||||||
rowReader = new RowReader(tempReference_row4);
|
rowReader = new RowReader(tempReference_row4);
|
||||||
row = tempReference_row4.get();
|
row = tempReference_row4.get();
|
||||||
Reference<RowReader> tempReference_rowReader3 =
|
Reference<RowReader> tempReference_rowReader3 =
|
||||||
new Reference<RowReader>(rowReader);
|
new Reference<RowReader>(rowReader);
|
||||||
ResultAssert.IsSuccess(RowReaderUnitTests.ReadNestedDocumentNonDelegateWithSkipScope(tempReference_rowReader3, 0));
|
ResultAssert.IsSuccess(RowReaderUnitTests.ReadNestedDocumentNonDelegateWithSkipScope(tempReference_rowReader3, 0));
|
||||||
rowReader = tempReference_rowReader3.get();
|
rowReader = tempReference_rowReader3.get();
|
||||||
|
|
||||||
// SkipScope not okay after advancing parent
|
// SkipScope not okay after advancing parent
|
||||||
Reference<RowBuffer> tempReference_row5 =
|
Reference<RowBuffer> tempReference_row5 =
|
||||||
new Reference<RowBuffer>(row);
|
new Reference<RowBuffer>(row);
|
||||||
rowReader = new RowReader(tempReference_row5);
|
rowReader = new RowReader(tempReference_row5);
|
||||||
row = tempReference_row5.get();
|
row = tempReference_row5.get();
|
||||||
assert rowReader.read();
|
assert rowReader.read();
|
||||||
assert rowReader.type().LayoutCode == LayoutCode.ObjectScope;
|
assert rowReader.type().LayoutCode == LayoutCode.ObjectScope;
|
||||||
RowReader nestedScope = rowReader.readScope().clone();
|
RowReader nestedScope = rowReader.readScope().clone();
|
||||||
Reference<RowReader> tempReference_nestedScope =
|
Reference<RowReader> tempReference_nestedScope =
|
||||||
new Reference<RowReader>(nestedScope);
|
new Reference<RowReader>(nestedScope);
|
||||||
ResultAssert.IsSuccess(RowReaderUnitTests.ReadNestedDocumentDelegate(tempReference_nestedScope, 0));
|
ResultAssert.IsSuccess(RowReaderUnitTests.ReadNestedDocumentDelegate(tempReference_nestedScope, 0));
|
||||||
nestedScope = tempReference_nestedScope.get();
|
nestedScope = tempReference_nestedScope.get();
|
||||||
assert rowReader.read();
|
assert rowReader.read();
|
||||||
Reference<RowReader> tempReference_nestedScope2 =
|
Reference<RowReader> tempReference_nestedScope2 =
|
||||||
new Reference<RowReader>(nestedScope);
|
new Reference<RowReader>(nestedScope);
|
||||||
Result result = rowReader.skipScope(tempReference_nestedScope2);
|
Result result = rowReader.skipScope(tempReference_nestedScope2);
|
||||||
nestedScope = tempReference_nestedScope2.get();
|
nestedScope = tempReference_nestedScope2.get();
|
||||||
assert Result.SUCCESS != result;
|
assert Result.SUCCESS != result;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static Result ReadNestedDocumentDelegate(Reference<RowReader> reader, int context) {
|
private static Result ReadNestedDocumentDelegate(Reference<RowReader> reader, int context) {
|
||||||
while (reader.get().read()) {
|
while (reader.get().read()) {
|
||||||
switch (reader.get().type().LayoutCode) {
|
switch (reader.get().type().LayoutCode) {
|
||||||
case TupleScope: {
|
case TupleScope: {
|
||||||
ResultAssert.IsSuccess(reader.get().readScope(0, RowReaderUnitTests.ReadTuplePartial));
|
ResultAssert.IsSuccess(reader.get().readScope(0, RowReaderUnitTests.ReadTuplePartial));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case ObjectScope: {
|
case ObjectScope: {
|
||||||
ResultAssert.IsSuccess(reader.get().readScope(0, RowReaderUnitTests.ReadNestedDocumentDelegate));
|
ResultAssert.IsSuccess(reader.get().readScope(0, RowReaderUnitTests.ReadNestedDocumentDelegate));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return Result.SUCCESS;
|
return Result.SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static Result ReadNestedDocumentNonDelegate(Reference<RowReader> reader, int context) {
|
private static Result ReadNestedDocumentNonDelegate(Reference<RowReader> reader, int context) {
|
||||||
while (reader.get().read()) {
|
while (reader.get().read()) {
|
||||||
switch (reader.get().type().LayoutCode) {
|
switch (reader.get().type().LayoutCode) {
|
||||||
case TupleScope: {
|
case TupleScope: {
|
||||||
RowReader nested = reader.get().readScope().clone();
|
RowReader nested = reader.get().readScope().clone();
|
||||||
Reference<RowReader> tempReference_nested =
|
Reference<RowReader> tempReference_nested =
|
||||||
new Reference<RowReader>(nested);
|
new Reference<RowReader>(nested);
|
||||||
ResultAssert.IsSuccess(RowReaderUnitTests.ReadTuplePartial(tempReference_nested, 0));
|
ResultAssert.IsSuccess(RowReaderUnitTests.ReadTuplePartial(tempReference_nested, 0));
|
||||||
nested = tempReference_nested.get();
|
nested = tempReference_nested.get();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case ObjectScope: {
|
case ObjectScope: {
|
||||||
RowReader nested = reader.get().readScope().clone();
|
RowReader nested = reader.get().readScope().clone();
|
||||||
Reference<RowReader> tempReference_nested2 =
|
Reference<RowReader> tempReference_nested2 =
|
||||||
new Reference<RowReader>(nested);
|
new Reference<RowReader>(nested);
|
||||||
ResultAssert.IsSuccess(RowReaderUnitTests.ReadNestedDocumentNonDelegate(tempReference_nested2, 0));
|
ResultAssert.IsSuccess(RowReaderUnitTests.ReadNestedDocumentNonDelegate(tempReference_nested2, 0));
|
||||||
nested = tempReference_nested2.get();
|
nested = tempReference_nested2.get();
|
||||||
ResultAssert.IsSuccess(reader.get().readScope(0, RowReaderUnitTests.ReadNestedDocumentDelegate));
|
ResultAssert.IsSuccess(reader.get().readScope(0, RowReaderUnitTests.ReadNestedDocumentDelegate));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return Result.SUCCESS;
|
return Result.SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static Result ReadNestedDocumentNonDelegateWithSkipScope(Reference<RowReader> reader,
|
private static Result ReadNestedDocumentNonDelegateWithSkipScope(Reference<RowReader> reader,
|
||||||
int context) {
|
int context) {
|
||||||
while (reader.get().read()) {
|
while (reader.get().read()) {
|
||||||
switch (reader.get().type().LayoutCode) {
|
switch (reader.get().type().LayoutCode) {
|
||||||
case TupleScope: {
|
case TupleScope: {
|
||||||
RowReader nested = reader.get().readScope().clone();
|
RowReader nested = reader.get().readScope().clone();
|
||||||
Reference<RowReader> tempReference_nested =
|
Reference<RowReader> tempReference_nested =
|
||||||
new Reference<RowReader>(nested);
|
new Reference<RowReader>(nested);
|
||||||
ResultAssert.IsSuccess(RowReaderUnitTests.ReadTuplePartial(tempReference_nested, 0));
|
ResultAssert.IsSuccess(RowReaderUnitTests.ReadTuplePartial(tempReference_nested, 0));
|
||||||
nested = tempReference_nested.get();
|
nested = tempReference_nested.get();
|
||||||
Reference<RowReader> tempReference_nested2 =
|
Reference<RowReader> tempReference_nested2 =
|
||||||
new Reference<RowReader>(nested);
|
new Reference<RowReader>(nested);
|
||||||
ResultAssert.IsSuccess(reader.get().skipScope(tempReference_nested2));
|
ResultAssert.IsSuccess(reader.get().skipScope(tempReference_nested2));
|
||||||
nested = tempReference_nested2.get();
|
nested = tempReference_nested2.get();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case ObjectScope: {
|
case ObjectScope: {
|
||||||
RowReader nested = reader.get().readScope().clone();
|
RowReader nested = reader.get().readScope().clone();
|
||||||
Reference<RowReader> tempReference_nested3 =
|
Reference<RowReader> tempReference_nested3 =
|
||||||
new Reference<RowReader>(nested);
|
new Reference<RowReader>(nested);
|
||||||
ResultAssert.IsSuccess(RowReaderUnitTests.ReadNestedDocumentNonDelegate(tempReference_nested3, 0));
|
ResultAssert.IsSuccess(RowReaderUnitTests.ReadNestedDocumentNonDelegate(tempReference_nested3, 0));
|
||||||
nested = tempReference_nested3.get();
|
nested = tempReference_nested3.get();
|
||||||
ResultAssert.IsSuccess(reader.get().readScope(0, RowReaderUnitTests.ReadNestedDocumentDelegate));
|
ResultAssert.IsSuccess(reader.get().readScope(0, RowReaderUnitTests.ReadNestedDocumentDelegate));
|
||||||
Reference<RowReader> tempReference_nested4 = new Reference<RowReader>(nested);
|
Reference<RowReader> tempReference_nested4 = new Reference<RowReader>(nested);
|
||||||
ResultAssert.IsSuccess(reader.get().skipScope(tempReference_nested4));
|
ResultAssert.IsSuccess(reader.get().skipScope(tempReference_nested4));
|
||||||
nested = tempReference_nested4.get();
|
nested = tempReference_nested4.get();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return Result.SUCCESS;
|
return Result.SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static Result ReadTuplePartial(Reference<RowReader> reader, int unused) {
|
private static Result ReadTuplePartial(Reference<RowReader> reader, int unused) {
|
||||||
// Read only part of our tuple
|
// Read only part of our tuple
|
||||||
assert reader.get().read();
|
assert reader.get().read();
|
||||||
assert reader.get().read();
|
assert reader.get().read();
|
||||||
return Result.SUCCESS;
|
return Result.SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static Result WriteNestedDocument(Reference<RowWriter> writer, TypeArgument typeArgument,
|
private static Result WriteNestedDocument(Reference<RowWriter> writer, TypeArgument typeArgument,
|
||||||
int level) {
|
int level) {
|
||||||
TypeArgument tupleArgument = new TypeArgument(LayoutType.Tuple, new TypeArgumentList(new TypeArgument[]
|
TypeArgument tupleArgument = new TypeArgument(LayoutType.Tuple, new TypeArgumentList(new TypeArgument[]
|
||||||
{
|
{
|
||||||
new TypeArgument(LayoutType.Int32),
|
new TypeArgument(LayoutType.Int32),
|
||||||
new TypeArgument(LayoutType.Int32),
|
new TypeArgument(LayoutType.Int32),
|
||||||
new TypeArgument(LayoutType.Int32)
|
new TypeArgument(LayoutType.Int32)
|
||||||
}));
|
}));
|
||||||
|
|
||||||
// TODO: C# TO JAVA CONVERTER: Local functions are not converted by C# to Java Converter:
|
// TODO: C# TO JAVA CONVERTER: Local functions are not converted by C# to Java Converter:
|
||||||
// Result WriteTuple(ref RowWriter tupleWriter, TypeArgument tupleTypeArgument, int unused)
|
// Result WriteTuple(ref RowWriter tupleWriter, TypeArgument tupleTypeArgument, int unused)
|
||||||
// {
|
// {
|
||||||
// ResultAssert.IsSuccess(tupleWriter.WriteInt32(null, 1));
|
// ResultAssert.IsSuccess(tupleWriter.WriteInt32(null, 1));
|
||||||
// ResultAssert.IsSuccess(tupleWriter.WriteInt32(null, 2));
|
// ResultAssert.IsSuccess(tupleWriter.WriteInt32(null, 2));
|
||||||
// ResultAssert.IsSuccess(tupleWriter.WriteInt32(null, 3));
|
// ResultAssert.IsSuccess(tupleWriter.WriteInt32(null, 3));
|
||||||
// return Result.Success;
|
// return Result.Success;
|
||||||
// }
|
// }
|
||||||
|
|
||||||
if (level == 0) {
|
if (level == 0) {
|
||||||
ResultAssert.IsSuccess(writer.get().WriteScope("x", tupleArgument.clone(), 0, WriteTuple));
|
ResultAssert.IsSuccess(writer.get().WriteScope("x", tupleArgument.clone(), 0, WriteTuple));
|
||||||
return Result.SUCCESS;
|
return Result.SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
ResultAssert.IsSuccess(writer.get().WriteScope("a", new TypeArgument(LayoutType.Object), level - 1,
|
ResultAssert.IsSuccess(writer.get().WriteScope("a", new TypeArgument(LayoutType.Object), level - 1,
|
||||||
RowReaderUnitTests.WriteNestedDocument));
|
RowReaderUnitTests.WriteNestedDocument));
|
||||||
ResultAssert.IsSuccess(writer.get().WriteScope("x", tupleArgument.clone(), 0, WriteTuple));
|
ResultAssert.IsSuccess(writer.get().WriteScope("x", tupleArgument.clone(), 0, WriteTuple));
|
||||||
ResultAssert.IsSuccess(writer.get().WriteScope("b", new TypeArgument(LayoutType.Object), level - 1,
|
ResultAssert.IsSuccess(writer.get().WriteScope("b", new TypeArgument(LayoutType.Object), level - 1,
|
||||||
RowReaderUnitTests.WriteNestedDocument));
|
RowReaderUnitTests.WriteNestedDocument));
|
||||||
ResultAssert.IsSuccess(writer.get().WriteScope("y", tupleArgument.clone(), 0, WriteTuple));
|
ResultAssert.IsSuccess(writer.get().WriteScope("y", tupleArgument.clone(), 0, WriteTuple));
|
||||||
ResultAssert.IsSuccess(writer.get().WriteScope("c", new TypeArgument(LayoutType.Object), level - 1,
|
ResultAssert.IsSuccess(writer.get().WriteScope("c", new TypeArgument(LayoutType.Object), level - 1,
|
||||||
RowReaderUnitTests.WriteNestedDocument));
|
RowReaderUnitTests.WriteNestedDocument));
|
||||||
|
|
||||||
return Result.SUCCESS;
|
return Result.SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: C# TO JAVA CONVERTER: Java annotations will not correspond to .NET attributes:
|
// TODO: C# TO JAVA CONVERTER: Java annotations will not correspond to .NET attributes:
|
||||||
//ORIGINAL LINE: [SuppressMessage("Microsoft.StyleCop.CSharp.OrderingRules", "SA1401", Justification = "Test types.")] internal sealed class Point : IDispatchable, IRowSerializable
|
//ORIGINAL LINE: [SuppressMessage("Microsoft.StyleCop.CSharp.OrderingRules", "SA1401", Justification = "Test types.")] internal sealed class Point : IDispatchable, IRowSerializable
|
||||||
public final static class Point implements IDispatchable, IRowSerializable {
|
public final static class Point implements IDispatchable, IRowSerializable {
|
||||||
public int X;
|
public int X;
|
||||||
public int Y;
|
public int Y;
|
||||||
|
|
||||||
public Point(int x, int y) {
|
public Point(int x, int y) {
|
||||||
this.X = x;
|
this.X = x;
|
||||||
this.Y = y;
|
this.Y = y;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Dispatch(Reference<RowOperationDispatcher> dispatcher, Reference<RowCursor> scope) {
|
public void Dispatch(Reference<RowOperationDispatcher> dispatcher, Reference<RowCursor> scope) {
|
||||||
dispatcher.get().LayoutCodeSwitch(scope, "x", value:this.X)
|
dispatcher.get().LayoutCodeSwitch(scope, "x", value:this.X)
|
||||||
dispatcher.get().LayoutCodeSwitch(scope, "y", value:this.Y)
|
dispatcher.get().LayoutCodeSwitch(scope, "y", value:this.Y)
|
||||||
}
|
}
|
||||||
|
|
||||||
public Result Write(Reference<RowWriter> writer, TypeArgument typeArg) {
|
public Result Write(Reference<RowWriter> writer, TypeArgument typeArg) {
|
||||||
Result result = writer.get().WriteInt32("x", this.X);
|
Result result = writer.get().WriteInt32("x", this.X);
|
||||||
if (result != Result.SUCCESS) {
|
if (result != Result.SUCCESS) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
return writer.get().WriteInt32("y", this.Y);
|
return writer.get().WriteInt32("y", this.Y);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean equals(Object obj) {
|
public boolean equals(Object obj) {
|
||||||
if (null == obj) {
|
if (null == obj) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this == obj) {
|
if (this == obj) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
return obj instanceof Point && this.equals((Point)obj);
|
return obj instanceof Point && this.equals((Point)obj);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int hashCode() {
|
public int hashCode() {
|
||||||
// TODO: C# TO JAVA CONVERTER: There is no equivalent to an 'unchecked' block in Java:
|
// TODO: C# TO JAVA CONVERTER: There is no equivalent to an 'unchecked' block in Java:
|
||||||
unchecked
|
unchecked
|
||||||
{
|
{
|
||||||
return ((new Integer(this.X)).hashCode() * 397) ^ (new Integer(this.Y)).hashCode();
|
return ((new Integer(this.X)).hashCode() * 397) ^ (new Integer(this.Y)).hashCode();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean equals(Point other) {
|
private boolean equals(Point other) {
|
||||||
return this.X == other.X && this.Y == other.Y;
|
return this.X == other.X && this.Y == other.Y;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+508
-508
File diff suppressed because it is too large
Load Diff
+271
-271
@@ -1,272 +1,272 @@
|
|||||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||||
// Licensed under the MIT License.
|
// Licensed under the MIT License.
|
||||||
|
|
||||||
package com.azure.data.cosmos.serialization.hybridrow.unit;
|
package com.azure.data.cosmos.serialization.hybridrow.unit;
|
||||||
|
|
||||||
import Newtonsoft.Json.*;
|
import Newtonsoft.Json.*;
|
||||||
import com.azure.data.cosmos.serialization.hybridrow.SchemaId;
|
import com.azure.data.cosmos.serialization.hybridrow.SchemaId;
|
||||||
import com.azure.data.cosmos.serialization.hybridrow.schemas.PropertyType;
|
import com.azure.data.cosmos.serialization.hybridrow.schemas.PropertyType;
|
||||||
|
|
||||||
import java.nio.file.Files;
|
import java.nio.file.Files;
|
||||||
|
|
||||||
// TODO: C# TO JAVA CONVERTER: Java annotations will not correspond to .NET attributes:
|
// TODO: C# TO JAVA CONVERTER: Java annotations will not correspond to .NET attributes:
|
||||||
//ORIGINAL LINE: [TestClass][DeploymentItem(SchemaHashUnitTests.SchemaFile, "TestData")] public class
|
//ORIGINAL LINE: [TestClass][DeploymentItem(SchemaHashUnitTests.SchemaFile, "TestData")] public class
|
||||||
// SchemaHashUnitTests
|
// SchemaHashUnitTests
|
||||||
public class SchemaHashUnitTests {
|
public class SchemaHashUnitTests {
|
||||||
private static final String SchemaFile = "TestData\\SchemaHashCoverageSchema.json";
|
private static final String SchemaFile = "TestData\\SchemaHashCoverageSchema.json";
|
||||||
private Namespace ns;
|
private Namespace ns;
|
||||||
private Schema tableSchema;
|
private Schema tableSchema;
|
||||||
|
|
||||||
// TODO: C# TO JAVA CONVERTER: Java annotations will not correspond to .NET attributes:
|
// TODO: C# TO JAVA CONVERTER: Java annotations will not correspond to .NET attributes:
|
||||||
//ORIGINAL LINE: [TestInitialize] public void InitializeSuite()
|
//ORIGINAL LINE: [TestInitialize] public void InitializeSuite()
|
||||||
public final void InitializeSuite() {
|
public final void InitializeSuite() {
|
||||||
String json = Files.readString(SchemaHashUnitTests.SchemaFile);
|
String json = Files.readString(SchemaHashUnitTests.SchemaFile);
|
||||||
this.ns = Namespace.Parse(json);
|
this.ns = Namespace.Parse(json);
|
||||||
this.tableSchema = tangible.ListHelper.find(this.ns.getSchemas(), s -> s.Name.equals("Table"));
|
this.tableSchema = tangible.ListHelper.find(this.ns.getSchemas(), s -> s.Name.equals("Table"));
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: C# TO JAVA CONVERTER: Java annotations will not correspond to .NET attributes:
|
// TODO: C# TO JAVA CONVERTER: Java annotations will not correspond to .NET attributes:
|
||||||
//ORIGINAL LINE: [TestMethod][Owner("jthunter")] public void SchemaHashCompileTest()
|
//ORIGINAL LINE: [TestMethod][Owner("jthunter")] public void SchemaHashCompileTest()
|
||||||
public final void SchemaHashCompileTest() {
|
public final void SchemaHashCompileTest() {
|
||||||
Layout layout = this.tableSchema.Compile(this.ns);
|
Layout layout = this.tableSchema.Compile(this.ns);
|
||||||
assert layout != null;
|
assert layout != null;
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: C# TO JAVA CONVERTER: Java annotations will not correspond to .NET attributes:
|
// TODO: C# TO JAVA CONVERTER: Java annotations will not correspond to .NET attributes:
|
||||||
//ORIGINAL LINE: [TestMethod][Owner("jthunter")] public void SchemaHashTest()
|
//ORIGINAL LINE: [TestMethod][Owner("jthunter")] public void SchemaHashTest()
|
||||||
public final void SchemaHashTest() {
|
public final void SchemaHashTest() {
|
||||||
// TODO: C# TO JAVA CONVERTER: Tuple variables are not converted by C# to Java Converter:
|
// TODO: C# TO JAVA CONVERTER: Tuple variables are not converted by C# to Java Converter:
|
||||||
( long low, long high)hash = SchemaHash.ComputeHash(this.ns, this.tableSchema);
|
( long low, long high)hash = SchemaHash.ComputeHash(this.ns, this.tableSchema);
|
||||||
assert (0,0) !=hash;
|
assert (0,0) !=hash;
|
||||||
// TODO: C# TO JAVA CONVERTER: Tuple variables are not converted by C# to Java Converter:
|
// TODO: C# TO JAVA CONVERTER: Tuple variables are not converted by C# to Java Converter:
|
||||||
( long low, long high)hash2 = SchemaHash.ComputeHash(this.ns, this.tableSchema, (1, 1))
|
( long low, long high)hash2 = SchemaHash.ComputeHash(this.ns, this.tableSchema, (1, 1))
|
||||||
assert hash != hash2;
|
assert hash != hash2;
|
||||||
|
|
||||||
// Test clone are the same.
|
// Test clone are the same.
|
||||||
Schema clone = SchemaHashUnitTests.Clone(this.tableSchema);
|
Schema clone = SchemaHashUnitTests.Clone(this.tableSchema);
|
||||||
hash2 = SchemaHash.ComputeHash(this.ns, clone);
|
hash2 = SchemaHash.ComputeHash(this.ns, clone);
|
||||||
assert hash == hash2;
|
assert hash == hash2;
|
||||||
|
|
||||||
// Test Schema changes
|
// Test Schema changes
|
||||||
clone = SchemaHashUnitTests.Clone(this.tableSchema);
|
clone = SchemaHashUnitTests.Clone(this.tableSchema);
|
||||||
clone.setName("something else");
|
clone.setName("something else");
|
||||||
hash2 = SchemaHash.ComputeHash(this.ns, clone);
|
hash2 = SchemaHash.ComputeHash(this.ns, clone);
|
||||||
assert hash == hash2; // Name not part of the hash
|
assert hash == hash2; // Name not part of the hash
|
||||||
|
|
||||||
clone = SchemaHashUnitTests.Clone(this.tableSchema);
|
clone = SchemaHashUnitTests.Clone(this.tableSchema);
|
||||||
clone.setComment("something else");
|
clone.setComment("something else");
|
||||||
hash2 = SchemaHash.ComputeHash(this.ns, clone);
|
hash2 = SchemaHash.ComputeHash(this.ns, clone);
|
||||||
assert hash == hash2; // Comment not part of the hash
|
assert hash == hash2; // Comment not part of the hash
|
||||||
|
|
||||||
clone = SchemaHashUnitTests.Clone(this.tableSchema);
|
clone = SchemaHashUnitTests.Clone(this.tableSchema);
|
||||||
clone.setVersion(SchemaLanguageVersion.forValue((byte)1));
|
clone.setVersion(SchemaLanguageVersion.forValue((byte)1));
|
||||||
hash2 = SchemaHash.ComputeHash(this.ns, clone);
|
hash2 = SchemaHash.ComputeHash(this.ns, clone);
|
||||||
assert hash == hash2; // Encoding version not part of the hash
|
assert hash == hash2; // Encoding version not part of the hash
|
||||||
|
|
||||||
clone = SchemaHashUnitTests.Clone(this.tableSchema);
|
clone = SchemaHashUnitTests.Clone(this.tableSchema);
|
||||||
clone.setSchemaId(new SchemaId(42));
|
clone.setSchemaId(new SchemaId(42));
|
||||||
hash2 = SchemaHash.ComputeHash(this.ns, clone);
|
hash2 = SchemaHash.ComputeHash(this.ns, clone);
|
||||||
assert hash != hash2;
|
assert hash != hash2;
|
||||||
|
|
||||||
clone = SchemaHashUnitTests.Clone(this.tableSchema);
|
clone = SchemaHashUnitTests.Clone(this.tableSchema);
|
||||||
clone.setType(TypeKind.Int8);
|
clone.setType(TypeKind.Int8);
|
||||||
hash2 = SchemaHash.ComputeHash(this.ns, clone);
|
hash2 = SchemaHash.ComputeHash(this.ns, clone);
|
||||||
assert hash != hash2;
|
assert hash != hash2;
|
||||||
|
|
||||||
// Test Options changes
|
// Test Options changes
|
||||||
clone = SchemaHashUnitTests.Clone(this.tableSchema);
|
clone = SchemaHashUnitTests.Clone(this.tableSchema);
|
||||||
clone.getOptions().setEnablePropertyLevelTimestamp(!clone.getOptions().getEnablePropertyLevelTimestamp());
|
clone.getOptions().setEnablePropertyLevelTimestamp(!clone.getOptions().getEnablePropertyLevelTimestamp());
|
||||||
hash2 = SchemaHash.ComputeHash(this.ns, clone);
|
hash2 = SchemaHash.ComputeHash(this.ns, clone);
|
||||||
assert hash != hash2;
|
assert hash != hash2;
|
||||||
|
|
||||||
clone = SchemaHashUnitTests.Clone(this.tableSchema);
|
clone = SchemaHashUnitTests.Clone(this.tableSchema);
|
||||||
clone.getOptions().setDisallowUnschematized(!clone.getOptions().getDisallowUnschematized());
|
clone.getOptions().setDisallowUnschematized(!clone.getOptions().getDisallowUnschematized());
|
||||||
hash2 = SchemaHash.ComputeHash(this.ns, clone);
|
hash2 = SchemaHash.ComputeHash(this.ns, clone);
|
||||||
assert hash != hash2;
|
assert hash != hash2;
|
||||||
|
|
||||||
// Test Partition Keys changes
|
// Test Partition Keys changes
|
||||||
clone = SchemaHashUnitTests.Clone(this.tableSchema);
|
clone = SchemaHashUnitTests.Clone(this.tableSchema);
|
||||||
clone.getPartitionKeys().get(0).setPath("something else");
|
clone.getPartitionKeys().get(0).setPath("something else");
|
||||||
hash2 = SchemaHash.ComputeHash(this.ns, clone);
|
hash2 = SchemaHash.ComputeHash(this.ns, clone);
|
||||||
assert hash != hash2;
|
assert hash != hash2;
|
||||||
|
|
||||||
// Test Primary Sort Keys changes
|
// Test Primary Sort Keys changes
|
||||||
clone = SchemaHashUnitTests.Clone(this.tableSchema);
|
clone = SchemaHashUnitTests.Clone(this.tableSchema);
|
||||||
clone.getPrimarySortKeys().get(0).setPath("something else");
|
clone.getPrimarySortKeys().get(0).setPath("something else");
|
||||||
hash2 = SchemaHash.ComputeHash(this.ns, clone);
|
hash2 = SchemaHash.ComputeHash(this.ns, clone);
|
||||||
assert hash != hash2;
|
assert hash != hash2;
|
||||||
|
|
||||||
clone = SchemaHashUnitTests.Clone(this.tableSchema);
|
clone = SchemaHashUnitTests.Clone(this.tableSchema);
|
||||||
clone.getPrimarySortKeys().get(0).setDirection(SortDirection.Descending);
|
clone.getPrimarySortKeys().get(0).setDirection(SortDirection.Descending);
|
||||||
hash2 = SchemaHash.ComputeHash(this.ns, clone);
|
hash2 = SchemaHash.ComputeHash(this.ns, clone);
|
||||||
assert hash != hash2;
|
assert hash != hash2;
|
||||||
|
|
||||||
// Test Static Keys changes
|
// Test Static Keys changes
|
||||||
clone = SchemaHashUnitTests.Clone(this.tableSchema);
|
clone = SchemaHashUnitTests.Clone(this.tableSchema);
|
||||||
clone.getStaticKeys().get(0).setPath("something else");
|
clone.getStaticKeys().get(0).setPath("something else");
|
||||||
hash2 = SchemaHash.ComputeHash(this.ns, clone);
|
hash2 = SchemaHash.ComputeHash(this.ns, clone);
|
||||||
assert hash != hash2;
|
assert hash != hash2;
|
||||||
|
|
||||||
// Test Properties changes
|
// Test Properties changes
|
||||||
clone = SchemaHashUnitTests.Clone(this.tableSchema);
|
clone = SchemaHashUnitTests.Clone(this.tableSchema);
|
||||||
clone.getProperties().get(0).setComment("something else");
|
clone.getProperties().get(0).setComment("something else");
|
||||||
hash2 = SchemaHash.ComputeHash(this.ns, clone);
|
hash2 = SchemaHash.ComputeHash(this.ns, clone);
|
||||||
assert hash == hash2; // Comment not part of the hash
|
assert hash == hash2; // Comment not part of the hash
|
||||||
|
|
||||||
clone = SchemaHashUnitTests.Clone(this.tableSchema);
|
clone = SchemaHashUnitTests.Clone(this.tableSchema);
|
||||||
clone.getProperties().get(0).setPath("something else");
|
clone.getProperties().get(0).setPath("something else");
|
||||||
hash2 = SchemaHash.ComputeHash(this.ns, clone);
|
hash2 = SchemaHash.ComputeHash(this.ns, clone);
|
||||||
assert hash != hash2;
|
assert hash != hash2;
|
||||||
|
|
||||||
// Test Property Type changes
|
// Test Property Type changes
|
||||||
clone = SchemaHashUnitTests.Clone(this.tableSchema);
|
clone = SchemaHashUnitTests.Clone(this.tableSchema);
|
||||||
clone.getProperties().get(0).getPropertyType().setApiType("something else");
|
clone.getProperties().get(0).getPropertyType().setApiType("something else");
|
||||||
hash2 = SchemaHash.ComputeHash(this.ns, clone);
|
hash2 = SchemaHash.ComputeHash(this.ns, clone);
|
||||||
assert hash != hash2;
|
assert hash != hash2;
|
||||||
|
|
||||||
clone = SchemaHashUnitTests.Clone(this.tableSchema);
|
clone = SchemaHashUnitTests.Clone(this.tableSchema);
|
||||||
clone.getProperties().get(0).getPropertyType().setType(TypeKind.Binary);
|
clone.getProperties().get(0).getPropertyType().setType(TypeKind.Binary);
|
||||||
hash2 = SchemaHash.ComputeHash(this.ns, clone);
|
hash2 = SchemaHash.ComputeHash(this.ns, clone);
|
||||||
assert hash != hash2;
|
assert hash != hash2;
|
||||||
|
|
||||||
clone = SchemaHashUnitTests.Clone(this.tableSchema);
|
clone = SchemaHashUnitTests.Clone(this.tableSchema);
|
||||||
clone.getProperties().get(0).getPropertyType().setNullable(!clone.getProperties().get(0).getPropertyType().getNullable());
|
clone.getProperties().get(0).getPropertyType().setNullable(!clone.getProperties().get(0).getPropertyType().getNullable());
|
||||||
hash2 = SchemaHash.ComputeHash(this.ns, clone);
|
hash2 = SchemaHash.ComputeHash(this.ns, clone);
|
||||||
assert hash != hash2;
|
assert hash != hash2;
|
||||||
|
|
||||||
// Test Primitive Property Type changes
|
// Test Primitive Property Type changes
|
||||||
clone = SchemaHashUnitTests.Clone(this.tableSchema);
|
clone = SchemaHashUnitTests.Clone(this.tableSchema);
|
||||||
PropertyType tempVar =
|
PropertyType tempVar =
|
||||||
clone.getProperties().get(0).getPropertyType();
|
clone.getProperties().get(0).getPropertyType();
|
||||||
(tempVar instanceof PrimitivePropertyType ? (PrimitivePropertyType)tempVar : null).setLength(42);
|
(tempVar instanceof PrimitivePropertyType ? (PrimitivePropertyType)tempVar : null).setLength(42);
|
||||||
hash2 = SchemaHash.ComputeHash(this.ns, clone);
|
hash2 = SchemaHash.ComputeHash(this.ns, clone);
|
||||||
assert hash != hash2;
|
assert hash != hash2;
|
||||||
|
|
||||||
clone = SchemaHashUnitTests.Clone(this.tableSchema);
|
clone = SchemaHashUnitTests.Clone(this.tableSchema);
|
||||||
PropertyType tempVar2 =
|
PropertyType tempVar2 =
|
||||||
clone.getProperties().get(0).getPropertyType();
|
clone.getProperties().get(0).getPropertyType();
|
||||||
(tempVar2 instanceof PrimitivePropertyType ? (PrimitivePropertyType)tempVar2 : null).setStorage(StorageKind.Variable);
|
(tempVar2 instanceof PrimitivePropertyType ? (PrimitivePropertyType)tempVar2 : null).setStorage(StorageKind.Variable);
|
||||||
hash2 = SchemaHash.ComputeHash(this.ns, clone);
|
hash2 = SchemaHash.ComputeHash(this.ns, clone);
|
||||||
assert hash != hash2;
|
assert hash != hash2;
|
||||||
|
|
||||||
// Test Scope Property Type changes
|
// Test Scope Property Type changes
|
||||||
clone = SchemaHashUnitTests.Clone(this.tableSchema);
|
clone = SchemaHashUnitTests.Clone(this.tableSchema);
|
||||||
PropertyType tempVar3 =
|
PropertyType tempVar3 =
|
||||||
clone.getProperties().get(1).getPropertyType();
|
clone.getProperties().get(1).getPropertyType();
|
||||||
PropertyType tempVar4 =
|
PropertyType tempVar4 =
|
||||||
clone.getProperties().get(1).getPropertyType();
|
clone.getProperties().get(1).getPropertyType();
|
||||||
(tempVar3 instanceof ScopePropertyType ? (ScopePropertyType)tempVar3 : null).setImmutable(!(tempVar4 instanceof ScopePropertyType ? (ScopePropertyType)tempVar4 : null).getImmutable());
|
(tempVar3 instanceof ScopePropertyType ? (ScopePropertyType)tempVar3 : null).setImmutable(!(tempVar4 instanceof ScopePropertyType ? (ScopePropertyType)tempVar4 : null).getImmutable());
|
||||||
hash2 = SchemaHash.ComputeHash(this.ns, clone);
|
hash2 = SchemaHash.ComputeHash(this.ns, clone);
|
||||||
assert hash != hash2;
|
assert hash != hash2;
|
||||||
|
|
||||||
// Test Array Property Type changes
|
// Test Array Property Type changes
|
||||||
clone = SchemaHashUnitTests.Clone(this.tableSchema);
|
clone = SchemaHashUnitTests.Clone(this.tableSchema);
|
||||||
PropertyType tempVar5 =
|
PropertyType tempVar5 =
|
||||||
clone.getProperties().get(1).getPropertyType();
|
clone.getProperties().get(1).getPropertyType();
|
||||||
(tempVar5 instanceof ArrayPropertyType ? (ArrayPropertyType)tempVar5 : null).setItems(clone.getProperties().get(0).getPropertyType());
|
(tempVar5 instanceof ArrayPropertyType ? (ArrayPropertyType)tempVar5 : null).setItems(clone.getProperties().get(0).getPropertyType());
|
||||||
hash2 = SchemaHash.ComputeHash(this.ns, clone);
|
hash2 = SchemaHash.ComputeHash(this.ns, clone);
|
||||||
assert hash != hash2;
|
assert hash != hash2;
|
||||||
|
|
||||||
// Test Object Property Type changes
|
// Test Object Property Type changes
|
||||||
clone = SchemaHashUnitTests.Clone(this.tableSchema);
|
clone = SchemaHashUnitTests.Clone(this.tableSchema);
|
||||||
PropertyType tempVar6 =
|
PropertyType tempVar6 =
|
||||||
clone.getProperties().get(2).getPropertyType();
|
clone.getProperties().get(2).getPropertyType();
|
||||||
(tempVar6 instanceof ObjectPropertyType ? (ObjectPropertyType)tempVar6 : null).getProperties().set(0,
|
(tempVar6 instanceof ObjectPropertyType ? (ObjectPropertyType)tempVar6 : null).getProperties().set(0,
|
||||||
clone.getProperties().get(0));
|
clone.getProperties().get(0));
|
||||||
hash2 = SchemaHash.ComputeHash(this.ns, clone);
|
hash2 = SchemaHash.ComputeHash(this.ns, clone);
|
||||||
assert hash != hash2;
|
assert hash != hash2;
|
||||||
|
|
||||||
// Test Map Property Type changes
|
// Test Map Property Type changes
|
||||||
clone = SchemaHashUnitTests.Clone(this.tableSchema);
|
clone = SchemaHashUnitTests.Clone(this.tableSchema);
|
||||||
PropertyType tempVar7 =
|
PropertyType tempVar7 =
|
||||||
clone.getProperties().get(3).getPropertyType();
|
clone.getProperties().get(3).getPropertyType();
|
||||||
(tempVar7 instanceof MapPropertyType ? (MapPropertyType)tempVar7 : null).setKeys(clone.getProperties().get(0).getPropertyType());
|
(tempVar7 instanceof MapPropertyType ? (MapPropertyType)tempVar7 : null).setKeys(clone.getProperties().get(0).getPropertyType());
|
||||||
hash2 = SchemaHash.ComputeHash(this.ns, clone);
|
hash2 = SchemaHash.ComputeHash(this.ns, clone);
|
||||||
assert hash != hash2;
|
assert hash != hash2;
|
||||||
|
|
||||||
clone = SchemaHashUnitTests.Clone(this.tableSchema);
|
clone = SchemaHashUnitTests.Clone(this.tableSchema);
|
||||||
PropertyType tempVar8 =
|
PropertyType tempVar8 =
|
||||||
clone.getProperties().get(3).getPropertyType();
|
clone.getProperties().get(3).getPropertyType();
|
||||||
(tempVar8 instanceof MapPropertyType ? (MapPropertyType)tempVar8 : null).setValues(clone.getProperties().get(0).getPropertyType());
|
(tempVar8 instanceof MapPropertyType ? (MapPropertyType)tempVar8 : null).setValues(clone.getProperties().get(0).getPropertyType());
|
||||||
hash2 = SchemaHash.ComputeHash(this.ns, clone);
|
hash2 = SchemaHash.ComputeHash(this.ns, clone);
|
||||||
assert hash != hash2;
|
assert hash != hash2;
|
||||||
|
|
||||||
// Test Set Property Type changes
|
// Test Set Property Type changes
|
||||||
clone = SchemaHashUnitTests.Clone(this.tableSchema);
|
clone = SchemaHashUnitTests.Clone(this.tableSchema);
|
||||||
PropertyType tempVar9 =
|
PropertyType tempVar9 =
|
||||||
clone.getProperties().get(4).getPropertyType();
|
clone.getProperties().get(4).getPropertyType();
|
||||||
(tempVar9 instanceof SetPropertyType ? (SetPropertyType)tempVar9 : null).setItems(clone.getProperties().get(0).getPropertyType());
|
(tempVar9 instanceof SetPropertyType ? (SetPropertyType)tempVar9 : null).setItems(clone.getProperties().get(0).getPropertyType());
|
||||||
hash2 = SchemaHash.ComputeHash(this.ns, clone);
|
hash2 = SchemaHash.ComputeHash(this.ns, clone);
|
||||||
assert hash != hash2;
|
assert hash != hash2;
|
||||||
|
|
||||||
// Test Tagged Property Type changes
|
// Test Tagged Property Type changes
|
||||||
clone = SchemaHashUnitTests.Clone(this.tableSchema);
|
clone = SchemaHashUnitTests.Clone(this.tableSchema);
|
||||||
PropertyType tempVar10 =
|
PropertyType tempVar10 =
|
||||||
clone.getProperties().get(5).getPropertyType();
|
clone.getProperties().get(5).getPropertyType();
|
||||||
(tempVar10 instanceof TaggedPropertyType ? (TaggedPropertyType)tempVar10 : null).getItems().set(0,
|
(tempVar10 instanceof TaggedPropertyType ? (TaggedPropertyType)tempVar10 : null).getItems().set(0,
|
||||||
clone.getProperties().get(0).getPropertyType());
|
clone.getProperties().get(0).getPropertyType());
|
||||||
hash2 = SchemaHash.ComputeHash(this.ns, clone);
|
hash2 = SchemaHash.ComputeHash(this.ns, clone);
|
||||||
assert hash != hash2;
|
assert hash != hash2;
|
||||||
|
|
||||||
// Test Tuple Property Type changes
|
// Test Tuple Property Type changes
|
||||||
clone = SchemaHashUnitTests.Clone(this.tableSchema);
|
clone = SchemaHashUnitTests.Clone(this.tableSchema);
|
||||||
PropertyType tempVar11 =
|
PropertyType tempVar11 =
|
||||||
clone.getProperties().get(6).getPropertyType();
|
clone.getProperties().get(6).getPropertyType();
|
||||||
(tempVar11 instanceof TuplePropertyType ? (TuplePropertyType)tempVar11 : null).getItems().set(0,
|
(tempVar11 instanceof TuplePropertyType ? (TuplePropertyType)tempVar11 : null).getItems().set(0,
|
||||||
clone.getProperties().get(0).getPropertyType());
|
clone.getProperties().get(0).getPropertyType());
|
||||||
hash2 = SchemaHash.ComputeHash(this.ns, clone);
|
hash2 = SchemaHash.ComputeHash(this.ns, clone);
|
||||||
assert hash != hash2;
|
assert hash != hash2;
|
||||||
|
|
||||||
// Test UDT Property Type changes
|
// Test UDT Property Type changes
|
||||||
try {
|
try {
|
||||||
clone = SchemaHashUnitTests.Clone(this.tableSchema);
|
clone = SchemaHashUnitTests.Clone(this.tableSchema);
|
||||||
PropertyType tempVar12 =
|
PropertyType tempVar12 =
|
||||||
clone.getProperties().get(7).getPropertyType();
|
clone.getProperties().get(7).getPropertyType();
|
||||||
(tempVar12 instanceof UdtPropertyType ? (UdtPropertyType)tempVar12 : null).setName("some non-existing UDT" +
|
(tempVar12 instanceof UdtPropertyType ? (UdtPropertyType)tempVar12 : null).setName("some non-existing UDT" +
|
||||||
" name");
|
" name");
|
||||||
hash2 = SchemaHash.ComputeHash(this.ns, clone);
|
hash2 = SchemaHash.ComputeHash(this.ns, clone);
|
||||||
Assert.Fail("Should have thrown an exception.");
|
Assert.Fail("Should have thrown an exception.");
|
||||||
} catch (RuntimeException ex) {
|
} catch (RuntimeException ex) {
|
||||||
assert ex != null;
|
assert ex != null;
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
clone = SchemaHashUnitTests.Clone(this.tableSchema);
|
clone = SchemaHashUnitTests.Clone(this.tableSchema);
|
||||||
PropertyType tempVar13 =
|
PropertyType tempVar13 =
|
||||||
clone.getProperties().get(7).getPropertyType();
|
clone.getProperties().get(7).getPropertyType();
|
||||||
(tempVar13 instanceof UdtPropertyType ? (UdtPropertyType)tempVar13 : null).setName("Table");
|
(tempVar13 instanceof UdtPropertyType ? (UdtPropertyType)tempVar13 : null).setName("Table");
|
||||||
hash2 = SchemaHash.ComputeHash(this.ns, clone);
|
hash2 = SchemaHash.ComputeHash(this.ns, clone);
|
||||||
Assert.Fail("Should have thrown an exception.");
|
Assert.Fail("Should have thrown an exception.");
|
||||||
} catch (RuntimeException ex) {
|
} catch (RuntimeException ex) {
|
||||||
assert ex != null;
|
assert ex != null;
|
||||||
}
|
}
|
||||||
|
|
||||||
clone = SchemaHashUnitTests.Clone(this.tableSchema);
|
clone = SchemaHashUnitTests.Clone(this.tableSchema);
|
||||||
PropertyType tempVar14 =
|
PropertyType tempVar14 =
|
||||||
clone.getProperties().get(7).getPropertyType();
|
clone.getProperties().get(7).getPropertyType();
|
||||||
(tempVar14 instanceof UdtPropertyType ? (UdtPropertyType)tempVar14 : null).setName("Table");
|
(tempVar14 instanceof UdtPropertyType ? (UdtPropertyType)tempVar14 : null).setName("Table");
|
||||||
PropertyType tempVar15 =
|
PropertyType tempVar15 =
|
||||||
clone.getProperties().get(7).getPropertyType();
|
clone.getProperties().get(7).getPropertyType();
|
||||||
(tempVar15 instanceof UdtPropertyType ? (UdtPropertyType)tempVar15 : null).setSchemaId(new SchemaId(2));
|
(tempVar15 instanceof UdtPropertyType ? (UdtPropertyType)tempVar15 : null).setSchemaId(new SchemaId(2));
|
||||||
hash2 = SchemaHash.ComputeHash(this.ns, clone);
|
hash2 = SchemaHash.ComputeHash(this.ns, clone);
|
||||||
assert hash != hash2;
|
assert hash != hash2;
|
||||||
|
|
||||||
// Renaming an UDT is not a breaking change as long as the SchemaId has not changed.
|
// Renaming an UDT is not a breaking change as long as the SchemaId has not changed.
|
||||||
this.ns.getSchemas().get(0).setName("RenameActualUDT");
|
this.ns.getSchemas().get(0).setName("RenameActualUDT");
|
||||||
clone = SchemaHashUnitTests.Clone(this.tableSchema);
|
clone = SchemaHashUnitTests.Clone(this.tableSchema);
|
||||||
PropertyType tempVar16 = clone.getProperties().get(7).getPropertyType();
|
PropertyType tempVar16 = clone.getProperties().get(7).getPropertyType();
|
||||||
(tempVar16 instanceof UdtPropertyType ? (UdtPropertyType)tempVar16 : null).setName("RenameActualUDT");
|
(tempVar16 instanceof UdtPropertyType ? (UdtPropertyType)tempVar16 : null).setName("RenameActualUDT");
|
||||||
hash2 = SchemaHash.ComputeHash(this.ns, clone);
|
hash2 = SchemaHash.ComputeHash(this.ns, clone);
|
||||||
assert hash == hash2;
|
assert hash == hash2;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static Schema Clone(Schema s) {
|
private static Schema Clone(Schema s) {
|
||||||
JsonSerializerSettings settings = new JsonSerializerSettings();
|
JsonSerializerSettings settings = new JsonSerializerSettings();
|
||||||
settings.NullValueHandling = NullValueHandling.Ignore;
|
settings.NullValueHandling = NullValueHandling.Ignore;
|
||||||
settings.Formatting = Formatting.Indented;
|
settings.Formatting = Formatting.Indented;
|
||||||
settings.CheckAdditionalContent = true;
|
settings.CheckAdditionalContent = true;
|
||||||
|
|
||||||
String json = JsonConvert.SerializeObject(s, settings);
|
String json = JsonConvert.SerializeObject(s, settings);
|
||||||
return JsonConvert.<Schema>DeserializeObject(json, settings);
|
return JsonConvert.<Schema>DeserializeObject(json, settings);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+43
-43
@@ -1,44 +1,44 @@
|
|||||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||||
// Licensed under the MIT License.
|
// Licensed under the MIT License.
|
||||||
|
|
||||||
package com.azure.data.cosmos.serialization.hybridrow.unit;
|
package com.azure.data.cosmos.serialization.hybridrow.unit;
|
||||||
|
|
||||||
import Newtonsoft.Json.*;
|
import Newtonsoft.Json.*;
|
||||||
import com.azure.data.cosmos.serialization.hybridrow.SchemaId;
|
import com.azure.data.cosmos.serialization.hybridrow.SchemaId;
|
||||||
|
|
||||||
// TODO: C# TO JAVA CONVERTER: Java annotations will not correspond to .NET attributes:
|
// TODO: C# TO JAVA CONVERTER: Java annotations will not correspond to .NET attributes:
|
||||||
//ORIGINAL LINE: [TestClass] public class SchemaIdUnitTests
|
//ORIGINAL LINE: [TestClass] public class SchemaIdUnitTests
|
||||||
public class SchemaIdUnitTests {
|
public class SchemaIdUnitTests {
|
||||||
// TODO: C# TO JAVA CONVERTER: Java annotations will not correspond to .NET attributes:
|
// TODO: C# TO JAVA CONVERTER: Java annotations will not correspond to .NET attributes:
|
||||||
//ORIGINAL LINE: [TestMethod][Owner("jthunter")] public void SchemaIdTest()
|
//ORIGINAL LINE: [TestMethod][Owner("jthunter")] public void SchemaIdTest()
|
||||||
public final void SchemaIdTest() {
|
public final void SchemaIdTest() {
|
||||||
SchemaId a = new SchemaId(1);
|
SchemaId a = new SchemaId(1);
|
||||||
SchemaId b = new SchemaId(2);
|
SchemaId b = new SchemaId(2);
|
||||||
SchemaId c = new SchemaId();
|
SchemaId c = new SchemaId();
|
||||||
|
|
||||||
assert 1 == a.value();
|
assert 1 == a.value();
|
||||||
assert 2 == b.value();
|
assert 2 == b.value();
|
||||||
assert SchemaId.INVALID == c.clone();
|
assert SchemaId.INVALID == c.clone();
|
||||||
assert 2 != a.value();
|
assert 2 != a.value();
|
||||||
assert a.clone() != b.clone();
|
assert a.clone() != b.clone();
|
||||||
assert SchemaId.opEquals(a.clone(), a.clone());
|
assert SchemaId.opEquals(a.clone(), a.clone());
|
||||||
assert SchemaId.opNotEquals(a.clone(), b.clone());
|
assert SchemaId.opNotEquals(a.clone(), b.clone());
|
||||||
assert !a.equals(null);
|
assert !a.equals(null);
|
||||||
assert a.hashCode() == (new SchemaId(1)).hashCode();
|
assert a.hashCode() == (new SchemaId(1)).hashCode();
|
||||||
assert a.hashCode() != (new SchemaId(-1)).hashCode();
|
assert a.hashCode() != (new SchemaId(-1)).hashCode();
|
||||||
|
|
||||||
String json = JsonConvert.SerializeObject(a.clone());
|
String json = JsonConvert.SerializeObject(a.clone());
|
||||||
assert "1" == json;
|
assert "1" == json;
|
||||||
assert "1" == a.toString();
|
assert "1" == a.toString();
|
||||||
|
|
||||||
assert a.clone() == JsonConvert.<SchemaId>DeserializeObject(json);
|
assert a.clone() == JsonConvert.<SchemaId>DeserializeObject(json);
|
||||||
json = JsonConvert.SerializeObject(b.clone());
|
json = JsonConvert.SerializeObject(b.clone());
|
||||||
assert "2" == json;
|
assert "2" == json;
|
||||||
assert "2" == b.toString();
|
assert "2" == b.toString();
|
||||||
assert b.clone() == JsonConvert.<SchemaId>DeserializeObject(json);
|
assert b.clone() == JsonConvert.<SchemaId>DeserializeObject(json);
|
||||||
json = JsonConvert.SerializeObject(c.clone());
|
json = JsonConvert.SerializeObject(c.clone());
|
||||||
assert "0" == json;
|
assert "0" == json;
|
||||||
assert "0" == c.toString();
|
assert "0" == c.toString();
|
||||||
assert c.clone() == JsonConvert.<SchemaId>DeserializeObject(json);
|
assert c.clone() == JsonConvert.<SchemaId>DeserializeObject(json);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+993
-993
File diff suppressed because it is too large
Load Diff
+316
-316
@@ -1,317 +1,317 @@
|
|||||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||||
// Licensed under the MIT License.
|
// Licensed under the MIT License.
|
||||||
|
|
||||||
package com.azure.data.cosmos.serialization.hybridrow.unit;
|
package com.azure.data.cosmos.serialization.hybridrow.unit;
|
||||||
|
|
||||||
import com.azure.data.cosmos.core.Out;
|
import com.azure.data.cosmos.core.Out;
|
||||||
import com.azure.data.cosmos.core.Reference;
|
import com.azure.data.cosmos.core.Reference;
|
||||||
import com.azure.data.cosmos.serialization.hybridrow.HybridRowVersion;
|
import com.azure.data.cosmos.serialization.hybridrow.HybridRowVersion;
|
||||||
import com.azure.data.cosmos.serialization.hybridrow.Result;
|
import com.azure.data.cosmos.serialization.hybridrow.Result;
|
||||||
import com.azure.data.cosmos.serialization.hybridrow.RowBuffer;
|
import com.azure.data.cosmos.serialization.hybridrow.RowBuffer;
|
||||||
import com.azure.data.cosmos.serialization.hybridrow.SchemaId;
|
import com.azure.data.cosmos.serialization.hybridrow.SchemaId;
|
||||||
import com.azure.data.cosmos.serialization.hybridrow.io.RowReader;
|
import com.azure.data.cosmos.serialization.hybridrow.io.RowReader;
|
||||||
import com.azure.data.cosmos.serialization.hybridrow.io.RowReaderExtensions;
|
import com.azure.data.cosmos.serialization.hybridrow.io.RowReaderExtensions;
|
||||||
import com.azure.data.cosmos.serialization.hybridrow.layouts.TypeArgument;
|
import com.azure.data.cosmos.serialization.hybridrow.layouts.TypeArgument;
|
||||||
|
|
||||||
import java.nio.file.Files;
|
import java.nio.file.Files;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
|
|
||||||
// TODO: C# TO JAVA CONVERTER: There is no preprocessor in Java:
|
// TODO: C# TO JAVA CONVERTER: There is no preprocessor in Java:
|
||||||
///#pragma warning disable SA1401 // Fields should be private
|
///#pragma warning disable SA1401 // Fields should be private
|
||||||
// TODO: C# TO JAVA CONVERTER: There is no preprocessor in Java:
|
// TODO: C# TO JAVA CONVERTER: There is no preprocessor in Java:
|
||||||
///#pragma warning disable SA1201 // Elements should appear in the correct order
|
///#pragma warning disable SA1201 // Elements should appear in the correct order
|
||||||
// TODO: C# TO JAVA CONVERTER: There is no preprocessor in Java:
|
// TODO: C# TO JAVA CONVERTER: There is no preprocessor in Java:
|
||||||
///#pragma warning disable SA1204 // Elements should appear in the correct order
|
///#pragma warning disable SA1204 // Elements should appear in the correct order
|
||||||
// TODO: C# TO JAVA CONVERTER: There is no preprocessor in Java:
|
// TODO: C# TO JAVA CONVERTER: There is no preprocessor in Java:
|
||||||
///#pragma warning disable CA1034 // Nested types should not be visible
|
///#pragma warning disable CA1034 // Nested types should not be visible
|
||||||
// TODO: C# TO JAVA CONVERTER: There is no preprocessor in Java:
|
// TODO: C# TO JAVA CONVERTER: There is no preprocessor in Java:
|
||||||
///#pragma warning disable CA1051 // Do not declare visible instance fields
|
///#pragma warning disable CA1051 // Do not declare visible instance fields
|
||||||
|
|
||||||
|
|
||||||
// TODO: C# TO JAVA CONVERTER: Java annotations will not correspond to .NET attributes:
|
// TODO: C# TO JAVA CONVERTER: Java annotations will not correspond to .NET attributes:
|
||||||
//ORIGINAL LINE: [TestClass][DeploymentItem(SerializerUnitTest.SchemaFile, "TestData")] public sealed class
|
//ORIGINAL LINE: [TestClass][DeploymentItem(SerializerUnitTest.SchemaFile, "TestData")] public sealed class
|
||||||
// SerializerUnitTest
|
// SerializerUnitTest
|
||||||
public final class SerializerUnitTest {
|
public final class SerializerUnitTest {
|
||||||
private static final int InitialRowSize = 2 * 1024 * 1024;
|
private static final int InitialRowSize = 2 * 1024 * 1024;
|
||||||
private static final String SchemaFile = "TestData\\BatchApiSchema.json";
|
private static final String SchemaFile = "TestData\\BatchApiSchema.json";
|
||||||
private Layout layout;
|
private Layout layout;
|
||||||
private LayoutResolver resolver;
|
private LayoutResolver resolver;
|
||||||
private Namespace schema;
|
private Namespace schema;
|
||||||
|
|
||||||
// TODO: C# TO JAVA CONVERTER: Java annotations will not correspond to .NET attributes:
|
// TODO: C# TO JAVA CONVERTER: Java annotations will not correspond to .NET attributes:
|
||||||
//ORIGINAL LINE: [TestMethod][Owner("jthunter")] public void CreateBatchRequest()
|
//ORIGINAL LINE: [TestMethod][Owner("jthunter")] public void CreateBatchRequest()
|
||||||
public void CreateBatchRequest() {
|
public void CreateBatchRequest() {
|
||||||
BatchRequest request = new BatchRequest();
|
BatchRequest request = new BatchRequest();
|
||||||
BatchOperation tempVar = new BatchOperation();
|
BatchOperation tempVar = new BatchOperation();
|
||||||
tempVar.OperationType = 3;
|
tempVar.OperationType = 3;
|
||||||
tempVar.Headers = new BatchRequestHeaders();
|
tempVar.Headers = new BatchRequestHeaders();
|
||||||
tempVar.Headers.SampleRequestHeader = 12345L;
|
tempVar.Headers.SampleRequestHeader = 12345L;
|
||||||
tempVar.ResourceType = 1;
|
tempVar.ResourceType = 1;
|
||||||
tempVar.ResourcePath = "/some/url/path";
|
tempVar.ResourcePath = "/some/url/path";
|
||||||
//C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java:
|
//C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java:
|
||||||
//ORIGINAL LINE: tempVar.ResourceBody = new byte[] { 1, 2, 3 };
|
//ORIGINAL LINE: tempVar.ResourceBody = new byte[] { 1, 2, 3 };
|
||||||
tempVar.ResourceBody = new byte[] { 1, 2, 3 };
|
tempVar.ResourceBody = new byte[] { 1, 2, 3 };
|
||||||
BatchOperation tempVar2 = new BatchOperation();
|
BatchOperation tempVar2 = new BatchOperation();
|
||||||
tempVar2.OperationType = 2;
|
tempVar2.OperationType = 2;
|
||||||
tempVar2.Headers = new BatchRequestHeaders();
|
tempVar2.Headers = new BatchRequestHeaders();
|
||||||
tempVar2.Headers.SampleRequestHeader = 98746L;
|
tempVar2.Headers.SampleRequestHeader = 98746L;
|
||||||
tempVar2.ResourceType = 2;
|
tempVar2.ResourceType = 2;
|
||||||
tempVar2.ResourcePath = "/some/other/url/path";
|
tempVar2.ResourcePath = "/some/other/url/path";
|
||||||
//C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java:
|
//C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java:
|
||||||
//ORIGINAL LINE: tempVar2.ResourceBody = new byte[] { 3, 2, 1 };
|
//ORIGINAL LINE: tempVar2.ResourceBody = new byte[] { 3, 2, 1 };
|
||||||
tempVar2.ResourceBody = new byte[] { 3, 2, 1 };
|
tempVar2.ResourceBody = new byte[] { 3, 2, 1 };
|
||||||
request.Operations = new ArrayList<BatchOperation>(Arrays.asList(tempVar, tempVar2));
|
request.Operations = new ArrayList<BatchOperation>(Arrays.asList(tempVar, tempVar2));
|
||||||
|
|
||||||
// Write the request by serializing it to a row.
|
// Write the request by serializing it to a row.
|
||||||
RowBuffer row = new RowBuffer(SerializerUnitTest.InitialRowSize);
|
RowBuffer row = new RowBuffer(SerializerUnitTest.InitialRowSize);
|
||||||
row.initLayout(HybridRowVersion.V1, this.layout, this.resolver);
|
row.initLayout(HybridRowVersion.V1, this.layout, this.resolver);
|
||||||
Reference<RowBuffer> tempReference_row =
|
Reference<RowBuffer> tempReference_row =
|
||||||
new Reference<RowBuffer>(row);
|
new Reference<RowBuffer>(row);
|
||||||
Result r = RowWriter.WriteBuffer(tempReference_row, request, BatchRequestSerializer.Write);
|
Result r = RowWriter.WriteBuffer(tempReference_row, request, BatchRequestSerializer.Write);
|
||||||
row = tempReference_row.get();
|
row = tempReference_row.get();
|
||||||
assert Result.SUCCESS == r;
|
assert Result.SUCCESS == r;
|
||||||
System.out.printf("Length of serialized row: %1$s" + "\r\n", row.length());
|
System.out.printf("Length of serialized row: %1$s" + "\r\n", row.length());
|
||||||
|
|
||||||
// Read the row back again.
|
// Read the row back again.
|
||||||
Reference<RowBuffer> tempReference_row2 =
|
Reference<RowBuffer> tempReference_row2 =
|
||||||
new Reference<RowBuffer>(row);
|
new Reference<RowBuffer>(row);
|
||||||
RowReader reader = new RowReader(tempReference_row2);
|
RowReader reader = new RowReader(tempReference_row2);
|
||||||
row = tempReference_row2.get();
|
row = tempReference_row2.get();
|
||||||
Reference<RowReader> tempReference_reader =
|
Reference<RowReader> tempReference_reader =
|
||||||
new Reference<RowReader>(reader);
|
new Reference<RowReader>(reader);
|
||||||
BatchRequest _;
|
BatchRequest _;
|
||||||
Out<BatchRequest> tempOut__ = new Out<BatchRequest>();
|
Out<BatchRequest> tempOut__ = new Out<BatchRequest>();
|
||||||
r = BatchRequestSerializer.Read(tempReference_reader, tempOut__);
|
r = BatchRequestSerializer.Read(tempReference_reader, tempOut__);
|
||||||
_ = tempOut__.get();
|
_ = tempOut__.get();
|
||||||
reader = tempReference_reader.get();
|
reader = tempReference_reader.get();
|
||||||
assert Result.SUCCESS == r;
|
assert Result.SUCCESS == r;
|
||||||
|
|
||||||
// Dump the materialized request to the console.
|
// Dump the materialized request to the console.
|
||||||
Reference<RowBuffer> tempReference_row3 =
|
Reference<RowBuffer> tempReference_row3 =
|
||||||
new Reference<RowBuffer>(row);
|
new Reference<RowBuffer>(row);
|
||||||
reader = new RowReader(tempReference_row3);
|
reader = new RowReader(tempReference_row3);
|
||||||
row = tempReference_row3.get();
|
row = tempReference_row3.get();
|
||||||
Reference<RowReader> tempReference_reader2 =
|
Reference<RowReader> tempReference_reader2 =
|
||||||
new Reference<RowReader>(reader);
|
new Reference<RowReader>(reader);
|
||||||
String dumpStr;
|
String dumpStr;
|
||||||
// TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'out' keyword - these
|
// TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'out' keyword - these
|
||||||
// cannot be converted using the 'Out' helper class unless the method is within the code being modified:
|
// cannot be converted using the 'Out' helper class unless the method is within the code being modified:
|
||||||
r = DiagnosticConverter.ReaderToString(tempReference_reader2, out dumpStr);
|
r = DiagnosticConverter.ReaderToString(tempReference_reader2, out dumpStr);
|
||||||
reader = tempReference_reader2.get();
|
reader = tempReference_reader2.get();
|
||||||
assert Result.SUCCESS == r;
|
assert Result.SUCCESS == r;
|
||||||
System.out.println(dumpStr);
|
System.out.println(dumpStr);
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: C# TO JAVA CONVERTER: Java annotations will not correspond to .NET attributes:
|
// TODO: C# TO JAVA CONVERTER: Java annotations will not correspond to .NET attributes:
|
||||||
//ORIGINAL LINE: [TestInitialize] public void InitTestSuite()
|
//ORIGINAL LINE: [TestInitialize] public void InitTestSuite()
|
||||||
public void InitTestSuite() {
|
public void InitTestSuite() {
|
||||||
String json = Files.readString(SerializerUnitTest.SchemaFile);
|
String json = Files.readString(SerializerUnitTest.SchemaFile);
|
||||||
this.schema = Namespace.Parse(json);
|
this.schema = Namespace.Parse(json);
|
||||||
this.resolver = new LayoutResolverNamespace(this.schema);
|
this.resolver = new LayoutResolverNamespace(this.schema);
|
||||||
this.layout = this.resolver.Resolve(tangible.ListHelper.find(this.schema.getSchemas(), x -> x.Name.equals(
|
this.layout = this.resolver.Resolve(tangible.ListHelper.find(this.schema.getSchemas(), x -> x.Name.equals(
|
||||||
"BatchRequest")).SchemaId);
|
"BatchRequest")).SchemaId);
|
||||||
}
|
}
|
||||||
|
|
||||||
public final static class BatchOperation {
|
public final static class BatchOperation {
|
||||||
public BatchRequestHeaders Headers;
|
public BatchRequestHeaders Headers;
|
||||||
public int OperationType;
|
public int OperationType;
|
||||||
//C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java:
|
//C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java:
|
||||||
//ORIGINAL LINE: public byte[] ResourceBody;
|
//ORIGINAL LINE: public byte[] ResourceBody;
|
||||||
public byte[] ResourceBody;
|
public byte[] ResourceBody;
|
||||||
public String ResourcePath;
|
public String ResourcePath;
|
||||||
public int ResourceType;
|
public int ResourceType;
|
||||||
}
|
}
|
||||||
|
|
||||||
public final static class BatchOperationResponse {
|
public final static class BatchOperationResponse {
|
||||||
public BatchResponseHeaders Headers;
|
public BatchResponseHeaders Headers;
|
||||||
//C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java:
|
//C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java:
|
||||||
//ORIGINAL LINE: public byte[] ResourceBody;
|
//ORIGINAL LINE: public byte[] ResourceBody;
|
||||||
public byte[] ResourceBody;
|
public byte[] ResourceBody;
|
||||||
public int StatusCode;
|
public int StatusCode;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class BatchOperationSerializer {
|
public static class BatchOperationSerializer {
|
||||||
public static final TypeArgument TypeArg = new TypeArgument(LayoutType.UDT,
|
public static final TypeArgument TypeArg = new TypeArgument(LayoutType.UDT,
|
||||||
new TypeArgumentList(new SchemaId(2)));
|
new TypeArgumentList(new SchemaId(2)));
|
||||||
|
|
||||||
public static Result Read(Reference<RowReader> reader, Out<BatchOperation> operation) {
|
public static Result Read(Reference<RowReader> reader, Out<BatchOperation> operation) {
|
||||||
BatchOperation retval = new BatchOperation();
|
BatchOperation retval = new BatchOperation();
|
||||||
operation.setAndGet(null);
|
operation.setAndGet(null);
|
||||||
while (reader.get().read()) {
|
while (reader.get().read()) {
|
||||||
Result r;
|
Result r;
|
||||||
switch (reader.get().path()) {
|
switch (reader.get().path()) {
|
||||||
case "operationType":
|
case "operationType":
|
||||||
Out<Integer> tempOut_OperationType = new Out<Integer>();
|
Out<Integer> tempOut_OperationType = new Out<Integer>();
|
||||||
r = reader.get().readInt32(tempOut_OperationType);
|
r = reader.get().readInt32(tempOut_OperationType);
|
||||||
retval.OperationType = tempOut_OperationType.get();
|
retval.OperationType = tempOut_OperationType.get();
|
||||||
if (r != Result.SUCCESS) {
|
if (r != Result.SUCCESS) {
|
||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case "headers":
|
case "headers":
|
||||||
Reference<RowReader> tempReference_child = new Reference<RowReader>(child);
|
Reference<RowReader> tempReference_child = new Reference<RowReader>(child);
|
||||||
Out<BatchRequestHeaders> tempOut_Headers = new Out<BatchRequestHeaders>();
|
Out<BatchRequestHeaders> tempOut_Headers = new Out<BatchRequestHeaders>();
|
||||||
// TODO: C# TO JAVA CONVERTER: The following lambda contained an unresolved 'ref' keyword
|
// TODO: C# TO JAVA CONVERTER: The following lambda contained an unresolved 'ref' keyword
|
||||||
// - these are not converted by C# to Java Converter:
|
// - these are not converted by C# to Java Converter:
|
||||||
r = reader.get().readScope(retval,
|
r = reader.get().readScope(retval,
|
||||||
(RowReader RowReader child, BatchOperation parent) -> BatchRequestHeadersSerializer.Read(tempReference_child, tempOut_Headers));
|
(RowReader RowReader child, BatchOperation parent) -> BatchRequestHeadersSerializer.Read(tempReference_child, tempOut_Headers));
|
||||||
parent.Headers = tempOut_Headers.get();
|
parent.Headers = tempOut_Headers.get();
|
||||||
child = tempReference_child.get();
|
child = tempReference_child.get();
|
||||||
if (r != Result.SUCCESS) {
|
if (r != Result.SUCCESS) {
|
||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case "resourceType":
|
case "resourceType":
|
||||||
Out<Integer> tempOut_ResourceType = new Out<Integer>();
|
Out<Integer> tempOut_ResourceType = new Out<Integer>();
|
||||||
r = reader.get().readInt32(tempOut_ResourceType);
|
r = reader.get().readInt32(tempOut_ResourceType);
|
||||||
retval.ResourceType = tempOut_ResourceType.get();
|
retval.ResourceType = tempOut_ResourceType.get();
|
||||||
if (r != Result.SUCCESS) {
|
if (r != Result.SUCCESS) {
|
||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case "resourcePath":
|
case "resourcePath":
|
||||||
Out<String> tempOut_ResourcePath = new Out<String>();
|
Out<String> tempOut_ResourcePath = new Out<String>();
|
||||||
r = reader.get().readUtf8String(tempOut_ResourcePath);
|
r = reader.get().readUtf8String(tempOut_ResourcePath);
|
||||||
retval.ResourcePath = tempOut_ResourcePath.get();
|
retval.ResourcePath = tempOut_ResourcePath.get();
|
||||||
if (r != Result.SUCCESS) {
|
if (r != Result.SUCCESS) {
|
||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case "resourceBody":
|
case "resourceBody":
|
||||||
Out<Byte> tempOut_ResourceBody = new Out<Byte>();
|
Out<Byte> tempOut_ResourceBody = new Out<Byte>();
|
||||||
//C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java:
|
//C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java:
|
||||||
//ORIGINAL LINE: r = reader.ReadBinary(out retval.ResourceBody);
|
//ORIGINAL LINE: r = reader.ReadBinary(out retval.ResourceBody);
|
||||||
r = reader.get().ReadBinary(tempOut_ResourceBody);
|
r = reader.get().ReadBinary(tempOut_ResourceBody);
|
||||||
retval.ResourceBody = tempOut_ResourceBody.get();
|
retval.ResourceBody = tempOut_ResourceBody.get();
|
||||||
if (r != Result.SUCCESS) {
|
if (r != Result.SUCCESS) {
|
||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
operation.setAndGet(retval);
|
operation.setAndGet(retval);
|
||||||
return Result.SUCCESS;
|
return Result.SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Result Write(Reference<RowWriter> writer, TypeArgument typeArg,
|
public static Result Write(Reference<RowWriter> writer, TypeArgument typeArg,
|
||||||
BatchOperation operation) {
|
BatchOperation operation) {
|
||||||
Result r = writer.get().WriteInt32("operationType", operation.OperationType);
|
Result r = writer.get().WriteInt32("operationType", operation.OperationType);
|
||||||
if (r != Result.SUCCESS) {
|
if (r != Result.SUCCESS) {
|
||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
|
|
||||||
r = writer.get().WriteScope("headers", BatchRequestHeadersSerializer.TypeArg, operation.Headers,
|
r = writer.get().WriteScope("headers", BatchRequestHeadersSerializer.TypeArg, operation.Headers,
|
||||||
BatchRequestHeadersSerializer.Write);
|
BatchRequestHeadersSerializer.Write);
|
||||||
if (r != Result.SUCCESS) {
|
if (r != Result.SUCCESS) {
|
||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
|
|
||||||
r = writer.get().WriteInt32("resourceType", operation.ResourceType);
|
r = writer.get().WriteInt32("resourceType", operation.ResourceType);
|
||||||
if (r != Result.SUCCESS) {
|
if (r != Result.SUCCESS) {
|
||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
|
|
||||||
r = writer.get().WriteString("resourcePath", operation.ResourcePath);
|
r = writer.get().WriteString("resourcePath", operation.ResourcePath);
|
||||||
if (r != Result.SUCCESS) {
|
if (r != Result.SUCCESS) {
|
||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
|
|
||||||
r = writer.get().WriteBinary("resourceBody", operation.ResourceBody);
|
r = writer.get().WriteBinary("resourceBody", operation.ResourceBody);
|
||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public final static class BatchRequest {
|
public final static class BatchRequest {
|
||||||
public ArrayList<BatchOperation> Operations;
|
public ArrayList<BatchOperation> Operations;
|
||||||
}
|
}
|
||||||
|
|
||||||
public final static class BatchRequestHeaders {
|
public final static class BatchRequestHeaders {
|
||||||
public long SampleRequestHeader;
|
public long SampleRequestHeader;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class BatchRequestHeadersSerializer {
|
public static class BatchRequestHeadersSerializer {
|
||||||
public static final TypeArgument TypeArg = new TypeArgument(LayoutType.UDT,
|
public static final TypeArgument TypeArg = new TypeArgument(LayoutType.UDT,
|
||||||
new TypeArgumentList(new SchemaId(1)));
|
new TypeArgumentList(new SchemaId(1)));
|
||||||
|
|
||||||
public static Result Read(Reference<RowReader> reader,
|
public static Result Read(Reference<RowReader> reader,
|
||||||
Out<BatchRequestHeaders> header) {
|
Out<BatchRequestHeaders> header) {
|
||||||
BatchRequestHeaders retval = new BatchRequestHeaders();
|
BatchRequestHeaders retval = new BatchRequestHeaders();
|
||||||
header.setAndGet(null);
|
header.setAndGet(null);
|
||||||
while (reader.get().read()) {
|
while (reader.get().read()) {
|
||||||
switch (reader.get().path()) {
|
switch (reader.get().path()) {
|
||||||
case "sampleRequestHeader":
|
case "sampleRequestHeader":
|
||||||
Out<Long> tempOut_SampleRequestHeader = new Out<Long>();
|
Out<Long> tempOut_SampleRequestHeader = new Out<Long>();
|
||||||
Result r = reader.get().readInt64(tempOut_SampleRequestHeader);
|
Result r = reader.get().readInt64(tempOut_SampleRequestHeader);
|
||||||
retval.SampleRequestHeader = tempOut_SampleRequestHeader.get();
|
retval.SampleRequestHeader = tempOut_SampleRequestHeader.get();
|
||||||
if (r != Result.SUCCESS) {
|
if (r != Result.SUCCESS) {
|
||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
header.setAndGet(retval);
|
header.setAndGet(retval);
|
||||||
return Result.SUCCESS;
|
return Result.SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Result Write(Reference<RowWriter> writer, TypeArgument typeArg,
|
public static Result Write(Reference<RowWriter> writer, TypeArgument typeArg,
|
||||||
BatchRequestHeaders header) {
|
BatchRequestHeaders header) {
|
||||||
Result r = writer.get().WriteInt64("sampleRequestHeader", header.SampleRequestHeader);
|
Result r = writer.get().WriteInt64("sampleRequestHeader", header.SampleRequestHeader);
|
||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class BatchRequestSerializer {
|
public static class BatchRequestSerializer {
|
||||||
public static final TypeArgument OperationsTypeArg = new TypeArgument(LayoutType.TypedArray, new TypeArgumentList(new TypeArgument[] { BatchOperationSerializer.TypeArg }));
|
public static final TypeArgument OperationsTypeArg = new TypeArgument(LayoutType.TypedArray, new TypeArgumentList(new TypeArgument[] { BatchOperationSerializer.TypeArg }));
|
||||||
|
|
||||||
public static Result Read(Reference<RowReader> reader, Out<BatchRequest> request) {
|
public static Result Read(Reference<RowReader> reader, Out<BatchRequest> request) {
|
||||||
assert reader.get().read();
|
assert reader.get().read();
|
||||||
checkState(reader.get().path().equals("operations"));
|
checkState(reader.get().path().equals("operations"));
|
||||||
|
|
||||||
java.util.ArrayList<BatchOperation> operations;
|
java.util.ArrayList<BatchOperation> operations;
|
||||||
Out<ArrayList<TItem>> tempOut_operations = new Out<ArrayList<TItem>>();
|
Out<ArrayList<TItem>> tempOut_operations = new Out<ArrayList<TItem>>();
|
||||||
Result r = RowReaderExtensions.readList(reader.get().clone(), BatchOperationSerializer.Read, tempOut_operations);
|
Result r = RowReaderExtensions.readList(reader.get().clone(), BatchOperationSerializer.Read, tempOut_operations);
|
||||||
operations = tempOut_operations.get();
|
operations = tempOut_operations.get();
|
||||||
if (r != Result.SUCCESS) {
|
if (r != Result.SUCCESS) {
|
||||||
request.setAndGet(null);
|
request.setAndGet(null);
|
||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
|
|
||||||
request.setAndGet(new BatchRequest());
|
request.setAndGet(new BatchRequest());
|
||||||
request.get().Operations = operations;
|
request.get().Operations = operations;
|
||||||
|
|
||||||
return Result.SUCCESS;
|
return Result.SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Result Write(Reference<RowWriter> writer, TypeArgument typeArg, BatchRequest request) {
|
public static Result Write(Reference<RowWriter> writer, TypeArgument typeArg, BatchRequest request) {
|
||||||
// TODO: C# TO JAVA CONVERTER: The following lambda contained an unresolved 'ref' keyword - these are not converted by C# to Java Converter:
|
// TODO: C# TO JAVA CONVERTER: The following lambda contained an unresolved 'ref' keyword - these are not converted by C# to Java Converter:
|
||||||
return writer.get().WriteScope("operations", BatchRequestSerializer.OperationsTypeArg, request.Operations, (ref RowWriter writer2, TypeArgument typeArg2, ArrayList<BatchOperation> operations) ->
|
return writer.get().WriteScope("operations", BatchRequestSerializer.OperationsTypeArg, request.Operations, (ref RowWriter writer2, TypeArgument typeArg2, ArrayList<BatchOperation> operations) ->
|
||||||
{
|
{
|
||||||
for (BatchOperation operation : operations) {
|
for (BatchOperation operation : operations) {
|
||||||
Result r = writer2.WriteScope(null, BatchOperationSerializer.TypeArg, operation, BatchOperationSerializer.Write);
|
Result r = writer2.WriteScope(null, BatchOperationSerializer.TypeArg, operation, BatchOperationSerializer.Write);
|
||||||
if (r != Result.SUCCESS) {
|
if (r != Result.SUCCESS) {
|
||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return Result.SUCCESS;
|
return Result.SUCCESS;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public final static class BatchResponse {
|
public final static class BatchResponse {
|
||||||
public ArrayList<BatchOperationResponse> Operations;
|
public ArrayList<BatchOperationResponse> Operations;
|
||||||
}
|
}
|
||||||
|
|
||||||
public final static class BatchResponseHeaders {
|
public final static class BatchResponseHeaders {
|
||||||
public String SampleResponseHeader;
|
public String SampleResponseHeader;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+255
-255
@@ -1,256 +1,256 @@
|
|||||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||||
// Licensed under the MIT License.
|
// Licensed under the MIT License.
|
||||||
|
|
||||||
package com.azure.data.cosmos.serialization.hybridrow.unit;
|
package com.azure.data.cosmos.serialization.hybridrow.unit;
|
||||||
|
|
||||||
import com.azure.data.cosmos.core.Reference;
|
import com.azure.data.cosmos.core.Reference;
|
||||||
import com.azure.data.cosmos.serialization.hybridrow.HybridRowVersion;
|
import com.azure.data.cosmos.serialization.hybridrow.HybridRowVersion;
|
||||||
import com.azure.data.cosmos.serialization.hybridrow.Result;
|
import com.azure.data.cosmos.serialization.hybridrow.Result;
|
||||||
import com.azure.data.cosmos.serialization.hybridrow.RowBuffer;
|
import com.azure.data.cosmos.serialization.hybridrow.RowBuffer;
|
||||||
import com.azure.data.cosmos.serialization.hybridrow.RowCursor;
|
import com.azure.data.cosmos.serialization.hybridrow.RowCursor;
|
||||||
|
|
||||||
import java.nio.file.Files;
|
import java.nio.file.Files;
|
||||||
|
|
||||||
// TODO: C# TO JAVA CONVERTER: Java annotations will not correspond to .NET attributes:
|
// TODO: C# TO JAVA CONVERTER: Java annotations will not correspond to .NET attributes:
|
||||||
//ORIGINAL LINE: [TestClass][DeploymentItem(TaggedUnitTests.SchemaFile, "TestData")] public sealed class TaggedUnitTests
|
//ORIGINAL LINE: [TestClass][DeploymentItem(TaggedUnitTests.SchemaFile, "TestData")] public sealed class TaggedUnitTests
|
||||||
public final class TaggedUnitTests {
|
public final class TaggedUnitTests {
|
||||||
private static final int InitialRowSize = 2 * 1024 * 1024;
|
private static final int InitialRowSize = 2 * 1024 * 1024;
|
||||||
private static final String SchemaFile = "TestData\\TaggedApiSchema.json";
|
private static final String SchemaFile = "TestData\\TaggedApiSchema.json";
|
||||||
private Layout layout;
|
private Layout layout;
|
||||||
private LayoutResolver resolver;
|
private LayoutResolver resolver;
|
||||||
private Namespace schema;
|
private Namespace schema;
|
||||||
|
|
||||||
// TODO: C# TO JAVA CONVERTER: Java annotations will not correspond to .NET attributes:
|
// TODO: C# TO JAVA CONVERTER: Java annotations will not correspond to .NET attributes:
|
||||||
//ORIGINAL LINE: [TestMethod][Owner("jthunter")] public void CreateTaggedApi()
|
//ORIGINAL LINE: [TestMethod][Owner("jthunter")] public void CreateTaggedApi()
|
||||||
public void CreateTaggedApi() {
|
public void CreateTaggedApi() {
|
||||||
RowBuffer row = new RowBuffer(TaggedUnitTests.InitialRowSize);
|
RowBuffer row = new RowBuffer(TaggedUnitTests.InitialRowSize);
|
||||||
row.initLayout(HybridRowVersion.V1, this.layout, this.resolver);
|
row.initLayout(HybridRowVersion.V1, this.layout, this.resolver);
|
||||||
|
|
||||||
TaggedApi c1 = new TaggedApi();
|
TaggedApi c1 = new TaggedApi();
|
||||||
//C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java:
|
//C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java:
|
||||||
//ORIGINAL LINE: c1.Tag1 = ((byte)1, "hello");
|
//ORIGINAL LINE: c1.Tag1 = ((byte)1, "hello");
|
||||||
c1.Tag1 = ((byte)1, "hello")
|
c1.Tag1 = ((byte)1, "hello")
|
||||||
//C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java:
|
//C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java:
|
||||||
//ORIGINAL LINE: c1.Tag2 = ((byte)2, 28, 1974L);
|
//ORIGINAL LINE: c1.Tag2 = ((byte)2, 28, 1974L);
|
||||||
c1.Tag2 = ((byte)2, 28, 1974L)
|
c1.Tag2 = ((byte)2, 28, 1974L)
|
||||||
|
|
||||||
Reference<RowBuffer> tempReference_row =
|
Reference<RowBuffer> tempReference_row =
|
||||||
new Reference<RowBuffer>(row);
|
new Reference<RowBuffer>(row);
|
||||||
Reference<RowBuffer> tempReference_row2 =
|
Reference<RowBuffer> tempReference_row2 =
|
||||||
new Reference<RowBuffer>(row);
|
new Reference<RowBuffer>(row);
|
||||||
RowCursor _;
|
RowCursor _;
|
||||||
// TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'out' keyword - these
|
// TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'out' keyword - these
|
||||||
// cannot be converted using the 'Out' helper class unless the method is within the code being modified:
|
// cannot be converted using the 'Out' helper class unless the method is within the code being modified:
|
||||||
this.WriteTaggedApi(tempReference_row, RowCursor.create(tempReference_row2, out _), c1);
|
this.WriteTaggedApi(tempReference_row, RowCursor.create(tempReference_row2, out _), c1);
|
||||||
row = tempReference_row2.get();
|
row = tempReference_row2.get();
|
||||||
row = tempReference_row.get();
|
row = tempReference_row.get();
|
||||||
Reference<RowBuffer> tempReference_row3 =
|
Reference<RowBuffer> tempReference_row3 =
|
||||||
new Reference<RowBuffer>(row);
|
new Reference<RowBuffer>(row);
|
||||||
Reference<RowBuffer> tempReference_row4 =
|
Reference<RowBuffer> tempReference_row4 =
|
||||||
new Reference<RowBuffer>(row);
|
new Reference<RowBuffer>(row);
|
||||||
RowCursor _;
|
RowCursor _;
|
||||||
// TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'out' keyword - these
|
// TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'out' keyword - these
|
||||||
// cannot be converted using the 'Out' helper class unless the method is within the code being modified:
|
// cannot be converted using the 'Out' helper class unless the method is within the code being modified:
|
||||||
TaggedApi c2 = this.ReadTaggedApi(tempReference_row3, RowCursor.create(tempReference_row4, out _));
|
TaggedApi c2 = this.ReadTaggedApi(tempReference_row3, RowCursor.create(tempReference_row4, out _));
|
||||||
row = tempReference_row4.get();
|
row = tempReference_row4.get();
|
||||||
row = tempReference_row3.get();
|
row = tempReference_row3.get();
|
||||||
assert c1 == c2;
|
assert c1 == c2;
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: C# TO JAVA CONVERTER: Java annotations will not correspond to .NET attributes:
|
// TODO: C# TO JAVA CONVERTER: Java annotations will not correspond to .NET attributes:
|
||||||
//ORIGINAL LINE: [TestInitialize] public void ParseNamespaceExample()
|
//ORIGINAL LINE: [TestInitialize] public void ParseNamespaceExample()
|
||||||
public void ParseNamespaceExample() {
|
public void ParseNamespaceExample() {
|
||||||
String json = Files.readString(TaggedUnitTests.SchemaFile);
|
String json = Files.readString(TaggedUnitTests.SchemaFile);
|
||||||
this.schema = Namespace.Parse(json);
|
this.schema = Namespace.Parse(json);
|
||||||
this.resolver = new LayoutResolverNamespace(this.schema);
|
this.resolver = new LayoutResolverNamespace(this.schema);
|
||||||
this.layout = this.resolver.Resolve(tangible.ListHelper.find(this.schema.getSchemas(), x -> x.Name.equals(
|
this.layout = this.resolver.Resolve(tangible.ListHelper.find(this.schema.getSchemas(), x -> x.Name.equals(
|
||||||
"TaggedApi")).SchemaId);
|
"TaggedApi")).SchemaId);
|
||||||
}
|
}
|
||||||
|
|
||||||
private TaggedApi ReadTaggedApi(Reference<RowBuffer> row, Reference<RowCursor> root) {
|
private TaggedApi ReadTaggedApi(Reference<RowBuffer> row, Reference<RowCursor> root) {
|
||||||
TaggedApi pc = new TaggedApi();
|
TaggedApi pc = new TaggedApi();
|
||||||
|
|
||||||
LayoutColumn c;
|
LayoutColumn c;
|
||||||
// TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'out' keyword - these
|
// TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'out' keyword - these
|
||||||
// cannot be converted using the 'Out' helper class unless the method is within the code being modified:
|
// cannot be converted using the 'Out' helper class unless the method is within the code being modified:
|
||||||
assert this.layout.TryFind("tag1", out c);
|
assert this.layout.TryFind("tag1", out c);
|
||||||
assert c.Type.Immutable;
|
assert c.Type.Immutable;
|
||||||
RowCursor tag1Scope;
|
RowCursor tag1Scope;
|
||||||
// TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'out' keyword - these
|
// TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'out' keyword - these
|
||||||
// cannot be converted using the 'Out' helper class unless the method is within the code being modified:
|
// cannot be converted using the 'Out' helper class unless the method is within the code being modified:
|
||||||
root.get().Clone(out tag1Scope).Find(row, c.Path);
|
root.get().Clone(out tag1Scope).Find(row, c.Path);
|
||||||
// TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'out' keyword - these
|
// TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'out' keyword - these
|
||||||
// cannot be converted using the 'Out' helper class unless the method is within the code being modified:
|
// cannot be converted using the 'Out' helper class unless the method is within the code being modified:
|
||||||
// TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'ref' keyword - these
|
// TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'ref' keyword - these
|
||||||
// cannot be converted using the 'Ref' helper class unless the method is within the code being modified:
|
// cannot be converted using the 'Ref' helper class unless the method is within the code being modified:
|
||||||
if (c.<LayoutIndexedScope>TypeAs().ReadScope(row, ref tag1Scope, out tag1Scope) == Result.SUCCESS) {
|
if (c.<LayoutIndexedScope>TypeAs().ReadScope(row, ref tag1Scope, out tag1Scope) == Result.SUCCESS) {
|
||||||
assert tag1Scope.Immutable;
|
assert tag1Scope.Immutable;
|
||||||
assert tag1Scope.MoveNext(row);
|
assert tag1Scope.MoveNext(row);
|
||||||
byte apiCode;
|
byte apiCode;
|
||||||
// TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'out' keyword - these
|
// TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'out' keyword - these
|
||||||
// cannot be converted using the 'Out' helper class unless the method is within the code being
|
// cannot be converted using the 'Out' helper class unless the method is within the code being
|
||||||
// modified:
|
// modified:
|
||||||
// TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'ref' keyword - these
|
// TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'ref' keyword - these
|
||||||
// cannot be converted using the 'Ref' helper class unless the method is within the code being
|
// cannot be converted using the 'Ref' helper class unless the method is within the code being
|
||||||
// modified:
|
// modified:
|
||||||
//C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java:
|
//C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java:
|
||||||
//ORIGINAL LINE: ResultAssert.IsSuccess(c.TypeArgs[0].Type.TypeAs<LayoutUInt8>().ReadSparse(ref row, ref
|
//ORIGINAL LINE: ResultAssert.IsSuccess(c.TypeArgs[0].Type.TypeAs<LayoutUInt8>().ReadSparse(ref row, ref
|
||||||
// tag1Scope, out byte apiCode));
|
// tag1Scope, out byte apiCode));
|
||||||
ResultAssert.IsSuccess(c.TypeArgs[0].Type.<LayoutUInt8>TypeAs().ReadSparse(row, ref tag1Scope,
|
ResultAssert.IsSuccess(c.TypeArgs[0].Type.<LayoutUInt8>TypeAs().ReadSparse(row, ref tag1Scope,
|
||||||
out apiCode));
|
out apiCode));
|
||||||
assert tag1Scope.MoveNext(row);
|
assert tag1Scope.MoveNext(row);
|
||||||
String str;
|
String str;
|
||||||
// TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'out' keyword - these
|
// TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'out' keyword - these
|
||||||
// cannot be converted using the 'Out' helper class unless the method is within the code being
|
// cannot be converted using the 'Out' helper class unless the method is within the code being
|
||||||
// modified:
|
// modified:
|
||||||
// TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'ref' keyword - these
|
// TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'ref' keyword - these
|
||||||
// cannot be converted using the 'Ref' helper class unless the method is within the code being
|
// cannot be converted using the 'Ref' helper class unless the method is within the code being
|
||||||
// modified:
|
// modified:
|
||||||
ResultAssert.IsSuccess(c.TypeArgs[1].Type.<LayoutUtf8>TypeAs().ReadSparse(row, ref tag1Scope, out str));
|
ResultAssert.IsSuccess(c.TypeArgs[1].Type.<LayoutUtf8>TypeAs().ReadSparse(row, ref tag1Scope, out str));
|
||||||
pc.Tag1 = (apiCode, str)
|
pc.Tag1 = (apiCode, str)
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'out' keyword - these
|
// TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'out' keyword - these
|
||||||
// cannot be converted using the 'Out' helper class unless the method is within the code being modified:
|
// cannot be converted using the 'Out' helper class unless the method is within the code being modified:
|
||||||
assert this.layout.TryFind("tag2", out c);
|
assert this.layout.TryFind("tag2", out c);
|
||||||
assert !c.Type.Immutable;
|
assert !c.Type.Immutable;
|
||||||
RowCursor tag2Scope;
|
RowCursor tag2Scope;
|
||||||
// TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'out' keyword - these
|
// TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'out' keyword - these
|
||||||
// cannot be converted using the 'Out' helper class unless the method is within the code being modified:
|
// cannot be converted using the 'Out' helper class unless the method is within the code being modified:
|
||||||
root.get().Clone(out tag2Scope).Find(row, c.Path);
|
root.get().Clone(out tag2Scope).Find(row, c.Path);
|
||||||
// TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'out' keyword - these
|
// TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'out' keyword - these
|
||||||
// cannot be converted using the 'Out' helper class unless the method is within the code being modified:
|
// cannot be converted using the 'Out' helper class unless the method is within the code being modified:
|
||||||
// TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'ref' keyword - these
|
// TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'ref' keyword - these
|
||||||
// cannot be converted using the 'Ref' helper class unless the method is within the code being modified:
|
// cannot be converted using the 'Ref' helper class unless the method is within the code being modified:
|
||||||
if (c.<LayoutIndexedScope>TypeAs().ReadScope(row, ref tag2Scope, out tag2Scope) == Result.SUCCESS) {
|
if (c.<LayoutIndexedScope>TypeAs().ReadScope(row, ref tag2Scope, out tag2Scope) == Result.SUCCESS) {
|
||||||
assert !tag2Scope.Immutable;
|
assert !tag2Scope.Immutable;
|
||||||
assert tag2Scope.MoveNext(row);
|
assert tag2Scope.MoveNext(row);
|
||||||
byte apiCode;
|
byte apiCode;
|
||||||
// TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'out' keyword - these
|
// TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'out' keyword - these
|
||||||
// cannot be converted using the 'Out' helper class unless the method is within the code being
|
// cannot be converted using the 'Out' helper class unless the method is within the code being
|
||||||
// modified:
|
// modified:
|
||||||
// TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'ref' keyword - these
|
// TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'ref' keyword - these
|
||||||
// cannot be converted using the 'Ref' helper class unless the method is within the code being
|
// cannot be converted using the 'Ref' helper class unless the method is within the code being
|
||||||
// modified:
|
// modified:
|
||||||
//C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java:
|
//C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java:
|
||||||
//ORIGINAL LINE: ResultAssert.IsSuccess(c.TypeArgs[0].Type.TypeAs<LayoutUInt8>().ReadSparse(ref row, ref
|
//ORIGINAL LINE: ResultAssert.IsSuccess(c.TypeArgs[0].Type.TypeAs<LayoutUInt8>().ReadSparse(ref row, ref
|
||||||
// tag2Scope, out byte apiCode));
|
// tag2Scope, out byte apiCode));
|
||||||
ResultAssert.IsSuccess(c.TypeArgs[0].Type.<LayoutUInt8>TypeAs().ReadSparse(row, ref tag2Scope,
|
ResultAssert.IsSuccess(c.TypeArgs[0].Type.<LayoutUInt8>TypeAs().ReadSparse(row, ref tag2Scope,
|
||||||
out apiCode));
|
out apiCode));
|
||||||
assert tag2Scope.MoveNext(row);
|
assert tag2Scope.MoveNext(row);
|
||||||
int val1;
|
int val1;
|
||||||
// TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'out' keyword - these
|
// TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'out' keyword - these
|
||||||
// cannot be converted using the 'Out' helper class unless the method is within the code being
|
// cannot be converted using the 'Out' helper class unless the method is within the code being
|
||||||
// modified:
|
// modified:
|
||||||
// TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'ref' keyword - these
|
// TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'ref' keyword - these
|
||||||
// cannot be converted using the 'Ref' helper class unless the method is within the code being
|
// cannot be converted using the 'Ref' helper class unless the method is within the code being
|
||||||
// modified:
|
// modified:
|
||||||
ResultAssert.IsSuccess(c.TypeArgs[1].Type.<LayoutInt32>TypeAs().ReadSparse(row, ref tag2Scope, out val1));
|
ResultAssert.IsSuccess(c.TypeArgs[1].Type.<LayoutInt32>TypeAs().ReadSparse(row, ref tag2Scope, out val1));
|
||||||
assert tag2Scope.MoveNext(row);
|
assert tag2Scope.MoveNext(row);
|
||||||
long val2;
|
long val2;
|
||||||
// TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'out' keyword - these
|
// TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'out' keyword - these
|
||||||
// cannot be converted using the 'Out' helper class unless the method is within the code being
|
// cannot be converted using the 'Out' helper class unless the method is within the code being
|
||||||
// modified:
|
// modified:
|
||||||
// TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'ref' keyword - these
|
// TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'ref' keyword - these
|
||||||
// cannot be converted using the 'Ref' helper class unless the method is within the code being
|
// cannot be converted using the 'Ref' helper class unless the method is within the code being
|
||||||
// modified:
|
// modified:
|
||||||
ResultAssert.IsSuccess(c.TypeArgs[2].Type.<LayoutInt64>TypeAs().ReadSparse(row, ref tag2Scope, out val2));
|
ResultAssert.IsSuccess(c.TypeArgs[2].Type.<LayoutInt64>TypeAs().ReadSparse(row, ref tag2Scope, out val2));
|
||||||
pc.Tag2 = (apiCode, val1, val2)
|
pc.Tag2 = (apiCode, val1, val2)
|
||||||
}
|
}
|
||||||
|
|
||||||
return pc;
|
return pc;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void WriteTaggedApi(Reference<RowBuffer> row, Reference<RowCursor> root, TaggedApi pc) {
|
private void WriteTaggedApi(Reference<RowBuffer> row, Reference<RowCursor> root, TaggedApi pc) {
|
||||||
LayoutColumn c;
|
LayoutColumn c;
|
||||||
// TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'out' keyword - these
|
// TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'out' keyword - these
|
||||||
// cannot be converted using the 'Out' helper class unless the method is within the code being modified:
|
// cannot be converted using the 'Out' helper class unless the method is within the code being modified:
|
||||||
assert this.layout.TryFind("tag1", out c);
|
assert this.layout.TryFind("tag1", out c);
|
||||||
RowCursor tag1Scope;
|
RowCursor tag1Scope;
|
||||||
// TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'out' keyword - these
|
// TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'out' keyword - these
|
||||||
// cannot be converted using the 'Out' helper class unless the method is within the code being modified:
|
// cannot be converted using the 'Out' helper class unless the method is within the code being modified:
|
||||||
root.get().Clone(out tag1Scope).Find(row, c.Path);
|
root.get().Clone(out tag1Scope).Find(row, c.Path);
|
||||||
// TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'out' keyword - these
|
// TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'out' keyword - these
|
||||||
// cannot be converted using the 'Out' helper class unless the method is within the code being modified:
|
// cannot be converted using the 'Out' helper class unless the method is within the code being modified:
|
||||||
// TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'ref' keyword - these
|
// TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'ref' keyword - these
|
||||||
// cannot be converted using the 'Ref' helper class unless the method is within the code being modified:
|
// cannot be converted using the 'Ref' helper class unless the method is within the code being modified:
|
||||||
ResultAssert.IsSuccess(c.<LayoutIndexedScope>TypeAs().WriteScope(row, ref tag1Scope, c.TypeArgs,
|
ResultAssert.IsSuccess(c.<LayoutIndexedScope>TypeAs().WriteScope(row, ref tag1Scope, c.TypeArgs,
|
||||||
out tag1Scope));
|
out tag1Scope));
|
||||||
// TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'ref' keyword - these
|
// TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'ref' keyword - these
|
||||||
// cannot be converted using the 'Ref' helper class unless the method is within the code being modified:
|
// cannot be converted using the 'Ref' helper class unless the method is within the code being modified:
|
||||||
ResultAssert.IsSuccess(c.TypeArgs[0].Type.<LayoutUInt8>TypeAs().WriteSparse(row, ref tag1Scope, pc.Tag1.Item1));
|
ResultAssert.IsSuccess(c.TypeArgs[0].Type.<LayoutUInt8>TypeAs().WriteSparse(row, ref tag1Scope, pc.Tag1.Item1));
|
||||||
assert tag1Scope.MoveNext(row);
|
assert tag1Scope.MoveNext(row);
|
||||||
// TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'ref' keyword - these
|
// TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'ref' keyword - these
|
||||||
// cannot be converted using the 'Ref' helper class unless the method is within the code being modified:
|
// cannot be converted using the 'Ref' helper class unless the method is within the code being modified:
|
||||||
ResultAssert.IsSuccess(c.TypeArgs[1].Type.<LayoutUtf8>TypeAs().WriteSparse(row, ref tag1Scope, pc.Tag1.Item2));
|
ResultAssert.IsSuccess(c.TypeArgs[1].Type.<LayoutUtf8>TypeAs().WriteSparse(row, ref tag1Scope, pc.Tag1.Item2));
|
||||||
|
|
||||||
// TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'out' keyword - these
|
// TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'out' keyword - these
|
||||||
// cannot be converted using the 'Out' helper class unless the method is within the code being modified:
|
// cannot be converted using the 'Out' helper class unless the method is within the code being modified:
|
||||||
assert this.layout.TryFind("tag2", out c);
|
assert this.layout.TryFind("tag2", out c);
|
||||||
RowCursor tag2Scope;
|
RowCursor tag2Scope;
|
||||||
// TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'out' keyword - these
|
// TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'out' keyword - these
|
||||||
// cannot be converted using the 'Out' helper class unless the method is within the code being modified:
|
// cannot be converted using the 'Out' helper class unless the method is within the code being modified:
|
||||||
root.get().Clone(out tag2Scope).Find(row, c.Path);
|
root.get().Clone(out tag2Scope).Find(row, c.Path);
|
||||||
// TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'out' keyword - these
|
// TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'out' keyword - these
|
||||||
// cannot be converted using the 'Out' helper class unless the method is within the code being modified:
|
// cannot be converted using the 'Out' helper class unless the method is within the code being modified:
|
||||||
// TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'ref' keyword - these
|
// TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'ref' keyword - these
|
||||||
// cannot be converted using the 'Ref' helper class unless the method is within the code being modified:
|
// cannot be converted using the 'Ref' helper class unless the method is within the code being modified:
|
||||||
ResultAssert.IsSuccess(c.<LayoutIndexedScope>TypeAs().WriteScope(row, ref tag2Scope, c.TypeArgs,
|
ResultAssert.IsSuccess(c.<LayoutIndexedScope>TypeAs().WriteScope(row, ref tag2Scope, c.TypeArgs,
|
||||||
out tag2Scope));
|
out tag2Scope));
|
||||||
// TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'ref' keyword - these
|
// TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'ref' keyword - these
|
||||||
// cannot be converted using the 'Ref' helper class unless the method is within the code being modified:
|
// cannot be converted using the 'Ref' helper class unless the method is within the code being modified:
|
||||||
ResultAssert.IsSuccess(c.TypeArgs[0].Type.<LayoutUInt8>TypeAs().WriteSparse(row, ref tag2Scope, pc.Tag2.Item1));
|
ResultAssert.IsSuccess(c.TypeArgs[0].Type.<LayoutUInt8>TypeAs().WriteSparse(row, ref tag2Scope, pc.Tag2.Item1));
|
||||||
assert tag2Scope.MoveNext(row);
|
assert tag2Scope.MoveNext(row);
|
||||||
// TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'ref' keyword - these
|
// TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'ref' keyword - these
|
||||||
// cannot be converted using the 'Ref' helper class unless the method is within the code being modified:
|
// cannot be converted using the 'Ref' helper class unless the method is within the code being modified:
|
||||||
ResultAssert.IsSuccess(c.TypeArgs[1].Type.<LayoutInt32>TypeAs().WriteSparse(row, ref tag2Scope, pc.Tag2.Item2));
|
ResultAssert.IsSuccess(c.TypeArgs[1].Type.<LayoutInt32>TypeAs().WriteSparse(row, ref tag2Scope, pc.Tag2.Item2));
|
||||||
assert tag2Scope.MoveNext(row);
|
assert tag2Scope.MoveNext(row);
|
||||||
// TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'ref' keyword - these
|
// TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'ref' keyword - these
|
||||||
// cannot be converted using the 'Ref' helper class unless the method is within the code being modified:
|
// cannot be converted using the 'Ref' helper class unless the method is within the code being modified:
|
||||||
ResultAssert.IsSuccess(c.TypeArgs[2].Type.<LayoutInt64>TypeAs().WriteSparse(row, ref tag2Scope, pc.Tag2.Item3));
|
ResultAssert.IsSuccess(c.TypeArgs[2].Type.<LayoutInt64>TypeAs().WriteSparse(row, ref tag2Scope, pc.Tag2.Item3));
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: C# TO JAVA CONVERTER: Java annotations will not correspond to .NET attributes:
|
// TODO: C# TO JAVA CONVERTER: Java annotations will not correspond to .NET attributes:
|
||||||
//ORIGINAL LINE: [SuppressMessage("Microsoft.StyleCop.CSharp.OrderingRules", "SA1401", Justification = "Test
|
//ORIGINAL LINE: [SuppressMessage("Microsoft.StyleCop.CSharp.OrderingRules", "SA1401", Justification = "Test
|
||||||
// types.")] private sealed class TaggedApi
|
// types.")] private sealed class TaggedApi
|
||||||
private final static class TaggedApi {
|
private final static class TaggedApi {
|
||||||
//C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java:
|
//C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java:
|
||||||
//ORIGINAL LINE: public (byte, string) Tag1;
|
//ORIGINAL LINE: public (byte, string) Tag1;
|
||||||
public (byte,String)Tag1
|
public (byte,String)Tag1
|
||||||
//C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java:
|
//C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java:
|
||||||
//ORIGINAL LINE: public (byte, int, long) Tag2;
|
//ORIGINAL LINE: public (byte, int, long) Tag2;
|
||||||
public (byte,int,long)Tag2
|
public (byte,int,long)Tag2
|
||||||
|
|
||||||
// ReSharper disable once MemberCanBePrivate.Local
|
// ReSharper disable once MemberCanBePrivate.Local
|
||||||
public boolean equals(TaggedApi other) {
|
public boolean equals(TaggedApi other) {
|
||||||
return this.Tag1.equals(other.Tag1) && this.Tag2.equals(other.Tag2);
|
return this.Tag1.equals(other.Tag1) && this.Tag2.equals(other.Tag2);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean equals(Object obj) {
|
public boolean equals(Object obj) {
|
||||||
if (null == obj) {
|
if (null == obj) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this == obj) {
|
if (this == obj) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
boolean tempVar = obj instanceof TaggedApi;
|
boolean tempVar = obj instanceof TaggedApi;
|
||||||
TaggedApi taggedApi = tempVar ? (TaggedApi)obj : null;
|
TaggedApi taggedApi = tempVar ? (TaggedApi)obj : null;
|
||||||
return tempVar && this.equals(taggedApi);
|
return tempVar && this.equals(taggedApi);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int hashCode() {
|
public int hashCode() {
|
||||||
// TODO: C# TO JAVA CONVERTER: There is no equivalent to an 'unchecked' block in Java:
|
// TODO: C# TO JAVA CONVERTER: There is no equivalent to an 'unchecked' block in Java:
|
||||||
unchecked
|
unchecked
|
||||||
{
|
{
|
||||||
int hashCode = 0;
|
int hashCode = 0;
|
||||||
hashCode = (hashCode * 397) ^ this.Tag1.hashCode();
|
hashCode = (hashCode * 397) ^ this.Tag1.hashCode();
|
||||||
hashCode = (hashCode * 397) ^ this.Tag2.hashCode();
|
hashCode = (hashCode * 397) ^ this.Tag2.hashCode();
|
||||||
return hashCode;
|
return hashCode;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+1103
-1103
File diff suppressed because it is too large
Load Diff
+662
-662
File diff suppressed because it is too large
Load Diff
+1574
-1574
File diff suppressed because it is too large
Load Diff
+1994
-1994
File diff suppressed because it is too large
Load Diff
+19
-19
@@ -1,20 +1,20 @@
|
|||||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||||
// Licensed under the MIT License.
|
// Licensed under the MIT License.
|
||||||
|
|
||||||
package com.azure.data.cosmos.serialization.hybridrow.unit;
|
package com.azure.data.cosmos.serialization.hybridrow.unit;
|
||||||
|
|
||||||
import com.azure.data.cosmos.serialization.hybridrow.RowOptions;
|
import com.azure.data.cosmos.serialization.hybridrow.RowOptions;
|
||||||
|
|
||||||
// TODO: C# TO JAVA CONVERTER: Java annotations will not correspond to .NET attributes:
|
// TODO: C# TO JAVA CONVERTER: Java annotations will not correspond to .NET attributes:
|
||||||
//ORIGINAL LINE: [TestClass] public class UpdateOptionsUnitTests
|
//ORIGINAL LINE: [TestClass] public class UpdateOptionsUnitTests
|
||||||
public class UpdateOptionsUnitTests {
|
public class UpdateOptionsUnitTests {
|
||||||
// TODO: C# TO JAVA CONVERTER: Java annotations will not correspond to .NET attributes:
|
// TODO: C# TO JAVA CONVERTER: Java annotations will not correspond to .NET attributes:
|
||||||
//ORIGINAL LINE: [TestMethod][Owner("jthunter")] public void UpdateOptionsTest()
|
//ORIGINAL LINE: [TestMethod][Owner("jthunter")] public void UpdateOptionsTest()
|
||||||
public final void UpdateOptionsTest() {
|
public final void UpdateOptionsTest() {
|
||||||
assert RowOptions.NONE.value() == UpdateOptions.None.getValue();
|
assert RowOptions.NONE.value() == UpdateOptions.None.getValue();
|
||||||
assert RowOptions.UPDATE.value() == UpdateOptions.Update.getValue();
|
assert RowOptions.UPDATE.value() == UpdateOptions.Update.getValue();
|
||||||
assert RowOptions.INSERT.value() == UpdateOptions.Insert.getValue();
|
assert RowOptions.INSERT.value() == UpdateOptions.Insert.getValue();
|
||||||
assert RowOptions.UPSERT.value() == UpdateOptions.Upsert.getValue();
|
assert RowOptions.UPSERT.value() == UpdateOptions.Upsert.getValue();
|
||||||
assert RowOptions.INSERT_AT.value() == UpdateOptions.InsertAt.getValue();
|
assert RowOptions.INSERT_AT.value() == UpdateOptions.InsertAt.getValue();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+246
-246
@@ -1,247 +1,247 @@
|
|||||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||||
// Licensed under the MIT License.
|
// Licensed under the MIT License.
|
||||||
|
|
||||||
package com.azure.data.cosmos.serialization.hybridrow.unit;
|
package com.azure.data.cosmos.serialization.hybridrow.unit;
|
||||||
|
|
||||||
import com.azure.data.cosmos.core.Out;
|
import com.azure.data.cosmos.core.Out;
|
||||||
import com.azure.data.cosmos.core.Reference;
|
import com.azure.data.cosmos.core.Reference;
|
||||||
import com.azure.data.cosmos.serialization.hybridrow.RowBuffer;
|
import com.azure.data.cosmos.serialization.hybridrow.RowBuffer;
|
||||||
import com.azure.data.cosmos.serialization.hybridrow.RowCursor;
|
import com.azure.data.cosmos.serialization.hybridrow.RowCursor;
|
||||||
import com.azure.data.cosmos.serialization.hybridrow.layouts.LayoutType;
|
import com.azure.data.cosmos.serialization.hybridrow.layouts.LayoutType;
|
||||||
import com.azure.data.cosmos.serialization.hybridrow.layouts.LayoutTypedArray;
|
import com.azure.data.cosmos.serialization.hybridrow.layouts.LayoutTypedArray;
|
||||||
import com.azure.data.cosmos.serialization.hybridrow.layouts.TypeArgumentList;
|
import com.azure.data.cosmos.serialization.hybridrow.layouts.TypeArgumentList;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
//C# TO JAVA CONVERTER WARNING: Java does not allow user-defined value types. The behavior of this class may differ
|
//C# TO JAVA CONVERTER WARNING: Java does not allow user-defined value types. The behavior of this class may differ
|
||||||
// from the original:
|
// from the original:
|
||||||
//ORIGINAL LINE: internal struct WriteRowDispatcher : IDispatcher
|
//ORIGINAL LINE: internal struct WriteRowDispatcher : IDispatcher
|
||||||
public final class WriteRowDispatcher implements IDispatcher {
|
public final class WriteRowDispatcher implements IDispatcher {
|
||||||
|
|
||||||
public <TLayout extends LayoutType<TValue>, TValue> void Dispatch(Reference<RowOperationDispatcher> dispatcher, Reference<RowCursor> field, LayoutColumn col, LayoutType t) {
|
public <TLayout extends LayoutType<TValue>, TValue> void Dispatch(Reference<RowOperationDispatcher> dispatcher, Reference<RowCursor> field, LayoutColumn col, LayoutType t) {
|
||||||
Dispatch(dispatcher, field, col, t, null);
|
Dispatch(dispatcher, field, col, t, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
//C# TO JAVA CONVERTER NOTE: Java does not support optional parameters. Overloaded method(s) are created above:
|
//C# TO JAVA CONVERTER NOTE: Java does not support optional parameters. Overloaded method(s) are created above:
|
||||||
//ORIGINAL LINE: public void Dispatch<TLayout, TValue>(ref RowOperationDispatcher dispatcher, ref RowCursor
|
//ORIGINAL LINE: public void Dispatch<TLayout, TValue>(ref RowOperationDispatcher dispatcher, ref RowCursor
|
||||||
// field, LayoutColumn col, LayoutType t, TValue value = default) where TLayout : LayoutType<TValue>
|
// field, LayoutColumn col, LayoutType t, TValue value = default) where TLayout : LayoutType<TValue>
|
||||||
public <TLayout extends LayoutType<TValue>, TValue> void Dispatch(Reference<RowOperationDispatcher> dispatcher, Reference<RowCursor> field, LayoutColumn col, LayoutType t, TValue value) {
|
public <TLayout extends LayoutType<TValue>, TValue> void Dispatch(Reference<RowOperationDispatcher> dispatcher, Reference<RowCursor> field, LayoutColumn col, LayoutType t, TValue value) {
|
||||||
switch (col == null ? null : col.getStorage()) {
|
switch (col == null ? null : col.getStorage()) {
|
||||||
case Fixed:
|
case Fixed:
|
||||||
Reference<RowBuffer> tempReference_Row =
|
Reference<RowBuffer> tempReference_Row =
|
||||||
new Reference<RowBuffer>(dispatcher.get().Row);
|
new Reference<RowBuffer>(dispatcher.get().Row);
|
||||||
ResultAssert.IsSuccess(t.<TLayout>typeAs().writeFixed(tempReference_Row, field, col, value));
|
ResultAssert.IsSuccess(t.<TLayout>typeAs().writeFixed(tempReference_Row, field, col, value));
|
||||||
dispatcher.get().argValue.Row = tempReference_Row.get();
|
dispatcher.get().argValue.Row = tempReference_Row.get();
|
||||||
break;
|
break;
|
||||||
case Variable:
|
case Variable:
|
||||||
Reference<RowBuffer> tempReference_Row2 =
|
Reference<RowBuffer> tempReference_Row2 =
|
||||||
new Reference<RowBuffer>(dispatcher.get().Row);
|
new Reference<RowBuffer>(dispatcher.get().Row);
|
||||||
ResultAssert.IsSuccess(t.<TLayout>typeAs().writeVariable(tempReference_Row2, field, col, value));
|
ResultAssert.IsSuccess(t.<TLayout>typeAs().writeVariable(tempReference_Row2, field, col, value));
|
||||||
dispatcher.get().argValue.Row = tempReference_Row2.get();
|
dispatcher.get().argValue.Row = tempReference_Row2.get();
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
Reference<RowBuffer> tempReference_Row3 =
|
Reference<RowBuffer> tempReference_Row3 =
|
||||||
new Reference<RowBuffer>(dispatcher.get().Row);
|
new Reference<RowBuffer>(dispatcher.get().Row);
|
||||||
ResultAssert.IsSuccess(t.<TLayout>typeAs().writeSparse(tempReference_Row3, field, value));
|
ResultAssert.IsSuccess(t.<TLayout>typeAs().writeSparse(tempReference_Row3, field, value));
|
||||||
dispatcher.get().argValue.Row = tempReference_Row3.get();
|
dispatcher.get().argValue.Row = tempReference_Row3.get();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void DispatchArray(Reference<RowOperationDispatcher> dispatcher,
|
public void DispatchArray(Reference<RowOperationDispatcher> dispatcher,
|
||||||
Reference<RowCursor> scope, LayoutType t, TypeArgumentList typeArgs,
|
Reference<RowCursor> scope, LayoutType t, TypeArgumentList typeArgs,
|
||||||
Object value) {
|
Object value) {
|
||||||
checkArgument(typeArgs.count() == 1);
|
checkArgument(typeArgs.count() == 1);
|
||||||
|
|
||||||
Reference<RowBuffer> tempReference_Row =
|
Reference<RowBuffer> tempReference_Row =
|
||||||
new Reference<RowBuffer>(dispatcher.get().Row);
|
new Reference<RowBuffer>(dispatcher.get().Row);
|
||||||
RowCursor arrayScope;
|
RowCursor arrayScope;
|
||||||
Out<RowCursor> tempOut_arrayScope =
|
Out<RowCursor> tempOut_arrayScope =
|
||||||
new Out<RowCursor>();
|
new Out<RowCursor>();
|
||||||
ResultAssert.IsSuccess(t.<LayoutTypedArray>typeAs().WriteScope(tempReference_Row, scope, typeArgs.clone(),
|
ResultAssert.IsSuccess(t.<LayoutTypedArray>typeAs().WriteScope(tempReference_Row, scope, typeArgs.clone(),
|
||||||
tempOut_arrayScope));
|
tempOut_arrayScope));
|
||||||
arrayScope = tempOut_arrayScope.get();
|
arrayScope = tempOut_arrayScope.get();
|
||||||
dispatcher.get().argValue.Row = tempReference_Row.get();
|
dispatcher.get().argValue.Row = tempReference_Row.get();
|
||||||
|
|
||||||
List items = (List)value;
|
List items = (List)value;
|
||||||
for (Object item : items) {
|
for (Object item : items) {
|
||||||
// TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'ref' keyword - these
|
// TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'ref' keyword - these
|
||||||
// cannot be converted using the 'Ref' helper class unless the method is within the code being
|
// cannot be converted using the 'Ref' helper class unless the method is within the code being
|
||||||
// modified:
|
// modified:
|
||||||
dispatcher.get().LayoutCodeSwitch(ref arrayScope, null, typeArgs.get(0).type(),
|
dispatcher.get().LayoutCodeSwitch(ref arrayScope, null, typeArgs.get(0).type(),
|
||||||
typeArgs.get(0).typeArgs().clone(), item);
|
typeArgs.get(0).typeArgs().clone(), item);
|
||||||
Reference<RowBuffer> tempReference_Row2 =
|
Reference<RowBuffer> tempReference_Row2 =
|
||||||
new Reference<RowBuffer>(dispatcher.get().Row);
|
new Reference<RowBuffer>(dispatcher.get().Row);
|
||||||
arrayScope.MoveNext(tempReference_Row2);
|
arrayScope.MoveNext(tempReference_Row2);
|
||||||
dispatcher.get().argValue.Row = tempReference_Row2.get();
|
dispatcher.get().argValue.Row = tempReference_Row2.get();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void DispatchMap(Reference<RowOperationDispatcher> dispatcher,
|
public void DispatchMap(Reference<RowOperationDispatcher> dispatcher,
|
||||||
Reference<RowCursor> scope, LayoutType t, TypeArgumentList typeArgs,
|
Reference<RowCursor> scope, LayoutType t, TypeArgumentList typeArgs,
|
||||||
Object value) {
|
Object value) {
|
||||||
checkArgument(typeArgs.count() == 2);
|
checkArgument(typeArgs.count() == 2);
|
||||||
|
|
||||||
Reference<RowBuffer> tempReference_Row =
|
Reference<RowBuffer> tempReference_Row =
|
||||||
new Reference<RowBuffer>(dispatcher.get().Row);
|
new Reference<RowBuffer>(dispatcher.get().Row);
|
||||||
RowCursor mapScope;
|
RowCursor mapScope;
|
||||||
Out<RowCursor> tempOut_mapScope =
|
Out<RowCursor> tempOut_mapScope =
|
||||||
new Out<RowCursor>();
|
new Out<RowCursor>();
|
||||||
ResultAssert.IsSuccess(t.<LayoutTypedMap>typeAs().WriteScope(tempReference_Row, scope, typeArgs.clone(),
|
ResultAssert.IsSuccess(t.<LayoutTypedMap>typeAs().WriteScope(tempReference_Row, scope, typeArgs.clone(),
|
||||||
tempOut_mapScope));
|
tempOut_mapScope));
|
||||||
mapScope = tempOut_mapScope.get();
|
mapScope = tempOut_mapScope.get();
|
||||||
dispatcher.get().argValue.Row = tempReference_Row.get();
|
dispatcher.get().argValue.Row = tempReference_Row.get();
|
||||||
Reference<RowCursor> tempReference_mapScope =
|
Reference<RowCursor> tempReference_mapScope =
|
||||||
new Reference<RowCursor>(mapScope);
|
new Reference<RowCursor>(mapScope);
|
||||||
TypeArgument fieldType = t.<LayoutUniqueScope>typeAs().FieldType(tempReference_mapScope).clone();
|
TypeArgument fieldType = t.<LayoutUniqueScope>typeAs().FieldType(tempReference_mapScope).clone();
|
||||||
mapScope = tempReference_mapScope.get();
|
mapScope = tempReference_mapScope.get();
|
||||||
List pairs = (List)value;
|
List pairs = (List)value;
|
||||||
for (Object pair : pairs) {
|
for (Object pair : pairs) {
|
||||||
String elmPath = UUID.NewGuid().toString();
|
String elmPath = UUID.NewGuid().toString();
|
||||||
Reference<RowBuffer> tempReference_Row2 =
|
Reference<RowBuffer> tempReference_Row2 =
|
||||||
new Reference<RowBuffer>(dispatcher.get().Row);
|
new Reference<RowBuffer>(dispatcher.get().Row);
|
||||||
RowCursor tempCursor;
|
RowCursor tempCursor;
|
||||||
// TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'out' keyword - these
|
// TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'out' keyword - these
|
||||||
// cannot be converted using the 'Out' helper class unless the method is within the code being
|
// cannot be converted using the 'Out' helper class unless the method is within the code being
|
||||||
// modified:
|
// modified:
|
||||||
RowCursor.createForAppend(tempReference_Row2, out tempCursor);
|
RowCursor.createForAppend(tempReference_Row2, out tempCursor);
|
||||||
dispatcher.get().argValue.Row = tempReference_Row2.get();
|
dispatcher.get().argValue.Row = tempReference_Row2.get();
|
||||||
// TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'ref' keyword - these
|
// TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'ref' keyword - these
|
||||||
// cannot be converted using the 'Ref' helper class unless the method is within the code being
|
// cannot be converted using the 'Ref' helper class unless the method is within the code being
|
||||||
// modified:
|
// modified:
|
||||||
dispatcher.get().LayoutCodeSwitch(ref tempCursor, elmPath, fieldType.getType(),
|
dispatcher.get().LayoutCodeSwitch(ref tempCursor, elmPath, fieldType.getType(),
|
||||||
fieldType.getTypeArgs().clone(), pair);
|
fieldType.getTypeArgs().clone(), pair);
|
||||||
|
|
||||||
// Move item into the map.
|
// Move item into the map.
|
||||||
Reference<RowBuffer> tempReference_Row3 =
|
Reference<RowBuffer> tempReference_Row3 =
|
||||||
new Reference<RowBuffer>(dispatcher.get().Row);
|
new Reference<RowBuffer>(dispatcher.get().Row);
|
||||||
Reference<RowCursor> tempReference_mapScope2 =
|
Reference<RowCursor> tempReference_mapScope2 =
|
||||||
new Reference<RowCursor>(mapScope);
|
new Reference<RowCursor>(mapScope);
|
||||||
Reference<RowCursor> tempReference_tempCursor =
|
Reference<RowCursor> tempReference_tempCursor =
|
||||||
new Reference<RowCursor>(tempCursor);
|
new Reference<RowCursor>(tempCursor);
|
||||||
ResultAssert.IsSuccess(t.<LayoutTypedMap>typeAs().MoveField(tempReference_Row3, tempReference_mapScope2,
|
ResultAssert.IsSuccess(t.<LayoutTypedMap>typeAs().MoveField(tempReference_Row3, tempReference_mapScope2,
|
||||||
tempReference_tempCursor));
|
tempReference_tempCursor));
|
||||||
tempCursor = tempReference_tempCursor.get();
|
tempCursor = tempReference_tempCursor.get();
|
||||||
mapScope = tempReference_mapScope2.get();
|
mapScope = tempReference_mapScope2.get();
|
||||||
dispatcher.get().argValue.Row = tempReference_Row3.get();
|
dispatcher.get().argValue.Row = tempReference_Row3.get();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void DispatchNullable(Reference<RowOperationDispatcher> dispatcher,
|
public void DispatchNullable(Reference<RowOperationDispatcher> dispatcher,
|
||||||
Reference<RowCursor> scope, LayoutType t, TypeArgumentList typeArgs,
|
Reference<RowCursor> scope, LayoutType t, TypeArgumentList typeArgs,
|
||||||
Object value) {
|
Object value) {
|
||||||
checkArgument(typeArgs.count() == 1);
|
checkArgument(typeArgs.count() == 1);
|
||||||
|
|
||||||
Reference<RowBuffer> tempReference_Row =
|
Reference<RowBuffer> tempReference_Row =
|
||||||
new Reference<RowBuffer>(dispatcher.get().Row);
|
new Reference<RowBuffer>(dispatcher.get().Row);
|
||||||
RowCursor nullableScope;
|
RowCursor nullableScope;
|
||||||
// TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'out' keyword - these
|
// TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'out' keyword - these
|
||||||
// cannot be converted using the 'Out' helper class unless the method is within the code being modified:
|
// cannot be converted using the 'Out' helper class unless the method is within the code being modified:
|
||||||
ResultAssert.IsSuccess(t.<LayoutNullable>typeAs().WriteScope(tempReference_Row, scope, typeArgs.clone(),
|
ResultAssert.IsSuccess(t.<LayoutNullable>typeAs().WriteScope(tempReference_Row, scope, typeArgs.clone(),
|
||||||
value != null, out nullableScope));
|
value != null, out nullableScope));
|
||||||
dispatcher.get().argValue.Row = tempReference_Row.get();
|
dispatcher.get().argValue.Row = tempReference_Row.get();
|
||||||
|
|
||||||
if (value != null) {
|
if (value != null) {
|
||||||
// TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'ref' keyword - these
|
// TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'ref' keyword - these
|
||||||
// cannot be converted using the 'Ref' helper class unless the method is within the code being
|
// cannot be converted using the 'Ref' helper class unless the method is within the code being
|
||||||
// modified:
|
// modified:
|
||||||
dispatcher.get().LayoutCodeSwitch(ref nullableScope, null, typeArgs.get(0).type(),
|
dispatcher.get().LayoutCodeSwitch(ref nullableScope, null, typeArgs.get(0).type(),
|
||||||
typeArgs.get(0).typeArgs().clone(), value);
|
typeArgs.get(0).typeArgs().clone(), value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void DispatchObject(Reference<RowOperationDispatcher> dispatcher,
|
public void DispatchObject(Reference<RowOperationDispatcher> dispatcher,
|
||||||
Reference<RowCursor> scope) {
|
Reference<RowCursor> scope) {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void DispatchSet(Reference<RowOperationDispatcher> dispatcher,
|
public void DispatchSet(Reference<RowOperationDispatcher> dispatcher,
|
||||||
Reference<RowCursor> scope, LayoutType t, TypeArgumentList typeArgs,
|
Reference<RowCursor> scope, LayoutType t, TypeArgumentList typeArgs,
|
||||||
Object value) {
|
Object value) {
|
||||||
checkArgument(typeArgs.count() == 1);
|
checkArgument(typeArgs.count() == 1);
|
||||||
|
|
||||||
Reference<RowBuffer> tempReference_Row =
|
Reference<RowBuffer> tempReference_Row =
|
||||||
new Reference<RowBuffer>(dispatcher.get().Row);
|
new Reference<RowBuffer>(dispatcher.get().Row);
|
||||||
RowCursor setScope;
|
RowCursor setScope;
|
||||||
Out<RowCursor> tempOut_setScope =
|
Out<RowCursor> tempOut_setScope =
|
||||||
new Out<RowCursor>();
|
new Out<RowCursor>();
|
||||||
ResultAssert.IsSuccess(t.<LayoutTypedSet>typeAs().WriteScope(tempReference_Row, scope, typeArgs.clone(),
|
ResultAssert.IsSuccess(t.<LayoutTypedSet>typeAs().WriteScope(tempReference_Row, scope, typeArgs.clone(),
|
||||||
tempOut_setScope));
|
tempOut_setScope));
|
||||||
setScope = tempOut_setScope.get();
|
setScope = tempOut_setScope.get();
|
||||||
dispatcher.get().argValue.Row = tempReference_Row.get();
|
dispatcher.get().argValue.Row = tempReference_Row.get();
|
||||||
List items = (List)value;
|
List items = (List)value;
|
||||||
for (Object item : items) {
|
for (Object item : items) {
|
||||||
String elmPath = UUID.NewGuid().toString();
|
String elmPath = UUID.NewGuid().toString();
|
||||||
Reference<RowBuffer> tempReference_Row2 =
|
Reference<RowBuffer> tempReference_Row2 =
|
||||||
new Reference<RowBuffer>(dispatcher.get().Row);
|
new Reference<RowBuffer>(dispatcher.get().Row);
|
||||||
RowCursor tempCursor;
|
RowCursor tempCursor;
|
||||||
// TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'out' keyword - these
|
// TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'out' keyword - these
|
||||||
// cannot be converted using the 'Out' helper class unless the method is within the code being
|
// cannot be converted using the 'Out' helper class unless the method is within the code being
|
||||||
// modified:
|
// modified:
|
||||||
RowCursor.createForAppend(tempReference_Row2, out tempCursor);
|
RowCursor.createForAppend(tempReference_Row2, out tempCursor);
|
||||||
dispatcher.get().argValue.Row = tempReference_Row2.get();
|
dispatcher.get().argValue.Row = tempReference_Row2.get();
|
||||||
// TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'ref' keyword - these
|
// TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'ref' keyword - these
|
||||||
// cannot be converted using the 'Ref' helper class unless the method is within the code being
|
// cannot be converted using the 'Ref' helper class unless the method is within the code being
|
||||||
// modified:
|
// modified:
|
||||||
dispatcher.get().LayoutCodeSwitch(ref tempCursor, elmPath, typeArgs.get(0).type(),
|
dispatcher.get().LayoutCodeSwitch(ref tempCursor, elmPath, typeArgs.get(0).type(),
|
||||||
typeArgs.get(0).typeArgs().clone(), item);
|
typeArgs.get(0).typeArgs().clone(), item);
|
||||||
|
|
||||||
// Move item into the set.
|
// Move item into the set.
|
||||||
Reference<RowBuffer> tempReference_Row3 =
|
Reference<RowBuffer> tempReference_Row3 =
|
||||||
new Reference<RowBuffer>(dispatcher.get().Row);
|
new Reference<RowBuffer>(dispatcher.get().Row);
|
||||||
Reference<RowCursor> tempReference_setScope =
|
Reference<RowCursor> tempReference_setScope =
|
||||||
new Reference<RowCursor>(setScope);
|
new Reference<RowCursor>(setScope);
|
||||||
Reference<RowCursor> tempReference_tempCursor =
|
Reference<RowCursor> tempReference_tempCursor =
|
||||||
new Reference<RowCursor>(tempCursor);
|
new Reference<RowCursor>(tempCursor);
|
||||||
ResultAssert.IsSuccess(t.<LayoutTypedSet>typeAs().MoveField(tempReference_Row3, tempReference_setScope,
|
ResultAssert.IsSuccess(t.<LayoutTypedSet>typeAs().MoveField(tempReference_Row3, tempReference_setScope,
|
||||||
tempReference_tempCursor));
|
tempReference_tempCursor));
|
||||||
tempCursor = tempReference_tempCursor.get();
|
tempCursor = tempReference_tempCursor.get();
|
||||||
setScope = tempReference_setScope.get();
|
setScope = tempReference_setScope.get();
|
||||||
dispatcher.get().argValue.Row = tempReference_Row3.get();
|
dispatcher.get().argValue.Row = tempReference_Row3.get();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void DispatchTuple(Reference<RowOperationDispatcher> dispatcher,
|
public void DispatchTuple(Reference<RowOperationDispatcher> dispatcher,
|
||||||
Reference<RowCursor> scope, LayoutType t, TypeArgumentList typeArgs,
|
Reference<RowCursor> scope, LayoutType t, TypeArgumentList typeArgs,
|
||||||
Object value) {
|
Object value) {
|
||||||
checkArgument(typeArgs.count() >= 2);
|
checkArgument(typeArgs.count() >= 2);
|
||||||
|
|
||||||
Reference<RowBuffer> tempReference_Row =
|
Reference<RowBuffer> tempReference_Row =
|
||||||
new Reference<RowBuffer>(dispatcher.get().Row);
|
new Reference<RowBuffer>(dispatcher.get().Row);
|
||||||
RowCursor tupleScope;
|
RowCursor tupleScope;
|
||||||
// TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'out' keyword - these
|
// TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'out' keyword - these
|
||||||
// cannot be converted using the 'Out' helper class unless the method is within the code being modified:
|
// cannot be converted using the 'Out' helper class unless the method is within the code being modified:
|
||||||
ResultAssert.IsSuccess(t.<LayoutIndexedScope>typeAs().WriteScope(tempReference_Row, scope, typeArgs.clone(),
|
ResultAssert.IsSuccess(t.<LayoutIndexedScope>typeAs().WriteScope(tempReference_Row, scope, typeArgs.clone(),
|
||||||
out tupleScope));
|
out tupleScope));
|
||||||
dispatcher.get().argValue.Row = tempReference_Row.get();
|
dispatcher.get().argValue.Row = tempReference_Row.get();
|
||||||
|
|
||||||
for (int i = 0; i < typeArgs.count(); i++) {
|
for (int i = 0; i < typeArgs.count(); i++) {
|
||||||
PropertyInfo valueAccessor = value.getClass().GetProperty(String.format("Item%1$s", i + 1));
|
PropertyInfo valueAccessor = value.getClass().GetProperty(String.format("Item%1$s", i + 1));
|
||||||
// TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'ref' keyword - these
|
// TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'ref' keyword - these
|
||||||
// cannot be converted using the 'Ref' helper class unless the method is within the code being
|
// cannot be converted using the 'Ref' helper class unless the method is within the code being
|
||||||
// modified:
|
// modified:
|
||||||
dispatcher.get().LayoutCodeSwitch(ref tupleScope, null, typeArgs.get(i).type(),
|
dispatcher.get().LayoutCodeSwitch(ref tupleScope, null, typeArgs.get(i).type(),
|
||||||
typeArgs.get(i).typeArgs().clone(), valueAccessor.GetValue(value));
|
typeArgs.get(i).typeArgs().clone(), valueAccessor.GetValue(value));
|
||||||
Reference<RowBuffer> tempReference_Row2 =
|
Reference<RowBuffer> tempReference_Row2 =
|
||||||
new Reference<RowBuffer>(dispatcher.get().Row);
|
new Reference<RowBuffer>(dispatcher.get().Row);
|
||||||
tupleScope.MoveNext(tempReference_Row2);
|
tupleScope.MoveNext(tempReference_Row2);
|
||||||
dispatcher.get().argValue.Row = tempReference_Row2.get();
|
dispatcher.get().argValue.Row = tempReference_Row2.get();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void DispatchUDT(Reference<RowOperationDispatcher> dispatcher,
|
public void DispatchUDT(Reference<RowOperationDispatcher> dispatcher,
|
||||||
Reference<RowCursor> scope, LayoutType t, TypeArgumentList typeArgs,
|
Reference<RowCursor> scope, LayoutType t, TypeArgumentList typeArgs,
|
||||||
Object value) {
|
Object value) {
|
||||||
Reference<RowBuffer> tempReference_Row = new Reference<RowBuffer>(dispatcher.get().Row);
|
Reference<RowBuffer> tempReference_Row = new Reference<RowBuffer>(dispatcher.get().Row);
|
||||||
RowCursor udtScope;
|
RowCursor udtScope;
|
||||||
Out<RowCursor> tempOut_udtScope = new Out<RowCursor>();
|
Out<RowCursor> tempOut_udtScope = new Out<RowCursor>();
|
||||||
ResultAssert.IsSuccess(t.<LayoutUDT>typeAs().WriteScope(tempReference_Row, scope, typeArgs.clone(), tempOut_udtScope));
|
ResultAssert.IsSuccess(t.<LayoutUDT>typeAs().WriteScope(tempReference_Row, scope, typeArgs.clone(), tempOut_udtScope));
|
||||||
udtScope = tempOut_udtScope.get();
|
udtScope = tempOut_udtScope.get();
|
||||||
dispatcher.get().argValue.Row = tempReference_Row.get();
|
dispatcher.get().argValue.Row = tempReference_Row.get();
|
||||||
IDispatchable valueDispatcher = value instanceof IDispatchable ? (IDispatchable)value : null;
|
IDispatchable valueDispatcher = value instanceof IDispatchable ? (IDispatchable)value : null;
|
||||||
assert valueDispatcher != null;
|
assert valueDispatcher != null;
|
||||||
Reference<RowCursor> tempReference_udtScope = new Reference<RowCursor>(udtScope);
|
Reference<RowCursor> tempReference_udtScope = new Reference<RowCursor>(udtScope);
|
||||||
valueDispatcher.Dispatch(dispatcher, tempReference_udtScope);
|
valueDispatcher.Dispatch(dispatcher, tempReference_udtScope);
|
||||||
udtScope = tempReference_udtScope.get();
|
udtScope = tempReference_udtScope.get();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+46
-46
@@ -1,47 +1,47 @@
|
|||||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||||
// Licensed under the MIT License.
|
// Licensed under the MIT License.
|
||||||
|
|
||||||
package com.azure.data.cosmos.serialization.hybridrow.unit.customerschema;
|
package com.azure.data.cosmos.serialization.hybridrow.unit.customerschema;
|
||||||
|
|
||||||
import azure.data.cosmos.serialization.hybridrow.unit.*;
|
import azure.data.cosmos.serialization.hybridrow.unit.*;
|
||||||
|
|
||||||
// TODO: C# TO JAVA CONVERTER: There is no preprocessor in Java:
|
// TODO: C# TO JAVA CONVERTER: There is no preprocessor in Java:
|
||||||
///#pragma warning disable SA1401 // Fields should be private
|
///#pragma warning disable SA1401 // Fields should be private
|
||||||
|
|
||||||
|
|
||||||
public final class Address {
|
public final class Address {
|
||||||
public String City;
|
public String City;
|
||||||
public PostalCode PostalCode;
|
public PostalCode PostalCode;
|
||||||
public String State;
|
public String State;
|
||||||
public String Street;
|
public String Street;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean equals(Object obj) {
|
public boolean equals(Object obj) {
|
||||||
if (null == obj) {
|
if (null == obj) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this == obj) {
|
if (this == obj) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
return obj instanceof Address && this.equals((Address)obj);
|
return obj instanceof Address && this.equals((Address)obj);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int hashCode() {
|
public int hashCode() {
|
||||||
// TODO: C# TO JAVA CONVERTER: There is no equivalent to an 'unchecked' block in Java:
|
// TODO: C# TO JAVA CONVERTER: There is no equivalent to an 'unchecked' block in Java:
|
||||||
unchecked
|
unchecked
|
||||||
{
|
{
|
||||||
int hashCode = this.Street != null ? this.Street.hashCode() : 0;
|
int hashCode = this.Street != null ? this.Street.hashCode() : 0;
|
||||||
hashCode = (hashCode * 397) ^ (this.City != null ? this.City.hashCode() : 0);
|
hashCode = (hashCode * 397) ^ (this.City != null ? this.City.hashCode() : 0);
|
||||||
hashCode = (hashCode * 397) ^ (this.State != null ? this.State.hashCode() : 0);
|
hashCode = (hashCode * 397) ^ (this.State != null ? this.State.hashCode() : 0);
|
||||||
hashCode = (hashCode * 397) ^ (this.PostalCode != null ? this.PostalCode.hashCode() : 0);
|
hashCode = (hashCode * 397) ^ (this.PostalCode != null ? this.PostalCode.hashCode() : 0);
|
||||||
return hashCode;
|
return hashCode;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean equals(Address other) {
|
private boolean equals(Address other) {
|
||||||
return this.Street.equals(other.Street) && this.City.equals(other.City) && this.State.equals(other.State) && this.PostalCode.equals(other.PostalCode);
|
return this.Street.equals(other.Street) && this.City.equals(other.City) && this.State.equals(other.State) && this.PostalCode.equals(other.PostalCode);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+95
-95
@@ -1,96 +1,96 @@
|
|||||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||||
// Licensed under the MIT License.
|
// Licensed under the MIT License.
|
||||||
|
|
||||||
package com.azure.data.cosmos.serialization.hybridrow.unit.customerschema;
|
package com.azure.data.cosmos.serialization.hybridrow.unit.customerschema;
|
||||||
|
|
||||||
import com.azure.data.cosmos.core.Out;
|
import com.azure.data.cosmos.core.Out;
|
||||||
import com.azure.data.cosmos.core.Reference;
|
import com.azure.data.cosmos.core.Reference;
|
||||||
import com.azure.data.cosmos.serialization.hybridrow.Result;
|
import com.azure.data.cosmos.serialization.hybridrow.Result;
|
||||||
import azure.data.cosmos.serialization.hybridrow.unit.*;
|
import azure.data.cosmos.serialization.hybridrow.unit.*;
|
||||||
import com.azure.data.cosmos.serialization.hybridrow.io.RowReader;
|
import com.azure.data.cosmos.serialization.hybridrow.io.RowReader;
|
||||||
|
|
||||||
public final class AddressSerializer {
|
public final class AddressSerializer {
|
||||||
public static Result Read(Reference<RowReader> reader, Out<Address> obj) {
|
public static Result Read(Reference<RowReader> reader, Out<Address> obj) {
|
||||||
obj.setAndGet(new Address());
|
obj.setAndGet(new Address());
|
||||||
while (reader.get().read()) {
|
while (reader.get().read()) {
|
||||||
Result r;
|
Result r;
|
||||||
switch (reader.get().path()) {
|
switch (reader.get().path()) {
|
||||||
case "street":
|
case "street":
|
||||||
Out<String> tempOut_Street = new Out<String>();
|
Out<String> tempOut_Street = new Out<String>();
|
||||||
r = reader.get().readUtf8String(tempOut_Street);
|
r = reader.get().readUtf8String(tempOut_Street);
|
||||||
obj.get().argValue.Street = tempOut_Street.get();
|
obj.get().argValue.Street = tempOut_Street.get();
|
||||||
if (r != Result.SUCCESS) {
|
if (r != Result.SUCCESS) {
|
||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case "city":
|
case "city":
|
||||||
Out<String> tempOut_City = new Out<String>();
|
Out<String> tempOut_City = new Out<String>();
|
||||||
r = reader.get().readUtf8String(tempOut_City);
|
r = reader.get().readUtf8String(tempOut_City);
|
||||||
obj.get().argValue.City = tempOut_City.get();
|
obj.get().argValue.City = tempOut_City.get();
|
||||||
if (r != Result.SUCCESS) {
|
if (r != Result.SUCCESS) {
|
||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case "state":
|
case "state":
|
||||||
Out<String> tempOut_State = new Out<String>();
|
Out<String> tempOut_State = new Out<String>();
|
||||||
r = reader.get().readUtf8String(tempOut_State);
|
r = reader.get().readUtf8String(tempOut_State);
|
||||||
obj.get().argValue.State = tempOut_State.get();
|
obj.get().argValue.State = tempOut_State.get();
|
||||||
if (r != Result.SUCCESS) {
|
if (r != Result.SUCCESS) {
|
||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case "postal_code":
|
case "postal_code":
|
||||||
Reference<RowReader> tempReference_child =
|
Reference<RowReader> tempReference_child =
|
||||||
new Reference<RowReader>(child);
|
new Reference<RowReader>(child);
|
||||||
Out<PostalCode> tempOut_PostalCode = new Out<PostalCode>();
|
Out<PostalCode> tempOut_PostalCode = new Out<PostalCode>();
|
||||||
// TODO: C# TO JAVA CONVERTER: The following lambda contained an unresolved 'ref' keyword - these are not converted by C# to Java Converter:
|
// TODO: C# TO JAVA CONVERTER: The following lambda contained an unresolved 'ref' keyword - these are not converted by C# to Java Converter:
|
||||||
r = reader.get().readScope(obj.get(), (RowReader RowReader child, Address parent) -> PostalCodeSerializer.Read(tempReference_child, tempOut_PostalCode));
|
r = reader.get().readScope(obj.get(), (RowReader RowReader child, Address parent) -> PostalCodeSerializer.Read(tempReference_child, tempOut_PostalCode));
|
||||||
parent.PostalCode = tempOut_PostalCode.get();
|
parent.PostalCode = tempOut_PostalCode.get();
|
||||||
child = tempReference_child.get();
|
child = tempReference_child.get();
|
||||||
|
|
||||||
if (r != Result.SUCCESS) {
|
if (r != Result.SUCCESS) {
|
||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return Result.SUCCESS;
|
return Result.SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Result Write(Reference<RowWriter> writer, TypeArgument typeArg, Address obj) {
|
public static Result Write(Reference<RowWriter> writer, TypeArgument typeArg, Address obj) {
|
||||||
Result r;
|
Result r;
|
||||||
if (obj.Street != null) {
|
if (obj.Street != null) {
|
||||||
r = writer.get().WriteString("street", obj.Street);
|
r = writer.get().WriteString("street", obj.Street);
|
||||||
if (r != Result.SUCCESS) {
|
if (r != Result.SUCCESS) {
|
||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (obj.City != null) {
|
if (obj.City != null) {
|
||||||
r = writer.get().WriteString("city", obj.City);
|
r = writer.get().WriteString("city", obj.City);
|
||||||
if (r != Result.SUCCESS) {
|
if (r != Result.SUCCESS) {
|
||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (obj.State != null) {
|
if (obj.State != null) {
|
||||||
r = writer.get().WriteString("state", obj.State);
|
r = writer.get().WriteString("state", obj.State);
|
||||||
if (r != Result.SUCCESS) {
|
if (r != Result.SUCCESS) {
|
||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (obj.PostalCode != null) {
|
if (obj.PostalCode != null) {
|
||||||
r = writer.get().WriteScope("postal_code", PostalCodeSerializer.TypeArg, obj.PostalCode,
|
r = writer.get().WriteScope("postal_code", PostalCodeSerializer.TypeArg, obj.PostalCode,
|
||||||
PostalCodeSerializer.Write);
|
PostalCodeSerializer.Write);
|
||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
|
|
||||||
return Result.SUCCESS;
|
return Result.SUCCESS;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+93
-93
@@ -1,94 +1,94 @@
|
|||||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||||
// Licensed under the MIT License.
|
// Licensed under the MIT License.
|
||||||
|
|
||||||
package com.azure.data.cosmos.serialization.hybridrow.unit.customerschema;
|
package com.azure.data.cosmos.serialization.hybridrow.unit.customerschema;
|
||||||
|
|
||||||
import azure.data.cosmos.serialization.hybridrow.unit.*;
|
import azure.data.cosmos.serialization.hybridrow.unit.*;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
// TODO: C# TO JAVA CONVERTER: There is no preprocessor in Java:
|
// TODO: C# TO JAVA CONVERTER: There is no preprocessor in Java:
|
||||||
///#pragma warning disable SA1401 // Fields should be private
|
///#pragma warning disable SA1401 // Fields should be private
|
||||||
|
|
||||||
|
|
||||||
public final class Guest {
|
public final class Guest {
|
||||||
public Map<String, Address> Addresses;
|
public Map<String, Address> Addresses;
|
||||||
public String ConfirmNumber;
|
public String ConfirmNumber;
|
||||||
public Set<String> Emails;
|
public Set<String> Emails;
|
||||||
public String FirstName;
|
public String FirstName;
|
||||||
public UUID Id;
|
public UUID Id;
|
||||||
public String LastName;
|
public String LastName;
|
||||||
public List<String> PhoneNumbers;
|
public List<String> PhoneNumbers;
|
||||||
public String Title;
|
public String Title;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean equals(Object obj) {
|
public boolean equals(Object obj) {
|
||||||
if (null == obj) {
|
if (null == obj) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this == obj) {
|
if (this == obj) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
return obj instanceof Guest && this.equals((Guest)obj);
|
return obj instanceof Guest && this.equals((Guest)obj);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int hashCode() {
|
public int hashCode() {
|
||||||
// TODO: C# TO JAVA CONVERTER: There is no equivalent to an 'unchecked' block in Java:
|
// TODO: C# TO JAVA CONVERTER: There is no equivalent to an 'unchecked' block in Java:
|
||||||
unchecked
|
unchecked
|
||||||
{
|
{
|
||||||
int hashCode = this.Id.hashCode();
|
int hashCode = this.Id.hashCode();
|
||||||
hashCode = (hashCode * 397) ^ (this.FirstName != null ? this.FirstName.hashCode() : 0);
|
hashCode = (hashCode * 397) ^ (this.FirstName != null ? this.FirstName.hashCode() : 0);
|
||||||
hashCode = (hashCode * 397) ^ (this.LastName != null ? this.LastName.hashCode() : 0);
|
hashCode = (hashCode * 397) ^ (this.LastName != null ? this.LastName.hashCode() : 0);
|
||||||
hashCode = (hashCode * 397) ^ (this.Title != null ? this.Title.hashCode() : 0);
|
hashCode = (hashCode * 397) ^ (this.Title != null ? this.Title.hashCode() : 0);
|
||||||
hashCode = (hashCode * 397) ^ (this.Emails != null ? this.Emails.hashCode() : 0);
|
hashCode = (hashCode * 397) ^ (this.Emails != null ? this.Emails.hashCode() : 0);
|
||||||
hashCode = (hashCode * 397) ^ (this.PhoneNumbers != null ? this.PhoneNumbers.hashCode() : 0);
|
hashCode = (hashCode * 397) ^ (this.PhoneNumbers != null ? this.PhoneNumbers.hashCode() : 0);
|
||||||
hashCode = (hashCode * 397) ^ (this.Addresses != null ? this.Addresses.hashCode() : 0);
|
hashCode = (hashCode * 397) ^ (this.Addresses != null ? this.Addresses.hashCode() : 0);
|
||||||
hashCode = (hashCode * 397) ^ (this.ConfirmNumber != null ? this.ConfirmNumber.hashCode() : 0);
|
hashCode = (hashCode * 397) ^ (this.ConfirmNumber != null ? this.ConfirmNumber.hashCode() : 0);
|
||||||
return hashCode;
|
return hashCode;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static <TKey, TValue> boolean DictionaryEquals(Map<TKey, TValue> left, Map<TKey, TValue> right) {
|
private static <TKey, TValue> boolean DictionaryEquals(Map<TKey, TValue> left, Map<TKey, TValue> right) {
|
||||||
if (left == right) {
|
if (left == right) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((left == null) || (right == null)) {
|
if ((left == null) || (right == null)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (left.size() != right.size()) {
|
if (left.size() != right.size()) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (Map.Entry<TKey, TValue> p : left.entrySet()) {
|
for (Map.Entry<TKey, TValue> p : left.entrySet()) {
|
||||||
TValue value;
|
TValue value;
|
||||||
if (!(right.containsKey(p.getKey()) && (value = right.get(p.getKey())) == value)) {
|
if (!(right.containsKey(p.getKey()) && (value = right.get(p.getKey())) == value)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!p.getValue().equals(value)) {
|
if (!p.getValue().equals(value)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean equals(Guest other) {
|
private boolean equals(Guest other) {
|
||||||
//C# TO JAVA CONVERTER WARNING: Java AbstractList 'equals' is not always identical to LINQ 'SequenceEqual':
|
//C# TO JAVA CONVERTER WARNING: Java AbstractList 'equals' is not always identical to LINQ 'SequenceEqual':
|
||||||
//ORIGINAL LINE: return this.Id.Equals(other.Id) && string.Equals(this.FirstName, other.FirstName) && string
|
//ORIGINAL LINE: return this.Id.Equals(other.Id) && string.Equals(this.FirstName, other.FirstName) && string
|
||||||
// .Equals(this.LastName, other.LastName) && string.Equals(this.Title, other.Title) && string.Equals(this
|
// .Equals(this.LastName, other.LastName) && string.Equals(this.Title, other.Title) && string.Equals(this
|
||||||
// .ConfirmNumber, other.ConfirmNumber) && ((this.Emails == other.Emails) || ((this.Emails != null) && (other
|
// .ConfirmNumber, other.ConfirmNumber) && ((this.Emails == other.Emails) || ((this.Emails != null) && (other
|
||||||
// .Emails != null) && this.Emails.SetEquals(other.Emails))) && ((this.PhoneNumbers == other.PhoneNumbers) ||
|
// .Emails != null) && this.Emails.SetEquals(other.Emails))) && ((this.PhoneNumbers == other.PhoneNumbers) ||
|
||||||
// ((this.PhoneNumbers != null) && (other.PhoneNumbers != null) && this.PhoneNumbers.SequenceEqual(other
|
// ((this.PhoneNumbers != null) && (other.PhoneNumbers != null) && this.PhoneNumbers.SequenceEqual(other
|
||||||
// .PhoneNumbers))) && Guest.DictionaryEquals(this.Addresses, other.Addresses);
|
// .PhoneNumbers))) && Guest.DictionaryEquals(this.Addresses, other.Addresses);
|
||||||
return this.Id.equals(other.Id) && this.FirstName.equals(other.FirstName) && this.LastName.equals(other.LastName) && this.Title.equals(other.Title) && this.ConfirmNumber.equals(other.ConfirmNumber) && ((this.Emails == other.Emails) || ((this.Emails != null) && (other.Emails != null) && this.Emails.equals(other.Emails))) && ((this.PhoneNumbers == other.PhoneNumbers) || ((this.PhoneNumbers != null) && (other.PhoneNumbers != null) && this.PhoneNumbers.equals(other.PhoneNumbers))) && Guest.DictionaryEquals(this.Addresses, other.Addresses);
|
return this.Id.equals(other.Id) && this.FirstName.equals(other.FirstName) && this.LastName.equals(other.LastName) && this.Title.equals(other.Title) && this.ConfirmNumber.equals(other.ConfirmNumber) && ((this.Emails == other.Emails) || ((this.Emails != null) && (other.Emails != null) && this.Emails.equals(other.Emails))) && ((this.PhoneNumbers == other.PhoneNumbers) || ((this.PhoneNumbers != null) && (other.PhoneNumbers != null) && this.PhoneNumbers.equals(other.PhoneNumbers))) && Guest.DictionaryEquals(this.Addresses, other.Addresses);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+49
-49
@@ -1,50 +1,50 @@
|
|||||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||||
// Licensed under the MIT License.
|
// Licensed under the MIT License.
|
||||||
|
|
||||||
package com.azure.data.cosmos.serialization.hybridrow.unit.customerschema;
|
package com.azure.data.cosmos.serialization.hybridrow.unit.customerschema;
|
||||||
|
|
||||||
import azure.data.cosmos.serialization.hybridrow.unit.*;
|
import azure.data.cosmos.serialization.hybridrow.unit.*;
|
||||||
|
|
||||||
// TODO: C# TO JAVA CONVERTER: There is no preprocessor in Java:
|
// TODO: C# TO JAVA CONVERTER: There is no preprocessor in Java:
|
||||||
///#pragma warning disable SA1401 // Fields should be private
|
///#pragma warning disable SA1401 // Fields should be private
|
||||||
|
|
||||||
|
|
||||||
public final class Hotel {
|
public final class Hotel {
|
||||||
public Address Address;
|
public Address Address;
|
||||||
public String Id;
|
public String Id;
|
||||||
public String Name;
|
public String Name;
|
||||||
public String Phone;
|
public String Phone;
|
||||||
|
|
||||||
public boolean equals(Hotel other) {
|
public boolean equals(Hotel other) {
|
||||||
return this.Id.equals(other.Id) && this.Name.equals(other.Name) && this.Phone.equals(other.Phone) && this.Address.equals(other.Address);
|
return this.Id.equals(other.Id) && this.Name.equals(other.Name) && this.Phone.equals(other.Phone) && this.Address.equals(other.Address);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean equals(Object obj) {
|
public boolean equals(Object obj) {
|
||||||
if (null == obj) {
|
if (null == obj) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this == obj) {
|
if (this == obj) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
return obj instanceof Hotel && this.equals((Hotel)obj);
|
return obj instanceof Hotel && this.equals((Hotel)obj);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int hashCode() {
|
public int hashCode() {
|
||||||
// TODO: C# TO JAVA CONVERTER: There is no equivalent to an 'unchecked' block in Java:
|
// TODO: C# TO JAVA CONVERTER: There is no equivalent to an 'unchecked' block in Java:
|
||||||
unchecked
|
unchecked
|
||||||
{
|
{
|
||||||
int hashCode = this.Id == null ? null : this.Id.hashCode() != null ? this.Id.hashCode() : 0;
|
int hashCode = this.Id == null ? null : this.Id.hashCode() != null ? this.Id.hashCode() : 0;
|
||||||
hashCode = (hashCode * 397) ^ (this.Name == null ? null : this.Name.hashCode() != null ?
|
hashCode = (hashCode * 397) ^ (this.Name == null ? null : this.Name.hashCode() != null ?
|
||||||
this.Name.hashCode() : 0);
|
this.Name.hashCode() : 0);
|
||||||
hashCode = (hashCode * 397) ^ (this.Phone == null ? null : this.Phone.hashCode() != null ?
|
hashCode = (hashCode * 397) ^ (this.Phone == null ? null : this.Phone.hashCode() != null ?
|
||||||
this.Phone.hashCode() : 0);
|
this.Phone.hashCode() : 0);
|
||||||
int tempVar = this.Address.GetHashCode();
|
int tempVar = this.Address.GetHashCode();
|
||||||
hashCode = (hashCode * 397) ^ (this.Address == null ? null : tempVar != null ? tempVar : 0);
|
hashCode = (hashCode * 397) ^ (this.Address == null ? null : tempVar != null ? tempVar : 0);
|
||||||
return hashCode;
|
return hashCode;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+40
-40
@@ -1,41 +1,41 @@
|
|||||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||||
// Licensed under the MIT License.
|
// Licensed under the MIT License.
|
||||||
|
|
||||||
package com.azure.data.cosmos.serialization.hybridrow.unit.customerschema;
|
package com.azure.data.cosmos.serialization.hybridrow.unit.customerschema;
|
||||||
|
|
||||||
import azure.data.cosmos.serialization.hybridrow.unit.*;
|
import azure.data.cosmos.serialization.hybridrow.unit.*;
|
||||||
|
|
||||||
// TODO: C# TO JAVA CONVERTER: There is no preprocessor in Java:
|
// TODO: C# TO JAVA CONVERTER: There is no preprocessor in Java:
|
||||||
///#pragma warning disable SA1401 // Fields should be private
|
///#pragma warning disable SA1401 // Fields should be private
|
||||||
|
|
||||||
|
|
||||||
public final class PostalCode {
|
public final class PostalCode {
|
||||||
public Short Plus4;
|
public Short Plus4;
|
||||||
public int Zip;
|
public int Zip;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean equals(Object obj) {
|
public boolean equals(Object obj) {
|
||||||
if (null == obj) {
|
if (null == obj) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this == obj) {
|
if (this == obj) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
return obj instanceof PostalCode && this.equals((PostalCode)obj);
|
return obj instanceof PostalCode && this.equals((PostalCode)obj);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int hashCode() {
|
public int hashCode() {
|
||||||
// TODO: C# TO JAVA CONVERTER: There is no equivalent to an 'unchecked' block in Java:
|
// TODO: C# TO JAVA CONVERTER: There is no equivalent to an 'unchecked' block in Java:
|
||||||
unchecked
|
unchecked
|
||||||
{
|
{
|
||||||
return (this.Zip * 397) ^ this.Plus4.hashCode();
|
return (this.Zip * 397) ^ this.Plus4.hashCode();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean equals(PostalCode other) {
|
private boolean equals(PostalCode other) {
|
||||||
return this.Zip == other.Zip && this.Plus4 == other.Plus4;
|
return this.Zip == other.Zip && this.Plus4 == other.Plus4;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+68
-68
@@ -1,69 +1,69 @@
|
|||||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||||
// Licensed under the MIT License.
|
// Licensed under the MIT License.
|
||||||
|
|
||||||
package com.azure.data.cosmos.serialization.hybridrow.unit.customerschema;
|
package com.azure.data.cosmos.serialization.hybridrow.unit.customerschema;
|
||||||
|
|
||||||
import com.azure.data.cosmos.core.Out;
|
import com.azure.data.cosmos.core.Out;
|
||||||
import com.azure.data.cosmos.core.Reference;
|
import com.azure.data.cosmos.core.Reference;
|
||||||
import com.azure.data.cosmos.serialization.hybridrow.Result;
|
import com.azure.data.cosmos.serialization.hybridrow.Result;
|
||||||
import com.azure.data.cosmos.serialization.hybridrow.SchemaId;
|
import com.azure.data.cosmos.serialization.hybridrow.SchemaId;
|
||||||
import com.azure.data.cosmos.serialization.hybridrow.io.RowReader;
|
import com.azure.data.cosmos.serialization.hybridrow.io.RowReader;
|
||||||
import com.azure.data.cosmos.serialization.hybridrow.io.RowWriter;
|
import com.azure.data.cosmos.serialization.hybridrow.io.RowWriter;
|
||||||
import com.azure.data.cosmos.serialization.hybridrow.layouts.LayoutType;
|
import com.azure.data.cosmos.serialization.hybridrow.layouts.LayoutType;
|
||||||
import com.azure.data.cosmos.serialization.hybridrow.layouts.TypeArgument;
|
import com.azure.data.cosmos.serialization.hybridrow.layouts.TypeArgument;
|
||||||
import com.azure.data.cosmos.serialization.hybridrow.layouts.TypeArgumentList;
|
import com.azure.data.cosmos.serialization.hybridrow.layouts.TypeArgumentList;
|
||||||
import azure.data.cosmos.serialization.hybridrow.unit.*;
|
import azure.data.cosmos.serialization.hybridrow.unit.*;
|
||||||
|
|
||||||
// TODO: C# TO JAVA CONVERTER: There is no preprocessor in Java:
|
// TODO: C# TO JAVA CONVERTER: There is no preprocessor in Java:
|
||||||
///#pragma warning disable SA1401 // Fields should be private
|
///#pragma warning disable SA1401 // Fields should be private
|
||||||
|
|
||||||
|
|
||||||
public final class PostalCodeSerializer {
|
public final class PostalCodeSerializer {
|
||||||
public static TypeArgument TypeArg = new TypeArgument(LayoutType.UDT, new TypeArgumentList(new SchemaId(1)));
|
public static TypeArgument TypeArg = new TypeArgument(LayoutType.UDT, new TypeArgumentList(new SchemaId(1)));
|
||||||
|
|
||||||
public static Result Read(Reference<RowReader> reader, Out<PostalCode> obj) {
|
public static Result Read(Reference<RowReader> reader, Out<PostalCode> obj) {
|
||||||
obj.setAndGet(new PostalCode());
|
obj.setAndGet(new PostalCode());
|
||||||
while (reader.get().read()) {
|
while (reader.get().read()) {
|
||||||
Result r;
|
Result r;
|
||||||
switch (reader.get().path()) {
|
switch (reader.get().path()) {
|
||||||
case "zip":
|
case "zip":
|
||||||
Out<Integer> tempOut_Zip = new Out<Integer>();
|
Out<Integer> tempOut_Zip = new Out<Integer>();
|
||||||
r = reader.get().readInt32(tempOut_Zip);
|
r = reader.get().readInt32(tempOut_Zip);
|
||||||
obj.get().argValue.Zip = tempOut_Zip.get();
|
obj.get().argValue.Zip = tempOut_Zip.get();
|
||||||
if (r != Result.SUCCESS) {
|
if (r != Result.SUCCESS) {
|
||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case "plus4":
|
case "plus4":
|
||||||
short value;
|
short value;
|
||||||
Out<Short> tempOut_value = new Out<Short>();
|
Out<Short> tempOut_value = new Out<Short>();
|
||||||
r = reader.get().readInt16(tempOut_value);
|
r = reader.get().readInt16(tempOut_value);
|
||||||
value = tempOut_value.get();
|
value = tempOut_value.get();
|
||||||
if (r != Result.SUCCESS) {
|
if (r != Result.SUCCESS) {
|
||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
|
|
||||||
obj.get().Plus4 = value;
|
obj.get().Plus4 = value;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return Result.SUCCESS;
|
return Result.SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Result Write(Reference<RowWriter> writer, TypeArgument typeArg, PostalCode obj) {
|
public static Result Write(Reference<RowWriter> writer, TypeArgument typeArg, PostalCode obj) {
|
||||||
Result r;
|
Result r;
|
||||||
r = writer.get().writeInt32("zip", obj.Zip);
|
r = writer.get().writeInt32("zip", obj.Zip);
|
||||||
if (r != Result.SUCCESS) {
|
if (r != Result.SUCCESS) {
|
||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (obj.Plus4.HasValue) {
|
if (obj.Plus4.HasValue) {
|
||||||
r = writer.get().writeInt16("plus4", obj.Plus4.Value);
|
r = writer.get().writeInt16("plus4", obj.Plus4.Value);
|
||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
|
|
||||||
return Result.SUCCESS;
|
return Result.SUCCESS;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+125
-125
@@ -1,126 +1,126 @@
|
|||||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||||
// Licensed under the MIT License.
|
// Licensed under the MIT License.
|
||||||
|
|
||||||
package com.azure.data.cosmos.serialization.hybridrow.unit.internal;
|
package com.azure.data.cosmos.serialization.hybridrow.unit.internal;
|
||||||
|
|
||||||
import com.azure.data.cosmos.serialization.hybridrow.internal.Murmur3Hash;
|
import com.azure.data.cosmos.serialization.hybridrow.internal.Murmur3Hash;
|
||||||
|
|
||||||
import java.util.Random;
|
import java.util.Random;
|
||||||
|
|
||||||
// TODO: C# TO JAVA CONVERTER: Java annotations will not correspond to .NET attributes:
|
// TODO: C# TO JAVA CONVERTER: Java annotations will not correspond to .NET attributes:
|
||||||
//ORIGINAL LINE: [TestClass] public class MurmurHash3UnitTests
|
//ORIGINAL LINE: [TestClass] public class MurmurHash3UnitTests
|
||||||
public class MurmurHash3UnitTests {
|
public class MurmurHash3UnitTests {
|
||||||
|
|
||||||
//C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java:
|
//C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java:
|
||||||
//ORIGINAL LINE: private static readonly(ulong low, ulong high)[] Expected = new[] { (0x56F1549659CBEE1AUL,
|
//ORIGINAL LINE: private static readonly(ulong low, ulong high)[] Expected = new[] { (0x56F1549659CBEE1AUL,
|
||||||
// 0xCEB3EE124C3E3855UL), (0xFE84B58886F9D717UL, 0xD24C5DE024F5EA6BUL), (0x89F6250648BB11BFUL,
|
// 0xCEB3EE124C3E3855UL), (0xFE84B58886F9D717UL, 0xD24C5DE024F5EA6BUL), (0x89F6250648BB11BFUL,
|
||||||
// 0x95595FB9D4CF58B0UL), (0xC76AFDB39EDC6262UL, 0xB9286AF4FADAF497UL), (0xC2CB4D9B3C9C247EUL,
|
// 0x95595FB9D4CF58B0UL), (0xC76AFDB39EDC6262UL, 0xB9286AF4FADAF497UL), (0xC2CB4D9B3C9C247EUL,
|
||||||
// 0xB465D40116B8B7A2UL), (0x317178F5B26D0B35UL, 0x1D564F53E2E468ADUL), (0xE8D75F7C05F43F09UL,
|
// 0xB465D40116B8B7A2UL), (0x317178F5B26D0B35UL, 0x1D564F53E2E468ADUL), (0xE8D75F7C05F43F09UL,
|
||||||
// 0xA81CEA052AE92D6FUL), (0x8F837665508C08A8UL, 0x2A74E6E47E5497BCUL), (0x609778FDA1AFD731UL,
|
// 0xA81CEA052AE92D6FUL), (0x8F837665508C08A8UL, 0x2A74E6E47E5497BCUL), (0x609778FDA1AFD731UL,
|
||||||
// 0x3EB1A0E3BFC653E4UL), (0x0F59B8965FA49D1AUL, 0xCB3BC158243A5DEEUL), (0x7A6D0AC9C98F5908UL,
|
// 0x3EB1A0E3BFC653E4UL), (0x0F59B8965FA49D1AUL, 0xCB3BC158243A5DEEUL), (0x7A6D0AC9C98F5908UL,
|
||||||
// 0xBC93D3042C3E7178UL), (0x863FE5AEBA9A3DFAUL, 0xDF42416658CB87C5UL), (0xDB4C82337C8FB216UL,
|
// 0xBC93D3042C3E7178UL), (0x863FE5AEBA9A3DFAUL, 0xDF42416658CB87C5UL), (0xDB4C82337C8FB216UL,
|
||||||
// 0xCA7616B64ABF6B3DUL), (0x0049223177425B48UL, 0x25510D7246BC3C2CUL), (0x31AC129B24F82CABUL,
|
// 0xCA7616B64ABF6B3DUL), (0x0049223177425B48UL, 0x25510D7246BC3C2CUL), (0x31AC129B24F82CABUL,
|
||||||
// 0xCD7174C2040E9834UL), (0xCE39465288116345UL, 0x1CE6A26BA2E9E67DUL), (0xD2BE55791E13DB17UL,
|
// 0xCD7174C2040E9834UL), (0xCE39465288116345UL, 0x1CE6A26BA2E9E67DUL), (0xD2BE55791E13DB17UL,
|
||||||
// 0xCF30BF3D93B3A9FAUL), (0x43E323DD0F079145UL, 0xF06721555571ABBAUL), (0xB0CE9F170A96F5BCUL,
|
// 0xCF30BF3D93B3A9FAUL), (0x43E323DD0F079145UL, 0xF06721555571ABBAUL), (0xB0CE9F170A96F5BCUL,
|
||||||
// 0x18EE95960369D702UL), (0xBFFAF6BEBC84A2A9UL, 0xE0612B6FC0C9D502UL), (0x33E2D699697BC2DAUL,
|
// 0x18EE95960369D702UL), (0xBFFAF6BEBC84A2A9UL, 0xE0612B6FC0C9D502UL), (0x33E2D699697BC2DAUL,
|
||||||
// 0xB7E9CD6313DE05EEUL), (0xCBFD7D8DA2A962BFUL, 0xCF4C281A7750E88AUL), (0xBD8D863F83863088UL,
|
// 0xB7E9CD6313DE05EEUL), (0xCBFD7D8DA2A962BFUL, 0xCF4C281A7750E88AUL), (0xBD8D863F83863088UL,
|
||||||
// 0x01AFFBDE3D405D35UL), (0xBA2E05DF3328C7DBUL, 0x9620867ADDFE6579UL), (0xC57BD1FB63CA0947UL,
|
// 0x01AFFBDE3D405D35UL), (0xBA2E05DF3328C7DBUL, 0x9620867ADDFE6579UL), (0xC57BD1FB63CA0947UL,
|
||||||
// 0xE1391F8454D4EA9FUL), (0x6AB710460A5BF9BAUL, 0x11D7E13FBEF63775UL), (0x55C2C7C95F41C483UL,
|
// 0xE1391F8454D4EA9FUL), (0x6AB710460A5BF9BAUL, 0x11D7E13FBEF63775UL), (0x55C2C7C95F41C483UL,
|
||||||
// 0xA4DCC9F547A89563UL), (0x8AA5A2031027F216UL, 0x1653FC7AD6CC6104UL), (0xAD8A899FF093D9A5UL,
|
// 0xA4DCC9F547A89563UL), (0x8AA5A2031027F216UL, 0x1653FC7AD6CC6104UL), (0xAD8A899FF093D9A5UL,
|
||||||
// 0x0EB26F6D1CCEB258UL), (0xA3B6D57EBEB965D1UL, 0xE8078FCC5D8C2E3EUL), (0x91ABF587B38224F6UL,
|
// 0x0EB26F6D1CCEB258UL), (0xA3B6D57EBEB965D1UL, 0xE8078FCC5D8C2E3EUL), (0x91ABF587B38224F6UL,
|
||||||
// 0x35899665A8A9252CUL), (0xF05B1AF0487EE2D4UL, 0x5D7496C1665DDE12UL)};
|
// 0x35899665A8A9252CUL), (0xF05B1AF0487EE2D4UL, 0x5D7496C1665DDE12UL)};
|
||||||
|
|
||||||
private static final Murmur3Hash.HashCode128[] EXPECTED_VALUES = new Murmur3Hash.HashCode128[] {
|
private static final Murmur3Hash.HashCode128[] EXPECTED_VALUES = new Murmur3Hash.HashCode128[] {
|
||||||
new Murmur3Hash.HashCode128(0x56F1549659CBEE1AL, 0xCEB3EE124C3E3855L),
|
new Murmur3Hash.HashCode128(0x56F1549659CBEE1AL, 0xCEB3EE124C3E3855L),
|
||||||
new Murmur3Hash.HashCode128(0xFE84B58886F9D717L, 0xD24C5DE024F5EA6BL),
|
new Murmur3Hash.HashCode128(0xFE84B58886F9D717L, 0xD24C5DE024F5EA6BL),
|
||||||
new Murmur3Hash.HashCode128(0x89F6250648BB11BFL, 0x95595FB9D4CF58B0L),
|
new Murmur3Hash.HashCode128(0x89F6250648BB11BFL, 0x95595FB9D4CF58B0L),
|
||||||
new Murmur3Hash.HashCode128(0xC76AFDB39EDC6262L, 0xB9286AF4FADAF497L),
|
new Murmur3Hash.HashCode128(0xC76AFDB39EDC6262L, 0xB9286AF4FADAF497L),
|
||||||
new Murmur3Hash.HashCode128(0xC2CB4D9B3C9C247EL, 0xB465D40116B8B7A2L),
|
new Murmur3Hash.HashCode128(0xC2CB4D9B3C9C247EL, 0xB465D40116B8B7A2L),
|
||||||
new Murmur3Hash.HashCode128(0x317178F5B26D0B35L, 0x1D564F53E2E468ADL),
|
new Murmur3Hash.HashCode128(0x317178F5B26D0B35L, 0x1D564F53E2E468ADL),
|
||||||
new Murmur3Hash.HashCode128(0xE8D75F7C05F43F09L, 0xA81CEA052AE92D6FL),
|
new Murmur3Hash.HashCode128(0xE8D75F7C05F43F09L, 0xA81CEA052AE92D6FL),
|
||||||
new Murmur3Hash.HashCode128(0x8F837665508C08A8L, 0x2A74E6E47E5497BCL),
|
new Murmur3Hash.HashCode128(0x8F837665508C08A8L, 0x2A74E6E47E5497BCL),
|
||||||
new Murmur3Hash.HashCode128(0x609778FDA1AFD731L, 0x3EB1A0E3BFC653E4L),
|
new Murmur3Hash.HashCode128(0x609778FDA1AFD731L, 0x3EB1A0E3BFC653E4L),
|
||||||
new Murmur3Hash.HashCode128(0x0F59B8965FA49D1AL, 0xCB3BC158243A5DEEL),
|
new Murmur3Hash.HashCode128(0x0F59B8965FA49D1AL, 0xCB3BC158243A5DEEL),
|
||||||
new Murmur3Hash.HashCode128(0x7A6D0AC9C98F5908L, 0xBC93D3042C3E7178L),
|
new Murmur3Hash.HashCode128(0x7A6D0AC9C98F5908L, 0xBC93D3042C3E7178L),
|
||||||
new Murmur3Hash.HashCode128(0x863FE5AEBA9A3DFAL, 0xDF42416658CB87C5L),
|
new Murmur3Hash.HashCode128(0x863FE5AEBA9A3DFAL, 0xDF42416658CB87C5L),
|
||||||
new Murmur3Hash.HashCode128(0xDB4C82337C8FB216L, 0xCA7616B64ABF6B3DL),
|
new Murmur3Hash.HashCode128(0xDB4C82337C8FB216L, 0xCA7616B64ABF6B3DL),
|
||||||
new Murmur3Hash.HashCode128(0x0049223177425B48L, 0x25510D7246BC3C2CL),
|
new Murmur3Hash.HashCode128(0x0049223177425B48L, 0x25510D7246BC3C2CL),
|
||||||
new Murmur3Hash.HashCode128(0x31AC129B24F82CABL, 0xCD7174C2040E9834L),
|
new Murmur3Hash.HashCode128(0x31AC129B24F82CABL, 0xCD7174C2040E9834L),
|
||||||
new Murmur3Hash.HashCode128(0xCE39465288116345L, 0x1CE6A26BA2E9E67DL),
|
new Murmur3Hash.HashCode128(0xCE39465288116345L, 0x1CE6A26BA2E9E67DL),
|
||||||
new Murmur3Hash.HashCode128(0xD2BE55791E13DB17L, 0xCF30BF3D93B3A9FAL),
|
new Murmur3Hash.HashCode128(0xD2BE55791E13DB17L, 0xCF30BF3D93B3A9FAL),
|
||||||
new Murmur3Hash.HashCode128(0x43E323DD0F079145L, 0xF06721555571ABBAL),
|
new Murmur3Hash.HashCode128(0x43E323DD0F079145L, 0xF06721555571ABBAL),
|
||||||
new Murmur3Hash.HashCode128(0xB0CE9F170A96F5BCL, 0x18EE95960369D702L),
|
new Murmur3Hash.HashCode128(0xB0CE9F170A96F5BCL, 0x18EE95960369D702L),
|
||||||
new Murmur3Hash.HashCode128(0xBFFAF6BEBC84A2A9L, 0xE0612B6FC0C9D502L),
|
new Murmur3Hash.HashCode128(0xBFFAF6BEBC84A2A9L, 0xE0612B6FC0C9D502L),
|
||||||
new Murmur3Hash.HashCode128(0x33E2D699697BC2DAL, 0xB7E9CD6313DE05EEL),
|
new Murmur3Hash.HashCode128(0x33E2D699697BC2DAL, 0xB7E9CD6313DE05EEL),
|
||||||
new Murmur3Hash.HashCode128(0xCBFD7D8DA2A962BFL, 0xCF4C281A7750E88AL),
|
new Murmur3Hash.HashCode128(0xCBFD7D8DA2A962BFL, 0xCF4C281A7750E88AL),
|
||||||
new Murmur3Hash.HashCode128(0xBD8D863F83863088L, 0x01AFFBDE3D405D35L),
|
new Murmur3Hash.HashCode128(0xBD8D863F83863088L, 0x01AFFBDE3D405D35L),
|
||||||
new Murmur3Hash.HashCode128(0xBA2E05DF3328C7DBL, 0x9620867ADDFE6579L),
|
new Murmur3Hash.HashCode128(0xBA2E05DF3328C7DBL, 0x9620867ADDFE6579L),
|
||||||
new Murmur3Hash.HashCode128(0xC57BD1FB63CA0947L, 0xE1391F8454D4EA9FL),
|
new Murmur3Hash.HashCode128(0xC57BD1FB63CA0947L, 0xE1391F8454D4EA9FL),
|
||||||
new Murmur3Hash.HashCode128(0x6AB710460A5BF9BAL, 0x11D7E13FBEF63775L),
|
new Murmur3Hash.HashCode128(0x6AB710460A5BF9BAL, 0x11D7E13FBEF63775L),
|
||||||
new Murmur3Hash.HashCode128(0x55C2C7C95F41C483L, 0xA4DCC9F547A89563L),
|
new Murmur3Hash.HashCode128(0x55C2C7C95F41C483L, 0xA4DCC9F547A89563L),
|
||||||
new Murmur3Hash.HashCode128(0x8AA5A2031027F216L, 0x1653FC7AD6CC6104L),
|
new Murmur3Hash.HashCode128(0x8AA5A2031027F216L, 0x1653FC7AD6CC6104L),
|
||||||
new Murmur3Hash.HashCode128(0xAD8A899FF093D9A5L, 0x0EB26F6D1CCEB258L),
|
new Murmur3Hash.HashCode128(0xAD8A899FF093D9A5L, 0x0EB26F6D1CCEB258L),
|
||||||
new Murmur3Hash.HashCode128(0xA3B6D57EBEB965D1L, 0xE8078FCC5D8C2E3EL),
|
new Murmur3Hash.HashCode128(0xA3B6D57EBEB965D1L, 0xE8078FCC5D8C2E3EL),
|
||||||
new Murmur3Hash.HashCode128(0x91ABF587B38224F6L, 0x35899665A8A9252CL),
|
new Murmur3Hash.HashCode128(0x91ABF587B38224F6L, 0x35899665A8A9252CL),
|
||||||
new Murmur3Hash.HashCode128(0xF05B1AF0487EE2D4L, 0x5D7496C1665DDE12L) };
|
new Murmur3Hash.HashCode128(0xF05B1AF0487EE2D4L, 0x5D7496C1665DDE12L) };
|
||||||
|
|
||||||
// TODO: C# TO JAVA CONVERTER: Java annotations will not correspond to .NET attributes:
|
// TODO: C# TO JAVA CONVERTER: Java annotations will not correspond to .NET attributes:
|
||||||
// ORIGINAL LINE:
|
// ORIGINAL LINE:
|
||||||
// [TestMethod][Owner("jthunter")] public void Hash128Check()
|
// [TestMethod][Owner("jthunter")] public void Hash128Check()
|
||||||
public final void Hash128Check() {
|
public final void Hash128Check() {
|
||||||
// Generate deterministic data for which the Murmur3Hash is known (see Expected).
|
// Generate deterministic data for which the Murmur3Hash is known (see Expected).
|
||||||
Random rand = new Random(42);
|
Random rand = new Random(42);
|
||||||
//C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java:
|
//C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java:
|
||||||
//ORIGINAL LINE: byte[][] samples = new byte[MurmurHash3UnitTests.Expected.Length][];
|
//ORIGINAL LINE: byte[][] samples = new byte[MurmurHash3UnitTests.Expected.Length][];
|
||||||
byte[][] samples = new byte[MurmurHash3UnitTests.EXPECTED_VALUES.length][];
|
byte[][] samples = new byte[MurmurHash3UnitTests.EXPECTED_VALUES.length][];
|
||||||
for (int i = 0; i < samples.length; i++) {
|
for (int i = 0; i < samples.length; i++) {
|
||||||
int sampleLength = rand.nextInt(10 * 1024);
|
int sampleLength = rand.nextInt(10 * 1024);
|
||||||
//C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java:
|
//C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java:
|
||||||
//ORIGINAL LINE: samples[i] = new byte[sampleLength];
|
//ORIGINAL LINE: samples[i] = new byte[sampleLength];
|
||||||
samples[i] = new byte[sampleLength];
|
samples[i] = new byte[sampleLength];
|
||||||
rand.nextBytes(samples[i]);
|
rand.nextBytes(samples[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Warm up the loop and verify correctness.
|
// Warm up the loop and verify correctness.
|
||||||
for (int i = 0; i < samples.length; i++) {
|
for (int i = 0; i < samples.length; i++) {
|
||||||
//C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java:
|
//C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java:
|
||||||
//ORIGINAL LINE: byte[] sample = samples[i];
|
//ORIGINAL LINE: byte[] sample = samples[i];
|
||||||
byte[] sample = samples[i];
|
byte[] sample = samples[i];
|
||||||
// TODO: C# TO JAVA CONVERTER: Java has no equivalent to C# deconstruction declarations:
|
// TODO: C# TO JAVA CONVERTER: Java has no equivalent to C# deconstruction declarations:
|
||||||
( long low, long high) = Murmur3Hash.Hash128(sample, (0, 0))
|
( long low, long high) = Murmur3Hash.Hash128(sample, (0, 0))
|
||||||
System.out.println(String.format("(0x%016XUL, 0x%1.16XUL),", high, low));
|
System.out.println(String.format("(0x%016XUL, 0x%1.16XUL),", high, low));
|
||||||
assert MurmurHash3UnitTests.EXPECTED_VALUES[i].high == high;
|
assert MurmurHash3UnitTests.EXPECTED_VALUES[i].high == high;
|
||||||
assert MurmurHash3UnitTests.EXPECTED_VALUES[i].low == low;
|
assert MurmurHash3UnitTests.EXPECTED_VALUES[i].low == low;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Measure performance.
|
// Measure performance.
|
||||||
long ticks = MurmurHash3UnitTests.MeasureLoop(samples);
|
long ticks = MurmurHash3UnitTests.MeasureLoop(samples);
|
||||||
System.out.println(String.format("Murmur3Hash: %1$s", ticks));
|
System.out.println(String.format("Murmur3Hash: %1$s", ticks));
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: C# TO JAVA CONVERTER: Java annotations will not correspond to .NET attributes:
|
// TODO: C# TO JAVA CONVERTER: Java annotations will not correspond to .NET attributes:
|
||||||
//ORIGINAL LINE: [MethodImpl(MethodImplOptions.NoInlining)][SuppressMessage("Microsoft.Reliability",
|
//ORIGINAL LINE: [MethodImpl(MethodImplOptions.NoInlining)][SuppressMessage("Microsoft.Reliability",
|
||||||
// "CA2001:Avoid calling problematic methods", Justification = "Perf Benchmark")] private static long MeasureLoop
|
// "CA2001:Avoid calling problematic methods", Justification = "Perf Benchmark")] private static long MeasureLoop
|
||||||
// (byte[][] samples)
|
// (byte[][] samples)
|
||||||
//C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java:
|
//C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java:
|
||||||
//ORIGINAL LINE: [MethodImpl(MethodImplOptions.NoInlining)][SuppressMessage("Microsoft.Reliability",
|
//ORIGINAL LINE: [MethodImpl(MethodImplOptions.NoInlining)][SuppressMessage("Microsoft.Reliability",
|
||||||
// "CA2001:Avoid calling problematic methods", Justification = "Perf Benchmark")] private static long MeasureLoop
|
// "CA2001:Avoid calling problematic methods", Justification = "Perf Benchmark")] private static long MeasureLoop
|
||||||
// (byte[][] samples)
|
// (byte[][] samples)
|
||||||
private static long MeasureLoop(byte[][] samples) {
|
private static long MeasureLoop(byte[][] samples) {
|
||||||
final int outerLoopCount = 10000;
|
final int outerLoopCount = 10000;
|
||||||
System.Diagnostics.Stopwatch watch = new System.Diagnostics.Stopwatch();
|
System.Diagnostics.Stopwatch watch = new System.Diagnostics.Stopwatch();
|
||||||
|
|
||||||
System.gc();
|
System.gc();
|
||||||
watch.Start();
|
watch.Start();
|
||||||
for (int j = 0; j < outerLoopCount; j++) {
|
for (int j = 0; j < outerLoopCount; j++) {
|
||||||
//C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java:
|
//C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java:
|
||||||
//ORIGINAL LINE: foreach (byte[] sample in samples)
|
//ORIGINAL LINE: foreach (byte[] sample in samples)
|
||||||
for (byte[] sample : samples) {
|
for (byte[] sample : samples) {
|
||||||
Murmur3Hash.Hash128(sample, (0, 0))
|
Murmur3Hash.Hash128(sample, (0, 0))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
watch.Stop();
|
watch.Stop();
|
||||||
return watch.ElapsedTicks;
|
return watch.ElapsedTicks;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -6,7 +6,7 @@ package com.azure.data.cosmos.core;
|
|||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A container object which may or may not contain a non-null value
|
* A container object which may or may not contain a non-null value.
|
||||||
*
|
*
|
||||||
* This is a value-based class and as such use of identity-sensitive operations--including reference equality
|
* This is a value-based class and as such use of identity-sensitive operations--including reference equality
|
||||||
* ({@code ==}), identity hash code, or synchronization--on instances of {@Reference} may have unpredictable results
|
* ({@code ==}), identity hash code, or synchronization--on instances of {@Reference} may have unpredictable results
|
||||||
@@ -34,7 +34,7 @@ public final class Reference<T> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* {@code true} if there is a value present, otherwise {@code false}
|
* {@code true} if there is a value present, otherwise {@code false}.
|
||||||
*
|
*
|
||||||
* This is equivalent to evaluating the expression {@code ref.get() == null}.
|
* This is equivalent to evaluating the expression {@code ref.get() == null}.
|
||||||
*
|
*
|
||||||
@@ -45,7 +45,7 @@ public final class Reference<T> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Indicates whether some other object is equal to this {@link Reference} value. The other object is considered equal if:
|
* Indicates whether some other object is equal to this {@link Reference} value. The other object is considered equal if:.
|
||||||
* <ul>
|
* <ul>
|
||||||
* <li>it is also an {@link Reference} and;
|
* <li>it is also an {@link Reference} and;
|
||||||
* <li>both instances have no value present or;
|
* <li>both instances have no value present or;
|
||||||
|
|||||||
@@ -44,16 +44,14 @@ public final class Float128 {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The high-order 64 bits of the IEEE 754-2008 128-bit decimal floating point, using the BID
|
* The high-order 64 bits of the IEEE 754-2008 128-bit decimal floating point, using the BID encoding scheme.
|
||||||
* encoding scheme.
|
|
||||||
*/
|
*/
|
||||||
public long high() {
|
public long high() {
|
||||||
return this.high;
|
return this.high;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The low-order 64 bits of the IEEE 754-2008 128-bit decimal floating point, using the BID
|
* The low-order 64 bits of the IEEE 754-2008 128-bit decimal floating point, using the BID encoding scheme.
|
||||||
* encoding scheme.
|
|
||||||
*/
|
*/
|
||||||
public long low() {
|
public long low() {
|
||||||
return this.low;
|
return this.low;
|
||||||
|
|||||||
+1
-1
@@ -16,7 +16,7 @@ public final class HybridRowHeader {
|
|||||||
private HybridRowVersion version = HybridRowVersion.values()[0];
|
private HybridRowVersion version = HybridRowVersion.values()[0];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Initializes a new instance of a {@link HybridRowHeader}
|
* Initializes a new instance of a {@link HybridRowHeader}.
|
||||||
*
|
*
|
||||||
* @param version The version of the HybridRow library used to write this row.
|
* @param version The version of the HybridRow library used to write this row.
|
||||||
* @param schemaId The unique identifier of the schema whose layout was used to write this row.
|
* @param schemaId The unique identifier of the schema whose layout was used to write this row.
|
||||||
|
|||||||
+1
-1
@@ -7,7 +7,7 @@ import it.unimi.dsi.fastutil.ints.Int2ObjectMap;
|
|||||||
import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap;
|
import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Versions of HybridRow
|
* Versions of HybridRow.
|
||||||
* <p>
|
* <p>
|
||||||
* A version from this list MUST be inserted in the version BOM at the beginning of all rows.
|
* A version from this list MUST be inserted in the version BOM at the beginning of all rows.
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -88,7 +88,7 @@ import static com.google.common.base.Strings.lenientFormat;
|
|||||||
//import static com.azure.data.cosmos.serialization.hybridrow.layouts.LayoutTypes.MongoDbObjectId;
|
//import static com.azure.data.cosmos.serialization.hybridrow.layouts.LayoutTypes.MongoDbObjectId;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Manages a sequence of bytes representing a Hybrid Row
|
* Manages a sequence of bytes representing a Hybrid Row.
|
||||||
* <p>
|
* <p>
|
||||||
* A Hybrid Row begins in the 0-th byte of the {@link RowBuffer}. The sequence of bytes is defined by the Hybrid Row
|
* A Hybrid Row begins in the 0-th byte of the {@link RowBuffer}. The sequence of bytes is defined by the Hybrid Row
|
||||||
* grammar.
|
* grammar.
|
||||||
@@ -99,7 +99,7 @@ public final class RowBuffer {
|
|||||||
private LayoutResolver resolver;
|
private LayoutResolver resolver;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Initializes a new instance of a {@link RowBuffer}
|
* Initializes a new instance of a {@link RowBuffer}.
|
||||||
*
|
*
|
||||||
* @param capacity Initial buffer capacity.
|
* @param capacity Initial buffer capacity.
|
||||||
*/
|
*/
|
||||||
@@ -108,7 +108,7 @@ public final class RowBuffer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Initializes a new instance of a {@link RowBuffer}
|
* Initializes a new instance of a {@link RowBuffer}.
|
||||||
*
|
*
|
||||||
* @param capacity Initial buffer capacity
|
* @param capacity Initial buffer capacity
|
||||||
* @param allocator A buffer allocator
|
* @param allocator A buffer allocator
|
||||||
@@ -121,7 +121,7 @@ public final class RowBuffer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Initializes a new instance of a {@link RowBuffer} from an existing buffer
|
* Initializes a new instance of a {@link RowBuffer} from an existing buffer.
|
||||||
*
|
*
|
||||||
* @param buffer An existing {@link ByteBuf} containing a Hybrid Row. This instance takes ownership of the buffer.
|
* @param buffer An existing {@link ByteBuf} containing a Hybrid Row. This instance takes ownership of the buffer.
|
||||||
* Hence, the caller should not maintain a reference to the buffer or mutate the buffer after this
|
* Hence, the caller should not maintain a reference to the buffer or mutate the buffer after this
|
||||||
@@ -156,7 +156,7 @@ public final class RowBuffer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Compute the byte offset from the beginning of the row for a given variable's value
|
* Compute the byte offset from the beginning of the row for a given variable's value.
|
||||||
*
|
*
|
||||||
* @param layout The (optional) layout of the current scope.
|
* @param layout The (optional) layout of the current scope.
|
||||||
* @param scopeOffset The zero-based offset to the beginning of the scope's value.
|
* @param scopeOffset The zero-based offset to the beginning of the scope's value.
|
||||||
@@ -196,7 +196,7 @@ public final class RowBuffer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Compute the number of bytes necessary to store the unsigned 32-bit integer value using the varuint encoding
|
* Compute the number of bytes necessary to store the unsigned 32-bit integer value using the varuint encoding.
|
||||||
*
|
*
|
||||||
* @param value The value to be encoded
|
* @param value The value to be encoded
|
||||||
* @return The number of bytes needed to store the varuint encoding of {@code value}
|
* @return The number of bytes needed to store the varuint encoding of {@code value}
|
||||||
@@ -218,7 +218,7 @@ public final class RowBuffer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Delete the sparse field at the specified cursor position
|
* Delete the sparse field at the specified cursor position.
|
||||||
*
|
*
|
||||||
* @param edit identifies the field to delete
|
* @param edit identifies the field to delete
|
||||||
*/
|
*/
|
||||||
@@ -242,7 +242,7 @@ public final class RowBuffer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Delete the variable-length field at a specified {@code offset}
|
* Delete the variable-length field at a specified {@code offset}.
|
||||||
* <p>
|
* <p>
|
||||||
* The field is interpreted as either a variable-length integer or a variable-length sequence of bytes as indicated
|
* The field is interpreted as either a variable-length integer or a variable-length sequence of bytes as indicated
|
||||||
* by the value of {@code isVarint}.
|
* by the value of {@code isVarint}.
|
||||||
@@ -319,14 +319,14 @@ public final class RowBuffer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The length of this {@link RowBuffer} in bytes
|
* The length of this {@link RowBuffer} in bytes.
|
||||||
*/
|
*/
|
||||||
public int length() {
|
public int length() {
|
||||||
return this.buffer.writerIndex();
|
return this.buffer.writerIndex();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Compute the byte offsets from the beginning of the row for a given sparse field insertion
|
* Compute the byte offsets from the beginning of the row for a given sparse field insertion.
|
||||||
* into a set/map.
|
* into a set/map.
|
||||||
*
|
*
|
||||||
* @param scope The sparse scope to insert into.
|
* @param scope The sparse scope to insert into.
|
||||||
@@ -448,7 +448,7 @@ public final class RowBuffer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Reads in the contents of the current {@link RowBuffer} from an {@link InputStream}
|
* Reads in the contents of the current {@link RowBuffer} from an {@link InputStream}.
|
||||||
* <p>
|
* <p>
|
||||||
* The {@link RowBuffer} is initialized with the associated layout and row {@code version}.
|
* The {@link RowBuffer} is initialized with the associated layout and row {@code version}.
|
||||||
*
|
*
|
||||||
@@ -488,7 +488,7 @@ public final class RowBuffer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Reads the contents of the current {@link RowBuffer} from a {@link ByteBuf}
|
* Reads the contents of the current {@link RowBuffer} from a {@link ByteBuf}.
|
||||||
* <p>
|
* <p>
|
||||||
* The {@link RowBuffer} is initialized with a copy of the specified input {@link ByteBuf} and the associated layout
|
* The {@link RowBuffer} is initialized with a copy of the specified input {@link ByteBuf} and the associated layout
|
||||||
* and row {@code version}.
|
* and row {@code version}.
|
||||||
@@ -795,7 +795,7 @@ public final class RowBuffer {
|
|||||||
// }
|
// }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Rotates the sign bit of a two's complement value to the least significant bit
|
* Rotates the sign bit of a two's complement value to the least significant bit.
|
||||||
*
|
*
|
||||||
* @param value A signed value.
|
* @param value A signed value.
|
||||||
* @return An unsigned value encoding the same value but with the sign bit in the LSB.
|
* @return An unsigned value encoding the same value but with the sign bit in the LSB.
|
||||||
@@ -1172,7 +1172,7 @@ public final class RowBuffer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the specified 64-bit integer at the current {@link RowBuffer position} as a 7-bit encoded 32-bit value
|
* Sets the specified 64-bit integer at the current {@link RowBuffer position} as a 7-bit encoded 32-bit value.
|
||||||
* <p>
|
* <p>
|
||||||
* The 64-bit integer value is written 7-bits at a time. The high bit of the byte, when set, indicates there are
|
* The 64-bit integer value is written 7-bits at a time. The high bit of the byte, when set, indicates there are
|
||||||
* more bytes. An {@link IllegalArgumentException} is thrown, if the specified 64-bit integer value is outside
|
* more bytes. An {@link IllegalArgumentException} is thrown, if the specified 64-bit integer value is outside
|
||||||
@@ -2011,7 +2011,7 @@ public final class RowBuffer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Writes the content of the buffer on to an {@link OutputStream}
|
* Writes the content of the buffer on to an {@link OutputStream}.
|
||||||
*
|
*
|
||||||
* @param stream the target @{link OutputStream}
|
* @param stream the target @{link OutputStream}
|
||||||
* @throws IOException if the specified {@code stream} throws an {@link IOException} during output
|
* @throws IOException if the specified {@code stream} throws an {@link IOException} during output
|
||||||
@@ -2307,7 +2307,7 @@ public final class RowBuffer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Compares the values of two encoded key-value pair fields using the hybrid row binary
|
* Compares the values of two encoded key-value pair fields using the hybrid row binary.
|
||||||
* collation.
|
* collation.
|
||||||
*
|
*
|
||||||
* @param left An edit describing the left field.
|
* @param left An edit describing the left field.
|
||||||
@@ -2500,7 +2500,7 @@ public final class RowBuffer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Ensure that sufficient space exists in the row buffer to write the specified value
|
* Ensure that sufficient space exists in the row buffer to write the specified value.
|
||||||
*
|
*
|
||||||
* @param length The number of bytes needed to encode the value of the field to be written.
|
* @param length The number of bytes needed to encode the value of the field to be written.
|
||||||
* @param edit The prepared edit indicating where and in what context the current write will happen.
|
* @param edit The prepared edit indicating where and in what context the current write will happen.
|
||||||
@@ -2591,7 +2591,7 @@ public final class RowBuffer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Ensure that sufficient space exists in the row buffer to write the specified value
|
* Ensure that sufficient space exists in the row buffer to write the specified value.
|
||||||
*
|
*
|
||||||
* @param length The number of bytes needed to encode the value of the field to be written.
|
* @param length The number of bytes needed to encode the value of the field to be written.
|
||||||
* @param edit The prepared edit indicating where and in what context the current write will happen.
|
* @param edit The prepared edit indicating where and in what context the current write will happen.
|
||||||
@@ -2645,7 +2645,7 @@ public final class RowBuffer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sorts a {@code uniqueIndex} list using the hybrid row binary collation
|
* Sorts a {@code uniqueIndex} list using the hybrid row binary collation.
|
||||||
*
|
*
|
||||||
* @param scope The scope to be sorted.
|
* @param scope The scope to be sorted.
|
||||||
* @param edit A edit that points at the scope.
|
* @param edit A edit that points at the scope.
|
||||||
@@ -2931,7 +2931,7 @@ public final class RowBuffer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Skip over a nested scope
|
* Skip over a nested scope.
|
||||||
*
|
*
|
||||||
* @param edit The sparse scope to search
|
* @param edit The sparse scope to search
|
||||||
* @return The zero-based byte offset immediately following the scope end marker
|
* @return The zero-based byte offset immediately following the scope end marker
|
||||||
@@ -2950,7 +2950,7 @@ public final class RowBuffer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Compute the size of a sparse (primitive) field
|
* Compute the size of a sparse (primitive) field.
|
||||||
*
|
*
|
||||||
* @param type The type of the current sparse field.
|
* @param type The type of the current sparse field.
|
||||||
* @param metaOffset The zero-based offset from the beginning of the row where the field begins.
|
* @param metaOffset The zero-based offset from the beginning of the row where the field begins.
|
||||||
@@ -3039,7 +3039,7 @@ public final class RowBuffer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Compute the size of a sparse field
|
* Compute the size of a sparse field.
|
||||||
*
|
*
|
||||||
* @param edit The edit structure describing the field to measure.
|
* @param edit The edit structure describing the field to measure.
|
||||||
* @return The length (in bytes) of the encoded field including the metadata and the value.
|
* @return The length (in bytes) of the encoded field including the metadata and the value.
|
||||||
@@ -3056,7 +3056,7 @@ public final class RowBuffer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Reads and validates the header of the current {@link RowBuffer}
|
* Reads and validates the header of the current {@link RowBuffer}.
|
||||||
*
|
*
|
||||||
* @return {@code true} if the header validation succeeded; otherwise, if the header is invalid, {@code false}
|
* @return {@code true} if the header validation succeeded; otherwise, if the header is invalid, {@code false}
|
||||||
*/
|
*/
|
||||||
@@ -3378,7 +3378,7 @@ public final class RowBuffer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Represents a single item within a set/map scope that needs to be indexed
|
* Represents a single item within a set/map scope that needs to be indexed.
|
||||||
* <p>
|
* <p>
|
||||||
* This structure is used when rebuilding a set/map index during row streaming via {@link RowWriter}.Each item
|
* This structure is used when rebuilding a set/map index during row streaming via {@link RowWriter}.Each item
|
||||||
* encodes its offsets and length within the row.
|
* encodes its offsets and length within the row.
|
||||||
@@ -3403,7 +3403,7 @@ public final class RowBuffer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* If existing, the offset to the metadata of the existing field, otherwise the location to insert a new field
|
* If existing, the offset to the metadata of the existing field, otherwise the location to insert a new field.
|
||||||
*/
|
*/
|
||||||
public int metaOffset() {
|
public int metaOffset() {
|
||||||
return this.metaOffset;
|
return this.metaOffset;
|
||||||
@@ -3415,7 +3415,7 @@ public final class RowBuffer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Size of the target element
|
* Size of the target element.
|
||||||
*/
|
*/
|
||||||
public int size() {
|
public int size() {
|
||||||
return this.size;
|
return this.size;
|
||||||
@@ -3427,7 +3427,7 @@ public final class RowBuffer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* If existing, the offset to the value of the existing field, otherwise undefined
|
* If existing, the offset to the value of the existing field, otherwise undefined.
|
||||||
*/
|
*/
|
||||||
public int valueOffset() {
|
public int valueOffset() {
|
||||||
return this.valueOffset;
|
return this.valueOffset;
|
||||||
|
|||||||
@@ -126,7 +126,7 @@ public final class RowCursor implements Cloneable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* If existing, the offset to the end of the existing field. Used as a hint when skipping
|
* If existing, the offset to the end of the existing field. Used as a hint when skipping.
|
||||||
* forward.
|
* forward.
|
||||||
*/
|
*/
|
||||||
public int endOffset() {
|
public int endOffset() {
|
||||||
@@ -151,7 +151,7 @@ public final class RowCursor implements Cloneable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* If {@code true}, this scope's nested fields cannot be updated individually
|
* If {@code true}, this scope's nested fields cannot be updated individually.
|
||||||
* <p>
|
* <p>
|
||||||
* The entire scope can still be replaced.
|
* The entire scope can still be replaced.
|
||||||
*/
|
*/
|
||||||
@@ -165,7 +165,7 @@ public final class RowCursor implements Cloneable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* For indexed scopes (e.g. an Array scope), the zero-based index into the scope of the sparse field
|
* For indexed scopes (e.g. an Array scope), the zero-based index into the scope of the sparse field.
|
||||||
*/
|
*/
|
||||||
public int index() {
|
public int index() {
|
||||||
return this.index;
|
return this.index;
|
||||||
@@ -189,7 +189,7 @@ public final class RowCursor implements Cloneable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* If existing, the offset to the metadata of the existing field, otherwise the location to
|
* If existing, the offset to the metadata of the existing field, otherwise the location to.
|
||||||
* insert a new field.
|
* insert a new field.
|
||||||
*/
|
*/
|
||||||
public int metaOffset() {
|
public int metaOffset() {
|
||||||
@@ -226,7 +226,7 @@ public final class RowCursor implements Cloneable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The kind of scope within which this edit was prepared
|
* The kind of scope within which this edit was prepared.
|
||||||
*/
|
*/
|
||||||
public LayoutTypeScope scopeType() {
|
public LayoutTypeScope scopeType() {
|
||||||
return this.scopeType;
|
return this.scopeType;
|
||||||
@@ -238,7 +238,7 @@ public final class RowCursor implements Cloneable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The type parameters of the scope within which this edit was prepared
|
* The type parameters of the scope within which this edit was prepared.
|
||||||
*/
|
*/
|
||||||
public TypeArgumentList scopeTypeArgs() {
|
public TypeArgumentList scopeTypeArgs() {
|
||||||
return this.scopeTypeArgs;
|
return this.scopeTypeArgs;
|
||||||
@@ -250,8 +250,7 @@ public final class RowCursor implements Cloneable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The 0-based byte offset from the beginning of the row where the first sparse field within
|
* The 0-based byte offset from the beginning of the row where the first sparse field within the scope begins.
|
||||||
* the scope begins.
|
|
||||||
*/
|
*/
|
||||||
public int start() {
|
public int start() {
|
||||||
return this.start;
|
return this.start;
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ import java.io.IOException;
|
|||||||
import static com.google.common.base.Strings.lenientFormat;
|
import static com.google.common.base.Strings.lenientFormat;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The unique identifier for a schema
|
* The unique identifier for a schema.
|
||||||
* Identifiers must be unique within the scope of the database in which they are used.
|
* Identifiers must be unique within the scope of the database in which they are used.
|
||||||
*/
|
*/
|
||||||
@JsonDeserialize(using = SchemaId.JsonDeserializer.class)
|
@JsonDeserialize(using = SchemaId.JsonDeserializer.class)
|
||||||
@@ -65,7 +65,7 @@ public final class SchemaId implements Comparable<SchemaId> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* {@code true} if this is the same {@link SchemaId} as {@code other}
|
* {@code true} if this is the same {@link SchemaId} as {@code other}.
|
||||||
*
|
*
|
||||||
* @param other The value to compare against.
|
* @param other The value to compare against.
|
||||||
* @return True if the two values are the same.
|
* @return True if the two values are the same.
|
||||||
@@ -78,7 +78,7 @@ public final class SchemaId implements Comparable<SchemaId> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns a {@link SchemaId} from a specified underlying integer value
|
* Returns a {@link SchemaId} from a specified underlying integer value.
|
||||||
*
|
*
|
||||||
* @return The integer value of this {@link SchemaId}
|
* @return The integer value of this {@link SchemaId}
|
||||||
*/
|
*/
|
||||||
@@ -97,7 +97,7 @@ public final class SchemaId implements Comparable<SchemaId> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The underlying integer value of this {@link SchemaId}
|
* The underlying integer value of this {@link SchemaId}.
|
||||||
*
|
*
|
||||||
* @return The integer value of this {@link SchemaId}
|
* @return The integer value of this {@link SchemaId}
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -11,14 +11,14 @@ package com.azure.data.cosmos.serialization.hybridrow;
|
|||||||
*/
|
*/
|
||||||
public final class UnixDateTime {
|
public final class UnixDateTime {
|
||||||
/**
|
/**
|
||||||
* Unix epoch
|
* Unix epoch.
|
||||||
* <p>
|
* <p>
|
||||||
* {@link UnixDateTime} values are signed values centered on this value.
|
* {@link UnixDateTime} values are signed values centered on this value.
|
||||||
*/
|
*/
|
||||||
public static final UnixDateTime EPOCH = new UnixDateTime();
|
public static final UnixDateTime EPOCH = new UnixDateTime();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Size in bytes of a {@link UnixDateTime}
|
* Size in bytes of a {@link UnixDateTime}.
|
||||||
*/
|
*/
|
||||||
public static final int BYTES = Long.SIZE;
|
public static final int BYTES = Long.SIZE;
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -36,7 +36,7 @@ public final class Murmur3Hash {
|
|||||||
private static final ByteBuf EMPTY_STRING = Constant.add("");
|
private static final ByteBuf EMPTY_STRING = Constant.add("");
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Computes a 128-bit Murmur3Hash 128-bit value for a data item
|
* Computes a 128-bit Murmur3Hash 128-bit value for a data item.
|
||||||
*
|
*
|
||||||
* @param item The data to hash
|
* @param item The data to hash
|
||||||
* @param seed The seed with which to initialize
|
* @param seed The seed with which to initialize
|
||||||
|
|||||||
+17
-17
@@ -55,7 +55,7 @@ import static com.google.common.base.Preconditions.checkState;
|
|||||||
import static com.google.common.base.Strings.lenientFormat;
|
import static com.google.common.base.Strings.lenientFormat;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A forward-only, streaming, field reader for {@link RowBuffer}
|
* A forward-only, streaming, field reader for {@link RowBuffer}.
|
||||||
* <p>
|
* <p>
|
||||||
* A {@link RowReader} allows the traversal in a streaming, left to right fashion, of an entire HybridRow. The row's
|
* A {@link RowReader} allows the traversal in a streaming, left to right fashion, of an entire HybridRow. The row's
|
||||||
* layout provides decoding for any schematized portion of the row. However, unschematized sparse fields are read
|
* layout provides decoding for any schematized portion of the row. However, unschematized sparse fields are read
|
||||||
@@ -75,7 +75,7 @@ public final class RowReader {
|
|||||||
private States state;
|
private States state;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Initializes a new instance of the {@link RowReader} class
|
* Initializes a new instance of the {@link RowReader} class.
|
||||||
*
|
*
|
||||||
* @param row The row to be read
|
* @param row The row to be read
|
||||||
*/
|
*/
|
||||||
@@ -84,7 +84,7 @@ public final class RowReader {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Initializes a new instance of the {@link RowReader} class
|
* Initializes a new instance of the {@link RowReader} class.
|
||||||
*
|
*
|
||||||
* @param row The row to be read
|
* @param row The row to be read
|
||||||
* @param checkpoint Initial state of the reader
|
* @param checkpoint Initial state of the reader
|
||||||
@@ -101,7 +101,7 @@ public final class RowReader {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Initializes a new instance of the {@link RowReader} class
|
* Initializes a new instance of the {@link RowReader} class.
|
||||||
*
|
*
|
||||||
* @param row The row to be read
|
* @param row The row to be read
|
||||||
* @param scope Cursor defining the scope of the fields to be read
|
* @param scope Cursor defining the scope of the fields to be read
|
||||||
@@ -123,7 +123,7 @@ public final class RowReader {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Read the current field as a fixed length {@code MongoDbObjectId} value
|
* Read the current field as a fixed length {@code MongoDbObjectId} value.
|
||||||
*
|
*
|
||||||
* @param value On success, receives the value, undefined otherwise
|
* @param value On success, receives the value, undefined otherwise
|
||||||
* @return {@link Result#SUCCESS} if the read is successful, an error {@link Result} otherwise.
|
* @return {@link Result#SUCCESS} if the read is successful, an error {@link Result} otherwise.
|
||||||
@@ -151,7 +151,7 @@ public final class RowReader {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* {@code true} if field has a value--if positioned on a field--undefined otherwise
|
* {@code true} if field has a value--if positioned on a field--undefined otherwise.
|
||||||
* <p>
|
* <p>
|
||||||
* If the current field is a Nullable scope, this method return true if the value is not null. If the current field
|
* If the current field is a Nullable scope, this method return true if the value is not null. If the current field
|
||||||
* is a nullable Null primitive value, this method return true if the value is set (even though its values is set
|
* is a nullable Null primitive value, this method return true if the value is set (even though its values is set
|
||||||
@@ -177,7 +177,7 @@ public final class RowReader {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Zero-based index, relative to the scope, of the field--if positioned on a field--undefined otherwise
|
* Zero-based index, relative to the scope, of the field--if positioned on a field--undefined otherwise.
|
||||||
* <p>
|
* <p>
|
||||||
* When enumerating a non-indexed scope, this value is always zero.
|
* When enumerating a non-indexed scope, this value is always zero.
|
||||||
*
|
*
|
||||||
@@ -188,14 +188,14 @@ public final class RowReader {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The length of row in bytes
|
* The length of row in bytes.
|
||||||
*/
|
*/
|
||||||
public int length() {
|
public int length() {
|
||||||
return this.row.length();
|
return this.row.length();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The path, relative to the scope, of the field--if positioned on a field--undefined otherwise
|
* The path, relative to the scope, of the field--if positioned on a field--undefined otherwise.
|
||||||
* <p>
|
* <p>
|
||||||
* When enumerating an indexed scope, this value is always null.
|
* When enumerating an indexed scope, this value is always null.
|
||||||
*
|
*
|
||||||
@@ -224,7 +224,7 @@ public final class RowReader {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The path, relative to the scope, of the field--if positioned on a field--undefined otherwise
|
* The path, relative to the scope, of the field--if positioned on a field--undefined otherwise.
|
||||||
* <p>
|
* <p>
|
||||||
* When enumerating an indexed scope, this value is always null.
|
* When enumerating an indexed scope, this value is always null.
|
||||||
*
|
*
|
||||||
@@ -242,7 +242,7 @@ public final class RowReader {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Advances the reader to the next field
|
* Advances the reader to the next field.
|
||||||
*
|
*
|
||||||
* @return {@code true}, if there is another field to be read; {@code false} otherwise
|
* @return {@code true}, if there is another field to be read; {@code false} otherwise
|
||||||
*/
|
*/
|
||||||
@@ -292,7 +292,7 @@ public final class RowReader {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Read the current field as a variable length, sequence of bytes
|
* Read the current field as a variable length, sequence of bytes.
|
||||||
*
|
*
|
||||||
* @param value On success, receives the value, undefined otherwise.
|
* @param value On success, receives the value, undefined otherwise.
|
||||||
* @return {@link Result#SUCCESS} if the read is successful, an error {@link Result} otherwise.
|
* @return {@link Result#SUCCESS} if the read is successful, an error {@link Result} otherwise.
|
||||||
@@ -321,7 +321,7 @@ public final class RowReader {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Read the current field as a variable length, sequence of bytes
|
* Read the current field as a variable length, sequence of bytes.
|
||||||
*
|
*
|
||||||
* @param value On success, receives the value, undefined otherwise.
|
* @param value On success, receives the value, undefined otherwise.
|
||||||
* @return {@link Result#SUCCESS} if the read is successful, an error {@link Result} otherwise.
|
* @return {@link Result#SUCCESS} if the read is successful, an error {@link Result} otherwise.
|
||||||
@@ -341,7 +341,7 @@ public final class RowReader {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Read the current field as a {@link Boolean}
|
* Read the current field as a {@link Boolean}.
|
||||||
*
|
*
|
||||||
* @param value On success, receives the value, undefined otherwise.
|
* @param value On success, receives the value, undefined otherwise.
|
||||||
* @return {@link Result#SUCCESS} if the read is successful, an error {@link Result} otherwise.
|
* @return {@link Result#SUCCESS} if the read is successful, an error {@link Result} otherwise.
|
||||||
@@ -369,7 +369,7 @@ public final class RowReader {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Read the current field as a fixed length {@code DateTime} value
|
* Read the current field as a fixed length {@code DateTime} value.
|
||||||
*
|
*
|
||||||
* @param value On success, receives the value, undefined otherwise.
|
* @param value On success, receives the value, undefined otherwise.
|
||||||
* @return {@link Result#SUCCESS} if the read is successful, an error {@link Result} otherwise.
|
* @return {@link Result#SUCCESS} if the read is successful, an error {@link Result} otherwise.
|
||||||
@@ -397,7 +397,7 @@ public final class RowReader {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Read the current field as a fixed length decimal value
|
* Read the current field as a fixed length decimal value.
|
||||||
*
|
*
|
||||||
* @param value On success, receives the value, undefined otherwise.
|
* @param value On success, receives the value, undefined otherwise.
|
||||||
* @return {@link Result#SUCCESS} if the read is successful, an error {@link Result} otherwise.
|
* @return {@link Result#SUCCESS} if the read is successful, an error {@link Result} otherwise.
|
||||||
@@ -424,7 +424,7 @@ public final class RowReader {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Read the current field as a fixed length, 128-bit, IEEE-encoded floating point value
|
* Read the current field as a fixed length, 128-bit, IEEE-encoded floating point value.
|
||||||
*
|
*
|
||||||
* @param value On success, receives the value, undefined otherwise.
|
* @param value On success, receives the value, undefined otherwise.
|
||||||
* @return {@link Result#SUCCESS} if the read is successful, an error {@link Result} otherwise.
|
* @return {@link Result#SUCCESS} if the read is successful, an error {@link Result} otherwise.
|
||||||
|
|||||||
@@ -59,7 +59,7 @@ public final class RowWriter {
|
|||||||
private RowBuffer row;
|
private RowBuffer row;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Initializes a new instance of the {@link RowWriter} class
|
* Initializes a new instance of the {@link RowWriter} class.
|
||||||
*
|
*
|
||||||
* @param row The row to be read.
|
* @param row The row to be read.
|
||||||
* @param scope The scope into which items should be written.
|
* @param scope The scope into which items should be written.
|
||||||
|
|||||||
+4
-4
@@ -21,7 +21,7 @@ import static com.google.common.base.Preconditions.checkArgument;
|
|||||||
import static com.google.common.base.Preconditions.checkNotNull;
|
import static com.google.common.base.Preconditions.checkNotNull;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A Layout describes the structure of a Hybrid Row
|
* A Layout describes the structure of a Hybrid Row.
|
||||||
* <p>
|
* <p>
|
||||||
* A layout indicates the number, order, and type of all schematized columns to be stored within a hybrid row. The
|
* A layout indicates the number, order, and type of all schematized columns to be stored within a hybrid row. The
|
||||||
* order and type of columns defines the physical ordering of bytes used to encode the row and impacts the cost of
|
* order and type of columns defines the physical ordering of bytes used to encode the row and impacts the cost of
|
||||||
@@ -97,7 +97,7 @@ public final class Layout {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Finds a column specification for a column with a matching path
|
* Finds a column specification for a column with a matching path.
|
||||||
*
|
*
|
||||||
* @param path path of the column to find
|
* @param path path of the column to find
|
||||||
* @return {@link LayoutColumn}, if a column with the {@code path} is found, {@link Optional#empty()}
|
* @return {@link LayoutColumn}, if a column with the {@code path} is found, {@link Optional#empty()}
|
||||||
@@ -129,7 +129,7 @@ public final class Layout {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Top level columns defined by the current {@link Layout} in left-to-right order
|
* Top level columns defined by the current {@link Layout} in left-to-right order.
|
||||||
*
|
*
|
||||||
* @return Top level columns defined by the current {@link Layout} in left-to-right order
|
* @return Top level columns defined by the current {@link Layout} in left-to-right order
|
||||||
*/
|
*/
|
||||||
@@ -188,7 +188,7 @@ public final class Layout {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns a human readable diagnostic string representation of this {@link Layout}
|
* Returns a human readable diagnostic string representation of this {@link Layout}.
|
||||||
* <p>
|
* <p>
|
||||||
* This representation should only be used for debugging and diagnostic purposes.
|
* This representation should only be used for debugging and diagnostic purposes.
|
||||||
*/
|
*/
|
||||||
|
|||||||
+1
-1
@@ -15,7 +15,7 @@ import static com.google.common.base.Preconditions.checkNotNull;
|
|||||||
import static com.google.common.base.Strings.lenientFormat;
|
import static com.google.common.base.Strings.lenientFormat;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Describes the physical byte layout of a hybrid row field of a specific physical type {@code T}
|
* Describes the physical byte layout of a hybrid row field of a specific physical type {@code T}.
|
||||||
*
|
*
|
||||||
* {@link LayoutType} provides methods for manipulating hybrid row fields of a particular type, and properties that
|
* {@link LayoutType} provides methods for manipulating hybrid row fields of a particular type, and properties that
|
||||||
* describe the layout of fields of that type.
|
* describe the layout of fields of that type.
|
||||||
|
|||||||
+3
-3
@@ -4,7 +4,7 @@
|
|||||||
package com.azure.data.cosmos.serialization.hybridrow.schemas;
|
package com.azure.data.cosmos.serialization.hybridrow.schemas;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Map properties represent an unbounded set of zero or more key-value pairs with unique keys
|
* Map properties represent an unbounded set of zero or more key-value pairs with unique keys.
|
||||||
* <p>
|
* <p>
|
||||||
* Maps are typed or untyped. Within typed maps, all key MUST be the same type, and all values MUST be the same type.
|
* Maps are typed or untyped. Within typed maps, all key MUST be the same type, and all values MUST be the same type.
|
||||||
* The type of both key and values is specified via {@link #keys} and {@link #values} respectively. Typed maps may be
|
* The type of both key and values is specified via {@link #keys} and {@link #values} respectively. Typed maps may be
|
||||||
@@ -17,7 +17,7 @@ public class MapPropertyType extends ScopePropertyType {
|
|||||||
private PropertyType values;
|
private PropertyType values;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* (Optional) type of the keys of the map, if a typed map, otherwise {@code null}
|
* (Optional) type of the keys of the map, if a typed map, otherwise {@code null}.
|
||||||
*/
|
*/
|
||||||
public final PropertyType keys() {
|
public final PropertyType keys() {
|
||||||
return this.keys;
|
return this.keys;
|
||||||
@@ -29,7 +29,7 @@ public class MapPropertyType extends ScopePropertyType {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* (Optional) type of the values of the map, if a typed map, otherwise {@code null}
|
* (Optional) type of the values of the map, if a typed map, otherwise {@code null}.
|
||||||
*/
|
*/
|
||||||
public final PropertyType values() {
|
public final PropertyType values() {
|
||||||
return this.values;
|
return this.values;
|
||||||
|
|||||||
+1
-1
@@ -25,7 +25,7 @@ public class ObjectPropertyType extends ScopePropertyType {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A list of zero or more property definitions that define the columns within the schema
|
* A list of zero or more property definitions that define the columns within the schema.
|
||||||
*/
|
*/
|
||||||
public final List<Property> properties() {
|
public final List<Property> properties() {
|
||||||
return this.properties;
|
return this.properties;
|
||||||
|
|||||||
+1
-1
@@ -4,7 +4,7 @@
|
|||||||
package com.azure.data.cosmos.serialization.hybridrow.schemas;
|
package com.azure.data.cosmos.serialization.hybridrow.schemas;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Describes a property or set of properties used to order the data set within a single
|
* Describes a property or set of properties used to order the data set within a single.
|
||||||
* partition.
|
* partition.
|
||||||
*/
|
*/
|
||||||
public class PrimarySortKey {
|
public class PrimarySortKey {
|
||||||
|
|||||||
+9
-9
@@ -19,7 +19,7 @@ import static com.google.common.base.Preconditions.checkArgument;
|
|||||||
import static com.google.common.base.Preconditions.checkNotNull;
|
import static com.google.common.base.Preconditions.checkNotNull;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A schema describes either table or UDT metadata
|
* A schema describes either table or UDT metadata.
|
||||||
* <p>
|
* <p>
|
||||||
* The schema of a table or UDT describes the structure of row (i.e. which columns and the types of those columns). A
|
* The schema of a table or UDT describes the structure of row (i.e. which columns and the types of those columns). A
|
||||||
* table schema represents the description of the contents of a collection level row directly. UDTs described nested
|
* table schema represents the description of the contents of a collection level row directly. UDTs described nested
|
||||||
@@ -63,7 +63,7 @@ public class Schema {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Compiles this logical schema into a physical layout that can be used to read and write rows
|
* Compiles this logical schema into a physical layout that can be used to read and write rows.
|
||||||
*
|
*
|
||||||
* @param ns The namespace within which this schema is defined.
|
* @param ns The namespace within which this schema is defined.
|
||||||
* @return The layout for the schema.
|
* @return The layout for the schema.
|
||||||
@@ -117,7 +117,7 @@ public class Schema {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* An (optional) list of zero or more logical paths that form the partition key
|
* An (optional) list of zero or more logical paths that form the partition key.
|
||||||
* <p>
|
* <p>
|
||||||
* All paths referenced MUST map to a property within the schema. This field is never null.
|
* All paths referenced MUST map to a property within the schema. This field is never null.
|
||||||
*
|
*
|
||||||
@@ -134,7 +134,7 @@ public class Schema {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* An (optional) list of zero or more logical paths that form the primary sort key
|
* An (optional) list of zero or more logical paths that form the primary sort key.
|
||||||
* <p>
|
* <p>
|
||||||
* All paths referenced MUST map to a property within the schema. This field is never null.
|
* All paths referenced MUST map to a property within the schema. This field is never null.
|
||||||
*
|
*
|
||||||
@@ -151,7 +151,7 @@ public class Schema {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A list of zero or more property definitions that define the columns within the schema
|
* A list of zero or more property definitions that define the columns within the schema.
|
||||||
* <p>
|
* <p>
|
||||||
* This field is never null.
|
* This field is never null.
|
||||||
*
|
*
|
||||||
@@ -168,7 +168,7 @@ public class Schema {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The unique identifier for a schema
|
* The unique identifier for a schema.
|
||||||
* <p>
|
* <p>
|
||||||
* Identifiers must be unique within the scope of the database in which they are used.
|
* Identifiers must be unique within the scope of the database in which they are used.
|
||||||
*/
|
*/
|
||||||
@@ -199,7 +199,7 @@ public class Schema {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns a JSON string representation of the current {@link Schema}
|
* Returns a JSON string representation of the current {@link Schema}.
|
||||||
*
|
*
|
||||||
* @return a JSON string representation of the current {@link Schema}
|
* @return a JSON string representation of the current {@link Schema}
|
||||||
*/
|
*/
|
||||||
@@ -209,7 +209,7 @@ public class Schema {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The type of this schema
|
* The type of this schema.
|
||||||
* <p>
|
* <p>
|
||||||
* This value MUST be {@link TypeKind#SCHEMA}.
|
* This value MUST be {@link TypeKind#SCHEMA}.
|
||||||
*/
|
*/
|
||||||
@@ -223,7 +223,7 @@ public class Schema {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The version of the HybridRow Schema Definition Language used to encode this schema
|
* The version of the HybridRow Schema Definition Language used to encode this schema.
|
||||||
*/
|
*/
|
||||||
public final SchemaLanguageVersion version() {
|
public final SchemaLanguageVersion version() {
|
||||||
return this.version;
|
return this.version;
|
||||||
|
|||||||
+1
-1
@@ -4,7 +4,7 @@
|
|||||||
package com.azure.data.cosmos.serialization.hybridrow.schemas;
|
package com.azure.data.cosmos.serialization.hybridrow.schemas;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set properties represent an unbounded set of zero or more unique items
|
* Set properties represent an unbounded set of zero or more unique items.
|
||||||
* <p>
|
* <p>
|
||||||
* Sets may be typed or untyped. Within typed sets, all items MUST be the same type. The
|
* Sets may be typed or untyped. Within typed sets, all items MUST be the same type. The
|
||||||
* type of items is specified via {@link #items}. Typed sets may be stored more efficiently
|
* type of items is specified via {@link #items}. Typed sets may be stored more efficiently
|
||||||
|
|||||||
+2
-2
@@ -4,14 +4,14 @@
|
|||||||
package com.azure.data.cosmos.serialization.hybridrow.schemas;
|
package com.azure.data.cosmos.serialization.hybridrow.schemas;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Describes a property or property set whose values MUST be the same for all rows that share the same partition key
|
* Describes a property or property set whose values MUST be the same for all rows that share the same partition key.
|
||||||
*/
|
*/
|
||||||
public class StaticKey {
|
public class StaticKey {
|
||||||
|
|
||||||
private String path;
|
private String path;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The logical path of the referenced property
|
* The logical path of the referenced property.
|
||||||
* <p>
|
* <p>
|
||||||
* Static path MUST refer to properties defined within the same {@link Schema}.
|
* Static path MUST refer to properties defined within the same {@link Schema}.
|
||||||
*/
|
*/
|
||||||
|
|||||||
+1
-1
@@ -18,7 +18,7 @@ public class UdtPropertyType extends ScopePropertyType {
|
|||||||
private SchemaId schemaId;
|
private SchemaId schemaId;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Initializes a new {@link UdtPropertyType}
|
* Initializes a new {@link UdtPropertyType}.
|
||||||
*/
|
*/
|
||||||
public UdtPropertyType() {
|
public UdtPropertyType() {
|
||||||
this.schemaId(SchemaId.INVALID);
|
this.schemaId(SchemaId.INVALID);
|
||||||
|
|||||||
@@ -0,0 +1,83 @@
|
|||||||
|
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||||
|
// Licensed under the MIT License.
|
||||||
|
|
||||||
|
package com.azure.data.cosmos.core;
|
||||||
|
|
||||||
|
import org.testng.annotations.Test;
|
||||||
|
|
||||||
|
import static org.testng.Assert.*;
|
||||||
|
|
||||||
|
public class Utf8StringTest {
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testIsEmpty() {
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testIsNull() {
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testChars() {
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testCodePoints() {
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testCompareTo() {
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testTestCompareTo() {
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testEncodedLength() {
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testTestEquals() {
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testTestEquals1() {
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testTestEquals2() {
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testTestEquals3() {
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testFrom() {
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testFromUnsafe() {
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testTestHashCode() {
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testLength() {
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testTestToString() {
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testToUtf16() {
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testTranscodeUtf16() {
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,75 @@
|
|||||||
|
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||||
|
// Licensed under the MIT License.
|
||||||
|
|
||||||
|
package com.azure.data.cosmos.core;
|
||||||
|
|
||||||
|
import org.testng.annotations.Test;
|
||||||
|
|
||||||
|
import static org.testng.Assert.*;
|
||||||
|
|
||||||
|
public class UtfAnyStringTest {
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testIsEmpty() {
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testIsNull() {
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testIsUtf16() {
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testIsUtf8() {
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testCompareTo() {
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testTestCompareTo() {
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testTestCompareTo1() {
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testTestEquals() {
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testTestEquals1() {
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testTestEquals2() {
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testTestEquals3() {
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testTestHashCode() {
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testLength() {
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testTestToString() {
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testToUtf16() {
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testToUtf8() {
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user