From 0408ab4ef2cc131af15604b9178d58e0f00c3f83 Mon Sep 17 00:00:00 2001 From: David Noble Date: Fri, 23 Aug 2019 09:30:16 -0700 Subject: [PATCH] Progressed on port from dotnet to java --- jre/pom.xml | 36 + .../internal/Utf8StringJsonConverter.java | 34 - .../layouts/ILayoutSpanReadable.java | 26 - .../layouts/ILayoutUtf8SpanReadable.java | 23 - .../hybridrow/layouts/LayoutDateTime.java | 88 - .../hybridrow/layouts/LayoutDecimal.java | 90 - .../hybridrow/layouts/LayoutFloat128.java | 87 - .../hybridrow/layouts/LayoutFloat32.java | 86 - .../hybridrow/layouts/LayoutFloat64.java | 86 - .../hybridrow/layouts/LayoutGuid.java | 89 - .../hybridrow/layouts/LayoutIndexedScope.java | 26 - .../hybridrow/layouts/LayoutInt16.java | 86 - .../hybridrow/layouts/LayoutInt32.java | 86 - .../hybridrow/layouts/LayoutInt64.java | 86 - .../hybridrow/layouts/LayoutInt8.java | 86 - .../layouts/LayoutMongoDbObjectId.java | 88 - .../hybridrow/layouts/LayoutNull.java | 90 - .../hybridrow/layouts/LayoutNullable.java | 106 -- .../hybridrow/layouts/LayoutTagged.java | 83 - .../hybridrow/layouts/LayoutTagged2.java | 98 - .../hybridrow/layouts/LayoutTuple.java | 86 - .../hybridrow/layouts/LayoutTypedArray.java | 81 - .../hybridrow/layouts/LayoutTypedMap.java | 100 - .../hybridrow/layouts/LayoutTypedSet.java | 85 - .../hybridrow/layouts/LayoutTypedTuple.java | 99 - .../hybridrow/layouts/LayoutUDT.java | 64 - .../hybridrow/layouts/LayoutUnixDateTime.java | 87 - .../hybridrow/layouts/LayoutUtf8.java | 188 -- .../hybridrow/layouts/LayoutVarInt.java | 114 -- .../hybridrow/recordio/RecordSerializer.java | 53 - .../hybridrow/recordio/SegmentSerializer.java | 101 - .../com/azure/data/cosmos/core/OutObject.java | 18 + .../com/azure/data/cosmos/core/RefObject.java | 22 + .../azure/data/cosmos/core/Utf8String.java | 459 +++++ .../hybridrow/DefaultSpanResizer.java | 2 +- .../serialization/hybridrow/Float128.java | 2 +- .../hybridrow/HybridRowHeader.java | 4 +- .../hybridrow/HybridRowVersion.java | 2 +- .../serialization/hybridrow/ISpanResizer.java | 2 +- .../hybridrow/MemorySpanResizer.java | 2 +- .../serialization/hybridrow/NullValue.java | 2 +- .../serialization/hybridrow/Result.java | 2 +- .../serialization/hybridrow/RowBuffer.java | 1663 +++++++++-------- .../serialization/hybridrow/RowCursor.java | 25 +- .../hybridrow/RowCursorExtensions.java | 55 +- .../serialization/hybridrow/RowOptions.java | 2 +- .../serialization/hybridrow/SchemaId.java | 2 +- .../serialization/hybridrow/UnixDateTime.java | 2 +- .../hybridrow/internal/MurmurHash3.java | 82 +- .../internal/Utf8StringJsonConverter.java | 50 + .../hybridrow/io/IRowSerializable.java | 9 +- .../serialization/hybridrow/io/RowReader.java | 583 +++--- .../hybridrow/io/RowReaderExtensions.java | 30 +- .../serialization/hybridrow/io/RowWriter.java | 335 ++-- .../json/RowReaderJsonExtensions.java | 180 +- .../hybridrow/json/RowReaderJsonSettings.java | 5 +- .../layouts/ILayoutSequenceWritable.java | 17 +- .../layouts/ILayoutSpanReadable.java | 28 + .../layouts/ILayoutSpanWritable.java | 17 +- .../hybridrow/layouts/ILayoutType.java | 2 +- .../layouts/ILayoutUtf8SpanReadable.java | 25 + .../layouts/ILayoutUtf8SpanWritable.java | 17 +- .../hybridrow/layouts/Layout.java | 21 +- .../hybridrow/layouts/LayoutArray.java | 33 +- .../hybridrow/layouts/LayoutBinary.java | 146 +- .../hybridrow/layouts/LayoutBit.java | 4 +- .../hybridrow/layouts/LayoutBoolean.java | 48 +- .../hybridrow/layouts/LayoutBuilder.java | 6 +- .../hybridrow/layouts/LayoutCode.java | 2 +- .../hybridrow/layouts/LayoutCodeTraits.java | 2 +- .../hybridrow/layouts/LayoutColumn.java | 8 +- .../layouts/LayoutCompilationException.java | 2 +- .../hybridrow/layouts/LayoutCompiler.java | 91 +- .../hybridrow/layouts/LayoutDateTime.java | 90 + .../hybridrow/layouts/LayoutDecimal.java | 92 + .../hybridrow/layouts/LayoutEndScope.java | 22 +- .../hybridrow/layouts/LayoutFloat128.java | 89 + .../hybridrow/layouts/LayoutFloat32.java | 88 + .../hybridrow/layouts/LayoutFloat64.java | 88 + .../hybridrow/layouts/LayoutGuid.java | 91 + .../hybridrow/layouts/LayoutIndexedScope.java | 29 + .../hybridrow/layouts/LayoutInt16.java | 88 + .../hybridrow/layouts/LayoutInt32.java | 88 + .../hybridrow/layouts/LayoutInt64.java | 88 + .../hybridrow/layouts/LayoutInt8.java | 88 + .../layouts/LayoutMongoDbObjectId.java | 90 + .../hybridrow/layouts/LayoutNull.java | 92 + .../hybridrow/layouts/LayoutNullable.java | 107 ++ .../hybridrow/layouts/LayoutObject.java | 25 +- .../layouts/LayoutPropertyScope.java | 2 +- .../hybridrow/layouts/LayoutResolver.java | 4 +- .../layouts/LayoutResolverNamespace.java | 15 +- .../layouts/LayoutResolverSimple.java | 4 +- .../hybridrow/layouts/LayoutScope.java | 81 +- .../hybridrow/layouts/LayoutTagged.java | 85 + .../hybridrow/layouts/LayoutTagged2.java | 101 + .../hybridrow/layouts/LayoutTuple.java | 90 + .../hybridrow/layouts/LayoutType.java | 127 +- .../hybridrow/layouts/LayoutType1.java | 60 +- .../hybridrow/layouts/LayoutTypedArray.java | 80 + .../hybridrow/layouts/LayoutTypedMap.java | 103 + .../hybridrow/layouts/LayoutTypedSet.java | 87 + .../hybridrow/layouts/LayoutTypedTuple.java | 103 + .../hybridrow/layouts/LayoutUDT.java | 67 + .../hybridrow/layouts/LayoutUInt16.java | 52 +- .../hybridrow/layouts/LayoutUInt32.java | 52 +- .../hybridrow/layouts/LayoutUInt64.java | 52 +- .../hybridrow/layouts/LayoutUInt8.java | 52 +- .../hybridrow/layouts/LayoutUniqueScope.java | 73 +- .../hybridrow/layouts/LayoutUnixDateTime.java | 90 + .../hybridrow/layouts/LayoutUtf8.java | 190 ++ .../hybridrow/layouts/LayoutVarInt.java | 116 ++ .../hybridrow/layouts/LayoutVarUInt.java | 70 +- .../layouts/SamplingStringComparer.java | 8 +- .../layouts/SamplingUtf8StringComparer.java | 8 +- .../hybridrow/layouts/StringToken.java | 2 +- .../hybridrow/layouts/StringTokenizer.java | 24 +- .../hybridrow/layouts/SystemSchema.java | 4 +- .../hybridrow/layouts/TypeArgument.java | 2 +- .../hybridrow/layouts/TypeArgumentList.java | 8 +- .../hybridrow/layouts/UpdateOptions.java | 2 +- .../hybridrow/recordio/Record.java | 2 +- .../hybridrow/recordio/RecordIOFormatter.java | 30 +- .../hybridrow/recordio/RecordIOParser.java | 129 +- .../hybridrow/recordio/RecordIOStream.java | 71 +- .../hybridrow/recordio/RecordSerializer.java | 55 + .../hybridrow/recordio/Segment.java | 2 +- .../hybridrow/recordio/SegmentSerializer.java | 104 ++ .../hybridrow/schemas/ArrayPropertyType.java | 2 +- .../hybridrow/schemas/MapPropertyType.java | 2 +- .../hybridrow/schemas/Namespace.java | 2 +- .../hybridrow/schemas/ObjectPropertyType.java | 2 +- .../hybridrow/schemas/PartitionKey.java | 2 +- .../hybridrow/schemas/PrimarySortKey.java | 2 +- .../schemas/PrimitivePropertyType.java | 2 +- .../hybridrow/schemas/Property.java | 2 +- .../schemas/PropertySchemaConverter.java | 2 +- .../hybridrow/schemas/PropertyType.java | 2 +- .../hybridrow/schemas/Schema.java | 10 +- .../hybridrow/schemas/SchemaException.java | 2 +- .../hybridrow/schemas/SchemaHash.java | 2 +- .../schemas/SchemaLanguageVersion.java | 2 +- .../hybridrow/schemas/SchemaOptions.java | 2 +- .../hybridrow/schemas/SchemaValidator.java | 8 +- .../hybridrow/schemas/ScopePropertyType.java | 2 +- .../hybridrow/schemas/SetPropertyType.java | 2 +- .../hybridrow/schemas/SortDirection.java | 2 +- .../hybridrow/schemas/StaticKey.java | 2 +- .../hybridrow/schemas/StorageKind.java | 2 +- .../schemas/StrictBooleanConverter.java | 2 +- .../schemas/StrictIntegerConverter.java | 2 +- .../hybridrow/schemas/TaggedPropertyType.java | 2 +- .../hybridrow/schemas/TuplePropertyType.java | 2 +- .../hybridrow/schemas/TypeKind.java | 2 +- .../hybridrow/schemas/UdtPropertyType.java | 8 +- jre/src/main/java/tangible/OutObject.java | 15 - jre/src/main/java/tangible/RefObject.java | 19 - .../main/java/tangible/TryParseHelper.java | 30 +- .../hybridrow/unit/DeleteRowDispatcher.java | 161 -- .../hybridrow/unit/IDispatchable.java | 11 - .../hybridrow/unit/IDispatcher.java | 41 - .../hybridrow/unit/NullRowDispatcher.java | 85 - .../hybridrow/unit/ReadRowDispatcher.java | 234 --- .../hybridrow/unit/WriteRowDispatcher.java | 242 --- .../customerschema/AddressSerializer.java | 94 - .../customerschema/PostalCodeSerializer.java | 63 - .../hybridrow/perf/BenchmarkSuiteBase.java | 40 +- .../perf/BsonJsonModelRowGenerator.java | 2 +- .../hybridrow/perf/BsonReaderExtensions.java | 10 +- .../hybridrow/perf/BsonRowGenerator.java | 49 +- .../perf/CassandraHotel/Protobuf/Address.java | 16 +- .../Available_Rooms_By_Hotel_Date.java | 6 +- .../CassandraHotelSchemaReflection.java | 6 +- .../perf/CassandraHotel/Protobuf/Guests.java | 10 +- .../perf/CassandraHotel/Protobuf/Hotels.java | 6 +- .../CassandraHotel/Protobuf/PostalCode.java | 13 +- .../perf/CodeGenMicroBenchmarkSuite.java | 23 +- .../hybridrow/perf/CodeGenRowGenerator.java | 458 ++--- .../perf/GenerateBenchmarkSuite.java | 4 +- .../hybridrow/perf/JsonModelRowGenerator.java | 76 +- .../hybridrow/perf/Measurements.java | 2 +- .../perf/MicroBenchmarkSuiteBase.java | 11 +- .../hybridrow/perf/ProtobufRowGenerator.java | 49 +- .../hybridrow/perf/ReaderBenchmark.java | 36 +- .../hybridrow/perf/RowReaderExtensions.java | 23 +- .../perf/SchematizedMicroBenchmarkSuite.java | 49 +- .../hybridrow/perf/TestData.java | 2 +- .../UnschematizedMicroBenchmarkSuite.java | 67 +- .../hybridrow/unit/ArrayAssert.java | 2 +- .../hybridrow/unit/AssertThrowsException.java | 2 +- .../unit/CrossVersioningUnitTests.java | 17 +- .../unit/CustomerExampleUnitTests.java | 489 ++--- .../hybridrow/unit/DeleteRowDispatcher.java | 168 ++ .../hybridrow/unit/IDispatchable.java | 12 + .../hybridrow/unit/IDispatcher.java | 42 + .../unit/LayoutCompilerUnitTests.java | 655 +++---- .../hybridrow/unit/LayoutTypeUnitTests.java | 2 +- .../hybridrow/unit/NullRowDispatcher.java | 87 + .../hybridrow/unit/NullableUnitTests.java | 522 +++--- .../hybridrow/unit/PermuteExtensions.java | 4 +- .../unit/RandomGeneratorUnitTests.java | 2 +- .../hybridrow/unit/ReadRowDispatcher.java | 240 +++ .../hybridrow/unit/RecordIOUnitTests.java | 98 +- .../hybridrow/unit/ResultAssert.java | 4 +- .../hybridrow/unit/RowBufferUnitTests.java | 4 +- .../unit/RowOperationDispatcher.java | 208 ++- .../hybridrow/unit/RowReaderUnitTests.java | 197 +- .../hybridrow/unit/RowWriterUnitTests.java | 155 +- .../hybridrow/unit/SchemaHashUnitTests.java | 37 +- .../hybridrow/unit/SchemaIdUnitTests.java | 8 +- .../hybridrow/unit/SchemaUnitTests.java | 147 +- .../hybridrow/unit/SerializerUnitTest.java | 151 +- .../hybridrow/unit/TaggedUnitTests.java | 47 +- .../hybridrow/unit/TupleUnitTests.java | 663 +++---- .../hybridrow/unit/TypedArrayUnitTests.java | 247 +-- .../hybridrow/unit/TypedMapUnitTests.java | 1113 +++++------ .../hybridrow/unit/TypedSetUnitTests.java | 1237 ++++++------ .../unit/UpdateOptionsUnitTests.java | 4 +- .../hybridrow/unit/WriteRowDispatcher.java | 248 +++ .../unit/customerschema/Address.java | 4 +- .../customerschema/AddressSerializer.java | 97 + .../hybridrow/unit/customerschema/Guest.java | 4 +- .../hybridrow/unit/customerschema/Hotel.java | 4 +- .../unit/customerschema/PostalCode.java | 4 +- .../customerschema/PostalCodeSerializer.java | 70 + .../unit/internal/MurmurHash3UnitTests.java | 69 +- 226 files changed, 9982 insertions(+), 9118 deletions(-) delete mode 100644 jre/src/main/java/azure/data/cosmos/serialization/hybridrow/internal/Utf8StringJsonConverter.java delete mode 100644 jre/src/main/java/azure/data/cosmos/serialization/hybridrow/layouts/ILayoutSpanReadable.java delete mode 100644 jre/src/main/java/azure/data/cosmos/serialization/hybridrow/layouts/ILayoutUtf8SpanReadable.java delete mode 100644 jre/src/main/java/azure/data/cosmos/serialization/hybridrow/layouts/LayoutDateTime.java delete mode 100644 jre/src/main/java/azure/data/cosmos/serialization/hybridrow/layouts/LayoutDecimal.java delete mode 100644 jre/src/main/java/azure/data/cosmos/serialization/hybridrow/layouts/LayoutFloat128.java delete mode 100644 jre/src/main/java/azure/data/cosmos/serialization/hybridrow/layouts/LayoutFloat32.java delete mode 100644 jre/src/main/java/azure/data/cosmos/serialization/hybridrow/layouts/LayoutFloat64.java delete mode 100644 jre/src/main/java/azure/data/cosmos/serialization/hybridrow/layouts/LayoutGuid.java delete mode 100644 jre/src/main/java/azure/data/cosmos/serialization/hybridrow/layouts/LayoutIndexedScope.java delete mode 100644 jre/src/main/java/azure/data/cosmos/serialization/hybridrow/layouts/LayoutInt16.java delete mode 100644 jre/src/main/java/azure/data/cosmos/serialization/hybridrow/layouts/LayoutInt32.java delete mode 100644 jre/src/main/java/azure/data/cosmos/serialization/hybridrow/layouts/LayoutInt64.java delete mode 100644 jre/src/main/java/azure/data/cosmos/serialization/hybridrow/layouts/LayoutInt8.java delete mode 100644 jre/src/main/java/azure/data/cosmos/serialization/hybridrow/layouts/LayoutMongoDbObjectId.java delete mode 100644 jre/src/main/java/azure/data/cosmos/serialization/hybridrow/layouts/LayoutNull.java delete mode 100644 jre/src/main/java/azure/data/cosmos/serialization/hybridrow/layouts/LayoutNullable.java delete mode 100644 jre/src/main/java/azure/data/cosmos/serialization/hybridrow/layouts/LayoutTagged.java delete mode 100644 jre/src/main/java/azure/data/cosmos/serialization/hybridrow/layouts/LayoutTagged2.java delete mode 100644 jre/src/main/java/azure/data/cosmos/serialization/hybridrow/layouts/LayoutTuple.java delete mode 100644 jre/src/main/java/azure/data/cosmos/serialization/hybridrow/layouts/LayoutTypedArray.java delete mode 100644 jre/src/main/java/azure/data/cosmos/serialization/hybridrow/layouts/LayoutTypedMap.java delete mode 100644 jre/src/main/java/azure/data/cosmos/serialization/hybridrow/layouts/LayoutTypedSet.java delete mode 100644 jre/src/main/java/azure/data/cosmos/serialization/hybridrow/layouts/LayoutTypedTuple.java delete mode 100644 jre/src/main/java/azure/data/cosmos/serialization/hybridrow/layouts/LayoutUDT.java delete mode 100644 jre/src/main/java/azure/data/cosmos/serialization/hybridrow/layouts/LayoutUnixDateTime.java delete mode 100644 jre/src/main/java/azure/data/cosmos/serialization/hybridrow/layouts/LayoutUtf8.java delete mode 100644 jre/src/main/java/azure/data/cosmos/serialization/hybridrow/layouts/LayoutVarInt.java delete mode 100644 jre/src/main/java/azure/data/cosmos/serialization/hybridrow/recordio/RecordSerializer.java delete mode 100644 jre/src/main/java/azure/data/cosmos/serialization/hybridrow/recordio/SegmentSerializer.java create mode 100644 jre/src/main/java/com/azure/data/cosmos/core/OutObject.java create mode 100644 jre/src/main/java/com/azure/data/cosmos/core/RefObject.java create mode 100644 jre/src/main/java/com/azure/data/cosmos/core/Utf8String.java rename jre/src/main/java/{ => com}/azure/data/cosmos/serialization/hybridrow/DefaultSpanResizer.java (94%) rename jre/src/main/java/{ => com}/azure/data/cosmos/serialization/hybridrow/Float128.java (95%) rename jre/src/main/java/{ => com}/azure/data/cosmos/serialization/hybridrow/HybridRowHeader.java (91%) rename jre/src/main/java/{ => com}/azure/data/cosmos/serialization/hybridrow/HybridRowVersion.java (93%) rename jre/src/main/java/{ => com}/azure/data/cosmos/serialization/hybridrow/ISpanResizer.java (93%) rename jre/src/main/java/{ => com}/azure/data/cosmos/serialization/hybridrow/MemorySpanResizer.java (95%) rename jre/src/main/java/{ => com}/azure/data/cosmos/serialization/hybridrow/NullValue.java (94%) rename jre/src/main/java/{ => com}/azure/data/cosmos/serialization/hybridrow/Result.java (92%) rename jre/src/main/java/{ => com}/azure/data/cosmos/serialization/hybridrow/RowBuffer.java (64%) rename jre/src/main/java/{ => com}/azure/data/cosmos/serialization/hybridrow/RowCursor.java (88%) rename jre/src/main/java/{ => com}/azure/data/cosmos/serialization/hybridrow/RowCursorExtensions.java (57%) rename jre/src/main/java/{ => com}/azure/data/cosmos/serialization/hybridrow/RowOptions.java (94%) rename jre/src/main/java/{ => com}/azure/data/cosmos/serialization/hybridrow/SchemaId.java (95%) rename jre/src/main/java/{ => com}/azure/data/cosmos/serialization/hybridrow/UnixDateTime.java (95%) rename jre/src/main/java/{ => com}/azure/data/cosmos/serialization/hybridrow/internal/MurmurHash3.java (73%) create mode 100644 jre/src/main/java/com/azure/data/cosmos/serialization/hybridrow/internal/Utf8StringJsonConverter.java rename jre/src/main/java/{ => com}/azure/data/cosmos/serialization/hybridrow/io/IRowSerializable.java (64%) rename jre/src/main/java/{ => com}/azure/data/cosmos/serialization/hybridrow/io/RowReader.java (61%) rename jre/src/main/java/{ => com}/azure/data/cosmos/serialization/hybridrow/io/RowReaderExtensions.java (68%) rename jre/src/main/java/{ => com}/azure/data/cosmos/serialization/hybridrow/io/RowWriter.java (75%) rename jre/src/main/java/{ => com}/azure/data/cosmos/serialization/hybridrow/json/RowReaderJsonExtensions.java (65%) rename jre/src/main/java/{ => com}/azure/data/cosmos/serialization/hybridrow/json/RowReaderJsonSettings.java (91%) rename jre/src/main/java/{ => com}/azure/data/cosmos/serialization/hybridrow/layouts/ILayoutSequenceWritable.java (60%) create mode 100644 jre/src/main/java/com/azure/data/cosmos/serialization/hybridrow/layouts/ILayoutSpanReadable.java rename jre/src/main/java/{ => com}/azure/data/cosmos/serialization/hybridrow/layouts/ILayoutSpanWritable.java (59%) rename jre/src/main/java/{ => com}/azure/data/cosmos/serialization/hybridrow/layouts/ILayoutType.java (78%) create mode 100644 jre/src/main/java/com/azure/data/cosmos/serialization/hybridrow/layouts/ILayoutUtf8SpanReadable.java rename jre/src/main/java/{ => com}/azure/data/cosmos/serialization/hybridrow/layouts/ILayoutUtf8SpanWritable.java (50%) rename jre/src/main/java/{ => com}/azure/data/cosmos/serialization/hybridrow/layouts/Layout.java (88%) rename jre/src/main/java/{ => com}/azure/data/cosmos/serialization/hybridrow/layouts/LayoutArray.java (51%) rename jre/src/main/java/{ => com}/azure/data/cosmos/serialization/hybridrow/layouts/LayoutBinary.java (63%) rename jre/src/main/java/{ => com}/azure/data/cosmos/serialization/hybridrow/layouts/LayoutBit.java (93%) rename jre/src/main/java/{ => com}/azure/data/cosmos/serialization/hybridrow/layouts/LayoutBoolean.java (50%) rename jre/src/main/java/{ => com}/azure/data/cosmos/serialization/hybridrow/layouts/LayoutBuilder.java (94%) rename jre/src/main/java/{ => com}/azure/data/cosmos/serialization/hybridrow/layouts/LayoutCode.java (94%) rename jre/src/main/java/{ => com}/azure/data/cosmos/serialization/hybridrow/layouts/LayoutCodeTraits.java (94%) rename jre/src/main/java/{ => com}/azure/data/cosmos/serialization/hybridrow/layouts/LayoutColumn.java (93%) rename jre/src/main/java/{ => com}/azure/data/cosmos/serialization/hybridrow/layouts/LayoutCompilationException.java (91%) rename jre/src/main/java/{ => com}/azure/data/cosmos/serialization/hybridrow/layouts/LayoutCompiler.java (77%) create mode 100644 jre/src/main/java/com/azure/data/cosmos/serialization/hybridrow/layouts/LayoutDateTime.java create mode 100644 jre/src/main/java/com/azure/data/cosmos/serialization/hybridrow/layouts/LayoutDecimal.java rename jre/src/main/java/{ => com}/azure/data/cosmos/serialization/hybridrow/layouts/LayoutEndScope.java (56%) create mode 100644 jre/src/main/java/com/azure/data/cosmos/serialization/hybridrow/layouts/LayoutFloat128.java create mode 100644 jre/src/main/java/com/azure/data/cosmos/serialization/hybridrow/layouts/LayoutFloat32.java create mode 100644 jre/src/main/java/com/azure/data/cosmos/serialization/hybridrow/layouts/LayoutFloat64.java create mode 100644 jre/src/main/java/com/azure/data/cosmos/serialization/hybridrow/layouts/LayoutGuid.java create mode 100644 jre/src/main/java/com/azure/data/cosmos/serialization/hybridrow/layouts/LayoutIndexedScope.java create mode 100644 jre/src/main/java/com/azure/data/cosmos/serialization/hybridrow/layouts/LayoutInt16.java create mode 100644 jre/src/main/java/com/azure/data/cosmos/serialization/hybridrow/layouts/LayoutInt32.java create mode 100644 jre/src/main/java/com/azure/data/cosmos/serialization/hybridrow/layouts/LayoutInt64.java create mode 100644 jre/src/main/java/com/azure/data/cosmos/serialization/hybridrow/layouts/LayoutInt8.java create mode 100644 jre/src/main/java/com/azure/data/cosmos/serialization/hybridrow/layouts/LayoutMongoDbObjectId.java create mode 100644 jre/src/main/java/com/azure/data/cosmos/serialization/hybridrow/layouts/LayoutNull.java create mode 100644 jre/src/main/java/com/azure/data/cosmos/serialization/hybridrow/layouts/LayoutNullable.java rename jre/src/main/java/{ => com}/azure/data/cosmos/serialization/hybridrow/layouts/LayoutObject.java (53%) rename jre/src/main/java/{ => com}/azure/data/cosmos/serialization/hybridrow/layouts/LayoutPropertyScope.java (89%) rename jre/src/main/java/{ => com}/azure/data/cosmos/serialization/hybridrow/layouts/LayoutResolver.java (67%) rename jre/src/main/java/{ => com}/azure/data/cosmos/serialization/hybridrow/layouts/LayoutResolverNamespace.java (81%) rename jre/src/main/java/{ => com}/azure/data/cosmos/serialization/hybridrow/layouts/LayoutResolverSimple.java (80%) rename jre/src/main/java/{ => com}/azure/data/cosmos/serialization/hybridrow/layouts/LayoutScope.java (56%) create mode 100644 jre/src/main/java/com/azure/data/cosmos/serialization/hybridrow/layouts/LayoutTagged.java create mode 100644 jre/src/main/java/com/azure/data/cosmos/serialization/hybridrow/layouts/LayoutTagged2.java create mode 100644 jre/src/main/java/com/azure/data/cosmos/serialization/hybridrow/layouts/LayoutTuple.java rename jre/src/main/java/{ => com}/azure/data/cosmos/serialization/hybridrow/layouts/LayoutType.java (83%) rename jre/src/main/java/{ => com}/azure/data/cosmos/serialization/hybridrow/layouts/LayoutType1.java (52%) create mode 100644 jre/src/main/java/com/azure/data/cosmos/serialization/hybridrow/layouts/LayoutTypedArray.java create mode 100644 jre/src/main/java/com/azure/data/cosmos/serialization/hybridrow/layouts/LayoutTypedMap.java create mode 100644 jre/src/main/java/com/azure/data/cosmos/serialization/hybridrow/layouts/LayoutTypedSet.java create mode 100644 jre/src/main/java/com/azure/data/cosmos/serialization/hybridrow/layouts/LayoutTypedTuple.java create mode 100644 jre/src/main/java/com/azure/data/cosmos/serialization/hybridrow/layouts/LayoutUDT.java rename jre/src/main/java/{ => com}/azure/data/cosmos/serialization/hybridrow/layouts/LayoutUInt16.java (54%) rename jre/src/main/java/{ => com}/azure/data/cosmos/serialization/hybridrow/layouts/LayoutUInt32.java (54%) rename jre/src/main/java/{ => com}/azure/data/cosmos/serialization/hybridrow/layouts/LayoutUInt64.java (54%) rename jre/src/main/java/{ => com}/azure/data/cosmos/serialization/hybridrow/layouts/LayoutUInt8.java (54%) rename jre/src/main/java/{ => com}/azure/data/cosmos/serialization/hybridrow/layouts/LayoutUniqueScope.java (62%) create mode 100644 jre/src/main/java/com/azure/data/cosmos/serialization/hybridrow/layouts/LayoutUnixDateTime.java create mode 100644 jre/src/main/java/com/azure/data/cosmos/serialization/hybridrow/layouts/LayoutUtf8.java create mode 100644 jre/src/main/java/com/azure/data/cosmos/serialization/hybridrow/layouts/LayoutVarInt.java rename jre/src/main/java/{ => com}/azure/data/cosmos/serialization/hybridrow/layouts/LayoutVarUInt.java (53%) rename jre/src/main/java/{ => com}/azure/data/cosmos/serialization/hybridrow/layouts/SamplingStringComparer.java (88%) rename jre/src/main/java/{ => com}/azure/data/cosmos/serialization/hybridrow/layouts/SamplingUtf8StringComparer.java (89%) rename jre/src/main/java/{ => com}/azure/data/cosmos/serialization/hybridrow/layouts/StringToken.java (96%) rename jre/src/main/java/{ => com}/azure/data/cosmos/serialization/hybridrow/layouts/StringTokenizer.java (83%) rename jre/src/main/java/{ => com}/azure/data/cosmos/serialization/hybridrow/layouts/SystemSchema.java (92%) rename jre/src/main/java/{ => com}/azure/data/cosmos/serialization/hybridrow/layouts/TypeArgument.java (95%) rename jre/src/main/java/{ => com}/azure/data/cosmos/serialization/hybridrow/layouts/TypeArgumentList.java (92%) rename jre/src/main/java/{ => com}/azure/data/cosmos/serialization/hybridrow/layouts/UpdateOptions.java (94%) rename jre/src/main/java/{ => com}/azure/data/cosmos/serialization/hybridrow/recordio/Record.java (92%) rename jre/src/main/java/{ => com}/azure/data/cosmos/serialization/hybridrow/recordio/RecordIOFormatter.java (78%) rename jre/src/main/java/{ => com}/azure/data/cosmos/serialization/hybridrow/recordio/RecordIOParser.java (67%) rename jre/src/main/java/{ => com}/azure/data/cosmos/serialization/hybridrow/recordio/RecordIOStream.java (84%) create mode 100644 jre/src/main/java/com/azure/data/cosmos/serialization/hybridrow/recordio/RecordSerializer.java rename jre/src/main/java/{ => com}/azure/data/cosmos/serialization/hybridrow/recordio/Segment.java (90%) create mode 100644 jre/src/main/java/com/azure/data/cosmos/serialization/hybridrow/recordio/SegmentSerializer.java rename jre/src/main/java/{ => com}/azure/data/cosmos/serialization/hybridrow/schemas/ArrayPropertyType.java (92%) rename jre/src/main/java/{ => com}/azure/data/cosmos/serialization/hybridrow/schemas/MapPropertyType.java (94%) rename jre/src/main/java/{ => com}/azure/data/cosmos/serialization/hybridrow/schemas/Namespace.java (95%) rename jre/src/main/java/{ => com}/azure/data/cosmos/serialization/hybridrow/schemas/ObjectPropertyType.java (93%) rename jre/src/main/java/{ => com}/azure/data/cosmos/serialization/hybridrow/schemas/PartitionKey.java (90%) rename jre/src/main/java/{ => com}/azure/data/cosmos/serialization/hybridrow/schemas/PrimarySortKey.java (93%) rename jre/src/main/java/{ => com}/azure/data/cosmos/serialization/hybridrow/schemas/PrimitivePropertyType.java (93%) rename jre/src/main/java/{ => com}/azure/data/cosmos/serialization/hybridrow/schemas/Property.java (94%) rename jre/src/main/java/{ => com}/azure/data/cosmos/serialization/hybridrow/schemas/PropertySchemaConverter.java (95%) rename jre/src/main/java/{ => com}/azure/data/cosmos/serialization/hybridrow/schemas/PropertyType.java (94%) rename jre/src/main/java/{ => com}/azure/data/cosmos/serialization/hybridrow/schemas/Schema.java (93%) rename jre/src/main/java/{ => com}/azure/data/cosmos/serialization/hybridrow/schemas/SchemaException.java (90%) rename jre/src/main/java/{ => com}/azure/data/cosmos/serialization/hybridrow/schemas/SchemaHash.java (96%) rename jre/src/main/java/{ => com}/azure/data/cosmos/serialization/hybridrow/schemas/SchemaLanguageVersion.java (93%) rename jre/src/main/java/{ => com}/azure/data/cosmos/serialization/hybridrow/schemas/SchemaOptions.java (96%) rename jre/src/main/java/{ => com}/azure/data/cosmos/serialization/hybridrow/schemas/SchemaValidator.java (95%) rename jre/src/main/java/{ => com}/azure/data/cosmos/serialization/hybridrow/schemas/ScopePropertyType.java (90%) rename jre/src/main/java/{ => com}/azure/data/cosmos/serialization/hybridrow/schemas/SetPropertyType.java (92%) rename jre/src/main/java/{ => com}/azure/data/cosmos/serialization/hybridrow/schemas/SortDirection.java (93%) rename jre/src/main/java/{ => com}/azure/data/cosmos/serialization/hybridrow/schemas/StaticKey.java (90%) rename jre/src/main/java/{ => com}/azure/data/cosmos/serialization/hybridrow/schemas/StorageKind.java (94%) rename jre/src/main/java/{ => com}/azure/data/cosmos/serialization/hybridrow/schemas/StrictBooleanConverter.java (93%) rename jre/src/main/java/{ => com}/azure/data/cosmos/serialization/hybridrow/schemas/StrictIntegerConverter.java (94%) rename jre/src/main/java/{ => com}/azure/data/cosmos/serialization/hybridrow/schemas/TaggedPropertyType.java (93%) rename jre/src/main/java/{ => com}/azure/data/cosmos/serialization/hybridrow/schemas/TuplePropertyType.java (92%) rename jre/src/main/java/{ => com}/azure/data/cosmos/serialization/hybridrow/schemas/TypeKind.java (95%) rename jre/src/main/java/{ => com}/azure/data/cosmos/serialization/hybridrow/schemas/UdtPropertyType.java (84%) delete mode 100644 jre/src/main/java/tangible/OutObject.java delete mode 100644 jre/src/main/java/tangible/RefObject.java delete mode 100644 jre/src/test/java/azure/data/cosmos/serialization/hybridrow/unit/DeleteRowDispatcher.java delete mode 100644 jre/src/test/java/azure/data/cosmos/serialization/hybridrow/unit/IDispatchable.java delete mode 100644 jre/src/test/java/azure/data/cosmos/serialization/hybridrow/unit/IDispatcher.java delete mode 100644 jre/src/test/java/azure/data/cosmos/serialization/hybridrow/unit/NullRowDispatcher.java delete mode 100644 jre/src/test/java/azure/data/cosmos/serialization/hybridrow/unit/ReadRowDispatcher.java delete mode 100644 jre/src/test/java/azure/data/cosmos/serialization/hybridrow/unit/WriteRowDispatcher.java delete mode 100644 jre/src/test/java/azure/data/cosmos/serialization/hybridrow/unit/customerschema/AddressSerializer.java delete mode 100644 jre/src/test/java/azure/data/cosmos/serialization/hybridrow/unit/customerschema/PostalCodeSerializer.java rename jre/src/test/java/{ => com}/azure/data/cosmos/serialization/hybridrow/perf/BenchmarkSuiteBase.java (80%) rename jre/src/test/java/{ => com}/azure/data/cosmos/serialization/hybridrow/perf/BsonJsonModelRowGenerator.java (96%) rename jre/src/test/java/{ => com}/azure/data/cosmos/serialization/hybridrow/perf/BsonReaderExtensions.java (69%) rename jre/src/test/java/{ => com}/azure/data/cosmos/serialization/hybridrow/perf/BsonRowGenerator.java (85%) rename jre/src/test/java/{ => com}/azure/data/cosmos/serialization/hybridrow/perf/CassandraHotel/Protobuf/Address.java (92%) rename jre/src/test/java/{ => com}/azure/data/cosmos/serialization/hybridrow/perf/CassandraHotel/Protobuf/Available_Rooms_By_Hotel_Date.java (95%) rename jre/src/test/java/{ => com}/azure/data/cosmos/serialization/hybridrow/perf/CassandraHotel/Protobuf/CassandraHotelSchemaReflection.java (78%) rename jre/src/test/java/{ => com}/azure/data/cosmos/serialization/hybridrow/perf/CassandraHotel/Protobuf/Guests.java (94%) rename jre/src/test/java/{ => com}/azure/data/cosmos/serialization/hybridrow/perf/CassandraHotel/Protobuf/Hotels.java (95%) rename jre/src/test/java/{ => com}/azure/data/cosmos/serialization/hybridrow/perf/CassandraHotel/Protobuf/PostalCode.java (92%) rename jre/src/test/java/{ => com}/azure/data/cosmos/serialization/hybridrow/perf/CodeGenMicroBenchmarkSuite.java (91%) rename jre/src/test/java/{ => com}/azure/data/cosmos/serialization/hybridrow/perf/CodeGenRowGenerator.java (65%) rename jre/src/test/java/{ => com}/azure/data/cosmos/serialization/hybridrow/perf/GenerateBenchmarkSuite.java (96%) rename jre/src/test/java/{ => com}/azure/data/cosmos/serialization/hybridrow/perf/JsonModelRowGenerator.java (68%) rename jre/src/test/java/{ => com}/azure/data/cosmos/serialization/hybridrow/perf/Measurements.java (96%) rename jre/src/test/java/{ => com}/azure/data/cosmos/serialization/hybridrow/perf/MicroBenchmarkSuiteBase.java (92%) rename jre/src/test/java/{ => com}/azure/data/cosmos/serialization/hybridrow/perf/ProtobufRowGenerator.java (78%) rename jre/src/test/java/{ => com}/azure/data/cosmos/serialization/hybridrow/perf/ReaderBenchmark.java (89%) rename jre/src/test/java/{ => com}/azure/data/cosmos/serialization/hybridrow/perf/RowReaderExtensions.java (73%) rename jre/src/test/java/{ => com}/azure/data/cosmos/serialization/hybridrow/perf/SchematizedMicroBenchmarkSuite.java (91%) rename jre/src/test/java/{ => com}/azure/data/cosmos/serialization/hybridrow/perf/TestData.java (91%) rename jre/src/test/java/{ => com}/azure/data/cosmos/serialization/hybridrow/perf/UnschematizedMicroBenchmarkSuite.java (80%) rename jre/src/test/java/{ => com}/azure/data/cosmos/serialization/hybridrow/unit/ArrayAssert.java (93%) rename jre/src/test/java/{ => com}/azure/data/cosmos/serialization/hybridrow/unit/AssertThrowsException.java (97%) rename jre/src/test/java/{ => com}/azure/data/cosmos/serialization/hybridrow/unit/CrossVersioningUnitTests.java (96%) rename jre/src/test/java/{ => com}/azure/data/cosmos/serialization/hybridrow/unit/CustomerExampleUnitTests.java (66%) create mode 100644 jre/src/test/java/com/azure/data/cosmos/serialization/hybridrow/unit/DeleteRowDispatcher.java create mode 100644 jre/src/test/java/com/azure/data/cosmos/serialization/hybridrow/unit/IDispatchable.java create mode 100644 jre/src/test/java/com/azure/data/cosmos/serialization/hybridrow/unit/IDispatcher.java rename jre/src/test/java/{ => com}/azure/data/cosmos/serialization/hybridrow/unit/LayoutCompilerUnitTests.java (83%) rename jre/src/test/java/{ => com}/azure/data/cosmos/serialization/hybridrow/unit/LayoutTypeUnitTests.java (96%) create mode 100644 jre/src/test/java/com/azure/data/cosmos/serialization/hybridrow/unit/NullRowDispatcher.java rename jre/src/test/java/{ => com}/azure/data/cosmos/serialization/hybridrow/unit/NullableUnitTests.java (56%) rename jre/src/test/java/{ => com}/azure/data/cosmos/serialization/hybridrow/unit/PermuteExtensions.java (85%) rename jre/src/test/java/{ => com}/azure/data/cosmos/serialization/hybridrow/unit/RandomGeneratorUnitTests.java (96%) create mode 100644 jre/src/test/java/com/azure/data/cosmos/serialization/hybridrow/unit/ReadRowDispatcher.java rename jre/src/test/java/{ => com}/azure/data/cosmos/serialization/hybridrow/unit/RecordIOUnitTests.java (68%) rename jre/src/test/java/{ => com}/azure/data/cosmos/serialization/hybridrow/unit/ResultAssert.java (93%) rename jre/src/test/java/{ => com}/azure/data/cosmos/serialization/hybridrow/unit/RowBufferUnitTests.java (94%) rename jre/src/test/java/{ => com}/azure/data/cosmos/serialization/hybridrow/unit/RowOperationDispatcher.java (55%) rename jre/src/test/java/{ => com}/azure/data/cosmos/serialization/hybridrow/unit/RowReaderUnitTests.java (66%) rename jre/src/test/java/{ => com}/azure/data/cosmos/serialization/hybridrow/unit/RowWriterUnitTests.java (78%) rename jre/src/test/java/{ => com}/azure/data/cosmos/serialization/hybridrow/unit/SchemaHashUnitTests.java (87%) rename jre/src/test/java/{ => com}/azure/data/cosmos/serialization/hybridrow/unit/SchemaIdUnitTests.java (82%) rename jre/src/test/java/{ => com}/azure/data/cosmos/serialization/hybridrow/unit/SchemaUnitTests.java (81%) rename jre/src/test/java/{ => com}/azure/data/cosmos/serialization/hybridrow/unit/SerializerUnitTest.java (60%) rename jre/src/test/java/{ => com}/azure/data/cosmos/serialization/hybridrow/unit/TaggedUnitTests.java (88%) rename jre/src/test/java/{ => com}/azure/data/cosmos/serialization/hybridrow/unit/TupleUnitTests.java (64%) rename jre/src/test/java/{ => com}/azure/data/cosmos/serialization/hybridrow/unit/TypedArrayUnitTests.java (75%) rename jre/src/test/java/{ => com}/azure/data/cosmos/serialization/hybridrow/unit/TypedMapUnitTests.java (58%) rename jre/src/test/java/{ => com}/azure/data/cosmos/serialization/hybridrow/unit/TypedSetUnitTests.java (64%) rename jre/src/test/java/{ => com}/azure/data/cosmos/serialization/hybridrow/unit/UpdateOptionsUnitTests.java (87%) create mode 100644 jre/src/test/java/com/azure/data/cosmos/serialization/hybridrow/unit/WriteRowDispatcher.java rename jre/src/test/java/{ => com}/azure/data/cosmos/serialization/hybridrow/unit/customerschema/Address.java (89%) create mode 100644 jre/src/test/java/com/azure/data/cosmos/serialization/hybridrow/unit/customerschema/AddressSerializer.java rename jre/src/test/java/{ => com}/azure/data/cosmos/serialization/hybridrow/unit/customerschema/Guest.java (94%) rename jre/src/test/java/{ => com}/azure/data/cosmos/serialization/hybridrow/unit/customerschema/Hotel.java (90%) rename jre/src/test/java/{ => com}/azure/data/cosmos/serialization/hybridrow/unit/customerschema/PostalCode.java (85%) create mode 100644 jre/src/test/java/com/azure/data/cosmos/serialization/hybridrow/unit/customerschema/PostalCodeSerializer.java rename jre/src/test/java/{ => com}/azure/data/cosmos/serialization/hybridrow/unit/internal/MurmurHash3UnitTests.java (60%) diff --git a/jre/pom.xml b/jre/pom.xml index 11639b7..b558cb4 100644 --- a/jre/pom.xml +++ b/jre/pom.xml @@ -37,18 +37,48 @@ Licensed under the MIT License. unit 27.0.1-jre + 2.9.9 1.10.19 3.11.0 + 4.1.39.Final + 3.9.1 + 1.7.28 + + com.fasterxml.jackson.core + jackson-databind + ${jackson.version} + + com.google.guava guava ${guava.version} + + com.google.protobuf + protobuf-java + ${protobuf.version} + test + + + + com.google.protobuf + protobuf-java-util + ${protobuf.version} + test + + + + io.netty + netty-buffer + ${netty.version} + + org.mockito mockito-core @@ -63,6 +93,12 @@ Licensed under the MIT License. test + + org.slf4j + slf4j-api + ${slf4j.version} + + diff --git a/jre/src/main/java/azure/data/cosmos/serialization/hybridrow/internal/Utf8StringJsonConverter.java b/jre/src/main/java/azure/data/cosmos/serialization/hybridrow/internal/Utf8StringJsonConverter.java deleted file mode 100644 index c13cd4e..0000000 --- a/jre/src/main/java/azure/data/cosmos/serialization/hybridrow/internal/Utf8StringJsonConverter.java +++ /dev/null @@ -1,34 +0,0 @@ -//------------------------------------------------------------ -// Copyright (c) Microsoft Corporation. All rights reserved. -//------------------------------------------------------------ - -package azure.data.cosmos.serialization.hybridrow.internal; - -import Newtonsoft.Json.*; - -/** - * Helper class for parsing from JSON. - */ -public class Utf8StringJsonConverter extends JsonConverter { - @Override - public boolean getCanWrite() { - return true; - } - - @Override - public boolean CanConvert(java.lang.Class objectType) { - return objectType.isAssignableFrom(Utf8String.class); - } - - @Override - public Object ReadJson(JsonReader reader, java.lang.Class objectType, Object existingValue, - JsonSerializer serializer) { - Contract.Requires(reader.TokenType == JsonToken.String); - return Utf8String.TranscodeUtf16((String)reader.Value); - } - - @Override - public void WriteJson(JsonWriter writer, Object value, JsonSerializer serializer) { - writer.WriteValue(((Utf8String)value).toString()); - } -} \ No newline at end of file diff --git a/jre/src/main/java/azure/data/cosmos/serialization/hybridrow/layouts/ILayoutSpanReadable.java b/jre/src/main/java/azure/data/cosmos/serialization/hybridrow/layouts/ILayoutSpanReadable.java deleted file mode 100644 index fe0cf30..0000000 --- a/jre/src/main/java/azure/data/cosmos/serialization/hybridrow/layouts/ILayoutSpanReadable.java +++ /dev/null @@ -1,26 +0,0 @@ -//------------------------------------------------------------ -// Copyright (c) Microsoft Corporation. All rights reserved. -//------------------------------------------------------------ - -package azure.data.cosmos.serialization.hybridrow.layouts; - -import azure.data.cosmos.serialization.hybridrow.Result; -import azure.data.cosmos.serialization.hybridrow.RowBuffer; -import azure.data.cosmos.serialization.hybridrow.RowCursor; - -/** - * An optional interface that indicates a can also read using a - * . - * - * The sub-element type to be written. - */ -public interface ILayoutSpanReadable extends ILayoutType { - Result ReadFixed(tangible.RefObject b, tangible.RefObject scope, LayoutColumn col, - tangible.OutObject> value); - - Result ReadSparse(tangible.RefObject b, tangible.RefObject scope, - tangible.OutObject> value); - - Result ReadVariable(tangible.RefObject b, tangible.RefObject scope, LayoutColumn col, - tangible.OutObject> value); -} \ No newline at end of file diff --git a/jre/src/main/java/azure/data/cosmos/serialization/hybridrow/layouts/ILayoutUtf8SpanReadable.java b/jre/src/main/java/azure/data/cosmos/serialization/hybridrow/layouts/ILayoutUtf8SpanReadable.java deleted file mode 100644 index 59aca73..0000000 --- a/jre/src/main/java/azure/data/cosmos/serialization/hybridrow/layouts/ILayoutUtf8SpanReadable.java +++ /dev/null @@ -1,23 +0,0 @@ -//------------------------------------------------------------ -// Copyright (c) Microsoft Corporation. All rights reserved. -//------------------------------------------------------------ - -package azure.data.cosmos.serialization.hybridrow.layouts; - -import azure.data.cosmos.serialization.hybridrow.Result; -import azure.data.cosmos.serialization.hybridrow.RowBuffer; -import azure.data.cosmos.serialization.hybridrow.RowCursor; - -/** - * An optional interface that indicates a can also read using a - * . - */ -public interface ILayoutUtf8SpanReadable extends ILayoutType { - Result ReadFixed(tangible.RefObject b, tangible.RefObject scope, LayoutColumn col, - tangible.OutObject value); - - Result ReadSparse(tangible.RefObject b, tangible.RefObject scope, tangible.OutObject value); - - Result ReadVariable(tangible.RefObject b, tangible.RefObject scope, LayoutColumn col, - tangible.OutObject value); -} \ No newline at end of file diff --git a/jre/src/main/java/azure/data/cosmos/serialization/hybridrow/layouts/LayoutDateTime.java b/jre/src/main/java/azure/data/cosmos/serialization/hybridrow/layouts/LayoutDateTime.java deleted file mode 100644 index 70ba623..0000000 --- a/jre/src/main/java/azure/data/cosmos/serialization/hybridrow/layouts/LayoutDateTime.java +++ /dev/null @@ -1,88 +0,0 @@ -//------------------------------------------------------------ -// Copyright (c) Microsoft Corporation. All rights reserved. -//------------------------------------------------------------ - -package azure.data.cosmos.serialization.hybridrow.layouts; - -import azure.data.cosmos.serialization.hybridrow.Result; -import azure.data.cosmos.serialization.hybridrow.RowBuffer; -import azure.data.cosmos.serialization.hybridrow.RowCursor; - -import java.time.LocalDateTime; - -import static com.google.common.base.Preconditions.checkArgument; - -public final class LayoutDateTime extends LayoutType { - public LayoutDateTime() { - super(azure.data.cosmos.serialization.hybridrow.layouts.LayoutCode.DateTime, 8); - } - - @Override - public boolean getIsFixed() { - return true; - } - - @Override - public String getName() { - return "datetime"; - } - - @Override - public Result ReadFixed(tangible.RefObject b, tangible.RefObject scope, LayoutColumn col, - tangible.OutObject value) { - checkArgument(scope.argValue.scopeType instanceof LayoutUDT); - if (!b.argValue.ReadBit(scope.argValue.start, col.getNullBit().clone())) { - value.argValue = LocalDateTime.MIN; - return Result.NotFound; - } - - value.argValue = b.argValue.ReadDateTime(scope.argValue.start + col.getOffset()); - return Result.Success; - } - - @Override - public Result ReadSparse(tangible.RefObject b, tangible.RefObject edit, - tangible.OutObject value) { - Result result = LayoutType.PrepareSparseRead(b, edit, this.LayoutCode); - if (result != Result.Success) { - value.argValue = LocalDateTime.MIN; - return result; - } - - value.argValue = b.argValue.ReadSparseDateTime(edit); - return Result.Success; - } - - @Override - public Result WriteFixed(tangible.RefObject b, tangible.RefObject scope, LayoutColumn col, - LocalDateTime value) { - checkArgument(scope.argValue.scopeType instanceof LayoutUDT); - if (scope.argValue.immutable) { - return Result.InsufficientPermissions; - } - - b.argValue.WriteDateTime(scope.argValue.start + col.getOffset(), value); - b.argValue.SetBit(scope.argValue.start, col.getNullBit().clone()); - return Result.Success; - } - - //C# TO JAVA CONVERTER NOTE: Java does not support optional parameters. Overloaded method(s) are created above: - //ORIGINAL LINE: public override Result WriteSparse(ref RowBuffer b, ref RowCursor edit, DateTime value, - // UpdateOptions options = UpdateOptions.Upsert) - @Override - public Result WriteSparse(tangible.RefObject b, tangible.RefObject edit, - LocalDateTime value, UpdateOptions options) { - Result result = LayoutType.PrepareSparseWrite(b, edit, this.getTypeArg().clone(), options); - if (result != Result.Success) { - return result; - } - - b.argValue.WriteSparseDateTime(edit, value, options); - return Result.Success; - } - - @Override - public Result WriteSparse(tangible.RefObject b, tangible.RefObject edit, DateTime value) { - return WriteSparse(b, edit, value, UpdateOptions.Upsert); - } -} \ No newline at end of file diff --git a/jre/src/main/java/azure/data/cosmos/serialization/hybridrow/layouts/LayoutDecimal.java b/jre/src/main/java/azure/data/cosmos/serialization/hybridrow/layouts/LayoutDecimal.java deleted file mode 100644 index 0257514..0000000 --- a/jre/src/main/java/azure/data/cosmos/serialization/hybridrow/layouts/LayoutDecimal.java +++ /dev/null @@ -1,90 +0,0 @@ -//------------------------------------------------------------ -// Copyright (c) Microsoft Corporation. All rights reserved. -//------------------------------------------------------------ - -package azure.data.cosmos.serialization.hybridrow.layouts; - -import azure.data.cosmos.serialization.hybridrow.Result; -import azure.data.cosmos.serialization.hybridrow.RowBuffer; -import azure.data.cosmos.serialization.hybridrow.RowCursor; - -import java.math.BigDecimal; - -import static com.google.common.base.Preconditions.checkArgument; - -public final class LayoutDecimal extends LayoutType { - public LayoutDecimal() { - // TODO: C# TO JAVA CONVERTER: There is no Java equivalent to 'sizeof': - super(azure.data.cosmos.serialization.hybridrow.layouts.LayoutCode.Decimal, sizeof(BigDecimal)); - } - - @Override - public boolean getIsFixed() { - return true; - } - - @Override - public String getName() { - return "decimal"; - } - - @Override - public Result ReadFixed(tangible.RefObject b, tangible.RefObject scope, LayoutColumn col, - tangible.OutObject value) { - checkArgument(scope.argValue.scopeType instanceof LayoutUDT); - if (!b.argValue.ReadBit(scope.argValue.start, col.getNullBit().clone())) { - value.argValue = new BigDecimal(0); - return Result.NotFound; - } - - value.argValue = b.argValue.ReadDecimal(scope.argValue.start + col.getOffset()); - return Result.Success; - } - - @Override - public Result ReadSparse(tangible.RefObject b, tangible.RefObject edit, - tangible.OutObject value) { - Result result = LayoutType.PrepareSparseRead(b, edit, this.LayoutCode); - if (result != Result.Success) { - value.argValue = new BigDecimal(0); - return result; - } - - value.argValue = b.argValue.ReadSparseDecimal(edit); - return Result.Success; - } - - @Override - public Result WriteFixed(tangible.RefObject b, tangible.RefObject scope, LayoutColumn col, - BigDecimal value) { - checkArgument(scope.argValue.scopeType instanceof LayoutUDT); - if (scope.argValue.immutable) { - return Result.InsufficientPermissions; - } - - b.argValue.WriteDecimal(scope.argValue.start + col.getOffset(), value); - b.argValue.SetBit(scope.argValue.start, col.getNullBit().clone()); - return Result.Success; - } - - //C# TO JAVA CONVERTER NOTE: Java does not support optional parameters. Overloaded method(s) are created above: - //ORIGINAL LINE: public override Result WriteSparse(ref RowBuffer b, ref RowCursor edit, decimal value, - // UpdateOptions options = UpdateOptions.Upsert) - @Override - public Result WriteSparse(tangible.RefObject b, tangible.RefObject edit, BigDecimal value, - UpdateOptions options) { - Result result = LayoutType.PrepareSparseWrite(b, edit, this.getTypeArg().clone(), options); - if (result != Result.Success) { - return result; - } - - b.argValue.WriteSparseDecimal(edit, value, options); - return Result.Success; - } - - @Override - public Result WriteSparse(tangible.RefObject b, tangible.RefObject edit, - java.math.BigDecimal value) { - return WriteSparse(b, edit, value, UpdateOptions.Upsert); - } -} \ No newline at end of file diff --git a/jre/src/main/java/azure/data/cosmos/serialization/hybridrow/layouts/LayoutFloat128.java b/jre/src/main/java/azure/data/cosmos/serialization/hybridrow/layouts/LayoutFloat128.java deleted file mode 100644 index e7efb86..0000000 --- a/jre/src/main/java/azure/data/cosmos/serialization/hybridrow/layouts/LayoutFloat128.java +++ /dev/null @@ -1,87 +0,0 @@ -//------------------------------------------------------------ -// Copyright (c) Microsoft Corporation. All rights reserved. -//------------------------------------------------------------ - -package azure.data.cosmos.serialization.hybridrow.layouts; - -import azure.data.cosmos.serialization.hybridrow.Float128; -import azure.data.cosmos.serialization.hybridrow.Result; -import azure.data.cosmos.serialization.hybridrow.RowBuffer; -import azure.data.cosmos.serialization.hybridrow.RowCursor; - -import static com.google.common.base.Preconditions.checkArgument; - -public final class LayoutFloat128 extends LayoutType { - public LayoutFloat128() { - super(azure.data.cosmos.serialization.hybridrow.layouts.LayoutCode.Float128, HybridRow.Float128.Size); - } - - @Override - public boolean getIsFixed() { - return true; - } - - @Override - public String getName() { - return "float128"; - } - - @Override - public Result ReadFixed(tangible.RefObject b, tangible.RefObject scope, LayoutColumn col, - tangible.OutObject value) { - checkArgument(scope.argValue.scopeType instanceof LayoutUDT); - if (!b.argValue.ReadBit(scope.argValue.start, col.getNullBit().clone())) { - value.argValue = null; - return Result.NotFound; - } - - value.argValue = b.argValue.ReadFloat128(scope.argValue.start + col.getOffset()).clone(); - return Result.Success; - } - - @Override - public Result ReadSparse(tangible.RefObject b, tangible.RefObject edit, - tangible.OutObject value) { - Result result = LayoutType.PrepareSparseRead(b, edit, this.LayoutCode); - if (result != Result.Success) { - value.argValue = null; - return result; - } - - value.argValue = b.argValue.ReadSparseFloat128(edit).clone(); - return Result.Success; - } - - @Override - public Result WriteFixed(tangible.RefObject b, tangible.RefObject scope, LayoutColumn col, - Float128 value) { - checkArgument(scope.argValue.scopeType instanceof LayoutUDT); - if (scope.argValue.immutable) { - return Result.InsufficientPermissions; - } - - b.argValue.WriteFloat128(scope.argValue.start + col.getOffset(), value.clone()); - b.argValue.SetBit(scope.argValue.start, col.getNullBit().clone()); - return Result.Success; - } - - //C# TO JAVA CONVERTER NOTE: Java does not support optional parameters. Overloaded method(s) are created above: - //ORIGINAL LINE: public override Result WriteSparse(ref RowBuffer b, ref RowCursor edit, Float128 value, - // UpdateOptions options = UpdateOptions.Upsert) - @Override - public Result WriteSparse(tangible.RefObject b, tangible.RefObject edit, Float128 value, - UpdateOptions options) { - Result result = LayoutType.PrepareSparseWrite(b, edit, this.getTypeArg().clone(), options); - if (result != Result.Success) { - return result; - } - - b.argValue.WriteSparseFloat128(edit, value.clone(), options); - return Result.Success; - } - - @Override - public Result WriteSparse(tangible.RefObject b, tangible.RefObject edit, Float128 value) { - return WriteSparse(b, edit, value, UpdateOptions.Upsert); - } -} \ No newline at end of file diff --git a/jre/src/main/java/azure/data/cosmos/serialization/hybridrow/layouts/LayoutFloat32.java b/jre/src/main/java/azure/data/cosmos/serialization/hybridrow/layouts/LayoutFloat32.java deleted file mode 100644 index ef072da..0000000 --- a/jre/src/main/java/azure/data/cosmos/serialization/hybridrow/layouts/LayoutFloat32.java +++ /dev/null @@ -1,86 +0,0 @@ -//------------------------------------------------------------ -// Copyright (c) Microsoft Corporation. All rights reserved. -//------------------------------------------------------------ - -package azure.data.cosmos.serialization.hybridrow.layouts; - -import azure.data.cosmos.serialization.hybridrow.Result; -import azure.data.cosmos.serialization.hybridrow.RowBuffer; -import azure.data.cosmos.serialization.hybridrow.RowCursor; - -import static com.google.common.base.Preconditions.checkArgument; - -public final class LayoutFloat32 extends LayoutType { - public LayoutFloat32() { - super(azure.data.cosmos.serialization.hybridrow.layouts.LayoutCode.Float32, (Float.SIZE / Byte.SIZE)); - } - - @Override - public boolean getIsFixed() { - return true; - } - - @Override - public String getName() { - return "float32"; - } - - @Override - public Result ReadFixed(tangible.RefObject b, tangible.RefObject scope, LayoutColumn col, - tangible.OutObject value) { - checkArgument(scope.argValue.scopeType instanceof LayoutUDT); - if (!b.argValue.ReadBit(scope.argValue.start, col.getNullBit().clone())) { - value.argValue = 0; - return Result.NotFound; - } - - value.argValue = b.argValue.ReadFloat32(scope.argValue.start + col.getOffset()); - return Result.Success; - } - - @Override - public Result ReadSparse(tangible.RefObject b, tangible.RefObject edit, - tangible.OutObject value) { - Result result = LayoutType.PrepareSparseRead(b, edit, this.LayoutCode); - if (result != Result.Success) { - value.argValue = 0; - return result; - } - - value.argValue = b.argValue.ReadSparseFloat32(edit); - return Result.Success; - } - - @Override - public Result WriteFixed(tangible.RefObject b, tangible.RefObject scope, LayoutColumn col, - float value) { - checkArgument(scope.argValue.scopeType instanceof LayoutUDT); - if (scope.argValue.immutable) { - return Result.InsufficientPermissions; - } - - b.argValue.WriteFloat32(scope.argValue.start + col.getOffset(), value); - b.argValue.SetBit(scope.argValue.start, col.getNullBit().clone()); - return Result.Success; - } - - //C# TO JAVA CONVERTER NOTE: Java does not support optional parameters. Overloaded method(s) are created above: - //ORIGINAL LINE: public override Result WriteSparse(ref RowBuffer b, ref RowCursor edit, float value, - // UpdateOptions options = UpdateOptions.Upsert) - @Override - public Result WriteSparse(tangible.RefObject b, tangible.RefObject edit, float value, - UpdateOptions options) { - Result result = LayoutType.PrepareSparseWrite(b, edit, this.getTypeArg().clone(), options); - if (result != Result.Success) { - return result; - } - - b.argValue.WriteSparseFloat32(edit, value, options); - return Result.Success; - } - - @Override - public Result WriteSparse(tangible.RefObject b, tangible.RefObject edit, float value) { - return WriteSparse(b, edit, value, UpdateOptions.Upsert); - } -} \ No newline at end of file diff --git a/jre/src/main/java/azure/data/cosmos/serialization/hybridrow/layouts/LayoutFloat64.java b/jre/src/main/java/azure/data/cosmos/serialization/hybridrow/layouts/LayoutFloat64.java deleted file mode 100644 index efb898b..0000000 --- a/jre/src/main/java/azure/data/cosmos/serialization/hybridrow/layouts/LayoutFloat64.java +++ /dev/null @@ -1,86 +0,0 @@ -//------------------------------------------------------------ -// Copyright (c) Microsoft Corporation. All rights reserved. -//------------------------------------------------------------ - -package azure.data.cosmos.serialization.hybridrow.layouts; - -import azure.data.cosmos.serialization.hybridrow.Result; -import azure.data.cosmos.serialization.hybridrow.RowBuffer; -import azure.data.cosmos.serialization.hybridrow.RowCursor; - -import static com.google.common.base.Preconditions.checkArgument; - -public final class LayoutFloat64 extends LayoutType { - public LayoutFloat64() { - super(azure.data.cosmos.serialization.hybridrow.layouts.LayoutCode.Float64, (Double.SIZE / Byte.SIZE)); - } - - @Override - public boolean getIsFixed() { - return true; - } - - @Override - public String getName() { - return "float64"; - } - - @Override - public Result ReadFixed(tangible.RefObject b, tangible.RefObject scope, LayoutColumn col, - tangible.OutObject value) { - checkArgument(scope.argValue.scopeType instanceof LayoutUDT); - if (!b.argValue.ReadBit(scope.argValue.start, col.getNullBit().clone())) { - value.argValue = 0; - return Result.NotFound; - } - - value.argValue = b.argValue.ReadFloat64(scope.argValue.start + col.getOffset()); - return Result.Success; - } - - @Override - public Result ReadSparse(tangible.RefObject b, tangible.RefObject edit, - tangible.OutObject value) { - Result result = LayoutType.PrepareSparseRead(b, edit, this.LayoutCode); - if (result != Result.Success) { - value.argValue = 0; - return result; - } - - value.argValue = b.argValue.ReadSparseFloat64(edit); - return Result.Success; - } - - @Override - public Result WriteFixed(tangible.RefObject b, tangible.RefObject scope, LayoutColumn col, - double value) { - checkArgument(scope.argValue.scopeType instanceof LayoutUDT); - if (scope.argValue.immutable) { - return Result.InsufficientPermissions; - } - - b.argValue.WriteFloat64(scope.argValue.start + col.getOffset(), value); - b.argValue.SetBit(scope.argValue.start, col.getNullBit().clone()); - return Result.Success; - } - - //C# TO JAVA CONVERTER NOTE: Java does not support optional parameters. Overloaded method(s) are created above: - //ORIGINAL LINE: public override Result WriteSparse(ref RowBuffer b, ref RowCursor edit, double value, - // UpdateOptions options = UpdateOptions.Upsert) - @Override - public Result WriteSparse(tangible.RefObject b, tangible.RefObject edit, double value, - UpdateOptions options) { - Result result = LayoutType.PrepareSparseWrite(b, edit, this.getTypeArg().clone(), options); - if (result != Result.Success) { - return result; - } - - b.argValue.WriteSparseFloat64(edit, value, options); - return Result.Success; - } - - @Override - public Result WriteSparse(tangible.RefObject b, tangible.RefObject edit, double value) { - return WriteSparse(b, edit, value, UpdateOptions.Upsert); - } -} \ No newline at end of file diff --git a/jre/src/main/java/azure/data/cosmos/serialization/hybridrow/layouts/LayoutGuid.java b/jre/src/main/java/azure/data/cosmos/serialization/hybridrow/layouts/LayoutGuid.java deleted file mode 100644 index 8e3e2f8..0000000 --- a/jre/src/main/java/azure/data/cosmos/serialization/hybridrow/layouts/LayoutGuid.java +++ /dev/null @@ -1,89 +0,0 @@ -//------------------------------------------------------------ -// Copyright (c) Microsoft Corporation. All rights reserved. -//------------------------------------------------------------ - -package azure.data.cosmos.serialization.hybridrow.layouts; - -import azure.data.cosmos.serialization.hybridrow.Result; -import azure.data.cosmos.serialization.hybridrow.RowBuffer; -import azure.data.cosmos.serialization.hybridrow.RowCursor; - -import java.util.UUID; - -import static com.google.common.base.Preconditions.checkArgument; - -public final class LayoutGuid extends LayoutType { - public LayoutGuid() { - super(azure.data.cosmos.serialization.hybridrow.layouts.LayoutCode.Guid, 16); - } - - @Override - public boolean getIsFixed() { - return true; - } - - @Override - public String getName() { - return "guid"; - } - - @Override - public Result ReadFixed(tangible.RefObject b, tangible.RefObject scope, LayoutColumn col, - tangible.OutObject value) { - checkArgument(scope.argValue.scopeType instanceof LayoutUDT); - if (!b.argValue.ReadBit(scope.argValue.start, col.getNullBit().clone())) { - value.argValue = null; - return Result.NotFound; - } - - value.argValue = b.argValue.ReadGuid(scope.argValue.start + col.getOffset()); - return Result.Success; - } - - @Override - public Result ReadSparse(tangible.RefObject b, tangible.RefObject edit, - tangible.OutObject value) { - Result result = LayoutType.PrepareSparseRead(b, edit, this.LayoutCode); - if (result != Result.Success) { - value.argValue = null; - return result; - } - - value.argValue = b.argValue.ReadSparseGuid(edit); - return Result.Success; - } - - @Override - public Result WriteFixed(tangible.RefObject b, tangible.RefObject scope, LayoutColumn col, - UUID value) { - checkArgument(scope.argValue.scopeType instanceof LayoutUDT); - if (scope.argValue.immutable) { - return Result.InsufficientPermissions; - } - - b.argValue.WriteGuid(scope.argValue.start + col.getOffset(), value); - b.argValue.SetBit(scope.argValue.start, col.getNullBit().clone()); - return Result.Success; - } - - //C# TO JAVA CONVERTER NOTE: Java does not support optional parameters. Overloaded method(s) are created above: - //ORIGINAL LINE: public override Result WriteSparse(ref RowBuffer b, ref RowCursor edit, Guid value, - // UpdateOptions options = UpdateOptions.Upsert) - @Override - public Result WriteSparse(tangible.RefObject b, tangible.RefObject edit, UUID value, - UpdateOptions options) { - Result result = LayoutType.PrepareSparseWrite(b, edit, this.getTypeArg().clone(), options); - if (result != Result.Success) { - return result; - } - - b.argValue.WriteSparseGuid(edit, value, options); - return Result.Success; - } - - @Override - public Result WriteSparse(tangible.RefObject b, tangible.RefObject edit, - java.util.UUID value) { - return WriteSparse(b, edit, value, UpdateOptions.Upsert); - } -} \ No newline at end of file diff --git a/jre/src/main/java/azure/data/cosmos/serialization/hybridrow/layouts/LayoutIndexedScope.java b/jre/src/main/java/azure/data/cosmos/serialization/hybridrow/layouts/LayoutIndexedScope.java deleted file mode 100644 index a0d7b1b..0000000 --- a/jre/src/main/java/azure/data/cosmos/serialization/hybridrow/layouts/LayoutIndexedScope.java +++ /dev/null @@ -1,26 +0,0 @@ -//------------------------------------------------------------ -// Copyright (c) Microsoft Corporation. All rights reserved. -//------------------------------------------------------------ - -package azure.data.cosmos.serialization.hybridrow.layouts; - -import azure.data.cosmos.serialization.hybridrow.RowBuffer; -import azure.data.cosmos.serialization.hybridrow.RowCursor; - -public abstract class LayoutIndexedScope extends LayoutScope { - protected LayoutIndexedScope(LayoutCode code, boolean immutable, boolean isSizedScope, boolean isFixedArity, - boolean isUniqueScope, boolean isTypedScope) { - // TODO: C# TO JAVA CONVERTER: C# to Java Converter could not resolve the named parameters in the - // following line: - //ORIGINAL LINE: base(code, immutable, isSizedScope, isIndexedScope: true, isFixedArity: isFixedArity, - // isUniqueScope: isUniqueScope, isTypedScope: isTypedScope); - super(code, immutable, isSizedScope, isIndexedScope:true, isFixedArity:isFixedArity, isUniqueScope: - isUniqueScope, isTypedScope:isTypedScope) - } - - @Override - public void ReadSparsePath(tangible.RefObject row, tangible.RefObject edit) { - edit.argValue.pathToken = 0; - edit.argValue.pathOffset = 0; - } -} \ No newline at end of file diff --git a/jre/src/main/java/azure/data/cosmos/serialization/hybridrow/layouts/LayoutInt16.java b/jre/src/main/java/azure/data/cosmos/serialization/hybridrow/layouts/LayoutInt16.java deleted file mode 100644 index 2a83dde..0000000 --- a/jre/src/main/java/azure/data/cosmos/serialization/hybridrow/layouts/LayoutInt16.java +++ /dev/null @@ -1,86 +0,0 @@ -//------------------------------------------------------------ -// Copyright (c) Microsoft Corporation. All rights reserved. -//------------------------------------------------------------ - -package azure.data.cosmos.serialization.hybridrow.layouts; - -import azure.data.cosmos.serialization.hybridrow.Result; -import azure.data.cosmos.serialization.hybridrow.RowBuffer; -import azure.data.cosmos.serialization.hybridrow.RowCursor; - -import static com.google.common.base.Preconditions.checkArgument; - -public final class LayoutInt16 extends LayoutType { - public LayoutInt16() { - super(azure.data.cosmos.serialization.hybridrow.layouts.LayoutCode.Int16, (Short.SIZE / Byte.SIZE)); - } - - @Override - public boolean getIsFixed() { - return true; - } - - @Override - public String getName() { - return "int16"; - } - - @Override - public Result ReadFixed(tangible.RefObject b, tangible.RefObject scope, LayoutColumn col, - tangible.OutObject value) { - checkArgument(scope.argValue.scopeType instanceof LayoutUDT); - if (!b.argValue.ReadBit(scope.argValue.start, col.getNullBit().clone())) { - value.argValue = 0; - return Result.NotFound; - } - - value.argValue = b.argValue.ReadInt16(scope.argValue.start + col.getOffset()); - return Result.Success; - } - - @Override - public Result ReadSparse(tangible.RefObject b, tangible.RefObject edit, - tangible.OutObject value) { - Result result = LayoutType.PrepareSparseRead(b, edit, this.LayoutCode); - if (result != Result.Success) { - value.argValue = 0; - return result; - } - - value.argValue = b.argValue.ReadSparseInt16(edit); - return Result.Success; - } - - @Override - public Result WriteFixed(tangible.RefObject b, tangible.RefObject scope, LayoutColumn col, - short value) { - checkArgument(scope.argValue.scopeType instanceof LayoutUDT); - if (scope.argValue.immutable) { - return Result.InsufficientPermissions; - } - - b.argValue.WriteInt16(scope.argValue.start + col.getOffset(), value); - b.argValue.SetBit(scope.argValue.start, col.getNullBit().clone()); - return Result.Success; - } - - //C# TO JAVA CONVERTER NOTE: Java does not support optional parameters. Overloaded method(s) are created above: - //ORIGINAL LINE: public override Result WriteSparse(ref RowBuffer b, ref RowCursor edit, short value, - // UpdateOptions options = UpdateOptions.Upsert) - @Override - public Result WriteSparse(tangible.RefObject b, tangible.RefObject edit, short value, - UpdateOptions options) { - Result result = LayoutType.PrepareSparseWrite(b, edit, this.getTypeArg().clone(), options); - if (result != Result.Success) { - return result; - } - - b.argValue.WriteSparseInt16(edit, value, options); - return Result.Success; - } - - @Override - public Result WriteSparse(tangible.RefObject b, tangible.RefObject edit, short value) { - return WriteSparse(b, edit, value, UpdateOptions.Upsert); - } -} \ No newline at end of file diff --git a/jre/src/main/java/azure/data/cosmos/serialization/hybridrow/layouts/LayoutInt32.java b/jre/src/main/java/azure/data/cosmos/serialization/hybridrow/layouts/LayoutInt32.java deleted file mode 100644 index 720351c..0000000 --- a/jre/src/main/java/azure/data/cosmos/serialization/hybridrow/layouts/LayoutInt32.java +++ /dev/null @@ -1,86 +0,0 @@ -//------------------------------------------------------------ -// Copyright (c) Microsoft Corporation. All rights reserved. -//------------------------------------------------------------ - -package azure.data.cosmos.serialization.hybridrow.layouts; - -import azure.data.cosmos.serialization.hybridrow.Result; -import azure.data.cosmos.serialization.hybridrow.RowBuffer; -import azure.data.cosmos.serialization.hybridrow.RowCursor; - -import static com.google.common.base.Preconditions.checkArgument; - -public final class LayoutInt32 extends LayoutType { - public LayoutInt32() { - super(azure.data.cosmos.serialization.hybridrow.layouts.LayoutCode.Int32, (Integer.SIZE / Byte.SIZE)); - } - - @Override - public boolean getIsFixed() { - return true; - } - - @Override - public String getName() { - return "int32"; - } - - @Override - public Result ReadFixed(tangible.RefObject b, tangible.RefObject scope, LayoutColumn col, - tangible.OutObject value) { - checkArgument(scope.argValue.scopeType instanceof LayoutUDT); - if (!b.argValue.ReadBit(scope.argValue.start, col.getNullBit().clone())) { - value.argValue = 0; - return Result.NotFound; - } - - value.argValue = b.argValue.ReadInt32(scope.argValue.start + col.getOffset()); - return Result.Success; - } - - @Override - public Result ReadSparse(tangible.RefObject b, tangible.RefObject edit, - tangible.OutObject value) { - Result result = LayoutType.PrepareSparseRead(b, edit, this.LayoutCode); - if (result != Result.Success) { - value.argValue = 0; - return result; - } - - value.argValue = b.argValue.ReadSparseInt32(edit); - return Result.Success; - } - - @Override - public Result WriteFixed(tangible.RefObject b, tangible.RefObject scope, LayoutColumn col, - int value) { - checkArgument(scope.argValue.scopeType instanceof LayoutUDT); - if (scope.argValue.immutable) { - return Result.InsufficientPermissions; - } - - b.argValue.WriteInt32(scope.argValue.start + col.getOffset(), value); - b.argValue.SetBit(scope.argValue.start, col.getNullBit().clone()); - return Result.Success; - } - - //C# TO JAVA CONVERTER NOTE: Java does not support optional parameters. Overloaded method(s) are created above: - //ORIGINAL LINE: public override Result WriteSparse(ref RowBuffer b, ref RowCursor edit, int value, UpdateOptions - // options = UpdateOptions.Upsert) - @Override - public Result WriteSparse(tangible.RefObject b, tangible.RefObject edit, int value, - UpdateOptions options) { - Result result = LayoutType.PrepareSparseWrite(b, edit, this.getTypeArg().clone(), options); - if (result != Result.Success) { - return result; - } - - b.argValue.WriteSparseInt32(edit, value, options); - return Result.Success; - } - - @Override - public Result WriteSparse(tangible.RefObject b, tangible.RefObject edit, int value) { - return WriteSparse(b, edit, value, UpdateOptions.Upsert); - } -} \ No newline at end of file diff --git a/jre/src/main/java/azure/data/cosmos/serialization/hybridrow/layouts/LayoutInt64.java b/jre/src/main/java/azure/data/cosmos/serialization/hybridrow/layouts/LayoutInt64.java deleted file mode 100644 index ad37b2e..0000000 --- a/jre/src/main/java/azure/data/cosmos/serialization/hybridrow/layouts/LayoutInt64.java +++ /dev/null @@ -1,86 +0,0 @@ -//------------------------------------------------------------ -// Copyright (c) Microsoft Corporation. All rights reserved. -//------------------------------------------------------------ - -package azure.data.cosmos.serialization.hybridrow.layouts; - -import azure.data.cosmos.serialization.hybridrow.Result; -import azure.data.cosmos.serialization.hybridrow.RowBuffer; -import azure.data.cosmos.serialization.hybridrow.RowCursor; - -import static com.google.common.base.Preconditions.checkArgument; - -public final class LayoutInt64 extends LayoutType { - public LayoutInt64() { - super(azure.data.cosmos.serialization.hybridrow.layouts.LayoutCode.Int64, (Long.SIZE / Byte.SIZE)); - } - - @Override - public boolean getIsFixed() { - return true; - } - - @Override - public String getName() { - return "int64"; - } - - @Override - public Result ReadFixed(tangible.RefObject b, tangible.RefObject scope, LayoutColumn col, - tangible.OutObject value) { - checkArgument(scope.argValue.scopeType instanceof LayoutUDT); - if (!b.argValue.ReadBit(scope.argValue.start, col.getNullBit().clone())) { - value.argValue = 0; - return Result.NotFound; - } - - value.argValue = b.argValue.ReadInt64(scope.argValue.start + col.getOffset()); - return Result.Success; - } - - @Override - public Result ReadSparse(tangible.RefObject b, tangible.RefObject edit, - tangible.OutObject value) { - Result result = LayoutType.PrepareSparseRead(b, edit, this.LayoutCode); - if (result != Result.Success) { - value.argValue = 0; - return result; - } - - value.argValue = b.argValue.ReadSparseInt64(edit); - return Result.Success; - } - - @Override - public Result WriteFixed(tangible.RefObject b, tangible.RefObject scope, LayoutColumn col, - long value) { - checkArgument(scope.argValue.scopeType instanceof LayoutUDT); - if (scope.argValue.immutable) { - return Result.InsufficientPermissions; - } - - b.argValue.WriteInt64(scope.argValue.start + col.getOffset(), value); - b.argValue.SetBit(scope.argValue.start, col.getNullBit().clone()); - return Result.Success; - } - - //C# TO JAVA CONVERTER NOTE: Java does not support optional parameters. Overloaded method(s) are created above: - //ORIGINAL LINE: public override Result WriteSparse(ref RowBuffer b, ref RowCursor edit, long value, - // UpdateOptions options = UpdateOptions.Upsert) - @Override - public Result WriteSparse(tangible.RefObject b, tangible.RefObject edit, long value, - UpdateOptions options) { - Result result = LayoutType.PrepareSparseWrite(b, edit, this.getTypeArg().clone(), options); - if (result != Result.Success) { - return result; - } - - b.argValue.WriteSparseInt64(edit, value, options); - return Result.Success; - } - - @Override - public Result WriteSparse(tangible.RefObject b, tangible.RefObject edit, long value) { - return WriteSparse(b, edit, value, UpdateOptions.Upsert); - } -} \ No newline at end of file diff --git a/jre/src/main/java/azure/data/cosmos/serialization/hybridrow/layouts/LayoutInt8.java b/jre/src/main/java/azure/data/cosmos/serialization/hybridrow/layouts/LayoutInt8.java deleted file mode 100644 index 8734212..0000000 --- a/jre/src/main/java/azure/data/cosmos/serialization/hybridrow/layouts/LayoutInt8.java +++ /dev/null @@ -1,86 +0,0 @@ -//------------------------------------------------------------ -// Copyright (c) Microsoft Corporation. All rights reserved. -//------------------------------------------------------------ - -package azure.data.cosmos.serialization.hybridrow.layouts; - -import azure.data.cosmos.serialization.hybridrow.Result; -import azure.data.cosmos.serialization.hybridrow.RowBuffer; -import azure.data.cosmos.serialization.hybridrow.RowCursor; - -import static com.google.common.base.Preconditions.checkArgument; - -public final class LayoutInt8 extends LayoutType { - public LayoutInt8() { - super(azure.data.cosmos.serialization.hybridrow.layouts.LayoutCode.Int8, (Byte.SIZE / Byte.SIZE)); - } - - @Override - public boolean getIsFixed() { - return true; - } - - @Override - public String getName() { - return "int8"; - } - - @Override - public Result ReadFixed(tangible.RefObject b, tangible.RefObject scope, LayoutColumn col, - tangible.OutObject value) { - checkArgument(scope.argValue.scopeType instanceof LayoutUDT); - if (!b.argValue.ReadBit(scope.argValue.start, col.getNullBit().clone())) { - value.argValue = 0; - return Result.NotFound; - } - - value.argValue = b.argValue.ReadInt8(scope.argValue.start + col.getOffset()); - return Result.Success; - } - - @Override - public Result ReadSparse(tangible.RefObject b, tangible.RefObject edit, - tangible.OutObject value) { - Result result = LayoutType.PrepareSparseRead(b, edit, this.LayoutCode); - if (result != Result.Success) { - value.argValue = 0; - return result; - } - - value.argValue = b.argValue.ReadSparseInt8(edit); - return Result.Success; - } - - @Override - public Result WriteFixed(tangible.RefObject b, tangible.RefObject scope, LayoutColumn col, - byte value) { - checkArgument(scope.argValue.scopeType instanceof LayoutUDT); - if (scope.argValue.immutable) { - return Result.InsufficientPermissions; - } - - b.argValue.WriteInt8(scope.argValue.start + col.getOffset(), value); - b.argValue.SetBit(scope.argValue.start, col.getNullBit().clone()); - return Result.Success; - } - - //C# TO JAVA CONVERTER NOTE: Java does not support optional parameters. Overloaded method(s) are created above: - //ORIGINAL LINE: public override Result WriteSparse(ref RowBuffer b, ref RowCursor edit, sbyte value, - // UpdateOptions options = UpdateOptions.Upsert) - @Override - public Result WriteSparse(tangible.RefObject b, tangible.RefObject edit, byte value, - UpdateOptions options) { - Result result = LayoutType.PrepareSparseWrite(b, edit, this.getTypeArg().clone(), options); - if (result != Result.Success) { - return result; - } - - b.argValue.WriteSparseInt8(edit, value, options); - return Result.Success; - } - - @Override - public Result WriteSparse(tangible.RefObject b, tangible.RefObject edit, byte value) { - return WriteSparse(b, edit, value, UpdateOptions.Upsert); - } -} \ No newline at end of file diff --git a/jre/src/main/java/azure/data/cosmos/serialization/hybridrow/layouts/LayoutMongoDbObjectId.java b/jre/src/main/java/azure/data/cosmos/serialization/hybridrow/layouts/LayoutMongoDbObjectId.java deleted file mode 100644 index 6163e84..0000000 --- a/jre/src/main/java/azure/data/cosmos/serialization/hybridrow/layouts/LayoutMongoDbObjectId.java +++ /dev/null @@ -1,88 +0,0 @@ -//------------------------------------------------------------ -// Copyright (c) Microsoft Corporation. All rights reserved. -//------------------------------------------------------------ - -package azure.data.cosmos.serialization.hybridrow.layouts; - -import azure.data.cosmos.serialization.hybridrow.Result; -import azure.data.cosmos.serialization.hybridrow.RowBuffer; -import azure.data.cosmos.serialization.hybridrow.RowCursor; - -import static com.google.common.base.Preconditions.checkArgument; - -public final class LayoutMongoDbObjectId extends LayoutType { - public LayoutMongoDbObjectId() { - super(azure.data.cosmos.serialization.hybridrow.layouts.LayoutCode.MongoDbObjectId, Microsoft.Azure.Cosmos.Serialization.HybridRow.MongoDbObjectId.Size); - } - - @Override - public boolean getIsFixed() { - return true; - } - - // ReSharper disable once StringLiteralTypo - @Override - public String getName() { - return "mongodbobjectid"; - } - - @Override - public Result ReadFixed(tangible.RefObject b, tangible.RefObject scope, LayoutColumn col, - tangible.OutObject value) { - checkArgument(scope.argValue.scopeType instanceof LayoutUDT); - if (!b.argValue.ReadBit(scope.argValue.start, col.getNullBit().clone())) { - value.argValue = null; - return Result.NotFound; - } - - value.argValue = b.argValue.ReadMongoDbObjectId(scope.argValue.start + col.getOffset()).clone(); - return Result.Success; - } - - @Override - public Result ReadSparse(tangible.RefObject b, tangible.RefObject edit, - tangible.OutObject value) { - Result result = LayoutType.PrepareSparseRead(b, edit, this.LayoutCode); - if (result != Result.Success) { - value.argValue = null; - return result; - } - - value.argValue = b.argValue.ReadSparseMongoDbObjectId(edit).clone(); - return Result.Success; - } - - @Override - public Result WriteFixed(tangible.RefObject b, tangible.RefObject scope, LayoutColumn col, - MongoDbObjectId value) { - checkArgument(scope.argValue.scopeType instanceof LayoutUDT); - if (scope.argValue.immutable) { - return Result.InsufficientPermissions; - } - - b.argValue.WriteMongoDbObjectId(scope.argValue.start + col.getOffset(), value.clone()); - b.argValue.SetBit(scope.argValue.start, col.getNullBit().clone()); - return Result.Success; - } - - //C# TO JAVA CONVERTER NOTE: Java does not support optional parameters. Overloaded method(s) are created above: - //ORIGINAL LINE: public override Result WriteSparse(ref RowBuffer b, ref RowCursor edit, MongoDbObjectId value, - // UpdateOptions options = UpdateOptions.Upsert) - @Override - public Result WriteSparse(tangible.RefObject b, tangible.RefObject edit, - MongoDbObjectId value, UpdateOptions options) { - Result result = LayoutType.PrepareSparseWrite(b, edit, this.getTypeArg().clone(), options); - if (result != Result.Success) { - return result; - } - - b.argValue.WriteSparseMongoDbObjectId(edit, value.clone(), options); - return Result.Success; - } - - @Override - public Result WriteSparse(tangible.RefObject b, tangible.RefObject edit, - MongoDbObjectId value) { - return WriteSparse(b, edit, value, UpdateOptions.Upsert); - } -} \ No newline at end of file diff --git a/jre/src/main/java/azure/data/cosmos/serialization/hybridrow/layouts/LayoutNull.java b/jre/src/main/java/azure/data/cosmos/serialization/hybridrow/layouts/LayoutNull.java deleted file mode 100644 index 7c8d5c4..0000000 --- a/jre/src/main/java/azure/data/cosmos/serialization/hybridrow/layouts/LayoutNull.java +++ /dev/null @@ -1,90 +0,0 @@ -//------------------------------------------------------------ -// Copyright (c) Microsoft Corporation. All rights reserved. -//------------------------------------------------------------ - -package azure.data.cosmos.serialization.hybridrow.layouts; - -import azure.data.cosmos.serialization.hybridrow.NullValue; -import azure.data.cosmos.serialization.hybridrow.Result; -import azure.data.cosmos.serialization.hybridrow.RowBuffer; -import azure.data.cosmos.serialization.hybridrow.RowCursor; - -import static com.google.common.base.Preconditions.checkArgument; - -public final class LayoutNull extends LayoutType { - public LayoutNull() { - super(azure.data.cosmos.serialization.hybridrow.layouts.LayoutCode.Null, 0); - } - - @Override - public boolean getIsFixed() { - return true; - } - - @Override - public boolean getIsNull() { - return true; - } - - @Override - public String getName() { - return "null"; - } - - @Override - public Result ReadFixed(tangible.RefObject b, tangible.RefObject scope, LayoutColumn col, - tangible.OutObject value) { - checkArgument(scope.argValue.scopeType instanceof LayoutUDT); - value.argValue = NullValue.Default; - if (!b.argValue.ReadBit(scope.argValue.start, col.getNullBit().clone())) { - return Result.NotFound; - } - - return Result.Success; - } - - @Override - public Result ReadSparse(tangible.RefObject b, tangible.RefObject edit, - tangible.OutObject value) { - Result result = LayoutType.PrepareSparseRead(b, edit, this.LayoutCode); - if (result != Result.Success) { - value.argValue = null; - return result; - } - - value.argValue = b.argValue.ReadSparseNull(edit).clone(); - return Result.Success; - } - - @Override - public Result WriteFixed(tangible.RefObject b, tangible.RefObject scope, LayoutColumn col, - NullValue value) { - checkArgument(scope.argValue.scopeType instanceof LayoutUDT); - if (scope.argValue.immutable) { - return Result.InsufficientPermissions; - } - - b.argValue.SetBit(scope.argValue.start, col.getNullBit().clone()); - return Result.Success; - } - - //C# TO JAVA CONVERTER NOTE: Java does not support optional parameters. Overloaded method(s) are created above: - //ORIGINAL LINE: public override Result WriteSparse(ref RowBuffer b, ref RowCursor edit, NullValue value, - // UpdateOptions options = UpdateOptions.Upsert) - @Override - public Result WriteSparse(tangible.RefObject b, tangible.RefObject edit, NullValue value, - UpdateOptions options) { - Result result = LayoutType.PrepareSparseWrite(b, edit, this.getTypeArg().clone(), options); - if (result != Result.Success) { - return result; - } - - b.argValue.WriteSparseNull(edit, value.clone(), options); - return Result.Success; - } - - @Override - public Result WriteSparse(tangible.RefObject b, tangible.RefObject edit, NullValue value) { - return WriteSparse(b, edit, value, UpdateOptions.Upsert); - } -} \ No newline at end of file diff --git a/jre/src/main/java/azure/data/cosmos/serialization/hybridrow/layouts/LayoutNullable.java b/jre/src/main/java/azure/data/cosmos/serialization/hybridrow/layouts/LayoutNullable.java deleted file mode 100644 index 4b7e14b..0000000 --- a/jre/src/main/java/azure/data/cosmos/serialization/hybridrow/layouts/LayoutNullable.java +++ /dev/null @@ -1,106 +0,0 @@ -//------------------------------------------------------------ -// Copyright (c) Microsoft Corporation. All rights reserved. -//------------------------------------------------------------ - -package azure.data.cosmos.serialization.hybridrow.layouts; - -import azure.data.cosmos.serialization.hybridrow.Result; -import azure.data.cosmos.serialization.hybridrow.RowBuffer; -import azure.data.cosmos.serialization.hybridrow.RowCursor; - -import static azure.data.cosmos.serialization.hybridrow.layouts.LayoutCode.ImmutableNullableScope; -import static azure.data.cosmos.serialization.hybridrow.layouts.LayoutCode.NullableScope; -import static com.google.common.base.Preconditions.checkArgument; -import static com.google.common.base.Preconditions.checkState; - -public final class LayoutNullable extends LayoutIndexedScope { - public LayoutNullable(boolean immutable) { - super(immutable ? ImmutableNullableScope : NullableScope, immutable, true, true, false, true); - } - - @Override - public String getName() { - return this.Immutable ? "im_nullable" : "nullable"; - } - - @Override - public int CountTypeArgument(TypeArgumentList value) { - checkState(value.getCount() == 1); - return (azure.data.cosmos.serialization.hybridrow.layouts.LayoutCode.SIZE / Byte.SIZE) + value.get(0).getType().CountTypeArgument(value.get(0).getTypeArgs().clone()); - } - - @Override - public boolean HasImplicitTypeCode(tangible.RefObject edit) { - checkState(edit.argValue.index >= 0); - checkState(edit.argValue.scopeTypeArgs.getCount() == 1); - checkState(edit.argValue.index == 1); - return !LayoutCodeTraits.AlwaysRequiresTypeCode(edit.argValue.scopeTypeArgs.get(0).getType().LayoutCode); - } - - public static Result HasValue(tangible.RefObject b, tangible.RefObject scope) { - checkArgument(scope.argValue.scopeType instanceof LayoutNullable); - checkState(scope.argValue.index == 1 || scope.argValue.index == 2, "Nullable scopes always point at the value"); - checkState(scope.argValue.scopeTypeArgs.getCount() == 1); - boolean hasValue = b.argValue.ReadInt8(scope.argValue.start) != 0; - return hasValue ? Result.Success : Result.NotFound; - } - - @Override - public TypeArgumentList ReadTypeArgumentList(tangible.RefObject row, int offset, - tangible.OutObject lenInBytes) { - return new TypeArgumentList(new azure.data.cosmos.serialization.hybridrow.layouts.TypeArgument[] { LayoutType.ReadTypeArgument(row, offset, lenInBytes) }); - } - - @Override - public void SetImplicitTypeCode(tangible.RefObject edit) { - checkState(edit.argValue.index == 1); - edit.argValue.cellType = edit.argValue.scopeTypeArgs.get(0).getType(); - edit.argValue.cellTypeArgs = edit.argValue.scopeTypeArgs.get(0).getTypeArgs().clone(); - } - - public Result WriteScope(tangible.RefObject b, tangible.RefObject edit, - TypeArgumentList typeArgs, boolean hasValue, tangible.OutObject value) { - return WriteScope(b, edit, typeArgs, hasValue, value, UpdateOptions.Upsert); - } - - //C# TO JAVA CONVERTER NOTE: Java does not support optional parameters. Overloaded method(s) are created above: - //ORIGINAL LINE: public Result WriteScope(ref RowBuffer b, ref RowCursor edit, TypeArgumentList typeArgs, bool - // hasValue, out RowCursor value, UpdateOptions options = UpdateOptions.Upsert) - public Result WriteScope(tangible.RefObject b, tangible.RefObject edit, - TypeArgumentList typeArgs, boolean hasValue, tangible.OutObject value, - UpdateOptions options) { - Result result = LayoutType.PrepareSparseWrite(b, edit, new TypeArgument(this, typeArgs.clone()), options); - if (result != Result.Success) { - value.argValue = null; - return result; - } - - b.argValue.WriteNullable(edit, this, typeArgs.clone(), options, hasValue, value.clone()); - return Result.Success; - } - - @Override - public Result WriteScope(tangible.RefObject b, tangible.RefObject edit, - TypeArgumentList typeArgs, tangible.OutObject value) { - return WriteScope(b, edit, typeArgs, value, UpdateOptions.Upsert); - } - - //C# TO JAVA CONVERTER NOTE: Java does not support optional parameters. Overloaded method(s) are created above: - //ORIGINAL LINE: public override Result WriteScope(ref RowBuffer b, ref RowCursor edit, TypeArgumentList - // typeArgs, out RowCursor value, UpdateOptions options = UpdateOptions.Upsert) - @Override - public Result WriteScope(tangible.RefObject b, tangible.RefObject edit, - TypeArgumentList typeArgs, tangible.OutObject value, UpdateOptions options) { - return this.WriteScope(b, edit, typeArgs.clone(), true, value, options); - } - - @Override - public int WriteTypeArgument(tangible.RefObject row, int offset, TypeArgumentList value) { - checkState(value.getCount() == 1); - row.argValue.WriteSparseTypeCode(offset, this.LayoutCode); - int lenInBytes = (azure.data.cosmos.serialization.hybridrow.layouts.LayoutCode.SIZE / Byte.SIZE); - lenInBytes += value.get(0).getType().WriteTypeArgument(row, offset + lenInBytes, - value.get(0).getTypeArgs().clone()); - return lenInBytes; - } -} \ No newline at end of file diff --git a/jre/src/main/java/azure/data/cosmos/serialization/hybridrow/layouts/LayoutTagged.java b/jre/src/main/java/azure/data/cosmos/serialization/hybridrow/layouts/LayoutTagged.java deleted file mode 100644 index eaa6175..0000000 --- a/jre/src/main/java/azure/data/cosmos/serialization/hybridrow/layouts/LayoutTagged.java +++ /dev/null @@ -1,83 +0,0 @@ -//------------------------------------------------------------ -// Copyright (c) Microsoft Corporation. All rights reserved. -//------------------------------------------------------------ - -package azure.data.cosmos.serialization.hybridrow.layouts; - -import azure.data.cosmos.serialization.hybridrow.Result; -import azure.data.cosmos.serialization.hybridrow.RowBuffer; -import azure.data.cosmos.serialization.hybridrow.RowCursor; - -import static azure.data.cosmos.serialization.hybridrow.layouts.LayoutCode.ImmutableTaggedScope; -import static azure.data.cosmos.serialization.hybridrow.layouts.LayoutCode.TaggedScope; - -public final class LayoutTagged extends LayoutIndexedScope { - public LayoutTagged(boolean immutable) { - super(immutable ? ImmutableTaggedScope : TaggedScope, immutable, true, true, false, true); - } - - @Override - public String getName() { - return this.Immutable ? "im_tagged_t" : "tagged_t"; - } - - @Override - public int CountTypeArgument(TypeArgumentList value) { - checkState(value.getCount() == 2); - return (azure.data.cosmos.serialization.hybridrow.layouts.LayoutCode.SIZE / Byte.SIZE) + value.get(1).getType().CountTypeArgument(value.get(1).getTypeArgs().clone()); - } - - @Override - public boolean HasImplicitTypeCode(tangible.RefObject edit) { - Contract.Assert(edit.argValue.index >= 0); - Contract.Assert(edit.argValue.scopeTypeArgs.getCount() > edit.argValue.index); - return !LayoutCodeTraits.AlwaysRequiresTypeCode(edit.argValue.scopeTypeArgs.get(edit.argValue.index).getType().LayoutCode); - } - - @Override - public TypeArgumentList ReadTypeArgumentList(tangible.RefObject row, int offset, - tangible.OutObject lenInBytes) { - TypeArgument[] retval = new TypeArgument[2]; - retval[0] = new TypeArgument(LayoutType.UInt8, TypeArgumentList.Empty); - retval[1] = LayoutType.ReadTypeArgument(row, offset, lenInBytes); - return new TypeArgumentList(retval); - } - - @Override - public void SetImplicitTypeCode(tangible.RefObject edit) { - edit.argValue.cellType = edit.argValue.scopeTypeArgs.get(edit.argValue.index).getType(); - edit.argValue.cellTypeArgs = edit.argValue.scopeTypeArgs.get(edit.argValue.index).getTypeArgs().clone(); - } - - @Override - public Result WriteScope(tangible.RefObject b, tangible.RefObject edit, - TypeArgumentList typeArgs, tangible.OutObject value) { - return WriteScope(b, edit, typeArgs, value, UpdateOptions.Upsert); - } - - //C# TO JAVA CONVERTER NOTE: Java does not support optional parameters. Overloaded method(s) are created above: - //ORIGINAL LINE: public override Result WriteScope(ref RowBuffer b, ref RowCursor edit, TypeArgumentList - // typeArgs, out RowCursor value, UpdateOptions options = UpdateOptions.Upsert) - @Override - public Result WriteScope(tangible.RefObject b, tangible.RefObject edit, - TypeArgumentList typeArgs, tangible.OutObject value, UpdateOptions options) { - Result result = LayoutType.PrepareSparseWrite(b, edit, new TypeArgument(this, typeArgs.clone()), options); - if (result != Result.Success) { - value.argValue = null; - return result; - } - - b.argValue.WriteTypedTuple(edit, this, typeArgs.clone(), options, value.clone()); - return Result.Success; - } - - @Override - public int WriteTypeArgument(tangible.RefObject row, int offset, TypeArgumentList value) { - Contract.Assert(value.getCount() == 2); - row.argValue.WriteSparseTypeCode(offset, this.LayoutCode); - int lenInBytes = (azure.data.cosmos.serialization.hybridrow.layouts.LayoutCode.SIZE / Byte.SIZE); - lenInBytes += value.get(1).getType().WriteTypeArgument(row, offset + lenInBytes, - value.get(1).getTypeArgs().clone()); - return lenInBytes; - } -} \ No newline at end of file diff --git a/jre/src/main/java/azure/data/cosmos/serialization/hybridrow/layouts/LayoutTagged2.java b/jre/src/main/java/azure/data/cosmos/serialization/hybridrow/layouts/LayoutTagged2.java deleted file mode 100644 index cd07dee..0000000 --- a/jre/src/main/java/azure/data/cosmos/serialization/hybridrow/layouts/LayoutTagged2.java +++ /dev/null @@ -1,98 +0,0 @@ -//------------------------------------------------------------ -// Copyright (c) Microsoft Corporation. All rights reserved. -//------------------------------------------------------------ - -package azure.data.cosmos.serialization.hybridrow.layouts; - -import azure.data.cosmos.serialization.hybridrow.Result; -import azure.data.cosmos.serialization.hybridrow.RowBuffer; -import azure.data.cosmos.serialization.hybridrow.RowCursor; - -public final class LayoutTagged2 extends LayoutIndexedScope { - public LayoutTagged2(boolean immutable) { - super(immutable ? azure.data.cosmos.serialization.hybridrow.layouts.LayoutCode.ImmutableTagged2Scope : azure.data.cosmos.serialization.hybridrow.layouts.LayoutCode.Tagged2Scope, immutable, isSizedScope: - true, isFixedArity:true, isUniqueScope:false, isTypedScope:true) - } - - @Override - public String getName() { - return this.Immutable ? "im_tagged2_t" : "tagged2_t"; - } - - @Override - public int CountTypeArgument(TypeArgumentList value) { - checkState(value.getCount() == 3); - int lenInBytes = (azure.data.cosmos.serialization.hybridrow.layouts.LayoutCode.SIZE / Byte.SIZE); - for (int i = 1; i < value.getCount(); i++) { - TypeArgument arg = value.get(i).clone(); - lenInBytes += arg.getType().CountTypeArgument(arg.getTypeArgs().clone()); - } - - return lenInBytes; - } - - @Override - public boolean HasImplicitTypeCode(tangible.RefObject edit) { - checkState(edit.argValue.index >= 0); - checkState(edit.argValue.scopeTypeArgs.getCount() > edit.argValue.index); - return !LayoutCodeTraits.AlwaysRequiresTypeCode(edit.argValue.scopeTypeArgs.get(edit.argValue.index).getType().LayoutCode); - } - - @Override - public TypeArgumentList ReadTypeArgumentList(tangible.RefObject row, int offset, - tangible.OutObject lenInBytes) { - lenInBytes.argValue = 0; - TypeArgument[] retval = new TypeArgument[3]; - retval[0] = new TypeArgument(LayoutType.UInt8, TypeArgumentList.Empty); - for (int i = 1; i < 3; i++) { - int itemLenInBytes; - tangible.OutObject tempOut_itemLenInBytes = new tangible.OutObject(); - retval[i] = LayoutType.ReadTypeArgument(row, offset + lenInBytes.argValue, tempOut_itemLenInBytes); - itemLenInBytes = tempOut_itemLenInBytes.argValue; - lenInBytes.argValue += itemLenInBytes; - } - - return new TypeArgumentList(retval); - } - - @Override - public void SetImplicitTypeCode(tangible.RefObject edit) { - edit.argValue.cellType = edit.argValue.scopeTypeArgs.get(edit.argValue.index).getType(); - edit.argValue.cellTypeArgs = edit.argValue.scopeTypeArgs.get(edit.argValue.index).getTypeArgs().clone(); - } - - @Override - public Result WriteScope(tangible.RefObject b, tangible.RefObject edit, - TypeArgumentList typeArgs, tangible.OutObject value) { - return WriteScope(b, edit, typeArgs, value, UpdateOptions.Upsert); - } - - //C# TO JAVA CONVERTER NOTE: Java does not support optional parameters. Overloaded method(s) are created above: - //ORIGINAL LINE: public override Result WriteScope(ref RowBuffer b, ref RowCursor edit, TypeArgumentList - // typeArgs, out RowCursor value, UpdateOptions options = UpdateOptions.Upsert) - @Override - public Result WriteScope(tangible.RefObject b, tangible.RefObject edit, - TypeArgumentList typeArgs, tangible.OutObject value, UpdateOptions options) { - Result result = LayoutType.PrepareSparseWrite(b, edit, new TypeArgument(this, typeArgs.clone()), options); - if (result != Result.Success) { - value.argValue = null; - return result; - } - - b.argValue.WriteTypedTuple(edit, this, typeArgs.clone(), options, value.clone()); - return Result.Success; - } - - @Override - public int WriteTypeArgument(tangible.RefObject row, int offset, TypeArgumentList value) { - checkState(value.getCount() == 3); - row.argValue.WriteSparseTypeCode(offset, this.LayoutCode); - int lenInBytes = (azure.data.cosmos.serialization.hybridrow.layouts.LayoutCode.SIZE / Byte.SIZE); - for (int i = 1; i < value.getCount(); i++) { - TypeArgument arg = value.get(i).clone(); - lenInBytes += arg.getType().WriteTypeArgument(row, offset + lenInBytes, arg.getTypeArgs().clone()); - } - - return lenInBytes; - } -} \ No newline at end of file diff --git a/jre/src/main/java/azure/data/cosmos/serialization/hybridrow/layouts/LayoutTuple.java b/jre/src/main/java/azure/data/cosmos/serialization/hybridrow/layouts/LayoutTuple.java deleted file mode 100644 index 46e5070..0000000 --- a/jre/src/main/java/azure/data/cosmos/serialization/hybridrow/layouts/LayoutTuple.java +++ /dev/null @@ -1,86 +0,0 @@ -//------------------------------------------------------------ -// Copyright (c) Microsoft Corporation. All rights reserved. -//------------------------------------------------------------ - -package azure.data.cosmos.serialization.hybridrow.layouts; - -import azure.data.cosmos.serialization.hybridrow.Result; -import azure.data.cosmos.serialization.hybridrow.RowBuffer; -import azure.data.cosmos.serialization.hybridrow.RowCursor; - -public final class LayoutTuple extends LayoutIndexedScope { - public LayoutTuple(boolean immutable) { - super(immutable ? azure.data.cosmos.serialization.hybridrow.layouts.LayoutCode.ImmutableTupleScope : azure.data.cosmos.serialization.hybridrow.layouts.LayoutCode.TupleScope, immutable, isSizedScope: - false, isFixedArity:true, isUniqueScope:false, isTypedScope:false) - } - - @Override - public String getName() { - return this.Immutable ? "im_tuple" : "tuple"; - } - - @Override - public int CountTypeArgument(TypeArgumentList value) { - int lenInBytes = (azure.data.cosmos.serialization.hybridrow.layouts.LayoutCode.SIZE / Byte.SIZE); - //C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java: - //ORIGINAL LINE: lenInBytes += RowBuffer.Count7BitEncodedUInt((ulong)value.Count); - lenInBytes += RowBuffer.Count7BitEncodedUInt(value.getCount()); - for (TypeArgument arg : value) { - lenInBytes += arg.getType().CountTypeArgument(arg.getTypeArgs().clone()); - } - - return lenInBytes; - } - - @Override - public TypeArgumentList ReadTypeArgumentList(tangible.RefObject row, int offset, - tangible.OutObject lenInBytes) { - int numTypeArgs = row.argValue.intValue().Read7BitEncodedUInt(offset, lenInBytes); - TypeArgument[] retval = new TypeArgument[numTypeArgs]; - for (int i = 0; i < numTypeArgs; i++) { - int itemLenInBytes; - tangible.OutObject tempOut_itemLenInBytes = new tangible.OutObject(); - retval[i] = LayoutType.ReadTypeArgument(row, offset + lenInBytes.argValue, tempOut_itemLenInBytes); - itemLenInBytes = tempOut_itemLenInBytes.argValue; - lenInBytes.argValue += itemLenInBytes; - } - - return new TypeArgumentList(retval); - } - - @Override - public Result WriteScope(tangible.RefObject b, tangible.RefObject edit, - TypeArgumentList typeArgs, tangible.OutObject value) { - return WriteScope(b, edit, typeArgs, value, UpdateOptions.Upsert); - } - - //C# TO JAVA CONVERTER NOTE: Java does not support optional parameters. Overloaded method(s) are created above: - //ORIGINAL LINE: public override Result WriteScope(ref RowBuffer b, ref RowCursor edit, TypeArgumentList - // typeArgs, out RowCursor value, UpdateOptions options = UpdateOptions.Upsert) - @Override - public Result WriteScope(tangible.RefObject b, tangible.RefObject edit, - TypeArgumentList typeArgs, tangible.OutObject value, UpdateOptions options) { - Result result = LayoutType.PrepareSparseWrite(b, edit, new TypeArgument(this, typeArgs.clone()), options); - if (result != Result.Success) { - value.argValue = null; - return result; - } - - b.argValue.WriteSparseTuple(edit, this, typeArgs.clone(), options, value.clone()); - return Result.Success; - } - - @Override - public int WriteTypeArgument(tangible.RefObject row, int offset, TypeArgumentList value) { - row.argValue.WriteSparseTypeCode(offset, this.LayoutCode); - int lenInBytes = (azure.data.cosmos.serialization.hybridrow.layouts.LayoutCode.SIZE / Byte.SIZE); - //C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java: - //ORIGINAL LINE: lenInBytes += row.Write7BitEncodedUInt(offset + lenInBytes, (ulong)value.Count); - lenInBytes += row.argValue.Write7BitEncodedUInt(offset + lenInBytes, value.getCount()); - for (TypeArgument arg : value) { - lenInBytes += arg.getType().WriteTypeArgument(row, offset + lenInBytes, arg.getTypeArgs().clone()); - } - - return lenInBytes; - } -} \ No newline at end of file diff --git a/jre/src/main/java/azure/data/cosmos/serialization/hybridrow/layouts/LayoutTypedArray.java b/jre/src/main/java/azure/data/cosmos/serialization/hybridrow/layouts/LayoutTypedArray.java deleted file mode 100644 index fb6a336..0000000 --- a/jre/src/main/java/azure/data/cosmos/serialization/hybridrow/layouts/LayoutTypedArray.java +++ /dev/null @@ -1,81 +0,0 @@ -//------------------------------------------------------------ -// Copyright (c) Microsoft Corporation. All rights reserved. -//------------------------------------------------------------ - -package azure.data.cosmos.serialization.hybridrow.layouts; - -import azure.data.cosmos.serialization.hybridrow.Result; -import azure.data.cosmos.serialization.hybridrow.RowBuffer; -import azure.data.cosmos.serialization.hybridrow.RowCursor; - -import static azure.data.cosmos.serialization.hybridrow.layouts.LayoutCode.ImmutableTypedArrayScope; -import static azure.data.cosmos.serialization.hybridrow.layouts.LayoutCode.SIZE; -import static azure.data.cosmos.serialization.hybridrow.layouts.LayoutCode.TypedArrayScope; - -public final class LayoutTypedArray extends LayoutIndexedScope { - public LayoutTypedArray(boolean immutable) { - super(immutable ? ImmutableTypedArrayScope : TypedArrayScope, immutable, true, false, false, true); - } - - @Override - public String getName() { - return this.Immutable ? "im_array_t" : "array_t"; - } - - @Override - public int CountTypeArgument(TypeArgumentList value) { - checkState(value.getCount() == 1); - return (SIZE / Byte.SIZE) + value.get(0).getType().CountTypeArgument(value.get(0).getTypeArgs().clone()); - } - - @Override - public boolean HasImplicitTypeCode(tangible.RefObject edit) { - checkState(edit.argValue.index >= 0); - checkState(edit.argValue.scopeTypeArgs.getCount() == 1); - return !LayoutCodeTraits.AlwaysRequiresTypeCode(edit.argValue.scopeTypeArgs.get(0).getType().LayoutCode); - } - - @Override - public TypeArgumentList ReadTypeArgumentList(tangible.RefObject row, int offset, - tangible.OutObject lenInBytes) { - return new TypeArgumentList(new azure.data.cosmos.serialization.hybridrow.layouts.TypeArgument[] { LayoutType.ReadTypeArgument(row, offset, lenInBytes) }); - } - - @Override - public void SetImplicitTypeCode(tangible.RefObject edit) { - edit.argValue.cellType = edit.argValue.scopeTypeArgs.get(0).getType(); - edit.argValue.cellTypeArgs = edit.argValue.scopeTypeArgs.get(0).getTypeArgs().clone(); - } - - @Override - public Result WriteScope(tangible.RefObject b, tangible.RefObject edit, - TypeArgumentList typeArgs, tangible.OutObject value) { - return WriteScope(b, edit, typeArgs, value, UpdateOptions.Upsert); - } - - //C# TO JAVA CONVERTER NOTE: Java does not support optional parameters. Overloaded method(s) are created above: - //ORIGINAL LINE: public override Result WriteScope(ref RowBuffer b, ref RowCursor edit, TypeArgumentList - // typeArgs, out RowCursor value, UpdateOptions options = UpdateOptions.Upsert) - @Override - public Result WriteScope(tangible.RefObject b, tangible.RefObject edit, - TypeArgumentList typeArgs, tangible.OutObject value, UpdateOptions options) { - Result result = LayoutType.PrepareSparseWrite(b, edit, new TypeArgument(this, typeArgs.clone()), options); - if (result != Result.Success) { - value.argValue = null; - return result; - } - - b.argValue.WriteTypedArray(edit, this, typeArgs.clone(), options, value.clone()); - return Result.Success; - } - - @Override - public int WriteTypeArgument(tangible.RefObject row, int offset, TypeArgumentList value) { - checkState(value.getCount() == 1); - row.argValue.WriteSparseTypeCode(offset, this.LayoutCode); - int lenInBytes = (SIZE / Byte.SIZE); - lenInBytes += value.get(0).getType().WriteTypeArgument(row, offset + lenInBytes, - value.get(0).getTypeArgs().clone()); - return lenInBytes; - } -} \ No newline at end of file diff --git a/jre/src/main/java/azure/data/cosmos/serialization/hybridrow/layouts/LayoutTypedMap.java b/jre/src/main/java/azure/data/cosmos/serialization/hybridrow/layouts/LayoutTypedMap.java deleted file mode 100644 index cc78a97..0000000 --- a/jre/src/main/java/azure/data/cosmos/serialization/hybridrow/layouts/LayoutTypedMap.java +++ /dev/null @@ -1,100 +0,0 @@ -//------------------------------------------------------------ -// Copyright (c) Microsoft Corporation. All rights reserved. -//------------------------------------------------------------ - -package azure.data.cosmos.serialization.hybridrow.layouts; - -import azure.data.cosmos.serialization.hybridrow.Result; -import azure.data.cosmos.serialization.hybridrow.RowBuffer; -import azure.data.cosmos.serialization.hybridrow.RowCursor; - -public final class LayoutTypedMap extends LayoutUniqueScope { - public LayoutTypedMap(boolean immutable) { - super(immutable ? azure.data.cosmos.serialization.hybridrow.layouts.LayoutCode.ImmutableTypedMapScope : azure.data.cosmos.serialization.hybridrow.layouts.LayoutCode.TypedMapScope, immutable, isSizedScope: - true, isTypedScope:true) - } - - @Override - public String getName() { - return this.Immutable ? "im_map_t" : "map_t"; - } - - @Override - public int CountTypeArgument(TypeArgumentList value) { - checkState(value.getCount() == 2); - int lenInBytes = (azure.data.cosmos.serialization.hybridrow.layouts.LayoutCode.SIZE / Byte.SIZE); - for (TypeArgument arg : value) { - lenInBytes += arg.getType().CountTypeArgument(arg.getTypeArgs().clone()); - } - - return lenInBytes; - } - - @Override - public TypeArgument FieldType(tangible.RefObject scope) { - return new TypeArgument(scope.argValue.scopeType.Immutable ? LayoutType.ImmutableTypedTuple : - LayoutType.TypedTuple, scope.argValue.scopeTypeArgs.clone()); - } - - @Override - public boolean HasImplicitTypeCode(tangible.RefObject edit) { - return true; - } - - @Override - public TypeArgumentList ReadTypeArgumentList(tangible.RefObject row, int offset, - tangible.OutObject lenInBytes) { - lenInBytes.argValue = 0; - TypeArgument[] retval = new TypeArgument[2]; - for (int i = 0; i < 2; i++) { - int itemLenInBytes; - tangible.OutObject tempOut_itemLenInBytes = new tangible.OutObject(); - retval[i] = LayoutType.ReadTypeArgument(row, offset + lenInBytes.argValue, tempOut_itemLenInBytes); - itemLenInBytes = tempOut_itemLenInBytes.argValue; - lenInBytes.argValue += itemLenInBytes; - } - - return new TypeArgumentList(retval); - } - - @Override - public void SetImplicitTypeCode(tangible.RefObject edit) { - edit.argValue.cellType = edit.argValue.scopeType.Immutable ? LayoutType.ImmutableTypedTuple : - LayoutType.TypedTuple; - edit.argValue.cellTypeArgs = edit.argValue.scopeTypeArgs.clone(); - } - - @Override - public Result WriteScope(tangible.RefObject b, tangible.RefObject edit, - TypeArgumentList typeArgs, tangible.OutObject value) { - return WriteScope(b, edit, typeArgs, value, UpdateOptions.Upsert); - } - - //C# TO JAVA CONVERTER NOTE: Java does not support optional parameters. Overloaded method(s) are created above: - //ORIGINAL LINE: public override Result WriteScope(ref RowBuffer b, ref RowCursor edit, TypeArgumentList - // typeArgs, out RowCursor value, UpdateOptions options = UpdateOptions.Upsert) - @Override - public Result WriteScope(tangible.RefObject b, tangible.RefObject edit, - TypeArgumentList typeArgs, tangible.OutObject value, UpdateOptions options) { - Result result = LayoutType.PrepareSparseWrite(b, edit, new TypeArgument(this, typeArgs.clone()), options); - if (result != Result.Success) { - value.argValue = null; - return result; - } - - b.argValue.WriteTypedMap(edit, this, typeArgs.clone(), options, value.clone()); - return Result.Success; - } - - @Override - public int WriteTypeArgument(tangible.RefObject row, int offset, TypeArgumentList value) { - checkState(value.getCount() == 2); - row.argValue.WriteSparseTypeCode(offset, this.LayoutCode); - int lenInBytes = (azure.data.cosmos.serialization.hybridrow.layouts.LayoutCode.SIZE / Byte.SIZE); - for (TypeArgument arg : value) { - lenInBytes += arg.getType().WriteTypeArgument(row, offset + lenInBytes, arg.getTypeArgs().clone()); - } - - return lenInBytes; - } -} \ No newline at end of file diff --git a/jre/src/main/java/azure/data/cosmos/serialization/hybridrow/layouts/LayoutTypedSet.java b/jre/src/main/java/azure/data/cosmos/serialization/hybridrow/layouts/LayoutTypedSet.java deleted file mode 100644 index 52af67b..0000000 --- a/jre/src/main/java/azure/data/cosmos/serialization/hybridrow/layouts/LayoutTypedSet.java +++ /dev/null @@ -1,85 +0,0 @@ -//------------------------------------------------------------ -// Copyright (c) Microsoft Corporation. All rights reserved. -//------------------------------------------------------------ - -package azure.data.cosmos.serialization.hybridrow.layouts; - -import azure.data.cosmos.serialization.hybridrow.Result; -import azure.data.cosmos.serialization.hybridrow.RowBuffer; -import azure.data.cosmos.serialization.hybridrow.RowCursor; - -import static azure.data.cosmos.serialization.hybridrow.layouts.LayoutCode.ImmutableTypedSetScope; -import static azure.data.cosmos.serialization.hybridrow.layouts.LayoutCode.TypedSetScope; - -public final class LayoutTypedSet extends LayoutUniqueScope { - public LayoutTypedSet(boolean immutable) { - super(immutable ? ImmutableTypedSetScope : TypedSetScope, immutable, true, true); - } - - @Override - public String getName() { - return this.Immutable ? "im_set_t" : "set_t"; - } - - @Override - public int CountTypeArgument(TypeArgumentList value) { - checkState(value.getCount() == 1); - return (azure.data.cosmos.serialization.hybridrow.layouts.LayoutCode.SIZE / Byte.SIZE) + value.get(0).getType().CountTypeArgument(value.get(0).getTypeArgs().clone()); - } - - @Override - public TypeArgument FieldType(tangible.RefObject scope) { - return scope.argValue.scopeTypeArgs.get(0).clone(); - } - - @Override - public boolean HasImplicitTypeCode(tangible.RefObject edit) { - checkState(edit.argValue.index >= 0); - checkState(edit.argValue.scopeTypeArgs.getCount() == 1); - return !LayoutCodeTraits.AlwaysRequiresTypeCode(edit.argValue.scopeTypeArgs.get(0).getType().LayoutCode); - } - - @Override - public TypeArgumentList ReadTypeArgumentList(tangible.RefObject row, int offset, - tangible.OutObject lenInBytes) { - return new TypeArgumentList(new azure.data.cosmos.serialization.hybridrow.layouts.TypeArgument[] { LayoutType.ReadTypeArgument(row, offset, lenInBytes) }); - } - - @Override - public void SetImplicitTypeCode(tangible.RefObject edit) { - edit.argValue.cellType = edit.argValue.scopeTypeArgs.get(0).getType(); - edit.argValue.cellTypeArgs = edit.argValue.scopeTypeArgs.get(0).getTypeArgs().clone(); - } - - @Override - public Result WriteScope(tangible.RefObject b, tangible.RefObject edit, - TypeArgumentList typeArgs, tangible.OutObject value) { - return WriteScope(b, edit, typeArgs, value, UpdateOptions.Upsert); - } - - //C# TO JAVA CONVERTER NOTE: Java does not support optional parameters. Overloaded method(s) are created above: - //ORIGINAL LINE: public override Result WriteScope(ref RowBuffer b, ref RowCursor edit, TypeArgumentList - // typeArgs, out RowCursor value, UpdateOptions options = UpdateOptions.Upsert) - @Override - public Result WriteScope(tangible.RefObject b, tangible.RefObject edit, - TypeArgumentList typeArgs, tangible.OutObject value, UpdateOptions options) { - Result result = LayoutType.PrepareSparseWrite(b, edit, new TypeArgument(this, typeArgs.clone()), options); - if (result != Result.Success) { - value.argValue = null; - return result; - } - - b.argValue.WriteTypedSet(edit, this, typeArgs.clone(), options, value.clone()); - return Result.Success; - } - - @Override - public int WriteTypeArgument(tangible.RefObject row, int offset, TypeArgumentList value) { - Contract.Assert(value.getCount() == 1); - row.argValue.WriteSparseTypeCode(offset, this.LayoutCode); - int lenInBytes = (azure.data.cosmos.serialization.hybridrow.layouts.LayoutCode.SIZE / Byte.SIZE); - lenInBytes += value.get(0).getType().WriteTypeArgument(row, offset + lenInBytes, - value.get(0).getTypeArgs().clone()); - return lenInBytes; - } -} \ No newline at end of file diff --git a/jre/src/main/java/azure/data/cosmos/serialization/hybridrow/layouts/LayoutTypedTuple.java b/jre/src/main/java/azure/data/cosmos/serialization/hybridrow/layouts/LayoutTypedTuple.java deleted file mode 100644 index f0badbb..0000000 --- a/jre/src/main/java/azure/data/cosmos/serialization/hybridrow/layouts/LayoutTypedTuple.java +++ /dev/null @@ -1,99 +0,0 @@ -//------------------------------------------------------------ -// Copyright (c) Microsoft Corporation. All rights reserved. -//------------------------------------------------------------ - -package azure.data.cosmos.serialization.hybridrow.layouts; - -import azure.data.cosmos.serialization.hybridrow.Result; -import azure.data.cosmos.serialization.hybridrow.RowBuffer; -import azure.data.cosmos.serialization.hybridrow.RowCursor; - -public final class LayoutTypedTuple extends LayoutIndexedScope { - public LayoutTypedTuple(boolean immutable) { - super(immutable ? azure.data.cosmos.serialization.hybridrow.layouts.LayoutCode.ImmutableTypedTupleScope : azure.data.cosmos.serialization.hybridrow.layouts.LayoutCode.TypedTupleScope, immutable, isSizedScope: - true, isFixedArity:true, isUniqueScope:false, isTypedScope:true) - } - - @Override - public String getName() { - return this.Immutable ? "im_tuple_t" : "tuple_t"; - } - - @Override - public int CountTypeArgument(TypeArgumentList value) { - int lenInBytes = (azure.data.cosmos.serialization.hybridrow.layouts.LayoutCode.SIZE / Byte.SIZE); - //C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java: - //ORIGINAL LINE: lenInBytes += RowBuffer.Count7BitEncodedUInt((ulong)value.Count); - lenInBytes += RowBuffer.Count7BitEncodedUInt(value.getCount()); - for (TypeArgument arg : value) { - lenInBytes += arg.getType().CountTypeArgument(arg.getTypeArgs().clone()); - } - - return lenInBytes; - } - - @Override - public boolean HasImplicitTypeCode(tangible.RefObject edit) { - Contract.Assert(edit.argValue.index >= 0); - Contract.Assert(edit.argValue.scopeTypeArgs.getCount() > edit.argValue.index); - return !LayoutCodeTraits.AlwaysRequiresTypeCode(edit.argValue.scopeTypeArgs.get(edit.argValue.index).getType().LayoutCode); - } - - @Override - public TypeArgumentList ReadTypeArgumentList(tangible.RefObject row, int offset, - tangible.OutObject lenInBytes) { - int numTypeArgs = row.argValue.intValue().Read7BitEncodedUInt(offset, lenInBytes); - TypeArgument[] retval = new TypeArgument[numTypeArgs]; - for (int i = 0; i < numTypeArgs; i++) { - int itemLenInBytes; - tangible.OutObject tempOut_itemLenInBytes = new tangible.OutObject(); - retval[i] = LayoutType.ReadTypeArgument(row, offset + lenInBytes.argValue, tempOut_itemLenInBytes); - itemLenInBytes = tempOut_itemLenInBytes.argValue; - lenInBytes.argValue += itemLenInBytes; - } - - return new TypeArgumentList(retval); - } - - @Override - public void SetImplicitTypeCode(tangible.RefObject edit) { - edit.argValue.cellType = edit.argValue.scopeTypeArgs.get(edit.argValue.index).getType(); - edit.argValue.cellTypeArgs = edit.argValue.scopeTypeArgs.get(edit.argValue.index).getTypeArgs().clone(); - } - - @Override - public Result WriteScope(tangible.RefObject b, tangible.RefObject edit, - TypeArgumentList typeArgs, tangible.OutObject value) { - return WriteScope(b, edit, typeArgs, value, UpdateOptions.Upsert); - } - - //C# TO JAVA CONVERTER NOTE: Java does not support optional parameters. Overloaded method(s) are created above: - //ORIGINAL LINE: public override Result WriteScope(ref RowBuffer b, ref RowCursor edit, TypeArgumentList - // typeArgs, out RowCursor value, UpdateOptions options = UpdateOptions.Upsert) - @Override - public Result WriteScope(tangible.RefObject b, tangible.RefObject edit, - TypeArgumentList typeArgs, tangible.OutObject value, UpdateOptions options) { - Result result = LayoutType.PrepareSparseWrite(b, edit, new TypeArgument(this, typeArgs.clone()), options); - if (result != Result.Success) { - value.argValue = null; - return result; - } - - b.argValue.WriteTypedTuple(edit, this, typeArgs.clone(), options, value.clone()); - return Result.Success; - } - - @Override - public int WriteTypeArgument(tangible.RefObject row, int offset, TypeArgumentList value) { - row.argValue.WriteSparseTypeCode(offset, this.LayoutCode); - int lenInBytes = (azure.data.cosmos.serialization.hybridrow.layouts.LayoutCode.SIZE / Byte.SIZE); - //C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java: - //ORIGINAL LINE: lenInBytes += row.Write7BitEncodedUInt(offset + lenInBytes, (ulong)value.Count); - lenInBytes += row.argValue.Write7BitEncodedUInt(offset + lenInBytes, value.getCount()); - for (TypeArgument arg : value) { - lenInBytes += arg.getType().WriteTypeArgument(row, offset + lenInBytes, arg.getTypeArgs().clone()); - } - - return lenInBytes; - } -} \ No newline at end of file diff --git a/jre/src/main/java/azure/data/cosmos/serialization/hybridrow/layouts/LayoutUDT.java b/jre/src/main/java/azure/data/cosmos/serialization/hybridrow/layouts/LayoutUDT.java deleted file mode 100644 index dcf743f..0000000 --- a/jre/src/main/java/azure/data/cosmos/serialization/hybridrow/layouts/LayoutUDT.java +++ /dev/null @@ -1,64 +0,0 @@ -//------------------------------------------------------------ -// Copyright (c) Microsoft Corporation. All rights reserved. -//------------------------------------------------------------ - -package azure.data.cosmos.serialization.hybridrow.layouts; - -import azure.data.cosmos.serialization.hybridrow.Result; -import azure.data.cosmos.serialization.hybridrow.RowBuffer; -import azure.data.cosmos.serialization.hybridrow.RowCursor; -import azure.data.cosmos.serialization.hybridrow.SchemaId; - -public final class LayoutUDT extends LayoutPropertyScope { - public LayoutUDT(boolean immutable) { - super(immutable ? azure.data.cosmos.serialization.hybridrow.layouts.LayoutCode.ImmutableSchema : azure.data.cosmos.serialization.hybridrow.layouts.LayoutCode.Schema, immutable); - } - - @Override - public String getName() { - return this.Immutable ? "im_udt" : "udt"; - } - - @Override - public int CountTypeArgument(TypeArgumentList value) { - return (azure.data.cosmos.serialization.hybridrow.layouts.LayoutCode.SIZE / Byte.SIZE) + SchemaId.Size; - } - - @Override - public TypeArgumentList ReadTypeArgumentList(tangible.RefObject row, int offset, - tangible.OutObject lenInBytes) { - SchemaId schemaId = row.argValue.ReadSchemaId(offset).clone(); - lenInBytes.argValue = SchemaId.Size; - return new TypeArgumentList(schemaId.clone()); - } - - @Override - public Result WriteScope(tangible.RefObject b, tangible.RefObject edit, - TypeArgumentList typeArgs, tangible.OutObject value) { - return WriteScope(b, edit, typeArgs, value, UpdateOptions.Upsert); - } - - //C# TO JAVA CONVERTER NOTE: Java does not support optional parameters. Overloaded method(s) are created above: - //ORIGINAL LINE: public override Result WriteScope(ref RowBuffer b, ref RowCursor edit, TypeArgumentList - // typeArgs, out RowCursor value, UpdateOptions options = UpdateOptions.Upsert) - @Override - public Result WriteScope(tangible.RefObject b, tangible.RefObject edit, - TypeArgumentList typeArgs, tangible.OutObject value, UpdateOptions options) { - Layout udt = b.argValue.getResolver().Resolve(typeArgs.getSchemaId().clone()); - Result result = LayoutType.PrepareSparseWrite(b, edit, new TypeArgument(this, typeArgs.clone()), options); - if (result != Result.Success) { - value.argValue = null; - return result; - } - - b.argValue.WriteSparseUDT(edit, this, udt, options, value.clone()); - return Result.Success; - } - - @Override - public int WriteTypeArgument(tangible.RefObject row, int offset, TypeArgumentList value) { - row.argValue.WriteSparseTypeCode(offset, this.LayoutCode); - row.argValue.WriteSchemaId(offset + (azure.data.cosmos.serialization.hybridrow.layouts.LayoutCode.SIZE / Byte.SIZE), value.getSchemaId().clone()); - return (azure.data.cosmos.serialization.hybridrow.layouts.LayoutCode.SIZE / Byte.SIZE) + SchemaId.Size; - } -} \ No newline at end of file diff --git a/jre/src/main/java/azure/data/cosmos/serialization/hybridrow/layouts/LayoutUnixDateTime.java b/jre/src/main/java/azure/data/cosmos/serialization/hybridrow/layouts/LayoutUnixDateTime.java deleted file mode 100644 index 181bd6f..0000000 --- a/jre/src/main/java/azure/data/cosmos/serialization/hybridrow/layouts/LayoutUnixDateTime.java +++ /dev/null @@ -1,87 +0,0 @@ -//------------------------------------------------------------ -// Copyright (c) Microsoft Corporation. All rights reserved. -//------------------------------------------------------------ - -package azure.data.cosmos.serialization.hybridrow.layouts; - -import azure.data.cosmos.serialization.hybridrow.Result; -import azure.data.cosmos.serialization.hybridrow.RowBuffer; -import azure.data.cosmos.serialization.hybridrow.RowCursor; -import azure.data.cosmos.serialization.hybridrow.UnixDateTime; - -import static com.google.common.base.Preconditions.checkArgument; - -public final class LayoutUnixDateTime extends LayoutType { - public LayoutUnixDateTime() { - super(azure.data.cosmos.serialization.hybridrow.layouts.LayoutCode.UnixDateTime, Microsoft.Azure.Cosmos.Serialization.HybridRow.UnixDateTime.Size); - } - - @Override - public boolean getIsFixed() { - return true; - } - - @Override - public String getName() { - return "unixdatetime"; - } - - @Override - public Result ReadFixed(tangible.RefObject b, tangible.RefObject scope, LayoutColumn col, - tangible.OutObject value) { - checkArgument(scope.argValue.scopeType instanceof LayoutUDT); - if (!b.argValue.ReadBit(scope.argValue.start, col.getNullBit().clone())) { - value.argValue = null; - return Result.NotFound; - } - - value.argValue = b.argValue.ReadUnixDateTime(scope.argValue.start + col.getOffset()).clone(); - return Result.Success; - } - - @Override - public Result ReadSparse(tangible.RefObject b, tangible.RefObject edit, - tangible.OutObject value) { - Result result = LayoutType.PrepareSparseRead(b, edit, this.LayoutCode); - if (result != Result.Success) { - value.argValue = null; - return result; - } - - value.argValue = b.argValue.ReadSparseUnixDateTime(edit).clone(); - return Result.Success; - } - - @Override - public Result WriteFixed(tangible.RefObject b, tangible.RefObject scope, LayoutColumn col, - UnixDateTime value) { - checkArgument(scope.argValue.scopeType instanceof LayoutUDT); - if (scope.argValue.immutable) { - return Result.InsufficientPermissions; - } - - b.argValue.WriteUnixDateTime(scope.argValue.start + col.getOffset(), value.clone()); - b.argValue.SetBit(scope.argValue.start, col.getNullBit().clone()); - return Result.Success; - } - - //C# TO JAVA CONVERTER NOTE: Java does not support optional parameters. Overloaded method(s) are created above: - //ORIGINAL LINE: public override Result WriteSparse(ref RowBuffer b, ref RowCursor edit, UnixDateTime value, - // UpdateOptions options = UpdateOptions.Upsert) - @Override - public Result WriteSparse(tangible.RefObject b, tangible.RefObject edit, UnixDateTime value - , UpdateOptions options) { - Result result = LayoutType.PrepareSparseWrite(b, edit, this.getTypeArg().clone(), options); - if (result != Result.Success) { - return result; - } - - b.argValue.WriteSparseUnixDateTime(edit, value.clone(), options); - return Result.Success; - } - - @Override - public Result WriteSparse(tangible.RefObject b, tangible.RefObject edit, UnixDateTime value) { - return WriteSparse(b, edit, value, UpdateOptions.Upsert); - } -} \ No newline at end of file diff --git a/jre/src/main/java/azure/data/cosmos/serialization/hybridrow/layouts/LayoutUtf8.java b/jre/src/main/java/azure/data/cosmos/serialization/hybridrow/layouts/LayoutUtf8.java deleted file mode 100644 index b02514d..0000000 --- a/jre/src/main/java/azure/data/cosmos/serialization/hybridrow/layouts/LayoutUtf8.java +++ /dev/null @@ -1,188 +0,0 @@ -//------------------------------------------------------------ -// Copyright (c) Microsoft Corporation. All rights reserved. -//------------------------------------------------------------ - -package azure.data.cosmos.serialization.hybridrow.layouts; - -import azure.data.cosmos.serialization.hybridrow.Result; -import azure.data.cosmos.serialization.hybridrow.RowBuffer; -import azure.data.cosmos.serialization.hybridrow.RowCursor; - -import static com.google.common.base.Preconditions.checkArgument; - -public final class LayoutUtf8 extends LayoutType implements ILayoutUtf8SpanWritable, ILayoutUtf8SpanReadable { - public LayoutUtf8() { - super(azure.data.cosmos.serialization.hybridrow.layouts.LayoutCode.Utf8, 0); - } - - @Override - public boolean getIsFixed() { - return false; - } - - @Override - public String getName() { - return "utf8"; - } - - @Override - public Result ReadFixed(tangible.RefObject b, tangible.RefObject scope, LayoutColumn col, - tangible.OutObject value) { - Utf8Span span; - // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'out' keyword - these - // cannot be converted using the 'OutObject' helper class unless the method is within the code being modified: - Result r = this.ReadFixed(b, scope, col, out span); - value.argValue = (r == Result.Success) ? span.toString() : - default - return r; - } - - public Result ReadFixed(tangible.RefObject b, tangible.RefObject scope, LayoutColumn col, - tangible.OutObject value) { - checkArgument(scope.argValue.scopeType instanceof LayoutUDT); - checkArgument(col.getSize() >= 0); - if (!b.argValue.ReadBit(scope.argValue.start, col.getNullBit().clone())) { - value.argValue = null; - return Result.NotFound; - } - - value.argValue = b.argValue.ReadFixedString(scope.argValue.start + col.getOffset(), col.getSize()); - return Result.Success; - } - - @Override - public Result ReadSparse(tangible.RefObject b, tangible.RefObject edit, - tangible.OutObject value) { - Utf8Span span; - // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'out' keyword - these - // cannot be converted using the 'OutObject' helper class unless the method is within the code being modified: - Result r = this.ReadSparse(b, edit, out span); - value.argValue = (r == Result.Success) ? span.toString() : - default - return r; - } - - public Result ReadSparse(tangible.RefObject b, tangible.RefObject edit, tangible.OutObject value) { - Result result = LayoutType.PrepareSparseRead(b, edit, this.LayoutCode); - if (result != Result.Success) { - value.argValue = null; - return result; - } - - value.argValue = b.argValue.ReadSparseString(edit); - return Result.Success; - } - - @Override - public Result ReadVariable(tangible.RefObject b, tangible.RefObject scope, LayoutColumn col - , tangible.OutObject value) { - Utf8Span span; - // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'out' keyword - these - // cannot be converted using the 'OutObject' helper class unless the method is within the code being modified: - Result r = this.ReadVariable(b, scope, col, out span); - value.argValue = (r == Result.Success) ? span.toString() : - default - return r; - } - - public Result ReadVariable(tangible.RefObject b, tangible.RefObject scope, LayoutColumn col - , tangible.OutObject value) { - checkArgument(scope.argValue.scopeType instanceof LayoutUDT); - if (!b.argValue.ReadBit(scope.argValue.start, col.getNullBit().clone())) { - value.argValue = null; - return Result.NotFound; - } - - int varOffset = b.argValue.ComputeVariableValueOffset(scope.argValue.layout, scope.argValue.start, - col.getOffset()); - value.argValue = b.argValue.ReadVariableString(varOffset); - return Result.Success; - } - - @Override - public Result WriteFixed(tangible.RefObject b, tangible.RefObject scope, LayoutColumn col, - String value) { - checkArgument(value != null); - return this.WriteFixed(b, scope, col, Utf8Span.TranscodeUtf16(value)); - } - - public Result WriteFixed(tangible.RefObject b, tangible.RefObject scope, LayoutColumn col, - Utf8Span value) { - checkArgument(scope.argValue.scopeType instanceof LayoutUDT); - checkArgument(col.getSize() >= 0); - checkArgument(value.Length == col.getSize()); - if (scope.argValue.immutable) { - return Result.InsufficientPermissions; - } - - b.argValue.WriteFixedString(scope.argValue.start + col.getOffset(), value); - b.argValue.SetBit(scope.argValue.start, col.getNullBit().clone()); - return Result.Success; - } - - @Override - public Result WriteSparse(tangible.RefObject b, tangible.RefObject edit, String value) { - return WriteSparse(b, edit, value, UpdateOptions.Upsert); - } - - //C# TO JAVA CONVERTER NOTE: Java does not support optional parameters. Overloaded method(s) are created above: - //ORIGINAL LINE: public override Result WriteSparse(ref RowBuffer b, ref RowCursor edit, string value, - // UpdateOptions options = UpdateOptions.Upsert) - @Override - public Result WriteSparse(tangible.RefObject b, tangible.RefObject edit, String value, - UpdateOptions options) { - checkArgument(value != null); - return this.WriteSparse(b, edit, Utf8Span.TranscodeUtf16(value), options); - } - - - public Result WriteSparse(tangible.RefObject b, tangible.RefObject edit, Utf8Span value) { - return WriteSparse(b, edit, value, UpdateOptions.Upsert); - } - - //C# TO JAVA CONVERTER NOTE: Java does not support optional parameters. Overloaded method(s) are created above: - //ORIGINAL LINE: public Result WriteSparse(ref RowBuffer b, ref RowCursor edit, Utf8Span value, UpdateOptions - // options = UpdateOptions.Upsert) - public Result WriteSparse(tangible.RefObject b, tangible.RefObject edit, Utf8Span value, - UpdateOptions options) { - Result result = LayoutType.PrepareSparseWrite(b, edit, this.getTypeArg().clone(), options); - if (result != Result.Success) { - return result; - } - - b.argValue.WriteSparseString(edit, value, options); - return Result.Success; - } - - @Override - public Result WriteVariable(tangible.RefObject b, tangible.RefObject scope, - LayoutColumn col, String value) { - checkArgument(value != null); - return this.WriteVariable(b, scope, col, Utf8Span.TranscodeUtf16(value)); - } - - public Result WriteVariable(tangible.RefObject b, tangible.RefObject scope, - LayoutColumn col, Utf8Span value) { - checkArgument(scope.argValue.scopeType instanceof LayoutUDT); - if (scope.argValue.immutable) { - return Result.InsufficientPermissions; - } - - int length = value.Length; - if ((col.getSize() > 0) && (length > col.getSize())) { - return Result.TooBig; - } - - boolean exists = b.argValue.ReadBit(scope.argValue.start, col.getNullBit().clone()); - int varOffset = b.argValue.ComputeVariableValueOffset(scope.argValue.layout, scope.argValue.start, - col.getOffset()); - int shift; - tangible.OutObject tempOut_shift = new tangible.OutObject(); - b.argValue.WriteVariableString(varOffset, value, exists, tempOut_shift); - shift = tempOut_shift.argValue; - b.argValue.SetBit(scope.argValue.start, col.getNullBit().clone()); - scope.argValue.metaOffset += shift; - scope.argValue.valueOffset += shift; - return Result.Success; - } -} \ No newline at end of file diff --git a/jre/src/main/java/azure/data/cosmos/serialization/hybridrow/layouts/LayoutVarInt.java b/jre/src/main/java/azure/data/cosmos/serialization/hybridrow/layouts/LayoutVarInt.java deleted file mode 100644 index 3090752..0000000 --- a/jre/src/main/java/azure/data/cosmos/serialization/hybridrow/layouts/LayoutVarInt.java +++ /dev/null @@ -1,114 +0,0 @@ -//------------------------------------------------------------ -// Copyright (c) Microsoft Corporation. All rights reserved. -//------------------------------------------------------------ - -package azure.data.cosmos.serialization.hybridrow.layouts; - -import azure.data.cosmos.serialization.hybridrow.Result; -import azure.data.cosmos.serialization.hybridrow.RowBuffer; -import azure.data.cosmos.serialization.hybridrow.RowCursor; - -import static com.google.common.base.Preconditions.checkArgument; - -public final class LayoutVarInt extends LayoutType { - public LayoutVarInt() { - super(azure.data.cosmos.serialization.hybridrow.layouts.LayoutCode.VarInt, 0); - } - - @Override - public boolean getIsFixed() { - return false; - } - - @Override - public boolean getIsVarint() { - return true; - } - - @Override - public String getName() { - return "varint"; - } - - @Override - public Result ReadFixed(tangible.RefObject b, tangible.RefObject scope, LayoutColumn col, - tangible.OutObject value) { - Contract.Fail("Not Implemented"); - value.argValue = 0; - return Result.Failure; - } - - @Override - public Result ReadSparse(tangible.RefObject b, tangible.RefObject edit, tangible.OutObject value) { - Result result = LayoutType.PrepareSparseRead(b, edit, this.LayoutCode); - if (result != Result.Success) { - value.argValue = 0; - return result; - } - - value.argValue = b.argValue.ReadSparseVarInt(edit); - return Result.Success; - } - - @Override - public Result ReadVariable(tangible.RefObject b, tangible.RefObject scope, LayoutColumn col, tangible.OutObject value) { - checkArgument(scope.argValue.scopeType instanceof LayoutUDT); - if (!b.argValue.ReadBit(scope.argValue.start, col.getNullBit().clone())) { - value.argValue = 0; - return Result.NotFound; - } - - int varOffset = b.argValue.ComputeVariableValueOffset(scope.argValue.layout, scope.argValue.start, - col.getOffset()); - value.argValue = b.argValue.ReadVariableInt(varOffset); - return Result.Success; - } - - @Override - public Result WriteFixed(tangible.RefObject b, tangible.RefObject scope, LayoutColumn col, - long value) { - Contract.Fail("Not Implemented"); - return Result.Failure; - } - - //C# TO JAVA CONVERTER NOTE: Java does not support optional parameters. Overloaded method(s) are created above: - //ORIGINAL LINE: public override Result WriteSparse(ref RowBuffer b, ref RowCursor edit, long value, - // UpdateOptions options = UpdateOptions.Upsert) - @Override - public Result WriteSparse(tangible.RefObject b, tangible.RefObject edit, long value, - UpdateOptions options) { - Result result = LayoutType.PrepareSparseWrite(b, edit, this.getTypeArg().clone(), options); - if (result != Result.Success) { - return result; - } - - b.argValue.WriteSparseVarInt(edit, value, options); - return Result.Success; - } - - @Override - public Result WriteSparse(tangible.RefObject b, tangible.RefObject edit, long value) { - return WriteSparse(b, edit, value, UpdateOptions.Upsert); - } - - @Override - public Result WriteVariable(tangible.RefObject b, tangible.RefObject scope, - LayoutColumn col, long value) { - checkArgument(scope.argValue.scopeType instanceof LayoutUDT); - if (scope.argValue.immutable) { - return Result.InsufficientPermissions; - } - - boolean exists = b.argValue.ReadBit(scope.argValue.start, col.getNullBit().clone()); - int varOffset = b.argValue.ComputeVariableValueOffset(scope.argValue.layout, scope.argValue.start, - col.getOffset()); - int shift; - tangible.OutObject tempOut_shift = new tangible.OutObject(); - b.argValue.WriteVariableInt(varOffset, value, exists, tempOut_shift); - shift = tempOut_shift.argValue; - b.argValue.SetBit(scope.argValue.start, col.getNullBit().clone()); - scope.argValue.metaOffset += shift; - scope.argValue.valueOffset += shift; - return Result.Success; - } -} \ No newline at end of file diff --git a/jre/src/main/java/azure/data/cosmos/serialization/hybridrow/recordio/RecordSerializer.java b/jre/src/main/java/azure/data/cosmos/serialization/hybridrow/recordio/RecordSerializer.java deleted file mode 100644 index 7c17e6b..0000000 --- a/jre/src/main/java/azure/data/cosmos/serialization/hybridrow/recordio/RecordSerializer.java +++ /dev/null @@ -1,53 +0,0 @@ -//------------------------------------------------------------ -// Copyright (c) Microsoft Corporation. All rights reserved. -//------------------------------------------------------------ - -package azure.data.cosmos.serialization.hybridrow.recordio; - -import azure.data.cosmos.serialization.hybridrow.Result; - -public final class RecordSerializer { - public static Result Read(tangible.RefObject reader, tangible.OutObject obj) { - obj.argValue = null; - while (reader.argValue.Read()) { - Result r; - - // TODO: use Path tokens here. - switch (reader.argValue.getPath().toString()) { - case "length": - tangible.OutObject tempOut_Length = new tangible.OutObject(); - r = reader.argValue.ReadInt32(tempOut_Length); - obj.argValue.argValue.Length = tempOut_Length.argValue; - if (r != Result.Success) { - return r; - } - - break; - case "crc32": - tangible.OutObject tempOut_Crc32 = new tangible.OutObject(); - //C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java: - //ORIGINAL LINE: r = reader.ReadUInt32(out obj.Crc32); - r = reader.argValue.ReadUInt32(tempOut_Crc32); - obj.argValue.argValue.Crc32 = tempOut_Crc32.argValue; - if (r != Result.Success) { - return r; - } - - break; - } - } - - return Result.Success; - } - - public static Result Write(tangible.RefObject writer, TypeArgument typeArg, Record obj) { - Result r; - r = writer.argValue.WriteInt32("length", obj.Length); - if (r != Result.Success) { - return r; - } - - r = writer.argValue.WriteUInt32("crc32", obj.Crc32); - return r; - } -} \ No newline at end of file diff --git a/jre/src/main/java/azure/data/cosmos/serialization/hybridrow/recordio/SegmentSerializer.java b/jre/src/main/java/azure/data/cosmos/serialization/hybridrow/recordio/SegmentSerializer.java deleted file mode 100644 index 54586e2..0000000 --- a/jre/src/main/java/azure/data/cosmos/serialization/hybridrow/recordio/SegmentSerializer.java +++ /dev/null @@ -1,101 +0,0 @@ -//------------------------------------------------------------ -// Copyright (c) Microsoft Corporation. All rights reserved. -//------------------------------------------------------------ - -package azure.data.cosmos.serialization.hybridrow.recordio; - -import azure.data.cosmos.serialization.hybridrow.HybridRowVersion; -import azure.data.cosmos.serialization.hybridrow.Result; -import azure.data.cosmos.serialization.hybridrow.RowBuffer; - -public final class SegmentSerializer { - //C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java: - //ORIGINAL LINE: public static Result Read(Span span, LayoutResolver resolver, out Segment obj) - public static Result Read(Span span, LayoutResolver resolver, tangible.OutObject obj) { - RowBuffer row = new RowBuffer(span, HybridRowVersion.V1, resolver); - tangible.RefObject tempRef_row = - new tangible.RefObject(row); - RowReader reader = new RowReader(tempRef_row); - row = tempRef_row.argValue; - tangible.RefObject tempRef_reader = - new tangible.RefObject(reader); - Result tempVar = SegmentSerializer.Read(tempRef_reader, obj.clone()); - reader = tempRef_reader.argValue; - return tempVar; - } - - public static Result Read(tangible.RefObject reader, tangible.OutObject obj) { - obj.argValue = null; - while (reader.argValue.Read()) { - Result r; - - // TODO: use Path tokens here. - switch (reader.argValue.getPath().toString()) { - case "length": - tangible.OutObject tempOut_Length = new tangible.OutObject(); - r = reader.argValue.ReadInt32(tempOut_Length); - obj.argValue.argValue.Length = tempOut_Length.argValue; - if (r != Result.Success) { - return r; - } - - // If the RowBuffer isn't big enough to contain the rest of the header, then just - // return the length. - if (reader.argValue.getLength() < obj.argValue.Length) { - return Result.Success; - } - - break; - case "comment": - tangible.OutObject tempOut_Comment = new tangible.OutObject(); - r = reader.argValue.ReadString(tempOut_Comment); - obj.argValue.argValue.Comment = tempOut_Comment.argValue; - if (r != Result.Success) { - return r; - } - - break; - case "sdl": - tangible.OutObject tempOut_SDL = new tangible.OutObject(); - r = reader.argValue.ReadString(tempOut_SDL); - obj.argValue.argValue.SDL = tempOut_SDL.argValue; - if (r != Result.Success) { - return r; - } - - break; - } - } - - return Result.Success; - } - - public static Result Write(tangible.RefObject writer, TypeArgument typeArg, Segment obj) { - Result r; - if (obj.Comment != null) { - r = writer.argValue.WriteString("comment", obj.Comment); - if (r != Result.Success) { - return r; - } - } - - if (obj.SDL != null) { - r = writer.argValue.WriteString("sdl", obj.SDL); - if (r != Result.Success) { - return r; - } - } - - // Defer writing the length until all other fields of the segment header are written. - // The length is then computed based on the current size of the underlying RowBuffer. - // Because the length field is itself fixed, writing the length can never change the length. - int length = writer.argValue.getLength(); - r = writer.argValue.WriteInt32("length", length); - if (r != Result.Success) { - return r; - } - - Contract.Assert(length == writer.argValue.getLength()); - return Result.Success; - } -} \ No newline at end of file diff --git a/jre/src/main/java/com/azure/data/cosmos/core/OutObject.java b/jre/src/main/java/com/azure/data/cosmos/core/OutObject.java new file mode 100644 index 0000000..ed309bd --- /dev/null +++ b/jre/src/main/java/com/azure/data/cosmos/core/OutObject.java @@ -0,0 +1,18 @@ +//------------------------------------------------------------ +// Copyright (c) Microsoft Corporation. All rights reserved. +//------------------------------------------------------------ + +package com.azure.data.cosmos.core; + +public final class OutObject { + + private T value; + + public T get() { + return value; + } + + public void set(T value) { + this.value = value; + } +} diff --git a/jre/src/main/java/com/azure/data/cosmos/core/RefObject.java b/jre/src/main/java/com/azure/data/cosmos/core/RefObject.java new file mode 100644 index 0000000..e49fbd8 --- /dev/null +++ b/jre/src/main/java/com/azure/data/cosmos/core/RefObject.java @@ -0,0 +1,22 @@ +//------------------------------------------------------------ +// Copyright (c) Microsoft Corporation. All rights reserved. +//------------------------------------------------------------ + +package com.azure.data.cosmos.core; + +public final class RefObject { + + private T value; + + public RefObject(T value) { + this.set(value); + } + + public T get() { + return value; + } + + public void set(T value) { + this.value = value; + } +} \ No newline at end of file diff --git a/jre/src/main/java/com/azure/data/cosmos/core/Utf8String.java b/jre/src/main/java/com/azure/data/cosmos/core/Utf8String.java new file mode 100644 index 0000000..41f70db --- /dev/null +++ b/jre/src/main/java/com/azure/data/cosmos/core/Utf8String.java @@ -0,0 +1,459 @@ +//------------------------------------------------------------ +// Copyright (c) Microsoft Corporation. All rights reserved. +//------------------------------------------------------------ + +package com.azure.data.cosmos.core; + +import com.fasterxml.jackson.core.JsonGenerator; +import com.fasterxml.jackson.core.JsonParseException; +import com.fasterxml.jackson.core.JsonParser; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.DeserializationContext; +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.SerializerProvider; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.deser.std.StdDeserializer; +import com.fasterxml.jackson.databind.node.JsonNodeType; +import com.fasterxml.jackson.databind.ser.std.StdSerializer; +import com.google.common.base.Utf8; +import io.netty.buffer.ByteBuf; +import io.netty.buffer.PooledByteBufAllocator; +import io.netty.buffer.Unpooled; + +import javax.annotation.Nonnull; +import java.io.IOException; +import java.util.Iterator; +import java.util.NoSuchElementException; +import java.util.Optional; +import java.util.Spliterator; +import java.util.function.Consumer; +import java.util.function.IntConsumer; +import java.util.stream.IntStream; +import java.util.stream.StreamSupport; + +import static com.google.common.base.Preconditions.checkArgument; +import static com.google.common.base.Preconditions.checkNotNull; +import static com.google.common.base.Preconditions.checkState; +import static com.google.common.base.Strings.lenientFormat; +import static java.nio.charset.StandardCharsets.UTF_8; + +@JsonSerialize(using = Utf8String.JsonSerializer.class) +@SuppressWarnings("UnstableApiUsage") +public final class Utf8String implements CharSequence, Comparable { + + public static final Utf8String EMPTY = new Utf8String(Unpooled.EMPTY_BUFFER, 0); + + private static final PooledByteBufAllocator allocator = PooledByteBufAllocator.DEFAULT; + private final ByteBuf buffer; + private final int length; + + private Utf8String(final ByteBuf buffer) { + this(buffer, decodedLength(buffer)); + } + + private Utf8String(final ByteBuf buffer, final int decodedLength) { + this.buffer = buffer.asReadOnly(); + this.length = decodedLength; + } + + /** + * {@code true} if the length of this instance is zero + */ + public final boolean isEmpty() { + return this.length == 0; + } + + @Override + public char charAt(final int index) { + throw new UnsupportedOperationException(); + } + + /** + * Non-allocating enumeration of each character in the UTF-8 stream + */ + @Override + public IntStream chars() { + throw new UnsupportedOperationException(); + } + + /** + * Non-allocating enumeration of each code point in the UTF-8 stream + */ + public final IntStream codePoints() { + if (this.length == 0) { + return IntStream.empty(); + } + return StreamSupport.intStream(new CodePointIterable(this.buffer, this.length), false); + } + + public final int compareTo(@Nonnull final Utf8String other) { + checkNotNull(other); + return this.buffer.compareTo(other.buffer); + } + + public final int compareTo(@Nonnull final String other) { + + checkNotNull(other); + + final int length = this.length(); + final int otherLength = other.length(); + final int limit = Math.min(length, otherLength); + + if (limit > 0) { + + final CodePointIterable iterable = new CodePointIterable(this.buffer, this.length); + int index = 0; + + for (int codePoint : iterable) { + + final int otherCodePoint = other.codePointAt(index++); + + if (codePoint != otherCodePoint) { + return codePoint - otherCodePoint; + } + + if (index >= limit) { + break; + } + } + } + + return length - otherLength; + } + + public final boolean equals(ByteBuf other) { + return this.buffer.equals(other); + } + + public final boolean equals(String other) { + if (other == null) { + return false; + } + return this.compareTo(other) == 0; + } + + public final boolean equals(Utf8String other) { + if (other == null) { + return false; + } + if (other == this) { + return true; + } + return this.buffer.equals(other.buffer); + } + + @Override + public boolean equals(Object other) { + if (other == null) { + return false; + } + if (other == this) { + return true; + } + if (other instanceof ByteBuf) { + return this.equals((ByteBuf)other); + } + if (other instanceof String) { + return this.equals((String)other); + } + if (other instanceof Utf8String) { + return this.equals((Utf8String)other); + } + return false; + } + + @Override + public int hashCode() { + return this.buffer.hashCode(); + } + + /** + * Returns the length of this character sequence + *

+ * The length is the number of Unicode characters in the sequence. + */ + public final int length() { + return this.length; + } + + public static boolean opEquals(Utf8String left, Utf8String right) { + if (null == left) { + return null == right; + } + return left.equals(right); + } + + public static boolean opGreaterThan(Utf8String left, Utf8String right) { + return left != null && left.compareTo(right) > 0; + } + + public static boolean opGreaterThan(Utf8String left, String right) { + return left != null && left.compareTo(right) > 0; + } + + public static boolean opGreaterThan(String left, Utf8String right) { + return right == null || right.compareTo(left) <= 0; + } + + public static boolean opGreaterThanOrEquals(Utf8String left, Utf8String right) { + return left == null ? right == null : left.compareTo(right) >= 0; + } + + public static boolean opGreaterThanOrEquals(Utf8String left, String right) { + return left == null ? right == null : left.compareTo(right) >= 0; + } + + public static boolean opGreaterThanOrEquals(String left, Utf8String right) { + return right == null ? left != null : right.compareTo(left) < 0; + } + + public static boolean opLessThan(Utf8String left, Utf8String right) { + return left == null ? right != null : left.compareTo(right) < 0; + } + + public static boolean opLessThan(Utf8String left, String right) { + return left == null ? right != null : left.compareTo(right) < 0; + } + + public static boolean opLessThan(String left, Utf8String right) { + return right == null ? left == null : right.compareTo(left) >= 0; + } + + public static boolean opLessThanOrEquals(Utf8String left, Utf8String right) { + return left == null || left.compareTo(right) <= 0; + } + + public static boolean opLessThanOrEquals(Utf8String left, String right) { + return left == null || left.compareTo(right) <= 0; + } + + public static boolean opLessThanOrEquals(String left, Utf8String right) { + return right != null && right.compareTo(left) > 0; + } + + public static boolean opNotEquals(Utf8String left, Utf8String right) { + if (null == left) { + return null != right; + } + return !left.equals(right); + } + + @Override + public CharSequence subSequence(int start, int end) { + checkArgument(start < 0 || end < 0 || start > end || end > this.length, "start: %s, end: %s", start, end); + // TODO: DANOBLE: compute buffer index for start and end character positions and use them in the slice + return new Utf8String(this.buffer.slice(), end - start); + } + + @Override + public String toString() { + return this.buffer.getCharSequence(0, this.buffer.capacity(), UTF_8).toString(); + } + + /** + * Creates a from a UTF16 encoding string. + * + * @param string The UTF16 encoding string. + * @return A new . + *

+ * This method must transcode the UTF-16 into UTF-8 which both requires allocation and is a size of data operation. + */ + public static Utf8String transcodeUtf16(final String string) { + + if (string == null) { + return null; + } + + if (string.isEmpty()) { + return EMPTY; + } + + final int length = Utf8.encodedLength(string); + final ByteBuf buffer = allocator.buffer(length, length); + final int count = buffer.writeCharSequence(string, UTF_8); + + checkState(count == length, "count: %s, length: %s", count, length); + + return new Utf8String(buffer, string.length()); + } + + /** + * Parses the contents of a byte buffer to prove it contains a valid UTF-8 character sequence + * + * @param buffer The byte buffer to validate + * @return A {@link Utf8String} instance, if the @{code buffer} validates or a value of @{link Optional#empty} + * otherwise. + */ + public static Optional tryParseUtf8Bytes(@Nonnull final ByteBuf buffer) { + checkNotNull(buffer); + return Utf8.isWellFormed(buffer.array()) ? Optional.of(new Utf8String(buffer)) : Optional.empty(); + } + + private static int decodedLength(final ByteBuf buffer) { + + final CodePointIterable iterable = new CodePointIterable(buffer, -1); + int decodedLength = 0; + + for (int ignored : iterable) { + decodedLength++; + } + + return decodedLength; + } + + private static final class CodePointIterable implements Iterable, Iterator, Spliterator.OfInt { + + private static final int CHARACTERISTICS = Spliterator.IMMUTABLE | Spliterator.NONNULL | Spliterator.ORDERED; + + private final ByteBuf buffer; + private final int length; + private int index; + + public CodePointIterable(final ByteBuf buffer, final int length) { + this.buffer = buffer; + this.length = length; + this.index = 0; + } + + @Override + public int characteristics() { + return this.length == -1 ? CHARACTERISTICS : CHARACTERISTICS | Spliterator.SIZED | Spliterator.SUBSIZED; + } + + @Override + public long estimateSize() { + return this.length < 0 ? Long.MAX_VALUE : this.length; + } + + @Override + public void forEachRemaining(final Consumer action) { + OfInt.super.forEachRemaining(action); + } + + @Override + public boolean hasNext() { + return this.index < this.buffer.capacity(); + } + + @Override + @Nonnull + public Iterator iterator() { + return this; + } + + @Override + public Integer next() { + + if (!this.hasNext()) { + throw new NoSuchElementException(); + } + + final int leadingByte = this.buffer.getByte(this.index++) & 0xFF; + + // A 1-byte UTF-8 code point is a special case that covers the 7-bit ASCII character set + + if (leadingByte < 0x80) { + return leadingByte; + } + + // The initial byte of 2-, 3- and 4-byte UTF-8 code points start with 2, 3, or 4 one bits followed by a 0 + // bit + + final int codePoint; + + if ((leadingByte & 0b1110_0000) == 0b1100_0000) { + + // 110xxxxx 10xxxxxx => 0x00000080 - 0x000007FF + + codePoint = ((leadingByte & 0b0001_1111) << 6) | + (buffer.getByte(this.index++) & 0b0011_1111); + + } else if ((leadingByte & 0b1111_0000) == 0b1110_0000) { + + // 1110xxxx 10xxxxxx 10xxxxxx => 0x00000800 - 0x0000FFFF + + codePoint = ((leadingByte & 0b0000_1111) << 12) | + ((buffer.getByte(this.index++) & 0b0011_1111) << 6) | + ((buffer.getByte(this.index++) & 0b0011_1111)); + + } else if ((leadingByte & 0b1111_1000) == 0b1111_0000) { + + // 11110xxx 10xxxxxx 10xxxxxx 10xxxxxx => 0x00010000 - 0x001FFFFF + + codePoint = ((leadingByte & 0b0000_0111) << 18) | + ((buffer.getByte(this.index++) & 0b0011_1111) << 12) | + ((buffer.getByte(this.index++) & 0b0011_1111) << 6) | + ((buffer.getByte(this.index++) & 0b0011_1111)); + + } else { + // leading byte is improperly encoded and we'll detect that before returning + codePoint = leadingByte; + } + + checkState(Character.isDefined(codePoint), "invalid character: %s", codePoint); + return codePoint; + } + + @Override + public Spliterator spliterator() { + return this; + } + + @Override + public boolean tryAdvance(@Nonnull final IntConsumer action) { + + checkNotNull(action); + + if (this.hasNext()) { + action.accept(this.next()); + return true; + } + + return false; + } + + @Override + public OfInt trySplit() { + return null; + } + + } + + static final class Deserializer extends StdDeserializer { + + private Deserializer() { + super(Utf8String.class); + } + + @Override + public Utf8String deserialize(JsonParser parser, DeserializationContext context) throws IOException, + JsonProcessingException { + + final JsonNode node = parser.getCodec().readTree(parser); + final JsonNodeType type = node.getNodeType(); + + switch (type) { + case STRING: + return Utf8String.transcodeUtf16(node.textValue()); + case NULL: + return null; + default: { + String message = lenientFormat("expected string value or null, not %s", type.name().toLowerCase()); + throw new JsonParseException(parser, message); + } + } + } + } + + static final class JsonSerializer extends StdSerializer { + + private JsonSerializer() { + super(Utf8String.class); + } + + @Override + public void serialize(Utf8String value, JsonGenerator generator, SerializerProvider provider) throws IOException { + generator.writeString(value.toString()); + } + } +} diff --git a/jre/src/main/java/azure/data/cosmos/serialization/hybridrow/DefaultSpanResizer.java b/jre/src/main/java/com/azure/data/cosmos/serialization/hybridrow/DefaultSpanResizer.java similarity index 94% rename from jre/src/main/java/azure/data/cosmos/serialization/hybridrow/DefaultSpanResizer.java rename to jre/src/main/java/com/azure/data/cosmos/serialization/hybridrow/DefaultSpanResizer.java index 214b5e2..00602d3 100644 --- a/jre/src/main/java/azure/data/cosmos/serialization/hybridrow/DefaultSpanResizer.java +++ b/jre/src/main/java/com/azure/data/cosmos/serialization/hybridrow/DefaultSpanResizer.java @@ -2,7 +2,7 @@ // Copyright (c) Microsoft Corporation. All rights reserved. //------------------------------------------------------------ -package azure.data.cosmos.serialization.hybridrow; +package com.azure.data.cosmos.serialization.hybridrow; public class DefaultSpanResizer implements ISpanResizer { // TODO: C# TO JAVA CONVERTER: Java annotations will not correspond to .NET attributes: diff --git a/jre/src/main/java/azure/data/cosmos/serialization/hybridrow/Float128.java b/jre/src/main/java/com/azure/data/cosmos/serialization/hybridrow/Float128.java similarity index 95% rename from jre/src/main/java/azure/data/cosmos/serialization/hybridrow/Float128.java rename to jre/src/main/java/com/azure/data/cosmos/serialization/hybridrow/Float128.java index 73da2ba..98cce6e 100644 --- a/jre/src/main/java/azure/data/cosmos/serialization/hybridrow/Float128.java +++ b/jre/src/main/java/com/azure/data/cosmos/serialization/hybridrow/Float128.java @@ -2,7 +2,7 @@ // Copyright (c) Microsoft Corporation. All rights reserved. //------------------------------------------------------------ -package azure.data.cosmos.serialization.hybridrow; +package com.azure.data.cosmos.serialization.hybridrow; // TODO: C# TO JAVA CONVERTER: There is no preprocessor in Java: ///#pragma warning disable CA1051 // Do not declare visible instance fields diff --git a/jre/src/main/java/azure/data/cosmos/serialization/hybridrow/HybridRowHeader.java b/jre/src/main/java/com/azure/data/cosmos/serialization/hybridrow/HybridRowHeader.java similarity index 91% rename from jre/src/main/java/azure/data/cosmos/serialization/hybridrow/HybridRowHeader.java rename to jre/src/main/java/com/azure/data/cosmos/serialization/hybridrow/HybridRowHeader.java index a7a30f1..e92c0f4 100644 --- a/jre/src/main/java/azure/data/cosmos/serialization/hybridrow/HybridRowHeader.java +++ b/jre/src/main/java/com/azure/data/cosmos/serialization/hybridrow/HybridRowHeader.java @@ -2,7 +2,7 @@ // Copyright (c) Microsoft Corporation. All rights reserved. //------------------------------------------------------------ -package azure.data.cosmos.serialization.hybridrow; +package com.azure.data.cosmos.serialization.hybridrow; /** * Describes the header the precedes all valid Hybrid Rows. @@ -17,7 +17,7 @@ public final class HybridRowHeader { /** * Size (in bytes) of a serialized header. */ - public static final int Size = (HybridRowVersion.SIZE / Byte.SIZE) + azure.data.cosmos.serialization.hybridrow.SchemaId.Size; + public static final int Size = (HybridRowVersion.SIZE / Byte.SIZE) + com.azure.data.cosmos.serialization.hybridrow.SchemaId.Size; /** * The unique identifier of the schema whose layout was used to write this row. */ diff --git a/jre/src/main/java/azure/data/cosmos/serialization/hybridrow/HybridRowVersion.java b/jre/src/main/java/com/azure/data/cosmos/serialization/hybridrow/HybridRowVersion.java similarity index 93% rename from jre/src/main/java/azure/data/cosmos/serialization/hybridrow/HybridRowVersion.java rename to jre/src/main/java/com/azure/data/cosmos/serialization/hybridrow/HybridRowVersion.java index 8b79e60..42646be 100644 --- a/jre/src/main/java/azure/data/cosmos/serialization/hybridrow/HybridRowVersion.java +++ b/jre/src/main/java/com/azure/data/cosmos/serialization/hybridrow/HybridRowVersion.java @@ -2,7 +2,7 @@ // Copyright (c) Microsoft Corporation. All rights reserved. //------------------------------------------------------------ -package azure.data.cosmos.serialization.hybridrow; +package com.azure.data.cosmos.serialization.hybridrow; // TODO: C# TO JAVA CONVERTER: There is no preprocessor in Java: ///#pragma warning disable CA1028 // Enum Storage should be Int32 diff --git a/jre/src/main/java/azure/data/cosmos/serialization/hybridrow/ISpanResizer.java b/jre/src/main/java/com/azure/data/cosmos/serialization/hybridrow/ISpanResizer.java similarity index 93% rename from jre/src/main/java/azure/data/cosmos/serialization/hybridrow/ISpanResizer.java rename to jre/src/main/java/com/azure/data/cosmos/serialization/hybridrow/ISpanResizer.java index 34fef1b..a2f1e59 100644 --- a/jre/src/main/java/azure/data/cosmos/serialization/hybridrow/ISpanResizer.java +++ b/jre/src/main/java/com/azure/data/cosmos/serialization/hybridrow/ISpanResizer.java @@ -2,7 +2,7 @@ // Copyright (c) Microsoft Corporation. All rights reserved. //------------------------------------------------------------ -package azure.data.cosmos.serialization.hybridrow; +package com.azure.data.cosmos.serialization.hybridrow; public interface ISpanResizer { /** diff --git a/jre/src/main/java/azure/data/cosmos/serialization/hybridrow/MemorySpanResizer.java b/jre/src/main/java/com/azure/data/cosmos/serialization/hybridrow/MemorySpanResizer.java similarity index 95% rename from jre/src/main/java/azure/data/cosmos/serialization/hybridrow/MemorySpanResizer.java rename to jre/src/main/java/com/azure/data/cosmos/serialization/hybridrow/MemorySpanResizer.java index 6218985..5ca961b 100644 --- a/jre/src/main/java/azure/data/cosmos/serialization/hybridrow/MemorySpanResizer.java +++ b/jre/src/main/java/com/azure/data/cosmos/serialization/hybridrow/MemorySpanResizer.java @@ -2,7 +2,7 @@ // Copyright (c) Microsoft Corporation. All rights reserved. //------------------------------------------------------------ -package azure.data.cosmos.serialization.hybridrow; +package com.azure.data.cosmos.serialization.hybridrow; import static com.google.common.base.Preconditions.checkArgument; diff --git a/jre/src/main/java/azure/data/cosmos/serialization/hybridrow/NullValue.java b/jre/src/main/java/com/azure/data/cosmos/serialization/hybridrow/NullValue.java similarity index 94% rename from jre/src/main/java/azure/data/cosmos/serialization/hybridrow/NullValue.java rename to jre/src/main/java/com/azure/data/cosmos/serialization/hybridrow/NullValue.java index baacc9e..a6456f1 100644 --- a/jre/src/main/java/azure/data/cosmos/serialization/hybridrow/NullValue.java +++ b/jre/src/main/java/com/azure/data/cosmos/serialization/hybridrow/NullValue.java @@ -2,7 +2,7 @@ // Copyright (c) Microsoft Corporation. All rights reserved. //------------------------------------------------------------ -package azure.data.cosmos.serialization.hybridrow; +package com.azure.data.cosmos.serialization.hybridrow; /** * The literal null value. diff --git a/jre/src/main/java/azure/data/cosmos/serialization/hybridrow/Result.java b/jre/src/main/java/com/azure/data/cosmos/serialization/hybridrow/Result.java similarity index 92% rename from jre/src/main/java/azure/data/cosmos/serialization/hybridrow/Result.java rename to jre/src/main/java/com/azure/data/cosmos/serialization/hybridrow/Result.java index ee96566..00603d5 100644 --- a/jre/src/main/java/azure/data/cosmos/serialization/hybridrow/Result.java +++ b/jre/src/main/java/com/azure/data/cosmos/serialization/hybridrow/Result.java @@ -2,7 +2,7 @@ // Copyright (c) Microsoft Corporation. All rights reserved. //------------------------------------------------------------ -package azure.data.cosmos.serialization.hybridrow; +package com.azure.data.cosmos.serialization.hybridrow; public enum Result { Success(0), diff --git a/jre/src/main/java/azure/data/cosmos/serialization/hybridrow/RowBuffer.java b/jre/src/main/java/com/azure/data/cosmos/serialization/hybridrow/RowBuffer.java similarity index 64% rename from jre/src/main/java/azure/data/cosmos/serialization/hybridrow/RowBuffer.java rename to jre/src/main/java/com/azure/data/cosmos/serialization/hybridrow/RowBuffer.java index e870188..a67315d 100644 --- a/jre/src/main/java/azure/data/cosmos/serialization/hybridrow/RowBuffer.java +++ b/jre/src/main/java/com/azure/data/cosmos/serialization/hybridrow/RowBuffer.java @@ -2,22 +2,23 @@ // Copyright (c) Microsoft Corporation. All rights reserved. //------------------------------------------------------------ -package azure.data.cosmos.serialization.hybridrow; +package com.azure.data.cosmos.serialization.hybridrow; -import azure.data.cosmos.serialization.hybridrow.RowBuffer.UniqueIndexItem; -import azure.data.cosmos.serialization.hybridrow.layouts.Layout; -import azure.data.cosmos.serialization.hybridrow.layouts.LayoutBit; -import azure.data.cosmos.serialization.hybridrow.layouts.LayoutCode; -import azure.data.cosmos.serialization.hybridrow.layouts.LayoutColumn; -import azure.data.cosmos.serialization.hybridrow.layouts.LayoutEndScope; -import azure.data.cosmos.serialization.hybridrow.layouts.LayoutResolver; -import azure.data.cosmos.serialization.hybridrow.layouts.LayoutScope; -import azure.data.cosmos.serialization.hybridrow.layouts.LayoutType; -import azure.data.cosmos.serialization.hybridrow.layouts.LayoutTypedMap; -import azure.data.cosmos.serialization.hybridrow.layouts.StringToken; -import azure.data.cosmos.serialization.hybridrow.layouts.TypeArgument; -import azure.data.cosmos.serialization.hybridrow.layouts.TypeArgumentList; -import azure.data.cosmos.serialization.hybridrow.layouts.UpdateOptions; +import com.azure.data.cosmos.core.OutObject; +import com.azure.data.cosmos.core.RefObject; +import com.azure.data.cosmos.serialization.hybridrow.layouts.Layout; +import com.azure.data.cosmos.serialization.hybridrow.layouts.LayoutBit; +import com.azure.data.cosmos.serialization.hybridrow.layouts.LayoutCode; +import com.azure.data.cosmos.serialization.hybridrow.layouts.LayoutColumn; +import com.azure.data.cosmos.serialization.hybridrow.layouts.LayoutEndScope; +import com.azure.data.cosmos.serialization.hybridrow.layouts.LayoutResolver; +import com.azure.data.cosmos.serialization.hybridrow.layouts.LayoutScope; +import com.azure.data.cosmos.serialization.hybridrow.layouts.LayoutType; +import com.azure.data.cosmos.serialization.hybridrow.layouts.LayoutTypedMap; +import com.azure.data.cosmos.serialization.hybridrow.layouts.StringToken; +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.UpdateOptions; import java.io.InputStream; import java.io.OutputStream; @@ -25,9 +26,10 @@ import java.math.BigDecimal; import java.time.LocalDateTime; import java.util.UUID; -import static azure.data.cosmos.serialization.hybridrow.layouts.LayoutType.MongoDbObjectId; +import static com.azure.data.cosmos.serialization.hybridrow.layouts.LayoutType.MongoDbObjectId; import static com.google.common.base.Preconditions.checkArgument; import static com.google.common.base.Preconditions.checkState; +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 // from the original: @@ -112,10 +114,10 @@ public final class RowBuffer { this.resolver = resolver; HybridRowHeader header = this.ReadHeader(0).clone(); - Contract.Invariant(header.getVersion() == version); + checkState(header.getVersion() == version); Layout layout = resolver.Resolve(header.getSchemaId().clone()); - checkState(azure.data.cosmos.serialization.hybridrow.SchemaId.opEquals(header.getSchemaId().clone(), layout.getSchemaId().clone())); - Contract.Invariant(HybridRowHeader.Size + layout.getSize() <= this.length); + checkState(SchemaId.opEquals(header.getSchemaId().clone(), layout.getSchemaId().clone())); + checkState(HybridRowHeader.Size + layout.getSize() <= this.length); } /** @@ -161,11 +163,11 @@ public final class RowBuffer { LayoutColumn col = columns[i]; if (this.ReadBit(scopeOffset, col.getNullBit().clone())) { int lengthSizeInBytes; - tangible.OutObject tempOut_lengthSizeInBytes = new tangible.OutObject(); + OutObject tempOut_lengthSizeInBytes = new OutObject(); //C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java: //ORIGINAL LINE: ulong valueSizeInBytes = this.Read7BitEncodedUInt(offset, out int lengthSizeInBytes); long valueSizeInBytes = this.Read7BitEncodedUInt(offset, tempOut_lengthSizeInBytes); - lengthSizeInBytes = tempOut_lengthSizeInBytes.argValue; + lengthSizeInBytes = tempOut_lengthSizeInBytes.get(); if (col.getType().getIsVarint()) { offset += lengthSizeInBytes; } else { @@ -214,34 +216,34 @@ public final class RowBuffer { * * @param edit The field to delete. */ - public void DeleteSparse(tangible.RefObject edit) { + public void DeleteSparse(RefObject edit) { // If the field doesn't exist, then nothing to do. - if (!edit.argValue.exists) { + if (!edit.get().exists) { return; } int numBytes = 0; int _; - tangible.OutObject tempOut__ = new tangible.OutObject(); + OutObject tempOut__ = new OutObject(); int _; - tangible.OutObject tempOut__2 = new tangible.OutObject(); + OutObject tempOut__2 = new OutObject(); int shift; - tangible.OutObject tempOut_shift = new tangible.OutObject(); - this.EnsureSparse(edit, edit.argValue.cellType, edit.argValue.cellTypeArgs.clone(), numBytes, + OutObject tempOut_shift = new OutObject(); + this.EnsureSparse(edit, edit.get().cellType, edit.get().cellTypeArgs.clone(), numBytes, RowOptions.Delete, tempOut__, tempOut__2, tempOut_shift); - shift = tempOut_shift.argValue; - _ = tempOut__2.argValue; - _ = tempOut__.argValue; + shift = tempOut_shift.get(); + _ = tempOut__2.get(); + _ = tempOut__.get(); this.length += shift; } public void DeleteVariable(int offset, boolean isVarint) { int spaceAvailable; - tangible.OutObject tempOut_spaceAvailable = new tangible.OutObject(); + OutObject tempOut_spaceAvailable = new OutObject(); //C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java: //ORIGINAL LINE: ulong existingValueBytes = this.Read7BitEncodedUInt(offset, out int spaceAvailable); long existingValueBytes = this.Read7BitEncodedUInt(offset, tempOut_spaceAvailable); - spaceAvailable = tempOut_spaceAvailable.argValue; + spaceAvailable = tempOut_spaceAvailable.get(); if (!isVarint) { spaceAvailable += (int)existingValueBytes; // "size" already in spaceAvailable } @@ -292,37 +294,37 @@ public final class RowBuffer { * @param srcEdit The field to move into the set/map. * @return The prepared edit context. */ - public RowCursor PrepareSparseMove(tangible.RefObject scope, tangible.RefObject srcEdit) { - checkArgument(scope.argValue.scopeType.IsUniqueScope); + public RowCursor PrepareSparseMove(RefObject scope, RefObject srcEdit) { + checkArgument(scope.get().scopeType.IsUniqueScope); - checkArgument(scope.argValue.index == 0); + checkArgument(scope.get().index == 0); RowCursor dstEdit; // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'out' keyword - these // cannot be converted using the 'OutObject' helper class unless the method is within the code being modified: - scope.argValue.Clone(out dstEdit); + scope.get().Clone(out dstEdit); - dstEdit.metaOffset = scope.argValue.valueOffset; + dstEdit.metaOffset = scope.get().valueOffset; int srcSize = this.SparseComputeSize(srcEdit); - int srcBytes = srcSize - (srcEdit.argValue.valueOffset - srcEdit.argValue.metaOffset); + int srcBytes = srcSize - (srcEdit.get().valueOffset - srcEdit.get().metaOffset); while (dstEdit.index < dstEdit.count) { - tangible.RefObject tempRef_dstEdit = - new tangible.RefObject(dstEdit); + RefObject tempRef_dstEdit = + new RefObject(dstEdit); this.ReadSparseMetadata(tempRef_dstEdit); - dstEdit = tempRef_dstEdit.argValue; + dstEdit = tempRef_dstEdit.get(); Contract.Assert(dstEdit.pathOffset == default) int elmSize = -1; // defer calculating the full size until needed. int cmp; - if (scope.argValue.scopeType instanceof LayoutTypedMap) { - cmp = this.CompareKeyValueFieldValue(srcEdit.argValue.clone(), dstEdit); + if (scope.get().scopeType instanceof LayoutTypedMap) { + cmp = this.CompareKeyValueFieldValue(srcEdit.get().clone(), dstEdit); } else { - tangible.RefObject tempRef_dstEdit2 = - new tangible.RefObject(dstEdit); + RefObject tempRef_dstEdit2 = + new RefObject(dstEdit); elmSize = this.SparseComputeSize(tempRef_dstEdit2); - dstEdit = tempRef_dstEdit2.argValue; + dstEdit = tempRef_dstEdit2.get(); int elmBytes = elmSize - (dstEdit.valueOffset - dstEdit.metaOffset); - cmp = this.CompareFieldValue(srcEdit.argValue.clone(), srcBytes, dstEdit, elmBytes); + cmp = this.CompareFieldValue(srcEdit.get().clone(), srcBytes, dstEdit, elmBytes); } if (cmp <= 0) { @@ -330,10 +332,10 @@ public final class RowBuffer { return dstEdit; } - tangible.RefObject tempRef_dstEdit3 = - new tangible.RefObject(dstEdit); + RefObject tempRef_dstEdit3 = + new RefObject(dstEdit); elmSize = (elmSize == -1) ? this.SparseComputeSize(tempRef_dstEdit3) : elmSize; - dstEdit = tempRef_dstEdit3.argValue; + dstEdit = tempRef_dstEdit3.get(); dstEdit.index++; dstEdit.metaOffset += elmSize; } @@ -344,20 +346,20 @@ public final class RowBuffer { return dstEdit; } - public long Read7BitEncodedInt(int offset, tangible.OutObject lenInBytes) { + public long Read7BitEncodedInt(int offset, OutObject lenInBytes) { return RowBuffer.RotateSignToMsb(this.Read7BitEncodedUInt(offset, lenInBytes)); } //C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java: //ORIGINAL LINE: internal ulong Read7BitEncodedUInt(int offset, out int lenInBytes) - public long Read7BitEncodedUInt(int offset, tangible.OutObject lenInBytes) { + public long Read7BitEncodedUInt(int offset, OutObject lenInBytes) { // Read out an unsigned long 7 bits at a time. The high bit of the byte, // when set, indicates there are more bytes. //C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java: //ORIGINAL LINE: ulong b = this.buffer[offset]; long b = this.buffer[offset]; if (b < 0x80L) { - lenInBytes.argValue = 1; + lenInBytes.set(1); return b; } @@ -372,7 +374,7 @@ public final class RowBuffer { shift += 7; } while (b >= 0x80L); - lenInBytes.argValue = shift / 7; + lenInBytes.set(shift / 7); return retval; } @@ -507,139 +509,139 @@ public final class RowBuffer { //C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java: //ORIGINAL LINE: internal ReadOnlySpan ReadSparseBinary(ref RowCursor edit) - public ReadOnlySpan ReadSparseBinary(tangible.RefObject edit) { + public ReadOnlySpan ReadSparseBinary(RefObject edit) { this.ReadSparsePrimitiveTypeCode(edit, LayoutType.Binary); int sizeLenInBytes; - tangible.OutObject tempOut_sizeLenInBytes = new tangible.OutObject(); + OutObject tempOut_sizeLenInBytes = new OutObject(); //C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java: //ORIGINAL LINE: ReadOnlySpan span = this.ReadBinary(edit.valueOffset, out int sizeLenInBytes); - ReadOnlySpan span = this.ReadBinary(edit.argValue.valueOffset, tempOut_sizeLenInBytes); - sizeLenInBytes = tempOut_sizeLenInBytes.argValue; - edit.argValue.endOffset = edit.argValue.valueOffset + sizeLenInBytes + span.Length; + ReadOnlySpan span = this.ReadBinary(edit.get().valueOffset, tempOut_sizeLenInBytes); + sizeLenInBytes = tempOut_sizeLenInBytes.get(); + edit.get().endOffset = edit.get().valueOffset + sizeLenInBytes + span.Length; return span; } - public boolean ReadSparseBool(tangible.RefObject edit) { + public boolean ReadSparseBool(RefObject edit) { this.ReadSparsePrimitiveTypeCode(edit, LayoutType.Boolean); - edit.argValue.endOffset = edit.argValue.valueOffset; - return edit.argValue.cellType == LayoutType.Boolean; + edit.get().endOffset = edit.get().valueOffset; + return edit.get().cellType == LayoutType.Boolean; } - public LocalDateTime ReadSparseDateTime(tangible.RefObject edit) { + public LocalDateTime ReadSparseDateTime(RefObject edit) { this.ReadSparsePrimitiveTypeCode(edit, LayoutType.DateTime); - edit.argValue.endOffset = edit.argValue.valueOffset + 8; - return this.ReadDateTime(edit.argValue.valueOffset); + edit.get().endOffset = edit.get().valueOffset + 8; + return this.ReadDateTime(edit.get().valueOffset); } - public BigDecimal ReadSparseDecimal(tangible.RefObject edit) { + public BigDecimal ReadSparseDecimal(RefObject edit) { this.ReadSparsePrimitiveTypeCode(edit, LayoutType.Decimal); // TODO: C# TO JAVA CONVERTER: There is no Java equivalent to 'sizeof': - edit.argValue.endOffset = edit.argValue.valueOffset + sizeof(BigDecimal); - return this.ReadDecimal(edit.argValue.valueOffset); + edit.get().endOffset = edit.get().valueOffset + sizeof(BigDecimal); + return this.ReadDecimal(edit.get().valueOffset); } - public Float128 ReadSparseFloat128(tangible.RefObject edit) { + public Float128 ReadSparseFloat128(RefObject edit) { this.ReadSparsePrimitiveTypeCode(edit, LayoutType.Float128); - edit.argValue.endOffset = edit.argValue.valueOffset + Float128.Size; - return this.ReadFloat128(edit.argValue.valueOffset).clone(); + edit.get().endOffset = edit.get().valueOffset + Float128.Size; + return this.ReadFloat128(edit.get().valueOffset).clone(); } - public float ReadSparseFloat32(tangible.RefObject edit) { + public float ReadSparseFloat32(RefObject edit) { this.ReadSparsePrimitiveTypeCode(edit, LayoutType.Float32); - edit.argValue.endOffset = edit.argValue.valueOffset + (Float.SIZE / Byte.SIZE); - return this.ReadFloat32(edit.argValue.valueOffset); + edit.get().endOffset = edit.get().valueOffset + (Float.SIZE / Byte.SIZE); + return this.ReadFloat32(edit.get().valueOffset); } - public double ReadSparseFloat64(tangible.RefObject edit) { + public double ReadSparseFloat64(RefObject edit) { this.ReadSparsePrimitiveTypeCode(edit, LayoutType.Float64); - edit.argValue.endOffset = edit.argValue.valueOffset + (Double.SIZE / Byte.SIZE); - return this.ReadFloat64(edit.argValue.valueOffset); + edit.get().endOffset = edit.get().valueOffset + (Double.SIZE / Byte.SIZE); + return this.ReadFloat64(edit.get().valueOffset); } - public UUID ReadSparseGuid(tangible.RefObject edit) { + public UUID ReadSparseGuid(RefObject edit) { this.ReadSparsePrimitiveTypeCode(edit, LayoutType.Guid); - edit.argValue.endOffset = edit.argValue.valueOffset + 16; - return this.ReadGuid(edit.argValue.valueOffset); + edit.get().endOffset = edit.get().valueOffset + 16; + return this.ReadGuid(edit.get().valueOffset); } - public short ReadSparseInt16(tangible.RefObject edit) { + public short ReadSparseInt16(RefObject edit) { this.ReadSparsePrimitiveTypeCode(edit, LayoutType.Int16); - edit.argValue.endOffset = edit.argValue.valueOffset + (Short.SIZE / Byte.SIZE); - return this.ReadInt16(edit.argValue.valueOffset); + edit.get().endOffset = edit.get().valueOffset + (Short.SIZE / Byte.SIZE); + return this.ReadInt16(edit.get().valueOffset); } - public int ReadSparseInt32(tangible.RefObject edit) { + public int ReadSparseInt32(RefObject edit) { this.ReadSparsePrimitiveTypeCode(edit, LayoutType.Int32); - edit.argValue.endOffset = edit.argValue.valueOffset + (Integer.SIZE / Byte.SIZE); - return this.ReadInt32(edit.argValue.valueOffset); + edit.get().endOffset = edit.get().valueOffset + (Integer.SIZE / Byte.SIZE); + return this.ReadInt32(edit.get().valueOffset); } - public long ReadSparseInt64(tangible.RefObject edit) { + public long ReadSparseInt64(RefObject edit) { this.ReadSparsePrimitiveTypeCode(edit, LayoutType.Int64); - edit.argValue.endOffset = edit.argValue.valueOffset + (Long.SIZE / Byte.SIZE); - return this.ReadInt64(edit.argValue.valueOffset); + edit.get().endOffset = edit.get().valueOffset + (Long.SIZE / Byte.SIZE); + return this.ReadInt64(edit.get().valueOffset); } - public byte ReadSparseInt8(tangible.RefObject edit) { + public byte ReadSparseInt8(RefObject edit) { // TODO: Remove calls to ReadSparsePrimitiveTypeCode once moved to V2 read. this.ReadSparsePrimitiveTypeCode(edit, LayoutType.Int8); - edit.argValue.endOffset = edit.argValue.valueOffset + (Byte.SIZE / Byte.SIZE); - return this.ReadInt8(edit.argValue.valueOffset); + edit.get().endOffset = edit.get().valueOffset + (Byte.SIZE / Byte.SIZE); + return this.ReadInt8(edit.get().valueOffset); } - public MongoDbObjectId ReadSparseMongoDbObjectId(tangible.RefObject edit) { + public MongoDbObjectId ReadSparseMongoDbObjectId(RefObject edit) { this.ReadSparsePrimitiveTypeCode(edit, MongoDbObjectId); - edit.argValue.endOffset = edit.argValue.valueOffset + MongoDbObjectId.Size; - return this.ReadMongoDbObjectId(edit.argValue.valueOffset).clone(); + edit.get().endOffset = edit.get().valueOffset + MongoDbObjectId.Size; + return this.ReadMongoDbObjectId(edit.get().valueOffset).clone(); } - public NullValue ReadSparseNull(tangible.RefObject edit) { + public NullValue ReadSparseNull(RefObject edit) { this.ReadSparsePrimitiveTypeCode(edit, LayoutType.Null); - edit.argValue.endOffset = edit.argValue.valueOffset; + edit.get().endOffset = edit.get().valueOffset; return NullValue.Default; } - public Utf8Span ReadSparsePath(tangible.RefObject edit) { + public Utf8Span ReadSparsePath(RefObject edit) { Utf8String path; - tangible.OutObject tempOut_path = new tangible.OutObject(); + OutObject tempOut_path = new OutObject(); //C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java: //ORIGINAL LINE: if (edit.layout.Tokenizer.TryFindString((ulong)edit.pathToken, out Utf8String path)) - if (edit.argValue.layout.getTokenizer().TryFindString(edit.argValue.longValue().pathToken, tempOut_path)) { - path = tempOut_path.argValue; + if (edit.get().layout.getTokenizer().TryFindString(edit.get().longValue().pathToken, tempOut_path)) { + path = tempOut_path.get(); return path.Span; } else { - path = tempOut_path.argValue; + path = tempOut_path.get(); } - int numBytes = edit.argValue.pathToken - edit.argValue.layout.getTokenizer().getCount(); - return Utf8Span.UnsafeFromUtf8BytesNoValidation(this.buffer.Slice(edit.argValue.pathOffset, numBytes)); + int numBytes = edit.get().pathToken - edit.get().layout.getTokenizer().getCount(); + return Utf8Span.UnsafeFromUtf8BytesNoValidation(this.buffer.Slice(edit.get().pathOffset, numBytes)); } - public int ReadSparsePathLen(Layout layout, int offset, tangible.OutObject pathLenInBytes, - tangible.OutObject pathOffset) { + public int ReadSparsePathLen(Layout layout, int offset, OutObject pathLenInBytes, + OutObject pathOffset) { int sizeLenInBytes; - tangible.OutObject tempOut_sizeLenInBytes = new tangible.OutObject(); + OutObject tempOut_sizeLenInBytes = new OutObject(); int token = (int)this.Read7BitEncodedUInt(offset, tempOut_sizeLenInBytes); - sizeLenInBytes = tempOut_sizeLenInBytes.argValue; + sizeLenInBytes = tempOut_sizeLenInBytes.get(); if (token < layout.getTokenizer().getCount()) { - pathLenInBytes.argValue = sizeLenInBytes; - pathOffset.argValue = offset; + pathLenInBytes.set(sizeLenInBytes); + pathOffset.set(offset); return token; } int numBytes = token - layout.getTokenizer().getCount(); - pathLenInBytes.argValue = numBytes + sizeLenInBytes; - pathOffset.argValue = offset + sizeLenInBytes; + pathLenInBytes.set(numBytes + sizeLenInBytes); + pathOffset.set(offset + sizeLenInBytes); return token; } - public Utf8Span ReadSparseString(tangible.RefObject edit) { + public Utf8Span ReadSparseString(RefObject edit) { this.ReadSparsePrimitiveTypeCode(edit, LayoutType.Utf8); int sizeLenInBytes; - tangible.OutObject tempOut_sizeLenInBytes = new tangible.OutObject(); - Utf8Span span = this.ReadString(edit.argValue.valueOffset, tempOut_sizeLenInBytes); - sizeLenInBytes = tempOut_sizeLenInBytes.argValue; - edit.argValue.endOffset = edit.argValue.valueOffset + sizeLenInBytes + span.Length; + OutObject tempOut_sizeLenInBytes = new OutObject(); + Utf8Span span = this.ReadString(edit.get().valueOffset, tempOut_sizeLenInBytes); + sizeLenInBytes = tempOut_sizeLenInBytes.get(); + edit.get().endOffset = edit.get().valueOffset + sizeLenInBytes + span.Length; return span; } @@ -652,63 +654,63 @@ public final class RowBuffer { //C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java: //ORIGINAL LINE: internal ushort ReadSparseUInt16(ref RowCursor edit) - public short ReadSparseUInt16(tangible.RefObject edit) { + public short ReadSparseUInt16(RefObject edit) { this.ReadSparsePrimitiveTypeCode(edit, LayoutType.UInt16); - edit.argValue.endOffset = edit.argValue.valueOffset + (Short.SIZE / Byte.SIZE); - return this.ReadUInt16(edit.argValue.valueOffset); + edit.get().endOffset = edit.get().valueOffset + (Short.SIZE / Byte.SIZE); + return this.ReadUInt16(edit.get().valueOffset); } //C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java: //ORIGINAL LINE: internal uint ReadSparseUInt32(ref RowCursor edit) - public int ReadSparseUInt32(tangible.RefObject edit) { + public int ReadSparseUInt32(RefObject edit) { this.ReadSparsePrimitiveTypeCode(edit, LayoutType.UInt32); - edit.argValue.endOffset = edit.argValue.valueOffset + (Integer.SIZE / Byte.SIZE); - return this.ReadUInt32(edit.argValue.valueOffset); + edit.get().endOffset = edit.get().valueOffset + (Integer.SIZE / Byte.SIZE); + return this.ReadUInt32(edit.get().valueOffset); } //C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java: //ORIGINAL LINE: internal ulong ReadSparseUInt64(ref RowCursor edit) - public long ReadSparseUInt64(tangible.RefObject edit) { + public long ReadSparseUInt64(RefObject edit) { this.ReadSparsePrimitiveTypeCode(edit, LayoutType.UInt64); - edit.argValue.endOffset = edit.argValue.valueOffset + (Long.SIZE / Byte.SIZE); - return this.ReadUInt64(edit.argValue.valueOffset); + edit.get().endOffset = edit.get().valueOffset + (Long.SIZE / Byte.SIZE); + return this.ReadUInt64(edit.get().valueOffset); } //C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java: //ORIGINAL LINE: internal byte ReadSparseUInt8(ref RowCursor edit) - public byte ReadSparseUInt8(tangible.RefObject edit) { + public byte ReadSparseUInt8(RefObject edit) { this.ReadSparsePrimitiveTypeCode(edit, LayoutType.UInt8); - edit.argValue.endOffset = edit.argValue.valueOffset + 1; - return this.ReadUInt8(edit.argValue.valueOffset); + edit.get().endOffset = edit.get().valueOffset + 1; + return this.ReadUInt8(edit.get().valueOffset); } - public UnixDateTime ReadSparseUnixDateTime(tangible.RefObject edit) { + public UnixDateTime ReadSparseUnixDateTime(RefObject edit) { this.ReadSparsePrimitiveTypeCode(edit, LayoutType.UnixDateTime); - edit.argValue.endOffset = edit.argValue.valueOffset + 8; - return this.ReadUnixDateTime(edit.argValue.valueOffset).clone(); + edit.get().endOffset = edit.get().valueOffset + 8; + return this.ReadUnixDateTime(edit.get().valueOffset).clone(); } - public long ReadSparseVarInt(tangible.RefObject edit) { + public long ReadSparseVarInt(RefObject edit) { this.ReadSparsePrimitiveTypeCode(edit, LayoutType.VarInt); int sizeLenInBytes; - tangible.OutObject tempOut_sizeLenInBytes = new tangible.OutObject(); - long value = this.Read7BitEncodedInt(edit.argValue.valueOffset, tempOut_sizeLenInBytes); - sizeLenInBytes = tempOut_sizeLenInBytes.argValue; - edit.argValue.endOffset = edit.argValue.valueOffset + sizeLenInBytes; + OutObject tempOut_sizeLenInBytes = new OutObject(); + long value = this.Read7BitEncodedInt(edit.get().valueOffset, tempOut_sizeLenInBytes); + sizeLenInBytes = tempOut_sizeLenInBytes.get(); + edit.get().endOffset = edit.get().valueOffset + sizeLenInBytes; return value; } //C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java: //ORIGINAL LINE: internal ulong ReadSparseVarUInt(ref RowCursor edit) - public long ReadSparseVarUInt(tangible.RefObject edit) { + public long ReadSparseVarUInt(RefObject edit) { this.ReadSparsePrimitiveTypeCode(edit, LayoutType.VarUInt); int sizeLenInBytes; - tangible.OutObject tempOut_sizeLenInBytes = new tangible.OutObject(); + OutObject tempOut_sizeLenInBytes = new OutObject(); //C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java: //ORIGINAL LINE: ulong value = this.Read7BitEncodedUInt(edit.valueOffset, out int sizeLenInBytes); - long value = this.Read7BitEncodedUInt(edit.argValue.valueOffset, tempOut_sizeLenInBytes); - sizeLenInBytes = tempOut_sizeLenInBytes.argValue; - edit.argValue.endOffset = edit.argValue.valueOffset + sizeLenInBytes; + long value = this.Read7BitEncodedUInt(edit.get().valueOffset, tempOut_sizeLenInBytes); + sizeLenInBytes = tempOut_sizeLenInBytes.get(); + edit.get().endOffset = edit.get().valueOffset + sizeLenInBytes; return value; } @@ -752,27 +754,27 @@ public final class RowBuffer { //ORIGINAL LINE: internal ReadOnlySpan ReadVariableBinary(int offset) public ReadOnlySpan ReadVariableBinary(int offset) { int _; - tangible.OutObject tempOut__ = new tangible.OutObject(); + OutObject tempOut__ = new OutObject(); //C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java: //ORIGINAL LINE: return this.ReadBinary(offset, out int _); ReadOnlySpan tempVar = this.ReadBinary(offset, tempOut__); - _ = tempOut__.argValue; + _ = tempOut__.get(); return tempVar; } public long ReadVariableInt(int offset) { int _; - tangible.OutObject tempOut__ = new tangible.OutObject(); + OutObject tempOut__ = new OutObject(); long tempVar = this.Read7BitEncodedInt(offset, tempOut__); - _ = tempOut__.argValue; + _ = tempOut__.get(); return tempVar; } public Utf8Span ReadVariableString(int offset) { int _; - tangible.OutObject tempOut__ = new tangible.OutObject(); + OutObject tempOut__ = new OutObject(); Utf8Span tempVar = this.ReadString(offset, tempOut__); - _ = tempOut__.argValue; + _ = tempOut__.get(); return tempVar; } @@ -780,11 +782,11 @@ public final class RowBuffer { //ORIGINAL LINE: internal ulong ReadVariableUInt(int offset) public long ReadVariableUInt(int offset) { int _; - tangible.OutObject tempOut__ = new tangible.OutObject(); + OutObject tempOut__ = new OutObject(); //C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java: //ORIGINAL LINE: return this.Read7BitEncodedUInt(offset, out int _); long tempVar = this.Read7BitEncodedUInt(offset, tempOut__); - _ = tempOut__.argValue; + _ = tempOut__.get(); return tempVar; } @@ -891,40 +893,40 @@ public final class RowBuffer { * . * @return True if there is another field, false if there are no more. */ - public boolean SparseIteratorMoveNext(tangible.RefObject edit) { - if (edit.argValue.cellType != null) { + public boolean SparseIteratorMoveNext(RefObject edit) { + if (edit.get().cellType != null) { // Move to the next element of an indexed scope. - if (edit.argValue.scopeType.IsIndexedScope) { - edit.argValue.index++; + if (edit.get().scopeType.IsIndexedScope) { + edit.get().index++; } // Skip forward to the end of the current value. - if (edit.argValue.endOffset != 0) { - edit.argValue.metaOffset = edit.argValue.endOffset; - edit.argValue.endOffset = 0; + if (edit.get().endOffset != 0) { + edit.get().metaOffset = edit.get().endOffset; + edit.get().endOffset = 0; } else { - edit.argValue.metaOffset += this.SparseComputeSize(edit); + edit.get().metaOffset += this.SparseComputeSize(edit); } } // Check if reached end of buffer. - if (edit.argValue.metaOffset < this.length) { + if (edit.get().metaOffset < this.length) { // Check if reached end of sized scope. - if (!edit.argValue.scopeType.IsSizedScope || (edit.argValue.index != edit.argValue.count)) { + if (!edit.get().scopeType.IsSizedScope || (edit.get().index != edit.get().count)) { // Read the metadata. this.ReadSparseMetadata(edit); // Check if reached end of sparse scope. - if (!(edit.argValue.cellType instanceof LayoutEndScope)) { - edit.argValue.exists = true; + if (!(edit.get().cellType instanceof LayoutEndScope)) { + edit.get().exists = true; return true; } } } - edit.argValue.cellType = LayoutType.EndScope; - edit.argValue.exists = false; - edit.argValue.valueOffset = edit.argValue.metaOffset; + edit.get().cellType = LayoutType.EndScope; + edit.get().exists = false; + edit.get().valueOffset = edit.get().metaOffset; return false; } @@ -935,8 +937,8 @@ public final class RowBuffer { * @param immutable True if the new scope should be marked immutable (read-only). * @return A new scope beginning at the current iterator position. */ - public RowCursor SparseIteratorReadScope(tangible.RefObject edit, boolean immutable) { - LayoutScope scopeType = edit.argValue.cellType instanceof LayoutScope ? (LayoutScope)edit.argValue.cellType : + public RowCursor SparseIteratorReadScope(RefObject edit, boolean immutable) { + LayoutScope scopeType = edit.get().cellType instanceof LayoutScope ? (LayoutScope)edit.get().cellType : null; switch (scopeType) { // TODO: C# TO JAVA CONVERTER: Java has no equivalent to C# pattern variables in 'case' statements: @@ -949,11 +951,11 @@ public final class RowBuffer { { RowCursor tempVar = new RowCursor(); tempVar.scopeType = scopeType; - tempVar.scopeTypeArgs = edit.argValue.cellTypeArgs.clone(); - tempVar.start = edit.argValue.valueOffset; - tempVar.valueOffset = edit.argValue.valueOffset; - tempVar.metaOffset = edit.argValue.valueOffset; - tempVar.layout = edit.argValue.layout; + tempVar.scopeTypeArgs = edit.get().cellTypeArgs.clone(); + tempVar.start = edit.get().valueOffset; + tempVar.valueOffset = edit.get().valueOffset; + tempVar.metaOffset = edit.get().valueOffset; + tempVar.layout = edit.get().layout; tempVar.immutable = immutable; return tempVar.clone(); @@ -971,16 +973,16 @@ public final class RowBuffer { //ORIGINAL LINE: case LayoutTypedMap _: case LayoutTypedMap _: { - int valueOffset = edit.argValue.valueOffset + (Integer.SIZE / Byte.SIZE); // Point after the Size + int valueOffset = edit.get().valueOffset + (Integer.SIZE / Byte.SIZE); // Point after the Size RowCursor tempVar2 = new RowCursor(); tempVar2.scopeType = scopeType; - tempVar2.scopeTypeArgs = edit.argValue.cellTypeArgs.clone(); - tempVar2.start = edit.argValue.valueOffset; + tempVar2.scopeTypeArgs = edit.get().cellTypeArgs.clone(); + tempVar2.start = edit.get().valueOffset; tempVar2.valueOffset = valueOffset; tempVar2.metaOffset = valueOffset; - tempVar2.layout = edit.argValue.layout; + tempVar2.layout = edit.get().layout; tempVar2.immutable = immutable; - tempVar2.count = this.ReadUInt32(edit.argValue.valueOffset); + tempVar2.count = this.ReadUInt32(edit.get().valueOffset); return tempVar2.clone(); break; @@ -1002,13 +1004,13 @@ public final class RowBuffer { { RowCursor tempVar3 = new RowCursor(); tempVar3.scopeType = scopeType; - tempVar3.scopeTypeArgs = edit.argValue.cellTypeArgs.clone(); - tempVar3.start = edit.argValue.valueOffset; - tempVar3.valueOffset = edit.argValue.valueOffset; - tempVar3.metaOffset = edit.argValue.valueOffset; - tempVar3.layout = edit.argValue.layout; + tempVar3.scopeTypeArgs = edit.get().cellTypeArgs.clone(); + tempVar3.start = edit.get().valueOffset; + tempVar3.valueOffset = edit.get().valueOffset; + tempVar3.metaOffset = edit.get().valueOffset; + tempVar3.layout = edit.get().layout; tempVar3.immutable = immutable; - tempVar3.count = edit.argValue.cellTypeArgs.getCount(); + tempVar3.count = edit.get().cellTypeArgs.getCount(); return tempVar3.clone(); break; @@ -1019,33 +1021,33 @@ public final class RowBuffer { case LayoutNullable _: { - boolean hasValue = this.ReadInt8(edit.argValue.valueOffset) != 0; + boolean hasValue = this.ReadInt8(edit.get().valueOffset) != 0; if (hasValue) { // Start at the T so it can be read. - int valueOffset = edit.argValue.valueOffset + 1; + int valueOffset = edit.get().valueOffset + 1; RowCursor tempVar4 = new RowCursor(); tempVar4.scopeType = scopeType; - tempVar4.scopeTypeArgs = edit.argValue.cellTypeArgs.clone(); - tempVar4.start = edit.argValue.valueOffset; + tempVar4.scopeTypeArgs = edit.get().cellTypeArgs.clone(); + tempVar4.start = edit.get().valueOffset; tempVar4.valueOffset = valueOffset; tempVar4.metaOffset = valueOffset; - tempVar4.layout = edit.argValue.layout; + tempVar4.layout = edit.get().layout; tempVar4.immutable = immutable; tempVar4.count = 2; tempVar4.index = 1; return tempVar4.clone(); } else { // Start at the end of the scope, instead of at the T, so the T will be skipped. - TypeArgument typeArg = edit.argValue.cellTypeArgs.get(0).clone(); - int valueOffset = edit.argValue.valueOffset + 1 + this.CountDefaultValue(typeArg.getType(), + TypeArgument typeArg = edit.get().cellTypeArgs.get(0).clone(); + int valueOffset = edit.get().valueOffset + 1 + this.CountDefaultValue(typeArg.getType(), typeArg.getTypeArgs().clone()); RowCursor tempVar5 = new RowCursor(); tempVar5.scopeType = scopeType; - tempVar5.scopeTypeArgs = edit.argValue.cellTypeArgs.clone(); - tempVar5.start = edit.argValue.valueOffset; + tempVar5.scopeTypeArgs = edit.get().cellTypeArgs.clone(); + tempVar5.start = edit.get().valueOffset; tempVar5.valueOffset = valueOffset; tempVar5.metaOffset = valueOffset; - tempVar5.layout = edit.argValue.layout; + tempVar5.layout = edit.get().layout; tempVar5.immutable = immutable; tempVar5.count = 2; tempVar5.index = 2; @@ -1060,13 +1062,13 @@ public final class RowBuffer { case LayoutUDT _: { - Layout udt = this.resolver.Resolve(edit.argValue.cellTypeArgs.getSchemaId().clone()); - int valueOffset = this.ComputeVariableValueOffset(udt, edit.argValue.valueOffset, + Layout udt = this.resolver.Resolve(edit.get().cellTypeArgs.getSchemaId().clone()); + int valueOffset = this.ComputeVariableValueOffset(udt, edit.get().valueOffset, udt.getNumVariable()); RowCursor tempVar6 = new RowCursor(); tempVar6.scopeType = scopeType; - tempVar6.scopeTypeArgs = edit.argValue.cellTypeArgs.clone(); - tempVar6.start = edit.argValue.valueOffset; + tempVar6.scopeTypeArgs = edit.get().cellTypeArgs.clone(); + tempVar6.start = edit.get().valueOffset; tempVar6.valueOffset = valueOffset; tempVar6.metaOffset = valueOffset; tempVar6.layout = udt; @@ -1091,45 +1093,45 @@ public final class RowBuffer { return this.buffer.Slice(0, this.length).ToArray(); } - public void TypedCollectionMoveField(tangible.RefObject dstEdit, tangible.RefObject srcEdit + public void TypedCollectionMoveField(RefObject dstEdit, RefObject srcEdit , RowOptions options) { int encodedSize = this.SparseComputeSize(srcEdit); - int numBytes = encodedSize - (srcEdit.argValue.valueOffset - srcEdit.argValue.metaOffset); + int numBytes = encodedSize - (srcEdit.get().valueOffset - srcEdit.get().metaOffset); // Insert the field metadata into its new location. int metaBytes; - tangible.OutObject tempOut_metaBytes = new tangible.OutObject(); + OutObject tempOut_metaBytes = new OutObject(); int spaceNeeded; - tangible.OutObject tempOut_spaceNeeded = new tangible.OutObject(); + OutObject tempOut_spaceNeeded = new OutObject(); int shiftInsert; - tangible.OutObject tempOut_shiftInsert = new tangible.OutObject(); - this.EnsureSparse(dstEdit, srcEdit.argValue.cellType, srcEdit.argValue.cellTypeArgs.clone(), numBytes, + OutObject tempOut_shiftInsert = new OutObject(); + this.EnsureSparse(dstEdit, srcEdit.get().cellType, srcEdit.get().cellTypeArgs.clone(), numBytes, options, tempOut_metaBytes, tempOut_spaceNeeded, tempOut_shiftInsert); - shiftInsert = tempOut_shiftInsert.argValue; - spaceNeeded = tempOut_spaceNeeded.argValue; - metaBytes = tempOut_metaBytes.argValue; + shiftInsert = tempOut_shiftInsert.get(); + spaceNeeded = tempOut_spaceNeeded.get(); + metaBytes = tempOut_metaBytes.get(); - this.WriteSparseMetadata(dstEdit, srcEdit.argValue.cellType, srcEdit.argValue.cellTypeArgs.clone(), metaBytes); + this.WriteSparseMetadata(dstEdit, srcEdit.get().cellType, srcEdit.get().cellTypeArgs.clone(), metaBytes); checkState(spaceNeeded == metaBytes + numBytes); - if (srcEdit.argValue.metaOffset >= dstEdit.argValue.metaOffset) { - srcEdit.argValue.metaOffset += shiftInsert; - srcEdit.argValue.valueOffset += shiftInsert; + if (srcEdit.get().metaOffset >= dstEdit.get().metaOffset) { + srcEdit.get().metaOffset += shiftInsert; + srcEdit.get().valueOffset += shiftInsert; } // Copy the value bits from the old location. - this.buffer.Slice(srcEdit.argValue.valueOffset, numBytes).CopyTo(this.buffer.Slice(dstEdit.argValue.valueOffset)); + this.buffer.Slice(srcEdit.get().valueOffset, numBytes).CopyTo(this.buffer.Slice(dstEdit.get().valueOffset)); this.length += shiftInsert; // Delete the old location. - tangible.OutObject tempOut_metaBytes2 = new tangible.OutObject(); - tangible.OutObject tempOut_spaceNeeded2 = new tangible.OutObject(); + OutObject tempOut_metaBytes2 = new OutObject(); + OutObject tempOut_spaceNeeded2 = new OutObject(); int shiftDelete; - tangible.OutObject tempOut_shiftDelete = new tangible.OutObject(); - this.EnsureSparse(srcEdit, srcEdit.argValue.cellType, srcEdit.argValue.cellTypeArgs.clone(), numBytes, + OutObject tempOut_shiftDelete = new OutObject(); + this.EnsureSparse(srcEdit, srcEdit.get().cellType, srcEdit.get().cellTypeArgs.clone(), numBytes, RowOptions.Delete, tempOut_metaBytes2, tempOut_spaceNeeded2, tempOut_shiftDelete); - shiftDelete = tempOut_shiftDelete.argValue; - spaceNeeded = tempOut_spaceNeeded2.argValue; - metaBytes = tempOut_metaBytes2.argValue; + shiftDelete = tempOut_shiftDelete.get(); + spaceNeeded = tempOut_spaceNeeded2.get(); + metaBytes = tempOut_metaBytes2.get(); checkState(shiftDelete < 0); this.length += shiftDelete; @@ -1164,14 +1166,14 @@ public final class RowBuffer { * operation is idempotent. *

*/ - public Result TypedCollectionUniqueIndexRebuild(tangible.RefObject scope) { - checkArgument(scope.argValue.scopeType.IsUniqueScope); - checkArgument(scope.argValue.index == 0); + public Result TypedCollectionUniqueIndexRebuild(RefObject scope) { + checkArgument(scope.get().scopeType.IsUniqueScope); + checkArgument(scope.get().index == 0); RowCursor dstEdit; // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'out' keyword - these // cannot be // converted using the 'OutObject' helper class unless the method is within the code being modified: - scope.argValue.Clone(out dstEdit); + scope.get().Clone(out dstEdit); if (dstEdit.count <= 1) { return Result.Success; } @@ -1181,18 +1183,18 @@ public final class RowBuffer { UniqueIndexItem item; Span uniqueIndex = dstEdit.count < 100 ? stackalloc UniqueIndexItem[dstEdit.count] : new UniqueIndexItem[dstEdit.count]; - dstEdit.metaOffset = scope.argValue.valueOffset; + dstEdit.metaOffset = scope.get().valueOffset; for (; dstEdit.index < dstEdit.count; dstEdit.index++) { - tangible.RefObject tempRef_dstEdit = - new tangible.RefObject(dstEdit); + RefObject tempRef_dstEdit = + new RefObject(dstEdit); this.ReadSparseMetadata(tempRef_dstEdit); - dstEdit = tempRef_dstEdit.argValue; + dstEdit = tempRef_dstEdit.get(); Contract.Assert(dstEdit.pathOffset == default) - tangible.RefObject tempRef_dstEdit2 = - new tangible.RefObject(dstEdit); + RefObject tempRef_dstEdit2 = + new RefObject(dstEdit); int elmSize = this.SparseComputeSize(tempRef_dstEdit2); - dstEdit = tempRef_dstEdit2.argValue; + dstEdit = tempRef_dstEdit2.get(); UniqueIndexItem tempVar = new UniqueIndexItem(); tempVar.Code = dstEdit.cellType.LayoutCode; @@ -1211,7 +1213,7 @@ public final class RowBuffer { // that items are relatively large, using scratch space requires each item to be moved // AT MOST once. Given that row buffer memory is likely reused, scratch space is // relatively memory efficient. - int shift = dstEdit.metaOffset - scope.argValue.valueOffset; + int shift = dstEdit.metaOffset - scope.get().valueOffset; // Sort and check for duplicates. // TODO: C# TO JAVA CONVERTER: C# 'unsafe' code is not converted by C# to Java Converter: @@ -1226,7 +1228,7 @@ public final class RowBuffer { // } // Move elements. - int metaOffset = scope.argValue.valueOffset; + int metaOffset = scope.get().valueOffset; this.Ensure(this.length + shift); this.buffer.Slice(metaOffset, this.length - metaOffset).CopyTo(this.buffer.Slice(metaOffset + shift)); for (UniqueIndexItem x : uniqueIndex) { @@ -1249,7 +1251,7 @@ public final class RowBuffer { } public void UnsetBit(int offset, LayoutBit bit) { - checkState(azure.data.cosmos.serialization.hybridrow.layouts.LayoutBit.opNotEquals(bit.clone(), LayoutBit.Invalid)); + checkState(LayoutBit.opNotEquals(bit.clone(), LayoutBit.Invalid)); // TODO: C# TO JAVA CONVERTER: There is no Java equivalent to 'unchecked' in this context: //ORIGINAL LINE: this.buffer[bit.GetOffset(offset)] &= unchecked((byte)~(1 << bit.GetBit())); //C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java: @@ -1284,15 +1286,15 @@ public final class RowBuffer { } public void WriteDateTime(int offset, LocalDateTime value) { - tangible.RefObject tempRef_value = new tangible.RefObject(value); + RefObject tempRef_value = new RefObject(value); MemoryMarshal.Write(this.buffer.Slice(offset), tempRef_value); - value = tempRef_value.argValue; + value = tempRef_value.get(); } public void WriteDecimal(int offset, BigDecimal value) { - tangible.RefObject tempRef_value = new tangible.RefObject(value); + RefObject tempRef_value = new RefObject(value); MemoryMarshal.Write(this.buffer.Slice(offset), tempRef_value); - value = tempRef_value.argValue; + value = tempRef_value.get(); } //C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java: @@ -1318,53 +1320,53 @@ public final class RowBuffer { } public void WriteFloat128(int offset, Float128 value) { - tangible.RefObject tempRef_value = - new tangible.RefObject(value); + RefObject tempRef_value = + new RefObject(value); MemoryMarshal.Write(this.buffer.Slice(offset), tempRef_value); - value = tempRef_value.argValue; + value = tempRef_value.get(); } public void WriteFloat32(int offset, float value) { - tangible.RefObject tempRef_value = new tangible.RefObject(value); + RefObject tempRef_value = new RefObject(value); MemoryMarshal.Write(this.buffer.Slice(offset), tempRef_value); - value = tempRef_value.argValue; + value = tempRef_value.get(); } public void WriteFloat64(int offset, double value) { - tangible.RefObject tempRef_value = new tangible.RefObject(value); + RefObject tempRef_value = new RefObject(value); MemoryMarshal.Write(this.buffer.Slice(offset), tempRef_value); - value = tempRef_value.argValue; + value = tempRef_value.get(); } public void WriteGuid(int offset, UUID value) { - tangible.RefObject tempRef_value = new tangible.RefObject(value); + RefObject tempRef_value = new RefObject(value); MemoryMarshal.Write(this.buffer.Slice(offset), tempRef_value); - value = tempRef_value.argValue; + value = tempRef_value.get(); } public void WriteHeader(int offset, HybridRowHeader value) { - tangible.RefObject tempRef_value = - new tangible.RefObject(value); + RefObject tempRef_value = + new RefObject(value); MemoryMarshal.Write(this.buffer.Slice(offset), tempRef_value); - value = tempRef_value.argValue; + value = tempRef_value.get(); } public void WriteInt16(int offset, short value) { - tangible.RefObject tempRef_value = new tangible.RefObject(value); + RefObject tempRef_value = new RefObject(value); MemoryMarshal.Write(this.buffer.Slice(offset), tempRef_value); - value = tempRef_value.argValue; + value = tempRef_value.get(); } public void WriteInt32(int offset, int value) { - tangible.RefObject tempRef_value = new tangible.RefObject(value); + RefObject tempRef_value = new RefObject(value); MemoryMarshal.Write(this.buffer.Slice(offset), tempRef_value); - value = tempRef_value.argValue; + value = tempRef_value.get(); } public void WriteInt64(int offset, long value) { - tangible.RefObject tempRef_value = new tangible.RefObject(value); + RefObject tempRef_value = new RefObject(value); MemoryMarshal.Write(this.buffer.Slice(offset), tempRef_value); - value = tempRef_value.argValue; + value = tempRef_value.get(); } public void WriteInt8(int offset, byte value) { @@ -1375,81 +1377,81 @@ public final class RowBuffer { } public void WriteMongoDbObjectId(int offset, MongoDbObjectId value) { - tangible.RefObject tempRef_value = - new tangible.RefObject(value); + RefObject tempRef_value = + new RefObject(value); MemoryMarshal.Write(this.buffer.Slice(offset), tempRef_value); - value = tempRef_value.argValue; + value = tempRef_value.get(); } - public void WriteNullable(tangible.RefObject edit, LayoutScope scopeType, TypeArgumentList typeArgs, - UpdateOptions options, boolean hasValue, tangible.OutObject newScope) { + public void WriteNullable(RefObject edit, LayoutScope scopeType, TypeArgumentList typeArgs, + UpdateOptions options, boolean hasValue, OutObject newScope) { int numBytes = this.CountDefaultValue(scopeType, typeArgs.clone()); int metaBytes; - tangible.OutObject tempOut_metaBytes = new tangible.OutObject(); + OutObject tempOut_metaBytes = new OutObject(); int spaceNeeded; - tangible.OutObject tempOut_spaceNeeded = new tangible.OutObject(); + OutObject tempOut_spaceNeeded = new OutObject(); int shift; - tangible.OutObject tempOut_shift = new tangible.OutObject(); + OutObject tempOut_shift = new OutObject(); this.EnsureSparse(edit, scopeType, typeArgs.clone(), numBytes, options, tempOut_metaBytes, tempOut_spaceNeeded, tempOut_shift); - shift = tempOut_shift.argValue; - spaceNeeded = tempOut_spaceNeeded.argValue; - metaBytes = tempOut_metaBytes.argValue; + shift = tempOut_shift.get(); + spaceNeeded = tempOut_spaceNeeded.get(); + metaBytes = tempOut_metaBytes.get(); this.WriteSparseMetadata(edit, scopeType, typeArgs.clone(), metaBytes); - int numWritten = this.WriteDefaultValue(edit.argValue.valueOffset, scopeType, typeArgs.clone()); + int numWritten = this.WriteDefaultValue(edit.get().valueOffset, scopeType, typeArgs.clone()); checkState(numBytes == numWritten); checkState(spaceNeeded == metaBytes + numBytes); if (hasValue) { - this.WriteInt8(edit.argValue.valueOffset, (byte)1); + this.WriteInt8(edit.get().valueOffset, (byte)1); } - int valueOffset = edit.argValue.valueOffset + 1; - newScope.argValue = new RowCursor(); - newScope.argValue.scopeType = scopeType; - newScope.argValue.scopeTypeArgs = typeArgs.clone(); - newScope.argValue.start = edit.argValue.valueOffset; - newScope.argValue.valueOffset = valueOffset; - newScope.argValue.metaOffset = valueOffset; - newScope.argValue.layout = edit.argValue.layout; - newScope.argValue.count = 2; - newScope.argValue.index = 1; + int valueOffset = edit.get().valueOffset + 1; + newScope.set(new RowCursor()); + newScope.get().scopeType = scopeType; + newScope.get().scopeTypeArgs = typeArgs.clone(); + newScope.get().start = edit.get().valueOffset; + newScope.get().valueOffset = valueOffset; + newScope.get().metaOffset = valueOffset; + newScope.get().layout = edit.get().layout; + newScope.get().count = 2; + newScope.get().index = 1; this.length += shift; - tangible.RefObject tempRef_this = - new tangible.RefObject(this); - azure.data.cosmos.serialization.hybridrow.RowCursorExtensions.MoveNext(newScope.argValue.clone(), tempRef_this); - this = tempRef_this.argValue; + RefObject tempRef_this = + new RefObject(this); + RowCursorExtensions.MoveNext(newScope.get().clone(), tempRef_this); + this = tempRef_this.get(); } public void WriteSchemaId(int offset, SchemaId value) { this.WriteInt32(offset, value.getId()); } - public void WriteSparseArray(tangible.RefObject edit, LayoutScope scopeType, UpdateOptions options, - tangible.OutObject newScope) { + public void WriteSparseArray(RefObject edit, LayoutScope scopeType, UpdateOptions options, + OutObject newScope) { int numBytes = (LayoutCode.SIZE / Byte.SIZE); // end scope type code. TypeArgumentList typeArgs = TypeArgumentList.Empty; int metaBytes; - tangible.OutObject tempOut_metaBytes = new tangible.OutObject(); + OutObject tempOut_metaBytes = new OutObject(); int spaceNeeded; - tangible.OutObject tempOut_spaceNeeded = new tangible.OutObject(); + OutObject tempOut_spaceNeeded = new OutObject(); int shift; - tangible.OutObject tempOut_shift = new tangible.OutObject(); + OutObject tempOut_shift = new OutObject(); this.EnsureSparse(edit, scopeType, typeArgs.clone(), numBytes, options, tempOut_metaBytes, tempOut_spaceNeeded, tempOut_shift); - shift = tempOut_shift.argValue; - spaceNeeded = tempOut_spaceNeeded.argValue; - metaBytes = tempOut_metaBytes.argValue; + shift = tempOut_shift.get(); + spaceNeeded = tempOut_spaceNeeded.get(); + metaBytes = tempOut_metaBytes.get(); this.WriteSparseMetadata(edit, scopeType, typeArgs.clone(), metaBytes); - this.WriteSparseTypeCode(edit.argValue.valueOffset, LayoutCode.EndScope); + this.WriteSparseTypeCode(edit.get().valueOffset, LayoutCode.EndScope); checkState(spaceNeeded == metaBytes + numBytes); - newScope.argValue = new RowCursor(); - newScope.argValue.scopeType = scopeType; - newScope.argValue.scopeTypeArgs = typeArgs.clone(); - newScope.argValue.start = edit.argValue.valueOffset; - newScope.argValue.valueOffset = edit.argValue.valueOffset; - newScope.argValue.metaOffset = edit.argValue.valueOffset; - newScope.argValue.layout = edit.argValue.layout; + newScope.set(new RowCursor()); + newScope.get().scopeType = scopeType; + newScope.get().scopeTypeArgs = typeArgs.clone(); + newScope.get().start = edit.get().valueOffset; + newScope.get().valueOffset = edit.get().valueOffset; + newScope.get().metaOffset = edit.get().valueOffset; + newScope.get().layout = edit.get().layout; this.length += shift; } @@ -1457,388 +1459,388 @@ public final class RowBuffer { //C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java: //ORIGINAL LINE: internal void WriteSparseBinary(ref RowCursor edit, ReadOnlySpan value, UpdateOptions // options) - public void WriteSparseBinary(tangible.RefObject edit, ReadOnlySpan value, UpdateOptions options) { + public void WriteSparseBinary(RefObject edit, ReadOnlySpan value, UpdateOptions options) { int len = value.Length; //C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java: //ORIGINAL LINE: int numBytes = len + RowBuffer.Count7BitEncodedUInt((ulong)len); int numBytes = len + RowBuffer.Count7BitEncodedUInt(len); int metaBytes; - tangible.OutObject tempOut_metaBytes = new tangible.OutObject(); + OutObject tempOut_metaBytes = new OutObject(); int spaceNeeded; - tangible.OutObject tempOut_spaceNeeded = new tangible.OutObject(); + OutObject tempOut_spaceNeeded = new OutObject(); int shift; - tangible.OutObject tempOut_shift = new tangible.OutObject(); + OutObject tempOut_shift = new OutObject(); this.EnsureSparse(edit, LayoutType.Binary, TypeArgumentList.Empty, numBytes, options, tempOut_metaBytes, tempOut_spaceNeeded, tempOut_shift); - shift = tempOut_shift.argValue; - spaceNeeded = tempOut_spaceNeeded.argValue; - metaBytes = tempOut_metaBytes.argValue; + shift = tempOut_shift.get(); + spaceNeeded = tempOut_spaceNeeded.get(); + metaBytes = tempOut_metaBytes.get(); this.WriteSparseMetadata(edit, LayoutType.Binary, TypeArgumentList.Empty, metaBytes); - int sizeLenInBytes = this.WriteBinary(edit.argValue.valueOffset, value); + int sizeLenInBytes = this.WriteBinary(edit.get().valueOffset, value); checkState(spaceNeeded == metaBytes + len + sizeLenInBytes); - edit.argValue.endOffset = edit.argValue.metaOffset + spaceNeeded; + edit.get().endOffset = edit.get().metaOffset + spaceNeeded; this.length += shift; } //C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java: //ORIGINAL LINE: internal void WriteSparseBinary(ref RowCursor edit, ReadOnlySequence value, UpdateOptions // options) - public void WriteSparseBinary(tangible.RefObject edit, ReadOnlySequence value, - UpdateOptions options) { + public void WriteSparseBinary(RefObject edit, ReadOnlySequence value, + UpdateOptions options) { int len = (int)value.Length; //C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java: //ORIGINAL LINE: int numBytes = len + RowBuffer.Count7BitEncodedUInt((ulong)len); int numBytes = len + RowBuffer.Count7BitEncodedUInt(len); int metaBytes; - tangible.OutObject tempOut_metaBytes = new tangible.OutObject(); + OutObject tempOut_metaBytes = new OutObject(); int spaceNeeded; - tangible.OutObject tempOut_spaceNeeded = new tangible.OutObject(); + OutObject tempOut_spaceNeeded = new OutObject(); int shift; - tangible.OutObject tempOut_shift = new tangible.OutObject(); + OutObject tempOut_shift = new OutObject(); this.EnsureSparse(edit, LayoutType.Binary, TypeArgumentList.Empty, numBytes, options, tempOut_metaBytes, tempOut_spaceNeeded, tempOut_shift); - shift = tempOut_shift.argValue; - spaceNeeded = tempOut_spaceNeeded.argValue; - metaBytes = tempOut_metaBytes.argValue; + shift = tempOut_shift.get(); + spaceNeeded = tempOut_spaceNeeded.get(); + metaBytes = tempOut_metaBytes.get(); this.WriteSparseMetadata(edit, LayoutType.Binary, TypeArgumentList.Empty, metaBytes); - int sizeLenInBytes = this.WriteBinary(edit.argValue.valueOffset, value); + int sizeLenInBytes = this.WriteBinary(edit.get().valueOffset, value); checkState(spaceNeeded == metaBytes + len + sizeLenInBytes); - edit.argValue.endOffset = edit.argValue.metaOffset + spaceNeeded; + edit.get().endOffset = edit.get().metaOffset + spaceNeeded; this.length += shift; } - public void WriteSparseBool(tangible.RefObject edit, boolean value, UpdateOptions options) { + public void WriteSparseBool(RefObject edit, boolean value, UpdateOptions options) { int numBytes = 0; int metaBytes; - tangible.OutObject tempOut_metaBytes = new tangible.OutObject(); + OutObject tempOut_metaBytes = new OutObject(); int spaceNeeded; - tangible.OutObject tempOut_spaceNeeded = new tangible.OutObject(); + OutObject tempOut_spaceNeeded = new OutObject(); int shift; - tangible.OutObject tempOut_shift = new tangible.OutObject(); + OutObject tempOut_shift = new OutObject(); this.EnsureSparse(edit, value ? LayoutType.Boolean : LayoutType.BooleanFalse, TypeArgumentList.Empty, numBytes, options, tempOut_metaBytes, tempOut_spaceNeeded, tempOut_shift); - shift = tempOut_shift.argValue; - spaceNeeded = tempOut_spaceNeeded.argValue; - metaBytes = tempOut_metaBytes.argValue; + shift = tempOut_shift.get(); + spaceNeeded = tempOut_spaceNeeded.get(); + metaBytes = tempOut_metaBytes.get(); this.WriteSparseMetadata(edit, value ? LayoutType.Boolean : LayoutType.BooleanFalse, TypeArgumentList.Empty, metaBytes); checkState(spaceNeeded == metaBytes); - edit.argValue.endOffset = edit.argValue.metaOffset + spaceNeeded; + edit.get().endOffset = edit.get().metaOffset + spaceNeeded; this.length += shift; } - public void WriteSparseDateTime(tangible.RefObject edit, LocalDateTime value, UpdateOptions options) { + public void WriteSparseDateTime(RefObject edit, LocalDateTime value, UpdateOptions options) { int numBytes = 8; int metaBytes; - tangible.OutObject tempOut_metaBytes = new tangible.OutObject(); + OutObject tempOut_metaBytes = new OutObject(); int spaceNeeded; - tangible.OutObject tempOut_spaceNeeded = new tangible.OutObject(); + OutObject tempOut_spaceNeeded = new OutObject(); int shift; - tangible.OutObject tempOut_shift = new tangible.OutObject(); + OutObject tempOut_shift = new OutObject(); this.EnsureSparse(edit, LayoutType.DateTime, TypeArgumentList.Empty, numBytes, options, tempOut_metaBytes, tempOut_spaceNeeded, tempOut_shift); - shift = tempOut_shift.argValue; - spaceNeeded = tempOut_spaceNeeded.argValue; - metaBytes = tempOut_metaBytes.argValue; + shift = tempOut_shift.get(); + spaceNeeded = tempOut_spaceNeeded.get(); + metaBytes = tempOut_metaBytes.get(); this.WriteSparseMetadata(edit, LayoutType.DateTime, TypeArgumentList.Empty, metaBytes); - this.WriteDateTime(edit.argValue.valueOffset, value); + this.WriteDateTime(edit.get().valueOffset, value); checkState(spaceNeeded == metaBytes + 8); - edit.argValue.endOffset = edit.argValue.metaOffset + spaceNeeded; + edit.get().endOffset = edit.get().metaOffset + spaceNeeded; this.length += shift; } - public void WriteSparseDecimal(tangible.RefObject edit, BigDecimal value, UpdateOptions options) { + public void WriteSparseDecimal(RefObject edit, BigDecimal value, UpdateOptions options) { // TODO: C# TO JAVA CONVERTER: There is no Java equivalent to 'sizeof': int numBytes = sizeof(BigDecimal); int metaBytes; - tangible.OutObject tempOut_metaBytes = new tangible.OutObject(); + OutObject tempOut_metaBytes = new OutObject(); int spaceNeeded; - tangible.OutObject tempOut_spaceNeeded = new tangible.OutObject(); + OutObject tempOut_spaceNeeded = new OutObject(); int shift; - tangible.OutObject tempOut_shift = new tangible.OutObject(); + OutObject tempOut_shift = new OutObject(); this.EnsureSparse(edit, LayoutType.Decimal, TypeArgumentList.Empty, numBytes, options, tempOut_metaBytes, tempOut_spaceNeeded, tempOut_shift); - shift = tempOut_shift.argValue; - spaceNeeded = tempOut_spaceNeeded.argValue; - metaBytes = tempOut_metaBytes.argValue; + shift = tempOut_shift.get(); + spaceNeeded = tempOut_spaceNeeded.get(); + metaBytes = tempOut_metaBytes.get(); this.WriteSparseMetadata(edit, LayoutType.Decimal, TypeArgumentList.Empty, metaBytes); - this.WriteDecimal(edit.argValue.valueOffset, value); + this.WriteDecimal(edit.get().valueOffset, value); // TODO: C# TO JAVA CONVERTER: There is no Java equivalent to 'sizeof': checkState(spaceNeeded == metaBytes + sizeof(BigDecimal)); - edit.argValue.endOffset = edit.argValue.metaOffset + spaceNeeded; + edit.get().endOffset = edit.get().metaOffset + spaceNeeded; this.length += shift; } - public void WriteSparseFloat128(tangible.RefObject edit, Float128 value, UpdateOptions options) { + public void WriteSparseFloat128(RefObject edit, Float128 value, UpdateOptions options) { int numBytes = Float128.Size; int metaBytes; - tangible.OutObject tempOut_metaBytes = new tangible.OutObject(); + OutObject tempOut_metaBytes = new OutObject(); int spaceNeeded; - tangible.OutObject tempOut_spaceNeeded = new tangible.OutObject(); + OutObject tempOut_spaceNeeded = new OutObject(); int shift; - tangible.OutObject tempOut_shift = new tangible.OutObject(); + OutObject tempOut_shift = new OutObject(); this.EnsureSparse(edit, LayoutType.Float128, TypeArgumentList.Empty, numBytes, options, tempOut_metaBytes, tempOut_spaceNeeded, tempOut_shift); - shift = tempOut_shift.argValue; - spaceNeeded = tempOut_spaceNeeded.argValue; - metaBytes = tempOut_metaBytes.argValue; + shift = tempOut_shift.get(); + spaceNeeded = tempOut_spaceNeeded.get(); + metaBytes = tempOut_metaBytes.get(); this.WriteSparseMetadata(edit, LayoutType.Float128, TypeArgumentList.Empty, metaBytes); - this.WriteFloat128(edit.argValue.valueOffset, value.clone()); + this.WriteFloat128(edit.get().valueOffset, value.clone()); checkState(spaceNeeded == metaBytes + Float128.Size); - edit.argValue.endOffset = edit.argValue.metaOffset + spaceNeeded; + edit.get().endOffset = edit.get().metaOffset + spaceNeeded; this.length += shift; } - public void WriteSparseFloat32(tangible.RefObject edit, float value, UpdateOptions options) { + public void WriteSparseFloat32(RefObject edit, float value, UpdateOptions options) { int numBytes = (Float.SIZE / Byte.SIZE); int metaBytes; - tangible.OutObject tempOut_metaBytes = new tangible.OutObject(); + OutObject tempOut_metaBytes = new OutObject(); int spaceNeeded; - tangible.OutObject tempOut_spaceNeeded = new tangible.OutObject(); + OutObject tempOut_spaceNeeded = new OutObject(); int shift; - tangible.OutObject tempOut_shift = new tangible.OutObject(); + OutObject tempOut_shift = new OutObject(); this.EnsureSparse(edit, LayoutType.Float32, TypeArgumentList.Empty, numBytes, options, tempOut_metaBytes, tempOut_spaceNeeded, tempOut_shift); - shift = tempOut_shift.argValue; - spaceNeeded = tempOut_spaceNeeded.argValue; - metaBytes = tempOut_metaBytes.argValue; + shift = tempOut_shift.get(); + spaceNeeded = tempOut_spaceNeeded.get(); + metaBytes = tempOut_metaBytes.get(); this.WriteSparseMetadata(edit, LayoutType.Float32, TypeArgumentList.Empty, metaBytes); - this.WriteFloat32(edit.argValue.valueOffset, value); + this.WriteFloat32(edit.get().valueOffset, value); checkState(spaceNeeded == metaBytes + (Float.SIZE / Byte.SIZE)); - edit.argValue.endOffset = edit.argValue.metaOffset + spaceNeeded; + edit.get().endOffset = edit.get().metaOffset + spaceNeeded; this.length += shift; } - public void WriteSparseFloat64(tangible.RefObject edit, double value, UpdateOptions options) { + public void WriteSparseFloat64(RefObject edit, double value, UpdateOptions options) { int numBytes = (Double.SIZE / Byte.SIZE); int metaBytes; - tangible.OutObject tempOut_metaBytes = new tangible.OutObject(); + OutObject tempOut_metaBytes = new OutObject(); int spaceNeeded; - tangible.OutObject tempOut_spaceNeeded = new tangible.OutObject(); + OutObject tempOut_spaceNeeded = new OutObject(); int shift; - tangible.OutObject tempOut_shift = new tangible.OutObject(); + OutObject tempOut_shift = new OutObject(); this.EnsureSparse(edit, LayoutType.Float64, TypeArgumentList.Empty, numBytes, options, tempOut_metaBytes, tempOut_spaceNeeded, tempOut_shift); - shift = tempOut_shift.argValue; - spaceNeeded = tempOut_spaceNeeded.argValue; - metaBytes = tempOut_metaBytes.argValue; + shift = tempOut_shift.get(); + spaceNeeded = tempOut_spaceNeeded.get(); + metaBytes = tempOut_metaBytes.get(); this.WriteSparseMetadata(edit, LayoutType.Float64, TypeArgumentList.Empty, metaBytes); - this.WriteFloat64(edit.argValue.valueOffset, value); + this.WriteFloat64(edit.get().valueOffset, value); checkState(spaceNeeded == metaBytes + (Double.SIZE / Byte.SIZE)); - edit.argValue.endOffset = edit.argValue.metaOffset + spaceNeeded; + edit.get().endOffset = edit.get().metaOffset + spaceNeeded; this.length += shift; } - public void WriteSparseGuid(tangible.RefObject edit, UUID value, UpdateOptions options) { + public void WriteSparseGuid(RefObject edit, UUID value, UpdateOptions options) { int numBytes = 16; int metaBytes; - tangible.OutObject tempOut_metaBytes = new tangible.OutObject(); + OutObject tempOut_metaBytes = new OutObject(); int spaceNeeded; - tangible.OutObject tempOut_spaceNeeded = new tangible.OutObject(); + OutObject tempOut_spaceNeeded = new OutObject(); int shift; - tangible.OutObject tempOut_shift = new tangible.OutObject(); + OutObject tempOut_shift = new OutObject(); this.EnsureSparse(edit, LayoutType.Guid, TypeArgumentList.Empty, numBytes, options, tempOut_metaBytes, tempOut_spaceNeeded, tempOut_shift); - shift = tempOut_shift.argValue; - spaceNeeded = tempOut_spaceNeeded.argValue; - metaBytes = tempOut_metaBytes.argValue; + shift = tempOut_shift.get(); + spaceNeeded = tempOut_spaceNeeded.get(); + metaBytes = tempOut_metaBytes.get(); this.WriteSparseMetadata(edit, LayoutType.Guid, TypeArgumentList.Empty, metaBytes); - this.WriteGuid(edit.argValue.valueOffset, value); + this.WriteGuid(edit.get().valueOffset, value); checkState(spaceNeeded == metaBytes + 16); - edit.argValue.endOffset = edit.argValue.metaOffset + spaceNeeded; + edit.get().endOffset = edit.get().metaOffset + spaceNeeded; this.length += shift; } - public void WriteSparseInt16(tangible.RefObject edit, short value, UpdateOptions options) { + public void WriteSparseInt16(RefObject edit, short value, UpdateOptions options) { int numBytes = (Short.SIZE / Byte.SIZE); int metaBytes; - tangible.OutObject tempOut_metaBytes = new tangible.OutObject(); + OutObject tempOut_metaBytes = new OutObject(); int spaceNeeded; - tangible.OutObject tempOut_spaceNeeded = new tangible.OutObject(); + OutObject tempOut_spaceNeeded = new OutObject(); int shift; - tangible.OutObject tempOut_shift = new tangible.OutObject(); + OutObject tempOut_shift = new OutObject(); this.EnsureSparse(edit, LayoutType.Int16, TypeArgumentList.Empty, numBytes, options, tempOut_metaBytes, tempOut_spaceNeeded, tempOut_shift); - shift = tempOut_shift.argValue; - spaceNeeded = tempOut_spaceNeeded.argValue; - metaBytes = tempOut_metaBytes.argValue; + shift = tempOut_shift.get(); + spaceNeeded = tempOut_spaceNeeded.get(); + metaBytes = tempOut_metaBytes.get(); this.WriteSparseMetadata(edit, LayoutType.Int16, TypeArgumentList.Empty, metaBytes); - this.WriteInt16(edit.argValue.valueOffset, value); + this.WriteInt16(edit.get().valueOffset, value); checkState(spaceNeeded == metaBytes + (Short.SIZE / Byte.SIZE)); - edit.argValue.endOffset = edit.argValue.metaOffset + spaceNeeded; + edit.get().endOffset = edit.get().metaOffset + spaceNeeded; this.length += shift; } - public void WriteSparseInt32(tangible.RefObject edit, int value, UpdateOptions options) { + public void WriteSparseInt32(RefObject edit, int value, UpdateOptions options) { int numBytes = (Integer.SIZE / Byte.SIZE); int metaBytes; - tangible.OutObject tempOut_metaBytes = new tangible.OutObject(); + OutObject tempOut_metaBytes = new OutObject(); int spaceNeeded; - tangible.OutObject tempOut_spaceNeeded = new tangible.OutObject(); + OutObject tempOut_spaceNeeded = new OutObject(); int shift; - tangible.OutObject tempOut_shift = new tangible.OutObject(); + OutObject tempOut_shift = new OutObject(); this.EnsureSparse(edit, LayoutType.Int32, TypeArgumentList.Empty, numBytes, options, tempOut_metaBytes, tempOut_spaceNeeded, tempOut_shift); - shift = tempOut_shift.argValue; - spaceNeeded = tempOut_spaceNeeded.argValue; - metaBytes = tempOut_metaBytes.argValue; + shift = tempOut_shift.get(); + spaceNeeded = tempOut_spaceNeeded.get(); + metaBytes = tempOut_metaBytes.get(); this.WriteSparseMetadata(edit, LayoutType.Int32, TypeArgumentList.Empty, metaBytes); - this.WriteInt32(edit.argValue.valueOffset, value); + this.WriteInt32(edit.get().valueOffset, value); checkState(spaceNeeded == metaBytes + (Integer.SIZE / Byte.SIZE)); - edit.argValue.endOffset = edit.argValue.metaOffset + spaceNeeded; + edit.get().endOffset = edit.get().metaOffset + spaceNeeded; this.length += shift; } - public void WriteSparseInt64(tangible.RefObject edit, long value, UpdateOptions options) { + public void WriteSparseInt64(RefObject edit, long value, UpdateOptions options) { int numBytes = (Long.SIZE / Byte.SIZE); int metaBytes; - tangible.OutObject tempOut_metaBytes = new tangible.OutObject(); + OutObject tempOut_metaBytes = new OutObject(); int spaceNeeded; - tangible.OutObject tempOut_spaceNeeded = new tangible.OutObject(); + OutObject tempOut_spaceNeeded = new OutObject(); int shift; - tangible.OutObject tempOut_shift = new tangible.OutObject(); + OutObject tempOut_shift = new OutObject(); this.EnsureSparse(edit, LayoutType.Int64, TypeArgumentList.Empty, numBytes, options, tempOut_metaBytes, tempOut_spaceNeeded, tempOut_shift); - shift = tempOut_shift.argValue; - spaceNeeded = tempOut_spaceNeeded.argValue; - metaBytes = tempOut_metaBytes.argValue; + shift = tempOut_shift.get(); + spaceNeeded = tempOut_spaceNeeded.get(); + metaBytes = tempOut_metaBytes.get(); this.WriteSparseMetadata(edit, LayoutType.Int64, TypeArgumentList.Empty, metaBytes); - this.WriteInt64(edit.argValue.valueOffset, value); + this.WriteInt64(edit.get().valueOffset, value); checkState(spaceNeeded == metaBytes + (Long.SIZE / Byte.SIZE)); - edit.argValue.endOffset = edit.argValue.metaOffset + spaceNeeded; + edit.get().endOffset = edit.get().metaOffset + spaceNeeded; this.length += shift; } - public void WriteSparseInt8(tangible.RefObject edit, byte value, UpdateOptions options) { + public void WriteSparseInt8(RefObject edit, byte value, UpdateOptions options) { int numBytes = (Byte.SIZE / Byte.SIZE); int metaBytes; - tangible.OutObject tempOut_metaBytes = new tangible.OutObject(); + OutObject tempOut_metaBytes = new OutObject(); int spaceNeeded; - tangible.OutObject tempOut_spaceNeeded = new tangible.OutObject(); + OutObject tempOut_spaceNeeded = new OutObject(); int shift; - tangible.OutObject tempOut_shift = new tangible.OutObject(); + OutObject tempOut_shift = new OutObject(); this.EnsureSparse(edit, LayoutType.Int8, TypeArgumentList.Empty, numBytes, options, tempOut_metaBytes, tempOut_spaceNeeded, tempOut_shift); - shift = tempOut_shift.argValue; - spaceNeeded = tempOut_spaceNeeded.argValue; - metaBytes = tempOut_metaBytes.argValue; + shift = tempOut_shift.get(); + spaceNeeded = tempOut_spaceNeeded.get(); + metaBytes = tempOut_metaBytes.get(); this.WriteSparseMetadata(edit, LayoutType.Int8, TypeArgumentList.Empty, metaBytes); - this.WriteInt8(edit.argValue.valueOffset, value); + this.WriteInt8(edit.get().valueOffset, value); checkState(spaceNeeded == metaBytes + (Byte.SIZE / Byte.SIZE)); - edit.argValue.endOffset = edit.argValue.metaOffset + spaceNeeded; + edit.get().endOffset = edit.get().metaOffset + spaceNeeded; this.length += shift; } - public void WriteSparseMongoDbObjectId(tangible.RefObject edit, MongoDbObjectId value, - UpdateOptions options) { + public void WriteSparseMongoDbObjectId(RefObject edit, MongoDbObjectId value, + UpdateOptions options) { int numBytes = MongoDbObjectId.Size; int metaBytes; - tangible.OutObject tempOut_metaBytes = new tangible.OutObject(); + OutObject tempOut_metaBytes = new OutObject(); int spaceNeeded; - tangible.OutObject tempOut_spaceNeeded = new tangible.OutObject(); + OutObject tempOut_spaceNeeded = new OutObject(); int shift; - tangible.OutObject tempOut_shift = new tangible.OutObject(); + OutObject tempOut_shift = new OutObject(); this.EnsureSparse(edit, MongoDbObjectId, TypeArgumentList.Empty, numBytes, options, tempOut_metaBytes, tempOut_spaceNeeded, tempOut_shift); - shift = tempOut_shift.argValue; - spaceNeeded = tempOut_spaceNeeded.argValue; - metaBytes = tempOut_metaBytes.argValue; + shift = tempOut_shift.get(); + spaceNeeded = tempOut_spaceNeeded.get(); + metaBytes = tempOut_metaBytes.get(); this.WriteSparseMetadata(edit, MongoDbObjectId, TypeArgumentList.Empty, metaBytes); - this.WriteMongoDbObjectId(edit.argValue.valueOffset, value.clone()); + this.WriteMongoDbObjectId(edit.get().valueOffset, value.clone()); checkState(spaceNeeded == metaBytes + MongoDbObjectId.Size); - edit.argValue.endOffset = edit.argValue.metaOffset + spaceNeeded; + edit.get().endOffset = edit.get().metaOffset + spaceNeeded; this.length += shift; } - public void WriteSparseNull(tangible.RefObject edit, NullValue value, UpdateOptions options) { + public void WriteSparseNull(RefObject edit, NullValue value, UpdateOptions options) { int numBytes = 0; int metaBytes; - tangible.OutObject tempOut_metaBytes = new tangible.OutObject(); + OutObject tempOut_metaBytes = new OutObject(); int spaceNeeded; - tangible.OutObject tempOut_spaceNeeded = new tangible.OutObject(); + OutObject tempOut_spaceNeeded = new OutObject(); int shift; - tangible.OutObject tempOut_shift = new tangible.OutObject(); + OutObject tempOut_shift = new OutObject(); this.EnsureSparse(edit, LayoutType.Null, TypeArgumentList.Empty, numBytes, options, tempOut_metaBytes, tempOut_spaceNeeded, tempOut_shift); - shift = tempOut_shift.argValue; - spaceNeeded = tempOut_spaceNeeded.argValue; - metaBytes = tempOut_metaBytes.argValue; + shift = tempOut_shift.get(); + spaceNeeded = tempOut_spaceNeeded.get(); + metaBytes = tempOut_metaBytes.get(); this.WriteSparseMetadata(edit, LayoutType.Null, TypeArgumentList.Empty, metaBytes); checkState(spaceNeeded == metaBytes); - edit.argValue.endOffset = edit.argValue.metaOffset + spaceNeeded; + edit.get().endOffset = edit.get().metaOffset + spaceNeeded; this.length += shift; } - public void WriteSparseObject(tangible.RefObject edit, LayoutScope scopeType, UpdateOptions options, - tangible.OutObject newScope) { + public void WriteSparseObject(RefObject edit, LayoutScope scopeType, UpdateOptions options, + OutObject newScope) { int numBytes = (LayoutCode.SIZE / Byte.SIZE); // end scope type code. TypeArgumentList typeArgs = TypeArgumentList.Empty; int metaBytes; - tangible.OutObject tempOut_metaBytes = new tangible.OutObject(); + OutObject tempOut_metaBytes = new OutObject(); int spaceNeeded; - tangible.OutObject tempOut_spaceNeeded = new tangible.OutObject(); + OutObject tempOut_spaceNeeded = new OutObject(); int shift; - tangible.OutObject tempOut_shift = new tangible.OutObject(); + OutObject tempOut_shift = new OutObject(); this.EnsureSparse(edit, scopeType, typeArgs.clone(), numBytes, options, tempOut_metaBytes, tempOut_spaceNeeded, tempOut_shift); - shift = tempOut_shift.argValue; - spaceNeeded = tempOut_spaceNeeded.argValue; - metaBytes = tempOut_metaBytes.argValue; + shift = tempOut_shift.get(); + spaceNeeded = tempOut_spaceNeeded.get(); + metaBytes = tempOut_metaBytes.get(); this.WriteSparseMetadata(edit, scopeType, TypeArgumentList.Empty, metaBytes); - this.WriteSparseTypeCode(edit.argValue.valueOffset, LayoutCode.EndScope); + this.WriteSparseTypeCode(edit.get().valueOffset, LayoutCode.EndScope); checkState(spaceNeeded == metaBytes + numBytes); - newScope.argValue = new RowCursor(); - newScope.argValue.scopeType = scopeType; - newScope.argValue.scopeTypeArgs = TypeArgumentList.Empty; - newScope.argValue.start = edit.argValue.valueOffset; - newScope.argValue.valueOffset = edit.argValue.valueOffset; - newScope.argValue.metaOffset = edit.argValue.valueOffset; - newScope.argValue.layout = edit.argValue.layout; + newScope.set(new RowCursor()); + newScope.get().scopeType = scopeType; + newScope.get().scopeTypeArgs = TypeArgumentList.Empty; + newScope.get().start = edit.get().valueOffset; + newScope.get().valueOffset = edit.get().valueOffset; + newScope.get().metaOffset = edit.get().valueOffset; + newScope.get().layout = edit.get().layout; this.length += shift; } - public void WriteSparseString(tangible.RefObject edit, Utf8Span value, UpdateOptions options) { + public void WriteSparseString(RefObject edit, Utf8Span value, UpdateOptions options) { int len = value.Length; //C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java: //ORIGINAL LINE: int numBytes = len + RowBuffer.Count7BitEncodedUInt((ulong)len); int numBytes = len + RowBuffer.Count7BitEncodedUInt(len); int metaBytes; - tangible.OutObject tempOut_metaBytes = new tangible.OutObject(); + OutObject tempOut_metaBytes = new OutObject(); int spaceNeeded; - tangible.OutObject tempOut_spaceNeeded = new tangible.OutObject(); + OutObject tempOut_spaceNeeded = new OutObject(); int shift; - tangible.OutObject tempOut_shift = new tangible.OutObject(); + OutObject tempOut_shift = new OutObject(); this.EnsureSparse(edit, LayoutType.Utf8, TypeArgumentList.Empty, numBytes, options, tempOut_metaBytes, tempOut_spaceNeeded, tempOut_shift); - shift = tempOut_shift.argValue; - spaceNeeded = tempOut_spaceNeeded.argValue; - metaBytes = tempOut_metaBytes.argValue; + shift = tempOut_shift.get(); + spaceNeeded = tempOut_spaceNeeded.get(); + metaBytes = tempOut_metaBytes.get(); this.WriteSparseMetadata(edit, LayoutType.Utf8, TypeArgumentList.Empty, metaBytes); - int sizeLenInBytes = this.WriteString(edit.argValue.valueOffset, value); + int sizeLenInBytes = this.WriteString(edit.get().valueOffset, value); checkState(spaceNeeded == metaBytes + len + sizeLenInBytes); - edit.argValue.endOffset = edit.argValue.metaOffset + spaceNeeded; + edit.get().endOffset = edit.get().metaOffset + spaceNeeded; this.length += shift; } - public void WriteSparseTuple(tangible.RefObject edit, LayoutScope scopeType, TypeArgumentList typeArgs - , UpdateOptions options, tangible.OutObject newScope) { + public void WriteSparseTuple(RefObject edit, LayoutScope scopeType, TypeArgumentList typeArgs + , UpdateOptions options, OutObject newScope) { int numBytes = (LayoutCode.SIZE / Byte.SIZE) * (1 + typeArgs.getCount()); // nulls for each element. int metaBytes; - tangible.OutObject tempOut_metaBytes = new tangible.OutObject(); + OutObject tempOut_metaBytes = new OutObject(); int spaceNeeded; - tangible.OutObject tempOut_spaceNeeded = new tangible.OutObject(); + OutObject tempOut_spaceNeeded = new OutObject(); int shift; - tangible.OutObject tempOut_shift = new tangible.OutObject(); + OutObject tempOut_shift = new OutObject(); this.EnsureSparse(edit, scopeType, typeArgs.clone(), numBytes, options, tempOut_metaBytes, tempOut_spaceNeeded, tempOut_shift); - shift = tempOut_shift.argValue; - spaceNeeded = tempOut_spaceNeeded.argValue; - metaBytes = tempOut_metaBytes.argValue; + shift = tempOut_shift.get(); + spaceNeeded = tempOut_spaceNeeded.get(); + metaBytes = tempOut_metaBytes.get(); this.WriteSparseMetadata(edit, scopeType, typeArgs.clone(), metaBytes); - int valueOffset = edit.argValue.valueOffset; + int valueOffset = edit.get().valueOffset; for (int i = 0; i < typeArgs.getCount(); i++) { this.WriteSparseTypeCode(valueOffset, LayoutCode.Null); valueOffset += (LayoutCode.SIZE / Byte.SIZE); @@ -1846,14 +1848,14 @@ public final class RowBuffer { this.WriteSparseTypeCode(valueOffset, LayoutCode.EndScope); checkState(spaceNeeded == metaBytes + numBytes); - newScope.argValue = new RowCursor(); - newScope.argValue.scopeType = scopeType; - newScope.argValue.scopeTypeArgs = typeArgs.clone(); - newScope.argValue.start = edit.argValue.valueOffset; - newScope.argValue.valueOffset = edit.argValue.valueOffset; - newScope.argValue.metaOffset = edit.argValue.valueOffset; - newScope.argValue.layout = edit.argValue.layout; - newScope.argValue.count = typeArgs.getCount(); + newScope.set(new RowCursor()); + newScope.get().scopeType = scopeType; + newScope.get().scopeTypeArgs = typeArgs.clone(); + newScope.get().start = edit.get().valueOffset; + newScope.get().valueOffset = edit.get().valueOffset; + newScope.get().metaOffset = edit.get().valueOffset; + newScope.get().layout = edit.get().layout; + newScope.get().count = typeArgs.getCount(); this.length += shift; } @@ -1867,191 +1869,191 @@ public final class RowBuffer { this.WriteUInt8(offset, (byte)code.getValue()); } - public void WriteSparseUDT(tangible.RefObject edit, LayoutScope scopeType, Layout udt, - UpdateOptions options, tangible.OutObject newScope) { + public void WriteSparseUDT(RefObject edit, LayoutScope scopeType, Layout udt, + UpdateOptions options, OutObject newScope) { TypeArgumentList typeArgs = new TypeArgumentList(udt.getSchemaId().clone()); int numBytes = udt.getSize() + (LayoutCode.SIZE / Byte.SIZE); int metaBytes; - tangible.OutObject tempOut_metaBytes = new tangible.OutObject(); + OutObject tempOut_metaBytes = new OutObject(); int spaceNeeded; - tangible.OutObject tempOut_spaceNeeded = new tangible.OutObject(); + OutObject tempOut_spaceNeeded = new OutObject(); int shift; - tangible.OutObject tempOut_shift = new tangible.OutObject(); + OutObject tempOut_shift = new OutObject(); this.EnsureSparse(edit, scopeType, typeArgs.clone(), numBytes, options, tempOut_metaBytes, tempOut_spaceNeeded, tempOut_shift); - shift = tempOut_shift.argValue; - spaceNeeded = tempOut_spaceNeeded.argValue; - metaBytes = tempOut_metaBytes.argValue; + shift = tempOut_shift.get(); + spaceNeeded = tempOut_spaceNeeded.get(); + metaBytes = tempOut_metaBytes.get(); this.WriteSparseMetadata(edit, scopeType, typeArgs.clone(), metaBytes); // Clear all presence bits. - this.buffer.Slice(edit.argValue.valueOffset, udt.getSize()).Fill(0); + this.buffer.Slice(edit.get().valueOffset, udt.getSize()).Fill(0); // Write scope terminator. - int valueOffset = edit.argValue.valueOffset + udt.getSize(); + int valueOffset = edit.get().valueOffset + udt.getSize(); this.WriteSparseTypeCode(valueOffset, LayoutCode.EndScope); checkState(spaceNeeded == metaBytes + numBytes); - newScope.argValue = new RowCursor(); - newScope.argValue.scopeType = scopeType; - newScope.argValue.scopeTypeArgs = typeArgs.clone(); - newScope.argValue.start = edit.argValue.valueOffset; - newScope.argValue.valueOffset = valueOffset; - newScope.argValue.metaOffset = valueOffset; - newScope.argValue.layout = udt; + newScope.set(new RowCursor()); + newScope.get().scopeType = scopeType; + newScope.get().scopeTypeArgs = typeArgs.clone(); + newScope.get().start = edit.get().valueOffset; + newScope.get().valueOffset = valueOffset; + newScope.get().metaOffset = valueOffset; + newScope.get().layout = udt; this.length += shift; } //C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java: //ORIGINAL LINE: internal void WriteSparseUInt16(ref RowCursor edit, ushort value, UpdateOptions options) - public void WriteSparseUInt16(tangible.RefObject edit, short value, UpdateOptions options) { + public void WriteSparseUInt16(RefObject edit, short value, UpdateOptions options) { int numBytes = (Short.SIZE / Byte.SIZE); int metaBytes; - tangible.OutObject tempOut_metaBytes = new tangible.OutObject(); + OutObject tempOut_metaBytes = new OutObject(); int spaceNeeded; - tangible.OutObject tempOut_spaceNeeded = new tangible.OutObject(); + OutObject tempOut_spaceNeeded = new OutObject(); int shift; - tangible.OutObject tempOut_shift = new tangible.OutObject(); + OutObject tempOut_shift = new OutObject(); this.EnsureSparse(edit, LayoutType.UInt16, TypeArgumentList.Empty, numBytes, options, tempOut_metaBytes, tempOut_spaceNeeded, tempOut_shift); - shift = tempOut_shift.argValue; - spaceNeeded = tempOut_spaceNeeded.argValue; - metaBytes = tempOut_metaBytes.argValue; + shift = tempOut_shift.get(); + spaceNeeded = tempOut_spaceNeeded.get(); + metaBytes = tempOut_metaBytes.get(); this.WriteSparseMetadata(edit, LayoutType.UInt16, TypeArgumentList.Empty, metaBytes); - this.WriteUInt16(edit.argValue.valueOffset, value); + this.WriteUInt16(edit.get().valueOffset, value); checkState(spaceNeeded == metaBytes + (Short.SIZE / Byte.SIZE)); - edit.argValue.endOffset = edit.argValue.metaOffset + spaceNeeded; + edit.get().endOffset = edit.get().metaOffset + spaceNeeded; this.length += shift; } //C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java: //ORIGINAL LINE: internal void WriteSparseUInt32(ref RowCursor edit, uint value, UpdateOptions options) - public void WriteSparseUInt32(tangible.RefObject edit, int value, UpdateOptions options) { + public void WriteSparseUInt32(RefObject edit, int value, UpdateOptions options) { int numBytes = (Integer.SIZE / Byte.SIZE); int metaBytes; - tangible.OutObject tempOut_metaBytes = new tangible.OutObject(); + OutObject tempOut_metaBytes = new OutObject(); int spaceNeeded; - tangible.OutObject tempOut_spaceNeeded = new tangible.OutObject(); + OutObject tempOut_spaceNeeded = new OutObject(); int shift; - tangible.OutObject tempOut_shift = new tangible.OutObject(); + OutObject tempOut_shift = new OutObject(); this.EnsureSparse(edit, LayoutType.UInt32, TypeArgumentList.Empty, numBytes, options, tempOut_metaBytes, tempOut_spaceNeeded, tempOut_shift); - shift = tempOut_shift.argValue; - spaceNeeded = tempOut_spaceNeeded.argValue; - metaBytes = tempOut_metaBytes.argValue; + shift = tempOut_shift.get(); + spaceNeeded = tempOut_spaceNeeded.get(); + metaBytes = tempOut_metaBytes.get(); this.WriteSparseMetadata(edit, LayoutType.UInt32, TypeArgumentList.Empty, metaBytes); - this.WriteUInt32(edit.argValue.valueOffset, value); + this.WriteUInt32(edit.get().valueOffset, value); checkState(spaceNeeded == metaBytes + (Integer.SIZE / Byte.SIZE)); - edit.argValue.endOffset = edit.argValue.metaOffset + spaceNeeded; + edit.get().endOffset = edit.get().metaOffset + spaceNeeded; this.length += shift; } //C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java: //ORIGINAL LINE: internal void WriteSparseUInt64(ref RowCursor edit, ulong value, UpdateOptions options) - public void WriteSparseUInt64(tangible.RefObject edit, long value, UpdateOptions options) { + public void WriteSparseUInt64(RefObject edit, long value, UpdateOptions options) { int numBytes = (Long.SIZE / Byte.SIZE); int metaBytes; - tangible.OutObject tempOut_metaBytes = new tangible.OutObject(); + OutObject tempOut_metaBytes = new OutObject(); int spaceNeeded; - tangible.OutObject tempOut_spaceNeeded = new tangible.OutObject(); + OutObject tempOut_spaceNeeded = new OutObject(); int shift; - tangible.OutObject tempOut_shift = new tangible.OutObject(); + OutObject tempOut_shift = new OutObject(); this.EnsureSparse(edit, LayoutType.UInt64, TypeArgumentList.Empty, numBytes, options, tempOut_metaBytes, tempOut_spaceNeeded, tempOut_shift); - shift = tempOut_shift.argValue; - spaceNeeded = tempOut_spaceNeeded.argValue; - metaBytes = tempOut_metaBytes.argValue; + shift = tempOut_shift.get(); + spaceNeeded = tempOut_spaceNeeded.get(); + metaBytes = tempOut_metaBytes.get(); this.WriteSparseMetadata(edit, LayoutType.UInt64, TypeArgumentList.Empty, metaBytes); - this.WriteUInt64(edit.argValue.valueOffset, value); + this.WriteUInt64(edit.get().valueOffset, value); checkState(spaceNeeded == metaBytes + (Long.SIZE / Byte.SIZE)); - edit.argValue.endOffset = edit.argValue.metaOffset + spaceNeeded; + edit.get().endOffset = edit.get().metaOffset + spaceNeeded; this.length += shift; } //C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java: //ORIGINAL LINE: internal void WriteSparseUInt8(ref RowCursor edit, byte value, UpdateOptions options) - public void WriteSparseUInt8(tangible.RefObject edit, byte value, UpdateOptions options) { + public void WriteSparseUInt8(RefObject edit, byte value, UpdateOptions options) { int numBytes = 1; int metaBytes; - tangible.OutObject tempOut_metaBytes = new tangible.OutObject(); + OutObject tempOut_metaBytes = new OutObject(); int spaceNeeded; - tangible.OutObject tempOut_spaceNeeded = new tangible.OutObject(); + OutObject tempOut_spaceNeeded = new OutObject(); int shift; - tangible.OutObject tempOut_shift = new tangible.OutObject(); + OutObject tempOut_shift = new OutObject(); this.EnsureSparse(edit, LayoutType.UInt8, TypeArgumentList.Empty, numBytes, options, tempOut_metaBytes, tempOut_spaceNeeded, tempOut_shift); - shift = tempOut_shift.argValue; - spaceNeeded = tempOut_spaceNeeded.argValue; - metaBytes = tempOut_metaBytes.argValue; + shift = tempOut_shift.get(); + spaceNeeded = tempOut_spaceNeeded.get(); + metaBytes = tempOut_metaBytes.get(); this.WriteSparseMetadata(edit, LayoutType.UInt8, TypeArgumentList.Empty, metaBytes); - this.WriteUInt8(edit.argValue.valueOffset, value); + this.WriteUInt8(edit.get().valueOffset, value); checkState(spaceNeeded == metaBytes + 1); - edit.argValue.endOffset = edit.argValue.metaOffset + spaceNeeded; + edit.get().endOffset = edit.get().metaOffset + spaceNeeded; this.length += shift; } - public void WriteSparseUnixDateTime(tangible.RefObject edit, UnixDateTime value, UpdateOptions options) { + public void WriteSparseUnixDateTime(RefObject edit, UnixDateTime value, UpdateOptions options) { int numBytes = 8; int metaBytes; - tangible.OutObject tempOut_metaBytes = new tangible.OutObject(); + OutObject tempOut_metaBytes = new OutObject(); int spaceNeeded; - tangible.OutObject tempOut_spaceNeeded = new tangible.OutObject(); + OutObject tempOut_spaceNeeded = new OutObject(); int shift; - tangible.OutObject tempOut_shift = new tangible.OutObject(); + OutObject tempOut_shift = new OutObject(); this.EnsureSparse(edit, LayoutType.UnixDateTime, TypeArgumentList.Empty, numBytes, options, tempOut_metaBytes , tempOut_spaceNeeded, tempOut_shift); - shift = tempOut_shift.argValue; - spaceNeeded = tempOut_spaceNeeded.argValue; - metaBytes = tempOut_metaBytes.argValue; + shift = tempOut_shift.get(); + spaceNeeded = tempOut_spaceNeeded.get(); + metaBytes = tempOut_metaBytes.get(); this.WriteSparseMetadata(edit, LayoutType.UnixDateTime, TypeArgumentList.Empty, metaBytes); - this.WriteUnixDateTime(edit.argValue.valueOffset, value.clone()); + this.WriteUnixDateTime(edit.get().valueOffset, value.clone()); checkState(spaceNeeded == metaBytes + 8); - edit.argValue.endOffset = edit.argValue.metaOffset + spaceNeeded; + edit.get().endOffset = edit.get().metaOffset + spaceNeeded; this.length += shift; } - public void WriteSparseVarInt(tangible.RefObject edit, long value, UpdateOptions options) { + public void WriteSparseVarInt(RefObject edit, long value, UpdateOptions options) { int numBytes = RowBuffer.Count7BitEncodedInt(value); int metaBytes; - tangible.OutObject tempOut_metaBytes = new tangible.OutObject(); + OutObject tempOut_metaBytes = new OutObject(); int spaceNeeded; - tangible.OutObject tempOut_spaceNeeded = new tangible.OutObject(); + OutObject tempOut_spaceNeeded = new OutObject(); int shift; - tangible.OutObject tempOut_shift = new tangible.OutObject(); + OutObject tempOut_shift = new OutObject(); this.EnsureSparse(edit, LayoutType.VarInt, TypeArgumentList.Empty, numBytes, options, tempOut_metaBytes, tempOut_spaceNeeded, tempOut_shift); - shift = tempOut_shift.argValue; - spaceNeeded = tempOut_spaceNeeded.argValue; - metaBytes = tempOut_metaBytes.argValue; + shift = tempOut_shift.get(); + spaceNeeded = tempOut_spaceNeeded.get(); + metaBytes = tempOut_metaBytes.get(); this.WriteSparseMetadata(edit, LayoutType.VarInt, TypeArgumentList.Empty, metaBytes); - int sizeLenInBytes = this.Write7BitEncodedInt(edit.argValue.valueOffset, value); + int sizeLenInBytes = this.Write7BitEncodedInt(edit.get().valueOffset, value); checkState(sizeLenInBytes == numBytes); checkState(spaceNeeded == metaBytes + sizeLenInBytes); - edit.argValue.endOffset = edit.argValue.metaOffset + spaceNeeded; + edit.get().endOffset = edit.get().metaOffset + spaceNeeded; this.length += shift; } //C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java: //ORIGINAL LINE: internal void WriteSparseVarUInt(ref RowCursor edit, ulong value, UpdateOptions options) - public void WriteSparseVarUInt(tangible.RefObject edit, long value, UpdateOptions options) { + public void WriteSparseVarUInt(RefObject edit, long value, UpdateOptions options) { int numBytes = RowBuffer.Count7BitEncodedUInt(value); int metaBytes; - tangible.OutObject tempOut_metaBytes = new tangible.OutObject(); + OutObject tempOut_metaBytes = new OutObject(); int spaceNeeded; - tangible.OutObject tempOut_spaceNeeded = new tangible.OutObject(); + OutObject tempOut_spaceNeeded = new OutObject(); int shift; - tangible.OutObject tempOut_shift = new tangible.OutObject(); + OutObject tempOut_shift = new OutObject(); this.EnsureSparse(edit, LayoutType.VarUInt, TypeArgumentList.Empty, numBytes, options, tempOut_metaBytes, tempOut_spaceNeeded, tempOut_shift); - shift = tempOut_shift.argValue; - spaceNeeded = tempOut_spaceNeeded.argValue; - metaBytes = tempOut_metaBytes.argValue; + shift = tempOut_shift.get(); + spaceNeeded = tempOut_spaceNeeded.get(); + metaBytes = tempOut_metaBytes.get(); this.WriteSparseMetadata(edit, LayoutType.VarUInt, TypeArgumentList.Empty, metaBytes); - int sizeLenInBytes = this.Write7BitEncodedUInt(edit.argValue.valueOffset, value); + int sizeLenInBytes = this.Write7BitEncodedUInt(edit.get().valueOffset, value); checkState(sizeLenInBytes == numBytes); checkState(spaceNeeded == metaBytes + sizeLenInBytes); - edit.argValue.endOffset = edit.argValue.metaOffset + spaceNeeded; + edit.get().endOffset = edit.get().metaOffset + spaceNeeded; this.length += shift; } @@ -2062,155 +2064,155 @@ public final class RowBuffer { stream.Write(this.buffer.Slice(0, this.length)); } - public void WriteTypedArray(tangible.RefObject edit, LayoutScope scopeType, TypeArgumentList typeArgs, - UpdateOptions options, tangible.OutObject newScope) { + public void WriteTypedArray(RefObject edit, LayoutScope scopeType, TypeArgumentList typeArgs, + UpdateOptions options, OutObject newScope) { int numBytes = (Integer.SIZE / Byte.SIZE); int metaBytes; - tangible.OutObject tempOut_metaBytes = new tangible.OutObject(); + OutObject tempOut_metaBytes = new OutObject(); int spaceNeeded; - tangible.OutObject tempOut_spaceNeeded = new tangible.OutObject(); + OutObject tempOut_spaceNeeded = new OutObject(); int shift; - tangible.OutObject tempOut_shift = new tangible.OutObject(); + OutObject tempOut_shift = new OutObject(); this.EnsureSparse(edit, scopeType, typeArgs.clone(), numBytes, options, tempOut_metaBytes, tempOut_spaceNeeded, tempOut_shift); - shift = tempOut_shift.argValue; - spaceNeeded = tempOut_spaceNeeded.argValue; - metaBytes = tempOut_metaBytes.argValue; + shift = tempOut_shift.get(); + spaceNeeded = tempOut_spaceNeeded.get(); + metaBytes = tempOut_metaBytes.get(); this.WriteSparseMetadata(edit, scopeType, typeArgs.clone(), metaBytes); checkState(spaceNeeded == metaBytes + numBytes); - this.WriteUInt32(edit.argValue.valueOffset, 0); - int valueOffset = edit.argValue.valueOffset + (Integer.SIZE / Byte.SIZE); // Point after the Size - newScope.argValue = new RowCursor(); - newScope.argValue.scopeType = scopeType; - newScope.argValue.scopeTypeArgs = typeArgs.clone(); - newScope.argValue.start = edit.argValue.valueOffset; - newScope.argValue.valueOffset = valueOffset; - newScope.argValue.metaOffset = valueOffset; - newScope.argValue.layout = edit.argValue.layout; + this.WriteUInt32(edit.get().valueOffset, 0); + int valueOffset = edit.get().valueOffset + (Integer.SIZE / Byte.SIZE); // Point after the Size + newScope.set(new RowCursor()); + newScope.get().scopeType = scopeType; + newScope.get().scopeTypeArgs = typeArgs.clone(); + newScope.get().start = edit.get().valueOffset; + newScope.get().valueOffset = valueOffset; + newScope.get().metaOffset = valueOffset; + newScope.get().layout = edit.get().layout; this.length += shift; } - public void WriteTypedMap(tangible.RefObject edit, LayoutScope scopeType, TypeArgumentList typeArgs, - UpdateOptions options, tangible.OutObject newScope) { + public void WriteTypedMap(RefObject edit, LayoutScope scopeType, TypeArgumentList typeArgs, + UpdateOptions options, OutObject newScope) { int numBytes = (Integer.SIZE / Byte.SIZE); // Sized scope. int metaBytes; - tangible.OutObject tempOut_metaBytes = new tangible.OutObject(); + OutObject tempOut_metaBytes = new OutObject(); int spaceNeeded; - tangible.OutObject tempOut_spaceNeeded = new tangible.OutObject(); + OutObject tempOut_spaceNeeded = new OutObject(); int shift; - tangible.OutObject tempOut_shift = new tangible.OutObject(); + OutObject tempOut_shift = new OutObject(); this.EnsureSparse(edit, scopeType, typeArgs.clone(), numBytes, options, tempOut_metaBytes, tempOut_spaceNeeded, tempOut_shift); - shift = tempOut_shift.argValue; - spaceNeeded = tempOut_spaceNeeded.argValue; - metaBytes = tempOut_metaBytes.argValue; + shift = tempOut_shift.get(); + spaceNeeded = tempOut_spaceNeeded.get(); + metaBytes = tempOut_metaBytes.get(); this.WriteSparseMetadata(edit, scopeType, typeArgs.clone(), metaBytes); checkState(spaceNeeded == metaBytes + numBytes); - this.WriteUInt32(edit.argValue.valueOffset, 0); - int valueOffset = edit.argValue.valueOffset + (Integer.SIZE / Byte.SIZE); // Point after the Size - newScope.argValue = new RowCursor(); - newScope.argValue.scopeType = scopeType; - newScope.argValue.scopeTypeArgs = typeArgs.clone(); - newScope.argValue.start = edit.argValue.valueOffset; - newScope.argValue.valueOffset = valueOffset; - newScope.argValue.metaOffset = valueOffset; - newScope.argValue.layout = edit.argValue.layout; + this.WriteUInt32(edit.get().valueOffset, 0); + int valueOffset = edit.get().valueOffset + (Integer.SIZE / Byte.SIZE); // Point after the Size + newScope.set(new RowCursor()); + newScope.get().scopeType = scopeType; + newScope.get().scopeTypeArgs = typeArgs.clone(); + newScope.get().start = edit.get().valueOffset; + newScope.get().valueOffset = valueOffset; + newScope.get().metaOffset = valueOffset; + newScope.get().layout = edit.get().layout; this.length += shift; } - public void WriteTypedSet(tangible.RefObject edit, LayoutScope scopeType, TypeArgumentList typeArgs, - UpdateOptions options, tangible.OutObject newScope) { + public void WriteTypedSet(RefObject edit, LayoutScope scopeType, TypeArgumentList typeArgs, + UpdateOptions options, OutObject newScope) { int numBytes = (Integer.SIZE / Byte.SIZE); int metaBytes; - tangible.OutObject tempOut_metaBytes = new tangible.OutObject(); + OutObject tempOut_metaBytes = new OutObject(); int spaceNeeded; - tangible.OutObject tempOut_spaceNeeded = new tangible.OutObject(); + OutObject tempOut_spaceNeeded = new OutObject(); int shift; - tangible.OutObject tempOut_shift = new tangible.OutObject(); + OutObject tempOut_shift = new OutObject(); this.EnsureSparse(edit, scopeType, typeArgs.clone(), numBytes, options, tempOut_metaBytes, tempOut_spaceNeeded, tempOut_shift); - shift = tempOut_shift.argValue; - spaceNeeded = tempOut_spaceNeeded.argValue; - metaBytes = tempOut_metaBytes.argValue; + shift = tempOut_shift.get(); + spaceNeeded = tempOut_spaceNeeded.get(); + metaBytes = tempOut_metaBytes.get(); this.WriteSparseMetadata(edit, scopeType, typeArgs.clone(), metaBytes); checkState(spaceNeeded == metaBytes + numBytes); - this.WriteUInt32(edit.argValue.valueOffset, 0); - int valueOffset = edit.argValue.valueOffset + (Integer.SIZE / Byte.SIZE); // Point after the Size - newScope.argValue = new RowCursor(); - newScope.argValue.scopeType = scopeType; - newScope.argValue.scopeTypeArgs = typeArgs.clone(); - newScope.argValue.start = edit.argValue.valueOffset; - newScope.argValue.valueOffset = valueOffset; - newScope.argValue.metaOffset = valueOffset; - newScope.argValue.layout = edit.argValue.layout; + this.WriteUInt32(edit.get().valueOffset, 0); + int valueOffset = edit.get().valueOffset + (Integer.SIZE / Byte.SIZE); // Point after the Size + newScope.set(new RowCursor()); + newScope.get().scopeType = scopeType; + newScope.get().scopeTypeArgs = typeArgs.clone(); + newScope.get().start = edit.get().valueOffset; + newScope.get().valueOffset = valueOffset; + newScope.get().metaOffset = valueOffset; + newScope.get().layout = edit.get().layout; this.length += shift; } - public void WriteTypedTuple(tangible.RefObject edit, LayoutScope scopeType, TypeArgumentList typeArgs, - UpdateOptions options, tangible.OutObject newScope) { + public void WriteTypedTuple(RefObject edit, LayoutScope scopeType, TypeArgumentList typeArgs, + UpdateOptions options, OutObject newScope) { int numBytes = this.CountDefaultValue(scopeType, typeArgs.clone()); int metaBytes; - tangible.OutObject tempOut_metaBytes = new tangible.OutObject(); + OutObject tempOut_metaBytes = new OutObject(); int spaceNeeded; - tangible.OutObject tempOut_spaceNeeded = new tangible.OutObject(); + OutObject tempOut_spaceNeeded = new OutObject(); int shift; - tangible.OutObject tempOut_shift = new tangible.OutObject(); + OutObject tempOut_shift = new OutObject(); this.EnsureSparse(edit, scopeType, typeArgs.clone(), numBytes, options, tempOut_metaBytes, tempOut_spaceNeeded, tempOut_shift); - shift = tempOut_shift.argValue; - spaceNeeded = tempOut_spaceNeeded.argValue; - metaBytes = tempOut_metaBytes.argValue; + shift = tempOut_shift.get(); + spaceNeeded = tempOut_spaceNeeded.get(); + metaBytes = tempOut_metaBytes.get(); this.WriteSparseMetadata(edit, scopeType, typeArgs.clone(), metaBytes); - int numWritten = this.WriteDefaultValue(edit.argValue.valueOffset, scopeType, typeArgs.clone()); + int numWritten = this.WriteDefaultValue(edit.get().valueOffset, scopeType, typeArgs.clone()); checkState(numBytes == numWritten); checkState(spaceNeeded == metaBytes + numBytes); - newScope.argValue = new RowCursor(); - newScope.argValue.scopeType = scopeType; - newScope.argValue.scopeTypeArgs = typeArgs.clone(); - newScope.argValue.start = edit.argValue.valueOffset; - newScope.argValue.valueOffset = edit.argValue.valueOffset; - newScope.argValue.metaOffset = edit.argValue.valueOffset; - newScope.argValue.layout = edit.argValue.layout; - newScope.argValue.count = typeArgs.getCount(); + newScope.set(new RowCursor()); + newScope.get().scopeType = scopeType; + newScope.get().scopeTypeArgs = typeArgs.clone(); + newScope.get().start = edit.get().valueOffset; + newScope.get().valueOffset = edit.get().valueOffset; + newScope.get().metaOffset = edit.get().valueOffset; + newScope.get().layout = edit.get().layout; + newScope.get().count = typeArgs.getCount(); this.length += shift; - tangible.RefObject tempRef_this = - new tangible.RefObject(this); - azure.data.cosmos.serialization.hybridrow.RowCursorExtensions.MoveNext(newScope.argValue.clone(), tempRef_this); - this = tempRef_this.argValue; + RefObject tempRef_this = + new RefObject(this); + RowCursorExtensions.MoveNext(newScope.get().clone(), tempRef_this); + this = tempRef_this.get(); } //C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java: //ORIGINAL LINE: internal void WriteUInt16(int offset, ushort value) public void WriteUInt16(int offset, short value) { - tangible.RefObject tempRef_value = new tangible.RefObject(value); + RefObject tempRef_value = new RefObject(value); //C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java: //ORIGINAL LINE: MemoryMarshal.Write(this.buffer.Slice(offset), ref value); MemoryMarshal.Write(this.buffer.Slice(offset), tempRef_value); - value = tempRef_value.argValue; + value = tempRef_value.get(); } //C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java: //ORIGINAL LINE: internal void WriteUInt32(int offset, uint value) public void WriteUInt32(int offset, int value) { - tangible.RefObject tempRef_value = new tangible.RefObject(value); + RefObject tempRef_value = new RefObject(value); //C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java: //ORIGINAL LINE: MemoryMarshal.Write(this.buffer.Slice(offset), ref value); MemoryMarshal.Write(this.buffer.Slice(offset), tempRef_value); - value = tempRef_value.argValue; + value = tempRef_value.get(); } //C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java: //ORIGINAL LINE: internal void WriteUInt64(int offset, ulong value) public void WriteUInt64(int offset, long value) { - tangible.RefObject tempRef_value = new tangible.RefObject(value); + RefObject tempRef_value = new RefObject(value); //C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java: //ORIGINAL LINE: MemoryMarshal.Write(this.buffer.Slice(offset), ref value); MemoryMarshal.Write(this.buffer.Slice(offset), tempRef_value); - value = tempRef_value.argValue; + value = tempRef_value.get(); } // TODO: C# TO JAVA CONVERTER: Java annotations will not correspond to .NET attributes: @@ -2222,81 +2224,81 @@ public final class RowBuffer { } public void WriteUnixDateTime(int offset, UnixDateTime value) { - tangible.RefObject tempRef_value = - new tangible.RefObject(value); + RefObject tempRef_value = + new RefObject(value); MemoryMarshal.Write(this.buffer.Slice(offset), tempRef_value); - value = tempRef_value.argValue; + value = tempRef_value.get(); } //C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java: //ORIGINAL LINE: internal void WriteVariableBinary(int offset, ReadOnlySpan value, bool exists, out int shift) public void WriteVariableBinary(int offset, ReadOnlySpan value, boolean exists, - tangible.OutObject shift) { + OutObject shift) { int numBytes = value.Length; int spaceNeeded; - tangible.OutObject tempOut_spaceNeeded = new tangible.OutObject(); + OutObject tempOut_spaceNeeded = new OutObject(); this.EnsureVariable(offset, false, numBytes, exists, tempOut_spaceNeeded, shift); - spaceNeeded = tempOut_spaceNeeded.argValue; + spaceNeeded = tempOut_spaceNeeded.get(); int sizeLenInBytes = this.WriteBinary(offset, value); checkState(spaceNeeded == numBytes + sizeLenInBytes); - this.length += shift.argValue; + this.length += shift.get(); } //C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java: //ORIGINAL LINE: internal void WriteVariableBinary(int offset, ReadOnlySequence value, bool exists, out int // shift) public void WriteVariableBinary(int offset, ReadOnlySequence value, boolean exists, - tangible.OutObject shift) { + OutObject shift) { int numBytes = (int)value.Length; int spaceNeeded; - tangible.OutObject tempOut_spaceNeeded = new tangible.OutObject(); + OutObject tempOut_spaceNeeded = new OutObject(); this.EnsureVariable(offset, false, numBytes, exists, tempOut_spaceNeeded, shift); - spaceNeeded = tempOut_spaceNeeded.argValue; + spaceNeeded = tempOut_spaceNeeded.get(); int sizeLenInBytes = this.WriteBinary(offset, value); checkState(spaceNeeded == numBytes + sizeLenInBytes); - this.length += shift.argValue; + this.length += shift.get(); } - public void WriteVariableInt(int offset, long value, boolean exists, tangible.OutObject shift) { + public void WriteVariableInt(int offset, long value, boolean exists, OutObject shift) { int numBytes = RowBuffer.Count7BitEncodedInt(value); int spaceNeeded; - tangible.OutObject tempOut_spaceNeeded = new tangible.OutObject(); + OutObject tempOut_spaceNeeded = new OutObject(); this.EnsureVariable(offset, true, numBytes, exists, tempOut_spaceNeeded, shift); - spaceNeeded = tempOut_spaceNeeded.argValue; + spaceNeeded = tempOut_spaceNeeded.get(); int sizeLenInBytes = this.Write7BitEncodedInt(offset, value); checkState(sizeLenInBytes == numBytes); checkState(spaceNeeded == numBytes); - this.length += shift.argValue; + this.length += shift.get(); } - public void WriteVariableString(int offset, Utf8Span value, boolean exists, tangible.OutObject shift) { + public void WriteVariableString(int offset, Utf8Span value, boolean exists, OutObject shift) { int numBytes = value.Length; int spaceNeeded; - tangible.OutObject tempOut_spaceNeeded = new tangible.OutObject(); + OutObject tempOut_spaceNeeded = new OutObject(); this.EnsureVariable(offset, false, numBytes, exists, tempOut_spaceNeeded, shift); - spaceNeeded = tempOut_spaceNeeded.argValue; + spaceNeeded = tempOut_spaceNeeded.get(); int sizeLenInBytes = this.WriteString(offset, value); checkState(spaceNeeded == numBytes + sizeLenInBytes); - this.length += shift.argValue; + this.length += shift.get(); } //C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java: //ORIGINAL LINE: internal void WriteVariableUInt(int offset, ulong value, bool exists, out int shift) - public void WriteVariableUInt(int offset, long value, boolean exists, tangible.OutObject shift) { + public void WriteVariableUInt(int offset, long value, boolean exists, OutObject shift) { int numBytes = RowBuffer.Count7BitEncodedUInt(value); int spaceNeeded; - tangible.OutObject tempOut_spaceNeeded = new tangible.OutObject(); + OutObject tempOut_spaceNeeded = new OutObject(); this.EnsureVariable(offset, true, numBytes, exists, tempOut_spaceNeeded, shift); - spaceNeeded = tempOut_spaceNeeded.argValue; + spaceNeeded = tempOut_spaceNeeded.get(); int sizeLenInBytes = this.Write7BitEncodedUInt(offset, value); checkState(sizeLenInBytes == numBytes); checkState(spaceNeeded == numBytes); - this.length += shift.argValue; + this.length += shift.get(); } public RowBuffer clone() { @@ -2382,15 +2384,15 @@ public final class RowBuffer { leftKey.metaOffset = left.valueOffset; leftKey.index = 0; - tangible.RefObject tempRef_leftKey = - new tangible.RefObject(leftKey); + RefObject tempRef_leftKey = + new RefObject(leftKey); this.ReadSparseMetadata(tempRef_leftKey); - leftKey = tempRef_leftKey.argValue; + leftKey = tempRef_leftKey.get(); checkState(leftKey.pathOffset == 0); - tangible.RefObject tempRef_leftKey2 = - new tangible.RefObject(leftKey); + RefObject tempRef_leftKey2 = + new RefObject(leftKey); int leftKeyLen = this.SparseComputeSize(tempRef_leftKey2) - (leftKey.valueOffset - leftKey.metaOffset); - leftKey = tempRef_leftKey2.argValue; + leftKey = tempRef_leftKey2.get(); RowCursor rightKey = new RowCursor(); rightKey.layout = right.layout; @@ -2400,15 +2402,15 @@ public final class RowBuffer { rightKey.metaOffset = right.valueOffset; rightKey.index = 0; - tangible.RefObject tempRef_rightKey = - new tangible.RefObject(rightKey); + RefObject tempRef_rightKey = + new RefObject(rightKey); this.ReadSparseMetadata(tempRef_rightKey); - rightKey = tempRef_rightKey.argValue; + rightKey = tempRef_rightKey.get(); checkState(rightKey.pathOffset == 0); - tangible.RefObject tempRef_rightKey2 = - new tangible.RefObject(rightKey); + RefObject tempRef_rightKey2 = + new RefObject(rightKey); int rightKeyLen = this.SparseComputeSize(tempRef_rightKey2) - (rightKey.valueOffset - rightKey.metaOffset); - rightKey = tempRef_rightKey2.argValue; + rightKey = tempRef_rightKey2.get(); return this.CompareFieldValue(leftKey.clone(), leftKeyLen, rightKey.clone(), rightKeyLen); } @@ -2623,31 +2625,31 @@ public final class RowBuffer { return udt.getSize() + (LayoutCode.SIZE / Byte.SIZE); default: - Contract.Fail(String.format("Not Implemented: %1$s", code)); + throw new IllegalStateException(lenientFormat("Not Implemented: %s", code)); return 0; } } - private static int CountSparsePath(tangible.RefObject edit) { - if (!edit.argValue.writePathToken.getIsNull()) { - return edit.argValue.writePathToken.Varint.length; + private static int CountSparsePath(RefObject edit) { + if (!edit.get().writePathToken.getIsNull()) { + return edit.get().writePathToken.Varint.length; } - tangible.OutObject tempOut_writePathToken = - new tangible.OutObject(); - if (edit.argValue.layout.getTokenizer().TryFindToken(edit.argValue.writePath, tempOut_writePathToken)) { - edit.argValue.argValue.writePathToken = tempOut_writePathToken.argValue; - return edit.argValue.writePathToken.Varint.length; + OutObject tempOut_writePathToken = + new OutObject(); + if (edit.get().layout.getTokenizer().TryFindToken(edit.get().writePath, tempOut_writePathToken)) { + edit.get().argValue.writePathToken = tempOut_writePathToken.get(); + return edit.get().writePathToken.Varint.length; } else { - edit.argValue.argValue.writePathToken = tempOut_writePathToken.argValue; + edit.get().argValue.writePathToken = tempOut_writePathToken.get(); } - int numBytes = edit.argValue.writePath.ToUtf8String().Length; + int numBytes = edit.get().writePath.ToUtf8String().Length; //C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java: //ORIGINAL LINE: int sizeLenInBytes = RowBuffer.Count7BitEncodedUInt((ulong)(edit.layout.Tokenizer.Count + // numBytes)); int sizeLenInBytes = - RowBuffer.Count7BitEncodedUInt((long)(edit.argValue.layout.getTokenizer().getCount() + numBytes)); + RowBuffer.Count7BitEncodedUInt((long)(edit.get().layout.getTokenizer().getCount() + numBytes)); return sizeLenInBytes + numBytes; } @@ -2666,9 +2668,9 @@ public final class RowBuffer { //ORIGINAL LINE: [MethodImpl(MethodImplOptions.AggressiveInlining)] private void EnsureSparse(ref RowCursor edit, // LayoutType cellType, TypeArgumentList typeArgs, int numBytes, UpdateOptions options, out int metaBytes, out // int spaceNeeded, out int shift) - private void EnsureSparse(tangible.RefObject edit, LayoutType cellType, TypeArgumentList typeArgs, - int numBytes, UpdateOptions options, tangible.OutObject metaBytes, - tangible.OutObject spaceNeeded, tangible.OutObject shift) { + private void EnsureSparse(RefObject edit, LayoutType cellType, TypeArgumentList typeArgs, + int numBytes, UpdateOptions options, OutObject metaBytes, + OutObject spaceNeeded, OutObject shift) { this.EnsureSparse(edit, cellType, typeArgs.clone(), numBytes, RowOptions.forValue(options), metaBytes, spaceNeeded, shift); } @@ -2689,100 +2691,100 @@ public final class RowBuffer { * @param shift On success, the number of bytes the length of the row buffer was increased * (which may be negative if the row buffer was shrunk). */ - private void EnsureSparse(tangible.RefObject edit, LayoutType cellType, TypeArgumentList typeArgs, - int numBytes, RowOptions options, tangible.OutObject metaBytes, - tangible.OutObject spaceNeeded, - tangible.OutObject shift) { - int metaOffset = edit.argValue.metaOffset; + private void EnsureSparse(RefObject edit, LayoutType cellType, TypeArgumentList typeArgs, + int numBytes, RowOptions options, OutObject metaBytes, + OutObject spaceNeeded, + OutObject shift) { + int metaOffset = edit.get().metaOffset; int spaceAvailable = 0; // Compute the metadata offsets - if (edit.argValue.scopeType.HasImplicitTypeCode(edit)) { - metaBytes.argValue = 0; + if (edit.get().scopeType.HasImplicitTypeCode(edit)) { + metaBytes.set(0); } else { - metaBytes.argValue = cellType.CountTypeArgument(typeArgs.clone()); + metaBytes.set(cellType.CountTypeArgument(typeArgs.clone())); } - if (!edit.argValue.scopeType.IsIndexedScope) { - checkState(edit.argValue.writePath != null); + if (!edit.get().scopeType.IsIndexedScope) { + checkState(edit.get().writePath != null); int pathLenInBytes = RowBuffer.CountSparsePath(edit); - metaBytes.argValue += pathLenInBytes; + metaBytes.set(metaBytes.get() + pathLenInBytes); } - if (edit.argValue.exists) { + if (edit.get().exists) { // Compute value offset for existing value to be overwritten. spaceAvailable = this.SparseComputeSize(edit); } - spaceNeeded.argValue = options == RowOptions.Delete ? 0 : metaBytes.argValue + numBytes; - shift.argValue = spaceNeeded.argValue - spaceAvailable; - if (shift.argValue > 0) { - this.Ensure(this.length + shift.argValue); + spaceNeeded.set(options == RowOptions.Delete ? 0 : metaBytes.get() + numBytes); + shift.set(spaceNeeded.get() - spaceAvailable); + if (shift.get() > 0) { + this.Ensure(this.length + shift.get()); } - this.buffer.Slice(metaOffset + spaceAvailable, this.length - (metaOffset + spaceAvailable)).CopyTo(this.buffer.Slice(metaOffset + spaceNeeded.argValue)); + this.buffer.Slice(metaOffset + spaceAvailable, this.length - (metaOffset + spaceAvailable)).CopyTo(this.buffer.Slice(metaOffset + spaceNeeded.get())); // TODO: C# TO JAVA CONVERTER: There is no preprocessor in Java: //#if DEBUG - if (shift.argValue < 0) { + if (shift.get() < 0) { // Fill deleted bits (in debug builds) to detect overflow/alignment errors. - this.buffer.Slice(this.length + shift.argValue, -shift.argValue).Fill(0xFF); + this.buffer.Slice(this.length + shift.get(), -shift.get()).Fill(0xFF); } //#endif // Update the stored size (fixed arity scopes don't store the size because it is implied by the type args). - if (edit.argValue.scopeType.IsSizedScope && !edit.argValue.scopeType.IsFixedArity) { - if ((options == RowOptions.Insert) || (options == RowOptions.InsertAt) || ((options == RowOptions.Upsert) && !edit.argValue.exists)) { + if (edit.get().scopeType.IsSizedScope && !edit.get().scopeType.IsFixedArity) { + if ((options == RowOptions.Insert) || (options == RowOptions.InsertAt) || ((options == RowOptions.Upsert) && !edit.get().exists)) { // Add one to the current scope count. - checkState(!edit.argValue.exists); - this.IncrementUInt32(edit.argValue.start, 1); - edit.argValue.count++; - } else if ((options == RowOptions.Delete) && edit.argValue.exists) { + checkState(!edit.get().exists); + this.IncrementUInt32(edit.get().start, 1); + edit.get().count++; + } else if ((options == RowOptions.Delete) && edit.get().exists) { // Subtract one from the current scope count. - checkState(this.ReadUInt32(edit.argValue.start) > 0); - this.DecrementUInt32(edit.argValue.start, 1); - edit.argValue.count--; + checkState(this.ReadUInt32(edit.get().start) > 0); + this.DecrementUInt32(edit.get().start, 1); + edit.get().count--; } } if (options == RowOptions.Delete) { - edit.argValue.cellType = null; - edit.argValue.cellTypeArgs = null; - edit.argValue.exists = false; + edit.get().cellType = null; + edit.get().cellTypeArgs = null; + edit.get().exists = false; } else { - edit.argValue.cellType = cellType; - edit.argValue.cellTypeArgs = typeArgs.clone(); - edit.argValue.exists = true; + edit.get().cellType = cellType; + edit.get().cellTypeArgs = typeArgs.clone(); + edit.get().exists = true; } } private void EnsureVariable(int offset, boolean isVarint, int numBytes, boolean exists, - tangible.OutObject spaceNeeded, tangible.OutObject shift) { + OutObject spaceNeeded, OutObject shift) { int spaceAvailable = 0; //C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java: //ORIGINAL LINE: ulong existingValueBytes = 0; long existingValueBytes = 0; if (exists) { - tangible.OutObject tempOut_spaceAvailable = new tangible.OutObject(); + OutObject tempOut_spaceAvailable = new OutObject(); existingValueBytes = this.Read7BitEncodedUInt(offset, tempOut_spaceAvailable); - spaceAvailable = tempOut_spaceAvailable.argValue; + spaceAvailable = tempOut_spaceAvailable.get(); } if (isVarint) { - spaceNeeded.argValue = numBytes; + spaceNeeded.set(numBytes); } else { spaceAvailable += (int)existingValueBytes; // size already in spaceAvailable //C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java: //ORIGINAL LINE: spaceNeeded = numBytes + RowBuffer.Count7BitEncodedUInt((ulong)numBytes); - spaceNeeded.argValue = numBytes + RowBuffer.Count7BitEncodedUInt(numBytes); + spaceNeeded.set(numBytes + RowBuffer.Count7BitEncodedUInt(numBytes)); } - shift.argValue = spaceNeeded.argValue - spaceAvailable; - if (shift.argValue > 0) { - this.Ensure(this.length + shift.argValue); - this.buffer.Slice(offset + spaceAvailable, this.length - (offset + spaceAvailable)).CopyTo(this.buffer.Slice(offset + spaceNeeded.argValue)); - } else if (shift.argValue < 0) { - this.buffer.Slice(offset + spaceAvailable, this.length - (offset + spaceAvailable)).CopyTo(this.buffer.Slice(offset + spaceNeeded.argValue)); + shift.set(spaceNeeded.get() - spaceAvailable); + if (shift.get() > 0) { + this.Ensure(this.length + shift.get()); + this.buffer.Slice(offset + spaceAvailable, this.length - (offset + spaceAvailable)).CopyTo(this.buffer.Slice(offset + spaceNeeded.get())); + } else if (shift.get() < 0) { + this.buffer.Slice(offset + spaceAvailable, this.length - (offset + spaceAvailable)).CopyTo(this.buffer.Slice(offset + spaceNeeded.get())); } } @@ -2795,8 +2797,7 @@ public final class RowBuffer { private boolean InitReadFrom(HybridRowVersion rowVersion) { HybridRowHeader header = this.ReadHeader(0).clone(); Layout layout = this.resolver.Resolve(header.getSchemaId().clone()); - Contract.Assert(azure.data.cosmos.serialization.hybridrow.SchemaId.opEquals(header.getSchemaId().clone(), - layout.getSchemaId().clone())); + checkState(SchemaId.opEquals(header.getSchemaId().clone(), layout.getSchemaId().clone())); return (header.getVersion() == rowVersion) && (HybridRowHeader.Size + layout.getSize() <= this.length); } @@ -2826,10 +2827,10 @@ public final class RowBuffer { * best choice. *

*/ - private boolean InsertionSort(tangible.RefObject scope, tangible.RefObject dstEdit, + private boolean InsertionSort(RefObject scope, RefObject dstEdit, Span uniqueIndex) { - RowCursor leftEdit = dstEdit.argValue.clone(); - RowCursor rightEdit = dstEdit.argValue.clone(); + RowCursor leftEdit = dstEdit.get().clone(); + RowCursor rightEdit = dstEdit.get().clone(); for (int i = 1; i < uniqueIndex.Length; i++) { UniqueIndexItem x = uniqueIndex[i]; @@ -2847,7 +2848,7 @@ public final class RowBuffer { rightEdit.valueOffset = y.ValueOffset; int cmp; - if (scope.argValue.scopeType instanceof LayoutTypedMap) { + if (scope.get().scopeType instanceof LayoutTypedMap) { cmp = this.CompareKeyValueFieldValue(leftEdit.clone(), rightEdit.clone()); } else { int rightBytes = y.Size - (y.ValueOffset - y.MetaOffset); @@ -2876,9 +2877,9 @@ public final class RowBuffer { //C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java: //ORIGINAL LINE: private ReadOnlySpan ReadBinary(int offset, out int sizeLenInBytes) - private ReadOnlySpan ReadBinary(int offset, tangible.OutObject sizeLenInBytes) { + private ReadOnlySpan ReadBinary(int offset, OutObject sizeLenInBytes) { int numBytes = (int)this.Read7BitEncodedUInt(offset, sizeLenInBytes); - return this.buffer.Slice(offset + sizeLenInBytes.argValue, numBytes); + return this.buffer.Slice(offset + sizeLenInBytes.get(), numBytes); } /** @@ -2907,89 +2908,89 @@ public final class RowBuffer { * undefined. * . */ - private void ReadSparseMetadata(tangible.RefObject edit) { - if (edit.argValue.scopeType.HasImplicitTypeCode(edit)) { - edit.argValue.scopeType.SetImplicitTypeCode(edit); - edit.argValue.valueOffset = edit.argValue.metaOffset; + private void ReadSparseMetadata(RefObject edit) { + if (edit.get().scopeType.HasImplicitTypeCode(edit)) { + edit.get().scopeType.SetImplicitTypeCode(edit); + edit.get().valueOffset = edit.get().metaOffset; } else { - edit.argValue.cellType = this.ReadSparseTypeCode(edit.argValue.metaOffset); - edit.argValue.valueOffset = edit.argValue.metaOffset + (LayoutCode.SIZE / Byte.SIZE); - edit.argValue.cellTypeArgs = TypeArgumentList.Empty; - if (edit.argValue.cellType instanceof LayoutEndScope) { + edit.get().cellType = this.ReadSparseTypeCode(edit.get().metaOffset); + edit.get().valueOffset = edit.get().metaOffset + (LayoutCode.SIZE / Byte.SIZE); + edit.get().cellTypeArgs = TypeArgumentList.Empty; + if (edit.get().cellType instanceof LayoutEndScope) { // Reached end of current scope without finding another field. - edit.argValue.pathToken = 0; - edit.argValue.pathOffset = 0; - edit.argValue.valueOffset = edit.argValue.metaOffset; + edit.get().pathToken = 0; + edit.get().pathOffset = 0; + edit.get().valueOffset = edit.get().metaOffset; return; } - tangible.RefObject tempRef_this = - new tangible.RefObject(this); + RefObject tempRef_this = + new RefObject(this); int sizeLenInBytes; - tangible.OutObject tempOut_sizeLenInBytes = new tangible.OutObject(); - edit.argValue.cellTypeArgs = edit.argValue.cellType.ReadTypeArgumentList(tempRef_this, - edit.argValue.valueOffset, tempOut_sizeLenInBytes).clone(); - sizeLenInBytes = tempOut_sizeLenInBytes.argValue; - this = tempRef_this.argValue; - edit.argValue.valueOffset += sizeLenInBytes; + OutObject tempOut_sizeLenInBytes = new OutObject(); + edit.get().cellTypeArgs = edit.get().cellType.ReadTypeArgumentList(tempRef_this, + edit.get().valueOffset, tempOut_sizeLenInBytes).clone(); + sizeLenInBytes = tempOut_sizeLenInBytes.get(); + this = tempRef_this.get(); + edit.get().valueOffset += sizeLenInBytes; } - tangible.RefObject tempRef_this2 = - new tangible.RefObject(this); - edit.argValue.scopeType.ReadSparsePath(tempRef_this2, edit); - this = tempRef_this2.argValue; + RefObject tempRef_this2 = + new RefObject(this); + edit.get().scopeType.ReadSparsePath(tempRef_this2, edit); + this = tempRef_this2.get(); } // TODO: C# TO JAVA CONVERTER: Java annotations will not correspond to .NET attributes: //ORIGINAL LINE: [Conditional("DEBUG")] private void ReadSparsePrimitiveTypeCode(ref RowCursor edit, LayoutType // code) - private void ReadSparsePrimitiveTypeCode(tangible.RefObject edit, LayoutType code) { - checkState(edit.argValue.exists); + private void ReadSparsePrimitiveTypeCode(RefObject edit, LayoutType code) { + checkState(edit.get().exists); - if (edit.argValue.scopeType.HasImplicitTypeCode(edit)) { - if (edit.argValue.scopeType instanceof LayoutNullable) { - checkState(edit.argValue.scopeTypeArgs.getCount() == 1); - checkState(edit.argValue.index == 1); - checkState(edit.argValue.scopeTypeArgs.get(0).getType() == code); - checkState(edit.argValue.scopeTypeArgs.get(0).getTypeArgs().getCount() == 0); - } else if (edit.argValue.scopeType.IsFixedArity) { - checkState(edit.argValue.scopeTypeArgs.getCount() > edit.argValue.index); - checkState(edit.argValue.scopeTypeArgs.get(edit.argValue.index).getType() == code); - checkState(edit.argValue.scopeTypeArgs.get(edit.argValue.index).getTypeArgs().getCount() == 0); + if (edit.get().scopeType.HasImplicitTypeCode(edit)) { + if (edit.get().scopeType instanceof LayoutNullable) { + checkState(edit.get().scopeTypeArgs.getCount() == 1); + checkState(edit.get().index == 1); + checkState(edit.get().scopeTypeArgs.get(0).getType() == code); + checkState(edit.get().scopeTypeArgs.get(0).getTypeArgs().getCount() == 0); + } else if (edit.get().scopeType.IsFixedArity) { + checkState(edit.get().scopeTypeArgs.getCount() > edit.get().index); + checkState(edit.get().scopeTypeArgs.get(edit.get().index).getType() == code); + checkState(edit.get().scopeTypeArgs.get(edit.get().index).getTypeArgs().getCount() == 0); } else { - checkState(edit.argValue.scopeTypeArgs.getCount() == 1); - checkState(edit.argValue.scopeTypeArgs.get(0).getType() == code); - checkState(edit.argValue.scopeTypeArgs.get(0).getTypeArgs().getCount() == 0); + checkState(edit.get().scopeTypeArgs.getCount() == 1); + checkState(edit.get().scopeTypeArgs.get(0).getType() == code); + checkState(edit.get().scopeTypeArgs.get(0).getTypeArgs().getCount() == 0); } } else { if (code == LayoutType.Boolean) { - code = this.ReadSparseTypeCode(edit.argValue.metaOffset); + code = this.ReadSparseTypeCode(edit.get().metaOffset); checkState(code == LayoutType.Boolean || code == LayoutType.BooleanFalse); } else { - checkState(this.ReadSparseTypeCode(edit.argValue.metaOffset) == code); + checkState(this.ReadSparseTypeCode(edit.get().metaOffset) == code); } } - if (edit.argValue.scopeType.IsIndexedScope) { - checkState(edit.argValue.pathOffset == 0); - checkState(edit.argValue.pathToken == 0); + if (edit.get().scopeType.IsIndexedScope) { + checkState(edit.get().pathOffset == 0); + checkState(edit.get().pathToken == 0); } else { int _; - tangible.OutObject tempOut__ = new tangible.OutObject(); + OutObject tempOut__ = new OutObject(); int pathOffset; - tangible.OutObject tempOut_pathOffset = new tangible.OutObject(); - int token = this.ReadSparsePathLen(edit.argValue.layout, - edit.argValue.metaOffset + (LayoutCode.SIZE / Byte.SIZE), tempOut__, tempOut_pathOffset); - pathOffset = tempOut_pathOffset.argValue; - _ = tempOut__.argValue; - checkState(edit.argValue.pathOffset == pathOffset); - checkState(edit.argValue.pathToken == token); + OutObject tempOut_pathOffset = new OutObject(); + int token = this.ReadSparsePathLen(edit.get().layout, + edit.get().metaOffset + (LayoutCode.SIZE / Byte.SIZE), tempOut__, tempOut_pathOffset); + pathOffset = tempOut_pathOffset.get(); + _ = tempOut__.get(); + checkState(edit.get().pathOffset == pathOffset); + checkState(edit.get().pathToken == token); } } - private Utf8Span ReadString(int offset, tangible.OutObject sizeLenInBytes) { + private Utf8Span ReadString(int offset, OutObject sizeLenInBytes) { int numBytes = (int)this.Read7BitEncodedUInt(offset, sizeLenInBytes); - return Utf8Span.UnsafeFromUtf8BytesNoValidation(this.buffer.Slice(offset + sizeLenInBytes.argValue, numBytes)); + return Utf8Span.UnsafeFromUtf8BytesNoValidation(this.buffer.Slice(offset + sizeLenInBytes.get(), numBytes)); } /** @@ -2998,15 +2999,15 @@ public final class RowBuffer { * @param edit The sparse scope to search. * @return The 0-based byte offset immediately following the scope end marker. */ - private int SkipScope(tangible.RefObject edit) { + private int SkipScope(RefObject edit) { while (this.SparseIteratorMoveNext(edit)) { } - if (!edit.argValue.scopeType.IsSizedScope) { - edit.argValue.metaOffset += (LayoutCode.SIZE / Byte.SIZE); // Move past the end of scope marker. + if (!edit.get().scopeType.IsSizedScope) { + edit.get().metaOffset += (LayoutCode.SIZE / Byte.SIZE); // Move past the end of scope marker. } - return edit.argValue.metaOffset; + return edit.get().metaOffset; } /** @@ -3086,25 +3087,25 @@ public final class RowBuffer { ///#pragma warning disable SA1137 // Elements should have the same indentation { int sizeLenInBytes; - tangible.OutObject tempOut_sizeLenInBytes = new tangible.OutObject(); + OutObject tempOut_sizeLenInBytes = new OutObject(); int numBytes = (int)this.Read7BitEncodedUInt(metaOffset + metaBytes, tempOut_sizeLenInBytes); - sizeLenInBytes = tempOut_sizeLenInBytes.argValue; + sizeLenInBytes = tempOut_sizeLenInBytes.get(); return metaBytes + sizeLenInBytes + numBytes; } case VarInt: case VarUInt: { int sizeLenInBytes; - tangible.OutObject tempOut_sizeLenInBytes2 = new tangible.OutObject(); + OutObject tempOut_sizeLenInBytes2 = new OutObject(); this.Read7BitEncodedUInt(metaOffset + metaBytes, tempOut_sizeLenInBytes2); - sizeLenInBytes = tempOut_sizeLenInBytes2.argValue; + sizeLenInBytes = tempOut_sizeLenInBytes2.get(); return metaBytes + sizeLenInBytes; } // TODO: C# TO JAVA CONVERTER: There is no preprocessor in Java: ///#pragma warning restore SA1137 // Elements should have the same indentation default: - Contract.Fail(String.format("Not Implemented: %1$s", code)); + throw new IllegalStateException(lenientFormat("Not Implemented: %s", code)); return 0; } } @@ -3115,18 +3116,18 @@ public final class RowBuffer { * @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. */ - private int SparseComputeSize(tangible.RefObject edit) { - if (!(edit.argValue.cellType instanceof LayoutScope)) { - return this.SparseComputePrimitiveSize(edit.argValue.cellType, edit.argValue.metaOffset, - edit.argValue.valueOffset); + private int SparseComputeSize(RefObject edit) { + if (!(edit.get().cellType instanceof LayoutScope)) { + return this.SparseComputePrimitiveSize(edit.get().cellType, edit.get().metaOffset, + edit.get().valueOffset); } // Compute offset to end of value for current value. RowCursor newScope = this.SparseIteratorReadScope(edit, true).clone(); - tangible.RefObject tempRef_newScope = - new tangible.RefObject(newScope); - int tempVar = this.SkipScope(tempRef_newScope) - edit.argValue.metaOffset; - newScope = tempRef_newScope.argValue; + RefObject tempRef_newScope = + new RefObject(newScope); + int tempVar = this.SkipScope(tempRef_newScope) - edit.get().metaOffset; + newScope = tempRef_newScope.get(); return tempVar; } @@ -3378,51 +3379,51 @@ public final class RowBuffer { return udt.getSize() + (LayoutCode.SIZE / Byte.SIZE); default: - Contract.Fail(String.format("Not Implemented: %1$s", code)); + throw new IllegalStateException(lenientFormat("Not Implemented: %s", code)); return 0; } } - private void WriteSparseMetadata(tangible.RefObject edit, LayoutType cellType, - TypeArgumentList typeArgs, int metaBytes) { - int metaOffset = edit.argValue.metaOffset; - if (!edit.argValue.scopeType.HasImplicitTypeCode(edit)) { - tangible.RefObject tempRef_this = - new tangible.RefObject(this); + private void WriteSparseMetadata(RefObject edit, LayoutType cellType, + TypeArgumentList typeArgs, int metaBytes) { + int metaOffset = edit.get().metaOffset; + if (!edit.get().scopeType.HasImplicitTypeCode(edit)) { + RefObject tempRef_this = + new RefObject(this); metaOffset += cellType.WriteTypeArgument(tempRef_this, metaOffset, typeArgs.clone()); - this = tempRef_this.argValue; + this = tempRef_this.get(); } this.WriteSparsePath(edit, metaOffset); - edit.argValue.valueOffset = edit.argValue.metaOffset + metaBytes; - checkState(edit.argValue.valueOffset == edit.argValue.metaOffset + metaBytes); + edit.get().valueOffset = edit.get().metaOffset + metaBytes; + checkState(edit.get().valueOffset == edit.get().metaOffset + metaBytes); } - private void WriteSparsePath(tangible.RefObject edit, int offset) { + private void WriteSparsePath(RefObject edit, int offset) { // Some scopes don't encode paths, therefore the cost is always zero. - if (edit.argValue.scopeType.IsIndexedScope) { - edit.argValue.pathToken = 0; - edit.argValue.pathOffset = 0; + if (edit.get().scopeType.IsIndexedScope) { + edit.get().pathToken = 0; + edit.get().pathOffset = 0; return; } StringToken _; - tangible.OutObject tempOut__ = - new tangible.OutObject(); - Contract.Assert(!edit.argValue.layout.getTokenizer().TryFindToken(edit.argValue.writePath, tempOut__) || !edit.argValue.writePathToken.getIsNull()); - _ = tempOut__.argValue; - if (!edit.argValue.writePathToken.getIsNull()) { - edit.argValue.writePathToken.Varint.CopyTo(this.buffer.Slice(offset)); - edit.argValue.pathToken = edit.argValue.intValue().writePathToken.Id; - edit.argValue.pathOffset = offset; + OutObject tempOut__ = + new OutObject(); + checkState(!edit.get().layout.getTokenizer().TryFindToken(edit.get().writePath, tempOut__) || !edit.get().writePathToken.getIsNull()); + _ = tempOut__.get(); + if (!edit.get().writePathToken.getIsNull()) { + edit.get().writePathToken.Varint.CopyTo(this.buffer.Slice(offset)); + edit.get().pathToken = edit.get().intValue().writePathToken.Id; + edit.get().pathOffset = offset; } else { // TODO: It would be better if we could avoid allocating here when the path is UTF16. - Utf8Span span = edit.argValue.writePath.ToUtf8String(); - edit.argValue.pathToken = edit.argValue.layout.getTokenizer().getCount() + span.Length; + Utf8Span span = edit.get().writePath.ToUtf8String(); + edit.get().pathToken = edit.get().layout.getTokenizer().getCount() + span.Length; //C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java: //ORIGINAL LINE: int sizeLenInBytes = this.Write7BitEncodedUInt(offset, (ulong)edit.pathToken); - int sizeLenInBytes = this.Write7BitEncodedUInt(offset, edit.argValue.longValue().pathToken); - edit.argValue.pathOffset = offset + sizeLenInBytes; + int sizeLenInBytes = this.Write7BitEncodedUInt(offset, edit.get().longValue().pathToken); + edit.get().pathOffset = offset + sizeLenInBytes; span.Span.CopyTo(this.buffer.Slice(offset + sizeLenInBytes)); } } diff --git a/jre/src/main/java/azure/data/cosmos/serialization/hybridrow/RowCursor.java b/jre/src/main/java/com/azure/data/cosmos/serialization/hybridrow/RowCursor.java similarity index 88% rename from jre/src/main/java/azure/data/cosmos/serialization/hybridrow/RowCursor.java rename to jre/src/main/java/com/azure/data/cosmos/serialization/hybridrow/RowCursor.java index f4e7987..0767d9c 100644 --- a/jre/src/main/java/azure/data/cosmos/serialization/hybridrow/RowCursor.java +++ b/jre/src/main/java/com/azure/data/cosmos/serialization/hybridrow/RowCursor.java @@ -2,20 +2,21 @@ // Copyright (c) Microsoft Corporation. All rights reserved. //------------------------------------------------------------ -package azure.data.cosmos.serialization.hybridrow; +package com.azure.data.cosmos.serialization.hybridrow; // TODO: C# TO JAVA CONVERTER: There is no preprocessor in Java: ///#pragma warning disable SA1307 // Accessible fields should begin with upper-case letter // ReSharper disable InconsistentNaming -import azure.data.cosmos.serialization.hybridrow.layouts.Layout; -import azure.data.cosmos.serialization.hybridrow.layouts.LayoutEndScope; -import azure.data.cosmos.serialization.hybridrow.layouts.LayoutScope; -import azure.data.cosmos.serialization.hybridrow.layouts.LayoutType; -import azure.data.cosmos.serialization.hybridrow.layouts.StringToken; -import azure.data.cosmos.serialization.hybridrow.layouts.TypeArgument; -import azure.data.cosmos.serialization.hybridrow.layouts.TypeArgumentList; +import com.azure.data.cosmos.core.RefObject; +import com.azure.data.cosmos.serialization.hybridrow.layouts.Layout; +import com.azure.data.cosmos.serialization.hybridrow.layouts.LayoutEndScope; +import com.azure.data.cosmos.serialization.hybridrow.layouts.LayoutScope; +import com.azure.data.cosmos.serialization.hybridrow.layouts.LayoutType; +import com.azure.data.cosmos.serialization.hybridrow.layouts.StringToken; +import com.azure.data.cosmos.serialization.hybridrow.layouts.TypeArgument; +import com.azure.data.cosmos.serialization.hybridrow.layouts.TypeArgumentList; // ReSharper disable UseNameofExpression // TODO: C# TO JAVA CONVERTER: Java annotations will not correspond to .NET attributes: @@ -101,10 +102,10 @@ public final class RowCursor { */ public StringToken writePathToken = new StringToken(); - public static RowCursor Create(tangible.RefObject row) { - SchemaId schemaId = row.argValue.ReadSchemaId(1).clone(); - Layout layout = row.argValue.getResolver().Resolve(schemaId.clone()); - int sparseSegmentOffset = row.argValue.ComputeVariableValueOffset(layout, HybridRowHeader.Size, + public static RowCursor Create(RefObject row) { + SchemaId schemaId = row.get().ReadSchemaId(1).clone(); + Layout layout = row.get().getResolver().Resolve(schemaId.clone()); + int sparseSegmentOffset = row.get().ComputeVariableValueOffset(layout, HybridRowHeader.Size, layout.getNumVariable()); RowCursor tempVar = new RowCursor(); tempVar.layout = layout; diff --git a/jre/src/main/java/azure/data/cosmos/serialization/hybridrow/RowCursorExtensions.java b/jre/src/main/java/com/azure/data/cosmos/serialization/hybridrow/RowCursorExtensions.java similarity index 57% rename from jre/src/main/java/azure/data/cosmos/serialization/hybridrow/RowCursorExtensions.java rename to jre/src/main/java/com/azure/data/cosmos/serialization/hybridrow/RowCursorExtensions.java index 800162c..78bbb8a 100644 --- a/jre/src/main/java/azure/data/cosmos/serialization/hybridrow/RowCursorExtensions.java +++ b/jre/src/main/java/com/azure/data/cosmos/serialization/hybridrow/RowCursorExtensions.java @@ -2,10 +2,11 @@ // Copyright (c) Microsoft Corporation. All rights reserved. //------------------------------------------------------------ -package azure.data.cosmos.serialization.hybridrow; +package com.azure.data.cosmos.serialization.hybridrow; -import azure.data.cosmos.serialization.hybridrow.layouts.LayoutCode; -import azure.data.cosmos.serialization.hybridrow.layouts.LayoutEndScope; +import com.azure.data.cosmos.core.RefObject; +import com.azure.data.cosmos.serialization.hybridrow.layouts.LayoutCode; +import com.azure.data.cosmos.serialization.hybridrow.layouts.LayoutEndScope; import static com.google.common.base.Preconditions.checkArgument; @@ -77,27 +78,27 @@ public final class RowCursorExtensions { // edit.writePathToken = pathToken; // return ref edit; // } - public static boolean MoveNext(tangible.RefObject edit, tangible.RefObject row) { - edit.argValue.writePath = null; - edit.argValue.writePathToken = null; - return row.argValue.SparseIteratorMoveNext(edit); + public static boolean MoveNext(RefObject edit, RefObject row) { + edit.get().writePath = null; + edit.get().writePathToken = null; + return row.get().SparseIteratorMoveNext(edit); } - public static boolean MoveNext(tangible.RefObject edit, tangible.RefObject row, - tangible.RefObject childScope) { - if (childScope.argValue.scopeType != null) { - azure.data.cosmos.serialization.hybridrow.RowCursorExtensions.Skip(edit.argValue.clone(), row, childScope); + public static boolean MoveNext(RefObject edit, RefObject row, + RefObject childScope) { + if (childScope.get().scopeType != null) { + RowCursorExtensions.Skip(edit.get().clone(), row, childScope); } - return azure.data.cosmos.serialization.hybridrow.RowCursorExtensions.MoveNext(edit.argValue.clone(), row); + return RowCursorExtensions.MoveNext(edit.get().clone(), row); } - public static boolean MoveTo(tangible.RefObject edit, tangible.RefObject row, int index) { - checkState(edit.argValue.index <= index); - edit.argValue.writePath = null; - edit.argValue.writePathToken = null; - while (edit.argValue.index < index) { - if (!row.argValue.SparseIteratorMoveNext(edit)) { + public static boolean MoveTo(RefObject edit, RefObject row, int index) { + checkState(edit.get().index <= index); + edit.get().writePath = null; + edit.get().writePathToken = null; + while (edit.get().index < index) { + if (!row.get().SparseIteratorMoveNext(edit)) { return false; } } @@ -105,23 +106,23 @@ public final class RowCursorExtensions { return true; } - public static void Skip(tangible.RefObject edit, tangible.RefObject row, - tangible.RefObject childScope) { - checkArgument(childScope.argValue.start == edit.argValue.valueOffset); - if (!(childScope.argValue.cellType instanceof LayoutEndScope)) { - while (row.argValue.SparseIteratorMoveNext(childScope)) { + public static void Skip(RefObject edit, RefObject row, + RefObject childScope) { + checkArgument(childScope.get().start == edit.get().valueOffset); + if (!(childScope.get().cellType instanceof LayoutEndScope)) { + while (row.get().SparseIteratorMoveNext(childScope)) { } } - if (childScope.argValue.scopeType.IsSizedScope) { - edit.argValue.endOffset = childScope.argValue.metaOffset; + if (childScope.get().scopeType.IsSizedScope) { + edit.get().endOffset = childScope.get().metaOffset; } else { - edit.argValue.endOffset = childScope.argValue.metaOffset + (LayoutCode.SIZE / Byte.SIZE); // Move past the end of scope marker. + edit.get().endOffset = childScope.get().metaOffset + (LayoutCode.SIZE / Byte.SIZE); // Move past the end of scope marker. } // TODO: C# TO JAVA CONVERTER: There is no preprocessor in Java: //#if DEBUG - childScope.argValue = null; + childScope.set(null); //#endif } } \ No newline at end of file diff --git a/jre/src/main/java/azure/data/cosmos/serialization/hybridrow/RowOptions.java b/jre/src/main/java/com/azure/data/cosmos/serialization/hybridrow/RowOptions.java similarity index 94% rename from jre/src/main/java/azure/data/cosmos/serialization/hybridrow/RowOptions.java rename to jre/src/main/java/com/azure/data/cosmos/serialization/hybridrow/RowOptions.java index 66bb768..007df69 100644 --- a/jre/src/main/java/azure/data/cosmos/serialization/hybridrow/RowOptions.java +++ b/jre/src/main/java/com/azure/data/cosmos/serialization/hybridrow/RowOptions.java @@ -2,7 +2,7 @@ // Copyright (c) Microsoft Corporation. All rights reserved. //------------------------------------------------------------ -package azure.data.cosmos.serialization.hybridrow; +package com.azure.data.cosmos.serialization.hybridrow; /** * Describes the desired behavior when mutating a hybrid row. diff --git a/jre/src/main/java/azure/data/cosmos/serialization/hybridrow/SchemaId.java b/jre/src/main/java/com/azure/data/cosmos/serialization/hybridrow/SchemaId.java similarity index 95% rename from jre/src/main/java/azure/data/cosmos/serialization/hybridrow/SchemaId.java rename to jre/src/main/java/com/azure/data/cosmos/serialization/hybridrow/SchemaId.java index c930be1..45a489f 100644 --- a/jre/src/main/java/azure/data/cosmos/serialization/hybridrow/SchemaId.java +++ b/jre/src/main/java/com/azure/data/cosmos/serialization/hybridrow/SchemaId.java @@ -2,7 +2,7 @@ // Copyright (c) Microsoft Corporation. All rights reserved. //------------------------------------------------------------ -package azure.data.cosmos.serialization.hybridrow; +package com.azure.data.cosmos.serialization.hybridrow; import Newtonsoft.Json.*; diff --git a/jre/src/main/java/azure/data/cosmos/serialization/hybridrow/UnixDateTime.java b/jre/src/main/java/com/azure/data/cosmos/serialization/hybridrow/UnixDateTime.java similarity index 95% rename from jre/src/main/java/azure/data/cosmos/serialization/hybridrow/UnixDateTime.java rename to jre/src/main/java/com/azure/data/cosmos/serialization/hybridrow/UnixDateTime.java index 1b6064e..01c0b49 100644 --- a/jre/src/main/java/azure/data/cosmos/serialization/hybridrow/UnixDateTime.java +++ b/jre/src/main/java/com/azure/data/cosmos/serialization/hybridrow/UnixDateTime.java @@ -2,7 +2,7 @@ // Copyright (c) Microsoft Corporation. All rights reserved. //------------------------------------------------------------ -package azure.data.cosmos.serialization.hybridrow; +package com.azure.data.cosmos.serialization.hybridrow; /** * A wall clock time expressed in milliseconds since the Unix Epoch. diff --git a/jre/src/main/java/azure/data/cosmos/serialization/hybridrow/internal/MurmurHash3.java b/jre/src/main/java/com/azure/data/cosmos/serialization/hybridrow/internal/MurmurHash3.java similarity index 73% rename from jre/src/main/java/azure/data/cosmos/serialization/hybridrow/internal/MurmurHash3.java rename to jre/src/main/java/com/azure/data/cosmos/serialization/hybridrow/internal/MurmurHash3.java index 3ec5b84..eba9c5a 100644 --- a/jre/src/main/java/azure/data/cosmos/serialization/hybridrow/internal/MurmurHash3.java +++ b/jre/src/main/java/com/azure/data/cosmos/serialization/hybridrow/internal/MurmurHash3.java @@ -2,7 +2,9 @@ // Copyright (c) Microsoft Corporation. All rights reserved. //------------------------------------------------------------ -package azure.data.cosmos.serialization.hybridrow.internal; +package com.azure.data.cosmos.serialization.hybridrow.internal; + +import static com.google.common.base.Preconditions.checkArgument; /** * MurmurHash3 for x64 (Little Endian). @@ -19,14 +21,13 @@ public final class MurmurHash3 { @return The 128-bit hash represented as two 64-bit words. */ // TODO: C# TO JAVA CONVERTER: Methods returning tuples are not converted by C# to Java Converter: - // public static(ulong low, ulong high) Hash128(string value, (ulong high, ulong low) seed) - // { - // Contract.Requires(value != null); - // int size = Encoding.UTF8.GetMaxByteCount(value.Length); - // Span span = size <= 256 ? stackalloc byte[size] : new byte[size]; - // int len = Encoding.UTF8.GetBytes(value.AsSpan(), span); - // return MurmurHash3.Hash128(span.Slice(0, len), seed); - // } + public static Value Hash128(String value, Value seed) { + checkArgument(value != null); + int size = Encoding.UTF8.GetMaxByteCount(value.length()); + Span span = size <= 256 ? stackalloc byte[size] :new byte[size]; + int len = Encoding.UTF8.GetBytes(value.AsSpan(), span); + return MurmurHash3.Hash128(span.Slice(0, len), seed); + } /** MurmurHash3 128-bit implementation. @param value The data to hash. @@ -34,11 +35,10 @@ public final class MurmurHash3 { @return The 128-bit hash represented as two 64-bit words. */ // TODO: C# TO JAVA CONVERTER: Methods returning tuples are not converted by C# to Java Converter: - // public static(ulong low, ulong high) Hash128(bool value, (ulong high, ulong low) seed) - // { - // // Ensure that a bool is ALWAYS a single byte encoding with 1 for true and 0 for false. - // return MurmurHash3.Hash128((byte)(value ? 1 : 0), seed); - // } + public static Value Hash128(boolean value, Value seed) { + // Ensure that a bool is ALWAYS a single byte encoding with 1 for true and 0 for false. + return MurmurHash3.Hash128((byte)(value ? 1 : 0), seed); + } /** MurmurHash3 128-bit implementation. @param value The data to hash. @@ -47,7 +47,7 @@ public final class MurmurHash3 { */ // TODO: C# TO JAVA CONVERTER: Methods returning tuples are not converted by C# to Java Converter: // public static unsafe(ulong low, ulong high) Hash128(T value, (ulong high, ulong low) seed) where T : - // unmanaged + // unmanaged // { // ReadOnlySpan span = new ReadOnlySpan(&value, 1); // return MurmurHash3.Hash128(MemoryMarshal.AsBytes(span), seed); @@ -214,32 +214,42 @@ public final class MurmurHash3 { //ORIGINAL LINE: [MethodImpl(MethodImplOptions.AggressiveInlining)] private static ulong Mix(ulong h) private static long Mix(long h) { // TODO: C# TO JAVA CONVERTER: There is no equivalent to an 'unchecked' block in Java: - unchecked - { - //C# TO JAVA CONVERTER WARNING: The right shift operator was replaced by Java's logical right shift - // operator since the left operand was originally of an unsigned type, but you should confirm this - // replacement: - h ^= h >>> 33; - h *= 0xff51afd7ed558ccdL; - //C# TO JAVA CONVERTER WARNING: The right shift operator was replaced by Java's logical right shift - // operator since the left operand was originally of an unsigned type, but you should confirm this - // replacement: - h ^= h >>> 33; - h *= 0xc4ceb9fe1a85ec53L; - //C# TO JAVA CONVERTER WARNING: The right shift operator was replaced by Java's logical right shift - // operator since the left operand was originally of an unsigned type, but you should confirm this replacement: - h ^= h >>> 33; - return h; - } + //C# TO JAVA CONVERTER WARNING: The right shift operator was replaced by Java's logical right shift + // operator since the left operand was originally of an unsigned type, but you should confirm this + // replacement: + h ^= h >>> 33; + h *= 0xff51afd7ed558ccdL; + //C# TO JAVA CONVERTER WARNING: The right shift operator was replaced by Java's logical right shift + // operator since the left operand was originally of an unsigned type, but you should confirm this + // replacement: + h ^= h >>> 33; + h *= 0xc4ceb9fe1a85ec53L; + //C# TO JAVA CONVERTER WARNING: The right shift operator was replaced by Java's logical right shift + // operator since the left operand was originally of an unsigned type, but you should confirm this replacement: + h ^= h >>> 33; + return h; } // TODO: C# TO JAVA CONVERTER: Java annotations will not correspond to .NET attributes: - //ORIGINAL LINE: [MethodImpl(MethodImplOptions.AggressiveInlining)] private static ulong RotateLeft64(ulong n, int numBits) + //ORIGINAL LINE: [MethodImpl(MethodImplOptions.AggressiveInlining)] private static ulong RotateLeft64(ulong n, + // int numBits) //C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java: - //ORIGINAL LINE: [MethodImpl(MethodImplOptions.AggressiveInlining)] private static ulong RotateLeft64(ulong n, int numBits) + //ORIGINAL LINE: [MethodImpl(MethodImplOptions.AggressiveInlining)] private static ulong RotateLeft64(ulong n, + // int numBits) private static long RotateLeft64(long n, int numBits) { - Contract.Assert(numBits < 64, "numBits < 64"); - //C# TO JAVA CONVERTER WARNING: The right shift operator was replaced by Java's logical right shift operator since the left operand was originally of an unsigned type, but you should confirm this replacement: + checkArgument(numBits < 64, "numBits < 64"); + //C# TO JAVA CONVERTER WARNING: The right shift operator was replaced by Java's logical right shift operator + // since the left operand was originally of an unsigned type, but you should confirm this replacement: return (n << numBits) | (n >>> (64 - numBits)); } + + public static final class Value { + + public final long low, high; + + public Value(long low, long high) { + this.low = low; + this.high = high; + } + } } \ No newline at end of file diff --git a/jre/src/main/java/com/azure/data/cosmos/serialization/hybridrow/internal/Utf8StringJsonConverter.java b/jre/src/main/java/com/azure/data/cosmos/serialization/hybridrow/internal/Utf8StringJsonConverter.java new file mode 100644 index 0000000..02823f4 --- /dev/null +++ b/jre/src/main/java/com/azure/data/cosmos/serialization/hybridrow/internal/Utf8StringJsonConverter.java @@ -0,0 +1,50 @@ +//------------------------------------------------------------ +// Copyright (c) Microsoft Corporation. All rights reserved. +//------------------------------------------------------------ + +package com.azure.data.cosmos.serialization.hybridrow.internal; + + +import com.fasterxml.jackson.core.JsonParser; +import com.fasterxml.jackson.core.JsonToken; +import com.fasterxml.jackson.databind.JsonDeserializer; +import com.fasterxml.jackson.databind.ser.std.StdSerializer; +import io.netty.buffer.ByteBuf; + +import static com.google.common.base.Preconditions.checkArgument; + +/** + * Helper class for parsing from JSON. + */ +public class Utf8StringJsonConverter extends StdSerializer { + + public Utf8StringJsonConverter() { + this(ByteBuf.class); + } + + public Utf8StringJsonConverter(Class type) { + super(type); + } + + @Override + public boolean canWrite() { + return true; + } + + @Override + public boolean CanConvert(Class type) { + return type.isAssignableFrom(ByteBuf); + } + + @Override + public Object ReadJson( + JsonReader reader, java.lang.Class objectType, Object existingValue, JsonSerializer serializer) { + checkArgument(reader.TokenType == JsonToken.String); + return Utf8String.TranscodeUtf16((String)reader.Value); + } + + @Override + public void WriteJson(JsonWriter writer, Object value, JsonSerializer serializer) { + writer.WriteValue(((Utf8String)value).toString()); + } +} \ No newline at end of file diff --git a/jre/src/main/java/azure/data/cosmos/serialization/hybridrow/io/IRowSerializable.java b/jre/src/main/java/com/azure/data/cosmos/serialization/hybridrow/io/IRowSerializable.java similarity index 64% rename from jre/src/main/java/azure/data/cosmos/serialization/hybridrow/io/IRowSerializable.java rename to jre/src/main/java/com/azure/data/cosmos/serialization/hybridrow/io/IRowSerializable.java index 67f3a62..217dfb3 100644 --- a/jre/src/main/java/azure/data/cosmos/serialization/hybridrow/io/IRowSerializable.java +++ b/jre/src/main/java/com/azure/data/cosmos/serialization/hybridrow/io/IRowSerializable.java @@ -2,10 +2,11 @@ // Copyright (c) Microsoft Corporation. All rights reserved. //------------------------------------------------------------ -package azure.data.cosmos.serialization.hybridrow.io; +package com.azure.data.cosmos.serialization.hybridrow.io; -import azure.data.cosmos.serialization.hybridrow.Result; -import azure.data.cosmos.serialization.hybridrow.layouts.TypeArgument; +import com.azure.data.cosmos.core.RefObject; +import com.azure.data.cosmos.serialization.hybridrow.Result; +import com.azure.data.cosmos.serialization.hybridrow.layouts.TypeArgument; /** * A type may implement this interface to support serialization into a HybridRow. @@ -18,5 +19,5 @@ public interface IRowSerializable { * @param typeArg The schematized layout type, if a schema is available. * @return Success if the write is successful, the error code otherwise. */ - Result Write(tangible.RefObject writer, TypeArgument typeArg); + Result write(RefObject writer, TypeArgument typeArg); } \ No newline at end of file diff --git a/jre/src/main/java/azure/data/cosmos/serialization/hybridrow/io/RowReader.java b/jre/src/main/java/com/azure/data/cosmos/serialization/hybridrow/io/RowReader.java similarity index 61% rename from jre/src/main/java/azure/data/cosmos/serialization/hybridrow/io/RowReader.java rename to jre/src/main/java/com/azure/data/cosmos/serialization/hybridrow/io/RowReader.java index 0254958..ab4bcf8 100644 --- a/jre/src/main/java/azure/data/cosmos/serialization/hybridrow/io/RowReader.java +++ b/jre/src/main/java/com/azure/data/cosmos/serialization/hybridrow/io/RowReader.java @@ -2,23 +2,54 @@ // Copyright (c) Microsoft Corporation. All rights reserved. //------------------------------------------------------------ -package azure.data.cosmos.serialization.hybridrow.io; +package com.azure.data.cosmos.serialization.hybridrow.io; -import azure.data.cosmos.serialization.hybridrow.Float128; -import azure.data.cosmos.serialization.hybridrow.NullValue; -import azure.data.cosmos.serialization.hybridrow.Result; -import azure.data.cosmos.serialization.hybridrow.RowBuffer; -import azure.data.cosmos.serialization.hybridrow.RowCursor; -import azure.data.cosmos.serialization.hybridrow.UnixDateTime; -import azure.data.cosmos.serialization.hybridrow.layouts.LayoutColumn; -import azure.data.cosmos.serialization.hybridrow.layouts.LayoutNullable; -import azure.data.cosmos.serialization.hybridrow.layouts.LayoutUDT; -import azure.data.cosmos.serialization.hybridrow.schemas.StorageKind; +import com.azure.data.cosmos.core.OutObject; +import com.azure.data.cosmos.core.RefObject; +import com.azure.data.cosmos.serialization.hybridrow.Float128; +import com.azure.data.cosmos.serialization.hybridrow.NullValue; +import com.azure.data.cosmos.serialization.hybridrow.Result; +import com.azure.data.cosmos.serialization.hybridrow.RowBuffer; +import com.azure.data.cosmos.serialization.hybridrow.RowCursor; +import com.azure.data.cosmos.serialization.hybridrow.UnixDateTime; +import com.azure.data.cosmos.serialization.hybridrow.RowCursorExtensions; +import com.azure.data.cosmos.serialization.hybridrow.layouts.ILayoutSpanReadable; +import com.azure.data.cosmos.serialization.hybridrow.layouts.ILayoutUtf8SpanReadable; +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.LayoutColumn; +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.LayoutFloat128; +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.LayoutGuid; +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.LayoutInt64; +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.LayoutNull; +import com.azure.data.cosmos.serialization.hybridrow.layouts.LayoutNullable; +import com.azure.data.cosmos.serialization.hybridrow.layouts.LayoutType; +import com.azure.data.cosmos.serialization.hybridrow.layouts.LayoutUDT; +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.LayoutUInt64; +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.LayoutUtf8; +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.TypeArgumentList; +import com.azure.data.cosmos.serialization.hybridrow.schemas.StorageKind; import java.math.BigDecimal; import java.time.LocalDateTime; import java.util.UUID; +import static com.google.common.base.Preconditions.checkState; + // TODO: C# TO JAVA CONVERTER: There is no preprocessor in Java: ///#pragma warning disable CA1034 // Nested types should not be visible @@ -72,12 +103,12 @@ public final class RowReader { * child instances can be access through the method * to process nested content. */ - public RowReader(tangible.RefObject row) { + public RowReader(RefObject row) { this(row, RowCursor.Create(row)); } - public RowReader(tangible.RefObject row, final Checkpoint checkpoint) { - this.row = row.argValue.clone(); + public RowReader(RefObject row, final Checkpoint checkpoint) { + this.row = row.get().clone(); this.columns = checkpoint.Cursor.layout.getColumns(); this.schematizedCount = checkpoint.Cursor.layout.getNumFixed() + checkpoint.Cursor.layout.getNumVariable(); @@ -86,9 +117,9 @@ public final class RowReader { this.columnIndex = checkpoint.ColumnIndex; } - private RowReader(tangible.RefObject row, final RowCursor scope) { + private RowReader(RefObject row, final RowCursor scope) { this.cursor = scope.clone(); - this.row = row.argValue.clone(); + this.row = row.get().clone(); this.columns = this.cursor.layout.getColumns(); this.schematizedCount = this.cursor.layout.getNumFixed() + this.cursor.layout.getNumVariable(); @@ -109,16 +140,16 @@ public final class RowReader { return true; case Sparse: if (this.cursor.cellType instanceof LayoutNullable) { - tangible.RefObject tempRef_cursor = - new tangible.RefObject(this.cursor); + RefObject tempRef_cursor = + new RefObject(this.cursor); RowCursor nullableScope = this.row.SparseIteratorReadScope(tempRef_cursor, true).clone(); - this.cursor = tempRef_cursor.argValue; - tangible.RefObject tempRef_row = - new tangible.RefObject(this.row); - tangible.RefObject tempRef_nullableScope = new tangible.RefObject(nullableScope); + this.cursor = tempRef_cursor.get(); + RefObject tempRef_row = + new RefObject(this.row); + RefObject tempRef_nullableScope = new RefObject(nullableScope); boolean tempVar = LayoutNullable.HasValue(tempRef_row, tempRef_nullableScope) == Result.Success; - nullableScope = tempRef_nullableScope.argValue; - this.row = tempRef_row.argValue; + nullableScope = tempRef_nullableScope.get(); + this.row = tempRef_row.get(); return tempVar; } @@ -167,10 +198,10 @@ public final class RowReader { return null; } - tangible.RefObject tempRef_cursor = - new tangible.RefObject(this.cursor); + RefObject tempRef_cursor = + new RefObject(this.cursor); Utf8Span span = this.row.ReadSparsePath(tempRef_cursor); - this.cursor = tempRef_cursor.argValue; + this.cursor = tempRef_cursor.get(); return Utf8String.CopyFrom(span); default: return null; @@ -188,10 +219,10 @@ public final class RowReader { case Schematized: return this.columns[this.columnIndex].Path.Span; case Sparse: - tangible.RefObject tempRef_cursor = - new tangible.RefObject(this.cursor); + RefObject tempRef_cursor = + new RefObject(this.cursor); Utf8Span tempVar = this.row.ReadSparsePath(tempRef_cursor); - this.cursor = tempRef_cursor.argValue; + this.cursor = tempRef_cursor.get(); return tempVar; default: return null; @@ -246,49 +277,53 @@ public final class RowReader { * @return True, if there is another field to be read, false otherwise. */ public boolean Read() { + switch (this.state) { case None: { if (this.cursor.scopeType instanceof LayoutUDT) { this.state = States.Schematized; // TODO: C# TO JAVA CONVERTER: There is no 'goto' in Java: - goto case States.Schematized + // goto case States.Schematized; + } else { + this.state = States.Sparse; + // TODO: C# TO JAVA CONVERTER: There is no 'goto' in Java: + // goto case States.Sparse; } - - this.state = States.Sparse; - // TODO: C# TO JAVA CONVERTER: There is no 'goto' in Java: - goto case States.Sparse } - case Schematized: { + this.columnIndex++; + if (this.columnIndex >= this.schematizedCount) { this.state = States.Sparse; // TODO: C# TO JAVA CONVERTER: There is no 'goto' in Java: - goto case States.Sparse + // goto case States.Sparse; } checkState(this.cursor.scopeType instanceof LayoutUDT); LayoutColumn col = this.columns[this.columnIndex]; + if (!this.row.ReadBit(this.cursor.start, col.getNullBit().clone())) { // Skip schematized values if they aren't present. // TODO: C# TO JAVA CONVERTER: There is no 'goto' in Java: - goto case States.Schematized + // goto case States.Schematized; } return true; } case Sparse: { - tangible.RefObject tempRef_row = - new tangible.RefObject(this.row); - if (!Microsoft.Azure.Cosmos.Serialization.HybridRow.RowCursorExtensions.MoveNext(this.cursor.clone(), + + RefObject tempRef_row = new RefObject(this.row); + + if (!RowCursorExtensions.MoveNext(this.cursor.clone(), tempRef_row)) { - this.row = tempRef_row.argValue; + this.row = tempRef_row.get(); this.state = States.Done; // TODO: C# TO JAVA CONVERTER: There is no 'goto' in Java: - goto case States.Done + // goto case States.Done; } else { - this.row = tempRef_row.argValue; + this.row = tempRef_row.get(); } return true; @@ -310,14 +345,14 @@ public final class RowReader { */ //C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java: //ORIGINAL LINE: public Result ReadBinary(out byte[] value) - public Result ReadBinary(tangible.OutObject value) { + public Result ReadBinary(OutObject value) { ReadOnlySpan span; // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'out' keyword - these // cannot be converted using the 'OutObject' helper class unless the method is within the code being modified: //C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java: //ORIGINAL LINE: Result r = this.ReadBinary(out ReadOnlySpan span); Result r = this.ReadBinary(out span); - value.argValue = (r == Result.Success) ? span.ToArray() : + value.set((r == Result.Success) ? span.ToArray() :) default return r; } @@ -330,23 +365,23 @@ public final class RowReader { */ //C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java: //ORIGINAL LINE: public Result ReadBinary(out ReadOnlySpan value) - public Result ReadBinary(tangible.OutObject> value) { + public Result ReadBinary(OutObject> value) { switch (this.state) { case Schematized: return this.ReadPrimitiveValue(value); case Sparse: if (!(this.cursor.cellType instanceof LayoutBinary)) { - value.argValue = null; + value.set(null); return Result.TypeMismatch; } - tangible.RefObject tempRef_cursor = - new tangible.RefObject(this.cursor); - value.argValue = this.row.ReadSparseBinary(tempRef_cursor); - this.cursor = tempRef_cursor.argValue; + RefObject tempRef_cursor = + new RefObject(this.cursor); + value.set(this.row.ReadSparseBinary(tempRef_cursor)); + this.cursor = tempRef_cursor.get(); return Result.Success; default: - value.argValue = null; + value.set(null); return Result.Failure; } } @@ -357,23 +392,23 @@ public final class RowReader { * @param value On success, receives the value, undefined otherwise. * @return Success if the read is successful, an error code otherwise. */ - public Result ReadBool(tangible.OutObject value) { + public Result ReadBool(OutObject value) { switch (this.state) { case Schematized: return this.ReadPrimitiveValue(value); case Sparse: if (!(this.cursor.cellType instanceof LayoutBoolean)) { - value.argValue = false; + value.set(false); return Result.TypeMismatch; } - tangible.RefObject tempRef_cursor = - new tangible.RefObject(this.cursor); - value.argValue = this.row.ReadSparseBool(tempRef_cursor); - this.cursor = tempRef_cursor.argValue; + RefObject tempRef_cursor = + new RefObject(this.cursor); + value.set(this.row.ReadSparseBool(tempRef_cursor)); + this.cursor = tempRef_cursor.get(); return Result.Success; default: - value.argValue = false; + value.set(false); return Result.Failure; } } @@ -384,23 +419,23 @@ public final class RowReader { * @param value On success, receives the value, undefined otherwise. * @return Success if the read is successful, an error code otherwise. */ - public Result ReadDateTime(tangible.OutObject value) { + public Result ReadDateTime(OutObject value) { switch (this.state) { case Schematized: return this.ReadPrimitiveValue(value); case Sparse: if (!(this.cursor.cellType instanceof LayoutDateTime)) { - value.argValue = LocalDateTime.MIN; + value.set(LocalDateTime.MIN); return Result.TypeMismatch; } - tangible.RefObject tempRef_cursor = - new tangible.RefObject(this.cursor); - value.argValue = this.row.ReadSparseDateTime(tempRef_cursor); - this.cursor = tempRef_cursor.argValue; + RefObject tempRef_cursor = + new RefObject(this.cursor); + value.set(this.row.ReadSparseDateTime(tempRef_cursor)); + this.cursor = tempRef_cursor.get(); return Result.Success; default: - value.argValue = LocalDateTime.MIN; + value.set(LocalDateTime.MIN); return Result.Failure; } } @@ -411,23 +446,23 @@ public final class RowReader { * @param value On success, receives the value, undefined otherwise. * @return Success if the read is successful, an error code otherwise. */ - public Result ReadDecimal(tangible.OutObject value) { + public Result ReadDecimal(OutObject value) { switch (this.state) { case Schematized: return this.ReadPrimitiveValue(value); case Sparse: if (!(this.cursor.cellType instanceof LayoutDecimal)) { - value.argValue = new BigDecimal(0); + value.set(new BigDecimal(0)); return Result.TypeMismatch; } - tangible.RefObject tempRef_cursor = - new tangible.RefObject(this.cursor); - value.argValue = this.row.ReadSparseDecimal(tempRef_cursor); - this.cursor = tempRef_cursor.argValue; + RefObject tempRef_cursor = + new RefObject(this.cursor); + value.set(this.row.ReadSparseDecimal(tempRef_cursor)); + this.cursor = tempRef_cursor.get(); return Result.Success; default: - value.argValue = new BigDecimal(0); + value.set(new BigDecimal(0)); return Result.Failure; } } @@ -438,23 +473,23 @@ public final class RowReader { * @param value On success, receives the value, undefined otherwise. * @return Success if the read is successful, an error code otherwise. */ - public Result ReadFloat128(tangible.OutObject value) { + public Result ReadFloat128(OutObject value) { switch (this.state) { case Schematized: return this.ReadPrimitiveValue(value.clone()); case Sparse: if (!(this.cursor.cellType instanceof LayoutFloat128)) { - value.argValue = null; + value.set(null); return Result.TypeMismatch; } - tangible.RefObject tempRef_cursor = - new tangible.RefObject(this.cursor); - value.argValue = this.row.ReadSparseFloat128(tempRef_cursor).clone(); - this.cursor = tempRef_cursor.argValue; + RefObject tempRef_cursor = + new RefObject(this.cursor); + value.set(this.row.ReadSparseFloat128(tempRef_cursor).clone()); + this.cursor = tempRef_cursor.get(); return Result.Success; default: - value.argValue = null; + value.set(null); return Result.Failure; } } @@ -465,23 +500,23 @@ public final class RowReader { * @param value On success, receives the value, undefined otherwise. * @return Success if the read is successful, an error code otherwise. */ - public Result ReadFloat32(tangible.OutObject value) { + public Result ReadFloat32(OutObject value) { switch (this.state) { case Schematized: return this.ReadPrimitiveValue(value); case Sparse: if (!(this.cursor.cellType instanceof LayoutFloat32)) { - value.argValue = 0; + value.set(0); return Result.TypeMismatch; } - tangible.RefObject tempRef_cursor = - new tangible.RefObject(this.cursor); - value.argValue = this.row.ReadSparseFloat32(tempRef_cursor); - this.cursor = tempRef_cursor.argValue; + RefObject tempRef_cursor = + new RefObject(this.cursor); + value.set(this.row.ReadSparseFloat32(tempRef_cursor)); + this.cursor = tempRef_cursor.get(); return Result.Success; default: - value.argValue = 0; + value.set(0); return Result.Failure; } } @@ -492,23 +527,23 @@ public final class RowReader { * @param value On success, receives the value, undefined otherwise. * @return Success if the read is successful, an error code otherwise. */ - public Result ReadFloat64(tangible.OutObject value) { + public Result ReadFloat64(OutObject value) { switch (this.state) { case Schematized: return this.ReadPrimitiveValue(value); case Sparse: if (!(this.cursor.cellType instanceof LayoutFloat64)) { - value.argValue = 0; + value.set(0); return Result.TypeMismatch; } - tangible.RefObject tempRef_cursor = - new tangible.RefObject(this.cursor); - value.argValue = this.row.ReadSparseFloat64(tempRef_cursor); - this.cursor = tempRef_cursor.argValue; + RefObject tempRef_cursor = + new RefObject(this.cursor); + value.set(this.row.ReadSparseFloat64(tempRef_cursor)); + this.cursor = tempRef_cursor.get(); return Result.Success; default: - value.argValue = 0; + value.set(0); return Result.Failure; } } @@ -519,23 +554,23 @@ public final class RowReader { * @param value On success, receives the value, undefined otherwise. * @return Success if the read is successful, an error code otherwise. */ - public Result ReadGuid(tangible.OutObject value) { + public Result ReadGuid(OutObject value) { switch (this.state) { case Schematized: return this.ReadPrimitiveValue(value); case Sparse: if (!(this.cursor.cellType instanceof LayoutGuid)) { - value.argValue = null; + value.set(null); return Result.TypeMismatch; } - tangible.RefObject tempRef_cursor = - new tangible.RefObject(this.cursor); - value.argValue = this.row.ReadSparseGuid(tempRef_cursor); - this.cursor = tempRef_cursor.argValue; + RefObject tempRef_cursor = + new RefObject(this.cursor); + value.set(this.row.ReadSparseGuid(tempRef_cursor)); + this.cursor = tempRef_cursor.get(); return Result.Success; default: - value.argValue = null; + value.set(null); return Result.Failure; } } @@ -546,23 +581,23 @@ public final class RowReader { * @param value On success, receives the value, undefined otherwise. * @return Success if the read is successful, an error code otherwise. */ - public Result ReadInt16(tangible.OutObject value) { + public Result ReadInt16(OutObject value) { switch (this.state) { case Schematized: return this.ReadPrimitiveValue(value); case Sparse: if (!(this.cursor.cellType instanceof LayoutInt16)) { - value.argValue = 0; + value.set(0); return Result.TypeMismatch; } - tangible.RefObject tempRef_cursor = - new tangible.RefObject(this.cursor); - value.argValue = this.row.ReadSparseInt16(tempRef_cursor); - this.cursor = tempRef_cursor.argValue; + RefObject tempRef_cursor = + new RefObject(this.cursor); + value.set(this.row.ReadSparseInt16(tempRef_cursor)); + this.cursor = tempRef_cursor.get(); return Result.Success; default: - value.argValue = 0; + value.set(0); return Result.Failure; } } @@ -573,23 +608,23 @@ public final class RowReader { * @param value On success, receives the value, undefined otherwise. * @return Success if the read is successful, an error code otherwise. */ - public Result ReadInt32(tangible.OutObject value) { + public Result ReadInt32(OutObject value) { switch (this.state) { case Schematized: return this.ReadPrimitiveValue(value); case Sparse: if (!(this.cursor.cellType instanceof LayoutInt32)) { - value.argValue = 0; + value.set(0); return Result.TypeMismatch; } - tangible.RefObject tempRef_cursor = - new tangible.RefObject(this.cursor); - value.argValue = this.row.ReadSparseInt32(tempRef_cursor); - this.cursor = tempRef_cursor.argValue; + RefObject tempRef_cursor = + new RefObject(this.cursor); + value.set(this.row.ReadSparseInt32(tempRef_cursor)); + this.cursor = tempRef_cursor.get(); return Result.Success; default: - value.argValue = 0; + value.set(0); return Result.Failure; } } @@ -600,23 +635,23 @@ public final class RowReader { * @param value On success, receives the value, undefined otherwise. * @return Success if the read is successful, an error code otherwise. */ - public Result ReadInt64(tangible.OutObject value) { + public Result ReadInt64(OutObject value) { switch (this.state) { case Schematized: return this.ReadPrimitiveValue(value); case Sparse: if (!(this.cursor.cellType instanceof LayoutInt64)) { - value.argValue = 0; + value.set(0); return Result.TypeMismatch; } - tangible.RefObject tempRef_cursor = - new tangible.RefObject(this.cursor); - value.argValue = this.row.ReadSparseInt64(tempRef_cursor); - this.cursor = tempRef_cursor.argValue; + RefObject tempRef_cursor = + new RefObject(this.cursor); + value.set(this.row.ReadSparseInt64(tempRef_cursor)); + this.cursor = tempRef_cursor.get(); return Result.Success; default: - value.argValue = 0; + value.set(0); return Result.Failure; } } @@ -627,23 +662,23 @@ public final class RowReader { * @param value On success, receives the value, undefined otherwise. * @return Success if the read is successful, an error code otherwise. */ - public Result ReadInt8(tangible.OutObject value) { + public Result ReadInt8(OutObject value) { switch (this.state) { case Schematized: return this.ReadPrimitiveValue(value); case Sparse: if (!(this.cursor.cellType instanceof LayoutInt8)) { - value.argValue = 0; + value.set(0); return Result.TypeMismatch; } - tangible.RefObject tempRef_cursor = - new tangible.RefObject(this.cursor); - value.argValue = this.row.ReadSparseInt8(tempRef_cursor); - this.cursor = tempRef_cursor.argValue; + RefObject tempRef_cursor = + new RefObject(this.cursor); + value.set(this.row.ReadSparseInt8(tempRef_cursor)); + this.cursor = tempRef_cursor.get(); return Result.Success; default: - value.argValue = 0; + value.set(0); return Result.Failure; } } @@ -654,23 +689,23 @@ public final class RowReader { * @param value On success, receives the value, undefined otherwise. * @return Success if the read is successful, an error code otherwise. */ - public Result ReadMongoDbObjectId(tangible.OutObject value) { + public Result ReadMongoDbObjectId(OutObject value) { switch (this.state) { case Schematized: return this.ReadPrimitiveValue(value.clone()); case Sparse: if (!(this.cursor.cellType instanceof LayoutMongoDbObjectId)) { - value.argValue = null; + value.set(null); return Result.TypeMismatch; } - tangible.RefObject tempRef_cursor = - new tangible.RefObject(this.cursor); - value.argValue = this.row.ReadSparseMongoDbObjectId(tempRef_cursor).clone(); - this.cursor = tempRef_cursor.argValue; + RefObject tempRef_cursor = + new RefObject(this.cursor); + value.set(this.row.ReadSparseMongoDbObjectId(tempRef_cursor).clone()); + this.cursor = tempRef_cursor.get(); return Result.Success; default: - value.argValue = null; + value.set(null); return Result.Failure; } } @@ -681,23 +716,23 @@ public final class RowReader { * @param value On success, receives the value, undefined otherwise. * @return Success if the read is successful, an error code otherwise. */ - public Result ReadNull(tangible.OutObject value) { + public Result ReadNull(OutObject value) { switch (this.state) { case Schematized: return this.ReadPrimitiveValue(value.clone()); case Sparse: if (!(this.cursor.cellType instanceof LayoutNull)) { - value.argValue = null; + value.set(null); return Result.TypeMismatch; } - tangible.RefObject tempRef_cursor = - new tangible.RefObject(this.cursor); - value.argValue = this.row.ReadSparseNull(tempRef_cursor).clone(); - this.cursor = tempRef_cursor.argValue; + RefObject tempRef_cursor = + new RefObject(this.cursor); + value.set(this.row.ReadSparseNull(tempRef_cursor).clone()); + this.cursor = tempRef_cursor.get(); return Result.Success; default: - value.argValue = null; + value.set(null); return Result.Failure; } } @@ -711,15 +746,15 @@ public final class RowReader { * Nested child readers are independent of their parent. */ public RowReader ReadScope() { - tangible.RefObject tempRef_cursor = - new tangible.RefObject(this.cursor); + RefObject tempRef_cursor = + new RefObject(this.cursor); RowCursor newScope = this.row.SparseIteratorReadScope(tempRef_cursor, true).clone(); - this.cursor = tempRef_cursor.argValue; - tangible.RefObject tempRef_row = - new tangible.RefObject(this.row); + this.cursor = tempRef_cursor.get(); + RefObject tempRef_row = + new RefObject(this.row); // TODO: C# TO JAVA CONVERTER: The following line could not be converted: return new RowReader(ref this.row, newScope) - this.row = tempRef_row.argValue; + this.row = tempRef_row.get(); return tempVar; } @@ -730,32 +765,32 @@ public final class RowReader { * objects, arrays, tuples, set, and maps. */ public Result ReadScope(TContext context, ReaderFunc func) { - tangible.RefObject tempRef_cursor = - new tangible.RefObject(this.cursor); + RefObject tempRef_cursor = + new RefObject(this.cursor); RowCursor childScope = this.row.SparseIteratorReadScope(tempRef_cursor, true).clone(); - this.cursor = tempRef_cursor.argValue; - tangible.RefObject tempRef_row = - new tangible.RefObject(this.row); + this.cursor = tempRef_cursor.get(); + RefObject tempRef_row = + new RefObject(this.row); RowReader nestedReader = new RowReader(tempRef_row, childScope.clone()); - this.row = tempRef_row.argValue; + this.row = tempRef_row.get(); - tangible.RefObject tempRef_nestedReader = - new tangible.RefObject(nestedReader); + RefObject tempRef_nestedReader = + new RefObject(nestedReader); // TODO: C# TO JAVA CONVERTER: The following line could not be converted: Result result = func == null ? null : func.Invoke(ref nestedReader, context) ??Result.Success; - nestedReader = tempRef_nestedReader.argValue; + nestedReader = tempRef_nestedReader.get(); if (result != Result.Success) { return result; } - tangible.RefObject tempRef_row2 = - new tangible.RefObject(this.row); - tangible.RefObject tempRef_cursor2 = - new tangible.RefObject(nestedReader.cursor); - Microsoft.Azure.Cosmos.Serialization.HybridRow.RowCursorExtensions.Skip(this.cursor.clone(), tempRef_row2, + RefObject tempRef_row2 = + new RefObject(this.row); + RefObject tempRef_cursor2 = + new RefObject(nestedReader.cursor); + RowCursorExtensions.Skip(this.cursor.clone(), tempRef_row2, tempRef_cursor2); - nestedReader.cursor = tempRef_cursor2.argValue; - this.row = tempRef_row2.argValue; + nestedReader.cursor = tempRef_cursor2.get(); + this.row = tempRef_row2.get(); return Result.Success; } @@ -765,12 +800,12 @@ public final class RowReader { * @param value On success, receives the value, undefined otherwise. * @return Success if the read is successful, an error code otherwise. */ - public Result ReadString(tangible.OutObject value) { + public Result ReadString(OutObject value) { Utf8Span span; // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'out' keyword - these // cannot be converted using the 'OutObject' helper class unless the method is within the code being modified: Result r = this.ReadString(out span); - value.argValue = (r == Result.Success) ? span.toString() : + value.set((r == Result.Success) ? span.toString() :) default return r; } @@ -781,12 +816,12 @@ public final class RowReader { * @param value On success, receives the value, undefined otherwise. * @return Success if the read is successful, an error code otherwise. */ - public Result ReadString(tangible.OutObject value) { + public Result ReadString(OutObject value) { Utf8Span span; // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'out' keyword - these // cannot be converted using the 'OutObject' helper class unless the method is within the code being modified: Result r = this.ReadString(out span); - value.argValue = (r == Result.Success) ? Utf8String.CopyFrom(span) : + value.set((r == Result.Success) ? Utf8String.CopyFrom(span) :) default return r; } @@ -797,23 +832,23 @@ public final class RowReader { * @param value On success, receives the value, undefined otherwise. * @return Success if the read is successful, an error code otherwise. */ - public Result ReadString(tangible.OutObject value) { + public Result ReadString(OutObject value) { switch (this.state) { case Schematized: return this.ReadPrimitiveValue(value); case Sparse: if (!(this.cursor.cellType instanceof LayoutUtf8)) { - value.argValue = null; + value.set(null); return Result.TypeMismatch; } - tangible.RefObject tempRef_cursor = - new tangible.RefObject(this.cursor); - value.argValue = this.row.ReadSparseString(tempRef_cursor); - this.cursor = tempRef_cursor.argValue; + RefObject tempRef_cursor = + new RefObject(this.cursor); + value.set(this.row.ReadSparseString(tempRef_cursor)); + this.cursor = tempRef_cursor.get(); return Result.Success; default: - value.argValue = null; + value.set(null); return Result.Failure; } } @@ -826,23 +861,23 @@ public final class RowReader { */ //C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java: //ORIGINAL LINE: public Result ReadUInt16(out ushort value) - public Result ReadUInt16(tangible.OutObject value) { + public Result ReadUInt16(OutObject value) { switch (this.state) { case Schematized: return this.ReadPrimitiveValue(value); case Sparse: if (!(this.cursor.cellType instanceof LayoutUInt16)) { - value.argValue = 0; + value.set(0); return Result.TypeMismatch; } - tangible.RefObject tempRef_cursor = - new tangible.RefObject(this.cursor); - value.argValue = this.row.ReadSparseUInt16(tempRef_cursor); - this.cursor = tempRef_cursor.argValue; + RefObject tempRef_cursor = + new RefObject(this.cursor); + value.set(this.row.ReadSparseUInt16(tempRef_cursor)); + this.cursor = tempRef_cursor.get(); return Result.Success; default: - value.argValue = 0; + value.set(0); return Result.Failure; } } @@ -855,23 +890,23 @@ public final class RowReader { */ //C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java: //ORIGINAL LINE: public Result ReadUInt32(out uint value) - public Result ReadUInt32(tangible.OutObject value) { + public Result ReadUInt32(OutObject value) { switch (this.state) { case Schematized: return this.ReadPrimitiveValue(value); case Sparse: if (!(this.cursor.cellType instanceof LayoutUInt32)) { - value.argValue = 0; + value.set(0); return Result.TypeMismatch; } - tangible.RefObject tempRef_cursor = - new tangible.RefObject(this.cursor); - value.argValue = this.row.ReadSparseUInt32(tempRef_cursor); - this.cursor = tempRef_cursor.argValue; + RefObject tempRef_cursor = + new RefObject(this.cursor); + value.set(this.row.ReadSparseUInt32(tempRef_cursor)); + this.cursor = tempRef_cursor.get(); return Result.Success; default: - value.argValue = 0; + value.set(0); return Result.Failure; } } @@ -884,23 +919,23 @@ public final class RowReader { */ //C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java: //ORIGINAL LINE: public Result ReadUInt64(out ulong value) - public Result ReadUInt64(tangible.OutObject value) { + public Result ReadUInt64(OutObject value) { switch (this.state) { case Schematized: return this.ReadPrimitiveValue(value); case Sparse: if (!(this.cursor.cellType instanceof LayoutUInt64)) { - value.argValue = 0; + value.set(0); return Result.TypeMismatch; } - tangible.RefObject tempRef_cursor = - new tangible.RefObject(this.cursor); - value.argValue = this.row.ReadSparseUInt64(tempRef_cursor); - this.cursor = tempRef_cursor.argValue; + RefObject tempRef_cursor = + new RefObject(this.cursor); + value.set(this.row.ReadSparseUInt64(tempRef_cursor)); + this.cursor = tempRef_cursor.get(); return Result.Success; default: - value.argValue = 0; + value.set(0); return Result.Failure; } } @@ -913,23 +948,23 @@ public final class RowReader { */ //C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java: //ORIGINAL LINE: public Result ReadUInt8(out byte value) - public Result ReadUInt8(tangible.OutObject value) { + public Result ReadUInt8(OutObject value) { switch (this.state) { case Schematized: return this.ReadPrimitiveValue(value); case Sparse: if (!(this.cursor.cellType instanceof LayoutUInt8)) { - value.argValue = 0; + value.set(0); return Result.TypeMismatch; } - tangible.RefObject tempRef_cursor = - new tangible.RefObject(this.cursor); - value.argValue = this.row.ReadSparseUInt8(tempRef_cursor); - this.cursor = tempRef_cursor.argValue; + RefObject tempRef_cursor = + new RefObject(this.cursor); + value.set(this.row.ReadSparseUInt8(tempRef_cursor)); + this.cursor = tempRef_cursor.get(); return Result.Success; default: - value.argValue = 0; + value.set(0); return Result.Failure; } } @@ -940,23 +975,23 @@ public final class RowReader { * @param value On success, receives the value, undefined otherwise. * @return Success if the read is successful, an error code otherwise. */ - public Result ReadUnixDateTime(tangible.OutObject value) { + public Result ReadUnixDateTime(OutObject value) { switch (this.state) { case Schematized: return this.ReadPrimitiveValue(value.clone()); case Sparse: if (!(this.cursor.cellType instanceof LayoutUnixDateTime)) { - value.argValue = null; + value.set(null); return Result.TypeMismatch; } - tangible.RefObject tempRef_cursor = - new tangible.RefObject(this.cursor); - value.argValue = this.row.ReadSparseUnixDateTime(tempRef_cursor).clone(); - this.cursor = tempRef_cursor.argValue; + RefObject tempRef_cursor = + new RefObject(this.cursor); + value.set(this.row.ReadSparseUnixDateTime(tempRef_cursor).clone()); + this.cursor = tempRef_cursor.get(); return Result.Success; default: - value.argValue = null; + value.set(null); return Result.Failure; } } @@ -967,23 +1002,23 @@ public final class RowReader { * @param value On success, receives the value, undefined otherwise. * @return Success if the read is successful, an error code otherwise. */ - public Result ReadVarInt(tangible.OutObject value) { + public Result ReadVarInt(OutObject value) { switch (this.state) { case Schematized: return this.ReadPrimitiveValue(value); case Sparse: if (!(this.cursor.cellType instanceof LayoutVarInt)) { - value.argValue = 0; + value.set(0); return Result.TypeMismatch; } - tangible.RefObject tempRef_cursor = - new tangible.RefObject(this.cursor); - value.argValue = this.row.ReadSparseVarInt(tempRef_cursor); - this.cursor = tempRef_cursor.argValue; + RefObject tempRef_cursor = + new RefObject(this.cursor); + value.set(this.row.ReadSparseVarInt(tempRef_cursor)); + this.cursor = tempRef_cursor.get(); return Result.Success; default: - value.argValue = 0; + value.set(0); return Result.Failure; } } @@ -996,23 +1031,23 @@ public final class RowReader { */ //C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java: //ORIGINAL LINE: public Result ReadVarUInt(out ulong value) - public Result ReadVarUInt(tangible.OutObject value) { + public Result ReadVarUInt(OutObject value) { switch (this.state) { case Schematized: return this.ReadPrimitiveValue(value); case Sparse: if (!(this.cursor.cellType instanceof LayoutVarUInt)) { - value.argValue = 0; + value.set(0); return Result.TypeMismatch; } - tangible.RefObject tempRef_cursor = - new tangible.RefObject(this.cursor); - value.argValue = this.row.ReadSparseVarUInt(tempRef_cursor); - this.cursor = tempRef_cursor.argValue; + RefObject tempRef_cursor = + new RefObject(this.cursor); + value.set(this.row.ReadSparseVarUInt(tempRef_cursor)); + this.cursor = tempRef_cursor.get(); return Result.Success; default: - value.argValue = 0; + value.set(0); return Result.Failure; } } @@ -1030,19 +1065,19 @@ public final class RowReader { * This method can be used when the overload of that takes a * is not an option, such as when TContext is a ref struct. */ - public Result SkipScope(tangible.RefObject nestedReader) { - if (nestedReader.argValue.cursor.start != this.cursor.valueOffset) { + public Result SkipScope(RefObject nestedReader) { + if (nestedReader.get().cursor.start != this.cursor.valueOffset) { return Result.Failure; } - tangible.RefObject tempRef_row = - new tangible.RefObject(this.row); - tangible.RefObject tempRef_cursor = - new tangible.RefObject(nestedReader.argValue.cursor); - Microsoft.Azure.Cosmos.Serialization.HybridRow.RowCursorExtensions.Skip(this.cursor.clone(), tempRef_row, + RefObject tempRef_row = + new RefObject(this.row); + RefObject tempRef_cursor = + new RefObject(nestedReader.get().cursor); + RowCursorExtensions.Skip(this.cursor.clone(), tempRef_row, tempRef_cursor); - nestedReader.argValue.argValue.cursor = tempRef_cursor.argValue; - this.row = tempRef_row.argValue; + nestedReader.get().argValue.cursor = tempRef_cursor.get(); + this.row = tempRef_row.get(); return Result.Success; } @@ -1066,34 +1101,34 @@ public final class RowReader { * @param value On success, receives the value, undefined otherwise. * @return Success if the read is successful, an error code otherwise. */ - private Result ReadPrimitiveValue(tangible.OutObject value) { + private Result ReadPrimitiveValue(OutObject value) { LayoutColumn col = this.columns[this.columnIndex]; LayoutType t = this.columns[this.columnIndex].Type; if (!(t instanceof LayoutType)) { - value.argValue = null; + value.set(null); return Result.TypeMismatch; } switch (col == null ? null : col.getStorage()) { case Fixed: - tangible.RefObject tempRef_row = - new tangible.RefObject(this.row); - tangible.RefObject tempRef_cursor = - new tangible.RefObject(this.cursor); + RefObject tempRef_row = + new RefObject(this.row); + RefObject tempRef_cursor = + new RefObject(this.cursor); Result tempVar = t.>TypeAs().ReadFixed(tempRef_row, tempRef_cursor, col, value); - this.cursor = tempRef_cursor.argValue; - this.row = tempRef_row.argValue; + this.cursor = tempRef_cursor.get(); + this.row = tempRef_row.get(); return tempVar; case Variable: - tangible.RefObject tempRef_row2 = new tangible.RefObject(this.row); - tangible.RefObject tempRef_cursor2 = new tangible.RefObject(this.cursor); + RefObject tempRef_row2 = new RefObject(this.row); + RefObject tempRef_cursor2 = new RefObject(this.cursor); Result tempVar2 = t.>TypeAs().ReadVariable(tempRef_row2, tempRef_cursor2, col, value); - this.cursor = tempRef_cursor2.argValue; - this.row = tempRef_row2.argValue; + this.cursor = tempRef_cursor2.get(); + this.row = tempRef_row2.get(); return tempVar2; default: - Contract.Assert(false); - value.argValue = null; + throw new IllegalStateException(); + value.set(null); return Result.Failure; } } @@ -1104,32 +1139,32 @@ public final class RowReader { * @param value On success, receives the value, undefined otherwise. * @return Success if the read is successful, an error code otherwise. */ - private Result ReadPrimitiveValue(tangible.OutObject value) { + private Result ReadPrimitiveValue(OutObject value) { LayoutColumn col = this.columns[this.columnIndex]; LayoutType t = this.columns[this.columnIndex].Type; if (!(t instanceof ILayoutUtf8SpanReadable)) { - value.argValue = null; + value.set(null); return Result.TypeMismatch; } switch (col == null ? null : col.getStorage()) { case Fixed: - tangible.RefObject tempRef_row = new tangible.RefObject(this.row); - tangible.RefObject tempRef_cursor = new tangible.RefObject(this.cursor); + RefObject tempRef_row = new RefObject(this.row); + RefObject tempRef_cursor = new RefObject(this.cursor); Result tempVar = t.TypeAs().ReadFixed(tempRef_row, tempRef_cursor, col, value); - this.cursor = tempRef_cursor.argValue; - this.row = tempRef_row.argValue; + this.cursor = tempRef_cursor.get(); + this.row = tempRef_row.get(); return tempVar; case Variable: - tangible.RefObject tempRef_row2 = new tangible.RefObject(this.row); - tangible.RefObject tempRef_cursor2 = new tangible.RefObject(this.cursor); + RefObject tempRef_row2 = new RefObject(this.row); + RefObject tempRef_cursor2 = new RefObject(this.cursor); Result tempVar2 = t.TypeAs().ReadVariable(tempRef_row2, tempRef_cursor2, col, value); - this.cursor = tempRef_cursor2.argValue; - this.row = tempRef_row2.argValue; + this.cursor = tempRef_cursor2.get(); + this.row = tempRef_row2.get(); return tempVar2; default: - Contract.Assert(false); - value.argValue = null; + throw new IllegalStateException(); + value.set(null); return Result.Failure; } } @@ -1141,32 +1176,32 @@ public final class RowReader { * @param value On success, receives the value, undefined otherwise. * @return Success if the read is successful, an error code otherwise. */ - private Result ReadPrimitiveValue(tangible.OutObject> value) { + private Result ReadPrimitiveValue(OutObject> value) { LayoutColumn col = this.columns[this.columnIndex]; LayoutType t = this.columns[this.columnIndex].Type; if (!(t instanceof ILayoutSpanReadable)) { - value.argValue = null; + value.set(null); return Result.TypeMismatch; } switch (col == null ? null : col.getStorage()) { case Fixed: - tangible.RefObject tempRef_row = new tangible.RefObject(this.row); - tangible.RefObject tempRef_cursor = new tangible.RefObject(this.cursor); + RefObject tempRef_row = new RefObject(this.row); + RefObject tempRef_cursor = new RefObject(this.cursor); Result tempVar = t.>TypeAs().ReadFixed(tempRef_row, tempRef_cursor, col, value); - this.cursor = tempRef_cursor.argValue; - this.row = tempRef_row.argValue; + this.cursor = tempRef_cursor.get(); + this.row = tempRef_row.get(); return tempVar; case Variable: - tangible.RefObject tempRef_row2 = new tangible.RefObject(this.row); - tangible.RefObject tempRef_cursor2 = new tangible.RefObject(this.cursor); + RefObject tempRef_row2 = new RefObject(this.row); + RefObject tempRef_cursor2 = new RefObject(this.cursor); Result tempVar2 = t.>TypeAs().ReadVariable(tempRef_row2, tempRef_cursor2, col, value); - this.cursor = tempRef_cursor2.argValue; - this.row = tempRef_row2.argValue; + this.cursor = tempRef_cursor2.get(); + this.row = tempRef_row2.get(); return tempVar2; default: - Contract.Assert(false); - value.argValue = null; + throw new IllegalStateException(); + value.set(null); return Result.Failure; } } @@ -1218,7 +1253,7 @@ public final class RowReader { */ @FunctionalInterface public interface ReaderFunc { - Result invoke(tangible.RefObject reader, TContext context); + Result invoke(RefObject reader, TContext context); } /** diff --git a/jre/src/main/java/azure/data/cosmos/serialization/hybridrow/io/RowReaderExtensions.java b/jre/src/main/java/com/azure/data/cosmos/serialization/hybridrow/io/RowReaderExtensions.java similarity index 68% rename from jre/src/main/java/azure/data/cosmos/serialization/hybridrow/io/RowReaderExtensions.java rename to jre/src/main/java/com/azure/data/cosmos/serialization/hybridrow/io/RowReaderExtensions.java index be4a64a..87be9cf 100644 --- a/jre/src/main/java/azure/data/cosmos/serialization/hybridrow/io/RowReaderExtensions.java +++ b/jre/src/main/java/com/azure/data/cosmos/serialization/hybridrow/io/RowReaderExtensions.java @@ -2,9 +2,11 @@ // Copyright (c) Microsoft Corporation. All rights reserved. //------------------------------------------------------------ -package azure.data.cosmos.serialization.hybridrow.io; +package com.azure.data.cosmos.serialization.hybridrow.io; -import azure.data.cosmos.serialization.hybridrow.Result; +import com.azure.data.cosmos.core.OutObject; +import com.azure.data.cosmos.core.RefObject; +import com.azure.data.cosmos.serialization.hybridrow.Result; import java.util.ArrayList; @@ -19,28 +21,28 @@ public final class RowReaderExtensions { * @param list On success, the collection of materialized items. * @return The result. */ - public static Result ReadList(tangible.RefObject reader, DeserializerFunc deserializer, - tangible.OutObject> list) { + public static Result ReadList(RefObject reader, DeserializerFunc deserializer, + OutObject> list) { // Pass the context as a struct by value to avoid allocations. ListContext ctx = new ListContext(); - ctx.List = new ArrayList(); + ctx.List = new ArrayList<>(); ctx.Deserializer = - (tangible.RefObject reader.argValue, tangible.OutObject item) -> deserializer.invoke(reader.argValue.clone(), item); + (RefObject reader.argValue, OutObject item) -> deserializer.invoke(reader.get().clone(), item); // All lambda's here are static. // 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.argValue.ReadScope(ctx.clone(), (ref RowReader arrayReader, ListContext ctx1) -> + Result r = reader.get().ReadScope(ctx.clone(), (ref RowReader arrayReader, ListContext ctx1) -> { while (arrayReader.Read()) { Result r2 = arrayReader.ReadScope(ctx1.clone(), (ref RowReader itemReader, ListContext ctx2) -> { - tangible.RefObject tempRef_itemReader = new tangible.RefObject(itemReader); + RefObject tempRef_itemReader = new RefObject(itemReader); TItem op; - tangible.OutObject tempOut_op = new tangible.OutObject(); + OutObject tempOut_op = new OutObject(); Result r3 = ctx2.Deserializer.invoke(tempRef_itemReader, tempOut_op); - op = tempOut_op.argValue; - itemReader = tempRef_itemReader.argValue; + op = tempOut_op.get(); + itemReader = tempRef_itemReader.get(); if (r3 != Result.Success) { return r3; } @@ -58,11 +60,11 @@ public final class RowReaderExtensions { }); if (r != Result.Success) { - list.argValue = null; + list.set(null); return r; } - list.argValue = ctx.List; + list.set(ctx.List); return Result.Success; } @@ -76,7 +78,7 @@ public final class RowReaderExtensions { */ @FunctionalInterface public interface DeserializerFunc { - Result invoke(tangible.RefObject reader, tangible.OutObject item); + Result invoke(RefObject reader, OutObject item); } //C# TO JAVA CONVERTER WARNING: Java does not allow user-defined value types. The behavior of this class may diff --git a/jre/src/main/java/azure/data/cosmos/serialization/hybridrow/io/RowWriter.java b/jre/src/main/java/com/azure/data/cosmos/serialization/hybridrow/io/RowWriter.java similarity index 75% rename from jre/src/main/java/azure/data/cosmos/serialization/hybridrow/io/RowWriter.java rename to jre/src/main/java/com/azure/data/cosmos/serialization/hybridrow/io/RowWriter.java index 6825088..f32e935 100644 --- a/jre/src/main/java/azure/data/cosmos/serialization/hybridrow/io/RowWriter.java +++ b/jre/src/main/java/com/azure/data/cosmos/serialization/hybridrow/io/RowWriter.java @@ -2,14 +2,23 @@ // Copyright (c) Microsoft Corporation. All rights reserved. //------------------------------------------------------------ -package azure.data.cosmos.serialization.hybridrow.io; +package com.azure.data.cosmos.serialization.hybridrow.io; -import azure.data.cosmos.serialization.hybridrow.Float128; -import azure.data.cosmos.serialization.hybridrow.NullValue; -import azure.data.cosmos.serialization.hybridrow.Result; -import azure.data.cosmos.serialization.hybridrow.RowBuffer; -import azure.data.cosmos.serialization.hybridrow.RowCursor; -import azure.data.cosmos.serialization.hybridrow.UnixDateTime; +import com.azure.data.cosmos.core.OutObject; +import com.azure.data.cosmos.core.RefObject; +import com.azure.data.cosmos.serialization.hybridrow.Float128; +import com.azure.data.cosmos.serialization.hybridrow.NullValue; +import com.azure.data.cosmos.serialization.hybridrow.Result; +import com.azure.data.cosmos.serialization.hybridrow.RowBuffer; +import com.azure.data.cosmos.serialization.hybridrow.RowCursor; +import com.azure.data.cosmos.serialization.hybridrow.UnixDateTime; +import com.azure.data.cosmos.serialization.hybridrow.RowCursorExtensions; +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.LayoutType; +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.UpdateOptions; import java.math.BigDecimal; import java.time.LocalDateTime; @@ -36,9 +45,9 @@ public final class RowWriter { public RowWriter() { } - private RowWriter(tangible.RefObject row, tangible.RefObject scope) { - this.row = row.argValue.clone(); - this.cursor = scope.argValue.clone(); + private RowWriter(RefObject row, RefObject scope) { + this.row = row.get().clone(); + this.cursor = scope.get().clone(); } /** @@ -151,21 +160,21 @@ public final class RowWriter { * @param func A function to write the entire row. * @return Success if the write is successful, an error code otherwise. */ - public static Result WriteBuffer(tangible.RefObject row, TContext context, + public static Result WriteBuffer(RefObject row, TContext context, WriterFunc func) { RowCursor scope = RowCursor.Create(row); - tangible.RefObject tempRef_scope = - new tangible.RefObject(scope); + RefObject tempRef_scope = + new RefObject(scope); RowWriter writer = new RowWriter(row, tempRef_scope); - scope = tempRef_scope.argValue; + scope = tempRef_scope.get(); TypeArgument typeArg = new TypeArgument(LayoutType.UDT, new TypeArgumentList(scope.layout.getSchemaId().clone())); - tangible.RefObject tempRef_writer = - new tangible.RefObject(writer); + RefObject tempRef_writer = + new RefObject(writer); // TODO: C# TO JAVA CONVERTER: The following line could not be converted: Result result = func(ref writer, typeArg, context); - writer = tempRef_writer.argValue; - row.argValue = writer.row.clone(); + writer = tempRef_writer.get(); + row.set(writer.row.clone()); return result; } @@ -374,37 +383,37 @@ public final class RowWriter { //ORIGINAL LINE: case LayoutObject scopeType: case LayoutObject scopeType: - tangible.RefObject tempRef_cursor = - new tangible.RefObject(this.cursor); - tangible.OutObject tempOut_nestedScope = - new tangible.OutObject(); + RefObject tempRef_cursor = + new RefObject(this.cursor); + OutObject tempOut_nestedScope = + new OutObject(); this.row.WriteSparseObject(tempRef_cursor, scopeType, UpdateOptions.Upsert, tempOut_nestedScope); - nestedScope = tempOut_nestedScope.argValue; + nestedScope = tempOut_nestedScope.get(); this.cursor = tempRef_cursor.argValue; break; // TODO: C# TO JAVA CONVERTER: Java has no equivalent to C# pattern variables in 'case' statements: //ORIGINAL LINE: case LayoutArray scopeType: case LayoutArray scopeType: - tangible.RefObject tempRef_cursor2 = - new tangible.RefObject(this.cursor); - tangible.OutObject tempOut_nestedScope2 = - new tangible.OutObject(); + RefObject tempRef_cursor2 = + new RefObject(this.cursor); + OutObject tempOut_nestedScope2 = + new OutObject(); this.row.WriteSparseArray(tempRef_cursor2, scopeType, UpdateOptions.Upsert, tempOut_nestedScope2); - nestedScope = tempOut_nestedScope2.argValue; + nestedScope = tempOut_nestedScope2.get(); this.cursor = tempRef_cursor2.argValue; break; // TODO: C# TO JAVA CONVERTER: Java has no equivalent to C# pattern variables in 'case' statements: //ORIGINAL LINE: case LayoutTypedArray scopeType: case LayoutTypedArray scopeType: - tangible.RefObject tempRef_cursor3 = - new tangible.RefObject(this.cursor); - tangible.OutObject tempOut_nestedScope3 = - new tangible.OutObject(); + RefObject tempRef_cursor3 = + new RefObject(this.cursor); + OutObject tempOut_nestedScope3 = + new OutObject(); this.row.WriteTypedArray(tempRef_cursor3, scopeType, typeArg.getTypeArgs().clone(), UpdateOptions.Upsert, tempOut_nestedScope3); - nestedScope = tempOut_nestedScope3.argValue; + nestedScope = tempOut_nestedScope3.get(); this.cursor = tempRef_cursor3.argValue; break; @@ -412,13 +421,13 @@ public final class RowWriter { //ORIGINAL LINE: case LayoutTuple scopeType: case LayoutTuple scopeType: - tangible.RefObject tempRef_cursor4 = - new tangible.RefObject(this.cursor); - tangible.OutObject tempOut_nestedScope4 = - new tangible.OutObject(); + RefObject tempRef_cursor4 = + new RefObject(this.cursor); + OutObject tempOut_nestedScope4 = + new OutObject(); this.row.WriteSparseTuple(tempRef_cursor4, scopeType, typeArg.getTypeArgs().clone(), UpdateOptions.Upsert, tempOut_nestedScope4); - nestedScope = tempOut_nestedScope4.argValue; + nestedScope = tempOut_nestedScope4.get(); this.cursor = tempRef_cursor4.argValue; break; @@ -426,13 +435,13 @@ public final class RowWriter { //ORIGINAL LINE: case LayoutTypedTuple scopeType: case LayoutTypedTuple scopeType: - tangible.RefObject tempRef_cursor5 = - new tangible.RefObject(this.cursor); - tangible.OutObject tempOut_nestedScope5 = - new tangible.OutObject(); + RefObject tempRef_cursor5 = + new RefObject(this.cursor); + OutObject tempOut_nestedScope5 = + new OutObject(); this.row.WriteTypedTuple(tempRef_cursor5, scopeType, typeArg.getTypeArgs().clone(), UpdateOptions.Upsert, tempOut_nestedScope5); - nestedScope = tempOut_nestedScope5.argValue; + nestedScope = tempOut_nestedScope5.get(); this.cursor = tempRef_cursor5.argValue; break; @@ -440,13 +449,13 @@ public final class RowWriter { //ORIGINAL LINE: case LayoutTagged scopeType: case LayoutTagged scopeType: - tangible.RefObject tempRef_cursor6 = - new tangible.RefObject(this.cursor); - tangible.OutObject tempOut_nestedScope6 = - new tangible.OutObject(); + RefObject tempRef_cursor6 = + new RefObject(this.cursor); + OutObject tempOut_nestedScope6 = + new OutObject(); this.row.WriteTypedTuple(tempRef_cursor6, scopeType, typeArg.getTypeArgs().clone(), UpdateOptions.Upsert, tempOut_nestedScope6); - nestedScope = tempOut_nestedScope6.argValue; + nestedScope = tempOut_nestedScope6.get(); this.cursor = tempRef_cursor6.argValue; break; @@ -454,13 +463,13 @@ public final class RowWriter { //ORIGINAL LINE: case LayoutTagged2 scopeType: case LayoutTagged2 scopeType: - tangible.RefObject tempRef_cursor7 = - new tangible.RefObject(this.cursor); - tangible.OutObject tempOut_nestedScope7 = - new tangible.OutObject(); + RefObject tempRef_cursor7 = + new RefObject(this.cursor); + OutObject tempOut_nestedScope7 = + new OutObject(); this.row.WriteTypedTuple(tempRef_cursor7, scopeType, typeArg.getTypeArgs().clone(), UpdateOptions.Upsert, tempOut_nestedScope7); - nestedScope = tempOut_nestedScope7.argValue; + nestedScope = tempOut_nestedScope7.get(); this.cursor = tempRef_cursor7.argValue; break; @@ -468,13 +477,13 @@ public final class RowWriter { //ORIGINAL LINE: case LayoutNullable scopeType: case LayoutNullable scopeType: - tangible.RefObject tempRef_cursor8 = - new tangible.RefObject(this.cursor); - tangible.OutObject tempOut_nestedScope8 = - new tangible.OutObject(); + RefObject tempRef_cursor8 = + new RefObject(this.cursor); + OutObject tempOut_nestedScope8 = + new OutObject(); this.row.WriteNullable(tempRef_cursor8, scopeType, typeArg.getTypeArgs().clone(), UpdateOptions.Upsert, func != null, tempOut_nestedScope8); - nestedScope = tempOut_nestedScope8.argValue; + nestedScope = tempOut_nestedScope8.get(); this.cursor = tempRef_cursor8.argValue; break; @@ -483,26 +492,26 @@ public final class RowWriter { case LayoutUDT scopeType: Layout udt = this.row.getResolver().Resolve(typeArg.getTypeArgs().getSchemaId().clone()); - tangible.RefObject tempRef_cursor9 = - new tangible.RefObject(this.cursor); - tangible.OutObject tempOut_nestedScope9 = - new tangible.OutObject(); + RefObject tempRef_cursor9 = + new RefObject(this.cursor); + OutObject tempOut_nestedScope9 = + new OutObject(); this.row.WriteSparseUDT(tempRef_cursor9, scopeType, udt, UpdateOptions.Upsert, tempOut_nestedScope9); - nestedScope = tempOut_nestedScope9.argValue; - this.cursor = tempRef_cursor9.argValue; + nestedScope = tempOut_nestedScope9.get(); + this.cursor = tempRef_cursor9.get(); break; // TODO: C# TO JAVA CONVERTER: Java has no equivalent to C# pattern variables in 'case' statements: //ORIGINAL LINE: case LayoutTypedSet scopeType: case LayoutTypedSet scopeType: - tangible.RefObject tempRef_cursor10 = - new tangible.RefObject(this.cursor); - tangible.OutObject tempOut_nestedScope10 = - new tangible.OutObject(); + RefObject tempRef_cursor10 = + new RefObject(this.cursor); + OutObject tempOut_nestedScope10 = + new OutObject(); this.row.WriteTypedSet(tempRef_cursor10, scopeType, typeArg.getTypeArgs().clone(), UpdateOptions.Upsert, tempOut_nestedScope10); - nestedScope = tempOut_nestedScope10.argValue; + nestedScope = tempOut_nestedScope10.get(); this.cursor = tempRef_cursor10.argValue; break; @@ -510,13 +519,13 @@ public final class RowWriter { //ORIGINAL LINE: case LayoutTypedMap scopeType: case LayoutTypedMap scopeType: - tangible.RefObject tempRef_cursor11 = - new tangible.RefObject(this.cursor); - tangible.OutObject tempOut_nestedScope11 = - new tangible.OutObject(); + RefObject tempRef_cursor11 = + new RefObject(this.cursor); + OutObject tempOut_nestedScope11 = + new OutObject(); this.row.WriteTypedMap(tempRef_cursor11, scopeType, typeArg.getTypeArgs().clone(), UpdateOptions.Upsert, tempOut_nestedScope11); - nestedScope = tempOut_nestedScope11.argValue; + nestedScope = tempOut_nestedScope11.get(); this.cursor = tempRef_cursor11.argValue; break; @@ -525,18 +534,18 @@ public final class RowWriter { return Result.Failure; } - tangible.RefObject tempRef_row = - new tangible.RefObject(this.row); - tangible.RefObject tempRef_nestedScope = - new tangible.RefObject(nestedScope); + RefObject tempRef_row = + new RefObject(this.row); + RefObject tempRef_nestedScope = + new RefObject(nestedScope); RowWriter nestedWriter = new RowWriter(tempRef_row, tempRef_nestedScope); - nestedScope = tempRef_nestedScope.argValue; - this.row = tempRef_row.argValue; - tangible.RefObject tempRef_nestedWriter = - new tangible.RefObject(nestedWriter); + nestedScope = tempRef_nestedScope.get(); + this.row = tempRef_row.get(); + RefObject tempRef_nestedWriter = + new RefObject(nestedWriter); // TODO: C# TO JAVA CONVERTER: The following line could not be converted: result = func == null ? null : func.Invoke(ref nestedWriter, typeArg, context) ??Result.Success; - nestedWriter = tempRef_nestedWriter.argValue; + nestedWriter = tempRef_nestedWriter.get(); this.row = nestedWriter.row.clone(); nestedScope.count = nestedWriter.cursor.count; @@ -546,24 +555,24 @@ public final class RowWriter { } if (type instanceof LayoutUniqueScope) { - tangible.RefObject tempRef_nestedScope2 = - new tangible.RefObject(nestedScope); + RefObject tempRef_nestedScope2 = + new RefObject(nestedScope); result = this.row.TypedCollectionUniqueIndexRebuild(tempRef_nestedScope2); - nestedScope = tempRef_nestedScope2.argValue; + nestedScope = tempRef_nestedScope2.get(); if (result != Result.Success) { // TODO: If the index rebuild fails then the row is corrupted. Should we automatically clean up here? return result; } } - tangible.RefObject tempRef_row2 = - new tangible.RefObject(this.row); - tangible.RefObject tempRef_cursor12 = - new tangible.RefObject(nestedWriter.cursor); - Microsoft.Azure.Cosmos.Serialization.HybridRow.RowCursorExtensions.MoveNext(this.cursor.clone(), tempRef_row2 + RefObject tempRef_row2 = + new RefObject(this.row); + RefObject tempRef_cursor12 = + new RefObject(nestedWriter.cursor); + RowCursorExtensions.MoveNext(this.cursor.clone(), tempRef_row2 , tempRef_cursor12); - nestedWriter.cursor = tempRef_cursor12.argValue; - this.row = tempRef_row2.argValue; + nestedWriter.cursor = tempRef_cursor12.get(); + this.row = tempRef_row2.get(); return Result.Success; } @@ -760,13 +769,13 @@ public final class RowWriter { return Result.TypeConstraint; } } else if (this.cursor.scopeType instanceof LayoutTypedMap) { - tangible.RefObject tempRef_cursor = - new tangible.RefObject(this.cursor); + RefObject tempRef_cursor = + new RefObject(this.cursor); if (!typeArg.equals(this.cursor.scopeType.TypeAs().FieldType(tempRef_cursor).clone())) { - this.cursor = tempRef_cursor.argValue; + this.cursor = tempRef_cursor.get(); return Result.TypeConstraint; } else { - this.cursor = tempRef_cursor.argValue; + this.cursor = tempRef_cursor.get(); } } else if (this.cursor.scopeType.IsTypedScope && !typeArg.equals(this.cursor.scopeTypeArgs.get(0).clone())) { return Result.TypeConstraint; @@ -799,16 +808,16 @@ public final class RowWriter { return result; } - tangible.RefObject tempRef_this = - new tangible.RefObject(this); + RefObject tempRef_this = + new RefObject(this); // TODO: C# TO JAVA CONVERTER: The following line could not be converted: sparse(ref this, value) - this = tempRef_this.argValue; - tangible.RefObject tempRef_row = - new tangible.RefObject(this.row); - Microsoft.Azure.Cosmos.Serialization.HybridRow.RowCursorExtensions.MoveNext(this.cursor.clone(), + this = tempRef_this.get(); + RefObject tempRef_row = + new RefObject(this.row); + RowCursorExtensions.MoveNext(this.cursor.clone(), tempRef_row); - this.row = tempRef_row.argValue; + this.row = tempRef_row.get(); } return result; @@ -838,16 +847,16 @@ public final class RowWriter { return result; } - tangible.RefObject tempRef_this = - new tangible.RefObject(this); + RefObject tempRef_this = + new RefObject(this); // TODO: C# TO JAVA CONVERTER: The following line could not be converted: sparse(ref this, value) - this = tempRef_this.argValue; - tangible.RefObject tempRef_row = - new tangible.RefObject(this.row); - Microsoft.Azure.Cosmos.Serialization.HybridRow.RowCursorExtensions.MoveNext(this.cursor.clone(), + this = tempRef_this.get(); + RefObject tempRef_row = + new RefObject(this.row); + RowCursorExtensions.MoveNext(this.cursor.clone(), tempRef_row); - this.row = tempRef_row.argValue; + this.row = tempRef_row.get(); } return result; @@ -877,16 +886,16 @@ public final class RowWriter { return result; } - tangible.RefObject tempRef_this = - new tangible.RefObject(this); + RefObject tempRef_this = + new RefObject(this); // TODO: C# TO JAVA CONVERTER: The following line could not be converted: sparse(ref this, value) - this = tempRef_this.argValue; - tangible.RefObject tempRef_row = - new tangible.RefObject(this.row); - Microsoft.Azure.Cosmos.Serialization.HybridRow.RowCursorExtensions.MoveNext(this.cursor.clone(), + this = tempRef_this.get(); + RefObject tempRef_row = + new RefObject(this.row); + RowCursorExtensions.MoveNext(this.cursor.clone(), tempRef_row); - this.row = tempRef_row.argValue; + this.row = tempRef_row.get(); } return result; @@ -917,16 +926,16 @@ public final class RowWriter { return result; } - tangible.RefObject tempRef_this = - new tangible.RefObject(this); + RefObject tempRef_this = + new RefObject(this); // TODO: C# TO JAVA CONVERTER: The following line could not be converted: sparse(ref this, value) - this = tempRef_this.argValue; - tangible.RefObject tempRef_row = - new tangible.RefObject(this.row); - Microsoft.Azure.Cosmos.Serialization.HybridRow.RowCursorExtensions.MoveNext(this.cursor.clone(), + this = tempRef_this.get(); + RefObject tempRef_row = + new RefObject(this.row); + RowCursorExtensions.MoveNext(this.cursor.clone(), tempRef_row); - this.row = tempRef_row.argValue; + this.row = tempRef_row.get(); } return result; @@ -956,17 +965,17 @@ public final class RowWriter { switch (col.Storage) { case StorageKind.Fixed: - tangible.RefObject tempRef_row = - new tangible.RefObject(this.row); + RefObject tempRef_row = + new RefObject(this.row); Result tempVar2 = t.WriteFixed(ref this.row, ref this.cursor, col, value) - this.row = tempRef_row.argValue; + this.row = tempRef_row.get(); return tempVar2; case StorageKind.Variable: - tangible.RefObject tempRef_row2 = - new tangible.RefObject(this.row); + RefObject tempRef_row2 = + new RefObject(this.row); Result tempVar3 = t.WriteVariable(ref this.row, ref this.cursor, col, value) - this.row = tempRef_row2.argValue; + this.row = tempRef_row2.get(); return tempVar3; default: @@ -998,24 +1007,24 @@ public final class RowWriter { switch (col.Storage) { case StorageKind.Fixed: - tangible.RefObject tempRef_row = - new tangible.RefObject(this.row); - tangible.RefObject tempRef_cursor = - new tangible.RefObject(this.cursor); + RefObject tempRef_row = + new RefObject(this.row); + RefObject tempRef_cursor = + new RefObject(this.cursor); Result tempVar = t.TypeAs().WriteFixed(tempRef_row, tempRef_cursor, col, value); - this.cursor = tempRef_cursor.argValue; - this.row = tempRef_row.argValue; + this.cursor = tempRef_cursor.get(); + this.row = tempRef_row.get(); return tempVar; case StorageKind.Variable: - tangible.RefObject tempRef_row2 = - new tangible.RefObject(this.row); - tangible.RefObject tempRef_cursor2 = - new tangible.RefObject(this.cursor); + RefObject tempRef_row2 = + new RefObject(this.row); + RefObject tempRef_cursor2 = + new RefObject(this.cursor); Result tempVar2 = t.TypeAs().WriteVariable(tempRef_row2, tempRef_cursor2, col, value); - this.cursor = tempRef_cursor2.argValue; - this.row = tempRef_row2.argValue; + this.cursor = tempRef_cursor2.get(); + this.row = tempRef_row2.get(); return tempVar2; default: return Result.NotFound; @@ -1044,18 +1053,18 @@ public final class RowWriter { switch (col.Storage) { case StorageKind.Fixed: - tangible.RefObject tempRef_row = new tangible.RefObject(this.row); - tangible.RefObject tempRef_cursor = new tangible.RefObject(this.cursor); + RefObject tempRef_row = new RefObject(this.row); + RefObject tempRef_cursor = new RefObject(this.cursor); Result tempVar = t.>TypeAs().WriteFixed(tempRef_row, tempRef_cursor, col, value); - this.cursor = tempRef_cursor.argValue; - this.row = tempRef_row.argValue; + this.cursor = tempRef_cursor.get(); + this.row = tempRef_row.get(); return tempVar; case StorageKind.Variable: - tangible.RefObject tempRef_row2 = new tangible.RefObject(this.row); - tangible.RefObject tempRef_cursor2 = new tangible.RefObject(this.cursor); + RefObject tempRef_row2 = new RefObject(this.row); + RefObject tempRef_cursor2 = new RefObject(this.cursor); Result tempVar2 = t.>TypeAs().WriteVariable(tempRef_row2, tempRef_cursor2, col, value); - this.cursor = tempRef_cursor2.argValue; - this.row = tempRef_row2.argValue; + this.cursor = tempRef_cursor2.get(); + this.row = tempRef_row2.get(); return tempVar2; default: return Result.NotFound; @@ -1084,18 +1093,18 @@ public final class RowWriter { switch (col.Storage) { case StorageKind.Fixed: - tangible.RefObject tempRef_row = new tangible.RefObject(this.row); - tangible.RefObject tempRef_cursor = new tangible.RefObject(this.cursor); + RefObject tempRef_row = new RefObject(this.row); + RefObject tempRef_cursor = new RefObject(this.cursor); Result tempVar = t.>TypeAs().WriteFixed(tempRef_row, tempRef_cursor, col, value); - this.cursor = tempRef_cursor.argValue; - this.row = tempRef_row.argValue; + this.cursor = tempRef_cursor.get(); + this.row = tempRef_row.get(); return tempVar; case StorageKind.Variable: - tangible.RefObject tempRef_row2 = new tangible.RefObject(this.row); - tangible.RefObject tempRef_cursor2 = new tangible.RefObject(this.cursor); + RefObject tempRef_row2 = new RefObject(this.row); + RefObject tempRef_cursor2 = new RefObject(this.cursor); Result tempVar2 = t.>TypeAs().WriteVariable(tempRef_row2, tempRef_cursor2, col, value); - this.cursor = tempRef_cursor2.argValue; - this.row = tempRef_row2.argValue; + this.cursor = tempRef_cursor2.get(); + this.row = tempRef_row2.get(); return tempVar2; default: return Result.NotFound; @@ -1104,17 +1113,17 @@ public final class RowWriter { @FunctionalInterface private interface AccessMethod { - void invoke(tangible.RefObject writer, TValue value); + void invoke(RefObject writer, TValue value); } @FunctionalInterface private interface AccessReadOnlySpanMethod { - void invoke(tangible.RefObject writer, ReadOnlySpan value); + void invoke(RefObject writer, ReadOnlySpan value); } @FunctionalInterface private interface AccessUtf8SpanMethod { - void invoke(tangible.RefObject writer, Utf8Span value); + void invoke(RefObject writer, Utf8Span value); } /** @@ -1128,6 +1137,6 @@ public final class RowWriter { */ @FunctionalInterface public interface WriterFunc { - Result invoke(tangible.RefObject writer, TypeArgument typeArg, TContext context); + Result invoke(RefObject writer, TypeArgument typeArg, TContext context); } } \ No newline at end of file diff --git a/jre/src/main/java/azure/data/cosmos/serialization/hybridrow/json/RowReaderJsonExtensions.java b/jre/src/main/java/com/azure/data/cosmos/serialization/hybridrow/json/RowReaderJsonExtensions.java similarity index 65% rename from jre/src/main/java/azure/data/cosmos/serialization/hybridrow/json/RowReaderJsonExtensions.java rename to jre/src/main/java/com/azure/data/cosmos/serialization/hybridrow/json/RowReaderJsonExtensions.java index 76fa088..b966239 100644 --- a/jre/src/main/java/azure/data/cosmos/serialization/hybridrow/json/RowReaderJsonExtensions.java +++ b/jre/src/main/java/com/azure/data/cosmos/serialization/hybridrow/json/RowReaderJsonExtensions.java @@ -2,13 +2,17 @@ // Copyright (c) Microsoft Corporation. All rights reserved. //------------------------------------------------------------ -package azure.data.cosmos.serialization.hybridrow.json; +package com.azure.data.cosmos.serialization.hybridrow.json; -import azure.data.cosmos.serialization.hybridrow.Float128; -import azure.data.cosmos.serialization.hybridrow.NullValue; -import azure.data.cosmos.serialization.hybridrow.Result; -import azure.data.cosmos.serialization.hybridrow.UnixDateTime; -import azure.data.cosmos.serialization.hybridrow.io.RowReader; +import com.azure.data.cosmos.core.OutObject; +import com.azure.data.cosmos.core.RefObject; +import com.azure.data.cosmos.serialization.hybridrow.Float128; +import com.azure.data.cosmos.serialization.hybridrow.NullValue; +import com.azure.data.cosmos.serialization.hybridrow.Result; +import com.azure.data.cosmos.serialization.hybridrow.UnixDateTime; +import com.azure.data.cosmos.serialization.hybridrow.io.RowReader; + +import java.util.UUID; public final class RowReaderJsonExtensions { /** @@ -18,8 +22,8 @@ public final class RowReaderJsonExtensions { * @param str If successful, the JSON document that corresponds to the . * @return The result. */ - public static Result ToJson(tangible.RefObject reader, tangible.OutObject str) { - return azure.data.cosmos.serialization.hybridrow.json.RowReaderJsonExtensions.ToJson(reader.argValue.clone(), new RowReaderJsonSettings(" "), str); + public static Result ToJson(RefObject reader, OutObject str) { + return RowReaderJsonExtensions.ToJson(reader.get().clone(), new RowReaderJsonSettings(" "), str); } /** @@ -30,29 +34,29 @@ public final class RowReaderJsonExtensions { * @param str If successful, the JSON document that corresponds to the . * @return The result. */ - public static Result ToJson(tangible.RefObject reader, RowReaderJsonSettings settings, - tangible.OutObject str) { + public static Result ToJson(RefObject reader, RowReaderJsonSettings settings, + OutObject str) { ReaderStringContext ctx = new ReaderStringContext(new StringBuilder(), new RowReaderJsonSettings(settings.IndentChars, settings.QuoteChar == '\'' ? '\'' : '"'), 1); ctx.Builder.append("{"); Result result = RowReaderJsonExtensions.ToJson(reader, ctx.clone()); if (result != Result.Success) { - str.argValue = null; + str.set(null); return result; } ctx.Builder.append(ctx.NewLine); ctx.Builder.append("}"); - str.argValue = ctx.Builder.toString(); + str.set(ctx.Builder.toString()); return Result.Success; } - private static Result ToJson(tangible.RefObject reader, ReaderStringContext ctx) { + private static Result ToJson(RefObject reader, ReaderStringContext ctx) { int index = 0; - while (reader.argValue.Read()) { - String path = !reader.argValue.getPath().IsNull ? String.format("%1$s%2$s%3$s:", ctx.Settings.QuoteChar, - reader.argValue.getPath(), ctx.Settings.QuoteChar) : null; + while (reader.get().Read()) { + String path = !reader.get().getPath().IsNull ? String.format("%1$s%2$s%3$s:", ctx.Settings.QuoteChar, + reader.get().getPath(), ctx.Settings.QuoteChar) : null; if (index != 0) { ctx.Builder.append(','); } @@ -68,13 +72,13 @@ public final class RowReaderJsonExtensions { Result r; char scopeBracket = '\0'; char scopeCloseBracket = '\0'; - switch (reader.argValue.getType().LayoutCode) { + switch (reader.get().getType().LayoutCode) { case Null: { NullValue _; - tangible.OutObject tempOut__ = - new tangible.OutObject(); - r = reader.argValue.ReadNull(tempOut__); - _ = tempOut__.argValue; + OutObject tempOut__ = + new OutObject(); + r = reader.get().ReadNull(tempOut__); + _ = tempOut__.get(); if (r != Result.Success) { return r; } @@ -85,9 +89,9 @@ public final class RowReaderJsonExtensions { case Boolean: { boolean value; - tangible.OutObject tempOut_value = new tangible.OutObject(); - r = reader.argValue.ReadBool(tempOut_value); - value = tempOut_value.argValue; + OutObject tempOut_value = new OutObject(); + r = reader.get().ReadBool(tempOut_value); + value = tempOut_value.get(); if (r != Result.Success) { return r; } @@ -98,9 +102,9 @@ public final class RowReaderJsonExtensions { case Int8: { byte value; - tangible.OutObject tempOut_value2 = new tangible.OutObject(); - r = reader.argValue.ReadInt8(tempOut_value2); - value = tempOut_value2.argValue; + OutObject tempOut_value2 = new OutObject(); + r = reader.get().ReadInt8(tempOut_value2); + value = tempOut_value2.get(); if (r != Result.Success) { return r; } @@ -111,9 +115,9 @@ public final class RowReaderJsonExtensions { case Int16: { short value; - tangible.OutObject tempOut_value3 = new tangible.OutObject(); - r = reader.argValue.ReadInt16(tempOut_value3); - value = tempOut_value3.argValue; + OutObject tempOut_value3 = new OutObject(); + r = reader.get().ReadInt16(tempOut_value3); + value = tempOut_value3.get(); if (r != Result.Success) { return r; } @@ -124,9 +128,9 @@ public final class RowReaderJsonExtensions { case Int32: { int value; - tangible.OutObject tempOut_value4 = new tangible.OutObject(); - r = reader.argValue.ReadInt32(tempOut_value4); - value = tempOut_value4.argValue; + OutObject tempOut_value4 = new OutObject(); + r = reader.get().ReadInt32(tempOut_value4); + value = tempOut_value4.get(); if (r != Result.Success) { return r; } @@ -137,9 +141,9 @@ public final class RowReaderJsonExtensions { case Int64: { long value; - tangible.OutObject tempOut_value5 = new tangible.OutObject(); - r = reader.argValue.ReadInt64(tempOut_value5); - value = tempOut_value5.argValue; + OutObject tempOut_value5 = new OutObject(); + r = reader.get().ReadInt64(tempOut_value5); + value = tempOut_value5.get(); if (r != Result.Success) { return r; } @@ -150,11 +154,11 @@ public final class RowReaderJsonExtensions { case UInt8: { byte value; - tangible.OutObject tempOut_value6 = new tangible.OutObject(); + OutObject tempOut_value6 = new OutObject(); //C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java: //ORIGINAL LINE: r = reader.ReadUInt8(out byte value); - r = reader.argValue.ReadUInt8(tempOut_value6); - value = tempOut_value6.argValue; + r = reader.get().ReadUInt8(tempOut_value6); + value = tempOut_value6.get(); if (r != Result.Success) { return r; } @@ -165,11 +169,11 @@ public final class RowReaderJsonExtensions { case UInt16: { short value; - tangible.OutObject tempOut_value7 = new tangible.OutObject(); + OutObject tempOut_value7 = new OutObject(); //C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java: //ORIGINAL LINE: r = reader.ReadUInt16(out ushort value); - r = reader.argValue.ReadUInt16(tempOut_value7); - value = tempOut_value7.argValue; + r = reader.get().ReadUInt16(tempOut_value7); + value = tempOut_value7.get(); if (r != Result.Success) { return r; } @@ -180,11 +184,11 @@ public final class RowReaderJsonExtensions { case UInt32: { int value; - tangible.OutObject tempOut_value8 = new tangible.OutObject(); + OutObject tempOut_value8 = new OutObject(); //C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java: //ORIGINAL LINE: r = reader.ReadUInt32(out uint value); - r = reader.argValue.ReadUInt32(tempOut_value8); - value = tempOut_value8.argValue; + r = reader.get().ReadUInt32(tempOut_value8); + value = tempOut_value8.get(); if (r != Result.Success) { return r; } @@ -195,11 +199,11 @@ public final class RowReaderJsonExtensions { case UInt64: { long value; - tangible.OutObject tempOut_value9 = new tangible.OutObject(); + OutObject tempOut_value9 = new OutObject(); //C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java: //ORIGINAL LINE: r = reader.ReadUInt64(out ulong value); - r = reader.argValue.ReadUInt64(tempOut_value9); - value = tempOut_value9.argValue; + r = reader.get().ReadUInt64(tempOut_value9); + value = tempOut_value9.get(); if (r != Result.Success) { return r; } @@ -210,9 +214,9 @@ public final class RowReaderJsonExtensions { case VarInt: { long value; - tangible.OutObject tempOut_value10 = new tangible.OutObject(); - r = reader.argValue.ReadVarInt(tempOut_value10); - value = tempOut_value10.argValue; + OutObject tempOut_value10 = new OutObject(); + r = reader.get().ReadVarInt(tempOut_value10); + value = tempOut_value10.get(); if (r != Result.Success) { return r; } @@ -223,11 +227,11 @@ public final class RowReaderJsonExtensions { case VarUInt: { long value; - tangible.OutObject tempOut_value11 = new tangible.OutObject(); + OutObject tempOut_value11 = new OutObject(); //C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java: //ORIGINAL LINE: r = reader.ReadVarUInt(out ulong value); - r = reader.argValue.ReadVarUInt(tempOut_value11); - value = tempOut_value11.argValue; + r = reader.get().ReadVarUInt(tempOut_value11); + value = tempOut_value11.get(); if (r != Result.Success) { return r; } @@ -238,9 +242,9 @@ public final class RowReaderJsonExtensions { case Float32: { float value; - tangible.OutObject tempOut_value12 = new tangible.OutObject(); - r = reader.argValue.ReadFloat32(tempOut_value12); - value = tempOut_value12.argValue; + OutObject tempOut_value12 = new OutObject(); + r = reader.get().ReadFloat32(tempOut_value12); + value = tempOut_value12.get(); if (r != Result.Success) { return r; } @@ -251,9 +255,9 @@ public final class RowReaderJsonExtensions { case Float64: { double value; - tangible.OutObject tempOut_value13 = new tangible.OutObject(); - r = reader.argValue.ReadFloat64(tempOut_value13); - value = tempOut_value13.argValue; + OutObject tempOut_value13 = new OutObject(); + r = reader.get().ReadFloat64(tempOut_value13); + value = tempOut_value13.get(); if (r != Result.Success) { return r; } @@ -264,24 +268,24 @@ public final class RowReaderJsonExtensions { case Float128: { Float128 _; - tangible.OutObject tempOut__2 = - new tangible.OutObject(); - r = reader.argValue.ReadFloat128(tempOut__2); - _ = tempOut__2.argValue; + OutObject tempOut__2 = + new OutObject(); + r = reader.get().ReadFloat128(tempOut__2); + _ = tempOut__2.get(); if (r != Result.Success) { return r; } // ctx.Builder.AppendFormat("High: {0}, Low: {1}\n", value.High, value.Low); - Contract.Assert(false, "Float128 are not supported."); + checkState(false, "Float128 are not supported."); break; } case Decimal: { java.math.BigDecimal value; - tangible.OutObject tempOut_value14 = new tangible.OutObject(); - r = reader.argValue.ReadDecimal(tempOut_value14); - value = tempOut_value14.argValue; + OutObject tempOut_value14 = new OutObject(); + r = reader.get().ReadDecimal(tempOut_value14); + value = tempOut_value14.get(); if (r != Result.Success) { return r; } @@ -292,9 +296,9 @@ public final class RowReaderJsonExtensions { case DateTime: { java.time.LocalDateTime value; - tangible.OutObject tempOut_value15 = new tangible.OutObject(); - r = reader.argValue.ReadDateTime(tempOut_value15); - value = tempOut_value15.argValue; + OutObject tempOut_value15 = new OutObject(); + r = reader.get().ReadDateTime(tempOut_value15); + value = tempOut_value15.get(); if (r != Result.Success) { return r; } @@ -307,10 +311,10 @@ public final class RowReaderJsonExtensions { case UnixDateTime: { UnixDateTime value; - tangible.OutObject tempOut_value16 = - new tangible.OutObject(); - r = reader.argValue.ReadUnixDateTime(tempOut_value16); - value = tempOut_value16.argValue; + OutObject tempOut_value16 = + new OutObject(); + r = reader.get().ReadUnixDateTime(tempOut_value16); + value = tempOut_value16.get(); if (r != Result.Success) { return r; } @@ -321,9 +325,9 @@ public final class RowReaderJsonExtensions { case Guid: { java.util.UUID value; - tangible.OutObject tempOut_value17 = new tangible.OutObject(); - r = reader.argValue.ReadGuid(tempOut_value17); - value = tempOut_value17.argValue; + OutObject tempOut_value17 = new OutObject(); + r = reader.get().ReadGuid(tempOut_value17); + value = tempOut_value17.get(); if (r != Result.Success) { return r; } @@ -336,9 +340,9 @@ public final class RowReaderJsonExtensions { case MongoDbObjectId: { MongoDbObjectId value; - tangible.OutObject tempOut_value18 = new tangible.OutObject(); - r = reader.argValue.ReadMongoDbObjectId(tempOut_value18); - value = tempOut_value18.argValue; + OutObject tempOut_value18 = new OutObject(); + r = reader.get().ReadMongoDbObjectId(tempOut_value18); + value = tempOut_value18.get(); if (r != Result.Success) { return r; } @@ -357,7 +361,7 @@ public final class RowReaderJsonExtensions { // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'out' keyword // - these cannot be converted using the 'OutObject' helper class unless the method is within the // code being modified: - r = reader.argValue.ReadString(out value); + r = reader.get().ReadString(out value); if (r != Result.Success) { return r; } @@ -373,7 +377,7 @@ public final class RowReaderJsonExtensions { // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'out' keyword - these cannot be converted using the 'OutObject' helper class unless the method is within the code being modified: //C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java: //ORIGINAL LINE: r = reader.ReadBinary(out ReadOnlySpan value); - r = reader.argValue.ReadBinary(out value); + r = reader.get().ReadBinary(out value); if (r != Result.Success) { return r; } @@ -386,13 +390,13 @@ public final class RowReaderJsonExtensions { case NullableScope: case ImmutableNullableScope: { - if (!reader.argValue.getHasValue()) { + if (!reader.get().getHasValue()) { ctx.Builder.append("null"); break; } // TODO: C# TO JAVA CONVERTER: There is no 'goto' in Java: - goto case LayoutCode.TypedTupleScope + // goto case LayoutCode.TypedTupleScope; } case ArrayScope: @@ -414,7 +418,7 @@ public final class RowReaderJsonExtensions { scopeBracket = '['; scopeCloseBracket = ']'; // TODO: C# TO JAVA CONVERTER: There is no 'goto' in Java: - goto case LayoutCode.EndScope + // goto case LayoutCode.EndScope; case ObjectScope: case ImmutableObjectScope: case Schema: @@ -425,7 +429,7 @@ public final class RowReaderJsonExtensions { case EndScope: { ctx.Builder.append(scopeBracket); int snapshot = ctx.Builder.length(); - r = reader.argValue.ReadScope(new ReaderStringContext(ctx.Builder, ctx.Settings.clone(), ctx.Indent + 1), RowReaderJsonExtensions.ToJson); + r = reader.get().ReadScope(new ReaderStringContext(ctx.Builder, ctx.Settings.clone(), ctx.Indent + 1), RowReaderJsonExtensions.ToJson); if (r != Result.Success) { return r; } @@ -440,7 +444,7 @@ public final class RowReaderJsonExtensions { } default: { - Contract.Assert(false, String.format("Unknown type will be ignored: %1$s", reader.argValue.getType().LayoutCode)); + throw new IllegalStateException(lenientFormat("Unknown type will be ignored: %s", reader.get().getType().LayoutCode)); break; } } diff --git a/jre/src/main/java/azure/data/cosmos/serialization/hybridrow/json/RowReaderJsonSettings.java b/jre/src/main/java/com/azure/data/cosmos/serialization/hybridrow/json/RowReaderJsonSettings.java similarity index 91% rename from jre/src/main/java/azure/data/cosmos/serialization/hybridrow/json/RowReaderJsonSettings.java rename to jre/src/main/java/com/azure/data/cosmos/serialization/hybridrow/json/RowReaderJsonSettings.java index 89f9e3b..a1e6fd8 100644 --- a/jre/src/main/java/azure/data/cosmos/serialization/hybridrow/json/RowReaderJsonSettings.java +++ b/jre/src/main/java/com/azure/data/cosmos/serialization/hybridrow/json/RowReaderJsonSettings.java @@ -2,7 +2,7 @@ // Copyright (c) Microsoft Corporation. All rights reserved. //------------------------------------------------------------ -package azure.data.cosmos.serialization.hybridrow.json; +package com.azure.data.cosmos.serialization.hybridrow.json; // TODO: C# TO JAVA CONVERTER: There is no preprocessor in Java: ///#pragma warning disable CA1051 // Do not declare visible instance fields @@ -33,9 +33,6 @@ public final class RowReaderJsonSettings { this(" ", '"'); } - public RowReaderJsonSettings() { - } - //C# TO JAVA CONVERTER NOTE: Java does not support optional parameters. Overloaded method(s) are created above: //ORIGINAL LINE: public RowReaderJsonSettings(string indentChars = " ", char quoteChar = '"') public RowReaderJsonSettings(String indentChars, char quoteChar) { diff --git a/jre/src/main/java/azure/data/cosmos/serialization/hybridrow/layouts/ILayoutSequenceWritable.java b/jre/src/main/java/com/azure/data/cosmos/serialization/hybridrow/layouts/ILayoutSequenceWritable.java similarity index 60% rename from jre/src/main/java/azure/data/cosmos/serialization/hybridrow/layouts/ILayoutSequenceWritable.java rename to jre/src/main/java/com/azure/data/cosmos/serialization/hybridrow/layouts/ILayoutSequenceWritable.java index ad6c129..76e4dba 100644 --- a/jre/src/main/java/azure/data/cosmos/serialization/hybridrow/layouts/ILayoutSequenceWritable.java +++ b/jre/src/main/java/com/azure/data/cosmos/serialization/hybridrow/layouts/ILayoutSequenceWritable.java @@ -2,11 +2,12 @@ // Copyright (c) Microsoft Corporation. All rights reserved. //------------------------------------------------------------ -package azure.data.cosmos.serialization.hybridrow.layouts; +package com.azure.data.cosmos.serialization.hybridrow.layouts; -import azure.data.cosmos.serialization.hybridrow.Result; -import azure.data.cosmos.serialization.hybridrow.RowBuffer; -import azure.data.cosmos.serialization.hybridrow.RowCursor; +import com.azure.data.cosmos.core.RefObject; +import com.azure.data.cosmos.serialization.hybridrow.Result; +import com.azure.data.cosmos.serialization.hybridrow.RowBuffer; +import com.azure.data.cosmos.serialization.hybridrow.RowCursor; /** * An optional interface that indicates a can also write using a @@ -15,18 +16,18 @@ import azure.data.cosmos.serialization.hybridrow.RowCursor; * The sub-element type to be written. */ public interface ILayoutSequenceWritable extends ILayoutType { - Result WriteFixed(tangible.RefObject b, tangible.RefObject scope, LayoutColumn col, + Result WriteFixed(RefObject b, RefObject scope, LayoutColumn col, ReadOnlySequence value); - Result WriteSparse(tangible.RefObject b, tangible.RefObject edit, + Result WriteSparse(RefObject b, RefObject edit, ReadOnlySequence value); //C# TO JAVA CONVERTER NOTE: Java does not support optional parameters. Overloaded method(s) are created above: //ORIGINAL LINE: Result WriteSparse(ref RowBuffer b, ref RowCursor edit, ReadOnlySequence value, // UpdateOptions options = UpdateOptions.Upsert); - Result WriteSparse(tangible.RefObject b, tangible.RefObject edit, + Result WriteSparse(RefObject b, RefObject edit, ReadOnlySequence value, UpdateOptions options); - Result WriteVariable(tangible.RefObject b, tangible.RefObject scope, LayoutColumn col, + Result WriteVariable(RefObject b, RefObject scope, LayoutColumn col, ReadOnlySequence value); } \ No newline at end of file diff --git a/jre/src/main/java/com/azure/data/cosmos/serialization/hybridrow/layouts/ILayoutSpanReadable.java b/jre/src/main/java/com/azure/data/cosmos/serialization/hybridrow/layouts/ILayoutSpanReadable.java new file mode 100644 index 0000000..e986610 --- /dev/null +++ b/jre/src/main/java/com/azure/data/cosmos/serialization/hybridrow/layouts/ILayoutSpanReadable.java @@ -0,0 +1,28 @@ +//------------------------------------------------------------ +// Copyright (c) Microsoft Corporation. All rights reserved. +//------------------------------------------------------------ + +package com.azure.data.cosmos.serialization.hybridrow.layouts; + +import com.azure.data.cosmos.core.OutObject; +import com.azure.data.cosmos.core.RefObject; +import com.azure.data.cosmos.serialization.hybridrow.Result; +import com.azure.data.cosmos.serialization.hybridrow.RowBuffer; +import com.azure.data.cosmos.serialization.hybridrow.RowCursor; + +/** + * An optional interface that indicates a can also read using a + * . + * + * The sub-element type to be written. + */ +public interface ILayoutSpanReadable extends ILayoutType { + Result ReadFixed(RefObject b, RefObject scope, LayoutColumn col, + OutObject> value); + + Result ReadSparse(RefObject b, RefObject scope, + OutObject> value); + + Result ReadVariable(RefObject b, RefObject scope, LayoutColumn col, + OutObject> value); +} \ No newline at end of file diff --git a/jre/src/main/java/azure/data/cosmos/serialization/hybridrow/layouts/ILayoutSpanWritable.java b/jre/src/main/java/com/azure/data/cosmos/serialization/hybridrow/layouts/ILayoutSpanWritable.java similarity index 59% rename from jre/src/main/java/azure/data/cosmos/serialization/hybridrow/layouts/ILayoutSpanWritable.java rename to jre/src/main/java/com/azure/data/cosmos/serialization/hybridrow/layouts/ILayoutSpanWritable.java index 9b3b571..8ddeb54 100644 --- a/jre/src/main/java/azure/data/cosmos/serialization/hybridrow/layouts/ILayoutSpanWritable.java +++ b/jre/src/main/java/com/azure/data/cosmos/serialization/hybridrow/layouts/ILayoutSpanWritable.java @@ -2,11 +2,12 @@ // Copyright (c) Microsoft Corporation. All rights reserved. //------------------------------------------------------------ -package azure.data.cosmos.serialization.hybridrow.layouts; +package com.azure.data.cosmos.serialization.hybridrow.layouts; -import azure.data.cosmos.serialization.hybridrow.Result; -import azure.data.cosmos.serialization.hybridrow.RowBuffer; -import azure.data.cosmos.serialization.hybridrow.RowCursor; +import com.azure.data.cosmos.core.RefObject; +import com.azure.data.cosmos.serialization.hybridrow.Result; +import com.azure.data.cosmos.serialization.hybridrow.RowBuffer; +import com.azure.data.cosmos.serialization.hybridrow.RowCursor; /** * An optional interface that indicates a can also write using a @@ -15,18 +16,18 @@ import azure.data.cosmos.serialization.hybridrow.RowCursor; * The sub-element type to be written. */ public interface ILayoutSpanWritable extends ILayoutType { - Result WriteFixed(tangible.RefObject b, tangible.RefObject scope, LayoutColumn col, + Result WriteFixed(RefObject b, RefObject scope, LayoutColumn col, ReadOnlySpan value); - Result WriteSparse(tangible.RefObject b, tangible.RefObject edit, + Result WriteSparse(RefObject b, RefObject edit, ReadOnlySpan value); //C# TO JAVA CONVERTER NOTE: Java does not support optional parameters. Overloaded method(s) are created above: //ORIGINAL LINE: Result WriteSparse(ref RowBuffer b, ref RowCursor edit, ReadOnlySpan value, // UpdateOptions options = UpdateOptions.Upsert); - Result WriteSparse(tangible.RefObject b, tangible.RefObject edit, + Result WriteSparse(RefObject b, RefObject edit, ReadOnlySpan value, UpdateOptions options); - Result WriteVariable(tangible.RefObject b, tangible.RefObject scope, LayoutColumn col, + Result WriteVariable(RefObject b, RefObject scope, LayoutColumn col, ReadOnlySpan value); } \ No newline at end of file diff --git a/jre/src/main/java/azure/data/cosmos/serialization/hybridrow/layouts/ILayoutType.java b/jre/src/main/java/com/azure/data/cosmos/serialization/hybridrow/layouts/ILayoutType.java similarity index 78% rename from jre/src/main/java/azure/data/cosmos/serialization/hybridrow/layouts/ILayoutType.java rename to jre/src/main/java/com/azure/data/cosmos/serialization/hybridrow/layouts/ILayoutType.java index 77c12bd..a1bee93 100644 --- a/jre/src/main/java/azure/data/cosmos/serialization/hybridrow/layouts/ILayoutType.java +++ b/jre/src/main/java/com/azure/data/cosmos/serialization/hybridrow/layouts/ILayoutType.java @@ -2,7 +2,7 @@ // Copyright (c) Microsoft Corporation. All rights reserved. //------------------------------------------------------------ -package azure.data.cosmos.serialization.hybridrow.layouts; +package com.azure.data.cosmos.serialization.hybridrow.layouts; /** * Marker interface for layout types. diff --git a/jre/src/main/java/com/azure/data/cosmos/serialization/hybridrow/layouts/ILayoutUtf8SpanReadable.java b/jre/src/main/java/com/azure/data/cosmos/serialization/hybridrow/layouts/ILayoutUtf8SpanReadable.java new file mode 100644 index 0000000..013d09b --- /dev/null +++ b/jre/src/main/java/com/azure/data/cosmos/serialization/hybridrow/layouts/ILayoutUtf8SpanReadable.java @@ -0,0 +1,25 @@ +//------------------------------------------------------------ +// Copyright (c) Microsoft Corporation. All rights reserved. +//------------------------------------------------------------ + +package com.azure.data.cosmos.serialization.hybridrow.layouts; + +import com.azure.data.cosmos.core.OutObject; +import com.azure.data.cosmos.core.RefObject; +import com.azure.data.cosmos.serialization.hybridrow.Result; +import com.azure.data.cosmos.serialization.hybridrow.RowBuffer; +import com.azure.data.cosmos.serialization.hybridrow.RowCursor; + +/** + * An optional interface that indicates a can also read using a + * . + */ +public interface ILayoutUtf8SpanReadable extends ILayoutType { + Result ReadFixed(RefObject b, RefObject scope, LayoutColumn col, + OutObject value); + + Result ReadSparse(RefObject b, RefObject scope, OutObject value); + + Result ReadVariable(RefObject b, RefObject scope, LayoutColumn col, + OutObject value); +} \ No newline at end of file diff --git a/jre/src/main/java/azure/data/cosmos/serialization/hybridrow/layouts/ILayoutUtf8SpanWritable.java b/jre/src/main/java/com/azure/data/cosmos/serialization/hybridrow/layouts/ILayoutUtf8SpanWritable.java similarity index 50% rename from jre/src/main/java/azure/data/cosmos/serialization/hybridrow/layouts/ILayoutUtf8SpanWritable.java rename to jre/src/main/java/com/azure/data/cosmos/serialization/hybridrow/layouts/ILayoutUtf8SpanWritable.java index 62c4085..cf6e979 100644 --- a/jre/src/main/java/azure/data/cosmos/serialization/hybridrow/layouts/ILayoutUtf8SpanWritable.java +++ b/jre/src/main/java/com/azure/data/cosmos/serialization/hybridrow/layouts/ILayoutUtf8SpanWritable.java @@ -2,27 +2,28 @@ // Copyright (c) Microsoft Corporation. All rights reserved. //------------------------------------------------------------ -package azure.data.cosmos.serialization.hybridrow.layouts; +package com.azure.data.cosmos.serialization.hybridrow.layouts; -import azure.data.cosmos.serialization.hybridrow.Result; -import azure.data.cosmos.serialization.hybridrow.RowBuffer; -import azure.data.cosmos.serialization.hybridrow.RowCursor; +import com.azure.data.cosmos.core.RefObject; +import com.azure.data.cosmos.serialization.hybridrow.Result; +import com.azure.data.cosmos.serialization.hybridrow.RowBuffer; +import com.azure.data.cosmos.serialization.hybridrow.RowCursor; /** * An optional interface that indicates a can also write using a * . */ public interface ILayoutUtf8SpanWritable extends ILayoutType { - Result WriteFixed(tangible.RefObject b, tangible.RefObject scope, LayoutColumn col, + Result WriteFixed(RefObject b, RefObject scope, LayoutColumn col, Utf8Span value); - Result WriteSparse(tangible.RefObject b, tangible.RefObject edit, Utf8Span value); + Result WriteSparse(RefObject b, RefObject edit, Utf8Span value); //C# TO JAVA CONVERTER NOTE: Java does not support optional parameters. Overloaded method(s) are created above: //ORIGINAL LINE: Result WriteSparse(ref RowBuffer b, ref RowCursor edit, Utf8Span value, UpdateOptions options = // UpdateOptions.Upsert); - Result WriteSparse(tangible.RefObject b, tangible.RefObject edit, Utf8Span value, UpdateOptions options); + Result WriteSparse(RefObject b, RefObject edit, Utf8Span value, UpdateOptions options); - Result WriteVariable(tangible.RefObject b, tangible.RefObject scope, LayoutColumn col, + Result WriteVariable(RefObject b, RefObject scope, LayoutColumn col, Utf8Span value); } \ No newline at end of file diff --git a/jre/src/main/java/azure/data/cosmos/serialization/hybridrow/layouts/Layout.java b/jre/src/main/java/com/azure/data/cosmos/serialization/hybridrow/layouts/Layout.java similarity index 88% rename from jre/src/main/java/azure/data/cosmos/serialization/hybridrow/layouts/Layout.java rename to jre/src/main/java/com/azure/data/cosmos/serialization/hybridrow/layouts/Layout.java index fcfb1dc..465dc05 100644 --- a/jre/src/main/java/azure/data/cosmos/serialization/hybridrow/layouts/Layout.java +++ b/jre/src/main/java/com/azure/data/cosmos/serialization/hybridrow/layouts/Layout.java @@ -2,9 +2,11 @@ // Copyright (c) Microsoft Corporation. All rights reserved. //------------------------------------------------------------ -package azure.data.cosmos.serialization.hybridrow.layouts; +package com.azure.data.cosmos.serialization.hybridrow.layouts; -import azure.data.cosmos.serialization.hybridrow.SchemaId; +import com.azure.data.cosmos.core.OutObject; +import com.azure.data.cosmos.serialization.hybridrow.SchemaId; +import com.azure.data.cosmos.serialization.hybridrow.schemas.StorageKind; import java.util.ArrayList; import java.util.HashMap; @@ -53,7 +55,7 @@ public final class Layout { /** * Unique identifier of the schema from which this was generated. */ - private SchemaId SchemaId = new SchemaId(); + private com.azure.data.cosmos.serialization.hybridrow.SchemaId SchemaId = new SchemaId(); /** * Minimum required size of a row of this layout. *

@@ -134,18 +136,17 @@ public final class Layout { * @param column If found, the column specification, otherwise null. * @return True if a column with the path is found, otherwise false. */ - public boolean TryFind(UtfAnyString path, tangible.OutObject column) { + public boolean TryFind(UtfAnyString path, OutObject column) { if (path.IsNull) { - column.argValue = null; + column.set(null); return false; } if (path.IsUtf8) { - return (this.pathMap.containsKey(path.ToUtf8String()) && (column.argValue = - this.pathMap.get(path.ToUtf8String())) == column.argValue); + return (this.pathMap.containsKey(path.ToUtf8String()) && (column.set(this.pathMap.get(path.ToUtf8String()))) == column.get()); } - return (this.pathStringMap.containsKey(path) && (column.argValue = this.pathStringMap.get(path)) == column.argValue); + return (this.pathStringMap.containsKey(path) && (column.set(this.pathStringMap.get(path))) == column.get()); } /** @@ -155,8 +156,8 @@ public final class Layout { * @param column If found, the column specification, otherwise null. * @return True if a column with the path is found, otherwise false. */ - public boolean TryFind(String path, tangible.OutObject column) { - return (this.pathStringMap.containsKey(path) && (column.argValue = this.pathStringMap.get(path)) == column.argValue); + public boolean TryFind(String path, OutObject column) { + return (this.pathStringMap.containsKey(path) && (column.set(this.pathStringMap.get(path))) == column.get()); } /** diff --git a/jre/src/main/java/azure/data/cosmos/serialization/hybridrow/layouts/LayoutArray.java b/jre/src/main/java/com/azure/data/cosmos/serialization/hybridrow/layouts/LayoutArray.java similarity index 51% rename from jre/src/main/java/azure/data/cosmos/serialization/hybridrow/layouts/LayoutArray.java rename to jre/src/main/java/com/azure/data/cosmos/serialization/hybridrow/layouts/LayoutArray.java index 3d14205..e7f4a7b 100644 --- a/jre/src/main/java/azure/data/cosmos/serialization/hybridrow/layouts/LayoutArray.java +++ b/jre/src/main/java/com/azure/data/cosmos/serialization/hybridrow/layouts/LayoutArray.java @@ -2,14 +2,16 @@ // Copyright (c) Microsoft Corporation. All rights reserved. //------------------------------------------------------------ -package azure.data.cosmos.serialization.hybridrow.layouts; +package com.azure.data.cosmos.serialization.hybridrow.layouts; -import azure.data.cosmos.serialization.hybridrow.Result; -import azure.data.cosmos.serialization.hybridrow.RowBuffer; -import azure.data.cosmos.serialization.hybridrow.RowCursor; +import com.azure.data.cosmos.core.OutObject; +import com.azure.data.cosmos.core.RefObject; +import com.azure.data.cosmos.serialization.hybridrow.Result; +import com.azure.data.cosmos.serialization.hybridrow.RowBuffer; +import com.azure.data.cosmos.serialization.hybridrow.RowCursor; -import static azure.data.cosmos.serialization.hybridrow.layouts.LayoutCode.ArrayScope; -import static azure.data.cosmos.serialization.hybridrow.layouts.LayoutCode.ImmutableArrayScope; +import static com.azure.data.cosmos.serialization.hybridrow.layouts.LayoutCode.ArrayScope; +import static com.azure.data.cosmos.serialization.hybridrow.layouts.LayoutCode.ImmutableArrayScope; public final class LayoutArray extends LayoutIndexedScope { private TypeArgument TypeArg = new TypeArgument(); @@ -28,10 +30,13 @@ public final class LayoutArray extends LayoutIndexedScope { return TypeArg; } - @Override - public Result WriteScope(tangible.RefObject b, tangible.RefObject edit, - TypeArgumentList typeArgs, tangible.OutObject value) { + public Result WriteScope( + RefObject b, + RefObject edit, + TypeArgumentList typeArgs, + OutObject value + ) { return WriteScope(b, edit, typeArgs, value, UpdateOptions.Upsert); } @@ -39,15 +44,15 @@ public final class LayoutArray extends LayoutIndexedScope { //ORIGINAL LINE: public override Result WriteScope(ref RowBuffer b, ref RowCursor edit, TypeArgumentList // typeArgs, out RowCursor value, UpdateOptions options = UpdateOptions.Upsert) @Override - public Result WriteScope(tangible.RefObject b, tangible.RefObject edit, - TypeArgumentList typeArgs, tangible.OutObject value, UpdateOptions options) { - Result result = LayoutType.PrepareSparseWrite(b, edit, this.getTypeArg().clone(), options); + public Result WriteScope(RefObject b, RefObject edit, + TypeArgumentList typeArgs, OutObject value, UpdateOptions options) { + Result result = PrepareSparseWrite(b, edit, this.getTypeArg().clone(), options); if (result != Result.Success) { - value.argValue = null; + value.set(null); return result; } - b.argValue.WriteSparseArray(edit, this, options, value.clone()); + b.get().WriteSparseArray(edit, this, options, value.clone()); return Result.Success; } } \ No newline at end of file diff --git a/jre/src/main/java/azure/data/cosmos/serialization/hybridrow/layouts/LayoutBinary.java b/jre/src/main/java/com/azure/data/cosmos/serialization/hybridrow/layouts/LayoutBinary.java similarity index 63% rename from jre/src/main/java/azure/data/cosmos/serialization/hybridrow/layouts/LayoutBinary.java rename to jre/src/main/java/com/azure/data/cosmos/serialization/hybridrow/layouts/LayoutBinary.java index 94082f3..5582eab 100644 --- a/jre/src/main/java/azure/data/cosmos/serialization/hybridrow/layouts/LayoutBinary.java +++ b/jre/src/main/java/com/azure/data/cosmos/serialization/hybridrow/layouts/LayoutBinary.java @@ -2,11 +2,13 @@ // Copyright (c) Microsoft Corporation. All rights reserved. //------------------------------------------------------------ -package azure.data.cosmos.serialization.hybridrow.layouts; +package com.azure.data.cosmos.serialization.hybridrow.layouts; -import azure.data.cosmos.serialization.hybridrow.Result; -import azure.data.cosmos.serialization.hybridrow.RowBuffer; -import azure.data.cosmos.serialization.hybridrow.RowCursor; +import com.azure.data.cosmos.core.OutObject; +import com.azure.data.cosmos.core.RefObject; +import com.azure.data.cosmos.serialization.hybridrow.Result; +import com.azure.data.cosmos.serialization.hybridrow.RowBuffer; +import com.azure.data.cosmos.serialization.hybridrow.RowCursor; import static com.google.common.base.Preconditions.checkArgument; @@ -16,7 +18,7 @@ import static com.google.common.base.Preconditions.checkArgument; public final class LayoutBinary extends LayoutType implements ILayoutSpanWritable, ILayoutSpanReadable, ILayoutSequenceWritable { public LayoutBinary() { - super(azure.data.cosmos.serialization.hybridrow.layouts.LayoutCode.Binary, 0); + super(com.azure.data.cosmos.serialization.hybridrow.layouts.LayoutCode.Binary, 0); } @Override @@ -33,15 +35,15 @@ public final class LayoutBinary extends LayoutType implements ILayoutSpa //ORIGINAL LINE: public override Result ReadFixed(ref RowBuffer b, ref RowCursor scope, LayoutColumn col, out // byte[] value) @Override - public Result ReadFixed(tangible.RefObject b, tangible.RefObject scope, LayoutColumn col, - tangible.OutObject value) { + public Result ReadFixed(RefObject b, RefObject scope, LayoutColumn col, + OutObject value) { ReadOnlySpan span; // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'out' keyword - these // cannot be converted using the 'OutObject' helper class unless the method is within the code being modified: //C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java: //ORIGINAL LINE: Result r = this.ReadFixed(ref b, ref scope, col, out ReadOnlySpan span); Result r = this.ReadFixed(b, scope, col, out span); - value.argValue = (r == Result.Success) ? span.ToArray() : + value.set((r == Result.Success) ? span.ToArray() :) default return r; } @@ -49,44 +51,44 @@ public final class LayoutBinary extends LayoutType implements ILayoutSpa //C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java: //ORIGINAL LINE: public Result ReadFixed(ref RowBuffer b, ref RowCursor scope, LayoutColumn col, out // ReadOnlySpan value) - public Result ReadFixed(tangible.RefObject b, tangible.RefObject scope, LayoutColumn col, - tangible.OutObject> value) { - checkArgument(scope.argValue.scopeType instanceof LayoutUDT); + public Result ReadFixed(RefObject b, RefObject scope, LayoutColumn col, + OutObject> value) { + checkArgument(scope.get().scopeType instanceof LayoutUDT); checkArgument(col.getSize() >= 0); - if (!b.argValue.ReadBit(scope.argValue.start, col.getNullBit().clone())) { - value.argValue = null; + if (!b.get().ReadBit(scope.get().start, col.getNullBit().clone())) { + value.set(null); return Result.NotFound; } - value.argValue = b.argValue.ReadFixedBinary(scope.argValue.start + col.getOffset(), col.getSize()); + value.set(b.get().ReadFixedBinary(scope.get().start + col.getOffset(), col.getSize())); return Result.Success; } //C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java: //ORIGINAL LINE: public override Result ReadSparse(ref RowBuffer b, ref RowCursor edit, out byte[] value) @Override - public Result ReadSparse(tangible.RefObject b, tangible.RefObject edit, - tangible.OutObject value) { + public Result ReadSparse(RefObject b, RefObject edit, + OutObject value) { ReadOnlySpan span; // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'out' keyword - these cannot be converted using the 'OutObject' helper class unless the method is within the code being modified: //C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java: //ORIGINAL LINE: Result r = this.ReadSparse(ref b, ref edit, out ReadOnlySpan span); Result r = this.ReadSparse(b, edit, out span); - value.argValue = (r == Result.Success) ? span.ToArray() : + value.set((r == Result.Success) ? span.ToArray() :) default return r; } //C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java: //ORIGINAL LINE: public Result ReadSparse(ref RowBuffer b, ref RowCursor edit, out ReadOnlySpan value) - public Result ReadSparse(tangible.RefObject b, tangible.RefObject edit, tangible.OutObject> value) { + public Result ReadSparse(RefObject b, RefObject edit, OutObject> value) { Result result = LayoutType.PrepareSparseRead(b, edit, this.LayoutCode); if (result != Result.Success) { - value.argValue = null; + value.set(null); return result; } - value.argValue = b.argValue.ReadSparseBinary(edit); + value.set(b.get().ReadSparseBinary(edit)); return Result.Success; } @@ -94,15 +96,15 @@ public final class LayoutBinary extends LayoutType implements ILayoutSpa //ORIGINAL LINE: public override Result ReadVariable(ref RowBuffer b, ref RowCursor scope, LayoutColumn col, out // byte[] value) @Override - public Result ReadVariable(tangible.RefObject b, tangible.RefObject scope, LayoutColumn col - , tangible.OutObject value) { + public Result ReadVariable(RefObject b, RefObject scope, LayoutColumn col + , OutObject value) { ReadOnlySpan span; // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'out' keyword - these // cannot be converted using the 'OutObject' helper class unless the method is within the code being modified: //C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java: //ORIGINAL LINE: Result r = this.ReadVariable(ref b, ref scope, col, out ReadOnlySpan span); Result r = this.ReadVariable(b, scope, col, out span); - value.argValue = (r == Result.Success) ? span.ToArray() : + value.set((r == Result.Success) ? span.ToArray() :) default return r; } @@ -110,17 +112,17 @@ public final class LayoutBinary extends LayoutType implements ILayoutSpa //C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java: //ORIGINAL LINE: public Result ReadVariable(ref RowBuffer b, ref RowCursor scope, LayoutColumn col, out // ReadOnlySpan value) - public Result ReadVariable(tangible.RefObject b, tangible.RefObject scope, LayoutColumn col - , tangible.OutObject> value) { - checkArgument(scope.argValue.scopeType instanceof LayoutUDT); - if (!b.argValue.ReadBit(scope.argValue.start, col.getNullBit().clone())) { - value.argValue = null; + public Result ReadVariable(RefObject b, RefObject scope, LayoutColumn col + , OutObject> value) { + checkArgument(scope.get().scopeType instanceof LayoutUDT); + if (!b.get().ReadBit(scope.get().start, col.getNullBit().clone())) { + value.set(null); return Result.NotFound; } - int varOffset = b.argValue.ComputeVariableValueOffset(scope.argValue.layout, scope.argValue.start, + int varOffset = b.get().ComputeVariableValueOffset(scope.get().layout, scope.get().start, col.getOffset()); - value.argValue = b.argValue.ReadVariableBinary(varOffset); + value.set(b.get().ReadVariableBinary(varOffset)); return Result.Success; } @@ -128,7 +130,7 @@ public final class LayoutBinary extends LayoutType implements ILayoutSpa //ORIGINAL LINE: public override Result WriteFixed(ref RowBuffer b, ref RowCursor scope, LayoutColumn col, byte[] // value) @Override - public Result WriteFixed(tangible.RefObject b, tangible.RefObject scope, LayoutColumn col, + public Result WriteFixed(RefObject b, RefObject scope, LayoutColumn col, byte[] value) { checkArgument(value != null); //C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java: @@ -139,39 +141,39 @@ public final class LayoutBinary extends LayoutType implements ILayoutSpa //C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java: //ORIGINAL LINE: public Result WriteFixed(ref RowBuffer b, ref RowCursor scope, LayoutColumn col, // ReadOnlySpan value) - public Result WriteFixed(tangible.RefObject b, tangible.RefObject scope, LayoutColumn col, + public Result WriteFixed(RefObject b, RefObject scope, LayoutColumn col, ReadOnlySpan value) { - checkArgument(scope.argValue.scopeType instanceof LayoutUDT); + checkArgument(scope.get().scopeType instanceof LayoutUDT); checkArgument(col.getSize() >= 0); checkArgument(value.Length == col.getSize()); - if (scope.argValue.immutable) { + if (scope.get().immutable) { return Result.InsufficientPermissions; } - b.argValue.WriteFixedBinary(scope.argValue.start + col.getOffset(), value, col.getSize()); - b.argValue.SetBit(scope.argValue.start, col.getNullBit().clone()); + b.get().WriteFixedBinary(scope.get().start + col.getOffset(), value, col.getSize()); + b.get().SetBit(scope.get().start, col.getNullBit().clone()); return Result.Success; } //C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java: //ORIGINAL LINE: public Result WriteFixed(ref RowBuffer b, ref RowCursor scope, LayoutColumn col, // ReadOnlySequence value) - public Result WriteFixed(tangible.RefObject b, tangible.RefObject scope, LayoutColumn col, + public Result WriteFixed(RefObject b, RefObject scope, LayoutColumn col, ReadOnlySequence value) { - checkArgument(scope.argValue.scopeType instanceof LayoutUDT); + checkArgument(scope.get().scopeType instanceof LayoutUDT); checkArgument(col.getSize() >= 0); checkArgument(value.Length == col.getSize()); - if (scope.argValue.immutable) { + if (scope.get().immutable) { return Result.InsufficientPermissions; } - b.argValue.WriteFixedBinary(scope.argValue.start + col.getOffset(), value, col.getSize()); - b.argValue.SetBit(scope.argValue.start, col.getNullBit().clone()); + b.get().WriteFixedBinary(scope.get().start + col.getOffset(), value, col.getSize()); + b.get().SetBit(scope.get().start, col.getNullBit().clone()); return Result.Success; } @Override - public Result WriteSparse(tangible.RefObject b, tangible.RefObject edit, byte[] value) { + public Result WriteSparse(RefObject b, RefObject edit, byte[] value) { return WriteSparse(b, edit, value, UpdateOptions.Upsert); } @@ -180,7 +182,7 @@ public final class LayoutBinary extends LayoutType implements ILayoutSpa // UpdateOptions options = UpdateOptions.Upsert) //C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java: @Override - public Result WriteSparse(tangible.RefObject b, tangible.RefObject edit, byte[] value, + public Result WriteSparse(RefObject b, RefObject edit, byte[] value, UpdateOptions options) { checkArgument(value != null); //C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java: @@ -188,7 +190,7 @@ public final class LayoutBinary extends LayoutType implements ILayoutSpa return this.WriteSparse(b, edit, new ReadOnlySpan(value), options); } - public Result WriteSparse(tangible.RefObject b, tangible.RefObject edit, + public Result WriteSparse(RefObject b, RefObject edit, ReadOnlySpan value) { return WriteSparse(b, edit, value, UpdateOptions.Upsert); } @@ -197,18 +199,18 @@ public final class LayoutBinary extends LayoutType implements ILayoutSpa //ORIGINAL LINE: public Result WriteSparse(ref RowBuffer b, ref RowCursor edit, ReadOnlySpan value, // UpdateOptions options = UpdateOptions.Upsert) //C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java: - public Result WriteSparse(tangible.RefObject b, tangible.RefObject edit, + public Result WriteSparse(RefObject b, RefObject edit, ReadOnlySpan value, UpdateOptions options) { Result result = LayoutType.PrepareSparseWrite(b, edit, this.getTypeArg().clone(), options); if (result != Result.Success) { return result; } - b.argValue.WriteSparseBinary(edit, value, options); + b.get().WriteSparseBinary(edit, value, options); return Result.Success; } - public Result WriteSparse(tangible.RefObject b, tangible.RefObject edit, + public Result WriteSparse(RefObject b, RefObject edit, ReadOnlySequence value) { return WriteSparse(b, edit, value, UpdateOptions.Upsert); } @@ -217,14 +219,14 @@ public final class LayoutBinary extends LayoutType implements ILayoutSpa //ORIGINAL LINE: public Result WriteSparse(ref RowBuffer b, ref RowCursor edit, ReadOnlySequence value, // UpdateOptions options = UpdateOptions.Upsert) //C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java: - public Result WriteSparse(tangible.RefObject b, tangible.RefObject edit, + public Result WriteSparse(RefObject b, RefObject edit, ReadOnlySequence value, UpdateOptions options) { Result result = LayoutType.PrepareSparseWrite(b, edit, this.getTypeArg().clone(), options); if (result != Result.Success) { return result; } - b.argValue.WriteSparseBinary(edit, value, options); + b.get().WriteSparseBinary(edit, value, options); return Result.Success; } @@ -232,7 +234,7 @@ public final class LayoutBinary extends LayoutType implements ILayoutSpa //ORIGINAL LINE: public override Result WriteVariable(ref RowBuffer b, ref RowCursor scope, LayoutColumn col, // byte[] value) @Override - public Result WriteVariable(tangible.RefObject b, tangible.RefObject scope, + public Result WriteVariable(RefObject b, RefObject scope, LayoutColumn col, byte[] value) { checkArgument(value != null); //C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java: @@ -243,10 +245,10 @@ public final class LayoutBinary extends LayoutType implements ILayoutSpa //C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java: //ORIGINAL LINE: public Result WriteVariable(ref RowBuffer b, ref RowCursor scope, LayoutColumn col, // ReadOnlySpan value) - public Result WriteVariable(tangible.RefObject b, tangible.RefObject scope, + public Result WriteVariable(RefObject b, RefObject scope, LayoutColumn col, ReadOnlySpan value) { - checkArgument(scope.argValue.scopeType instanceof LayoutUDT); - if (scope.argValue.immutable) { + checkArgument(scope.get().scopeType instanceof LayoutUDT); + if (scope.get().immutable) { return Result.InsufficientPermissions; } @@ -255,26 +257,26 @@ public final class LayoutBinary extends LayoutType implements ILayoutSpa return Result.TooBig; } - boolean exists = b.argValue.ReadBit(scope.argValue.start, col.getNullBit().clone()); - int varOffset = b.argValue.ComputeVariableValueOffset(scope.argValue.layout, scope.argValue.start, + boolean exists = b.get().ReadBit(scope.get().start, col.getNullBit().clone()); + int varOffset = b.get().ComputeVariableValueOffset(scope.get().layout, scope.get().start, col.getOffset()); int shift; - tangible.OutObject tempOut_shift = new tangible.OutObject(); - b.argValue.WriteVariableBinary(varOffset, value, exists, tempOut_shift); - shift = tempOut_shift.argValue; - b.argValue.SetBit(scope.argValue.start, col.getNullBit().clone()); - scope.argValue.metaOffset += shift; - scope.argValue.valueOffset += shift; + OutObject tempOut_shift = new OutObject(); + b.get().WriteVariableBinary(varOffset, value, exists, tempOut_shift); + shift = tempOut_shift.get(); + b.get().SetBit(scope.get().start, col.getNullBit().clone()); + scope.get().metaOffset += shift; + scope.get().valueOffset += shift; return Result.Success; } //C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java: //ORIGINAL LINE: public Result WriteVariable(ref RowBuffer b, ref RowCursor scope, LayoutColumn col, // ReadOnlySequence value) - public Result WriteVariable(tangible.RefObject b, tangible.RefObject scope, + public Result WriteVariable(RefObject b, RefObject scope, LayoutColumn col, ReadOnlySequence value) { - checkArgument(scope.argValue.scopeType instanceof LayoutUDT); - if (scope.argValue.immutable) { + checkArgument(scope.get().scopeType instanceof LayoutUDT); + if (scope.get().immutable) { return Result.InsufficientPermissions; } @@ -283,16 +285,16 @@ public final class LayoutBinary extends LayoutType implements ILayoutSpa return Result.TooBig; } - boolean exists = b.argValue.ReadBit(scope.argValue.start, col.getNullBit().clone()); - int varOffset = b.argValue.ComputeVariableValueOffset(scope.argValue.layout, scope.argValue.start, + boolean exists = b.get().ReadBit(scope.get().start, col.getNullBit().clone()); + int varOffset = b.get().ComputeVariableValueOffset(scope.get().layout, scope.get().start, col.getOffset()); int shift; - tangible.OutObject tempOut_shift = new tangible.OutObject(); - b.argValue.WriteVariableBinary(varOffset, value, exists, tempOut_shift); - shift = tempOut_shift.argValue; - b.argValue.SetBit(scope.argValue.start, col.getNullBit().clone()); - scope.argValue.metaOffset += shift; - scope.argValue.valueOffset += shift; + OutObject tempOut_shift = new OutObject(); + b.get().WriteVariableBinary(varOffset, value, exists, tempOut_shift); + shift = tempOut_shift.get(); + b.get().SetBit(scope.get().start, col.getNullBit().clone()); + scope.get().metaOffset += shift; + scope.get().valueOffset += shift; return Result.Success; } } \ No newline at end of file diff --git a/jre/src/main/java/azure/data/cosmos/serialization/hybridrow/layouts/LayoutBit.java b/jre/src/main/java/com/azure/data/cosmos/serialization/hybridrow/layouts/LayoutBit.java similarity index 93% rename from jre/src/main/java/azure/data/cosmos/serialization/hybridrow/layouts/LayoutBit.java rename to jre/src/main/java/com/azure/data/cosmos/serialization/hybridrow/layouts/LayoutBit.java index 66a2e80..42fbb47 100644 --- a/jre/src/main/java/azure/data/cosmos/serialization/hybridrow/layouts/LayoutBit.java +++ b/jre/src/main/java/com/azure/data/cosmos/serialization/hybridrow/layouts/LayoutBit.java @@ -2,7 +2,7 @@ // Copyright (c) Microsoft Corporation. All rights reserved. //------------------------------------------------------------ -package azure.data.cosmos.serialization.hybridrow.layouts; +package com.azure.data.cosmos.serialization.hybridrow.layouts; import static com.google.common.base.Preconditions.checkArgument; @@ -107,7 +107,7 @@ public final class LayoutBit implements IEquatable { //ORIGINAL LINE: [MethodImpl(MethodImplOptions.AggressiveInlining)] public static bool operator !=(LayoutBit // left, LayoutBit right) public static boolean opNotEquals(LayoutBit left, LayoutBit right) { - return !azure.data.cosmos.serialization.hybridrow.layouts.LayoutBit.opEquals(left.clone(), right.clone()); + return !LayoutBit.opEquals(left.clone(), right.clone()); } /** diff --git a/jre/src/main/java/azure/data/cosmos/serialization/hybridrow/layouts/LayoutBoolean.java b/jre/src/main/java/com/azure/data/cosmos/serialization/hybridrow/layouts/LayoutBoolean.java similarity index 50% rename from jre/src/main/java/azure/data/cosmos/serialization/hybridrow/layouts/LayoutBoolean.java rename to jre/src/main/java/com/azure/data/cosmos/serialization/hybridrow/layouts/LayoutBoolean.java index 5aaf540..da2d04b 100644 --- a/jre/src/main/java/azure/data/cosmos/serialization/hybridrow/layouts/LayoutBoolean.java +++ b/jre/src/main/java/com/azure/data/cosmos/serialization/hybridrow/layouts/LayoutBoolean.java @@ -2,11 +2,13 @@ // Copyright (c) Microsoft Corporation. All rights reserved. //------------------------------------------------------------ -package azure.data.cosmos.serialization.hybridrow.layouts; +package com.azure.data.cosmos.serialization.hybridrow.layouts; -import azure.data.cosmos.serialization.hybridrow.Result; -import azure.data.cosmos.serialization.hybridrow.RowBuffer; -import azure.data.cosmos.serialization.hybridrow.RowCursor; +import com.azure.data.cosmos.core.OutObject; +import com.azure.data.cosmos.core.RefObject; +import com.azure.data.cosmos.serialization.hybridrow.Result; +import com.azure.data.cosmos.serialization.hybridrow.RowBuffer; +import com.azure.data.cosmos.serialization.hybridrow.RowCursor; import static com.google.common.base.Preconditions.checkArgument; @@ -31,46 +33,46 @@ public final class LayoutBoolean extends LayoutType { } @Override - public Result ReadFixed(tangible.RefObject b, tangible.RefObject scope, LayoutColumn col, - tangible.OutObject value) { - checkArgument(scope.argValue.scopeType instanceof LayoutUDT); - if (!b.argValue.ReadBit(scope.argValue.start, col.getNullBit().clone())) { - value.argValue = false; + public Result ReadFixed(RefObject b, RefObject scope, LayoutColumn col, + OutObject value) { + checkArgument(scope.get().scopeType instanceof LayoutUDT); + if (!b.get().ReadBit(scope.get().start, col.getNullBit().clone())) { + value.set(false); return Result.NotFound; } - value.argValue = b.argValue.ReadBit(scope.argValue.start, col.getBoolBit().clone()); + value.set(b.get().ReadBit(scope.get().start, col.getBoolBit().clone())); return Result.Success; } @Override - public Result ReadSparse(tangible.RefObject b, tangible.RefObject edit, - tangible.OutObject value) { + public Result ReadSparse(RefObject b, RefObject edit, + OutObject value) { Result result = LayoutType.PrepareSparseRead(b, edit, this.LayoutCode); if (result != Result.Success) { - value.argValue = false; + value.set(false); return result; } - value.argValue = b.argValue.ReadSparseBool(edit); + value.set(b.get().ReadSparseBool(edit)); return Result.Success; } @Override - public Result WriteFixed(tangible.RefObject b, tangible.RefObject scope, LayoutColumn col, + public Result WriteFixed(RefObject b, RefObject scope, LayoutColumn col, boolean value) { - checkArgument(scope.argValue.scopeType instanceof LayoutUDT); - if (scope.argValue.immutable) { + checkArgument(scope.get().scopeType instanceof LayoutUDT); + if (scope.get().immutable) { return Result.InsufficientPermissions; } if (value) { - b.argValue.SetBit(scope.argValue.start, col.getBoolBit().clone()); + b.get().SetBit(scope.get().start, col.getBoolBit().clone()); } else { - b.argValue.UnsetBit(scope.argValue.start, col.getBoolBit().clone()); + b.get().UnsetBit(scope.get().start, col.getBoolBit().clone()); } - b.argValue.SetBit(scope.argValue.start, col.getNullBit().clone()); + b.get().SetBit(scope.get().start, col.getNullBit().clone()); return Result.Success; } @@ -78,19 +80,19 @@ public final class LayoutBoolean extends LayoutType { //ORIGINAL LINE: public override Result WriteSparse(ref RowBuffer b, ref RowCursor edit, bool value, // UpdateOptions options = UpdateOptions.Upsert) @Override - public Result WriteSparse(tangible.RefObject b, tangible.RefObject edit, boolean value, + public Result WriteSparse(RefObject b, RefObject edit, boolean value, UpdateOptions options) { Result result = LayoutType.PrepareSparseWrite(b, edit, this.getTypeArg().clone(), options); if (result != Result.Success) { return result; } - b.argValue.WriteSparseBool(edit, value, options); + b.get().WriteSparseBool(edit, value, options); return Result.Success; } @Override - public Result WriteSparse(tangible.RefObject b, tangible.RefObject edit, boolean value) { + public Result WriteSparse(RefObject b, RefObject edit, boolean value) { return WriteSparse(b, edit, value, UpdateOptions.Upsert); } } \ No newline at end of file diff --git a/jre/src/main/java/azure/data/cosmos/serialization/hybridrow/layouts/LayoutBuilder.java b/jre/src/main/java/com/azure/data/cosmos/serialization/hybridrow/layouts/LayoutBuilder.java similarity index 94% rename from jre/src/main/java/azure/data/cosmos/serialization/hybridrow/layouts/LayoutBuilder.java rename to jre/src/main/java/com/azure/data/cosmos/serialization/hybridrow/layouts/LayoutBuilder.java index 2de78ad..f4a88f4 100644 --- a/jre/src/main/java/azure/data/cosmos/serialization/hybridrow/layouts/LayoutBuilder.java +++ b/jre/src/main/java/com/azure/data/cosmos/serialization/hybridrow/layouts/LayoutBuilder.java @@ -2,10 +2,10 @@ // Copyright (c) Microsoft Corporation. All rights reserved. //------------------------------------------------------------ -package azure.data.cosmos.serialization.hybridrow.layouts; +package com.azure.data.cosmos.serialization.hybridrow.layouts; -import azure.data.cosmos.serialization.hybridrow.SchemaId; -import azure.data.cosmos.serialization.hybridrow.schemas.StorageKind; +import com.azure.data.cosmos.serialization.hybridrow.SchemaId; +import com.azure.data.cosmos.serialization.hybridrow.schemas.StorageKind; import java.util.ArrayList; import java.util.Stack; diff --git a/jre/src/main/java/azure/data/cosmos/serialization/hybridrow/layouts/LayoutCode.java b/jre/src/main/java/com/azure/data/cosmos/serialization/hybridrow/layouts/LayoutCode.java similarity index 94% rename from jre/src/main/java/azure/data/cosmos/serialization/hybridrow/layouts/LayoutCode.java rename to jre/src/main/java/com/azure/data/cosmos/serialization/hybridrow/layouts/LayoutCode.java index 4cca7c0..b111d1a 100644 --- a/jre/src/main/java/azure/data/cosmos/serialization/hybridrow/layouts/LayoutCode.java +++ b/jre/src/main/java/com/azure/data/cosmos/serialization/hybridrow/layouts/LayoutCode.java @@ -2,7 +2,7 @@ // Copyright (c) Microsoft Corporation. All rights reserved. //------------------------------------------------------------ -package azure.data.cosmos.serialization.hybridrow.layouts; +package com.azure.data.cosmos.serialization.hybridrow.layouts; // TODO: C# TO JAVA CONVERTER: There is no preprocessor in Java: ///#pragma warning disable CA1028 // Enum Storage should be Int32 diff --git a/jre/src/main/java/azure/data/cosmos/serialization/hybridrow/layouts/LayoutCodeTraits.java b/jre/src/main/java/com/azure/data/cosmos/serialization/hybridrow/layouts/LayoutCodeTraits.java similarity index 94% rename from jre/src/main/java/azure/data/cosmos/serialization/hybridrow/layouts/LayoutCodeTraits.java rename to jre/src/main/java/com/azure/data/cosmos/serialization/hybridrow/layouts/LayoutCodeTraits.java index 71fbe40..06e5993 100644 --- a/jre/src/main/java/azure/data/cosmos/serialization/hybridrow/layouts/LayoutCodeTraits.java +++ b/jre/src/main/java/com/azure/data/cosmos/serialization/hybridrow/layouts/LayoutCodeTraits.java @@ -2,7 +2,7 @@ // Copyright (c) Microsoft Corporation. All rights reserved. //------------------------------------------------------------ -package azure.data.cosmos.serialization.hybridrow.layouts; +package com.azure.data.cosmos.serialization.hybridrow.layouts; public final class LayoutCodeTraits { /** diff --git a/jre/src/main/java/azure/data/cosmos/serialization/hybridrow/layouts/LayoutColumn.java b/jre/src/main/java/com/azure/data/cosmos/serialization/hybridrow/layouts/LayoutColumn.java similarity index 93% rename from jre/src/main/java/azure/data/cosmos/serialization/hybridrow/layouts/LayoutColumn.java rename to jre/src/main/java/com/azure/data/cosmos/serialization/hybridrow/layouts/LayoutColumn.java index 6dd7515..0ae9efe 100644 --- a/jre/src/main/java/azure/data/cosmos/serialization/hybridrow/layouts/LayoutColumn.java +++ b/jre/src/main/java/com/azure/data/cosmos/serialization/hybridrow/layouts/LayoutColumn.java @@ -2,9 +2,11 @@ // Copyright (c) Microsoft Corporation. All rights reserved. //------------------------------------------------------------ -package azure.data.cosmos.serialization.hybridrow.layouts; +package com.azure.data.cosmos.serialization.hybridrow.layouts; -import azure.data.cosmos.serialization.hybridrow.schemas.StorageKind; +import com.azure.data.cosmos.serialization.hybridrow.schemas.StorageKind; + +import static com.google.common.base.Strings.lenientFormat; // TODO: C# TO JAVA CONVERTER: Java annotations will not correspond to .NET attributes: //ORIGINAL LINE: [DebuggerDisplay("{FullPath + \": \" + Type.Name + TypeArgs.ToString()}")] public sealed class @@ -236,7 +238,7 @@ public final class LayoutColumn { case TypedMapScope: return parent.getFullPath().toString() + "[]" + path; default: - Contract.Fail(String.format("Parent scope type not supported: %1$s", parent.type.LayoutCode)); + throw new IllegalStateException(lenientFormat("Parent scope type not supported: %s", parent.type.LayoutCode)); return null; } } diff --git a/jre/src/main/java/azure/data/cosmos/serialization/hybridrow/layouts/LayoutCompilationException.java b/jre/src/main/java/com/azure/data/cosmos/serialization/hybridrow/layouts/LayoutCompilationException.java similarity index 91% rename from jre/src/main/java/azure/data/cosmos/serialization/hybridrow/layouts/LayoutCompilationException.java rename to jre/src/main/java/com/azure/data/cosmos/serialization/hybridrow/layouts/LayoutCompilationException.java index 9944f9a..c115e18 100644 --- a/jre/src/main/java/azure/data/cosmos/serialization/hybridrow/layouts/LayoutCompilationException.java +++ b/jre/src/main/java/com/azure/data/cosmos/serialization/hybridrow/layouts/LayoutCompilationException.java @@ -2,7 +2,7 @@ // Copyright (c) Microsoft Corporation. All rights reserved. //------------------------------------------------------------ -package azure.data.cosmos.serialization.hybridrow.layouts; +package com.azure.data.cosmos.serialization.hybridrow.layouts; import java.io.Serializable; diff --git a/jre/src/main/java/azure/data/cosmos/serialization/hybridrow/layouts/LayoutCompiler.java b/jre/src/main/java/com/azure/data/cosmos/serialization/hybridrow/layouts/LayoutCompiler.java similarity index 77% rename from jre/src/main/java/azure/data/cosmos/serialization/hybridrow/layouts/LayoutCompiler.java rename to jre/src/main/java/com/azure/data/cosmos/serialization/hybridrow/layouts/LayoutCompiler.java index 62458cc..ae4c1d3 100644 --- a/jre/src/main/java/azure/data/cosmos/serialization/hybridrow/layouts/LayoutCompiler.java +++ b/jre/src/main/java/com/azure/data/cosmos/serialization/hybridrow/layouts/LayoutCompiler.java @@ -2,23 +2,24 @@ // Copyright (c) Microsoft Corporation. All rights reserved. //------------------------------------------------------------ -package azure.data.cosmos.serialization.hybridrow.layouts; +package com.azure.data.cosmos.serialization.hybridrow.layouts; -import azure.data.cosmos.serialization.hybridrow.SchemaId; -import azure.data.cosmos.serialization.hybridrow.schemas.ArrayPropertyType; -import azure.data.cosmos.serialization.hybridrow.schemas.MapPropertyType; -import azure.data.cosmos.serialization.hybridrow.schemas.Namespace; -import azure.data.cosmos.serialization.hybridrow.schemas.ObjectPropertyType; -import azure.data.cosmos.serialization.hybridrow.schemas.PrimitivePropertyType; -import azure.data.cosmos.serialization.hybridrow.schemas.Property; -import azure.data.cosmos.serialization.hybridrow.schemas.PropertyType; -import azure.data.cosmos.serialization.hybridrow.schemas.Schema; -import azure.data.cosmos.serialization.hybridrow.schemas.ScopePropertyType; -import azure.data.cosmos.serialization.hybridrow.schemas.SetPropertyType; -import azure.data.cosmos.serialization.hybridrow.schemas.TaggedPropertyType; -import azure.data.cosmos.serialization.hybridrow.schemas.TuplePropertyType; -import azure.data.cosmos.serialization.hybridrow.schemas.TypeKind; -import azure.data.cosmos.serialization.hybridrow.schemas.UdtPropertyType; +import com.azure.data.cosmos.core.OutObject; +import com.azure.data.cosmos.serialization.hybridrow.SchemaId; +import com.azure.data.cosmos.serialization.hybridrow.schemas.ArrayPropertyType; +import com.azure.data.cosmos.serialization.hybridrow.schemas.MapPropertyType; +import com.azure.data.cosmos.serialization.hybridrow.schemas.Namespace; +import com.azure.data.cosmos.serialization.hybridrow.schemas.ObjectPropertyType; +import com.azure.data.cosmos.serialization.hybridrow.schemas.PrimitivePropertyType; +import com.azure.data.cosmos.serialization.hybridrow.schemas.Property; +import com.azure.data.cosmos.serialization.hybridrow.schemas.PropertyType; +import com.azure.data.cosmos.serialization.hybridrow.schemas.Schema; +import com.azure.data.cosmos.serialization.hybridrow.schemas.ScopePropertyType; +import com.azure.data.cosmos.serialization.hybridrow.schemas.SetPropertyType; +import com.azure.data.cosmos.serialization.hybridrow.schemas.TaggedPropertyType; +import com.azure.data.cosmos.serialization.hybridrow.schemas.TuplePropertyType; +import com.azure.data.cosmos.serialization.hybridrow.schemas.TypeKind; +import com.azure.data.cosmos.serialization.hybridrow.schemas.UdtPropertyType; import java.util.ArrayList; @@ -52,10 +53,10 @@ public final class LayoutCompiler { ArrayList properties) { for (Property p : properties) { TypeArgumentList typeArgs = new TypeArgumentList(); - tangible.OutObject tempOut_typeArgs = - new tangible.OutObject(); + OutObject tempOut_typeArgs = + new OutObject(); LayoutType type = LayoutCompiler.LogicalToPhysicalType(ns, p.getPropertyType(), tempOut_typeArgs); - typeArgs = tempOut_typeArgs.argValue; + typeArgs = tempOut_typeArgs.get(); switch (LayoutCodeTraits.ClearImmutableBit(type.LayoutCode)) { case ObjectScope: { if (!p.getPropertyType().getNullable()) { @@ -148,8 +149,8 @@ public final class LayoutCompiler { } private static LayoutType LogicalToPhysicalType(Namespace ns, PropertyType logicalType, - tangible.OutObject typeArgs) { - typeArgs.argValue = TypeArgumentList.Empty; + OutObject typeArgs) { + typeArgs.set(TypeArgumentList.Empty); boolean tempVar = (logicalType instanceof ScopePropertyType ? (ScopePropertyType)logicalType : null).getImmutable(); boolean immutable = @@ -208,17 +209,17 @@ public final class LayoutCompiler { ArrayPropertyType ap = (ArrayPropertyType)logicalType; if ((ap.getItems() != null) && (ap.getItems().getType() != TypeKind.Any)) { TypeArgumentList itemTypeArgs = new TypeArgumentList(); - tangible.OutObject tempOut_itemTypeArgs = new tangible.OutObject(); + OutObject tempOut_itemTypeArgs = new OutObject(); LayoutType itemType = LayoutCompiler.LogicalToPhysicalType(ns, ap.getItems(), tempOut_itemTypeArgs); - itemTypeArgs = tempOut_itemTypeArgs.argValue; + itemTypeArgs = tempOut_itemTypeArgs.get(); if (ap.getItems().getNullable()) { itemTypeArgs = new TypeArgumentList(new TypeArgument[] { new TypeArgument(itemType, itemTypeArgs.clone()) }); itemType = itemType.Immutable ? LayoutType.ImmutableNullable : LayoutType.Nullable; } - typeArgs.argValue = new TypeArgumentList(new TypeArgument[] { new TypeArgument(itemType, - itemTypeArgs.clone()) }); + typeArgs.set(new TypeArgumentList(new TypeArgument[] { new TypeArgument(itemType, + itemTypeArgs.clone()) })); return immutable ? LayoutType.ImmutableTypedArray : LayoutType.TypedArray; } @@ -227,18 +228,18 @@ public final class LayoutCompiler { SetPropertyType sp = (SetPropertyType)logicalType; if ((sp.getItems() != null) && (sp.getItems().getType() != TypeKind.Any)) { TypeArgumentList itemTypeArgs = new TypeArgumentList(); - tangible.OutObject tempOut_itemTypeArgs2 = new tangible.OutObject(); + OutObject tempOut_itemTypeArgs2 = new OutObject(); LayoutType itemType = LayoutCompiler.LogicalToPhysicalType(ns, sp.getItems(), tempOut_itemTypeArgs2); - itemTypeArgs = tempOut_itemTypeArgs2.argValue; + itemTypeArgs = tempOut_itemTypeArgs2.get(); if (sp.getItems().getNullable()) { itemTypeArgs = new TypeArgumentList(new TypeArgument[] { new TypeArgument(itemType, itemTypeArgs.clone()) }); itemType = itemType.Immutable ? LayoutType.ImmutableNullable : LayoutType.Nullable; } - typeArgs.argValue = new TypeArgumentList(new TypeArgument[] { new TypeArgument(itemType, - itemTypeArgs.clone()) }); + typeArgs.set(new TypeArgumentList(new TypeArgument[] { new TypeArgument(itemType, + itemTypeArgs.clone()) })); return immutable ? LayoutType.ImmutableTypedSet : LayoutType.TypedSet; } @@ -250,9 +251,9 @@ public final class LayoutCompiler { MapPropertyType mp = (MapPropertyType)logicalType; if ((mp.getKeys() != null) && (mp.getKeys().getType() != TypeKind.Any) && (mp.getValues() != null) && (mp.getValues().getType() != TypeKind.Any)) { TypeArgumentList keyTypeArgs = new TypeArgumentList(); - tangible.OutObject tempOut_keyTypeArgs = new tangible.OutObject(); + OutObject tempOut_keyTypeArgs = new OutObject(); LayoutType keyType = LayoutCompiler.LogicalToPhysicalType(ns, mp.getKeys(), tempOut_keyTypeArgs); - keyTypeArgs = tempOut_keyTypeArgs.argValue; + keyTypeArgs = tempOut_keyTypeArgs.get(); if (mp.getKeys().getNullable()) { keyTypeArgs = new TypeArgumentList(new TypeArgument[] { new TypeArgument(keyType, keyTypeArgs.clone()) }); @@ -260,21 +261,21 @@ public final class LayoutCompiler { } TypeArgumentList valueTypeArgs = new TypeArgumentList(); - tangible.OutObject tempOut_valueTypeArgs = new tangible.OutObject(); + OutObject tempOut_valueTypeArgs = new OutObject(); LayoutType valueType = LayoutCompiler.LogicalToPhysicalType(ns, mp.getValues(), tempOut_valueTypeArgs); - valueTypeArgs = tempOut_valueTypeArgs.argValue; + valueTypeArgs = tempOut_valueTypeArgs.get(); if (mp.getValues().getNullable()) { valueTypeArgs = new TypeArgumentList(new TypeArgument[] { new TypeArgument(valueType, valueTypeArgs.clone()) }); valueType = valueType.Immutable ? LayoutType.ImmutableNullable : LayoutType.Nullable; } - typeArgs.argValue = new TypeArgumentList(new TypeArgument[] + typeArgs.set(new TypeArgumentList(new TypeArgument[] { new TypeArgument(keyType, keyTypeArgs.clone()), new TypeArgument(valueType, valueTypeArgs.clone()) - }); + })); return immutable ? LayoutType.ImmutableTypedMap : LayoutType.TypedMap; } @@ -287,10 +288,10 @@ public final class LayoutCompiler { TypeArgument[] args = new TypeArgument[tp.getItems().size()]; for (int i = 0; i < tp.getItems().size(); i++) { TypeArgumentList itemTypeArgs = new TypeArgumentList(); - tangible.OutObject tempOut_itemTypeArgs3 = new tangible.OutObject(); + OutObject tempOut_itemTypeArgs3 = new OutObject(); LayoutType itemType = LayoutCompiler.LogicalToPhysicalType(ns, tp.getItems().get(i), tempOut_itemTypeArgs3); - itemTypeArgs = tempOut_itemTypeArgs3.argValue; + itemTypeArgs = tempOut_itemTypeArgs3.get(); if (tp.getItems().get(i).getNullable()) { itemTypeArgs = new TypeArgumentList(new TypeArgument[] { new TypeArgument(itemType, itemTypeArgs.clone()) }); @@ -300,7 +301,7 @@ public final class LayoutCompiler { args[i] = new TypeArgument(itemType, itemTypeArgs.clone()); } - typeArgs.argValue = new TypeArgumentList(args); + typeArgs.set(new TypeArgumentList(args)); return immutable ? LayoutType.ImmutableTypedTuple : LayoutType.TypedTuple; case Tagged: @@ -315,10 +316,10 @@ public final class LayoutCompiler { tgArgs[0] = new TypeArgument(LayoutType.UInt8, TypeArgumentList.Empty); for (int i = 0; i < tg.getItems().size(); i++) { TypeArgumentList itemTypeArgs = new TypeArgumentList(); - tangible.OutObject tempOut_itemTypeArgs4 = new tangible.OutObject(); + OutObject tempOut_itemTypeArgs4 = new OutObject(); LayoutType itemType = LayoutCompiler.LogicalToPhysicalType(ns, tg.getItems().get(i), tempOut_itemTypeArgs4); - itemTypeArgs = tempOut_itemTypeArgs4.argValue; + itemTypeArgs = tempOut_itemTypeArgs4.get(); if (tg.getItems().get(i).getNullable()) { itemTypeArgs = new TypeArgumentList(new TypeArgument[] { new TypeArgument(itemType, itemTypeArgs.clone()) }); @@ -328,7 +329,7 @@ public final class LayoutCompiler { tgArgs[i + 1] = new TypeArgument(itemType, itemTypeArgs.clone()); } - typeArgs.argValue = new TypeArgumentList(tgArgs); + typeArgs.set(new TypeArgumentList(tgArgs)); switch (tg.getItems().size()) { case 1: return immutable ? LayoutType.ImmutableTagged : LayoutType.Tagged; @@ -341,13 +342,11 @@ public final class LayoutCompiler { case Schema: UdtPropertyType up = (UdtPropertyType)logicalType; Schema udtSchema; - if (azure.data.cosmos.serialization.hybridrow.SchemaId.opEquals(up.getSchemaId().clone(), - SchemaId.Invalid)) { + if (SchemaId.opEquals(up.getSchemaId().clone(), SchemaId.Invalid)) { udtSchema = tangible.ListHelper.find(ns.getSchemas(), s = up.getName().equals( > s.Name)) } else { udtSchema = tangible.ListHelper.find(ns.getSchemas(), s = - azure.data.cosmos.serialization.hybridrow.SchemaId.opEquals( > s.SchemaId, - up.getSchemaId().clone())) + SchemaId.opEquals( > s.SchemaId, up.getSchemaId().clone())) if (!udtSchema.getName().equals(up.getName())) { throw new LayoutCompilationException(String.format("Ambiguous schema reference: '%1$s:%2$s'", up.getName(), up.getSchemaId().clone())); @@ -359,7 +358,7 @@ public final class LayoutCompiler { up.getName(), up.getSchemaId().clone())); } - typeArgs.argValue = new TypeArgumentList(udtSchema.getSchemaId().clone()); + typeArgs.set(new TypeArgumentList(udtSchema.getSchemaId().clone())); return immutable ? LayoutType.ImmutableUDT : LayoutType.UDT; default: diff --git a/jre/src/main/java/com/azure/data/cosmos/serialization/hybridrow/layouts/LayoutDateTime.java b/jre/src/main/java/com/azure/data/cosmos/serialization/hybridrow/layouts/LayoutDateTime.java new file mode 100644 index 0000000..90dbb68 --- /dev/null +++ b/jre/src/main/java/com/azure/data/cosmos/serialization/hybridrow/layouts/LayoutDateTime.java @@ -0,0 +1,90 @@ +//------------------------------------------------------------ +// Copyright (c) Microsoft Corporation. All rights reserved. +//------------------------------------------------------------ + +package com.azure.data.cosmos.serialization.hybridrow.layouts; + +import com.azure.data.cosmos.core.OutObject; +import com.azure.data.cosmos.core.RefObject; +import com.azure.data.cosmos.serialization.hybridrow.Result; +import com.azure.data.cosmos.serialization.hybridrow.RowBuffer; +import com.azure.data.cosmos.serialization.hybridrow.RowCursor; + +import java.time.LocalDateTime; + +import static com.google.common.base.Preconditions.checkArgument; + +public final class LayoutDateTime extends LayoutType { + public LayoutDateTime() { + super(com.azure.data.cosmos.serialization.hybridrow.layouts.LayoutCode.DateTime, 8); + } + + @Override + public boolean getIsFixed() { + return true; + } + + @Override + public String getName() { + return "datetime"; + } + + @Override + public Result ReadFixed(RefObject b, RefObject scope, LayoutColumn col, + OutObject value) { + checkArgument(scope.get().scopeType instanceof LayoutUDT); + if (!b.get().ReadBit(scope.get().start, col.getNullBit().clone())) { + value.set(LocalDateTime.MIN); + return Result.NotFound; + } + + value.set(b.get().ReadDateTime(scope.get().start + col.getOffset())); + return Result.Success; + } + + @Override + public Result ReadSparse(RefObject b, RefObject edit, + OutObject value) { + Result result = LayoutType.PrepareSparseRead(b, edit, this.LayoutCode); + if (result != Result.Success) { + value.set(LocalDateTime.MIN); + return result; + } + + value.set(b.get().ReadSparseDateTime(edit)); + return Result.Success; + } + + @Override + public Result WriteFixed(RefObject b, RefObject scope, LayoutColumn col, + LocalDateTime value) { + checkArgument(scope.get().scopeType instanceof LayoutUDT); + if (scope.get().immutable) { + return Result.InsufficientPermissions; + } + + b.get().WriteDateTime(scope.get().start + col.getOffset(), value); + b.get().SetBit(scope.get().start, col.getNullBit().clone()); + return Result.Success; + } + + //C# TO JAVA CONVERTER NOTE: Java does not support optional parameters. Overloaded method(s) are created above: + //ORIGINAL LINE: public override Result WriteSparse(ref RowBuffer b, ref RowCursor edit, DateTime value, + // UpdateOptions options = UpdateOptions.Upsert) + @Override + public Result WriteSparse(RefObject b, RefObject edit, + LocalDateTime value, UpdateOptions options) { + Result result = LayoutType.PrepareSparseWrite(b, edit, this.getTypeArg().clone(), options); + if (result != Result.Success) { + return result; + } + + b.get().WriteSparseDateTime(edit, value, options); + return Result.Success; + } + + @Override + public Result WriteSparse(RefObject b, RefObject edit, DateTime value) { + return WriteSparse(b, edit, value, UpdateOptions.Upsert); + } +} \ No newline at end of file diff --git a/jre/src/main/java/com/azure/data/cosmos/serialization/hybridrow/layouts/LayoutDecimal.java b/jre/src/main/java/com/azure/data/cosmos/serialization/hybridrow/layouts/LayoutDecimal.java new file mode 100644 index 0000000..b9a38b5 --- /dev/null +++ b/jre/src/main/java/com/azure/data/cosmos/serialization/hybridrow/layouts/LayoutDecimal.java @@ -0,0 +1,92 @@ +//------------------------------------------------------------ +// Copyright (c) Microsoft Corporation. All rights reserved. +//------------------------------------------------------------ + +package com.azure.data.cosmos.serialization.hybridrow.layouts; + +import com.azure.data.cosmos.core.OutObject; +import com.azure.data.cosmos.core.RefObject; +import com.azure.data.cosmos.serialization.hybridrow.Result; +import com.azure.data.cosmos.serialization.hybridrow.RowBuffer; +import com.azure.data.cosmos.serialization.hybridrow.RowCursor; + +import java.math.BigDecimal; + +import static com.google.common.base.Preconditions.checkArgument; + +public final class LayoutDecimal extends LayoutType { + public LayoutDecimal() { + // TODO: C# TO JAVA CONVERTER: There is no Java equivalent to 'sizeof': + super(com.azure.data.cosmos.serialization.hybridrow.layouts.LayoutCode.Decimal, sizeof(BigDecimal)); + } + + @Override + public boolean getIsFixed() { + return true; + } + + @Override + public String getName() { + return "decimal"; + } + + @Override + public Result ReadFixed(RefObject b, RefObject scope, LayoutColumn col, + OutObject value) { + checkArgument(scope.get().scopeType instanceof LayoutUDT); + if (!b.get().ReadBit(scope.get().start, col.getNullBit().clone())) { + value.set(new BigDecimal(0)); + return Result.NotFound; + } + + value.set(b.get().ReadDecimal(scope.get().start + col.getOffset())); + return Result.Success; + } + + @Override + public Result ReadSparse(RefObject b, RefObject edit, + OutObject value) { + Result result = LayoutType.PrepareSparseRead(b, edit, this.LayoutCode); + if (result != Result.Success) { + value.set(new BigDecimal(0)); + return result; + } + + value.set(b.get().ReadSparseDecimal(edit)); + return Result.Success; + } + + @Override + public Result WriteFixed(RefObject b, RefObject scope, LayoutColumn col, + BigDecimal value) { + checkArgument(scope.get().scopeType instanceof LayoutUDT); + if (scope.get().immutable) { + return Result.InsufficientPermissions; + } + + b.get().WriteDecimal(scope.get().start + col.getOffset(), value); + b.get().SetBit(scope.get().start, col.getNullBit().clone()); + return Result.Success; + } + + //C# TO JAVA CONVERTER NOTE: Java does not support optional parameters. Overloaded method(s) are created above: + //ORIGINAL LINE: public override Result WriteSparse(ref RowBuffer b, ref RowCursor edit, decimal value, + // UpdateOptions options = UpdateOptions.Upsert) + @Override + public Result WriteSparse(RefObject b, RefObject edit, BigDecimal value, + UpdateOptions options) { + Result result = LayoutType.PrepareSparseWrite(b, edit, this.getTypeArg().clone(), options); + if (result != Result.Success) { + return result; + } + + b.get().WriteSparseDecimal(edit, value, options); + return Result.Success; + } + + @Override + public Result WriteSparse(RefObject b, RefObject edit, + java.math.BigDecimal value) { + return WriteSparse(b, edit, value, UpdateOptions.Upsert); + } +} \ No newline at end of file diff --git a/jre/src/main/java/azure/data/cosmos/serialization/hybridrow/layouts/LayoutEndScope.java b/jre/src/main/java/com/azure/data/cosmos/serialization/hybridrow/layouts/LayoutEndScope.java similarity index 56% rename from jre/src/main/java/azure/data/cosmos/serialization/hybridrow/layouts/LayoutEndScope.java rename to jre/src/main/java/com/azure/data/cosmos/serialization/hybridrow/layouts/LayoutEndScope.java index 17a8404..67156d7 100644 --- a/jre/src/main/java/azure/data/cosmos/serialization/hybridrow/layouts/LayoutEndScope.java +++ b/jre/src/main/java/com/azure/data/cosmos/serialization/hybridrow/layouts/LayoutEndScope.java @@ -2,11 +2,13 @@ // Copyright (c) Microsoft Corporation. All rights reserved. //------------------------------------------------------------ -package azure.data.cosmos.serialization.hybridrow.layouts; +package com.azure.data.cosmos.serialization.hybridrow.layouts; -import azure.data.cosmos.serialization.hybridrow.Result; -import azure.data.cosmos.serialization.hybridrow.RowBuffer; -import azure.data.cosmos.serialization.hybridrow.RowCursor; +import com.azure.data.cosmos.core.OutObject; +import com.azure.data.cosmos.core.RefObject; +import com.azure.data.cosmos.serialization.hybridrow.Result; +import com.azure.data.cosmos.serialization.hybridrow.RowBuffer; +import com.azure.data.cosmos.serialization.hybridrow.RowCursor; public final class LayoutEndScope extends LayoutScope { public LayoutEndScope() { @@ -14,7 +16,7 @@ public final class LayoutEndScope extends LayoutScope { // following line: //ORIGINAL LINE: base(LayoutCode.EndScope, false, isSizedScope: false, isIndexedScope: false, isFixedArity: // false, isUniqueScope: false, isTypedScope: false); - super(azure.data.cosmos.serialization.hybridrow.layouts.LayoutCode.EndScope, false, isSizedScope:false, isIndexedScope:false, isFixedArity:false, isUniqueScope: + super(com.azure.data.cosmos.serialization.hybridrow.layouts.LayoutCode.EndScope, false, isSizedScope:false, isIndexedScope:false, isFixedArity:false, isUniqueScope: false, isTypedScope:false) } @@ -25,8 +27,8 @@ public final class LayoutEndScope extends LayoutScope { @Override - public Result WriteScope(tangible.RefObject b, tangible.RefObject scope, - TypeArgumentList typeArgs, tangible.OutObject value) { + public Result WriteScope(RefObject b, RefObject scope, + TypeArgumentList typeArgs, OutObject value) { return WriteScope(b, scope, typeArgs, value, UpdateOptions.Upsert); } @@ -34,10 +36,10 @@ public final class LayoutEndScope extends LayoutScope { //ORIGINAL LINE: public override Result WriteScope(ref RowBuffer b, ref RowCursor scope, TypeArgumentList // typeArgs, out RowCursor value, UpdateOptions options = UpdateOptions.Upsert) @Override - public Result WriteScope(tangible.RefObject b, tangible.RefObject scope, - TypeArgumentList typeArgs, tangible.OutObject value, UpdateOptions options) { + public Result WriteScope(RefObject b, RefObject scope, + TypeArgumentList typeArgs, OutObject value, UpdateOptions options) { Contract.Fail("Cannot write an EndScope directly"); - value.argValue = null; + value.set(null); return Result.Failure; } } \ No newline at end of file diff --git a/jre/src/main/java/com/azure/data/cosmos/serialization/hybridrow/layouts/LayoutFloat128.java b/jre/src/main/java/com/azure/data/cosmos/serialization/hybridrow/layouts/LayoutFloat128.java new file mode 100644 index 0000000..8996269 --- /dev/null +++ b/jre/src/main/java/com/azure/data/cosmos/serialization/hybridrow/layouts/LayoutFloat128.java @@ -0,0 +1,89 @@ +//------------------------------------------------------------ +// Copyright (c) Microsoft Corporation. All rights reserved. +//------------------------------------------------------------ + +package com.azure.data.cosmos.serialization.hybridrow.layouts; + +import com.azure.data.cosmos.core.OutObject; +import com.azure.data.cosmos.core.RefObject; +import com.azure.data.cosmos.serialization.hybridrow.Float128; +import com.azure.data.cosmos.serialization.hybridrow.Result; +import com.azure.data.cosmos.serialization.hybridrow.RowBuffer; +import com.azure.data.cosmos.serialization.hybridrow.RowCursor; + +import static com.google.common.base.Preconditions.checkArgument; + +public final class LayoutFloat128 extends LayoutType { + public LayoutFloat128() { + super(com.azure.data.cosmos.serialization.hybridrow.layouts.LayoutCode.Float128, HybridRow.Float128.Size); + } + + @Override + public boolean getIsFixed() { + return true; + } + + @Override + public String getName() { + return "float128"; + } + + @Override + public Result ReadFixed(RefObject b, RefObject scope, LayoutColumn col, + OutObject value) { + checkArgument(scope.get().scopeType instanceof LayoutUDT); + if (!b.get().ReadBit(scope.get().start, col.getNullBit().clone())) { + value.set(null); + return Result.NotFound; + } + + value.set(b.get().ReadFloat128(scope.get().start + col.getOffset()).clone()); + return Result.Success; + } + + @Override + public Result ReadSparse(RefObject b, RefObject edit, + OutObject value) { + Result result = LayoutType.PrepareSparseRead(b, edit, this.LayoutCode); + if (result != Result.Success) { + value.set(null); + return result; + } + + value.set(b.get().ReadSparseFloat128(edit).clone()); + return Result.Success; + } + + @Override + public Result WriteFixed(RefObject b, RefObject scope, LayoutColumn col, + Float128 value) { + checkArgument(scope.get().scopeType instanceof LayoutUDT); + if (scope.get().immutable) { + return Result.InsufficientPermissions; + } + + b.get().WriteFloat128(scope.get().start + col.getOffset(), value.clone()); + b.get().SetBit(scope.get().start, col.getNullBit().clone()); + return Result.Success; + } + + //C# TO JAVA CONVERTER NOTE: Java does not support optional parameters. Overloaded method(s) are created above: + //ORIGINAL LINE: public override Result WriteSparse(ref RowBuffer b, ref RowCursor edit, Float128 value, + // UpdateOptions options = UpdateOptions.Upsert) + @Override + public Result WriteSparse(RefObject b, RefObject edit, Float128 value, + UpdateOptions options) { + Result result = LayoutType.PrepareSparseWrite(b, edit, this.getTypeArg().clone(), options); + if (result != Result.Success) { + return result; + } + + b.get().WriteSparseFloat128(edit, value.clone(), options); + return Result.Success; + } + + @Override + public Result WriteSparse(RefObject b, RefObject edit, Float128 value) { + return WriteSparse(b, edit, value, UpdateOptions.Upsert); + } +} \ No newline at end of file diff --git a/jre/src/main/java/com/azure/data/cosmos/serialization/hybridrow/layouts/LayoutFloat32.java b/jre/src/main/java/com/azure/data/cosmos/serialization/hybridrow/layouts/LayoutFloat32.java new file mode 100644 index 0000000..7cc31c3 --- /dev/null +++ b/jre/src/main/java/com/azure/data/cosmos/serialization/hybridrow/layouts/LayoutFloat32.java @@ -0,0 +1,88 @@ +//------------------------------------------------------------ +// Copyright (c) Microsoft Corporation. All rights reserved. +//------------------------------------------------------------ + +package com.azure.data.cosmos.serialization.hybridrow.layouts; + +import com.azure.data.cosmos.core.OutObject; +import com.azure.data.cosmos.core.RefObject; +import com.azure.data.cosmos.serialization.hybridrow.Result; +import com.azure.data.cosmos.serialization.hybridrow.RowBuffer; +import com.azure.data.cosmos.serialization.hybridrow.RowCursor; + +import static com.google.common.base.Preconditions.checkArgument; + +public final class LayoutFloat32 extends LayoutType { + public LayoutFloat32() { + super(com.azure.data.cosmos.serialization.hybridrow.layouts.LayoutCode.Float32, (Float.SIZE / Byte.SIZE)); + } + + @Override + public boolean getIsFixed() { + return true; + } + + @Override + public String getName() { + return "float32"; + } + + @Override + public Result ReadFixed(RefObject b, RefObject scope, LayoutColumn col, + OutObject value) { + checkArgument(scope.get().scopeType instanceof LayoutUDT); + if (!b.get().ReadBit(scope.get().start, col.getNullBit().clone())) { + value.set(0); + return Result.NotFound; + } + + value.set(b.get().ReadFloat32(scope.get().start + col.getOffset())); + return Result.Success; + } + + @Override + public Result ReadSparse(RefObject b, RefObject edit, + OutObject value) { + Result result = PrepareSparseRead(b, edit, this.LayoutCode); + if (result != Result.Success) { + value.set(0); + return result; + } + + value.set(b.get().ReadSparseFloat32(edit)); + return Result.Success; + } + + @Override + public Result WriteFixed(RefObject b, RefObject scope, LayoutColumn col, + float value) { + checkArgument(scope.get().scopeType instanceof LayoutUDT); + if (scope.get().immutable) { + return Result.InsufficientPermissions; + } + + b.get().WriteFloat32(scope.get().start + col.getOffset(), value); + b.get().SetBit(scope.get().start, col.getNullBit().clone()); + return Result.Success; + } + + //C# TO JAVA CONVERTER NOTE: Java does not support optional parameters. Overloaded method(s) are created above: + //ORIGINAL LINE: public override Result WriteSparse(ref RowBuffer b, ref RowCursor edit, float value, + // UpdateOptions options = UpdateOptions.Upsert) + @Override + public Result WriteSparse(RefObject b, RefObject edit, float value, + UpdateOptions options) { + Result result = PrepareSparseWrite(b, edit, this.getTypeArg().clone(), options); + if (result != Result.Success) { + return result; + } + + b.get().WriteSparseFloat32(edit, value, options); + return Result.Success; + } + + @Override + public Result WriteSparse(RefObject b, RefObject edit, float value) { + return WriteSparse(b, edit, value, UpdateOptions.Upsert); + } +} \ No newline at end of file diff --git a/jre/src/main/java/com/azure/data/cosmos/serialization/hybridrow/layouts/LayoutFloat64.java b/jre/src/main/java/com/azure/data/cosmos/serialization/hybridrow/layouts/LayoutFloat64.java new file mode 100644 index 0000000..0dcc8c6 --- /dev/null +++ b/jre/src/main/java/com/azure/data/cosmos/serialization/hybridrow/layouts/LayoutFloat64.java @@ -0,0 +1,88 @@ +//------------------------------------------------------------ +// Copyright (c) Microsoft Corporation. All rights reserved. +//------------------------------------------------------------ + +package com.azure.data.cosmos.serialization.hybridrow.layouts; + +import com.azure.data.cosmos.core.OutObject; +import com.azure.data.cosmos.core.RefObject; +import com.azure.data.cosmos.serialization.hybridrow.Result; +import com.azure.data.cosmos.serialization.hybridrow.RowBuffer; +import com.azure.data.cosmos.serialization.hybridrow.RowCursor; + +import static com.google.common.base.Preconditions.checkArgument; + +public final class LayoutFloat64 extends LayoutType { + public LayoutFloat64() { + super(com.azure.data.cosmos.serialization.hybridrow.layouts.LayoutCode.Float64, (Double.SIZE / Byte.SIZE)); + } + + @Override + public boolean getIsFixed() { + return true; + } + + @Override + public String getName() { + return "float64"; + } + + @Override + public Result ReadFixed(RefObject b, RefObject scope, LayoutColumn col, + OutObject value) { + checkArgument(scope.get().scopeType instanceof LayoutUDT); + if (!b.get().ReadBit(scope.get().start, col.getNullBit().clone())) { + value.set(0); + return Result.NotFound; + } + + value.set(b.get().ReadFloat64(scope.get().start + col.getOffset())); + return Result.Success; + } + + @Override + public Result ReadSparse(RefObject b, RefObject edit, + OutObject value) { + Result result = LayoutType.PrepareSparseRead(b, edit, this.LayoutCode); + if (result != Result.Success) { + value.set(0); + return result; + } + + value.set(b.get().ReadSparseFloat64(edit)); + return Result.Success; + } + + @Override + public Result WriteFixed(RefObject b, RefObject scope, LayoutColumn col, + double value) { + checkArgument(scope.get().scopeType instanceof LayoutUDT); + if (scope.get().immutable) { + return Result.InsufficientPermissions; + } + + b.get().WriteFloat64(scope.get().start + col.getOffset(), value); + b.get().SetBit(scope.get().start, col.getNullBit().clone()); + return Result.Success; + } + + //C# TO JAVA CONVERTER NOTE: Java does not support optional parameters. Overloaded method(s) are created above: + //ORIGINAL LINE: public override Result WriteSparse(ref RowBuffer b, ref RowCursor edit, double value, + // UpdateOptions options = UpdateOptions.Upsert) + @Override + public Result WriteSparse(RefObject b, RefObject edit, double value, + UpdateOptions options) { + Result result = LayoutType.PrepareSparseWrite(b, edit, this.getTypeArg().clone(), options); + if (result != Result.Success) { + return result; + } + + b.get().WriteSparseFloat64(edit, value, options); + return Result.Success; + } + + @Override + public Result WriteSparse(RefObject b, RefObject edit, double value) { + return WriteSparse(b, edit, value, UpdateOptions.Upsert); + } +} \ No newline at end of file diff --git a/jre/src/main/java/com/azure/data/cosmos/serialization/hybridrow/layouts/LayoutGuid.java b/jre/src/main/java/com/azure/data/cosmos/serialization/hybridrow/layouts/LayoutGuid.java new file mode 100644 index 0000000..ffc1913 --- /dev/null +++ b/jre/src/main/java/com/azure/data/cosmos/serialization/hybridrow/layouts/LayoutGuid.java @@ -0,0 +1,91 @@ +//------------------------------------------------------------ +// Copyright (c) Microsoft Corporation. All rights reserved. +//------------------------------------------------------------ + +package com.azure.data.cosmos.serialization.hybridrow.layouts; + +import com.azure.data.cosmos.core.OutObject; +import com.azure.data.cosmos.core.RefObject; +import com.azure.data.cosmos.serialization.hybridrow.Result; +import com.azure.data.cosmos.serialization.hybridrow.RowBuffer; +import com.azure.data.cosmos.serialization.hybridrow.RowCursor; + +import java.util.UUID; + +import static com.google.common.base.Preconditions.checkArgument; + +public final class LayoutGuid extends LayoutType { + public LayoutGuid() { + super(com.azure.data.cosmos.serialization.hybridrow.layouts.LayoutCode.Guid, 16); + } + + @Override + public boolean getIsFixed() { + return true; + } + + @Override + public String getName() { + return "guid"; + } + + @Override + public Result ReadFixed(RefObject b, RefObject scope, LayoutColumn col, + OutObject value) { + checkArgument(scope.get().scopeType instanceof LayoutUDT); + if (!b.get().ReadBit(scope.get().start, col.getNullBit().clone())) { + value.set(null); + return Result.NotFound; + } + + value.set(b.get().ReadGuid(scope.get().start + col.getOffset())); + return Result.Success; + } + + @Override + public Result ReadSparse(RefObject b, RefObject edit, + OutObject value) { + Result result = PrepareSparseRead(b, edit, this.LayoutCode); + if (result != Result.Success) { + value.set(null); + return result; + } + + value.set(b.get().ReadSparseGuid(edit)); + return Result.Success; + } + + @Override + public Result WriteFixed(RefObject b, RefObject scope, LayoutColumn col, + UUID value) { + checkArgument(scope.get().scopeType instanceof LayoutUDT); + if (scope.get().immutable) { + return Result.InsufficientPermissions; + } + + b.get().WriteGuid(scope.get().start + col.getOffset(), value); + b.get().SetBit(scope.get().start, col.getNullBit().clone()); + return Result.Success; + } + + //C# TO JAVA CONVERTER NOTE: Java does not support optional parameters. Overloaded method(s) are created above: + //ORIGINAL LINE: public override Result WriteSparse(ref RowBuffer b, ref RowCursor edit, Guid value, + // UpdateOptions options = UpdateOptions.Upsert) + @Override + public Result WriteSparse(RefObject b, RefObject edit, UUID value, + UpdateOptions options) { + Result result = PrepareSparseWrite(b, edit, this.getTypeArg().clone(), options); + if (result != Result.Success) { + return result; + } + + b.get().WriteSparseGuid(edit, value, options); + return Result.Success; + } + + @Override + public Result WriteSparse(RefObject b, RefObject edit, + java.util.UUID value) { + return WriteSparse(b, edit, value, UpdateOptions.Upsert); + } +} \ No newline at end of file diff --git a/jre/src/main/java/com/azure/data/cosmos/serialization/hybridrow/layouts/LayoutIndexedScope.java b/jre/src/main/java/com/azure/data/cosmos/serialization/hybridrow/layouts/LayoutIndexedScope.java new file mode 100644 index 0000000..4919540 --- /dev/null +++ b/jre/src/main/java/com/azure/data/cosmos/serialization/hybridrow/layouts/LayoutIndexedScope.java @@ -0,0 +1,29 @@ +//------------------------------------------------------------ +// Copyright (c) Microsoft Corporation. All rights reserved. +//------------------------------------------------------------ + +package com.azure.data.cosmos.serialization.hybridrow.layouts; + +import com.azure.data.cosmos.core.RefObject; +import com.azure.data.cosmos.serialization.hybridrow.RowBuffer; +import com.azure.data.cosmos.serialization.hybridrow.RowCursor; + +public abstract class LayoutIndexedScope extends LayoutScope { + + protected LayoutIndexedScope( + LayoutCode code, boolean immutable, boolean isSizedScope, boolean isFixedArity, boolean isUniqueScope, + boolean isTypedScope + ) { + // TODO: C# TO JAVA CONVERTER: C# to Java Converter could not resolve the named parameters in the + // following line: + //ORIGINAL LINE: base(code, immutable, isSizedScope, isIndexedScope: true, isFixedArity: isFixedArity, + // isUniqueScope: isUniqueScope, isTypedScope: isTypedScope); + super(code, immutable, isSizedScope, true, isFixedArity, isUniqueScope, isTypedScope); + } + + @Override + public void ReadSparsePath(RefObject row, RefObject edit) { + edit.get().pathToken = 0; + edit.get().pathOffset = 0; + } +} \ No newline at end of file diff --git a/jre/src/main/java/com/azure/data/cosmos/serialization/hybridrow/layouts/LayoutInt16.java b/jre/src/main/java/com/azure/data/cosmos/serialization/hybridrow/layouts/LayoutInt16.java new file mode 100644 index 0000000..51ea736 --- /dev/null +++ b/jre/src/main/java/com/azure/data/cosmos/serialization/hybridrow/layouts/LayoutInt16.java @@ -0,0 +1,88 @@ +//------------------------------------------------------------ +// Copyright (c) Microsoft Corporation. All rights reserved. +//------------------------------------------------------------ + +package com.azure.data.cosmos.serialization.hybridrow.layouts; + +import com.azure.data.cosmos.core.OutObject; +import com.azure.data.cosmos.core.RefObject; +import com.azure.data.cosmos.serialization.hybridrow.Result; +import com.azure.data.cosmos.serialization.hybridrow.RowBuffer; +import com.azure.data.cosmos.serialization.hybridrow.RowCursor; + +import static com.google.common.base.Preconditions.checkArgument; + +public final class LayoutInt16 extends LayoutType { + public LayoutInt16() { + super(com.azure.data.cosmos.serialization.hybridrow.layouts.LayoutCode.Int16, (Short.SIZE / Byte.SIZE)); + } + + @Override + public boolean getIsFixed() { + return true; + } + + @Override + public String getName() { + return "int16"; + } + + @Override + public Result ReadFixed(RefObject b, RefObject scope, LayoutColumn col, + OutObject value) { + checkArgument(scope.get().scopeType instanceof LayoutUDT); + if (!b.get().ReadBit(scope.get().start, col.getNullBit().clone())) { + value.set(0); + return Result.NotFound; + } + + value.set(b.get().ReadInt16(scope.get().start + col.getOffset())); + return Result.Success; + } + + @Override + public Result ReadSparse(RefObject b, RefObject edit, + OutObject value) { + Result result = PrepareSparseRead(b, edit, this.LayoutCode); + if (result != Result.Success) { + value.set(0); + return result; + } + + value.set(b.get().ReadSparseInt16(edit)); + return Result.Success; + } + + @Override + public Result WriteFixed(RefObject b, RefObject scope, LayoutColumn col, + short value) { + checkArgument(scope.get().scopeType instanceof LayoutUDT); + if (scope.get().immutable) { + return Result.InsufficientPermissions; + } + + b.get().WriteInt16(scope.get().start + col.getOffset(), value); + b.get().SetBit(scope.get().start, col.getNullBit().clone()); + return Result.Success; + } + + //C# TO JAVA CONVERTER NOTE: Java does not support optional parameters. Overloaded method(s) are created above: + //ORIGINAL LINE: public override Result WriteSparse(ref RowBuffer b, ref RowCursor edit, short value, + // UpdateOptions options = UpdateOptions.Upsert) + @Override + public Result WriteSparse(RefObject b, RefObject edit, short value, + UpdateOptions options) { + Result result = PrepareSparseWrite(b, edit, this.getTypeArg().clone(), options); + if (result != Result.Success) { + return result; + } + + b.get().WriteSparseInt16(edit, value, options); + return Result.Success; + } + + @Override + public Result WriteSparse(RefObject b, RefObject edit, short value) { + return WriteSparse(b, edit, value, UpdateOptions.Upsert); + } +} \ No newline at end of file diff --git a/jre/src/main/java/com/azure/data/cosmos/serialization/hybridrow/layouts/LayoutInt32.java b/jre/src/main/java/com/azure/data/cosmos/serialization/hybridrow/layouts/LayoutInt32.java new file mode 100644 index 0000000..237e14b --- /dev/null +++ b/jre/src/main/java/com/azure/data/cosmos/serialization/hybridrow/layouts/LayoutInt32.java @@ -0,0 +1,88 @@ +//------------------------------------------------------------ +// Copyright (c) Microsoft Corporation. All rights reserved. +//------------------------------------------------------------ + +package com.azure.data.cosmos.serialization.hybridrow.layouts; + +import com.azure.data.cosmos.core.OutObject; +import com.azure.data.cosmos.core.RefObject; +import com.azure.data.cosmos.serialization.hybridrow.Result; +import com.azure.data.cosmos.serialization.hybridrow.RowBuffer; +import com.azure.data.cosmos.serialization.hybridrow.RowCursor; + +import static com.google.common.base.Preconditions.checkArgument; + +public final class LayoutInt32 extends LayoutType { + public LayoutInt32() { + super(com.azure.data.cosmos.serialization.hybridrow.layouts.LayoutCode.Int32, (Integer.SIZE / Byte.SIZE)); + } + + @Override + public boolean getIsFixed() { + return true; + } + + @Override + public String getName() { + return "int32"; + } + + @Override + public Result ReadFixed(RefObject b, RefObject scope, LayoutColumn col, + OutObject value) { + checkArgument(scope.get().scopeType instanceof LayoutUDT); + if (!b.get().ReadBit(scope.get().start, col.getNullBit().clone())) { + value.set(0); + return Result.NotFound; + } + + value.set(b.get().ReadInt32(scope.get().start + col.getOffset())); + return Result.Success; + } + + @Override + public Result ReadSparse(RefObject b, RefObject edit, + OutObject value) { + Result result = LayoutType.PrepareSparseRead(b, edit, this.LayoutCode); + if (result != Result.Success) { + value.set(0); + return result; + } + + value.set(b.get().ReadSparseInt32(edit)); + return Result.Success; + } + + @Override + public Result WriteFixed(RefObject b, RefObject scope, LayoutColumn col, + int value) { + checkArgument(scope.get().scopeType instanceof LayoutUDT); + if (scope.get().immutable) { + return Result.InsufficientPermissions; + } + + b.get().WriteInt32(scope.get().start + col.getOffset(), value); + b.get().SetBit(scope.get().start, col.getNullBit().clone()); + return Result.Success; + } + + //C# TO JAVA CONVERTER NOTE: Java does not support optional parameters. Overloaded method(s) are created above: + //ORIGINAL LINE: public override Result WriteSparse(ref RowBuffer b, ref RowCursor edit, int value, UpdateOptions + // options = UpdateOptions.Upsert) + @Override + public Result WriteSparse(RefObject b, RefObject edit, int value, + UpdateOptions options) { + Result result = LayoutType.PrepareSparseWrite(b, edit, this.getTypeArg().clone(), options); + if (result != Result.Success) { + return result; + } + + b.get().WriteSparseInt32(edit, value, options); + return Result.Success; + } + + @Override + public Result WriteSparse(RefObject b, RefObject edit, int value) { + return WriteSparse(b, edit, value, UpdateOptions.Upsert); + } +} \ No newline at end of file diff --git a/jre/src/main/java/com/azure/data/cosmos/serialization/hybridrow/layouts/LayoutInt64.java b/jre/src/main/java/com/azure/data/cosmos/serialization/hybridrow/layouts/LayoutInt64.java new file mode 100644 index 0000000..fffd7dc --- /dev/null +++ b/jre/src/main/java/com/azure/data/cosmos/serialization/hybridrow/layouts/LayoutInt64.java @@ -0,0 +1,88 @@ +//------------------------------------------------------------ +// Copyright (c) Microsoft Corporation. All rights reserved. +//------------------------------------------------------------ + +package com.azure.data.cosmos.serialization.hybridrow.layouts; + +import com.azure.data.cosmos.core.OutObject; +import com.azure.data.cosmos.core.RefObject; +import com.azure.data.cosmos.serialization.hybridrow.Result; +import com.azure.data.cosmos.serialization.hybridrow.RowBuffer; +import com.azure.data.cosmos.serialization.hybridrow.RowCursor; + +import static com.google.common.base.Preconditions.checkArgument; + +public final class LayoutInt64 extends LayoutType { + public LayoutInt64() { + super(com.azure.data.cosmos.serialization.hybridrow.layouts.LayoutCode.Int64, (Long.SIZE / Byte.SIZE)); + } + + @Override + public boolean getIsFixed() { + return true; + } + + @Override + public String getName() { + return "int64"; + } + + @Override + public Result ReadFixed(RefObject b, RefObject scope, LayoutColumn col, + OutObject value) { + checkArgument(scope.get().scopeType instanceof LayoutUDT); + if (!b.get().ReadBit(scope.get().start, col.getNullBit().clone())) { + value.set(0); + return Result.NotFound; + } + + value.set(b.get().ReadInt64(scope.get().start + col.getOffset())); + return Result.Success; + } + + @Override + public Result ReadSparse(RefObject b, RefObject edit, + OutObject value) { + Result result = LayoutType.PrepareSparseRead(b, edit, this.LayoutCode); + if (result != Result.Success) { + value.set(0); + return result; + } + + value.set(b.get().ReadSparseInt64(edit)); + return Result.Success; + } + + @Override + public Result WriteFixed(RefObject b, RefObject scope, LayoutColumn col, + long value) { + checkArgument(scope.get().scopeType instanceof LayoutUDT); + if (scope.get().immutable) { + return Result.InsufficientPermissions; + } + + b.get().WriteInt64(scope.get().start + col.getOffset(), value); + b.get().SetBit(scope.get().start, col.getNullBit().clone()); + return Result.Success; + } + + //C# TO JAVA CONVERTER NOTE: Java does not support optional parameters. Overloaded method(s) are created above: + //ORIGINAL LINE: public override Result WriteSparse(ref RowBuffer b, ref RowCursor edit, long value, + // UpdateOptions options = UpdateOptions.Upsert) + @Override + public Result WriteSparse(RefObject b, RefObject edit, long value, + UpdateOptions options) { + Result result = LayoutType.PrepareSparseWrite(b, edit, this.getTypeArg().clone(), options); + if (result != Result.Success) { + return result; + } + + b.get().WriteSparseInt64(edit, value, options); + return Result.Success; + } + + @Override + public Result WriteSparse(RefObject b, RefObject edit, long value) { + return WriteSparse(b, edit, value, UpdateOptions.Upsert); + } +} \ No newline at end of file diff --git a/jre/src/main/java/com/azure/data/cosmos/serialization/hybridrow/layouts/LayoutInt8.java b/jre/src/main/java/com/azure/data/cosmos/serialization/hybridrow/layouts/LayoutInt8.java new file mode 100644 index 0000000..d6102ea --- /dev/null +++ b/jre/src/main/java/com/azure/data/cosmos/serialization/hybridrow/layouts/LayoutInt8.java @@ -0,0 +1,88 @@ +//------------------------------------------------------------ +// Copyright (c) Microsoft Corporation. All rights reserved. +//------------------------------------------------------------ + +package com.azure.data.cosmos.serialization.hybridrow.layouts; + +import com.azure.data.cosmos.core.OutObject; +import com.azure.data.cosmos.core.RefObject; +import com.azure.data.cosmos.serialization.hybridrow.Result; +import com.azure.data.cosmos.serialization.hybridrow.RowBuffer; +import com.azure.data.cosmos.serialization.hybridrow.RowCursor; + +import static com.google.common.base.Preconditions.checkArgument; + +public final class LayoutInt8 extends LayoutType { + public LayoutInt8() { + super(com.azure.data.cosmos.serialization.hybridrow.layouts.LayoutCode.Int8, (Byte.SIZE / Byte.SIZE)); + } + + @Override + public boolean getIsFixed() { + return true; + } + + @Override + public String getName() { + return "int8"; + } + + @Override + public Result ReadFixed(RefObject b, RefObject scope, LayoutColumn col, + OutObject value) { + checkArgument(scope.get().scopeType instanceof LayoutUDT); + if (!b.get().ReadBit(scope.get().start, col.getNullBit().clone())) { + value.set(0); + return Result.NotFound; + } + + value.set(b.get().ReadInt8(scope.get().start + col.getOffset())); + return Result.Success; + } + + @Override + public Result ReadSparse(RefObject b, RefObject edit, + OutObject value) { + Result result = LayoutType.PrepareSparseRead(b, edit, this.LayoutCode); + if (result != Result.Success) { + value.set(0); + return result; + } + + value.set(b.get().ReadSparseInt8(edit)); + return Result.Success; + } + + @Override + public Result WriteFixed(RefObject b, RefObject scope, LayoutColumn col, + byte value) { + checkArgument(scope.get().scopeType instanceof LayoutUDT); + if (scope.get().immutable) { + return Result.InsufficientPermissions; + } + + b.get().WriteInt8(scope.get().start + col.getOffset(), value); + b.get().SetBit(scope.get().start, col.getNullBit().clone()); + return Result.Success; + } + + //C# TO JAVA CONVERTER NOTE: Java does not support optional parameters. Overloaded method(s) are created above: + //ORIGINAL LINE: public override Result WriteSparse(ref RowBuffer b, ref RowCursor edit, sbyte value, + // UpdateOptions options = UpdateOptions.Upsert) + @Override + public Result WriteSparse(RefObject b, RefObject edit, byte value, + UpdateOptions options) { + Result result = LayoutType.PrepareSparseWrite(b, edit, this.getTypeArg().clone(), options); + if (result != Result.Success) { + return result; + } + + b.get().WriteSparseInt8(edit, value, options); + return Result.Success; + } + + @Override + public Result WriteSparse(RefObject b, RefObject edit, byte value) { + return WriteSparse(b, edit, value, UpdateOptions.Upsert); + } +} \ No newline at end of file diff --git a/jre/src/main/java/com/azure/data/cosmos/serialization/hybridrow/layouts/LayoutMongoDbObjectId.java b/jre/src/main/java/com/azure/data/cosmos/serialization/hybridrow/layouts/LayoutMongoDbObjectId.java new file mode 100644 index 0000000..7e862f1 --- /dev/null +++ b/jre/src/main/java/com/azure/data/cosmos/serialization/hybridrow/layouts/LayoutMongoDbObjectId.java @@ -0,0 +1,90 @@ +//------------------------------------------------------------ +// Copyright (c) Microsoft Corporation. All rights reserved. +//------------------------------------------------------------ + +package com.azure.data.cosmos.serialization.hybridrow.layouts; + +import com.azure.data.cosmos.core.OutObject; +import com.azure.data.cosmos.core.RefObject; +import com.azure.data.cosmos.serialization.hybridrow.Result; +import com.azure.data.cosmos.serialization.hybridrow.RowBuffer; +import com.azure.data.cosmos.serialization.hybridrow.RowCursor; + +import static com.google.common.base.Preconditions.checkArgument; + +public final class LayoutMongoDbObjectId extends LayoutType { + public LayoutMongoDbObjectId() { + super(com.azure.data.cosmos.serialization.hybridrow.layouts.LayoutCode.MongoDbObjectId, azure.data.cosmos.serialization.hybridrow.MongoDbObjectId.Size); + } + + @Override + public boolean getIsFixed() { + return true; + } + + // ReSharper disable once StringLiteralTypo + @Override + public String getName() { + return "mongodbobjectid"; + } + + @Override + public Result ReadFixed(RefObject b, RefObject scope, LayoutColumn col, + OutObject value) { + checkArgument(scope.get().scopeType instanceof LayoutUDT); + if (!b.get().ReadBit(scope.get().start, col.getNullBit().clone())) { + value.set(null); + return Result.NotFound; + } + + value.set(b.get().ReadMongoDbObjectId(scope.get().start + col.getOffset()).clone()); + return Result.Success; + } + + @Override + public Result ReadSparse(RefObject b, RefObject edit, + OutObject value) { + Result result = LayoutType.PrepareSparseRead(b, edit, this.LayoutCode); + if (result != Result.Success) { + value.set(null); + return result; + } + + value.set(b.get().ReadSparseMongoDbObjectId(edit).clone()); + return Result.Success; + } + + @Override + public Result WriteFixed(RefObject b, RefObject scope, LayoutColumn col, + MongoDbObjectId value) { + checkArgument(scope.get().scopeType instanceof LayoutUDT); + if (scope.get().immutable) { + return Result.InsufficientPermissions; + } + + b.get().WriteMongoDbObjectId(scope.get().start + col.getOffset(), value.clone()); + b.get().SetBit(scope.get().start, col.getNullBit().clone()); + return Result.Success; + } + + //C# TO JAVA CONVERTER NOTE: Java does not support optional parameters. Overloaded method(s) are created above: + //ORIGINAL LINE: public override Result WriteSparse(ref RowBuffer b, ref RowCursor edit, MongoDbObjectId value, + // UpdateOptions options = UpdateOptions.Upsert) + @Override + public Result WriteSparse(RefObject b, RefObject edit, + MongoDbObjectId value, UpdateOptions options) { + Result result = LayoutType.PrepareSparseWrite(b, edit, this.getTypeArg().clone(), options); + if (result != Result.Success) { + return result; + } + + b.get().WriteSparseMongoDbObjectId(edit, value.clone(), options); + return Result.Success; + } + + @Override + public Result WriteSparse(RefObject b, RefObject edit, + MongoDbObjectId value) { + return WriteSparse(b, edit, value, UpdateOptions.Upsert); + } +} \ No newline at end of file diff --git a/jre/src/main/java/com/azure/data/cosmos/serialization/hybridrow/layouts/LayoutNull.java b/jre/src/main/java/com/azure/data/cosmos/serialization/hybridrow/layouts/LayoutNull.java new file mode 100644 index 0000000..adaefd6 --- /dev/null +++ b/jre/src/main/java/com/azure/data/cosmos/serialization/hybridrow/layouts/LayoutNull.java @@ -0,0 +1,92 @@ +//------------------------------------------------------------ +// Copyright (c) Microsoft Corporation. All rights reserved. +//------------------------------------------------------------ + +package com.azure.data.cosmos.serialization.hybridrow.layouts; + +import com.azure.data.cosmos.core.OutObject; +import com.azure.data.cosmos.core.RefObject; +import com.azure.data.cosmos.serialization.hybridrow.NullValue; +import com.azure.data.cosmos.serialization.hybridrow.Result; +import com.azure.data.cosmos.serialization.hybridrow.RowBuffer; +import com.azure.data.cosmos.serialization.hybridrow.RowCursor; + +import static com.google.common.base.Preconditions.checkArgument; + +public final class LayoutNull extends LayoutType { + public LayoutNull() { + super(com.azure.data.cosmos.serialization.hybridrow.layouts.LayoutCode.Null, 0); + } + + @Override + public boolean getIsFixed() { + return true; + } + + @Override + public boolean getIsNull() { + return true; + } + + @Override + public String getName() { + return "null"; + } + + @Override + public Result ReadFixed(RefObject b, RefObject scope, LayoutColumn col, + OutObject value) { + checkArgument(scope.get().scopeType instanceof LayoutUDT); + value.set(NullValue.Default); + if (!b.get().ReadBit(scope.get().start, col.getNullBit().clone())) { + return Result.NotFound; + } + + return Result.Success; + } + + @Override + public Result ReadSparse(RefObject b, RefObject edit, + OutObject value) { + Result result = PrepareSparseRead(b, edit, this.LayoutCode); + if (result != Result.Success) { + value.set(null); + return result; + } + + value.set(b.get().ReadSparseNull(edit).clone()); + return Result.Success; + } + + @Override + public Result WriteFixed(RefObject b, RefObject scope, LayoutColumn col, + NullValue value) { + checkArgument(scope.get().scopeType instanceof LayoutUDT); + if (scope.get().immutable) { + return Result.InsufficientPermissions; + } + + b.get().SetBit(scope.get().start, col.getNullBit().clone()); + return Result.Success; + } + + //C# TO JAVA CONVERTER NOTE: Java does not support optional parameters. Overloaded method(s) are created above: + //ORIGINAL LINE: public override Result WriteSparse(ref RowBuffer b, ref RowCursor edit, NullValue value, + // UpdateOptions options = UpdateOptions.Upsert) + @Override + public Result WriteSparse(RefObject b, RefObject edit, NullValue value, + UpdateOptions options) { + Result result = PrepareSparseWrite(b, edit, this.getTypeArg().clone(), options); + if (result != Result.Success) { + return result; + } + + b.get().WriteSparseNull(edit, value.clone(), options); + return Result.Success; + } + + @Override + public Result WriteSparse(RefObject b, RefObject edit, NullValue value) { + return WriteSparse(b, edit, value, UpdateOptions.Upsert); + } +} \ No newline at end of file diff --git a/jre/src/main/java/com/azure/data/cosmos/serialization/hybridrow/layouts/LayoutNullable.java b/jre/src/main/java/com/azure/data/cosmos/serialization/hybridrow/layouts/LayoutNullable.java new file mode 100644 index 0000000..a348457 --- /dev/null +++ b/jre/src/main/java/com/azure/data/cosmos/serialization/hybridrow/layouts/LayoutNullable.java @@ -0,0 +1,107 @@ +//------------------------------------------------------------ +// Copyright (c) Microsoft Corporation. All rights reserved. +//------------------------------------------------------------ + +package com.azure.data.cosmos.serialization.hybridrow.layouts; + +import com.azure.data.cosmos.core.OutObject; +import com.azure.data.cosmos.core.RefObject; +import com.azure.data.cosmos.serialization.hybridrow.Result; +import com.azure.data.cosmos.serialization.hybridrow.RowBuffer; +import com.azure.data.cosmos.serialization.hybridrow.RowCursor; + +import static com.google.common.base.Preconditions.checkArgument; +import static com.google.common.base.Preconditions.checkState; + +public final class LayoutNullable extends LayoutIndexedScope { + public LayoutNullable(boolean immutable) { + super(immutable ? com.azure.data.cosmos.serialization.hybridrow.layouts.LayoutCode.ImmutableNullableScope : + com.azure.data.cosmos.serialization.hybridrow.layouts.LayoutCode.NullableScope, immutable, true, true, false, true); + } + + @Override + public String getName() { + return this.Immutable ? "im_nullable" : "nullable"; + } + + @Override + public int CountTypeArgument(TypeArgumentList value) { + checkState(value.getCount() == 1); + return (com.azure.data.cosmos.serialization.hybridrow.layouts.LayoutCode.SIZE / Byte.SIZE) + value.get(0).getType().CountTypeArgument(value.get(0).getTypeArgs().clone()); + } + + @Override + public boolean HasImplicitTypeCode(RefObject edit) { + checkState(edit.get().index >= 0); + checkState(edit.get().scopeTypeArgs.getCount() == 1); + checkState(edit.get().index == 1); + return !LayoutCodeTraits.AlwaysRequiresTypeCode(edit.get().scopeTypeArgs.get(0).getType().LayoutCode); + } + + public static Result HasValue(RefObject b, RefObject scope) { + checkArgument(scope.get().scopeType instanceof LayoutNullable); + checkState(scope.get().index == 1 || scope.get().index == 2, "Nullable scopes always point at the value"); + checkState(scope.get().scopeTypeArgs.getCount() == 1); + boolean hasValue = b.get().ReadInt8(scope.get().start) != 0; + return hasValue ? Result.Success : Result.NotFound; + } + + @Override + public TypeArgumentList ReadTypeArgumentList(RefObject row, int offset, + OutObject lenInBytes) { + return new TypeArgumentList(new TypeArgument[] { LayoutType.ReadTypeArgument(row, offset, lenInBytes) }); + } + + @Override + public void SetImplicitTypeCode(RefObject edit) { + checkState(edit.get().index == 1); + edit.get().cellType = edit.get().scopeTypeArgs.get(0).getType(); + edit.get().cellTypeArgs = edit.get().scopeTypeArgs.get(0).getTypeArgs().clone(); + } + + public Result WriteScope(RefObject b, RefObject edit, + TypeArgumentList typeArgs, boolean hasValue, OutObject value) { + return WriteScope(b, edit, typeArgs, hasValue, value, UpdateOptions.Upsert); + } + + //C# TO JAVA CONVERTER NOTE: Java does not support optional parameters. Overloaded method(s) are created above: + //ORIGINAL LINE: public Result WriteScope(ref RowBuffer b, ref RowCursor edit, TypeArgumentList typeArgs, bool + // hasValue, out RowCursor value, UpdateOptions options = UpdateOptions.Upsert) + public Result WriteScope(RefObject b, RefObject edit, + TypeArgumentList typeArgs, boolean hasValue, OutObject value, + UpdateOptions options) { + Result result = LayoutType.PrepareSparseWrite(b, edit, new TypeArgument(this, typeArgs.clone()), options); + if (result != Result.Success) { + value.set(null); + return result; + } + + b.get().WriteNullable(edit, this, typeArgs.clone(), options, hasValue, value.clone()); + return Result.Success; + } + + @Override + public Result WriteScope(RefObject b, RefObject edit, + TypeArgumentList typeArgs, OutObject value) { + return WriteScope(b, edit, typeArgs, value, UpdateOptions.Upsert); + } + + //C# TO JAVA CONVERTER NOTE: Java does not support optional parameters. Overloaded method(s) are created above: + //ORIGINAL LINE: public override Result WriteScope(ref RowBuffer b, ref RowCursor edit, TypeArgumentList + // typeArgs, out RowCursor value, UpdateOptions options = UpdateOptions.Upsert) + @Override + public Result WriteScope(RefObject b, RefObject edit, + TypeArgumentList typeArgs, OutObject value, UpdateOptions options) { + return this.WriteScope(b, edit, typeArgs.clone(), true, value, options); + } + + @Override + public int WriteTypeArgument(RefObject row, int offset, TypeArgumentList value) { + checkState(value.getCount() == 1); + row.get().WriteSparseTypeCode(offset, this.LayoutCode); + int lenInBytes = (com.azure.data.cosmos.serialization.hybridrow.layouts.LayoutCode.SIZE / Byte.SIZE); + lenInBytes += value.get(0).getType().WriteTypeArgument(row, offset + lenInBytes, + value.get(0).getTypeArgs().clone()); + return lenInBytes; + } +} \ No newline at end of file diff --git a/jre/src/main/java/azure/data/cosmos/serialization/hybridrow/layouts/LayoutObject.java b/jre/src/main/java/com/azure/data/cosmos/serialization/hybridrow/layouts/LayoutObject.java similarity index 53% rename from jre/src/main/java/azure/data/cosmos/serialization/hybridrow/layouts/LayoutObject.java rename to jre/src/main/java/com/azure/data/cosmos/serialization/hybridrow/layouts/LayoutObject.java index 1368270..0ab2362 100644 --- a/jre/src/main/java/azure/data/cosmos/serialization/hybridrow/layouts/LayoutObject.java +++ b/jre/src/main/java/com/azure/data/cosmos/serialization/hybridrow/layouts/LayoutObject.java @@ -2,17 +2,20 @@ // Copyright (c) Microsoft Corporation. All rights reserved. //------------------------------------------------------------ -package azure.data.cosmos.serialization.hybridrow.layouts; +package com.azure.data.cosmos.serialization.hybridrow.layouts; -import azure.data.cosmos.serialization.hybridrow.Result; -import azure.data.cosmos.serialization.hybridrow.RowBuffer; -import azure.data.cosmos.serialization.hybridrow.RowCursor; +import com.azure.data.cosmos.core.OutObject; +import com.azure.data.cosmos.core.RefObject; +import com.azure.data.cosmos.serialization.hybridrow.Result; +import com.azure.data.cosmos.serialization.hybridrow.RowBuffer; +import com.azure.data.cosmos.serialization.hybridrow.RowCursor; public final class LayoutObject extends LayoutPropertyScope { private TypeArgument TypeArg = new TypeArgument(); public LayoutObject(boolean immutable) { - super(immutable ? azure.data.cosmos.serialization.hybridrow.layouts.LayoutCode.ImmutableObjectScope : azure.data.cosmos.serialization.hybridrow.layouts.LayoutCode.ObjectScope, immutable); + super(immutable ? com.azure.data.cosmos.serialization.hybridrow.layouts.LayoutCode.ImmutableObjectScope : + com.azure.data.cosmos.serialization.hybridrow.layouts.LayoutCode.ObjectScope, immutable); this.TypeArg = new TypeArgument(this); } @@ -27,8 +30,8 @@ public final class LayoutObject extends LayoutPropertyScope { @Override - public Result WriteScope(tangible.RefObject b, tangible.RefObject edit, - TypeArgumentList typeArgs, tangible.OutObject value) { + public Result WriteScope(RefObject b, RefObject edit, + TypeArgumentList typeArgs, OutObject value) { return WriteScope(b, edit, typeArgs, value, UpdateOptions.Upsert); } @@ -36,15 +39,15 @@ public final class LayoutObject extends LayoutPropertyScope { //ORIGINAL LINE: public override Result WriteScope(ref RowBuffer b, ref RowCursor edit, TypeArgumentList // typeArgs, out RowCursor value, UpdateOptions options = UpdateOptions.Upsert) @Override - public Result WriteScope(tangible.RefObject b, tangible.RefObject edit, - TypeArgumentList typeArgs, tangible.OutObject value, UpdateOptions options) { + public Result WriteScope(RefObject b, RefObject edit, + TypeArgumentList typeArgs, OutObject value, UpdateOptions options) { Result result = LayoutType.PrepareSparseWrite(b, edit, this.getTypeArg().clone(), options); if (result != Result.Success) { - value.argValue = null; + value.set(null); return result; } - b.argValue.WriteSparseObject(edit, this, options, value.clone()); + b.get().WriteSparseObject(edit, this, options, value.clone()); return Result.Success; } } \ No newline at end of file diff --git a/jre/src/main/java/azure/data/cosmos/serialization/hybridrow/layouts/LayoutPropertyScope.java b/jre/src/main/java/com/azure/data/cosmos/serialization/hybridrow/layouts/LayoutPropertyScope.java similarity index 89% rename from jre/src/main/java/azure/data/cosmos/serialization/hybridrow/layouts/LayoutPropertyScope.java rename to jre/src/main/java/com/azure/data/cosmos/serialization/hybridrow/layouts/LayoutPropertyScope.java index 6257af3..8067570 100644 --- a/jre/src/main/java/azure/data/cosmos/serialization/hybridrow/layouts/LayoutPropertyScope.java +++ b/jre/src/main/java/com/azure/data/cosmos/serialization/hybridrow/layouts/LayoutPropertyScope.java @@ -2,7 +2,7 @@ // Copyright (c) Microsoft Corporation. All rights reserved. //------------------------------------------------------------ -package azure.data.cosmos.serialization.hybridrow.layouts; +package com.azure.data.cosmos.serialization.hybridrow.layouts; public abstract class LayoutPropertyScope extends LayoutScope { protected LayoutPropertyScope(LayoutCode code, boolean immutable) { diff --git a/jre/src/main/java/azure/data/cosmos/serialization/hybridrow/layouts/LayoutResolver.java b/jre/src/main/java/com/azure/data/cosmos/serialization/hybridrow/layouts/LayoutResolver.java similarity index 67% rename from jre/src/main/java/azure/data/cosmos/serialization/hybridrow/layouts/LayoutResolver.java rename to jre/src/main/java/com/azure/data/cosmos/serialization/hybridrow/layouts/LayoutResolver.java index c172b0f..8dd969f 100644 --- a/jre/src/main/java/azure/data/cosmos/serialization/hybridrow/layouts/LayoutResolver.java +++ b/jre/src/main/java/com/azure/data/cosmos/serialization/hybridrow/layouts/LayoutResolver.java @@ -2,9 +2,9 @@ // Copyright (c) Microsoft Corporation. All rights reserved. //------------------------------------------------------------ -package azure.data.cosmos.serialization.hybridrow.layouts; +package com.azure.data.cosmos.serialization.hybridrow.layouts; -import azure.data.cosmos.serialization.hybridrow.SchemaId; +import com.azure.data.cosmos.serialization.hybridrow.SchemaId; public abstract class LayoutResolver { public abstract Layout Resolve(SchemaId schemaId); diff --git a/jre/src/main/java/azure/data/cosmos/serialization/hybridrow/layouts/LayoutResolverNamespace.java b/jre/src/main/java/com/azure/data/cosmos/serialization/hybridrow/layouts/LayoutResolverNamespace.java similarity index 81% rename from jre/src/main/java/azure/data/cosmos/serialization/hybridrow/layouts/LayoutResolverNamespace.java rename to jre/src/main/java/com/azure/data/cosmos/serialization/hybridrow/layouts/LayoutResolverNamespace.java index f95fb39..2247dac 100644 --- a/jre/src/main/java/azure/data/cosmos/serialization/hybridrow/layouts/LayoutResolverNamespace.java +++ b/jre/src/main/java/com/azure/data/cosmos/serialization/hybridrow/layouts/LayoutResolverNamespace.java @@ -2,11 +2,14 @@ // Copyright (c) Microsoft Corporation. All rights reserved. //------------------------------------------------------------ -package azure.data.cosmos.serialization.hybridrow.layouts; +package com.azure.data.cosmos.serialization.hybridrow.layouts; -import azure.data.cosmos.serialization.hybridrow.SchemaId; -import azure.data.cosmos.serialization.hybridrow.schemas.Namespace; -import azure.data.cosmos.serialization.hybridrow.schemas.Schema; +import com.azure.data.cosmos.serialization.hybridrow.SchemaId; +import com.azure.data.cosmos.serialization.hybridrow.schemas.Namespace; +import com.azure.data.cosmos.serialization.hybridrow.schemas.Schema; + +import static com.google.common.base.Preconditions.checkState; +import static com.google.common.base.Strings.lenientFormat; /** * An implementation of which dynamically compiles schema from @@ -52,7 +55,7 @@ public final class LayoutResolverNamespace extends LayoutResolver { } for (Schema s : this.schemaNamespace.getSchemas()) { - if (azure.data.cosmos.serialization.hybridrow.SchemaId.opEquals(s.getSchemaId().clone(), + if (SchemaId.opEquals(s.getSchemaId().clone(), schemaId.clone())) { layout = s.Compile(this.schemaNamespace); layout = this.layoutCache.putIfAbsent(schemaId.getId(), layout); @@ -69,7 +72,7 @@ public final class LayoutResolverNamespace extends LayoutResolver { return layout; } - Contract.Fail(String.format("Failed to resolve schema %1$s", schemaId.clone())); + throw new IllegalStateException(lenientFormat("Failed to resolve schema %s", schemaId.clone())); return null; } } \ No newline at end of file diff --git a/jre/src/main/java/azure/data/cosmos/serialization/hybridrow/layouts/LayoutResolverSimple.java b/jre/src/main/java/com/azure/data/cosmos/serialization/hybridrow/layouts/LayoutResolverSimple.java similarity index 80% rename from jre/src/main/java/azure/data/cosmos/serialization/hybridrow/layouts/LayoutResolverSimple.java rename to jre/src/main/java/com/azure/data/cosmos/serialization/hybridrow/layouts/LayoutResolverSimple.java index 4b9384b..e606109 100644 --- a/jre/src/main/java/azure/data/cosmos/serialization/hybridrow/layouts/LayoutResolverSimple.java +++ b/jre/src/main/java/com/azure/data/cosmos/serialization/hybridrow/layouts/LayoutResolverSimple.java @@ -2,9 +2,9 @@ // Copyright (c) Microsoft Corporation. All rights reserved. //------------------------------------------------------------ -package azure.data.cosmos.serialization.hybridrow.layouts; +package com.azure.data.cosmos.serialization.hybridrow.layouts; -import azure.data.cosmos.serialization.hybridrow.SchemaId; +import com.azure.data.cosmos.serialization.hybridrow.SchemaId; public final class LayoutResolverSimple extends LayoutResolver { private tangible.Func1Param resolver; diff --git a/jre/src/main/java/azure/data/cosmos/serialization/hybridrow/layouts/LayoutScope.java b/jre/src/main/java/com/azure/data/cosmos/serialization/hybridrow/layouts/LayoutScope.java similarity index 56% rename from jre/src/main/java/azure/data/cosmos/serialization/hybridrow/layouts/LayoutScope.java rename to jre/src/main/java/com/azure/data/cosmos/serialization/hybridrow/layouts/LayoutScope.java index 95f24bd..690f329 100644 --- a/jre/src/main/java/azure/data/cosmos/serialization/hybridrow/layouts/LayoutScope.java +++ b/jre/src/main/java/com/azure/data/cosmos/serialization/hybridrow/layouts/LayoutScope.java @@ -2,11 +2,15 @@ // Copyright (c) Microsoft Corporation. All rights reserved. //------------------------------------------------------------ -package azure.data.cosmos.serialization.hybridrow.layouts; +package com.azure.data.cosmos.serialization.hybridrow.layouts; -import azure.data.cosmos.serialization.hybridrow.Result; -import azure.data.cosmos.serialization.hybridrow.RowBuffer; -import azure.data.cosmos.serialization.hybridrow.RowCursor; +import com.azure.data.cosmos.core.OutObject; +import com.azure.data.cosmos.core.RefObject; +import com.azure.data.cosmos.serialization.hybridrow.Result; +import com.azure.data.cosmos.serialization.hybridrow.RowBuffer; +import com.azure.data.cosmos.serialization.hybridrow.RowCursor; +import com.azure.data.cosmos.serialization.hybridrow.RowCursorExtensions; +import sun.reflect.generics.reflectiveObjects.NotImplementedException; public abstract class LayoutScope extends LayoutType { /** @@ -30,8 +34,10 @@ public abstract class LayoutScope extends LayoutType { */ public boolean IsUniqueScope; - protected LayoutScope(LayoutCode code, boolean immutable, boolean isSizedScope, boolean isIndexedScope, - boolean isFixedArity, boolean isUniqueScope, boolean isTypedScope) { + protected LayoutScope( + LayoutCode code, boolean immutable, boolean isSizedScope, boolean isIndexedScope, boolean isFixedArity, + boolean isUniqueScope, boolean isTypedScope + ) { super(code, immutable, 0); this.IsSizedScope = isSizedScope; this.IsIndexedScope = isIndexedScope; @@ -45,13 +51,13 @@ public abstract class LayoutScope extends LayoutType { return false; } - public final Result DeleteScope(tangible.RefObject b, tangible.RefObject edit) { + public final Result DeleteScope(RefObject b, RefObject edit) { Result result = LayoutType.PrepareSparseDelete(b, edit, this.LayoutCode); if (result != Result.Success) { return result; } - b.argValue.DeleteSparse(edit); + b.get().DeleteSparse(edit); return Result.Success; } @@ -62,48 +68,49 @@ public abstract class LayoutScope extends LayoutType { * @param edit * @return True if the type code is implied (not written), false otherwise. */ - public boolean HasImplicitTypeCode(tangible.RefObject edit) { + public boolean HasImplicitTypeCode(RefObject edit) { return false; } - public final Result ReadScope(tangible.RefObject b, tangible.RefObject edit, - tangible.OutObject value) { + public final Result ReadScope(RefObject b, RefObject edit, + OutObject value) { Result result = LayoutType.PrepareSparseRead(b, edit, this.LayoutCode); if (result != Result.Success) { - value.argValue = null; + value.set(null); return result; } - value.argValue = b.argValue.SparseIteratorReadScope(edit, - this.Immutable || edit.argValue.immutable || edit.argValue.scopeType.IsUniqueScope).clone(); + value.set(b.get().SparseIteratorReadScope(edit, + this.Immutable || edit.get().immutable || edit.get().scopeType.IsUniqueScope).clone()); return Result.Success; } - public void ReadSparsePath(tangible.RefObject row, tangible.RefObject edit) { + public void ReadSparsePath(RefObject row, RefObject edit) { int pathLenInBytes; - tangible.OutObject tempOut_pathLenInBytes = new tangible.OutObject(); - tangible.OutObject tempOut_pathOffset = new tangible.OutObject(); - edit.argValue.pathToken = row.argValue.ReadSparsePathLen(edit.argValue.layout, edit.argValue.valueOffset, tempOut_pathLenInBytes, tempOut_pathOffset); - edit.argValue.argValue.pathOffset = tempOut_pathOffset.argValue; - pathLenInBytes = tempOut_pathLenInBytes.argValue; - edit.argValue.valueOffset += pathLenInBytes; + OutObject tempOut_pathLenInBytes = new OutObject(); + OutObject tempOut_pathOffset = new OutObject(); + edit.get().pathToken = row.get().ReadSparsePathLen(edit.get().layout, edit.get().valueOffset, tempOut_pathLenInBytes, tempOut_pathOffset); + edit.get().argValue.pathOffset = tempOut_pathOffset.get(); + pathLenInBytes = tempOut_pathLenInBytes.get(); + edit.get().valueOffset += pathLenInBytes; } - public void SetImplicitTypeCode(tangible.RefObject edit) { - Contract.Fail("No implicit type codes."); + public void SetImplicitTypeCode(RefObject edit) { + throw new NotImplementedException(); } - public final abstract Result WriteScope(tangible.RefObject b, tangible.RefObject scope, - TypeArgumentList typeArgs, tangible.OutObject value); + public abstract Result WriteScope( + RefObject b, RefObject scope, TypeArgumentList typeArgs, + OutObject value); //C# TO JAVA CONVERTER NOTE: Java does not support optional parameters. Overloaded method(s) are created above: //ORIGINAL LINE: public abstract Result WriteScope(ref RowBuffer b, ref RowCursor scope, TypeArgumentList // typeArgs, out RowCursor value, UpdateOptions options = UpdateOptions.Upsert); - public abstract Result WriteScope(tangible.RefObject b, tangible.RefObject scope, - TypeArgumentList typeArgs, tangible.OutObject value, + public abstract Result WriteScope(RefObject b, RefObject scope, + TypeArgumentList typeArgs, OutObject value, UpdateOptions options); - public Result WriteScope(tangible.RefObject b, tangible.RefObject scope, + public Result WriteScope(RefObject b, RefObject scope, TypeArgumentList typeArgs, TContext context, WriterFunc func) { return WriteScope(b, scope, typeArgs, context, func, UpdateOptions.Upsert); } @@ -112,7 +119,7 @@ public abstract class LayoutScope extends LayoutType { //ORIGINAL LINE: public virtual Result WriteScope(ref RowBuffer b, ref RowCursor scope, // TypeArgumentList typeArgs, TContext context, WriterFunc func, UpdateOptions options = UpdateOptions // .Upsert) - public Result WriteScope(tangible.RefObject b, tangible.RefObject scope, + public Result WriteScope(RefObject b, RefObject scope, TypeArgumentList typeArgs, TContext context, WriterFunc func, UpdateOptions options) { RowCursor childScope; @@ -123,21 +130,21 @@ public abstract class LayoutScope extends LayoutType { return r; } - tangible.RefObject tempRef_childScope = - new tangible.RefObject(childScope); + RefObject tempRef_childScope = + new RefObject(childScope); // TODO: C# TO JAVA CONVERTER: The following line could not be converted: r = func == null ? null : func.Invoke(ref b, ref childScope, context) ??Result.Success; - childScope = tempRef_childScope.argValue; + childScope = tempRef_childScope.get(); if (r != Result.Success) { this.DeleteScope(b, scope); return r; } - tangible.RefObject tempRef_childScope2 = - new tangible.RefObject(childScope); - Microsoft.Azure.Cosmos.Serialization.HybridRow.RowCursorExtensions.Skip(scope.argValue.clone(), b, + RefObject tempRef_childScope2 = + new RefObject(childScope); + RowCursorExtensions.Skip(scope.get().clone(), b, tempRef_childScope2); - childScope = tempRef_childScope2.argValue; + childScope = tempRef_childScope2.get(); return Result.Success; } @@ -152,6 +159,6 @@ public abstract class LayoutScope extends LayoutType { */ @FunctionalInterface public interface WriterFunc { - Result invoke(tangible.RefObject b, tangible.RefObject scope, TContext context); + Result invoke(RefObject b, RefObject scope, TContext context); } } \ No newline at end of file diff --git a/jre/src/main/java/com/azure/data/cosmos/serialization/hybridrow/layouts/LayoutTagged.java b/jre/src/main/java/com/azure/data/cosmos/serialization/hybridrow/layouts/LayoutTagged.java new file mode 100644 index 0000000..bd83053 --- /dev/null +++ b/jre/src/main/java/com/azure/data/cosmos/serialization/hybridrow/layouts/LayoutTagged.java @@ -0,0 +1,85 @@ +//------------------------------------------------------------ +// Copyright (c) Microsoft Corporation. All rights reserved. +//------------------------------------------------------------ + +package com.azure.data.cosmos.serialization.hybridrow.layouts; + +import com.azure.data.cosmos.core.OutObject; +import com.azure.data.cosmos.core.RefObject; +import com.azure.data.cosmos.serialization.hybridrow.Result; +import com.azure.data.cosmos.serialization.hybridrow.RowBuffer; +import com.azure.data.cosmos.serialization.hybridrow.RowCursor; + +import static com.azure.data.cosmos.serialization.hybridrow.layouts.LayoutCode.ImmutableTaggedScope; +import static com.azure.data.cosmos.serialization.hybridrow.layouts.LayoutCode.TaggedScope; + +public final class LayoutTagged extends LayoutIndexedScope { + public LayoutTagged(boolean immutable) { + super(immutable ? ImmutableTaggedScope : TaggedScope, immutable, true, true, false, true); + } + + @Override + public String getName() { + return this.Immutable ? "im_tagged_t" : "tagged_t"; + } + + @Override + public int CountTypeArgument(TypeArgumentList value) { + checkState(value.getCount() == 2); + return (com.azure.data.cosmos.serialization.hybridrow.layouts.LayoutCode.SIZE / Byte.SIZE) + value.get(1).getType().CountTypeArgument(value.get(1).getTypeArgs().clone()); + } + + @Override + public boolean HasImplicitTypeCode(RefObject edit) { + checkArgument(edit.get().index >= 0); + checkArgument(edit.get().scopeTypeArgs.getCount() > edit.get().index); + return !LayoutCodeTraits.AlwaysRequiresTypeCode(edit.get().scopeTypeArgs.get(edit.get().index).getType().LayoutCode); + } + + @Override + public TypeArgumentList ReadTypeArgumentList(RefObject row, int offset, + OutObject lenInBytes) { + TypeArgument[] retval = new TypeArgument[2]; + retval[0] = new TypeArgument(UInt8, TypeArgumentList.Empty); + retval[1] = ReadTypeArgument(row, offset, lenInBytes); + return new TypeArgumentList(retval); + } + + @Override + public void SetImplicitTypeCode(RefObject edit) { + edit.get().cellType = edit.get().scopeTypeArgs.get(edit.get().index).getType(); + edit.get().cellTypeArgs = edit.get().scopeTypeArgs.get(edit.get().index).getTypeArgs().clone(); + } + + @Override + public Result WriteScope(RefObject b, RefObject edit, + TypeArgumentList typeArgs, OutObject value) { + return WriteScope(b, edit, typeArgs, value, UpdateOptions.Upsert); + } + + //C# TO JAVA CONVERTER NOTE: Java does not support optional parameters. Overloaded method(s) are created above: + //ORIGINAL LINE: public override Result WriteScope(ref RowBuffer b, ref RowCursor edit, TypeArgumentList + // typeArgs, out RowCursor value, UpdateOptions options = UpdateOptions.Upsert) + @Override + public Result WriteScope(RefObject b, RefObject edit, + TypeArgumentList typeArgs, OutObject value, UpdateOptions options) { + Result result = PrepareSparseWrite(b, edit, new TypeArgument(this, typeArgs.clone()), options); + if (result != Result.Success) { + value.set(null); + return result; + } + + b.get().WriteTypedTuple(edit, this, typeArgs.clone(), options, value.clone()); + return Result.Success; + } + + @Override + public int WriteTypeArgument(RefObject row, int offset, TypeArgumentList value) { + checkArgument(value.getCount() == 2); + row.get().WriteSparseTypeCode(offset, this.LayoutCode); + int lenInBytes = (com.azure.data.cosmos.serialization.hybridrow.layouts.LayoutCode.SIZE / Byte.SIZE); + lenInBytes += value.get(1).getType().WriteTypeArgument(row, offset + lenInBytes, + value.get(1).getTypeArgs().clone()); + return lenInBytes; + } +} \ No newline at end of file diff --git a/jre/src/main/java/com/azure/data/cosmos/serialization/hybridrow/layouts/LayoutTagged2.java b/jre/src/main/java/com/azure/data/cosmos/serialization/hybridrow/layouts/LayoutTagged2.java new file mode 100644 index 0000000..2422be3 --- /dev/null +++ b/jre/src/main/java/com/azure/data/cosmos/serialization/hybridrow/layouts/LayoutTagged2.java @@ -0,0 +1,101 @@ +//------------------------------------------------------------ +// Copyright (c) Microsoft Corporation. All rights reserved. +//------------------------------------------------------------ + +package com.azure.data.cosmos.serialization.hybridrow.layouts; + +import com.azure.data.cosmos.core.OutObject; +import com.azure.data.cosmos.core.RefObject; +import com.azure.data.cosmos.serialization.hybridrow.Result; +import com.azure.data.cosmos.serialization.hybridrow.RowBuffer; +import com.azure.data.cosmos.serialization.hybridrow.RowCursor; + +public final class LayoutTagged2 extends LayoutIndexedScope { + public LayoutTagged2(boolean immutable) { + super(immutable ? com.azure.data.cosmos.serialization.hybridrow.layouts.LayoutCode.ImmutableTagged2Scope : + com.azure.data.cosmos.serialization.hybridrow.layouts.LayoutCode.Tagged2Scope, immutable, isSizedScope: + true, isFixedArity:true, isUniqueScope:false, isTypedScope:true) + } + + @Override + public String getName() { + return this.Immutable ? "im_tagged2_t" : "tagged2_t"; + } + + @Override + public int CountTypeArgument(TypeArgumentList value) { + checkState(value.getCount() == 3); + int lenInBytes = (com.azure.data.cosmos.serialization.hybridrow.layouts.LayoutCode.SIZE / Byte.SIZE); + for (int i = 1; i < value.getCount(); i++) { + TypeArgument arg = value.get(i).clone(); + lenInBytes += arg.getType().CountTypeArgument(arg.getTypeArgs().clone()); + } + + return lenInBytes; + } + + @Override + public boolean HasImplicitTypeCode(RefObject edit) { + checkState(edit.get().index >= 0); + checkState(edit.get().scopeTypeArgs.getCount() > edit.get().index); + return !LayoutCodeTraits.AlwaysRequiresTypeCode(edit.get().scopeTypeArgs.get(edit.get().index).getType().LayoutCode); + } + + @Override + public TypeArgumentList ReadTypeArgumentList(RefObject row, int offset, + OutObject lenInBytes) { + lenInBytes.set(0); + TypeArgument[] retval = new TypeArgument[3]; + retval[0] = new TypeArgument(UInt8, TypeArgumentList.Empty); + for (int i = 1; i < 3; i++) { + int itemLenInBytes; + OutObject tempOut_itemLenInBytes = new OutObject(); + retval[i] = ReadTypeArgument(row, offset + lenInBytes.get(), tempOut_itemLenInBytes); + itemLenInBytes = tempOut_itemLenInBytes.get(); + lenInBytes.set(lenInBytes.get() + itemLenInBytes); + } + + return new TypeArgumentList(retval); + } + + @Override + public void SetImplicitTypeCode(RefObject edit) { + edit.get().cellType = edit.get().scopeTypeArgs.get(edit.get().index).getType(); + edit.get().cellTypeArgs = edit.get().scopeTypeArgs.get(edit.get().index).getTypeArgs().clone(); + } + + @Override + public Result WriteScope(RefObject b, RefObject edit, + TypeArgumentList typeArgs, OutObject value) { + return WriteScope(b, edit, typeArgs, value, UpdateOptions.Upsert); + } + + //C# TO JAVA CONVERTER NOTE: Java does not support optional parameters. Overloaded method(s) are created above: + //ORIGINAL LINE: public override Result WriteScope(ref RowBuffer b, ref RowCursor edit, TypeArgumentList + // typeArgs, out RowCursor value, UpdateOptions options = UpdateOptions.Upsert) + @Override + public Result WriteScope(RefObject b, RefObject edit, + TypeArgumentList typeArgs, OutObject value, UpdateOptions options) { + Result result = PrepareSparseWrite(b, edit, new TypeArgument(this, typeArgs.clone()), options); + if (result != Result.Success) { + value.set(null); + return result; + } + + b.get().WriteTypedTuple(edit, this, typeArgs.clone(), options, value.clone()); + return Result.Success; + } + + @Override + public int WriteTypeArgument(RefObject row, int offset, TypeArgumentList value) { + checkState(value.getCount() == 3); + row.get().WriteSparseTypeCode(offset, this.LayoutCode); + int lenInBytes = (com.azure.data.cosmos.serialization.hybridrow.layouts.LayoutCode.SIZE / Byte.SIZE); + for (int i = 1; i < value.getCount(); i++) { + TypeArgument arg = value.get(i).clone(); + lenInBytes += arg.getType().WriteTypeArgument(row, offset + lenInBytes, arg.getTypeArgs().clone()); + } + + return lenInBytes; + } +} \ No newline at end of file diff --git a/jre/src/main/java/com/azure/data/cosmos/serialization/hybridrow/layouts/LayoutTuple.java b/jre/src/main/java/com/azure/data/cosmos/serialization/hybridrow/layouts/LayoutTuple.java new file mode 100644 index 0000000..0b96666 --- /dev/null +++ b/jre/src/main/java/com/azure/data/cosmos/serialization/hybridrow/layouts/LayoutTuple.java @@ -0,0 +1,90 @@ +//------------------------------------------------------------ +// Copyright (c) Microsoft Corporation. All rights reserved. +//------------------------------------------------------------ + +package com.azure.data.cosmos.serialization.hybridrow.layouts; + +import com.azure.data.cosmos.core.OutObject; +import com.azure.data.cosmos.core.RefObject; +import com.azure.data.cosmos.serialization.hybridrow.Result; +import com.azure.data.cosmos.serialization.hybridrow.RowBuffer; +import com.azure.data.cosmos.serialization.hybridrow.RowCursor; + +import static com.azure.data.cosmos.serialization.hybridrow.layouts.LayoutCode.ImmutableTupleScope; +import static com.azure.data.cosmos.serialization.hybridrow.layouts.LayoutCode.TupleScope; + +public final class LayoutTuple extends LayoutIndexedScope { + public LayoutTuple(boolean immutable) { + super(immutable ? ImmutableTupleScope : TupleScope, immutable, false, true, false, false); + } + + @Override + public String getName() { + return this.Immutable ? "im_tuple" : "tuple"; + } + + @Override + public int CountTypeArgument(TypeArgumentList value) { + int lenInBytes = (com.azure.data.cosmos.serialization.hybridrow.layouts.LayoutCode.SIZE / Byte.SIZE); + //C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java: + //ORIGINAL LINE: lenInBytes += RowBuffer.Count7BitEncodedUInt((ulong)value.Count); + lenInBytes += RowBuffer.Count7BitEncodedUInt(value.getCount()); + for (TypeArgument arg : value) { + lenInBytes += arg.getType().CountTypeArgument(arg.getTypeArgs().clone()); + } + + return lenInBytes; + } + + @Override + public TypeArgumentList ReadTypeArgumentList(RefObject row, int offset, + OutObject lenInBytes) { + int numTypeArgs = row.get().intValue().Read7BitEncodedUInt(offset, lenInBytes); + TypeArgument[] retval = new TypeArgument[numTypeArgs]; + for (int i = 0; i < numTypeArgs; i++) { + int itemLenInBytes; + OutObject tempOut_itemLenInBytes = new OutObject(); + retval[i] = ReadTypeArgument(row, offset + lenInBytes.get(), tempOut_itemLenInBytes); + itemLenInBytes = tempOut_itemLenInBytes.get(); + lenInBytes.set(lenInBytes.get() + itemLenInBytes); + } + + return new TypeArgumentList(retval); + } + + @Override + public Result WriteScope(RefObject b, RefObject edit, + TypeArgumentList typeArgs, OutObject value) { + return WriteScope(b, edit, typeArgs, value, UpdateOptions.Upsert); + } + + //C# TO JAVA CONVERTER NOTE: Java does not support optional parameters. Overloaded method(s) are created above: + //ORIGINAL LINE: public override Result WriteScope(ref RowBuffer b, ref RowCursor edit, TypeArgumentList + // typeArgs, out RowCursor value, UpdateOptions options = UpdateOptions.Upsert) + @Override + public Result WriteScope(RefObject b, RefObject edit, + TypeArgumentList typeArgs, OutObject value, UpdateOptions options) { + Result result = PrepareSparseWrite(b, edit, new TypeArgument(this, typeArgs.clone()), options); + if (result != Result.Success) { + value.set(null); + return result; + } + + b.get().WriteSparseTuple(edit, this, typeArgs.clone(), options, value.clone()); + return Result.Success; + } + + @Override + public int WriteTypeArgument(RefObject row, int offset, TypeArgumentList value) { + row.get().WriteSparseTypeCode(offset, this.LayoutCode); + int lenInBytes = (com.azure.data.cosmos.serialization.hybridrow.layouts.LayoutCode.SIZE / Byte.SIZE); + //C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java: + //ORIGINAL LINE: lenInBytes += row.Write7BitEncodedUInt(offset + lenInBytes, (ulong)value.Count); + lenInBytes += row.get().Write7BitEncodedUInt(offset + lenInBytes, value.getCount()); + for (TypeArgument arg : value) { + lenInBytes += arg.getType().WriteTypeArgument(row, offset + lenInBytes, arg.getTypeArgs().clone()); + } + + return lenInBytes; + } +} \ No newline at end of file diff --git a/jre/src/main/java/azure/data/cosmos/serialization/hybridrow/layouts/LayoutType.java b/jre/src/main/java/com/azure/data/cosmos/serialization/hybridrow/layouts/LayoutType.java similarity index 83% rename from jre/src/main/java/azure/data/cosmos/serialization/hybridrow/layouts/LayoutType.java rename to jre/src/main/java/com/azure/data/cosmos/serialization/hybridrow/layouts/LayoutType.java index 46651d1..2824d8d 100644 --- a/jre/src/main/java/azure/data/cosmos/serialization/hybridrow/layouts/LayoutType.java +++ b/jre/src/main/java/com/azure/data/cosmos/serialization/hybridrow/layouts/LayoutType.java @@ -2,13 +2,16 @@ // Copyright (c) Microsoft Corporation. All rights reserved. //------------------------------------------------------------ -package azure.data.cosmos.serialization.hybridrow.layouts; +package com.azure.data.cosmos.serialization.hybridrow.layouts; -import azure.data.cosmos.serialization.hybridrow.Result; -import azure.data.cosmos.serialization.hybridrow.RowBuffer; -import azure.data.cosmos.serialization.hybridrow.RowCursor; +import com.azure.data.cosmos.core.OutObject; +import com.azure.data.cosmos.core.RefObject; +import com.azure.data.cosmos.serialization.hybridrow.Result; +import com.azure.data.cosmos.serialization.hybridrow.RowBuffer; +import com.azure.data.cosmos.serialization.hybridrow.RowCursor; import static com.google.common.base.Preconditions.checkArgument; +import static com.google.common.base.Strings.lenientFormat; // TODO: C# TO JAVA CONVERTER: There is no preprocessor in Java: ///#pragma warning disable SA1402 // FileMayOnlyContainASingleType @@ -250,7 +253,7 @@ public abstract class LayoutType implements ILayoutType { //ORIGINAL LINE: [SuppressMessage("Microsoft.Security", "CA2104:DoNotDeclareReadOnlyMutableReferenceTypes", // Justification = "Type is immutable.")] public static readonly LayoutVarUInt VarUInt = new LayoutVarUInt(); public static final LayoutVarUInt VarUInt = new LayoutVarUInt(); - private static final LayoutType[] CodeIndex = new LayoutType[azure.data.cosmos.serialization.hybridrow.layouts.LayoutCode.EndScope.getValue() + 1]; + private static final LayoutType[] CodeIndex = new LayoutType[com.azure.data.cosmos.serialization.hybridrow.layouts.LayoutCode.EndScope.getValue() + 1]; /** * If true, this edit's nested fields cannot be updated individually. * The entire edit can still be replaced. @@ -259,7 +262,7 @@ public abstract class LayoutType implements ILayoutType { /** * The physical layout code used to represent the type within the serialization. */ - public LayoutCode LayoutCode = azure.data.cosmos.serialization.hybridrow.layouts.LayoutCode.values()[0]; + public LayoutCode LayoutCode = com.azure.data.cosmos.serialization.hybridrow.layouts.LayoutCode.values()[0]; /** * If fixed, the fixed size of the type's serialization in bytes, otherwise undefined. */ @@ -314,7 +317,7 @@ public abstract class LayoutType implements ILayoutType { public abstract String getName(); public int CountTypeArgument(TypeArgumentList value) { - return (azure.data.cosmos.serialization.hybridrow.layouts.LayoutCode.SIZE / Byte.SIZE); + return (com.azure.data.cosmos.serialization.hybridrow.layouts.LayoutCode.SIZE / Byte.SIZE); } // TODO: C# TO JAVA CONVERTER: Java annotations will not correspond to .NET attributes: @@ -325,7 +328,7 @@ public abstract class LayoutType implements ILayoutType { // TODO: C# TO JAVA CONVERTER: There is no preprocessor in Java: //#if DEBUG if (type == null) { - Contract.Fail(String.format("Not Implemented: %1$s", code)); + throw new IllegalStateException(lenientFormat("Not Implemented: %s", code)); } //#endif @@ -340,17 +343,17 @@ public abstract class LayoutType implements ILayoutType { * @param code The expected type of the field. * @return Success if the delete is permitted, the error code otherwise. */ - public static Result PrepareSparseDelete(tangible.RefObject b, tangible.RefObject edit, + public static Result PrepareSparseDelete(RefObject b, RefObject edit, LayoutCode code) { - if (edit.argValue.scopeType.IsFixedArity) { + if (edit.get().scopeType.IsFixedArity) { return Result.TypeConstraint; } - if (edit.argValue.immutable) { + if (edit.get().immutable) { return Result.InsufficientPermissions; } - if (edit.argValue.exists && LayoutCodeTraits.Canonicalize(edit.argValue.cellType.LayoutCode) != code) { + if (edit.get().exists && LayoutCodeTraits.Canonicalize(edit.get().cellType.LayoutCode) != code) { return Result.TypeMismatch; } @@ -370,55 +373,55 @@ public abstract class LayoutType implements ILayoutType { * @return Success if the move is permitted, the error code otherwise. * The source field is delete if the move prepare fails with a destination error. */ - public static Result PrepareSparseMove(tangible.RefObject b, - tangible.RefObject destinationScope, + public static Result PrepareSparseMove(RefObject b, + RefObject destinationScope, LayoutScope destinationCode, TypeArgument elementType, - tangible.RefObject srcEdit, UpdateOptions options, - tangible.OutObject dstEdit) { - checkArgument(destinationScope.argValue.scopeType == destinationCode); - checkArgument(destinationScope.argValue.index == 0, "Can only insert into a edit at the root"); + RefObject srcEdit, UpdateOptions options, + OutObject dstEdit) { + checkArgument(destinationScope.get().scopeType == destinationCode); + checkArgument(destinationScope.get().index == 0, "Can only insert into a edit at the root"); // Prepare the delete of the source. Result result = LayoutType.PrepareSparseDelete(b, srcEdit, elementType.getType().LayoutCode); if (result != Result.Success) { - dstEdit.argValue = null; + dstEdit.set(null); return result; } - if (!srcEdit.argValue.exists) { - dstEdit.argValue = null; + if (!srcEdit.get().exists) { + dstEdit.set(null); return Result.NotFound; } - if (destinationScope.argValue.immutable) { - b.argValue.DeleteSparse(srcEdit); - dstEdit.argValue = null; + if (destinationScope.get().immutable) { + b.get().DeleteSparse(srcEdit); + dstEdit.set(null); return Result.InsufficientPermissions; } - if (!srcEdit.argValue.cellTypeArgs.equals(elementType.getTypeArgs().clone())) { - b.argValue.DeleteSparse(srcEdit); - dstEdit.argValue = null; + if (!srcEdit.get().cellTypeArgs.equals(elementType.getTypeArgs().clone())) { + b.get().DeleteSparse(srcEdit); + dstEdit.set(null); return Result.TypeConstraint; } if (options == UpdateOptions.InsertAt) { - b.argValue.DeleteSparse(srcEdit); - dstEdit.argValue = null; + b.get().DeleteSparse(srcEdit); + dstEdit.set(null); return Result.TypeConstraint; } // Prepare the insertion at the destination. - dstEdit.argValue = b.argValue.PrepareSparseMove(destinationScope, srcEdit).clone(); - if ((options == UpdateOptions.Update) && (!dstEdit.argValue.exists)) { - b.argValue.DeleteSparse(srcEdit); - dstEdit.argValue = null; + dstEdit.set(b.get().PrepareSparseMove(destinationScope, srcEdit).clone()); + if ((options == UpdateOptions.Update) && (!dstEdit.get().exists)) { + b.get().DeleteSparse(srcEdit); + dstEdit.set(null); return Result.NotFound; } - if ((options == UpdateOptions.Insert) && dstEdit.argValue.exists) { - b.argValue.DeleteSparse(srcEdit); - dstEdit.argValue = null; + if ((options == UpdateOptions.Insert) && dstEdit.get().exists) { + b.get().DeleteSparse(srcEdit); + dstEdit.set(null); return Result.Exists; } @@ -433,13 +436,13 @@ public abstract class LayoutType implements ILayoutType { * @param code The expected type of the field. * @return Success if the read is permitted, the error code otherwise. */ - public static Result PrepareSparseRead(tangible.RefObject b, tangible.RefObject edit, + public static Result PrepareSparseRead(RefObject b, RefObject edit, LayoutCode code) { - if (!edit.argValue.exists) { + if (!edit.get().exists) { return Result.NotFound; } - if (LayoutCodeTraits.Canonicalize(edit.argValue.cellType.LayoutCode) != code) { + if (LayoutCodeTraits.Canonicalize(edit.get().cellType.LayoutCode) != code) { return Result.TypeMismatch; } @@ -455,37 +458,37 @@ public abstract class LayoutType implements ILayoutType { * @param options The write options. * @return Success if the write is permitted, the error code otherwise. */ - public static Result PrepareSparseWrite(tangible.RefObject b, tangible.RefObject edit, + public static Result PrepareSparseWrite(RefObject b, RefObject edit, TypeArgument typeArg, UpdateOptions options) { - if (edit.argValue.immutable || (edit.argValue.scopeType.IsUniqueScope && !edit.argValue.deferUniqueIndex)) { + if (edit.get().immutable || (edit.get().scopeType.IsUniqueScope && !edit.get().deferUniqueIndex)) { return Result.InsufficientPermissions; } - if (edit.argValue.scopeType.IsFixedArity && !(edit.argValue.scopeType instanceof LayoutNullable)) { - if ((edit.argValue.index < edit.argValue.scopeTypeArgs.getCount()) && !typeArg.equals(edit.argValue.scopeTypeArgs.get(edit.argValue.index).clone())) { + if (edit.get().scopeType.IsFixedArity && !(edit.get().scopeType instanceof LayoutNullable)) { + if ((edit.get().index < edit.get().scopeTypeArgs.getCount()) && !typeArg.equals(edit.get().scopeTypeArgs.get(edit.get().index).clone())) { return Result.TypeConstraint; } - } else if (edit.argValue.scopeType instanceof LayoutTypedMap) { - if (!((typeArg.getType() instanceof LayoutTypedTuple) && typeArg.getTypeArgs().equals(edit.argValue.scopeTypeArgs.clone()))) { + } else if (edit.get().scopeType instanceof LayoutTypedMap) { + if (!((typeArg.getType() instanceof LayoutTypedTuple) && typeArg.getTypeArgs().equals(edit.get().scopeTypeArgs.clone()))) { return Result.TypeConstraint; } - } else if (edit.argValue.scopeType.IsTypedScope && !typeArg.equals(edit.argValue.scopeTypeArgs.get(0).clone())) { + } else if (edit.get().scopeType.IsTypedScope && !typeArg.equals(edit.get().scopeTypeArgs.get(0).clone())) { return Result.TypeConstraint; } - if ((options == UpdateOptions.InsertAt) && edit.argValue.scopeType.IsFixedArity) { + if ((options == UpdateOptions.InsertAt) && edit.get().scopeType.IsFixedArity) { return Result.TypeConstraint; } - if ((options == UpdateOptions.InsertAt) && !edit.argValue.scopeType.IsFixedArity) { - edit.argValue.exists = false; // InsertAt never overwrites an existing item. + if ((options == UpdateOptions.InsertAt) && !edit.get().scopeType.IsFixedArity) { + edit.get().exists = false; // InsertAt never overwrites an existing item. } - if ((options == UpdateOptions.Update) && (!edit.argValue.exists)) { + if ((options == UpdateOptions.Update) && (!edit.get().exists)) { return Result.NotFound; } - if ((options == UpdateOptions.Insert) && edit.argValue.exists) { + if ((options == UpdateOptions.Insert) && edit.get().exists) { return Result.Exists; } @@ -494,18 +497,18 @@ public abstract class LayoutType implements ILayoutType { // TODO: C# TO JAVA CONVERTER: Java annotations will not correspond to .NET attributes: //ORIGINAL LINE: [MethodImpl(MethodImplOptions.AggressiveInlining)] internal static TypeArgument ReadTypeArgument(ref RowBuffer row, int offset, out int lenInBytes) - public static TypeArgument ReadTypeArgument(tangible.RefObject row, int offset, tangible.OutObject lenInBytes) { - LayoutType itemCode = row.argValue.ReadSparseTypeCode(offset); + public static TypeArgument ReadTypeArgument(RefObject row, int offset, OutObject lenInBytes) { + LayoutType itemCode = row.get().ReadSparseTypeCode(offset); int argsLenInBytes; - tangible.OutObject tempOut_argsLenInBytes = new tangible.OutObject(); - TypeArgumentList itemTypeArgs = itemCode.ReadTypeArgumentList(row, offset + (azure.data.cosmos.serialization.hybridrow.layouts.LayoutCode.SIZE / Byte.SIZE), tempOut_argsLenInBytes).clone(); - argsLenInBytes = tempOut_argsLenInBytes.argValue; - lenInBytes.argValue = (azure.data.cosmos.serialization.hybridrow.layouts.LayoutCode.SIZE / Byte.SIZE) + argsLenInBytes; + OutObject tempOut_argsLenInBytes = new OutObject(); + TypeArgumentList itemTypeArgs = itemCode.ReadTypeArgumentList(row, offset + (com.azure.data.cosmos.serialization.hybridrow.layouts.LayoutCode.SIZE / Byte.SIZE), tempOut_argsLenInBytes).clone(); + argsLenInBytes = tempOut_argsLenInBytes.get(); + lenInBytes.set((com.azure.data.cosmos.serialization.hybridrow.layouts.LayoutCode.SIZE / Byte.SIZE) + argsLenInBytes); return new TypeArgument(itemCode, itemTypeArgs.clone()); } - public TypeArgumentList ReadTypeArgumentList(tangible.RefObject row, int offset, tangible.OutObject lenInBytes) { - lenInBytes.argValue = 0; + public TypeArgumentList ReadTypeArgumentList(RefObject row, int offset, OutObject lenInBytes) { + lenInBytes.set(0); return TypeArgumentList.Empty; } @@ -518,8 +521,8 @@ public abstract class LayoutType implements ILayoutType { return (T)this; } - public int WriteTypeArgument(tangible.RefObject row, int offset, TypeArgumentList value) { - row.argValue.WriteSparseTypeCode(offset, this.LayoutCode); - return (azure.data.cosmos.serialization.hybridrow.layouts.LayoutCode.SIZE / Byte.SIZE); + public int WriteTypeArgument(RefObject row, int offset, TypeArgumentList value) { + row.get().WriteSparseTypeCode(offset, this.LayoutCode); + return (com.azure.data.cosmos.serialization.hybridrow.layouts.LayoutCode.SIZE / Byte.SIZE); } } \ No newline at end of file diff --git a/jre/src/main/java/azure/data/cosmos/serialization/hybridrow/layouts/LayoutType1.java b/jre/src/main/java/com/azure/data/cosmos/serialization/hybridrow/layouts/LayoutType1.java similarity index 52% rename from jre/src/main/java/azure/data/cosmos/serialization/hybridrow/layouts/LayoutType1.java rename to jre/src/main/java/com/azure/data/cosmos/serialization/hybridrow/layouts/LayoutType1.java index 3ffdb33..3741f0a 100644 --- a/jre/src/main/java/azure/data/cosmos/serialization/hybridrow/layouts/LayoutType1.java +++ b/jre/src/main/java/com/azure/data/cosmos/serialization/hybridrow/layouts/LayoutType1.java @@ -2,11 +2,13 @@ // Copyright (c) Microsoft Corporation. All rights reserved. //------------------------------------------------------------ -package azure.data.cosmos.serialization.hybridrow.layouts; +package com.azure.data.cosmos.serialization.hybridrow.layouts; -import azure.data.cosmos.serialization.hybridrow.Result; -import azure.data.cosmos.serialization.hybridrow.RowBuffer; -import azure.data.cosmos.serialization.hybridrow.RowCursor; +import com.azure.data.cosmos.core.OutObject; +import com.azure.data.cosmos.core.RefObject; +import com.azure.data.cosmos.serialization.hybridrow.Result; +import com.azure.data.cosmos.serialization.hybridrow.RowBuffer; +import com.azure.data.cosmos.serialization.hybridrow.RowCursor; import static com.google.common.base.Preconditions.checkArgument; @@ -29,10 +31,10 @@ public abstract class LayoutType extends LayoutType { this.typeArg = new TypeArgument(this); } - public final Result DeleteFixed(tangible.RefObject b, tangible.RefObject scope, + public final Result DeleteFixed(RefObject b, RefObject scope, LayoutColumn col) { - checkArgument(scope.argValue.scopeType instanceof LayoutUDT); - if (scope.argValue.immutable) { + checkArgument(scope.get().scopeType instanceof LayoutUDT); + if (scope.get().immutable) { return Result.InsufficientPermissions; } @@ -41,7 +43,7 @@ public abstract class LayoutType extends LayoutType { return Result.TypeMismatch; } - b.argValue.UnsetBit(scope.argValue.start, col.getNullBit().clone()); + b.get().UnsetBit(scope.get().start, col.getNullBit().clone()); return Result.Success; } @@ -51,13 +53,13 @@ public abstract class LayoutType extends LayoutType { * If a value exists, then it is removed. The remainder of the row is resized to accomodate * a decrease in required space. If no value exists this operation is a no-op. */ - public final Result DeleteSparse(tangible.RefObject b, tangible.RefObject edit) { + public final Result DeleteSparse(RefObject b, RefObject edit) { Result result = LayoutType.PrepareSparseDelete(b, edit, this.LayoutCode); if (result != Result.Success) { return result; } - b.argValue.DeleteSparse(edit); + b.get().DeleteSparse(edit); return Result.Success; } @@ -67,55 +69,55 @@ public abstract class LayoutType extends LayoutType { * If a value exists, then it is removed. The remainder of the row is resized to accomodate * a decrease in required space. If no value exists this operation is a no-op. */ - public final Result DeleteVariable(tangible.RefObject b, tangible.RefObject scope, + public final Result DeleteVariable(RefObject b, RefObject scope, LayoutColumn col) { - checkArgument(scope.argValue.scopeType instanceof LayoutUDT); - if (scope.argValue.immutable) { + checkArgument(scope.get().scopeType instanceof LayoutUDT); + if (scope.get().immutable) { return Result.InsufficientPermissions; } - boolean exists = b.argValue.ReadBit(scope.argValue.start, col.getNullBit().clone()); + boolean exists = b.get().ReadBit(scope.get().start, col.getNullBit().clone()); if (exists) { - int varOffset = b.argValue.ComputeVariableValueOffset(scope.argValue.layout, scope.argValue.start, + int varOffset = b.get().ComputeVariableValueOffset(scope.get().layout, scope.get().start, col.getOffset()); - b.argValue.DeleteVariable(varOffset, this.getIsVarint()); - b.argValue.UnsetBit(scope.argValue.start, col.getNullBit().clone()); + b.get().DeleteVariable(varOffset, this.getIsVarint()); + b.get().UnsetBit(scope.get().start, col.getNullBit().clone()); } return Result.Success; } - public final Result HasValue(tangible.RefObject b, tangible.RefObject scope, + public final Result HasValue(RefObject b, RefObject scope, LayoutColumn col) { - if (!b.argValue.ReadBit(scope.argValue.start, col.getNullBit().clone())) { + if (!b.get().ReadBit(scope.get().start, col.getNullBit().clone())) { return Result.NotFound; } return Result.Success; } - public abstract Result ReadFixed(tangible.RefObject b, tangible.RefObject scope, - LayoutColumn col, tangible.OutObject value); + public abstract Result ReadFixed(RefObject b, RefObject scope, + LayoutColumn col, OutObject value); - public abstract Result ReadSparse(tangible.RefObject b, tangible.RefObject edit, tangible.OutObject value); + public abstract Result ReadSparse(RefObject b, RefObject edit, OutObject value); - public Result ReadVariable(tangible.RefObject b, tangible.RefObject scope, LayoutColumn col - , tangible.OutObject value) { - value.argValue = null; + public Result ReadVariable(RefObject b, RefObject scope, LayoutColumn col + , OutObject value) { + value.set(null); return Result.Failure; } - public abstract Result WriteFixed(tangible.RefObject b, tangible.RefObject scope, + public abstract Result WriteFixed(RefObject b, RefObject scope, LayoutColumn col, T value); - public abstract Result WriteSparse(tangible.RefObject b, tangible.RefObject edit, T value); + public abstract Result WriteSparse(RefObject b, RefObject edit, T value); //C# TO JAVA CONVERTER NOTE: Java does not support optional parameters. Overloaded method(s) are created above: //ORIGINAL LINE: public abstract Result WriteSparse(ref RowBuffer b, ref RowCursor edit, T value, UpdateOptions // options = UpdateOptions.Upsert); - public abstract Result WriteSparse(tangible.RefObject b, tangible.RefObject edit, T value, UpdateOptions options); + public abstract Result WriteSparse(RefObject b, RefObject edit, T value, UpdateOptions options); - public Result WriteVariable(tangible.RefObject b, tangible.RefObject scope, + public Result WriteVariable(RefObject b, RefObject scope, LayoutColumn col, T value) { return Result.Failure; } diff --git a/jre/src/main/java/com/azure/data/cosmos/serialization/hybridrow/layouts/LayoutTypedArray.java b/jre/src/main/java/com/azure/data/cosmos/serialization/hybridrow/layouts/LayoutTypedArray.java new file mode 100644 index 0000000..fe8766c --- /dev/null +++ b/jre/src/main/java/com/azure/data/cosmos/serialization/hybridrow/layouts/LayoutTypedArray.java @@ -0,0 +1,80 @@ +//------------------------------------------------------------ +// Copyright (c) Microsoft Corporation. All rights reserved. +//------------------------------------------------------------ + +package com.azure.data.cosmos.serialization.hybridrow.layouts; + +import com.azure.data.cosmos.core.OutObject; +import com.azure.data.cosmos.core.RefObject; +import com.azure.data.cosmos.serialization.hybridrow.Result; +import com.azure.data.cosmos.serialization.hybridrow.RowBuffer; +import com.azure.data.cosmos.serialization.hybridrow.RowCursor; + +public final class LayoutTypedArray extends LayoutIndexedScope { + public LayoutTypedArray(boolean immutable) { + super(immutable ? com.azure.data.cosmos.serialization.hybridrow.layouts.LayoutCode.ImmutableTypedArrayScope : + com.azure.data.cosmos.serialization.hybridrow.layouts.LayoutCode.TypedArrayScope, immutable, true, false, false, true); + } + + @Override + public String getName() { + return this.Immutable ? "im_array_t" : "array_t"; + } + + @Override + public int CountTypeArgument(TypeArgumentList value) { + checkState(value.getCount() == 1); + return (com.azure.data.cosmos.serialization.hybridrow.layouts.LayoutCode.SIZE / Byte.SIZE) + value.get(0).getType().CountTypeArgument(value.get(0).getTypeArgs().clone()); + } + + @Override + public boolean HasImplicitTypeCode(RefObject edit) { + checkState(edit.get().index >= 0); + checkState(edit.get().scopeTypeArgs.getCount() == 1); + return !LayoutCodeTraits.AlwaysRequiresTypeCode(edit.get().scopeTypeArgs.get(0).getType().LayoutCode); + } + + @Override + public TypeArgumentList ReadTypeArgumentList(RefObject row, int offset, + OutObject lenInBytes) { + return new TypeArgumentList(new TypeArgument[] { LayoutType.ReadTypeArgument(row, offset, lenInBytes) }); + } + + @Override + public void SetImplicitTypeCode(RefObject edit) { + edit.get().cellType = edit.get().scopeTypeArgs.get(0).getType(); + edit.get().cellTypeArgs = edit.get().scopeTypeArgs.get(0).getTypeArgs().clone(); + } + + @Override + public Result WriteScope(RefObject b, RefObject edit, + TypeArgumentList typeArgs, OutObject value) { + return WriteScope(b, edit, typeArgs, value, UpdateOptions.Upsert); + } + + //C# TO JAVA CONVERTER NOTE: Java does not support optional parameters. Overloaded method(s) are created above: + //ORIGINAL LINE: public override Result WriteScope(ref RowBuffer b, ref RowCursor edit, TypeArgumentList + // typeArgs, out RowCursor value, UpdateOptions options = UpdateOptions.Upsert) + @Override + public Result WriteScope(RefObject b, RefObject edit, + TypeArgumentList typeArgs, OutObject value, UpdateOptions options) { + Result result = LayoutType.PrepareSparseWrite(b, edit, new TypeArgument(this, typeArgs.clone()), options); + if (result != Result.Success) { + value.set(null); + return result; + } + + b.get().WriteTypedArray(edit, this, typeArgs.clone(), options, value.clone()); + return Result.Success; + } + + @Override + public int WriteTypeArgument(RefObject row, int offset, TypeArgumentList value) { + checkState(value.getCount() == 1); + row.get().WriteSparseTypeCode(offset, this.LayoutCode); + int lenInBytes = (com.azure.data.cosmos.serialization.hybridrow.layouts.LayoutCode.SIZE / Byte.SIZE); + lenInBytes += value.get(0).getType().WriteTypeArgument(row, offset + lenInBytes, + value.get(0).getTypeArgs().clone()); + return lenInBytes; + } +} \ No newline at end of file diff --git a/jre/src/main/java/com/azure/data/cosmos/serialization/hybridrow/layouts/LayoutTypedMap.java b/jre/src/main/java/com/azure/data/cosmos/serialization/hybridrow/layouts/LayoutTypedMap.java new file mode 100644 index 0000000..38f56cf --- /dev/null +++ b/jre/src/main/java/com/azure/data/cosmos/serialization/hybridrow/layouts/LayoutTypedMap.java @@ -0,0 +1,103 @@ +//------------------------------------------------------------ +// Copyright (c) Microsoft Corporation. All rights reserved. +//------------------------------------------------------------ + +package com.azure.data.cosmos.serialization.hybridrow.layouts; + +import com.azure.data.cosmos.core.OutObject; +import com.azure.data.cosmos.core.RefObject; +import com.azure.data.cosmos.serialization.hybridrow.Result; +import com.azure.data.cosmos.serialization.hybridrow.RowBuffer; +import com.azure.data.cosmos.serialization.hybridrow.RowCursor; + +public final class LayoutTypedMap extends LayoutUniqueScope { + public LayoutTypedMap(boolean immutable) { + super(immutable ? com.azure.data.cosmos.serialization.hybridrow.layouts.LayoutCode.ImmutableTypedMapScope : + com.azure.data.cosmos.serialization.hybridrow.layouts.LayoutCode.TypedMapScope, immutable, isSizedScope: + true, isTypedScope:true) + } + + @Override + public String getName() { + return this.Immutable ? "im_map_t" : "map_t"; + } + + @Override + public int CountTypeArgument(TypeArgumentList value) { + checkState(value.getCount() == 2); + int lenInBytes = (com.azure.data.cosmos.serialization.hybridrow.layouts.LayoutCode.SIZE / Byte.SIZE); + for (TypeArgument arg : value) { + lenInBytes += arg.getType().CountTypeArgument(arg.getTypeArgs().clone()); + } + + return lenInBytes; + } + + @Override + public TypeArgument FieldType(RefObject scope) { + return new TypeArgument(scope.get().scopeType.Immutable ? ImmutableTypedTuple : + TypedTuple, scope.get().scopeTypeArgs.clone()); + } + + @Override + public boolean HasImplicitTypeCode(RefObject edit) { + return true; + } + + @Override + public TypeArgumentList ReadTypeArgumentList(RefObject row, int offset, + OutObject lenInBytes) { + lenInBytes.set(0); + TypeArgument[] retval = new TypeArgument[2]; + for (int i = 0; i < 2; i++) { + int itemLenInBytes; + OutObject tempOut_itemLenInBytes = new OutObject(); + retval[i] = ReadTypeArgument(row, offset + lenInBytes.get(), tempOut_itemLenInBytes); + itemLenInBytes = tempOut_itemLenInBytes.get(); + lenInBytes.set(lenInBytes.get() + itemLenInBytes); + } + + return new TypeArgumentList(retval); + } + + @Override + public void SetImplicitTypeCode(RefObject edit) { + edit.get().cellType = edit.get().scopeType.Immutable ? ImmutableTypedTuple : + TypedTuple; + edit.get().cellTypeArgs = edit.get().scopeTypeArgs.clone(); + } + + @Override + public Result WriteScope(RefObject b, RefObject edit, + TypeArgumentList typeArgs, OutObject value) { + return WriteScope(b, edit, typeArgs, value, UpdateOptions.Upsert); + } + + //C# TO JAVA CONVERTER NOTE: Java does not support optional parameters. Overloaded method(s) are created above: + //ORIGINAL LINE: public override Result WriteScope(ref RowBuffer b, ref RowCursor edit, TypeArgumentList + // typeArgs, out RowCursor value, UpdateOptions options = UpdateOptions.Upsert) + @Override + public Result WriteScope(RefObject b, RefObject edit, + TypeArgumentList typeArgs, OutObject value, UpdateOptions options) { + Result result = PrepareSparseWrite(b, edit, new TypeArgument(this, typeArgs.clone()), options); + if (result != Result.Success) { + value.set(null); + return result; + } + + b.get().WriteTypedMap(edit, this, typeArgs.clone(), options, value.clone()); + return Result.Success; + } + + @Override + public int WriteTypeArgument(RefObject row, int offset, TypeArgumentList value) { + checkState(value.getCount() == 2); + row.get().WriteSparseTypeCode(offset, this.LayoutCode); + int lenInBytes = (com.azure.data.cosmos.serialization.hybridrow.layouts.LayoutCode.SIZE / Byte.SIZE); + for (TypeArgument arg : value) { + lenInBytes += arg.getType().WriteTypeArgument(row, offset + lenInBytes, arg.getTypeArgs().clone()); + } + + return lenInBytes; + } +} \ No newline at end of file diff --git a/jre/src/main/java/com/azure/data/cosmos/serialization/hybridrow/layouts/LayoutTypedSet.java b/jre/src/main/java/com/azure/data/cosmos/serialization/hybridrow/layouts/LayoutTypedSet.java new file mode 100644 index 0000000..6af4744 --- /dev/null +++ b/jre/src/main/java/com/azure/data/cosmos/serialization/hybridrow/layouts/LayoutTypedSet.java @@ -0,0 +1,87 @@ +//------------------------------------------------------------ +// Copyright (c) Microsoft Corporation. All rights reserved. +//------------------------------------------------------------ + +package com.azure.data.cosmos.serialization.hybridrow.layouts; + +import com.azure.data.cosmos.core.OutObject; +import com.azure.data.cosmos.core.RefObject; +import com.azure.data.cosmos.serialization.hybridrow.Result; +import com.azure.data.cosmos.serialization.hybridrow.RowBuffer; +import com.azure.data.cosmos.serialization.hybridrow.RowCursor; + +import static com.azure.data.cosmos.serialization.hybridrow.layouts.LayoutCode.ImmutableTypedSetScope; +import static com.azure.data.cosmos.serialization.hybridrow.layouts.LayoutCode.TypedSetScope; + +public final class LayoutTypedSet extends LayoutUniqueScope { + public LayoutTypedSet(boolean immutable) { + super(immutable ? ImmutableTypedSetScope : TypedSetScope, immutable, true, true); + } + + @Override + public String getName() { + return this.Immutable ? "im_set_t" : "set_t"; + } + + @Override + public int CountTypeArgument(TypeArgumentList value) { + checkState(value.getCount() == 1); + return (com.azure.data.cosmos.serialization.hybridrow.layouts.LayoutCode.SIZE / Byte.SIZE) + value.get(0).getType().CountTypeArgument(value.get(0).getTypeArgs().clone()); + } + + @Override + public TypeArgument FieldType(RefObject scope) { + return scope.get().scopeTypeArgs.get(0).clone(); + } + + @Override + public boolean HasImplicitTypeCode(RefObject edit) { + checkState(edit.get().index >= 0); + checkState(edit.get().scopeTypeArgs.getCount() == 1); + return !LayoutCodeTraits.AlwaysRequiresTypeCode(edit.get().scopeTypeArgs.get(0).getType().LayoutCode); + } + + @Override + public TypeArgumentList ReadTypeArgumentList(RefObject row, int offset, + OutObject lenInBytes) { + return new TypeArgumentList(new TypeArgument[] { ReadTypeArgument(row, offset, lenInBytes) }); + } + + @Override + public void SetImplicitTypeCode(RefObject edit) { + edit.get().cellType = edit.get().scopeTypeArgs.get(0).getType(); + edit.get().cellTypeArgs = edit.get().scopeTypeArgs.get(0).getTypeArgs().clone(); + } + + @Override + public Result WriteScope(RefObject b, RefObject edit, + TypeArgumentList typeArgs, OutObject value) { + return WriteScope(b, edit, typeArgs, value, UpdateOptions.Upsert); + } + + //C# TO JAVA CONVERTER NOTE: Java does not support optional parameters. Overloaded method(s) are created above: + //ORIGINAL LINE: public override Result WriteScope(ref RowBuffer b, ref RowCursor edit, TypeArgumentList + // typeArgs, out RowCursor value, UpdateOptions options = UpdateOptions.Upsert) + @Override + public Result WriteScope(RefObject b, RefObject edit, + TypeArgumentList typeArgs, OutObject value, UpdateOptions options) { + Result result = PrepareSparseWrite(b, edit, new TypeArgument(this, typeArgs.clone()), options); + if (result != Result.Success) { + value.set(null); + return result; + } + + b.get().WriteTypedSet(edit, this, typeArgs.clone(), options, value.clone()); + return Result.Success; + } + + @Override + public int WriteTypeArgument(RefObject row, int offset, TypeArgumentList value) { + checkArgument(value.getCount() == 1); + row.get().WriteSparseTypeCode(offset, this.LayoutCode); + int lenInBytes = (com.azure.data.cosmos.serialization.hybridrow.layouts.LayoutCode.SIZE / Byte.SIZE); + lenInBytes += value.get(0).getType().WriteTypeArgument(row, offset + lenInBytes, + value.get(0).getTypeArgs().clone()); + return lenInBytes; + } +} \ No newline at end of file diff --git a/jre/src/main/java/com/azure/data/cosmos/serialization/hybridrow/layouts/LayoutTypedTuple.java b/jre/src/main/java/com/azure/data/cosmos/serialization/hybridrow/layouts/LayoutTypedTuple.java new file mode 100644 index 0000000..804a903 --- /dev/null +++ b/jre/src/main/java/com/azure/data/cosmos/serialization/hybridrow/layouts/LayoutTypedTuple.java @@ -0,0 +1,103 @@ +//------------------------------------------------------------ +// Copyright (c) Microsoft Corporation. All rights reserved. +//------------------------------------------------------------ + +package com.azure.data.cosmos.serialization.hybridrow.layouts; + +import com.azure.data.cosmos.core.OutObject; +import com.azure.data.cosmos.core.RefObject; +import com.azure.data.cosmos.serialization.hybridrow.Result; +import com.azure.data.cosmos.serialization.hybridrow.RowBuffer; +import com.azure.data.cosmos.serialization.hybridrow.RowCursor; + +import static com.google.common.base.Preconditions.checkArgument; + +public final class LayoutTypedTuple extends LayoutIndexedScope { + public LayoutTypedTuple(boolean immutable) { + super(immutable ? com.azure.data.cosmos.serialization.hybridrow.layouts.LayoutCode.ImmutableTypedTupleScope : + com.azure.data.cosmos.serialization.hybridrow.layouts.LayoutCode.TypedTupleScope, immutable, true, true, false, true); + } + + @Override + public String getName() { + return this.Immutable ? "im_tuple_t" : "tuple_t"; + } + + @Override + public int CountTypeArgument(TypeArgumentList value) { + int lenInBytes = (com.azure.data.cosmos.serialization.hybridrow.layouts.LayoutCode.SIZE / Byte.SIZE); + //C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java: + //ORIGINAL LINE: lenInBytes += RowBuffer.Count7BitEncodedUInt((ulong)value.Count); + lenInBytes += RowBuffer.Count7BitEncodedUInt(value.getCount()); + for (TypeArgument arg : value) { + lenInBytes += arg.getType().CountTypeArgument(arg.getTypeArgs().clone()); + } + + return lenInBytes; + } + + @Override + public boolean HasImplicitTypeCode(RefObject edit) { + checkArgument(edit.get().index >= 0); + checkArgument(edit.get().scopeTypeArgs.getCount() > edit.get().index); + return !LayoutCodeTraits.AlwaysRequiresTypeCode(edit.get().scopeTypeArgs.get(edit.get().index).getType().LayoutCode); + } + + @Override + public TypeArgumentList ReadTypeArgumentList(RefObject row, int offset, + OutObject lenInBytes) { + int numTypeArgs = row.get().intValue().Read7BitEncodedUInt(offset, lenInBytes); + TypeArgument[] retval = new TypeArgument[numTypeArgs]; + for (int i = 0; i < numTypeArgs; i++) { + int itemLenInBytes; + OutObject tempOut_itemLenInBytes = new OutObject(); + retval[i] = LayoutType.ReadTypeArgument(row, offset + lenInBytes.get(), tempOut_itemLenInBytes); + itemLenInBytes = tempOut_itemLenInBytes.get(); + lenInBytes.set(lenInBytes.get() + itemLenInBytes); + } + + return new TypeArgumentList(retval); + } + + @Override + public void SetImplicitTypeCode(RefObject edit) { + edit.get().cellType = edit.get().scopeTypeArgs.get(edit.get().index).getType(); + edit.get().cellTypeArgs = edit.get().scopeTypeArgs.get(edit.get().index).getTypeArgs().clone(); + } + + @Override + public Result WriteScope(RefObject b, RefObject edit, + TypeArgumentList typeArgs, OutObject value) { + return WriteScope(b, edit, typeArgs, value, UpdateOptions.Upsert); + } + + //C# TO JAVA CONVERTER NOTE: Java does not support optional parameters. Overloaded method(s) are created above: + //ORIGINAL LINE: public override Result WriteScope(ref RowBuffer b, ref RowCursor edit, TypeArgumentList + // typeArgs, out RowCursor value, UpdateOptions options = UpdateOptions.Upsert) + @Override + public Result WriteScope(RefObject b, RefObject edit, + TypeArgumentList typeArgs, OutObject value, UpdateOptions options) { + Result result = LayoutType.PrepareSparseWrite(b, edit, new TypeArgument(this, typeArgs.clone()), options); + if (result != Result.Success) { + value.set(null); + return result; + } + + b.get().WriteTypedTuple(edit, this, typeArgs.clone(), options, value.clone()); + return Result.Success; + } + + @Override + public int WriteTypeArgument(RefObject row, int offset, TypeArgumentList value) { + row.get().WriteSparseTypeCode(offset, this.LayoutCode); + int lenInBytes = (com.azure.data.cosmos.serialization.hybridrow.layouts.LayoutCode.SIZE / Byte.SIZE); + //C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java: + //ORIGINAL LINE: lenInBytes += row.Write7BitEncodedUInt(offset + lenInBytes, (ulong)value.Count); + lenInBytes += row.get().Write7BitEncodedUInt(offset + lenInBytes, value.getCount()); + for (TypeArgument arg : value) { + lenInBytes += arg.getType().WriteTypeArgument(row, offset + lenInBytes, arg.getTypeArgs().clone()); + } + + return lenInBytes; + } +} \ No newline at end of file diff --git a/jre/src/main/java/com/azure/data/cosmos/serialization/hybridrow/layouts/LayoutUDT.java b/jre/src/main/java/com/azure/data/cosmos/serialization/hybridrow/layouts/LayoutUDT.java new file mode 100644 index 0000000..24f5020 --- /dev/null +++ b/jre/src/main/java/com/azure/data/cosmos/serialization/hybridrow/layouts/LayoutUDT.java @@ -0,0 +1,67 @@ +//------------------------------------------------------------ +// Copyright (c) Microsoft Corporation. All rights reserved. +//------------------------------------------------------------ + +package com.azure.data.cosmos.serialization.hybridrow.layouts; + +import com.azure.data.cosmos.core.OutObject; +import com.azure.data.cosmos.core.RefObject; +import com.azure.data.cosmos.serialization.hybridrow.Result; +import com.azure.data.cosmos.serialization.hybridrow.RowBuffer; +import com.azure.data.cosmos.serialization.hybridrow.RowCursor; +import com.azure.data.cosmos.serialization.hybridrow.SchemaId; + +public final class LayoutUDT extends LayoutPropertyScope { + public LayoutUDT(boolean immutable) { + super(immutable ? com.azure.data.cosmos.serialization.hybridrow.layouts.LayoutCode.ImmutableSchema : + com.azure.data.cosmos.serialization.hybridrow.layouts.LayoutCode.Schema, immutable); + } + + @Override + public String getName() { + return this.Immutable ? "im_udt" : "udt"; + } + + @Override + public int CountTypeArgument(TypeArgumentList value) { + return (com.azure.data.cosmos.serialization.hybridrow.layouts.LayoutCode.SIZE / Byte.SIZE) + SchemaId.Size; + } + + @Override + public TypeArgumentList ReadTypeArgumentList(RefObject row, int offset, + OutObject lenInBytes) { + SchemaId schemaId = row.get().ReadSchemaId(offset).clone(); + lenInBytes.set(SchemaId.Size); + return new TypeArgumentList(schemaId.clone()); + } + + @Override + public Result WriteScope(RefObject b, RefObject edit, + TypeArgumentList typeArgs, OutObject value) { + return WriteScope(b, edit, typeArgs, value, UpdateOptions.Upsert); + } + + //C# TO JAVA CONVERTER NOTE: Java does not support optional parameters. Overloaded method(s) are created above: + //ORIGINAL LINE: public override Result WriteScope(ref RowBuffer b, ref RowCursor edit, TypeArgumentList + // typeArgs, out RowCursor value, UpdateOptions options = UpdateOptions.Upsert) + @Override + public Result WriteScope(RefObject b, RefObject edit, + TypeArgumentList typeArgs, OutObject value, UpdateOptions options) { + Layout udt = b.get().getResolver().Resolve(typeArgs.getSchemaId().clone()); + Result result = PrepareSparseWrite(b, edit, new TypeArgument(this, typeArgs.clone()), options); + if (result != Result.Success) { + value.set(null); + return result; + } + + b.get().WriteSparseUDT(edit, this, udt, options, value.clone()); + return Result.Success; + } + + @Override + public int WriteTypeArgument(RefObject row, int offset, TypeArgumentList value) { + row.get().WriteSparseTypeCode(offset, this.LayoutCode); + row.get().WriteSchemaId(offset + (com.azure.data.cosmos.serialization.hybridrow.layouts.LayoutCode.SIZE / Byte.SIZE), value.getSchemaId().clone()); + return (com.azure.data.cosmos.serialization.hybridrow.layouts.LayoutCode.SIZE / Byte.SIZE) + SchemaId.Size; + } +} \ No newline at end of file diff --git a/jre/src/main/java/azure/data/cosmos/serialization/hybridrow/layouts/LayoutUInt16.java b/jre/src/main/java/com/azure/data/cosmos/serialization/hybridrow/layouts/LayoutUInt16.java similarity index 54% rename from jre/src/main/java/azure/data/cosmos/serialization/hybridrow/layouts/LayoutUInt16.java rename to jre/src/main/java/com/azure/data/cosmos/serialization/hybridrow/layouts/LayoutUInt16.java index 0b4697c..6d02079 100644 --- a/jre/src/main/java/azure/data/cosmos/serialization/hybridrow/layouts/LayoutUInt16.java +++ b/jre/src/main/java/com/azure/data/cosmos/serialization/hybridrow/layouts/LayoutUInt16.java @@ -2,11 +2,13 @@ // Copyright (c) Microsoft Corporation. All rights reserved. //------------------------------------------------------------ -package azure.data.cosmos.serialization.hybridrow.layouts; +package com.azure.data.cosmos.serialization.hybridrow.layouts; -import azure.data.cosmos.serialization.hybridrow.Result; -import azure.data.cosmos.serialization.hybridrow.RowBuffer; -import azure.data.cosmos.serialization.hybridrow.RowCursor; +import com.azure.data.cosmos.core.OutObject; +import com.azure.data.cosmos.core.RefObject; +import com.azure.data.cosmos.serialization.hybridrow.Result; +import com.azure.data.cosmos.serialization.hybridrow.RowBuffer; +import com.azure.data.cosmos.serialization.hybridrow.RowCursor; import static com.google.common.base.Preconditions.checkArgument; @@ -14,7 +16,7 @@ import static com.google.common.base.Preconditions.checkArgument; //ORIGINAL LINE: public sealed class LayoutUInt16 : LayoutType public final class LayoutUInt16 extends LayoutType { public LayoutUInt16() { - super(azure.data.cosmos.serialization.hybridrow.layouts.LayoutCode.UInt16, (Short.SIZE / Byte.SIZE)); + super(com.azure.data.cosmos.serialization.hybridrow.layouts.LayoutCode.UInt16, (Short.SIZE / Byte.SIZE)); } @Override @@ -31,30 +33,30 @@ public final class LayoutUInt16 extends LayoutType { //ORIGINAL LINE: public override Result ReadFixed(ref RowBuffer b, ref RowCursor scope, LayoutColumn col, out // ushort value) @Override - public Result ReadFixed(tangible.RefObject b, tangible.RefObject scope, LayoutColumn col, - tangible.OutObject value) { - checkArgument(scope.argValue.scopeType instanceof LayoutUDT); - if (!b.argValue.ReadBit(scope.argValue.start, col.getNullBit().clone())) { - value.argValue = 0; + public Result ReadFixed(RefObject b, RefObject scope, LayoutColumn col, + OutObject value) { + checkArgument(scope.get().scopeType instanceof LayoutUDT); + if (!b.get().ReadBit(scope.get().start, col.getNullBit().clone())) { + value.set(0); return Result.NotFound; } - value.argValue = b.argValue.ReadUInt16(scope.argValue.start + col.getOffset()); + value.set(b.get().ReadUInt16(scope.get().start + col.getOffset())); return Result.Success; } //C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java: //ORIGINAL LINE: public override Result ReadSparse(ref RowBuffer b, ref RowCursor edit, out ushort value) @Override - public Result ReadSparse(tangible.RefObject b, tangible.RefObject edit, - tangible.OutObject value) { - Result result = LayoutType.PrepareSparseRead(b, edit, this.LayoutCode); + public Result ReadSparse(RefObject b, RefObject edit, + OutObject value) { + Result result = PrepareSparseRead(b, edit, this.LayoutCode); if (result != Result.Success) { - value.argValue = 0; + value.set(0); return result; } - value.argValue = b.argValue.ReadSparseUInt16(edit); + value.set(b.get().ReadSparseUInt16(edit)); return Result.Success; } @@ -62,15 +64,15 @@ public final class LayoutUInt16 extends LayoutType { //ORIGINAL LINE: public override Result WriteFixed(ref RowBuffer b, ref RowCursor scope, LayoutColumn col, ushort // value) @Override - public Result WriteFixed(tangible.RefObject b, tangible.RefObject scope, LayoutColumn col, + public Result WriteFixed(RefObject b, RefObject scope, LayoutColumn col, short value) { - checkArgument(scope.argValue.scopeType instanceof LayoutUDT); - if (scope.argValue.immutable) { + checkArgument(scope.get().scopeType instanceof LayoutUDT); + if (scope.get().immutable) { return Result.InsufficientPermissions; } - b.argValue.WriteUInt16(scope.argValue.start + col.getOffset(), value); - b.argValue.SetBit(scope.argValue.start, col.getNullBit().clone()); + b.get().WriteUInt16(scope.get().start + col.getOffset(), value); + b.get().SetBit(scope.get().start, col.getNullBit().clone()); return Result.Success; } @@ -79,19 +81,19 @@ public final class LayoutUInt16 extends LayoutType { // UpdateOptions options = UpdateOptions.Upsert) //C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java: @Override - public Result WriteSparse(tangible.RefObject b, tangible.RefObject edit, short value, + public Result WriteSparse(RefObject b, RefObject edit, short value, UpdateOptions options) { - Result result = LayoutType.PrepareSparseWrite(b, edit, this.getTypeArg().clone(), options); + Result result = PrepareSparseWrite(b, edit, this.getTypeArg().clone(), options); if (result != Result.Success) { return result; } - b.argValue.WriteSparseUInt16(edit, value, options); + b.get().WriteSparseUInt16(edit, value, options); return Result.Success; } @Override - public Result WriteSparse(tangible.RefObject b, tangible.RefObject edit, short value) { + public Result WriteSparse(RefObject b, RefObject edit, short value) { return WriteSparse(b, edit, value, UpdateOptions.Upsert); } } \ No newline at end of file diff --git a/jre/src/main/java/azure/data/cosmos/serialization/hybridrow/layouts/LayoutUInt32.java b/jre/src/main/java/com/azure/data/cosmos/serialization/hybridrow/layouts/LayoutUInt32.java similarity index 54% rename from jre/src/main/java/azure/data/cosmos/serialization/hybridrow/layouts/LayoutUInt32.java rename to jre/src/main/java/com/azure/data/cosmos/serialization/hybridrow/layouts/LayoutUInt32.java index 20fcd2d..d9b90b4 100644 --- a/jre/src/main/java/azure/data/cosmos/serialization/hybridrow/layouts/LayoutUInt32.java +++ b/jre/src/main/java/com/azure/data/cosmos/serialization/hybridrow/layouts/LayoutUInt32.java @@ -2,11 +2,13 @@ // Copyright (c) Microsoft Corporation. All rights reserved. //------------------------------------------------------------ -package azure.data.cosmos.serialization.hybridrow.layouts; +package com.azure.data.cosmos.serialization.hybridrow.layouts; -import azure.data.cosmos.serialization.hybridrow.Result; -import azure.data.cosmos.serialization.hybridrow.RowBuffer; -import azure.data.cosmos.serialization.hybridrow.RowCursor; +import com.azure.data.cosmos.core.OutObject; +import com.azure.data.cosmos.core.RefObject; +import com.azure.data.cosmos.serialization.hybridrow.Result; +import com.azure.data.cosmos.serialization.hybridrow.RowBuffer; +import com.azure.data.cosmos.serialization.hybridrow.RowCursor; import static com.google.common.base.Preconditions.checkArgument; @@ -14,7 +16,7 @@ import static com.google.common.base.Preconditions.checkArgument; //ORIGINAL LINE: public sealed class LayoutUInt32 : LayoutType public final class LayoutUInt32 extends LayoutType { public LayoutUInt32() { - super(azure.data.cosmos.serialization.hybridrow.layouts.LayoutCode.UInt32, (Integer.SIZE / Byte.SIZE)); + super(com.azure.data.cosmos.serialization.hybridrow.layouts.LayoutCode.UInt32, (Integer.SIZE / Byte.SIZE)); } @Override @@ -31,30 +33,30 @@ public final class LayoutUInt32 extends LayoutType { //ORIGINAL LINE: public override Result ReadFixed(ref RowBuffer b, ref RowCursor scope, LayoutColumn col, out // uint value) @Override - public Result ReadFixed(tangible.RefObject b, tangible.RefObject scope, LayoutColumn col, - tangible.OutObject value) { - checkArgument(scope.argValue.scopeType instanceof LayoutUDT); - if (!b.argValue.ReadBit(scope.argValue.start, col.getNullBit().clone())) { - value.argValue = 0; + public Result ReadFixed(RefObject b, RefObject scope, LayoutColumn col, + OutObject value) { + checkArgument(scope.get().scopeType instanceof LayoutUDT); + if (!b.get().ReadBit(scope.get().start, col.getNullBit().clone())) { + value.set(0); return Result.NotFound; } - value.argValue = b.argValue.ReadUInt32(scope.argValue.start + col.getOffset()); + value.set(b.get().ReadUInt32(scope.get().start + col.getOffset())); return Result.Success; } //C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java: //ORIGINAL LINE: public override Result ReadSparse(ref RowBuffer b, ref RowCursor edit, out uint value) @Override - public Result ReadSparse(tangible.RefObject b, tangible.RefObject edit, - tangible.OutObject value) { - Result result = LayoutType.PrepareSparseRead(b, edit, this.LayoutCode); + public Result ReadSparse(RefObject b, RefObject edit, + OutObject value) { + Result result = PrepareSparseRead(b, edit, this.LayoutCode); if (result != Result.Success) { - value.argValue = 0; + value.set(0); return result; } - value.argValue = b.argValue.ReadSparseUInt32(edit); + value.set(b.get().ReadSparseUInt32(edit)); return Result.Success; } @@ -62,15 +64,15 @@ public final class LayoutUInt32 extends LayoutType { //ORIGINAL LINE: public override Result WriteFixed(ref RowBuffer b, ref RowCursor scope, LayoutColumn col, uint // value) @Override - public Result WriteFixed(tangible.RefObject b, tangible.RefObject scope, LayoutColumn col, + public Result WriteFixed(RefObject b, RefObject scope, LayoutColumn col, int value) { - checkArgument(scope.argValue.scopeType instanceof LayoutUDT); - if (scope.argValue.immutable) { + checkArgument(scope.get().scopeType instanceof LayoutUDT); + if (scope.get().immutable) { return Result.InsufficientPermissions; } - b.argValue.WriteUInt32(scope.argValue.start + col.getOffset(), value); - b.argValue.SetBit(scope.argValue.start, col.getNullBit().clone()); + b.get().WriteUInt32(scope.get().start + col.getOffset(), value); + b.get().SetBit(scope.get().start, col.getNullBit().clone()); return Result.Success; } @@ -79,19 +81,19 @@ public final class LayoutUInt32 extends LayoutType { // UpdateOptions options = UpdateOptions.Upsert) //C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java: @Override - public Result WriteSparse(tangible.RefObject b, tangible.RefObject edit, int value, + public Result WriteSparse(RefObject b, RefObject edit, int value, UpdateOptions options) { - Result result = LayoutType.PrepareSparseWrite(b, edit, this.getTypeArg().clone(), options); + Result result = PrepareSparseWrite(b, edit, this.getTypeArg().clone(), options); if (result != Result.Success) { return result; } - b.argValue.WriteSparseUInt32(edit, value, options); + b.get().WriteSparseUInt32(edit, value, options); return Result.Success; } @Override - public Result WriteSparse(tangible.RefObject b, tangible.RefObject edit, int value) { + public Result WriteSparse(RefObject b, RefObject edit, int value) { return WriteSparse(b, edit, value, UpdateOptions.Upsert); } } \ No newline at end of file diff --git a/jre/src/main/java/azure/data/cosmos/serialization/hybridrow/layouts/LayoutUInt64.java b/jre/src/main/java/com/azure/data/cosmos/serialization/hybridrow/layouts/LayoutUInt64.java similarity index 54% rename from jre/src/main/java/azure/data/cosmos/serialization/hybridrow/layouts/LayoutUInt64.java rename to jre/src/main/java/com/azure/data/cosmos/serialization/hybridrow/layouts/LayoutUInt64.java index 52686a4..5ecfe88 100644 --- a/jre/src/main/java/azure/data/cosmos/serialization/hybridrow/layouts/LayoutUInt64.java +++ b/jre/src/main/java/com/azure/data/cosmos/serialization/hybridrow/layouts/LayoutUInt64.java @@ -2,11 +2,13 @@ // Copyright (c) Microsoft Corporation. All rights reserved. //------------------------------------------------------------ -package azure.data.cosmos.serialization.hybridrow.layouts; +package com.azure.data.cosmos.serialization.hybridrow.layouts; -import azure.data.cosmos.serialization.hybridrow.Result; -import azure.data.cosmos.serialization.hybridrow.RowBuffer; -import azure.data.cosmos.serialization.hybridrow.RowCursor; +import com.azure.data.cosmos.core.OutObject; +import com.azure.data.cosmos.core.RefObject; +import com.azure.data.cosmos.serialization.hybridrow.Result; +import com.azure.data.cosmos.serialization.hybridrow.RowBuffer; +import com.azure.data.cosmos.serialization.hybridrow.RowCursor; import static com.google.common.base.Preconditions.checkArgument; @@ -14,7 +16,7 @@ import static com.google.common.base.Preconditions.checkArgument; //ORIGINAL LINE: public sealed class LayoutUInt64 : LayoutType public final class LayoutUInt64 extends LayoutType { public LayoutUInt64() { - super(azure.data.cosmos.serialization.hybridrow.layouts.LayoutCode.UInt64, (Long.SIZE / Byte.SIZE)); + super(com.azure.data.cosmos.serialization.hybridrow.layouts.LayoutCode.UInt64, (Long.SIZE / Byte.SIZE)); } @Override @@ -31,30 +33,30 @@ public final class LayoutUInt64 extends LayoutType { //ORIGINAL LINE: public override Result ReadFixed(ref RowBuffer b, ref RowCursor scope, LayoutColumn col, out // ulong value) @Override - public Result ReadFixed(tangible.RefObject b, tangible.RefObject scope, LayoutColumn col, - tangible.OutObject value) { - checkArgument(scope.argValue.scopeType instanceof LayoutUDT); - if (!b.argValue.ReadBit(scope.argValue.start, col.getNullBit().clone())) { - value.argValue = 0; + public Result ReadFixed(RefObject b, RefObject scope, LayoutColumn col, + OutObject value) { + checkArgument(scope.get().scopeType instanceof LayoutUDT); + if (!b.get().ReadBit(scope.get().start, col.getNullBit().clone())) { + value.set(0); return Result.NotFound; } - value.argValue = b.argValue.ReadUInt64(scope.argValue.start + col.getOffset()); + value.set(b.get().ReadUInt64(scope.get().start + col.getOffset())); return Result.Success; } //C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java: //ORIGINAL LINE: public override Result ReadSparse(ref RowBuffer b, ref RowCursor edit, out ulong value) @Override - public Result ReadSparse(tangible.RefObject b, tangible.RefObject edit, - tangible.OutObject value) { - Result result = LayoutType.PrepareSparseRead(b, edit, this.LayoutCode); + public Result ReadSparse(RefObject b, RefObject edit, + OutObject value) { + Result result = PrepareSparseRead(b, edit, this.LayoutCode); if (result != Result.Success) { - value.argValue = 0; + value.set(0); return result; } - value.argValue = b.argValue.ReadSparseUInt64(edit); + value.set(b.get().ReadSparseUInt64(edit)); return Result.Success; } @@ -62,15 +64,15 @@ public final class LayoutUInt64 extends LayoutType { //ORIGINAL LINE: public override Result WriteFixed(ref RowBuffer b, ref RowCursor scope, LayoutColumn col, ulong // value) @Override - public Result WriteFixed(tangible.RefObject b, tangible.RefObject scope, LayoutColumn col, + public Result WriteFixed(RefObject b, RefObject scope, LayoutColumn col, long value) { - checkArgument(scope.argValue.scopeType instanceof LayoutUDT); - if (scope.argValue.immutable) { + checkArgument(scope.get().scopeType instanceof LayoutUDT); + if (scope.get().immutable) { return Result.InsufficientPermissions; } - b.argValue.WriteUInt64(scope.argValue.start + col.getOffset(), value); - b.argValue.SetBit(scope.argValue.start, col.getNullBit().clone()); + b.get().WriteUInt64(scope.get().start + col.getOffset(), value); + b.get().SetBit(scope.get().start, col.getNullBit().clone()); return Result.Success; } @@ -79,19 +81,19 @@ public final class LayoutUInt64 extends LayoutType { // UpdateOptions options = UpdateOptions.Upsert) //C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java: @Override - public Result WriteSparse(tangible.RefObject b, tangible.RefObject edit, long value, + public Result WriteSparse(RefObject b, RefObject edit, long value, UpdateOptions options) { - Result result = LayoutType.PrepareSparseWrite(b, edit, this.getTypeArg().clone(), options); + Result result = PrepareSparseWrite(b, edit, this.getTypeArg().clone(), options); if (result != Result.Success) { return result; } - b.argValue.WriteSparseUInt64(edit, value, options); + b.get().WriteSparseUInt64(edit, value, options); return Result.Success; } @Override - public Result WriteSparse(tangible.RefObject b, tangible.RefObject edit, long value) { + public Result WriteSparse(RefObject b, RefObject edit, long value) { return WriteSparse(b, edit, value, UpdateOptions.Upsert); } } \ No newline at end of file diff --git a/jre/src/main/java/azure/data/cosmos/serialization/hybridrow/layouts/LayoutUInt8.java b/jre/src/main/java/com/azure/data/cosmos/serialization/hybridrow/layouts/LayoutUInt8.java similarity index 54% rename from jre/src/main/java/azure/data/cosmos/serialization/hybridrow/layouts/LayoutUInt8.java rename to jre/src/main/java/com/azure/data/cosmos/serialization/hybridrow/layouts/LayoutUInt8.java index 75eac1a..15ac870 100644 --- a/jre/src/main/java/azure/data/cosmos/serialization/hybridrow/layouts/LayoutUInt8.java +++ b/jre/src/main/java/com/azure/data/cosmos/serialization/hybridrow/layouts/LayoutUInt8.java @@ -2,11 +2,13 @@ // Copyright (c) Microsoft Corporation. All rights reserved. //------------------------------------------------------------ -package azure.data.cosmos.serialization.hybridrow.layouts; +package com.azure.data.cosmos.serialization.hybridrow.layouts; -import azure.data.cosmos.serialization.hybridrow.Result; -import azure.data.cosmos.serialization.hybridrow.RowBuffer; -import azure.data.cosmos.serialization.hybridrow.RowCursor; +import com.azure.data.cosmos.core.OutObject; +import com.azure.data.cosmos.core.RefObject; +import com.azure.data.cosmos.serialization.hybridrow.Result; +import com.azure.data.cosmos.serialization.hybridrow.RowBuffer; +import com.azure.data.cosmos.serialization.hybridrow.RowCursor; import static com.google.common.base.Preconditions.checkArgument; @@ -14,7 +16,7 @@ import static com.google.common.base.Preconditions.checkArgument; //ORIGINAL LINE: public sealed class LayoutUInt8 : LayoutType public final class LayoutUInt8 extends LayoutType { public LayoutUInt8() { - super(azure.data.cosmos.serialization.hybridrow.layouts.LayoutCode.UInt8, 1); + super(com.azure.data.cosmos.serialization.hybridrow.layouts.LayoutCode.UInt8, 1); } @Override @@ -31,30 +33,30 @@ public final class LayoutUInt8 extends LayoutType { //ORIGINAL LINE: public override Result ReadFixed(ref RowBuffer b, ref RowCursor scope, LayoutColumn col, out // byte value) @Override - public Result ReadFixed(tangible.RefObject b, tangible.RefObject scope, LayoutColumn col, - tangible.OutObject value) { - checkArgument(scope.argValue.scopeType instanceof LayoutUDT); - if (!b.argValue.ReadBit(scope.argValue.start, col.getNullBit().clone())) { - value.argValue = 0; + public Result ReadFixed(RefObject b, RefObject scope, LayoutColumn col, + OutObject value) { + checkArgument(scope.get().scopeType instanceof LayoutUDT); + if (!b.get().ReadBit(scope.get().start, col.getNullBit().clone())) { + value.set(0); return Result.NotFound; } - value.argValue = b.argValue.ReadUInt8(scope.argValue.start + col.getOffset()); + value.set(b.get().ReadUInt8(scope.get().start + col.getOffset())); return Result.Success; } //C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java: //ORIGINAL LINE: public override Result ReadSparse(ref RowBuffer b, ref RowCursor edit, out byte value) @Override - public Result ReadSparse(tangible.RefObject b, tangible.RefObject edit, - tangible.OutObject value) { - Result result = LayoutType.PrepareSparseRead(b, edit, this.LayoutCode); + public Result ReadSparse(RefObject b, RefObject edit, + OutObject value) { + Result result = PrepareSparseRead(b, edit, this.LayoutCode); if (result != Result.Success) { - value.argValue = 0; + value.set(0); return result; } - value.argValue = b.argValue.ReadSparseUInt8(edit); + value.set(b.get().ReadSparseUInt8(edit)); return Result.Success; } @@ -62,15 +64,15 @@ public final class LayoutUInt8 extends LayoutType { //ORIGINAL LINE: public override Result WriteFixed(ref RowBuffer b, ref RowCursor scope, LayoutColumn col, byte // value) @Override - public Result WriteFixed(tangible.RefObject b, tangible.RefObject scope, LayoutColumn col, + public Result WriteFixed(RefObject b, RefObject scope, LayoutColumn col, byte value) { - checkArgument(scope.argValue.scopeType instanceof LayoutUDT); - if (scope.argValue.immutable) { + checkArgument(scope.get().scopeType instanceof LayoutUDT); + if (scope.get().immutable) { return Result.InsufficientPermissions; } - b.argValue.WriteUInt8(scope.argValue.start + col.getOffset(), value); - b.argValue.SetBit(scope.argValue.start, col.getNullBit().clone()); + b.get().WriteUInt8(scope.get().start + col.getOffset(), value); + b.get().SetBit(scope.get().start, col.getNullBit().clone()); return Result.Success; } @@ -79,19 +81,19 @@ public final class LayoutUInt8 extends LayoutType { // UpdateOptions options = UpdateOptions.Upsert) //C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java: @Override - public Result WriteSparse(tangible.RefObject b, tangible.RefObject edit, byte value, + public Result WriteSparse(RefObject b, RefObject edit, byte value, UpdateOptions options) { - Result result = LayoutType.PrepareSparseWrite(b, edit, this.getTypeArg().clone(), options); + Result result = PrepareSparseWrite(b, edit, this.getTypeArg().clone(), options); if (result != Result.Success) { return result; } - b.argValue.WriteSparseUInt8(edit, value, options); + b.get().WriteSparseUInt8(edit, value, options); return Result.Success; } @Override - public Result WriteSparse(tangible.RefObject b, tangible.RefObject edit, byte value) { + public Result WriteSparse(RefObject b, RefObject edit, byte value) { return WriteSparse(b, edit, value, UpdateOptions.Upsert); } } \ No newline at end of file diff --git a/jre/src/main/java/azure/data/cosmos/serialization/hybridrow/layouts/LayoutUniqueScope.java b/jre/src/main/java/com/azure/data/cosmos/serialization/hybridrow/layouts/LayoutUniqueScope.java similarity index 62% rename from jre/src/main/java/azure/data/cosmos/serialization/hybridrow/layouts/LayoutUniqueScope.java rename to jre/src/main/java/com/azure/data/cosmos/serialization/hybridrow/layouts/LayoutUniqueScope.java index 390fbe7..b0cbe55 100644 --- a/jre/src/main/java/azure/data/cosmos/serialization/hybridrow/layouts/LayoutUniqueScope.java +++ b/jre/src/main/java/com/azure/data/cosmos/serialization/hybridrow/layouts/LayoutUniqueScope.java @@ -2,12 +2,15 @@ // Copyright (c) Microsoft Corporation. All rights reserved. //------------------------------------------------------------ -package azure.data.cosmos.serialization.hybridrow.layouts; +package com.azure.data.cosmos.serialization.hybridrow.layouts; -import azure.data.cosmos.serialization.hybridrow.Result; -import azure.data.cosmos.serialization.hybridrow.RowBuffer; -import azure.data.cosmos.serialization.hybridrow.RowCursor; -import azure.data.cosmos.serialization.hybridrow.RowOptions; +import com.azure.data.cosmos.core.OutObject; +import com.azure.data.cosmos.core.RefObject; +import com.azure.data.cosmos.serialization.hybridrow.Result; +import com.azure.data.cosmos.serialization.hybridrow.RowBuffer; +import com.azure.data.cosmos.serialization.hybridrow.RowCursor; +import com.azure.data.cosmos.serialization.hybridrow.RowOptions; +import com.azure.data.cosmos.serialization.hybridrow.RowCursorExtensions; public abstract class LayoutUniqueScope extends LayoutIndexedScope { protected LayoutUniqueScope(LayoutCode code, boolean immutable, boolean isSizedScope, boolean isTypedScope) { @@ -15,10 +18,10 @@ public abstract class LayoutUniqueScope extends LayoutIndexedScope { // following line: //ORIGINAL LINE: base(code, immutable, isSizedScope, isFixedArity: false, isUniqueScope: true, isTypedScope: // isTypedScope); - super(code, immutable, isSizedScope, isFixedArity:false, isUniqueScope:true, isTypedScope:isTypedScope) + super(code, immutable, isSizedScope, false, true, isTypedScope); } - public abstract TypeArgument FieldType(tangible.RefObject scope); + public abstract TypeArgument FieldType(RefObject scope); /** * Search for a matching field within a unique index. @@ -32,8 +35,8 @@ public abstract class LayoutUniqueScope extends LayoutIndexedScope { *

* The pattern field is delete whether the find succeeds or fails. */ - public final Result Find(tangible.RefObject b, tangible.RefObject scope, - tangible.RefObject patternScope, tangible.OutObject value) { + public final Result Find(RefObject b, RefObject scope, + RefObject patternScope, OutObject value) { Result result = LayoutType.PrepareSparseMove(b, scope, this, this.FieldType(scope).clone(), patternScope, UpdateOptions.Update, value.clone()); if (result != Result.Success) { @@ -41,7 +44,7 @@ public abstract class LayoutUniqueScope extends LayoutIndexedScope { } // Check if the search found the result. - b.argValue.DeleteSparse(patternScope); + b.get().DeleteSparse(patternScope); return Result.Success; } @@ -49,28 +52,28 @@ public abstract class LayoutUniqueScope extends LayoutIndexedScope { //C# TO JAVA CONVERTER NOTE: Java does not support optional parameters. Overloaded method(s) are created above: //ORIGINAL LINE: public Result MoveField(ref RowBuffer b, ref RowCursor destinationScope, ref RowCursor // sourceEdit, UpdateOptions options = UpdateOptions.Upsert) - public final Result MoveField(tangible.RefObject b, tangible.RefObject destinationScope, - tangible.RefObject sourceEdit, UpdateOptions options) { + public final Result MoveField(RefObject b, RefObject destinationScope, + RefObject sourceEdit, UpdateOptions options) { RowCursor dstEdit; - tangible.OutObject tempOut_dstEdit = - new tangible.OutObject(); + OutObject tempOut_dstEdit = + new OutObject(); Result result = LayoutType.PrepareSparseMove(b, destinationScope, this, this.FieldType(destinationScope).clone(), sourceEdit, options, tempOut_dstEdit); - dstEdit = tempOut_dstEdit.argValue; + dstEdit = tempOut_dstEdit.get(); if (result != Result.Success) { return result; } // Perform the move. - tangible.RefObject tempRef_dstEdit = - new tangible.RefObject(dstEdit); - b.argValue.TypedCollectionMoveField(tempRef_dstEdit, sourceEdit, RowOptions.forValue(options)); - dstEdit = tempRef_dstEdit.argValue; + RefObject tempRef_dstEdit = + new RefObject(dstEdit); + b.get().TypedCollectionMoveField(tempRef_dstEdit, sourceEdit, RowOptions.forValue(options)); + dstEdit = tempRef_dstEdit.get(); // TODO: it would be "better" if the destinationScope were updated to point to the // highest item seen. Then we would avoid the maximum reparse. - destinationScope.argValue.count = dstEdit.count; + destinationScope.get().count = dstEdit.count; return Result.Success; } @@ -89,8 +92,8 @@ public abstract class LayoutUniqueScope extends LayoutIndexedScope { * The source field is delete whether the move succeeds or fails. */ - public final Result MoveField(tangible.RefObject b, tangible.RefObject destinationScope, - tangible.RefObject sourceEdit) { + public final Result MoveField(RefObject b, RefObject destinationScope, + RefObject sourceEdit) { return MoveField(b, destinationScope, sourceEdit, UpdateOptions.Upsert); } @@ -99,7 +102,7 @@ public abstract class LayoutUniqueScope extends LayoutIndexedScope { // TypeArgumentList typeArgs, TContext context, WriterFunc func, UpdateOptions options = UpdateOptions // .Upsert) @Override - public Result WriteScope(tangible.RefObject b, tangible.RefObject scope, + public Result WriteScope(RefObject b, RefObject scope, TypeArgumentList typeArgs, TContext context, WriterFunc func, UpdateOptions options) { RowCursor uniqueScope; @@ -115,36 +118,36 @@ public abstract class LayoutUniqueScope extends LayoutIndexedScope { // cannot be converted using the 'OutObject' helper class unless the method is within the code being modified: uniqueScope.Clone(out childScope); childScope.deferUniqueIndex = true; - tangible.RefObject tempRef_childScope = - new tangible.RefObject(childScope); + RefObject tempRef_childScope = + new RefObject(childScope); // TODO: C# TO JAVA CONVERTER: The following line could not be converted: r = func == null ? null : func.Invoke(ref b, ref childScope, context) ??Result.Success; - childScope = tempRef_childScope.argValue; + childScope = tempRef_childScope.get(); if (r != Result.Success) { this.DeleteScope(b, scope); return r; } uniqueScope.count = childScope.count; - tangible.RefObject tempRef_uniqueScope = - new tangible.RefObject(uniqueScope); - r = b.argValue.TypedCollectionUniqueIndexRebuild(tempRef_uniqueScope); - uniqueScope = tempRef_uniqueScope.argValue; + RefObject tempRef_uniqueScope = + new RefObject(uniqueScope); + r = b.get().TypedCollectionUniqueIndexRebuild(tempRef_uniqueScope); + uniqueScope = tempRef_uniqueScope.get(); if (r != Result.Success) { this.DeleteScope(b, scope); return r; } - tangible.RefObject tempRef_childScope2 = - new tangible.RefObject(childScope); - Microsoft.Azure.Cosmos.Serialization.HybridRow.RowCursorExtensions.Skip(scope.argValue.clone(), b, + RefObject tempRef_childScope2 = + new RefObject(childScope); + RowCursorExtensions.Skip(scope.get().clone(), b, tempRef_childScope2); - childScope = tempRef_childScope2.argValue; + childScope = tempRef_childScope2.get(); return Result.Success; } @Override - public Result WriteScope(tangible.RefObject b, tangible.RefObject scope, + public Result WriteScope(RefObject b, RefObject scope, TypeArgumentList typeArgs, TContext context, WriterFunc func) { return WriteScope(b, scope, typeArgs, context, func, UpdateOptions.Upsert); } diff --git a/jre/src/main/java/com/azure/data/cosmos/serialization/hybridrow/layouts/LayoutUnixDateTime.java b/jre/src/main/java/com/azure/data/cosmos/serialization/hybridrow/layouts/LayoutUnixDateTime.java new file mode 100644 index 0000000..437e537 --- /dev/null +++ b/jre/src/main/java/com/azure/data/cosmos/serialization/hybridrow/layouts/LayoutUnixDateTime.java @@ -0,0 +1,90 @@ +//------------------------------------------------------------ +// Copyright (c) Microsoft Corporation. All rights reserved. +//------------------------------------------------------------ + +package com.azure.data.cosmos.serialization.hybridrow.layouts; + +import com.azure.data.cosmos.core.OutObject; +import com.azure.data.cosmos.core.RefObject; +import com.azure.data.cosmos.serialization.hybridrow.Result; +import com.azure.data.cosmos.serialization.hybridrow.RowBuffer; +import com.azure.data.cosmos.serialization.hybridrow.RowCursor; +import com.azure.data.cosmos.serialization.hybridrow.UnixDateTime; + +import static com.google.common.base.Preconditions.checkArgument; + +public final class LayoutUnixDateTime extends LayoutType { + public LayoutUnixDateTime() { + super(com.azure.data.cosmos.serialization.hybridrow.layouts.LayoutCode.UnixDateTime, + com.azure.data.cosmos.serialization.hybridrow.UnixDateTime.Size); + } + + @Override + public boolean getIsFixed() { + return true; + } + + @Override + public String getName() { + return "unixdatetime"; + } + + @Override + public Result ReadFixed(RefObject b, RefObject scope, LayoutColumn col, + OutObject value) { + checkArgument(scope.get().scopeType instanceof LayoutUDT); + if (!b.get().ReadBit(scope.get().start, col.getNullBit().clone())) { + value.set(null); + return Result.NotFound; + } + + value.set(b.get().ReadUnixDateTime(scope.get().start + col.getOffset()).clone()); + return Result.Success; + } + + @Override + public Result ReadSparse(RefObject b, RefObject edit, + OutObject value) { + Result result = PrepareSparseRead(b, edit, this.LayoutCode); + if (result != Result.Success) { + value.set(null); + return result; + } + + value.set(b.get().ReadSparseUnixDateTime(edit).clone()); + return Result.Success; + } + + @Override + public Result WriteFixed(RefObject b, RefObject scope, LayoutColumn col, + UnixDateTime value) { + checkArgument(scope.get().scopeType instanceof LayoutUDT); + if (scope.get().immutable) { + return Result.InsufficientPermissions; + } + + b.get().WriteUnixDateTime(scope.get().start + col.getOffset(), value.clone()); + b.get().SetBit(scope.get().start, col.getNullBit().clone()); + return Result.Success; + } + + //C# TO JAVA CONVERTER NOTE: Java does not support optional parameters. Overloaded method(s) are created above: + //ORIGINAL LINE: public override Result WriteSparse(ref RowBuffer b, ref RowCursor edit, UnixDateTime value, + // UpdateOptions options = UpdateOptions.Upsert) + @Override + public Result WriteSparse(RefObject b, RefObject edit, UnixDateTime value + , UpdateOptions options) { + Result result = PrepareSparseWrite(b, edit, this.getTypeArg().clone(), options); + if (result != Result.Success) { + return result; + } + + b.get().WriteSparseUnixDateTime(edit, value.clone(), options); + return Result.Success; + } + + @Override + public Result WriteSparse(RefObject b, RefObject edit, UnixDateTime value) { + return WriteSparse(b, edit, value, UpdateOptions.Upsert); + } +} \ No newline at end of file diff --git a/jre/src/main/java/com/azure/data/cosmos/serialization/hybridrow/layouts/LayoutUtf8.java b/jre/src/main/java/com/azure/data/cosmos/serialization/hybridrow/layouts/LayoutUtf8.java new file mode 100644 index 0000000..24bcf25 --- /dev/null +++ b/jre/src/main/java/com/azure/data/cosmos/serialization/hybridrow/layouts/LayoutUtf8.java @@ -0,0 +1,190 @@ +//------------------------------------------------------------ +// Copyright (c) Microsoft Corporation. All rights reserved. +//------------------------------------------------------------ + +package com.azure.data.cosmos.serialization.hybridrow.layouts; + +import com.azure.data.cosmos.core.OutObject; +import com.azure.data.cosmos.core.RefObject; +import com.azure.data.cosmos.serialization.hybridrow.Result; +import com.azure.data.cosmos.serialization.hybridrow.RowBuffer; +import com.azure.data.cosmos.serialization.hybridrow.RowCursor; + +import static com.google.common.base.Preconditions.checkArgument; + +public final class LayoutUtf8 extends LayoutType implements ILayoutUtf8SpanWritable, ILayoutUtf8SpanReadable { + public LayoutUtf8() { + super(com.azure.data.cosmos.serialization.hybridrow.layouts.LayoutCode.Utf8, 0); + } + + @Override + public boolean getIsFixed() { + return false; + } + + @Override + public String getName() { + return "utf8"; + } + + @Override + public Result ReadFixed(RefObject b, RefObject scope, LayoutColumn col, + OutObject value) { + Utf8Span span; + // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'out' keyword - these + // cannot be converted using the 'OutObject' helper class unless the method is within the code being modified: + Result r = this.ReadFixed(b, scope, col, out span); + value.set((r == Result.Success) ? span.toString() :) + default + return r; + } + + public Result ReadFixed(RefObject b, RefObject scope, LayoutColumn col, + OutObject value) { + checkArgument(scope.get().scopeType instanceof LayoutUDT); + checkArgument(col.getSize() >= 0); + if (!b.get().ReadBit(scope.get().start, col.getNullBit().clone())) { + value.set(null); + return Result.NotFound; + } + + value.set(b.get().ReadFixedString(scope.get().start + col.getOffset(), col.getSize())); + return Result.Success; + } + + @Override + public Result ReadSparse(RefObject b, RefObject edit, + OutObject value) { + Utf8Span span; + // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'out' keyword - these + // cannot be converted using the 'OutObject' helper class unless the method is within the code being modified: + Result r = this.ReadSparse(b, edit, out span); + value.set((r == Result.Success) ? span.toString() :) + default + return r; + } + + public Result ReadSparse(RefObject b, RefObject edit, OutObject value) { + Result result = LayoutType.PrepareSparseRead(b, edit, this.LayoutCode); + if (result != Result.Success) { + value.set(null); + return result; + } + + value.set(b.get().ReadSparseString(edit)); + return Result.Success; + } + + @Override + public Result ReadVariable(RefObject b, RefObject scope, LayoutColumn col + , OutObject value) { + Utf8Span span; + // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'out' keyword - these + // cannot be converted using the 'OutObject' helper class unless the method is within the code being modified: + Result r = this.ReadVariable(b, scope, col, out span); + value.set((r == Result.Success) ? span.toString() :) + default + return r; + } + + public Result ReadVariable(RefObject b, RefObject scope, LayoutColumn col + , OutObject value) { + checkArgument(scope.get().scopeType instanceof LayoutUDT); + if (!b.get().ReadBit(scope.get().start, col.getNullBit().clone())) { + value.set(null); + return Result.NotFound; + } + + int varOffset = b.get().ComputeVariableValueOffset(scope.get().layout, scope.get().start, + col.getOffset()); + value.set(b.get().ReadVariableString(varOffset)); + return Result.Success; + } + + @Override + public Result WriteFixed(RefObject b, RefObject scope, LayoutColumn col, + String value) { + checkArgument(value != null); + return this.WriteFixed(b, scope, col, Utf8Span.TranscodeUtf16(value)); + } + + public Result WriteFixed(RefObject b, RefObject scope, LayoutColumn col, + Utf8Span value) { + checkArgument(scope.get().scopeType instanceof LayoutUDT); + checkArgument(col.getSize() >= 0); + checkArgument(value.Length == col.getSize()); + if (scope.get().immutable) { + return Result.InsufficientPermissions; + } + + b.get().WriteFixedString(scope.get().start + col.getOffset(), value); + b.get().SetBit(scope.get().start, col.getNullBit().clone()); + return Result.Success; + } + + @Override + public Result WriteSparse(RefObject b, RefObject edit, String value) { + return WriteSparse(b, edit, value, UpdateOptions.Upsert); + } + + //C# TO JAVA CONVERTER NOTE: Java does not support optional parameters. Overloaded method(s) are created above: + //ORIGINAL LINE: public override Result WriteSparse(ref RowBuffer b, ref RowCursor edit, string value, + // UpdateOptions options = UpdateOptions.Upsert) + @Override + public Result WriteSparse(RefObject b, RefObject edit, String value, + UpdateOptions options) { + checkArgument(value != null); + return this.WriteSparse(b, edit, Utf8Span.TranscodeUtf16(value), options); + } + + + public Result WriteSparse(RefObject b, RefObject edit, Utf8Span value) { + return WriteSparse(b, edit, value, UpdateOptions.Upsert); + } + + //C# TO JAVA CONVERTER NOTE: Java does not support optional parameters. Overloaded method(s) are created above: + //ORIGINAL LINE: public Result WriteSparse(ref RowBuffer b, ref RowCursor edit, Utf8Span value, UpdateOptions + // options = UpdateOptions.Upsert) + public Result WriteSparse(RefObject b, RefObject edit, Utf8Span value, + UpdateOptions options) { + Result result = LayoutType.PrepareSparseWrite(b, edit, this.getTypeArg().clone(), options); + if (result != Result.Success) { + return result; + } + + b.get().WriteSparseString(edit, value, options); + return Result.Success; + } + + @Override + public Result WriteVariable(RefObject b, RefObject scope, + LayoutColumn col, String value) { + checkArgument(value != null); + return this.WriteVariable(b, scope, col, Utf8Span.TranscodeUtf16(value)); + } + + public Result WriteVariable(RefObject b, RefObject scope, + LayoutColumn col, Utf8Span value) { + checkArgument(scope.get().scopeType instanceof LayoutUDT); + if (scope.get().immutable) { + return Result.InsufficientPermissions; + } + + int length = value.Length; + if ((col.getSize() > 0) && (length > col.getSize())) { + return Result.TooBig; + } + + boolean exists = b.get().ReadBit(scope.get().start, col.getNullBit().clone()); + int varOffset = b.get().ComputeVariableValueOffset(scope.get().layout, scope.get().start, + col.getOffset()); + int shift; + OutObject tempOut_shift = new OutObject(); + b.get().WriteVariableString(varOffset, value, exists, tempOut_shift); + shift = tempOut_shift.get(); + b.get().SetBit(scope.get().start, col.getNullBit().clone()); + scope.get().metaOffset += shift; + scope.get().valueOffset += shift; + return Result.Success; + } +} \ No newline at end of file diff --git a/jre/src/main/java/com/azure/data/cosmos/serialization/hybridrow/layouts/LayoutVarInt.java b/jre/src/main/java/com/azure/data/cosmos/serialization/hybridrow/layouts/LayoutVarInt.java new file mode 100644 index 0000000..5cf49e7 --- /dev/null +++ b/jre/src/main/java/com/azure/data/cosmos/serialization/hybridrow/layouts/LayoutVarInt.java @@ -0,0 +1,116 @@ +//------------------------------------------------------------ +// Copyright (c) Microsoft Corporation. All rights reserved. +//------------------------------------------------------------ + +package com.azure.data.cosmos.serialization.hybridrow.layouts; + +import com.azure.data.cosmos.core.OutObject; +import com.azure.data.cosmos.core.RefObject; +import com.azure.data.cosmos.serialization.hybridrow.Result; +import com.azure.data.cosmos.serialization.hybridrow.RowBuffer; +import com.azure.data.cosmos.serialization.hybridrow.RowCursor; + +import static com.google.common.base.Preconditions.checkArgument; + +public final class LayoutVarInt extends LayoutType { + public LayoutVarInt() { + super(com.azure.data.cosmos.serialization.hybridrow.layouts.LayoutCode.VarInt, 0); + } + + @Override + public boolean getIsFixed() { + return false; + } + + @Override + public boolean getIsVarint() { + return true; + } + + @Override + public String getName() { + return "varint"; + } + + @Override + public Result ReadFixed(RefObject b, RefObject scope, LayoutColumn col, + OutObject value) { + Contract.Fail("Not Implemented"); + value.set(0); + return Result.Failure; + } + + @Override + public Result ReadSparse(RefObject b, RefObject edit, OutObject value) { + Result result = LayoutType.PrepareSparseRead(b, edit, this.LayoutCode); + if (result != Result.Success) { + value.set(0); + return result; + } + + value.set(b.get().ReadSparseVarInt(edit)); + return Result.Success; + } + + @Override + public Result ReadVariable(RefObject b, RefObject scope, LayoutColumn col, OutObject value) { + checkArgument(scope.get().scopeType instanceof LayoutUDT); + if (!b.get().ReadBit(scope.get().start, col.getNullBit().clone())) { + value.set(0); + return Result.NotFound; + } + + int varOffset = b.get().ComputeVariableValueOffset(scope.get().layout, scope.get().start, + col.getOffset()); + value.set(b.get().ReadVariableInt(varOffset)); + return Result.Success; + } + + @Override + public Result WriteFixed(RefObject b, RefObject scope, LayoutColumn col, + long value) { + Contract.Fail("Not Implemented"); + return Result.Failure; + } + + //C# TO JAVA CONVERTER NOTE: Java does not support optional parameters. Overloaded method(s) are created above: + //ORIGINAL LINE: public override Result WriteSparse(ref RowBuffer b, ref RowCursor edit, long value, + // UpdateOptions options = UpdateOptions.Upsert) + @Override + public Result WriteSparse(RefObject b, RefObject edit, long value, + UpdateOptions options) { + Result result = LayoutType.PrepareSparseWrite(b, edit, this.getTypeArg().clone(), options); + if (result != Result.Success) { + return result; + } + + b.get().WriteSparseVarInt(edit, value, options); + return Result.Success; + } + + @Override + public Result WriteSparse(RefObject b, RefObject edit, long value) { + return WriteSparse(b, edit, value, UpdateOptions.Upsert); + } + + @Override + public Result WriteVariable(RefObject b, RefObject scope, + LayoutColumn col, long value) { + checkArgument(scope.get().scopeType instanceof LayoutUDT); + if (scope.get().immutable) { + return Result.InsufficientPermissions; + } + + boolean exists = b.get().ReadBit(scope.get().start, col.getNullBit().clone()); + int varOffset = b.get().ComputeVariableValueOffset(scope.get().layout, scope.get().start, + col.getOffset()); + int shift; + OutObject tempOut_shift = new OutObject(); + b.get().WriteVariableInt(varOffset, value, exists, tempOut_shift); + shift = tempOut_shift.get(); + b.get().SetBit(scope.get().start, col.getNullBit().clone()); + scope.get().metaOffset += shift; + scope.get().valueOffset += shift; + return Result.Success; + } +} \ No newline at end of file diff --git a/jre/src/main/java/azure/data/cosmos/serialization/hybridrow/layouts/LayoutVarUInt.java b/jre/src/main/java/com/azure/data/cosmos/serialization/hybridrow/layouts/LayoutVarUInt.java similarity index 53% rename from jre/src/main/java/azure/data/cosmos/serialization/hybridrow/layouts/LayoutVarUInt.java rename to jre/src/main/java/com/azure/data/cosmos/serialization/hybridrow/layouts/LayoutVarUInt.java index 63b45f0..32d6fd0 100644 --- a/jre/src/main/java/azure/data/cosmos/serialization/hybridrow/layouts/LayoutVarUInt.java +++ b/jre/src/main/java/com/azure/data/cosmos/serialization/hybridrow/layouts/LayoutVarUInt.java @@ -2,11 +2,13 @@ // Copyright (c) Microsoft Corporation. All rights reserved. //------------------------------------------------------------ -package azure.data.cosmos.serialization.hybridrow.layouts; +package com.azure.data.cosmos.serialization.hybridrow.layouts; -import azure.data.cosmos.serialization.hybridrow.Result; -import azure.data.cosmos.serialization.hybridrow.RowBuffer; -import azure.data.cosmos.serialization.hybridrow.RowCursor; +import com.azure.data.cosmos.core.OutObject; +import com.azure.data.cosmos.core.RefObject; +import com.azure.data.cosmos.serialization.hybridrow.Result; +import com.azure.data.cosmos.serialization.hybridrow.RowBuffer; +import com.azure.data.cosmos.serialization.hybridrow.RowCursor; import static com.google.common.base.Preconditions.checkArgument; @@ -14,7 +16,7 @@ import static com.google.common.base.Preconditions.checkArgument; //ORIGINAL LINE: public sealed class LayoutVarUInt : LayoutType public final class LayoutVarUInt extends LayoutType { public LayoutVarUInt() { - super(azure.data.cosmos.serialization.hybridrow.layouts.LayoutCode.VarUInt, 0); + super(com.azure.data.cosmos.serialization.hybridrow.layouts.LayoutCode.VarUInt, 0); } @Override @@ -36,24 +38,24 @@ public final class LayoutVarUInt extends LayoutType { //ORIGINAL LINE: public override Result ReadFixed(ref RowBuffer b, ref RowCursor scope, LayoutColumn col, out // ulong value) @Override - public Result ReadFixed(tangible.RefObject b, tangible.RefObject scope, LayoutColumn col, - tangible.OutObject value) { + public Result ReadFixed(RefObject b, RefObject scope, LayoutColumn col, + OutObject value) { Contract.Fail("Not Implemented"); - value.argValue = 0; + value.set(0); return Result.Failure; } //C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java: //ORIGINAL LINE: public override Result ReadSparse(ref RowBuffer b, ref RowCursor edit, out ulong value) @Override - public Result ReadSparse(tangible.RefObject b, tangible.RefObject edit, tangible.OutObject value) { - Result result = LayoutType.PrepareSparseRead(b, edit, this.LayoutCode); + public Result ReadSparse(RefObject b, RefObject edit, OutObject value) { + Result result = PrepareSparseRead(b, edit, this.LayoutCode); if (result != Result.Success) { - value.argValue = 0; + value.set(0); return result; } - value.argValue = b.argValue.ReadSparseVarUInt(edit); + value.set(b.get().ReadSparseVarUInt(edit)); return Result.Success; } @@ -61,16 +63,16 @@ public final class LayoutVarUInt extends LayoutType { //ORIGINAL LINE: public override Result ReadVariable(ref RowBuffer b, ref RowCursor scope, LayoutColumn col, out // ulong value) @Override - public Result ReadVariable(tangible.RefObject b, tangible.RefObject scope, LayoutColumn col, tangible.OutObject value) { - checkArgument(scope.argValue.scopeType instanceof LayoutUDT); - if (!b.argValue.ReadBit(scope.argValue.start, col.getNullBit().clone())) { - value.argValue = 0; + public Result ReadVariable(RefObject b, RefObject scope, LayoutColumn col, OutObject value) { + checkArgument(scope.get().scopeType instanceof LayoutUDT); + if (!b.get().ReadBit(scope.get().start, col.getNullBit().clone())) { + value.set(0); return Result.NotFound; } - int varOffset = b.argValue.ComputeVariableValueOffset(scope.argValue.layout, scope.argValue.start, + int varOffset = b.get().ComputeVariableValueOffset(scope.get().layout, scope.get().start, col.getOffset()); - value.argValue = b.argValue.ReadVariableUInt(varOffset); + value.set(b.get().ReadVariableUInt(varOffset)); return Result.Success; } @@ -78,7 +80,7 @@ public final class LayoutVarUInt extends LayoutType { //ORIGINAL LINE: public override Result WriteFixed(ref RowBuffer b, ref RowCursor scope, LayoutColumn col, ulong // value) @Override - public Result WriteFixed(tangible.RefObject b, tangible.RefObject scope, LayoutColumn col, + public Result WriteFixed(RefObject b, RefObject scope, LayoutColumn col, long value) { Contract.Fail("Not Implemented"); return Result.Failure; @@ -89,19 +91,19 @@ public final class LayoutVarUInt extends LayoutType { // UpdateOptions options = UpdateOptions.Upsert) //C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java: @Override - public Result WriteSparse(tangible.RefObject b, tangible.RefObject edit, long value, + public Result WriteSparse(RefObject b, RefObject edit, long value, UpdateOptions options) { - Result result = LayoutType.PrepareSparseWrite(b, edit, this.getTypeArg().clone(), options); + Result result = PrepareSparseWrite(b, edit, this.getTypeArg().clone(), options); if (result != Result.Success) { return result; } - b.argValue.WriteSparseVarUInt(edit, value, options); + b.get().WriteSparseVarUInt(edit, value, options); return Result.Success; } @Override - public Result WriteSparse(tangible.RefObject b, tangible.RefObject edit, long value) { + public Result WriteSparse(RefObject b, RefObject edit, long value) { return WriteSparse(b, edit, value, UpdateOptions.Upsert); } @@ -109,23 +111,23 @@ public final class LayoutVarUInt extends LayoutType { //ORIGINAL LINE: public override Result WriteVariable(ref RowBuffer b, ref RowCursor scope, LayoutColumn col, // ulong value) @Override - public Result WriteVariable(tangible.RefObject b, tangible.RefObject scope, + public Result WriteVariable(RefObject b, RefObject scope, LayoutColumn col, long value) { - Contract.Requires(scope.argValue.scopeType instanceof LayoutUDT); - if (scope.argValue.immutable) { + checkArgument(scope.get().scopeType instanceof LayoutUDT); + if (scope.get().immutable) { return Result.InsufficientPermissions; } - boolean exists = b.argValue.ReadBit(scope.argValue.start, col.getNullBit().clone()); - int varOffset = b.argValue.ComputeVariableValueOffset(scope.argValue.layout, scope.argValue.start, + boolean exists = b.get().ReadBit(scope.get().start, col.getNullBit().clone()); + int varOffset = b.get().ComputeVariableValueOffset(scope.get().layout, scope.get().start, col.getOffset()); int shift; - tangible.OutObject tempOut_shift = new tangible.OutObject(); - b.argValue.WriteVariableUInt(varOffset, value, exists, tempOut_shift); - shift = tempOut_shift.argValue; - b.argValue.SetBit(scope.argValue.start, col.getNullBit().clone()); - scope.argValue.metaOffset += shift; - scope.argValue.valueOffset += shift; + OutObject tempOut_shift = new OutObject(); + b.get().WriteVariableUInt(varOffset, value, exists, tempOut_shift); + shift = tempOut_shift.get(); + b.get().SetBit(scope.get().start, col.getNullBit().clone()); + scope.get().metaOffset += shift; + scope.get().valueOffset += shift; return Result.Success; } } \ No newline at end of file diff --git a/jre/src/main/java/azure/data/cosmos/serialization/hybridrow/layouts/SamplingStringComparer.java b/jre/src/main/java/com/azure/data/cosmos/serialization/hybridrow/layouts/SamplingStringComparer.java similarity index 88% rename from jre/src/main/java/azure/data/cosmos/serialization/hybridrow/layouts/SamplingStringComparer.java rename to jre/src/main/java/com/azure/data/cosmos/serialization/hybridrow/layouts/SamplingStringComparer.java index c11ad88..c4cb259 100644 --- a/jre/src/main/java/azure/data/cosmos/serialization/hybridrow/layouts/SamplingStringComparer.java +++ b/jre/src/main/java/com/azure/data/cosmos/serialization/hybridrow/layouts/SamplingStringComparer.java @@ -2,20 +2,20 @@ // Copyright (c) Microsoft Corporation. All rights reserved. //------------------------------------------------------------ -package azure.data.cosmos.serialization.hybridrow.layouts; +package com.azure.data.cosmos.serialization.hybridrow.layouts; public class SamplingStringComparer implements IEqualityComparer { public static final SamplingStringComparer Default = new SamplingStringComparer(); public final boolean equals(String x, String y) { - Contract.Assert(x != null); - Contract.Assert(y != null); + checkArgument(x != null); + checkArgument(y != null); return x.equals(y); } public final int hashCode(String obj) { - Contract.Assert(obj != null); + checkArgument(obj != null); // TODO: C# TO JAVA CONVERTER: There is no equivalent to an 'unchecked' block in Java: unchecked diff --git a/jre/src/main/java/azure/data/cosmos/serialization/hybridrow/layouts/SamplingUtf8StringComparer.java b/jre/src/main/java/com/azure/data/cosmos/serialization/hybridrow/layouts/SamplingUtf8StringComparer.java similarity index 89% rename from jre/src/main/java/azure/data/cosmos/serialization/hybridrow/layouts/SamplingUtf8StringComparer.java rename to jre/src/main/java/com/azure/data/cosmos/serialization/hybridrow/layouts/SamplingUtf8StringComparer.java index f7a04cc..c014147 100644 --- a/jre/src/main/java/azure/data/cosmos/serialization/hybridrow/layouts/SamplingUtf8StringComparer.java +++ b/jre/src/main/java/com/azure/data/cosmos/serialization/hybridrow/layouts/SamplingUtf8StringComparer.java @@ -2,20 +2,20 @@ // Copyright (c) Microsoft Corporation. All rights reserved. //------------------------------------------------------------ -package azure.data.cosmos.serialization.hybridrow.layouts; +package com.azure.data.cosmos.serialization.hybridrow.layouts; public class SamplingUtf8StringComparer implements IEqualityComparer { public static final SamplingUtf8StringComparer Default = new SamplingUtf8StringComparer(); public final boolean equals(Utf8String x, Utf8String y) { - Contract.Assert(x != null); - Contract.Assert(y != null); + checkArgument(x != null); + checkArgument(y != null); return x.Span.equals(y.Span); } public final int hashCode(Utf8String obj) { - Contract.Assert(obj != null); + checkArgument(obj != null); // TODO: C# TO JAVA CONVERTER: There is no equivalent to an 'unchecked' block in Java: unchecked diff --git a/jre/src/main/java/azure/data/cosmos/serialization/hybridrow/layouts/StringToken.java b/jre/src/main/java/com/azure/data/cosmos/serialization/hybridrow/layouts/StringToken.java similarity index 96% rename from jre/src/main/java/azure/data/cosmos/serialization/hybridrow/layouts/StringToken.java rename to jre/src/main/java/com/azure/data/cosmos/serialization/hybridrow/layouts/StringToken.java index 273a1b1..c8ae1df 100644 --- a/jre/src/main/java/azure/data/cosmos/serialization/hybridrow/layouts/StringToken.java +++ b/jre/src/main/java/com/azure/data/cosmos/serialization/hybridrow/layouts/StringToken.java @@ -2,7 +2,7 @@ // Copyright (c) Microsoft Corporation. All rights reserved. //------------------------------------------------------------ -package azure.data.cosmos.serialization.hybridrow.layouts; +package com.azure.data.cosmos.serialization.hybridrow.layouts; //C# TO JAVA CONVERTER WARNING: Java does not allow user-defined value types. The behavior of this class may differ // from the original: diff --git a/jre/src/main/java/azure/data/cosmos/serialization/hybridrow/layouts/StringTokenizer.java b/jre/src/main/java/com/azure/data/cosmos/serialization/hybridrow/layouts/StringTokenizer.java similarity index 83% rename from jre/src/main/java/azure/data/cosmos/serialization/hybridrow/layouts/StringTokenizer.java rename to jre/src/main/java/com/azure/data/cosmos/serialization/hybridrow/layouts/StringTokenizer.java index 1fa74ca..48b5edc 100644 --- a/jre/src/main/java/azure/data/cosmos/serialization/hybridrow/layouts/StringTokenizer.java +++ b/jre/src/main/java/com/azure/data/cosmos/serialization/hybridrow/layouts/StringTokenizer.java @@ -2,7 +2,9 @@ // Copyright (c) Microsoft Corporation. All rights reserved. //------------------------------------------------------------ -package azure.data.cosmos.serialization.hybridrow.layouts; +package com.azure.data.cosmos.serialization.hybridrow.layouts; + +import com.azure.data.cosmos.core.OutObject; import java.util.ArrayList; import java.util.Arrays; @@ -46,7 +48,7 @@ public final class StringTokenizer { * @return The token assigned to the string. */ public StringToken Add(Utf8String path) { - Contract.Requires(path != null); + checkArgument(path != null); StringToken token; if (this.tokens.containsKey(path) && (token = this.tokens.get(path)) == token) { @@ -66,15 +68,15 @@ public final class StringTokenizer { */ //C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java: //ORIGINAL LINE: public bool TryFindString(ulong token, out Utf8String path) - public boolean TryFindString(long token, tangible.OutObject path) { + public boolean TryFindString(long token, OutObject path) { //C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java: //ORIGINAL LINE: if (token >= (ulong)this.strings.Count) if (token >= (long)this.strings.size()) { - path.argValue = null; + path.set(null); return false; } - path.argValue = this.strings.get((int)token); + path.set(this.strings.get((int)token)); return true; } @@ -85,19 +87,17 @@ public final class StringTokenizer { * @param token If successful, the string's assigned token. * @return True if successful, false otherwise. */ - public boolean TryFindToken(UtfAnyString path, tangible.OutObject token) { + public boolean TryFindToken(UtfAnyString path, OutObject token) { if (path.IsNull) { - token.argValue = null; + token.set(null); return false; } if (path.IsUtf8) { - return (this.tokens.containsKey(path.ToUtf8String()) && (token.argValue = - this.tokens.get(path.ToUtf8String())) == token.argValue); + return (this.tokens.containsKey(path.ToUtf8String()) && (token.set(this.tokens.get(path.ToUtf8String()))) == token.get()); } - return (this.stringTokens.containsKey(path.toString()) && (token.argValue = - this.stringTokens.get(path.toString())) == token.argValue); + return (this.stringTokens.containsKey(path.toString()) && (token.set(this.stringTokens.get(path.toString()))) == token.get()); } /** @@ -117,7 +117,7 @@ public final class StringTokenizer { this.strings.add(path); //C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java: //ORIGINAL LINE: Contract.Assert((ulong)this.strings.Count - 1 == id); - Contract.Assert((long)this.strings.size() - 1 == id); + checkState((long)this.strings.size() - 1 == id); return token.clone(); } } \ No newline at end of file diff --git a/jre/src/main/java/azure/data/cosmos/serialization/hybridrow/layouts/SystemSchema.java b/jre/src/main/java/com/azure/data/cosmos/serialization/hybridrow/layouts/SystemSchema.java similarity index 92% rename from jre/src/main/java/azure/data/cosmos/serialization/hybridrow/layouts/SystemSchema.java rename to jre/src/main/java/com/azure/data/cosmos/serialization/hybridrow/layouts/SystemSchema.java index 2673810..a50cbc8 100644 --- a/jre/src/main/java/azure/data/cosmos/serialization/hybridrow/layouts/SystemSchema.java +++ b/jre/src/main/java/com/azure/data/cosmos/serialization/hybridrow/layouts/SystemSchema.java @@ -2,9 +2,9 @@ // Copyright (c) Microsoft Corporation. All rights reserved. //------------------------------------------------------------ -package azure.data.cosmos.serialization.hybridrow.layouts; +package com.azure.data.cosmos.serialization.hybridrow.layouts; -import azure.data.cosmos.serialization.hybridrow.SchemaId; +import com.azure.data.cosmos.serialization.hybridrow.SchemaId; public final class SystemSchema { /** diff --git a/jre/src/main/java/azure/data/cosmos/serialization/hybridrow/layouts/TypeArgument.java b/jre/src/main/java/com/azure/data/cosmos/serialization/hybridrow/layouts/TypeArgument.java similarity index 95% rename from jre/src/main/java/azure/data/cosmos/serialization/hybridrow/layouts/TypeArgument.java rename to jre/src/main/java/com/azure/data/cosmos/serialization/hybridrow/layouts/TypeArgument.java index 223190a..8cb7b45 100644 --- a/jre/src/main/java/azure/data/cosmos/serialization/hybridrow/layouts/TypeArgument.java +++ b/jre/src/main/java/com/azure/data/cosmos/serialization/hybridrow/layouts/TypeArgument.java @@ -2,7 +2,7 @@ // Copyright (c) Microsoft Corporation. All rights reserved. //------------------------------------------------------------ -package azure.data.cosmos.serialization.hybridrow.layouts; +package com.azure.data.cosmos.serialization.hybridrow.layouts; import static com.google.common.base.Preconditions.checkArgument; diff --git a/jre/src/main/java/azure/data/cosmos/serialization/hybridrow/layouts/TypeArgumentList.java b/jre/src/main/java/com/azure/data/cosmos/serialization/hybridrow/layouts/TypeArgumentList.java similarity index 92% rename from jre/src/main/java/azure/data/cosmos/serialization/hybridrow/layouts/TypeArgumentList.java rename to jre/src/main/java/com/azure/data/cosmos/serialization/hybridrow/layouts/TypeArgumentList.java index 51ca94b..1439b7a 100644 --- a/jre/src/main/java/azure/data/cosmos/serialization/hybridrow/layouts/TypeArgumentList.java +++ b/jre/src/main/java/com/azure/data/cosmos/serialization/hybridrow/layouts/TypeArgumentList.java @@ -2,9 +2,9 @@ // Copyright (c) Microsoft Corporation. All rights reserved. //------------------------------------------------------------ -package azure.data.cosmos.serialization.hybridrow.layouts; +package com.azure.data.cosmos.serialization.hybridrow.layouts; -import azure.data.cosmos.serialization.hybridrow.SchemaId; +import com.azure.data.cosmos.serialization.hybridrow.SchemaId; import static com.google.common.base.Preconditions.checkArgument; @@ -80,7 +80,7 @@ public final class TypeArgumentList implements IEquatable { public boolean equals(TypeArgumentList other) { //C# TO JAVA CONVERTER WARNING: Java Arrays.equals is not always identical to LINQ 'SequenceEqual': //ORIGINAL LINE: return (this.schemaId == other.schemaId) && this.args.SequenceEqual(other.args); - return (azure.data.cosmos.serialization.hybridrow.SchemaId.opEquals(this.schemaId.clone(), + return (SchemaId.opEquals(this.schemaId.clone(), other.schemaId.clone())) && Arrays.equals(this.args, other.args); } @@ -128,7 +128,7 @@ public final class TypeArgumentList implements IEquatable { @Override public String toString() { - if (azure.data.cosmos.serialization.hybridrow.SchemaId.opNotEquals(this.schemaId.clone(), + if (SchemaId.opNotEquals(this.schemaId.clone(), getSchemaId().Invalid)) { return String.format("<%1$s>", this.schemaId.toString()); } diff --git a/jre/src/main/java/azure/data/cosmos/serialization/hybridrow/layouts/UpdateOptions.java b/jre/src/main/java/com/azure/data/cosmos/serialization/hybridrow/layouts/UpdateOptions.java similarity index 94% rename from jre/src/main/java/azure/data/cosmos/serialization/hybridrow/layouts/UpdateOptions.java rename to jre/src/main/java/com/azure/data/cosmos/serialization/hybridrow/layouts/UpdateOptions.java index d8b5ea6..412d559 100644 --- a/jre/src/main/java/azure/data/cosmos/serialization/hybridrow/layouts/UpdateOptions.java +++ b/jre/src/main/java/com/azure/data/cosmos/serialization/hybridrow/layouts/UpdateOptions.java @@ -2,7 +2,7 @@ // Copyright (c) Microsoft Corporation. All rights reserved. //------------------------------------------------------------ -package azure.data.cosmos.serialization.hybridrow.layouts; +package com.azure.data.cosmos.serialization.hybridrow.layouts; /** * Describes the desired behavior when writing a . diff --git a/jre/src/main/java/azure/data/cosmos/serialization/hybridrow/recordio/Record.java b/jre/src/main/java/com/azure/data/cosmos/serialization/hybridrow/recordio/Record.java similarity index 92% rename from jre/src/main/java/azure/data/cosmos/serialization/hybridrow/recordio/Record.java rename to jre/src/main/java/com/azure/data/cosmos/serialization/hybridrow/recordio/Record.java index 403bb3d..ed2c417 100644 --- a/jre/src/main/java/azure/data/cosmos/serialization/hybridrow/recordio/Record.java +++ b/jre/src/main/java/com/azure/data/cosmos/serialization/hybridrow/recordio/Record.java @@ -2,7 +2,7 @@ // Copyright (c) Microsoft Corporation. All rights reserved. //------------------------------------------------------------ -package azure.data.cosmos.serialization.hybridrow.recordio; +package com.azure.data.cosmos.serialization.hybridrow.recordio; // TODO: C# TO JAVA CONVERTER: There is no preprocessor in Java: ///#pragma warning disable CA1051 // Do not declare visible instance fields diff --git a/jre/src/main/java/azure/data/cosmos/serialization/hybridrow/recordio/RecordIOFormatter.java b/jre/src/main/java/com/azure/data/cosmos/serialization/hybridrow/recordio/RecordIOFormatter.java similarity index 78% rename from jre/src/main/java/azure/data/cosmos/serialization/hybridrow/recordio/RecordIOFormatter.java rename to jre/src/main/java/com/azure/data/cosmos/serialization/hybridrow/recordio/RecordIOFormatter.java index 2289853..6245a57 100644 --- a/jre/src/main/java/azure/data/cosmos/serialization/hybridrow/recordio/RecordIOFormatter.java +++ b/jre/src/main/java/com/azure/data/cosmos/serialization/hybridrow/recordio/RecordIOFormatter.java @@ -2,20 +2,20 @@ // Copyright (c) Microsoft Corporation. All rights reserved. //------------------------------------------------------------ -package azure.data.cosmos.serialization.hybridrow.recordio; +package com.azure.data.cosmos.serialization.hybridrow.recordio; -import azure.data.cosmos.serialization.hybridrow.DefaultSpanResizer; -import azure.data.cosmos.serialization.hybridrow.HybridRowHeader; -import azure.data.cosmos.serialization.hybridrow.HybridRowVersion; -import azure.data.cosmos.serialization.hybridrow.ISpanResizer; -import azure.data.cosmos.serialization.hybridrow.Result; -import azure.data.cosmos.serialization.hybridrow.RowBuffer; +import com.azure.data.cosmos.core.OutObject; +import com.azure.data.cosmos.serialization.hybridrow.HybridRowHeader; +import com.azure.data.cosmos.serialization.hybridrow.HybridRowVersion; +import com.azure.data.cosmos.serialization.hybridrow.ISpanResizer; +import com.azure.data.cosmos.serialization.hybridrow.Result; +import com.azure.data.cosmos.serialization.hybridrow.RowBuffer; public final class RecordIOFormatter { public static final Layout RecordLayout = SystemSchema.LayoutResolver.Resolve(SystemSchema.RecordSchemaId); public static final Layout SegmentLayout = SystemSchema.LayoutResolver.Resolve(SystemSchema.SegmentSchemaId); - public static Result FormatRecord(ReadOnlyMemory body, tangible.OutObject row) { + public static Result FormatRecord(ReadOnlyMemory body, OutObject row) { return FormatRecord(body, row, null); } @@ -23,7 +23,7 @@ public final class RecordIOFormatter { //ORIGINAL LINE: public static Result FormatRecord(ReadOnlyMemory body, out RowBuffer row, // ISpanResizer resizer = default) //C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java: - public static Result FormatRecord(ReadOnlyMemory body, tangible.OutObject row, + public static Result FormatRecord(ReadOnlyMemory body, OutObject row, ISpanResizer resizer) { //C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java: //ORIGINAL LINE: resizer = resizer != null ? resizer : DefaultSpanResizer.Default; @@ -37,7 +37,7 @@ public final class RecordIOFormatter { RecordSerializer.Write, row.clone()); } - public static Result FormatSegment(Segment segment, tangible.OutObject row) { + public static Result FormatSegment(Segment segment, OutObject row) { return FormatSegment(segment, row, null); } @@ -45,7 +45,7 @@ public final class RecordIOFormatter { //ORIGINAL LINE: public static Result FormatSegment(Segment segment, out RowBuffer row, ISpanResizer // resizer = default) //C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java: - public static Result FormatSegment(Segment segment, tangible.OutObject row, ISpanResizer resizer) { + public static Result FormatSegment(Segment segment, OutObject row, ISpanResizer resizer) { //C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java: //ORIGINAL LINE: resizer = resizer != null ? resizer : DefaultSpanResizer.Default; resizer = resizer != null ? resizer : DefaultSpanResizer < Byte >.Default; @@ -62,12 +62,12 @@ public final class RecordIOFormatter { //ORIGINAL LINE: private static Result FormatObject(ISpanResizer resizer, int initialCapacity, Layout // layout, T obj, RowWriter.WriterFunc writer, out RowBuffer row) private static Result FormatObject(ISpanResizer resizer, int initialCapacity, Layout layout, T obj, - RowWriter.WriterFunc writer, tangible.OutObject row) { - row.argValue = new RowBuffer(initialCapacity, resizer); - row.argValue.InitLayout(HybridRowVersion.V1, layout, SystemSchema.LayoutResolver); + RowWriter.WriterFunc writer, OutObject row) { + row.set(new RowBuffer(initialCapacity, resizer)); + row.get().InitLayout(HybridRowVersion.V1, layout, SystemSchema.LayoutResolver); Result r = RowWriter.WriteBuffer(row.clone(), obj, writer); if (r != Result.Success) { - row.argValue = null; + row.set(null); return r; } diff --git a/jre/src/main/java/azure/data/cosmos/serialization/hybridrow/recordio/RecordIOParser.java b/jre/src/main/java/com/azure/data/cosmos/serialization/hybridrow/recordio/RecordIOParser.java similarity index 67% rename from jre/src/main/java/azure/data/cosmos/serialization/hybridrow/recordio/RecordIOParser.java rename to jre/src/main/java/com/azure/data/cosmos/serialization/hybridrow/recordio/RecordIOParser.java index 90f70ad..c4ca04f 100644 --- a/jre/src/main/java/azure/data/cosmos/serialization/hybridrow/recordio/RecordIOParser.java +++ b/jre/src/main/java/com/azure/data/cosmos/serialization/hybridrow/recordio/RecordIOParser.java @@ -2,14 +2,17 @@ // Copyright (c) Microsoft Corporation. All rights reserved. //------------------------------------------------------------ -package azure.data.cosmos.serialization.hybridrow.recordio; +package com.azure.data.cosmos.serialization.hybridrow.recordio; -import azure.data.cosmos.serialization.hybridrow.HybridRowHeader; -import azure.data.cosmos.serialization.hybridrow.HybridRowVersion; -import azure.data.cosmos.serialization.hybridrow.Result; -import azure.data.cosmos.serialization.hybridrow.RowBuffer; -import azure.data.cosmos.serialization.hybridrow.io.RowReader; -import azure.data.cosmos.serialization.hybridrow.layouts.SystemSchema; +import com.azure.data.cosmos.core.OutObject; +import com.azure.data.cosmos.core.RefObject; +import com.azure.data.cosmos.serialization.hybridrow.HybridRowHeader; +import com.azure.data.cosmos.serialization.hybridrow.HybridRowVersion; +import com.azure.data.cosmos.serialization.hybridrow.Result; +import com.azure.data.cosmos.serialization.hybridrow.RowBuffer; +import com.azure.data.cosmos.serialization.hybridrow.SchemaId; +import com.azure.data.cosmos.serialization.hybridrow.io.RowReader; +import com.azure.data.cosmos.serialization.hybridrow.layouts.SystemSchema; //C# TO JAVA CONVERTER WARNING: Java does not allow user-defined value types. The behavior of this class may differ // from the original: @@ -30,7 +33,7 @@ public final class RecordIOParser { * If a valid segment has been parsed then current active segment, otherwise undefined. */ public Segment getSegment() { - Contract.Requires(this.getHaveSegment()); + checkArgument(this.getHaveSegment()); return this.segment.clone(); } @@ -44,9 +47,9 @@ public final class RecordIOParser { * recommended that Process not be called again until at least this number of bytes are available. * @param consumed The number of bytes consumed from the input buffer. This number may be less * than the total buffer size if the parser moved to a new state. - * @return if no error + * @return if no error * has occurred, otherwise a valid - * of the last error encountered + * of the last error encountered * during parsing. *

* > @@ -54,15 +57,15 @@ public final class RecordIOParser { //C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java: //ORIGINAL LINE: public Result Process(Memory buffer, out ProductionType type, out Memory record, out // int need, out int consumed) - public Result Process(Memory buffer, tangible.OutObject type, - tangible.OutObject> record, tangible.OutObject need, - tangible.OutObject consumed) { + public Result Process(Memory buffer, OutObject type, + OutObject> record, OutObject need, + OutObject consumed) { Result r = Result.Failure; //C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java: //ORIGINAL LINE: Memory b = buffer; Memory b = buffer; - type.argValue = ProductionType.None; - record.argValue = null; + type.set(ProductionType.None); + record.set(null); switch (this.state) { case Start: this.state = State.NeedSegmentLength; @@ -70,8 +73,8 @@ public final class RecordIOParser { case NeedSegmentLength: { int minimalSegmentRowSize = HybridRowHeader.Size + RecordIOFormatter.SegmentLayout.getSize(); if (b.Length < minimalSegmentRowSize) { - need.argValue = minimalSegmentRowSize; - consumed.argValue = buffer.Length - b.Length; + need.set(minimalSegmentRowSize); + consumed.set(buffer.Length - b.Length); return Result.InsufficientBuffer; } @@ -79,17 +82,17 @@ public final class RecordIOParser { //ORIGINAL LINE: Span span = b.Span.Slice(0, minimalSegmentRowSize); Span span = b.Span.Slice(0, minimalSegmentRowSize); RowBuffer row = new RowBuffer(span, HybridRowVersion.V1, SystemSchema.LayoutResolver); - tangible.RefObject tempRef_row = - new tangible.RefObject(row); + RefObject tempRef_row = + new RefObject(row); RowReader reader = new RowReader(tempRef_row); - row = tempRef_row.argValue; - tangible.RefObject tempRef_reader = - new tangible.RefObject(reader); - tangible.OutObject tempOut_segment = - new tangible.OutObject(); + row = tempRef_row.get(); + RefObject tempRef_reader = + new RefObject(reader); + OutObject tempOut_segment = + new OutObject(); r = SegmentSerializer.Read(tempRef_reader, tempOut_segment); - this.segment = tempOut_segment.argValue; - reader = tempRef_reader.argValue; + this.segment = tempOut_segment.get(); + reader = tempRef_reader.get(); if (r != Result.Success) { break; } @@ -101,8 +104,8 @@ public final class RecordIOParser { case NeedSegment: { if (b.Length < this.segment.Length) { - need.argValue = this.segment.Length; - consumed.argValue = buffer.Length - b.Length; + need.set(this.segment.Length); + consumed.set(buffer.Length - b.Length); return Result.InsufficientBuffer; } @@ -110,34 +113,34 @@ public final class RecordIOParser { //ORIGINAL LINE: Span span = b.Span.Slice(0, this.segment.Length); Span span = b.Span.Slice(0, this.segment.Length); RowBuffer row = new RowBuffer(span, HybridRowVersion.V1, SystemSchema.LayoutResolver); - tangible.RefObject tempRef_row2 = - new tangible.RefObject(row); + RefObject tempRef_row2 = + new RefObject(row); RowReader reader = new RowReader(tempRef_row2); - row = tempRef_row2.argValue; - tangible.RefObject tempRef_reader2 = - new tangible.RefObject(reader); - tangible.OutObject tempOut_segment2 - = new tangible.OutObject(); + row = tempRef_row2.get(); + RefObject tempRef_reader2 = + new RefObject(reader); + OutObject tempOut_segment2 + = new OutObject(); r = SegmentSerializer.Read(tempRef_reader2, tempOut_segment2); - this.segment = tempOut_segment2.argValue; - reader = tempRef_reader2.argValue; + this.segment = tempOut_segment2.get(); + reader = tempRef_reader2.get(); if (r != Result.Success) { break; } - record.argValue = b.Slice(0, span.Length); + record.set(b.Slice(0, span.Length)); b = b.Slice(span.Length); - need.argValue = 0; + need.set(0); this.state = State.NeedHeader; - consumed.argValue = buffer.Length - b.Length; - type.argValue = ProductionType.Segment; + consumed.set(buffer.Length - b.Length); + type.set(ProductionType.Segment); return Result.Success; } case NeedHeader: { if (b.Length < HybridRowHeader.Size) { - need.argValue = HybridRowHeader.Size; - consumed.argValue = buffer.Length - b.Length; + need.set(HybridRowHeader.Size); + consumed.set(buffer.Length - b.Length); return Result.InsufficientBuffer; } @@ -151,13 +154,13 @@ public final class RecordIOParser { break; } - if (azure.data.cosmos.serialization.hybridrow.SchemaId.opEquals(header.SchemaId, + if (SchemaId.opEquals(header.SchemaId, SystemSchema.SegmentSchemaId)) { // TODO: C# TO JAVA CONVERTER: There is no 'goto' in Java: goto case State.NeedSegment } - if (azure.data.cosmos.serialization.hybridrow.SchemaId.opEquals(header.SchemaId, + if (SchemaId.opEquals(header.SchemaId, SystemSchema.RecordSchemaId)) { // TODO: C# TO JAVA CONVERTER: There is no 'goto' in Java: goto case State.NeedRecord @@ -170,8 +173,8 @@ public final class RecordIOParser { case NeedRecord: { int minimalRecordRowSize = HybridRowHeader.Size + RecordIOFormatter.RecordLayout.getSize(); if (b.Length < minimalRecordRowSize) { - need.argValue = minimalRecordRowSize; - consumed.argValue = buffer.Length - b.Length; + need.set(minimalRecordRowSize); + consumed.set(buffer.Length - b.Length); return Result.InsufficientBuffer; } @@ -179,15 +182,15 @@ public final class RecordIOParser { //ORIGINAL LINE: Span span = b.Span.Slice(0, minimalRecordRowSize); Span span = b.Span.Slice(0, minimalRecordRowSize); RowBuffer row = new RowBuffer(span, HybridRowVersion.V1, SystemSchema.LayoutResolver); - tangible.RefObject tempRef_row3 = - new tangible.RefObject(row); + RefObject tempRef_row3 = + new RefObject(row); RowReader reader = new RowReader(tempRef_row3); - row = tempRef_row3.argValue; - tangible.RefObject tempRef_reader3 = new tangible.RefObject(reader); - tangible.OutObject tempOut_record = new tangible.OutObject(); + row = tempRef_row3.get(); + RefObject tempRef_reader3 = new RefObject(reader); + OutObject tempOut_record = new OutObject(); r = RecordSerializer.Read(tempRef_reader3, tempOut_record); - this.record = tempOut_record.argValue; - reader = tempRef_reader3.argValue; + this.record = tempOut_record.get(); + reader = tempRef_reader3.get(); if (r != Result.Success) { break; } @@ -200,34 +203,34 @@ public final class RecordIOParser { case NeedRow: { if (b.Length < this.record.Length) { - need.argValue = this.record.Length; - consumed.argValue = buffer.Length - b.Length; + need.set(this.record.Length); + consumed.set(buffer.Length - b.Length); return Result.InsufficientBuffer; } - record.argValue = b.Slice(0, this.record.Length); + record.set(b.Slice(0, this.record.Length)); // Validate that the record has not been corrupted. //C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java: //ORIGINAL LINE: uint crc32 = Crc32.Update(0, record.Span); - int crc32 = Crc32.Update(0, record.argValue.Span); + int crc32 = Crc32.Update(0, record.get().Span); if (crc32 != this.record.Crc32) { r = Result.InvalidRow; break; } b = b.Slice(this.record.Length); - need.argValue = 0; + need.set(0); this.state = State.NeedHeader; - consumed.argValue = buffer.Length - b.Length; - type.argValue = ProductionType.Record; + consumed.set(buffer.Length - b.Length); + type.set(ProductionType.Record); return Result.Success; } } this.state = State.Error; - need.argValue = 0; - consumed.argValue = buffer.Length - b.Length; + need.set(0); + consumed.set(buffer.Length - b.Length); return r; } diff --git a/jre/src/main/java/azure/data/cosmos/serialization/hybridrow/recordio/RecordIOStream.java b/jre/src/main/java/com/azure/data/cosmos/serialization/hybridrow/recordio/RecordIOStream.java similarity index 84% rename from jre/src/main/java/azure/data/cosmos/serialization/hybridrow/recordio/RecordIOStream.java rename to jre/src/main/java/com/azure/data/cosmos/serialization/hybridrow/recordio/RecordIOStream.java index 18374c7..f0866bd 100644 --- a/jre/src/main/java/azure/data/cosmos/serialization/hybridrow/recordio/RecordIOStream.java +++ b/jre/src/main/java/com/azure/data/cosmos/serialization/hybridrow/recordio/RecordIOStream.java @@ -2,11 +2,12 @@ // Copyright (c) Microsoft Corporation. All rights reserved. //------------------------------------------------------------ -package azure.data.cosmos.serialization.hybridrow.recordio; +package com.azure.data.cosmos.serialization.hybridrow.recordio; -import azure.data.cosmos.serialization.hybridrow.MemorySpanResizer; -import azure.data.cosmos.serialization.hybridrow.Result; -import azure.data.cosmos.serialization.hybridrow.RowBuffer; +import com.azure.data.cosmos.core.OutObject; +import com.azure.data.cosmos.serialization.hybridrow.MemorySpanResizer; +import com.azure.data.cosmos.serialization.hybridrow.Result; +import com.azure.data.cosmos.serialization.hybridrow.RowBuffer; import java.io.InputStream; import java.io.OutputStream; @@ -70,8 +71,8 @@ public final class RecordIOStream { tangible.Func1Param, Result> visitRecord, tangible.Func1Param, Result> visitSegment, MemorySpanResizer resizer) { - Contract.Requires(stm != null); - Contract.Requires(visitRecord != null); + checkArgument(stm != null); + checkArgument(visitRecord != null); // Create a reusable, resizable buffer if the caller didn't provide one. //C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java: @@ -108,20 +109,20 @@ public final class RecordIOStream { while (avail.Length > 0) { // Loop around processing available data until we don't have anymore RecordIOParser.ProductionType prodType; - tangible.OutObject tempOut_prodType = new tangible.OutObject(); + OutObject tempOut_prodType = new OutObject(); Memory record; - tangible.OutObject> tempOut_record = new tangible.OutObject>(); - tangible.OutObject tempOut_need = new tangible.OutObject(); + OutObject> tempOut_record = new OutObject>(); + OutObject tempOut_need = new OutObject(); int consumed; - tangible.OutObject tempOut_consumed = new tangible.OutObject(); + OutObject tempOut_consumed = new OutObject(); //C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java: //ORIGINAL LINE: Result r = parser.Process(avail, out RecordIOParser.ProductionType prodType, out // Memory record, out need, out int consumed); Result r = parser.Process(avail, tempOut_prodType, tempOut_record, tempOut_need, tempOut_consumed); - consumed = tempOut_consumed.argValue; - need = tempOut_need.argValue; - record = tempOut_record.argValue; - prodType = tempOut_prodType.argValue; + consumed = tempOut_consumed.get(); + need = tempOut_need.get(); + record = tempOut_record.get(); + prodType = tempOut_prodType.get(); if ((r != Result.Success) && (r != Result.InsufficientBuffer)) { return r; @@ -167,7 +168,7 @@ public final class RecordIOStream { } // Make sure we processed all of the available data. - Contract.Assert(avail.Length == 0); + checkState(avail.Length == 0); return Result.Success; } @@ -202,12 +203,12 @@ public final class RecordIOStream { //C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java: public static Task WriteRecordIOAsync(Stream stm, Segment segment, ProduceFunc produce, MemorySpanResizer resizer) { - return Microsoft.Azure.Cosmos.Serialization.HybridRow.RecordIO.RecordIOStream.WriteRecordIOAsync(stm, + return RecordIOStream.WriteRecordIOAsync(stm, segment.clone(), index -> { ReadOnlyMemory buffer; - tangible.OutObject> tempOut_buffer = new tangible.OutObject>(); - buffer = tempOut_buffer.argValue; + OutObject> tempOut_buffer = new OutObject>(); + buffer = tempOut_buffer.get(); return new ValueTask<(Result, ReadOnlyMemory < Byte >) > ((r,buffer)) }, resizer); } @@ -249,11 +250,11 @@ public final class RecordIOStream { // Write a RecordIO stream. Memory metadata; - tangible.OutObject> tempOut_metadata = new tangible.OutObject>(); + OutObject> tempOut_metadata = new OutObject>(); //C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java: //ORIGINAL LINE: Result r = RecordIOStream.FormatSegment(segment, resizer, out Memory metadata); Result r = RecordIOStream.FormatSegment(segment.clone(), resizer, tempOut_metadata); - metadata = tempOut_metadata.argValue; + metadata = tempOut_metadata.get(); if (r != Result.Success) { return r; } @@ -276,11 +277,11 @@ public final class RecordIOStream { break; } - tangible.OutObject> tempOut_metadata2 = new tangible.OutObject>(); + OutObject> tempOut_metadata2 = new OutObject>(); //C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java: //ORIGINAL LINE: r = RecordIOStream.FormatRow(body, resizer, out metadata); r = RecordIOStream.FormatRow(body, resizer, tempOut_metadata2); - metadata = tempOut_metadata2.argValue; + metadata = tempOut_metadata2.get(); if (r != Result.Success) { return r; } @@ -289,7 +290,7 @@ public final class RecordIOStream { // play at the same time. If they do this usually means that the same resizer // was incorrectly used for both. Check the resizer parameter passed to // WriteRecordIOAsync for metadata. - Contract.Assert(!metadata.Span.Overlaps(body.Span)); + checkState(!metadata.Span.Overlaps(body.Span)); // TODO: C# TO JAVA CONVERTER: There is no equivalent to 'await' in Java: await stm.WriteAsync(metadata); @@ -310,17 +311,17 @@ public final class RecordIOStream { */ //C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java: //ORIGINAL LINE: private static Result FormatRow(ReadOnlyMemory body, MemorySpanResizer resizer, out Memory block) - private static Result FormatRow(ReadOnlyMemory body, MemorySpanResizer resizer, tangible.OutObject> block) { + private static Result FormatRow(ReadOnlyMemory body, MemorySpanResizer resizer, OutObject> block) { RowBuffer row; - tangible.OutObject tempOut_row = new tangible.OutObject(); + OutObject tempOut_row = new OutObject(); Result r = RecordIOFormatter.FormatRecord(body, tempOut_row, resizer); - row = tempOut_row.argValue; + row = tempOut_row.get(); if (r != Result.Success) { - block.argValue = null; + block.set(null); return r; } - block.argValue = resizer.getMemory().Slice(0, row.Length); + block.set(resizer.getMemory().Slice(0, row.Length)); return Result.Success; } @@ -336,18 +337,18 @@ public final class RecordIOStream { //ORIGINAL LINE: private static Result FormatSegment(Segment segment, MemorySpanResizer resizer, out // Memory block) private static Result FormatSegment(Segment segment, MemorySpanResizer resizer, - tangible.OutObject> block) { + OutObject> block) { RowBuffer row; - tangible.OutObject tempOut_row = - new tangible.OutObject(); + OutObject tempOut_row = + new OutObject(); Result r = RecordIOFormatter.FormatSegment(segment.clone(), tempOut_row, resizer); - row = tempOut_row.argValue; + row = tempOut_row.get(); if (r != Result.Success) { - block.argValue = null; + block.set(null); return r; } - block.argValue = resizer.getMemory().Slice(0, row.Length); + block.set(resizer.getMemory().Slice(0, row.Length)); return Result.Success; } @@ -363,6 +364,6 @@ public final class RecordIOStream { */ @FunctionalInterface public interface ProduceFunc { - Result invoke(long index, tangible.OutObject> buffer); + Result invoke(long index, OutObject> buffer); } } \ No newline at end of file diff --git a/jre/src/main/java/com/azure/data/cosmos/serialization/hybridrow/recordio/RecordSerializer.java b/jre/src/main/java/com/azure/data/cosmos/serialization/hybridrow/recordio/RecordSerializer.java new file mode 100644 index 0000000..c3f5ae4 --- /dev/null +++ b/jre/src/main/java/com/azure/data/cosmos/serialization/hybridrow/recordio/RecordSerializer.java @@ -0,0 +1,55 @@ +//------------------------------------------------------------ +// Copyright (c) Microsoft Corporation. All rights reserved. +//------------------------------------------------------------ + +package com.azure.data.cosmos.serialization.hybridrow.recordio; + +import com.azure.data.cosmos.core.OutObject; +import com.azure.data.cosmos.core.RefObject; +import com.azure.data.cosmos.serialization.hybridrow.Result; + +public final class RecordSerializer { + public static Result Read(RefObject reader, OutObject obj) { + obj.set(null); + while (reader.get().Read()) { + Result r; + + // TODO: use Path tokens here. + switch (reader.get().getPath().toString()) { + case "length": + OutObject tempOut_Length = new OutObject(); + r = reader.get().ReadInt32(tempOut_Length); + obj.get().argValue.Length = tempOut_Length.get(); + if (r != Result.Success) { + return r; + } + + break; + case "crc32": + OutObject tempOut_Crc32 = new OutObject(); + //C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java: + //ORIGINAL LINE: r = reader.ReadUInt32(out obj.Crc32); + r = reader.get().ReadUInt32(tempOut_Crc32); + obj.get().argValue.Crc32 = tempOut_Crc32.get(); + if (r != Result.Success) { + return r; + } + + break; + } + } + + return Result.Success; + } + + public static Result Write(RefObject writer, TypeArgument typeArg, Record obj) { + Result r; + r = writer.get().WriteInt32("length", obj.Length); + if (r != Result.Success) { + return r; + } + + r = writer.get().WriteUInt32("crc32", obj.Crc32); + return r; + } +} \ No newline at end of file diff --git a/jre/src/main/java/azure/data/cosmos/serialization/hybridrow/recordio/Segment.java b/jre/src/main/java/com/azure/data/cosmos/serialization/hybridrow/recordio/Segment.java similarity index 90% rename from jre/src/main/java/azure/data/cosmos/serialization/hybridrow/recordio/Segment.java rename to jre/src/main/java/com/azure/data/cosmos/serialization/hybridrow/recordio/Segment.java index 8fd7dcc..67ed96e 100644 --- a/jre/src/main/java/azure/data/cosmos/serialization/hybridrow/recordio/Segment.java +++ b/jre/src/main/java/com/azure/data/cosmos/serialization/hybridrow/recordio/Segment.java @@ -2,7 +2,7 @@ // Copyright (c) Microsoft Corporation. All rights reserved. //------------------------------------------------------------ -package azure.data.cosmos.serialization.hybridrow.recordio; +package com.azure.data.cosmos.serialization.hybridrow.recordio; // TODO: C# TO JAVA CONVERTER: There is no preprocessor in Java: ///#pragma warning disable CA1051 // Do not declare visible instance fields diff --git a/jre/src/main/java/com/azure/data/cosmos/serialization/hybridrow/recordio/SegmentSerializer.java b/jre/src/main/java/com/azure/data/cosmos/serialization/hybridrow/recordio/SegmentSerializer.java new file mode 100644 index 0000000..ec41de7 --- /dev/null +++ b/jre/src/main/java/com/azure/data/cosmos/serialization/hybridrow/recordio/SegmentSerializer.java @@ -0,0 +1,104 @@ +//------------------------------------------------------------ +// Copyright (c) Microsoft Corporation. All rights reserved. +//------------------------------------------------------------ + +package com.azure.data.cosmos.serialization.hybridrow.recordio; + +import com.azure.data.cosmos.core.OutObject; +import com.azure.data.cosmos.core.RefObject; +import com.azure.data.cosmos.serialization.hybridrow.HybridRowVersion; +import com.azure.data.cosmos.serialization.hybridrow.Result; +import com.azure.data.cosmos.serialization.hybridrow.RowBuffer; +import com.azure.data.cosmos.serialization.hybridrow.io.RowReader; + +public final class SegmentSerializer { + //C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java: + //ORIGINAL LINE: public static Result Read(Span span, LayoutResolver resolver, out Segment obj) + public static Result Read(Span span, LayoutResolver resolver, OutObject obj) { + RowBuffer row = new RowBuffer(span, HybridRowVersion.V1, resolver); + RefObject tempRef_row = + new RefObject(row); + RowReader reader = new RowReader(tempRef_row); + row = tempRef_row.get(); + RefObject tempRef_reader = + new RefObject(reader); + Result tempVar = SegmentSerializer.Read(tempRef_reader, obj.clone()); + reader = tempRef_reader.get(); + return tempVar; + } + + public static Result Read(RefObject reader, OutObject obj) { + obj.set(null); + while (reader.get().Read()) { + Result r; + + // TODO: use Path tokens here. + switch (reader.get().getPath().toString()) { + case "length": + OutObject tempOut_Length = new OutObject(); + r = reader.get().ReadInt32(tempOut_Length); + obj.get().argValue.Length = tempOut_Length.get(); + if (r != Result.Success) { + return r; + } + + // If the RowBuffer isn't big enough to contain the rest of the header, then just + // return the length. + if (reader.get().getLength() < obj.get().Length) { + return Result.Success; + } + + break; + case "comment": + OutObject tempOut_Comment = new OutObject(); + r = reader.get().ReadString(tempOut_Comment); + obj.get().argValue.Comment = tempOut_Comment.get(); + if (r != Result.Success) { + return r; + } + + break; + case "sdl": + OutObject tempOut_SDL = new OutObject(); + r = reader.get().ReadString(tempOut_SDL); + obj.get().argValue.SDL = tempOut_SDL.get(); + if (r != Result.Success) { + return r; + } + + break; + } + } + + return Result.Success; + } + + public static Result Write(RefObject writer, TypeArgument typeArg, Segment obj) { + Result r; + if (obj.Comment != null) { + r = writer.get().WriteString("comment", obj.Comment); + if (r != Result.Success) { + return r; + } + } + + if (obj.SDL != null) { + r = writer.get().WriteString("sdl", obj.SDL); + if (r != Result.Success) { + return r; + } + } + + // Defer writing the length until all other fields of the segment header are written. + // The length is then computed based on the current size of the underlying RowBuffer. + // Because the length field is itself fixed, writing the length can never change the length. + int length = writer.get().getLength(); + r = writer.get().WriteInt32("length", length); + if (r != Result.Success) { + return r; + } + + checkState(length == writer.get().getLength()); + return Result.Success; + } +} \ No newline at end of file diff --git a/jre/src/main/java/azure/data/cosmos/serialization/hybridrow/schemas/ArrayPropertyType.java b/jre/src/main/java/com/azure/data/cosmos/serialization/hybridrow/schemas/ArrayPropertyType.java similarity index 92% rename from jre/src/main/java/azure/data/cosmos/serialization/hybridrow/schemas/ArrayPropertyType.java rename to jre/src/main/java/com/azure/data/cosmos/serialization/hybridrow/schemas/ArrayPropertyType.java index fa07797..e876a4b 100644 --- a/jre/src/main/java/azure/data/cosmos/serialization/hybridrow/schemas/ArrayPropertyType.java +++ b/jre/src/main/java/com/azure/data/cosmos/serialization/hybridrow/schemas/ArrayPropertyType.java @@ -2,7 +2,7 @@ // Copyright (c) Microsoft Corporation. All rights reserved. //------------------------------------------------------------ -package azure.data.cosmos.serialization.hybridrow.schemas; +package com.azure.data.cosmos.serialization.hybridrow.schemas; /** * Array properties represent an unbounded set of zero or more items. diff --git a/jre/src/main/java/azure/data/cosmos/serialization/hybridrow/schemas/MapPropertyType.java b/jre/src/main/java/com/azure/data/cosmos/serialization/hybridrow/schemas/MapPropertyType.java similarity index 94% rename from jre/src/main/java/azure/data/cosmos/serialization/hybridrow/schemas/MapPropertyType.java rename to jre/src/main/java/com/azure/data/cosmos/serialization/hybridrow/schemas/MapPropertyType.java index d8f95a6..a091416 100644 --- a/jre/src/main/java/azure/data/cosmos/serialization/hybridrow/schemas/MapPropertyType.java +++ b/jre/src/main/java/com/azure/data/cosmos/serialization/hybridrow/schemas/MapPropertyType.java @@ -2,7 +2,7 @@ // Copyright (c) Microsoft Corporation. All rights reserved. //------------------------------------------------------------ -package 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 diff --git a/jre/src/main/java/azure/data/cosmos/serialization/hybridrow/schemas/Namespace.java b/jre/src/main/java/com/azure/data/cosmos/serialization/hybridrow/schemas/Namespace.java similarity index 95% rename from jre/src/main/java/azure/data/cosmos/serialization/hybridrow/schemas/Namespace.java rename to jre/src/main/java/com/azure/data/cosmos/serialization/hybridrow/schemas/Namespace.java index 647a0e5..b9dd81a 100644 --- a/jre/src/main/java/azure/data/cosmos/serialization/hybridrow/schemas/Namespace.java +++ b/jre/src/main/java/com/azure/data/cosmos/serialization/hybridrow/schemas/Namespace.java @@ -2,7 +2,7 @@ // Copyright (c) Microsoft Corporation. All rights reserved. //------------------------------------------------------------ -package azure.data.cosmos.serialization.hybridrow.schemas; +package com.azure.data.cosmos.serialization.hybridrow.schemas; import Newtonsoft.Json.*; diff --git a/jre/src/main/java/azure/data/cosmos/serialization/hybridrow/schemas/ObjectPropertyType.java b/jre/src/main/java/com/azure/data/cosmos/serialization/hybridrow/schemas/ObjectPropertyType.java similarity index 93% rename from jre/src/main/java/azure/data/cosmos/serialization/hybridrow/schemas/ObjectPropertyType.java rename to jre/src/main/java/com/azure/data/cosmos/serialization/hybridrow/schemas/ObjectPropertyType.java index 56c6fcc..6130b75 100644 --- a/jre/src/main/java/azure/data/cosmos/serialization/hybridrow/schemas/ObjectPropertyType.java +++ b/jre/src/main/java/com/azure/data/cosmos/serialization/hybridrow/schemas/ObjectPropertyType.java @@ -2,7 +2,7 @@ // Copyright (c) Microsoft Corporation. All rights reserved. //------------------------------------------------------------ -package azure.data.cosmos.serialization.hybridrow.schemas; +package com.azure.data.cosmos.serialization.hybridrow.schemas; import java.util.ArrayList; diff --git a/jre/src/main/java/azure/data/cosmos/serialization/hybridrow/schemas/PartitionKey.java b/jre/src/main/java/com/azure/data/cosmos/serialization/hybridrow/schemas/PartitionKey.java similarity index 90% rename from jre/src/main/java/azure/data/cosmos/serialization/hybridrow/schemas/PartitionKey.java rename to jre/src/main/java/com/azure/data/cosmos/serialization/hybridrow/schemas/PartitionKey.java index 3ff54b7..14c2d56 100644 --- a/jre/src/main/java/azure/data/cosmos/serialization/hybridrow/schemas/PartitionKey.java +++ b/jre/src/main/java/com/azure/data/cosmos/serialization/hybridrow/schemas/PartitionKey.java @@ -2,7 +2,7 @@ // Copyright (c) Microsoft Corporation. All rights reserved. //------------------------------------------------------------ -package azure.data.cosmos.serialization.hybridrow.schemas; +package com.azure.data.cosmos.serialization.hybridrow.schemas; /** * Describes a property or set of properties used to partition the data set across machines. diff --git a/jre/src/main/java/azure/data/cosmos/serialization/hybridrow/schemas/PrimarySortKey.java b/jre/src/main/java/com/azure/data/cosmos/serialization/hybridrow/schemas/PrimarySortKey.java similarity index 93% rename from jre/src/main/java/azure/data/cosmos/serialization/hybridrow/schemas/PrimarySortKey.java rename to jre/src/main/java/com/azure/data/cosmos/serialization/hybridrow/schemas/PrimarySortKey.java index a1ff8e0..29018a3 100644 --- a/jre/src/main/java/azure/data/cosmos/serialization/hybridrow/schemas/PrimarySortKey.java +++ b/jre/src/main/java/com/azure/data/cosmos/serialization/hybridrow/schemas/PrimarySortKey.java @@ -2,7 +2,7 @@ // Copyright (c) Microsoft Corporation. All rights reserved. //------------------------------------------------------------ -package 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 diff --git a/jre/src/main/java/azure/data/cosmos/serialization/hybridrow/schemas/PrimitivePropertyType.java b/jre/src/main/java/com/azure/data/cosmos/serialization/hybridrow/schemas/PrimitivePropertyType.java similarity index 93% rename from jre/src/main/java/azure/data/cosmos/serialization/hybridrow/schemas/PrimitivePropertyType.java rename to jre/src/main/java/com/azure/data/cosmos/serialization/hybridrow/schemas/PrimitivePropertyType.java index 3c484e0..8cd15d9 100644 --- a/jre/src/main/java/azure/data/cosmos/serialization/hybridrow/schemas/PrimitivePropertyType.java +++ b/jre/src/main/java/com/azure/data/cosmos/serialization/hybridrow/schemas/PrimitivePropertyType.java @@ -2,7 +2,7 @@ // Copyright (c) Microsoft Corporation. All rights reserved. //------------------------------------------------------------ -package azure.data.cosmos.serialization.hybridrow.schemas; +package com.azure.data.cosmos.serialization.hybridrow.schemas; /** * A primitive property. diff --git a/jre/src/main/java/azure/data/cosmos/serialization/hybridrow/schemas/Property.java b/jre/src/main/java/com/azure/data/cosmos/serialization/hybridrow/schemas/Property.java similarity index 94% rename from jre/src/main/java/azure/data/cosmos/serialization/hybridrow/schemas/Property.java rename to jre/src/main/java/com/azure/data/cosmos/serialization/hybridrow/schemas/Property.java index 128a81e..aaa517c 100644 --- a/jre/src/main/java/azure/data/cosmos/serialization/hybridrow/schemas/Property.java +++ b/jre/src/main/java/com/azure/data/cosmos/serialization/hybridrow/schemas/Property.java @@ -2,7 +2,7 @@ // Copyright (c) Microsoft Corporation. All rights reserved. //------------------------------------------------------------ -package azure.data.cosmos.serialization.hybridrow.schemas; +package com.azure.data.cosmos.serialization.hybridrow.schemas; // TODO: C# TO JAVA CONVERTER: There is no preprocessor in Java: ///#pragma warning disable CA1716 // Identifiers should not match keywords diff --git a/jre/src/main/java/azure/data/cosmos/serialization/hybridrow/schemas/PropertySchemaConverter.java b/jre/src/main/java/com/azure/data/cosmos/serialization/hybridrow/schemas/PropertySchemaConverter.java similarity index 95% rename from jre/src/main/java/azure/data/cosmos/serialization/hybridrow/schemas/PropertySchemaConverter.java rename to jre/src/main/java/com/azure/data/cosmos/serialization/hybridrow/schemas/PropertySchemaConverter.java index 88084e6..609bf27 100644 --- a/jre/src/main/java/azure/data/cosmos/serialization/hybridrow/schemas/PropertySchemaConverter.java +++ b/jre/src/main/java/com/azure/data/cosmos/serialization/hybridrow/schemas/PropertySchemaConverter.java @@ -2,7 +2,7 @@ // Copyright (c) Microsoft Corporation. All rights reserved. //------------------------------------------------------------ -package azure.data.cosmos.serialization.hybridrow.schemas; +package com.azure.data.cosmos.serialization.hybridrow.schemas; import Newtonsoft.Json.*; import Newtonsoft.Json.Converters.*; diff --git a/jre/src/main/java/azure/data/cosmos/serialization/hybridrow/schemas/PropertyType.java b/jre/src/main/java/com/azure/data/cosmos/serialization/hybridrow/schemas/PropertyType.java similarity index 94% rename from jre/src/main/java/azure/data/cosmos/serialization/hybridrow/schemas/PropertyType.java rename to jre/src/main/java/com/azure/data/cosmos/serialization/hybridrow/schemas/PropertyType.java index 0817952..06ab0cd 100644 --- a/jre/src/main/java/azure/data/cosmos/serialization/hybridrow/schemas/PropertyType.java +++ b/jre/src/main/java/com/azure/data/cosmos/serialization/hybridrow/schemas/PropertyType.java @@ -2,7 +2,7 @@ // Copyright (c) Microsoft Corporation. All rights reserved. //------------------------------------------------------------ -package azure.data.cosmos.serialization.hybridrow.schemas; +package com.azure.data.cosmos.serialization.hybridrow.schemas; /** * The base class for property types both primitive and complex. diff --git a/jre/src/main/java/azure/data/cosmos/serialization/hybridrow/schemas/Schema.java b/jre/src/main/java/com/azure/data/cosmos/serialization/hybridrow/schemas/Schema.java similarity index 93% rename from jre/src/main/java/azure/data/cosmos/serialization/hybridrow/schemas/Schema.java rename to jre/src/main/java/com/azure/data/cosmos/serialization/hybridrow/schemas/Schema.java index 1aef147..8d95c4a 100644 --- a/jre/src/main/java/azure/data/cosmos/serialization/hybridrow/schemas/Schema.java +++ b/jre/src/main/java/com/azure/data/cosmos/serialization/hybridrow/schemas/Schema.java @@ -2,12 +2,12 @@ // Copyright (c) Microsoft Corporation. All rights reserved. //------------------------------------------------------------ -package azure.data.cosmos.serialization.hybridrow.schemas; +package com.azure.data.cosmos.serialization.hybridrow.schemas; import Newtonsoft.Json.*; -import azure.data.cosmos.serialization.hybridrow.SchemaId; -import azure.data.cosmos.serialization.hybridrow.layouts.Layout; -import azure.data.cosmos.serialization.hybridrow.layouts.LayoutCompiler; +import com.azure.data.cosmos.serialization.hybridrow.SchemaId; +import com.azure.data.cosmos.serialization.hybridrow.layouts.Layout; +import com.azure.data.cosmos.serialization.hybridrow.layouts.LayoutCompiler; import java.util.ArrayList; @@ -53,7 +53,7 @@ public class Schema { */ // TODO: C# TO JAVA CONVERTER: Java annotations will not correspond to .NET attributes: //ORIGINAL LINE: [JsonProperty(PropertyName = "id", Required = Required.Always)] public SchemaId SchemaId {get;set;} - private SchemaId SchemaId = new SchemaId(); + private com.azure.data.cosmos.serialization.hybridrow.SchemaId SchemaId = new SchemaId(); /** * The type of this schema. This value MUST be . */ diff --git a/jre/src/main/java/azure/data/cosmos/serialization/hybridrow/schemas/SchemaException.java b/jre/src/main/java/com/azure/data/cosmos/serialization/hybridrow/schemas/SchemaException.java similarity index 90% rename from jre/src/main/java/azure/data/cosmos/serialization/hybridrow/schemas/SchemaException.java rename to jre/src/main/java/com/azure/data/cosmos/serialization/hybridrow/schemas/SchemaException.java index a63d61f..2a1fe65 100644 --- a/jre/src/main/java/azure/data/cosmos/serialization/hybridrow/schemas/SchemaException.java +++ b/jre/src/main/java/com/azure/data/cosmos/serialization/hybridrow/schemas/SchemaException.java @@ -2,7 +2,7 @@ // Copyright (c) Microsoft Corporation. All rights reserved. //------------------------------------------------------------ -package azure.data.cosmos.serialization.hybridrow.schemas; +package com.azure.data.cosmos.serialization.hybridrow.schemas; import java.io.Serializable; diff --git a/jre/src/main/java/azure/data/cosmos/serialization/hybridrow/schemas/SchemaHash.java b/jre/src/main/java/com/azure/data/cosmos/serialization/hybridrow/schemas/SchemaHash.java similarity index 96% rename from jre/src/main/java/azure/data/cosmos/serialization/hybridrow/schemas/SchemaHash.java rename to jre/src/main/java/com/azure/data/cosmos/serialization/hybridrow/schemas/SchemaHash.java index b49912f..455a6ae 100644 --- a/jre/src/main/java/azure/data/cosmos/serialization/hybridrow/schemas/SchemaHash.java +++ b/jre/src/main/java/com/azure/data/cosmos/serialization/hybridrow/schemas/SchemaHash.java @@ -2,7 +2,7 @@ // Copyright (c) Microsoft Corporation. All rights reserved. //------------------------------------------------------------ -package azure.data.cosmos.serialization.hybridrow.schemas; +package com.azure.data.cosmos.serialization.hybridrow.schemas; public final class SchemaHash { /** Computes the logical hash for a logical schema. diff --git a/jre/src/main/java/azure/data/cosmos/serialization/hybridrow/schemas/SchemaLanguageVersion.java b/jre/src/main/java/com/azure/data/cosmos/serialization/hybridrow/schemas/SchemaLanguageVersion.java similarity index 93% rename from jre/src/main/java/azure/data/cosmos/serialization/hybridrow/schemas/SchemaLanguageVersion.java rename to jre/src/main/java/com/azure/data/cosmos/serialization/hybridrow/schemas/SchemaLanguageVersion.java index 3007315..7aec4d2 100644 --- a/jre/src/main/java/azure/data/cosmos/serialization/hybridrow/schemas/SchemaLanguageVersion.java +++ b/jre/src/main/java/com/azure/data/cosmos/serialization/hybridrow/schemas/SchemaLanguageVersion.java @@ -2,7 +2,7 @@ // Copyright (c) Microsoft Corporation. All rights reserved. //------------------------------------------------------------ -package azure.data.cosmos.serialization.hybridrow.schemas; +package com.azure.data.cosmos.serialization.hybridrow.schemas; // TODO: C# TO JAVA CONVERTER: There is no preprocessor in Java: ///#pragma warning disable CA1028 // Enum Storage should be Int32 diff --git a/jre/src/main/java/azure/data/cosmos/serialization/hybridrow/schemas/SchemaOptions.java b/jre/src/main/java/com/azure/data/cosmos/serialization/hybridrow/schemas/SchemaOptions.java similarity index 96% rename from jre/src/main/java/azure/data/cosmos/serialization/hybridrow/schemas/SchemaOptions.java rename to jre/src/main/java/com/azure/data/cosmos/serialization/hybridrow/schemas/SchemaOptions.java index b94d2d9..9c45b2c 100644 --- a/jre/src/main/java/azure/data/cosmos/serialization/hybridrow/schemas/SchemaOptions.java +++ b/jre/src/main/java/com/azure/data/cosmos/serialization/hybridrow/schemas/SchemaOptions.java @@ -2,7 +2,7 @@ // Copyright (c) Microsoft Corporation. All rights reserved. //------------------------------------------------------------ -package azure.data.cosmos.serialization.hybridrow.schemas; +package com.azure.data.cosmos.serialization.hybridrow.schemas; /** * Describes the set of options that apply to the entire schema and the way it is validated. diff --git a/jre/src/main/java/azure/data/cosmos/serialization/hybridrow/schemas/SchemaValidator.java b/jre/src/main/java/com/azure/data/cosmos/serialization/hybridrow/schemas/SchemaValidator.java similarity index 95% rename from jre/src/main/java/azure/data/cosmos/serialization/hybridrow/schemas/SchemaValidator.java rename to jre/src/main/java/com/azure/data/cosmos/serialization/hybridrow/schemas/SchemaValidator.java index dad528b..623c6ce 100644 --- a/jre/src/main/java/azure/data/cosmos/serialization/hybridrow/schemas/SchemaValidator.java +++ b/jre/src/main/java/com/azure/data/cosmos/serialization/hybridrow/schemas/SchemaValidator.java @@ -2,9 +2,9 @@ // Copyright (c) Microsoft Corporation. All rights reserved. //------------------------------------------------------------ -package azure.data.cosmos.serialization.hybridrow.schemas; +package com.azure.data.cosmos.serialization.hybridrow.schemas; -import azure.data.cosmos.serialization.hybridrow.SchemaId; +import com.azure.data.cosmos.serialization.hybridrow.SchemaId; import java.util.HashMap; @@ -119,7 +119,7 @@ HashMap ids case UdtPropertyType up: ValidateAssert.Exists((up.Name, up.SchemaId), schemas, "Schema reference", "Namespace") - if (azure.data.cosmos.serialization.hybridrow.SchemaId.opNotEquals(up.SchemaId, + if (SchemaId.opNotEquals(up.SchemaId, SchemaId.Invalid)) { Schema s = ValidateAssert.Exists(up.SchemaId, ids, "Schema id", "Namespace"); ValidateAssert.AreEqual(up.Name, s.getName(), String.format("Schema name '%1$s' does not match " + @@ -269,7 +269,7 @@ private static void Visit(PropertyType p, PropertyType parent, HashMap<(String, * @param label Diagnostic label describing . */ public static void IsValidSchemaId(SchemaId id, String label) { - if (azure.data.cosmos.serialization.hybridrow.SchemaId.opEquals(id.clone(), SchemaId.Invalid)) { + if (SchemaId.opEquals(id.clone(), SchemaId.Invalid)) { throw new SchemaException(String.format("%1$s cannot be 0", label)); } } diff --git a/jre/src/main/java/azure/data/cosmos/serialization/hybridrow/schemas/ScopePropertyType.java b/jre/src/main/java/com/azure/data/cosmos/serialization/hybridrow/schemas/ScopePropertyType.java similarity index 90% rename from jre/src/main/java/azure/data/cosmos/serialization/hybridrow/schemas/ScopePropertyType.java rename to jre/src/main/java/com/azure/data/cosmos/serialization/hybridrow/schemas/ScopePropertyType.java index 7c67cdf..581e12b 100644 --- a/jre/src/main/java/azure/data/cosmos/serialization/hybridrow/schemas/ScopePropertyType.java +++ b/jre/src/main/java/com/azure/data/cosmos/serialization/hybridrow/schemas/ScopePropertyType.java @@ -2,7 +2,7 @@ // Copyright (c) Microsoft Corporation. All rights reserved. //------------------------------------------------------------ -package azure.data.cosmos.serialization.hybridrow.schemas; +package com.azure.data.cosmos.serialization.hybridrow.schemas; public abstract class ScopePropertyType extends PropertyType { /** diff --git a/jre/src/main/java/azure/data/cosmos/serialization/hybridrow/schemas/SetPropertyType.java b/jre/src/main/java/com/azure/data/cosmos/serialization/hybridrow/schemas/SetPropertyType.java similarity index 92% rename from jre/src/main/java/azure/data/cosmos/serialization/hybridrow/schemas/SetPropertyType.java rename to jre/src/main/java/com/azure/data/cosmos/serialization/hybridrow/schemas/SetPropertyType.java index 33f7801..c53bca6 100644 --- a/jre/src/main/java/azure/data/cosmos/serialization/hybridrow/schemas/SetPropertyType.java +++ b/jre/src/main/java/com/azure/data/cosmos/serialization/hybridrow/schemas/SetPropertyType.java @@ -2,7 +2,7 @@ // Copyright (c) Microsoft Corporation. All rights reserved. //------------------------------------------------------------ -package 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. diff --git a/jre/src/main/java/azure/data/cosmos/serialization/hybridrow/schemas/SortDirection.java b/jre/src/main/java/com/azure/data/cosmos/serialization/hybridrow/schemas/SortDirection.java similarity index 93% rename from jre/src/main/java/azure/data/cosmos/serialization/hybridrow/schemas/SortDirection.java rename to jre/src/main/java/com/azure/data/cosmos/serialization/hybridrow/schemas/SortDirection.java index 6a48557..bc8ed70 100644 --- a/jre/src/main/java/azure/data/cosmos/serialization/hybridrow/schemas/SortDirection.java +++ b/jre/src/main/java/com/azure/data/cosmos/serialization/hybridrow/schemas/SortDirection.java @@ -2,7 +2,7 @@ // Copyright (c) Microsoft Corporation. All rights reserved. //------------------------------------------------------------ -package azure.data.cosmos.serialization.hybridrow.schemas; +package com.azure.data.cosmos.serialization.hybridrow.schemas; /** * Describes the sort order direction. diff --git a/jre/src/main/java/azure/data/cosmos/serialization/hybridrow/schemas/StaticKey.java b/jre/src/main/java/com/azure/data/cosmos/serialization/hybridrow/schemas/StaticKey.java similarity index 90% rename from jre/src/main/java/azure/data/cosmos/serialization/hybridrow/schemas/StaticKey.java rename to jre/src/main/java/com/azure/data/cosmos/serialization/hybridrow/schemas/StaticKey.java index 48b81b0..eebe1b5 100644 --- a/jre/src/main/java/azure/data/cosmos/serialization/hybridrow/schemas/StaticKey.java +++ b/jre/src/main/java/com/azure/data/cosmos/serialization/hybridrow/schemas/StaticKey.java @@ -2,7 +2,7 @@ // Copyright (c) Microsoft Corporation. All rights reserved. //------------------------------------------------------------ -package azure.data.cosmos.serialization.hybridrow.schemas; +package com.azure.data.cosmos.serialization.hybridrow.schemas; /** * Describes a property or set of properties whose values MUST be the same for all rows that share the same partition diff --git a/jre/src/main/java/azure/data/cosmos/serialization/hybridrow/schemas/StorageKind.java b/jre/src/main/java/com/azure/data/cosmos/serialization/hybridrow/schemas/StorageKind.java similarity index 94% rename from jre/src/main/java/azure/data/cosmos/serialization/hybridrow/schemas/StorageKind.java rename to jre/src/main/java/com/azure/data/cosmos/serialization/hybridrow/schemas/StorageKind.java index fce9e45..3b98261 100644 --- a/jre/src/main/java/azure/data/cosmos/serialization/hybridrow/schemas/StorageKind.java +++ b/jre/src/main/java/com/azure/data/cosmos/serialization/hybridrow/schemas/StorageKind.java @@ -2,7 +2,7 @@ // Copyright (c) Microsoft Corporation. All rights reserved. //------------------------------------------------------------ -package azure.data.cosmos.serialization.hybridrow.schemas; +package com.azure.data.cosmos.serialization.hybridrow.schemas; /** * Describes the storage placement for primitive properties. diff --git a/jre/src/main/java/azure/data/cosmos/serialization/hybridrow/schemas/StrictBooleanConverter.java b/jre/src/main/java/com/azure/data/cosmos/serialization/hybridrow/schemas/StrictBooleanConverter.java similarity index 93% rename from jre/src/main/java/azure/data/cosmos/serialization/hybridrow/schemas/StrictBooleanConverter.java rename to jre/src/main/java/com/azure/data/cosmos/serialization/hybridrow/schemas/StrictBooleanConverter.java index 773f9d4..fee8336 100644 --- a/jre/src/main/java/azure/data/cosmos/serialization/hybridrow/schemas/StrictBooleanConverter.java +++ b/jre/src/main/java/com/azure/data/cosmos/serialization/hybridrow/schemas/StrictBooleanConverter.java @@ -2,7 +2,7 @@ // Copyright (c) Microsoft Corporation. All rights reserved. //------------------------------------------------------------ -package azure.data.cosmos.serialization.hybridrow.schemas; +package com.azure.data.cosmos.serialization.hybridrow.schemas; import Newtonsoft.Json.*; diff --git a/jre/src/main/java/azure/data/cosmos/serialization/hybridrow/schemas/StrictIntegerConverter.java b/jre/src/main/java/com/azure/data/cosmos/serialization/hybridrow/schemas/StrictIntegerConverter.java similarity index 94% rename from jre/src/main/java/azure/data/cosmos/serialization/hybridrow/schemas/StrictIntegerConverter.java rename to jre/src/main/java/com/azure/data/cosmos/serialization/hybridrow/schemas/StrictIntegerConverter.java index 5dcf291..22ac7f1 100644 --- a/jre/src/main/java/azure/data/cosmos/serialization/hybridrow/schemas/StrictIntegerConverter.java +++ b/jre/src/main/java/com/azure/data/cosmos/serialization/hybridrow/schemas/StrictIntegerConverter.java @@ -2,7 +2,7 @@ // Copyright (c) Microsoft Corporation. All rights reserved. //------------------------------------------------------------ -package azure.data.cosmos.serialization.hybridrow.schemas; +package com.azure.data.cosmos.serialization.hybridrow.schemas; import Newtonsoft.Json.*; diff --git a/jre/src/main/java/azure/data/cosmos/serialization/hybridrow/schemas/TaggedPropertyType.java b/jre/src/main/java/com/azure/data/cosmos/serialization/hybridrow/schemas/TaggedPropertyType.java similarity index 93% rename from jre/src/main/java/azure/data/cosmos/serialization/hybridrow/schemas/TaggedPropertyType.java rename to jre/src/main/java/com/azure/data/cosmos/serialization/hybridrow/schemas/TaggedPropertyType.java index 1015279..80767fc 100644 --- a/jre/src/main/java/azure/data/cosmos/serialization/hybridrow/schemas/TaggedPropertyType.java +++ b/jre/src/main/java/com/azure/data/cosmos/serialization/hybridrow/schemas/TaggedPropertyType.java @@ -2,7 +2,7 @@ // Copyright (c) Microsoft Corporation. All rights reserved. //------------------------------------------------------------ -package azure.data.cosmos.serialization.hybridrow.schemas; +package com.azure.data.cosmos.serialization.hybridrow.schemas; import java.util.ArrayList; diff --git a/jre/src/main/java/azure/data/cosmos/serialization/hybridrow/schemas/TuplePropertyType.java b/jre/src/main/java/com/azure/data/cosmos/serialization/hybridrow/schemas/TuplePropertyType.java similarity index 92% rename from jre/src/main/java/azure/data/cosmos/serialization/hybridrow/schemas/TuplePropertyType.java rename to jre/src/main/java/com/azure/data/cosmos/serialization/hybridrow/schemas/TuplePropertyType.java index 2e411c4..cca95a4 100644 --- a/jre/src/main/java/azure/data/cosmos/serialization/hybridrow/schemas/TuplePropertyType.java +++ b/jre/src/main/java/com/azure/data/cosmos/serialization/hybridrow/schemas/TuplePropertyType.java @@ -2,7 +2,7 @@ // Copyright (c) Microsoft Corporation. All rights reserved. //------------------------------------------------------------ -package azure.data.cosmos.serialization.hybridrow.schemas; +package com.azure.data.cosmos.serialization.hybridrow.schemas; import java.util.ArrayList; diff --git a/jre/src/main/java/azure/data/cosmos/serialization/hybridrow/schemas/TypeKind.java b/jre/src/main/java/com/azure/data/cosmos/serialization/hybridrow/schemas/TypeKind.java similarity index 95% rename from jre/src/main/java/azure/data/cosmos/serialization/hybridrow/schemas/TypeKind.java rename to jre/src/main/java/com/azure/data/cosmos/serialization/hybridrow/schemas/TypeKind.java index 27f8677..24a93dc 100644 --- a/jre/src/main/java/azure/data/cosmos/serialization/hybridrow/schemas/TypeKind.java +++ b/jre/src/main/java/com/azure/data/cosmos/serialization/hybridrow/schemas/TypeKind.java @@ -2,7 +2,7 @@ // Copyright (c) Microsoft Corporation. All rights reserved. //------------------------------------------------------------ -package azure.data.cosmos.serialization.hybridrow.schemas; +package com.azure.data.cosmos.serialization.hybridrow.schemas; /** * Describes the logical type of a property. diff --git a/jre/src/main/java/azure/data/cosmos/serialization/hybridrow/schemas/UdtPropertyType.java b/jre/src/main/java/com/azure/data/cosmos/serialization/hybridrow/schemas/UdtPropertyType.java similarity index 84% rename from jre/src/main/java/azure/data/cosmos/serialization/hybridrow/schemas/UdtPropertyType.java rename to jre/src/main/java/com/azure/data/cosmos/serialization/hybridrow/schemas/UdtPropertyType.java index 04805d9..57be696 100644 --- a/jre/src/main/java/azure/data/cosmos/serialization/hybridrow/schemas/UdtPropertyType.java +++ b/jre/src/main/java/com/azure/data/cosmos/serialization/hybridrow/schemas/UdtPropertyType.java @@ -2,9 +2,9 @@ // Copyright (c) Microsoft Corporation. All rights reserved. //------------------------------------------------------------ -package azure.data.cosmos.serialization.hybridrow.schemas; +package com.azure.data.cosmos.serialization.hybridrow.schemas; -import azure.data.cosmos.serialization.hybridrow.SchemaId; +import com.azure.data.cosmos.serialization.hybridrow.SchemaId; /** * UDT properties represent nested structures with an independent schema. @@ -35,10 +35,10 @@ public class UdtPropertyType extends ScopePropertyType { // TODO: C# TO JAVA CONVERTER: Java annotations will not correspond to .NET attributes: //ORIGINAL LINE: [JsonProperty(PropertyName = "id", Required = Required.DisallowNull, DefaultValueHandling = // DefaultValueHandling.IgnoreAndPopulate)] public SchemaId SchemaId {get;set;} - private SchemaId SchemaId = new SchemaId(); + private com.azure.data.cosmos.serialization.hybridrow.SchemaId SchemaId = new SchemaId(); public UdtPropertyType() { - this.setSchemaId(azure.data.cosmos.serialization.hybridrow.SchemaId.Invalid); + this.setSchemaId(com.azure.data.cosmos.serialization.hybridrow.SchemaId.Invalid); } public final String getName() { diff --git a/jre/src/main/java/tangible/OutObject.java b/jre/src/main/java/tangible/OutObject.java deleted file mode 100644 index 6da6196..0000000 --- a/jre/src/main/java/tangible/OutObject.java +++ /dev/null @@ -1,15 +0,0 @@ -//------------------------------------------------------------ -// Copyright (c) Microsoft Corporation. All rights reserved. -//------------------------------------------------------------ - -package tangible; - -//---------------------------------------------------------------------------------------- -// Copyright © 2007 - 2019 Tangible Software Solutions, Inc. -// This class can be used by anyone provided that the copyright notice remains intact. -// -// This class is used to replicate the ability to have 'out' parameters in Java. -//---------------------------------------------------------------------------------------- -public final class OutObject { - public T argValue; -} \ No newline at end of file diff --git a/jre/src/main/java/tangible/RefObject.java b/jre/src/main/java/tangible/RefObject.java deleted file mode 100644 index 7086780..0000000 --- a/jre/src/main/java/tangible/RefObject.java +++ /dev/null @@ -1,19 +0,0 @@ -//------------------------------------------------------------ -// Copyright (c) Microsoft Corporation. All rights reserved. -//------------------------------------------------------------ - -package tangible; - -//---------------------------------------------------------------------------------------- -// Copyright © 2007 - 2019 Tangible Software Solutions, Inc. -// This class can be used by anyone provided that the copyright notice remains intact. -// -// This class is used to replicate the ability to pass arguments by reference in Java. -//---------------------------------------------------------------------------------------- -public final class RefObject { - public T argValue; - - public RefObject(T refArg) { - argValue = refArg; - } -} \ No newline at end of file diff --git a/jre/src/main/java/tangible/TryParseHelper.java b/jre/src/main/java/tangible/TryParseHelper.java index d70cdde..a95fa0d 100644 --- a/jre/src/main/java/tangible/TryParseHelper.java +++ b/jre/src/main/java/tangible/TryParseHelper.java @@ -4,6 +4,8 @@ package tangible; +import com.azure.data.cosmos.core.OutObject; + //---------------------------------------------------------------------------------------- // Copyright © 2007 - 2019 Tangible Software Solutions, Inc. // This class can be used by anyone provided that the copyright notice remains intact. @@ -11,63 +13,63 @@ package tangible; // This class is used to convert some of the C# TryParse methods to Java. //---------------------------------------------------------------------------------------- public final class TryParseHelper { - public static boolean tryParseBoolean(String s, tangible.OutObject result) { + public static boolean tryParseBoolean(String s, OutObject result) { try { - result.argValue = Boolean.parseBoolean(s); + result.set(Boolean.parseBoolean(s)); return true; } catch (NumberFormatException e) { return false; } } - public static boolean tryParseByte(String s, tangible.OutObject result) { + public static boolean tryParseByte(String s, OutObject result) { try { - result.argValue = Byte.parseByte(s); + result.set(Byte.parseByte(s)); return true; } catch (NumberFormatException e) { return false; } } - public static boolean tryParseDouble(String s, tangible.OutObject result) { + public static boolean tryParseDouble(String s, OutObject result) { try { - result.argValue = Double.parseDouble(s); + result.set(Double.parseDouble(s)); return true; } catch (NumberFormatException e) { return false; } } - public static boolean tryParseFloat(String s, tangible.OutObject result) { + public static boolean tryParseFloat(String s, OutObject result) { try { - result.argValue = Float.parseFloat(s); + result.set(Float.parseFloat(s)); return true; } catch (NumberFormatException e) { return false; } } - public static boolean tryParseInt(String s, tangible.OutObject result) { + public static boolean tryParseInt(String s, OutObject result) { try { - result.argValue = Integer.parseInt(s); + result.set(Integer.parseInt(s)); return true; } catch (NumberFormatException e) { return false; } } - public static boolean tryParseLong(String s, tangible.OutObject result) { + public static boolean tryParseLong(String s, OutObject result) { try { - result.argValue = Long.parseLong(s); + result.set(Long.parseLong(s)); return true; } catch (NumberFormatException e) { return false; } } - public static boolean tryParseShort(String s, tangible.OutObject result) { + public static boolean tryParseShort(String s, OutObject result) { try { - result.argValue = Short.parseShort(s); + result.set(Short.parseShort(s)); return true; } catch (NumberFormatException e) { return false; diff --git a/jre/src/test/java/azure/data/cosmos/serialization/hybridrow/unit/DeleteRowDispatcher.java b/jre/src/test/java/azure/data/cosmos/serialization/hybridrow/unit/DeleteRowDispatcher.java deleted file mode 100644 index f72d5ed..0000000 --- a/jre/src/test/java/azure/data/cosmos/serialization/hybridrow/unit/DeleteRowDispatcher.java +++ /dev/null @@ -1,161 +0,0 @@ -//------------------------------------------------------------ -// Copyright (c) Microsoft Corporation. All rights reserved. -//------------------------------------------------------------ - -package azure.data.cosmos.serialization.hybridrow.unit; - -import azure.data.cosmos.serialization.hybridrow.RowCursor; - -import java.util.List; - -//C# TO JAVA CONVERTER WARNING: Java does not allow user-defined value types. The behavior of this class may differ -// from the original: -//ORIGINAL LINE: internal struct DeleteRowDispatcher : IDispatcher -public final class DeleteRowDispatcher implements IDispatcher { - - public , TValue> void Dispatch(tangible.RefObject dispatcher, tangible.RefObject root, LayoutColumn col, LayoutType t) { - Dispatch(dispatcher, root, col, t, null); - } - - //C# TO JAVA CONVERTER NOTE: Java does not support optional parameters. Overloaded method(s) are created above: - //ORIGINAL LINE: public void Dispatch(ref RowOperationDispatcher dispatcher, ref RowCursor root, - // LayoutColumn col, LayoutType t, TValue value = default) where TLayout : LayoutType - public , TValue> void Dispatch(tangible.RefObject dispatcher, tangible.RefObject root, LayoutColumn col, LayoutType t, TValue value) { - tangible.RefObject tempRef_Row = - new tangible.RefObject(dispatcher.argValue.Row); - ResultAssert.IsSuccess(t.TypeAs().DeleteSparse(tempRef_Row, root)); - dispatcher.argValue.argValue.Row = tempRef_Row.argValue; - } - - public void DispatchArray(tangible.RefObject dispatcher, - tangible.RefObject scope, LayoutType t, TypeArgumentList typeArgs, - Object value) { - Contract.Requires(typeArgs.getCount() == 1); - - tangible.RefObject tempRef_Row = - new tangible.RefObject(dispatcher.argValue.Row); - RowCursor arrayScope; - tangible.OutObject tempOut_arrayScope = - new tangible.OutObject(); - ResultAssert.IsSuccess(t.TypeAs().ReadScope(tempRef_Row, scope, tempOut_arrayScope)); - arrayScope = tempOut_arrayScope.argValue; - dispatcher.argValue.argValue.Row = tempRef_Row.argValue; - - if (!arrayScope.Immutable) { - List items = (List)value; - for (Object item : items) { - tangible.RefObject tempRef_Row2 = - new tangible.RefObject(dispatcher.argValue.Row); - assert arrayScope.MoveNext(tempRef_Row2); - dispatcher.argValue.argValue.Row = tempRef_Row2.argValue; - // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'ref' keyword - - // these cannot be converted using the 'RefObject' helper class unless the method is within the code - // being modified: - dispatcher.argValue.LayoutCodeSwitch(ref arrayScope, null, typeArgs.get(0).getType(), - typeArgs.get(0).getTypeArgs().clone(), item); - } - } - - tangible.RefObject tempRef_Row3 = - new tangible.RefObject(dispatcher.argValue.Row); - ResultAssert.IsSuccess(t.TypeAs().DeleteScope(tempRef_Row3, scope)); - dispatcher.argValue.argValue.Row = tempRef_Row3.argValue; - } - - public void DispatchMap(tangible.RefObject dispatcher, - tangible.RefObject scope, LayoutType t, TypeArgumentList typeArgs, - Object value) { - Contract.Requires(typeArgs.getCount() == 2); - - tangible.RefObject tempRef_Row = - new tangible.RefObject(dispatcher.argValue.Row); - RowCursor mapScope; - tangible.OutObject tempOut_mapScope = - new tangible.OutObject(); - ResultAssert.IsSuccess(t.TypeAs().ReadScope(tempRef_Row, scope, tempOut_mapScope)); - mapScope = tempOut_mapScope.argValue; - dispatcher.argValue.argValue.Row = tempRef_Row.argValue; - if (!mapScope.Immutable) { - List items = (List)value; - for (Object item : items) { - tangible.RefObject tempRef_Row2 = - new tangible.RefObject(dispatcher.argValue.Row); - assert mapScope.MoveNext(tempRef_Row2); - dispatcher.argValue.argValue.Row = tempRef_Row2.argValue; - // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'ref' keyword - - // these cannot be converted using the 'RefObject' helper class unless the method is within the code - // being modified: - dispatcher.argValue.LayoutCodeSwitch(ref mapScope, null, LayoutType.TypedTuple, typeArgs.clone(), item); - } - } - - tangible.RefObject tempRef_Row3 = - new tangible.RefObject(dispatcher.argValue.Row); - ResultAssert.IsSuccess(t.TypeAs().DeleteScope(tempRef_Row3, scope)); - dispatcher.argValue.argValue.Row = tempRef_Row3.argValue; - } - - public void DispatchNullable(tangible.RefObject dispatcher, - tangible.RefObject scope, LayoutType t, TypeArgumentList typeArgs, - Object value) { - Contract.Requires(typeArgs.getCount() == 1); - tangible.RefObject tempRef_Row = - new tangible.RefObject(dispatcher.argValue.Row); - ResultAssert.IsSuccess(t.TypeAs().DeleteScope(tempRef_Row, scope)); - dispatcher.argValue.argValue.Row = tempRef_Row.argValue; - } - - public void DispatchObject(tangible.RefObject dispatcher, - tangible.RefObject scope) { - } - - public void DispatchSet(tangible.RefObject dispatcher, - tangible.RefObject scope, LayoutType t, TypeArgumentList typeArgs, - Object value) { - Contract.Requires(typeArgs.getCount() == 1); - - tangible.RefObject tempRef_Row = - new tangible.RefObject(dispatcher.argValue.Row); - RowCursor setScope; - tangible.OutObject tempOut_setScope = - new tangible.OutObject(); - ResultAssert.IsSuccess(t.TypeAs().ReadScope(tempRef_Row, scope, tempOut_setScope)); - setScope = tempOut_setScope.argValue; - dispatcher.argValue.argValue.Row = tempRef_Row.argValue; - if (!setScope.Immutable) { - List items = (List)value; - for (Object item : items) { - tangible.RefObject tempRef_Row2 = - new tangible.RefObject(dispatcher.argValue.Row); - assert setScope.MoveNext(tempRef_Row2); - dispatcher.argValue.argValue.Row = tempRef_Row2.argValue; - // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'ref' keyword - - // these cannot be converted using the 'RefObject' helper class unless the method is within the code - // being modified: - dispatcher.argValue.LayoutCodeSwitch(ref setScope, null, typeArgs.get(0).getType(), - typeArgs.get(0).getTypeArgs().clone(), item); - } - } - - tangible.RefObject tempRef_Row3 = - new tangible.RefObject(dispatcher.argValue.Row); - ResultAssert.IsSuccess(t.TypeAs().DeleteScope(tempRef_Row3, scope)); - dispatcher.argValue.argValue.Row = tempRef_Row3.argValue; - } - - public void DispatchTuple(tangible.RefObject dispatcher, - tangible.RefObject scope, LayoutType t, TypeArgumentList typeArgs, - Object value) { - Contract.Requires(typeArgs.getCount() >= 2); - tangible.RefObject tempRef_Row = - new tangible.RefObject(dispatcher.argValue.Row); - ResultAssert.IsSuccess(t.TypeAs().DeleteScope(tempRef_Row, scope)); - dispatcher.argValue.argValue.Row = tempRef_Row.argValue; - } - - public void DispatchUDT(tangible.RefObject dispatcher, tangible.RefObject scope, LayoutType t, TypeArgumentList typeArgs, Object value) { - tangible.RefObject tempRef_Row = new tangible.RefObject(dispatcher.argValue.Row); - ResultAssert.IsSuccess(t.TypeAs().DeleteScope(tempRef_Row, scope)); - dispatcher.argValue.argValue.Row = tempRef_Row.argValue; - } -} \ No newline at end of file diff --git a/jre/src/test/java/azure/data/cosmos/serialization/hybridrow/unit/IDispatchable.java b/jre/src/test/java/azure/data/cosmos/serialization/hybridrow/unit/IDispatchable.java deleted file mode 100644 index 748d31e..0000000 --- a/jre/src/test/java/azure/data/cosmos/serialization/hybridrow/unit/IDispatchable.java +++ /dev/null @@ -1,11 +0,0 @@ -//------------------------------------------------------------ -// Copyright (c) Microsoft Corporation. All rights reserved. -//------------------------------------------------------------ - -package azure.data.cosmos.serialization.hybridrow.unit; - -import azure.data.cosmos.serialization.hybridrow.RowCursor; - -public interface IDispatchable { - void Dispatch(tangible.RefObject dispatcher, tangible.RefObject scope); -} \ No newline at end of file diff --git a/jre/src/test/java/azure/data/cosmos/serialization/hybridrow/unit/IDispatcher.java b/jre/src/test/java/azure/data/cosmos/serialization/hybridrow/unit/IDispatcher.java deleted file mode 100644 index 2fe0cd0..0000000 --- a/jre/src/test/java/azure/data/cosmos/serialization/hybridrow/unit/IDispatcher.java +++ /dev/null @@ -1,41 +0,0 @@ -//------------------------------------------------------------ -// Copyright (c) Microsoft Corporation. All rights reserved. -//------------------------------------------------------------ - -package azure.data.cosmos.serialization.hybridrow.unit; - -import azure.data.cosmos.serialization.hybridrow.RowCursor; - -public interface IDispatcher { - - , TValue> void Dispatch(tangible.RefObject dispatcher, - tangible.RefObject scope, LayoutColumn col, - LayoutType t); - - //C# TO JAVA CONVERTER NOTE: Java does not support optional parameters. Overloaded method(s) are created above: - //ORIGINAL LINE: void Dispatch(ref RowOperationDispatcher dispatcher, ref RowCursor scope, - // LayoutColumn col, LayoutType t, TValue value = default) where TLayout : LayoutType; - , TValue> void Dispatch(tangible.RefObject dispatcher, - tangible.RefObject scope, LayoutColumn col, - LayoutType t, TValue value); - - void DispatchArray(tangible.RefObject dispatcher, tangible.RefObject scope, - LayoutType t, TypeArgumentList typeArgs, Object value); - - void DispatchMap(tangible.RefObject dispatcher, tangible.RefObject scope, - LayoutType t, TypeArgumentList typeArgs, Object value); - - void DispatchNullable(tangible.RefObject dispatcher, tangible.RefObject scope, - LayoutType t, TypeArgumentList typeArgs, Object value); - - void DispatchObject(tangible.RefObject dispatcher, tangible.RefObject scope); - - void DispatchSet(tangible.RefObject dispatcher, tangible.RefObject scope, - LayoutType t, TypeArgumentList typeArgs, Object value); - - void DispatchTuple(tangible.RefObject dispatcher, tangible.RefObject scope, - LayoutType t, TypeArgumentList typeArgs, Object value); - - void DispatchUDT(tangible.RefObject dispatcher, tangible.RefObject scope, - LayoutType type, TypeArgumentList typeArgs, Object value); -} \ No newline at end of file diff --git a/jre/src/test/java/azure/data/cosmos/serialization/hybridrow/unit/NullRowDispatcher.java b/jre/src/test/java/azure/data/cosmos/serialization/hybridrow/unit/NullRowDispatcher.java deleted file mode 100644 index eb6d238..0000000 --- a/jre/src/test/java/azure/data/cosmos/serialization/hybridrow/unit/NullRowDispatcher.java +++ /dev/null @@ -1,85 +0,0 @@ -//------------------------------------------------------------ -// Copyright (c) Microsoft Corporation. All rights reserved. -//------------------------------------------------------------ - -package azure.data.cosmos.serialization.hybridrow.unit; - -import 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 -// from the original: -//ORIGINAL LINE: internal struct NullRowDispatcher : IDispatcher -public final class NullRowDispatcher implements IDispatcher { - - public , TValue> void Dispatch(tangible.RefObject dispatcher, tangible.RefObject root, LayoutColumn col, LayoutType t) { - Dispatch(dispatcher, root, col, t, null); - } - - //C# TO JAVA CONVERTER NOTE: Java does not support optional parameters. Overloaded method(s) are created above: - //ORIGINAL LINE: public void Dispatch(ref RowOperationDispatcher dispatcher, ref RowCursor root, - // LayoutColumn col, LayoutType t, TValue expected = default) where TLayout : LayoutType - public , TValue> void Dispatch(tangible.RefObject dispatcher, tangible.RefObject root, LayoutColumn col, LayoutType t, TValue expected) { - switch (col == null ? null : col.getStorage()) { - case Fixed: - tangible.RefObject tempRef_Row = - new tangible.RefObject(dispatcher.argValue.Row); - TValue _; - // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'out' keyword - - // these cannot be converted using the 'OutObject' helper class unless the method is within the code - // being modified: - ResultAssert.NotFound(t.TypeAs().ReadFixed(tempRef_Row, root, col, out _)); - dispatcher.argValue.argValue.Row = tempRef_Row.argValue; - break; - case Variable: - tangible.RefObject tempRef_Row2 = - new tangible.RefObject(dispatcher.argValue.Row); - TValue _; - // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'out' keyword - - // these cannot be converted using the 'OutObject' helper class unless the method is within the code - // being modified: - ResultAssert.NotFound(t.TypeAs().ReadVariable(tempRef_Row2, root, col, out _)); - dispatcher.argValue.argValue.Row = tempRef_Row2.argValue; - break; - default: - tangible.RefObject tempRef_Row3 = - new tangible.RefObject(dispatcher.argValue.Row); - TValue _; - // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'out' keyword - - // these cannot be converted using the 'OutObject' helper class unless the method is within the code - // being modified: - ResultAssert.NotFound(t.TypeAs().ReadSparse(tempRef_Row3, root, out _)); - dispatcher.argValue.argValue.Row = tempRef_Row3.argValue; - break; - } - } - - public void DispatchArray(tangible.RefObject dispatcher, - tangible.RefObject scope, LayoutType t, TypeArgumentList typeArgs, - Object value) { - } - - public void DispatchMap(tangible.RefObject dispatcher, tangible.RefObject scope, LayoutType t, TypeArgumentList typeArgs, Object value) { - } - - public void DispatchNullable(tangible.RefObject dispatcher, - tangible.RefObject scope, LayoutType t, TypeArgumentList typeArgs, - Object value) { - } - - public void DispatchObject(tangible.RefObject dispatcher, - tangible.RefObject scope) { - } - - public void DispatchSet(tangible.RefObject dispatcher, - tangible.RefObject scope, LayoutType t, TypeArgumentList typeArgs, - Object value) { - } - - public void DispatchTuple(tangible.RefObject dispatcher, - tangible.RefObject scope, LayoutType t, TypeArgumentList typeArgs, - Object value) { - } - - public void DispatchUDT(tangible.RefObject dispatcher, tangible.RefObject scope, LayoutType t, TypeArgumentList typeArgs, Object value) { - } -} \ No newline at end of file diff --git a/jre/src/test/java/azure/data/cosmos/serialization/hybridrow/unit/ReadRowDispatcher.java b/jre/src/test/java/azure/data/cosmos/serialization/hybridrow/unit/ReadRowDispatcher.java deleted file mode 100644 index 4565a88..0000000 --- a/jre/src/test/java/azure/data/cosmos/serialization/hybridrow/unit/ReadRowDispatcher.java +++ /dev/null @@ -1,234 +0,0 @@ -//------------------------------------------------------------ -// Copyright (c) Microsoft Corporation. All rights reserved. -//------------------------------------------------------------ - -package azure.data.cosmos.serialization.hybridrow.unit; - -import azure.data.cosmos.serialization.hybridrow.RowCursor; - -import java.util.Collection; -import java.util.List; - -//C# TO JAVA CONVERTER WARNING: Java does not allow user-defined value types. The behavior of this class may differ -// from the original: -//ORIGINAL LINE: internal struct ReadRowDispatcher : IDispatcher -public final class ReadRowDispatcher implements IDispatcher { - - public , TValue> void Dispatch(tangible.RefObject dispatcher, tangible.RefObject root, LayoutColumn col, LayoutType t) { - Dispatch(dispatcher, root, col, t, null); - } - - //C# TO JAVA CONVERTER NOTE: Java does not support optional parameters. Overloaded method(s) are created above: - //ORIGINAL LINE: public void Dispatch(ref RowOperationDispatcher dispatcher, ref RowCursor root, - // LayoutColumn col, LayoutType t, TValue expected = default) where TLayout : LayoutType - public , TValue> void Dispatch(tangible.RefObject dispatcher, tangible.RefObject root, LayoutColumn col, LayoutType t, TValue expected) { - TValue value; - switch (col == null ? null : col.getStorage()) { - case Fixed: - tangible.RefObject tempRef_Row = - new tangible.RefObject(dispatcher.argValue.Row); - tangible.OutObject tempOut_value = new tangible.OutObject(); - ResultAssert.IsSuccess(t.TypeAs().ReadFixed(tempRef_Row, root, col, tempOut_value)); - value = tempOut_value.argValue; - dispatcher.argValue.argValue.Row = tempRef_Row.argValue; - break; - case Variable: - tangible.RefObject tempRef_Row2 = - new tangible.RefObject(dispatcher.argValue.Row); - tangible.OutObject tempOut_value2 = new tangible.OutObject(); - ResultAssert.IsSuccess(t.TypeAs().ReadVariable(tempRef_Row2, root, col, tempOut_value2)); - value = tempOut_value2.argValue; - dispatcher.argValue.argValue.Row = tempRef_Row2.argValue; - break; - default: - tangible.RefObject tempRef_Row3 = - new tangible.RefObject(dispatcher.argValue.Row); - tangible.OutObject tempOut_value3 = new tangible.OutObject(); - ResultAssert.IsSuccess(t.TypeAs().ReadSparse(tempRef_Row3, root, tempOut_value3)); - value = tempOut_value3.argValue; - dispatcher.argValue.argValue.Row = tempRef_Row3.argValue; - break; - } - - if (TValue.class.IsArray) { - CollectionAssert.AreEqual((Collection)expected, (Collection)value); - } else { - assert expected == value; - } - } - - public void DispatchArray(tangible.RefObject dispatcher, - tangible.RefObject scope, LayoutType t, TypeArgumentList typeArgs, - Object value) { - Contract.Requires(typeArgs.getCount() == 1); - - tangible.RefObject tempRef_Row = - new tangible.RefObject(dispatcher.argValue.Row); - RowCursor arrayScope; - tangible.OutObject tempOut_arrayScope = - new tangible.OutObject(); - ResultAssert.IsSuccess(t.TypeAs().ReadScope(tempRef_Row, scope, tempOut_arrayScope)); - arrayScope = tempOut_arrayScope.argValue; - dispatcher.argValue.argValue.Row = tempRef_Row.argValue; - - int i = 0; - List items = (List)value; - tangible.RefObject tempRef_Row2 = - new tangible.RefObject(dispatcher.argValue.Row); - while (arrayScope.MoveNext(tempRef_Row2)) { - dispatcher.argValue.argValue.Row = tempRef_Row2.argValue; - // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'ref' keyword - these - // cannot be converted using the 'RefObject' helper class unless the method is within the code being - // modified: - dispatcher.argValue.LayoutCodeSwitch(ref arrayScope, null, typeArgs.get(0).getType(), - typeArgs.get(0).getTypeArgs().clone(), items.get(i++)); - } - dispatcher.argValue.argValue.Row = tempRef_Row2.argValue; - } - - public void DispatchMap(tangible.RefObject dispatcher, - tangible.RefObject scope, LayoutType t, TypeArgumentList typeArgs, - Object value) { - Contract.Requires(typeArgs.getCount() == 2); - - tangible.RefObject tempRef_Row = - new tangible.RefObject(dispatcher.argValue.Row); - RowCursor mapScope; - tangible.OutObject tempOut_mapScope = - new tangible.OutObject(); - ResultAssert.IsSuccess(t.TypeAs().ReadScope(tempRef_Row, scope, tempOut_mapScope)); - mapScope = tempOut_mapScope.argValue; - dispatcher.argValue.argValue.Row = tempRef_Row.argValue; - int i = 0; - List items = (List)value; - tangible.RefObject tempRef_Row2 = - new tangible.RefObject(dispatcher.argValue.Row); - while (mapScope.MoveNext(tempRef_Row2)) { - dispatcher.argValue.argValue.Row = tempRef_Row2.argValue; - // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'ref' keyword - these - // cannot be converted using the 'RefObject' helper class unless the method is within the code being - // modified: - dispatcher.argValue.LayoutCodeSwitch(ref mapScope, null, LayoutType.TypedTuple, typeArgs.clone(), - items.get(i++)); - } - dispatcher.argValue.argValue.Row = tempRef_Row2.argValue; - } - - public void DispatchNullable(tangible.RefObject dispatcher, - tangible.RefObject scope, LayoutType t, TypeArgumentList typeArgs, - Object value) { - Contract.Requires(typeArgs.getCount() == 1); - - tangible.RefObject tempRef_Row = - new tangible.RefObject(dispatcher.argValue.Row); - RowCursor nullableScope; - tangible.OutObject tempOut_nullableScope = - new tangible.OutObject(); - ResultAssert.IsSuccess(t.TypeAs().ReadScope(tempRef_Row, scope, tempOut_nullableScope)); - nullableScope = tempOut_nullableScope.argValue; - dispatcher.argValue.argValue.Row = tempRef_Row.argValue; - - if (value != null) { - tangible.RefObject tempRef_Row2 = - new tangible.RefObject(dispatcher.argValue.Row); - tangible.RefObject tempRef_nullableScope = - new tangible.RefObject(nullableScope); - ResultAssert.IsSuccess(LayoutNullable.HasValue(tempRef_Row2, tempRef_nullableScope)); - nullableScope = tempRef_nullableScope.argValue; - dispatcher.argValue.argValue.Row = tempRef_Row2.argValue; - tangible.RefObject tempRef_Row3 = - new tangible.RefObject(dispatcher.argValue.Row); - nullableScope.MoveNext(tempRef_Row3); - dispatcher.argValue.argValue.Row = tempRef_Row3.argValue; - // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'ref' keyword - these - // cannot be converted using the 'RefObject' helper class unless the method is within the code being - // modified: - dispatcher.argValue.LayoutCodeSwitch(ref nullableScope, null, typeArgs.get(0).getType(), - typeArgs.get(0).getTypeArgs().clone(), value); - } else { - tangible.RefObject tempRef_Row4 = - new tangible.RefObject(dispatcher.argValue.Row); - tangible.RefObject tempRef_nullableScope2 = - new tangible.RefObject(nullableScope); - ResultAssert.NotFound(LayoutNullable.HasValue(tempRef_Row4, tempRef_nullableScope2)); - nullableScope = tempRef_nullableScope2.argValue; - dispatcher.argValue.argValue.Row = tempRef_Row4.argValue; - } - } - - public void DispatchObject(tangible.RefObject dispatcher, - tangible.RefObject scope) { - } - - public void DispatchSet(tangible.RefObject dispatcher, - tangible.RefObject scope, LayoutType t, TypeArgumentList typeArgs, - Object value) { - Contract.Requires(typeArgs.getCount() == 1); - - tangible.RefObject tempRef_Row = - new tangible.RefObject(dispatcher.argValue.Row); - RowCursor setScope; - tangible.OutObject tempOut_setScope = - new tangible.OutObject(); - ResultAssert.IsSuccess(t.TypeAs().ReadScope(tempRef_Row, scope, tempOut_setScope)); - setScope = tempOut_setScope.argValue; - dispatcher.argValue.argValue.Row = tempRef_Row.argValue; - int i = 0; - List items = (List)value; - tangible.RefObject tempRef_Row2 = - new tangible.RefObject(dispatcher.argValue.Row); - while (setScope.MoveNext(tempRef_Row2)) { - dispatcher.argValue.argValue.Row = tempRef_Row2.argValue; - // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'ref' keyword - these - // cannot be converted using the 'RefObject' helper class unless the method is within the code being - // modified: - dispatcher.argValue.LayoutCodeSwitch(ref setScope, null, typeArgs.get(0).getType(), - typeArgs.get(0).getTypeArgs().clone(), items.get(i++)); - } - dispatcher.argValue.argValue.Row = tempRef_Row2.argValue; - } - - public void DispatchTuple(tangible.RefObject dispatcher, - tangible.RefObject scope, LayoutType t, TypeArgumentList typeArgs, - Object value) { - Contract.Requires(typeArgs.getCount() >= 2); - - tangible.RefObject tempRef_Row = - new tangible.RefObject(dispatcher.argValue.Row); - RowCursor tupleScope; - tangible.OutObject tempOut_tupleScope = - new tangible.OutObject(); - ResultAssert.IsSuccess(t.TypeAs().ReadScope(tempRef_Row, scope, tempOut_tupleScope)); - tupleScope = tempOut_tupleScope.argValue; - dispatcher.argValue.argValue.Row = tempRef_Row.argValue; - - for (int i = 0; i < typeArgs.getCount(); i++) { - tangible.RefObject tempRef_Row2 = - new tangible.RefObject(dispatcher.argValue.Row); - tupleScope.MoveNext(tempRef_Row2); - dispatcher.argValue.argValue.Row = tempRef_Row2.argValue; - 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 - // cannot be converted using the 'RefObject' helper class unless the method is within the code being - // modified: - dispatcher.argValue.LayoutCodeSwitch(ref tupleScope, null, typeArgs.get(i).getType(), - typeArgs.get(i).getTypeArgs().clone(), valueAccessor.GetValue(value)); - } - } - - public void DispatchUDT(tangible.RefObject dispatcher, - tangible.RefObject scope, LayoutType t, TypeArgumentList typeArgs, - Object value) { - tangible.RefObject tempRef_Row = new tangible.RefObject(dispatcher.argValue.Row); - RowCursor udtScope; - tangible.OutObject tempOut_udtScope = new tangible.OutObject(); - ResultAssert.IsSuccess(t.TypeAs().ReadScope(tempRef_Row, scope, tempOut_udtScope)); - udtScope = tempOut_udtScope.argValue; - dispatcher.argValue.argValue.Row = tempRef_Row.argValue; - IDispatchable valueDispatcher = value instanceof IDispatchable ? (IDispatchable)value : null; - assert valueDispatcher != null; - tangible.RefObject tempRef_udtScope = new tangible.RefObject(udtScope); - valueDispatcher.Dispatch(dispatcher, tempRef_udtScope); - udtScope = tempRef_udtScope.argValue; - } -} \ No newline at end of file diff --git a/jre/src/test/java/azure/data/cosmos/serialization/hybridrow/unit/WriteRowDispatcher.java b/jre/src/test/java/azure/data/cosmos/serialization/hybridrow/unit/WriteRowDispatcher.java deleted file mode 100644 index bc0a443..0000000 --- a/jre/src/test/java/azure/data/cosmos/serialization/hybridrow/unit/WriteRowDispatcher.java +++ /dev/null @@ -1,242 +0,0 @@ -//------------------------------------------------------------ -// Copyright (c) Microsoft Corporation. All rights reserved. -//------------------------------------------------------------ - -package azure.data.cosmos.serialization.hybridrow.unit; - -import azure.data.cosmos.serialization.hybridrow.RowCursor; - -import java.util.List; -import java.util.UUID; - -//C# TO JAVA CONVERTER WARNING: Java does not allow user-defined value types. The behavior of this class may differ -// from the original: -//ORIGINAL LINE: internal struct WriteRowDispatcher : IDispatcher -public final class WriteRowDispatcher implements IDispatcher { - - public , TValue> void Dispatch(tangible.RefObject dispatcher, tangible.RefObject field, LayoutColumn col, LayoutType t) { - Dispatch(dispatcher, field, col, t, null); - } - - //C# TO JAVA CONVERTER NOTE: Java does not support optional parameters. Overloaded method(s) are created above: - //ORIGINAL LINE: public void Dispatch(ref RowOperationDispatcher dispatcher, ref RowCursor - // field, LayoutColumn col, LayoutType t, TValue value = default) where TLayout : LayoutType - public , TValue> void Dispatch(tangible.RefObject dispatcher, tangible.RefObject field, LayoutColumn col, LayoutType t, TValue value) { - switch (col == null ? null : col.getStorage()) { - case Fixed: - tangible.RefObject tempRef_Row = - new tangible.RefObject(dispatcher.argValue.Row); - ResultAssert.IsSuccess(t.TypeAs().WriteFixed(tempRef_Row, field, col, value)); - dispatcher.argValue.argValue.Row = tempRef_Row.argValue; - break; - case Variable: - tangible.RefObject tempRef_Row2 = - new tangible.RefObject(dispatcher.argValue.Row); - ResultAssert.IsSuccess(t.TypeAs().WriteVariable(tempRef_Row2, field, col, value)); - dispatcher.argValue.argValue.Row = tempRef_Row2.argValue; - break; - default: - tangible.RefObject tempRef_Row3 = - new tangible.RefObject(dispatcher.argValue.Row); - ResultAssert.IsSuccess(t.TypeAs().WriteSparse(tempRef_Row3, field, value)); - dispatcher.argValue.argValue.Row = tempRef_Row3.argValue; - break; - } - } - - public void DispatchArray(tangible.RefObject dispatcher, - tangible.RefObject scope, LayoutType t, TypeArgumentList typeArgs, - Object value) { - Contract.Requires(typeArgs.getCount() == 1); - - tangible.RefObject tempRef_Row = - new tangible.RefObject(dispatcher.argValue.Row); - RowCursor arrayScope; - tangible.OutObject tempOut_arrayScope = - new tangible.OutObject(); - ResultAssert.IsSuccess(t.TypeAs().WriteScope(tempRef_Row, scope, typeArgs.clone(), - tempOut_arrayScope)); - arrayScope = tempOut_arrayScope.argValue; - dispatcher.argValue.argValue.Row = tempRef_Row.argValue; - - List items = (List)value; - for (Object item : items) { - // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'ref' keyword - these - // cannot be converted using the 'RefObject' helper class unless the method is within the code being - // modified: - dispatcher.argValue.LayoutCodeSwitch(ref arrayScope, null, typeArgs.get(0).getType(), - typeArgs.get(0).getTypeArgs().clone(), item); - tangible.RefObject tempRef_Row2 = - new tangible.RefObject(dispatcher.argValue.Row); - arrayScope.MoveNext(tempRef_Row2); - dispatcher.argValue.argValue.Row = tempRef_Row2.argValue; - } - } - - public void DispatchMap(tangible.RefObject dispatcher, - tangible.RefObject scope, LayoutType t, TypeArgumentList typeArgs, - Object value) { - Contract.Requires(typeArgs.getCount() == 2); - - tangible.RefObject tempRef_Row = - new tangible.RefObject(dispatcher.argValue.Row); - RowCursor mapScope; - tangible.OutObject tempOut_mapScope = - new tangible.OutObject(); - ResultAssert.IsSuccess(t.TypeAs().WriteScope(tempRef_Row, scope, typeArgs.clone(), - tempOut_mapScope)); - mapScope = tempOut_mapScope.argValue; - dispatcher.argValue.argValue.Row = tempRef_Row.argValue; - tangible.RefObject tempRef_mapScope = - new tangible.RefObject(mapScope); - TypeArgument fieldType = t.TypeAs().FieldType(tempRef_mapScope).clone(); - mapScope = tempRef_mapScope.argValue; - List pairs = (List)value; - for (Object pair : pairs) { - String elmPath = UUID.NewGuid().toString(); - tangible.RefObject tempRef_Row2 = - new tangible.RefObject(dispatcher.argValue.Row); - RowCursor tempCursor; - // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'out' keyword - these - // cannot be converted using the 'OutObject' helper class unless the method is within the code being - // modified: - RowCursor.CreateForAppend(tempRef_Row2, out tempCursor); - dispatcher.argValue.argValue.Row = tempRef_Row2.argValue; - // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'ref' keyword - these - // cannot be converted using the 'RefObject' helper class unless the method is within the code being - // modified: - dispatcher.argValue.LayoutCodeSwitch(ref tempCursor, elmPath, fieldType.getType(), - fieldType.getTypeArgs().clone(), pair); - - // Move item into the map. - tangible.RefObject tempRef_Row3 = - new tangible.RefObject(dispatcher.argValue.Row); - tangible.RefObject tempRef_mapScope2 = - new tangible.RefObject(mapScope); - tangible.RefObject tempRef_tempCursor = - new tangible.RefObject(tempCursor); - ResultAssert.IsSuccess(t.TypeAs().MoveField(tempRef_Row3, tempRef_mapScope2, - tempRef_tempCursor)); - tempCursor = tempRef_tempCursor.argValue; - mapScope = tempRef_mapScope2.argValue; - dispatcher.argValue.argValue.Row = tempRef_Row3.argValue; - } - } - - public void DispatchNullable(tangible.RefObject dispatcher, - tangible.RefObject scope, LayoutType t, TypeArgumentList typeArgs, - Object value) { - Contract.Requires(typeArgs.getCount() == 1); - - tangible.RefObject tempRef_Row = - new tangible.RefObject(dispatcher.argValue.Row); - RowCursor nullableScope; - // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'out' keyword - these - // cannot be converted using the 'OutObject' helper class unless the method is within the code being modified: - ResultAssert.IsSuccess(t.TypeAs().WriteScope(tempRef_Row, scope, typeArgs.clone(), - value != null, out nullableScope)); - dispatcher.argValue.argValue.Row = tempRef_Row.argValue; - - if (value != null) { - // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'ref' keyword - these - // cannot be converted using the 'RefObject' helper class unless the method is within the code being - // modified: - dispatcher.argValue.LayoutCodeSwitch(ref nullableScope, null, typeArgs.get(0).getType(), - typeArgs.get(0).getTypeArgs().clone(), value); - } - } - - public void DispatchObject(tangible.RefObject dispatcher, - tangible.RefObject scope) { - } - - public void DispatchSet(tangible.RefObject dispatcher, - tangible.RefObject scope, LayoutType t, TypeArgumentList typeArgs, - Object value) { - Contract.Requires(typeArgs.getCount() == 1); - - tangible.RefObject tempRef_Row = - new tangible.RefObject(dispatcher.argValue.Row); - RowCursor setScope; - tangible.OutObject tempOut_setScope = - new tangible.OutObject(); - ResultAssert.IsSuccess(t.TypeAs().WriteScope(tempRef_Row, scope, typeArgs.clone(), - tempOut_setScope)); - setScope = tempOut_setScope.argValue; - dispatcher.argValue.argValue.Row = tempRef_Row.argValue; - List items = (List)value; - for (Object item : items) { - String elmPath = UUID.NewGuid().toString(); - tangible.RefObject tempRef_Row2 = - new tangible.RefObject(dispatcher.argValue.Row); - RowCursor tempCursor; - // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'out' keyword - these - // cannot be converted using the 'OutObject' helper class unless the method is within the code being - // modified: - RowCursor.CreateForAppend(tempRef_Row2, out tempCursor); - dispatcher.argValue.argValue.Row = tempRef_Row2.argValue; - // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'ref' keyword - these - // cannot be converted using the 'RefObject' helper class unless the method is within the code being - // modified: - dispatcher.argValue.LayoutCodeSwitch(ref tempCursor, elmPath, typeArgs.get(0).getType(), - typeArgs.get(0).getTypeArgs().clone(), item); - - // Move item into the set. - tangible.RefObject tempRef_Row3 = - new tangible.RefObject(dispatcher.argValue.Row); - tangible.RefObject tempRef_setScope = - new tangible.RefObject(setScope); - tangible.RefObject tempRef_tempCursor = - new tangible.RefObject(tempCursor); - ResultAssert.IsSuccess(t.TypeAs().MoveField(tempRef_Row3, tempRef_setScope, - tempRef_tempCursor)); - tempCursor = tempRef_tempCursor.argValue; - setScope = tempRef_setScope.argValue; - dispatcher.argValue.argValue.Row = tempRef_Row3.argValue; - } - } - - public void DispatchTuple(tangible.RefObject dispatcher, - tangible.RefObject scope, LayoutType t, TypeArgumentList typeArgs, - Object value) { - Contract.Requires(typeArgs.getCount() >= 2); - - tangible.RefObject tempRef_Row = - new tangible.RefObject(dispatcher.argValue.Row); - RowCursor tupleScope; - // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'out' keyword - these - // cannot be converted using the 'OutObject' helper class unless the method is within the code being modified: - ResultAssert.IsSuccess(t.TypeAs().WriteScope(tempRef_Row, scope, typeArgs.clone(), - out tupleScope)); - dispatcher.argValue.argValue.Row = tempRef_Row.argValue; - - for (int i = 0; i < typeArgs.getCount(); i++) { - 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 - // cannot be converted using the 'RefObject' helper class unless the method is within the code being - // modified: - dispatcher.argValue.LayoutCodeSwitch(ref tupleScope, null, typeArgs.get(i).getType(), - typeArgs.get(i).getTypeArgs().clone(), valueAccessor.GetValue(value)); - tangible.RefObject tempRef_Row2 = - new tangible.RefObject(dispatcher.argValue.Row); - tupleScope.MoveNext(tempRef_Row2); - dispatcher.argValue.argValue.Row = tempRef_Row2.argValue; - } - } - - public void DispatchUDT(tangible.RefObject dispatcher, - tangible.RefObject scope, LayoutType t, TypeArgumentList typeArgs, - Object value) { - tangible.RefObject tempRef_Row = new tangible.RefObject(dispatcher.argValue.Row); - RowCursor udtScope; - tangible.OutObject tempOut_udtScope = new tangible.OutObject(); - ResultAssert.IsSuccess(t.TypeAs().WriteScope(tempRef_Row, scope, typeArgs.clone(), tempOut_udtScope)); - udtScope = tempOut_udtScope.argValue; - dispatcher.argValue.argValue.Row = tempRef_Row.argValue; - IDispatchable valueDispatcher = value instanceof IDispatchable ? (IDispatchable)value : null; - assert valueDispatcher != null; - tangible.RefObject tempRef_udtScope = new tangible.RefObject(udtScope); - valueDispatcher.Dispatch(dispatcher, tempRef_udtScope); - udtScope = tempRef_udtScope.argValue; - } -} \ No newline at end of file diff --git a/jre/src/test/java/azure/data/cosmos/serialization/hybridrow/unit/customerschema/AddressSerializer.java b/jre/src/test/java/azure/data/cosmos/serialization/hybridrow/unit/customerschema/AddressSerializer.java deleted file mode 100644 index 2e92f21..0000000 --- a/jre/src/test/java/azure/data/cosmos/serialization/hybridrow/unit/customerschema/AddressSerializer.java +++ /dev/null @@ -1,94 +0,0 @@ -//------------------------------------------------------------ -// Copyright (c) Microsoft Corporation. All rights reserved. -//------------------------------------------------------------ - -package azure.data.cosmos.serialization.hybridrow.unit.customerschema; - -import azure.data.cosmos.serialization.hybridrow.Result; -import azure.data.cosmos.serialization.hybridrow.Tests.Unit.*; - -public final class AddressSerializer { - public static Result Read(tangible.RefObject reader, tangible.OutObject

obj) { - obj.argValue = new Address(); - while (reader.argValue.Read()) { - Result r; - switch (reader.argValue.getPath()) { - case "street": - tangible.OutObject tempOut_Street = new tangible.OutObject(); - r = reader.argValue.ReadString(tempOut_Street); - obj.argValue.argValue.Street = tempOut_Street.argValue; - if (r != Result.Success) { - return r; - } - - break; - case "city": - tangible.OutObject tempOut_City = new tangible.OutObject(); - r = reader.argValue.ReadString(tempOut_City); - obj.argValue.argValue.City = tempOut_City.argValue; - if (r != Result.Success) { - return r; - } - - break; - case "state": - tangible.OutObject tempOut_State = new tangible.OutObject(); - r = reader.argValue.ReadString(tempOut_State); - obj.argValue.argValue.State = tempOut_State.argValue; - if (r != Result.Success) { - return r; - } - - break; - case "postal_code": - tangible.RefObject tempRef_child = - new tangible.RefObject(child); - tangible.OutObject tempOut_PostalCode = new tangible.OutObject(); - // TODO: C# TO JAVA CONVERTER: The following lambda contained an unresolved 'ref' keyword - these are not converted by C# to Java Converter: - r = reader.argValue.ReadScope(obj.argValue, (ref RowReader child, Address parent) -> PostalCodeSerializer.Read(tempRef_child, tempOut_PostalCode)); - parent.PostalCode = tempOut_PostalCode.argValue; - child = tempRef_child.argValue; - - if (r != Result.Success) { - return r; - } - - break; - } - } - - return Result.Success; - } - - public static Result Write(tangible.RefObject writer, TypeArgument typeArg, Address obj) { - Result r; - if (obj.Street != null) { - r = writer.argValue.WriteString("street", obj.Street); - if (r != Result.Success) { - return r; - } - } - - if (obj.City != null) { - r = writer.argValue.WriteString("city", obj.City); - if (r != Result.Success) { - return r; - } - } - - if (obj.State != null) { - r = writer.argValue.WriteString("state", obj.State); - if (r != Result.Success) { - return r; - } - } - - if (obj.PostalCode != null) { - r = writer.argValue.WriteScope("postal_code", PostalCodeSerializer.TypeArg, obj.PostalCode, - PostalCodeSerializer.Write); - return r; - } - - return Result.Success; - } -} \ No newline at end of file diff --git a/jre/src/test/java/azure/data/cosmos/serialization/hybridrow/unit/customerschema/PostalCodeSerializer.java b/jre/src/test/java/azure/data/cosmos/serialization/hybridrow/unit/customerschema/PostalCodeSerializer.java deleted file mode 100644 index d1aa0a1..0000000 --- a/jre/src/test/java/azure/data/cosmos/serialization/hybridrow/unit/customerschema/PostalCodeSerializer.java +++ /dev/null @@ -1,63 +0,0 @@ -//------------------------------------------------------------ -// Copyright (c) Microsoft Corporation. All rights reserved. -//------------------------------------------------------------ - -package azure.data.cosmos.serialization.hybridrow.unit.customerschema; - -import azure.data.cosmos.serialization.hybridrow.Result; -import azure.data.cosmos.serialization.hybridrow.SchemaId; -import azure.data.cosmos.serialization.hybridrow.Tests.Unit.*; - -// TODO: C# TO JAVA CONVERTER: There is no preprocessor in Java: -///#pragma warning disable SA1401 // Fields should be private - - -public final class PostalCodeSerializer { - public static TypeArgument TypeArg = new TypeArgument(LayoutType.UDT, new TypeArgumentList(new SchemaId(1))); - - public static Result Read(tangible.RefObject reader, tangible.OutObject obj) { - obj.argValue = new PostalCode(); - while (reader.argValue.Read()) { - Result r; - switch (reader.argValue.getPath()) { - case "zip": - tangible.OutObject tempOut_Zip = new tangible.OutObject(); - r = reader.argValue.ReadInt32(tempOut_Zip); - obj.argValue.argValue.Zip = tempOut_Zip.argValue; - if (r != Result.Success) { - return r; - } - - break; - case "plus4": - short value; - tangible.OutObject tempOut_value = new tangible.OutObject(); - r = reader.argValue.ReadInt16(tempOut_value); - value = tempOut_value.argValue; - if (r != Result.Success) { - return r; - } - - obj.argValue.Plus4 = value; - break; - } - } - - return Result.Success; - } - - public static Result Write(tangible.RefObject writer, TypeArgument typeArg, PostalCode obj) { - Result r; - r = writer.argValue.WriteInt32("zip", obj.Zip); - if (r != Result.Success) { - return r; - } - - if (obj.Plus4.HasValue) { - r = writer.argValue.WriteInt16("plus4", obj.Plus4.Value); - return r; - } - - return Result.Success; - } -} \ No newline at end of file diff --git a/jre/src/test/java/azure/data/cosmos/serialization/hybridrow/perf/BenchmarkSuiteBase.java b/jre/src/test/java/com/azure/data/cosmos/serialization/hybridrow/perf/BenchmarkSuiteBase.java similarity index 80% rename from jre/src/test/java/azure/data/cosmos/serialization/hybridrow/perf/BenchmarkSuiteBase.java rename to jre/src/test/java/com/azure/data/cosmos/serialization/hybridrow/perf/BenchmarkSuiteBase.java index 1d3075e..d5a238f 100644 --- a/jre/src/test/java/azure/data/cosmos/serialization/hybridrow/perf/BenchmarkSuiteBase.java +++ b/jre/src/test/java/com/azure/data/cosmos/serialization/hybridrow/perf/BenchmarkSuiteBase.java @@ -2,19 +2,21 @@ // Copyright (c) Microsoft Corporation. All rights reserved. //------------------------------------------------------------ -package azure.data.cosmos.serialization.hybridrow.perf; +package com.azure.data.cosmos.serialization.hybridrow.perf; -import azure.data.cosmos.serialization.hybridrow.HybridRowVersion; -import azure.data.cosmos.serialization.hybridrow.MemorySpanResizer; -import azure.data.cosmos.serialization.hybridrow.Result; -import azure.data.cosmos.serialization.hybridrow.RowBuffer; -import azure.data.cosmos.serialization.hybridrow.io.RowReader; -import azure.data.cosmos.serialization.hybridrow.layouts.Layout; -import azure.data.cosmos.serialization.hybridrow.layouts.LayoutResolver; -import azure.data.cosmos.serialization.hybridrow.layouts.LayoutResolverNamespace; -import azure.data.cosmos.serialization.hybridrow.layouts.SystemSchema; -import azure.data.cosmos.serialization.hybridrow.recordio.RecordIOStream; -import azure.data.cosmos.serialization.hybridrow.recordio.Segment; +import com.azure.data.cosmos.core.OutObject; +import com.azure.data.cosmos.core.RefObject; +import com.azure.data.cosmos.serialization.hybridrow.HybridRowVersion; +import com.azure.data.cosmos.serialization.hybridrow.MemorySpanResizer; +import com.azure.data.cosmos.serialization.hybridrow.Result; +import com.azure.data.cosmos.serialization.hybridrow.RowBuffer; +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.LayoutResolver; +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.recordio.RecordIOStream; +import com.azure.data.cosmos.serialization.hybridrow.recordio.Segment; import java.util.ArrayList; import java.util.HashMap; @@ -72,16 +74,16 @@ public class BenchmarkSuiteBase { // Dictionary rowValue) //C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java: protected static Result LoadOneRow(Memory buffer, LayoutResolver resolver, - tangible.OutObject> rowValue) { + OutObject> rowValue) { RowBuffer row = new RowBuffer(buffer.Span, HybridRowVersion.V1, resolver); - tangible.RefObject tempRef_row = - new tangible.RefObject(row); + RefObject tempRef_row = + new RefObject(row); RowReader reader = new RowReader(tempRef_row); - row = tempRef_row.argValue; - tangible.RefObject tempRef_reader = - new tangible.RefObject(reader); + row = tempRef_row.get(); + RefObject tempRef_reader = + new RefObject(reader); Result tempVar = DiagnosticConverter.ReaderToDynamic(tempRef_reader, rowValue); - reader = tempRef_reader.argValue; + reader = tempRef_reader.get(); return tempVar; } diff --git a/jre/src/test/java/azure/data/cosmos/serialization/hybridrow/perf/BsonJsonModelRowGenerator.java b/jre/src/test/java/com/azure/data/cosmos/serialization/hybridrow/perf/BsonJsonModelRowGenerator.java similarity index 96% rename from jre/src/test/java/azure/data/cosmos/serialization/hybridrow/perf/BsonJsonModelRowGenerator.java rename to jre/src/test/java/com/azure/data/cosmos/serialization/hybridrow/perf/BsonJsonModelRowGenerator.java index 12f10f6..9a0a440 100644 --- a/jre/src/test/java/azure/data/cosmos/serialization/hybridrow/perf/BsonJsonModelRowGenerator.java +++ b/jre/src/test/java/com/azure/data/cosmos/serialization/hybridrow/perf/BsonJsonModelRowGenerator.java @@ -2,7 +2,7 @@ // Copyright (c) Microsoft Corporation. All rights reserved. //------------------------------------------------------------ -package azure.data.cosmos.serialization.hybridrow.perf; +package com.azure.data.cosmos.serialization.hybridrow.perf; import org.bson.BsonWriter; import org.bson.BsonBinaryWriter diff --git a/jre/src/test/java/azure/data/cosmos/serialization/hybridrow/perf/BsonReaderExtensions.java b/jre/src/test/java/com/azure/data/cosmos/serialization/hybridrow/perf/BsonReaderExtensions.java similarity index 69% rename from jre/src/test/java/azure/data/cosmos/serialization/hybridrow/perf/BsonReaderExtensions.java rename to jre/src/test/java/com/azure/data/cosmos/serialization/hybridrow/perf/BsonReaderExtensions.java index 3166722..ae4a670 100644 --- a/jre/src/test/java/azure/data/cosmos/serialization/hybridrow/perf/BsonReaderExtensions.java +++ b/jre/src/test/java/com/azure/data/cosmos/serialization/hybridrow/perf/BsonReaderExtensions.java @@ -2,7 +2,7 @@ // Copyright (c) Microsoft Corporation. All rights reserved. //------------------------------------------------------------ -package azure.data.cosmos.serialization.hybridrow.perf; +package com.azure.data.cosmos.serialization.hybridrow.perf; import MongoDB.Bson.*; import MongoDB.Bson.IO.*; @@ -15,11 +15,11 @@ public final class BsonReaderExtensions { String path = bsonReader.ReadName(); switch (type) { case BsonType.Array: - Microsoft.Azure.Cosmos.Serialization.HybridRow.Tests.Perf.BsonReaderExtensions.VisitBsonArray(bsonReader); + BsonReaderExtensions.VisitBsonArray(bsonReader); break; case BsonType.Document: - Microsoft.Azure.Cosmos.Serialization.HybridRow.Tests.Perf.BsonReaderExtensions.VisitBsonDocument(bsonReader); + BsonReaderExtensions.VisitBsonDocument(bsonReader); break; default: @@ -37,11 +37,11 @@ public final class BsonReaderExtensions { while ((type = bsonReader.ReadBsonType()) != BsonType.EndOfDocument) { switch (type) { case BsonType.Array: - Microsoft.Azure.Cosmos.Serialization.HybridRow.Tests.Perf.BsonReaderExtensions.VisitBsonArray(bsonReader); + BsonReaderExtensions.VisitBsonArray(bsonReader); break; case BsonType.Document: - Microsoft.Azure.Cosmos.Serialization.HybridRow.Tests.Perf.BsonReaderExtensions.VisitBsonDocument(bsonReader); + BsonReaderExtensions.VisitBsonDocument(bsonReader); break; default: diff --git a/jre/src/test/java/azure/data/cosmos/serialization/hybridrow/perf/BsonRowGenerator.java b/jre/src/test/java/com/azure/data/cosmos/serialization/hybridrow/perf/BsonRowGenerator.java similarity index 85% rename from jre/src/test/java/azure/data/cosmos/serialization/hybridrow/perf/BsonRowGenerator.java rename to jre/src/test/java/com/azure/data/cosmos/serialization/hybridrow/perf/BsonRowGenerator.java index fc24502..b68f076 100644 --- a/jre/src/test/java/azure/data/cosmos/serialization/hybridrow/perf/BsonRowGenerator.java +++ b/jre/src/test/java/com/azure/data/cosmos/serialization/hybridrow/perf/BsonRowGenerator.java @@ -2,12 +2,18 @@ // Copyright (c) Microsoft Corporation. All rights reserved. //------------------------------------------------------------ -package azure.data.cosmos.serialization.hybridrow.perf; +package com.azure.data.cosmos.serialization.hybridrow.perf; import MongoDB.Bson.*; import MongoDB.Bson.IO.*; -import azure.data.cosmos.serialization.hybridrow.Float128; -import azure.data.cosmos.serialization.hybridrow.UnixDateTime; +import com.azure.data.cosmos.serialization.hybridrow.Float128; +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.LayoutColumn; +import com.azure.data.cosmos.serialization.hybridrow.layouts.LayoutResolver; +import com.azure.data.cosmos.serialization.hybridrow.layouts.TypeArgument; +import org.bson.BsonBinaryWriter; +import org.bson.BsonWriter; import java.io.Closeable; import java.io.IOException; @@ -17,6 +23,9 @@ import java.util.ArrayList; import java.util.HashMap; import java.util.UUID; +import static com.google.common.base.Preconditions.checkArgument; +import static com.google.common.base.Strings.lenientFormat; + public final class BsonRowGenerator implements Closeable { private Layout layout; private LayoutResolver resolver; @@ -50,12 +59,12 @@ public final class BsonRowGenerator implements Closeable { } public void WriteBuffer(HashMap dict) { - this.writer.WriteStartDocument(); + this.writer.writeStartDocument(); for (LayoutColumn c : this.layout.getColumns()) { this.LayoutCodeSwitch(c.getPath(), c.getTypeArg().clone(), dict.get(c.getPath())); } - this.writer.WriteEndDocument(); + this.writer.writeEndDocument(); } public void close() throws IOException { @@ -64,46 +73,46 @@ public final class BsonRowGenerator implements Closeable { } private void DispatchArray(TypeArgument typeArg, Object value) { - Contract.Requires(typeArg.getTypeArgs().getCount() == 1); - this.writer.WriteStartArray(); + checkArgument(typeArg.getTypeArgs().getCount() == 1); + this.writer.writeStartArray(); + for (Object item : (ArrayList)value) { this.LayoutCodeSwitch(null, typeArg.getTypeArgs().get(0).clone(), item); } - this.writer.WriteEndArray(); + this.writer.writeEndArray(); } private void DispatchMap(TypeArgument typeArg, Object value) { - Contract.Requires(typeArg.getTypeArgs().getCount() == 2); + checkArgument(typeArg.getTypeArgs().getCount() == 2); - this.writer.WriteStartArray(); + this.writer.writeStartArray(); for (Object item : (ArrayList)value) { this.DispatchTuple(typeArg.clone(), item); } - this.writer.WriteEndArray(); + this.writer.writeEndArray(); } private void DispatchNullable(TypeArgument typeArg, Object value) { - Contract.Requires(typeArg.getTypeArgs().getCount() == 1); + checkArgument(typeArg.getTypeArgs().getCount() == 1); if (value != null) { this.LayoutCodeSwitch(null, typeArg.getTypeArgs().get(0).clone(), value); } else { - this.writer.WriteNull(); + this.writer.writeNull(); } } private void DispatchObject(TypeArgument typeArg, Object value) { - this.writer.WriteStartDocument(); - + this.writer.writeStartDocument(); // TODO: support properties in an object scope. - this.writer.WriteEndDocument(); + this.writer.writeEndDocument(); } private void DispatchSet(TypeArgument typeArg, Object value) { - Contract.Requires(typeArg.getTypeArgs().getCount() == 1); + checkArgument(typeArg.getTypeArgs().getCount() == 1); this.writer.WriteStartArray(); for (Object item : (ArrayList)value) { @@ -114,9 +123,9 @@ public final class BsonRowGenerator implements Closeable { } private void DispatchTuple(TypeArgument typeArg, Object value) { - Contract.Requires(typeArg.getTypeArgs().getCount() >= 2); + checkArgument(typeArg.getTypeArgs().getCount() >= 2); ArrayList items = (ArrayList)value; - Contract.Assert(items.size() == typeArg.getTypeArgs().getCount()); + checkArgument(items.size() == typeArg.getTypeArgs().getCount()); this.writer.WriteStartArray(); for (int i = 0; i < items.size(); i++) { @@ -299,7 +308,7 @@ public final class BsonRowGenerator implements Closeable { return; default: - Contract.Assert(false, String.format("Unknown type will be ignored: %1$s", typeArg.clone())); + throw new IllegalStateException(lenientFormat("Unknown type will be ignored: %s", typeArg.clone())); return; } } diff --git a/jre/src/test/java/azure/data/cosmos/serialization/hybridrow/perf/CassandraHotel/Protobuf/Address.java b/jre/src/test/java/com/azure/data/cosmos/serialization/hybridrow/perf/CassandraHotel/Protobuf/Address.java similarity index 92% rename from jre/src/test/java/azure/data/cosmos/serialization/hybridrow/perf/CassandraHotel/Protobuf/Address.java rename to jre/src/test/java/com/azure/data/cosmos/serialization/hybridrow/perf/CassandraHotel/Protobuf/Address.java index c08c0a3..5296fb2 100644 --- a/jre/src/test/java/azure/data/cosmos/serialization/hybridrow/perf/CassandraHotel/Protobuf/Address.java +++ b/jre/src/test/java/com/azure/data/cosmos/serialization/hybridrow/perf/CassandraHotel/Protobuf/Address.java @@ -2,9 +2,11 @@ // Copyright (c) Microsoft Corporation. All rights reserved. //------------------------------------------------------------ -package azure.data.cosmos.serialization.hybridrow.perf.CassandraHotel.Protobuf; +package com.azure.data.cosmos.serialization.hybridrow.perf.cassandrahotel.protobuf; -import azure.data.cosmos.serialization.hybridrow.Tests.Perf.*; +import com.azure.data.cosmos.serialization.hybridrow.perf.*; +import com.google.protobuf.Message; +import com.google.protobuf.Parser; // // Generated by the protocol buffer compiler. DO NOT EDIT! @@ -18,7 +20,7 @@ import azure.data.cosmos.serialization.hybridrow.Tests.Perf.*; //C# TO JAVA CONVERTER NOTE: There is no Java equivalent to C# namespace aliases: //using pbr = Google.Protobuf.Reflection; -public final class Address implements Google.Protobuf.IMessage
{ +public final class Address implements Message
{ /** * Field number for the "city" field. */ @@ -35,10 +37,8 @@ public final class Address implements Google.Protobuf.IMessage
{ * Field number for the "street" field. */ public static final int StreetFieldNumber = 1; - private static final Google.Protobuf.MessageParser
_parser = - new Google.Protobuf.MessageParser
(() -> new Address()); - private static final Google.Protobuf.FieldCodec _single_city_codec = - Google.Protobuf.FieldCodec.ForClassWrapper(18); + private static final Parser _parser = new Address().getParserForType(); + private static final Google.Protobuf.FieldCodec _single_city_codec = Google.Protobuf.FieldCodec.ForClassWrapper(18); // TODO: C# TO JAVA CONVERTER: Java does not support 'partial' methods: // partial void OnConstruction(); @@ -88,7 +88,7 @@ public final class Address implements Google.Protobuf.IMessage
{ //ORIGINAL LINE: [System.Diagnostics.DebuggerNonUserCodeAttribute] public static Google.Protobuf.Reflection // .MessageDescriptor Descriptor public static Google.Protobuf.Reflection.MessageDescriptor getDescriptor() { - return Microsoft.Azure.Cosmos.Serialization.HybridRow.Tests.Perf.CassandraHotel.Protobuf.CassandraHotelSchemaReflection.getDescriptor().MessageTypes[1]; + return CassandraHotelSchemaReflection.getDescriptor().MessageTypes[1]; } // TODO: C# TO JAVA CONVERTER: Java annotations will not correspond to .NET attributes: diff --git a/jre/src/test/java/azure/data/cosmos/serialization/hybridrow/perf/CassandraHotel/Protobuf/Available_Rooms_By_Hotel_Date.java b/jre/src/test/java/com/azure/data/cosmos/serialization/hybridrow/perf/CassandraHotel/Protobuf/Available_Rooms_By_Hotel_Date.java similarity index 95% rename from jre/src/test/java/azure/data/cosmos/serialization/hybridrow/perf/CassandraHotel/Protobuf/Available_Rooms_By_Hotel_Date.java rename to jre/src/test/java/com/azure/data/cosmos/serialization/hybridrow/perf/CassandraHotel/Protobuf/Available_Rooms_By_Hotel_Date.java index e1d9cf9..1b66dc8 100644 --- a/jre/src/test/java/azure/data/cosmos/serialization/hybridrow/perf/CassandraHotel/Protobuf/Available_Rooms_By_Hotel_Date.java +++ b/jre/src/test/java/com/azure/data/cosmos/serialization/hybridrow/perf/CassandraHotel/Protobuf/Available_Rooms_By_Hotel_Date.java @@ -2,9 +2,9 @@ // Copyright (c) Microsoft Corporation. All rights reserved. //------------------------------------------------------------ -package azure.data.cosmos.serialization.hybridrow.perf.CassandraHotel.Protobuf; +package com.azure.data.cosmos.serialization.hybridrow.perf.cassandrahotel.protobuf; -import azure.data.cosmos.serialization.hybridrow.Tests.Perf.*; +import com.azure.data.cosmos.serialization.hybridrow.perf.*; // // Generated by the protocol buffer compiler. DO NOT EDIT! @@ -93,7 +93,7 @@ public final class Available_Rooms_By_Hotel_Date implements Google.Protobuf.IMes //ORIGINAL LINE: [System.Diagnostics.DebuggerNonUserCodeAttribute] public static Google.Protobuf.Reflection // .MessageDescriptor Descriptor public static Google.Protobuf.Reflection.MessageDescriptor getDescriptor() { - return Microsoft.Azure.Cosmos.Serialization.HybridRow.Tests.Perf.CassandraHotel.Protobuf.CassandraHotelSchemaReflection.getDescriptor().MessageTypes[3]; + return CassandraHotelSchemaReflection.getDescriptor().MessageTypes[3]; } // TODO: C# TO JAVA CONVERTER: Java annotations will not correspond to .NET attributes: diff --git a/jre/src/test/java/azure/data/cosmos/serialization/hybridrow/perf/CassandraHotel/Protobuf/CassandraHotelSchemaReflection.java b/jre/src/test/java/com/azure/data/cosmos/serialization/hybridrow/perf/CassandraHotel/Protobuf/CassandraHotelSchemaReflection.java similarity index 78% rename from jre/src/test/java/azure/data/cosmos/serialization/hybridrow/perf/CassandraHotel/Protobuf/CassandraHotelSchemaReflection.java rename to jre/src/test/java/com/azure/data/cosmos/serialization/hybridrow/perf/CassandraHotel/Protobuf/CassandraHotelSchemaReflection.java index 2acb93a..9a2a381 100644 --- a/jre/src/test/java/azure/data/cosmos/serialization/hybridrow/perf/CassandraHotel/Protobuf/CassandraHotelSchemaReflection.java +++ b/jre/src/test/java/com/azure/data/cosmos/serialization/hybridrow/perf/CassandraHotel/Protobuf/CassandraHotelSchemaReflection.java @@ -2,9 +2,9 @@ // Copyright (c) Microsoft Corporation. All rights reserved. //------------------------------------------------------------ -package azure.data.cosmos.serialization.hybridrow.perf.CassandraHotel.Protobuf; +package com.azure.data.cosmos.serialization.hybridrow.perf.cassandrahotel.protobuf; -import azure.data.cosmos.serialization.hybridrow.Tests.Perf.*; +import com.azure.data.cosmos.serialization.hybridrow.perf.*; // // Generated by the protocol buffer compiler. DO NOT EDIT! @@ -106,7 +106,7 @@ public final class CassandraHotelSchemaReflection { "LkF6dXJlLkNvc21vcy5TZXJpYWxpemF0aW9uLkh5YnJpZFJvdy5UZXN0cy5Q", "ZXJmLkNhc3NhbmRyYUhvdGVsLlByb3RvYnVmYgZwcm90bzM=")); 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(Microsoft.Azure.Cosmos.Serialization.HybridRow.Tests.Perf.CassandraHotel.Protobuf.PostalCode.class, Microsoft.Azure.Cosmos.Serialization.HybridRow.Tests.Perf.CassandraHotel.Protobuf.PostalCode.getParser(), new String[] { "Zip", "Plus4" }, null, null, null), new Google.Protobuf.Reflection.GeneratedClrTypeInfo(Microsoft.Azure.Cosmos.Serialization.HybridRow.Tests.Perf.CassandraHotel.Protobuf.Address.class, Microsoft.Azure.Cosmos.Serialization.HybridRow.Tests.Perf.CassandraHotel.Protobuf.Address.getParser(), new String[] { "Street", "City", "State", "PostalCode" }, null, null, null), new Google.Protobuf.Reflection.GeneratedClrTypeInfo(Microsoft.Azure.Cosmos.Serialization.HybridRow.Tests.Perf.CassandraHotel.Protobuf.Hotels.class, Microsoft.Azure.Cosmos.Serialization.HybridRow.Tests.Perf.CassandraHotel.Protobuf.Hotels.getParser(), new String[] { "HotelId", "Name", "Phone", "Address" }, null, null, null), new Google.Protobuf.Reflection.GeneratedClrTypeInfo(Microsoft.Azure.Cosmos.Serialization.HybridRow.Tests.Perf.CassandraHotel.Protobuf.Available_Rooms_By_Hotel_Date.class, Microsoft.Azure.Cosmos.Serialization.HybridRow.Tests.Perf.CassandraHotel.Protobuf.Available_Rooms_By_Hotel_Date.getParser(), new String[] { "HotelId", "Date", "RoomNumber", "IsAvailable" }, null, null, null), new Google.Protobuf.Reflection.GeneratedClrTypeInfo(Microsoft.Azure.Cosmos.Serialization.HybridRow.Tests.Perf.CassandraHotel.Protobuf.Guests.class, Microsoft.Azure.Cosmos.Serialization.HybridRow.Tests.Perf.CassandraHotel.Protobuf.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 }) })); } /** diff --git a/jre/src/test/java/azure/data/cosmos/serialization/hybridrow/perf/CassandraHotel/Protobuf/Guests.java b/jre/src/test/java/com/azure/data/cosmos/serialization/hybridrow/perf/CassandraHotel/Protobuf/Guests.java similarity index 94% rename from jre/src/test/java/azure/data/cosmos/serialization/hybridrow/perf/CassandraHotel/Protobuf/Guests.java rename to jre/src/test/java/com/azure/data/cosmos/serialization/hybridrow/perf/CassandraHotel/Protobuf/Guests.java index a638fe9..d741b6e 100644 --- a/jre/src/test/java/azure/data/cosmos/serialization/hybridrow/perf/CassandraHotel/Protobuf/Guests.java +++ b/jre/src/test/java/com/azure/data/cosmos/serialization/hybridrow/perf/CassandraHotel/Protobuf/Guests.java @@ -2,9 +2,9 @@ // Copyright (c) Microsoft Corporation. All rights reserved. //------------------------------------------------------------ -package azure.data.cosmos.serialization.hybridrow.perf.CassandraHotel.Protobuf; +package com.azure.data.cosmos.serialization.hybridrow.perf.cassandrahotel.protobuf; -import azure.data.cosmos.serialization.hybridrow.Tests.Perf.*; +import com.azure.data.cosmos.serialization.hybridrow.perf.*; // // Generated by the protocol buffer compiler. DO NOT EDIT! @@ -57,7 +57,7 @@ public final class Guests implements Google.Protobuf.IMessage { private static final Google.Protobuf.Collections.MapField.Codec _map_addresses_codec = new Google.Protobuf.Collections.MapField.Codec(Google.Protobuf.FieldCodec.ForString(10), Google.Protobuf.FieldCodec.ForMessage(18, - Microsoft.Azure.Cosmos.Serialization.HybridRow.Tests.Perf.CassandraHotel.Protobuf.Address.getParser()), 58); + Address.getParser()), 58); private static final Google.Protobuf.MessageParser _parser = new Google.Protobuf.MessageParser(() -> new Guests()); private static final Google.Protobuf.FieldCodec _repeated_emails_codec = @@ -110,7 +110,7 @@ public final class Guests implements Google.Protobuf.IMessage { // TODO: C# TO JAVA CONVERTER: Java annotations will not correspond to .NET attributes: //ORIGINAL LINE: [System.Diagnostics.DebuggerNonUserCodeAttribute] public Google.Protobuf.Collections - // .MapField + // .MapField // Addresses public Google.Protobuf.Collections.MapField getAddresses() { return addresses_; @@ -130,7 +130,7 @@ public final class Guests implements Google.Protobuf.IMessage { //ORIGINAL LINE: [System.Diagnostics.DebuggerNonUserCodeAttribute] public static Google.Protobuf.Reflection // .MessageDescriptor Descriptor public static Google.Protobuf.Reflection.MessageDescriptor getDescriptor() { - return Microsoft.Azure.Cosmos.Serialization.HybridRow.Tests.Perf.CassandraHotel.Protobuf.CassandraHotelSchemaReflection.getDescriptor().MessageTypes[4]; + return CassandraHotelSchemaReflection.getDescriptor().MessageTypes[4]; } // TODO: C# TO JAVA CONVERTER: Java annotations will not correspond to .NET attributes: diff --git a/jre/src/test/java/azure/data/cosmos/serialization/hybridrow/perf/CassandraHotel/Protobuf/Hotels.java b/jre/src/test/java/com/azure/data/cosmos/serialization/hybridrow/perf/CassandraHotel/Protobuf/Hotels.java similarity index 95% rename from jre/src/test/java/azure/data/cosmos/serialization/hybridrow/perf/CassandraHotel/Protobuf/Hotels.java rename to jre/src/test/java/com/azure/data/cosmos/serialization/hybridrow/perf/CassandraHotel/Protobuf/Hotels.java index 56687ff..7343588 100644 --- a/jre/src/test/java/azure/data/cosmos/serialization/hybridrow/perf/CassandraHotel/Protobuf/Hotels.java +++ b/jre/src/test/java/com/azure/data/cosmos/serialization/hybridrow/perf/CassandraHotel/Protobuf/Hotels.java @@ -2,9 +2,9 @@ // Copyright (c) Microsoft Corporation. All rights reserved. //------------------------------------------------------------ -package azure.data.cosmos.serialization.hybridrow.perf.CassandraHotel.Protobuf; +package com.azure.data.cosmos.serialization.hybridrow.perf.cassandrahotel.protobuf; -import azure.data.cosmos.serialization.hybridrow.Tests.Perf.*; +import com.azure.data.cosmos.serialization.hybridrow.perf.*; // // Generated by the protocol buffer compiler. DO NOT EDIT! @@ -89,7 +89,7 @@ public final class Hotels implements Google.Protobuf.IMessage { //ORIGINAL LINE: [System.Diagnostics.DebuggerNonUserCodeAttribute] public static Google.Protobuf.Reflection // .MessageDescriptor Descriptor public static Google.Protobuf.Reflection.MessageDescriptor getDescriptor() { - return Microsoft.Azure.Cosmos.Serialization.HybridRow.Tests.Perf.CassandraHotel.Protobuf.CassandraHotelSchemaReflection.getDescriptor().MessageTypes[2]; + return CassandraHotelSchemaReflection.getDescriptor().MessageTypes[2]; } // TODO: C# TO JAVA CONVERTER: Java annotations will not correspond to .NET attributes: diff --git a/jre/src/test/java/azure/data/cosmos/serialization/hybridrow/perf/CassandraHotel/Protobuf/PostalCode.java b/jre/src/test/java/com/azure/data/cosmos/serialization/hybridrow/perf/CassandraHotel/Protobuf/PostalCode.java similarity index 92% rename from jre/src/test/java/azure/data/cosmos/serialization/hybridrow/perf/CassandraHotel/Protobuf/PostalCode.java rename to jre/src/test/java/com/azure/data/cosmos/serialization/hybridrow/perf/CassandraHotel/Protobuf/PostalCode.java index 58148f3..7e718ad 100644 --- a/jre/src/test/java/azure/data/cosmos/serialization/hybridrow/perf/CassandraHotel/Protobuf/PostalCode.java +++ b/jre/src/test/java/com/azure/data/cosmos/serialization/hybridrow/perf/CassandraHotel/Protobuf/PostalCode.java @@ -2,9 +2,11 @@ // Copyright (c) Microsoft Corporation. All rights reserved. //------------------------------------------------------------ -package azure.data.cosmos.serialization.hybridrow.perf.CassandraHotel.Protobuf; +package com.azure.data.cosmos.serialization.hybridrow.perf.cassandrahotel.protobuf; -import azure.data.cosmos.serialization.hybridrow.Tests.Perf.*; +import com.azure.data.cosmos.serialization.hybridrow.perf.*; +import com.google.protobuf.Message; +import com.google.protobuf.Parser; // // Generated by the protocol buffer compiler. DO NOT EDIT! @@ -18,7 +20,7 @@ import azure.data.cosmos.serialization.hybridrow.Tests.Perf.*; //C# TO JAVA CONVERTER NOTE: There is no Java equivalent to C# namespace aliases: //using pbr = Google.Protobuf.Reflection; -public final class PostalCode implements Google.Protobuf.IMessage { +public final class PostalCode implements Message { /** * Field number for the "plus4" field. */ @@ -27,8 +29,7 @@ public final class PostalCode implements Google.Protobuf.IMessage { * Field number for the "zip" field. */ public static final int ZipFieldNumber = 1; - private static final Google.Protobuf.MessageParser _parser = - new Google.Protobuf.MessageParser(() -> new PostalCode()); + private static final Parser _parser = new Parser(() -> new PostalCode()); private static final Google.Protobuf.FieldCodec _single_plus4_codec = Google.Protobuf.FieldCodec.ForStructWrapper(18); private static final Google.Protobuf.FieldCodec _single_zip_codec = @@ -58,7 +59,7 @@ public final class PostalCode implements Google.Protobuf.IMessage { //ORIGINAL LINE: [System.Diagnostics.DebuggerNonUserCodeAttribute] public static Google.Protobuf.Reflection // .MessageDescriptor Descriptor public static Google.Protobuf.Reflection.MessageDescriptor getDescriptor() { - return Microsoft.Azure.Cosmos.Serialization.HybridRow.Tests.Perf.CassandraHotel.Protobuf.CassandraHotelSchemaReflection.getDescriptor().MessageTypes[0]; + return CassandraHotelSchemaReflection.getDescriptor().MessageTypes[0]; } // TODO: C# TO JAVA CONVERTER: Java annotations will not correspond to .NET attributes: diff --git a/jre/src/test/java/azure/data/cosmos/serialization/hybridrow/perf/CodeGenMicroBenchmarkSuite.java b/jre/src/test/java/com/azure/data/cosmos/serialization/hybridrow/perf/CodeGenMicroBenchmarkSuite.java similarity index 91% rename from jre/src/test/java/azure/data/cosmos/serialization/hybridrow/perf/CodeGenMicroBenchmarkSuite.java rename to jre/src/test/java/com/azure/data/cosmos/serialization/hybridrow/perf/CodeGenMicroBenchmarkSuite.java index de42a6f..f6f9760 100644 --- a/jre/src/test/java/azure/data/cosmos/serialization/hybridrow/perf/CodeGenMicroBenchmarkSuite.java +++ b/jre/src/test/java/com/azure/data/cosmos/serialization/hybridrow/perf/CodeGenMicroBenchmarkSuite.java @@ -2,14 +2,13 @@ // Copyright (c) Microsoft Corporation. All rights reserved. //------------------------------------------------------------ -package azure.data.cosmos.serialization.hybridrow.perf; +package com.azure.data.cosmos.serialization.hybridrow.perf; -import azure.data.cosmos.serialization.hybridrow.Result; +import com.azure.data.cosmos.core.RefObject; +import com.azure.data.cosmos.serialization.hybridrow.Result; import java.util.ArrayList; -import java.util.Dictionary; import java.util.HashMap; -import java.util.List; /** * Tests involving generated (early bound) code compiled from schema based on a partial implementation @@ -229,7 +228,7 @@ public final class CodeGenMicroBenchmarkSuite extends MicroBenchmarkSuiteBase { expectedSerialized.add(context.CodeGenWriter.ToArray()); } - tangible.RefObject tempRef_context = new tangible.RefObject(context); + RefObject tempRef_context = new RefObject(context); // 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: //ORIGINAL LINE: MicroBenchmarkSuiteBase.Benchmark("CodeGen", "Read", dataSetName, "HybridRowGen", innerLoopIterations, ref context, (ref BenchmarkContext ctx, byte[] tableValue) => @@ -238,7 +237,7 @@ public final class CodeGenMicroBenchmarkSuite extends MicroBenchmarkSuiteBase { Result r = ctx.CodeGenWriter.ReadBuffer(tableValue); ResultAssert.IsSuccess(r); }, (ref BenchmarkContext ctx, byte[] tableValue) -> tableValue.length, expectedSerialized); - context = tempRef_context.argValue; + context = tempRef_context.get(); } private static void CodeGenWriteBenchmark(LayoutResolverNamespace resolver, String schemaName, String dataSetName @@ -248,7 +247,7 @@ public final class CodeGenMicroBenchmarkSuite extends MicroBenchmarkSuiteBase { BenchmarkContext context = new BenchmarkContext(); context.CodeGenWriter = new CodeGenRowGenerator(BenchmarkSuiteBase.InitialCapacity, layout, resolver); - tangible.RefObject tempRef_context = new tangible.RefObject(context); + RefObject tempRef_context = new RefObject(context); // TODO: C# TO JAVA CONVERTER: The following lambda contained an unresolved 'ref' keyword - these are not // converted by C# to Java Converter: MicroBenchmarkSuiteBase.Benchmark("CodeGen", "Write", dataSetName, "HybridRowGen", innerLoopIterations, @@ -259,7 +258,7 @@ public final class CodeGenMicroBenchmarkSuite extends MicroBenchmarkSuiteBase { Result r = ctx.CodeGenWriter.WriteBuffer(tableValue); ResultAssert.IsSuccess(r); }, (ref BenchmarkContext ctx, HashMap tableValue) -> ctx.CodeGenWriter.Length, expected); - context = tempRef_context.argValue; + context = tempRef_context.get(); } private static void ProtobufReadBenchmark(String schemaName, String dataSetName, int innerLoopIterations, @@ -278,7 +277,7 @@ public final class CodeGenMicroBenchmarkSuite extends MicroBenchmarkSuiteBase { expectedSerialized.add(context.ProtobufWriter.ToArray()); } - tangible.RefObject tempRef_context = new tangible.RefObject(context); + RefObject tempRef_context = new RefObject(context); // 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: @@ -290,7 +289,7 @@ public final class CodeGenMicroBenchmarkSuite extends MicroBenchmarkSuiteBase { tempRef_context, (ref BenchmarkContext ctx, byte[] tableValue) -> ctx.ProtobufWriter.ReadBuffer(tableValue), (ref BenchmarkContext ctx, byte[] tableValue) -> tableValue.length, expectedSerialized); - context = tempRef_context.argValue; + context = tempRef_context.get(); } private static void ProtobufWriteBenchmark(String schemaName, String dataSetName, int innerLoopIterations, @@ -298,7 +297,7 @@ public final class CodeGenMicroBenchmarkSuite extends MicroBenchmarkSuiteBase { BenchmarkContext context = new BenchmarkContext(); context.ProtobufWriter = new ProtobufRowGenerator(schemaName, BenchmarkSuiteBase.InitialCapacity); - tangible.RefObject tempRef_context = new tangible.RefObject(context); + RefObject tempRef_context = new RefObject(context); // TODO: C# TO JAVA CONVERTER: The following lambda contained an unresolved 'ref' keyword - these are not // converted by C# to Java Converter: MicroBenchmarkSuiteBase.Benchmark("CodeGen", "Write", dataSetName, "Protobuf", innerLoopIterations, @@ -306,6 +305,6 @@ public final class CodeGenMicroBenchmarkSuite extends MicroBenchmarkSuiteBase { { ctx.ProtobufWriter.WriteBuffer(tableValue); }, (ref BenchmarkContext ctx, HashMap tableValue) -> ctx.ProtobufWriter.Length, expected); - context = tempRef_context.argValue; + context = tempRef_context.get(); } } \ No newline at end of file diff --git a/jre/src/test/java/azure/data/cosmos/serialization/hybridrow/perf/CodeGenRowGenerator.java b/jre/src/test/java/com/azure/data/cosmos/serialization/hybridrow/perf/CodeGenRowGenerator.java similarity index 65% rename from jre/src/test/java/azure/data/cosmos/serialization/hybridrow/perf/CodeGenRowGenerator.java rename to jre/src/test/java/com/azure/data/cosmos/serialization/hybridrow/perf/CodeGenRowGenerator.java index 1a855ca..a315244 100644 --- a/jre/src/test/java/azure/data/cosmos/serialization/hybridrow/perf/CodeGenRowGenerator.java +++ b/jre/src/test/java/com/azure/data/cosmos/serialization/hybridrow/perf/CodeGenRowGenerator.java @@ -2,20 +2,32 @@ // Copyright (c) Microsoft Corporation. All rights reserved. //------------------------------------------------------------ -package azure.data.cosmos.serialization.hybridrow.perf; +package com.azure.data.cosmos.serialization.hybridrow.perf; -import azure.data.cosmos.serialization.hybridrow.HybridRowVersion; -import azure.data.cosmos.serialization.hybridrow.ISpanResizer; -import azure.data.cosmos.serialization.hybridrow.Result; -import azure.data.cosmos.serialization.hybridrow.RowBuffer; -import azure.data.cosmos.serialization.hybridrow.RowCursor; -import azure.data.cosmos.serialization.hybridrow.perf.CodeGenRowGenerator.GuestsHybridRowSerializer; +import com.azure.data.cosmos.core.OutObject; +import com.azure.data.cosmos.core.RefObject; +import com.azure.data.cosmos.serialization.hybridrow.HybridRowVersion; +import com.azure.data.cosmos.serialization.hybridrow.ISpanResizer; +import com.azure.data.cosmos.serialization.hybridrow.Result; +import com.azure.data.cosmos.serialization.hybridrow.RowBuffer; +import com.azure.data.cosmos.serialization.hybridrow.RowCursor; +import com.azure.data.cosmos.serialization.hybridrow.RowCursorExtensions; +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.LayoutResolver; +import com.azure.data.cosmos.serialization.hybridrow.layouts.LayoutScope; +import com.azure.data.cosmos.serialization.hybridrow.layouts.LayoutType; +import com.azure.data.cosmos.serialization.hybridrow.layouts.StringToken; +import com.azure.data.cosmos.serialization.hybridrow.layouts.TypeArgument; +import com.azure.data.cosmos.serialization.hybridrow.layouts.TypeArgumentList; import java.time.LocalDateTime; import java.util.ArrayList; import java.util.HashMap; import java.util.UUID; +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 // from the original: //ORIGINAL LINE: internal ref struct CodeGenRowGenerator @@ -54,7 +66,7 @@ public final class CodeGenRowGenerator { break; default: - Contract.Fail(String.format("Unknown schema will be ignored: %1$s", layout.getName())); + throw new IllegalStateException(lenientFormat("Unknown schema will be ignored: %s", layout.getName())); this.dispatcher = null; break; } @@ -68,17 +80,17 @@ public final class CodeGenRowGenerator { //ORIGINAL LINE: public Result ReadBuffer(byte[] buffer) public Result ReadBuffer(byte[] buffer) { this.row = new RowBuffer(buffer.AsSpan(), HybridRowVersion.V1, this.row.getResolver()); - tangible.RefObject tempRef_row = - new tangible.RefObject(this.row); + RefObject tempRef_row = + new RefObject(this.row); RowCursor root = RowCursor.Create(tempRef_row); - this.row = tempRef_row.argValue; - tangible.RefObject tempRef_row2 = - new tangible.RefObject(this.row); - tangible.RefObject tempRef_root = - new tangible.RefObject(root); + this.row = tempRef_row.get(); + RefObject tempRef_row2 = + new RefObject(this.row); + RefObject tempRef_root = + new RefObject(root); Result tempVar = this.dispatcher.ReadBuffer(tempRef_row2, tempRef_root); - root = tempRef_root.argValue; - this.row = tempRef_row2.argValue; + root = tempRef_root.get(); + this.row = tempRef_row2.get(); return tempVar; } @@ -94,17 +106,17 @@ public final class CodeGenRowGenerator { } public Result WriteBuffer(HashMap tableValue) { - tangible.RefObject tempRef_row = - new tangible.RefObject(this.row); + RefObject tempRef_row = + new RefObject(this.row); RowCursor root = RowCursor.Create(tempRef_row); - this.row = tempRef_row.argValue; - tangible.RefObject tempRef_row2 = - new tangible.RefObject(this.row); - tangible.RefObject tempRef_root = - new tangible.RefObject(root); + this.row = tempRef_row.get(); + RefObject tempRef_row2 = + new RefObject(this.row); + RefObject tempRef_root = + new RefObject(root); Result tempVar = this.dispatcher.WriteBuffer(tempRef_row2, tempRef_root, tableValue); - root = tempRef_root.argValue; - this.row = tempRef_row2.argValue; + root = tempRef_root.get(); + this.row = tempRef_row2.get(); return tempVar; } @@ -130,26 +142,26 @@ public final class CodeGenRowGenerator { private LayoutColumn street; public AddressHybridRowSerializer(Layout layout, LayoutResolver resolver) { - tangible.OutObject tempOut_street = new tangible.OutObject(); + OutObject tempOut_street = new OutObject(); layout.TryFind(AddressHybridRowSerializer.StreetName, tempOut_street); - this.street = tempOut_street.argValue; - tangible.OutObject tempOut_city = new tangible.OutObject(); + this.street = tempOut_street.get(); + OutObject tempOut_city = new OutObject(); layout.TryFind(AddressHybridRowSerializer.CityName, tempOut_city); - this.city = tempOut_city.argValue; - tangible.OutObject tempOut_state = new tangible.OutObject(); + this.city = tempOut_city.get(); + OutObject tempOut_state = new OutObject(); layout.TryFind(AddressHybridRowSerializer.StateName, tempOut_state); - this.state = tempOut_state.argValue; - tangible.OutObject tempOut_postalCode = new tangible.OutObject(); + this.state = tempOut_state.get(); + OutObject tempOut_postalCode = new OutObject(); layout.TryFind(AddressHybridRowSerializer.PostalCodeName, tempOut_postalCode); - this.postalCode = tempOut_postalCode.argValue; - tangible.OutObject tempOut_postalCodeToken = new tangible.OutObject(); + this.postalCode = tempOut_postalCode.get(); + OutObject tempOut_postalCodeToken = new OutObject(); layout.getTokenizer().TryFindToken(this.postalCode.getPath(), tempOut_postalCodeToken); - this.postalCodeToken = tempOut_postalCodeToken.argValue; + this.postalCodeToken = tempOut_postalCodeToken.get(); this.postalCodeSerializer = new PostalCodeHybridRowSerializer(resolver.Resolve(this.postalCode.getTypeArgs().getSchemaId().clone()), resolver); } @Override - public Result ReadBuffer(tangible.RefObject row, tangible.RefObject root) { + public Result ReadBuffer(RefObject row, RefObject root) { Utf8Span _; // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'out' keyword - these cannot be converted using the 'OutObject' helper class unless the method is within the code being modified: Result r = LayoutType.Utf8.ReadVariable(row, root, this.street, out _); @@ -171,30 +183,30 @@ public final class CodeGenRowGenerator { return r; } - root.argValue.Find(row, this.postalCodeToken.clone()); + root.get().Find(row, this.postalCodeToken.clone()); RowCursor childScope; - tangible.OutObject tempOut_childScope = new tangible.OutObject(); + OutObject tempOut_childScope = new OutObject(); r = LayoutType.UDT.ReadScope(row, root, tempOut_childScope); - childScope = tempOut_childScope.argValue; + childScope = tempOut_childScope.get(); if (r != Result.Success) { return r; } - tangible.RefObject tempRef_childScope = new tangible.RefObject(childScope); + RefObject tempRef_childScope = new RefObject(childScope); r = this.postalCodeSerializer.ReadBuffer(row, tempRef_childScope); - childScope = tempRef_childScope.argValue; + childScope = tempRef_childScope.get(); if (r != Result.Success) { return r; } - tangible.RefObject tempRef_childScope2 = new tangible.RefObject(childScope); - Microsoft.Azure.Cosmos.Serialization.HybridRow.RowCursorExtensions.Skip(root.argValue.clone(), row, tempRef_childScope2); - childScope = tempRef_childScope2.argValue; + RefObject tempRef_childScope2 = new RefObject(childScope); + RowCursorExtensions.Skip(root.get().clone(), row, tempRef_childScope2); + childScope = tempRef_childScope2.get(); return Result.Success; } @Override - public Result WriteBuffer(tangible.RefObject row, tangible.RefObject root, HashMap tableValue) { + public Result WriteBuffer(RefObject row, RefObject root, HashMap tableValue) { for ((Utf8String key,Object value) :tableValue) { Result r; @@ -239,32 +251,32 @@ public final class CodeGenRowGenerator { //ORIGINAL LINE: case 0 when key.Equals(AddressHybridRowSerializer.PostalCodeName): case 0 if (value != null) { - root.argValue.Find(row, this.postalCodeToken.clone()); + root.get().Find(row, this.postalCodeToken.clone()); RowCursor childScope; - tangible.OutObject tempOut_childScope = new tangible.OutObject(); + OutObject tempOut_childScope = new OutObject(); r = LayoutType.UDT.WriteScope(row, root, this.postalCode.getTypeArgs().clone(), tempOut_childScope); - childScope = tempOut_childScope.argValue; + childScope = tempOut_childScope.get(); if (r != Result.Success) { return r; } - tangible.RefObject tempRef_childScope = new tangible.RefObject(childScope); + RefObject tempRef_childScope = new RefObject(childScope); r = this.postalCodeSerializer.WriteBuffer(row, tempRef_childScope, (HashMap)value); - childScope = tempRef_childScope.argValue; + childScope = tempRef_childScope.get(); if (r != Result.Success) { return r; } - tangible.RefObject tempRef_childScope2 = new tangible.RefObject(childScope); - Microsoft.Azure.Cosmos.Serialization.HybridRow.RowCursorExtensions.Skip(root.argValue.clone(), row, tempRef_childScope2); - childScope = tempRef_childScope2.argValue; + RefObject tempRef_childScope2 = new RefObject(childScope); + RowCursorExtensions.Skip(root.get().clone(), row, tempRef_childScope2); + childScope = tempRef_childScope2.get(); } break; default: - Contract.Fail(String.format("Unknown property name: %1$s", key)); + throw new IllegalStateException(lenientFormat("Unknown property name: %s", key)); break; } } @@ -298,43 +310,43 @@ public final class CodeGenRowGenerator { private LayoutColumn title; public GuestsHybridRowSerializer(Layout layout, LayoutResolver resolver) { - tangible.OutObject tempOut_guestId = - new tangible.OutObject(); + OutObject tempOut_guestId = + new OutObject(); layout.TryFind(GuestsHybridRowSerializer.GuestIdName, tempOut_guestId); - this.guestId = tempOut_guestId.argValue; - tangible.OutObject tempOut_firstName = new tangible.OutObject(); + this.guestId = tempOut_guestId.get(); + OutObject tempOut_firstName = new OutObject(); layout.TryFind(GuestsHybridRowSerializer.FirstNameName, tempOut_firstName); - this.firstName = tempOut_firstName.argValue; - tangible.OutObject tempOut_lastName - = new tangible.OutObject(); + this.firstName = tempOut_firstName.get(); + OutObject tempOut_lastName + = new OutObject(); layout.TryFind(GuestsHybridRowSerializer.LastNameName, tempOut_lastName); - this.lastName = tempOut_lastName.argValue; - tangible.OutObject tempOut_title = - new tangible.OutObject(); + this.lastName = tempOut_lastName.get(); + OutObject tempOut_title = + new OutObject(); layout.TryFind(GuestsHybridRowSerializer.TitleName, tempOut_title); - this.title = tempOut_title.argValue; - tangible.OutObject tempOut_emails = - new tangible.OutObject(); + this.title = tempOut_title.get(); + OutObject tempOut_emails = + new OutObject(); layout.TryFind(GuestsHybridRowSerializer.EmailsName, tempOut_emails); - this.emails = tempOut_emails.argValue; - tangible.OutObject tempOut_phoneNumbers = new tangible.OutObject(); + this.emails = tempOut_emails.get(); + OutObject tempOut_phoneNumbers = new OutObject(); layout.TryFind(GuestsHybridRowSerializer.PhoneNumbersName, tempOut_phoneNumbers); - this.phoneNumbers = tempOut_phoneNumbers.argValue; - tangible.OutObject tempOut_addresses = new tangible.OutObject(); + this.phoneNumbers = tempOut_phoneNumbers.get(); + OutObject tempOut_addresses = new OutObject(); layout.TryFind(GuestsHybridRowSerializer.AddressesName, tempOut_addresses); - this.addresses = tempOut_addresses.argValue; - tangible.OutObject tempOut_confirmNumber = new tangible.OutObject(); + this.addresses = tempOut_addresses.get(); + OutObject tempOut_confirmNumber = new OutObject(); layout.TryFind(GuestsHybridRowSerializer.ConfirmNumberName, tempOut_confirmNumber); - this.confirmNumber = tempOut_confirmNumber.argValue; - tangible.OutObject tempOut_emailsToken = new tangible.OutObject(); + this.confirmNumber = tempOut_confirmNumber.get(); + OutObject tempOut_emailsToken = new OutObject(); layout.getTokenizer().TryFindToken(this.emails.getPath(), tempOut_emailsToken); - this.emailsToken = tempOut_emailsToken.argValue; - tangible.OutObject tempOut_phoneNumbersToken = new tangible.OutObject(); + this.emailsToken = tempOut_emailsToken.get(); + OutObject tempOut_phoneNumbersToken = new OutObject(); layout.getTokenizer().TryFindToken(this.phoneNumbers.getPath(), tempOut_phoneNumbersToken); - this.phoneNumbersToken = tempOut_phoneNumbersToken.argValue; - tangible.OutObject tempOut_addressesToken = new tangible.OutObject(); + this.phoneNumbersToken = tempOut_phoneNumbersToken.get(); + OutObject tempOut_addressesToken = new OutObject(); layout.getTokenizer().TryFindToken(this.addresses.getPath(), tempOut_addressesToken); - this.addressesToken = tempOut_addressesToken.argValue; + this.addressesToken = tempOut_addressesToken.get(); this.addressesFieldType = new TypeArgumentList(new TypeArgument[] { new TypeArgument(LayoutType.TypedTuple, @@ -342,17 +354,17 @@ public final class CodeGenRowGenerator { this.addressSerializer = new AddressHybridRowSerializer(resolver.Resolve(this.addresses.getTypeArgs().get(1).getTypeArgs().getSchemaId().clone()), resolver); - this.addressSerializerWriter = (tangible.RefObject b, tangible.RefObject scope, + this.addressSerializerWriter = (RefObject b, RefObject scope, HashMap context) -> addressSerializer.WriteBuffer(b, scope, context); } @Override - public Result ReadBuffer(tangible.RefObject row, tangible.RefObject root) { + public Result ReadBuffer(RefObject row, RefObject root) { java.util.UUID _; - tangible.OutObject tempOut__ = new tangible.OutObject(); + OutObject tempOut__ = new OutObject(); Result r = LayoutType.Guid.ReadFixed(row, root, this.guestId, tempOut__); - _ = tempOut__.argValue; + _ = tempOut__.get(); if (r != Result.Success) { return r; } @@ -384,12 +396,12 @@ public final class CodeGenRowGenerator { return r; } - root.argValue.Find(row, this.emailsToken.clone()); + root.get().Find(row, this.emailsToken.clone()); RowCursor childScope; - tangible.OutObject tempOut_childScope = - new tangible.OutObject(); + OutObject tempOut_childScope = + new OutObject(); r = LayoutType.TypedArray.ReadScope(row, root, tempOut_childScope); - childScope = tempOut_childScope.argValue; + childScope = tempOut_childScope.get(); if (r != Result.Success) { return r; } @@ -408,16 +420,16 @@ public final class CodeGenRowGenerator { } } - tangible.RefObject tempRef_childScope = - new tangible.RefObject(childScope); - Microsoft.Azure.Cosmos.Serialization.HybridRow.RowCursorExtensions.Skip(root.argValue.clone(), row, + RefObject tempRef_childScope = + new RefObject(childScope); + RowCursorExtensions.Skip(root.get().clone(), row, tempRef_childScope); - childScope = tempRef_childScope.argValue; - root.argValue.Find(row, this.phoneNumbersToken.clone()); - tangible.OutObject tempOut_childScope2 = - new tangible.OutObject(); + childScope = tempRef_childScope.get(); + root.get().Find(row, this.phoneNumbersToken.clone()); + OutObject tempOut_childScope2 = + new OutObject(); r = LayoutType.TypedArray.ReadScope(row, root, tempOut_childScope2); - childScope = tempOut_childScope2.argValue; + childScope = tempOut_childScope2.get(); if (r != Result.Success) { return r; } @@ -436,29 +448,29 @@ public final class CodeGenRowGenerator { } } - tangible.RefObject tempRef_childScope2 = - new tangible.RefObject(childScope); - Microsoft.Azure.Cosmos.Serialization.HybridRow.RowCursorExtensions.Skip(root.argValue.clone(), row, + RefObject tempRef_childScope2 = + new RefObject(childScope); + RowCursorExtensions.Skip(root.get().clone(), row, tempRef_childScope2); - childScope = tempRef_childScope2.argValue; - root.argValue.Find(row, this.addressesToken.clone()); - tangible.OutObject tempOut_childScope3 = - new tangible.OutObject(); + childScope = tempRef_childScope2.get(); + root.get().Find(row, this.addressesToken.clone()); + OutObject tempOut_childScope3 = + new OutObject(); r = LayoutType.TypedMap.ReadScope(row, root, tempOut_childScope3); - childScope = tempOut_childScope3.argValue; + childScope = tempOut_childScope3.get(); if (r != Result.Success) { return r; } while (childScope.MoveNext(row)) { - tangible.RefObject tempRef_childScope3 = - new tangible.RefObject(childScope); + RefObject tempRef_childScope3 = + new RefObject(childScope); RowCursor tupleScope; - tangible.OutObject tempOut_tupleScope = - new tangible.OutObject(); + OutObject tempOut_tupleScope = + new OutObject(); r = LayoutType.TypedTuple.ReadScope(row, tempRef_childScope3, tempOut_tupleScope); - tupleScope = tempOut_tupleScope.argValue; - childScope = tempRef_childScope3.argValue; + tupleScope = tempOut_tupleScope.get(); + childScope = tempRef_childScope3.get(); if (r != Result.Success) { return r; } @@ -483,22 +495,22 @@ public final class CodeGenRowGenerator { return Result.InvalidRow; } - tangible.RefObject tempRef_tupleScope = - new tangible.RefObject(tupleScope); + RefObject tempRef_tupleScope = + new RefObject(tupleScope); RowCursor valueScope; - tangible.OutObject tempOut_valueScope = - new tangible.OutObject(); + OutObject tempOut_valueScope = + new OutObject(); r = LayoutType.ImmutableUDT.ReadScope(row, tempRef_tupleScope, tempOut_valueScope); - valueScope = tempOut_valueScope.argValue; - tupleScope = tempRef_tupleScope.argValue; + valueScope = tempOut_valueScope.get(); + tupleScope = tempRef_tupleScope.get(); if (r != Result.Success) { return r; } - tangible.RefObject tempRef_valueScope = - new tangible.RefObject(valueScope); + RefObject tempRef_valueScope = + new RefObject(valueScope); r = this.addressSerializer.ReadBuffer(row, tempRef_valueScope); - valueScope = tempRef_valueScope.argValue; + valueScope = tempRef_valueScope.get(); if (r != Result.Success) { return r; } @@ -513,11 +525,11 @@ public final class CodeGenRowGenerator { childScope.Skip(row, ref tupleScope); } - tangible.RefObject tempRef_childScope4 = - new tangible.RefObject(childScope); - Microsoft.Azure.Cosmos.Serialization.HybridRow.RowCursorExtensions.Skip(root.argValue.clone(), row, + RefObject tempRef_childScope4 = + new RefObject(childScope); + RowCursorExtensions.Skip(root.get().clone(), row, tempRef_childScope4); - childScope = tempRef_childScope4.argValue; + childScope = tempRef_childScope4.get(); Utf8Span _; // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'out' keyword - these @@ -527,7 +539,7 @@ public final class CodeGenRowGenerator { } @Override - public Result WriteBuffer(tangible.RefObject row, tangible.RefObject root, + public Result WriteBuffer(RefObject row, RefObject root, HashMap tableValue) { for ((Utf8String key,Object value) :tableValue) { @@ -590,7 +602,7 @@ public final class CodeGenRowGenerator { //ORIGINAL LINE: case 0 when key.Equals(GuestsHybridRowSerializer.EmailsName): case 0 if (value != null) { - root.argValue.Find(row, this.emailsToken.clone()); + root.get().Find(row, this.emailsToken.clone()); // TODO: C# TO JAVA CONVERTER: The following lambda contained an unresolved 'ref' // keyword - these are not converted by C# to Java Converter: r = LayoutType.TypedArray.WriteScope(row, root, this.emails.getTypeArgs().clone(), @@ -598,9 +610,9 @@ public final class CodeGenRowGenerator { ArrayList context) -> { for (Object item : context) { - tangible.RefObjecttempRef_row2 = new tangible.RefObjecttempRef_row2 = new RefObject (row2); - tangible.RefObjecttempRef_childScope = new tangible.RefObjecttempRef_childScope = new RefObject (childScope); Result r2 = LayoutType.Utf8.WriteSparse(tempRef_row2, tempRef_childScope, (Utf8String)item); @@ -610,7 +622,7 @@ public final class CodeGenRowGenerator { return r2; } - tangible.RefObjecttempRef_row22 = new tangible.RefObjecttempRef_row22 = new RefObject (row2); childScope.MoveNext(tempRef_row22); row2 = tempRef_row22.argValue; @@ -630,12 +642,12 @@ public final class CodeGenRowGenerator { //ORIGINAL LINE: case 0 when key.Equals(GuestsHybridRowSerializer.PhoneNumbersName): case 0 if (value != null) { - root.argValue.Find(row, this.phoneNumbersToken.clone()); + root.get().Find(row, this.phoneNumbersToken.clone()); RowCursor childScope; - tangible.OutObject tempOut_childScope = new tangible.OutObject(); + OutObject tempOut_childScope = new OutObject(); r = LayoutType.TypedArray.WriteScope(row, root, this.phoneNumbers.getTypeArgs().clone(), tempOut_childScope); - childScope = tempOut_childScope.argValue; + childScope = tempOut_childScope.get(); if (r != Result.Success) { return r; } @@ -652,9 +664,9 @@ public final class CodeGenRowGenerator { childScope.MoveNext(row); } - tangible.RefObject tempRef_childScope = new tangible.RefObject(childScope); - Microsoft.Azure.Cosmos.Serialization.HybridRow.RowCursorExtensions.Skip(root.argValue.clone(), row, tempRef_childScope); - childScope = tempRef_childScope.argValue; + RefObject tempRef_childScope = new RefObject(childScope); + RowCursorExtensions.Skip(root.get().clone(), row, tempRef_childScope); + childScope = tempRef_childScope.get(); } break; @@ -664,7 +676,7 @@ public final class CodeGenRowGenerator { //ORIGINAL LINE: case 0 when key.Equals(GuestsHybridRowSerializer.AddressesName): case 0 if (value != null) { - root.argValue.Find(row, this.addressesToken.clone()); + root.get().Find(row, this.addressesToken.clone()); // TODO: C# TO JAVA CONVERTER: The following lambda contained an unresolved 'ref' // keyword - these are not converted by C# to Java Converter: r = LayoutType.TypedMap.WriteScope(row, root, this.addresses.getTypeArgs().clone(), (this @@ -673,16 +685,16 @@ public final class CodeGenRowGenerator { _this, ArrayList < Object > value)ctx) -> { for (Object item : ctx.value) { - tangible.RefObject tempRef_row2 = new tangible.RefObject(row2); - tangible.RefObject tempRef_childScope = new tangible.RefObject(childScope); + RefObject tempRef_row2 = new RefObject(row2); + RefObject tempRef_childScope = new RefObject(childScope); Result r2 = LayoutType.TypedTuple.WriteScope(tempRef_row2, tempRef_childScope, ctx._this.addresses.TypeArgs, (ctx._this, (ArrayList)item), (ref RowBuffer row3, ref RowCursor tupleScope, (GuestsHybridRowSerializer _this, ArrayList < Object > value)ctx2) -> { - tangible.RefObjecttempRef_row3 = new tangible.RefObjecttempRef_row3 = new RefObject (row3); - tangible.RefObjecttempRef_tupleScope = new tangible.RefObjecttempRef_tupleScope = new RefObject (tupleScope); Result r3 = LayoutType.Utf8.WriteSparse(tempRef_row3, tempRef_tupleScope, (Utf8String)ctx2.value[0]); @@ -692,27 +704,27 @@ public final class CodeGenRowGenerator { return r3; } - tangible.RefObjecttempRef_row32 = new tangible.RefObjecttempRef_row32 = new RefObject (row3); tupleScope.MoveNext(tempRef_row32); row3 = tempRef_row32.argValue; - tangible.RefObject tempRef_row33 = new tangible.RefObject(row3); - tangible.RefObject tempRef_tupleScope2 = new tangible.RefObject(tupleScope); + RefObject tempRef_row33 = new RefObject(row3); + RefObject tempRef_tupleScope2 = new RefObject(tupleScope); Result tempVar = LayoutType.ImmutableUDT.WriteScope(tempRef_row33, tempRef_tupleScope2, ctx2._this.addresses.TypeArgs[1].TypeArgs, (HashMap)ctx2.value[1], ctx2._this.addressSerializerWriter); - tupleScope = tempRef_tupleScope2.argValue; - row3 = tempRef_row33.argValue; + tupleScope = tempRef_tupleScope2.get(); + row3 = tempRef_row33.get(); return tempVar; }) - childScope = tempRef_childScope.argValue; - row2 = tempRef_row2.argValue; + childScope = tempRef_childScope.get(); + row2 = tempRef_row2.get(); if (r2 != Result.Success) { return r2; } - tangible.RefObjecttempRef_row22 = new tangible.RefObjecttempRef_row22 = new RefObject (row2); childScope.MoveNext(tempRef_row22); row2 = tempRef_row22.argValue; @@ -741,7 +753,7 @@ public final class CodeGenRowGenerator { break; default: - Contract.Fail(String.format("Unknown property name: %1$s", key)); + throw new IllegalStateException(lenientFormat("Unknown property name: %s", key)); break; } } @@ -763,32 +775,32 @@ public final class CodeGenRowGenerator { private LayoutColumn phone; public HotelsHybridRowSerializer(Layout layout, LayoutResolver resolver) { - tangible.OutObject tempOut_hotelId = - new tangible.OutObject(); + OutObject tempOut_hotelId = + new OutObject(); layout.TryFind(HotelsHybridRowSerializer.HotelIdName, tempOut_hotelId); - this.hotelId = tempOut_hotelId.argValue; - tangible.OutObject tempOut_name = - new tangible.OutObject(); + this.hotelId = tempOut_hotelId.get(); + OutObject tempOut_name = + new OutObject(); layout.TryFind(HotelsHybridRowSerializer.NameName, tempOut_name); - this.name = tempOut_name.argValue; - tangible.OutObject tempOut_phone = - new tangible.OutObject(); + this.name = tempOut_name.get(); + OutObject tempOut_phone = + new OutObject(); layout.TryFind(HotelsHybridRowSerializer.PhoneName, tempOut_phone); - this.phone = tempOut_phone.argValue; - tangible.OutObject tempOut_address = - new tangible.OutObject(); + this.phone = tempOut_phone.get(); + OutObject tempOut_address = + new OutObject(); layout.TryFind(HotelsHybridRowSerializer.AddressName, tempOut_address); - this.address = tempOut_address.argValue; - tangible.OutObject tempOut_addressToken = new tangible.OutObject(); + this.address = tempOut_address.get(); + OutObject tempOut_addressToken = new OutObject(); layout.getTokenizer().TryFindToken(this.address.getPath(), tempOut_addressToken); - this.addressToken = tempOut_addressToken.argValue; + this.addressToken = tempOut_addressToken.get(); this.addressSerializer = new AddressHybridRowSerializer(resolver.Resolve(this.address.getTypeArgs().getSchemaId().clone()), resolver); } @Override - public Result ReadBuffer(tangible.RefObject row, tangible.RefObject root) { + public Result ReadBuffer(RefObject row, RefObject root) { Utf8Span _; // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'out' keyword - these // cannot be converted using the 'OutObject' helper class unless the method is within the code being @@ -816,34 +828,34 @@ public final class CodeGenRowGenerator { return r; } - root.argValue.Find(row, this.addressToken.clone()); + root.get().Find(row, this.addressToken.clone()); RowCursor childScope; - tangible.OutObject tempOut_childScope = - new tangible.OutObject(); + OutObject tempOut_childScope = + new OutObject(); r = LayoutType.UDT.ReadScope(row, root, tempOut_childScope); - childScope = tempOut_childScope.argValue; + childScope = tempOut_childScope.get(); if (r != Result.Success) { return r; } - tangible.RefObject tempRef_childScope = - new tangible.RefObject(childScope); + RefObject tempRef_childScope = + new RefObject(childScope); r = this.addressSerializer.ReadBuffer(row, tempRef_childScope); - childScope = tempRef_childScope.argValue; + childScope = tempRef_childScope.get(); if (r != Result.Success) { return r; } - tangible.RefObject tempRef_childScope2 = - new tangible.RefObject(childScope); - Microsoft.Azure.Cosmos.Serialization.HybridRow.RowCursorExtensions.Skip(root.argValue.clone(), row, + RefObject tempRef_childScope2 = + new RefObject(childScope); + RowCursorExtensions.Skip(root.get().clone(), row, tempRef_childScope2); - childScope = tempRef_childScope2.argValue; + childScope = tempRef_childScope2.get(); return Result.Success; } @Override - public Result WriteBuffer(tangible.RefObject row, tangible.RefObject root, + public Result WriteBuffer(RefObject row, RefObject root, HashMap tableValue) { for ((Utf8String key,Object value) :tableValue) { @@ -893,33 +905,33 @@ public final class CodeGenRowGenerator { //ORIGINAL LINE: case 0 when key.Equals(HotelsHybridRowSerializer.AddressName): case 0 if (value != null) { - root.argValue.Find(row, this.addressToken.clone()); + root.get().Find(row, this.addressToken.clone()); RowCursor childScope; - tangible.OutObject tempOut_childScope = new tangible.OutObject(); + OutObject tempOut_childScope = new OutObject(); r = LayoutType.UDT.WriteScope(row, root, this.address.getTypeArgs().clone(), tempOut_childScope); - childScope = tempOut_childScope.argValue; + childScope = tempOut_childScope.get(); if (r != Result.Success) { return r; } - tangible.RefObject tempRef_childScope = new tangible.RefObject(childScope); + RefObject tempRef_childScope = new RefObject(childScope); r = this.addressSerializer.WriteBuffer(row, tempRef_childScope, (HashMap)value); - childScope = tempRef_childScope.argValue; + childScope = tempRef_childScope.get(); if (r != Result.Success) { return r; } - tangible.RefObject tempRef_childScope2 = new tangible.RefObject(childScope); - Microsoft.Azure.Cosmos.Serialization.HybridRow.RowCursorExtensions.Skip(root.argValue.clone(), row, tempRef_childScope2); - childScope = tempRef_childScope2.argValue; + RefObject tempRef_childScope2 = new RefObject(childScope); + RowCursorExtensions.Skip(root.get().clone(), row, tempRef_childScope2); + childScope = tempRef_childScope2.get(); } break; default: - Contract.Fail(String.format("Unknown property name: %1$s", key)); + throw new IllegalStateException(lenientFormat("Unknown property name: %s", key)); break; } } @@ -929,9 +941,9 @@ public final class CodeGenRowGenerator { } private abstract static class HybridRowSerializer { - public abstract Result ReadBuffer(tangible.RefObject row, tangible.RefObject root); + public abstract Result ReadBuffer(RefObject row, RefObject root); - public abstract Result WriteBuffer(tangible.RefObject row, tangible.RefObject root, + public abstract Result WriteBuffer(RefObject row, RefObject root, HashMap tableValue); } @@ -944,39 +956,39 @@ public final class CodeGenRowGenerator { // ReSharper disable once UnusedParameter.Local public PostalCodeHybridRowSerializer(Layout layout, LayoutResolver resolver) { - tangible.OutObject tempOut_zip = - new tangible.OutObject(); + OutObject tempOut_zip = + new OutObject(); layout.TryFind(PostalCodeHybridRowSerializer.ZipName, tempOut_zip); - this.zip = tempOut_zip.argValue; - tangible.OutObject tempOut_plus4 = - new tangible.OutObject(); + this.zip = tempOut_zip.get(); + OutObject tempOut_plus4 = + new OutObject(); layout.TryFind(PostalCodeHybridRowSerializer.Plus4Name, tempOut_plus4); - this.plus4 = tempOut_plus4.argValue; - tangible.OutObject tempOut_plus4Token = new tangible.OutObject(); + this.plus4 = tempOut_plus4.get(); + OutObject tempOut_plus4Token = new OutObject(); layout.getTokenizer().TryFindToken(this.plus4.getPath(), tempOut_plus4Token); - this.plus4Token = tempOut_plus4Token.argValue; + this.plus4Token = tempOut_plus4Token.get(); } @Override - public Result ReadBuffer(tangible.RefObject row, tangible.RefObject root) { + public Result ReadBuffer(RefObject row, RefObject root) { int _; - tangible.OutObject tempOut__ = new tangible.OutObject(); + OutObject tempOut__ = new OutObject(); Result r = LayoutType.Int32.ReadFixed(row, root, this.zip, tempOut__); - _ = tempOut__.argValue; + _ = tempOut__.get(); if (r != Result.Success) { return r; } - root.argValue.Find(row, this.plus4Token.clone()); + root.get().Find(row, this.plus4Token.clone()); short _; - tangible.OutObject tempOut__2 = new tangible.OutObject(); + OutObject tempOut__2 = new OutObject(); Result tempVar = LayoutType.Int16.ReadSparse(row, root, tempOut__2); - _ = tempOut__2.argValue; + _ = tempOut__2.get(); return tempVar; } @Override - public Result WriteBuffer(tangible.RefObject row, tangible.RefObject root, + public Result WriteBuffer(RefObject row, RefObject root, HashMap tableValue) { for ((Utf8String key,Object value) :tableValue) { @@ -1000,7 +1012,7 @@ public final class CodeGenRowGenerator { //ORIGINAL LINE: case 0 when key.Equals(PostalCodeHybridRowSerializer.Plus4Name): case 0 if (value != null) { - root.argValue.Find(row, this.plus4Token.clone()); + root.get().Find(row, this.plus4Token.clone()); r = LayoutType.Int16.WriteSparse(row, root, (short)value); if (r != Result.Success) { return r; @@ -1010,7 +1022,7 @@ public final class CodeGenRowGenerator { break; default: - Contract.Fail(String.format("Unknown property name: %1$s", key)); + throw new IllegalStateException(lenientFormat("Unknown property name: %s", key)); break; } } @@ -1031,24 +1043,24 @@ public final class CodeGenRowGenerator { // ReSharper disable once UnusedParameter.Local public RoomsHybridRowSerializer(Layout layout, LayoutResolver resolver) { - tangible.OutObject tempOut_hotelId = - new tangible.OutObject(); + OutObject tempOut_hotelId = + new OutObject(); layout.TryFind(RoomsHybridRowSerializer.HotelIdName, tempOut_hotelId); - this.hotelId = tempOut_hotelId.argValue; - tangible.OutObject tempOut_date = - new tangible.OutObject(); + this.hotelId = tempOut_hotelId.get(); + OutObject tempOut_date = + new OutObject(); layout.TryFind(RoomsHybridRowSerializer.DateName, tempOut_date); - this.date = tempOut_date.argValue; - tangible.OutObject tempOut_roomNumber = new tangible.OutObject(); + this.date = tempOut_date.get(); + OutObject tempOut_roomNumber = new OutObject(); layout.TryFind(RoomsHybridRowSerializer.RoomNumberName, tempOut_roomNumber); - this.roomNumber = tempOut_roomNumber.argValue; - tangible.OutObject tempOut_isAvailable = new tangible.OutObject(); + this.roomNumber = tempOut_roomNumber.get(); + OutObject tempOut_isAvailable = new OutObject(); layout.TryFind(RoomsHybridRowSerializer.IsAvailableName, tempOut_isAvailable); - this.isAvailable = tempOut_isAvailable.argValue; + this.isAvailable = tempOut_isAvailable.get(); } @Override - public Result ReadBuffer(tangible.RefObject row, tangible.RefObject root) { + public Result ReadBuffer(RefObject row, RefObject root) { Utf8Span _; // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'out' keyword - these // cannot be converted using the 'OutObject' helper class unless the method is within the code being @@ -1059,32 +1071,32 @@ public final class CodeGenRowGenerator { } java.time.LocalDateTime _; - tangible.OutObject tempOut__ = new tangible.OutObject(); + OutObject tempOut__ = new OutObject(); r = LayoutType.DateTime.ReadFixed(row, root, this.date, tempOut__); - _ = tempOut__.argValue; + _ = tempOut__.get(); if (r != Result.Success) { return r; } byte _; - tangible.OutObject tempOut__2 = new tangible.OutObject(); + OutObject tempOut__2 = new OutObject(); //C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java: //ORIGINAL LINE: r = LayoutType.UInt8.ReadFixed(ref row, ref root, this.roomNumber, out byte _); r = LayoutType.UInt8.ReadFixed(row, root, this.roomNumber, tempOut__2); - _ = tempOut__2.argValue; + _ = tempOut__2.get(); if (r != Result.Success) { return r; } boolean _; - tangible.OutObject tempOut__3 = new tangible.OutObject(); + OutObject tempOut__3 = new OutObject(); Result tempVar = LayoutType.Boolean.ReadFixed(row, root, this.isAvailable, tempOut__3); - _ = tempOut__3.argValue; + _ = tempOut__3.get(); return tempVar; } @Override - public Result WriteBuffer(tangible.RefObject row, tangible.RefObject root, + public Result WriteBuffer(RefObject row, RefObject root, HashMap tableValue) { for ((Utf8String key,Object value) :tableValue) { @@ -1146,7 +1158,7 @@ public final class CodeGenRowGenerator { break; default: - Contract.Fail(String.format("Unknown property name: %1$s", key)); + throw new IllegalStateException(lenientFormat("Unknown property name: %s", key)); break; } } diff --git a/jre/src/test/java/azure/data/cosmos/serialization/hybridrow/perf/GenerateBenchmarkSuite.java b/jre/src/test/java/com/azure/data/cosmos/serialization/hybridrow/perf/GenerateBenchmarkSuite.java similarity index 96% rename from jre/src/test/java/azure/data/cosmos/serialization/hybridrow/perf/GenerateBenchmarkSuite.java rename to jre/src/test/java/com/azure/data/cosmos/serialization/hybridrow/perf/GenerateBenchmarkSuite.java index ee45d60..abd29e7 100644 --- a/jre/src/test/java/azure/data/cosmos/serialization/hybridrow/perf/GenerateBenchmarkSuite.java +++ b/jre/src/test/java/com/azure/data/cosmos/serialization/hybridrow/perf/GenerateBenchmarkSuite.java @@ -2,14 +2,12 @@ // Copyright (c) Microsoft Corporation. All rights reserved. //------------------------------------------------------------ -package azure.data.cosmos.serialization.hybridrow.perf; +package com.azure.data.cosmos.serialization.hybridrow.perf; import java.io.File; import java.nio.file.Files; import java.util.ArrayList; -import java.util.Dictionary; import java.util.HashMap; -import java.util.List; import java.util.Random; // TODO: C# TO JAVA CONVERTER: Java annotations will not correspond to .NET attributes: diff --git a/jre/src/test/java/azure/data/cosmos/serialization/hybridrow/perf/JsonModelRowGenerator.java b/jre/src/test/java/com/azure/data/cosmos/serialization/hybridrow/perf/JsonModelRowGenerator.java similarity index 68% rename from jre/src/test/java/azure/data/cosmos/serialization/hybridrow/perf/JsonModelRowGenerator.java rename to jre/src/test/java/com/azure/data/cosmos/serialization/hybridrow/perf/JsonModelRowGenerator.java index ee199a5..4101d48 100644 --- a/jre/src/test/java/azure/data/cosmos/serialization/hybridrow/perf/JsonModelRowGenerator.java +++ b/jre/src/test/java/com/azure/data/cosmos/serialization/hybridrow/perf/JsonModelRowGenerator.java @@ -2,16 +2,27 @@ // Copyright (c) Microsoft Corporation. All rights reserved. //------------------------------------------------------------ -package azure.data.cosmos.serialization.hybridrow.perf; +package com.azure.data.cosmos.serialization.hybridrow.perf; -import azure.data.cosmos.serialization.hybridrow.HybridRowVersion; -import azure.data.cosmos.serialization.hybridrow.ISpanResizer; -import azure.data.cosmos.serialization.hybridrow.Result; -import azure.data.cosmos.serialization.hybridrow.RowBuffer; +import com.azure.data.cosmos.core.RefObject; +import com.azure.data.cosmos.serialization.hybridrow.HybridRowVersion; +import com.azure.data.cosmos.serialization.hybridrow.ISpanResizer; +import com.azure.data.cosmos.serialization.hybridrow.Result; +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.RowWriter; +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.LayoutType; +import com.azure.data.cosmos.serialization.hybridrow.layouts.TypeArgument; +import java.io.InputStream; +import java.io.OutputStream; import java.util.ArrayList; import java.util.HashMap; +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 // from the original: //ORIGINAL LINE: public ref struct JsonModelRowGenerator @@ -41,17 +52,16 @@ public final class JsonModelRowGenerator { } public RowReader GetReader() { - tangible.RefObject tempRef_row = - new tangible.RefObject(this.row); + RefObject tempRef_row = new RefObject(this.row); // TODO: C# TO JAVA CONVERTER: The following line could not be converted: return new RowReader(ref this.row) - this.row = tempRef_row.argValue; + this.row = tempRef_row.get(); return tempVar; } // TODO: C# TO JAVA CONVERTER: C# to Java Converter cannot determine whether this System.IO.Stream is input or // output: - public boolean ReadFrom(Stream stream, int length) { + public boolean ReadFrom(InputStream stream, int length) { return this.row.ReadFrom(stream, length, HybridRowVersion.V1, this.row.getResolver()); } @@ -67,8 +77,8 @@ public final class JsonModelRowGenerator { } public Result WriteBuffer(HashMap value) { - tangible.RefObject tempRef_row = - new tangible.RefObject(this.row); + RefObject tempRef_row = + new RefObject(this.row); // TODO: C# TO JAVA CONVERTER: The following lambda contained an unresolved 'ref' keyword - these are not // converted by C# to Java Converter: Result tempVar = RowWriter.WriteBuffer(tempRef_row, value, (ref RowWriter writer, TypeArgument typeArg, @@ -76,86 +86,84 @@ public final class JsonModelRowGenerator { { for ((Utf8String propPath,Object propValue) :dict) { - tangible.RefObject tempRef_writer = - new tangible.RefObject(writer); + RefObject tempRef_writer = + new RefObject(writer); Result result = JsonModelRowGenerator.JsonModelSwitch(tempRef_writer, propPath, propValue); - writer = tempRef_writer.argValue; + writer = tempRef_writer.get(); return result; } return Result.Success; }); - this.row = tempRef_row.argValue; + this.row = tempRef_row.get(); return tempVar; } // TODO: C# TO JAVA CONVERTER: C# to Java Converter cannot determine whether this System.IO.Stream is input or // output: - public void WriteTo(Stream stream) { + public void WriteTo(OutputStream stream) { this.row.WriteTo(stream); } public JsonModelRowGenerator clone() { JsonModelRowGenerator varCopy = new JsonModelRowGenerator(); - varCopy.row = this.row.clone(); - return varCopy; } - private static Result JsonModelSwitch(tangible.RefObject writer, Utf8String path, Object value) { + private static Result JsonModelSwitch(RefObject writer, Utf8String path, Object value) { switch (value) { case null: - return writer.argValue.WriteNull(path); + return writer.get().WriteNull(path); // TODO: C# TO JAVA CONVERTER: Java has no equivalent to C# pattern variables in 'case' statements: //ORIGINAL LINE: case bool x: case boolean x: - return writer.argValue.WriteBool(path, x); + return writer.get().WriteBool(path, x); // TODO: C# TO JAVA CONVERTER: Java has no equivalent to C# pattern variables in 'case' statements: //ORIGINAL LINE: case long x: case long x: - return writer.argValue.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: //ORIGINAL LINE: case double x: case double x: - return writer.argValue.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: //ORIGINAL LINE: case string x: case String x: - return writer.argValue.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: //ORIGINAL LINE: case Utf8String x: case Utf8String x: - return writer.argValue.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: //ORIGINAL LINE: case byte[] x: //C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java: case byte[] x: - return writer.argValue.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: //ORIGINAL LINE: case ReadOnlyMemory x: //C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java: case ReadOnlyMemory < Byte > x: - return writer.argValue.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: //ORIGINAL LINE: case Dictionary x: case HashMap < Utf8String, Object > x: // TODO: C# TO JAVA CONVERTER: The following lambda contained an unresolved 'ref' keyword - these // are not converted by C# to Java Converter: - return writer.argValue.WriteScope(path, new TypeArgument(LayoutType.Object), x, + return writer.get().WriteScope(path, new TypeArgument(LayoutType.Object), x, (ref RowWriter writer2, TypeArgument typeArg, HashMap dict) -> { for ((Utf8String propPath,Object propValue) :dict) { - tangible.RefObject tempRef_writer2 = new tangible.RefObject(writer2); + RefObject tempRef_writer2 = new RefObject(writer2); Result result = JsonModelRowGenerator.JsonModelSwitch(tempRef_writer2, propPath, propValue); - writer2 = tempRef_writer2.argValue; + writer2 = tempRef_writer2.get(); return result; } @@ -165,12 +173,12 @@ public final class JsonModelRowGenerator { //ORIGINAL LINE: case List 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: - return writer.argValue.WriteScope(path, new TypeArgument(LayoutType.Array), x, (ref RowWriter writer2, TypeArgument typeArg, ArrayList list) -> + return writer.get().WriteScope(path, new TypeArgument(LayoutType.Array), x, (ref RowWriter writer2, TypeArgument typeArg, ArrayList list) -> { for (Object elm : list) { - tangible.RefObject tempRef_writer2 = new tangible.RefObject(writer2); + RefObject tempRef_writer2 = new RefObject(writer2); Result result = JsonModelRowGenerator.JsonModelSwitch(tempRef_writer2, null, elm); - writer2 = tempRef_writer2.argValue; + writer2 = tempRef_writer2.get(); if (result != Result.Success) { return result; } @@ -179,7 +187,7 @@ public final class JsonModelRowGenerator { return Result.Success; }); default: - Contract.Assert(false, String.format("Unknown type will be ignored: %1$s", value.getClass().getSimpleName())); + throw new IllegalStateException(lenientFormat("Unknown type will be ignored: %s", value.getClass().getSimpleName())); return Result.Failure; } } diff --git a/jre/src/test/java/azure/data/cosmos/serialization/hybridrow/perf/Measurements.java b/jre/src/test/java/com/azure/data/cosmos/serialization/hybridrow/perf/Measurements.java similarity index 96% rename from jre/src/test/java/azure/data/cosmos/serialization/hybridrow/perf/Measurements.java rename to jre/src/test/java/com/azure/data/cosmos/serialization/hybridrow/perf/Measurements.java index 1503cce..15a7ce4 100644 --- a/jre/src/test/java/azure/data/cosmos/serialization/hybridrow/perf/Measurements.java +++ b/jre/src/test/java/com/azure/data/cosmos/serialization/hybridrow/perf/Measurements.java @@ -2,7 +2,7 @@ // Copyright (c) Microsoft Corporation. All rights reserved. //------------------------------------------------------------ -package azure.data.cosmos.serialization.hybridrow.perf; +package com.azure.data.cosmos.serialization.hybridrow.perf; import java.io.Closeable; import java.io.File; diff --git a/jre/src/test/java/azure/data/cosmos/serialization/hybridrow/perf/MicroBenchmarkSuiteBase.java b/jre/src/test/java/com/azure/data/cosmos/serialization/hybridrow/perf/MicroBenchmarkSuiteBase.java similarity index 92% rename from jre/src/test/java/azure/data/cosmos/serialization/hybridrow/perf/MicroBenchmarkSuiteBase.java rename to jre/src/test/java/com/azure/data/cosmos/serialization/hybridrow/perf/MicroBenchmarkSuiteBase.java index 2792e4e..683aef8 100644 --- a/jre/src/test/java/azure/data/cosmos/serialization/hybridrow/perf/MicroBenchmarkSuiteBase.java +++ b/jre/src/test/java/com/azure/data/cosmos/serialization/hybridrow/perf/MicroBenchmarkSuiteBase.java @@ -2,9 +2,10 @@ // Copyright (c) Microsoft Corporation. All rights reserved. //------------------------------------------------------------ -package azure.data.cosmos.serialization.hybridrow.perf; +package com.azure.data.cosmos.serialization.hybridrow.perf; import JetBrains.Profiler.Api.*; +import com.azure.data.cosmos.core.RefObject; import java.util.ArrayList; @@ -26,7 +27,7 @@ public class MicroBenchmarkSuiteBase extends BenchmarkSuiteBase { // operation, string schema, string api, int innerLoopIterations, ref BenchmarkContext context, // BenchmarkBody loopBody, BenchmarkMeasure measure, List expected) protected static void Benchmark(String model, String operation, String schema, String api, - int innerLoopIterations, tangible.RefObject context, + int innerLoopIterations, RefObject context, BenchmarkBody loopBody, BenchmarkMeasure measure, ArrayList expected) { Stopwatch sw = new Stopwatch(); @@ -82,7 +83,7 @@ public class MicroBenchmarkSuiteBase extends BenchmarkSuiteBase { //ORIGINAL LINE: [MethodImpl(MethodImplOptions.NoInlining)] private static void BenchmarkInnerLoop(int // innerLoopIterations, TValue tableValue, ref BenchmarkContext context, BenchmarkBody loopBody) private static void BenchmarkInnerLoop(int innerLoopIterations, TValue tableValue, - tangible.RefObject context, + RefObject context, BenchmarkBody loopBody) { for (int innerLoop = 0; innerLoop < innerLoopIterations; innerLoop++) { loopBody.invoke(context, tableValue); @@ -91,12 +92,12 @@ public class MicroBenchmarkSuiteBase extends BenchmarkSuiteBase { @FunctionalInterface public interface BenchmarkBody { - void invoke(tangible.RefObject context, TValue value); + void invoke(RefObject context, TValue value); } @FunctionalInterface public interface BenchmarkMeasure { - long invoke(tangible.RefObject context, TValue value); + long invoke(RefObject context, TValue value); } //C# TO JAVA CONVERTER WARNING: Java does not allow user-defined value types. The behavior of this class may diff --git a/jre/src/test/java/azure/data/cosmos/serialization/hybridrow/perf/ProtobufRowGenerator.java b/jre/src/test/java/com/azure/data/cosmos/serialization/hybridrow/perf/ProtobufRowGenerator.java similarity index 78% rename from jre/src/test/java/azure/data/cosmos/serialization/hybridrow/perf/ProtobufRowGenerator.java rename to jre/src/test/java/com/azure/data/cosmos/serialization/hybridrow/perf/ProtobufRowGenerator.java index 4581a92..cd33845 100644 --- a/jre/src/test/java/azure/data/cosmos/serialization/hybridrow/perf/ProtobufRowGenerator.java +++ b/jre/src/test/java/com/azure/data/cosmos/serialization/hybridrow/perf/ProtobufRowGenerator.java @@ -2,16 +2,23 @@ // Copyright (c) Microsoft Corporation. All rights reserved. //------------------------------------------------------------ -package azure.data.cosmos.serialization.hybridrow.perf; +package com.azure.data.cosmos.serialization.hybridrow.perf; import Google.Protobuf.*; 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.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.Hotels; +import com.azure.data.cosmos.serialization.hybridrow.perf.CassandraHotel.Protobuf.PostalCode; import java.time.LocalDateTime; import java.util.ArrayList; import java.util.HashMap; import java.util.UUID; +import static com.google.common.base.Strings.lenientFormat; + // TODO: C# TO JAVA CONVERTER: There is no preprocessor in Java: ///#pragma warning disable DontUseNamespaceAliases // Namespace Aliases should be avoided @@ -63,7 +70,7 @@ public final class ProtobufRowGenerator { break; default: - Contract.Fail(String.format("Unknown schema will be ignored: %1$s", this.schemaName)); + throw new IllegalStateException(lenientFormat("Unknown schema will be ignored: %s", this.schemaName)); break; } } @@ -89,7 +96,7 @@ public final class ProtobufRowGenerator { break; default: - Contract.Fail(String.format("Unknown schema will be ignored: %1$s", this.schemaName)); + throw new IllegalStateException(lenientFormat("Unknown schema will be ignored: %s", this.schemaName)); break; } } @@ -104,8 +111,8 @@ public final class ProtobufRowGenerator { return varCopy; } - private static Microsoft.Azure.Cosmos.Serialization.HybridRow.Tests.Perf.CassandraHotel.Protobuf.Address MakeAddress(HashMap tableValue) { - Microsoft.Azure.Cosmos.Serialization.HybridRow.Tests.Perf.CassandraHotel.Protobuf.Address address = new Microsoft.Azure.Cosmos.Serialization.HybridRow.Tests.Perf.CassandraHotel.Protobuf.Address(); + private static Address MakeAddress(HashMap tableValue) { + Address address = new Address(); for ((Utf8String key,Object value) :tableValue) { switch (key.toString()) { @@ -126,7 +133,7 @@ public final class ProtobufRowGenerator { break; default: - Assert.Fail("should never happen"); + throw new IllegalStateException(); break; } } @@ -134,8 +141,8 @@ public final class ProtobufRowGenerator { return address; } - private static Microsoft.Azure.Cosmos.Serialization.HybridRow.Tests.Perf.CassandraHotel.Protobuf.PostalCode MakePostalCode(HashMap tableValue) { - Microsoft.Azure.Cosmos.Serialization.HybridRow.Tests.Perf.CassandraHotel.Protobuf.PostalCode postalCode = new Microsoft.Azure.Cosmos.Serialization.HybridRow.Tests.Perf.CassandraHotel.Protobuf.PostalCode(); + private static PostalCode MakePostalCode(HashMap tableValue) { + PostalCode postalCode = new PostalCode(); for ((Utf8String key,Object value) :tableValue) { switch (key.toString()) { @@ -148,7 +155,7 @@ public final class ProtobufRowGenerator { break; default: - Assert.Fail("should never happen"); + throw new IllegalStateException(); break; } } @@ -157,12 +164,12 @@ public final class ProtobufRowGenerator { } private static void PopulateStringAddressMap(MapField field, + Address> field, ArrayList list) { for (Object item : list) { ArrayList tuple = (ArrayList)item; String key = ((Utf8String)tuple.get(0)).toString(); - Microsoft.Azure.Cosmos.Serialization.HybridRow.Tests.Perf.CassandraHotel.Protobuf.Address value = + Address value = ProtobufRowGenerator.MakeAddress((HashMap)tuple.get(1)); field.Add(key, value); } @@ -177,29 +184,29 @@ public final class ProtobufRowGenerator { //C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java: //ORIGINAL LINE: private static void ReadBufferGuest(byte[] buffer) private static void ReadBufferGuest(byte[] buffer) { - Microsoft.Azure.Cosmos.Serialization.HybridRow.Tests.Perf.CassandraHotel.Protobuf.Guests item = - new Microsoft.Azure.Cosmos.Serialization.HybridRow.Tests.Perf.CassandraHotel.Protobuf.Guests(); + Guests item = + new Guests(); item.MergeFrom(buffer); } //C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java: //ORIGINAL LINE: private static void ReadBufferHotel(byte[] buffer) private static void ReadBufferHotel(byte[] buffer) { - Microsoft.Azure.Cosmos.Serialization.HybridRow.Tests.Perf.CassandraHotel.Protobuf.Hotels item = - new Microsoft.Azure.Cosmos.Serialization.HybridRow.Tests.Perf.CassandraHotel.Protobuf.Hotels(); + Hotels item = + new Hotels(); item.MergeFrom(buffer); } //C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java: //ORIGINAL LINE: private static void ReadBufferRoom(byte[] buffer) private static void ReadBufferRoom(byte[] buffer) { - Microsoft.Azure.Cosmos.Serialization.HybridRow.Tests.Perf.CassandraHotel.Protobuf.Available_Rooms_By_Hotel_Date item = new Microsoft.Azure.Cosmos.Serialization.HybridRow.Tests.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); } private void WriteBufferGuest(HashMap tableValue) { - Microsoft.Azure.Cosmos.Serialization.HybridRow.Tests.Perf.CassandraHotel.Protobuf.Guests room = - new Microsoft.Azure.Cosmos.Serialization.HybridRow.Tests.Perf.CassandraHotel.Protobuf.Guests(); + azure.data.cosmos.serialization.hybridrow.perf.CassandraHotel.Protobuf.Guests room = + new azure.data.cosmos.serialization.hybridrow.perf.CassandraHotel.Protobuf.Guests(); try (CodedOutputStream stm = new CodedOutputStream(this.buffer)) { for ((Utf8String key,Object value) :tableValue) { @@ -259,8 +266,8 @@ public final class ProtobufRowGenerator { } private void WriteBufferHotel(HashMap tableValue) { - Microsoft.Azure.Cosmos.Serialization.HybridRow.Tests.Perf.CassandraHotel.Protobuf.Hotels room = - new Microsoft.Azure.Cosmos.Serialization.HybridRow.Tests.Perf.CassandraHotel.Protobuf.Hotels(); + azure.data.cosmos.serialization.hybridrow.perf.CassandraHotel.Protobuf.Hotels room = + new azure.data.cosmos.serialization.hybridrow.perf.CassandraHotel.Protobuf.Hotels(); try (CodedOutputStream stm = new CodedOutputStream(this.buffer)) { for ((Utf8String key,Object value) :tableValue) { @@ -295,7 +302,7 @@ public final class ProtobufRowGenerator { } private void WriteBufferRoom(HashMap tableValue) { - Microsoft.Azure.Cosmos.Serialization.HybridRow.Tests.Perf.CassandraHotel.Protobuf.Available_Rooms_By_Hotel_Date room = new Microsoft.Azure.Cosmos.Serialization.HybridRow.Tests.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)) { for ((Utf8String key,Object value) :tableValue) { diff --git a/jre/src/test/java/azure/data/cosmos/serialization/hybridrow/perf/ReaderBenchmark.java b/jre/src/test/java/com/azure/data/cosmos/serialization/hybridrow/perf/ReaderBenchmark.java similarity index 89% rename from jre/src/test/java/azure/data/cosmos/serialization/hybridrow/perf/ReaderBenchmark.java rename to jre/src/test/java/com/azure/data/cosmos/serialization/hybridrow/perf/ReaderBenchmark.java index 52faf99..11eb463 100644 --- a/jre/src/test/java/azure/data/cosmos/serialization/hybridrow/perf/ReaderBenchmark.java +++ b/jre/src/test/java/com/azure/data/cosmos/serialization/hybridrow/perf/ReaderBenchmark.java @@ -2,12 +2,16 @@ // Copyright (c) Microsoft Corporation. All rights reserved. //------------------------------------------------------------ -package azure.data.cosmos.serialization.hybridrow.perf; +package com.azure.data.cosmos.serialization.hybridrow.perf; -import azure.data.cosmos.serialization.hybridrow.HybridRowVersion; -import azure.data.cosmos.serialization.hybridrow.MemorySpanResizer; -import azure.data.cosmos.serialization.hybridrow.Result; -import azure.data.cosmos.serialization.hybridrow.RowBuffer; +import com.azure.data.cosmos.core.OutObject; +import com.azure.data.cosmos.core.RefObject; +import com.azure.data.cosmos.serialization.hybridrow.HybridRowVersion; +import com.azure.data.cosmos.serialization.hybridrow.MemorySpanResizer; +import com.azure.data.cosmos.serialization.hybridrow.Result; +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.Segment; import java.io.Closeable; import java.io.File; @@ -119,7 +123,7 @@ public final class ReaderBenchmark { MemorySpanResizer resizer = new MemorySpanResizer(ReaderBenchmark.InitialCapacity); // TODO: C# TO JAVA CONVERTER: There is no equivalent to 'await' in Java: Result r = await - Microsoft.Azure.Cosmos.Serialization.HybridRow.RecordIO.RecordIOStream.ReadRecordIOAsync(context.getInput(), + RecordIOStream.ReadRecordIOAsync(context.getInput(), record -> { context.IncrementRecordCount(); @@ -129,10 +133,10 @@ public final class ReaderBenchmark { }, segment -> { Segment _; - tangible.OutObject tempOut__ = - new tangible.OutObject(); + OutObject tempOut__ = + new OutObject(); r = SegmentSerializer.Read(segment.Span, context.getResolver(), tempOut__); - _ = tempOut__.argValue; + _ = tempOut__.get(); assert Result.Success == r; // TODO: do something with embedded schema. @@ -146,11 +150,11 @@ public final class ReaderBenchmark { //ORIGINAL LINE: private static Result VisitOneRow(Memory buffer, LayoutResolver resolver) private static Result VisitOneRow(Memory buffer, LayoutResolver resolver) { RowBuffer row = new RowBuffer(buffer.Span, HybridRowVersion.V1, resolver); - tangible.RefObject tempRef_row = - new tangible.RefObject(row); + RefObject tempRef_row = + new RefObject(row); RowReader reader = new RowReader(tempRef_row); - row = tempRef_row.argValue; - return Microsoft.Azure.Cosmos.Serialization.HybridRow.Tests.Perf.RowReaderExtensions.VisitReader(reader.clone()); + row = tempRef_row.get(); + return RowReaderExtensions.VisitReader(reader.clone()); } private final static class BenchmarkContext implements Closeable { @@ -300,12 +304,12 @@ public final class ReaderBenchmark { private void DoWork() { while (!this.cancel.IsCancellationRequested) { Task item; - tangible.OutObject tempOut_item = new tangible.OutObject(); + OutObject tempOut_item = new OutObject(); if (this.tasks.TryDequeue(tempOut_item)) { - item = tempOut_item.argValue; + item = tempOut_item.get(); this.TryExecuteTask(item); } else { - item = tempOut_item.argValue; + item = tempOut_item.get(); this.ready.WaitOne(TimeSpan.FromSeconds(1)); } } diff --git a/jre/src/test/java/azure/data/cosmos/serialization/hybridrow/perf/RowReaderExtensions.java b/jre/src/test/java/com/azure/data/cosmos/serialization/hybridrow/perf/RowReaderExtensions.java similarity index 73% rename from jre/src/test/java/azure/data/cosmos/serialization/hybridrow/perf/RowReaderExtensions.java rename to jre/src/test/java/com/azure/data/cosmos/serialization/hybridrow/perf/RowReaderExtensions.java index f8df4ce..a6687fe 100644 --- a/jre/src/test/java/azure/data/cosmos/serialization/hybridrow/perf/RowReaderExtensions.java +++ b/jre/src/test/java/com/azure/data/cosmos/serialization/hybridrow/perf/RowReaderExtensions.java @@ -2,17 +2,18 @@ // Copyright (c) Microsoft Corporation. All rights reserved. //------------------------------------------------------------ -package azure.data.cosmos.serialization.hybridrow.perf; +package com.azure.data.cosmos.serialization.hybridrow.perf; -import azure.data.cosmos.serialization.hybridrow.Float128; -import azure.data.cosmos.serialization.hybridrow.Result; -import azure.data.cosmos.serialization.hybridrow.UnixDateTime; +import com.azure.data.cosmos.core.RefObject; +import com.azure.data.cosmos.serialization.hybridrow.Result; + +import static com.azure.data.cosmos.serialization.hybridrow.layouts.LayoutCode.ImmutableTagged2Scope; public final class RowReaderExtensions { - public static Result VisitReader(tangible.RefObject reader) { - while (reader.argValue.Read()) { - Utf8Span path = reader.argValue.getPathSpan(); - switch (reader.argValue.getType().LayoutCode) { + public static Result VisitReader(RefObject reader) { + while (reader.get().Read()) { + Utf8Span path = reader.get().getPathSpan(); + switch (reader.get().getType().LayoutCode) { case Null: case Boolean: case Int8: @@ -39,7 +40,7 @@ public final class RowReaderExtensions { case NullableScope: case ImmutableNullableScope: { - if (!reader.argValue.getHasValue()) { + if (!reader.get().getHasValue()) { break; } @@ -68,7 +69,7 @@ public final class RowReaderExtensions { case Tagged2Scope: case ImmutableTagged2Scope: { // 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.argValue.ReadScope(null, (ref RowReader child, Object _) -> child.VisitReader()); + Result r = reader.get().ReadScope(null, (ref RowReader child, Object _) -> child.VisitReader()); if (r != Result.Success) { return r; } @@ -77,7 +78,7 @@ public final class RowReaderExtensions { } default: { - Contract.Assert(false, String.format("Unknown type will be ignored: %1$s", reader.argValue.getType().LayoutCode)); + throw new IllegalStateException(lenientFormat("Unknown type will be ignored: %s", reader.get().getType().LayoutCode)); break; } } diff --git a/jre/src/test/java/azure/data/cosmos/serialization/hybridrow/perf/SchematizedMicroBenchmarkSuite.java b/jre/src/test/java/com/azure/data/cosmos/serialization/hybridrow/perf/SchematizedMicroBenchmarkSuite.java similarity index 91% rename from jre/src/test/java/azure/data/cosmos/serialization/hybridrow/perf/SchematizedMicroBenchmarkSuite.java rename to jre/src/test/java/com/azure/data/cosmos/serialization/hybridrow/perf/SchematizedMicroBenchmarkSuite.java index 1b495d0..c48c329 100644 --- a/jre/src/test/java/azure/data/cosmos/serialization/hybridrow/perf/SchematizedMicroBenchmarkSuite.java +++ b/jre/src/test/java/com/azure/data/cosmos/serialization/hybridrow/perf/SchematizedMicroBenchmarkSuite.java @@ -2,19 +2,18 @@ // Copyright (c) Microsoft Corporation. All rights reserved. //------------------------------------------------------------ -package azure.data.cosmos.serialization.hybridrow.perf; +package com.azure.data.cosmos.serialization.hybridrow.perf; import MongoDB.Bson.IO.*; import Newtonsoft.Json.*; -import azure.data.cosmos.serialization.hybridrow.HybridRowVersion; -import azure.data.cosmos.serialization.hybridrow.Result; -import azure.data.cosmos.serialization.hybridrow.RowBuffer; +import com.azure.data.cosmos.core.RefObject; +import com.azure.data.cosmos.serialization.hybridrow.HybridRowVersion; +import com.azure.data.cosmos.serialization.hybridrow.Result; +import com.azure.data.cosmos.serialization.hybridrow.RowBuffer; import java.nio.file.Files; import java.util.ArrayList; -import java.util.Dictionary; import java.util.HashMap; -import java.util.List; // TODO: C# TO JAVA CONVERTER: Java annotations will not correspond to .NET attributes: //ORIGINAL LINE: [TestClass][DeploymentItem(TestData.SchemaFile, TestData.Target)] public sealed class @@ -409,7 +408,7 @@ public final class SchematizedMicroBenchmarkSuite extends MicroBenchmarkSuiteBas } BenchmarkContext ignoredContext = null; - tangible.RefObject tempRef_ignoredContext = new tangible.RefObject(ignoredContext); + RefObject tempRef_ignoredContext = new RefObject(ignoredContext); // 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: @@ -424,7 +423,7 @@ public final class SchematizedMicroBenchmarkSuite extends MicroBenchmarkSuiteBas } } }, (ref BenchmarkContext _, byte[] tableValue) -> tableValue.length, expectedSerialized); - ignoredContext = tempRef_ignoredContext.argValue; + ignoredContext = tempRef_ignoredContext.get(); } private static void BsonWriteBenchmark(LayoutResolverNamespace resolver, String schemaName, String dataSetName, @@ -434,7 +433,7 @@ public final class SchematizedMicroBenchmarkSuite extends MicroBenchmarkSuiteBas try (BsonRowGenerator writer = new BsonRowGenerator(BenchmarkSuiteBase.InitialCapacity, layout, resolver)) { BenchmarkContext ignoredContext = null; - tangible.RefObject tempRef_ignoredContext = new tangible.RefObject(ignoredContext); + RefObject tempRef_ignoredContext = new RefObject(ignoredContext); // TODO: C# TO JAVA CONVERTER: The following lambda contained an unresolved 'ref' keyword - these are // not converted by C# to Java Converter: MicroBenchmarkSuiteBase.Benchmark("Schematized", "Write", dataSetName, "BSON", innerLoopIterations, @@ -443,7 +442,7 @@ public final class SchematizedMicroBenchmarkSuite extends MicroBenchmarkSuiteBas writer.Reset(); writer.WriteBuffer(tableValue); }, (ref BenchmarkContext _, HashMap tableValue) -> writer.getLength(), expected); - ignoredContext = tempRef_ignoredContext.argValue; + ignoredContext = tempRef_ignoredContext.get(); } } @@ -475,7 +474,7 @@ public final class SchematizedMicroBenchmarkSuite extends MicroBenchmarkSuiteBas BenchmarkContext ignoredContext = null; jsonSerializer.Converters.Add(new Utf8StringJsonConverter()); - tangible.RefObject tempRef_ignoredContext = new tangible.RefObject(ignoredContext); + RefObject tempRef_ignoredContext = new RefObject(ignoredContext); // 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: @@ -494,7 +493,7 @@ public final class SchematizedMicroBenchmarkSuite extends MicroBenchmarkSuiteBas } } }, (ref BenchmarkContext _, byte[] tableValue) -> tableValue.length, expectedSerialized); - ignoredContext = tempRef_ignoredContext.argValue; + ignoredContext = tempRef_ignoredContext.get(); } private static void JsonWriteBenchmark(String dataSetName, int innerLoopIterations, ArrayList tempRef_ignoredContext = new tangible.RefObject(ignoredContext); + RefObject tempRef_ignoredContext = new RefObject(ignoredContext); // TODO: C# TO JAVA CONVERTER: The following lambda contained an unresolved 'ref' keyword - // these are not converted by C# to Java Converter: MicroBenchmarkSuiteBase.Benchmark("Schematized", "Write", dataSetName, "JSON", @@ -518,7 +517,7 @@ public final class SchematizedMicroBenchmarkSuite extends MicroBenchmarkSuiteBas jsonSerializer.Serialize(jsonWriter, tableValue); jsonWriter.Flush(); }, (ref BenchmarkContext _, HashMap value) -> jsonStream.Length, expected); - ignoredContext = tempRef_ignoredContext.argValue; + ignoredContext = tempRef_ignoredContext.get(); } } } @@ -545,7 +544,7 @@ public final class SchematizedMicroBenchmarkSuite extends MicroBenchmarkSuiteBas expectedSerialized.add((Byte)context.StreamingWriter.ToArray()); } - tangible.RefObject tempRef_context = new tangible.RefObject(context); + RefObject tempRef_context = new RefObject(context); // 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: @@ -558,7 +557,7 @@ public final class SchematizedMicroBenchmarkSuite extends MicroBenchmarkSuiteBas Result r = visitor.DispatchLayout(layout); ResultAssert.IsSuccess(r); }, (ref BenchmarkContext ctx, byte[] tableValue) -> tableValue.length, expectedSerialized); - context = tempRef_context.argValue; + context = tempRef_context.get(); } private static void LayoutWriteBenchmark(LayoutResolverNamespace resolver, String schemaName, String dataSetName, @@ -568,7 +567,7 @@ public final class SchematizedMicroBenchmarkSuite extends MicroBenchmarkSuiteBas BenchmarkContext context = new BenchmarkContext(); context.PatchWriter = new WriteRowGenerator(BenchmarkSuiteBase.InitialCapacity, layout, resolver); - tangible.RefObject tempRef_context = new tangible.RefObject(context); + RefObject tempRef_context = new RefObject(context); // TODO: C# TO JAVA CONVERTER: The following lambda contained an unresolved 'ref' keyword - these are not // converted by C# to Java Converter: MicroBenchmarkSuiteBase.Benchmark("Schematized", "Write", dataSetName, "Layout", innerLoopIterations, @@ -578,7 +577,7 @@ public final class SchematizedMicroBenchmarkSuite extends MicroBenchmarkSuiteBas Result r = ctx.PatchWriter.DispatchLayout(layout, dict); ResultAssert.IsSuccess(r); }, (ref BenchmarkContext ctx, HashMap _) -> ctx.PatchWriter.Length, expected); - context = tempRef_context.argValue; + context = tempRef_context.get(); } private static void StreamingReadBenchmark(LayoutResolverNamespace resolver, String schemaName, String dataSetName, int innerLoopIterations, ArrayList> expected) { @@ -600,19 +599,19 @@ public final class SchematizedMicroBenchmarkSuite extends MicroBenchmarkSuiteBas expectedSerialized.add((Byte)context.StreamingWriter.ToArray()); } - tangible.RefObject tempRef_context = new tangible.RefObject(context); + RefObject tempRef_context = new RefObject(context); // 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: //ORIGINAL LINE: MicroBenchmarkSuiteBase.Benchmark("Schematized", "Read", dataSetName, "HybridRow", innerLoopIterations, ref context, (ref BenchmarkContext ctx, byte[] tableValue) => MicroBenchmarkSuiteBase.Benchmark("Schematized", "Read", dataSetName, "HybridRow", innerLoopIterations, tempRef_context, (ref BenchmarkContext ctx, byte[] tableValue) -> { RowBuffer row = new RowBuffer(tableValue.AsSpan(), HybridRowVersion.V1, resolver); - tangible.RefObject tempRef_row = new tangible.RefObject(row); + RefObject tempRef_row = new RefObject(row); RowReader reader = new RowReader(tempRef_row); - row = tempRef_row.argValue; - Microsoft.Azure.Cosmos.Serialization.HybridRow.Tests.Perf.RowReaderExtensions.VisitReader(reader.clone()); + row = tempRef_row.get(); + RowReaderExtensions.VisitReader(reader.clone()); }, (ref BenchmarkContext ctx, byte[] tableValue) -> tableValue.length, expectedSerialized); - context = tempRef_context.argValue; + context = tempRef_context.get(); } private static void StreamingWriteBenchmark(LayoutResolverNamespace resolver, String schemaName, @@ -623,7 +622,7 @@ public final class SchematizedMicroBenchmarkSuite extends MicroBenchmarkSuiteBas BenchmarkContext context = new BenchmarkContext(); context.StreamingWriter = new StreamingRowGenerator(BenchmarkSuiteBase.InitialCapacity, layout, resolver); - tangible.RefObject tempRef_context = new tangible.RefObject(context); + RefObject tempRef_context = new RefObject(context); // TODO: C# TO JAVA CONVERTER: The following lambda contained an unresolved 'ref' keyword - these are not // converted by C# to Java Converter: MicroBenchmarkSuiteBase.Benchmark("Schematized", "Write", dataSetName, "HybridRow", innerLoopIterations, @@ -634,6 +633,6 @@ public final class SchematizedMicroBenchmarkSuite extends MicroBenchmarkSuiteBas Result r = ctx.StreamingWriter.WriteBuffer(tableValue); ResultAssert.IsSuccess(r); }, (ref BenchmarkContext ctx, HashMap _) -> ctx.StreamingWriter.Length, expected); - context = tempRef_context.argValue; + context = tempRef_context.get(); } } \ No newline at end of file diff --git a/jre/src/test/java/azure/data/cosmos/serialization/hybridrow/perf/TestData.java b/jre/src/test/java/com/azure/data/cosmos/serialization/hybridrow/perf/TestData.java similarity index 91% rename from jre/src/test/java/azure/data/cosmos/serialization/hybridrow/perf/TestData.java rename to jre/src/test/java/com/azure/data/cosmos/serialization/hybridrow/perf/TestData.java index 79ff704..e8920fc 100644 --- a/jre/src/test/java/azure/data/cosmos/serialization/hybridrow/perf/TestData.java +++ b/jre/src/test/java/com/azure/data/cosmos/serialization/hybridrow/perf/TestData.java @@ -2,7 +2,7 @@ // Copyright (c) Microsoft Corporation. All rights reserved. //------------------------------------------------------------ -package azure.data.cosmos.serialization.hybridrow.perf; +package com.azure.data.cosmos.serialization.hybridrow.perf; /** * Names of assets in the TestData folder. diff --git a/jre/src/test/java/azure/data/cosmos/serialization/hybridrow/perf/UnschematizedMicroBenchmarkSuite.java b/jre/src/test/java/com/azure/data/cosmos/serialization/hybridrow/perf/UnschematizedMicroBenchmarkSuite.java similarity index 80% rename from jre/src/test/java/azure/data/cosmos/serialization/hybridrow/perf/UnschematizedMicroBenchmarkSuite.java rename to jre/src/test/java/com/azure/data/cosmos/serialization/hybridrow/perf/UnschematizedMicroBenchmarkSuite.java index 4365fb4..098d2de 100644 --- a/jre/src/test/java/azure/data/cosmos/serialization/hybridrow/perf/UnschematizedMicroBenchmarkSuite.java +++ b/jre/src/test/java/com/azure/data/cosmos/serialization/hybridrow/perf/UnschematizedMicroBenchmarkSuite.java @@ -2,18 +2,17 @@ // Copyright (c) Microsoft Corporation. All rights reserved. //------------------------------------------------------------ -package azure.data.cosmos.serialization.hybridrow.perf; +package com.azure.data.cosmos.serialization.hybridrow.perf; import MongoDB.Bson.IO.*; import Newtonsoft.Json.*; -import azure.data.cosmos.serialization.hybridrow.HybridRowVersion; -import azure.data.cosmos.serialization.hybridrow.Result; -import azure.data.cosmos.serialization.hybridrow.RowBuffer; +import com.azure.data.cosmos.core.RefObject; +import com.azure.data.cosmos.serialization.hybridrow.HybridRowVersion; +import com.azure.data.cosmos.serialization.hybridrow.Result; +import com.azure.data.cosmos.serialization.hybridrow.RowBuffer; import java.util.ArrayList; -import java.util.Dictionary; import java.util.HashMap; -import java.util.List; /** * Tests involving fully (or mostly) unschematized test data. @@ -155,7 +154,7 @@ public final class UnschematizedMicroBenchmarkSuite extends MicroBenchmarkSuiteB //C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java: //ORIGINAL LINE: List expectedSerialized = new List(expected.Count); ArrayList expectedSerialized = new ArrayList(expected.size()); - try (BsonJsonModelRowGenerator writer = new BsonJsonModelRowGenerator(BenchmarkSuiteBase.InitialCapacity)) { + try (BsonJsonModelRowGenerator writer = new BsonJsonModelRowGenerator(InitialCapacity)) { for (HashMap tableValue : expected) { writer.Reset(); writer.WriteBuffer(tableValue); @@ -166,11 +165,11 @@ public final class UnschematizedMicroBenchmarkSuite extends MicroBenchmarkSuiteB } BenchmarkContext ignoredContext = null; - tangible.RefObject tempRef_ignoredContext = new tangible.RefObject(ignoredContext); + RefObject tempRef_ignoredContext = new RefObject(ignoredContext); // 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: //ORIGINAL LINE: MicroBenchmarkSuiteBase.Benchmark("Unschematized", "Read", dataSetName, "BSON", innerLoopIterations, ref ignoredContext, (ref BenchmarkContext _, byte[] tableValue) => - MicroBenchmarkSuiteBase.Benchmark("Unschematized", "Read", dataSetName, "BSON", innerLoopIterations, tempRef_ignoredContext, (ref BenchmarkContext _, byte[] tableValue) -> + Benchmark("Unschematized", "Read", dataSetName, "BSON", innerLoopIterations, tempRef_ignoredContext, (ref BenchmarkContext _, byte[] tableValue) -> { try (MemoryStream stm = new MemoryStream(tableValue)) { try (BsonBinaryReader bsonReader = new BsonBinaryReader(stm)) { @@ -178,24 +177,24 @@ public final class UnschematizedMicroBenchmarkSuite extends MicroBenchmarkSuiteB } } }, (ref BenchmarkContext _, byte[] tableValue) -> tableValue.length, expectedSerialized); - ignoredContext = tempRef_ignoredContext.argValue; + ignoredContext = tempRef_ignoredContext.get(); } private static void BsonWriteBenchmark(String dataSetName, int innerLoopIterations, ArrayList> expected) { - try (BsonJsonModelRowGenerator writer = new BsonJsonModelRowGenerator(BenchmarkSuiteBase.InitialCapacity)) { + try (BsonJsonModelRowGenerator writer = new BsonJsonModelRowGenerator(InitialCapacity)) { BenchmarkContext ignoredContext = null; - tangible.RefObject tempRef_ignoredContext = new tangible.RefObject(ignoredContext); + RefObject tempRef_ignoredContext = new RefObject(ignoredContext); // TODO: C# TO JAVA CONVERTER: The following lambda contained an unresolved 'ref' keyword - these are // not converted by C# to Java Converter: - MicroBenchmarkSuiteBase.Benchmark("Unschematized", "Write", dataSetName, "BSON", innerLoopIterations, + Benchmark("Unschematized", "Write", dataSetName, "BSON", innerLoopIterations, tempRef_ignoredContext, (ref BenchmarkContext _, HashMap tableValue) -> { writer.Reset(); writer.WriteBuffer(tableValue); }, (ref BenchmarkContext _, HashMap tableValue) -> writer.getLength(), expected); - ignoredContext = tempRef_ignoredContext.argValue; + ignoredContext = tempRef_ignoredContext.get(); } } @@ -209,7 +208,7 @@ public final class UnschematizedMicroBenchmarkSuite extends MicroBenchmarkSuiteB Layout layout = resolver.Resolve(tangible.ListHelper.find(resolver.getNamespace().getSchemas(), x = schemaName.equals( > x.Name)).SchemaId) BenchmarkContext context = new BenchmarkContext(); - context.JsonModelWriter = new JsonModelRowGenerator(BenchmarkSuiteBase.InitialCapacity, layout, resolver); + context.JsonModelWriter = new JsonModelRowGenerator(InitialCapacity, layout, resolver); for (HashMap tableValue : expected) { context.JsonModelWriter.Reset(); @@ -221,23 +220,23 @@ public final class UnschematizedMicroBenchmarkSuite extends MicroBenchmarkSuiteB expectedSerialized.add(context.JsonModelWriter.ToArray()); } - tangible.RefObject tempRef_context = new tangible.RefObject(context); + RefObject tempRef_context = new RefObject(context); // 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: //ORIGINAL LINE: MicroBenchmarkSuiteBase.Benchmark("Unschematized", "Read", dataSetName, "HybridRowSparse", // innerLoopIterations, ref context, (ref BenchmarkContext ctx, byte[] tableValue) => - MicroBenchmarkSuiteBase.Benchmark("Unschematized", "Read", dataSetName, "HybridRowSparse", + Benchmark("Unschematized", "Read", dataSetName, "HybridRowSparse", innerLoopIterations, tempRef_context, (ref BenchmarkContext ctx, byte[] tableValue) -> { RowBuffer row = new RowBuffer(tableValue.AsSpan(), HybridRowVersion.V1, resolver); - tangible.RefObject tempRef_row = - new tangible.RefObject(row); + RefObject tempRef_row = + new RefObject(row); RowReader reader = new RowReader(tempRef_row); - row = tempRef_row.argValue; - Microsoft.Azure.Cosmos.Serialization.HybridRow.Tests.Perf.RowReaderExtensions.VisitReader(reader.clone()); + row = tempRef_row.get(); + RowReaderExtensions.VisitReader(reader.clone()); }, (ref BenchmarkContext ctx, byte[] tableValue) -> tableValue.length, expectedSerialized); - context = tempRef_context.argValue; + context = tempRef_context.get(); } private static void JsonModelWriteBenchmark(LayoutResolverNamespace resolver, String schemaName, @@ -246,12 +245,12 @@ public final class UnschematizedMicroBenchmarkSuite extends MicroBenchmarkSuiteB Layout layout = resolver.Resolve(tangible.ListHelper.find(resolver.getNamespace().getSchemas(), x = schemaName.equals( > x.Name)).SchemaId) BenchmarkContext context = new BenchmarkContext(); - context.JsonModelWriter = new JsonModelRowGenerator(BenchmarkSuiteBase.InitialCapacity, layout, resolver); + context.JsonModelWriter = new JsonModelRowGenerator(InitialCapacity, layout, resolver); - tangible.RefObject tempRef_context = new tangible.RefObject(context); + RefObject tempRef_context = new RefObject(context); // TODO: C# TO JAVA CONVERTER: The following lambda contained an unresolved 'ref' keyword - these are not // converted by C# to Java Converter: - MicroBenchmarkSuiteBase.Benchmark("Unschematized", "Write", dataSetName, "HybridRowSparse", + Benchmark("Unschematized", "Write", dataSetName, "HybridRowSparse", innerLoopIterations, tempRef_context, (ref BenchmarkContext ctx, HashMap tableValue) -> { ctx.JsonModelWriter.Reset(); @@ -259,7 +258,7 @@ public final class UnschematizedMicroBenchmarkSuite extends MicroBenchmarkSuiteB Result r = ctx.JsonModelWriter.WriteBuffer(tableValue); ResultAssert.IsSuccess(r); }, (ref BenchmarkContext ctx, HashMap tableValue) -> ctx.JsonModelWriter.Length, expected); - context = tempRef_context.argValue; + context = tempRef_context.get(); } private static void JsonReadBenchmark(String dataSetName, int innerLoopIterations, ArrayList expectedSerialized = new ArrayList(expected.size()); Encoding utf8Encoding = new UTF8Encoding(); JsonSerializer jsonSerializer = JsonSerializer.Create(UnschematizedMicroBenchmarkSuite.JsonSettings); - try (MemoryStream jsonStream = new MemoryStream(BenchmarkSuiteBase.InitialCapacity)) { + try (MemoryStream jsonStream = new MemoryStream(InitialCapacity)) { try (OutputStreamWriter textWriter = new OutputStreamWriter(jsonStream)) { try (JsonTextWriter jsonWriter = new JsonTextWriter(textWriter)) { jsonSerializer.Converters.Add(new Utf8StringJsonConverter()); @@ -290,13 +289,13 @@ public final class UnschematizedMicroBenchmarkSuite extends MicroBenchmarkSuiteB BenchmarkContext ignoredContext = null; jsonSerializer.Converters.Add(new Utf8StringJsonConverter()); - tangible.RefObject tempRef_ignoredContext = new tangible.RefObject(ignoredContext); + RefObject tempRef_ignoredContext = new RefObject(ignoredContext); // 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: //ORIGINAL LINE: MicroBenchmarkSuiteBase.Benchmark("Unschematized", "Read", dataSetName, "JSON", // innerLoopIterations, ref ignoredContext, (ref BenchmarkContext _, byte[] tableValue) => - MicroBenchmarkSuiteBase.Benchmark("Unschematized", "Read", dataSetName, "JSON", innerLoopIterations, + Benchmark("Unschematized", "Read", dataSetName, "JSON", innerLoopIterations, tempRef_ignoredContext, (ref BenchmarkContext _, byte[] tableValue) -> { try (MemoryStream jsonStream = new MemoryStream(tableValue)) { @@ -309,23 +308,23 @@ public final class UnschematizedMicroBenchmarkSuite extends MicroBenchmarkSuiteB } } }, (ref BenchmarkContext _, byte[] tableValue) -> tableValue.length, expectedSerialized); - ignoredContext = tempRef_ignoredContext.argValue; + ignoredContext = tempRef_ignoredContext.get(); } private static void JsonWriteBenchmark(String dataSetName, int innerLoopIterations, ArrayList> expected) { Encoding utf8Encoding = new UTF8Encoding(); JsonSerializer jsonSerializer = JsonSerializer.Create(UnschematizedMicroBenchmarkSuite.JsonSettings); - try (MemoryStream jsonStream = new MemoryStream(BenchmarkSuiteBase.InitialCapacity)) { + try (MemoryStream jsonStream = new MemoryStream(InitialCapacity)) { try (OutputStreamWriter textWriter = new OutputStreamWriter(jsonStream)) { try (JsonTextWriter jsonWriter = new JsonTextWriter(textWriter)) { BenchmarkContext ignoredContext = null; jsonSerializer.Converters.Add(new Utf8StringJsonConverter()); - tangible.RefObject tempRef_ignoredContext = new tangible.RefObject(ignoredContext); + RefObject tempRef_ignoredContext = new RefObject(ignoredContext); // TODO: C# TO JAVA CONVERTER: The following lambda contained an unresolved 'ref' keyword - // these are not converted by C# to Java Converter: - MicroBenchmarkSuiteBase.Benchmark("Unschematized", "Write", dataSetName, "JSON", + Benchmark("Unschematized", "Write", dataSetName, "JSON", innerLoopIterations, tempRef_ignoredContext, (ref BenchmarkContext _, HashMap tableValue) -> { @@ -333,7 +332,7 @@ public final class UnschematizedMicroBenchmarkSuite extends MicroBenchmarkSuiteB jsonSerializer.Serialize(jsonWriter, tableValue); jsonWriter.Flush(); }, (ref BenchmarkContext _, HashMap value) -> jsonStream.Length, expected); - ignoredContext = tempRef_ignoredContext.argValue; + ignoredContext = tempRef_ignoredContext.get(); } } } diff --git a/jre/src/test/java/azure/data/cosmos/serialization/hybridrow/unit/ArrayAssert.java b/jre/src/test/java/com/azure/data/cosmos/serialization/hybridrow/unit/ArrayAssert.java similarity index 93% rename from jre/src/test/java/azure/data/cosmos/serialization/hybridrow/unit/ArrayAssert.java rename to jre/src/test/java/com/azure/data/cosmos/serialization/hybridrow/unit/ArrayAssert.java index d20711e..782a27a 100644 --- a/jre/src/test/java/azure/data/cosmos/serialization/hybridrow/unit/ArrayAssert.java +++ b/jre/src/test/java/com/azure/data/cosmos/serialization/hybridrow/unit/ArrayAssert.java @@ -2,7 +2,7 @@ // Copyright (c) Microsoft Corporation. All rights reserved. //------------------------------------------------------------ -package azure.data.cosmos.serialization.hybridrow.unit; +package com.azure.data.cosmos.serialization.hybridrow.unit; public final class ArrayAssert { public static void AreEqual(T[] expected, T[] actual) { diff --git a/jre/src/test/java/azure/data/cosmos/serialization/hybridrow/unit/AssertThrowsException.java b/jre/src/test/java/com/azure/data/cosmos/serialization/hybridrow/unit/AssertThrowsException.java similarity index 97% rename from jre/src/test/java/azure/data/cosmos/serialization/hybridrow/unit/AssertThrowsException.java rename to jre/src/test/java/com/azure/data/cosmos/serialization/hybridrow/unit/AssertThrowsException.java index 536f687..5256005 100644 --- a/jre/src/test/java/azure/data/cosmos/serialization/hybridrow/unit/AssertThrowsException.java +++ b/jre/src/test/java/com/azure/data/cosmos/serialization/hybridrow/unit/AssertThrowsException.java @@ -2,7 +2,7 @@ // Copyright (c) Microsoft Corporation. All rights reserved. //------------------------------------------------------------ -package azure.data.cosmos.serialization.hybridrow.unit; +package com.azure.data.cosmos.serialization.hybridrow.unit; public final class AssertThrowsException { /** diff --git a/jre/src/test/java/azure/data/cosmos/serialization/hybridrow/unit/CrossVersioningUnitTests.java b/jre/src/test/java/com/azure/data/cosmos/serialization/hybridrow/unit/CrossVersioningUnitTests.java similarity index 96% rename from jre/src/test/java/azure/data/cosmos/serialization/hybridrow/unit/CrossVersioningUnitTests.java rename to jre/src/test/java/com/azure/data/cosmos/serialization/hybridrow/unit/CrossVersioningUnitTests.java index 6d4adcd..5525df0 100644 --- a/jre/src/test/java/azure/data/cosmos/serialization/hybridrow/unit/CrossVersioningUnitTests.java +++ b/jre/src/test/java/com/azure/data/cosmos/serialization/hybridrow/unit/CrossVersioningUnitTests.java @@ -2,13 +2,14 @@ // Copyright (c) Microsoft Corporation. All rights reserved. //------------------------------------------------------------ -package azure.data.cosmos.serialization.hybridrow.unit; +package com.azure.data.cosmos.serialization.hybridrow.unit; import Newtonsoft.Json.*; -import azure.data.cosmos.serialization.hybridrow.Float128; -import azure.data.cosmos.serialization.hybridrow.NullValue; -import azure.data.cosmos.serialization.hybridrow.RowCursor; -import azure.data.cosmos.serialization.hybridrow.UnixDateTime; +import com.azure.data.cosmos.core.RefObject; +import com.azure.data.cosmos.serialization.hybridrow.Float128; +import com.azure.data.cosmos.serialization.hybridrow.NullValue; +import com.azure.data.cosmos.serialization.hybridrow.RowCursor; +import com.azure.data.cosmos.serialization.hybridrow.UnixDateTime; import java.nio.file.Files; import java.time.LocalDateTime; @@ -577,9 +578,9 @@ public final class CrossVersioningUnitTests { this.Y = y; } - public void Dispatch(tangible.RefObject dispatcher, tangible.RefObject scope) { - dispatcher.argValue.LayoutCodeSwitch(scope, "x", value:this.X) - dispatcher.argValue.LayoutCodeSwitch(scope, "y", value:this.Y) + public void Dispatch(RefObject dispatcher, RefObject scope) { + dispatcher.get().LayoutCodeSwitch(scope, "x", value:this.X) + dispatcher.get().LayoutCodeSwitch(scope, "y", value:this.Y) } @Override diff --git a/jre/src/test/java/azure/data/cosmos/serialization/hybridrow/unit/CustomerExampleUnitTests.java b/jre/src/test/java/com/azure/data/cosmos/serialization/hybridrow/unit/CustomerExampleUnitTests.java similarity index 66% rename from jre/src/test/java/azure/data/cosmos/serialization/hybridrow/unit/CustomerExampleUnitTests.java rename to jre/src/test/java/com/azure/data/cosmos/serialization/hybridrow/unit/CustomerExampleUnitTests.java index 8583371..42ec77f 100644 --- a/jre/src/test/java/azure/data/cosmos/serialization/hybridrow/unit/CustomerExampleUnitTests.java +++ b/jre/src/test/java/com/azure/data/cosmos/serialization/hybridrow/unit/CustomerExampleUnitTests.java @@ -2,12 +2,15 @@ // Copyright (c) Microsoft Corporation. All rights reserved. //------------------------------------------------------------ -package azure.data.cosmos.serialization.hybridrow.unit; +package com.azure.data.cosmos.serialization.hybridrow.unit; -import azure.data.cosmos.serialization.hybridrow.HybridRowVersion; -import azure.data.cosmos.serialization.hybridrow.Result; -import azure.data.cosmos.serialization.hybridrow.RowBuffer; -import azure.data.cosmos.serialization.hybridrow.RowCursor; +import com.azure.data.cosmos.core.OutObject; +import com.azure.data.cosmos.core.RefObject; +import com.azure.data.cosmos.serialization.hybridrow.HybridRowVersion; +import com.azure.data.cosmos.serialization.hybridrow.Result; +import com.azure.data.cosmos.serialization.hybridrow.RowBuffer; +import com.azure.data.cosmos.serialization.hybridrow.RowCursor; +import com.azure.data.cosmos.serialization.hybridrow.RowCursorExtensions; import java.nio.file.Files; import java.util.ArrayList; @@ -64,115 +67,115 @@ public final class CustomerExampleUnitTests { tempVar.setPostalCode(tempVar2); g1.Addresses = new HashMap(Map.ofEntries(Map.entry("home", tempVar))); - tangible.RefObject tempRef_row = - new tangible.RefObject(row); + RefObject tempRef_row = + new RefObject(row); RowCursor rc1 = RowCursor.Create(tempRef_row); - row = tempRef_row.argValue; - tangible.RefObject tempRef_row2 = - new tangible.RefObject(row); - tangible.RefObject tempRef_rc1 = - new tangible.RefObject(rc1); + row = tempRef_row.get(); + RefObject tempRef_row2 = + new RefObject(row); + RefObject tempRef_rc1 = + new RefObject(rc1); this.WriteGuest(tempRef_row2, tempRef_rc1, g1); - rc1 = tempRef_rc1.argValue; - row = tempRef_row2.argValue; - tangible.RefObject tempRef_row3 = - new tangible.RefObject(row); + rc1 = tempRef_rc1.get(); + row = tempRef_row2.get(); + RefObject tempRef_row3 = + new RefObject(row); RowCursor rc2 = RowCursor.Create(tempRef_row3); - row = tempRef_row3.argValue; - tangible.RefObject tempRef_row4 = - new tangible.RefObject(row); - tangible.RefObject tempRef_rc2 = - new tangible.RefObject(rc2); + row = tempRef_row3.get(); + RefObject tempRef_row4 = + new RefObject(row); + RefObject tempRef_rc2 = + new RefObject(rc2); Guest g2 = this.ReadGuest(tempRef_row4, tempRef_rc2); - rc2 = tempRef_rc2.argValue; - row = tempRef_row4.argValue; + rc2 = tempRef_rc2.get(); + row = tempRef_row4.get(); assert g1 == g2; // Append an item to an existing list. - tangible.RefObject tempRef_row5 = - new tangible.RefObject(row); + RefObject tempRef_row5 = + new RefObject(row); RowCursor rc3 = RowCursor.Create(tempRef_row5); - row = tempRef_row5.argValue; - tangible.RefObject tempRef_row6 = - new tangible.RefObject(row); - tangible.RefObject tempRef_rc3 = - new tangible.RefObject(rc3); + row = tempRef_row5.get(); + RefObject tempRef_row6 = + new RefObject(row); + RefObject tempRef_rc3 = + new RefObject(rc3); int index = this.AppendGuestEmail(tempRef_row6, tempRef_rc3, "vice_president@whitehouse.gov"); - rc3 = tempRef_rc3.argValue; - row = tempRef_row6.argValue; + rc3 = tempRef_rc3.get(); + row = tempRef_row6.get(); assert 1 == index; g1.Emails.add("vice_president@whitehouse.gov"); - tangible.RefObject tempRef_row7 = - new tangible.RefObject(row); + RefObject tempRef_row7 = + new RefObject(row); RowCursor rc4 = RowCursor.Create(tempRef_row7); - row = tempRef_row7.argValue; - tangible.RefObject tempRef_row8 = - new tangible.RefObject(row); - tangible.RefObject tempRef_rc4 = - new tangible.RefObject(rc4); + row = tempRef_row7.get(); + RefObject tempRef_row8 = + new RefObject(row); + RefObject tempRef_rc4 = + new RefObject(rc4); g2 = this.ReadGuest(tempRef_row8, tempRef_rc4); - rc4 = tempRef_rc4.argValue; - row = tempRef_row8.argValue; + rc4 = tempRef_rc4.get(); + row = tempRef_row8.get(); assert g1 == g2; // Prepend an item to an existing list. - tangible.RefObject tempRef_row9 = - new tangible.RefObject(row); + RefObject tempRef_row9 = + new RefObject(row); RowCursor rc5 = RowCursor.Create(tempRef_row9); - row = tempRef_row9.argValue; - tangible.RefObject tempRef_row10 = - new tangible.RefObject(row); - tangible.RefObject tempRef_rc5 = - new tangible.RefObject(rc5); + row = tempRef_row9.get(); + RefObject tempRef_row10 = + new RefObject(row); + RefObject tempRef_rc5 = + new RefObject(rc5); index = this.PrependGuestEmail(tempRef_row10, tempRef_rc5, "ex_president@whitehouse.gov"); - rc5 = tempRef_rc5.argValue; - row = tempRef_row10.argValue; + rc5 = tempRef_rc5.get(); + row = tempRef_row10.get(); assert 0 == index; g1.Emails = new TreeSet { "ex_president@whitehouse.gov", "president@whitehouse.gov", "vice_president@whitehouse.gov" } - tangible.RefObject tempRef_row11 = - new tangible.RefObject(row); + RefObject tempRef_row11 = + new RefObject(row); RowCursor rc6 = RowCursor.Create(tempRef_row11); - row = tempRef_row11.argValue; - tangible.RefObject tempRef_row12 = - new tangible.RefObject(row); - tangible.RefObject tempRef_rc6 = - new tangible.RefObject(rc6); + row = tempRef_row11.get(); + RefObject tempRef_row12 = + new RefObject(row); + RefObject tempRef_rc6 = + new RefObject(rc6); g2 = this.ReadGuest(tempRef_row12, tempRef_rc6); - rc6 = tempRef_rc6.argValue; - row = tempRef_row12.argValue; + rc6 = tempRef_rc6.get(); + row = tempRef_row12.get(); assert g1 == g2; // InsertAt an item to an existing list. - tangible.RefObject tempRef_row13 = - new tangible.RefObject(row); + RefObject tempRef_row13 = + new RefObject(row); RowCursor rc7 = RowCursor.Create(tempRef_row13); - row = tempRef_row13.argValue; - tangible.RefObject tempRef_row14 = - new tangible.RefObject(row); - tangible.RefObject tempRef_rc7 = - new tangible.RefObject(rc7); + row = tempRef_row13.get(); + RefObject tempRef_row14 = + new RefObject(row); + RefObject tempRef_rc7 = + new RefObject(rc7); index = this.InsertAtGuestEmail(tempRef_row14, tempRef_rc7, 1, "future_president@whitehouse.gov"); - rc7 = tempRef_rc7.argValue; - row = tempRef_row14.argValue; + rc7 = tempRef_rc7.get(); + row = tempRef_row14.get(); assert 1 == index; g1.Emails = new TreeSet { "ex_president@whitehouse.gov", "future_president@whitehouse.gov", "president@whitehouse.gov", "vice_president@whitehouse.gov" } - tangible.RefObject tempRef_row15 = - new tangible.RefObject(row); + RefObject tempRef_row15 = + new RefObject(row); RowCursor rc8 = RowCursor.Create(tempRef_row15); - row = tempRef_row15.argValue; - tangible.RefObject tempRef_row16 = - new tangible.RefObject(row); - tangible.RefObject tempRef_rc8 = - new tangible.RefObject(rc8); + row = tempRef_row15.get(); + RefObject tempRef_row16 = + new RefObject(row); + RefObject tempRef_rc8 = + new RefObject(rc8); g2 = this.ReadGuest(tempRef_row16, tempRef_rc8); - rc8 = tempRef_rc8.argValue; - row = tempRef_row16.argValue; + rc8 = tempRef_rc8.get(); + row = tempRef_row16.get(); assert g1 == g2; } @@ -183,29 +186,29 @@ public final class CustomerExampleUnitTests { row.InitLayout(HybridRowVersion.V1, this.hotelLayout, this.customerResolver); Hotel h1 = this.hotelExample; - tangible.RefObject tempRef_row = - new tangible.RefObject(row); + RefObject tempRef_row = + new RefObject(row); RowCursor root = RowCursor.Create(tempRef_row); - row = tempRef_row.argValue; - tangible.RefObject tempRef_row2 = - new tangible.RefObject(row); - tangible.RefObject tempRef_root = - new tangible.RefObject(root); + row = tempRef_row.get(); + RefObject tempRef_row2 = + new RefObject(row); + RefObject tempRef_root = + new RefObject(root); this.WriteHotel(tempRef_row2, tempRef_root, h1); - root = tempRef_root.argValue; - row = tempRef_row2.argValue; + root = tempRef_root.get(); + row = tempRef_row2.get(); - tangible.RefObject tempRef_row3 = - new tangible.RefObject(row); + RefObject tempRef_row3 = + new RefObject(row); root = RowCursor.Create(tempRef_row3); - row = tempRef_row3.argValue; - tangible.RefObject tempRef_row4 = - new tangible.RefObject(row); - tangible.RefObject tempRef_root2 = - new tangible.RefObject(root); + row = tempRef_row3.get(); + RefObject tempRef_row4 = + new RefObject(row); + RefObject tempRef_root2 = + new RefObject(root); Hotel h2 = this.ReadHotel(tempRef_row4, tempRef_root2); - root = tempRef_root2.argValue; - row = tempRef_row4.argValue; + root = tempRef_root2.get(); + row = tempRef_row4.get(); assert h1 == h2; } @@ -217,31 +220,31 @@ public final class CustomerExampleUnitTests { row.InitLayout(HybridRowVersion.V1, this.hotelLayout, this.customerResolver); Hotel h1 = this.hotelExample; - tangible.RefObject tempRef_row = - new tangible.RefObject(row); + RefObject tempRef_row = + new RefObject(row); RowCursor root = RowCursor.Create(tempRef_row); - row = tempRef_row.argValue; - tangible.RefObject tempRef_row2 = - new tangible.RefObject(row); - tangible.RefObject tempRef_root = - new tangible.RefObject(root); + row = tempRef_row.get(); + RefObject tempRef_row2 = + new RefObject(row); + RefObject tempRef_root = + new RefObject(root); this.WriteHotel(tempRef_row2, tempRef_root, h1); - root = tempRef_root.argValue; - row = tempRef_row2.argValue; + root = tempRef_root.get(); + row = tempRef_row2.get(); - tangible.RefObject tempRef_row3 = - new tangible.RefObject(row); + RefObject tempRef_row3 = + new RefObject(row); root = RowCursor.Create(tempRef_row3); - row = tempRef_row3.argValue; + row = tempRef_row3.get(); Address tempVar = new Address(); tempVar.setStreet("300B Brownie Way"); - tangible.RefObject tempRef_row4 = - new tangible.RefObject(row); - tangible.RefObject tempRef_root2 = - new tangible.RefObject(root); + RefObject tempRef_row4 = + new RefObject(row); + RefObject tempRef_root2 = + new RefObject(root); ResultAssert.InsufficientPermissions(this.PartialUpdateHotelAddress(tempRef_row4, tempRef_root2, tempVar)); - root = tempRef_root2.argValue; - row = tempRef_row4.argValue; + root = tempRef_root2.get(); + row = tempRef_row4.get(); } // TODO: C# TO JAVA CONVERTER: Java annotations will not correspond to .NET attributes: @@ -256,12 +259,12 @@ public final class CustomerExampleUnitTests { x -> x.Name.equals("Guests")).SchemaId); } - private int AppendGuestEmail(tangible.RefObject row, tangible.RefObject root, String email) { + private int AppendGuestEmail(RefObject row, RefObject root, String email) { LayoutColumn c; // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'out' keyword - these // cannot be converted using the 'OutObject' helper class unless the method is within the code being modified: assert this.guestLayout.TryFind("emails", out c); - root.argValue.Find(row, c.Path); + root.get().Find(row, c.Path); RowCursor emailScope; // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'out' keyword - these // cannot be converted using the 'OutObject' helper class unless the method is within the code being modified: @@ -273,13 +276,13 @@ public final class CustomerExampleUnitTests { return emailScope.Index; } - private int InsertAtGuestEmail(tangible.RefObject row, tangible.RefObject root, int i, + private int InsertAtGuestEmail(RefObject row, RefObject root, int i, String email) { LayoutColumn c; // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'out' keyword - these // cannot be converted using the 'OutObject' helper class unless the method is within the code being modified: assert this.guestLayout.TryFind("emails", out c); - root.argValue.Find(row, c.Path); + root.get().Find(row, c.Path); RowCursor emailScope; // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'out' keyword - these // cannot be converted using the 'OutObject' helper class unless the method is within the code being modified: @@ -292,13 +295,13 @@ public final class CustomerExampleUnitTests { return emailScope.Index; } - private Result PartialUpdateHotelAddress(tangible.RefObject row, tangible.RefObject root, + private Result PartialUpdateHotelAddress(RefObject row, RefObject root, Address a) { LayoutColumn c; // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'out' keyword - these // cannot be converted using the 'OutObject' helper class unless the method is within the code being modified: assert this.hotelLayout.TryFind("address", out c); - root.argValue.Find(row, c.Path); + root.get().Find(row, c.Path); RowCursor addressScope; // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'out' keyword - these // cannot be converted using the 'OutObject' helper class unless the method is within the code being modified: @@ -368,21 +371,21 @@ public final class CustomerExampleUnitTests { return r; } - tangible.RefObject tempRef_postalCodeScope = - new tangible.RefObject(postalCodeScope); + RefObject tempRef_postalCodeScope = + new RefObject(postalCodeScope); this.WritePostalCode(row, tempRef_postalCodeScope, c.TypeArgs, a.PostalCode); - postalCodeScope = tempRef_postalCodeScope.argValue; + postalCodeScope = tempRef_postalCodeScope.get(); } return Result.Success; } - private int PrependGuestEmail(tangible.RefObject row, tangible.RefObject root, String email) { + private int PrependGuestEmail(RefObject row, RefObject root, String email) { LayoutColumn c; // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'out' keyword - these // cannot be converted using the 'OutObject' helper class unless the method is within the code being modified: assert this.guestLayout.TryFind("emails", out c); - root.argValue.Find(row, c.Path); + root.get().Find(row, c.Path); RowCursor emailScope; // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'out' keyword - these // cannot be converted using the 'OutObject' helper class unless the method is within the code being modified: @@ -394,82 +397,82 @@ public final class CustomerExampleUnitTests { return emailScope.Index; } - private static Address ReadAddress(tangible.RefObject row, tangible.RefObject addressScope) { + private static Address ReadAddress(RefObject row, RefObject addressScope) { Address a = new Address(); - Layout addressLayout = addressScope.argValue.getLayout(); + Layout addressLayout = addressScope.get().getLayout(); LayoutColumn c; // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'out' keyword - these // cannot be converted using the 'OutObject' helper class unless the method is within the code being modified: assert addressLayout.TryFind("street", out c); - tangible.OutObject tempOut_Street = new tangible.OutObject(); + OutObject tempOut_Street = new OutObject(); ResultAssert.IsSuccess(c.TypeAs().ReadVariable(row, addressScope, c, tempOut_Street)); - a.Street = tempOut_Street.argValue; + a.Street = tempOut_Street.get(); // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'out' keyword - these // cannot be converted using the 'OutObject' helper class unless the method is within the code being modified: assert addressLayout.TryFind("city", out c); - tangible.OutObject tempOut_City = new tangible.OutObject(); + OutObject tempOut_City = new OutObject(); ResultAssert.IsSuccess(c.TypeAs().ReadVariable(row, addressScope, c, tempOut_City)); - a.City = tempOut_City.argValue; + a.City = tempOut_City.get(); // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'out' keyword - these // cannot be converted using the 'OutObject' helper class unless the method is within the code being modified: assert addressLayout.TryFind("state", out c); - tangible.OutObject tempOut_State = new tangible.OutObject(); + OutObject tempOut_State = new OutObject(); ResultAssert.IsSuccess(c.TypeAs().ReadFixed(row, addressScope, c, tempOut_State)); - a.State = tempOut_State.argValue; + a.State = tempOut_State.get(); // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'out' keyword - these // cannot be converted using the 'OutObject' helper class unless the method is within the code being modified: assert addressLayout.TryFind("postal_code", out c); - addressScope.argValue.Find(row, c.Path); + addressScope.get().Find(row, c.Path); RowCursor postalCodeScope; // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'out' keyword - these // cannot be converted using the 'OutObject' helper class unless the method is within the code being modified: ResultAssert.IsSuccess(c.TypeAs().ReadScope(row, addressScope, out postalCodeScope)); - tangible.RefObject tempRef_postalCodeScope = - new tangible.RefObject(postalCodeScope); + RefObject tempRef_postalCodeScope = + new RefObject(postalCodeScope); a.PostalCode = CustomerExampleUnitTests.ReadPostalCode(row, tempRef_postalCodeScope); - postalCodeScope = tempRef_postalCodeScope.argValue; - tangible.RefObject tempRef_postalCodeScope2 = - new tangible.RefObject(postalCodeScope); - Microsoft.Azure.Cosmos.Serialization.HybridRow.RowCursorExtensions.Skip(addressScope.argValue.clone(), row, + postalCodeScope = tempRef_postalCodeScope.get(); + RefObject tempRef_postalCodeScope2 = + new RefObject(postalCodeScope); + RowCursorExtensions.Skip(addressScope.get().clone(), row, tempRef_postalCodeScope2); - postalCodeScope = tempRef_postalCodeScope2.argValue; + postalCodeScope = tempRef_postalCodeScope2.get(); return a; } - private Guest ReadGuest(tangible.RefObject row, tangible.RefObject root) { + private Guest ReadGuest(RefObject row, RefObject root) { Guest g = new Guest(); LayoutColumn c; // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'out' keyword - these // cannot be converted using the 'OutObject' helper class unless the method is within the code being modified: assert this.guestLayout.TryFind("guest_id", out c); - tangible.OutObject tempOut_Id = new tangible.OutObject(); + OutObject tempOut_Id = new OutObject(); ResultAssert.IsSuccess(c.TypeAs().ReadFixed(row, root, c, tempOut_Id)); - g.Id = tempOut_Id.argValue; + g.Id = tempOut_Id.get(); // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'out' keyword - these // cannot be converted using the 'OutObject' helper class unless the method is within the code being modified: assert this.guestLayout.TryFind("first_name", out c); - tangible.OutObject tempOut_FirstName = new tangible.OutObject(); + OutObject tempOut_FirstName = new OutObject(); ResultAssert.IsSuccess(c.TypeAs().ReadVariable(row, root, c, tempOut_FirstName)); - g.FirstName = tempOut_FirstName.argValue; + g.FirstName = tempOut_FirstName.get(); // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'out' keyword - these // cannot be converted using the 'OutObject' helper class unless the method is within the code being modified: assert this.guestLayout.TryFind("last_name", out c); - tangible.OutObject tempOut_LastName = new tangible.OutObject(); + OutObject tempOut_LastName = new OutObject(); ResultAssert.IsSuccess(c.TypeAs().ReadVariable(row, root, c, tempOut_LastName)); - g.LastName = tempOut_LastName.argValue; + g.LastName = tempOut_LastName.get(); // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'out' keyword - these // cannot be converted using the 'OutObject' helper class unless the method is within the code being modified: assert this.guestLayout.TryFind("title", out c); - tangible.OutObject tempOut_Title = new tangible.OutObject(); + OutObject tempOut_Title = new OutObject(); ResultAssert.IsSuccess(c.TypeAs().ReadVariable(row, root, c, tempOut_Title)); - g.Title = tempOut_Title.argValue; + g.Title = tempOut_Title.get(); // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'out' keyword - these // cannot be converted using the 'OutObject' helper class unless the method is within the code being modified: assert this.guestLayout.TryFind("confirm_number", out c); - tangible.OutObject tempOut_ConfirmNumber = new tangible.OutObject(); + OutObject tempOut_ConfirmNumber = new OutObject(); ResultAssert.IsSuccess(c.TypeAs().ReadVariable(row, root, c, tempOut_ConfirmNumber)); - g.ConfirmNumber = tempOut_ConfirmNumber.argValue; + g.ConfirmNumber = tempOut_ConfirmNumber.get(); // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'out' keyword - these // cannot be converted using the 'OutObject' helper class unless the method is within the code being modified: @@ -477,7 +480,7 @@ public final class CustomerExampleUnitTests { RowCursor emailScope; // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'out' keyword - these // cannot be converted using the 'OutObject' helper class unless the method is within the code being modified: - root.argValue.Clone(out emailScope).Find(row, c.Path); + root.get().Clone(out emailScope).Find(row, c.Path); // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'out' keyword - these // cannot be converted using the 'OutObject' 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 @@ -504,7 +507,7 @@ public final class CustomerExampleUnitTests { RowCursor phoneNumbersScope; // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'out' keyword - these // cannot be converted using the 'OutObject' helper class unless the method is within the code being modified: - root.argValue.Clone(out phoneNumbersScope).Find(row, c.Path); + root.get().Clone(out phoneNumbersScope).Find(row, c.Path); // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'out' keyword - these // cannot be converted using the 'OutObject' 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 @@ -531,113 +534,113 @@ public final class CustomerExampleUnitTests { RowCursor addressesScope; // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'out' keyword - these // cannot be converted using the 'OutObject' helper class unless the method is within the code being modified: - root.argValue.Clone(out addressesScope).Find(row, c.Path); + root.get().Clone(out addressesScope).Find(row, c.Path); // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'out' keyword - these // cannot be converted using the 'OutObject' 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 cannot be converted using the 'RefObject' helper class unless the method is within the code being modified: if (c.TypeAs().ReadScope(row, ref addressesScope, out addressesScope) == Result.Success) { - tangible.RefObject tempRef_addressesScope = new tangible.RefObject(addressesScope); + RefObject tempRef_addressesScope = new RefObject(addressesScope); TypeArgument tupleType = LayoutType.TypedMap.FieldType(tempRef_addressesScope).clone(); - addressesScope = tempRef_addressesScope.argValue; + addressesScope = tempRef_addressesScope.get(); TypeArgument t0 = tupleType.getTypeArgs().get(0).clone(); TypeArgument t1 = tupleType.getTypeArgs().get(1).clone(); g.Addresses = new HashMap(); RowCursor pairScope = null; - tangible.RefObject tempRef_pairScope = new tangible.RefObject(pairScope); + RefObject tempRef_pairScope = new RefObject(pairScope); while (addressesScope.MoveNext(row, tempRef_pairScope)) { - pairScope = tempRef_pairScope.argValue; - tangible.RefObject tempRef_addressesScope2 = new tangible.RefObject(addressesScope); - tangible.OutObject tempOut_pairScope = new tangible.OutObject(); + pairScope = tempRef_pairScope.get(); + RefObject tempRef_addressesScope2 = new RefObject(addressesScope); + OutObject tempOut_pairScope = new OutObject(); ResultAssert.IsSuccess(tupleType.TypeAs().ReadScope(row, tempRef_addressesScope2, tempOut_pairScope)); - pairScope = tempOut_pairScope.argValue; - addressesScope = tempRef_addressesScope2.argValue; - assert Microsoft.Azure.Cosmos.Serialization.HybridRow.RowCursorExtensions.MoveNext(pairScope.clone(), row); - tangible.RefObject tempRef_pairScope2 = new tangible.RefObject(pairScope); + pairScope = tempOut_pairScope.get(); + addressesScope = tempRef_addressesScope2.get(); + assert RowCursorExtensions.MoveNext(pairScope.clone(), row); + RefObject tempRef_pairScope2 = new RefObject(pairScope); String key; // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'out' keyword - these cannot be converted using the 'OutObject' helper class unless the method is within the code being modified: ResultAssert.IsSuccess(t0.TypeAs().ReadSparse(row, tempRef_pairScope2, out key)); - pairScope = tempRef_pairScope2.argValue; - assert Microsoft.Azure.Cosmos.Serialization.HybridRow.RowCursorExtensions.MoveNext(pairScope.clone(), row); - tangible.RefObject tempRef_pairScope3 = new tangible.RefObject(pairScope); + pairScope = tempRef_pairScope2.get(); + assert RowCursorExtensions.MoveNext(pairScope.clone(), row); + RefObject tempRef_pairScope3 = new RefObject(pairScope); RowCursor addressScope; - tangible.OutObject tempOut_addressScope = new tangible.OutObject(); + OutObject tempOut_addressScope = new OutObject(); ResultAssert.IsSuccess(t1.TypeAs().ReadScope(row, tempRef_pairScope3, tempOut_addressScope)); - addressScope = tempOut_addressScope.argValue; - pairScope = tempRef_pairScope3.argValue; - tangible.RefObject tempRef_addressScope = new tangible.RefObject(addressScope); + addressScope = tempOut_addressScope.get(); + pairScope = tempRef_pairScope3.get(); + RefObject tempRef_addressScope = new RefObject(addressScope); Address value = CustomerExampleUnitTests.ReadAddress(row, tempRef_addressScope); - addressScope = tempRef_addressScope.argValue; + addressScope = tempRef_addressScope.get(); g.Addresses.put(key, value); - tangible.RefObject tempRef_addressScope2 = new tangible.RefObject(addressScope); - assert !Microsoft.Azure.Cosmos.Serialization.HybridRow.RowCursorExtensions.MoveNext(pairScope.clone(), row, tempRef_addressScope2); - addressScope = tempRef_addressScope2.argValue; + RefObject tempRef_addressScope2 = new RefObject(addressScope); + assert !RowCursorExtensions.MoveNext(pairScope.clone(), row, tempRef_addressScope2); + addressScope = tempRef_addressScope2.get(); } - pairScope = tempRef_pairScope.argValue; + pairScope = tempRef_pairScope.get(); } return g; } - private Hotel ReadHotel(tangible.RefObject row, tangible.RefObject root) { + private Hotel ReadHotel(RefObject row, RefObject root) { Hotel h = new Hotel(); LayoutColumn c; // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'out' keyword - these // cannot be converted using the 'OutObject' helper class unless the method is within the code being modified: assert this.hotelLayout.TryFind("hotel_id", out c); - tangible.OutObject tempOut_Id = new tangible.OutObject(); + OutObject tempOut_Id = new OutObject(); ResultAssert.IsSuccess(c.TypeAs().ReadVariable(row, root, c, tempOut_Id)); - h.Id = tempOut_Id.argValue; + h.Id = tempOut_Id.get(); // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'out' keyword - these // cannot be converted using the 'OutObject' helper class unless the method is within the code being modified: assert this.hotelLayout.TryFind("name", out c); - tangible.OutObject tempOut_Name = new tangible.OutObject(); + OutObject tempOut_Name = new OutObject(); ResultAssert.IsSuccess(c.TypeAs().ReadVariable(row, root, c, tempOut_Name)); - h.Name = tempOut_Name.argValue; + h.Name = tempOut_Name.get(); // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'out' keyword - these // cannot be converted using the 'OutObject' helper class unless the method is within the code being modified: assert this.hotelLayout.TryFind("phone", out c); - tangible.OutObject tempOut_Phone = new tangible.OutObject(); + OutObject tempOut_Phone = new OutObject(); ResultAssert.IsSuccess(c.TypeAs().ReadVariable(row, root, c, tempOut_Phone)); - h.Phone = tempOut_Phone.argValue; + h.Phone = tempOut_Phone.get(); // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'out' keyword - these // cannot be converted using the 'OutObject' helper class unless the method is within the code being modified: assert this.hotelLayout.TryFind("address", out c); assert c.Type.Immutable; - root.argValue.Find(row, c.Path); + root.get().Find(row, c.Path); RowCursor addressScope; // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'out' keyword - these // cannot be converted using the 'OutObject' helper class unless the method is within the code being modified: ResultAssert.IsSuccess(c.TypeAs().ReadScope(row, root, out addressScope)); assert addressScope.Immutable; - tangible.RefObject tempRef_addressScope = - new tangible.RefObject(addressScope); + RefObject tempRef_addressScope = + new RefObject(addressScope); h.Address = CustomerExampleUnitTests.ReadAddress(row, tempRef_addressScope); - addressScope = tempRef_addressScope.argValue; - tangible.RefObject tempRef_addressScope2 = - new tangible.RefObject(addressScope); - Microsoft.Azure.Cosmos.Serialization.HybridRow.RowCursorExtensions.Skip(root.argValue.clone(), row, + addressScope = tempRef_addressScope.get(); + RefObject tempRef_addressScope2 = + new RefObject(addressScope); + RowCursorExtensions.Skip(root.get().clone(), row, tempRef_addressScope2); - addressScope = tempRef_addressScope2.argValue; + addressScope = tempRef_addressScope2.get(); return h; } - private static PostalCode ReadPostalCode(tangible.RefObject row, - tangible.RefObject postalCodeScope) { - Layout postalCodeLayout = postalCodeScope.argValue.getLayout(); + private static PostalCode ReadPostalCode(RefObject row, + RefObject postalCodeScope) { + Layout postalCodeLayout = postalCodeScope.get().getLayout(); PostalCode pc = new PostalCode(); LayoutColumn c; // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'out' keyword - these // cannot be converted using the 'OutObject' helper class unless the method is within the code being modified: assert postalCodeLayout.TryFind("zip", out c); - tangible.OutObject tempOut_Zip = new tangible.OutObject(); + OutObject tempOut_Zip = new OutObject(); ResultAssert.IsSuccess(c.TypeAs().ReadFixed(row, postalCodeScope, c, tempOut_Zip)); - pc.Zip = tempOut_Zip.argValue; + pc.Zip = tempOut_Zip.get(); // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'out' keyword - these // cannot be converted using the 'OutObject' helper class unless the method is within the code being modified: assert postalCodeLayout.TryFind("plus4", out c); - postalCodeScope.argValue.Find(row, c.Path); + postalCodeScope.get().Find(row, c.Path); short plus4; // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'out' keyword - these // cannot be converted using the 'OutObject' helper class unless the method is within the code being modified: @@ -648,7 +651,7 @@ public final class CustomerExampleUnitTests { return pc; } - private void WriteAddress(tangible.RefObject row, tangible.RefObject addressScope, + private void WriteAddress(RefObject row, RefObject addressScope, TypeArgumentList typeArgs, Address a) { Layout addressLayout = this.customerResolver.Resolve(typeArgs.getSchemaId().clone()); LayoutColumn c; @@ -668,23 +671,23 @@ public final class CustomerExampleUnitTests { // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'out' keyword - these // cannot be converted using the 'OutObject' helper class unless the method is within the code being modified: assert addressLayout.TryFind("postal_code", out c); - addressScope.argValue.Find(row, c.Path); + addressScope.get().Find(row, c.Path); RowCursor postalCodeScope; // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'out' keyword - these // cannot be converted using the 'OutObject' helper class unless the method is within the code being modified: ResultAssert.IsSuccess(c.TypeAs().WriteScope(row, addressScope, c.TypeArgs, out postalCodeScope)); - tangible.RefObject tempRef_postalCodeScope = - new tangible.RefObject(postalCodeScope); + RefObject tempRef_postalCodeScope = + new RefObject(postalCodeScope); this.WritePostalCode(row, tempRef_postalCodeScope, c.TypeArgs, a.PostalCode); - postalCodeScope = tempRef_postalCodeScope.argValue; - tangible.RefObject tempRef_postalCodeScope2 = - new tangible.RefObject(postalCodeScope); - Microsoft.Azure.Cosmos.Serialization.HybridRow.RowCursorExtensions.Skip(addressScope.argValue.clone(), row, + postalCodeScope = tempRef_postalCodeScope.get(); + RefObject tempRef_postalCodeScope2 = + new RefObject(postalCodeScope); + RowCursorExtensions.Skip(addressScope.get().clone(), row, tempRef_postalCodeScope2); - postalCodeScope = tempRef_postalCodeScope2.argValue; + postalCodeScope = tempRef_postalCodeScope2.get(); } - private void WriteGuest(tangible.RefObject row, tangible.RefObject root, Guest g) { + private void WriteGuest(RefObject row, RefObject root, Guest g) { LayoutColumn c; // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'out' keyword - these // cannot be converted using the 'OutObject' helper class unless the method is within the code being modified: @@ -712,7 +715,7 @@ public final class CustomerExampleUnitTests { // cannot be converted using the 'OutObject' helper class unless the method is within the code being // modified: assert this.guestLayout.TryFind("emails", out c); - root.argValue.Find(row, c.Path); + root.get().Find(row, c.Path); RowCursor emailScope; // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'out' keyword - these // cannot be converted using the 'OutObject' helper class unless the method is within the code being @@ -726,11 +729,11 @@ public final class CustomerExampleUnitTests { assert !emailScope.MoveNext(row); } - tangible.RefObject tempRef_emailScope = - new tangible.RefObject(emailScope); - Microsoft.Azure.Cosmos.Serialization.HybridRow.RowCursorExtensions.Skip(root.argValue.clone(), row, + RefObject tempRef_emailScope = + new RefObject(emailScope); + RowCursorExtensions.Skip(root.get().clone(), row, tempRef_emailScope); - emailScope = tempRef_emailScope.argValue; + emailScope = tempRef_emailScope.get(); } if (g.PhoneNumbers != null) { @@ -738,7 +741,7 @@ public final class CustomerExampleUnitTests { // cannot be converted using the 'OutObject' helper class unless the method is within the code being // modified: assert this.guestLayout.TryFind("phone_numbers", out c); - root.argValue.Find(row, c.Path); + root.get().Find(row, c.Path); RowCursor phoneNumbersScope; // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'out' keyword - these // cannot be converted using the 'OutObject' helper class unless the method is within the code being @@ -754,11 +757,11 @@ public final class CustomerExampleUnitTests { assert !phoneNumbersScope.MoveNext(row); } - tangible.RefObject tempRef_phoneNumbersScope = - new tangible.RefObject(phoneNumbersScope); - Microsoft.Azure.Cosmos.Serialization.HybridRow.RowCursorExtensions.Skip(root.argValue.clone(), row, + RefObject tempRef_phoneNumbersScope = + new RefObject(phoneNumbersScope); + RowCursorExtensions.Skip(root.get().clone(), row, tempRef_phoneNumbersScope); - phoneNumbersScope = tempRef_phoneNumbersScope.argValue; + phoneNumbersScope = tempRef_phoneNumbersScope.get(); } if (g.Addresses != null) { @@ -766,7 +769,7 @@ public final class CustomerExampleUnitTests { // cannot be converted using the 'OutObject' helper class unless the method is within the code being // modified: assert this.guestLayout.TryFind("addresses", out c); - root.argValue.Find(row, c.Path); + root.get().Find(row, c.Path); RowCursor addressesScope; // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'out' keyword - these // cannot be converted using the 'OutObject' helper class unless the method is within the code being @@ -783,7 +786,7 @@ public final class CustomerExampleUnitTests { // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'out' keyword - // these cannot be converted using the 'OutObject' helper class unless the method is within the code // being modified: - root.argValue.Clone(out tempCursor).Find(row, Utf8String.Empty); + root.get().Clone(out tempCursor).Find(row, Utf8String.Empty); RowCursor tupleScope; // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'out' keyword - // these cannot be converted using the 'OutObject' helper class unless the method is within the code @@ -799,19 +802,19 @@ public final class CustomerExampleUnitTests { // being modified: ResultAssert.IsSuccess(t0.TypeAs().WriteSparse(row, ref tupleScope, pair.getKey())); assert tupleScope.MoveNext(row); - tangible.RefObject tempRef_tupleScope = - new tangible.RefObject(tupleScope); + RefObject tempRef_tupleScope = + new RefObject(tupleScope); RowCursor addressScope; - tangible.OutObject tempOut_addressScope = - new tangible.OutObject(); + OutObject tempOut_addressScope = + new OutObject(); ResultAssert.IsSuccess(t1.TypeAs().WriteScope(row, tempRef_tupleScope, t1.getTypeArgs().clone(), tempOut_addressScope)); - addressScope = tempOut_addressScope.argValue; - tupleScope = tempRef_tupleScope.argValue; - tangible.RefObject tempRef_addressScope = - new tangible.RefObject(addressScope); + addressScope = tempOut_addressScope.get(); + tupleScope = tempRef_tupleScope.get(); + RefObject tempRef_addressScope = + new RefObject(addressScope); this.WriteAddress(row, tempRef_addressScope, t1.getTypeArgs().clone(), pair.getValue()); - addressScope = tempRef_addressScope.argValue; + addressScope = tempRef_addressScope.get(); // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'ref' keyword - // these cannot be converted using the 'RefObject' helper class unless the method is within the code // being modified: @@ -823,15 +826,15 @@ public final class CustomerExampleUnitTests { ref tempCursor)); } - tangible.RefObject tempRef_addressesScope = - new tangible.RefObject(addressesScope); - Microsoft.Azure.Cosmos.Serialization.HybridRow.RowCursorExtensions.Skip(root.argValue.clone(), row, + RefObject tempRef_addressesScope = + new RefObject(addressesScope); + RowCursorExtensions.Skip(root.get().clone(), row, tempRef_addressesScope); - addressesScope = tempRef_addressesScope.argValue; + addressesScope = tempRef_addressesScope.get(); } } - private void WriteHotel(tangible.RefObject row, tangible.RefObject root, Hotel h) { + private void WriteHotel(RefObject row, RefObject root, Hotel h) { LayoutColumn c; // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'out' keyword - these // cannot be converted using the 'OutObject' helper class unless the method is within the code being modified: @@ -849,23 +852,23 @@ public final class CustomerExampleUnitTests { // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'out' keyword - these // cannot be converted using the 'OutObject' helper class unless the method is within the code being modified: assert this.hotelLayout.TryFind("address", out c); - root.argValue.Find(row, c.Path); + root.get().Find(row, c.Path); RowCursor addressScope; // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'out' keyword - these // cannot be converted using the 'OutObject' helper class unless the method is within the code being modified: ResultAssert.IsSuccess(c.TypeAs().WriteScope(row, root, c.TypeArgs, out addressScope)); - tangible.RefObject tempRef_addressScope = - new tangible.RefObject(addressScope); + RefObject tempRef_addressScope = + new RefObject(addressScope); this.WriteAddress(row, tempRef_addressScope, c.TypeArgs, h.Address); - addressScope = tempRef_addressScope.argValue; - tangible.RefObject tempRef_addressScope2 = - new tangible.RefObject(addressScope); - Microsoft.Azure.Cosmos.Serialization.HybridRow.RowCursorExtensions.Skip(root.argValue.clone(), row, + addressScope = tempRef_addressScope.get(); + RefObject tempRef_addressScope2 = + new RefObject(addressScope); + RowCursorExtensions.Skip(root.get().clone(), row, tempRef_addressScope2); - addressScope = tempRef_addressScope2.argValue; + addressScope = tempRef_addressScope2.get(); } - private void WritePostalCode(tangible.RefObject row, tangible.RefObject postalCodeScope, + private void WritePostalCode(RefObject row, RefObject postalCodeScope, TypeArgumentList typeArgs, PostalCode pc) { Layout postalCodeLayout = this.customerResolver.Resolve(typeArgs.getSchemaId().clone()); assert postalCodeLayout != null; @@ -879,7 +882,7 @@ public final class CustomerExampleUnitTests { // cannot be converted using the 'OutObject' helper class unless the method is within the code being // modified: assert postalCodeLayout.TryFind("plus4", out c); - postalCodeScope.argValue.Find(row, c.Path); + postalCodeScope.get().Find(row, c.Path); ResultAssert.IsSuccess(c.TypeAs().WriteSparse(row, postalCodeScope, pc.Plus4.Value)); } } diff --git a/jre/src/test/java/com/azure/data/cosmos/serialization/hybridrow/unit/DeleteRowDispatcher.java b/jre/src/test/java/com/azure/data/cosmos/serialization/hybridrow/unit/DeleteRowDispatcher.java new file mode 100644 index 0000000..d078154 --- /dev/null +++ b/jre/src/test/java/com/azure/data/cosmos/serialization/hybridrow/unit/DeleteRowDispatcher.java @@ -0,0 +1,168 @@ +//------------------------------------------------------------ +// Copyright (c) Microsoft Corporation. All rights reserved. +//------------------------------------------------------------ + +package com.azure.data.cosmos.serialization.hybridrow.unit; + +import com.azure.data.cosmos.core.OutObject; +import com.azure.data.cosmos.core.RefObject; +import com.azure.data.cosmos.serialization.hybridrow.RowBuffer; +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.LayoutType; +import com.azure.data.cosmos.serialization.hybridrow.layouts.LayoutTypedSet; +import com.azure.data.cosmos.serialization.hybridrow.layouts.TypeArgumentList; + +import java.util.List; + +//C# TO JAVA CONVERTER WARNING: Java does not allow user-defined value types. The behavior of this class may differ +// from the original: +//ORIGINAL LINE: internal struct DeleteRowDispatcher : IDispatcher +public final class DeleteRowDispatcher implements IDispatcher { + + public , TValue> void Dispatch(RefObject dispatcher, RefObject root, LayoutColumn col, LayoutType t) { + Dispatch(dispatcher, root, col, t, null); + } + + //C# TO JAVA CONVERTER NOTE: Java does not support optional parameters. Overloaded method(s) are created above: + //ORIGINAL LINE: public void Dispatch(ref RowOperationDispatcher dispatcher, ref RowCursor root, + // LayoutColumn col, LayoutType t, TValue value = default) where TLayout : LayoutType + public , TValue> void Dispatch(RefObject dispatcher, RefObject root, LayoutColumn col, LayoutType t, TValue value) { + RefObject tempRef_Row = + new RefObject(dispatcher.get().Row); + ResultAssert.IsSuccess(t.TypeAs().DeleteSparse(tempRef_Row, root)); + dispatcher.get().argValue.Row = tempRef_Row.get(); + } + + public void DispatchArray(RefObject dispatcher, + RefObject scope, LayoutType t, TypeArgumentList typeArgs, + Object value) { + checkArgument(typeArgs.getCount() == 1); + + RefObject tempRef_Row = + new RefObject(dispatcher.get().Row); + RowCursor arrayScope; + OutObject tempOut_arrayScope = + new OutObject(); + ResultAssert.IsSuccess(t.TypeAs().ReadScope(tempRef_Row, scope, tempOut_arrayScope)); + arrayScope = tempOut_arrayScope.get(); + dispatcher.get().argValue.Row = tempRef_Row.get(); + + if (!arrayScope.Immutable) { + List items = (List)value; + for (Object item : items) { + RefObject tempRef_Row2 = + new RefObject(dispatcher.get().Row); + assert arrayScope.MoveNext(tempRef_Row2); + dispatcher.get().argValue.Row = tempRef_Row2.get(); + // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'ref' keyword - + // these cannot be converted using the 'RefObject' helper class unless the method is within the code + // being modified: + dispatcher.get().LayoutCodeSwitch(ref arrayScope, null, typeArgs.get(0).getType(), + typeArgs.get(0).getTypeArgs().clone(), item); + } + } + + RefObject tempRef_Row3 = + new RefObject(dispatcher.get().Row); + ResultAssert.IsSuccess(t.TypeAs().DeleteScope(tempRef_Row3, scope)); + dispatcher.get().argValue.Row = tempRef_Row3.get(); + } + + public void DispatchMap(RefObject dispatcher, + RefObject scope, LayoutType t, TypeArgumentList typeArgs, + Object value) { + checkArgument(typeArgs.getCount() == 2); + + RefObject tempRef_Row = + new RefObject(dispatcher.get().Row); + RowCursor mapScope; + OutObject tempOut_mapScope = + new OutObject(); + ResultAssert.IsSuccess(t.TypeAs().ReadScope(tempRef_Row, scope, tempOut_mapScope)); + mapScope = tempOut_mapScope.get(); + dispatcher.get().argValue.Row = tempRef_Row.get(); + if (!mapScope.Immutable) { + List items = (List)value; + for (Object item : items) { + RefObject tempRef_Row2 = + new RefObject(dispatcher.get().Row); + assert mapScope.MoveNext(tempRef_Row2); + dispatcher.get().argValue.Row = tempRef_Row2.get(); + // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'ref' keyword - + // these cannot be converted using the 'RefObject' helper class unless the method is within the code + // being modified: + dispatcher.get().LayoutCodeSwitch(ref mapScope, null, LayoutType.TypedTuple, typeArgs.clone(), item); + } + } + + RefObject tempRef_Row3 = + new RefObject(dispatcher.get().Row); + ResultAssert.IsSuccess(t.TypeAs().DeleteScope(tempRef_Row3, scope)); + dispatcher.get().argValue.Row = tempRef_Row3.get(); + } + + public void DispatchNullable(RefObject dispatcher, + RefObject scope, LayoutType t, TypeArgumentList typeArgs, + Object value) { + checkArgument(typeArgs.getCount() == 1); + RefObject tempRef_Row = + new RefObject(dispatcher.get().Row); + ResultAssert.IsSuccess(t.TypeAs().DeleteScope(tempRef_Row, scope)); + dispatcher.get().argValue.Row = tempRef_Row.get(); + } + + public void DispatchObject(RefObject dispatcher, + RefObject scope) { + } + + public void DispatchSet(RefObject dispatcher, + RefObject scope, LayoutType t, TypeArgumentList typeArgs, + Object value) { + checkArgument(typeArgs.getCount() == 1); + + RefObject tempRef_Row = + new RefObject(dispatcher.get().Row); + RowCursor setScope; + OutObject tempOut_setScope = + new OutObject(); + ResultAssert.IsSuccess(t.TypeAs().ReadScope(tempRef_Row, scope, tempOut_setScope)); + setScope = tempOut_setScope.get(); + dispatcher.get().argValue.Row = tempRef_Row.get(); + if (!setScope.Immutable) { + List items = (List)value; + for (Object item : items) { + RefObject tempRef_Row2 = + new RefObject(dispatcher.get().Row); + assert setScope.MoveNext(tempRef_Row2); + dispatcher.get().argValue.Row = tempRef_Row2.get(); + // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'ref' keyword - + // these cannot be converted using the 'RefObject' helper class unless the method is within the code + // being modified: + dispatcher.get().LayoutCodeSwitch(ref setScope, null, typeArgs.get(0).getType(), + typeArgs.get(0).getTypeArgs().clone(), item); + } + } + + RefObject tempRef_Row3 = + new RefObject(dispatcher.get().Row); + ResultAssert.IsSuccess(t.TypeAs().DeleteScope(tempRef_Row3, scope)); + dispatcher.get().argValue.Row = tempRef_Row3.get(); + } + + public void DispatchTuple(RefObject dispatcher, + RefObject scope, LayoutType t, TypeArgumentList typeArgs, + Object value) { + checkArgument(typeArgs.getCount() >= 2); + RefObject tempRef_Row = + new RefObject(dispatcher.get().Row); + ResultAssert.IsSuccess(t.TypeAs().DeleteScope(tempRef_Row, scope)); + dispatcher.get().argValue.Row = tempRef_Row.get(); + } + + public void DispatchUDT(RefObject dispatcher, RefObject scope, LayoutType t, TypeArgumentList typeArgs, Object value) { + RefObject tempRef_Row = new RefObject(dispatcher.get().Row); + ResultAssert.IsSuccess(t.TypeAs().DeleteScope(tempRef_Row, scope)); + dispatcher.get().argValue.Row = tempRef_Row.get(); + } +} \ No newline at end of file diff --git a/jre/src/test/java/com/azure/data/cosmos/serialization/hybridrow/unit/IDispatchable.java b/jre/src/test/java/com/azure/data/cosmos/serialization/hybridrow/unit/IDispatchable.java new file mode 100644 index 0000000..a493f8a --- /dev/null +++ b/jre/src/test/java/com/azure/data/cosmos/serialization/hybridrow/unit/IDispatchable.java @@ -0,0 +1,12 @@ +//------------------------------------------------------------ +// Copyright (c) Microsoft Corporation. All rights reserved. +//------------------------------------------------------------ + +package com.azure.data.cosmos.serialization.hybridrow.unit; + +import com.azure.data.cosmos.core.RefObject; +import com.azure.data.cosmos.serialization.hybridrow.RowCursor; + +public interface IDispatchable { + void Dispatch(RefObject dispatcher, RefObject scope); +} \ No newline at end of file diff --git a/jre/src/test/java/com/azure/data/cosmos/serialization/hybridrow/unit/IDispatcher.java b/jre/src/test/java/com/azure/data/cosmos/serialization/hybridrow/unit/IDispatcher.java new file mode 100644 index 0000000..1dc81cc --- /dev/null +++ b/jre/src/test/java/com/azure/data/cosmos/serialization/hybridrow/unit/IDispatcher.java @@ -0,0 +1,42 @@ +//------------------------------------------------------------ +// Copyright (c) Microsoft Corporation. All rights reserved. +//------------------------------------------------------------ + +package com.azure.data.cosmos.serialization.hybridrow.unit; + +import com.azure.data.cosmos.core.RefObject; +import com.azure.data.cosmos.serialization.hybridrow.RowCursor; + +public interface IDispatcher { + + , TValue> void Dispatch(RefObject dispatcher, + RefObject scope, LayoutColumn col, + LayoutType t); + + //C# TO JAVA CONVERTER NOTE: Java does not support optional parameters. Overloaded method(s) are created above: + //ORIGINAL LINE: void Dispatch(ref RowOperationDispatcher dispatcher, ref RowCursor scope, + // LayoutColumn col, LayoutType t, TValue value = default) where TLayout : LayoutType; + , TValue> void Dispatch(RefObject dispatcher, + RefObject scope, LayoutColumn col, + LayoutType t, TValue value); + + void DispatchArray(RefObject dispatcher, RefObject scope, + LayoutType t, TypeArgumentList typeArgs, Object value); + + void DispatchMap(RefObject dispatcher, RefObject scope, + LayoutType t, TypeArgumentList typeArgs, Object value); + + void DispatchNullable(RefObject dispatcher, RefObject scope, + LayoutType t, TypeArgumentList typeArgs, Object value); + + void DispatchObject(RefObject dispatcher, RefObject scope); + + void DispatchSet(RefObject dispatcher, RefObject scope, + LayoutType t, TypeArgumentList typeArgs, Object value); + + void DispatchTuple(RefObject dispatcher, RefObject scope, + LayoutType t, TypeArgumentList typeArgs, Object value); + + void DispatchUDT(RefObject dispatcher, RefObject scope, + LayoutType type, TypeArgumentList typeArgs, Object value); +} \ No newline at end of file diff --git a/jre/src/test/java/azure/data/cosmos/serialization/hybridrow/unit/LayoutCompilerUnitTests.java b/jre/src/test/java/com/azure/data/cosmos/serialization/hybridrow/unit/LayoutCompilerUnitTests.java similarity index 83% rename from jre/src/test/java/azure/data/cosmos/serialization/hybridrow/unit/LayoutCompilerUnitTests.java rename to jre/src/test/java/com/azure/data/cosmos/serialization/hybridrow/unit/LayoutCompilerUnitTests.java index 5491016..dad6e31 100644 --- a/jre/src/test/java/azure/data/cosmos/serialization/hybridrow/unit/LayoutCompilerUnitTests.java +++ b/jre/src/test/java/com/azure/data/cosmos/serialization/hybridrow/unit/LayoutCompilerUnitTests.java @@ -2,15 +2,20 @@ // Copyright (c) Microsoft Corporation. All rights reserved. //------------------------------------------------------------ -package azure.data.cosmos.serialization.hybridrow.unit; +package com.azure.data.cosmos.serialization.hybridrow.unit; -import azure.data.cosmos.serialization.hybridrow.Float128; -import azure.data.cosmos.serialization.hybridrow.NullValue; -import azure.data.cosmos.serialization.hybridrow.Result; -import azure.data.cosmos.serialization.hybridrow.RowBuffer; -import azure.data.cosmos.serialization.hybridrow.RowCursor; -import azure.data.cosmos.serialization.hybridrow.SchemaId; -import azure.data.cosmos.serialization.hybridrow.UnixDateTime; +import com.azure.data.cosmos.core.OutObject; +import com.azure.data.cosmos.core.RefObject; +import com.azure.data.cosmos.serialization.hybridrow.Float128; +import com.azure.data.cosmos.serialization.hybridrow.NullValue; +import com.azure.data.cosmos.serialization.hybridrow.Result; +import com.azure.data.cosmos.serialization.hybridrow.RowBuffer; +import com.azure.data.cosmos.serialization.hybridrow.RowCursor; +import com.azure.data.cosmos.serialization.hybridrow.SchemaId; +import com.azure.data.cosmos.serialization.hybridrow.UnixDateTime; +import com.azure.data.cosmos.serialization.hybridrow.layouts.LayoutColumn; +import com.azure.data.cosmos.serialization.hybridrow.layouts.LayoutBit; +import com.azure.data.cosmos.serialization.hybridrow.layouts.LayoutType; import java.math.BigDecimal; import java.time.LocalDateTime; @@ -155,7 +160,7 @@ public class LayoutCompilerUnitTests { tempVar20.Value = new byte[] { 0x01, 0x02 }; tempVar20.Length = 2; RoundTripFixed.Expected[] expectedSchemas = - new Microsoft.Azure.Cosmos.Serialization.HybridRow.Tests.Unit.LayoutCompilerUnitTests.RoundTripFixed.Expected[] { tempVar, tempVar2, tempVar3, tempVar4, tempVar5, tempVar6, tempVar7, tempVar8, tempVar9, tempVar10, tempVar11, tempVar12, tempVar13, tempVar14, tempVar15, tempVar16, tempVar17, tempVar18, tempVar19, tempVar20 }; + new azure.data.cosmos.serialization.hybridrow.unit.layoutcompilerunittests.RoundTripFixed.Expected[] { tempVar, tempVar2, tempVar3, tempVar4, tempVar5, tempVar6, tempVar7, tempVar8, tempVar9, tempVar10, tempVar11, tempVar12, tempVar13, tempVar14, tempVar15, tempVar16, tempVar17, tempVar18, tempVar19, tempVar20 }; RowBuffer row = new RowBuffer(LayoutCompilerUnitTests.InitialRowSize); for (String nullable : new String[] { "true", "false" }) { @@ -273,7 +278,7 @@ public final void ParseSchemaVariable() //ORIGINAL LINE: tempVar4.Long = ulong.MaxValue; tempVar4.Long=Long.MAX_VALUE; RoundTripVariable.Expected[]expectedSchemas= - new Microsoft.Azure.Cosmos.Serialization.HybridRow.Tests.Unit.LayoutCompilerUnitTests.RoundTripVariable.Expected[]{tempVar,tempVar2,tempVar3,tempVar4}; + new azure.data.cosmos.serialization.hybridrow.unit.layoutcompilerunittests.RoundTripVariable.Expected[]{tempVar,tempVar2,tempVar3,tempVar4}; RowBuffer row=new RowBuffer(LayoutCompilerUnitTests.InitialRowSize); for(RoundTripVariable.Expected expected:expectedSchemas) @@ -358,11 +363,11 @@ public final void SparseOrdering() tempVar8.Type=LayoutType.Boolean; tempVar8.Value=true; RoundTripSparseOrdering.Expected[][]expectedOrders= - new Microsoft.Azure.Cosmos.Serialization.HybridRow.Tests.Unit.LayoutCompilerUnitTests.RoundTripSparseOrdering.Expected[][] + new azure.data.cosmos.serialization.hybridrow.unit.layoutcompilerunittests.RoundTripSparseOrdering.Expected[][] { - new Microsoft.Azure.Cosmos.Serialization.HybridRow.Tests.Unit.LayoutCompilerUnitTests.RoundTripSparseOrdering.Expected[]{tempVar,tempVar2}, - new Microsoft.Azure.Cosmos.Serialization.HybridRow.Tests.Unit.LayoutCompilerUnitTests.RoundTripSparseOrdering.Expected[]{tempVar3,tempVar4}, - new Microsoft.Azure.Cosmos.Serialization.HybridRow.Tests.Unit.LayoutCompilerUnitTests.RoundTripSparseOrdering.Expected[]{tempVar5,tempVar6,tempVar7,tempVar8} + new azure.data.cosmos.serialization.hybridrow.unit.layoutcompilerunittests.RoundTripSparseOrdering.Expected[]{tempVar,tempVar2}, + new azure.data.cosmos.serialization.hybridrow.unit.layoutcompilerunittests.RoundTripSparseOrdering.Expected[]{tempVar3,tempVar4}, + new azure.data.cosmos.serialization.hybridrow.unit.layoutcompilerunittests.RoundTripSparseOrdering.Expected[]{tempVar5,tempVar6,tempVar7,tempVar8} }; RowBuffer row=new RowBuffer(LayoutCompilerUnitTests.InitialRowSize); @@ -476,7 +481,7 @@ public final void ParseSchemaSparseSimple() //ORIGINAL LINE: tempVar23.Value = new byte[] { 0x01, 0x02 }; tempVar23.Value=new byte[]{0x01,0x02}; RoundTripSparseSimple.Expected[]expectedSchemas= - new Microsoft.Azure.Cosmos.Serialization.HybridRow.Tests.Unit.LayoutCompilerUnitTests.RoundTripSparseSimple.Expected[]{tempVar,tempVar2,tempVar3,tempVar4,tempVar5,tempVar6,tempVar7,tempVar8,tempVar9,tempVar10,tempVar11,tempVar12,tempVar13,tempVar14,tempVar15,tempVar16,tempVar17,tempVar18,tempVar19,tempVar20,tempVar21,tempVar22,tempVar23}; + new azure.data.cosmos.serialization.hybridrow.unit.layoutcompilerunittests.RoundTripSparseSimple.Expected[]{tempVar,tempVar2,tempVar3,tempVar4,tempVar5,tempVar6,tempVar7,tempVar8,tempVar9,tempVar10,tempVar11,tempVar12,tempVar13,tempVar14,tempVar15,tempVar16,tempVar17,tempVar18,tempVar19,tempVar20,tempVar21,tempVar22,tempVar23}; RowBuffer row=new RowBuffer(LayoutCompilerUnitTests.InitialRowSize); for(RoundTripSparseSimple.Expected expected:expectedSchemas) @@ -776,7 +781,7 @@ public final void ParseSchemaSparseObject() tempVar.Json="{'path': 'b', 'type': {'type': 'int8'}}"; tempVar.Value=(byte)42; RoundTripSparseObject.Expected[]expectedSchemas= - new Microsoft.Azure.Cosmos.Serialization.HybridRow.Tests.Unit.LayoutCompilerUnitTests.RoundTripSparseObject.Expected[]{tempVar}; + new azure.data.cosmos.serialization.hybridrow.unit.layoutcompilerunittests.RoundTripSparseObject.Expected[]{tempVar}; RowBuffer row=new RowBuffer(LayoutCompilerUnitTests.InitialRowSize); for(RoundTripSparseObject.Expected expected:expectedSchemas) @@ -839,7 +844,7 @@ public final void ParseSchemaSparseObjectMulti() tempVar2.setPath("a.b"); tempVar2.Value=(byte)42; tempVar.Props= - new Microsoft.Azure.Cosmos.Serialization.HybridRow.Tests.Unit.LayoutCompilerUnitTests.RoundTripSparseObjectMulti.Property[]{tempVar2}; + new azure.data.cosmos.serialization.hybridrow.unit.layoutcompilerunittests.RoundTripSparseObjectMulti.Property[]{tempVar2}; RoundTripSparseObjectMulti.Expected tempVar3=new RoundTripSparseObjectMulti.Expected(); tempVar3.Json="{'path': 'b', 'type': {'type': 'int8'}}, {'path': 'c', 'type': {'type': 'utf8'}}"; RoundTripSparseObjectMulti.Property tempVar4=new RoundTripSparseObjectMulti.Property(); @@ -849,7 +854,7 @@ public final void ParseSchemaSparseObjectMulti() tempVar5.setPath("a.c"); tempVar5.Value="abc"; tempVar3.Props= - new Microsoft.Azure.Cosmos.Serialization.HybridRow.Tests.Unit.LayoutCompilerUnitTests.RoundTripSparseObjectMulti.Property[]{tempVar4,tempVar5}; + new azure.data.cosmos.serialization.hybridrow.unit.layoutcompilerunittests.RoundTripSparseObjectMulti.Property[]{tempVar4,tempVar5}; RoundTripSparseObjectMulti.Expected tempVar6=new RoundTripSparseObjectMulti.Expected(); tempVar6.Json="{'path': 'b', 'type': {'type': 'int8'}}, {'path': 'c', 'type': {'type': 'bool'}}, {'path': 'd', " + "'type': {'type': 'binary'}}, {'path': 'e', 'type': {'type': 'null'}}"; @@ -868,15 +873,15 @@ public final void ParseSchemaSparseObjectMulti() tempVar10.setPath("a.e"); tempVar10.Value=NullValue.Default; tempVar6.Props= - new Microsoft.Azure.Cosmos.Serialization.HybridRow.Tests.Unit.LayoutCompilerUnitTests.RoundTripSparseObjectMulti.Property[]{tempVar7,tempVar8,tempVar9,tempVar10}; + new azure.data.cosmos.serialization.hybridrow.unit.layoutcompilerunittests.RoundTripSparseObjectMulti.Property[]{tempVar7,tempVar8,tempVar9,tempVar10}; RoundTripSparseObjectMulti.Expected tempVar11=new RoundTripSparseObjectMulti.Expected(); tempVar11.Json="{'path': 'b', 'type': {'type': 'object'}}"; RoundTripSparseObjectMulti.Property tempVar12=new RoundTripSparseObjectMulti.Property(); tempVar12.setPath("a.b"); tempVar11.Props= - new Microsoft.Azure.Cosmos.Serialization.HybridRow.Tests.Unit.LayoutCompilerUnitTests.RoundTripSparseObjectMulti.Property[]{tempVar12}; + new azure.data.cosmos.serialization.hybridrow.unit.layoutcompilerunittests.RoundTripSparseObjectMulti.Property[]{tempVar12}; RoundTripSparseObjectMulti.Expected[]expectedSchemas= - new Microsoft.Azure.Cosmos.Serialization.HybridRow.Tests.Unit.LayoutCompilerUnitTests.RoundTripSparseObjectMulti.Expected[]{tempVar,tempVar3,tempVar6,tempVar11}; + new azure.data.cosmos.serialization.hybridrow.unit.layoutcompilerunittests.RoundTripSparseObjectMulti.Expected[]{tempVar,tempVar3,tempVar6,tempVar11}; RowBuffer row=new RowBuffer(LayoutCompilerUnitTests.InitialRowSize); for(RoundTripSparseObjectMulti.Expected expected:expectedSchemas) @@ -1025,7 +1030,7 @@ public final void ParseSchemaSparseObjectNested() tempVar2.setPath("a.b.c"); tempVar2.Value=(byte)42; tempVar.Props= - new Microsoft.Azure.Cosmos.Serialization.HybridRow.Tests.Unit.LayoutCompilerUnitTests.RoundTripSparseObjectNested.Property[]{tempVar2}; + new azure.data.cosmos.serialization.hybridrow.unit.layoutcompilerunittests.RoundTripSparseObjectNested.Property[]{tempVar2}; RoundTripSparseObjectNested.Expected tempVar3=new RoundTripSparseObjectNested.Expected(); tempVar3.Json="{'path': 'b', 'type': {'type': 'int8'}}, {'path': 'c', 'type': {'type': 'utf8'}}"; RoundTripSparseObjectNested.Property tempVar4=new RoundTripSparseObjectNested.Property(); @@ -1035,7 +1040,7 @@ public final void ParseSchemaSparseObjectNested() tempVar5.setPath("a.b.c"); tempVar5.Value="abc"; tempVar3.Props= - new Microsoft.Azure.Cosmos.Serialization.HybridRow.Tests.Unit.LayoutCompilerUnitTests.RoundTripSparseObjectNested.Property[]{tempVar4,tempVar5}; + new azure.data.cosmos.serialization.hybridrow.unit.layoutcompilerunittests.RoundTripSparseObjectNested.Property[]{tempVar4,tempVar5}; RoundTripSparseObjectNested.Expected tempVar6=new RoundTripSparseObjectNested.Expected(); tempVar6.Json="{'path': 'b', 'type': {'type': 'int8'}}, {'path': 'c', 'type': {'type': 'bool'}}, {'path': 'd', " + "'type': {'type': 'binary'}}, {'path': 'e', 'type': {'type': 'null'}}"; @@ -1054,15 +1059,15 @@ public final void ParseSchemaSparseObjectNested() tempVar10.setPath("a.b.e"); tempVar10.Value=NullValue.Default; tempVar6.Props= - new Microsoft.Azure.Cosmos.Serialization.HybridRow.Tests.Unit.LayoutCompilerUnitTests.RoundTripSparseObjectNested.Property[]{tempVar7,tempVar8,tempVar9,tempVar10}; + new azure.data.cosmos.serialization.hybridrow.unit.layoutcompilerunittests.RoundTripSparseObjectNested.Property[]{tempVar7,tempVar8,tempVar9,tempVar10}; RoundTripSparseObjectNested.Expected tempVar11=new RoundTripSparseObjectNested.Expected(); tempVar11.Json="{'path': 'b', 'type': {'type': 'object'}}"; RoundTripSparseObjectNested.Property tempVar12=new RoundTripSparseObjectNested.Property(); tempVar12.setPath("a.b.b"); tempVar11.Props= - new Microsoft.Azure.Cosmos.Serialization.HybridRow.Tests.Unit.LayoutCompilerUnitTests.RoundTripSparseObjectNested.Property[]{tempVar12}; + new azure.data.cosmos.serialization.hybridrow.unit.layoutcompilerunittests.RoundTripSparseObjectNested.Property[]{tempVar12}; RoundTripSparseObjectNested.Expected[]expectedSchemas= - new Microsoft.Azure.Cosmos.Serialization.HybridRow.Tests.Unit.LayoutCompilerUnitTests.RoundTripSparseObjectNested.Expected[]{tempVar,tempVar3,tempVar6,tempVar11}; + new azure.data.cosmos.serialization.hybridrow.unit.layoutcompilerunittests.RoundTripSparseObjectNested.Expected[]{tempVar,tempVar3,tempVar6,tempVar11}; RowBuffer row=new RowBuffer(LayoutCompilerUnitTests.InitialRowSize); for(RoundTripSparseObjectNested.Expected expected:expectedSchemas) @@ -1251,7 +1256,7 @@ public final void ParseSchemaSparseArray() tempVar22.Value=new ArrayList(Arrays.asList(new Byte[]{0x01,0x02},new byte[]{0x03,0x04},new byte[]{0x05, 0x06})); RoundTripSparseArray.Expected[]expectedSchemas= - new Microsoft.Azure.Cosmos.Serialization.HybridRow.Tests.Unit.LayoutCompilerUnitTests.RoundTripSparseArray.Expected[]{tempVar,tempVar2,tempVar3,tempVar4,tempVar5,tempVar6,tempVar7,tempVar8,tempVar9,tempVar10,tempVar11,tempVar12,tempVar13,tempVar14,tempVar15,tempVar16,tempVar17,tempVar18,tempVar19,tempVar20,tempVar21,tempVar22}; + new azure.data.cosmos.serialization.hybridrow.unit.layoutcompilerunittests.RoundTripSparseArray.Expected[]{tempVar,tempVar2,tempVar3,tempVar4,tempVar5,tempVar6,tempVar7,tempVar8,tempVar9,tempVar10,tempVar11,tempVar12,tempVar13,tempVar14,tempVar15,tempVar16,tempVar17,tempVar18,tempVar19,tempVar20,tempVar21,tempVar22}; RowBuffer row=new RowBuffer(LayoutCompilerUnitTests.InitialRowSize); for(RoundTripSparseArray.Expected expected:expectedSchemas) @@ -1398,7 +1403,7 @@ public final void ParseSchemaSparseSet() tempVar19.Value=new ArrayList(Arrays.asList(new Byte[]{0x01,0x02},new byte[]{0x03,0x04},new byte[]{0x05, 0x06})); RoundTripSparseSet.Expected[]expectedSchemas= - new Microsoft.Azure.Cosmos.Serialization.HybridRow.Tests.Unit.LayoutCompilerUnitTests.RoundTripSparseSet.Expected[]{tempVar,tempVar2,tempVar3,tempVar4,tempVar5,tempVar6,tempVar7,tempVar8,tempVar9,tempVar10,tempVar11,tempVar12,tempVar13,tempVar14,tempVar15,tempVar16,tempVar17,tempVar18,tempVar19}; + new azure.data.cosmos.serialization.hybridrow.unit.layoutcompilerunittests.RoundTripSparseSet.Expected[]{tempVar,tempVar2,tempVar3,tempVar4,tempVar5,tempVar6,tempVar7,tempVar8,tempVar9,tempVar10,tempVar11,tempVar12,tempVar13,tempVar14,tempVar15,tempVar16,tempVar17,tempVar18,tempVar19}; RowBuffer row=new RowBuffer(LayoutCompilerUnitTests.InitialRowSize); for(RoundTripSparseSet.Expected expected:expectedSchemas) @@ -1587,14 +1592,14 @@ private, TClosure> void Layou dispatcher.DispatchObject(row,scope,closure); break; default: - Contract.Assert(false,String.format("Unknown type will be ignored: %1$s",code)); + throw new IllegalStateException(lenientFormat("Unknown type will be ignored: %s",code)); break; } } private final static class RoundTripFixed extends TestActionDispatcher { @Override - public void Dispatch(tangible.RefObject row, tangible.RefObject root, + public void Dispatch(RefObject row, RefObject root, Closure closure) { LayoutColumn col = closure.Col; Expected expected = closure.Expected.clone(); @@ -1603,16 +1608,16 @@ private final static class RoundTripFixed extends TestActionDispatcher tempOut_value = new tangible.OutObject(); + OutObject tempOut_value = new OutObject(); r = t.ReadFixed(row, root, col, tempOut_value); - value = tempOut_value.argValue; + value = tempOut_value.get(); ResultAssert.NotFound(r, "Json: {0}", expected.Json); } else { - tangible.OutObject tempOut_value2 = new tangible.OutObject(); + OutObject tempOut_value2 = new OutObject(); r = t.ReadFixed(row, root, col, tempOut_value2); - value = tempOut_value2.argValue; + value = tempOut_value2.get(); ResultAssert.IsSuccess(r, "Json: {0}", expected.Json); boolean tempVar = expected.Default instanceof Array; Array defaultArray = tempVar ? (Array)expected.Default : null; @@ -1625,9 +1630,9 @@ private final static class RoundTripFixed extends TestActionDispatcher tempOut_value3 = new tangible.OutObject(); + OutObject tempOut_value3 = new OutObject(); r = t.ReadFixed(row, root, col, tempOut_value3); - value = tempOut_value3.argValue; + value = tempOut_value3.get(); ResultAssert.IsSuccess(r, "Json: {0}", expected.Json); boolean tempVar2 = expected.Value instanceof Array; Array array = tempVar2 ? (Array)expected.Value : null; @@ -1640,7 +1645,7 @@ private final static class RoundTripFixed extends TestActionDispatcher { @Override - public void Dispatch(tangible.RefObject row, tangible.RefObject root, + public void Dispatch(RefObject row, RefObject root, Closure closure) { LayoutColumn arrCol = closure.ArrCol; - azure.data.cosmos.serialization.hybridrow.layouts.LayoutType tempVar = arrCol.getType(); + LayoutType tempVar = arrCol.getType(); LayoutIndexedScope arrT = tempVar instanceof LayoutIndexedScope ? (LayoutIndexedScope)tempVar : null; Expected expected = closure.Expected.clone(); String tag = String.format("Json: %1$s, Array: %2$s", expected.Json, arrCol.getType().getName()); @@ -1716,15 +1721,15 @@ private final static class RoundTripSparseArray extends TestActionDispatcher tempRef_field = - new tangible.RefObject(field); + root.get().Clone(out field).Find(row, arrCol.getPath()); + RefObject tempRef_field = + new RefObject(field); RowCursor scope; - tangible.OutObject tempOut_scope = - new tangible.OutObject(); + OutObject tempOut_scope = + new OutObject(); Result r = arrT.ReadScope(row, tempRef_field, tempOut_scope); - scope = tempOut_scope.argValue; - field = tempRef_field.argValue; + scope = tempOut_scope.get(); + field = tempRef_field.get(); ResultAssert.NotFound(r, tag); // Write the array. @@ -1763,14 +1768,14 @@ private final static class RoundTripSparseArray extends TestActionDispatcher tempRef_field2 = - new tangible.RefObject(field); + RefObject tempRef_field2 = + new RefObject(field); RowCursor scope2; - tangible.OutObject tempOut_scope2 = - new tangible.OutObject(); + OutObject tempOut_scope2 = + new OutObject(); r = arrT.ReadScope(row, tempRef_field2, tempOut_scope2); - scope2 = tempOut_scope2.argValue; - field = tempRef_field2.argValue; + scope2 = tempOut_scope2.get(); + field = tempRef_field2.get(); ResultAssert.IsSuccess(r, tag); Assert.AreEqual(scope.ScopeType, scope2.ScopeType, tag); Assert.AreEqual(scope.start, scope2.start, tag); @@ -1839,11 +1844,11 @@ private final static class RoundTripSparseArray extends TestActionDispatcher tempRef_roRoot = - new tangible.RefObject(roRoot); + root.get().AsReadOnly(out roRoot).Find(row, arrCol.getPath()); + RefObject tempRef_roRoot = + new RefObject(roRoot); ResultAssert.InsufficientPermissions(arrT.DeleteScope(row, tempRef_roRoot)); - roRoot = tempRef_roRoot.argValue; + roRoot = tempRef_roRoot.get(); // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'out' keyword - these // cannot be converted using the 'OutObject' 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 @@ -1852,24 +1857,24 @@ private final static class RoundTripSparseArray extends TestActionDispatcher tempRef_field3 = - new tangible.RefObject(field); + RefObject tempRef_field3 = + new RefObject(field); r = LayoutType.Null.WriteSparse(row, tempRef_field3, NullValue.Default); - field = tempRef_field3.argValue; + field = tempRef_field3.get(); ResultAssert.IsSuccess(r, tag); - tangible.RefObject tempRef_field4 = - new tangible.RefObject(field); + RefObject tempRef_field4 = + new RefObject(field); RowCursor _; - tangible.OutObject tempOut__ = - new tangible.OutObject(); + OutObject tempOut__ = + new OutObject(); r = arrT.ReadScope(row, tempRef_field4, tempOut__); - _ = tempOut__.argValue; - field = tempRef_field4.argValue; + _ = tempOut__.get(); + field = tempRef_field4.get(); ResultAssert.TypeMismatch(r, tag); - tangible.RefObject tempRef_field5 = - new tangible.RefObject(field); + RefObject tempRef_field5 = + new RefObject(field); r = arrT.DeleteScope(row, tempRef_field5); - field = tempRef_field5.argValue; + field = tempRef_field5.get(); ResultAssert.TypeMismatch(r, "Json: {0}", expected.Json); // Overwrite it again, then delete it. @@ -1880,19 +1885,19 @@ private final static class RoundTripSparseArray extends TestActionDispatcher tempRef_field6 = - new tangible.RefObject(field); + RefObject tempRef_field6 = + new RefObject(field); r = arrT.DeleteScope(row, tempRef_field6); - field = tempRef_field6.argValue; + field = tempRef_field6.get(); ResultAssert.IsSuccess(r, "Json: {0}", expected.Json); - tangible.RefObject tempRef_field7 = - new tangible.RefObject(field); + RefObject tempRef_field7 = + new RefObject(field); RowCursor _; - tangible.OutObject tempOut__2 = - new tangible.OutObject(); + OutObject tempOut__2 = + new OutObject(); r = arrT.ReadScope(row, tempRef_field7, tempOut__2); - _ = tempOut__2.argValue; - field = tempRef_field7.argValue; + _ = tempOut__2.get(); + field = tempRef_field7.get(); ResultAssert.NotFound(r, "Json: {0}", expected.Json); } @@ -1935,10 +1940,10 @@ private final static class RoundTripSparseArray extends TestActionDispatcher { @Override - public void Dispatch(tangible.RefObject row, tangible.RefObject root, + public void Dispatch(RefObject row, RefObject root, Closure closure) { LayoutColumn objCol = closure.ObjCol; - azure.data.cosmos.serialization.hybridrow.layouts.LayoutType tempVar = objCol.getType(); + LayoutType tempVar = objCol.getType(); LayoutObject objT = tempVar instanceof LayoutObject ? (LayoutObject)tempVar : null; LayoutColumn col = closure.Col; Expected expected = closure.Expected.clone(); @@ -1953,25 +1958,25 @@ private final static class RoundTripSparseObject extends TestActionDispatcher tempRef_field = - new tangible.RefObject(field); + root.get().Clone(out field).Find(row, objCol.getPath()); + RefObject tempRef_field = + new RefObject(field); RowCursor scope; - tangible.OutObject tempOut_scope = - new tangible.OutObject(); + OutObject tempOut_scope = + new OutObject(); Result r = objT.ReadScope(row, tempRef_field, tempOut_scope); - scope = tempOut_scope.argValue; - field = tempRef_field.argValue; + scope = tempOut_scope.get(); + field = tempRef_field.get(); ResultAssert.NotFound(r, "Json: {0}", expected.Json); // Write the object and the nested column. - tangible.RefObject tempRef_field2 = - new tangible.RefObject(field); - tangible.OutObject tempOut_scope2 = - new tangible.OutObject(); + RefObject tempRef_field2 = + new RefObject(field); + OutObject tempOut_scope2 = + new OutObject(); r = objT.WriteScope(row, tempRef_field2, objCol.getTypeArgs().clone(), tempOut_scope2); - scope = tempOut_scope2.argValue; - field = tempRef_field2.argValue; + scope = tempOut_scope2.get(); + field = tempRef_field2.get(); ResultAssert.IsSuccess(r, "Json: {0}", expected.Json); // Verify the nested field doesn't yet appear within the new scope. @@ -1994,14 +1999,14 @@ private final static class RoundTripSparseObject extends TestActionDispatcher tempRef_field3 = - new tangible.RefObject(field); + RefObject tempRef_field3 = + new RefObject(field); RowCursor scope2; - tangible.OutObject tempOut_scope2 = - new tangible.OutObject(); + OutObject tempOut_scope2 = + new OutObject(); r = objT.ReadScope(row, tempRef_field3, tempOut_scope2); - scope2 = tempOut_scope2.argValue; - field = tempRef_field3.argValue; + scope2 = tempOut_scope2.get(); + field = tempRef_field3.get(); ResultAssert.IsSuccess(r, "Json: {0}", expected.Json); Assert.AreEqual(scope.ScopeType, scope2.ScopeType, "Json: {0}", expected.Json); Assert.AreEqual(scope.start, scope2.start, "Json: {0}", expected.Json); @@ -2028,64 +2033,64 @@ private final static class RoundTripSparseObject extends TestActionDispatcher tempRef_roRoot = - new tangible.RefObject(roRoot); + root.get().AsReadOnly(out roRoot).Find(row, objCol.getPath()); + RefObject tempRef_roRoot = + new RefObject(roRoot); ResultAssert.InsufficientPermissions(objT.DeleteScope(row, tempRef_roRoot)); - roRoot = tempRef_roRoot.argValue; - tangible.RefObject tempRef_roRoot2 = - new tangible.RefObject(roRoot); - tangible.OutObject tempOut_scope22 = - new tangible.OutObject(); + roRoot = tempRef_roRoot.get(); + RefObject tempRef_roRoot2 = + new RefObject(roRoot); + OutObject tempOut_scope22 = + new OutObject(); ResultAssert.InsufficientPermissions(objT.WriteScope(row, tempRef_roRoot2, objCol.getTypeArgs().clone(), tempOut_scope22)); - scope2 = tempOut_scope22.argValue; - roRoot = tempRef_roRoot2.argValue; + scope2 = tempOut_scope22.get(); + roRoot = tempRef_roRoot2.get(); // Overwrite the whole scope. - tangible.RefObject tempRef_field4 = - new tangible.RefObject(field); + RefObject tempRef_field4 = + new RefObject(field); r = LayoutType.Null.WriteSparse(row, tempRef_field4, NullValue.Default); - field = tempRef_field4.argValue; + field = tempRef_field4.get(); ResultAssert.IsSuccess(r, "Json: {0}", expected.Json); - tangible.RefObject tempRef_field5 = - new tangible.RefObject(field); + RefObject tempRef_field5 = + new RefObject(field); RowCursor _; - tangible.OutObject tempOut__ = - new tangible.OutObject(); + OutObject tempOut__ = + new OutObject(); r = objT.ReadScope(row, tempRef_field5, tempOut__); - _ = tempOut__.argValue; - field = tempRef_field5.argValue; + _ = tempOut__.get(); + field = tempRef_field5.get(); ResultAssert.TypeMismatch(r, "Json: {0}", expected.Json); - tangible.RefObject tempRef_field6 = - new tangible.RefObject(field); + RefObject tempRef_field6 = + new RefObject(field); r = objT.DeleteScope(row, tempRef_field6); - field = tempRef_field6.argValue; + field = tempRef_field6.get(); ResultAssert.TypeMismatch(r, "Json: {0}", expected.Json); // Overwrite it again, then delete it. - tangible.RefObject tempRef_field7 = - new tangible.RefObject(field); + RefObject tempRef_field7 = + new RefObject(field); RowCursor _; - tangible.OutObject tempOut__2 = - new tangible.OutObject(); + OutObject tempOut__2 = + new OutObject(); r = objT.WriteScope(row, tempRef_field7, objCol.getTypeArgs().clone(), tempOut__2, UpdateOptions.Update); - _ = tempOut__2.argValue; - field = tempRef_field7.argValue; + _ = tempOut__2.get(); + field = tempRef_field7.get(); ResultAssert.IsSuccess(r, "Json: {0}", expected.Json); - tangible.RefObject tempRef_field8 = - new tangible.RefObject(field); + RefObject tempRef_field8 = + new RefObject(field); r = objT.DeleteScope(row, tempRef_field8); - field = tempRef_field8.argValue; + field = tempRef_field8.get(); ResultAssert.IsSuccess(r, "Json: {0}", expected.Json); - tangible.RefObject tempRef_field9 = - new tangible.RefObject(field); + RefObject tempRef_field9 = + new RefObject(field); RowCursor _; - tangible.OutObject tempOut__3 = - new tangible.OutObject(); + OutObject tempOut__3 = + new OutObject(); r = objT.ReadScope(row, tempRef_field9, tempOut__3); - _ = tempOut__3.argValue; - field = tempRef_field9.argValue; + _ = tempOut__3.get(); + field = tempRef_field9.get(); ResultAssert.NotFound(r, "Json: {0}", expected.Json); } @@ -2128,7 +2133,7 @@ private final static class RoundTripSparseObject extends TestActionDispatcher { @Override - public void Dispatch(tangible.RefObject row, tangible.RefObject scope, + public void Dispatch(RefObject row, RefObject scope, Closure closure) { LayoutColumn col = closure.Col; Property prop = closure.Prop.clone(); @@ -2143,7 +2148,7 @@ private final static class RoundTripSparseObjectMulti extends TestActionDispatch RowCursor nestedField; // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'out' keyword - these // cannot be converted using the 'OutObject' helper class unless the method is within the code being modified: - scope.argValue.Clone(out nestedField).Find(row, col.getPath()); + scope.get().Clone(out nestedField).Find(row, col.getPath()); TValue value; // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'out' keyword - these // cannot be converted using the 'OutObject' helper class unless the method is within the code being modified: @@ -2175,16 +2180,16 @@ private final static class RoundTripSparseObjectMulti extends TestActionDispatch // Overwrite the nested field. if (t instanceof LayoutNull) { - tangible.RefObject tempRef_nestedField = - new tangible.RefObject(nestedField); + RefObject tempRef_nestedField = + new RefObject(nestedField); r = LayoutType.Boolean.WriteSparse(row, tempRef_nestedField, false); - nestedField = tempRef_nestedField.argValue; + nestedField = tempRef_nestedField.get(); ResultAssert.IsSuccess(r, tag); } else { - tangible.RefObject tempRef_nestedField2 = - new tangible.RefObject(nestedField); + RefObject tempRef_nestedField2 = + new RefObject(nestedField); r = LayoutType.Null.WriteSparse(row, tempRef_nestedField2, NullValue.Default); - nestedField = tempRef_nestedField2.argValue; + nestedField = tempRef_nestedField2.get(); ResultAssert.IsSuccess(r, tag); } @@ -2198,7 +2203,7 @@ private final static class RoundTripSparseObjectMulti extends TestActionDispatch } @Override - public void DispatchObject(tangible.RefObject row, tangible.RefObject scope, + public void DispatchObject(RefObject row, RefObject scope, Closure closure) { LayoutColumn col = closure.Col; Property prop = closure.Prop.clone(); @@ -2213,36 +2218,36 @@ private final static class RoundTripSparseObjectMulti extends TestActionDispatch RowCursor nestedField; // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'out' keyword - these // cannot be converted using the 'OutObject' helper class unless the method is within the code being modified: - scope.argValue.Clone(out nestedField).Find(row, col.getPath()); - tangible.RefObject tempRef_nestedField = - new tangible.RefObject(nestedField); + scope.get().Clone(out nestedField).Find(row, col.getPath()); + RefObject tempRef_nestedField = + new RefObject(nestedField); RowCursor scope2; - tangible.OutObject tempOut_scope2 = - new tangible.OutObject(); + OutObject tempOut_scope2 = + new OutObject(); Result r = t.ReadScope(row, tempRef_nestedField, tempOut_scope2); - scope2 = tempOut_scope2.argValue; - nestedField = tempRef_nestedField.argValue; + scope2 = tempOut_scope2.get(); + nestedField = tempRef_nestedField.get(); ResultAssert.NotFound(r, tag); // Write the nested field. - tangible.RefObject tempRef_nestedField2 = - new tangible.RefObject(nestedField); - tangible.OutObject tempOut_scope22 = - new tangible.OutObject(); + RefObject tempRef_nestedField2 = + new RefObject(nestedField); + OutObject tempOut_scope22 = + new OutObject(); r = t.WriteScope(row, tempRef_nestedField2, col.getTypeArgs().clone(), tempOut_scope22); - scope2 = tempOut_scope22.argValue; - nestedField = tempRef_nestedField2.argValue; + scope2 = tempOut_scope22.get(); + nestedField = tempRef_nestedField2.get(); ResultAssert.IsSuccess(r, tag); // Read the nested field - tangible.RefObject tempRef_nestedField3 = - new tangible.RefObject(nestedField); + RefObject tempRef_nestedField3 = + new RefObject(nestedField); RowCursor scope3; - tangible.OutObject tempOut_scope3 = - new tangible.OutObject(); + OutObject tempOut_scope3 = + new OutObject(); r = t.ReadScope(row, tempRef_nestedField3, tempOut_scope3); - scope3 = tempOut_scope3.argValue; - nestedField = tempRef_nestedField3.argValue; + scope3 = tempOut_scope3.get(); + nestedField = tempRef_nestedField3.get(); ResultAssert.IsSuccess(r, tag); RowCursor _; // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'out' keyword - these @@ -2254,20 +2259,20 @@ private final static class RoundTripSparseObjectMulti extends TestActionDispatch Assert.AreEqual(scope2.AsReadOnly(out _).start, scope3.start, tag); // Overwrite the nested field. - tangible.RefObject tempRef_nestedField4 = - new tangible.RefObject(nestedField); + RefObject tempRef_nestedField4 = + new RefObject(nestedField); r = LayoutType.Null.WriteSparse(row, tempRef_nestedField4, NullValue.Default); - nestedField = tempRef_nestedField4.argValue; + nestedField = tempRef_nestedField4.get(); ResultAssert.IsSuccess(r, tag); // Verify nested field no longer there. - tangible.RefObject tempRef_nestedField5 = - new tangible.RefObject(nestedField); - tangible.OutObject tempOut_scope32 = - new tangible.OutObject(); + RefObject tempRef_nestedField5 = + new RefObject(nestedField); + OutObject tempOut_scope32 = + new OutObject(); r = t.ReadScope(row, tempRef_nestedField5, tempOut_scope32); - scope3 = tempOut_scope32.argValue; - nestedField = tempRef_nestedField5.argValue; + scope3 = tempOut_scope32.get(); + nestedField = tempRef_nestedField5.get(); ResultAssert.TypeMismatch(r, tag); } @@ -2327,7 +2332,7 @@ private final static class RoundTripSparseObjectMulti extends TestActionDispatch private final static class RoundTripSparseObjectNested extends TestActionDispatcher { @Override - public void Dispatch(tangible.RefObject row, tangible.RefObject root, + public void Dispatch(RefObject row, RefObject root, Closure closure) { LayoutColumn col = closure.Col; Property prop = closure.Prop.clone(); @@ -2369,16 +2374,16 @@ private final static class RoundTripSparseObjectNested extends TestActionDispatc // Overwrite the nested field. if (t instanceof LayoutNull) { - tangible.RefObject tempRef_field = - new tangible.RefObject(field); + RefObject tempRef_field = + new RefObject(field); r = LayoutType.Boolean.WriteSparse(row, tempRef_field, false); - field = tempRef_field.argValue; + field = tempRef_field.get(); ResultAssert.IsSuccess(r, tag); } else { - tangible.RefObject tempRef_field2 = - new tangible.RefObject(field); + RefObject tempRef_field2 = + new RefObject(field); r = LayoutType.Null.WriteSparse(row, tempRef_field2, NullValue.Default); - field = tempRef_field2.argValue; + field = tempRef_field2.get(); ResultAssert.IsSuccess(r, tag); } @@ -2392,7 +2397,7 @@ private final static class RoundTripSparseObjectNested extends TestActionDispatc } @Override - public void DispatchObject(tangible.RefObject row, tangible.RefObject root, Closure closure) { + public void DispatchObject(RefObject row, RefObject root, Closure closure) { LayoutColumn col = closure.Col; Property prop = closure.Prop.clone(); Expected expected = closure.Expected.clone(); @@ -2402,7 +2407,7 @@ private final static class RoundTripSparseObjectNested extends TestActionDispatc // Ensure scope exists. RowCursor scope = LayoutCompilerUnitTests.EnsureScope(row, root, col, tag); - assert root.argValue.clone() != scope.clone(); + assert root.get().clone() != scope.clone(); } //C# TO JAVA CONVERTER WARNING: Java does not allow user-defined value types. The behavior of this class may @@ -2461,7 +2466,7 @@ private final static class RoundTripSparseObjectNested extends TestActionDispatc private final static class RoundTripSparseOrdering extends TestActionDispatcher { @Override - public void Dispatch(tangible.RefObject row, tangible.RefObject root, + public void Dispatch(RefObject row, RefObject root, Closure closure) { LayoutType type = closure.Expected.Type; String path = closure.Expected.Path; @@ -2473,18 +2478,18 @@ private final static class RoundTripSparseOrdering extends TestActionDispatcher< RowCursor field; // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'out' keyword - these // cannot be converted using the 'OutObject' helper class unless the method is within the code being modified: - root.argValue.Clone(out field).Find(row, path); + root.get().Clone(out field).Find(row, path); // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'ref' keyword - these // cannot be converted using the 'RefObject' helper class unless the method is within the code being modified: Result r = t.WriteSparse(row, ref field, value); ResultAssert.IsSuccess(r, "Json: {0}", json); - tangible.OutObject tempOut_value = new tangible.OutObject(); + OutObject tempOut_value = new OutObject(); // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'out' keyword - these // cannot be converted using the 'OutObject' 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 // cannot be converted using the 'RefObject' helper class unless the method is within the code being modified: r = t.ReadSparse(row, ref field, tempOut_value); - value = tempOut_value.argValue; + value = tempOut_value.get(); ResultAssert.IsSuccess(r, "Json: {0}", json); boolean tempVar = exValue instanceof Array; Array array = tempVar ? (Array)exValue : null; @@ -2495,12 +2500,12 @@ private final static class RoundTripSparseOrdering extends TestActionDispatcher< } if (t instanceof LayoutNull) { - tangible.RefObject tempRef_field = - new tangible.RefObject(field); + RefObject tempRef_field = + new RefObject(field); r = LayoutType.Boolean.WriteSparse(row, tempRef_field, false); - field = tempRef_field.argValue; + field = tempRef_field.get(); ResultAssert.IsSuccess(r, "Json: {0}", json); - tangible.OutObject tempOut_value2 = new tangible.OutObject(); + OutObject tempOut_value2 = new OutObject(); // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'out' keyword - these // cannot be converted using the 'OutObject' helper class unless the method is within the code being // modified: @@ -2508,15 +2513,15 @@ private final static class RoundTripSparseOrdering extends TestActionDispatcher< // cannot be converted using the 'RefObject' helper class unless the method is within the code being // modified: r = t.ReadSparse(row, ref field, tempOut_value2); - value = tempOut_value2.argValue; + value = tempOut_value2.get(); ResultAssert.TypeMismatch(r, "Json: {0}", json); } else { - tangible.RefObject tempRef_field2 = - new tangible.RefObject(field); + RefObject tempRef_field2 = + new RefObject(field); r = LayoutType.Null.WriteSparse(row, tempRef_field2, NullValue.Default); - field = tempRef_field2.argValue; + field = tempRef_field2.get(); ResultAssert.IsSuccess(r, "Json: {0}", json); - tangible.OutObject tempOut_value3 = new tangible.OutObject(); + OutObject tempOut_value3 = new OutObject(); // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'out' keyword - these // cannot be converted using the 'OutObject' helper class unless the method is within the code being // modified: @@ -2524,7 +2529,7 @@ private final static class RoundTripSparseOrdering extends TestActionDispatcher< // cannot be converted using the 'RefObject' helper class unless the method is within the code being // modified: r = t.ReadSparse(row, ref field, tempOut_value3); - value = tempOut_value3.argValue; + value = tempOut_value3.get(); ResultAssert.TypeMismatch(r, "Json: {0}", json); } } @@ -2568,10 +2573,10 @@ private final static class RoundTripSparseOrdering extends TestActionDispatcher< private final static class RoundTripSparseSet extends TestActionDispatcher { @Override - public void Dispatch(tangible.RefObject row, tangible.RefObject root, + public void Dispatch(RefObject row, RefObject root, Closure closure) { LayoutColumn setCol = closure.SetCol; - azure.data.cosmos.serialization.hybridrow.layouts.LayoutType tempVar = setCol.getType(); + LayoutType tempVar = setCol.getType(); LayoutUniqueScope setT = tempVar instanceof LayoutUniqueScope ? (LayoutUniqueScope)tempVar : null; Expected expected = closure.Expected.clone(); String tag = String.format("Json: %1$s, Set: %2$s", expected.Json, setCol.getType().getName()); @@ -2585,15 +2590,15 @@ private final static class RoundTripSparseSet extends TestActionDispatcher tempRef_field = - new tangible.RefObject(field); + root.get().Clone(out field).Find(row, setCol.getPath()); + RefObject tempRef_field = + new RefObject(field); RowCursor scope; - tangible.OutObject tempOut_scope = - new tangible.OutObject(); + OutObject tempOut_scope = + new OutObject(); Result r = setT.ReadScope(row, tempRef_field, tempOut_scope); - scope = tempOut_scope.argValue; - field = tempRef_field.argValue; + scope = tempOut_scope.get(); + field = tempRef_field.get(); ResultAssert.NotFound(r, tag); // Write the Set. @@ -2621,7 +2626,7 @@ private final static class RoundTripSparseSet extends TestActionDispatcher tempRef_scope = - new tangible.RefObject(scope); - tangible.RefObject tempRef_tempCursor = - new tangible.RefObject(tempCursor); + RefObject tempRef_scope = + new RefObject(scope); + RefObject tempRef_tempCursor = + new RefObject(tempCursor); r = setT.MoveField(row, tempRef_scope, tempRef_tempCursor); - tempCursor = tempRef_tempCursor.argValue; - scope = tempRef_scope.argValue; + tempCursor = tempRef_tempCursor.get(); + scope = tempRef_scope.get(); ResultAssert.IsSuccess(r, tag); } @@ -2646,7 +2651,7 @@ private final static class RoundTripSparseSet extends TestActionDispatcher tempRef_scope2 = - new tangible.RefObject(scope); - tangible.RefObject tempRef_tempCursor2 = - new tangible.RefObject(tempCursor); + RefObject tempRef_scope2 = + new RefObject(scope); + RefObject tempRef_tempCursor2 = + new RefObject(tempCursor); r = setT.MoveField(row, tempRef_scope2, tempRef_tempCursor2, UpdateOptions.Insert); - tempCursor = tempRef_tempCursor2.argValue; - scope = tempRef_scope2.argValue; + tempCursor = tempRef_tempCursor2.get(); + scope = tempRef_scope2.get(); ResultAssert.Exists(r, tag); } // Read the Set and the nested column, validate the nested column has the proper value. - tangible.RefObject tempRef_field2 = - new tangible.RefObject(field); + RefObject tempRef_field2 = + new RefObject(field); RowCursor scope2; - tangible.OutObject tempOut_scope2 = - new tangible.OutObject(); + OutObject tempOut_scope2 = + new OutObject(); r = setT.ReadScope(row, tempRef_field2, tempOut_scope2); - scope2 = tempOut_scope2.argValue; - field = tempRef_field2.argValue; + scope2 = tempOut_scope2.get(); + field = tempRef_field2.get(); ResultAssert.IsSuccess(r, tag); Assert.AreEqual(scope.ScopeType, scope2.ScopeType, tag); Assert.AreEqual(scope.start, scope2.start, tag); Assert.AreEqual(scope.Immutable, scope2.Immutable, tag); // Read the nested fields - tangible.RefObject tempRef_field3 = - new tangible.RefObject(field); - tangible.OutObject tempOut_scope2 = - new tangible.OutObject(); + RefObject tempRef_field3 = + new RefObject(field); + OutObject tempOut_scope2 = + new OutObject(); ResultAssert.IsSuccess(setT.ReadScope(row, tempRef_field3, tempOut_scope2)); - scope = tempOut_scope2.argValue; - field = tempRef_field3.argValue; + scope = tempOut_scope2.get(); + field = tempRef_field3.get(); for (Object item : expected.Value) { assert scope.MoveNext(row); // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'out' keyword - these @@ -2706,13 +2711,13 @@ private final static class RoundTripSparseSet extends TestActionDispatcher tempRef_field4 = - new tangible.RefObject(field); - tangible.OutObject tempOut_scope3 = - new tangible.OutObject(); + RefObject tempRef_field4 = + new RefObject(field); + OutObject tempOut_scope3 = + new OutObject(); ResultAssert.IsSuccess(setT.ReadScope(row, tempRef_field4, tempOut_scope3)); - scope = tempOut_scope3.argValue; - field = tempRef_field4.argValue; + scope = tempOut_scope3.get(); + field = tempRef_field4.get(); for (int i = 0; i < expected.Value.size(); i++) { assert scope.MoveNext(row); // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'ref' keyword - these @@ -2722,20 +2727,20 @@ private final static class RoundTripSparseSet extends TestActionDispatcher tempRef_field5 = - new tangible.RefObject(field); - tangible.OutObject tempOut_scope4 = - new tangible.OutObject(); + RefObject tempRef_field5 = + new RefObject(field); + OutObject tempOut_scope4 = + new OutObject(); ResultAssert.IsSuccess(setT.ReadScope(row, tempRef_field5, tempOut_scope4)); - scope = tempOut_scope4.argValue; - field = tempRef_field5.argValue; + scope = tempOut_scope4.get(); + field = tempRef_field5.get(); for (int i = expected.Value.size() - 1; i >= 0; i--) { // Write the ith item into staging storage. RowCursor tempCursor; // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'out' keyword - these // cannot be converted using the 'OutObject' helper class unless the method is within the code being // modified: - root.argValue.Clone(out tempCursor).Find(row, Utf8String.Empty); + root.get().Clone(out tempCursor).Find(row, Utf8String.Empty); // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'ref' keyword - these // cannot be converted using the 'RefObject' helper class unless the method is within the code being // modified: @@ -2743,24 +2748,24 @@ private final static class RoundTripSparseSet extends TestActionDispatcher tempRef_scope3 = - new tangible.RefObject(scope); - tangible.RefObject tempRef_tempCursor3 = - new tangible.RefObject(tempCursor); + RefObject tempRef_scope3 = + new RefObject(scope); + RefObject tempRef_tempCursor3 = + new RefObject(tempCursor); r = setT.MoveField(row, tempRef_scope3, tempRef_tempCursor3); - tempCursor = tempRef_tempCursor3.argValue; - scope = tempRef_scope3.argValue; + tempCursor = tempRef_tempCursor3.get(); + scope = tempRef_scope3.get(); ResultAssert.IsSuccess(r, tag); } // Verify they still enumerate in sorted order. - tangible.RefObject tempRef_field6 = - new tangible.RefObject(field); - tangible.OutObject tempOut_scope5 = - new tangible.OutObject(); + RefObject tempRef_field6 = + new RefObject(field); + OutObject tempOut_scope5 = + new OutObject(); ResultAssert.IsSuccess(setT.ReadScope(row, tempRef_field6, tempOut_scope5)); - scope = tempOut_scope5.argValue; - field = tempRef_field6.argValue; + scope = tempOut_scope5.get(); + field = tempRef_field6.get(); for (Object item : expected.Value) { assert scope.MoveNext(row); // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'out' keyword - these @@ -2783,12 +2788,12 @@ private final static class RoundTripSparseSet extends TestActionDispatcher 1) { int indexToDelete = 1; - tangible.RefObject tempRef_field7 = - new tangible.RefObject(field); - tangible.OutObject tempOut_scope6 = new tangible.OutObject(); + RefObject tempRef_field7 = + new RefObject(field); + OutObject tempOut_scope6 = new OutObject(); ResultAssert.IsSuccess(setT.ReadScope(row, tempRef_field7, tempOut_scope6)); - scope = tempOut_scope6.argValue; - field = tempRef_field7.argValue; + scope = tempOut_scope6.get(); + field = tempRef_field7.get(); assert scope.MoveTo(row, indexToDelete); // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'ref' keyword - these cannot be converted using the 'RefObject' helper class unless the method is within the code being modified: r = t.DeleteSparse(row, ref scope); @@ -2796,11 +2801,11 @@ private final static class RoundTripSparseSet extends TestActionDispatcher remainingValues = new ArrayList(expected.Value); remainingValues.remove(indexToDelete); - tangible.RefObject tempRef_field8 = new tangible.RefObject(field); - tangible.OutObject tempOut_scope7 = new tangible.OutObject(); + RefObject tempRef_field8 = new RefObject(field); + OutObject tempOut_scope7 = new OutObject(); ResultAssert.IsSuccess(setT.ReadScope(row, tempRef_field8, tempOut_scope7)); - scope = tempOut_scope7.argValue; - field = tempRef_field8.argValue; + scope = tempOut_scope7.get(); + field = tempRef_field8.get(); for (Object item : remainingValues) { assert scope.MoveNext(row); // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'out' keyword - these cannot be converted using the 'OutObject' helper class unless the method is within the code being modified: @@ -2821,48 +2826,48 @@ private final static class RoundTripSparseSet extends TestActionDispatcher tempRef_roRoot = new tangible.RefObject(roRoot); + root.get().AsReadOnly(out roRoot).Find(row, setCol.getPath()); + RefObject tempRef_roRoot = new RefObject(roRoot); ResultAssert.InsufficientPermissions(setT.DeleteScope(row, tempRef_roRoot)); - roRoot = tempRef_roRoot.argValue; + roRoot = tempRef_roRoot.get(); // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'out' keyword - these cannot be converted using the 'OutObject' 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 cannot be converted using the 'RefObject' helper class unless the method is within the code being modified: ResultAssert.InsufficientPermissions(setT.WriteScope(row, ref roRoot, setCol.getTypeArgs().clone(), out _)); // Overwrite the whole scope. - tangible.RefObject tempRef_field9 = new tangible.RefObject(field); + RefObject tempRef_field9 = new RefObject(field); r = LayoutType.Null.WriteSparse(row, tempRef_field9, NullValue.Default); - field = tempRef_field9.argValue; + field = tempRef_field9.get(); ResultAssert.IsSuccess(r, tag); - tangible.RefObject tempRef_field10 = new tangible.RefObject(field); + RefObject tempRef_field10 = new RefObject(field); RowCursor _; - tangible.OutObject tempOut__ = new tangible.OutObject(); + OutObject tempOut__ = new OutObject(); r = setT.ReadScope(row, tempRef_field10, tempOut__); - _ = tempOut__.argValue; - field = tempRef_field10.argValue; + _ = tempOut__.get(); + field = tempRef_field10.get(); ResultAssert.TypeMismatch(r, tag); - tangible.RefObject tempRef_field11 = new tangible.RefObject(field); + RefObject tempRef_field11 = new RefObject(field); r = setT.DeleteScope(row, tempRef_field11); - field = tempRef_field11.argValue; + field = tempRef_field11.get(); ResultAssert.TypeMismatch(r, "Json: {0}", expected.Json); // Overwrite it again, then delete it. - tangible.RefObject tempRef_field12 = new tangible.RefObject(field); + RefObject tempRef_field12 = new RefObject(field); RowCursor _; // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'out' keyword - these cannot be converted using the 'OutObject' helper class unless the method is within the code being modified: r = setT.WriteScope(row, tempRef_field12, setCol.getTypeArgs().clone(), out _, UpdateOptions.Update); - field = tempRef_field12.argValue; + field = tempRef_field12.get(); ResultAssert.IsSuccess(r, "Json: {0}", expected.Json); - tangible.RefObject tempRef_field13 = new tangible.RefObject(field); + RefObject tempRef_field13 = new RefObject(field); r = setT.DeleteScope(row, tempRef_field13); - field = tempRef_field13.argValue; + field = tempRef_field13.get(); ResultAssert.IsSuccess(r, "Json: {0}", expected.Json); - tangible.RefObject tempRef_field14 = new tangible.RefObject(field); + RefObject tempRef_field14 = new RefObject(field); RowCursor _; - tangible.OutObject tempOut__2 = new tangible.OutObject(); + OutObject tempOut__2 = new OutObject(); r = setT.ReadScope(row, tempRef_field14, tempOut__2); - _ = tempOut__2.argValue; - field = tempRef_field14.argValue; + _ = tempOut__2.get(); + field = tempRef_field14.get(); ResultAssert.NotFound(r, "Json: {0}", expected.Json); } @@ -2905,7 +2910,7 @@ private final static class RoundTripSparseSet extends TestActionDispatcher { @Override - public void Dispatch(tangible.RefObject row, tangible.RefObject root, + public void Dispatch(RefObject row, RefObject root, Closure closure) { LayoutColumn col = closure.Col; Expected expected = closure.Expected.clone(); @@ -2915,7 +2920,7 @@ private final static class RoundTripSparseSimple extends TestActionDispatcher tempRef_field = - new tangible.RefObject(field); + RefObject tempRef_field = + new RefObject(field); r = LayoutType.Boolean.WriteSparse(row, tempRef_field, false); - field = tempRef_field.argValue; + field = tempRef_field.get(); ResultAssert.IsSuccess(r, "Json: {0}", expected.Json); // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'out' keyword - these // cannot be converted using the 'OutObject' helper class unless the method is within the code being @@ -2976,10 +2981,10 @@ private final static class RoundTripSparseSimple extends TestActionDispatcher tempRef_field2 = - new tangible.RefObject(field); + RefObject tempRef_field2 = + new RefObject(field); r = LayoutType.Null.WriteSparse(row, tempRef_field2, NullValue.Default); - field = tempRef_field2.argValue; + field = tempRef_field2.get(); ResultAssert.IsSuccess(r, "Json: {0}", expected.Json); // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'out' keyword - these // cannot be converted using the 'OutObject' helper class unless the method is within the code being @@ -3050,7 +3055,7 @@ private final static class RoundTripSparseSimple extends TestActionDispatcher { @Override - public void Dispatch(tangible.RefObject row, tangible.RefObject root, + public void Dispatch(RefObject row, RefObject root, Closure closure) { LayoutColumn col = closure.Col; Expected expected = closure.Expected.clone(); @@ -3060,13 +3065,13 @@ private static class RoundTripVariable extends TestActionDispatcherRoundTrip(row, root, col, expected.Value, expected.clone()); } - protected final , TValue> void Compare(tangible.RefObject row, - tangible.RefObject root, LayoutColumn col, Object exValue, Expected expected) { + protected final , TValue> void Compare(RefObject row, + RefObject root, LayoutColumn col, Object exValue, Expected expected) { TLayout t = (TLayout)col.getType(); TValue value; - tangible.OutObject tempOut_value = new tangible.OutObject(); + OutObject tempOut_value = new OutObject(); Result r = t.ReadVariable(row, root, col, tempOut_value); - value = tempOut_value.argValue; + value = tempOut_value.get(); ResultAssert.IsSuccess(r, "Json: {0}", expected.Json); boolean tempVar = exValue instanceof Array; Array array = tempVar ? (Array)exValue : null; @@ -3077,8 +3082,8 @@ private static class RoundTripVariable extends TestActionDispatcher, TValue> void RoundTrip(tangible.RefObject row, - tangible.RefObject root, LayoutColumn col, Object exValue, Expected expected) { + protected final , TValue> void RoundTrip(RefObject row, + RefObject root, LayoutColumn col, Object exValue, Expected expected) { TLayout t = (TLayout)col.getType(); Result r = t.WriteVariable(row, root, col, (TValue)exValue); ResultAssert.IsSuccess(r, "Json: {0}", expected.Json); @@ -3087,11 +3092,11 @@ private static class RoundTripVariable extends TestActionDispatcher tempRef_roRoot = - new tangible.RefObject(roRoot); + root.get().AsReadOnly(out roRoot); + RefObject tempRef_roRoot = + new RefObject(roRoot); ResultAssert.InsufficientPermissions(t.WriteVariable(row, tempRef_roRoot, col, (TValue)expected.Value)); - roRoot = tempRef_roRoot.argValue; + roRoot = tempRef_roRoot.get(); } //C# TO JAVA CONVERTER WARNING: Java does not allow user-defined value types. The behavior of this class may @@ -3138,16 +3143,16 @@ private static class RoundTripVariable extends TestActionDispatcher { - public abstract , TValue> void Dispatch(tangible.RefObject row, tangible.RefObject scope, TClosure closure); + public abstract , TValue> void Dispatch(RefObject row, RefObject scope, TClosure closure); - public void DispatchObject(tangible.RefObject row, tangible.RefObject scope, TClosure closure) { + public void DispatchObject(RefObject row, RefObject scope, TClosure closure) { Assert.Fail("not implemented"); } } private final static class VariableInterleaving extends RoundTripVariable { @Override - public void Dispatch(tangible.RefObject row, tangible.RefObject root, + public void Dispatch(RefObject row, RefObject root, Closure closure) { Layout layout = closure.Layout; Expected expected = closure.Expected.clone(); @@ -3163,16 +3168,16 @@ private final static class VariableInterleaving extends RoundTripVariable { this.RoundTrip(row, root, c, expected.Value, expected.clone()); // Make the var column shorter. - int rowSizeBeforeShrink = row.argValue.getLength(); + int rowSizeBeforeShrink = row.get().getLength(); this.RoundTrip(row, root, a, expected.Short, expected.clone()); this.Compare(row, root, c, expected.Value, expected.clone()); - int rowSizeAfterShrink = row.argValue.getLength(); + int rowSizeAfterShrink = row.get().getLength(); Assert.IsTrue(rowSizeAfterShrink < rowSizeBeforeShrink, "Json: {0}", expected.Json); // Make the var column longer. this.RoundTrip(row, root, a, expected.Long, expected.clone()); this.Compare(row, root, c, expected.Value, expected.clone()); - int rowSizeAfterGrow = row.argValue.getLength(); + int rowSizeAfterGrow = row.get().getLength(); Assert.IsTrue(rowSizeAfterGrow > rowSizeAfterShrink, "Json: {0}", expected.Json); Assert.IsTrue(rowSizeAfterGrow > rowSizeBeforeShrink, "Json: {0}", expected.Json); @@ -3187,35 +3192,35 @@ private final static class VariableInterleaving extends RoundTripVariable { this.Delete(row, root, a, expected.clone()); } - private , TValue> void Delete(tangible.RefObject row, - tangible.RefObject root, LayoutColumn col, Expected expected) { + private , TValue> void Delete(RefObject row, + RefObject root, LayoutColumn col, Expected expected) { TLayout t = (TLayout)col.getType(); RowCursor roRoot; // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'out' keyword - these // cannot be converted using the 'OutObject' helper class unless the method is within the code being modified: - root.argValue.AsReadOnly(out roRoot); - tangible.RefObject tempRef_roRoot = - new tangible.RefObject(roRoot); + root.get().AsReadOnly(out roRoot); + RefObject tempRef_roRoot = + new RefObject(roRoot); ResultAssert.InsufficientPermissions(t.DeleteVariable(row, tempRef_roRoot, col)); - roRoot = tempRef_roRoot.argValue; + roRoot = tempRef_roRoot.get(); Result r = t.DeleteVariable(row, root, col); ResultAssert.IsSuccess(r, "Json: {0}", expected.Json); TValue _; - tangible.OutObject tempOut__ = new tangible.OutObject(); + OutObject tempOut__ = new OutObject(); r = t.ReadVariable(row, root, col, tempOut__); - _ = tempOut__.argValue; + _ = tempOut__.get(); ResultAssert.NotFound(r, "Json: {0}", expected.Json); } - private , TValue> void TooBig(tangible.RefObject row, - tangible.RefObject root, LayoutColumn col, Expected expected) { + private , TValue> void TooBig(RefObject row, + RefObject root, LayoutColumn col, Expected expected) { TLayout t = (TLayout)col.getType(); Result r = t.WriteVariable(row, root, col, (TValue)expected.TooBig); Assert.AreEqual(Result.TooBig, r, "Json: {0}", expected.Json); } - private , TValue> LayoutColumn Verify(tangible.RefObject row, - tangible.RefObject root, Layout layout, String path, Expected expected) { + private , TValue> LayoutColumn Verify(RefObject row, + RefObject root, Layout layout, String path, Expected expected) { LayoutColumn col; // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'out' keyword - these // cannot be converted using the 'OutObject' helper class unless the method is within the code being modified: @@ -3224,9 +3229,9 @@ private final static class VariableInterleaving extends RoundTripVariable { assert col.Type.AllowVariable; TLayout t = (TLayout)col.Type; TValue _; - tangible.OutObject tempOut__ = new tangible.OutObject(); + OutObject tempOut__ = new OutObject(); Result r = t.ReadVariable(row, root, col, tempOut__); - _ = tempOut__.argValue; + _ = tempOut__.get(); ResultAssert.NotFound(r, "Json: {0}", expected.Json); return col; } diff --git a/jre/src/test/java/azure/data/cosmos/serialization/hybridrow/unit/LayoutTypeUnitTests.java b/jre/src/test/java/com/azure/data/cosmos/serialization/hybridrow/unit/LayoutTypeUnitTests.java similarity index 96% rename from jre/src/test/java/azure/data/cosmos/serialization/hybridrow/unit/LayoutTypeUnitTests.java rename to jre/src/test/java/com/azure/data/cosmos/serialization/hybridrow/unit/LayoutTypeUnitTests.java index d89b798..2275c15 100644 --- a/jre/src/test/java/azure/data/cosmos/serialization/hybridrow/unit/LayoutTypeUnitTests.java +++ b/jre/src/test/java/com/azure/data/cosmos/serialization/hybridrow/unit/LayoutTypeUnitTests.java @@ -2,7 +2,7 @@ // Copyright (c) Microsoft Corporation. All rights reserved. //------------------------------------------------------------ -package 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: //ORIGINAL LINE: [TestClass] public class LayoutTypeUnitTests diff --git a/jre/src/test/java/com/azure/data/cosmos/serialization/hybridrow/unit/NullRowDispatcher.java b/jre/src/test/java/com/azure/data/cosmos/serialization/hybridrow/unit/NullRowDispatcher.java new file mode 100644 index 0000000..b7e1a29 --- /dev/null +++ b/jre/src/test/java/com/azure/data/cosmos/serialization/hybridrow/unit/NullRowDispatcher.java @@ -0,0 +1,87 @@ +//------------------------------------------------------------ +// Copyright (c) Microsoft Corporation. All rights reserved. +//------------------------------------------------------------ + +package com.azure.data.cosmos.serialization.hybridrow.unit; + +import com.azure.data.cosmos.core.RefObject; +import com.azure.data.cosmos.serialization.hybridrow.RowBuffer; +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 +// from the original: +//ORIGINAL LINE: internal struct NullRowDispatcher : IDispatcher +public final class NullRowDispatcher implements IDispatcher { + + public , TValue> void Dispatch(RefObject dispatcher, RefObject root, LayoutColumn col, LayoutType t) { + Dispatch(dispatcher, root, col, t, null); + } + + //C# TO JAVA CONVERTER NOTE: Java does not support optional parameters. Overloaded method(s) are created above: + //ORIGINAL LINE: public void Dispatch(ref RowOperationDispatcher dispatcher, ref RowCursor root, + // LayoutColumn col, LayoutType t, TValue expected = default) where TLayout : LayoutType + public , TValue> void Dispatch(RefObject dispatcher, RefObject root, LayoutColumn col, LayoutType t, TValue expected) { + switch (col == null ? null : col.getStorage()) { + case Fixed: + RefObject tempRef_Row = + new RefObject(dispatcher.get().Row); + TValue _; + // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'out' keyword - + // these cannot be converted using the 'OutObject' helper class unless the method is within the code + // being modified: + ResultAssert.NotFound(t.TypeAs().ReadFixed(tempRef_Row, root, col, out _)); + dispatcher.get().argValue.Row = tempRef_Row.get(); + break; + case Variable: + RefObject tempRef_Row2 = + new RefObject(dispatcher.get().Row); + TValue _; + // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'out' keyword - + // these cannot be converted using the 'OutObject' helper class unless the method is within the code + // being modified: + ResultAssert.NotFound(t.TypeAs().ReadVariable(tempRef_Row2, root, col, out _)); + dispatcher.get().argValue.Row = tempRef_Row2.get(); + break; + default: + RefObject tempRef_Row3 = + new RefObject(dispatcher.get().Row); + TValue _; + // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'out' keyword - + // these cannot be converted using the 'OutObject' helper class unless the method is within the code + // being modified: + ResultAssert.NotFound(t.TypeAs().ReadSparse(tempRef_Row3, root, out _)); + dispatcher.get().argValue.Row = tempRef_Row3.get(); + break; + } + } + + public void DispatchArray(RefObject dispatcher, + RefObject scope, LayoutType t, TypeArgumentList typeArgs, + Object value) { + } + + public void DispatchMap(RefObject dispatcher, RefObject scope, LayoutType t, TypeArgumentList typeArgs, Object value) { + } + + public void DispatchNullable(RefObject dispatcher, + RefObject scope, LayoutType t, TypeArgumentList typeArgs, + Object value) { + } + + public void DispatchObject(RefObject dispatcher, + RefObject scope) { + } + + public void DispatchSet(RefObject dispatcher, + RefObject scope, LayoutType t, TypeArgumentList typeArgs, + Object value) { + } + + public void DispatchTuple(RefObject dispatcher, + RefObject scope, LayoutType t, TypeArgumentList typeArgs, + Object value) { + } + + public void DispatchUDT(RefObject dispatcher, RefObject scope, LayoutType t, TypeArgumentList typeArgs, Object value) { + } +} \ No newline at end of file diff --git a/jre/src/test/java/azure/data/cosmos/serialization/hybridrow/unit/NullableUnitTests.java b/jre/src/test/java/com/azure/data/cosmos/serialization/hybridrow/unit/NullableUnitTests.java similarity index 56% rename from jre/src/test/java/azure/data/cosmos/serialization/hybridrow/unit/NullableUnitTests.java rename to jre/src/test/java/com/azure/data/cosmos/serialization/hybridrow/unit/NullableUnitTests.java index 2ef2d71..80298df 100644 --- a/jre/src/test/java/azure/data/cosmos/serialization/hybridrow/unit/NullableUnitTests.java +++ b/jre/src/test/java/com/azure/data/cosmos/serialization/hybridrow/unit/NullableUnitTests.java @@ -2,12 +2,16 @@ // Copyright (c) Microsoft Corporation. All rights reserved. //------------------------------------------------------------ -package azure.data.cosmos.serialization.hybridrow.unit; +package com.azure.data.cosmos.serialization.hybridrow.unit; -import azure.data.cosmos.serialization.hybridrow.HybridRowVersion; -import azure.data.cosmos.serialization.hybridrow.Result; -import azure.data.cosmos.serialization.hybridrow.RowBuffer; -import azure.data.cosmos.serialization.hybridrow.RowCursor; +import com.azure.data.cosmos.core.OutObject; +import com.azure.data.cosmos.core.RefObject; +import com.azure.data.cosmos.serialization.hybridrow.HybridRowVersion; +import com.azure.data.cosmos.serialization.hybridrow.Result; +import com.azure.data.cosmos.serialization.hybridrow.RowBuffer; +import com.azure.data.cosmos.serialization.hybridrow.RowCursor; +import com.azure.data.cosmos.serialization.hybridrow.RowCursorExtensions; +import com.azure.data.cosmos.serialization.hybridrow.layouts.LayoutColumn; import java.nio.file.Files; import java.util.ArrayList; @@ -49,26 +53,26 @@ public final class NullableUnitTests { "-000000000000}"), 1), Map.entry(UUID.fromString("{4674962B-CE11-4916-81C5-0421EE36F168}"), 20), Map.entry(UUID.fromString("{7499C40E-7077-45C1-AE5F-3E384966B3B9}"), null))); - tangible.RefObject tempRef_row = - new tangible.RefObject(row); - tangible.RefObject tempRef_row2 = - new tangible.RefObject(row); + RefObject tempRef_row = + new RefObject(row); + RefObject tempRef_row2 = + new RefObject(row); RowCursor _; // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'out' keyword - these // cannot be converted using the 'OutObject' helper class unless the method is within the code being modified: this.WriteNullables(tempRef_row, RowCursor.Create(tempRef_row2, out _), t1); - row = tempRef_row2.argValue; - row = tempRef_row.argValue; - tangible.RefObject tempRef_row3 = - new tangible.RefObject(row); - tangible.RefObject tempRef_row4 = - new tangible.RefObject(row); + row = tempRef_row2.get(); + row = tempRef_row.get(); + RefObject tempRef_row3 = + new RefObject(row); + RefObject tempRef_row4 = + new RefObject(row); RowCursor _; // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'out' keyword - these // cannot be converted using the 'OutObject' helper class unless the method is within the code being modified: Nullables t2 = this.ReadNullables(tempRef_row3, RowCursor.Create(tempRef_row4, out _)); - row = tempRef_row4.argValue; - row = tempRef_row3.argValue; + row = tempRef_row4.get(); + row = tempRef_row3.get(); assert t1 == t2; } @@ -85,54 +89,54 @@ public final class NullableUnitTests { // TODO: C# TO JAVA CONVERTER: The C# 'struct' constraint has no equivalent in Java: //ORIGINAL LINE: private static Result ReadNullable(ref RowBuffer row, ref RowCursor scope, TypeArgument // itemType, out Nullable item, out RowCursor nullableScope) where TValue : struct - private static Result ReadNullable(tangible.RefObject row, - tangible.RefObject scope, TypeArgument itemType, - tangible.OutObject item, - tangible.OutObject nullableScope) { + private static Result ReadNullable(RefObject row, + RefObject scope, TypeArgument itemType, + OutObject item, + OutObject nullableScope) { TValue value; - tangible.OutObject tempOut_value = new tangible.OutObject(); + OutObject tempOut_value = new OutObject(); Result r = NullableUnitTests.ReadNullableImpl(row, scope, itemType.clone(), tempOut_value, nullableScope.clone()); - value = tempOut_value.argValue; + value = tempOut_value.get(); if ((r != Result.Success) && (r != Result.NotFound)) { - item.argValue = null; + item.set(null); return r; } - item.argValue = (r == Result.NotFound) ? null : value; + item.set((r == Result.NotFound) ? null : value); return Result.Success; } - private static Result ReadNullable(tangible.RefObject row, - tangible.RefObject scope, TypeArgument itemType, - tangible.OutObject item, - tangible.OutObject nullableScope) { + private static Result ReadNullable(RefObject row, + RefObject scope, TypeArgument itemType, + OutObject item, + OutObject nullableScope) { Result r = NullableUnitTests.ReadNullableImpl(row, scope, itemType.clone(), item, nullableScope.clone()); return (r == Result.NotFound) ? Result.Success : r; } - private static Result ReadNullableImpl(tangible.RefObject row, - tangible.RefObject scope, TypeArgument itemType, - tangible.OutObject item, - tangible.OutObject nullableScope) { + private static Result ReadNullableImpl(RefObject row, + RefObject scope, TypeArgument itemType, + OutObject item, + OutObject nullableScope) { Result r = itemType.getType().TypeAs().ReadScope(row, scope, nullableScope.clone()); if (r != Result.Success) { - item.argValue = null; + item.set(null); return r; } - if (Microsoft.Azure.Cosmos.Serialization.HybridRow.RowCursorExtensions.MoveNext(nullableScope.argValue.clone(), row)) { + if (RowCursorExtensions.MoveNext(nullableScope.get().clone(), row)) { ResultAssert.IsSuccess(LayoutNullable.HasValue(row, nullableScope.clone())); return itemType.getTypeArgs().get(0).getType().>TypeAs().ReadSparse(row, nullableScope.clone(), item); } ResultAssert.NotFound(LayoutNullable.HasValue(row, nullableScope.clone())); - item.argValue = null; + item.set(null); return Result.NotFound; } - private Nullables ReadNullables(tangible.RefObject row, tangible.RefObject root) { + private Nullables ReadNullables(RefObject row, RefObject root) { Nullables value = new Nullables(); LayoutColumn c; @@ -142,7 +146,7 @@ public final class NullableUnitTests { RowCursor scope; // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'out' keyword - these // cannot be converted using the 'OutObject' helper class unless the method is within the code being modified: - root.argValue.Clone(out scope).Find(row, c.Path); + root.get().Clone(out scope).Find(row, c.Path); // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'out' keyword - these // cannot be converted using the 'OutObject' 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 @@ -150,24 +154,24 @@ public final class NullableUnitTests { if (c.TypeAs().ReadScope(row, ref scope, out scope) == Result.Success) { value.NullBool = new ArrayList(); RowCursor nullableScope = null; - tangible.RefObject tempRef_nullableScope = - new tangible.RefObject(nullableScope); + RefObject tempRef_nullableScope = + new RefObject(nullableScope); while (scope.MoveNext(row, tempRef_nullableScope)) { - nullableScope = tempRef_nullableScope.argValue; - tangible.RefObject tempRef_scope = - new tangible.RefObject(scope); + nullableScope = tempRef_nullableScope.get(); + RefObject tempRef_scope = + new RefObject(scope); Nullable item; - tangible.OutObject tempOut_item = new tangible.OutObject(); - tangible.OutObject tempOut_nullableScope = - new tangible.OutObject(); + OutObject tempOut_item = new OutObject(); + OutObject tempOut_nullableScope = + new OutObject(); ResultAssert.IsSuccess(NullableUnitTests.ReadNullable(row, tempRef_scope, c.TypeArgs[0], tempOut_item , tempOut_nullableScope)); - nullableScope = tempOut_nullableScope.argValue; - item = tempOut_item.argValue; - scope = tempRef_scope.argValue; + nullableScope = tempOut_nullableScope.get(); + item = tempOut_item.get(); + scope = tempRef_scope.get(); value.NullBool.add(item); } - nullableScope = tempRef_nullableScope.argValue; + nullableScope = tempRef_nullableScope.get(); } // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'out' keyword - these @@ -175,7 +179,7 @@ public final class NullableUnitTests { assert this.layout.TryFind("nullarray", out c); // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'out' keyword - these // cannot be converted using the 'OutObject' helper class unless the method is within the code being modified: - root.argValue.Clone(out scope).Find(row, c.Path); + root.get().Clone(out scope).Find(row, c.Path); // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'out' keyword - these // cannot be converted using the 'OutObject' 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 @@ -183,24 +187,24 @@ public final class NullableUnitTests { if (c.TypeAs().ReadScope(row, ref scope, out scope) == Result.Success) { value.NullArray = new ArrayList(); RowCursor nullableScope = null; - tangible.RefObject tempRef_nullableScope2 = - new tangible.RefObject(nullableScope); + RefObject tempRef_nullableScope2 = + new RefObject(nullableScope); while (scope.MoveNext(row, tempRef_nullableScope2)) { - nullableScope = tempRef_nullableScope2.argValue; - tangible.RefObject tempRef_scope2 = - new tangible.RefObject(scope); + nullableScope = tempRef_nullableScope2.get(); + RefObject tempRef_scope2 = + new RefObject(scope); Nullable item; - tangible.OutObject tempOut_item2 = new tangible.OutObject(); - tangible.OutObject tempOut_nullableScope2 = - new tangible.OutObject(); + OutObject tempOut_item2 = new OutObject(); + OutObject tempOut_nullableScope2 = + new OutObject(); ResultAssert.IsSuccess(NullableUnitTests.ReadNullable(row, tempRef_scope2, c.TypeArgs[0], tempOut_item2, tempOut_nullableScope2)); - nullableScope = tempOut_nullableScope2.argValue; - item = tempOut_item2.argValue; - scope = tempRef_scope2.argValue; + nullableScope = tempOut_nullableScope2.get(); + item = tempOut_item2.get(); + scope = tempRef_scope2.get(); value.NullArray.add(item); } - nullableScope = tempRef_nullableScope2.argValue; + nullableScope = tempRef_nullableScope2.get(); } // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'out' keyword - these @@ -208,7 +212,7 @@ public final class NullableUnitTests { assert this.layout.TryFind("nullset", out c); // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'out' keyword - these // cannot be converted using the 'OutObject' helper class unless the method is within the code being modified: - root.argValue.Clone(out scope).Find(row, c.Path); + root.get().Clone(out scope).Find(row, c.Path); // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'out' keyword - these // cannot be converted using the 'OutObject' 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 @@ -216,24 +220,24 @@ public final class NullableUnitTests { if (c.TypeAs().ReadScope(row, ref scope, out scope) == Result.Success) { value.NullSet = new ArrayList(); RowCursor nullableScope = null; - tangible.RefObject tempRef_nullableScope3 = - new tangible.RefObject(nullableScope); + RefObject tempRef_nullableScope3 = + new RefObject(nullableScope); while (scope.MoveNext(row, tempRef_nullableScope3)) { - nullableScope = tempRef_nullableScope3.argValue; - tangible.RefObject tempRef_scope3 = - new tangible.RefObject(scope); + nullableScope = tempRef_nullableScope3.get(); + RefObject tempRef_scope3 = + new RefObject(scope); String item; - tangible.OutObject tempOut_item3 = new tangible.OutObject(); - tangible.OutObject tempOut_nullableScope3 = - new tangible.OutObject(); + OutObject tempOut_item3 = new OutObject(); + OutObject tempOut_nullableScope3 = + new OutObject(); ResultAssert.IsSuccess(NullableUnitTests.ReadNullable(row, tempRef_scope3, c.TypeArgs[0], tempOut_item3, tempOut_nullableScope3)); - nullableScope = tempOut_nullableScope3.argValue; - item = tempOut_item3.argValue; - scope = tempRef_scope3.argValue; + nullableScope = tempOut_nullableScope3.get(); + item = tempOut_item3.get(); + scope = tempRef_scope3.get(); value.NullSet.add(item); } - nullableScope = tempRef_nullableScope3.argValue; + nullableScope = tempRef_nullableScope3.get(); } // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'out' keyword - these @@ -241,7 +245,7 @@ public final class NullableUnitTests { assert this.layout.TryFind("nulltuple", out c); // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'out' keyword - these // cannot be converted using the 'OutObject' helper class unless the method is within the code being modified: - root.argValue.Clone(out scope).Find(row, c.Path); + root.get().Clone(out scope).Find(row, c.Path); // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'out' keyword - these // cannot be converted using the 'OutObject' 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 @@ -250,57 +254,57 @@ public final class NullableUnitTests { value.NullTuple = new ArrayList<(Integer, Long) > (); RowCursor tupleScope = null; TypeArgument tupleType = c.TypeArgs[0]; - tangible.RefObject tempRef_tupleScope = - new tangible.RefObject(tupleScope); + RefObject tempRef_tupleScope = + new RefObject(tupleScope); while (scope.MoveNext(row, tempRef_tupleScope)) { - tupleScope = tempRef_tupleScope.argValue; - tangible.RefObject tempRef_scope4 = - new tangible.RefObject(scope); - tangible.OutObject tempOut_tupleScope = - new tangible.OutObject(); + tupleScope = tempRef_tupleScope.get(); + RefObject tempRef_scope4 = + new RefObject(scope); + OutObject tempOut_tupleScope = + new OutObject(); ResultAssert.IsSuccess(tupleType.TypeAs().ReadScope(row, tempRef_scope4, tempOut_tupleScope)); - tupleScope = tempOut_tupleScope.argValue; - scope = tempRef_scope4.argValue; + tupleScope = tempOut_tupleScope.get(); + scope = tempRef_scope4.get(); - assert Microsoft.Azure.Cosmos.Serialization.HybridRow.RowCursorExtensions.MoveNext(tupleScope.clone() + assert RowCursorExtensions.MoveNext(tupleScope.clone() , row); - tangible.RefObject tempRef_tupleScope2 = - new tangible.RefObject(tupleScope); + RefObject tempRef_tupleScope2 = + new RefObject(tupleScope); Nullable item1; - tangible.OutObject tempOut_item1 = new tangible.OutObject(); + OutObject tempOut_item1 = new OutObject(); RowCursor nullableScope; - tangible.OutObject tempOut_nullableScope4 = - new tangible.OutObject(); + OutObject tempOut_nullableScope4 = + new OutObject(); ResultAssert.IsSuccess(NullableUnitTests.ReadNullable(row, tempRef_tupleScope2, tupleType.getTypeArgs().get(0).clone(), tempOut_item1, tempOut_nullableScope4)); - nullableScope = tempOut_nullableScope4.argValue; - item1 = tempOut_item1.argValue; - tupleScope = tempRef_tupleScope2.argValue; - tangible.RefObject tempRef_nullableScope4 = - new tangible.RefObject(nullableScope); - assert Microsoft.Azure.Cosmos.Serialization.HybridRow.RowCursorExtensions.MoveNext(tupleScope.clone() + nullableScope = tempOut_nullableScope4.get(); + item1 = tempOut_item1.get(); + tupleScope = tempRef_tupleScope2.get(); + RefObject tempRef_nullableScope4 = + new RefObject(nullableScope); + assert RowCursorExtensions.MoveNext(tupleScope.clone() , row, tempRef_nullableScope4); - nullableScope = tempRef_nullableScope4.argValue; - tangible.RefObject tempRef_tupleScope3 = - new tangible.RefObject(tupleScope); + nullableScope = tempRef_nullableScope4.get(); + RefObject tempRef_tupleScope3 = + new RefObject(tupleScope); Nullable item2; - tangible.OutObject tempOut_item2 = new tangible.OutObject(); - tangible.OutObject tempOut_nullableScope5 = - new tangible.OutObject(); + OutObject tempOut_item2 = new OutObject(); + OutObject tempOut_nullableScope5 = + new OutObject(); ResultAssert.IsSuccess(NullableUnitTests.ReadNullable(row, tempRef_tupleScope3, tupleType.getTypeArgs().get(1).clone(), tempOut_item2, tempOut_nullableScope5)); - nullableScope = tempOut_nullableScope5.argValue; - item2 = tempOut_item2.argValue; - tupleScope = tempRef_tupleScope3.argValue; + nullableScope = tempOut_nullableScope5.get(); + item2 = tempOut_item2.get(); + tupleScope = tempRef_tupleScope3.get(); - tangible.RefObject tempRef_nullableScope5 = - new tangible.RefObject(nullableScope); - assert !Microsoft.Azure.Cosmos.Serialization.HybridRow.RowCursorExtensions.MoveNext(tupleScope.clone(), row, tempRef_nullableScope5); - nullableScope = tempRef_nullableScope5.argValue; + RefObject tempRef_nullableScope5 = + new RefObject(nullableScope); + assert !RowCursorExtensions.MoveNext(tupleScope.clone(), row, tempRef_nullableScope5); + nullableScope = tempRef_nullableScope5.get(); value.NullTuple.add((item1, item2)) } - tupleScope = tempRef_tupleScope.argValue; + tupleScope = tempRef_tupleScope.get(); } // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'out' keyword - these @@ -308,7 +312,7 @@ public final class NullableUnitTests { assert this.layout.TryFind("nullmap", out c); // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'out' keyword - these // cannot be converted using the 'OutObject' helper class unless the method is within the code being modified: - root.argValue.Clone(out scope).Find(row, c.Path); + root.get().Clone(out scope).Find(row, c.Path); // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'out' keyword - these // cannot be converted using the 'OutObject' 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 @@ -322,58 +326,58 @@ public final class NullableUnitTests { // cannot be converted using the 'RefObject' helper class unless the method is within the code being // modified: TypeArgument tupleType = c.TypeAs().FieldType(ref scope); - tangible.RefObject tempRef_tupleScope4 = - new tangible.RefObject(tupleScope); + RefObject tempRef_tupleScope4 = + new RefObject(tupleScope); while (scope.MoveNext(row, tempRef_tupleScope4)) { - tupleScope = tempRef_tupleScope4.argValue; - tangible.RefObject tempRef_scope5 = - new tangible.RefObject(scope); - tangible.OutObject tempOut_tupleScope2 = - new tangible.OutObject(); + tupleScope = tempRef_tupleScope4.get(); + RefObject tempRef_scope5 = + new RefObject(scope); + OutObject tempOut_tupleScope2 = + new OutObject(); ResultAssert.IsSuccess(tupleType.TypeAs().ReadScope(row, tempRef_scope5, tempOut_tupleScope2)); - tupleScope = tempOut_tupleScope2.argValue; - scope = tempRef_scope5.argValue; + tupleScope = tempOut_tupleScope2.get(); + scope = tempRef_scope5.get(); - assert Microsoft.Azure.Cosmos.Serialization.HybridRow.RowCursorExtensions.MoveNext(tupleScope.clone() + assert RowCursorExtensions.MoveNext(tupleScope.clone() , row); - tangible.RefObject tempRef_tupleScope5 = - new tangible.RefObject(tupleScope); + RefObject tempRef_tupleScope5 = + new RefObject(tupleScope); Nullable itemKey; - tangible.OutObject tempOut_itemKey = new tangible.OutObject(); + OutObject tempOut_itemKey = new OutObject(); RowCursor nullableScope; - tangible.OutObject tempOut_nullableScope6 = - new tangible.OutObject(); + OutObject tempOut_nullableScope6 = + new OutObject(); ResultAssert.IsSuccess(NullableUnitTests.ReadNullable(row, tempRef_tupleScope5, tupleType.getTypeArgs().get(0).clone(), tempOut_itemKey, tempOut_nullableScope6)); - nullableScope = tempOut_nullableScope6.argValue; - itemKey = tempOut_itemKey.argValue; - tupleScope = tempRef_tupleScope5.argValue; + nullableScope = tempOut_nullableScope6.get(); + itemKey = tempOut_itemKey.get(); + tupleScope = tempRef_tupleScope5.get(); - tangible.RefObject tempRef_nullableScope6 = - new tangible.RefObject(nullableScope); - assert Microsoft.Azure.Cosmos.Serialization.HybridRow.RowCursorExtensions.MoveNext(tupleScope.clone() + RefObject tempRef_nullableScope6 = + new RefObject(nullableScope); + assert RowCursorExtensions.MoveNext(tupleScope.clone() , row, tempRef_nullableScope6); - nullableScope = tempRef_nullableScope6.argValue; - tangible.RefObject tempRef_tupleScope6 = - new tangible.RefObject(tupleScope); + nullableScope = tempRef_nullableScope6.get(); + RefObject tempRef_tupleScope6 = + new RefObject(tupleScope); Nullable itemValue; - tangible.OutObject tempOut_itemValue = new tangible.OutObject(); - tangible.OutObject tempOut_nullableScope7 = - new tangible.OutObject(); + OutObject tempOut_itemValue = new OutObject(); + OutObject tempOut_nullableScope7 = + new OutObject(); ResultAssert.IsSuccess(NullableUnitTests.ReadNullable(row, tempRef_tupleScope6, tupleType.getTypeArgs().get(1).clone(), tempOut_itemValue, tempOut_nullableScope7)); - nullableScope = tempOut_nullableScope7.argValue; - itemValue = tempOut_itemValue.argValue; - tupleScope = tempRef_tupleScope6.argValue; + nullableScope = tempOut_nullableScope7.get(); + itemValue = tempOut_itemValue.get(); + tupleScope = tempRef_tupleScope6.get(); - tangible.RefObject tempRef_nullableScope7 = - new tangible.RefObject(nullableScope); - assert !Microsoft.Azure.Cosmos.Serialization.HybridRow.RowCursorExtensions.MoveNext(tupleScope.clone(), row, tempRef_nullableScope7); - nullableScope = tempRef_nullableScope7.argValue; + RefObject tempRef_nullableScope7 = + new RefObject(nullableScope); + assert !RowCursorExtensions.MoveNext(tupleScope.clone(), row, tempRef_nullableScope7); + nullableScope = tempRef_nullableScope7.get(); value.NullMap.put(itemKey != null ? itemKey : UUID.Empty, itemValue); } - tupleScope = tempRef_tupleScope4.argValue; + tupleScope = tempRef_tupleScope4.get(); } return value; @@ -382,24 +386,24 @@ public final class NullableUnitTests { // TODO: C# TO JAVA CONVERTER: The C# 'struct' constraint has no equivalent in Java: //ORIGINAL LINE: private static Result WriteNullable(ref RowBuffer row, ref RowCursor scope, TypeArgument // itemType, Nullable item, out RowCursor nullableScope) where TValue : struct - private static Result WriteNullable(tangible.RefObject row, - tangible.RefObject scope, TypeArgument itemType, - TValue item, tangible.OutObject nullableScope) { + private static Result WriteNullable(RefObject row, + RefObject scope, TypeArgument itemType, + TValue item, OutObject nullableScope) { return NullableUnitTests.WriteNullableImpl(row, scope, itemType.clone(), item != null, item != null ? item : default,nullableScope.clone()) } - private static Result WriteNullable(tangible.RefObject row, - tangible.RefObject scope, TypeArgument itemType, - TValue item, tangible.OutObject nullableScope) { + private static Result WriteNullable(RefObject row, + RefObject scope, TypeArgument itemType, + TValue item, OutObject nullableScope) { return NullableUnitTests.WriteNullableImpl(row, scope, itemType.clone(), item != null, item, nullableScope.clone()); } - private static Result WriteNullableImpl(tangible.RefObject row, - tangible.RefObject scope, TypeArgument itemType, + private static Result WriteNullableImpl(RefObject row, + RefObject scope, TypeArgument itemType, boolean hasValue, TValue item, - tangible.OutObject nullableScope) { + OutObject nullableScope) { Result r = itemType.TypeAs().WriteScope(row, scope, itemType.getTypeArgs().clone(), hasValue, nullableScope); @@ -416,38 +420,38 @@ public final class NullableUnitTests { return Result.Success; } - private void WriteNullables(tangible.RefObject row, tangible.RefObject root, + private void WriteNullables(RefObject row, RefObject root, Nullables value) { LayoutColumn c; if (value.NullBool != null) { - tangible.OutObject tempOut_c = - new tangible.OutObject(); + OutObject tempOut_c = + new OutObject(); assert this.layout.TryFind("nullbool", tempOut_c); - c = tempOut_c.argValue; + c = tempOut_c.get(); RowCursor outerScope; // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'out' keyword - these // cannot be converted using the 'OutObject' helper class unless the method is within the code being // modified: - root.argValue.Clone(out outerScope).Find(row, c.getPath()); - tangible.RefObject tempRef_outerScope = - new tangible.RefObject(outerScope); - tangible.OutObject tempOut_outerScope = - new tangible.OutObject(); + root.get().Clone(out outerScope).Find(row, c.getPath()); + RefObject tempRef_outerScope = + new RefObject(outerScope); + OutObject tempOut_outerScope = + new OutObject(); ResultAssert.IsSuccess(c.TypeAs().WriteScope(row, tempRef_outerScope, c.getTypeArgs().clone(), tempOut_outerScope)); - outerScope = tempOut_outerScope.argValue; - outerScope = tempRef_outerScope.argValue; + outerScope = tempOut_outerScope.get(); + outerScope = tempRef_outerScope.get(); for (Boolean item : value.NullBool) { - tangible.RefObject tempRef_outerScope2 = - new tangible.RefObject(outerScope); + RefObject tempRef_outerScope2 = + new RefObject(outerScope); RowCursor innerScope; - tangible.OutObject tempOut_innerScope = - new tangible.OutObject(); + OutObject tempOut_innerScope = + new OutObject(); ResultAssert.IsSuccess(NullableUnitTests.WriteNullable(row, tempRef_outerScope2, c.getTypeArgs().get(0).clone(), item, tempOut_innerScope)); - innerScope = tempOut_innerScope.argValue; - outerScope = tempRef_outerScope2.argValue; + innerScope = tempOut_innerScope.get(); + outerScope = tempRef_outerScope2.get(); // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'ref' keyword - // these cannot be converted using the 'RefObject' helper class unless the method is within the code // being modified: @@ -456,33 +460,33 @@ public final class NullableUnitTests { } if (value.NullArray != null) { - tangible.OutObject tempOut_c2 = - new tangible.OutObject(); + OutObject tempOut_c2 = + new OutObject(); assert this.layout.TryFind("nullarray", tempOut_c2); - c = tempOut_c2.argValue; + c = tempOut_c2.get(); RowCursor outerScope; // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'out' keyword - these // cannot be converted using the 'OutObject' helper class unless the method is within the code being // modified: - root.argValue.Clone(out outerScope).Find(row, c.getPath()); - tangible.RefObject tempRef_outerScope3 = - new tangible.RefObject(outerScope); - tangible.OutObject tempOut_outerScope2 = - new tangible.OutObject(); + root.get().Clone(out outerScope).Find(row, c.getPath()); + RefObject tempRef_outerScope3 = + new RefObject(outerScope); + OutObject tempOut_outerScope2 = + new OutObject(); ResultAssert.IsSuccess(c.TypeAs().WriteScope(row, tempRef_outerScope3, c.getTypeArgs().clone(), tempOut_outerScope2)); - outerScope = tempOut_outerScope2.argValue; - outerScope = tempRef_outerScope3.argValue; + outerScope = tempOut_outerScope2.get(); + outerScope = tempRef_outerScope3.get(); for (Float item : value.NullArray) { - tangible.RefObject tempRef_outerScope4 = - new tangible.RefObject(outerScope); + RefObject tempRef_outerScope4 = + new RefObject(outerScope); RowCursor innerScope; - tangible.OutObject tempOut_innerScope2 = - new tangible.OutObject(); + OutObject tempOut_innerScope2 = + new OutObject(); ResultAssert.IsSuccess(NullableUnitTests.WriteNullable(row, tempRef_outerScope4, c.getTypeArgs().get(0).clone(), item, tempOut_innerScope2)); - innerScope = tempOut_innerScope2.argValue; - outerScope = tempRef_outerScope4.argValue; + innerScope = tempOut_innerScope2.get(); + outerScope = tempRef_outerScope4.get(); // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'ref' keyword - // these cannot be converted using the 'RefObject' helper class unless the method is within the code // being modified: @@ -491,66 +495,66 @@ public final class NullableUnitTests { } if (value.NullSet != null) { - tangible.OutObject tempOut_c3 = - new tangible.OutObject(); + OutObject tempOut_c3 = + new OutObject(); assert this.layout.TryFind("nullset", tempOut_c3); - c = tempOut_c3.argValue; + c = tempOut_c3.get(); RowCursor outerScope; // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'out' keyword - these // cannot be converted using the 'OutObject' helper class unless the method is within the code being // modified: - root.argValue.Clone(out outerScope).Find(row, c.getPath()); - tangible.RefObject tempRef_outerScope5 = - new tangible.RefObject(outerScope); - tangible.OutObject tempOut_outerScope3 = - new tangible.OutObject(); + root.get().Clone(out outerScope).Find(row, c.getPath()); + RefObject tempRef_outerScope5 = + new RefObject(outerScope); + OutObject tempOut_outerScope3 = + new OutObject(); ResultAssert.IsSuccess(c.TypeAs().WriteScope(row, tempRef_outerScope5, c.getTypeArgs().clone(), tempOut_outerScope3)); - outerScope = tempOut_outerScope3.argValue; - outerScope = tempRef_outerScope5.argValue; + outerScope = tempOut_outerScope3.get(); + outerScope = tempRef_outerScope5.get(); for (String item : value.NullSet) { RowCursor temp; // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'out' keyword - // these cannot be converted using the 'OutObject' helper class unless the method is within the code // being modified: RowCursor.CreateForAppend(row, out temp).Find(row, ""); - tangible.RefObject tempRef_temp = - new tangible.RefObject(temp); + RefObject tempRef_temp = + new RefObject(temp); RowCursor _; - tangible.OutObject tempOut__ = - new tangible.OutObject(); + OutObject tempOut__ = + new OutObject(); ResultAssert.IsSuccess(NullableUnitTests.WriteNullable(row, tempRef_temp, c.getTypeArgs().get(0).clone(), item, tempOut__)); - _ = tempOut__.argValue; - temp = tempRef_temp.argValue; - tangible.RefObject tempRef_outerScope6 = - new tangible.RefObject(outerScope); - tangible.RefObject tempRef_temp2 = - new tangible.RefObject(temp); + _ = tempOut__.get(); + temp = tempRef_temp.get(); + RefObject tempRef_outerScope6 = + new RefObject(outerScope); + RefObject tempRef_temp2 = + new RefObject(temp); ResultAssert.IsSuccess(c.TypeAs().MoveField(row, tempRef_outerScope6, tempRef_temp2)); - temp = tempRef_temp2.argValue; - outerScope = tempRef_outerScope6.argValue; + temp = tempRef_temp2.get(); + outerScope = tempRef_outerScope6.get(); } } if (value.NullTuple != null) { - tangible.OutObject tempOut_c4 = - new tangible.OutObject(); + OutObject tempOut_c4 = + new OutObject(); assert this.layout.TryFind("nulltuple", tempOut_c4); - c = tempOut_c4.argValue; + c = tempOut_c4.get(); RowCursor outerScope; // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'out' keyword - these // cannot be converted using the 'OutObject' helper class unless the method is within the code being // modified: - root.argValue.Clone(out outerScope).Find(row, c.getPath()); - tangible.RefObject tempRef_outerScope7 = - new tangible.RefObject(outerScope); - tangible.OutObject tempOut_outerScope4 = - new tangible.OutObject(); + root.get().Clone(out outerScope).Find(row, c.getPath()); + RefObject tempRef_outerScope7 = + new RefObject(outerScope); + OutObject tempOut_outerScope4 = + new OutObject(); ResultAssert.IsSuccess(c.TypeAs().WriteScope(row, tempRef_outerScope7, c.getTypeArgs().clone(), tempOut_outerScope4)); - outerScope = tempOut_outerScope4.argValue; - outerScope = tempRef_outerScope7.argValue; + outerScope = tempOut_outerScope4.get(); + outerScope = tempRef_outerScope7.get(); for ((Integer item1,Long item2) :value.NullTuple) { TypeArgument tupleType = c.getTypeArgs().get(0).clone(); @@ -564,28 +568,28 @@ public final class NullableUnitTests { ResultAssert.IsSuccess(tupleType.TypeAs().WriteScope(row, ref outerScope, tupleType.getTypeArgs().clone(), out tupleScope)); - tangible.RefObject tempRef_tupleScope = - new tangible.RefObject(tupleScope); + RefObject tempRef_tupleScope = + new RefObject(tupleScope); RowCursor nullableScope; - tangible.OutObject tempOut_nullableScope = - new tangible.OutObject(); + OutObject tempOut_nullableScope = + new OutObject(); ResultAssert.IsSuccess(NullableUnitTests.WriteNullable(row, tempRef_tupleScope, tupleType.getTypeArgs().get(0).clone(), item1, tempOut_nullableScope)); - nullableScope = tempOut_nullableScope.argValue; - tupleScope = tempRef_tupleScope.argValue; + nullableScope = tempOut_nullableScope.get(); + tupleScope = tempRef_tupleScope.get(); // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'ref' keyword - // these cannot be converted using the 'RefObject' helper class unless the method is within the code // being modified: assert tupleScope.MoveNext(row, ref nullableScope); - tangible.RefObject tempRef_tupleScope2 = - new tangible.RefObject(tupleScope); - tangible.OutObject tempOut_nullableScope2 = - new tangible.OutObject(); + RefObject tempRef_tupleScope2 = + new RefObject(tupleScope); + OutObject tempOut_nullableScope2 = + new OutObject(); ResultAssert.IsSuccess(NullableUnitTests.WriteNullable(row, tempRef_tupleScope2, tupleType.getTypeArgs().get(1).clone(), item2, tempOut_nullableScope2)); - nullableScope = tempOut_nullableScope2.argValue; - tupleScope = tempRef_tupleScope2.argValue; + nullableScope = tempOut_nullableScope2.get(); + tupleScope = tempRef_tupleScope2.get(); // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'ref' keyword - // these cannot be converted using the 'RefObject' helper class unless the method is within the code // being modified: @@ -599,15 +603,15 @@ public final class NullableUnitTests { } if (value.NullMap != null) { - tangible.OutObject tempOut_c5 = - new tangible.OutObject(); + OutObject tempOut_c5 = + new OutObject(); assert this.layout.TryFind("nullmap", tempOut_c5); - c = tempOut_c5.argValue; + c = tempOut_c5.get(); RowCursor outerScope; // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'out' keyword - these // cannot be converted using the 'OutObject' helper class unless the method is within the code being // modified: - root.argValue.Clone(out outerScope).Find(row, c.getPath()); + root.get().Clone(out outerScope).Find(row, c.getPath()); // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'out' keyword - these // cannot be converted using the 'OutObject' helper class unless the method is within the code being // modified: @@ -620,10 +624,10 @@ public final class NullableUnitTests { //ORIGINAL LINE: foreach ((Guid key, Nullable itemValue) in value.NullMap) for ((UUID key,Byte itemValue) :value.NullMap) { - tangible.RefObject tempRef_outerScope8 = - new tangible.RefObject(outerScope); + RefObject tempRef_outerScope8 = + new RefObject(outerScope); TypeArgument tupleType = c.TypeAs().FieldType(tempRef_outerScope8).clone(); - outerScope = tempRef_outerScope8.argValue; + outerScope = tempRef_outerScope8.get(); RowCursor temp; // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'out' keyword - // these cannot be converted using the 'OutObject' helper class unless the method is within the code @@ -640,42 +644,42 @@ public final class NullableUnitTests { tupleType.getTypeArgs().clone(), out tupleScope)); UUID itemKey = key.equals(UUID.Empty) ? null : key; - tangible.RefObject tempRef_tupleScope3 = - new tangible.RefObject(tupleScope); + RefObject tempRef_tupleScope3 = + new RefObject(tupleScope); RowCursor nullableScope; - tangible.OutObject tempOut_nullableScope3 = - new tangible.OutObject(); + OutObject tempOut_nullableScope3 = + new OutObject(); ResultAssert.IsSuccess(NullableUnitTests.WriteNullable(row, tempRef_tupleScope3, tupleType.getTypeArgs().get(0).clone(), itemKey, tempOut_nullableScope3)); - nullableScope = tempOut_nullableScope3.argValue; - tupleScope = tempRef_tupleScope3.argValue; + nullableScope = tempOut_nullableScope3.get(); + tupleScope = tempRef_tupleScope3.get(); // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'ref' keyword - // these cannot be converted using the 'RefObject' helper class unless the method is within the code // being modified: assert tupleScope.MoveNext(row, ref nullableScope); - tangible.RefObject tempRef_tupleScope4 = - new tangible.RefObject(tupleScope); - tangible.OutObject tempOut_nullableScope4 = - new tangible.OutObject(); + RefObject tempRef_tupleScope4 = + new RefObject(tupleScope); + OutObject tempOut_nullableScope4 = + new OutObject(); ResultAssert.IsSuccess(NullableUnitTests.WriteNullable(row, tempRef_tupleScope4, tupleType.getTypeArgs().get(1).clone(), itemValue, tempOut_nullableScope4)); - nullableScope = tempOut_nullableScope4.argValue; - tupleScope = tempRef_tupleScope4.argValue; + nullableScope = tempOut_nullableScope4.get(); + tupleScope = tempRef_tupleScope4.get(); // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'ref' keyword - // these cannot be converted using the 'RefObject' helper class unless the method is within the code // being modified: assert !tupleScope.MoveNext(row, ref nullableScope); - tangible.RefObject tempRef_outerScope9 = - new tangible.RefObject(outerScope); - tangible.RefObject tempRef_temp3 = - new tangible.RefObject(temp); + RefObject tempRef_outerScope9 = + new RefObject(outerScope); + RefObject tempRef_temp3 = + new RefObject(temp); ResultAssert.IsSuccess(c.TypeAs().MoveField(row, tempRef_outerScope9, tempRef_temp3)); - temp = tempRef_temp3.argValue; - outerScope = tempRef_outerScope9.argValue; + temp = tempRef_temp3.get(); + outerScope = tempRef_outerScope9.get(); } } } diff --git a/jre/src/test/java/azure/data/cosmos/serialization/hybridrow/unit/PermuteExtensions.java b/jre/src/test/java/com/azure/data/cosmos/serialization/hybridrow/unit/PermuteExtensions.java similarity index 85% rename from jre/src/test/java/azure/data/cosmos/serialization/hybridrow/unit/PermuteExtensions.java rename to jre/src/test/java/com/azure/data/cosmos/serialization/hybridrow/unit/PermuteExtensions.java index 8677a47..823bafb 100644 --- a/jre/src/test/java/azure/data/cosmos/serialization/hybridrow/unit/PermuteExtensions.java +++ b/jre/src/test/java/com/azure/data/cosmos/serialization/hybridrow/unit/PermuteExtensions.java @@ -2,7 +2,7 @@ // Copyright (c) Microsoft Corporation. All rights reserved. //------------------------------------------------------------ -package azure.data.cosmos.serialization.hybridrow.unit; +package com.azure.data.cosmos.serialization.hybridrow.unit; /** * Extension methods for computing permutations of . @@ -23,7 +23,7 @@ public final class PermuteExtensions { } for (java.lang.Iterable sub : - Microsoft.Azure.Cosmos.Serialization.HybridRow.Tests.Unit.PermuteExtensions.Permute(rest)) { + PermuteExtensions.Permute(rest)) { // TODO: C# TO JAVA CONVERTER: Java does not have an equivalent to the C# 'yield' keyword: yield return first.Concat(sub); } diff --git a/jre/src/test/java/azure/data/cosmos/serialization/hybridrow/unit/RandomGeneratorUnitTests.java b/jre/src/test/java/com/azure/data/cosmos/serialization/hybridrow/unit/RandomGeneratorUnitTests.java similarity index 96% rename from jre/src/test/java/azure/data/cosmos/serialization/hybridrow/unit/RandomGeneratorUnitTests.java rename to jre/src/test/java/com/azure/data/cosmos/serialization/hybridrow/unit/RandomGeneratorUnitTests.java index d38be9d..178ec14 100644 --- a/jre/src/test/java/azure/data/cosmos/serialization/hybridrow/unit/RandomGeneratorUnitTests.java +++ b/jre/src/test/java/com/azure/data/cosmos/serialization/hybridrow/unit/RandomGeneratorUnitTests.java @@ -2,7 +2,7 @@ // Copyright (c) Microsoft Corporation. All rights reserved. //------------------------------------------------------------ -package azure.data.cosmos.serialization.hybridrow.unit; +package com.azure.data.cosmos.serialization.hybridrow.unit; import java.util.Random; diff --git a/jre/src/test/java/com/azure/data/cosmos/serialization/hybridrow/unit/ReadRowDispatcher.java b/jre/src/test/java/com/azure/data/cosmos/serialization/hybridrow/unit/ReadRowDispatcher.java new file mode 100644 index 0000000..6fe2d7e --- /dev/null +++ b/jre/src/test/java/com/azure/data/cosmos/serialization/hybridrow/unit/ReadRowDispatcher.java @@ -0,0 +1,240 @@ +//------------------------------------------------------------ +// Copyright (c) Microsoft Corporation. All rights reserved. +//------------------------------------------------------------ + +package com.azure.data.cosmos.serialization.hybridrow.unit; + +import com.azure.data.cosmos.core.OutObject; +import com.azure.data.cosmos.core.RefObject; +import com.azure.data.cosmos.serialization.hybridrow.RowBuffer; +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.LayoutTypedArray; +import com.azure.data.cosmos.serialization.hybridrow.layouts.TypeArgumentList; + +import java.util.Collection; +import java.util.List; + +//C# TO JAVA CONVERTER WARNING: Java does not allow user-defined value types. The behavior of this class may differ +// from the original: +//ORIGINAL LINE: internal struct ReadRowDispatcher : IDispatcher +public final class ReadRowDispatcher implements IDispatcher { + + public , TValue> void Dispatch(RefObject dispatcher, RefObject root, LayoutColumn col, LayoutType t) { + Dispatch(dispatcher, root, col, t, null); + } + + //C# TO JAVA CONVERTER NOTE: Java does not support optional parameters. Overloaded method(s) are created above: + //ORIGINAL LINE: public void Dispatch(ref RowOperationDispatcher dispatcher, ref RowCursor root, + // LayoutColumn col, LayoutType t, TValue expected = default) where TLayout : LayoutType + public , TValue> void Dispatch(RefObject dispatcher, RefObject root, LayoutColumn col, LayoutType t, TValue expected) { + TValue value; + switch (col == null ? null : col.getStorage()) { + case Fixed: + RefObject tempRef_Row = + new RefObject(dispatcher.get().Row); + OutObject tempOut_value = new OutObject(); + ResultAssert.IsSuccess(t.TypeAs().ReadFixed(tempRef_Row, root, col, tempOut_value)); + value = tempOut_value.get(); + dispatcher.get().argValue.Row = tempRef_Row.get(); + break; + case Variable: + RefObject tempRef_Row2 = + new RefObject(dispatcher.get().Row); + OutObject tempOut_value2 = new OutObject(); + ResultAssert.IsSuccess(t.TypeAs().ReadVariable(tempRef_Row2, root, col, tempOut_value2)); + value = tempOut_value2.get(); + dispatcher.get().argValue.Row = tempRef_Row2.get(); + break; + default: + RefObject tempRef_Row3 = + new RefObject(dispatcher.get().Row); + OutObject tempOut_value3 = new OutObject(); + ResultAssert.IsSuccess(t.TypeAs().ReadSparse(tempRef_Row3, root, tempOut_value3)); + value = tempOut_value3.get(); + dispatcher.get().argValue.Row = tempRef_Row3.get(); + break; + } + + if (TValue.class.IsArray) { + CollectionAssert.AreEqual((Collection)expected, (Collection)value); + } else { + assert expected == value; + } + } + + public void DispatchArray(RefObject dispatcher, + RefObject scope, LayoutType t, TypeArgumentList typeArgs, + Object value) { + checkArgument(typeArgs.getCount() == 1); + + RefObject tempRef_Row = + new RefObject(dispatcher.get().Row); + RowCursor arrayScope; + OutObject tempOut_arrayScope = + new OutObject(); + ResultAssert.IsSuccess(t.TypeAs().ReadScope(tempRef_Row, scope, tempOut_arrayScope)); + arrayScope = tempOut_arrayScope.get(); + dispatcher.get().argValue.Row = tempRef_Row.get(); + + int i = 0; + List items = (List)value; + RefObject tempRef_Row2 = + new RefObject(dispatcher.get().Row); + while (arrayScope.MoveNext(tempRef_Row2)) { + dispatcher.get().argValue.Row = tempRef_Row2.get(); + // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'ref' keyword - these + // cannot be converted using the 'RefObject' helper class unless the method is within the code being + // modified: + dispatcher.get().LayoutCodeSwitch(ref arrayScope, null, typeArgs.get(0).getType(), + typeArgs.get(0).getTypeArgs().clone(), items.get(i++)); + } + dispatcher.get().argValue.Row = tempRef_Row2.get(); + } + + public void DispatchMap(RefObject dispatcher, + RefObject scope, LayoutType t, TypeArgumentList typeArgs, + Object value) { + checkArgument(typeArgs.getCount() == 2); + + RefObject tempRef_Row = + new RefObject(dispatcher.get().Row); + RowCursor mapScope; + OutObject tempOut_mapScope = + new OutObject(); + ResultAssert.IsSuccess(t.TypeAs().ReadScope(tempRef_Row, scope, tempOut_mapScope)); + mapScope = tempOut_mapScope.get(); + dispatcher.get().argValue.Row = tempRef_Row.get(); + int i = 0; + List items = (List)value; + RefObject tempRef_Row2 = + new RefObject(dispatcher.get().Row); + while (mapScope.MoveNext(tempRef_Row2)) { + dispatcher.get().argValue.Row = tempRef_Row2.get(); + // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'ref' keyword - these + // cannot be converted using the 'RefObject' helper class unless the method is within the code being + // modified: + dispatcher.get().LayoutCodeSwitch(ref mapScope, null, LayoutType.TypedTuple, typeArgs.clone(), + items.get(i++)); + } + dispatcher.get().argValue.Row = tempRef_Row2.get(); + } + + public void DispatchNullable(RefObject dispatcher, + RefObject scope, LayoutType t, TypeArgumentList typeArgs, + Object value) { + checkArgument(typeArgs.getCount() == 1); + + RefObject tempRef_Row = + new RefObject(dispatcher.get().Row); + RowCursor nullableScope; + OutObject tempOut_nullableScope = + new OutObject(); + ResultAssert.IsSuccess(t.TypeAs().ReadScope(tempRef_Row, scope, tempOut_nullableScope)); + nullableScope = tempOut_nullableScope.get(); + dispatcher.get().argValue.Row = tempRef_Row.get(); + + if (value != null) { + RefObject tempRef_Row2 = + new RefObject(dispatcher.get().Row); + RefObject tempRef_nullableScope = + new RefObject(nullableScope); + ResultAssert.IsSuccess(LayoutNullable.HasValue(tempRef_Row2, tempRef_nullableScope)); + nullableScope = tempRef_nullableScope.get(); + dispatcher.get().argValue.Row = tempRef_Row2.get(); + RefObject tempRef_Row3 = + new RefObject(dispatcher.get().Row); + nullableScope.MoveNext(tempRef_Row3); + dispatcher.get().argValue.Row = tempRef_Row3.get(); + // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'ref' keyword - these + // cannot be converted using the 'RefObject' helper class unless the method is within the code being + // modified: + dispatcher.get().LayoutCodeSwitch(ref nullableScope, null, typeArgs.get(0).getType(), + typeArgs.get(0).getTypeArgs().clone(), value); + } else { + RefObject tempRef_Row4 = + new RefObject(dispatcher.get().Row); + RefObject tempRef_nullableScope2 = + new RefObject(nullableScope); + ResultAssert.NotFound(LayoutNullable.HasValue(tempRef_Row4, tempRef_nullableScope2)); + nullableScope = tempRef_nullableScope2.get(); + dispatcher.get().argValue.Row = tempRef_Row4.get(); + } + } + + public void DispatchObject(RefObject dispatcher, + RefObject scope) { + } + + public void DispatchSet(RefObject dispatcher, + RefObject scope, LayoutType t, TypeArgumentList typeArgs, + Object value) { + checkArgument(typeArgs.getCount() == 1); + + RefObject tempRef_Row = + new RefObject(dispatcher.get().Row); + RowCursor setScope; + OutObject tempOut_setScope = + new OutObject(); + ResultAssert.IsSuccess(t.TypeAs().ReadScope(tempRef_Row, scope, tempOut_setScope)); + setScope = tempOut_setScope.get(); + dispatcher.get().argValue.Row = tempRef_Row.get(); + int i = 0; + List items = (List)value; + RefObject tempRef_Row2 = + new RefObject(dispatcher.get().Row); + while (setScope.MoveNext(tempRef_Row2)) { + dispatcher.get().argValue.Row = tempRef_Row2.get(); + // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'ref' keyword - these + // cannot be converted using the 'RefObject' helper class unless the method is within the code being + // modified: + dispatcher.get().LayoutCodeSwitch(ref setScope, null, typeArgs.get(0).getType(), + typeArgs.get(0).getTypeArgs().clone(), items.get(i++)); + } + dispatcher.get().argValue.Row = tempRef_Row2.get(); + } + + public void DispatchTuple(RefObject dispatcher, + RefObject scope, LayoutType t, TypeArgumentList typeArgs, + Object value) { + checkArgument(typeArgs.getCount() >= 2); + + RefObject tempRef_Row = + new RefObject(dispatcher.get().Row); + RowCursor tupleScope; + OutObject tempOut_tupleScope = + new OutObject(); + ResultAssert.IsSuccess(t.TypeAs().ReadScope(tempRef_Row, scope, tempOut_tupleScope)); + tupleScope = tempOut_tupleScope.get(); + dispatcher.get().argValue.Row = tempRef_Row.get(); + + for (int i = 0; i < typeArgs.getCount(); i++) { + RefObject tempRef_Row2 = + new RefObject(dispatcher.get().Row); + tupleScope.MoveNext(tempRef_Row2); + dispatcher.get().argValue.Row = tempRef_Row2.get(); + 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 + // cannot be converted using the 'RefObject' helper class unless the method is within the code being + // modified: + dispatcher.get().LayoutCodeSwitch(ref tupleScope, null, typeArgs.get(i).getType(), + typeArgs.get(i).getTypeArgs().clone(), valueAccessor.GetValue(value)); + } + } + + public void DispatchUDT(RefObject dispatcher, + RefObject scope, LayoutType t, TypeArgumentList typeArgs, + Object value) { + RefObject tempRef_Row = new RefObject(dispatcher.get().Row); + RowCursor udtScope; + OutObject tempOut_udtScope = new OutObject(); + ResultAssert.IsSuccess(t.TypeAs().ReadScope(tempRef_Row, scope, tempOut_udtScope)); + udtScope = tempOut_udtScope.get(); + dispatcher.get().argValue.Row = tempRef_Row.get(); + IDispatchable valueDispatcher = value instanceof IDispatchable ? (IDispatchable)value : null; + assert valueDispatcher != null; + RefObject tempRef_udtScope = new RefObject(udtScope); + valueDispatcher.Dispatch(dispatcher, tempRef_udtScope); + udtScope = tempRef_udtScope.get(); + } +} \ No newline at end of file diff --git a/jre/src/test/java/azure/data/cosmos/serialization/hybridrow/unit/RecordIOUnitTests.java b/jre/src/test/java/com/azure/data/cosmos/serialization/hybridrow/unit/RecordIOUnitTests.java similarity index 68% rename from jre/src/test/java/azure/data/cosmos/serialization/hybridrow/unit/RecordIOUnitTests.java rename to jre/src/test/java/com/azure/data/cosmos/serialization/hybridrow/unit/RecordIOUnitTests.java index 2189058..f51c0cf 100644 --- a/jre/src/test/java/azure/data/cosmos/serialization/hybridrow/unit/RecordIOUnitTests.java +++ b/jre/src/test/java/com/azure/data/cosmos/serialization/hybridrow/unit/RecordIOUnitTests.java @@ -2,12 +2,18 @@ // Copyright (c) Microsoft Corporation. All rights reserved. //------------------------------------------------------------ -package azure.data.cosmos.serialization.hybridrow.unit; +package com.azure.data.cosmos.serialization.hybridrow.unit; -import azure.data.cosmos.serialization.hybridrow.HybridRowVersion; -import azure.data.cosmos.serialization.hybridrow.MemorySpanResizer; -import azure.data.cosmos.serialization.hybridrow.Result; -import azure.data.cosmos.serialization.hybridrow.RowBuffer; +import com.azure.data.cosmos.core.OutObject; +import com.azure.data.cosmos.core.RefObject; +import com.azure.data.cosmos.serialization.hybridrow.HybridRowVersion; +import com.azure.data.cosmos.serialization.hybridrow.MemorySpanResizer; +import com.azure.data.cosmos.serialization.hybridrow.Result; +import com.azure.data.cosmos.serialization.hybridrow.RowBuffer; +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.Segment; +import com.azure.data.cosmos.serialization.hybridrow.unit.customerschema.Address; import java.nio.file.Files; import java.util.ArrayList; @@ -88,7 +94,7 @@ public class RecordIOUnitTests { //ORIGINAL LINE: Result r = await stm.WriteRecordIOAsync(new Segment(sampleComment, sampleSDL), (long // index, out ReadOnlyMemory body) => Result r = await - Microsoft.Azure.Cosmos.Serialization.HybridRow.RecordIO.RecordIOStream.WriteRecordIOAsync(stm, + RecordIOStream.WriteRecordIOAsync(stm, new Segment(sampleComment, sampleSDL), (long index, out ReadOnlyMemorybody) -> { body = null; @@ -96,9 +102,9 @@ public class RecordIOUnitTests { return Result.Success; } - tangible.OutObject> tempOut_body = new tangible.OutObject>(); + OutObject> tempOut_body = new OutObject>(); Task tempVar5 = this.WriteAddress(resizer, addresses[index], tempOut_body); - body = tempOut_body.argValue; + body = tempOut_body.get(); return tempVar5; }); @@ -110,14 +116,14 @@ public class RecordIOUnitTests { resizer = new MemorySpanResizer(1); // TODO: C# TO JAVA CONVERTER: There is no equivalent to 'await' in Java: r = await - Microsoft.Azure.Cosmos.Serialization.HybridRow.RecordIO.RecordIOStream.ReadRecordIOAsync(stm, record -> + RecordIOStream.ReadRecordIOAsync(stm, record -> { assert !record.IsEmpty; Address obj; - tangible.OutObject tempOut_obj = new tangible.OutObject(); + OutObject
tempOut_obj = new OutObject
(); r = this.ReadAddress(record, tempOut_obj); - obj = tempOut_obj.argValue; + obj = tempOut_obj.get(); ResultAssert.IsSuccess(r); addressesRead.add(obj); return Result.Success; @@ -126,10 +132,10 @@ public class RecordIOUnitTests { assert !segment.IsEmpty; Segment obj; - tangible.OutObject tempOut_obj = - new tangible.OutObject(); + OutObject tempOut_obj = + new OutObject(); r = this.ReadSegment(segment, tempOut_obj); - obj = tempOut_obj.argValue; + obj = tempOut_obj.get(); ResultAssert.IsSuccess(r); assert obj.Comment == sampleComment; assert obj.SDL == sampleSDL; @@ -148,70 +154,70 @@ public class RecordIOUnitTests { //C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java: //ORIGINAL LINE: private Result ReadAddress(Memory buffer, out Address obj) - private Result ReadAddress(Memory buffer, tangible.OutObject
obj) { + private Result ReadAddress(Memory buffer, OutObject
obj) { RowBuffer row = new RowBuffer(buffer.Span, HybridRowVersion.V1, this.resolver); - tangible.RefObject tempRef_row = - new tangible.RefObject(row); + RefObject tempRef_row = + new RefObject(row); RowReader reader = new RowReader(tempRef_row); - row = tempRef_row.argValue; + row = tempRef_row.get(); // Use the reader to dump to the screen. - tangible.RefObject tempRef_reader = - new tangible.RefObject(reader); + RefObject tempRef_reader = + new RefObject(reader); String str; // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'out' keyword - these // cannot be converted using the 'OutObject' helper class unless the method is within the code being modified: Result r = DiagnosticConverter.ReaderToString(tempRef_reader, out str); - reader = tempRef_reader.argValue; + reader = tempRef_reader.get(); if (r != Result.Success) { - obj.argValue = null; + obj.set(null); return r; } System.out.println(str); // Reset the reader and materialize the object. - tangible.RefObject tempRef_row2 = - new tangible.RefObject(row); + RefObject tempRef_row2 = + new RefObject(row); reader = new RowReader(tempRef_row2); - row = tempRef_row2.argValue; - tangible.RefObject tempRef_reader2 = - new tangible.RefObject(reader); + row = tempRef_row2.get(); + RefObject tempRef_reader2 = + new RefObject(reader); Result tempVar = AddressSerializer.Read(tempRef_reader2, obj); - reader = tempRef_reader2.argValue; + reader = tempRef_reader2.get(); return tempVar; } //C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java: //ORIGINAL LINE: private Result ReadSegment(Memory buffer, out Segment obj) - private Result ReadSegment(Memory buffer, tangible.OutObject obj) { + private Result ReadSegment(Memory buffer, OutObject obj) { RowBuffer row = new RowBuffer(buffer.Span, HybridRowVersion.V1, SystemSchema.LayoutResolver); - tangible.RefObject tempRef_row = - new tangible.RefObject(row); + RefObject tempRef_row = + new RefObject(row); RowReader reader = new RowReader(tempRef_row); - row = tempRef_row.argValue; + row = tempRef_row.get(); // Use the reader to dump to the screen. - tangible.RefObject tempRef_reader = - new tangible.RefObject(reader); + RefObject tempRef_reader = + new RefObject(reader); String str; // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'out' keyword - these cannot be converted using the 'OutObject' helper class unless the method is within the code being modified: Result r = DiagnosticConverter.ReaderToString(tempRef_reader, out str); - reader = tempRef_reader.argValue; + reader = tempRef_reader.get(); if (r != Result.Success) { - obj.argValue = null; + obj.set(null); return r; } System.out.println(str); // Reset the reader and materialize the object. - tangible.RefObject tempRef_row2 = new tangible.RefObject(row); + RefObject tempRef_row2 = new RefObject(row); reader = new RowReader(tempRef_row2); - row = tempRef_row2.argValue; - tangible.RefObject tempRef_reader2 = new tangible.RefObject(reader); + row = tempRef_row2.get(); + RefObject tempRef_reader2 = new RefObject(reader); Result tempVar = SegmentSerializer.Read(tempRef_reader2, obj.clone()); - reader = tempRef_reader2.argValue; + reader = tempRef_reader2.get(); return tempVar; } @@ -219,19 +225,19 @@ public class RecordIOUnitTests { //ORIGINAL LINE: private Result WriteAddress(MemorySpanResizer resizer, Address obj, out // ReadOnlyMemory buffer) private Result WriteAddress(MemorySpanResizer resizer, Address obj, - tangible.OutObject> buffer) { + OutObject> buffer) { RowBuffer row = new RowBuffer(RecordIOUnitTests.InitialRowSize, resizer); row.InitLayout(HybridRowVersion.V1, this.addressLayout, this.resolver); - tangible.RefObject tempRef_row = - new tangible.RefObject(row); + RefObject tempRef_row = + new RefObject(row); Result r = RowWriter.WriteBuffer(tempRef_row, obj, AddressSerializer.Write); - row = tempRef_row.argValue; + row = tempRef_row.get(); if (r != Result.Success) { - buffer.argValue = null; + buffer.set(null); return r; } - buffer.argValue = resizer.getMemory().Slice(0, row.getLength()); + buffer.set(resizer.getMemory().Slice(0, row.getLength())); return Result.Success; } } \ No newline at end of file diff --git a/jre/src/test/java/azure/data/cosmos/serialization/hybridrow/unit/ResultAssert.java b/jre/src/test/java/com/azure/data/cosmos/serialization/hybridrow/unit/ResultAssert.java similarity index 93% rename from jre/src/test/java/azure/data/cosmos/serialization/hybridrow/unit/ResultAssert.java rename to jre/src/test/java/com/azure/data/cosmos/serialization/hybridrow/unit/ResultAssert.java index 89f28fd..2a0460a 100644 --- a/jre/src/test/java/azure/data/cosmos/serialization/hybridrow/unit/ResultAssert.java +++ b/jre/src/test/java/com/azure/data/cosmos/serialization/hybridrow/unit/ResultAssert.java @@ -2,9 +2,9 @@ // Copyright (c) Microsoft Corporation. All rights reserved. //------------------------------------------------------------ -package azure.data.cosmos.serialization.hybridrow.unit; +package com.azure.data.cosmos.serialization.hybridrow.unit; -import azure.data.cosmos.serialization.hybridrow.Result; +import com.azure.data.cosmos.serialization.hybridrow.Result; public final class ResultAssert { public static void Exists(Result actual) { diff --git a/jre/src/test/java/azure/data/cosmos/serialization/hybridrow/unit/RowBufferUnitTests.java b/jre/src/test/java/com/azure/data/cosmos/serialization/hybridrow/unit/RowBufferUnitTests.java similarity index 94% rename from jre/src/test/java/azure/data/cosmos/serialization/hybridrow/unit/RowBufferUnitTests.java rename to jre/src/test/java/com/azure/data/cosmos/serialization/hybridrow/unit/RowBufferUnitTests.java index 6f4f343..964b686 100644 --- a/jre/src/test/java/azure/data/cosmos/serialization/hybridrow/unit/RowBufferUnitTests.java +++ b/jre/src/test/java/com/azure/data/cosmos/serialization/hybridrow/unit/RowBufferUnitTests.java @@ -2,9 +2,9 @@ // Copyright (c) Microsoft Corporation. All rights reserved. //------------------------------------------------------------ -package azure.data.cosmos.serialization.hybridrow.unit; +package com.azure.data.cosmos.serialization.hybridrow.unit; -import 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: //ORIGINAL LINE: [TestClass] public class RowBufferUnitTests diff --git a/jre/src/test/java/azure/data/cosmos/serialization/hybridrow/unit/RowOperationDispatcher.java b/jre/src/test/java/com/azure/data/cosmos/serialization/hybridrow/unit/RowOperationDispatcher.java similarity index 55% rename from jre/src/test/java/azure/data/cosmos/serialization/hybridrow/unit/RowOperationDispatcher.java rename to jre/src/test/java/com/azure/data/cosmos/serialization/hybridrow/unit/RowOperationDispatcher.java index 97902dc..edfa5c1 100644 --- a/jre/src/test/java/azure/data/cosmos/serialization/hybridrow/unit/RowOperationDispatcher.java +++ b/jre/src/test/java/com/azure/data/cosmos/serialization/hybridrow/unit/RowOperationDispatcher.java @@ -2,14 +2,45 @@ // Copyright (c) Microsoft Corporation. All rights reserved. //------------------------------------------------------------ -package azure.data.cosmos.serialization.hybridrow.unit; +package com.azure.data.cosmos.serialization.hybridrow.unit; -import azure.data.cosmos.serialization.hybridrow.Float128; -import azure.data.cosmos.serialization.hybridrow.HybridRowVersion; -import azure.data.cosmos.serialization.hybridrow.NullValue; -import azure.data.cosmos.serialization.hybridrow.RowBuffer; -import azure.data.cosmos.serialization.hybridrow.RowCursor; -import azure.data.cosmos.serialization.hybridrow.UnixDateTime; +import com.azure.data.cosmos.core.OutObject; +import com.azure.data.cosmos.core.RefObject; +import com.azure.data.cosmos.serialization.hybridrow.Float128; +import com.azure.data.cosmos.serialization.hybridrow.HybridRowVersion; +import com.azure.data.cosmos.serialization.hybridrow.NullValue; +import com.azure.data.cosmos.serialization.hybridrow.RowBuffer; +import com.azure.data.cosmos.serialization.hybridrow.RowCursor; +import com.azure.data.cosmos.serialization.hybridrow.UnixDateTime; +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.LayoutBinary; +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.LayoutDateTime; +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.LayoutFloat32; +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.LayoutInt16; +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.LayoutInt8; +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.LayoutResolver; +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.LayoutUInt32; +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.LayoutUnixDateTime; +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.LayoutVarUInt; +import com.azure.data.cosmos.serialization.hybridrow.layouts.TypeArgumentList; +import com.azure.data.cosmos.serialization.hybridrow.schemas.StorageKind; import java.math.BigDecimal; import java.time.LocalDateTime; @@ -62,11 +93,11 @@ public final class RowOperationDispatcher { } public RowReader GetReader() { - tangible.RefObject tempRef_Row = - new tangible.RefObject(this.Row); + RefObject tempRef_Row = + new RefObject(this.Row); // TODO: C# TO JAVA CONVERTER: The following line could not be converted: return new RowReader(ref this.Row) - this.Row = tempRef_Row.argValue; + this.Row = tempRef_Row.get(); return tempVar; } @@ -90,262 +121,262 @@ public final class RowOperationDispatcher { //ORIGINAL LINE: public void LayoutCodeSwitch(string path = null, LayoutType type = null, TypeArgumentList // typeArgs = default, object value = null) public void LayoutCodeSwitch(String path, LayoutType type, TypeArgumentList typeArgs, Object value) { - tangible.RefObject tempRef_Row = - new tangible.RefObject(this.Row); + RefObject tempRef_Row = + new RefObject(this.Row); RowCursor root = RowCursor.Create(tempRef_Row); - this.Row = tempRef_Row.argValue; - tangible.RefObject tempRef_root = - new tangible.RefObject(root); + this.Row = tempRef_Row.get(); + RefObject tempRef_root = + new RefObject(root); this.LayoutCodeSwitch(tempRef_root, path, type, typeArgs.clone(), value); - root = tempRef_root.argValue; + root = tempRef_root.get(); } - public void LayoutCodeSwitch(tangible.RefObject scope, String path, LayoutType type, + public void LayoutCodeSwitch(RefObject scope, String path, LayoutType type, TypeArgumentList typeArgs) { LayoutCodeSwitch(scope, path, type, typeArgs, null); } - public void LayoutCodeSwitch(tangible.RefObject scope, String path, LayoutType type) { + public void LayoutCodeSwitch(RefObject scope, String path, LayoutType type) { LayoutCodeSwitch(scope, path, type, null, null); } - public void LayoutCodeSwitch(tangible.RefObject scope, String path) { + public void LayoutCodeSwitch(RefObject scope, String path) { LayoutCodeSwitch(scope, path, null, null, null); } - public void LayoutCodeSwitch(tangible.RefObject scope) { + public void LayoutCodeSwitch(RefObject scope) { LayoutCodeSwitch(scope, null, null, null, null); } //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, // TypeArgumentList typeArgs = default, object value = null) - public void LayoutCodeSwitch(tangible.RefObject scope, String path, LayoutType type, + public void LayoutCodeSwitch(RefObject scope, String path, LayoutType type, TypeArgumentList typeArgs, Object value) { LayoutColumn col = null; if (type == null) { assert path != null; - tangible.OutObject tempOut_col = - new tangible.OutObject(); - assert scope.argValue.getLayout().TryFind(path, tempOut_col); - col = tempOut_col.argValue; + OutObject tempOut_col = + new OutObject(); + assert scope.get().getLayout().TryFind(path, tempOut_col); + col = tempOut_col.get(); assert col != null; type = col.getType(); typeArgs = col.getTypeArgs().clone(); } if ((path != null) && (col == null || col.getStorage() == StorageKind.Sparse)) { - tangible.RefObject tempRef_Row = - new tangible.RefObject(this.Row); - scope.argValue.Find(tempRef_Row, path); - this.Row = tempRef_Row.argValue; + RefObject tempRef_Row = + new RefObject(this.Row); + scope.get().Find(tempRef_Row, path); + this.Row = tempRef_Row.get(); } switch (type.LayoutCode) { case Null: - tangible.RefObject tempRef_this = new tangible.RefObject(this); + RefObject tempRef_this = new RefObject(this); this.dispatcher.Dispatch(tempRef_this, scope, col, type, NullValue.Default); - this = tempRef_this.argValue; + this = tempRef_this.get(); break; case Boolean: - tangible.RefObject tempRef_this2 = new tangible.RefObject(this); + RefObject tempRef_this2 = new RefObject(this); this.dispatcher.Dispatch(tempRef_this2, scope, col, type, value != null ? value : default) - this = tempRef_this2.argValue; + this = tempRef_this2.get(); break; case Int8: - tangible.RefObject tempRef_this3 = new tangible.RefObject(this); + RefObject tempRef_this3 = new RefObject(this); this.dispatcher.Dispatch(tempRef_this3, scope, col, type, value != null ? value : default) - this = tempRef_this3.argValue; + this = tempRef_this3.get(); break; case Int16: - tangible.RefObject tempRef_this4 = new tangible.RefObject(this); + RefObject tempRef_this4 = new RefObject(this); this.dispatcher.Dispatch(tempRef_this4, scope, col, type, value != null ? value : default) - this = tempRef_this4.argValue; + this = tempRef_this4.get(); break; case Int32: - tangible.RefObject tempRef_this5 = new tangible.RefObject(this); + RefObject tempRef_this5 = new RefObject(this); this.dispatcher.Dispatch(tempRef_this5, scope, col, type, value != null ? value : default) - this = tempRef_this5.argValue; + this = tempRef_this5.get(); break; case Int64: - tangible.RefObject tempRef_this6 = new tangible.RefObject(this); + RefObject tempRef_this6 = new RefObject(this); this.dispatcher.Dispatch(tempRef_this6, scope, col, type, value != null ? value : default) - this = tempRef_this6.argValue; + this = tempRef_this6.get(); break; case UInt8: - tangible.RefObject tempRef_this7 = new tangible.RefObject(this); + RefObject tempRef_this7 = new RefObject(this); //C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java: //ORIGINAL LINE: this.dispatcher.Dispatch(tempRef_this7, scope, col, type, // (Nullable)value != null ? value : default); this.dispatcher.Dispatch(tempRef_this7, scope, col, type, value != null ? value : default) - this = tempRef_this7.argValue; + this = tempRef_this7.get(); break; case UInt16: - tangible.RefObject tempRef_this8 = new tangible.RefObject(this); + RefObject tempRef_this8 = new RefObject(this); //C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java: //ORIGINAL LINE: this.dispatcher.Dispatch(tempRef_this8, scope, col, type, // (Nullable)value != null ? value : default); this.dispatcher.Dispatch(tempRef_this8, scope, col, type, value != null ? value : default) - this = tempRef_this8.argValue; + this = tempRef_this8.get(); break; case UInt32: - tangible.RefObject tempRef_this9 = new tangible.RefObject(this); + RefObject tempRef_this9 = new RefObject(this); //C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java: //ORIGINAL LINE: this.dispatcher.Dispatch(tempRef_this9, scope, col, type, // (Nullable)value != null ? value : default); this.dispatcher.Dispatch(tempRef_this9, scope, col, type, value != null ? value : default) - this = tempRef_this9.argValue; + this = tempRef_this9.get(); break; case UInt64: - tangible.RefObject tempRef_this10 = new tangible.RefObject(this); + RefObject tempRef_this10 = new RefObject(this); //C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java: //ORIGINAL LINE: this.dispatcher.Dispatch(tempRef_this10, scope, col, type, // (Nullable)value != null ? value : default); this.dispatcher.Dispatch(tempRef_this10, scope, col, type, value != null ? value : default) - this = tempRef_this10.argValue; + this = tempRef_this10.get(); break; case VarInt: - tangible.RefObject tempRef_this11 = new tangible.RefObject(this); + RefObject tempRef_this11 = new RefObject(this); this.dispatcher.Dispatch(tempRef_this11, scope, col, type, value != null ? value : default) - this = tempRef_this11.argValue; + this = tempRef_this11.get(); break; case VarUInt: - tangible.RefObject tempRef_this12 = new tangible.RefObject(this); + RefObject tempRef_this12 = new RefObject(this); //C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java: //ORIGINAL LINE: this.dispatcher.Dispatch(tempRef_this12, scope, col, type, // (Nullable)value != null ? value : default); this.dispatcher.Dispatch(tempRef_this12, scope, col, type, value != null ? value : default) - this = tempRef_this12.argValue; + this = tempRef_this12.get(); break; case Float32: - tangible.RefObject tempRef_this13 = new tangible.RefObject(this); + RefObject tempRef_this13 = new RefObject(this); this.dispatcher.Dispatch(tempRef_this13, scope, col, type, value != null ? value : default) - this = tempRef_this13.argValue; + this = tempRef_this13.get(); break; case Float64: - tangible.RefObject tempRef_this14 = new tangible.RefObject(this); + RefObject tempRef_this14 = new RefObject(this); this.dispatcher.Dispatch(tempRef_this14, scope, col, type, value != null ? value : default) - this = tempRef_this14.argValue; + this = tempRef_this14.get(); break; case Float128: - tangible.RefObject tempRef_this15 = new tangible.RefObject(this); + RefObject tempRef_this15 = new RefObject(this); this.dispatcher.Dispatch(tempRef_this15, scope, col, type, value != null ? value : default) - this = tempRef_this15.argValue; + this = tempRef_this15.get(); break; case Decimal: - tangible.RefObject tempRef_this16 = new tangible.RefObject(this); + RefObject tempRef_this16 = new RefObject(this); this.dispatcher.Dispatch(tempRef_this16, scope, col, type, value != null ? value : default) - this = tempRef_this16.argValue; + this = tempRef_this16.get(); break; case DateTime: - tangible.RefObject tempRef_this17 = new tangible.RefObject(this); + RefObject tempRef_this17 = new RefObject(this); this.dispatcher.Dispatch(tempRef_this17, scope, col, type, value != null ? value : default) - this = tempRef_this17.argValue; + this = tempRef_this17.get(); break; case UnixDateTime: - tangible.RefObject tempRef_this18 = new tangible.RefObject(this); + RefObject tempRef_this18 = new RefObject(this); this.dispatcher.Dispatch(tempRef_this18, scope, col, type, value != null ? value : default) - this = tempRef_this18.argValue; + this = tempRef_this18.get(); break; case Guid: - tangible.RefObject tempRef_this19 = new tangible.RefObject(this); + RefObject tempRef_this19 = new RefObject(this); this.dispatcher.Dispatch(tempRef_this19, scope, col, type, value != null ? value : default) - this = tempRef_this19.argValue; + this = tempRef_this19.get(); break; case MongoDbObjectId: - tangible.RefObject tempRef_this20 = new tangible.RefObject(this); + RefObject tempRef_this20 = new RefObject(this); this.dispatcher.Dispatch(tempRef_this20, scope, col, type, value != null ? value : default) - this = tempRef_this20.argValue; + this = tempRef_this20.get(); break; case Utf8: - tangible.RefObject tempRef_this21 = new tangible.RefObject(this); + RefObject tempRef_this21 = new RefObject(this); this.dispatcher.Dispatch(tempRef_this21, scope, col, type, (String)value); - this = tempRef_this21.argValue; + this = tempRef_this21.get(); break; case Binary: - tangible.RefObject tempRef_this22 = new tangible.RefObject(this); + RefObject tempRef_this22 = new RefObject(this); //C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java: //ORIGINAL LINE: this.dispatcher.Dispatch(ref this, ref scope, col, type, // (byte[])value); this.dispatcher.Dispatch(tempRef_this22, scope, col, type, (byte[])value); - this = tempRef_this22.argValue; + this = tempRef_this22.get(); break; case ObjectScope: case ImmutableObjectScope: - tangible.RefObject tempRef_this23 = new tangible.RefObject(this); + RefObject tempRef_this23 = new RefObject(this); this.dispatcher.DispatchObject(tempRef_this23, scope); - this = tempRef_this23.argValue; + this = tempRef_this23.get(); break; case TypedArrayScope: case ImmutableTypedArrayScope: - tangible.RefObject tempRef_this24 = new tangible.RefObject(this); + RefObject tempRef_this24 = new RefObject(this); this.dispatcher.DispatchArray(tempRef_this24, scope, type, typeArgs.clone(), value); - this = tempRef_this24.argValue; + this = tempRef_this24.get(); break; case TypedSetScope: case ImmutableTypedSetScope: - tangible.RefObject tempRef_this25 = new tangible.RefObject(this); + RefObject tempRef_this25 = new RefObject(this); this.dispatcher.DispatchSet(tempRef_this25, scope, type, typeArgs.clone(), value); - this = tempRef_this25.argValue; + this = tempRef_this25.get(); break; case TypedMapScope: case ImmutableTypedMapScope: - tangible.RefObject tempRef_this26 = new tangible.RefObject(this); + RefObject tempRef_this26 = new RefObject(this); this.dispatcher.DispatchMap(tempRef_this26, scope, type, typeArgs.clone(), value); - this = tempRef_this26.argValue; + this = tempRef_this26.get(); break; case TupleScope: case ImmutableTupleScope: @@ -355,23 +386,24 @@ public final class RowOperationDispatcher { case ImmutableTaggedScope: case Tagged2Scope: case ImmutableTagged2Scope: - tangible.RefObject tempRef_this27 = new tangible.RefObject(this); + RefObject tempRef_this27 = new RefObject(this); this.dispatcher.DispatchTuple(tempRef_this27, scope, type, typeArgs.clone(), value); - this = tempRef_this27.argValue; + this = tempRef_this27.get(); break; case NullableScope: - tangible.RefObject tempRef_this28 = new tangible.RefObject(this); + RefObject tempRef_this28 = new RefObject(this); this.dispatcher.DispatchNullable(tempRef_this28, scope, type, typeArgs.clone(), value); - this = tempRef_this28.argValue; + this = tempRef_this28.get(); break; case Schema: case ImmutableSchema: - tangible.RefObject tempRef_this29 = new tangible.RefObject(this); + RefObject tempRef_this29 = new RefObject(this); this.dispatcher.DispatchUDT(tempRef_this29, scope, type, typeArgs.clone(), value); - this = tempRef_this29.argValue; + this = tempRef_this29.get(); break; default: - Contract.Assert(false, String.format("Unknown type will be ignored: %1$s", type.LayoutCode)); + if (logger.) + throw new IllegalStateException(lenientFormat("Unknown type will be ignored: %s", type.LayoutCode)); break; } } diff --git a/jre/src/test/java/azure/data/cosmos/serialization/hybridrow/unit/RowReaderUnitTests.java b/jre/src/test/java/com/azure/data/cosmos/serialization/hybridrow/unit/RowReaderUnitTests.java similarity index 66% rename from jre/src/test/java/azure/data/cosmos/serialization/hybridrow/unit/RowReaderUnitTests.java rename to jre/src/test/java/com/azure/data/cosmos/serialization/hybridrow/unit/RowReaderUnitTests.java index e8b5a56..9147477 100644 --- a/jre/src/test/java/azure/data/cosmos/serialization/hybridrow/unit/RowReaderUnitTests.java +++ b/jre/src/test/java/com/azure/data/cosmos/serialization/hybridrow/unit/RowReaderUnitTests.java @@ -2,16 +2,19 @@ // Copyright (c) Microsoft Corporation. All rights reserved. //------------------------------------------------------------ -package azure.data.cosmos.serialization.hybridrow.unit; +package com.azure.data.cosmos.serialization.hybridrow.unit; -import azure.data.cosmos.serialization.hybridrow.Float128; -import azure.data.cosmos.serialization.hybridrow.HybridRowVersion; -import azure.data.cosmos.serialization.hybridrow.MemorySpanResizer; -import azure.data.cosmos.serialization.hybridrow.NullValue; -import azure.data.cosmos.serialization.hybridrow.Result; -import azure.data.cosmos.serialization.hybridrow.RowBuffer; -import azure.data.cosmos.serialization.hybridrow.RowCursor; -import azure.data.cosmos.serialization.hybridrow.UnixDateTime; +import com.azure.data.cosmos.core.OutObject; +import com.azure.data.cosmos.core.RefObject; +import com.azure.data.cosmos.serialization.hybridrow.Float128; +import com.azure.data.cosmos.serialization.hybridrow.HybridRowVersion; +import com.azure.data.cosmos.serialization.hybridrow.MemorySpanResizer; +import com.azure.data.cosmos.serialization.hybridrow.NullValue; +import com.azure.data.cosmos.serialization.hybridrow.Result; +import com.azure.data.cosmos.serialization.hybridrow.RowBuffer; +import com.azure.data.cosmos.serialization.hybridrow.RowCursor; +import com.azure.data.cosmos.serialization.hybridrow.UnixDateTime; +import com.azure.data.cosmos.serialization.hybridrow.io.RowReader; import java.nio.file.Files; import java.time.LocalDateTime; @@ -39,11 +42,11 @@ public final class RowReaderUnitTests { this.resolver = new LayoutResolverNamespace(this.schema); } - public static void PrintReader(tangible.RefObject reader, int indent) { + public static void PrintReader(RefObject reader, int indent) { String str; - tangible.OutObject tempOut_str = new tangible.OutObject(); + OutObject tempOut_str = new OutObject(); ResultAssert.IsSuccess(DiagnosticConverter.ReaderToString(reader, tempOut_str)); - str = tempOut_str.argValue; + str = tempOut_str.get(); System.out.println(str); } @@ -179,10 +182,10 @@ public final class RowReaderUnitTests { RowReader reader = d.GetReader().clone(); assert reader.getLength() == d.Row.getLength(); - tangible.RefObject tempRef_reader = - new tangible.RefObject(reader); + RefObject tempRef_reader = + new RefObject(reader); RowReaderUnitTests.PrintReader(tempRef_reader, 0); - reader = tempRef_reader.argValue; + reader = tempRef_reader.get(); } // TODO: C# TO JAVA CONVERTER: Java annotations will not correspond to .NET attributes: @@ -196,68 +199,68 @@ public final class RowReaderUnitTests { "Mixed")).SchemaId); row.InitLayout(HybridRowVersion.V1, layout, this.resolver); - tangible.RefObject tempRef_row = - new tangible.RefObject(row); + RefObject tempRef_row = + new RefObject(row); ResultAssert.IsSuccess(RowWriter.WriteBuffer(tempRef_row, 2, RowReaderUnitTests.WriteNestedDocument)); - row = tempRef_row.argValue; - tangible.RefObject tempRef_row2 = - new tangible.RefObject(row); + row = tempRef_row.get(); + RefObject tempRef_row2 = + new RefObject(row); RowReader rowReader = new RowReader(tempRef_row2); - row = tempRef_row2.argValue; + row = tempRef_row2.get(); - tangible.RefObject tempRef_rowReader = - new tangible.RefObject(rowReader); + RefObject tempRef_rowReader = + new RefObject(rowReader); ResultAssert.IsSuccess(RowReaderUnitTests.ReadNestedDocumentDelegate(tempRef_rowReader, 0)); - rowReader = tempRef_rowReader.argValue; + rowReader = tempRef_rowReader.get(); - tangible.RefObject tempRef_row3 = - new tangible.RefObject(row); + RefObject tempRef_row3 = + new RefObject(row); rowReader = new RowReader(tempRef_row3); - row = tempRef_row3.argValue; - tangible.RefObject tempRef_rowReader2 = - new tangible.RefObject(rowReader); + row = tempRef_row3.get(); + RefObject tempRef_rowReader2 = + new RefObject(rowReader); ResultAssert.IsSuccess(RowReaderUnitTests.ReadNestedDocumentNonDelegate(tempRef_rowReader2, 0)); - rowReader = tempRef_rowReader2.argValue; + rowReader = tempRef_rowReader2.get(); - tangible.RefObject tempRef_row4 = - new tangible.RefObject(row); + RefObject tempRef_row4 = + new RefObject(row); rowReader = new RowReader(tempRef_row4); - row = tempRef_row4.argValue; - tangible.RefObject tempRef_rowReader3 = - new tangible.RefObject(rowReader); + row = tempRef_row4.get(); + RefObject tempRef_rowReader3 = + new RefObject(rowReader); ResultAssert.IsSuccess(RowReaderUnitTests.ReadNestedDocumentNonDelegateWithSkipScope(tempRef_rowReader3, 0)); - rowReader = tempRef_rowReader3.argValue; + rowReader = tempRef_rowReader3.get(); // SkipScope not okay after advancing parent - tangible.RefObject tempRef_row5 = - new tangible.RefObject(row); + RefObject tempRef_row5 = + new RefObject(row); rowReader = new RowReader(tempRef_row5); - row = tempRef_row5.argValue; + row = tempRef_row5.get(); assert rowReader.Read(); assert rowReader.getType().LayoutCode == LayoutCode.ObjectScope; RowReader nestedScope = rowReader.ReadScope().clone(); - tangible.RefObject tempRef_nestedScope = - new tangible.RefObject(nestedScope); + RefObject tempRef_nestedScope = + new RefObject(nestedScope); ResultAssert.IsSuccess(RowReaderUnitTests.ReadNestedDocumentDelegate(tempRef_nestedScope, 0)); - nestedScope = tempRef_nestedScope.argValue; + nestedScope = tempRef_nestedScope.get(); assert rowReader.Read(); - tangible.RefObject tempRef_nestedScope2 = - new tangible.RefObject(nestedScope); + RefObject tempRef_nestedScope2 = + new RefObject(nestedScope); Result result = rowReader.SkipScope(tempRef_nestedScope2); - nestedScope = tempRef_nestedScope2.argValue; + nestedScope = tempRef_nestedScope2.get(); assert Result.Success != result; } - private static Result ReadNestedDocumentDelegate(tangible.RefObject reader, int context) { - while (reader.argValue.Read()) { - switch (reader.argValue.getType().LayoutCode) { + private static Result ReadNestedDocumentDelegate(RefObject reader, int context) { + while (reader.get().Read()) { + switch (reader.get().getType().LayoutCode) { case TupleScope: { - ResultAssert.IsSuccess(reader.argValue.ReadScope(0, RowReaderUnitTests.ReadTuplePartial)); + ResultAssert.IsSuccess(reader.get().ReadScope(0, RowReaderUnitTests.ReadTuplePartial)); break; } case ObjectScope: { - ResultAssert.IsSuccess(reader.argValue.ReadScope(0, RowReaderUnitTests.ReadNestedDocumentDelegate)); + ResultAssert.IsSuccess(reader.get().ReadScope(0, RowReaderUnitTests.ReadNestedDocumentDelegate)); break; } } @@ -266,25 +269,25 @@ public final class RowReaderUnitTests { return Result.Success; } - private static Result ReadNestedDocumentNonDelegate(tangible.RefObject reader, int context) { - while (reader.argValue.Read()) { - switch (reader.argValue.getType().LayoutCode) { + private static Result ReadNestedDocumentNonDelegate(RefObject reader, int context) { + while (reader.get().Read()) { + switch (reader.get().getType().LayoutCode) { case TupleScope: { - RowReader nested = reader.argValue.ReadScope().clone(); - tangible.RefObject tempRef_nested = - new tangible.RefObject(nested); + RowReader nested = reader.get().ReadScope().clone(); + RefObject tempRef_nested = + new RefObject(nested); ResultAssert.IsSuccess(RowReaderUnitTests.ReadTuplePartial(tempRef_nested, 0)); - nested = tempRef_nested.argValue; + nested = tempRef_nested.get(); break; } case ObjectScope: { - RowReader nested = reader.argValue.ReadScope().clone(); - tangible.RefObject tempRef_nested2 = - new tangible.RefObject(nested); + RowReader nested = reader.get().ReadScope().clone(); + RefObject tempRef_nested2 = + new RefObject(nested); ResultAssert.IsSuccess(RowReaderUnitTests.ReadNestedDocumentNonDelegate(tempRef_nested2, 0)); - nested = tempRef_nested2.argValue; - ResultAssert.IsSuccess(reader.argValue.ReadScope(0, RowReaderUnitTests.ReadNestedDocumentDelegate)); + nested = tempRef_nested2.get(); + ResultAssert.IsSuccess(reader.get().ReadScope(0, RowReaderUnitTests.ReadNestedDocumentDelegate)); break; } } @@ -293,33 +296,33 @@ public final class RowReaderUnitTests { return Result.Success; } - private static Result ReadNestedDocumentNonDelegateWithSkipScope(tangible.RefObject reader, + private static Result ReadNestedDocumentNonDelegateWithSkipScope(RefObject reader, int context) { - while (reader.argValue.Read()) { - switch (reader.argValue.getType().LayoutCode) { + while (reader.get().Read()) { + switch (reader.get().getType().LayoutCode) { case TupleScope: { - RowReader nested = reader.argValue.ReadScope().clone(); - tangible.RefObject tempRef_nested = - new tangible.RefObject(nested); + RowReader nested = reader.get().ReadScope().clone(); + RefObject tempRef_nested = + new RefObject(nested); ResultAssert.IsSuccess(RowReaderUnitTests.ReadTuplePartial(tempRef_nested, 0)); - nested = tempRef_nested.argValue; - tangible.RefObject tempRef_nested2 = - new tangible.RefObject(nested); - ResultAssert.IsSuccess(reader.argValue.SkipScope(tempRef_nested2)); - nested = tempRef_nested2.argValue; + nested = tempRef_nested.get(); + RefObject tempRef_nested2 = + new RefObject(nested); + ResultAssert.IsSuccess(reader.get().SkipScope(tempRef_nested2)); + nested = tempRef_nested2.get(); break; } case ObjectScope: { - RowReader nested = reader.argValue.ReadScope().clone(); - tangible.RefObject tempRef_nested3 = - new tangible.RefObject(nested); + RowReader nested = reader.get().ReadScope().clone(); + RefObject tempRef_nested3 = + new RefObject(nested); ResultAssert.IsSuccess(RowReaderUnitTests.ReadNestedDocumentNonDelegate(tempRef_nested3, 0)); - nested = tempRef_nested3.argValue; - ResultAssert.IsSuccess(reader.argValue.ReadScope(0, RowReaderUnitTests.ReadNestedDocumentDelegate)); - tangible.RefObject tempRef_nested4 = new tangible.RefObject(nested); - ResultAssert.IsSuccess(reader.argValue.SkipScope(tempRef_nested4)); - nested = tempRef_nested4.argValue; + nested = tempRef_nested3.get(); + ResultAssert.IsSuccess(reader.get().ReadScope(0, RowReaderUnitTests.ReadNestedDocumentDelegate)); + RefObject tempRef_nested4 = new RefObject(nested); + ResultAssert.IsSuccess(reader.get().SkipScope(tempRef_nested4)); + nested = tempRef_nested4.get(); break; } } @@ -328,14 +331,14 @@ public final class RowReaderUnitTests { return Result.Success; } - private static Result ReadTuplePartial(tangible.RefObject reader, int unused) { + private static Result ReadTuplePartial(RefObject reader, int unused) { // Read only part of our tuple - assert reader.argValue.Read(); - assert reader.argValue.Read(); + assert reader.get().Read(); + assert reader.get().Read(); return Result.Success; } - private static Result WriteNestedDocument(tangible.RefObject writer, TypeArgument typeArgument, + private static Result WriteNestedDocument(RefObject writer, TypeArgument typeArgument, int level) { TypeArgument tupleArgument = new TypeArgument(LayoutType.Tuple, new TypeArgumentList(new TypeArgument[] { @@ -354,17 +357,17 @@ public final class RowReaderUnitTests { // } if (level == 0) { - ResultAssert.IsSuccess(writer.argValue.WriteScope("x", tupleArgument.clone(), 0, WriteTuple)); + ResultAssert.IsSuccess(writer.get().WriteScope("x", tupleArgument.clone(), 0, WriteTuple)); return Result.Success; } - ResultAssert.IsSuccess(writer.argValue.WriteScope("a", new TypeArgument(LayoutType.Object), level - 1, + ResultAssert.IsSuccess(writer.get().WriteScope("a", new TypeArgument(LayoutType.Object), level - 1, RowReaderUnitTests.WriteNestedDocument)); - ResultAssert.IsSuccess(writer.argValue.WriteScope("x", tupleArgument.clone(), 0, WriteTuple)); - ResultAssert.IsSuccess(writer.argValue.WriteScope("b", new TypeArgument(LayoutType.Object), level - 1, + ResultAssert.IsSuccess(writer.get().WriteScope("x", tupleArgument.clone(), 0, WriteTuple)); + ResultAssert.IsSuccess(writer.get().WriteScope("b", new TypeArgument(LayoutType.Object), level - 1, RowReaderUnitTests.WriteNestedDocument)); - ResultAssert.IsSuccess(writer.argValue.WriteScope("y", tupleArgument.clone(), 0, WriteTuple)); - ResultAssert.IsSuccess(writer.argValue.WriteScope("c", new TypeArgument(LayoutType.Object), level - 1, + ResultAssert.IsSuccess(writer.get().WriteScope("y", tupleArgument.clone(), 0, WriteTuple)); + ResultAssert.IsSuccess(writer.get().WriteScope("c", new TypeArgument(LayoutType.Object), level - 1, RowReaderUnitTests.WriteNestedDocument)); return Result.Success; @@ -381,18 +384,18 @@ public final class RowReaderUnitTests { this.Y = y; } - public void Dispatch(tangible.RefObject dispatcher, tangible.RefObject scope) { - dispatcher.argValue.LayoutCodeSwitch(scope, "x", value:this.X) - dispatcher.argValue.LayoutCodeSwitch(scope, "y", value:this.Y) + public void Dispatch(RefObject dispatcher, RefObject scope) { + dispatcher.get().LayoutCodeSwitch(scope, "x", value:this.X) + dispatcher.get().LayoutCodeSwitch(scope, "y", value:this.Y) } - public Result Write(tangible.RefObject writer, TypeArgument typeArg) { - Result result = writer.argValue.WriteInt32("x", this.X); + public Result Write(RefObject writer, TypeArgument typeArg) { + Result result = writer.get().WriteInt32("x", this.X); if (result != Result.Success) { return result; } - return writer.argValue.WriteInt32("y", this.Y); + return writer.get().WriteInt32("y", this.Y); } @Override diff --git a/jre/src/test/java/azure/data/cosmos/serialization/hybridrow/unit/RowWriterUnitTests.java b/jre/src/test/java/com/azure/data/cosmos/serialization/hybridrow/unit/RowWriterUnitTests.java similarity index 78% rename from jre/src/test/java/azure/data/cosmos/serialization/hybridrow/unit/RowWriterUnitTests.java rename to jre/src/test/java/com/azure/data/cosmos/serialization/hybridrow/unit/RowWriterUnitTests.java index c6d53d6..e19565b 100644 --- a/jre/src/test/java/azure/data/cosmos/serialization/hybridrow/unit/RowWriterUnitTests.java +++ b/jre/src/test/java/com/azure/data/cosmos/serialization/hybridrow/unit/RowWriterUnitTests.java @@ -2,14 +2,19 @@ // Copyright (c) Microsoft Corporation. All rights reserved. //------------------------------------------------------------ -package azure.data.cosmos.serialization.hybridrow.unit; +package com.azure.data.cosmos.serialization.hybridrow.unit; -import azure.data.cosmos.serialization.hybridrow.Float128; -import azure.data.cosmos.serialization.hybridrow.HybridRowVersion; -import azure.data.cosmos.serialization.hybridrow.NullValue; -import azure.data.cosmos.serialization.hybridrow.Result; -import azure.data.cosmos.serialization.hybridrow.RowBuffer; -import azure.data.cosmos.serialization.hybridrow.UnixDateTime; +import com.azure.data.cosmos.core.OutObject; +import com.azure.data.cosmos.core.RefObject; +import com.azure.data.cosmos.serialization.hybridrow.Float128; +import com.azure.data.cosmos.serialization.hybridrow.HybridRowVersion; +import com.azure.data.cosmos.serialization.hybridrow.NullValue; +import com.azure.data.cosmos.serialization.hybridrow.Result; +import com.azure.data.cosmos.serialization.hybridrow.RowBuffer; +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.RowWriter; +import com.azure.data.cosmos.serialization.hybridrow.layouts.LayoutColumn; import java.nio.file.Files; import java.time.LocalDateTime; @@ -49,8 +54,8 @@ public final class RowWriterUnitTests { row.InitLayout(HybridRowVersion.V1, layout, this.resolver); int writerLength = 0; - tangible.RefObject tempRef_row = - new tangible.RefObject(row); + RefObject tempRef_row = + new RefObject(row); // TODO: C# TO JAVA CONVERTER: The following lambda contained an unresolved 'ref' keyword - these are not // converted by C# to Java Converter: ResultAssert.IsSuccess(RowWriter.WriteBuffer(tempRef_row, null, (ref RowWriter writer, @@ -122,10 +127,10 @@ public final class RowWriterUnitTests { new ReadOnlySequence(new byte[] { (byte)0, (byte)1, (byte)2 }))); LayoutColumn col; - tangible.OutObject tempOut_col = - new tangible.OutObject(); + OutObject tempOut_col = + new OutObject(); assert layout.TryFind("array_t", tempOut_col); - col = tempOut_col.argValue; + col = tempOut_col.get(); ResultAssert.IsSuccess(writer.WriteScope(col.getPath(), col.getTypeArg().clone(), new byte[] { -86, -87, -88 }, (ref RowWriter writer2, TypeArgument typeArg, byte[] values) -> { @@ -136,10 +141,10 @@ public final class RowWriterUnitTests { return Result.Success; })); - tangible.OutObject tempOut_col2 = - new tangible.OutObject(); + OutObject tempOut_col2 = + new OutObject(); assert layout.TryFind("array_t>", tempOut_col2); - col = tempOut_col2.argValue; + col = tempOut_col2.get(); ResultAssert.IsSuccess(writer.WriteScope(col.getPath(), col.getTypeArg().clone(), new float[][] { new float[] { 1, 2, 3 }, @@ -161,10 +166,10 @@ public final class RowWriterUnitTests { return Result.Success; })); - tangible.OutObject tempOut_col3 = - new tangible.OutObject(); + OutObject tempOut_col3 = + new OutObject(); assert layout.TryFind("array_t", tempOut_col3); - col = tempOut_col3.argValue; + col = tempOut_col3.get(); ResultAssert.IsSuccess(writer.WriteScope(col.getPath(), col.getTypeArg().clone(), new String[] { "abc", "def", "hij" }, (ref RowWriter writer2, TypeArgument typeArg, String[] values) -> { @@ -175,10 +180,10 @@ public final class RowWriterUnitTests { return Result.Success; })); - tangible.OutObject tempOut_col4 = - new tangible.OutObject(); + OutObject tempOut_col4 = + new OutObject(); assert layout.TryFind("tuple", tempOut_col4); - col = tempOut_col4.argValue; + col = tempOut_col4.get(); ResultAssert.IsSuccess(writer.WriteScope(col.getPath(), col.getTypeArg().clone(), Tuple.Create(-6148914691236517206L, -6148914691236517206L), (ref RowWriter writer2, TypeArgument typeArg, @@ -189,10 +194,10 @@ public final class RowWriterUnitTests { return Result.Success; })); - tangible.OutObject tempOut_col5 = - new tangible.OutObject(); + OutObject tempOut_col5 = + new OutObject(); assert layout.TryFind("tuple>", tempOut_col5); - col = tempOut_col5.argValue; + col = tempOut_col5.get(); ResultAssert.IsSuccess(writer.WriteScope(col.getPath(), col.getTypeArg().clone(), Tuple.Create(NullValue.Default, Tuple.Create((byte)-86, (byte)-86)), (ref RowWriter writer2, TypeArgument typeArg, @@ -211,32 +216,32 @@ public final class RowWriterUnitTests { return Result.Success; })); - tangible.OutObject tempOut_col6 = - new tangible.OutObject(); + OutObject tempOut_col6 = + new OutObject(); assert layout.TryFind("tuple", tempOut_col6); - col = tempOut_col6.argValue; + col = tempOut_col6.get(); ResultAssert.IsSuccess(writer.WriteScope(col.getPath(), col.getTypeArg().clone(), Tuple.Create(false, new RowReaderUnitTests.Point(1, 2)), (ref RowWriter writer2, TypeArgument typeArg, Tuple values) -> { ResultAssert.IsSuccess(writer2.WriteBool(null, values.Item1)); - tangible.RefObject tempRef_writer3 = - new tangible.RefObject(writer3); + RefObject tempRef_writer3 = + new RefObject(writer3); ResultAssert.IsSuccess(writer2.WriteScope(null, typeArg.getTypeArgs().get(1).clone(), values.Item2, (ref RowWriter writer3, TypeArgument typeArg2, IRowSerializable values2) -> values2.Write(tempRef_writer3, typeArg2.clone()))); - writer3 = tempRef_writer3.argValue; + writer3 = tempRef_writer3.get(); return Result.Success; })); - tangible.OutObject tempOut_col7 = - new tangible.OutObject(); + OutObject tempOut_col7 = + new OutObject(); assert layout.TryFind("nullable", tempOut_col7); - col = tempOut_col7.argValue; + col = tempOut_col7.get(); ResultAssert.IsSuccess(writer.WriteScope(col.getPath(), col.getTypeArg().clone(), Tuple.Create(null, (Long)123L), (ref RowWriter writer2, TypeArgument typeArg, Tuple values) -> { - RowWriter.WriterFunc f0 = (tangible.RefObject writer, TypeArgument typeArg, + RowWriter.WriterFunc f0 = (RefObject writer, TypeArgument typeArg, Integer context) -> null.invoke(writer, typeArg.clone(), context); if (values.Item1 != null) { f0 = (ref RowWriter writer3, TypeArgument typeArg2, Integer value) -> writer3.WriteInt32(null, @@ -246,7 +251,7 @@ public final class RowWriterUnitTests { ResultAssert.IsSuccess(writer2.WriteScope(null, typeArg.getTypeArgs().get(0).clone(), values.Item1, f0)); - RowWriter.WriterFunc f1 = (tangible.RefObject writer, TypeArgument typeArg, + RowWriter.WriterFunc f1 = (RefObject writer, TypeArgument typeArg, Long context) -> null.invoke(writer, typeArg.clone(), context); if (values.Item2 != null) { f1 = (ref RowWriter writer3, TypeArgument typeArg2, Long value) -> writer3.WriteInt64(null, @@ -258,10 +263,10 @@ public final class RowWriterUnitTests { return Result.Success; })); - tangible.OutObject tempOut_col8 = - new tangible.OutObject(); + OutObject tempOut_col8 = + new OutObject(); assert layout.TryFind("tagged", tempOut_col8); - col = tempOut_col8.argValue; + col = tempOut_col8.get(); ResultAssert.IsSuccess(writer.WriteScope(col.getPath(), col.getTypeArg().clone(), Tuple.Create((byte)3, "hello"), (ref RowWriter writer2, TypeArgument typeArg, Tuple values) -> { @@ -270,10 +275,10 @@ public final class RowWriterUnitTests { return Result.Success; })); - tangible.OutObject tempOut_col9 = - new tangible.OutObject(); + OutObject tempOut_col9 = + new OutObject(); assert layout.TryFind("tagged", tempOut_col9); - col = tempOut_col9.argValue; + col = tempOut_col9.get(); ResultAssert.IsSuccess(writer.WriteScope(col.getPath(), col.getTypeArg().clone(), Tuple.Create((byte)5, true, "bye"), (ref RowWriter writer2, TypeArgument typeArg, Tuple values) -> { @@ -283,10 +288,10 @@ public final class RowWriterUnitTests { return Result.Success; })); - tangible.OutObject tempOut_col10 = - new tangible.OutObject(); + OutObject tempOut_col10 = + new OutObject(); assert layout.TryFind("set_t", tempOut_col10); - col = tempOut_col10.argValue; + col = tempOut_col10.get(); ResultAssert.IsSuccess(writer.WriteScope(col.getPath(), col.getTypeArg().clone(), new String[] { "abc", "xzy", "efg" }, (ref RowWriter writer2, TypeArgument typeArg, String[] values) -> { @@ -297,10 +302,10 @@ public final class RowWriterUnitTests { return Result.Success; })); - tangible.OutObject tempOut_col11 = - new tangible.OutObject(); + OutObject tempOut_col11 = + new OutObject(); assert layout.TryFind("set_t>", tempOut_col11); - col = tempOut_col11.argValue; + col = tempOut_col11.get(); ResultAssert.IsSuccess(writer.WriteScope(col.getPath(), col.getTypeArg().clone(), new byte[][] { new byte[] { 7, 8, 9 }, @@ -323,10 +328,10 @@ public final class RowWriterUnitTests { return Result.Success; })); - tangible.OutObject tempOut_col12 = - new tangible.OutObject(); + OutObject tempOut_col12 = + new OutObject(); assert layout.TryFind("set_t>", tempOut_col12); - col = tempOut_col12.argValue; + col = tempOut_col12.get(); ResultAssert.IsSuccess(writer.WriteScope(col.getPath(), col.getTypeArg().clone(), new int[][] { new int[] { 4, 5, 6 }, @@ -349,10 +354,10 @@ public final class RowWriterUnitTests { return Result.Success; })); - tangible.OutObject tempOut_col13 = - new tangible.OutObject(); + OutObject tempOut_col13 = + new OutObject(); assert layout.TryFind("set_t", tempOut_col13); - col = tempOut_col13.argValue; + col = tempOut_col13.get(); ResultAssert.IsSuccess(writer.WriteScope(col.getPath(), col.getTypeArg().clone(), new RowReaderUnitTests.Point[] { @@ -362,20 +367,20 @@ public final class RowWriterUnitTests { }, (ref RowWriter writer2, TypeArgument typeArg, RowReaderUnitTests.Point[] values) -> { for (RowReaderUnitTests.Point value : values) { - tangible.RefObject tempRef_writer3 = - new tangible.RefObject(writer3); + RefObject tempRef_writer3 = + new RefObject(writer3); ResultAssert.IsSuccess(writer2.WriteScope(null, typeArg.getTypeArgs().get(0).clone(), value, (ref RowWriter writer3, TypeArgument typeArg2, IRowSerializable values2) -> values2.Write(tempRef_writer3, typeArg2.clone()))); - writer3 = tempRef_writer3.argValue; + writer3 = tempRef_writer3.get(); } return Result.Success; })); - tangible.OutObject tempOut_col14 = - new tangible.OutObject(); + OutObject tempOut_col14 = + new OutObject(); assert layout.TryFind("map_t", tempOut_col14); - col = tempOut_col14.argValue; + col = tempOut_col14.get(); ResultAssert.IsSuccess(writer.WriteScope(col.getPath(), col.getTypeArg().clone(), new System.Tuple[] { Tuple.Create("Harrison", "Han"), Tuple.Create("Mark", "Luke") }, (ref RowWriter writer2, TypeArgument typeArg, @@ -395,10 +400,10 @@ public final class RowWriterUnitTests { return Result.Success; })); - tangible.OutObject tempOut_col15 = - new tangible.OutObject(); + OutObject tempOut_col15 = + new OutObject(); assert layout.TryFind("map_t>", tempOut_col15); - col = tempOut_col15.argValue; + col = tempOut_col15.get(); ResultAssert.IsSuccess(writer.WriteScope(col.getPath(), col.getTypeArg().clone(), new System.Tuple[] { Tuple.Create((byte)2, new byte[] { 4, 5, 6 }), Tuple.Create((byte)1, new byte[] { 1, 2, 3 }) }, (ref RowWriter writer2, TypeArgument typeArg, @@ -427,10 +432,10 @@ public final class RowWriterUnitTests { return Result.Success; })); - tangible.OutObject tempOut_col16 = - new tangible.OutObject(); + OutObject tempOut_col16 = + new OutObject(); assert layout.TryFind("map_t>", tempOut_col16); - col = tempOut_col16.argValue; + col = tempOut_col16.get(); ResultAssert.IsSuccess(writer.WriteScope(col.getPath(), col.getTypeArg().clone(), new System.Tuple[] { Tuple.Create((short)2, new System.Tuple[] { Tuple.Create(7, 8), Tuple.Create(5, 6) }) , Tuple.Create((short)1, new System.Tuple[] { Tuple.Create(3, 4), Tuple.Create(1, 2) }) }, @@ -467,19 +472,19 @@ public final class RowWriterUnitTests { return Result.Success; })); - tangible.OutObject tempOut_col17 = - new tangible.OutObject(); + OutObject tempOut_col17 = + new OutObject(); assert layout.TryFind("map_t", tempOut_col17); - col = tempOut_col17.argValue; + col = tempOut_col17.get(); ResultAssert.IsSuccess(writer.WriteScope(col.getPath(), col.getTypeArg().clone(), new System.Tuple[] { Tuple.Create(1.0, new RowReaderUnitTests.Point(1, 2)), Tuple.Create(2.0, new RowReaderUnitTests.Point(3, 4)), Tuple.Create(3.0, new RowReaderUnitTests.Point(5, 6)) }, (ref RowWriter writer2, TypeArgument typeArg, Tuple[] values) -> { for (Tuple value : values) { ResultAssert.IsSuccess(writer2.WriteScope(null, new TypeArgument(LayoutType.TypedTuple, typeArg.getTypeArgs().clone()), value, (ref RowWriter writer3, TypeArgument typeArg2, Tuple values2) -> { ResultAssert.IsSuccess(writer3.WriteFloat64(null, values2.Item1)); - tangible.RefObject tempRef_writer4 = new tangible.RefObject(writer4); + RefObject tempRef_writer4 = new RefObject(writer4); ResultAssert.IsSuccess(writer3.WriteScope(null, typeArg2.getTypeArgs().get(1).clone(), values2.Item2, (ref RowWriter writer4, TypeArgument typeArg3, IRowSerializable values3) -> values3.Write(tempRef_writer4, typeArg3.clone()))); - writer4 = tempRef_writer4.argValue; + writer4 = tempRef_writer4.get(); return Result.Success; })); @@ -492,14 +497,14 @@ public final class RowWriterUnitTests { writerLength = writer.Length; return Result.Success; })); - row = tempRef_row.argValue; + row = tempRef_row.get(); - tangible.RefObject tempRef_row2 = new tangible.RefObject(row); + RefObject tempRef_row2 = new RefObject(row); RowReader reader = new RowReader(tempRef_row2); - row = tempRef_row2.argValue; + row = tempRef_row2.get(); assert reader.getLength() == writerLength; - tangible.RefObject tempRef_reader = new tangible.RefObject(reader); + RefObject tempRef_reader = new RefObject(reader); RowReaderUnitTests.PrintReader(tempRef_reader, 0); - reader = tempRef_reader.argValue; + reader = tempRef_reader.get(); } } \ No newline at end of file diff --git a/jre/src/test/java/azure/data/cosmos/serialization/hybridrow/unit/SchemaHashUnitTests.java b/jre/src/test/java/com/azure/data/cosmos/serialization/hybridrow/unit/SchemaHashUnitTests.java similarity index 87% rename from jre/src/test/java/azure/data/cosmos/serialization/hybridrow/unit/SchemaHashUnitTests.java rename to jre/src/test/java/com/azure/data/cosmos/serialization/hybridrow/unit/SchemaHashUnitTests.java index ac7beda..f72ad5b 100644 --- a/jre/src/test/java/azure/data/cosmos/serialization/hybridrow/unit/SchemaHashUnitTests.java +++ b/jre/src/test/java/com/azure/data/cosmos/serialization/hybridrow/unit/SchemaHashUnitTests.java @@ -2,10 +2,11 @@ // Copyright (c) Microsoft Corporation. All rights reserved. //------------------------------------------------------------ -package azure.data.cosmos.serialization.hybridrow.unit; +package com.azure.data.cosmos.serialization.hybridrow.unit; import Newtonsoft.Json.*; -import azure.data.cosmos.serialization.hybridrow.SchemaId; +import com.azure.data.cosmos.serialization.hybridrow.SchemaId; +import com.azure.data.cosmos.serialization.hybridrow.schemas.PropertyType; import java.nio.file.Files; @@ -136,14 +137,14 @@ public class SchemaHashUnitTests { // Test Primitive Property Type changes clone = SchemaHashUnitTests.Clone(this.tableSchema); - Microsoft.Azure.Cosmos.Serialization.HybridRow.Schemas.PropertyType tempVar = + PropertyType tempVar = clone.getProperties().get(0).getPropertyType(); (tempVar instanceof PrimitivePropertyType ? (PrimitivePropertyType)tempVar : null).setLength(42); hash2 = SchemaHash.ComputeHash(this.ns, clone); assert hash != hash2; clone = SchemaHashUnitTests.Clone(this.tableSchema); - Microsoft.Azure.Cosmos.Serialization.HybridRow.Schemas.PropertyType tempVar2 = + PropertyType tempVar2 = clone.getProperties().get(0).getPropertyType(); (tempVar2 instanceof PrimitivePropertyType ? (PrimitivePropertyType)tempVar2 : null).setStorage(StorageKind.Variable); hash2 = SchemaHash.ComputeHash(this.ns, clone); @@ -151,9 +152,9 @@ public class SchemaHashUnitTests { // Test Scope Property Type changes clone = SchemaHashUnitTests.Clone(this.tableSchema); - Microsoft.Azure.Cosmos.Serialization.HybridRow.Schemas.PropertyType tempVar3 = + PropertyType tempVar3 = clone.getProperties().get(1).getPropertyType(); - Microsoft.Azure.Cosmos.Serialization.HybridRow.Schemas.PropertyType tempVar4 = + PropertyType tempVar4 = clone.getProperties().get(1).getPropertyType(); (tempVar3 instanceof ScopePropertyType ? (ScopePropertyType)tempVar3 : null).setImmutable(!(tempVar4 instanceof ScopePropertyType ? (ScopePropertyType)tempVar4 : null).getImmutable()); hash2 = SchemaHash.ComputeHash(this.ns, clone); @@ -161,7 +162,7 @@ public class SchemaHashUnitTests { // Test Array Property Type changes clone = SchemaHashUnitTests.Clone(this.tableSchema); - Microsoft.Azure.Cosmos.Serialization.HybridRow.Schemas.PropertyType tempVar5 = + PropertyType tempVar5 = clone.getProperties().get(1).getPropertyType(); (tempVar5 instanceof ArrayPropertyType ? (ArrayPropertyType)tempVar5 : null).setItems(clone.getProperties().get(0).getPropertyType()); hash2 = SchemaHash.ComputeHash(this.ns, clone); @@ -169,7 +170,7 @@ public class SchemaHashUnitTests { // Test Object Property Type changes clone = SchemaHashUnitTests.Clone(this.tableSchema); - Microsoft.Azure.Cosmos.Serialization.HybridRow.Schemas.PropertyType tempVar6 = + PropertyType tempVar6 = clone.getProperties().get(2).getPropertyType(); (tempVar6 instanceof ObjectPropertyType ? (ObjectPropertyType)tempVar6 : null).getProperties().set(0, clone.getProperties().get(0)); @@ -178,14 +179,14 @@ public class SchemaHashUnitTests { // Test Map Property Type changes clone = SchemaHashUnitTests.Clone(this.tableSchema); - Microsoft.Azure.Cosmos.Serialization.HybridRow.Schemas.PropertyType tempVar7 = + PropertyType tempVar7 = clone.getProperties().get(3).getPropertyType(); (tempVar7 instanceof MapPropertyType ? (MapPropertyType)tempVar7 : null).setKeys(clone.getProperties().get(0).getPropertyType()); hash2 = SchemaHash.ComputeHash(this.ns, clone); assert hash != hash2; clone = SchemaHashUnitTests.Clone(this.tableSchema); - Microsoft.Azure.Cosmos.Serialization.HybridRow.Schemas.PropertyType tempVar8 = + PropertyType tempVar8 = clone.getProperties().get(3).getPropertyType(); (tempVar8 instanceof MapPropertyType ? (MapPropertyType)tempVar8 : null).setValues(clone.getProperties().get(0).getPropertyType()); hash2 = SchemaHash.ComputeHash(this.ns, clone); @@ -193,7 +194,7 @@ public class SchemaHashUnitTests { // Test Set Property Type changes clone = SchemaHashUnitTests.Clone(this.tableSchema); - Microsoft.Azure.Cosmos.Serialization.HybridRow.Schemas.PropertyType tempVar9 = + PropertyType tempVar9 = clone.getProperties().get(4).getPropertyType(); (tempVar9 instanceof SetPropertyType ? (SetPropertyType)tempVar9 : null).setItems(clone.getProperties().get(0).getPropertyType()); hash2 = SchemaHash.ComputeHash(this.ns, clone); @@ -201,7 +202,7 @@ public class SchemaHashUnitTests { // Test Tagged Property Type changes clone = SchemaHashUnitTests.Clone(this.tableSchema); - Microsoft.Azure.Cosmos.Serialization.HybridRow.Schemas.PropertyType tempVar10 = + PropertyType tempVar10 = clone.getProperties().get(5).getPropertyType(); (tempVar10 instanceof TaggedPropertyType ? (TaggedPropertyType)tempVar10 : null).getItems().set(0, clone.getProperties().get(0).getPropertyType()); @@ -210,7 +211,7 @@ public class SchemaHashUnitTests { // Test Tuple Property Type changes clone = SchemaHashUnitTests.Clone(this.tableSchema); - Microsoft.Azure.Cosmos.Serialization.HybridRow.Schemas.PropertyType tempVar11 = + PropertyType tempVar11 = clone.getProperties().get(6).getPropertyType(); (tempVar11 instanceof TuplePropertyType ? (TuplePropertyType)tempVar11 : null).getItems().set(0, clone.getProperties().get(0).getPropertyType()); @@ -220,7 +221,7 @@ public class SchemaHashUnitTests { // Test UDT Property Type changes try { clone = SchemaHashUnitTests.Clone(this.tableSchema); - Microsoft.Azure.Cosmos.Serialization.HybridRow.Schemas.PropertyType tempVar12 = + PropertyType tempVar12 = clone.getProperties().get(7).getPropertyType(); (tempVar12 instanceof UdtPropertyType ? (UdtPropertyType)tempVar12 : null).setName("some non-existing UDT" + " name"); @@ -232,7 +233,7 @@ public class SchemaHashUnitTests { try { clone = SchemaHashUnitTests.Clone(this.tableSchema); - Microsoft.Azure.Cosmos.Serialization.HybridRow.Schemas.PropertyType tempVar13 = + PropertyType tempVar13 = clone.getProperties().get(7).getPropertyType(); (tempVar13 instanceof UdtPropertyType ? (UdtPropertyType)tempVar13 : null).setName("Table"); hash2 = SchemaHash.ComputeHash(this.ns, clone); @@ -242,10 +243,10 @@ public class SchemaHashUnitTests { } clone = SchemaHashUnitTests.Clone(this.tableSchema); - Microsoft.Azure.Cosmos.Serialization.HybridRow.Schemas.PropertyType tempVar14 = + PropertyType tempVar14 = clone.getProperties().get(7).getPropertyType(); (tempVar14 instanceof UdtPropertyType ? (UdtPropertyType)tempVar14 : null).setName("Table"); - Microsoft.Azure.Cosmos.Serialization.HybridRow.Schemas.PropertyType tempVar15 = + PropertyType tempVar15 = clone.getProperties().get(7).getPropertyType(); (tempVar15 instanceof UdtPropertyType ? (UdtPropertyType)tempVar15 : null).setSchemaId(new SchemaId(2)); hash2 = SchemaHash.ComputeHash(this.ns, clone); @@ -254,7 +255,7 @@ public class SchemaHashUnitTests { // Renaming an UDT is not a breaking change as long as the SchemaId has not changed. this.ns.getSchemas().get(0).setName("RenameActualUDT"); clone = SchemaHashUnitTests.Clone(this.tableSchema); - Microsoft.Azure.Cosmos.Serialization.HybridRow.Schemas.PropertyType tempVar16 = clone.getProperties().get(7).getPropertyType(); + PropertyType tempVar16 = clone.getProperties().get(7).getPropertyType(); (tempVar16 instanceof UdtPropertyType ? (UdtPropertyType)tempVar16 : null).setName("RenameActualUDT"); hash2 = SchemaHash.ComputeHash(this.ns, clone); assert hash == hash2; diff --git a/jre/src/test/java/azure/data/cosmos/serialization/hybridrow/unit/SchemaIdUnitTests.java b/jre/src/test/java/com/azure/data/cosmos/serialization/hybridrow/unit/SchemaIdUnitTests.java similarity index 82% rename from jre/src/test/java/azure/data/cosmos/serialization/hybridrow/unit/SchemaIdUnitTests.java rename to jre/src/test/java/com/azure/data/cosmos/serialization/hybridrow/unit/SchemaIdUnitTests.java index e99a825..de2aa25 100644 --- a/jre/src/test/java/azure/data/cosmos/serialization/hybridrow/unit/SchemaIdUnitTests.java +++ b/jre/src/test/java/com/azure/data/cosmos/serialization/hybridrow/unit/SchemaIdUnitTests.java @@ -2,10 +2,10 @@ // Copyright (c) Microsoft Corporation. All rights reserved. //------------------------------------------------------------ -package azure.data.cosmos.serialization.hybridrow.unit; +package com.azure.data.cosmos.serialization.hybridrow.unit; import Newtonsoft.Json.*; -import 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: //ORIGINAL LINE: [TestClass] public class SchemaIdUnitTests @@ -22,8 +22,8 @@ public class SchemaIdUnitTests { assert SchemaId.Invalid == c.clone(); assert 2 != a.getId(); assert a.clone() != b.clone(); - assert azure.data.cosmos.serialization.hybridrow.SchemaId.opEquals(a.clone(), a.clone()); - assert azure.data.cosmos.serialization.hybridrow.SchemaId.opNotEquals(a.clone(), b.clone()); + assert SchemaId.opEquals(a.clone(), a.clone()); + assert SchemaId.opNotEquals(a.clone(), b.clone()); assert !a.equals(null); assert a.hashCode() == (new SchemaId(1)).hashCode(); assert a.hashCode() != (new SchemaId(-1)).hashCode(); diff --git a/jre/src/test/java/azure/data/cosmos/serialization/hybridrow/unit/SchemaUnitTests.java b/jre/src/test/java/com/azure/data/cosmos/serialization/hybridrow/unit/SchemaUnitTests.java similarity index 81% rename from jre/src/test/java/azure/data/cosmos/serialization/hybridrow/unit/SchemaUnitTests.java rename to jre/src/test/java/com/azure/data/cosmos/serialization/hybridrow/unit/SchemaUnitTests.java index 5ed5381..e3800f3 100644 --- a/jre/src/test/java/azure/data/cosmos/serialization/hybridrow/unit/SchemaUnitTests.java +++ b/jre/src/test/java/com/azure/data/cosmos/serialization/hybridrow/unit/SchemaUnitTests.java @@ -2,10 +2,13 @@ // Copyright (c) Microsoft Corporation. All rights reserved. //------------------------------------------------------------ -package azure.data.cosmos.serialization.hybridrow.unit; +package com.azure.data.cosmos.serialization.hybridrow.unit; import Newtonsoft.Json.*; -import azure.data.cosmos.serialization.hybridrow.SchemaId; +import com.azure.data.cosmos.serialization.hybridrow.SchemaId; +import com.azure.data.cosmos.serialization.hybridrow.schemas.SortDirection; +import com.azure.data.cosmos.serialization.hybridrow.schemas.StorageKind; +import com.azure.data.cosmos.serialization.hybridrow.schemas.TypeKind; import java.nio.file.Files; @@ -110,12 +113,12 @@ public class SchemaUnitTests { class AnonymousType { public String Path; - public Microsoft.Azure.Cosmos.Serialization.HybridRow.Schemas.StorageKind Storage; - public Microsoft.Azure.Cosmos.Serialization.HybridRow.Schemas.TypeKind Type; + public StorageKind Storage; + public TypeKind Type; public AnonymousType(String _Path, - Microsoft.Azure.Cosmos.Serialization.HybridRow.Schemas.TypeKind _Type, - Microsoft.Azure.Cosmos.Serialization.HybridRow.Schemas.StorageKind _Storage) { + TypeKind _Type, + StorageKind _Storage) { Path = _Path; Type = _Type; Storage = _Storage; @@ -123,12 +126,12 @@ public class SchemaUnitTests { } class AnonymousType2 { public String Path; - public Microsoft.Azure.Cosmos.Serialization.HybridRow.Schemas.StorageKind Storage; - public Microsoft.Azure.Cosmos.Serialization.HybridRow.Schemas.TypeKind Type; + public StorageKind Storage; + public TypeKind Type; public AnonymousType2(String _Path, - Microsoft.Azure.Cosmos.Serialization.HybridRow.Schemas.TypeKind _Type, - Microsoft.Azure.Cosmos.Serialization.HybridRow.Schemas.StorageKind _Storage) { + TypeKind _Type, + StorageKind _Storage) { Path = _Path; Type = _Type; Storage = _Storage; @@ -170,9 +173,9 @@ public class SchemaUnitTests { // Test all primitive column types. class AnonymousType { public String Json; - public Microsoft.Azure.Cosmos.Serialization.HybridRow.Schemas.TypeKind Type; + public TypeKind Type; - public AnonymousType(String _Json, Microsoft.Azure.Cosmos.Serialization.HybridRow.Schemas.TypeKind _Type) { + public AnonymousType(String _Json, TypeKind _Type) { Json = _Json; Type = _Type; } @@ -180,10 +183,10 @@ public class SchemaUnitTests { class AnonymousType10 { public String Json; - public Microsoft.Azure.Cosmos.Serialization.HybridRow.Schemas.TypeKind Type; + public TypeKind Type; public AnonymousType10(String _Json, - Microsoft.Azure.Cosmos.Serialization.HybridRow.Schemas.TypeKind _Type) { + TypeKind _Type) { Json = _Json; Type = _Type; } @@ -191,10 +194,10 @@ public class SchemaUnitTests { class AnonymousType11 { public String Json; - public Microsoft.Azure.Cosmos.Serialization.HybridRow.Schemas.TypeKind Type; + public TypeKind Type; public AnonymousType11(String _Json, - Microsoft.Azure.Cosmos.Serialization.HybridRow.Schemas.TypeKind _Type) { + TypeKind _Type) { Json = _Json; Type = _Type; } @@ -202,10 +205,10 @@ public class SchemaUnitTests { class AnonymousType12 { public String Json; - public Microsoft.Azure.Cosmos.Serialization.HybridRow.Schemas.TypeKind Type; + public TypeKind Type; public AnonymousType12(String _Json, - Microsoft.Azure.Cosmos.Serialization.HybridRow.Schemas.TypeKind _Type) { + TypeKind _Type) { Json = _Json; Type = _Type; } @@ -213,10 +216,10 @@ public class SchemaUnitTests { class AnonymousType13 { public String Json; - public Microsoft.Azure.Cosmos.Serialization.HybridRow.Schemas.TypeKind Type; + public TypeKind Type; public AnonymousType13(String _Json, - Microsoft.Azure.Cosmos.Serialization.HybridRow.Schemas.TypeKind _Type) { + TypeKind _Type) { Json = _Json; Type = _Type; } @@ -224,10 +227,10 @@ public class SchemaUnitTests { class AnonymousType14 { public String Json; - public Microsoft.Azure.Cosmos.Serialization.HybridRow.Schemas.TypeKind Type; + public TypeKind Type; public AnonymousType14(String _Json, - Microsoft.Azure.Cosmos.Serialization.HybridRow.Schemas.TypeKind _Type) { + TypeKind _Type) { Json = _Json; Type = _Type; } @@ -235,10 +238,10 @@ public class SchemaUnitTests { class AnonymousType15 { public String Json; - public Microsoft.Azure.Cosmos.Serialization.HybridRow.Schemas.TypeKind Type; + public TypeKind Type; public AnonymousType15(String _Json, - Microsoft.Azure.Cosmos.Serialization.HybridRow.Schemas.TypeKind _Type) { + TypeKind _Type) { Json = _Json; Type = _Type; } @@ -246,10 +249,10 @@ public class SchemaUnitTests { class AnonymousType16 { public String Json; - public Microsoft.Azure.Cosmos.Serialization.HybridRow.Schemas.TypeKind Type; + public TypeKind Type; public AnonymousType16(String _Json, - Microsoft.Azure.Cosmos.Serialization.HybridRow.Schemas.TypeKind _Type) { + TypeKind _Type) { Json = _Json; Type = _Type; } @@ -257,10 +260,10 @@ public class SchemaUnitTests { class AnonymousType17 { public String Json; - public Microsoft.Azure.Cosmos.Serialization.HybridRow.Schemas.TypeKind Type; + public TypeKind Type; public AnonymousType17(String _Json, - Microsoft.Azure.Cosmos.Serialization.HybridRow.Schemas.TypeKind _Type) { + TypeKind _Type) { Json = _Json; Type = _Type; } @@ -268,10 +271,10 @@ public class SchemaUnitTests { class AnonymousType18 { public String Json; - public Microsoft.Azure.Cosmos.Serialization.HybridRow.Schemas.TypeKind Type; + public TypeKind Type; public AnonymousType18(String _Json, - Microsoft.Azure.Cosmos.Serialization.HybridRow.Schemas.TypeKind _Type) { + TypeKind _Type) { Json = _Json; Type = _Type; } @@ -279,10 +282,10 @@ public class SchemaUnitTests { class AnonymousType19 { public String Json; - public Microsoft.Azure.Cosmos.Serialization.HybridRow.Schemas.TypeKind Type; + public TypeKind Type; public AnonymousType19(String _Json, - Microsoft.Azure.Cosmos.Serialization.HybridRow.Schemas.TypeKind _Type) { + TypeKind _Type) { Json = _Json; Type = _Type; } @@ -290,9 +293,9 @@ public class SchemaUnitTests { class AnonymousType2 { public String Json; - public Microsoft.Azure.Cosmos.Serialization.HybridRow.Schemas.TypeKind Type; + public TypeKind Type; - public AnonymousType2(String _Json, Microsoft.Azure.Cosmos.Serialization.HybridRow.Schemas.TypeKind _Type) { + public AnonymousType2(String _Json, TypeKind _Type) { Json = _Json; Type = _Type; } @@ -301,10 +304,10 @@ public class SchemaUnitTests { class AnonymousType20 { public String Json; public int Len; - public Microsoft.Azure.Cosmos.Serialization.HybridRow.Schemas.TypeKind Type; + public TypeKind Type; public AnonymousType20(String _Json, - Microsoft.Azure.Cosmos.Serialization.HybridRow.Schemas.TypeKind _Type, int _Len) { + TypeKind _Type, int _Len) { Json = _Json; Type = _Type; Len = _Len; @@ -314,10 +317,10 @@ public class SchemaUnitTests { class AnonymousType21 { public String Json; public int Len; - public Microsoft.Azure.Cosmos.Serialization.HybridRow.Schemas.TypeKind Type; + public TypeKind Type; public AnonymousType21(String _Json, - Microsoft.Azure.Cosmos.Serialization.HybridRow.Schemas.TypeKind _Type, int _Len) { + TypeKind _Type, int _Len) { Json = _Json; Type = _Type; Len = _Len; @@ -327,10 +330,10 @@ public class SchemaUnitTests { class AnonymousType22 { public String Json; public int Len; - public Microsoft.Azure.Cosmos.Serialization.HybridRow.Schemas.TypeKind Type; + public TypeKind Type; public AnonymousType22(String _Json, - Microsoft.Azure.Cosmos.Serialization.HybridRow.Schemas.TypeKind _Type, int _Len) { + TypeKind _Type, int _Len) { Json = _Json; Type = _Type; Len = _Len; @@ -340,10 +343,10 @@ public class SchemaUnitTests { class AnonymousType23 { public String Json; public int Len; - public Microsoft.Azure.Cosmos.Serialization.HybridRow.Schemas.TypeKind Type; + public TypeKind Type; public AnonymousType23(String _Json, - Microsoft.Azure.Cosmos.Serialization.HybridRow.Schemas.TypeKind _Type, int _Len) { + TypeKind _Type, int _Len) { Json = _Json; Type = _Type; Len = _Len; @@ -353,10 +356,10 @@ public class SchemaUnitTests { class AnonymousType24 { public String Json; public int Len; - public Microsoft.Azure.Cosmos.Serialization.HybridRow.Schemas.TypeKind Type; + public TypeKind Type; public AnonymousType24(String _Json, - Microsoft.Azure.Cosmos.Serialization.HybridRow.Schemas.TypeKind _Type, int _Len) { + TypeKind _Type, int _Len) { Json = _Json; Type = _Type; Len = _Len; @@ -366,10 +369,10 @@ public class SchemaUnitTests { class AnonymousType25 { public String Json; public int Len; - public Microsoft.Azure.Cosmos.Serialization.HybridRow.Schemas.TypeKind Type; + public TypeKind Type; public AnonymousType25(String _Json, - Microsoft.Azure.Cosmos.Serialization.HybridRow.Schemas.TypeKind _Type, int _Len) { + TypeKind _Type, int _Len) { Json = _Json; Type = _Type; Len = _Len; @@ -378,9 +381,9 @@ public class SchemaUnitTests { class AnonymousType3 { public String Json; - public Microsoft.Azure.Cosmos.Serialization.HybridRow.Schemas.TypeKind Type; + public TypeKind Type; - public AnonymousType3(String _Json, Microsoft.Azure.Cosmos.Serialization.HybridRow.Schemas.TypeKind _Type) { + public AnonymousType3(String _Json, TypeKind _Type) { Json = _Json; Type = _Type; } @@ -388,9 +391,9 @@ public class SchemaUnitTests { class AnonymousType4 { public String Json; - public Microsoft.Azure.Cosmos.Serialization.HybridRow.Schemas.TypeKind Type; + public TypeKind Type; - public AnonymousType4(String _Json, Microsoft.Azure.Cosmos.Serialization.HybridRow.Schemas.TypeKind _Type) { + public AnonymousType4(String _Json, TypeKind _Type) { Json = _Json; Type = _Type; } @@ -398,9 +401,9 @@ public class SchemaUnitTests { class AnonymousType5 { public String Json; - public Microsoft.Azure.Cosmos.Serialization.HybridRow.Schemas.TypeKind Type; + public TypeKind Type; - public AnonymousType5(String _Json, Microsoft.Azure.Cosmos.Serialization.HybridRow.Schemas.TypeKind _Type) { + public AnonymousType5(String _Json, TypeKind _Type) { Json = _Json; Type = _Type; } @@ -408,9 +411,9 @@ public class SchemaUnitTests { class AnonymousType6 { public String Json; - public Microsoft.Azure.Cosmos.Serialization.HybridRow.Schemas.TypeKind Type; + public TypeKind Type; - public AnonymousType6(String _Json, Microsoft.Azure.Cosmos.Serialization.HybridRow.Schemas.TypeKind _Type) { + public AnonymousType6(String _Json, TypeKind _Type) { Json = _Json; Type = _Type; } @@ -418,9 +421,9 @@ public class SchemaUnitTests { class AnonymousType7 { public String Json; - public Microsoft.Azure.Cosmos.Serialization.HybridRow.Schemas.TypeKind Type; + public TypeKind Type; - public AnonymousType7(String _Json, Microsoft.Azure.Cosmos.Serialization.HybridRow.Schemas.TypeKind _Type) { + public AnonymousType7(String _Json, TypeKind _Type) { Json = _Json; Type = _Type; } @@ -428,9 +431,9 @@ public class SchemaUnitTests { class AnonymousType8 { public String Json; - public Microsoft.Azure.Cosmos.Serialization.HybridRow.Schemas.TypeKind Type; + public TypeKind Type; - public AnonymousType8(String _Json, Microsoft.Azure.Cosmos.Serialization.HybridRow.Schemas.TypeKind _Type) { + public AnonymousType8(String _Json, TypeKind _Type) { Json = _Json; Type = _Type; } @@ -438,9 +441,9 @@ public class SchemaUnitTests { class AnonymousType9 { public String Json; - public Microsoft.Azure.Cosmos.Serialization.HybridRow.Schemas.TypeKind Type; + public TypeKind Type; - public AnonymousType9(String _Json, Microsoft.Azure.Cosmos.Serialization.HybridRow.Schemas.TypeKind _Type) { + public AnonymousType9(String _Json, TypeKind _Type) { Json = _Json; Type = _Type; } @@ -483,9 +486,9 @@ public final void ParseSchemaArray() // Test array types include nested arrays. class AnonymousType { public String Json; - public Microsoft.Azure.Cosmos.Serialization.HybridRow.Schemas.TypeKind Type; + public TypeKind Type; - public AnonymousType(String _Json, Microsoft.Azure.Cosmos.Serialization.HybridRow.Schemas.TypeKind _Type) { + public AnonymousType(String _Json, TypeKind _Type) { Json = _Json; Type = _Type; } @@ -493,9 +496,9 @@ class AnonymousType { class AnonymousType2 { public String Json; - public Microsoft.Azure.Cosmos.Serialization.HybridRow.Schemas.TypeKind Type; + public TypeKind Type; - public AnonymousType2(String _Json, Microsoft.Azure.Cosmos.Serialization.HybridRow.Schemas.TypeKind _Type) { + public AnonymousType2(String _Json, TypeKind _Type) { Json = _Json; Type = _Type; } @@ -565,9 +568,9 @@ public final void ParseSchemaObject() // Test object types include nested objects. class AnonymousType { public String Json; - public Microsoft.Azure.Cosmos.Serialization.HybridRow.Schemas.TypeKind Type; + public TypeKind Type; - public AnonymousType(String _Json, Microsoft.Azure.Cosmos.Serialization.HybridRow.Schemas.TypeKind _Type) { + public AnonymousType(String _Json, TypeKind _Type) { Json = _Json; Type = _Type; } @@ -575,9 +578,9 @@ class AnonymousType { class AnonymousType2 { public String Json; - public Microsoft.Azure.Cosmos.Serialization.HybridRow.Schemas.TypeKind Type; + public TypeKind Type; - public AnonymousType2(String _Json, Microsoft.Azure.Cosmos.Serialization.HybridRow.Schemas.TypeKind _Type) { + public AnonymousType2(String _Json, TypeKind _Type) { Json = _Json; Type = _Type; } @@ -671,25 +674,25 @@ class AnonymousType { } class AnonymousType2 { - public Microsoft.Azure.Cosmos.Serialization.HybridRow.Schemas.SortDirection Dir; + public SortDirection Dir; pulic String Path - pubblic AnonymousType2(String _Path, Microsoft.Azure.Cosmos.Serialization.HybridRow.Schemas.SortDirection _Dir) { + pubblic AnonymousType2(String _Path, SortDirection _Dir) { Path = _Path; Dir = _Dir; } } class AnonymousType3 { - public Microsoft.Azure.Cosmos.Serialization.HybridRow.Schemas.SortDirection Dir; + public SortDirection Dir; pulic String Path pubblct[] expectedSchemas = new Object[] { AnonymousType("{'path': 'a'}", "{'path': 'b', 'direction': 'desc'}, " + "{'path': 'c'}", new String[] { "a" }, new Object[] { AnonymousType2("b", SortDirection.Descending), AnonymousType3("c", SortDirection.Ascending) }) }; - for(bjeic AnonymousType3(String _Path, Microsoft.Azure.Cosmos.Serialization.HybridRow.Schemas.SortDirection _Dir) { + for(bjeic AnonymousType3(String _Path, SortDirection _Dir) { Path = _Path; Dir = _Dir; } diff --git a/jre/src/test/java/azure/data/cosmos/serialization/hybridrow/unit/SerializerUnitTest.java b/jre/src/test/java/com/azure/data/cosmos/serialization/hybridrow/unit/SerializerUnitTest.java similarity index 60% rename from jre/src/test/java/azure/data/cosmos/serialization/hybridrow/unit/SerializerUnitTest.java rename to jre/src/test/java/com/azure/data/cosmos/serialization/hybridrow/unit/SerializerUnitTest.java index a344c76..2c6f1aa 100644 --- a/jre/src/test/java/azure/data/cosmos/serialization/hybridrow/unit/SerializerUnitTest.java +++ b/jre/src/test/java/com/azure/data/cosmos/serialization/hybridrow/unit/SerializerUnitTest.java @@ -2,12 +2,17 @@ // Copyright (c) Microsoft Corporation. All rights reserved. //------------------------------------------------------------ -package azure.data.cosmos.serialization.hybridrow.unit; +package com.azure.data.cosmos.serialization.hybridrow.unit; -import azure.data.cosmos.serialization.hybridrow.HybridRowVersion; -import azure.data.cosmos.serialization.hybridrow.Result; -import azure.data.cosmos.serialization.hybridrow.RowBuffer; -import azure.data.cosmos.serialization.hybridrow.SchemaId; +import com.azure.data.cosmos.core.OutObject; +import com.azure.data.cosmos.core.RefObject; +import com.azure.data.cosmos.serialization.hybridrow.HybridRowVersion; +import com.azure.data.cosmos.serialization.hybridrow.Result; +import com.azure.data.cosmos.serialization.hybridrow.RowBuffer; +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.RowReaderExtensions; +import com.azure.data.cosmos.serialization.hybridrow.layouts.TypeArgument; import java.nio.file.Files; import java.util.ArrayList; @@ -62,39 +67,39 @@ public final class SerializerUnitTest { // Write the request by serializing it to a row. RowBuffer row = new RowBuffer(SerializerUnitTest.InitialRowSize); row.InitLayout(HybridRowVersion.V1, this.layout, this.resolver); - tangible.RefObject tempRef_row = - new tangible.RefObject(row); + RefObject tempRef_row = + new RefObject(row); Result r = RowWriter.WriteBuffer(tempRef_row, request, BatchRequestSerializer.Write); - row = tempRef_row.argValue; + row = tempRef_row.get(); assert Result.Success == r; System.out.printf("Length of serialized row: %1$s" + "\r\n", row.getLength()); // Read the row back again. - tangible.RefObject tempRef_row2 = - new tangible.RefObject(row); + RefObject tempRef_row2 = + new RefObject(row); RowReader reader = new RowReader(tempRef_row2); - row = tempRef_row2.argValue; - tangible.RefObject tempRef_reader = - new tangible.RefObject(reader); + row = tempRef_row2.get(); + RefObject tempRef_reader = + new RefObject(reader); BatchRequest _; - tangible.OutObject tempOut__ = new tangible.OutObject(); + OutObject tempOut__ = new OutObject(); r = BatchRequestSerializer.Read(tempRef_reader, tempOut__); - _ = tempOut__.argValue; - reader = tempRef_reader.argValue; + _ = tempOut__.get(); + reader = tempRef_reader.get(); assert Result.Success == r; // Dump the materialized request to the console. - tangible.RefObject tempRef_row3 = - new tangible.RefObject(row); + RefObject tempRef_row3 = + new RefObject(row); reader = new RowReader(tempRef_row3); - row = tempRef_row3.argValue; - tangible.RefObject tempRef_reader2 = - new tangible.RefObject(reader); + row = tempRef_row3.get(); + RefObject tempRef_reader2 = + new RefObject(reader); String dumpStr; // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'out' keyword - these // cannot be converted using the 'OutObject' helper class unless the method is within the code being modified: r = DiagnosticConverter.ReaderToString(tempRef_reader2, out dumpStr); - reader = tempRef_reader2.argValue; + reader = tempRef_reader2.get(); assert Result.Success == r; System.out.println(dumpStr); } @@ -131,59 +136,59 @@ public final class SerializerUnitTest { public static final TypeArgument TypeArg = new TypeArgument(LayoutType.UDT, new TypeArgumentList(new SchemaId(2))); - public static Result Read(tangible.RefObject reader, tangible.OutObject operation) { + public static Result Read(RefObject reader, OutObject operation) { BatchOperation retval = new BatchOperation(); - operation.argValue = null; - while (reader.argValue.Read()) { + operation.set(null); + while (reader.get().Read()) { Result r; - switch (reader.argValue.getPath()) { + switch (reader.get().getPath()) { case "operationType": - tangible.OutObject tempOut_OperationType = new tangible.OutObject(); - r = reader.argValue.ReadInt32(tempOut_OperationType); - retval.OperationType = tempOut_OperationType.argValue; + OutObject tempOut_OperationType = new OutObject(); + r = reader.get().ReadInt32(tempOut_OperationType); + retval.OperationType = tempOut_OperationType.get(); if (r != Result.Success) { return r; } break; case "headers": - tangible.RefObject tempRef_child = new tangible.RefObject(child); - tangible.OutObject tempOut_Headers = new tangible.OutObject(); + RefObject tempRef_child = new RefObject(child); + OutObject tempOut_Headers = new OutObject(); // TODO: C# TO JAVA CONVERTER: The following lambda contained an unresolved 'ref' keyword // - these are not converted by C# to Java Converter: - r = reader.argValue.ReadScope(retval, + r = reader.get().ReadScope(retval, (ref RowReader child, BatchOperation parent) -> BatchRequestHeadersSerializer.Read(tempRef_child, tempOut_Headers)); - parent.Headers = tempOut_Headers.argValue; - child = tempRef_child.argValue; + parent.Headers = tempOut_Headers.get(); + child = tempRef_child.get(); if (r != Result.Success) { return r; } break; case "resourceType": - tangible.OutObject tempOut_ResourceType = new tangible.OutObject(); - r = reader.argValue.ReadInt32(tempOut_ResourceType); - retval.ResourceType = tempOut_ResourceType.argValue; + OutObject tempOut_ResourceType = new OutObject(); + r = reader.get().ReadInt32(tempOut_ResourceType); + retval.ResourceType = tempOut_ResourceType.get(); if (r != Result.Success) { return r; } break; case "resourcePath": - tangible.OutObject tempOut_ResourcePath = new tangible.OutObject(); - r = reader.argValue.ReadString(tempOut_ResourcePath); - retval.ResourcePath = tempOut_ResourcePath.argValue; + OutObject tempOut_ResourcePath = new OutObject(); + r = reader.get().ReadString(tempOut_ResourcePath); + retval.ResourcePath = tempOut_ResourcePath.get(); if (r != Result.Success) { return r; } break; case "resourceBody": - tangible.OutObject tempOut_ResourceBody = new tangible.OutObject(); + OutObject tempOut_ResourceBody = new OutObject(); //C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java: //ORIGINAL LINE: r = reader.ReadBinary(out retval.ResourceBody); - r = reader.argValue.ReadBinary(tempOut_ResourceBody); - retval.ResourceBody = tempOut_ResourceBody.argValue; + r = reader.get().ReadBinary(tempOut_ResourceBody); + retval.ResourceBody = tempOut_ResourceBody.get(); if (r != Result.Success) { return r; } @@ -192,34 +197,34 @@ public final class SerializerUnitTest { } } - operation.argValue = retval; + operation.set(retval); return Result.Success; } - public static Result Write(tangible.RefObject writer, TypeArgument typeArg, + public static Result Write(RefObject writer, TypeArgument typeArg, BatchOperation operation) { - Result r = writer.argValue.WriteInt32("operationType", operation.OperationType); + Result r = writer.get().WriteInt32("operationType", operation.OperationType); if (r != Result.Success) { return r; } - r = writer.argValue.WriteScope("headers", BatchRequestHeadersSerializer.TypeArg, operation.Headers, + r = writer.get().WriteScope("headers", BatchRequestHeadersSerializer.TypeArg, operation.Headers, BatchRequestHeadersSerializer.Write); if (r != Result.Success) { return r; } - r = writer.argValue.WriteInt32("resourceType", operation.ResourceType); + r = writer.get().WriteInt32("resourceType", operation.ResourceType); if (r != Result.Success) { return r; } - r = writer.argValue.WriteString("resourcePath", operation.ResourcePath); + r = writer.get().WriteString("resourcePath", operation.ResourcePath); if (r != Result.Success) { return r; } - r = writer.argValue.WriteBinary("resourceBody", operation.ResourceBody); + r = writer.get().WriteBinary("resourceBody", operation.ResourceBody); return r; } } @@ -236,16 +241,16 @@ public final class SerializerUnitTest { public static final TypeArgument TypeArg = new TypeArgument(LayoutType.UDT, new TypeArgumentList(new SchemaId(1))); - public static Result Read(tangible.RefObject reader, - tangible.OutObject header) { + public static Result Read(RefObject reader, + OutObject header) { BatchRequestHeaders retval = new BatchRequestHeaders(); - header.argValue = null; - while (reader.argValue.Read()) { - switch (reader.argValue.getPath()) { + header.set(null); + while (reader.get().Read()) { + switch (reader.get().getPath()) { case "sampleRequestHeader": - tangible.OutObject tempOut_SampleRequestHeader = new tangible.OutObject(); - Result r = reader.argValue.ReadInt64(tempOut_SampleRequestHeader); - retval.SampleRequestHeader = tempOut_SampleRequestHeader.argValue; + OutObject tempOut_SampleRequestHeader = new OutObject(); + Result r = reader.get().ReadInt64(tempOut_SampleRequestHeader); + retval.SampleRequestHeader = tempOut_SampleRequestHeader.get(); if (r != Result.Success) { return r; } @@ -254,42 +259,42 @@ public final class SerializerUnitTest { } } - header.argValue = retval; + header.set(retval); return Result.Success; } - public static Result Write(tangible.RefObject writer, TypeArgument typeArg, + public static Result Write(RefObject writer, TypeArgument typeArg, BatchRequestHeaders header) { - Result r = writer.argValue.WriteInt64("sampleRequestHeader", header.SampleRequestHeader); + Result r = writer.get().WriteInt64("sampleRequestHeader", header.SampleRequestHeader); return r; } } public static class BatchRequestSerializer { - public static final TypeArgument OperationsTypeArg = new TypeArgument(LayoutType.TypedArray, new TypeArgumentList(new azure.data.cosmos.serialization.hybridrow.layouts.TypeArgument[] { BatchOperationSerializer.TypeArg })); + public static final TypeArgument OperationsTypeArg = new TypeArgument(LayoutType.TypedArray, new TypeArgumentList(new TypeArgument[] { BatchOperationSerializer.TypeArg })); - public static Result Read(tangible.RefObject reader, tangible.OutObject request) { - assert reader.argValue.Read(); - Contract.Assert(reader.argValue.getPath().equals("operations")); + public static Result Read(RefObject reader, OutObject request) { + assert reader.get().Read(); + checkState(reader.get().getPath().equals("operations")); java.util.ArrayList operations; - tangible.OutObject> tempOut_operations = new tangible.OutObject>(); - Result r = azure.data.cosmos.serialization.hybridrow.io.RowReaderExtensions.ReadList(reader.argValue.clone(), BatchOperationSerializer.Read, tempOut_operations); - operations = tempOut_operations.argValue; + OutObject> tempOut_operations = new OutObject>(); + Result r = RowReaderExtensions.ReadList(reader.get().clone(), BatchOperationSerializer.Read, tempOut_operations); + operations = tempOut_operations.get(); if (r != Result.Success) { - request.argValue = null; + request.set(null); return r; } - request.argValue = new BatchRequest(); - request.argValue.Operations = operations; + request.set(new BatchRequest()); + request.get().Operations = operations; return Result.Success; } - public static Result Write(tangible.RefObject writer, TypeArgument typeArg, BatchRequest request) { + public static Result Write(RefObject 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: - return writer.argValue.WriteScope("operations", BatchRequestSerializer.OperationsTypeArg, request.Operations, (ref RowWriter writer2, TypeArgument typeArg2, ArrayList operations) -> + return writer.get().WriteScope("operations", BatchRequestSerializer.OperationsTypeArg, request.Operations, (ref RowWriter writer2, TypeArgument typeArg2, ArrayList operations) -> { for (BatchOperation operation : operations) { Result r = writer2.WriteScope(null, BatchOperationSerializer.TypeArg, operation, BatchOperationSerializer.Write); diff --git a/jre/src/test/java/azure/data/cosmos/serialization/hybridrow/unit/TaggedUnitTests.java b/jre/src/test/java/com/azure/data/cosmos/serialization/hybridrow/unit/TaggedUnitTests.java similarity index 88% rename from jre/src/test/java/azure/data/cosmos/serialization/hybridrow/unit/TaggedUnitTests.java rename to jre/src/test/java/com/azure/data/cosmos/serialization/hybridrow/unit/TaggedUnitTests.java index a68877d..63bb36f 100644 --- a/jre/src/test/java/azure/data/cosmos/serialization/hybridrow/unit/TaggedUnitTests.java +++ b/jre/src/test/java/com/azure/data/cosmos/serialization/hybridrow/unit/TaggedUnitTests.java @@ -2,12 +2,13 @@ // Copyright (c) Microsoft Corporation. All rights reserved. //------------------------------------------------------------ -package azure.data.cosmos.serialization.hybridrow.unit; +package com.azure.data.cosmos.serialization.hybridrow.unit; -import azure.data.cosmos.serialization.hybridrow.HybridRowVersion; -import azure.data.cosmos.serialization.hybridrow.Result; -import azure.data.cosmos.serialization.hybridrow.RowBuffer; -import azure.data.cosmos.serialization.hybridrow.RowCursor; +import com.azure.data.cosmos.core.RefObject; +import com.azure.data.cosmos.serialization.hybridrow.HybridRowVersion; +import com.azure.data.cosmos.serialization.hybridrow.Result; +import com.azure.data.cosmos.serialization.hybridrow.RowBuffer; +import com.azure.data.cosmos.serialization.hybridrow.RowCursor; import java.nio.file.Files; @@ -34,26 +35,26 @@ public final class TaggedUnitTests { //ORIGINAL LINE: c1.Tag2 = ((byte)2, 28, 1974L); c1.Tag2 = ((byte)2, 28, 1974L) - tangible.RefObject tempRef_row = - new tangible.RefObject(row); - tangible.RefObject tempRef_row2 = - new tangible.RefObject(row); + RefObject tempRef_row = + new RefObject(row); + RefObject tempRef_row2 = + new RefObject(row); RowCursor _; // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'out' keyword - these // cannot be converted using the 'OutObject' helper class unless the method is within the code being modified: this.WriteTaggedApi(tempRef_row, RowCursor.Create(tempRef_row2, out _), c1); - row = tempRef_row2.argValue; - row = tempRef_row.argValue; - tangible.RefObject tempRef_row3 = - new tangible.RefObject(row); - tangible.RefObject tempRef_row4 = - new tangible.RefObject(row); + row = tempRef_row2.get(); + row = tempRef_row.get(); + RefObject tempRef_row3 = + new RefObject(row); + RefObject tempRef_row4 = + new RefObject(row); RowCursor _; // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'out' keyword - these // cannot be converted using the 'OutObject' helper class unless the method is within the code being modified: TaggedApi c2 = this.ReadTaggedApi(tempRef_row3, RowCursor.Create(tempRef_row4, out _)); - row = tempRef_row4.argValue; - row = tempRef_row3.argValue; + row = tempRef_row4.get(); + row = tempRef_row3.get(); assert c1 == c2; } @@ -67,7 +68,7 @@ public final class TaggedUnitTests { "TaggedApi")).SchemaId); } - private TaggedApi ReadTaggedApi(tangible.RefObject row, tangible.RefObject root) { + private TaggedApi ReadTaggedApi(RefObject row, RefObject root) { TaggedApi pc = new TaggedApi(); LayoutColumn c; @@ -78,7 +79,7 @@ public final class TaggedUnitTests { RowCursor tag1Scope; // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'out' keyword - these // cannot be converted using the 'OutObject' helper class unless the method is within the code being modified: - root.argValue.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 // cannot be converted using the 'OutObject' 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 @@ -117,7 +118,7 @@ public final class TaggedUnitTests { RowCursor tag2Scope; // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'out' keyword - these // cannot be converted using the 'OutObject' helper class unless the method is within the code being modified: - root.argValue.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 // cannot be converted using the 'OutObject' 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 @@ -161,7 +162,7 @@ public final class TaggedUnitTests { return pc; } - private void WriteTaggedApi(tangible.RefObject row, tangible.RefObject root, TaggedApi pc) { + private void WriteTaggedApi(RefObject row, RefObject root, TaggedApi pc) { LayoutColumn c; // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'out' keyword - these // cannot be converted using the 'OutObject' helper class unless the method is within the code being modified: @@ -169,7 +170,7 @@ public final class TaggedUnitTests { RowCursor tag1Scope; // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'out' keyword - these // cannot be converted using the 'OutObject' helper class unless the method is within the code being modified: - root.argValue.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 // cannot be converted using the 'OutObject' 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 @@ -190,7 +191,7 @@ public final class TaggedUnitTests { RowCursor tag2Scope; // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'out' keyword - these // cannot be converted using the 'OutObject' helper class unless the method is within the code being modified: - root.argValue.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 // cannot be converted using the 'OutObject' 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 diff --git a/jre/src/test/java/azure/data/cosmos/serialization/hybridrow/unit/TupleUnitTests.java b/jre/src/test/java/com/azure/data/cosmos/serialization/hybridrow/unit/TupleUnitTests.java similarity index 64% rename from jre/src/test/java/azure/data/cosmos/serialization/hybridrow/unit/TupleUnitTests.java rename to jre/src/test/java/com/azure/data/cosmos/serialization/hybridrow/unit/TupleUnitTests.java index 553519e..8ef5c42 100644 --- a/jre/src/test/java/azure/data/cosmos/serialization/hybridrow/unit/TupleUnitTests.java +++ b/jre/src/test/java/com/azure/data/cosmos/serialization/hybridrow/unit/TupleUnitTests.java @@ -2,12 +2,15 @@ // Copyright (c) Microsoft Corporation. All rights reserved. //------------------------------------------------------------ -package azure.data.cosmos.serialization.hybridrow.unit; +package com.azure.data.cosmos.serialization.hybridrow.unit; -import azure.data.cosmos.serialization.hybridrow.HybridRowVersion; -import azure.data.cosmos.serialization.hybridrow.Result; -import azure.data.cosmos.serialization.hybridrow.RowBuffer; -import azure.data.cosmos.serialization.hybridrow.RowCursor; +import com.azure.data.cosmos.core.OutObject; +import com.azure.data.cosmos.core.RefObject; +import com.azure.data.cosmos.serialization.hybridrow.HybridRowVersion; +import com.azure.data.cosmos.serialization.hybridrow.Result; +import com.azure.data.cosmos.serialization.hybridrow.RowBuffer; +import com.azure.data.cosmos.serialization.hybridrow.RowCursor; +import com.azure.data.cosmos.serialization.hybridrow.layouts.StringToken; import java.nio.file.Files; import java.time.LocalDateTime; @@ -40,26 +43,26 @@ public final class TupleUnitTests { tempVar.Lng = 40L; c1.Coord = Tuple.Create("units", tempVar); - tangible.RefObject tempRef_row = - new tangible.RefObject(row); - tangible.RefObject tempRef_row2 = - new tangible.RefObject(row); + RefObject tempRef_row = + new RefObject(row); + RefObject tempRef_row2 = + new RefObject(row); RowCursor _; // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'out' keyword - these // cannot be converted using the 'OutObject' helper class unless the method is within the code being modified: this.WriteCounter(tempRef_row, RowCursor.Create(tempRef_row2, out _), c1); - row = tempRef_row2.argValue; - row = tempRef_row.argValue; - tangible.RefObject tempRef_row3 = - new tangible.RefObject(row); - tangible.RefObject tempRef_row4 = - new tangible.RefObject(row); + row = tempRef_row2.get(); + row = tempRef_row.get(); + RefObject tempRef_row3 = + new RefObject(row); + RefObject tempRef_row4 = + new RefObject(row); RowCursor _; // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'out' keyword - these // cannot be converted using the 'OutObject' helper class unless the method is within the code being modified: PerfCounter c2 = this.ReadCounter(tempRef_row3, RowCursor.Create(tempRef_row4, out _)); - row = tempRef_row4.argValue; - row = tempRef_row3.argValue; + row = tempRef_row4.get(); + row = tempRef_row3.get(); assert c1 == c2; } @@ -70,26 +73,26 @@ public final class TupleUnitTests { row.InitLayout(HybridRowVersion.V1, this.countersLayout, this.countersResolver); PerfCounter c1 = this.counterExample; - tangible.RefObject tempRef_row = - new tangible.RefObject(row); - tangible.RefObject tempRef_row2 = - new tangible.RefObject(row); + RefObject tempRef_row = + new RefObject(row); + RefObject tempRef_row2 = + new RefObject(row); RowCursor _; // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'out' keyword - these // cannot be converted using the 'OutObject' helper class unless the method is within the code being modified: this.WriteCounter(tempRef_row, RowCursor.Create(tempRef_row2, out _), c1); - row = tempRef_row2.argValue; - row = tempRef_row.argValue; - tangible.RefObject tempRef_row3 = - new tangible.RefObject(row); - tangible.RefObject tempRef_row4 = - new tangible.RefObject(row); + row = tempRef_row2.get(); + row = tempRef_row.get(); + RefObject tempRef_row3 = + new RefObject(row); + RefObject tempRef_row4 = + new RefObject(row); RowCursor _; // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'out' keyword - these // cannot be converted using the 'OutObject' helper class unless the method is within the code being modified: PerfCounter c2 = this.ReadCounter(tempRef_row3, RowCursor.Create(tempRef_row4, out _)); - row = tempRef_row4.argValue; - row = tempRef_row3.argValue; + row = tempRef_row4.get(); + row = tempRef_row3.get(); assert c1 == c2; } @@ -103,26 +106,26 @@ public final class TupleUnitTests { c1.Name = "RowInserts"; c1.MinMaxValue = Tuple.Create("units", Tuple.Create(12L, 542L, 12046L)); - tangible.RefObject tempRef_row = - new tangible.RefObject(row); - tangible.RefObject tempRef_row2 = - new tangible.RefObject(row); + RefObject tempRef_row = + new RefObject(row); + RefObject tempRef_row2 = + new RefObject(row); RowCursor _; // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'out' keyword - these // cannot be converted using the 'OutObject' helper class unless the method is within the code being modified: this.WriteCounter(tempRef_row, RowCursor.Create(tempRef_row2, out _), c1); - row = tempRef_row2.argValue; - row = tempRef_row.argValue; - tangible.RefObject tempRef_row3 = - new tangible.RefObject(row); - tangible.RefObject tempRef_row4 = - new tangible.RefObject(row); + row = tempRef_row2.get(); + row = tempRef_row.get(); + RefObject tempRef_row3 = + new RefObject(row); + RefObject tempRef_row4 = + new RefObject(row); RowCursor _; // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'out' keyword - these // cannot be converted using the 'OutObject' helper class unless the method is within the code being modified: PerfCounter c2 = this.ReadCounter(tempRef_row3, RowCursor.Create(tempRef_row4, out _)); - row = tempRef_row4.argValue; - row = tempRef_row3.argValue; + row = tempRef_row4.get(); + row = tempRef_row3.get(); assert c1 == c2; } @@ -139,50 +142,50 @@ public final class TupleUnitTests { // cannot be converted using the 'OutObject' helper class unless the method is within the code being modified: assert layout.TryFind("history", out col); StringToken historyToken; - tangible.OutObject tempOut_historyToken = - new tangible.OutObject(); + OutObject tempOut_historyToken = + new OutObject(); assert layout.getTokenizer().TryFindToken(col.Path, tempOut_historyToken); - historyToken = tempOut_historyToken.argValue; - tangible.RefObject tempRef_row = - new tangible.RefObject(row); - tangible.RefObject tempRef_row2 = - new tangible.RefObject(row); + historyToken = tempOut_historyToken.get(); + RefObject tempRef_row = + new RefObject(row); + RefObject tempRef_row2 = + new RefObject(row); RowCursor history; // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'out' keyword - these // cannot be converted using the 'OutObject' helper class unless the method is within the code being modified: RowCursor.Create(tempRef_row, out history).Find(tempRef_row2, historyToken); - row = tempRef_row2.argValue; - row = tempRef_row.argValue; + row = tempRef_row2.get(); + row = tempRef_row.get(); int ctx = 1; // ignored - tangible.RefObject tempRef_row3 = - new tangible.RefObject(row); - tangible.RefObject tempRef_history = - new tangible.RefObject(history); + RefObject tempRef_row3 = + new RefObject(row); + RefObject tempRef_history = + new RefObject(history); // TODO: C# TO JAVA CONVERTER: The following lambda contained an unresolved 'ref' keyword - these are not // converted by C# to Java Converter: ResultAssert.IsSuccess(LayoutType.TypedArray.WriteScope(tempRef_row3, tempRef_history, col.TypeArgs, ctx, (ref RowBuffer row2, ref RowCursor arrCur, int ctx2) -> { for (int i = 0; i < 5; i++) { - tangible.RefObject tempRef_row2 = - new tangible.RefObject(row2); - tangible.RefObject tempRef_arrCur = - new tangible.RefObject(arrCur); + RefObject tempRef_row2 = + new RefObject(row2); + RefObject tempRef_arrCur = + new RefObject(arrCur); ResultAssert.IsSuccess(LayoutType.UDT.WriteScope(tempRef_row2, tempRef_arrCur, arrCur.ScopeTypeArgs[0].TypeArgs, i, (ref RowBuffer row3, ref RowCursor udtCur, int ctx3) -> { LayoutColumn col3; assert udtCur.Layout.TryFind("minmeanmax", out col3); - tangible.RefObject tempRef_row3 = - new tangible.RefObject(row3); - tangible.RefObjecttempRef_row32 = new tangible.RefObject (row3); + RefObject tempRef_row3 = + new RefObject(row3); + RefObjecttempRef_row32 = new RefObject (row3); ResultAssert.IsSuccess(LayoutType.TypedTuple.WriteScope(tempRef_row3, udtCur.Find(tempRef_row32, col3.Path), col3.TypeArgs, ctx3, (ref RowBuffer row4, ref RowCursor tupCur, int ctx4) -> { if (ctx4 > 0) { - tangible.RefObjecttempRef_row4 = new tangible.RefObjecttempRef_row4 = new RefObject (row4); - tangible.RefObjecttempRef_tupCur = new tangible.RefObjecttempRef_tupCur = new RefObject (tupCur); ResultAssert.IsSuccess(LayoutType.Utf8.WriteSparse(tempRef_row4, tempRef_tupCur, "abc")); tupCur = tempRef_tupCur.argValue; @@ -190,76 +193,76 @@ public final class TupleUnitTests { } if (ctx4 > 1) { - tangible.RefObjecttempRef_row42 = new tangible.RefObjecttempRef_row42 = new RefObject (row4); assert tupCur.MoveNext(tempRef_row42); row4 = tempRef_row42.argValue; - tangible.RefObject tempRef_row43 = new tangible.RefObject(row4); - tangible.RefObject tempRef_tupCur2 = new tangible.RefObject(tupCur); + RefObject tempRef_row43 = new RefObject(row4); + RefObject tempRef_tupCur2 = new RefObject(tupCur); ResultAssert.IsSuccess(LayoutType.TypedTuple.WriteScope(tempRef_row43, tempRef_tupCur2, tupCur.ScopeTypeArgs[1].TypeArgs, ctx4, (ref RowBuffer row5, ref RowCursor tupCur2, int ctx5) -> { if (ctx5 > 1) { - tangible.RefObject tempRef_row5 = new tangible.RefObject(row5); - tangible.RefObject tempRef_tupCur2 = new tangible.RefObject(tupCur2); + RefObject tempRef_row5 = new RefObject(row5); + RefObject tempRef_tupCur2 = new RefObject(tupCur2); ResultAssert.IsSuccess(LayoutType.Int64.WriteSparse(tempRef_row5, tempRef_tupCur2 , ctx5)); - tupCur2 = tempRef_tupCur2.argValue; - row5 = tempRef_row5.argValue; + tupCur2 = tempRef_tupCur2.get(); + row5 = tempRef_row5.get(); } if (ctx5 > 2) { - tangible.RefObjecttempRef_row52 = new tangible.RefObjecttempRef_row52 = new RefObject (row5); assert tupCur2.MoveNext(tempRef_row52); row5 = tempRef_row52.argValue; - tangible.RefObject tempRef_row53 = new tangible.RefObject(row5); - tangible.RefObject tempRef_tupCur22 = new tangible.RefObject(tupCur2); + RefObject tempRef_row53 = new RefObject(row5); + RefObject tempRef_tupCur22 = new RefObject(tupCur2); ResultAssert.IsSuccess(LayoutType.Int64.WriteSparse(tempRef_row53, tempRef_tupCur22, ctx5)); - tupCur2 = tempRef_tupCur22.argValue; - row5 = tempRef_row53.argValue; + tupCur2 = tempRef_tupCur22.get(); + row5 = tempRef_row53.get(); } if (ctx5 > 3) { - tangible.RefObjecttempRef_row54 = new tangible.RefObjecttempRef_row54 = new RefObject (row5); assert tupCur2.MoveNext(tempRef_row54); row5 = tempRef_row54.argValue; - tangible.RefObject tempRef_row55 = new tangible.RefObject(row5); - tangible.RefObject tempRef_tupCur23 = new tangible.RefObject(tupCur2); + RefObject tempRef_row55 = new RefObject(row5); + RefObject tempRef_tupCur23 = new RefObject(tupCur2); ResultAssert.IsSuccess(LayoutType.Int64.WriteSparse(tempRef_row55, tempRef_tupCur23, ctx5)); - tupCur2 = tempRef_tupCur23.argValue; - row5 = tempRef_row55.argValue; + tupCur2 = tempRef_tupCur23.get(); + row5 = tempRef_row55.get(); } return Result.Success; })); - tupCur = tempRef_tupCur2.argValue; - row4 = tempRef_row43.argValue; + tupCur = tempRef_tupCur2.get(); + row4 = tempRef_row43.get(); } return Result.Success; })); row3 = tempRef_row32.argValue; - row3 = tempRef_row3.argValue; + row3 = tempRef_row3.get(); return Result.Success; })); - arrCur = tempRef_arrCur.argValue; - row2 = tempRef_row2.argValue; + arrCur = tempRef_arrCur.get(); + row2 = tempRef_row2.get(); - tangible.RefObjecttempRef_row22 = new tangible.RefObject (row2); + RefObjecttempRef_row22 = new RefObject (row2); assert !arrCur.MoveNext(tempRef_row22); row2 = tempRef_row22.argValue; } return Result.Success; })); - history = tempRef_history.argValue; - row = tempRef_row3.argValue; + history = tempRef_history.get(); + row = tempRef_row3.get(); } // TODO: C# TO JAVA CONVERTER: Java annotations will not correspond to .NET attributes: @@ -279,59 +282,59 @@ public final class TupleUnitTests { row.InitLayout(HybridRowVersion.V1, this.countersLayout, this.countersResolver); PerfCounter c1 = this.counterExample; - tangible.RefObject tempRef_row = - new tangible.RefObject(row); - tangible.RefObject tempRef_row2 = - new tangible.RefObject(row); + RefObject tempRef_row = + new RefObject(row); + RefObject tempRef_row2 = + new RefObject(row); RowCursor _; // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'out' keyword - these // cannot be converted using the 'OutObject' helper class unless the method is within the code being modified: this.WriteCounter(tempRef_row, RowCursor.Create(tempRef_row2, out _), c1); - row = tempRef_row2.argValue; - row = tempRef_row.argValue; + row = tempRef_row2.get(); + row = tempRef_row.get(); LayoutColumn c; // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'out' keyword - these // cannot be converted using the 'OutObject' helper class unless the method is within the code being modified: assert this.countersLayout.TryFind("value", out c); - tangible.RefObject tempRef_row3 = - new tangible.RefObject(row); - tangible.RefObject tempRef_row4 = - new tangible.RefObject(row); + RefObject tempRef_row3 = + new RefObject(row); + RefObject tempRef_row4 = + new RefObject(row); RowCursor valueScope; // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'out' keyword - these // cannot be converted using the 'OutObject' helper class unless the method is within the code being modified: RowCursor.Create(tempRef_row3, out valueScope).Find(tempRef_row4, c.Path); - row = tempRef_row4.argValue; - row = tempRef_row3.argValue; - tangible.RefObject tempRef_row5 = - new tangible.RefObject(row); + row = tempRef_row4.get(); + row = tempRef_row3.get(); + RefObject tempRef_row5 = + new RefObject(row); // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'out' keyword - these // cannot be converted using the 'OutObject' 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 // cannot be converted using the 'RefObject' helper class unless the method is within the code being modified: ResultAssert.IsSuccess(c.TypeAs().WriteScope(tempRef_row5, ref valueScope, c.TypeArgs, out valueScope)); - row = tempRef_row5.argValue; - tangible.RefObject tempRef_row6 = - new tangible.RefObject(row); - tangible.RefObject tempRef_row7 = - new tangible.RefObject(row); + row = tempRef_row5.get(); + RefObject tempRef_row6 = + new RefObject(row); + RefObject tempRef_row7 = + new RefObject(row); RowCursor valueScope2; // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'out' keyword - these // cannot be converted using the 'OutObject' helper class unless the method is within the code being modified: RowCursor.Create(tempRef_row6, out valueScope2).Find(tempRef_row7, c.Path); - row = tempRef_row7.argValue; - row = tempRef_row6.argValue; - tangible.RefObject tempRef_row8 = - new tangible.RefObject(row); + row = tempRef_row7.get(); + row = tempRef_row6.get(); + RefObject tempRef_row8 = + new RefObject(row); // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'out' keyword - these // cannot be converted using the 'OutObject' 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 // cannot be converted using the 'RefObject' helper class unless the method is within the code being modified: ResultAssert.IsSuccess(c.TypeAs().ReadScope(tempRef_row8, ref valueScope2, out valueScope2)); - row = tempRef_row8.argValue; + row = tempRef_row8.get(); RowCursor _; // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'out' keyword - these // cannot be converted using the 'OutObject' helper class unless the method is within the code being modified: @@ -345,24 +348,24 @@ public final class TupleUnitTests { // cannot be converted using the 'OutObject' helper class unless the method is within the code being modified: assert valueScope.AsReadOnly(out _).Immutable == valueScope2.Immutable; - tangible.RefObject tempRef_row9 = - new tangible.RefObject(row); + RefObject tempRef_row9 = + new RefObject(row); // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'ref' keyword - these // cannot be converted using the 'RefObject' helper class unless the method is within the code being modified: ResultAssert.TypeConstraint(c.TypeArgs[0].Type.TypeAs().WriteSparse(tempRef_row9, ref valueScope, "millis", UpdateOptions.InsertAt)); - row = tempRef_row9.argValue; - tangible.RefObject tempRef_row10 = - new tangible.RefObject(row); + row = tempRef_row9.get(); + RefObject tempRef_row10 = + new RefObject(row); // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'ref' keyword - these // cannot be converted using the 'RefObject' helper class unless the method is within the code being modified: ResultAssert.TypeConstraint(c.TypeArgs[0].Type.TypeAs().DeleteSparse(tempRef_row10, ref valueScope)); - row = tempRef_row10.argValue; - tangible.RefObject tempRef_row11 = - new tangible.RefObject(row); + row = tempRef_row10.get(); + RefObject tempRef_row11 = + new RefObject(row); assert !valueScope.MoveTo(tempRef_row11, 2); - row = tempRef_row11.argValue; + row = tempRef_row11.get(); } // TODO: C# TO JAVA CONVERTER: Java annotations will not correspond to .NET attributes: @@ -378,82 +381,82 @@ public final class TupleUnitTests { tempVar.Lng = 40L; c1.Coord = Tuple.Create("units", tempVar); - tangible.RefObject tempRef_row = - new tangible.RefObject(row); - tangible.RefObject tempRef_row2 = - new tangible.RefObject(row); + RefObject tempRef_row = + new RefObject(row); + RefObject tempRef_row2 = + new RefObject(row); RowCursor _; // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'out' keyword - these // cannot be converted using the 'OutObject' helper class unless the method is within the code being modified: this.WriteCounter(tempRef_row, RowCursor.Create(tempRef_row2, out _), c1); - row = tempRef_row2.argValue; - row = tempRef_row.argValue; + row = tempRef_row2.get(); + row = tempRef_row.get(); LayoutColumn c; // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'out' keyword - these // cannot be converted using the 'OutObject' helper class unless the method is within the code being modified: assert this.countersLayout.TryFind("coord", out c); - tangible.RefObject tempRef_row3 = - new tangible.RefObject(row); - tangible.RefObject tempRef_row4 = - new tangible.RefObject(row); + RefObject tempRef_row3 = + new RefObject(row); + RefObject tempRef_row4 = + new RefObject(row); RowCursor valueScope; // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'out' keyword - these // cannot be converted using the 'OutObject' helper class unless the method is within the code being modified: RowCursor.Create(tempRef_row3, out valueScope).Find(tempRef_row4, c.Path); - row = tempRef_row4.argValue; - row = tempRef_row3.argValue; - tangible.RefObject tempRef_row5 = - new tangible.RefObject(row); + row = tempRef_row4.get(); + row = tempRef_row3.get(); + RefObject tempRef_row5 = + new RefObject(row); // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'out' keyword - these // cannot be converted using the 'OutObject' 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 // cannot be converted using the 'RefObject' helper class unless the method is within the code being modified: ResultAssert.IsSuccess(c.TypeAs().WriteScope(tempRef_row5, ref valueScope, c.TypeArgs, out valueScope)); - row = tempRef_row5.argValue; - tangible.RefObject tempRef_row6 = - new tangible.RefObject(row); - tangible.RefObject tempRef_valueScope = - new tangible.RefObject(valueScope); + row = tempRef_row5.get(); + RefObject tempRef_row6 = + new RefObject(row); + RefObject tempRef_valueScope = + new RefObject(valueScope); ResultAssert.TypeConstraint(LayoutType.DateTime.WriteSparse(tempRef_row6, tempRef_valueScope, LocalDateTime.now())); - valueScope = tempRef_valueScope.argValue; - row = tempRef_row6.argValue; - tangible.RefObject tempRef_row7 = - new tangible.RefObject(row); + valueScope = tempRef_valueScope.get(); + row = tempRef_row6.get(); + RefObject tempRef_row7 = + new RefObject(row); // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'ref' keyword - these // cannot be converted using the 'RefObject' helper class unless the method is within the code being modified: ResultAssert.IsSuccess(c.TypeArgs[0].Type.TypeAs().WriteSparse(tempRef_row7, ref valueScope, "mins")); - row = tempRef_row7.argValue; - tangible.RefObject tempRef_row8 = - new tangible.RefObject(row); + row = tempRef_row7.get(); + RefObject tempRef_row8 = + new RefObject(row); assert valueScope.MoveNext(tempRef_row8); - row = tempRef_row8.argValue; - tangible.RefObject tempRef_row9 = - new tangible.RefObject(row); - tangible.RefObject tempRef_valueScope2 = - new tangible.RefObject(valueScope); + row = tempRef_row8.get(); + RefObject tempRef_row9 = + new RefObject(row); + RefObject tempRef_valueScope2 = + new RefObject(valueScope); ResultAssert.TypeConstraint(LayoutType.Int8.WriteSparse(tempRef_row9, tempRef_valueScope2, (byte)42)); - valueScope = tempRef_valueScope2.argValue; - row = tempRef_row9.argValue; + valueScope = tempRef_valueScope2.get(); + row = tempRef_row9.get(); TypeArgument coordType = c.TypeArgs[1]; // Invalid because is a UDT but the wrong type. - tangible.RefObject tempRef_row10 = - new tangible.RefObject(row); - tangible.RefObject tempRef_valueScope3 = - new tangible.RefObject(valueScope); + RefObject tempRef_row10 = + new RefObject(row); + RefObject tempRef_valueScope3 = + new RefObject(valueScope); RowCursor _; - tangible.OutObject tempOut__ = - new tangible.OutObject(); + OutObject tempOut__ = + new OutObject(); ResultAssert.TypeConstraint(coordType.getType().TypeAs().WriteScope(tempRef_row10, tempRef_valueScope3, new TypeArgumentList(this.countersLayout.getSchemaId().clone()), tempOut__)); - _ = tempOut__.argValue; - valueScope = tempRef_valueScope3.argValue; - row = tempRef_row10.argValue; + _ = tempOut__.get(); + valueScope = tempRef_valueScope3.get(); + row = tempRef_row10.get(); } // TODO: C# TO JAVA CONVERTER: Java annotations will not correspond to .NET attributes: @@ -463,72 +466,72 @@ public final class TupleUnitTests { row.InitLayout(HybridRowVersion.V1, this.countersLayout, this.countersResolver); PerfCounter c1 = this.counterExample; - tangible.RefObject tempRef_row = - new tangible.RefObject(row); - tangible.RefObject tempRef_row2 = - new tangible.RefObject(row); + RefObject tempRef_row = + new RefObject(row); + RefObject tempRef_row2 = + new RefObject(row); RowCursor _; // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'out' keyword - these // cannot be converted using the 'OutObject' helper class unless the method is within the code being modified: this.WriteCounter(tempRef_row, RowCursor.Create(tempRef_row2, out _), c1); - row = tempRef_row2.argValue; - row = tempRef_row.argValue; + row = tempRef_row2.get(); + row = tempRef_row.get(); LayoutColumn c; // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'out' keyword - these // cannot be converted using the 'OutObject' helper class unless the method is within the code being modified: assert this.countersLayout.TryFind("value", out c); - tangible.RefObject tempRef_row3 = - new tangible.RefObject(row); - tangible.RefObject tempRef_row4 = - new tangible.RefObject(row); + RefObject tempRef_row3 = + new RefObject(row); + RefObject tempRef_row4 = + new RefObject(row); RowCursor valueScope; // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'out' keyword - these // cannot be converted using the 'OutObject' helper class unless the method is within the code being modified: RowCursor.Create(tempRef_row3, out valueScope).Find(tempRef_row4, c.Path); - row = tempRef_row4.argValue; - row = tempRef_row3.argValue; - tangible.RefObject tempRef_row5 = - new tangible.RefObject(row); + row = tempRef_row4.get(); + row = tempRef_row3.get(); + RefObject tempRef_row5 = + new RefObject(row); // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'out' keyword - these // cannot be converted using the 'OutObject' 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 // cannot be converted using the 'RefObject' helper class unless the method is within the code being modified: ResultAssert.IsSuccess(c.TypeAs().WriteScope(tempRef_row5, ref valueScope, c.TypeArgs, out valueScope)); - row = tempRef_row5.argValue; - tangible.RefObject tempRef_row6 = - new tangible.RefObject(row); - tangible.RefObject tempRef_valueScope = - new tangible.RefObject(valueScope); + row = tempRef_row5.get(); + RefObject tempRef_row6 = + new RefObject(row); + RefObject tempRef_valueScope = + new RefObject(valueScope); ResultAssert.TypeConstraint(LayoutType.Boolean.WriteSparse(tempRef_row6, tempRef_valueScope, true)); - valueScope = tempRef_valueScope.argValue; - row = tempRef_row6.argValue; - tangible.RefObject tempRef_row7 = - new tangible.RefObject(row); + valueScope = tempRef_valueScope.get(); + row = tempRef_row6.get(); + RefObject tempRef_row7 = + new RefObject(row); // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'ref' keyword - these // cannot be converted using the 'RefObject' helper class unless the method is within the code being modified: ResultAssert.IsSuccess(c.TypeArgs[0].Type.TypeAs().WriteSparse(tempRef_row7, ref valueScope, "millis")); - row = tempRef_row7.argValue; - tangible.RefObject tempRef_row8 = - new tangible.RefObject(row); + row = tempRef_row7.get(); + RefObject tempRef_row8 = + new RefObject(row); assert valueScope.MoveNext(tempRef_row8); - row = tempRef_row8.argValue; - tangible.RefObject tempRef_row9 = - new tangible.RefObject(row); - tangible.RefObject tempRef_valueScope2 = - new tangible.RefObject(valueScope); + row = tempRef_row8.get(); + RefObject tempRef_row9 = + new RefObject(row); + RefObject tempRef_valueScope2 = + new RefObject(valueScope); ResultAssert.TypeConstraint(LayoutType.Float32.WriteSparse(tempRef_row9, tempRef_valueScope2, 0.1F)); - valueScope = tempRef_valueScope2.argValue; - row = tempRef_row9.argValue; - tangible.RefObject tempRef_row10 = - new tangible.RefObject(row); + valueScope = tempRef_valueScope2.get(); + row = tempRef_row9.get(); + RefObject tempRef_row10 = + new RefObject(row); // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'ref' keyword - these // cannot be converted using the 'RefObject' helper class unless the method is within the code being modified: ResultAssert.IsSuccess(c.TypeArgs[1].Type.TypeAs().WriteSparse(tempRef_row10, ref valueScope, 100L)); - row = tempRef_row10.argValue; + row = tempRef_row10.get(); } // TODO: C# TO JAVA CONVERTER: Java annotations will not correspond to .NET attributes: @@ -541,73 +544,73 @@ public final class TupleUnitTests { c1.Name = "RowInserts"; c1.MinMaxValue = Tuple.Create("units", Tuple.Create(12L, 542L, 12046L)); - tangible.RefObject tempRef_row = - new tangible.RefObject(row); - tangible.RefObject tempRef_row2 = - new tangible.RefObject(row); + RefObject tempRef_row = + new RefObject(row); + RefObject tempRef_row2 = + new RefObject(row); RowCursor _; // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'out' keyword - these // cannot be converted using the 'OutObject' helper class unless the method is within the code being modified: this.WriteCounter(tempRef_row, RowCursor.Create(tempRef_row2, out _), c1); - row = tempRef_row2.argValue; - row = tempRef_row.argValue; + row = tempRef_row2.get(); + row = tempRef_row.get(); // ReSharper disable once StringLiteralTypo LayoutColumn c; // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'out' keyword - these // cannot be converted using the 'OutObject' helper class unless the method is within the code being modified: assert this.countersLayout.TryFind("minmeanmax", out c); - tangible.RefObject tempRef_row3 = - new tangible.RefObject(row); - tangible.RefObject tempRef_row4 = - new tangible.RefObject(row); + RefObject tempRef_row3 = + new RefObject(row); + RefObject tempRef_row4 = + new RefObject(row); RowCursor valueScope; // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'out' keyword - these // cannot be converted using the 'OutObject' helper class unless the method is within the code being modified: RowCursor.Create(tempRef_row3, out valueScope).Find(tempRef_row4, c.Path); - row = tempRef_row4.argValue; - row = tempRef_row3.argValue; - tangible.RefObject tempRef_row5 = - new tangible.RefObject(row); + row = tempRef_row4.get(); + row = tempRef_row3.get(); + RefObject tempRef_row5 = + new RefObject(row); // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'out' keyword - these // cannot be converted using the 'OutObject' 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 // cannot be converted using the 'RefObject' helper class unless the method is within the code being modified: ResultAssert.IsSuccess(c.TypeAs().WriteScope(tempRef_row5, ref valueScope, c.TypeArgs, out valueScope)); - row = tempRef_row5.argValue; - tangible.RefObject tempRef_row6 = - new tangible.RefObject(row); - tangible.RefObject tempRef_valueScope = - new tangible.RefObject(valueScope); + row = tempRef_row5.get(); + RefObject tempRef_row6 = + new RefObject(row); + RefObject tempRef_valueScope = + new RefObject(valueScope); ResultAssert.TypeConstraint(LayoutType.DateTime.WriteSparse(tempRef_row6, tempRef_valueScope, LocalDateTime.now())); - valueScope = tempRef_valueScope.argValue; - row = tempRef_row6.argValue; - tangible.RefObject tempRef_row7 = - new tangible.RefObject(row); + valueScope = tempRef_valueScope.get(); + row = tempRef_row6.get(); + RefObject tempRef_row7 = + new RefObject(row); // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'ref' keyword - these // cannot be converted using the 'RefObject' helper class unless the method is within the code being modified: ResultAssert.IsSuccess(c.TypeArgs[0].Type.TypeAs().WriteSparse(tempRef_row7, ref valueScope, "secs")); - row = tempRef_row7.argValue; - tangible.RefObject tempRef_row8 = - new tangible.RefObject(row); + row = tempRef_row7.get(); + RefObject tempRef_row8 = + new RefObject(row); assert valueScope.MoveNext(tempRef_row8); - row = tempRef_row8.argValue; - tangible.RefObject tempRef_row9 = - new tangible.RefObject(row); - tangible.RefObject tempRef_valueScope2 = - new tangible.RefObject(valueScope); + row = tempRef_row8.get(); + RefObject tempRef_row9 = + new RefObject(row); + RefObject tempRef_valueScope2 = + new RefObject(valueScope); ResultAssert.TypeConstraint(LayoutType.Decimal.WriteSparse(tempRef_row9, tempRef_valueScope2, 12)); - valueScope = tempRef_valueScope2.argValue; - row = tempRef_row9.argValue; + valueScope = tempRef_valueScope2.get(); + row = tempRef_row9.get(); TypeArgument mmmType = c.TypeArgs[1]; // Invalid because not a tuple type. - tangible.RefObject tempRef_row10 = - new tangible.RefObject(row); + RefObject tempRef_row10 = + new RefObject(row); RowCursor mmmScope; // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'out' keyword - these // cannot be converted using the 'OutObject' helper class unless the method is within the code being modified: @@ -615,11 +618,11 @@ public final class TupleUnitTests { // cannot be converted using the 'RefObject' helper class unless the method is within the code being modified: ResultAssert.TypeConstraint(mmmType.getType().TypeAs().WriteScope(tempRef_row10, ref valueScope, TypeArgumentList.Empty, out mmmScope)); - row = tempRef_row10.argValue; + row = tempRef_row10.get(); // Invalid because is a tuple type but with the wrong parameters. - tangible.RefObject tempRef_row11 = - new tangible.RefObject(row); + RefObject tempRef_row11 = + new RefObject(row); // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'out' keyword - these // cannot be converted using the 'OutObject' 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 @@ -630,11 +633,11 @@ public final class TupleUnitTests { new TypeArgument(LayoutType.Boolean), new TypeArgument(LayoutType.Int64) }), out mmmScope)); - row = tempRef_row11.argValue; + row = tempRef_row11.get(); // Invalid because is a tuple type but with the wrong arity. - tangible.RefObject tempRef_row12 = - new tangible.RefObject(row); + RefObject tempRef_row12 = + new RefObject(row); // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'out' keyword - these // cannot be converted using the 'OutObject' 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 @@ -642,19 +645,19 @@ public final class TupleUnitTests { ResultAssert.TypeConstraint(mmmType.getType().TypeAs().WriteScope(tempRef_row12, ref valueScope, new TypeArgumentList(new TypeArgument[] { new TypeArgument(LayoutType.Utf8) }), out mmmScope)); - row = tempRef_row12.argValue; + row = tempRef_row12.get(); - tangible.RefObject tempRef_row13 = - new tangible.RefObject(row); + RefObject tempRef_row13 = + new RefObject(row); // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'out' keyword - these // cannot be converted using the 'OutObject' 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 // cannot be converted using the 'RefObject' helper class unless the method is within the code being modified: ResultAssert.IsSuccess(mmmType.getType().TypeAs().WriteScope(tempRef_row13, ref valueScope, mmmType.getTypeArgs().clone(), out mmmScope)); - row = tempRef_row13.argValue; - tangible.RefObject tempRef_row14 = - new tangible.RefObject(row); + row = tempRef_row13.get(); + RefObject tempRef_row14 = + new RefObject(row); // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'ref' keyword - these // cannot be converted using the 'RefObject' helper class unless the method is within the code being modified: //C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java: @@ -662,68 +665,68 @@ public final class TupleUnitTests { // byte[] { 1, 2, 3 })); ResultAssert.TypeConstraint(LayoutType.Binary.WriteSparse(tempRef_row14, ref valueScope, new byte[] { 1, 2, 3 })); - row = tempRef_row14.argValue; - tangible.RefObject tempRef_row15 = - new tangible.RefObject(row); - tangible.RefObject tempRef_mmmScope = - new tangible.RefObject(mmmScope); + row = tempRef_row14.get(); + RefObject tempRef_row15 = + new RefObject(row); + RefObject tempRef_mmmScope = + new RefObject(mmmScope); ResultAssert.IsSuccess(mmmType.getTypeArgs().get(0).getType().TypeAs().WriteSparse(tempRef_row15 , tempRef_mmmScope, 1L)); - mmmScope = tempRef_mmmScope.argValue; - row = tempRef_row15.argValue; - tangible.RefObject tempRef_row16 = - new tangible.RefObject(row); + mmmScope = tempRef_mmmScope.get(); + row = tempRef_row15.get(); + RefObject tempRef_row16 = + new RefObject(row); assert mmmScope.MoveNext(tempRef_row16); - row = tempRef_row16.argValue; - tangible.RefObject tempRef_row17 = - new tangible.RefObject(row); - tangible.RefObject tempRef_mmmScope2 = - new tangible.RefObject(mmmScope); + row = tempRef_row16.get(); + RefObject tempRef_row17 = + new RefObject(row); + RefObject tempRef_mmmScope2 = + new RefObject(mmmScope); ResultAssert.IsSuccess(mmmType.getTypeArgs().get(1).getType().TypeAs().WriteSparse(tempRef_row17 , tempRef_mmmScope2, 2L)); - mmmScope = tempRef_mmmScope2.argValue; - row = tempRef_row17.argValue; - tangible.RefObject tempRef_row18 = - new tangible.RefObject(row); + mmmScope = tempRef_mmmScope2.get(); + row = tempRef_row17.get(); + RefObject tempRef_row18 = + new RefObject(row); assert mmmScope.MoveNext(tempRef_row18); - row = tempRef_row18.argValue; - tangible.RefObject tempRef_row19 = - new tangible.RefObject(row); - tangible.RefObject tempRef_mmmScope3 = - new tangible.RefObject(mmmScope); + row = tempRef_row18.get(); + RefObject tempRef_row19 = + new RefObject(row); + RefObject tempRef_mmmScope3 = + new RefObject(mmmScope); ResultAssert.IsSuccess(mmmType.getTypeArgs().get(2).getType().TypeAs().WriteSparse(tempRef_row19 , tempRef_mmmScope3, 3L)); - mmmScope = tempRef_mmmScope3.argValue; - row = tempRef_row19.argValue; + mmmScope = tempRef_mmmScope3.get(); + row = tempRef_row19.get(); } - private static Coord ReadCoord(tangible.RefObject row, tangible.RefObject coordScope) { - Layout coordLayout = coordScope.argValue.getLayout(); + private static Coord ReadCoord(RefObject row, RefObject coordScope) { + Layout coordLayout = coordScope.get().getLayout(); Coord cd = new Coord(); LayoutColumn c; // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'out' keyword - these cannot be converted using the 'OutObject' helper class unless the method is within the code being modified: assert coordLayout.TryFind("lat", out c); - tangible.OutObject tempOut_Lat = new tangible.OutObject(); + OutObject tempOut_Lat = new OutObject(); ResultAssert.IsSuccess(c.TypeAs().ReadFixed(row, coordScope, c, tempOut_Lat)); - cd.Lat = tempOut_Lat.argValue; + cd.Lat = tempOut_Lat.get(); // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'out' keyword - these cannot be converted using the 'OutObject' helper class unless the method is within the code being modified: assert coordLayout.TryFind("lng", out c); - tangible.OutObject tempOut_Lng = new tangible.OutObject(); + OutObject tempOut_Lng = new OutObject(); ResultAssert.IsSuccess(c.TypeAs().ReadFixed(row, coordScope, c, tempOut_Lng)); - cd.Lng = tempOut_Lng.argValue; + cd.Lng = tempOut_Lng.get(); return cd; } - private PerfCounter ReadCounter(tangible.RefObject row, tangible.RefObject root) { + private PerfCounter ReadCounter(RefObject row, RefObject root) { PerfCounter pc = new PerfCounter(); LayoutColumn c; // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'out' keyword - these // cannot be converted using the 'OutObject' helper class unless the method is within the code being modified: assert this.countersLayout.TryFind("name", out c); - tangible.OutObject tempOut_Name = new tangible.OutObject(); + OutObject tempOut_Name = new OutObject(); ResultAssert.IsSuccess(c.TypeAs().ReadVariable(row, root, c, tempOut_Name)); - pc.Name = tempOut_Name.argValue; + pc.Name = tempOut_Name.get(); // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'out' keyword - these // cannot be converted using the 'OutObject' helper class unless the method is within the code being modified: @@ -732,7 +735,7 @@ public final class TupleUnitTests { RowCursor valueScope; // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'out' keyword - these // cannot be converted using the 'OutObject' helper class unless the method is within the code being modified: - root.argValue.Clone(out valueScope).Find(row, c.Path); + root.get().Clone(out valueScope).Find(row, c.Path); // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'out' keyword - these // cannot be converted using the 'OutObject' 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 @@ -768,7 +771,7 @@ public final class TupleUnitTests { assert c.Type.Immutable; // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'out' keyword - these // cannot be converted using the 'OutObject' helper class unless the method is within the code being modified: - root.argValue.Clone(out valueScope).Find(row, c.Path); + root.get().Clone(out valueScope).Find(row, c.Path); // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'out' keyword - these // cannot be converted using the 'OutObject' 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 @@ -787,44 +790,44 @@ public final class TupleUnitTests { assert valueScope.MoveNext(row); TypeArgument mmmType = c.TypeArgs[1]; - tangible.RefObject tempRef_valueScope = - new tangible.RefObject(valueScope); + RefObject tempRef_valueScope = + new RefObject(valueScope); RowCursor mmmScope; - tangible.OutObject tempOut_mmmScope = - new tangible.OutObject(); + OutObject tempOut_mmmScope = + new OutObject(); ResultAssert.IsSuccess(mmmType.getType().TypeAs().ReadScope(row, tempRef_valueScope, tempOut_mmmScope)); - mmmScope = tempOut_mmmScope.argValue; - valueScope = tempRef_valueScope.argValue; + mmmScope = tempOut_mmmScope.get(); + valueScope = tempRef_valueScope.get(); assert mmmScope.Immutable; assert mmmScope.MoveNext(row); - tangible.RefObject tempRef_mmmScope = - new tangible.RefObject(mmmScope); + RefObject tempRef_mmmScope = + new RefObject(mmmScope); long min; - tangible.OutObject tempOut_min = new tangible.OutObject(); + OutObject tempOut_min = new OutObject(); ResultAssert.IsSuccess(mmmType.getTypeArgs().get(0).getType().TypeAs().ReadSparse(row, tempRef_mmmScope, tempOut_min)); - min = tempOut_min.argValue; - mmmScope = tempRef_mmmScope.argValue; + min = tempOut_min.get(); + mmmScope = tempRef_mmmScope.get(); assert mmmScope.MoveNext(row); - tangible.RefObject tempRef_mmmScope2 = - new tangible.RefObject(mmmScope); + RefObject tempRef_mmmScope2 = + new RefObject(mmmScope); long mean; - tangible.OutObject tempOut_mean = new tangible.OutObject(); + OutObject tempOut_mean = new OutObject(); ResultAssert.IsSuccess(mmmType.getTypeArgs().get(1).getType().TypeAs().ReadSparse(row, tempRef_mmmScope2, tempOut_mean)); - mean = tempOut_mean.argValue; - mmmScope = tempRef_mmmScope2.argValue; + mean = tempOut_mean.get(); + mmmScope = tempRef_mmmScope2.get(); assert mmmScope.MoveNext(row); - tangible.RefObject tempRef_mmmScope3 = - new tangible.RefObject(mmmScope); + RefObject tempRef_mmmScope3 = + new RefObject(mmmScope); long max; - tangible.OutObject tempOut_max = new tangible.OutObject(); + OutObject tempOut_max = new OutObject(); ResultAssert.IsSuccess(mmmType.getTypeArgs().get(2).getType().TypeAs().ReadSparse(row, tempRef_mmmScope3, tempOut_max)); - max = tempOut_max.argValue; - mmmScope = tempRef_mmmScope3.argValue; + max = tempOut_max.get(); + mmmScope = tempRef_mmmScope3.get(); pc.MinMaxValue = Tuple.Create(units, Tuple.Create(min, mean, max)); } @@ -835,7 +838,7 @@ public final class TupleUnitTests { assert c.Type.Immutable; // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'out' keyword - these // cannot be converted using the 'OutObject' helper class unless the method is within the code being modified: - root.argValue.Clone(out valueScope).Find(row, c.Path); + root.get().Clone(out valueScope).Find(row, c.Path); // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'out' keyword - these // cannot be converted using the 'OutObject' 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 @@ -862,16 +865,16 @@ public final class TupleUnitTests { // modified: ResultAssert.IsSuccess(c.TypeArgs[1].Type.TypeAs().ReadScope(row, ref valueScope, out coordScope)); - tangible.RefObject tempRef_coordScope = new tangible.RefObject(coordScope); + RefObject tempRef_coordScope = new RefObject(coordScope); pc.Coord = Tuple.Create(units, TupleUnitTests.ReadCoord(row, tempRef_coordScope)); - coordScope = tempRef_coordScope.argValue; + coordScope = tempRef_coordScope.get(); } return pc; } - private static void WriteCoord(tangible.RefObject row, tangible.RefObject coordScope, TypeArgumentList typeArgs, Coord cd) { - Layout coordLayout = row.argValue.getResolver().Resolve(typeArgs.getSchemaId().clone()); + private static void WriteCoord(RefObject row, RefObject coordScope, TypeArgumentList typeArgs, Coord cd) { + Layout coordLayout = row.get().getResolver().Resolve(typeArgs.getSchemaId().clone()); LayoutColumn c; // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'out' keyword - these cannot be converted using the 'OutObject' helper class unless the method is within the code being modified: assert coordLayout.TryFind("lat", out c); @@ -881,7 +884,7 @@ public final class TupleUnitTests { ResultAssert.IsSuccess(c.TypeAs().WriteFixed(row, coordScope, c, cd.Lng)); } - private void WriteCounter(tangible.RefObject row, tangible.RefObject root, PerfCounter pc) { + private void WriteCounter(RefObject row, RefObject root, PerfCounter pc) { LayoutColumn c; // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'out' keyword - these // cannot be converted using the 'OutObject' helper class unless the method is within the code being modified: @@ -897,7 +900,7 @@ public final class TupleUnitTests { // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'out' keyword - these // cannot be converted using the 'OutObject' helper class unless the method is within the code being // modified: - root.argValue.Clone(out valueScope).Find(row, c.Path); + root.get().Clone(out valueScope).Find(row, c.Path); // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'out' keyword - these // cannot be converted using the 'OutObject' helper class unless the method is within the code being // modified: @@ -929,7 +932,7 @@ public final class TupleUnitTests { // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'out' keyword - these // cannot be converted using the 'OutObject' helper class unless the method is within the code being // modified: - root.argValue.Clone(out valueScope).Find(row, c.Path); + root.get().Clone(out valueScope).Find(row, c.Path); // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'out' keyword - these // cannot be converted using the 'OutObject' helper class unless the method is within the code being // modified: @@ -956,25 +959,25 @@ public final class TupleUnitTests { ResultAssert.IsSuccess(mmmType.getType().TypeAs().WriteScope(row, ref valueScope, mmmType.getTypeArgs().clone(), out mmmScope)); - tangible.RefObject tempRef_mmmScope = - new tangible.RefObject(mmmScope); + RefObject tempRef_mmmScope = + new RefObject(mmmScope); ResultAssert.IsSuccess(mmmType.getTypeArgs().get(0).getType().TypeAs().WriteSparse(row, tempRef_mmmScope, pc.MinMaxValue.Item2.Item1)); - mmmScope = tempRef_mmmScope.argValue; + mmmScope = tempRef_mmmScope.get(); assert mmmScope.MoveNext(row); - tangible.RefObject tempRef_mmmScope2 = - new tangible.RefObject(mmmScope); + RefObject tempRef_mmmScope2 = + new RefObject(mmmScope); ResultAssert.IsSuccess(mmmType.getTypeArgs().get(1).getType().TypeAs().WriteSparse(row, tempRef_mmmScope2, pc.MinMaxValue.Item2.Item2)); - mmmScope = tempRef_mmmScope2.argValue; + mmmScope = tempRef_mmmScope2.get(); assert mmmScope.MoveNext(row); - tangible.RefObject tempRef_mmmScope3 = - new tangible.RefObject(mmmScope); + RefObject tempRef_mmmScope3 = + new RefObject(mmmScope); ResultAssert.IsSuccess(mmmType.getTypeArgs().get(2).getType().TypeAs().WriteSparse(row, tempRef_mmmScope3, pc.MinMaxValue.Item2.Item3)); - mmmScope = tempRef_mmmScope3.argValue; + mmmScope = tempRef_mmmScope3.get(); } if (pc.Coord != null) { @@ -986,7 +989,7 @@ public final class TupleUnitTests { // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'out' keyword - these // cannot be converted using the 'OutObject' helper class unless the method is within the code being // modified: - root.argValue.Clone(out valueScope).Find(row, c.Path); + root.get().Clone(out valueScope).Find(row, c.Path); // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'out' keyword - these // cannot be converted using the 'OutObject' helper class unless the method is within the code being // modified: @@ -1003,19 +1006,19 @@ public final class TupleUnitTests { assert valueScope.MoveNext(row); TypeArgument mmmType = c.TypeArgs[1]; - tangible.RefObject tempRef_valueScope = - new tangible.RefObject(valueScope); + RefObject tempRef_valueScope = + new RefObject(valueScope); RowCursor coordScope; - tangible.OutObject tempOut_coordScope = - new tangible.OutObject(); + OutObject tempOut_coordScope = + new OutObject(); ResultAssert.IsSuccess(mmmType.getType().TypeAs().WriteScope(row, tempRef_valueScope, mmmType.getTypeArgs().clone(), tempOut_coordScope)); - coordScope = tempOut_coordScope.argValue; - valueScope = tempRef_valueScope.argValue; - tangible.RefObject tempRef_coordScope = - new tangible.RefObject(coordScope); + coordScope = tempOut_coordScope.get(); + valueScope = tempRef_valueScope.get(); + RefObject tempRef_coordScope = + new RefObject(coordScope); TupleUnitTests.WriteCoord(row, tempRef_coordScope, mmmType.getTypeArgs().clone(), pc.Coord.Item2); - coordScope = tempRef_coordScope.argValue; + coordScope = tempRef_coordScope.get(); } } diff --git a/jre/src/test/java/azure/data/cosmos/serialization/hybridrow/unit/TypedArrayUnitTests.java b/jre/src/test/java/com/azure/data/cosmos/serialization/hybridrow/unit/TypedArrayUnitTests.java similarity index 75% rename from jre/src/test/java/azure/data/cosmos/serialization/hybridrow/unit/TypedArrayUnitTests.java rename to jre/src/test/java/com/azure/data/cosmos/serialization/hybridrow/unit/TypedArrayUnitTests.java index 7df9892..243432a 100644 --- a/jre/src/test/java/azure/data/cosmos/serialization/hybridrow/unit/TypedArrayUnitTests.java +++ b/jre/src/test/java/com/azure/data/cosmos/serialization/hybridrow/unit/TypedArrayUnitTests.java @@ -2,12 +2,15 @@ // Copyright (c) Microsoft Corporation. All rights reserved. //------------------------------------------------------------ -package azure.data.cosmos.serialization.hybridrow.unit; +package com.azure.data.cosmos.serialization.hybridrow.unit; -import azure.data.cosmos.serialization.hybridrow.HybridRowVersion; -import azure.data.cosmos.serialization.hybridrow.Result; -import azure.data.cosmos.serialization.hybridrow.RowBuffer; -import azure.data.cosmos.serialization.hybridrow.RowCursor; +import com.azure.data.cosmos.core.OutObject; +import com.azure.data.cosmos.core.RefObject; +import com.azure.data.cosmos.serialization.hybridrow.HybridRowVersion; +import com.azure.data.cosmos.serialization.hybridrow.Result; +import com.azure.data.cosmos.serialization.hybridrow.RowBuffer; +import com.azure.data.cosmos.serialization.hybridrow.RowCursor; +import com.azure.data.cosmos.serialization.hybridrow.RowCursorExtensions; import java.nio.file.Files; import java.util.ArrayList; @@ -52,26 +55,26 @@ public final class TypedArrayUnitTests { t1.Priority = new ArrayList>(Arrays.asList(Tuple.Create("80's", 100L), Tuple.Create( "classics", 100L), Tuple.Create("pop", 50L))); - tangible.RefObject tempRef_row = - new tangible.RefObject(row); - tangible.RefObject tempRef_row2 = - new tangible.RefObject(row); + RefObject tempRef_row = + new RefObject(row); + RefObject tempRef_row2 = + new RefObject(row); RowCursor _; // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'out' keyword - these // cannot be converted using the 'OutObject' helper class unless the method is within the code being modified: this.WriteTagged(tempRef_row, RowCursor.Create(tempRef_row2, out _), t1); - row = tempRef_row2.argValue; - row = tempRef_row.argValue; - tangible.RefObject tempRef_row3 = - new tangible.RefObject(row); - tangible.RefObject tempRef_row4 = - new tangible.RefObject(row); + row = tempRef_row2.get(); + row = tempRef_row.get(); + RefObject tempRef_row3 = + new RefObject(row); + RefObject tempRef_row4 = + new RefObject(row); RowCursor _; // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'out' keyword - these // cannot be converted using the 'OutObject' helper class unless the method is within the code being modified: Tagged t2 = this.ReadTagged(tempRef_row3, RowCursor.Create(tempRef_row4, out _)); - row = tempRef_row4.argValue; - row = tempRef_row3.argValue; + row = tempRef_row4.get(); + row = tempRef_row3.get(); assert t1 == t2; } @@ -85,35 +88,35 @@ public final class TypedArrayUnitTests { x -> x.Name.equals("Tagged")).SchemaId); } - private static SimilarMatch ReadSimilarMatch(tangible.RefObject row, - tangible.RefObject matchScope) { - Layout matchLayout = matchScope.argValue.getLayout(); + private static SimilarMatch ReadSimilarMatch(RefObject row, + RefObject matchScope) { + Layout matchLayout = matchScope.get().getLayout(); SimilarMatch m = new SimilarMatch(); LayoutColumn c; // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'out' keyword - these // cannot be converted using the 'OutObject' helper class unless the method is within the code being modified: assert matchLayout.TryFind("thumbprint", out c); - tangible.OutObject tempOut_Thumbprint = new tangible.OutObject(); + OutObject tempOut_Thumbprint = new OutObject(); ResultAssert.IsSuccess(c.TypeAs().ReadFixed(row, matchScope, c, tempOut_Thumbprint)); - m.Thumbprint = tempOut_Thumbprint.argValue; + m.Thumbprint = tempOut_Thumbprint.get(); // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'out' keyword - these // cannot be converted using the 'OutObject' helper class unless the method is within the code being modified: assert matchLayout.TryFind("score", out c); - tangible.OutObject tempOut_Score = new tangible.OutObject(); + OutObject tempOut_Score = new OutObject(); ResultAssert.IsSuccess(c.TypeAs().ReadFixed(row, matchScope, c, tempOut_Score)); - m.Score = tempOut_Score.argValue; + m.Score = tempOut_Score.get(); return m; } - private Tagged ReadTagged(tangible.RefObject row, tangible.RefObject root) { + private Tagged ReadTagged(RefObject row, RefObject root) { Tagged value = new Tagged(); LayoutColumn c; // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'out' keyword - these // cannot be converted using the 'OutObject' helper class unless the method is within the code being modified: assert this.layout.TryFind("title", out c); - tangible.OutObject tempOut_Title = new tangible.OutObject(); + OutObject tempOut_Title = new OutObject(); ResultAssert.IsSuccess(c.TypeAs().ReadVariable(row, root, c, tempOut_Title)); - value.Title = tempOut_Title.argValue; + value.Title = tempOut_Title.get(); // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'out' keyword - these // cannot be converted using the 'OutObject' helper class unless the method is within the code being modified: @@ -121,7 +124,7 @@ public final class TypedArrayUnitTests { RowCursor tagsScope; // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'out' keyword - these // cannot be converted using the 'OutObject' helper class unless the method is within the code being modified: - root.argValue.Clone(out tagsScope).Find(row, c.Path); + root.get().Clone(out tagsScope).Find(row, c.Path); // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'out' keyword - these // cannot be converted using the 'OutObject' 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 @@ -148,7 +151,7 @@ public final class TypedArrayUnitTests { RowCursor optionsScope; // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'out' keyword - these // cannot be converted using the 'OutObject' helper class unless the method is within the code being modified: - root.argValue.Clone(out optionsScope).Find(row, c.Path); + root.get().Clone(out optionsScope).Find(row, c.Path); // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'out' keyword - these // cannot be converted using the 'OutObject' 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 @@ -157,33 +160,33 @@ public final class TypedArrayUnitTests { value.Options = new ArrayList(); while (optionsScope.MoveNext(row)) { TypeArgument itemType = c.TypeArgs[0]; - tangible.RefObject tempRef_optionsScope = - new tangible.RefObject(optionsScope); + RefObject tempRef_optionsScope = + new RefObject(optionsScope); RowCursor nullableScope; - tangible.OutObject tempOut_nullableScope = - new tangible.OutObject(); + OutObject tempOut_nullableScope = + new OutObject(); ResultAssert.IsSuccess(itemType.getType().TypeAs().ReadScope(row, tempRef_optionsScope, tempOut_nullableScope)); - nullableScope = tempOut_nullableScope.argValue; - optionsScope = tempRef_optionsScope.argValue; + nullableScope = tempOut_nullableScope.get(); + optionsScope = tempRef_optionsScope.get(); if (nullableScope.MoveNext(row)) { - tangible.RefObject tempRef_nullableScope = new tangible.RefObject(nullableScope); + RefObject tempRef_nullableScope = new RefObject(nullableScope); ResultAssert.IsSuccess(LayoutNullable.HasValue(row, tempRef_nullableScope)); - nullableScope = tempRef_nullableScope.argValue; + nullableScope = tempRef_nullableScope.get(); - tangible.RefObject tempRef_nullableScope2 = new tangible.RefObject(nullableScope); + RefObject tempRef_nullableScope2 = new RefObject(nullableScope); int itemValue; - tangible.OutObject tempOut_itemValue = new tangible.OutObject(); + OutObject tempOut_itemValue = new OutObject(); ResultAssert.IsSuccess(itemType.getTypeArgs().get(0).getType().TypeAs().ReadSparse(row, tempRef_nullableScope2, tempOut_itemValue)); - itemValue = tempOut_itemValue.argValue; - nullableScope = tempRef_nullableScope2.argValue; + itemValue = tempOut_itemValue.get(); + nullableScope = tempRef_nullableScope2.get(); value.Options.add(itemValue); } else { - tangible.RefObject tempRef_nullableScope3 = new tangible.RefObject(nullableScope); + RefObject tempRef_nullableScope3 = new RefObject(nullableScope); ResultAssert.NotFound(LayoutNullable.HasValue(row, tempRef_nullableScope3)); - nullableScope = tempRef_nullableScope3.argValue; + nullableScope = tempRef_nullableScope3.get(); value.Options.add(null); } @@ -196,7 +199,7 @@ public final class TypedArrayUnitTests { RowCursor ratingsScope; // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'out' keyword - these // cannot be converted using the 'OutObject' helper class unless the method is within the code being modified: - root.argValue.Clone(out ratingsScope).Find(row, c.Path); + root.get().Clone(out ratingsScope).Find(row, c.Path); // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'out' keyword - these // cannot be converted using the 'OutObject' 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 @@ -206,34 +209,34 @@ public final class TypedArrayUnitTests { TypeArgument innerType = c.TypeArgs[0]; LayoutTypedArray innerLayout = innerType.getType().TypeAs(); RowCursor innerScope = null; - tangible.RefObject tempRef_innerScope = - new tangible.RefObject(innerScope); + RefObject tempRef_innerScope = + new RefObject(innerScope); while (ratingsScope.MoveNext(row, tempRef_innerScope)) { - innerScope = tempRef_innerScope.argValue; + innerScope = tempRef_innerScope.get(); ArrayList item = new ArrayList(); - tangible.RefObject tempRef_ratingsScope = - new tangible.RefObject(ratingsScope); - tangible.OutObject tempOut_innerScope = - new tangible.OutObject(); + RefObject tempRef_ratingsScope = + new RefObject(ratingsScope); + OutObject tempOut_innerScope = + new OutObject(); ResultAssert.IsSuccess(innerLayout.ReadScope(row, tempRef_ratingsScope, tempOut_innerScope)); - innerScope = tempOut_innerScope.argValue; - ratingsScope = tempRef_ratingsScope.argValue; - while (Microsoft.Azure.Cosmos.Serialization.HybridRow.RowCursorExtensions.MoveNext(innerScope.clone() + innerScope = tempOut_innerScope.get(); + ratingsScope = tempRef_ratingsScope.get(); + while (RowCursorExtensions.MoveNext(innerScope.clone() , row)) { LayoutFloat64 itemLayout = innerType.getTypeArgs().get(0).getType().TypeAs(); - tangible.RefObject tempRef_innerScope2 - = new tangible.RefObject(innerScope); + RefObject tempRef_innerScope2 + = new RefObject(innerScope); double innerItem; - tangible.OutObject tempOut_innerItem = new tangible.OutObject(); + OutObject tempOut_innerItem = new OutObject(); ResultAssert.IsSuccess(itemLayout.ReadSparse(row, tempRef_innerScope2, tempOut_innerItem)); - innerItem = tempOut_innerItem.argValue; - innerScope = tempRef_innerScope2.argValue; + innerItem = tempOut_innerItem.get(); + innerScope = tempRef_innerScope2.get(); item.add(innerItem); } value.Ratings.add(item); } - innerScope = tempRef_innerScope.argValue; + innerScope = tempRef_innerScope.get(); } // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'out' keyword - these @@ -242,7 +245,7 @@ public final class TypedArrayUnitTests { RowCursor similarsScope; // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'out' keyword - these // cannot be converted using the 'OutObject' helper class unless the method is within the code being modified: - root.argValue.Clone(out similarsScope).Find(row, c.Path); + root.get().Clone(out similarsScope).Find(row, c.Path); // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'out' keyword - these // cannot be converted using the 'OutObject' 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 @@ -252,18 +255,18 @@ public final class TypedArrayUnitTests { while (similarsScope.MoveNext(row)) { TypeArgument innerType = c.TypeArgs[0]; LayoutUDT innerLayout = innerType.getType().TypeAs(); - tangible.RefObject tempRef_similarsScope = - new tangible.RefObject(similarsScope); + RefObject tempRef_similarsScope = + new RefObject(similarsScope); RowCursor matchScope; - tangible.OutObject tempOut_matchScope = - new tangible.OutObject(); + OutObject tempOut_matchScope = + new OutObject(); ResultAssert.IsSuccess(innerLayout.ReadScope(row, tempRef_similarsScope, tempOut_matchScope)); - matchScope = tempOut_matchScope.argValue; - similarsScope = tempRef_similarsScope.argValue; - tangible.RefObject tempRef_matchScope = - new tangible.RefObject(matchScope); + matchScope = tempOut_matchScope.get(); + similarsScope = tempRef_similarsScope.get(); + RefObject tempRef_matchScope = + new RefObject(matchScope); SimilarMatch item = TypedArrayUnitTests.ReadSimilarMatch(row, tempRef_matchScope); - matchScope = tempRef_matchScope.argValue; + matchScope = tempRef_matchScope.get(); value.Similars.add(item); } } @@ -274,7 +277,7 @@ public final class TypedArrayUnitTests { RowCursor priorityScope; // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'out' keyword - these // cannot be converted using the 'OutObject' helper class unless the method is within the code being modified: - root.argValue.Clone(out priorityScope).Find(row, c.Path); + root.get().Clone(out priorityScope).Find(row, c.Path); // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'out' keyword - these // cannot be converted using the 'OutObject' 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 @@ -282,54 +285,54 @@ public final class TypedArrayUnitTests { if (c.TypeAs().ReadScope(row, ref priorityScope, out priorityScope) == Result.Success) { value.Priority = new ArrayList>(); RowCursor tupleScope = null; - tangible.RefObject tempRef_tupleScope = - new tangible.RefObject(tupleScope); + RefObject tempRef_tupleScope = + new RefObject(tupleScope); while (priorityScope.MoveNext(row, tempRef_tupleScope)) { - tupleScope = tempRef_tupleScope.argValue; + tupleScope = tempRef_tupleScope.get(); TypeArgument innerType = c.TypeArgs[0]; LayoutIndexedScope innerLayout = innerType.getType().TypeAs(); - tangible.RefObject tempRef_priorityScope = - new tangible.RefObject(priorityScope); - tangible.OutObject tempOut_tupleScope = - new tangible.OutObject(); + RefObject tempRef_priorityScope = + new RefObject(priorityScope); + OutObject tempOut_tupleScope = + new OutObject(); ResultAssert.IsSuccess(innerLayout.ReadScope(row, tempRef_priorityScope, tempOut_tupleScope)); - tupleScope = tempOut_tupleScope.argValue; - priorityScope = tempRef_priorityScope.argValue; - assert Microsoft.Azure.Cosmos.Serialization.HybridRow.RowCursorExtensions.MoveNext(tupleScope.clone() + tupleScope = tempOut_tupleScope.get(); + priorityScope = tempRef_priorityScope.get(); + assert RowCursorExtensions.MoveNext(tupleScope.clone() , row); - tangible.RefObject tempRef_tupleScope2 = - new tangible.RefObject(tupleScope); + RefObject tempRef_tupleScope2 = + new RefObject(tupleScope); String item1; // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'out' keyword - // these cannot be converted using the 'OutObject' helper class unless the method is within the code // being modified: ResultAssert.IsSuccess(innerType.getTypeArgs().get(0).getType().TypeAs().ReadSparse(row, tempRef_tupleScope2, out item1)); - tupleScope = tempRef_tupleScope2.argValue; + tupleScope = tempRef_tupleScope2.get(); - assert Microsoft.Azure.Cosmos.Serialization.HybridRow.RowCursorExtensions.MoveNext(tupleScope.clone() + assert RowCursorExtensions.MoveNext(tupleScope.clone() , row); - tangible.RefObject tempRef_tupleScope3 = - new tangible.RefObject(tupleScope); + RefObject tempRef_tupleScope3 = + new RefObject(tupleScope); long item2; - tangible.OutObject tempOut_item2 = new tangible.OutObject(); + OutObject tempOut_item2 = new OutObject(); ResultAssert.IsSuccess(innerType.getTypeArgs().get(1).getType().TypeAs().ReadSparse(row, tempRef_tupleScope3, tempOut_item2)); - item2 = tempOut_item2.argValue; - tupleScope = tempRef_tupleScope3.argValue; + item2 = tempOut_item2.get(); + tupleScope = tempRef_tupleScope3.get(); value.Priority.add(Tuple.Create(item1, item2)); } - tupleScope = tempRef_tupleScope.argValue; + tupleScope = tempRef_tupleScope.get(); } return value; } - private static void WriteSimilarMatch(tangible.RefObject row, tangible.RefObject matchScope + private static void WriteSimilarMatch(RefObject row, RefObject matchScope , TypeArgumentList typeArgs, SimilarMatch m) { - Layout matchLayout = row.argValue.getResolver().Resolve(typeArgs.getSchemaId().clone()); + Layout matchLayout = row.get().getResolver().Resolve(typeArgs.getSchemaId().clone()); LayoutColumn c; // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'out' keyword - these // cannot be converted using the 'OutObject' helper class unless the method is within the code being modified: @@ -341,7 +344,7 @@ public final class TypedArrayUnitTests { ResultAssert.IsSuccess(c.TypeAs().WriteFixed(row, matchScope, c, m.Score)); } - private void WriteTagged(tangible.RefObject row, tangible.RefObject root, Tagged value) { + private void WriteTagged(RefObject row, RefObject root, Tagged value) { LayoutColumn c; // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'out' keyword - these // cannot be converted using the 'OutObject' helper class unless the method is within the code being modified: @@ -357,7 +360,7 @@ public final class TypedArrayUnitTests { // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'out' keyword - these // cannot be converted using the 'OutObject' helper class unless the method is within the code being // modified: - root.argValue.Clone(out tagsScope).Find(row, c.Path); + root.get().Clone(out tagsScope).Find(row, c.Path); // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'out' keyword - these // cannot be converted using the 'OutObject' helper class unless the method is within the code being // modified: @@ -384,7 +387,7 @@ public final class TypedArrayUnitTests { // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'out' keyword - these // cannot be converted using the 'OutObject' helper class unless the method is within the code being // modified: - root.argValue.Clone(out optionsScope).Find(row, c.Path); + root.get().Clone(out optionsScope).Find(row, c.Path); // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'out' keyword - these // cannot be converted using the 'OutObject' helper class unless the method is within the code being // modified: @@ -406,9 +409,9 @@ public final class TypedArrayUnitTests { itemType.getTypeArgs().clone(), item != null, out nullableScope)); if (item != null) { - tangible.RefObject tempRef_nullableScope = new tangible.RefObject(nullableScope); + RefObject tempRef_nullableScope = new RefObject(nullableScope); ResultAssert.IsSuccess(itemType.getTypeArgs().get(0).getType().TypeAs().WriteSparse(row, tempRef_nullableScope, item.intValue())); - nullableScope = tempRef_nullableScope.argValue; + nullableScope = tempRef_nullableScope.get(); } // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'ref' keyword - @@ -427,7 +430,7 @@ public final class TypedArrayUnitTests { // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'out' keyword - these // cannot be converted using the 'OutObject' helper class unless the method is within the code being // modified: - root.argValue.Clone(out ratingsScope).Find(row, c.Path); + root.get().Clone(out ratingsScope).Find(row, c.Path); // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'out' keyword - these // cannot be converted using the 'OutObject' helper class unless the method is within the code being // modified: @@ -440,21 +443,21 @@ public final class TypedArrayUnitTests { assert item != null; TypeArgument innerType = c.TypeArgs[0]; LayoutTypedArray innerLayout = innerType.getType().TypeAs(); - tangible.RefObject tempRef_ratingsScope = - new tangible.RefObject(ratingsScope); + RefObject tempRef_ratingsScope = + new RefObject(ratingsScope); RowCursor innerScope; - tangible.OutObject tempOut_innerScope = - new tangible.OutObject(); + OutObject tempOut_innerScope = + new OutObject(); ResultAssert.IsSuccess(innerLayout.WriteScope(row, tempRef_ratingsScope, innerType.getTypeArgs().clone(), tempOut_innerScope)); - innerScope = tempOut_innerScope.argValue; - ratingsScope = tempRef_ratingsScope.argValue; + innerScope = tempOut_innerScope.get(); + ratingsScope = tempRef_ratingsScope.get(); for (double innerItem : item) { LayoutFloat64 itemLayout = innerType.getTypeArgs().get(0).getType().TypeAs(); - tangible.RefObject tempRef_innerScope = - new tangible.RefObject(innerScope); + RefObject tempRef_innerScope = + new RefObject(innerScope); ResultAssert.IsSuccess(itemLayout.WriteSparse(row, tempRef_innerScope, innerItem)); - innerScope = tempRef_innerScope.argValue; + innerScope = tempRef_innerScope.get(); assert !innerScope.MoveNext(row); } @@ -474,7 +477,7 @@ public final class TypedArrayUnitTests { // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'out' keyword - these // cannot be converted using the 'OutObject' helper class unless the method is within the code being // modified: - root.argValue.Clone(out similarsScope).Find(row, c.Path); + root.get().Clone(out similarsScope).Find(row, c.Path); // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'out' keyword - these // cannot be converted using the 'OutObject' helper class unless the method is within the code being // modified: @@ -486,19 +489,19 @@ public final class TypedArrayUnitTests { for (SimilarMatch item : value.Similars) { TypeArgument innerType = c.TypeArgs[0]; LayoutUDT innerLayout = innerType.getType().TypeAs(); - tangible.RefObject tempRef_similarsScope = - new tangible.RefObject(similarsScope); + RefObject tempRef_similarsScope = + new RefObject(similarsScope); RowCursor matchScope; - tangible.OutObject tempOut_matchScope = - new tangible.OutObject(); + OutObject tempOut_matchScope = + new OutObject(); ResultAssert.IsSuccess(innerLayout.WriteScope(row, tempRef_similarsScope, innerType.getTypeArgs().clone(), tempOut_matchScope)); - matchScope = tempOut_matchScope.argValue; - similarsScope = tempRef_similarsScope.argValue; - tangible.RefObject tempRef_matchScope = - new tangible.RefObject(matchScope); + matchScope = tempOut_matchScope.get(); + similarsScope = tempRef_similarsScope.get(); + RefObject tempRef_matchScope = + new RefObject(matchScope); TypedArrayUnitTests.WriteSimilarMatch(row, tempRef_matchScope, innerType.getTypeArgs().clone(), item); - matchScope = tempRef_matchScope.argValue; + matchScope = tempRef_matchScope.get(); // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'ref' keyword - // these cannot be converted using the 'RefObject' helper class unless the method is within the code @@ -516,7 +519,7 @@ public final class TypedArrayUnitTests { // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'out' keyword - these // cannot be converted using the 'OutObject' helper class unless the method is within the code being // modified: - root.argValue.Clone(out priorityScope).Find(row, c.Path); + root.get().Clone(out priorityScope).Find(row, c.Path); // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'out' keyword - these // cannot be converted using the 'OutObject' helper class unless the method is within the code being // modified: @@ -543,11 +546,11 @@ public final class TypedArrayUnitTests { ResultAssert.IsSuccess(innerType.getTypeArgs().get(0).getType().TypeAs().WriteSparse(row, ref tupleScope, item.Item1)); assert tupleScope.MoveNext(row); - tangible.RefObject tempRef_tupleScope = - new tangible.RefObject(tupleScope); + RefObject tempRef_tupleScope = + new RefObject(tupleScope); ResultAssert.IsSuccess(innerType.getTypeArgs().get(1).getType().TypeAs().WriteSparse(row , tempRef_tupleScope, item.Item2)); - tupleScope = tempRef_tupleScope.argValue; + tupleScope = tempRef_tupleScope.get(); // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'ref' keyword - // these cannot be converted using the 'RefObject' helper class unless the method is within the code diff --git a/jre/src/test/java/azure/data/cosmos/serialization/hybridrow/unit/TypedMapUnitTests.java b/jre/src/test/java/com/azure/data/cosmos/serialization/hybridrow/unit/TypedMapUnitTests.java similarity index 58% rename from jre/src/test/java/azure/data/cosmos/serialization/hybridrow/unit/TypedMapUnitTests.java rename to jre/src/test/java/com/azure/data/cosmos/serialization/hybridrow/unit/TypedMapUnitTests.java index 36e5b57..d894beb 100644 --- a/jre/src/test/java/azure/data/cosmos/serialization/hybridrow/unit/TypedMapUnitTests.java +++ b/jre/src/test/java/com/azure/data/cosmos/serialization/hybridrow/unit/TypedMapUnitTests.java @@ -2,12 +2,15 @@ // Copyright (c) Microsoft Corporation. All rights reserved. //------------------------------------------------------------ -package azure.data.cosmos.serialization.hybridrow.unit; +package com.azure.data.cosmos.serialization.hybridrow.unit; -import azure.data.cosmos.serialization.hybridrow.HybridRowVersion; -import azure.data.cosmos.serialization.hybridrow.Result; -import azure.data.cosmos.serialization.hybridrow.RowBuffer; -import azure.data.cosmos.serialization.hybridrow.RowCursor; +import com.azure.data.cosmos.core.OutObject; +import com.azure.data.cosmos.core.RefObject; +import com.azure.data.cosmos.serialization.hybridrow.HybridRowVersion; +import com.azure.data.cosmos.serialization.hybridrow.Result; +import com.azure.data.cosmos.serialization.hybridrow.RowBuffer; +import com.azure.data.cosmos.serialization.hybridrow.RowCursor; +import com.azure.data.cosmos.serialization.hybridrow.layouts.LayoutColumn; import java.math.BigDecimal; import java.nio.file.Files; @@ -58,26 +61,26 @@ public final class TypedMapUnitTests { Map.entry(LocalDateTime.parse("01/31/1997"), tempVar3))); // ReSharper restore StringLiteralTypo - tangible.RefObject tempRef_row = - new tangible.RefObject(row); - tangible.RefObject tempRef_row2 = - new tangible.RefObject(row); + RefObject tempRef_row = + new RefObject(row); + RefObject tempRef_row2 = + new RefObject(row); RowCursor _; // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'out' keyword - these // cannot be converted using the 'OutObject' helper class unless the method is within the code being modified: this.WriteMovie(tempRef_row, RowCursor.Create(tempRef_row2, out _), t1); - row = tempRef_row2.argValue; - row = tempRef_row.argValue; - tangible.RefObject tempRef_row3 = - new tangible.RefObject(row); - tangible.RefObject tempRef_row4 = - new tangible.RefObject(row); + row = tempRef_row2.get(); + row = tempRef_row.get(); + RefObject tempRef_row3 = + new RefObject(row); + RefObject tempRef_row4 = + new RefObject(row); RowCursor _; // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'out' keyword - these // cannot be converted using the 'OutObject' helper class unless the method is within the code being modified: Movie t2 = this.ReadMovie(tempRef_row3, RowCursor.Create(tempRef_row4, out _)); - row = tempRef_row4.argValue; - row = tempRef_row3.argValue; + row = tempRef_row4.get(); + row = tempRef_row3.get(); assert t1 == t2; } @@ -86,10 +89,10 @@ public final class TypedMapUnitTests { public void FindAndDelete() { RowBuffer row = new RowBuffer(TypedMapUnitTests.InitialRowSize); row.InitLayout(HybridRowVersion.V1, this.layout, this.resolver); - tangible.RefObject tempRef_row = - new tangible.RefObject(row); + RefObject tempRef_row = + new RefObject(row); RowCursor root = RowCursor.Create(tempRef_row); - row = tempRef_row.argValue; + row = tempRef_row.get(); ArrayList expected = new ArrayList(Arrays.asList("Mark", "Harrison", "Carrie")); @@ -97,14 +100,14 @@ public final class TypedMapUnitTests { Movie t1 = new Movie(); t1.Cast = new HashMap(Map.ofEntries(Map.entry("Mark", "Luke"), Map.entry("Harrison", "Han" ), Map.entry("Carrie", "Leia"))); - tangible.RefObject tempRef_row2 = - new tangible.RefObject(row); + RefObject tempRef_row2 = + new RefObject(row); RowCursor _; // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'out' keyword - these // cannot be converted using the 'OutObject' helper class unless the method is within the code being // modified: this.WriteMovie(tempRef_row2, root.Clone(out _), t1); - row = tempRef_row2.argValue; + row = tempRef_row2.get(); // Attempt to find each item in turn and then delete it. LayoutColumn c; @@ -112,16 +115,16 @@ public final class TypedMapUnitTests { // cannot be converted using the 'OutObject' helper class unless the method is within the code being // modified: assert this.layout.TryFind("cast", out c); - tangible.RefObject tempRef_row3 = - new tangible.RefObject(row); + RefObject tempRef_row3 = + new RefObject(row); RowCursor mapScope; // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'out' keyword - these // cannot be converted using the 'OutObject' helper class unless the method is within the code being // modified: root.Clone(out mapScope).Find(tempRef_row3, c.Path); - row = tempRef_row3.argValue; - tangible.RefObject tempRef_row4 = - new tangible.RefObject(row); + row = tempRef_row3.get(); + RefObject tempRef_row4 = + new RefObject(row); // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'out' keyword - these // cannot be converted using the 'OutObject' helper class unless the method is within the code being // modified: @@ -129,28 +132,28 @@ public final class TypedMapUnitTests { // cannot be converted using the 'RefObject' helper class unless the method is within the code being // modified: ResultAssert.IsSuccess(c.TypeAs().ReadScope(tempRef_row4, ref mapScope, out mapScope)); - row = tempRef_row4.argValue; + row = tempRef_row4.get(); for (String key : permutation) { KeyValuePair pair = new KeyValuePair(key, "map lookup matches only on" + " key"); - tangible.RefObject tempRef_row5 = - new tangible.RefObject(row); + RefObject tempRef_row5 = + new RefObject(row); RowCursor tempCursor; // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'out' keyword - // these cannot be converted using the 'OutObject' helper class unless the method is within the code // being modified: root.Clone(out tempCursor).Find(tempRef_row5, Utf8String.Empty); - row = tempRef_row5.argValue; - tangible.RefObject tempRef_row6 = - new tangible.RefObject(row); - tangible.RefObject tempRef_tempCursor = - new tangible.RefObject(tempCursor); + row = tempRef_row5.get(); + RefObject tempRef_row6 = + new RefObject(row); + RefObject tempRef_tempCursor = + new RefObject(tempCursor); ResultAssert.IsSuccess(TypedMapUnitTests.WriteKeyValue(tempRef_row6, tempRef_tempCursor, c.TypeArgs, pair)); - tempCursor = tempRef_tempCursor.argValue; - row = tempRef_row6.argValue; - tangible.RefObject tempRef_row7 = - new tangible.RefObject(row); + tempCursor = tempRef_tempCursor.get(); + row = tempRef_row6.get(); + RefObject tempRef_row7 = + new RefObject(row); RowCursor findScope; // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'out' keyword - // these cannot be converted using the 'OutObject' helper class unless the method is within the code @@ -160,19 +163,19 @@ public final class TypedMapUnitTests { // being modified: ResultAssert.IsSuccess(c.TypeAs().Find(tempRef_row7, ref mapScope, ref tempCursor, out findScope)); - row = tempRef_row7.argValue; + row = tempRef_row7.get(); // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'ref' keyword - // these cannot be converted using the 'RefObject' helper class unless the method is within the code // being modified: TypeArgument tupleType = c.TypeAs().FieldType(ref mapScope); - tangible.RefObject tempRef_row8 = - new tangible.RefObject(row); - tangible.RefObject tempRef_findScope = - new tangible.RefObject(findScope); + RefObject tempRef_row8 = + new RefObject(row); + RefObject tempRef_findScope = + new RefObject(findScope); ResultAssert.IsSuccess(tupleType.TypeAs().DeleteScope(tempRef_row8, tempRef_findScope)); - findScope = tempRef_findScope.argValue; - row = tempRef_row8.argValue; + findScope = tempRef_findScope.get(); + row = tempRef_row8.get(); } } } @@ -182,65 +185,65 @@ public final class TypedMapUnitTests { public void FindInMap() { RowBuffer row = new RowBuffer(TypedMapUnitTests.InitialRowSize); row.InitLayout(HybridRowVersion.V1, this.layout, this.resolver); - tangible.RefObject tempRef_row = - new tangible.RefObject(row); + RefObject tempRef_row = + new RefObject(row); RowCursor root = RowCursor.Create(tempRef_row); - row = tempRef_row.argValue; + row = tempRef_row.get(); Movie t1 = new Movie(); t1.Cast = new HashMap(Map.ofEntries(Map.entry("Mark", "Luke"), Map.entry("Harrison", "Han"), Map.entry("Carrie", "Leia"))); - tangible.RefObject tempRef_row2 = - new tangible.RefObject(row); + RefObject tempRef_row2 = + new RefObject(row); RowCursor rc1 = RowCursor.Create(tempRef_row2); - row = tempRef_row2.argValue; - tangible.RefObject tempRef_row3 = - new tangible.RefObject(row); - tangible.RefObject tempRef_rc1 = - new tangible.RefObject(rc1); + row = tempRef_row2.get(); + RefObject tempRef_row3 = + new RefObject(row); + RefObject tempRef_rc1 = + new RefObject(rc1); this.WriteMovie(tempRef_row3, tempRef_rc1, t1); - rc1 = tempRef_rc1.argValue; - row = tempRef_row3.argValue; + rc1 = tempRef_rc1.get(); + row = tempRef_row3.get(); // Attempt to find each item in turn. LayoutColumn c; // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'out' keyword - these // cannot be converted using the 'OutObject' helper class unless the method is within the code being modified: assert this.layout.TryFind("cast", out c); - tangible.RefObject tempRef_row4 = - new tangible.RefObject(row); + RefObject tempRef_row4 = + new RefObject(row); RowCursor mapScope; // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'out' keyword - these // cannot be converted using the 'OutObject' helper class unless the method is within the code being modified: root.Clone(out mapScope).Find(tempRef_row4, c.Path); - row = tempRef_row4.argValue; - tangible.RefObject tempRef_row5 = - new tangible.RefObject(row); + row = tempRef_row4.get(); + RefObject tempRef_row5 = + new RefObject(row); // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'out' keyword - these // cannot be converted using the 'OutObject' 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 // cannot be converted using the 'RefObject' helper class unless the method is within the code being modified: ResultAssert.IsSuccess(c.TypeAs().ReadScope(tempRef_row5, ref mapScope, out mapScope)); - row = tempRef_row5.argValue; + row = tempRef_row5.get(); for (String key : t1.Cast.keySet()) { KeyValuePair pair = new KeyValuePair(key, "map lookup matches only on key"); - tangible.RefObject tempRef_row6 = - new tangible.RefObject(row); + RefObject tempRef_row6 = + new RefObject(row); RowCursor tempCursor; // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'out' keyword - these // cannot be converted using the 'OutObject' helper class unless the method is within the code being // modified: root.Clone(out tempCursor).Find(tempRef_row6, Utf8String.Empty); - row = tempRef_row6.argValue; - tangible.RefObject tempRef_row7 = - new tangible.RefObject(row); - tangible.RefObject tempRef_tempCursor = - new tangible.RefObject(tempCursor); + row = tempRef_row6.get(); + RefObject tempRef_row7 = + new RefObject(row); + RefObject tempRef_tempCursor = + new RefObject(tempCursor); ResultAssert.IsSuccess(TypedMapUnitTests.WriteKeyValue(tempRef_row7, tempRef_tempCursor, c.TypeArgs, pair)); - tempCursor = tempRef_tempCursor.argValue; - row = tempRef_row7.argValue; - tangible.RefObject tempRef_row8 = - new tangible.RefObject(row); + tempCursor = tempRef_tempCursor.get(); + row = tempRef_row7.get(); + RefObject tempRef_row8 = + new RefObject(row); RowCursor findScope; // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'out' keyword - these // cannot be converted using the 'OutObject' helper class unless the method is within the code being @@ -250,19 +253,19 @@ public final class TypedMapUnitTests { // modified: ResultAssert.IsSuccess(c.TypeAs().Find(tempRef_row8, ref mapScope, ref tempCursor, out findScope)); - row = tempRef_row8.argValue; - tangible.RefObject tempRef_row9 = - new tangible.RefObject(row); - tangible.RefObject tempRef_findScope = - new tangible.RefObject(findScope); + row = tempRef_row8.get(); + RefObject tempRef_row9 = + new RefObject(row); + RefObject tempRef_findScope = + new RefObject(findScope); KeyValuePair foundPair; - tangible.OutObject> tempOut_foundPair = - new tangible.OutObject>(); + OutObject> tempOut_foundPair = + new OutObject>(); ResultAssert.IsSuccess(TypedMapUnitTests.ReadKeyValue(tempRef_row9, tempRef_findScope, c.TypeArgs, tempOut_foundPair)); - foundPair = tempOut_foundPair.argValue; - findScope = tempRef_findScope.argValue; - row = tempRef_row9.argValue; + foundPair = tempOut_foundPair.get(); + findScope = tempRef_findScope.get(); + row = tempRef_row9.get(); Assert.AreEqual(key, foundPair.Key, String.format("Failed to find t1.Cast[%1$s]", key)); } } @@ -282,10 +285,10 @@ public final class TypedMapUnitTests { public void PreventUniquenessViolations() { RowBuffer row = new RowBuffer(TypedMapUnitTests.InitialRowSize); row.InitLayout(HybridRowVersion.V1, this.layout, this.resolver); - tangible.RefObject tempRef_row = - new tangible.RefObject(row); + RefObject tempRef_row = + new RefObject(row); RowCursor root = RowCursor.Create(tempRef_row); - row = tempRef_row.argValue; + row = tempRef_row.get(); Movie t1 = new Movie(); t1.Cast = new HashMap(Map.ofEntries(Map.entry("Mark", "Luke"))); @@ -299,173 +302,173 @@ public final class TypedMapUnitTests { t1.Revenue = new HashMap(Map.ofEntries(Map.entry(LocalDateTime.parse("05/25/1977"), tempVar))); - tangible.RefObject tempRef_row2 = - new tangible.RefObject(row); + RefObject tempRef_row2 = + new RefObject(row); RowCursor rc1 = RowCursor.Create(tempRef_row2); - row = tempRef_row2.argValue; - tangible.RefObject tempRef_row3 = - new tangible.RefObject(row); - tangible.RefObject tempRef_rc1 = - new tangible.RefObject(rc1); + row = tempRef_row2.get(); + RefObject tempRef_row3 = + new RefObject(row); + RefObject tempRef_rc1 = + new RefObject(rc1); this.WriteMovie(tempRef_row3, tempRef_rc1, t1); - rc1 = tempRef_rc1.argValue; - row = tempRef_row3.argValue; + rc1 = tempRef_rc1.get(); + row = tempRef_row3.get(); // Attempt to insert duplicate items in existing sets. LayoutColumn c; // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'out' keyword - these // cannot be converted using the 'OutObject' helper class unless the method is within the code being modified: assert this.layout.TryFind("cast", out c); - tangible.RefObject tempRef_row4 = - new tangible.RefObject(row); + RefObject tempRef_row4 = + new RefObject(row); RowCursor mapScope; // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'out' keyword - these // cannot be converted using the 'OutObject' helper class unless the method is within the code being modified: root.Clone(out mapScope).Find(tempRef_row4, c.Path); - row = tempRef_row4.argValue; - tangible.RefObject tempRef_row5 = - new tangible.RefObject(row); + row = tempRef_row4.get(); + RefObject tempRef_row5 = + new RefObject(row); // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'out' keyword - these // cannot be converted using the 'OutObject' 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 // cannot be converted using the 'RefObject' helper class unless the method is within the code being modified: ResultAssert.IsSuccess(c.TypeAs().ReadScope(tempRef_row5, ref mapScope, out mapScope)); - row = tempRef_row5.argValue; - tangible.RefObject tempRef_row6 = - new tangible.RefObject(row); + row = tempRef_row5.get(); + RefObject tempRef_row6 = + new RefObject(row); RowCursor tempCursor; // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'out' keyword - these // cannot be converted using the 'OutObject' helper class unless the method is within the code being modified: root.Clone(out tempCursor).Find(tempRef_row6, Utf8String.Empty); - row = tempRef_row6.argValue; - tangible.RefObject tempRef_row7 = - new tangible.RefObject(row); - tangible.RefObject tempRef_tempCursor = - new tangible.RefObject(tempCursor); + row = tempRef_row6.get(); + RefObject tempRef_row7 = + new RefObject(row); + RefObject tempRef_tempCursor = + new RefObject(tempCursor); ResultAssert.IsSuccess(TypedMapUnitTests.WriteKeyValue(tempRef_row7, tempRef_tempCursor, c.TypeArgs, KeyValuePair.Create("Mark", "Luke"))); - tempCursor = tempRef_tempCursor.argValue; - row = tempRef_row7.argValue; - tangible.RefObject tempRef_row8 = - new tangible.RefObject(row); + tempCursor = tempRef_tempCursor.get(); + row = tempRef_row7.get(); + RefObject tempRef_row8 = + new RefObject(row); // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'ref' keyword - these // cannot be converted using the 'RefObject' helper class unless the method is within the code being modified: ResultAssert.Exists(c.TypeAs().MoveField(tempRef_row8, ref mapScope, ref tempCursor, UpdateOptions.Insert)); - row = tempRef_row8.argValue; - tangible.RefObject tempRef_row9 = - new tangible.RefObject(row); + row = tempRef_row8.get(); + RefObject tempRef_row9 = + new RefObject(row); // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'out' keyword - these // cannot be converted using the 'OutObject' helper class unless the method is within the code being modified: root.Clone(out tempCursor).Find(tempRef_row9, Utf8String.Empty); - row = tempRef_row9.argValue; - tangible.RefObject tempRef_row10 = - new tangible.RefObject(row); - tangible.RefObject tempRef_tempCursor2 = - new tangible.RefObject(tempCursor); + row = tempRef_row9.get(); + RefObject tempRef_row10 = + new RefObject(row); + RefObject tempRef_tempCursor2 = + new RefObject(tempCursor); KeyValuePair _; - tangible.OutObject> tempOut__ = new tangible.OutObject>(); + OutObject> tempOut__ = new OutObject>(); ResultAssert.NotFound(TypedMapUnitTests.ReadKeyValue(tempRef_row10, tempRef_tempCursor2, c.TypeArgs, tempOut__)); - _ = tempOut__.argValue; - tempCursor = tempRef_tempCursor2.argValue; - row = tempRef_row10.argValue; - tangible.RefObject tempRef_row11 = - new tangible.RefObject(row); + _ = tempOut__.get(); + tempCursor = tempRef_tempCursor2.get(); + row = tempRef_row10.get(); + RefObject tempRef_row11 = + new RefObject(row); // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'out' keyword - these // cannot be converted using the 'OutObject' helper class unless the method is within the code being modified: root.Clone(out tempCursor).Find(tempRef_row11, Utf8String.Empty); - row = tempRef_row11.argValue; - tangible.RefObject tempRef_row12 = - new tangible.RefObject(row); - tangible.RefObject tempRef_tempCursor3 = - new tangible.RefObject(tempCursor); + row = tempRef_row11.get(); + RefObject tempRef_row12 = + new RefObject(row); + RefObject tempRef_tempCursor3 = + new RefObject(tempCursor); ResultAssert.IsSuccess(TypedMapUnitTests.WriteKeyValue(tempRef_row12, tempRef_tempCursor3, c.TypeArgs, KeyValuePair.Create("Mark", "Joker"))); - tempCursor = tempRef_tempCursor3.argValue; - row = tempRef_row12.argValue; - tangible.RefObject tempRef_row13 = - new tangible.RefObject(row); + tempCursor = tempRef_tempCursor3.get(); + row = tempRef_row12.get(); + RefObject tempRef_row13 = + new RefObject(row); // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'ref' keyword - these // cannot be converted using the 'RefObject' helper class unless the method is within the code being modified: ResultAssert.Exists(c.TypeAs().MoveField(tempRef_row13, ref mapScope, ref tempCursor, UpdateOptions.Insert)); - row = tempRef_row13.argValue; - tangible.RefObject tempRef_row14 = - new tangible.RefObject(row); + row = tempRef_row13.get(); + RefObject tempRef_row14 = + new RefObject(row); // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'out' keyword - these // cannot be converted using the 'OutObject' helper class unless the method is within the code being modified: root.Clone(out tempCursor).Find(tempRef_row14, Utf8String.Empty); - row = tempRef_row14.argValue; - tangible.RefObject tempRef_row15 = - new tangible.RefObject(row); - tangible.RefObject tempRef_tempCursor4 = - new tangible.RefObject(tempCursor); + row = tempRef_row14.get(); + RefObject tempRef_row15 = + new RefObject(row); + RefObject tempRef_tempCursor4 = + new RefObject(tempCursor); KeyValuePair _; - tangible.OutObject> tempOut__2 = - new tangible.OutObject>(); + OutObject> tempOut__2 = + new OutObject>(); ResultAssert.NotFound(TypedMapUnitTests.ReadKeyValue(tempRef_row15, tempRef_tempCursor4, c.TypeArgs, tempOut__2)); - _ = tempOut__2.argValue; - tempCursor = tempRef_tempCursor4.argValue; - row = tempRef_row15.argValue; + _ = tempOut__2.get(); + tempCursor = tempRef_tempCursor4.get(); + row = tempRef_row15.get(); // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'out' keyword - these // cannot be converted using the 'OutObject' helper class unless the method is within the code being modified: assert this.layout.TryFind("stats", out c); - tangible.RefObject tempRef_row16 = - new tangible.RefObject(row); + RefObject tempRef_row16 = + new RefObject(row); // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'out' keyword - these // cannot be converted using the 'OutObject' helper class unless the method is within the code being modified: root.Clone(out mapScope).Find(tempRef_row16, c.Path); - row = tempRef_row16.argValue; - tangible.RefObject tempRef_row17 = - new tangible.RefObject(row); + row = tempRef_row16.get(); + RefObject tempRef_row17 = + new RefObject(row); // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'out' keyword - these // cannot be converted using the 'OutObject' 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 // cannot be converted using the 'RefObject' helper class unless the method is within the code being modified: ResultAssert.IsSuccess(c.TypeAs().ReadScope(tempRef_row17, ref mapScope, out mapScope)); - row = tempRef_row17.argValue; + row = tempRef_row17.get(); KeyValuePair pair = KeyValuePair.Create(UUID.fromString("{4674962B-CE11-4916-81C5-0421EE36F168" + "}"), 11000000.00); - tangible.RefObject tempRef_row18 = - new tangible.RefObject(row); + RefObject tempRef_row18 = + new RefObject(row); // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'out' keyword - these // cannot be converted using the 'OutObject' helper class unless the method is within the code being modified: root.Clone(out tempCursor).Find(tempRef_row18, Utf8String.Empty); - row = tempRef_row18.argValue; - tangible.RefObject tempRef_row19 = - new tangible.RefObject(row); - tangible.RefObject tempRef_tempCursor5 = - new tangible.RefObject(tempCursor); + row = tempRef_row18.get(); + RefObject tempRef_row19 = + new RefObject(row); + RefObject tempRef_tempCursor5 = + new RefObject(tempCursor); ResultAssert.IsSuccess(TypedMapUnitTests.WriteKeyValue(tempRef_row19, tempRef_tempCursor5, c.TypeArgs, pair)); - tempCursor = tempRef_tempCursor5.argValue; - row = tempRef_row19.argValue; - tangible.RefObject tempRef_row20 = - new tangible.RefObject(row); + tempCursor = tempRef_tempCursor5.get(); + row = tempRef_row19.get(); + RefObject tempRef_row20 = + new RefObject(row); // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'ref' keyword - these // cannot be converted using the 'RefObject' helper class unless the method is within the code being modified: ResultAssert.Exists(c.TypeAs().MoveField(tempRef_row20, ref mapScope, ref tempCursor, UpdateOptions.Insert)); - row = tempRef_row20.argValue; - tangible.RefObject tempRef_row21 = - new tangible.RefObject(row); + row = tempRef_row20.get(); + RefObject tempRef_row21 = + new RefObject(row); // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'out' keyword - these // cannot be converted using the 'OutObject' helper class unless the method is within the code being modified: root.Clone(out tempCursor).Find(tempRef_row21, Utf8String.Empty); - row = tempRef_row21.argValue; - tangible.RefObject tempRef_row22 = - new tangible.RefObject(row); - tangible.RefObject tempRef_tempCursor6 = - new tangible.RefObject(tempCursor); - tangible.OutObject> tempOut_pair = new tangible.OutObject>(); + row = tempRef_row21.get(); + RefObject tempRef_row22 = + new RefObject(row); + RefObject tempRef_tempCursor6 = + new RefObject(tempCursor); + OutObject> tempOut_pair = new OutObject>(); ResultAssert.NotFound(TypedMapUnitTests.ReadKeyValue(tempRef_row22, tempRef_tempCursor6, c.TypeArgs, tempOut_pair)); - pair = tempOut_pair.argValue; - tempCursor = tempRef_tempCursor6.argValue; - row = tempRef_row22.argValue; + pair = tempOut_pair.get(); + tempCursor = tempRef_tempCursor6.get(); + row = tempRef_row22.get(); } // TODO: C# TO JAVA CONVERTER: Java annotations will not correspond to .NET attributes: @@ -473,132 +476,132 @@ public final class TypedMapUnitTests { public void PreventUpdatesInNonUpdatableScope() { RowBuffer row = new RowBuffer(TypedMapUnitTests.InitialRowSize); row.InitLayout(HybridRowVersion.V1, this.layout, this.resolver); - tangible.RefObject tempRef_row = - new tangible.RefObject(row); + RefObject tempRef_row = + new RefObject(row); RowCursor root = RowCursor.Create(tempRef_row); - row = tempRef_row.argValue; + row = tempRef_row.get(); // Write a map and then try to write directly into it. LayoutColumn c; // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'out' keyword - these // cannot be converted using the 'OutObject' helper class unless the method is within the code being modified: assert this.layout.TryFind("cast", out c); - tangible.RefObject tempRef_row2 = - new tangible.RefObject(row); + RefObject tempRef_row2 = + new RefObject(row); RowCursor mapScope; // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'out' keyword - these // cannot be converted using the 'OutObject' helper class unless the method is within the code being modified: root.Clone(out mapScope).Find(tempRef_row2, c.Path); - row = tempRef_row2.argValue; - tangible.RefObject tempRef_row3 = - new tangible.RefObject(row); + row = tempRef_row2.get(); + RefObject tempRef_row3 = + new RefObject(row); // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'out' keyword - these // cannot be converted using the 'OutObject' 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 // cannot be converted using the 'RefObject' helper class unless the method is within the code being modified: ResultAssert.IsSuccess(c.TypeAs().WriteScope(tempRef_row3, ref mapScope, c.TypeArgs, out mapScope)); - row = tempRef_row3.argValue; - tangible.RefObject tempRef_row4 = - new tangible.RefObject(row); - tangible.RefObject tempRef_mapScope = - new tangible.RefObject(mapScope); + row = tempRef_row3.get(); + RefObject tempRef_row4 = + new RefObject(row); + RefObject tempRef_mapScope = + new RefObject(mapScope); ResultAssert.InsufficientPermissions(TypedMapUnitTests.WriteKeyValue(tempRef_row4, tempRef_mapScope, c.TypeArgs, KeyValuePair.Create("Mark", "Joker"))); - mapScope = tempRef_mapScope.argValue; - row = tempRef_row4.argValue; - tangible.RefObject tempRef_row5 = - new tangible.RefObject(row); + mapScope = tempRef_mapScope.get(); + row = tempRef_row4.get(); + RefObject tempRef_row5 = + new RefObject(row); RowCursor tempCursor; // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'out' keyword - these // cannot be converted using the 'OutObject' helper class unless the method is within the code being modified: root.Clone(out tempCursor).Find(tempRef_row5, "cast.0"); - row = tempRef_row5.argValue; - tangible.RefObject tempRef_row6 = - new tangible.RefObject(row); - tangible.RefObject tempRef_tempCursor = - new tangible.RefObject(tempCursor); + row = tempRef_row5.get(); + RefObject tempRef_row6 = + new RefObject(row); + RefObject tempRef_tempCursor = + new RefObject(tempCursor); ResultAssert.IsSuccess(TypedMapUnitTests.WriteKeyValue(tempRef_row6, tempRef_tempCursor, c.TypeArgs, KeyValuePair.Create("Mark", "Joker"))); - tempCursor = tempRef_tempCursor.argValue; - row = tempRef_row6.argValue; - tangible.RefObject tempRef_row7 = - new tangible.RefObject(row); + tempCursor = tempRef_tempCursor.get(); + row = tempRef_row6.get(); + RefObject tempRef_row7 = + new RefObject(row); // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'ref' keyword - these // cannot be converted using the 'RefObject' helper class unless the method is within the code being modified: ResultAssert.IsSuccess(c.TypeAs().MoveField(tempRef_row7, ref mapScope, ref tempCursor)); - row = tempRef_row7.argValue; - tangible.RefObject tempRef_row8 = - new tangible.RefObject(row); + row = tempRef_row7.get(); + RefObject tempRef_row8 = + new RefObject(row); // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'out' keyword - these // cannot be converted using the 'OutObject' helper class unless the method is within the code being modified: root.Clone(out tempCursor).Find(tempRef_row8, "cast.0"); - row = tempRef_row8.argValue; - tangible.RefObject tempRef_row9 = - new tangible.RefObject(row); - tangible.RefObject tempRef_tempCursor2 = - new tangible.RefObject(tempCursor); + row = tempRef_row8.get(); + RefObject tempRef_row9 = + new RefObject(row); + RefObject tempRef_tempCursor2 = + new RefObject(tempCursor); KeyValuePair _; - tangible.OutObject> tempOut__ = new tangible.OutObject>(); + OutObject> tempOut__ = new OutObject>(); ResultAssert.NotFound(TypedMapUnitTests.ReadKeyValue(tempRef_row9, tempRef_tempCursor2, c.TypeArgs, tempOut__)); - _ = tempOut__.argValue; - tempCursor = tempRef_tempCursor2.argValue; - row = tempRef_row9.argValue; + _ = tempOut__.get(); + tempCursor = tempRef_tempCursor2.get(); + row = tempRef_row9.get(); // Write a map of maps, successfully insert an empty map into it, and then try to write directly to the inner // map. // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'out' keyword - these // cannot be converted using the 'OutObject' helper class unless the method is within the code being modified: assert this.layout.TryFind("related", out c); - tangible.RefObject tempRef_row10 = - new tangible.RefObject(row); + RefObject tempRef_row10 = + new RefObject(row); // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'out' keyword - these // cannot be converted using the 'OutObject' helper class unless the method is within the code being modified: root.Clone(out mapScope).Find(tempRef_row10, c.Path); - row = tempRef_row10.argValue; - tangible.RefObject tempRef_row11 = - new tangible.RefObject(row); + row = tempRef_row10.get(); + RefObject tempRef_row11 = + new RefObject(row); // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'out' keyword - these // cannot be converted using the 'OutObject' 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 // cannot be converted using the 'RefObject' helper class unless the method is within the code being modified: ResultAssert.IsSuccess(c.TypeAs().WriteScope(tempRef_row11, ref mapScope, c.TypeArgs, out mapScope)); - row = tempRef_row11.argValue; + row = tempRef_row11.get(); // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'ref' keyword - these // cannot be converted using the 'RefObject' helper class unless the method is within the code being modified: LayoutIndexedScope tupleLayout = c.TypeAs().FieldType(ref mapScope).TypeAs(); - tangible.RefObject tempRef_row12 = - new tangible.RefObject(row); + RefObject tempRef_row12 = + new RefObject(row); // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'out' keyword - these // cannot be converted using the 'OutObject' helper class unless the method is within the code being modified: root.Clone(out tempCursor).Find(tempRef_row12, "related.0"); - row = tempRef_row12.argValue; - tangible.RefObject tempRef_row13 = - new tangible.RefObject(row); + row = tempRef_row12.get(); + RefObject tempRef_row13 = + new RefObject(row); RowCursor tupleScope; // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'out' keyword - these // cannot be converted using the 'OutObject' 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 // cannot be converted using the 'RefObject' helper class unless the method is within the code being modified: ResultAssert.IsSuccess(tupleLayout.WriteScope(tempRef_row13, ref tempCursor, c.TypeArgs, out tupleScope)); - row = tempRef_row13.argValue; - tangible.RefObject tempRef_row14 = - new tangible.RefObject(row); + row = tempRef_row13.get(); + RefObject tempRef_row14 = + new RefObject(row); // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'ref' keyword - these // cannot be converted using the 'RefObject' helper class unless the method is within the code being modified: ResultAssert.IsSuccess(c.TypeArgs[0].Type.TypeAs().WriteSparse(tempRef_row14, ref tupleScope, "Mark")); - row = tempRef_row14.argValue; - tangible.RefObject tempRef_row15 = - new tangible.RefObject(row); + row = tempRef_row14.get(); + RefObject tempRef_row15 = + new RefObject(row); assert tupleScope.MoveNext(tempRef_row15); - row = tempRef_row15.argValue; + row = tempRef_row15.get(); TypeArgument valueType = c.TypeArgs[1]; LayoutUniqueScope valueLayout = valueType.getType().TypeAs(); - tangible.RefObject tempRef_row16 = - new tangible.RefObject(row); + RefObject tempRef_row16 = + new RefObject(row); RowCursor innerScope; // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'out' keyword - these // cannot be converted using the 'OutObject' helper class unless the method is within the code being modified: @@ -606,68 +609,68 @@ public final class TypedMapUnitTests { // cannot be converted using the 'RefObject' helper class unless the method is within the code being modified: ResultAssert.IsSuccess(valueLayout.WriteScope(tempRef_row16, ref tupleScope, valueType.getTypeArgs().clone(), out innerScope)); - row = tempRef_row16.argValue; - tangible.RefObject tempRef_row17 = - new tangible.RefObject(row); + row = tempRef_row16.get(); + RefObject tempRef_row17 = + new RefObject(row); // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'ref' keyword - these // cannot be converted using the 'RefObject' helper class unless the method is within the code being modified: ResultAssert.IsSuccess(c.TypeAs().MoveField(tempRef_row17, ref mapScope, ref tempCursor)); - row = tempRef_row17.argValue; - tangible.RefObject tempRef_row18 = - new tangible.RefObject(row); + row = tempRef_row17.get(); + RefObject tempRef_row18 = + new RefObject(row); assert mapScope.MoveNext(tempRef_row18); - row = tempRef_row18.argValue; - tangible.RefObject tempRef_row19 = - new tangible.RefObject(row); - tangible.RefObject tempRef_mapScope2 = - new tangible.RefObject(mapScope); - tangible.OutObject tempOut_tupleScope = - new tangible.OutObject(); + row = tempRef_row18.get(); + RefObject tempRef_row19 = + new RefObject(row); + RefObject tempRef_mapScope2 = + new RefObject(mapScope); + OutObject tempOut_tupleScope = + new OutObject(); ResultAssert.IsSuccess(tupleLayout.ReadScope(tempRef_row19, tempRef_mapScope2, tempOut_tupleScope)); - tupleScope = tempOut_tupleScope.argValue; - mapScope = tempRef_mapScope2.argValue; - row = tempRef_row19.argValue; - tangible.RefObject tempRef_row20 = - new tangible.RefObject(row); + tupleScope = tempOut_tupleScope.get(); + mapScope = tempRef_mapScope2.get(); + row = tempRef_row19.get(); + RefObject tempRef_row20 = + new RefObject(row); assert tupleScope.MoveNext(tempRef_row20); - row = tempRef_row20.argValue; + row = tempRef_row20.get(); // Skip key. - tangible.RefObject tempRef_row21 = - new tangible.RefObject(row); + RefObject tempRef_row21 = + new RefObject(row); assert tupleScope.MoveNext(tempRef_row21); - row = tempRef_row21.argValue; - tangible.RefObject tempRef_row22 = - new tangible.RefObject(row); - tangible.RefObject tempRef_tupleScope = - new tangible.RefObject(tupleScope); - tangible.OutObject tempOut_innerScope = - new tangible.OutObject(); + row = tempRef_row21.get(); + RefObject tempRef_row22 = + new RefObject(row); + RefObject tempRef_tupleScope = + new RefObject(tupleScope); + OutObject tempOut_innerScope = + new OutObject(); ResultAssert.IsSuccess(valueLayout.ReadScope(tempRef_row22, tempRef_tupleScope, tempOut_innerScope)); - innerScope = tempOut_innerScope.argValue; - tupleScope = tempRef_tupleScope.argValue; - row = tempRef_row22.argValue; + innerScope = tempOut_innerScope.get(); + tupleScope = tempRef_tupleScope.get(); + row = tempRef_row22.get(); TypeArgument itemType = valueType.getTypeArgs().get(0).clone(); - tangible.RefObject tempRef_row23 = - new tangible.RefObject(row); + RefObject tempRef_row23 = + new RefObject(row); assert !innerScope.MoveNext(tempRef_row23); - row = tempRef_row23.argValue; - tangible.RefObject tempRef_row24 = - new tangible.RefObject(row); - tangible.RefObject tempRef_innerScope = - new tangible.RefObject(innerScope); + row = tempRef_row23.get(); + RefObject tempRef_row24 = + new RefObject(row); + RefObject tempRef_innerScope = + new RefObject(innerScope); ResultAssert.InsufficientPermissions(itemType.getType().TypeAs().WriteSparse(tempRef_row24, tempRef_innerScope, 1)); - innerScope = tempRef_innerScope.argValue; - row = tempRef_row24.argValue; - tangible.RefObject tempRef_row25 = - new tangible.RefObject(row); - tangible.RefObject tempRef_innerScope2 = - new tangible.RefObject(innerScope); + innerScope = tempRef_innerScope.get(); + row = tempRef_row24.get(); + RefObject tempRef_row25 = + new RefObject(row); + RefObject tempRef_innerScope2 = + new RefObject(innerScope); ResultAssert.InsufficientPermissions(itemType.getType().TypeAs().DeleteSparse(tempRef_row25, tempRef_innerScope2)); - innerScope = tempRef_innerScope2.argValue; - row = tempRef_row25.argValue; + innerScope = tempRef_innerScope2.get(); + row = tempRef_row25.get(); } // TODO: C# TO JAVA CONVERTER: Java annotations will not correspond to .NET attributes: @@ -675,10 +678,10 @@ public final class TypedMapUnitTests { public void UpdateInMap() { RowBuffer row = new RowBuffer(TypedMapUnitTests.InitialRowSize); row.InitLayout(HybridRowVersion.V1, this.layout, this.resolver); - tangible.RefObject tempRef_row = - new tangible.RefObject(row); + RefObject tempRef_row = + new RefObject(row); RowCursor root = RowCursor.Create(tempRef_row); - row = tempRef_row.argValue; + row = tempRef_row.get(); ArrayList expected = new ArrayList(Arrays.asList("Mark", "Harrison", "Carrie")); @@ -686,14 +689,14 @@ public final class TypedMapUnitTests { Movie t1 = new Movie(); t1.Cast = new HashMap(Map.ofEntries(Map.entry("Mark", "Luke"), Map.entry("Harrison", "Han" ), Map.entry("Carrie", "Leia"))); - tangible.RefObject tempRef_row2 = - new tangible.RefObject(row); + RefObject tempRef_row2 = + new RefObject(row); RowCursor _; // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'out' keyword - these // cannot be converted using the 'OutObject' helper class unless the method is within the code being // modified: this.WriteMovie(tempRef_row2, root.Clone(out _), t1); - row = tempRef_row2.argValue; + row = tempRef_row2.get(); // Attempt to find each item in turn and then delete it. LayoutColumn c; @@ -701,16 +704,16 @@ public final class TypedMapUnitTests { // cannot be converted using the 'OutObject' helper class unless the method is within the code being // modified: assert this.layout.TryFind("cast", out c); - tangible.RefObject tempRef_row3 = - new tangible.RefObject(row); + RefObject tempRef_row3 = + new RefObject(row); RowCursor mapScope; // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'out' keyword - these // cannot be converted using the 'OutObject' helper class unless the method is within the code being // modified: root.Clone(out mapScope).Find(tempRef_row3, c.Path); - row = tempRef_row3.argValue; - tangible.RefObject tempRef_row4 = - new tangible.RefObject(row); + row = tempRef_row3.get(); + RefObject tempRef_row4 = + new RefObject(row); // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'out' keyword - these // cannot be converted using the 'OutObject' helper class unless the method is within the code being // modified: @@ -718,29 +721,29 @@ public final class TypedMapUnitTests { // cannot be converted using the 'RefObject' helper class unless the method is within the code being // modified: ResultAssert.IsSuccess(c.TypeAs().ReadScope(tempRef_row4, ref mapScope, out mapScope)); - row = tempRef_row4.argValue; + row = tempRef_row4.get(); for (String key : permutation) { // Verify it is already there. KeyValuePair pair = new KeyValuePair(key, "map lookup matches only on" + " key"); - tangible.RefObject tempRef_row5 = - new tangible.RefObject(row); + RefObject tempRef_row5 = + new RefObject(row); RowCursor tempCursor; // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'out' keyword - // these cannot be converted using the 'OutObject' helper class unless the method is within the code // being modified: root.Clone(out tempCursor).Find(tempRef_row5, Utf8String.Empty); - row = tempRef_row5.argValue; - tangible.RefObject tempRef_row6 = - new tangible.RefObject(row); - tangible.RefObject tempRef_tempCursor = - new tangible.RefObject(tempCursor); + row = tempRef_row5.get(); + RefObject tempRef_row6 = + new RefObject(row); + RefObject tempRef_tempCursor = + new RefObject(tempCursor); ResultAssert.IsSuccess(TypedMapUnitTests.WriteKeyValue(tempRef_row6, tempRef_tempCursor, c.TypeArgs, pair)); - tempCursor = tempRef_tempCursor.argValue; - row = tempRef_row6.argValue; - tangible.RefObject tempRef_row7 = - new tangible.RefObject(row); + tempCursor = tempRef_tempCursor.get(); + row = tempRef_row6.get(); + RefObject tempRef_row7 = + new RefObject(row); RowCursor findScope; // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'out' keyword - // these cannot be converted using the 'OutObject' helper class unless the method is within the code @@ -750,52 +753,52 @@ public final class TypedMapUnitTests { // being modified: ResultAssert.IsSuccess(c.TypeAs().Find(tempRef_row7, ref mapScope, ref tempCursor, out findScope)); - row = tempRef_row7.argValue; + row = tempRef_row7.get(); // Insert it again with update. KeyValuePair updatePair = new KeyValuePair(key, "update value"); - tangible.RefObject tempRef_row8 = - new tangible.RefObject(row); + RefObject tempRef_row8 = + new RefObject(row); // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'out' keyword - // these cannot be converted using the 'OutObject' helper class unless the method is within the code // being modified: root.Clone(out tempCursor).Find(tempRef_row8, Utf8String.Empty); - row = tempRef_row8.argValue; - tangible.RefObject tempRef_row9 = - new tangible.RefObject(row); - tangible.RefObject tempRef_tempCursor2 = - new tangible.RefObject(tempCursor); + row = tempRef_row8.get(); + RefObject tempRef_row9 = + new RefObject(row); + RefObject tempRef_tempCursor2 = + new RefObject(tempCursor); ResultAssert.IsSuccess(TypedMapUnitTests.WriteKeyValue(tempRef_row9, tempRef_tempCursor2, c.TypeArgs, updatePair)); - tempCursor = tempRef_tempCursor2.argValue; - row = tempRef_row9.argValue; - tangible.RefObject tempRef_row10 = - new tangible.RefObject(row); + tempCursor = tempRef_tempCursor2.get(); + row = tempRef_row9.get(); + RefObject tempRef_row10 = + new RefObject(row); // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'ref' keyword - // these cannot be converted using the 'RefObject' helper class unless the method is within the code // being modified: ResultAssert.IsSuccess(c.TypeAs().MoveField(tempRef_row10, ref mapScope, ref tempCursor, UpdateOptions.Update)); - row = tempRef_row10.argValue; + row = tempRef_row10.get(); // Verify that the value was updated. - tangible.RefObject tempRef_row11 = - new tangible.RefObject(row); + RefObject tempRef_row11 = + new RefObject(row); // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'out' keyword - // these cannot be converted using the 'OutObject' helper class unless the method is within the code // being modified: root.Clone(out tempCursor).Find(tempRef_row11, Utf8String.Empty); - row = tempRef_row11.argValue; - tangible.RefObject tempRef_row12 = - new tangible.RefObject(row); - tangible.RefObject tempRef_tempCursor3 = - new tangible.RefObject(tempCursor); + row = tempRef_row11.get(); + RefObject tempRef_row12 = + new RefObject(row); + RefObject tempRef_tempCursor3 = + new RefObject(tempCursor); ResultAssert.IsSuccess(TypedMapUnitTests.WriteKeyValue(tempRef_row12, tempRef_tempCursor3, c.TypeArgs , pair)); - tempCursor = tempRef_tempCursor3.argValue; - row = tempRef_row12.argValue; - tangible.RefObject tempRef_row13 = - new tangible.RefObject(row); + tempCursor = tempRef_tempCursor3.get(); + row = tempRef_row12.get(); + RefObject tempRef_row13 = + new RefObject(row); // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'out' keyword - // these cannot be converted using the 'OutObject' helper class unless the method is within the code // being modified: @@ -804,68 +807,68 @@ public final class TypedMapUnitTests { // being modified: ResultAssert.IsSuccess(c.TypeAs().Find(tempRef_row13, ref mapScope, ref tempCursor , out findScope)); - row = tempRef_row13.argValue; - tangible.RefObject tempRef_row14 = - new tangible.RefObject(row); - tangible.RefObject tempRef_findScope = - new tangible.RefObject(findScope); + row = tempRef_row13.get(); + RefObject tempRef_row14 = + new RefObject(row); + RefObject tempRef_findScope = + new RefObject(findScope); KeyValuePair foundPair; - tangible.OutObject> tempOut_foundPair = - new tangible.OutObject>(); + OutObject> tempOut_foundPair = + new OutObject>(); ResultAssert.IsSuccess(TypedMapUnitTests.ReadKeyValue(tempRef_row14, tempRef_findScope, c.TypeArgs, tempOut_foundPair)); - foundPair = tempOut_foundPair.argValue; - findScope = tempRef_findScope.argValue; - row = tempRef_row14.argValue; + foundPair = tempOut_foundPair.get(); + findScope = tempRef_findScope.get(); + row = tempRef_row14.get(); assert key == foundPair.Key; assert updatePair.Value == foundPair.Value; // Insert it again with upsert. updatePair = new KeyValuePair(key, "upsert value"); - tangible.RefObject tempRef_row15 = - new tangible.RefObject(row); + RefObject tempRef_row15 = + new RefObject(row); // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'out' keyword - // these cannot be converted using the 'OutObject' helper class unless the method is within the code // being modified: root.Clone(out tempCursor).Find(tempRef_row15, Utf8String.Empty); - row = tempRef_row15.argValue; - tangible.RefObject tempRef_row16 = - new tangible.RefObject(row); - tangible.RefObject tempRef_tempCursor4 = - new tangible.RefObject(tempCursor); + row = tempRef_row15.get(); + RefObject tempRef_row16 = + new RefObject(row); + RefObject tempRef_tempCursor4 = + new RefObject(tempCursor); ResultAssert.IsSuccess(TypedMapUnitTests.WriteKeyValue(tempRef_row16, tempRef_tempCursor4, c.TypeArgs , updatePair)); - tempCursor = tempRef_tempCursor4.argValue; - row = tempRef_row16.argValue; + tempCursor = tempRef_tempCursor4.get(); + row = tempRef_row16.get(); // ReSharper disable once RedundantArgumentDefaultValue - tangible.RefObject tempRef_row17 = - new tangible.RefObject(row); + RefObject tempRef_row17 = + new RefObject(row); // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'ref' keyword - // these cannot be converted using the 'RefObject' helper class unless the method is within the code // being modified: ResultAssert.IsSuccess(c.TypeAs().MoveField(tempRef_row17, ref mapScope, ref tempCursor, UpdateOptions.Upsert)); - row = tempRef_row17.argValue; + row = tempRef_row17.get(); // Verify that the value was upserted. - tangible.RefObject tempRef_row18 = - new tangible.RefObject(row); + RefObject tempRef_row18 = + new RefObject(row); // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'out' keyword - // these cannot be converted using the 'OutObject' helper class unless the method is within the code // being modified: root.Clone(out tempCursor).Find(tempRef_row18, Utf8String.Empty); - row = tempRef_row18.argValue; - tangible.RefObject tempRef_row19 = - new tangible.RefObject(row); - tangible.RefObject tempRef_tempCursor5 = - new tangible.RefObject(tempCursor); + row = tempRef_row18.get(); + RefObject tempRef_row19 = + new RefObject(row); + RefObject tempRef_tempCursor5 = + new RefObject(tempCursor); ResultAssert.IsSuccess(TypedMapUnitTests.WriteKeyValue(tempRef_row19, tempRef_tempCursor5, c.TypeArgs , pair)); - tempCursor = tempRef_tempCursor5.argValue; - row = tempRef_row19.argValue; - tangible.RefObject tempRef_row20 = - new tangible.RefObject(row); + tempCursor = tempRef_tempCursor5.get(); + row = tempRef_row19.get(); + RefObject tempRef_row20 = + new RefObject(row); // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'out' keyword - // these cannot be converted using the 'OutObject' helper class unless the method is within the code // being modified: @@ -874,136 +877,136 @@ public final class TypedMapUnitTests { // being modified: ResultAssert.IsSuccess(c.TypeAs().Find(tempRef_row20, ref mapScope, ref tempCursor , out findScope)); - row = tempRef_row20.argValue; - tangible.RefObject tempRef_row21 = - new tangible.RefObject(row); - tangible.RefObject tempRef_findScope2 = - new tangible.RefObject(findScope); - tangible.OutObject> tempOut_foundPair2 = - new tangible.OutObject>(); + row = tempRef_row20.get(); + RefObject tempRef_row21 = + new RefObject(row); + RefObject tempRef_findScope2 = + new RefObject(findScope); + OutObject> tempOut_foundPair2 = + new OutObject>(); ResultAssert.IsSuccess(TypedMapUnitTests.ReadKeyValue(tempRef_row21, tempRef_findScope2, c.TypeArgs, tempOut_foundPair2)); - foundPair = tempOut_foundPair2.argValue; - findScope = tempRef_findScope2.argValue; - row = tempRef_row21.argValue; + foundPair = tempOut_foundPair2.get(); + findScope = tempRef_findScope2.get(); + row = tempRef_row21.get(); assert key == foundPair.Key; assert updatePair.Value == foundPair.Value; // Insert it again with insert (fail: exists). updatePair = new KeyValuePair(key, "insert value"); - tangible.RefObject tempRef_row22 = - new tangible.RefObject(row); + RefObject tempRef_row22 = + new RefObject(row); // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'out' keyword - // these cannot be converted using the 'OutObject' helper class unless the method is within the code // being modified: root.Clone(out tempCursor).Find(tempRef_row22, Utf8String.Empty); - row = tempRef_row22.argValue; - tangible.RefObject tempRef_row23 = - new tangible.RefObject(row); - tangible.RefObject tempRef_tempCursor6 = - new tangible.RefObject(tempCursor); + row = tempRef_row22.get(); + RefObject tempRef_row23 = + new RefObject(row); + RefObject tempRef_tempCursor6 = + new RefObject(tempCursor); ResultAssert.IsSuccess(TypedMapUnitTests.WriteKeyValue(tempRef_row23, tempRef_tempCursor6, c.TypeArgs , updatePair)); - tempCursor = tempRef_tempCursor6.argValue; - row = tempRef_row23.argValue; - tangible.RefObject tempRef_row24 = - new tangible.RefObject(row); + tempCursor = tempRef_tempCursor6.get(); + row = tempRef_row23.get(); + RefObject tempRef_row24 = + new RefObject(row); // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'ref' keyword - // these cannot be converted using the 'RefObject' helper class unless the method is within the code // being modified: ResultAssert.Exists(c.TypeAs().MoveField(tempRef_row24, ref mapScope, ref tempCursor, UpdateOptions.Insert)); - row = tempRef_row24.argValue; + row = tempRef_row24.get(); // Insert it again with insert at (fail: disallowed). updatePair = new KeyValuePair(key, "insertAt value"); - tangible.RefObject tempRef_row25 = - new tangible.RefObject(row); + RefObject tempRef_row25 = + new RefObject(row); // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'out' keyword - // these cannot be converted using the 'OutObject' helper class unless the method is within the code // being modified: root.Clone(out tempCursor).Find(tempRef_row25, Utf8String.Empty); - row = tempRef_row25.argValue; - tangible.RefObject tempRef_row26 = - new tangible.RefObject(row); - tangible.RefObject tempRef_tempCursor7 = - new tangible.RefObject(tempCursor); + row = tempRef_row25.get(); + RefObject tempRef_row26 = + new RefObject(row); + RefObject tempRef_tempCursor7 = + new RefObject(tempCursor); ResultAssert.IsSuccess(TypedMapUnitTests.WriteKeyValue(tempRef_row26, tempRef_tempCursor7, c.TypeArgs , updatePair)); - tempCursor = tempRef_tempCursor7.argValue; - row = tempRef_row26.argValue; - tangible.RefObject tempRef_row27 = - new tangible.RefObject(row); + tempCursor = tempRef_tempCursor7.get(); + row = tempRef_row26.get(); + RefObject tempRef_row27 = + new RefObject(row); // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'ref' keyword - // these cannot be converted using the 'RefObject' helper class unless the method is within the code // being modified: ResultAssert.TypeConstraint(c.TypeAs().MoveField(tempRef_row27, ref mapScope, ref tempCursor, UpdateOptions.InsertAt)); - row = tempRef_row27.argValue; + row = tempRef_row27.get(); } } } - private static Earnings ReadEarnings(tangible.RefObject row, tangible.RefObject udtScope) { - Layout udt = udtScope.argValue.getLayout(); + private static Earnings ReadEarnings(RefObject row, RefObject udtScope) { + Layout udt = udtScope.get().getLayout(); Earnings m = new Earnings(); LayoutColumn c; // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'out' keyword - these cannot be converted using the 'OutObject' helper class unless the method is within the code being modified: assert udt.TryFind("domestic", out c); - tangible.OutObject tempOut_Domestic = new tangible.OutObject(); + OutObject tempOut_Domestic = new OutObject(); ResultAssert.IsSuccess(c.TypeAs().ReadFixed(row, udtScope, c, tempOut_Domestic)); - m.Domestic = tempOut_Domestic.argValue; + m.Domestic = tempOut_Domestic.get(); // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'out' keyword - these cannot be converted using the 'OutObject' helper class unless the method is within the code being modified: assert udt.TryFind("worldwide", out c); - tangible.OutObject tempOut_Worldwide = new tangible.OutObject(); + OutObject tempOut_Worldwide = new OutObject(); ResultAssert.IsSuccess(c.TypeAs().ReadFixed(row, udtScope, c, tempOut_Worldwide)); - m.Worldwide = tempOut_Worldwide.argValue; + m.Worldwide = tempOut_Worldwide.get(); return m; } - private static Result ReadKeyValue(tangible.RefObject row, - tangible.RefObject scope, TypeArgumentList typeArgs, - tangible.OutObject> pair) { - pair.argValue = null; + private static Result ReadKeyValue(RefObject row, + RefObject scope, TypeArgumentList typeArgs, + OutObject> pair) { + pair.set(null); LayoutIndexedScope tupleLayout = LayoutType.TypedTuple; RowCursor tupleScope; - tangible.OutObject tempOut_tupleScope = - new tangible.OutObject(); + OutObject tempOut_tupleScope = + new OutObject(); Result r = tupleLayout.ReadScope(row, scope, tempOut_tupleScope); - tupleScope = tempOut_tupleScope.argValue; + tupleScope = tempOut_tupleScope.get(); if (r != Result.Success) { return r; } tupleScope.MoveNext(row); - tangible.RefObject tempRef_tupleScope = - new tangible.RefObject(tupleScope); + RefObject tempRef_tupleScope = + new RefObject(tupleScope); TKey key; - tangible.OutObject tempOut_key = new tangible.OutObject(); + OutObject tempOut_key = new OutObject(); r = typeArgs.get(0).getType().>TypeAs().ReadSparse(row, tempRef_tupleScope, tempOut_key); - key = tempOut_key.argValue; - tupleScope = tempRef_tupleScope.argValue; + key = tempOut_key.get(); + tupleScope = tempRef_tupleScope.get(); if (r != Result.Success) { return r; } tupleScope.MoveNext(row); - tangible.RefObject tempRef_tupleScope2 = - new tangible.RefObject(tupleScope); + RefObject tempRef_tupleScope2 = + new RefObject(tupleScope); TValue value; - tangible.OutObject tempOut_value = new tangible.OutObject(); + OutObject tempOut_value = new OutObject(); r = typeArgs.get(1).getType().>TypeAs().ReadSparse(row, tempRef_tupleScope2, tempOut_value); - value = tempOut_value.argValue; - tupleScope = tempRef_tupleScope2.argValue; + value = tempOut_value.get(); + tupleScope = tempRef_tupleScope2.get(); if (r != Result.Success) { return r; } - pair.argValue = new KeyValuePair(key, value); + pair.set(new KeyValuePair(key, value)); return Result.Success; } - private Movie ReadMovie(tangible.RefObject row, tangible.RefObject root) { + private Movie ReadMovie(RefObject row, RefObject root) { Movie value = new Movie(); LayoutColumn c; @@ -1013,7 +1016,7 @@ public final class TypedMapUnitTests { RowCursor castScope; // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'out' keyword - these // cannot be converted using the 'OutObject' helper class unless the method is within the code being modified: - root.argValue.Clone(out castScope).Find(row, c.Path); + root.get().Clone(out castScope).Find(row, c.Path); // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'out' keyword - these // cannot be converted using the 'OutObject' 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 @@ -1021,15 +1024,15 @@ public final class TypedMapUnitTests { if (c.TypeAs().ReadScope(row, ref castScope, out castScope) == Result.Success) { value.Cast = new HashMap(); while (castScope.MoveNext(row)) { - tangible.RefObject tempRef_castScope = - new tangible.RefObject(castScope); + RefObject tempRef_castScope = + new RefObject(castScope); KeyValuePair item; - tangible.OutObject> tempOut_item = - new tangible.OutObject>(); + OutObject> tempOut_item = + new OutObject>(); ResultAssert.IsSuccess(TypedMapUnitTests.ReadKeyValue(row, tempRef_castScope, c.TypeArgs, tempOut_item)); - item = tempOut_item.argValue; - castScope = tempRef_castScope.argValue; + item = tempOut_item.get(); + castScope = tempRef_castScope.get(); value.Cast.put(item.Key, item.Value); } } @@ -1040,7 +1043,7 @@ public final class TypedMapUnitTests { RowCursor statsScope; // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'out' keyword - these // cannot be converted using the 'OutObject' helper class unless the method is within the code being modified: - root.argValue.Clone(out statsScope).Find(row, c.Path); + root.get().Clone(out statsScope).Find(row, c.Path); // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'out' keyword - these // cannot be converted using the 'OutObject' 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 @@ -1048,15 +1051,15 @@ public final class TypedMapUnitTests { if (c.TypeAs().ReadScope(row, ref statsScope, out statsScope) == Result.Success) { value.Stats = new HashMap(); while (statsScope.MoveNext(row)) { - tangible.RefObject tempRef_statsScope = - new tangible.RefObject(statsScope); + RefObject tempRef_statsScope = + new RefObject(statsScope); KeyValuePair item; - tangible.OutObject> tempOut_item2 = - new tangible.OutObject>(); + OutObject> tempOut_item2 = + new OutObject>(); ResultAssert.IsSuccess(TypedMapUnitTests.ReadKeyValue(row, tempRef_statsScope, c.TypeArgs, tempOut_item2)); - item = tempOut_item2.argValue; - statsScope = tempRef_statsScope.argValue; + item = tempOut_item2.get(); + statsScope = tempRef_statsScope.get(); value.Stats.put(item.Key, item.Value); } } @@ -1067,7 +1070,7 @@ public final class TypedMapUnitTests { RowCursor relatedScope; // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'out' keyword - these // cannot be converted using the 'OutObject' helper class unless the method is within the code being modified: - root.argValue.Clone(out relatedScope).Find(row, c.Path); + root.get().Clone(out relatedScope).Find(row, c.Path); // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'out' keyword - these // cannot be converted using the 'OutObject' 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 @@ -1080,14 +1083,14 @@ public final class TypedMapUnitTests { LayoutUniqueScope valueLayout = valueType.getType().TypeAs(); while (relatedScope.MoveNext(row)) { LayoutIndexedScope tupleLayout = LayoutType.TypedTuple; - tangible.RefObject tempRef_relatedScope = - new tangible.RefObject(relatedScope); + RefObject tempRef_relatedScope = + new RefObject(relatedScope); RowCursor tupleScope; - tangible.OutObject tempOut_tupleScope = - new tangible.OutObject(); + OutObject tempOut_tupleScope = + new OutObject(); ResultAssert.IsSuccess(tupleLayout.ReadScope(row, tempRef_relatedScope, tempOut_tupleScope)); - tupleScope = tempOut_tupleScope.argValue; - relatedScope = tempRef_relatedScope.argValue; + tupleScope = tempOut_tupleScope.get(); + relatedScope = tempRef_relatedScope.get(); assert tupleScope.MoveNext(row); String itemKey; // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'out' keyword - @@ -1098,24 +1101,24 @@ public final class TypedMapUnitTests { // being modified: ResultAssert.IsSuccess(keyLayout.ReadSparse(row, ref tupleScope, out itemKey)); assert tupleScope.MoveNext(row); - tangible.RefObject tempRef_tupleScope = - new tangible.RefObject(tupleScope); + RefObject tempRef_tupleScope = + new RefObject(tupleScope); RowCursor itemValueScope; - tangible.OutObject tempOut_itemValueScope = - new tangible.OutObject(); + OutObject tempOut_itemValueScope = + new OutObject(); ResultAssert.IsSuccess(valueLayout.ReadScope(row, tempRef_tupleScope, tempOut_itemValueScope)); - itemValueScope = tempOut_itemValueScope.argValue; - tupleScope = tempRef_tupleScope.argValue; + itemValueScope = tempOut_itemValueScope.get(); + tupleScope = tempRef_tupleScope.get(); HashMap itemValue = new HashMap(); while (itemValueScope.MoveNext(row)) { - tangible.RefObject tempRef_itemValueScope = new tangible.RefObject(itemValueScope); + RefObject tempRef_itemValueScope = new RefObject(itemValueScope); KeyValuePair innerItem; - tangible.OutObject> tempOut_innerItem = - new tangible.OutObject>(); + OutObject> tempOut_innerItem = + new OutObject>(); ResultAssert.IsSuccess(TypedMapUnitTests.ReadKeyValue(row, tempRef_itemValueScope, valueType.getTypeArgs().clone(), tempOut_innerItem)); - innerItem = tempOut_innerItem.argValue; - itemValueScope = tempRef_itemValueScope.argValue; + innerItem = tempOut_innerItem.get(); + itemValueScope = tempRef_itemValueScope.get(); itemValue.put(innerItem.Key, innerItem.Value); } @@ -1129,7 +1132,7 @@ public final class TypedMapUnitTests { RowCursor revenueScope; // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'out' keyword - these // cannot be converted using the 'OutObject' helper class unless the method is within the code being modified: - root.argValue.Clone(out revenueScope).Find(row, c.Path); + root.get().Clone(out revenueScope).Find(row, c.Path); // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'out' keyword - these // cannot be converted using the 'OutObject' 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 @@ -1142,31 +1145,31 @@ public final class TypedMapUnitTests { LayoutUDT valueLayout = valueType.getType().TypeAs(); while (revenueScope.MoveNext(row)) { LayoutIndexedScope tupleLayout = LayoutType.TypedTuple; - tangible.RefObject tempRef_revenueScope = - new tangible.RefObject(revenueScope); + RefObject tempRef_revenueScope = + new RefObject(revenueScope); RowCursor tupleScope; - tangible.OutObject tempOut_tupleScope2 = - new tangible.OutObject(); + OutObject tempOut_tupleScope2 = + new OutObject(); ResultAssert.IsSuccess(tupleLayout.ReadScope(row, tempRef_revenueScope, tempOut_tupleScope2)); - tupleScope = tempOut_tupleScope2.argValue; - revenueScope = tempRef_revenueScope.argValue; + tupleScope = tempOut_tupleScope2.get(); + revenueScope = tempRef_revenueScope.get(); assert tupleScope.MoveNext(row); - tangible.RefObject tempRef_tupleScope2 = new tangible.RefObject(tupleScope); + RefObject tempRef_tupleScope2 = new RefObject(tupleScope); java.time.LocalDateTime itemKey; - tangible.OutObject tempOut_itemKey = new tangible.OutObject(); + OutObject tempOut_itemKey = new OutObject(); ResultAssert.IsSuccess(keyLayout.ReadSparse(row, tempRef_tupleScope2, tempOut_itemKey)); - itemKey = tempOut_itemKey.argValue; - tupleScope = tempRef_tupleScope2.argValue; + itemKey = tempOut_itemKey.get(); + tupleScope = tempRef_tupleScope2.get(); assert tupleScope.MoveNext(row); - tangible.RefObject tempRef_tupleScope3 = new tangible.RefObject(tupleScope); + RefObject tempRef_tupleScope3 = new RefObject(tupleScope); RowCursor itemValueScope; - tangible.OutObject tempOut_itemValueScope2 = new tangible.OutObject(); + OutObject tempOut_itemValueScope2 = new OutObject(); ResultAssert.IsSuccess(valueLayout.ReadScope(row, tempRef_tupleScope3, tempOut_itemValueScope2)); - itemValueScope = tempOut_itemValueScope2.argValue; - tupleScope = tempRef_tupleScope3.argValue; - tangible.RefObject tempRef_itemValueScope2 = new tangible.RefObject(itemValueScope); + itemValueScope = tempOut_itemValueScope2.get(); + tupleScope = tempRef_tupleScope3.get(); + RefObject tempRef_itemValueScope2 = new RefObject(itemValueScope); Earnings itemValue = TypedMapUnitTests.ReadEarnings(row, tempRef_itemValueScope2); - itemValueScope = tempRef_itemValueScope2.argValue; + itemValueScope = tempRef_itemValueScope2.get(); value.Revenue.put(itemKey, itemValue); } @@ -1175,8 +1178,8 @@ public final class TypedMapUnitTests { return value; } - private static void WriteEarnings(tangible.RefObject row, tangible.RefObject udtScope, TypeArgumentList typeArgs, Earnings m) { - Layout udt = row.argValue.getResolver().Resolve(typeArgs.getSchemaId().clone()); + private static void WriteEarnings(RefObject row, RefObject udtScope, TypeArgumentList typeArgs, Earnings m) { + Layout udt = row.get().getResolver().Resolve(typeArgs.getSchemaId().clone()); LayoutColumn c; // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'out' keyword - these cannot be converted using the 'OutObject' helper class unless the method is within the code being modified: assert udt.TryFind("domestic", out c); @@ -1186,8 +1189,8 @@ public final class TypedMapUnitTests { ResultAssert.IsSuccess(c.TypeAs().WriteFixed(row, udtScope, c, m.Worldwide)); } - private static Result WriteKeyValue(tangible.RefObject row, - tangible.RefObject scope, TypeArgumentList typeArgs, KeyValuePair pair) { + private static Result WriteKeyValue(RefObject row, + RefObject scope, TypeArgumentList typeArgs, KeyValuePair pair) { LayoutIndexedScope tupleLayout = LayoutType.TypedTuple; RowCursor tupleScope; // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'out' keyword - these @@ -1197,35 +1200,35 @@ public final class TypedMapUnitTests { return r; } - tangible.RefObject tempRef_tupleScope = - new tangible.RefObject(tupleScope); + RefObject tempRef_tupleScope = + new RefObject(tupleScope); r = typeArgs.get(0).getType().>TypeAs().WriteSparse(row, tempRef_tupleScope, pair.Key); - tupleScope = tempRef_tupleScope.argValue; + tupleScope = tempRef_tupleScope.get(); if (r != Result.Success) { return r; } tupleScope.MoveNext(row); - tangible.RefObject tempRef_tupleScope2 = - new tangible.RefObject(tupleScope); + RefObject tempRef_tupleScope2 = + new RefObject(tupleScope); r = typeArgs.get(1).getType().>TypeAs().WriteSparse(row, tempRef_tupleScope2, pair.Value); - tupleScope = tempRef_tupleScope2.argValue; + tupleScope = tempRef_tupleScope2.get(); return r; } - private void WriteMovie(tangible.RefObject row, tangible.RefObject root, Movie value) { + private void WriteMovie(RefObject row, RefObject root, Movie value) { LayoutColumn c; if (value.Cast != null) { - tangible.OutObject tempOut_c = - new tangible.OutObject(); + OutObject tempOut_c = + new OutObject(); assert this.layout.TryFind("cast", tempOut_c); - c = tempOut_c.argValue; + c = tempOut_c.get(); RowCursor castScope; // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'out' keyword - these // cannot be converted using the 'OutObject' helper class unless the method is within the code being // modified: - root.argValue.Clone(out castScope).Find(row, c.getPath()); + root.get().Clone(out castScope).Find(row, c.getPath()); // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'out' keyword - these // cannot be converted using the 'OutObject' helper class unless the method is within the code being // modified: @@ -1239,33 +1242,33 @@ public final class TypedMapUnitTests { // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'out' keyword - // these cannot be converted using the 'OutObject' helper class unless the method is within the code // being modified: - root.argValue.Clone(out tempCursor).Find(row, Utf8String.Empty); - tangible.RefObject tempRef_tempCursor = - new tangible.RefObject(tempCursor); + root.get().Clone(out tempCursor).Find(row, Utf8String.Empty); + RefObject tempRef_tempCursor = + new RefObject(tempCursor); ResultAssert.IsSuccess(TypedMapUnitTests.WriteKeyValue(row, tempRef_tempCursor, c.getTypeArgs().clone(), item)); - tempCursor = tempRef_tempCursor.argValue; - tangible.RefObject tempRef_castScope = - new tangible.RefObject(castScope); - tangible.RefObject tempRef_tempCursor2 = - new tangible.RefObject(tempCursor); + tempCursor = tempRef_tempCursor.get(); + RefObject tempRef_castScope = + new RefObject(castScope); + RefObject tempRef_tempCursor2 = + new RefObject(tempCursor); ResultAssert.IsSuccess(c.TypeAs().MoveField(row, tempRef_castScope, tempRef_tempCursor2)); - tempCursor = tempRef_tempCursor2.argValue; - castScope = tempRef_castScope.argValue; + tempCursor = tempRef_tempCursor2.get(); + castScope = tempRef_castScope.get(); } } if (value.Stats != null) { - tangible.OutObject tempOut_c2 = - new tangible.OutObject(); + OutObject tempOut_c2 = + new OutObject(); assert this.layout.TryFind("stats", tempOut_c2); - c = tempOut_c2.argValue; + c = tempOut_c2.get(); RowCursor statsScope; // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'out' keyword - these // cannot be converted using the 'OutObject' helper class unless the method is within the code being // modified: - root.argValue.Clone(out statsScope).Find(row, c.getPath()); + root.get().Clone(out statsScope).Find(row, c.getPath()); // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'out' keyword - these // cannot be converted using the 'OutObject' helper class unless the method is within the code being // modified: @@ -1279,33 +1282,33 @@ public final class TypedMapUnitTests { // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'out' keyword - // these cannot be converted using the 'OutObject' helper class unless the method is within the code // being modified: - root.argValue.Clone(out tempCursor).Find(row, Utf8String.Empty); - tangible.RefObject tempRef_tempCursor3 = - new tangible.RefObject(tempCursor); + root.get().Clone(out tempCursor).Find(row, Utf8String.Empty); + RefObject tempRef_tempCursor3 = + new RefObject(tempCursor); ResultAssert.IsSuccess(TypedMapUnitTests.WriteKeyValue(row, tempRef_tempCursor3, c.getTypeArgs().clone(), item)); - tempCursor = tempRef_tempCursor3.argValue; - tangible.RefObject tempRef_statsScope = - new tangible.RefObject(statsScope); - tangible.RefObject tempRef_tempCursor4 = - new tangible.RefObject(tempCursor); + tempCursor = tempRef_tempCursor3.get(); + RefObject tempRef_statsScope = + new RefObject(statsScope); + RefObject tempRef_tempCursor4 = + new RefObject(tempCursor); ResultAssert.IsSuccess(c.TypeAs().MoveField(row, tempRef_statsScope, tempRef_tempCursor4)); - tempCursor = tempRef_tempCursor4.argValue; - statsScope = tempRef_statsScope.argValue; + tempCursor = tempRef_tempCursor4.get(); + statsScope = tempRef_statsScope.get(); } } if (value.Related != null) { - tangible.OutObject tempOut_c3 = - new tangible.OutObject(); + OutObject tempOut_c3 = + new OutObject(); assert this.layout.TryFind("related", tempOut_c3); - c = tempOut_c3.argValue; + c = tempOut_c3.get(); RowCursor relatedScoped; // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'out' keyword - these // cannot be converted using the 'OutObject' helper class unless the method is within the code being // modified: - root.argValue.Clone(out relatedScoped).Find(row, c.getPath()); + root.get().Clone(out relatedScoped).Find(row, c.getPath()); // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'out' keyword - these // cannot be converted using the 'OutObject' helper class unless the method is within the code being // modified: @@ -1322,7 +1325,7 @@ public final class TypedMapUnitTests { // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'out' keyword - // these cannot be converted using the 'OutObject' helper class unless the method is within the code // being modified: - root.argValue.Clone(out tempCursor1).Find(row, "related.0"); + root.get().Clone(out tempCursor1).Find(row, "related.0"); RowCursor tupleScope; // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'out' keyword - // these cannot be converted using the 'OutObject' helper class unless the method is within the code @@ -1354,41 +1357,41 @@ public final class TypedMapUnitTests { // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'out' keyword // - these cannot be converted using the 'OutObject' helper class unless the method is within the // code being modified: - root.argValue.Clone(out tempCursor2).Find(row, "related.0.0"); - tangible.RefObject tempRef_tempCursor2 - = new tangible.RefObject(tempCursor2); + root.get().Clone(out tempCursor2).Find(row, "related.0.0"); + RefObject tempRef_tempCursor2 + = new RefObject(tempCursor2); ResultAssert.IsSuccess(TypedMapUnitTests.WriteKeyValue(row, tempRef_tempCursor2, valueType.getTypeArgs().clone(), innerItem)); - tempCursor2 = tempRef_tempCursor2.argValue; - tangible.RefObject tempRef_innerScope = - new tangible.RefObject(innerScope); - tangible.RefObject tempRef_tempCursor22 = new tangible.RefObject(tempCursor2); + tempCursor2 = tempRef_tempCursor2.get(); + RefObject tempRef_innerScope = + new RefObject(innerScope); + RefObject tempRef_tempCursor22 = new RefObject(tempCursor2); ResultAssert.IsSuccess(valueLayout.MoveField(row, tempRef_innerScope, tempRef_tempCursor22)); - tempCursor2 = tempRef_tempCursor22.argValue; - innerScope = tempRef_innerScope.argValue; + tempCursor2 = tempRef_tempCursor22.get(); + innerScope = tempRef_innerScope.get(); } - tangible.RefObject tempRef_relatedScoped = - new tangible.RefObject(relatedScoped); - tangible.RefObject tempRef_tempCursor1 = - new tangible.RefObject(tempCursor1); + RefObject tempRef_relatedScoped = + new RefObject(relatedScoped); + RefObject tempRef_tempCursor1 = + new RefObject(tempCursor1); ResultAssert.IsSuccess(c.TypeAs().MoveField(row, tempRef_relatedScoped, tempRef_tempCursor1)); - tempCursor1 = tempRef_tempCursor1.argValue; - relatedScoped = tempRef_relatedScoped.argValue; + tempCursor1 = tempRef_tempCursor1.get(); + relatedScoped = tempRef_relatedScoped.get(); } } if (value.Revenue != null) { - tangible.OutObject tempOut_c4 = - new tangible.OutObject(); + OutObject tempOut_c4 = + new OutObject(); assert this.layout.TryFind("revenue", tempOut_c4); - c = tempOut_c4.argValue; + c = tempOut_c4.get(); RowCursor revenueScope; // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'out' keyword - these // cannot be converted using the 'OutObject' helper class unless the method is within the code being // modified: - root.argValue.Clone(out revenueScope).Find(row, c.getPath()); + root.get().Clone(out revenueScope).Find(row, c.getPath()); // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'out' keyword - these // cannot be converted using the 'OutObject' helper class unless the method is within the code being // modified: @@ -1405,7 +1408,7 @@ public final class TypedMapUnitTests { // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'out' keyword - // these cannot be converted using the 'OutObject' helper class unless the method is within the code // being modified: - root.argValue.Clone(out tempCursor1).Find(row, "revenue.0"); + root.get().Clone(out tempCursor1).Find(row, "revenue.0"); RowCursor tupleScope; // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'out' keyword - // these cannot be converted using the 'OutObject' helper class unless the method is within the code @@ -1415,36 +1418,36 @@ public final class TypedMapUnitTests { // being modified: ResultAssert.IsSuccess(tupleLayout.WriteScope(row, ref tempCursor1, c.getTypeArgs().clone(), out tupleScope)); - tangible.RefObject tempRef_tupleScope = - new tangible.RefObject(tupleScope); + RefObject tempRef_tupleScope = + new RefObject(tupleScope); ResultAssert.IsSuccess(c.getTypeArgs().get(0).getType().TypeAs().WriteSparse(row, tempRef_tupleScope, item.Key)); - tupleScope = tempRef_tupleScope.argValue; + tupleScope = tempRef_tupleScope.get(); assert tupleScope.MoveNext(row); TypeArgument valueType = c.getTypeArgs().get(1).clone(); LayoutUDT valueLayout = valueType.getType().TypeAs(); - tangible.RefObject tempRef_tupleScope2 = - new tangible.RefObject(tupleScope); + RefObject tempRef_tupleScope2 = + new RefObject(tupleScope); RowCursor itemScope; - tangible.OutObject tempOut_itemScope = - new tangible.OutObject(); + OutObject tempOut_itemScope = + new OutObject(); ResultAssert.IsSuccess(valueLayout.WriteScope(row, tempRef_tupleScope2, valueType.getTypeArgs().clone(), tempOut_itemScope)); - itemScope = tempOut_itemScope.argValue; - tupleScope = tempRef_tupleScope2.argValue; - tangible.RefObject tempRef_itemScope = - new tangible.RefObject(itemScope); + itemScope = tempOut_itemScope.get(); + tupleScope = tempRef_tupleScope2.get(); + RefObject tempRef_itemScope = + new RefObject(itemScope); TypedMapUnitTests.WriteEarnings(row, tempRef_itemScope, valueType.getTypeArgs().clone(), item.Value); - itemScope = tempRef_itemScope.argValue; + itemScope = tempRef_itemScope.get(); - tangible.RefObject tempRef_revenueScope = - new tangible.RefObject(revenueScope); - tangible.RefObject tempRef_tempCursor12 = - new tangible.RefObject(tempCursor1); + RefObject tempRef_revenueScope = + new RefObject(revenueScope); + RefObject tempRef_tempCursor12 = + new RefObject(tempCursor1); ResultAssert.IsSuccess(c.TypeAs().MoveField(row, tempRef_revenueScope, tempRef_tempCursor12)); - tempCursor1 = tempRef_tempCursor12.argValue; - revenueScope = tempRef_revenueScope.argValue; + tempCursor1 = tempRef_tempCursor12.get(); + revenueScope = tempRef_revenueScope.get(); } } } diff --git a/jre/src/test/java/azure/data/cosmos/serialization/hybridrow/unit/TypedSetUnitTests.java b/jre/src/test/java/com/azure/data/cosmos/serialization/hybridrow/unit/TypedSetUnitTests.java similarity index 64% rename from jre/src/test/java/azure/data/cosmos/serialization/hybridrow/unit/TypedSetUnitTests.java rename to jre/src/test/java/com/azure/data/cosmos/serialization/hybridrow/unit/TypedSetUnitTests.java index 6faa64e..57eef83 100644 --- a/jre/src/test/java/azure/data/cosmos/serialization/hybridrow/unit/TypedSetUnitTests.java +++ b/jre/src/test/java/com/azure/data/cosmos/serialization/hybridrow/unit/TypedSetUnitTests.java @@ -2,12 +2,15 @@ // Copyright (c) Microsoft Corporation. All rights reserved. //------------------------------------------------------------ -package azure.data.cosmos.serialization.hybridrow.unit; +package com.azure.data.cosmos.serialization.hybridrow.unit; -import azure.data.cosmos.serialization.hybridrow.HybridRowVersion; -import azure.data.cosmos.serialization.hybridrow.Result; -import azure.data.cosmos.serialization.hybridrow.RowBuffer; -import azure.data.cosmos.serialization.hybridrow.RowCursor; +import com.azure.data.cosmos.core.OutObject; +import com.azure.data.cosmos.core.RefObject; +import com.azure.data.cosmos.serialization.hybridrow.HybridRowVersion; +import com.azure.data.cosmos.serialization.hybridrow.Result; +import com.azure.data.cosmos.serialization.hybridrow.RowBuffer; +import com.azure.data.cosmos.serialization.hybridrow.RowCursor; +import com.azure.data.cosmos.serialization.hybridrow.layouts.LayoutColumn; import java.nio.file.Files; import java.util.ArrayList; @@ -56,26 +59,26 @@ public final class TypedSetUnitTests { t1.Work = new ArrayList>(Arrays.asList(Tuple.Create(false, 10000), Tuple.Create(true, 49053), Tuple.Create(false, 53111))); - tangible.RefObject tempRef_row = - new tangible.RefObject(row); - tangible.RefObject tempRef_row2 = - new tangible.RefObject(row); + RefObject tempRef_row = + new RefObject(row); + RefObject tempRef_row2 = + new RefObject(row); RowCursor _; // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'out' keyword - these // cannot be converted using the 'OutObject' helper class unless the method is within the code being modified: this.WriteTodo(tempRef_row, RowCursor.Create(tempRef_row2, out _), t1); - row = tempRef_row2.argValue; - row = tempRef_row.argValue; - tangible.RefObject tempRef_row3 = - new tangible.RefObject(row); - tangible.RefObject tempRef_row4 = - new tangible.RefObject(row); + row = tempRef_row2.get(); + row = tempRef_row.get(); + RefObject tempRef_row3 = + new RefObject(row); + RefObject tempRef_row4 = + new RefObject(row); RowCursor _; // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'out' keyword - these // cannot be converted using the 'OutObject' helper class unless the method is within the code being modified: Todo t2 = this.ReadTodo(tempRef_row3, RowCursor.Create(tempRef_row4, out _)); - row = tempRef_row4.argValue; - row = tempRef_row3.argValue; + row = tempRef_row4.get(); + row = tempRef_row3.get(); assert t1 == t2; } @@ -93,38 +96,38 @@ public final class TypedSetUnitTests { Todo t1 = new Todo(); t1.Projects = new ArrayList(permutation); - tangible.RefObject tempRef_row = - new tangible.RefObject(row); - tangible.RefObject tempRef_row2 = - new tangible.RefObject(row); + RefObject tempRef_row = + new RefObject(row); + RefObject tempRef_row2 = + new RefObject(row); RowCursor _; // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'out' keyword - these // cannot be converted using the 'OutObject' helper class unless the method is within the code being // modified: this.WriteTodo(tempRef_row, RowCursor.Create(tempRef_row2, out _), t1); - row = tempRef_row2.argValue; - row = tempRef_row.argValue; + row = tempRef_row2.get(); + row = tempRef_row.get(); // Attempt to update each item in turn and then update it with itself. - tangible.RefObject tempRef_row3 = - new tangible.RefObject(row); + RefObject tempRef_row3 = + new RefObject(row); RowCursor root = RowCursor.Create(tempRef_row3); - row = tempRef_row3.argValue; + row = tempRef_row3.get(); LayoutColumn c; // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'out' keyword - these // cannot be converted using the 'OutObject' helper class unless the method is within the code being // modified: assert this.layout.TryFind("projects", out c); - tangible.RefObject tempRef_row4 = - new tangible.RefObject(row); + RefObject tempRef_row4 = + new RefObject(row); RowCursor setScope; // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'out' keyword - these // cannot be converted using the 'OutObject' helper class unless the method is within the code being // modified: root.Clone(out setScope).Find(tempRef_row4, c.Path); - row = tempRef_row4.argValue; - tangible.RefObject tempRef_row5 = - new tangible.RefObject(row); + row = tempRef_row4.get(); + RefObject tempRef_row5 = + new RefObject(row); // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'out' keyword - these // cannot be converted using the 'OutObject' helper class unless the method is within the code being // modified: @@ -132,26 +135,26 @@ public final class TypedSetUnitTests { // cannot be converted using the 'RefObject' helper class unless the method is within the code being // modified: ResultAssert.IsSuccess(c.TypeAs().ReadScope(tempRef_row5, ref setScope, out setScope)); - row = tempRef_row5.argValue; + row = tempRef_row5.get(); for (UUID p : t1.Projects) { - tangible.RefObject tempRef_row6 = - new tangible.RefObject(row); + RefObject tempRef_row6 = + new RefObject(row); RowCursor tempCursor; // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'out' keyword - // these cannot be converted using the 'OutObject' helper class unless the method is within the code // being modified: root.Clone(out tempCursor).Find(tempRef_row6, Utf8String.Empty); - row = tempRef_row6.argValue; - tangible.RefObject tempRef_row7 = - new tangible.RefObject(row); + row = tempRef_row6.get(); + RefObject tempRef_row7 = + new RefObject(row); // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'ref' keyword - // these cannot be converted using the 'RefObject' helper class unless the method is within the code // being modified: ResultAssert.IsSuccess(c.TypeArgs[0].Type.TypeAs().WriteSparse(tempRef_row7, ref tempCursor, p)); - row = tempRef_row7.argValue; - tangible.RefObject tempRef_row8 = - new tangible.RefObject(row); + row = tempRef_row7.get(); + RefObject tempRef_row8 = + new RefObject(row); RowCursor findScope; // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'out' keyword - // these cannot be converted using the 'OutObject' helper class unless the method is within the code @@ -161,15 +164,15 @@ public final class TypedSetUnitTests { // being modified: ResultAssert.IsSuccess(c.TypeAs().Find(tempRef_row8, ref setScope, ref tempCursor, out findScope)); - row = tempRef_row8.argValue; - tangible.RefObject tempRef_row9 = - new tangible.RefObject(row); + row = tempRef_row8.get(); + RefObject tempRef_row9 = + new RefObject(row); // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'ref' keyword - // these cannot be converted using the 'RefObject' helper class unless the method is within the code // being modified: ResultAssert.IsSuccess(c.TypeArgs[0].Type.TypeAs().DeleteSparse(tempRef_row9, ref findScope)); - row = tempRef_row9.argValue; + row = tempRef_row9.get(); } } @@ -186,60 +189,60 @@ public final class TypedSetUnitTests { t1.Prices = new ArrayList>(Arrays.asList(new ArrayList(Arrays.asList(1.2F, 3.0F)), new ArrayList(Arrays.asList(4.1F, 5.7F)), new ArrayList(Arrays.asList(7.3F, 8.12F, 9.14F)))); - tangible.RefObject tempRef_row = - new tangible.RefObject(row); - tangible.RefObject tempRef_row2 = - new tangible.RefObject(row); + RefObject tempRef_row = + new RefObject(row); + RefObject tempRef_row2 = + new RefObject(row); RowCursor _; // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'out' keyword - these // cannot be converted using the 'OutObject' helper class unless the method is within the code being modified: this.WriteTodo(tempRef_row, RowCursor.Create(tempRef_row2, out _), t1); - row = tempRef_row2.argValue; - row = tempRef_row.argValue; + row = tempRef_row2.get(); + row = tempRef_row.get(); // Attempt to find each item in turn. - tangible.RefObject tempRef_row3 = - new tangible.RefObject(row); + RefObject tempRef_row3 = + new RefObject(row); RowCursor root = RowCursor.Create(tempRef_row3); - row = tempRef_row3.argValue; + row = tempRef_row3.get(); LayoutColumn c; // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'out' keyword - these // cannot be converted using the 'OutObject' helper class unless the method is within the code being modified: assert this.layout.TryFind("attendees", out c); - tangible.RefObject tempRef_row4 = - new tangible.RefObject(row); + RefObject tempRef_row4 = + new RefObject(row); RowCursor setScope; // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'out' keyword - these // cannot be converted using the 'OutObject' helper class unless the method is within the code being modified: root.Clone(out setScope).Find(tempRef_row4, c.Path); - row = tempRef_row4.argValue; - tangible.RefObject tempRef_row5 = - new tangible.RefObject(row); + row = tempRef_row4.get(); + RefObject tempRef_row5 = + new RefObject(row); // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'out' keyword - these // cannot be converted using the 'OutObject' 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 // cannot be converted using the 'RefObject' helper class unless the method is within the code being modified: ResultAssert.IsSuccess(c.TypeAs().ReadScope(tempRef_row5, ref setScope, out setScope)); - row = tempRef_row5.argValue; + row = tempRef_row5.get(); for (int i = 0; i < t1.Attendees.size(); i++) { - tangible.RefObject tempRef_row6 = - new tangible.RefObject(row); + RefObject tempRef_row6 = + new RefObject(row); RowCursor tempCursor; // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'out' keyword - these // cannot be converted using the 'OutObject' helper class unless the method is within the code being // modified: root.Clone(out tempCursor).Find(tempRef_row6, Utf8String.Empty); - row = tempRef_row6.argValue; - tangible.RefObject tempRef_row7 = - new tangible.RefObject(row); + row = tempRef_row6.get(); + RefObject tempRef_row7 = + new RefObject(row); // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'ref' keyword - these // cannot be converted using the 'RefObject' helper class unless the method is within the code being // modified: ResultAssert.IsSuccess(c.TypeArgs[0].Type.TypeAs().WriteSparse(tempRef_row7, ref tempCursor, t1.Attendees.get(i))); - row = tempRef_row7.argValue; - tangible.RefObject tempRef_row8 = - new tangible.RefObject(row); + row = tempRef_row7.get(); + RefObject tempRef_row8 = + new RefObject(row); RowCursor findScope; // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'out' keyword - these // cannot be converted using the 'OutObject' helper class unless the method is within the code being @@ -249,41 +252,41 @@ public final class TypedSetUnitTests { // modified: ResultAssert.IsSuccess(c.TypeAs().Find(tempRef_row8, ref setScope, ref tempCursor, out findScope)); - row = tempRef_row8.argValue; + row = tempRef_row8.get(); Assert.AreEqual(i, findScope.Index, String.format("Failed to find t1.Attendees[%1$s]", i)); } // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'out' keyword - these // cannot be converted using the 'OutObject' helper class unless the method is within the code being modified: assert this.layout.TryFind("prices", out c); - tangible.RefObject tempRef_row9 = - new tangible.RefObject(row); + RefObject tempRef_row9 = + new RefObject(row); // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'out' keyword - these // cannot be converted using the 'OutObject' helper class unless the method is within the code being modified: root.Clone(out setScope).Find(tempRef_row9, c.Path); - row = tempRef_row9.argValue; - tangible.RefObject tempRef_row10 = - new tangible.RefObject(row); + row = tempRef_row9.get(); + RefObject tempRef_row10 = + new RefObject(row); // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'out' keyword - these // cannot be converted using the 'OutObject' 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 // cannot be converted using the 'RefObject' helper class unless the method is within the code being modified: ResultAssert.IsSuccess(c.TypeAs().ReadScope(tempRef_row10, ref setScope, out setScope)); - row = tempRef_row10.argValue; + row = tempRef_row10.get(); TypeArgument innerType = c.TypeArgs[0]; TypeArgument itemType = innerType.getTypeArgs().get(0).clone(); LayoutUniqueScope innerLayout = innerType.getType().TypeAs(); for (int i = 0; i < t1.Prices.size(); i++) { - tangible.RefObject tempRef_row11 = - new tangible.RefObject(row); + RefObject tempRef_row11 = + new RefObject(row); RowCursor tempCursor1; // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'out' keyword - these // cannot be converted using the 'OutObject' helper class unless the method is within the code being // modified: root.Clone(out tempCursor1).Find(tempRef_row11, Utf8String.Empty); - row = tempRef_row11.argValue; - tangible.RefObject tempRef_row12 = - new tangible.RefObject(row); + row = tempRef_row11.get(); + RefObject tempRef_row12 = + new RefObject(row); RowCursor innerScope; // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'out' keyword - these // cannot be converted using the 'OutObject' helper class unless the method is within the code being @@ -293,38 +296,38 @@ public final class TypedSetUnitTests { // modified: ResultAssert.IsSuccess(innerLayout.WriteScope(tempRef_row12, ref tempCursor1, innerType.getTypeArgs().clone(), out innerScope)); - row = tempRef_row12.argValue; + row = tempRef_row12.get(); for (int j = 0; j < t1.Prices.get(i).size(); j++) { - tangible.RefObject tempRef_row13 = - new tangible.RefObject(row); + RefObject tempRef_row13 = + new RefObject(row); RowCursor tempCursor2; // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'out' keyword - // these cannot be converted using the 'OutObject' helper class unless the method is within the code // being modified: root.Clone(out tempCursor2).Find(tempRef_row13, "prices.0.0"); - row = tempRef_row13.argValue; - tangible.RefObject tempRef_row14 = - new tangible.RefObject(row); - tangible.RefObject tempRef_tempCursor2 = - new tangible.RefObject(tempCursor2); + row = tempRef_row13.get(); + RefObject tempRef_row14 = + new RefObject(row); + RefObject tempRef_tempCursor2 = + new RefObject(tempCursor2); ResultAssert.IsSuccess(itemType.getType().TypeAs().WriteSparse(tempRef_row14, tempRef_tempCursor2, t1.Prices.get(i).get(j))); - tempCursor2 = tempRef_tempCursor2.argValue; - row = tempRef_row14.argValue; - tangible.RefObject tempRef_row15 = - new tangible.RefObject(row); - tangible.RefObject tempRef_innerScope = - new tangible.RefObject(innerScope); - tangible.RefObject tempRef_tempCursor22 = - new tangible.RefObject(tempCursor2); + tempCursor2 = tempRef_tempCursor2.get(); + row = tempRef_row14.get(); + RefObject tempRef_row15 = + new RefObject(row); + RefObject tempRef_innerScope = + new RefObject(innerScope); + RefObject tempRef_tempCursor22 = + new RefObject(tempCursor2); ResultAssert.IsSuccess(innerLayout.MoveField(tempRef_row15, tempRef_innerScope, tempRef_tempCursor22)); - tempCursor2 = tempRef_tempCursor22.argValue; - innerScope = tempRef_innerScope.argValue; - row = tempRef_row15.argValue; + tempCursor2 = tempRef_tempCursor22.get(); + innerScope = tempRef_innerScope.get(); + row = tempRef_row15.get(); } - tangible.RefObject tempRef_row16 = - new tangible.RefObject(row); + RefObject tempRef_row16 = + new RefObject(row); RowCursor findScope; // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'out' keyword - these // cannot be converted using the 'OutObject' helper class unless the method is within the code being @@ -334,7 +337,7 @@ public final class TypedSetUnitTests { // modified: ResultAssert.IsSuccess(c.TypeAs().Find(tempRef_row16, ref setScope, ref tempCursor1, out findScope)); - row = tempRef_row16.argValue; + row = tempRef_row16.get(); Assert.AreEqual(i, findScope.Index, String.format("Failed to find t1.Prices[%1$s]", i)); } } @@ -367,167 +370,167 @@ public final class TypedSetUnitTests { //ORIGINAL LINE: t1.Work = new List> { Tuple.Create(false, 10000UL)}; t1.Work = new ArrayList>(Arrays.asList(Tuple.Create(false, 10000))); - tangible.RefObject tempRef_row = - new tangible.RefObject(row); - tangible.RefObject tempRef_row2 = - new tangible.RefObject(row); + RefObject tempRef_row = + new RefObject(row); + RefObject tempRef_row2 = + new RefObject(row); RowCursor _; // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'out' keyword - these // cannot be converted using the 'OutObject' helper class unless the method is within the code being modified: this.WriteTodo(tempRef_row, RowCursor.Create(tempRef_row2, out _), t1); - row = tempRef_row2.argValue; - row = tempRef_row.argValue; + row = tempRef_row2.get(); + row = tempRef_row.get(); // Attempt to insert duplicate items in existing sets. - tangible.RefObject tempRef_row3 = - new tangible.RefObject(row); + RefObject tempRef_row3 = + new RefObject(row); RowCursor root = RowCursor.Create(tempRef_row3); - row = tempRef_row3.argValue; + row = tempRef_row3.get(); LayoutColumn c; // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'out' keyword - these // cannot be converted using the 'OutObject' helper class unless the method is within the code being modified: assert this.layout.TryFind("attendees", out c); - tangible.RefObject tempRef_row4 = - new tangible.RefObject(row); + RefObject tempRef_row4 = + new RefObject(row); RowCursor setScope; // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'out' keyword - these // cannot be converted using the 'OutObject' helper class unless the method is within the code being modified: root.Clone(out setScope).Find(tempRef_row4, c.Path); - row = tempRef_row4.argValue; - tangible.RefObject tempRef_row5 = - new tangible.RefObject(row); + row = tempRef_row4.get(); + RefObject tempRef_row5 = + new RefObject(row); // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'out' keyword - these // cannot be converted using the 'OutObject' 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 // cannot be converted using the 'RefObject' helper class unless the method is within the code being modified: ResultAssert.IsSuccess(c.TypeAs().ReadScope(tempRef_row5, ref setScope, out setScope)); - row = tempRef_row5.argValue; - tangible.RefObject tempRef_row6 = - new tangible.RefObject(row); + row = tempRef_row5.get(); + RefObject tempRef_row6 = + new RefObject(row); RowCursor tempCursor; // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'out' keyword - these // cannot be converted using the 'OutObject' helper class unless the method is within the code being modified: root.Clone(out tempCursor).Find(tempRef_row6, Utf8String.Empty); - row = tempRef_row6.argValue; - tangible.RefObject tempRef_row7 = - new tangible.RefObject(row); + row = tempRef_row6.get(); + RefObject tempRef_row7 = + new RefObject(row); // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'ref' keyword - these // cannot be converted using the 'RefObject' helper class unless the method is within the code being modified: ResultAssert.IsSuccess(c.TypeArgs[0].Type.TypeAs().WriteSparse(tempRef_row7, ref tempCursor, t1.Attendees.get(0))); - row = tempRef_row7.argValue; - tangible.RefObject tempRef_row8 = - new tangible.RefObject(row); + row = tempRef_row7.get(); + RefObject tempRef_row8 = + new RefObject(row); // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'ref' keyword - these // cannot be converted using the 'RefObject' helper class unless the method is within the code being modified: ResultAssert.Exists(c.TypeAs().MoveField(tempRef_row8, ref setScope, ref tempCursor, UpdateOptions.Insert)); - row = tempRef_row8.argValue; - tangible.RefObject tempRef_row9 = - new tangible.RefObject(row); + row = tempRef_row8.get(); + RefObject tempRef_row9 = + new RefObject(row); // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'out' keyword - these // cannot be converted using the 'OutObject' helper class unless the method is within the code being modified: root.Clone(out tempCursor).Find(tempRef_row9, Utf8String.Empty); - row = tempRef_row9.argValue; - tangible.RefObject tempRef_row10 = - new tangible.RefObject(row); + row = tempRef_row9.get(); + RefObject tempRef_row10 = + new RefObject(row); // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'ref' keyword - these // cannot be converted using the 'RefObject' helper class unless the method is within the code being modified: ResultAssert.IsSuccess(c.TypeArgs[0].Type.TypeAs().WriteSparse(tempRef_row10, ref tempCursor, t1.Attendees.get(0))); - row = tempRef_row10.argValue; - tangible.RefObject tempRef_row11 = - new tangible.RefObject(row); + row = tempRef_row10.get(); + RefObject tempRef_row11 = + new RefObject(row); RowCursor _; // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'out' keyword - these // cannot be converted using the 'OutObject' 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 // cannot be converted using the 'RefObject' helper class unless the method is within the code being modified: ResultAssert.IsSuccess(c.TypeAs().Find(tempRef_row11, ref setScope, ref tempCursor, out _)); - row = tempRef_row11.argValue; - tangible.RefObject tempRef_row12 = - new tangible.RefObject(row); + row = tempRef_row11.get(); + RefObject tempRef_row12 = + new RefObject(row); // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'out' keyword - these // cannot be converted using the 'OutObject' helper class unless the method is within the code being modified: root.Clone(out tempCursor).Find(tempRef_row12, Utf8String.Empty); - row = tempRef_row12.argValue; - tangible.RefObject tempRef_row13 = - new tangible.RefObject(row); + row = tempRef_row12.get(); + RefObject tempRef_row13 = + new RefObject(row); String _; // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'out' keyword - these // cannot be converted using the 'OutObject' 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 // cannot be converted using the 'RefObject' helper class unless the method is within the code being modified: ResultAssert.NotFound(c.TypeArgs[0].Type.TypeAs().ReadSparse(tempRef_row13, ref tempCursor, out _)); - row = tempRef_row13.argValue; + row = tempRef_row13.get(); // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'out' keyword - these // cannot be converted using the 'OutObject' helper class unless the method is within the code being modified: assert this.layout.TryFind("projects", out c); - tangible.RefObject tempRef_row14 = - new tangible.RefObject(row); + RefObject tempRef_row14 = + new RefObject(row); // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'out' keyword - these // cannot be converted using the 'OutObject' helper class unless the method is within the code being modified: root.Clone(out setScope).Find(tempRef_row14, c.Path); - row = tempRef_row14.argValue; - tangible.RefObject tempRef_row15 = - new tangible.RefObject(row); + row = tempRef_row14.get(); + RefObject tempRef_row15 = + new RefObject(row); // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'out' keyword - these // cannot be converted using the 'OutObject' 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 // cannot be converted using the 'RefObject' helper class unless the method is within the code being modified: ResultAssert.IsSuccess(c.TypeAs().ReadScope(tempRef_row15, ref setScope, out setScope)); - row = tempRef_row15.argValue; - tangible.RefObject tempRef_row16 = - new tangible.RefObject(row); + row = tempRef_row15.get(); + RefObject tempRef_row16 = + new RefObject(row); // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'out' keyword - these // cannot be converted using the 'OutObject' helper class unless the method is within the code being modified: root.Clone(out tempCursor).Find(tempRef_row16, Utf8String.Empty); - row = tempRef_row16.argValue; - tangible.RefObject tempRef_row17 = - new tangible.RefObject(row); + row = tempRef_row16.get(); + RefObject tempRef_row17 = + new RefObject(row); // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'ref' keyword - these // cannot be converted using the 'RefObject' helper class unless the method is within the code being modified: ResultAssert.IsSuccess(c.TypeArgs[0].Type.TypeAs().WriteSparse(tempRef_row17, ref tempCursor, t1.Projects.get(0))); - row = tempRef_row17.argValue; - tangible.RefObject tempRef_row18 = - new tangible.RefObject(row); + row = tempRef_row17.get(); + RefObject tempRef_row18 = + new RefObject(row); // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'ref' keyword - these // cannot be converted using the 'RefObject' helper class unless the method is within the code being modified: ResultAssert.Exists(c.TypeAs().MoveField(tempRef_row18, ref setScope, ref tempCursor, UpdateOptions.Insert)); - row = tempRef_row18.argValue; + row = tempRef_row18.get(); // Attempt to move a duplicate set into a set of sets. // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'out' keyword - these // cannot be converted using the 'OutObject' helper class unless the method is within the code being modified: assert this.layout.TryFind("prices", out c); - tangible.RefObject tempRef_row19 = - new tangible.RefObject(row); + RefObject tempRef_row19 = + new RefObject(row); // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'out' keyword - these // cannot be converted using the 'OutObject' helper class unless the method is within the code being modified: root.Clone(out setScope).Find(tempRef_row19, c.Path); - row = tempRef_row19.argValue; - tangible.RefObject tempRef_row20 = - new tangible.RefObject(row); + row = tempRef_row19.get(); + RefObject tempRef_row20 = + new RefObject(row); // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'out' keyword - these // cannot be converted using the 'OutObject' 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 // cannot be converted using the 'RefObject' helper class unless the method is within the code being modified: ResultAssert.IsSuccess(c.TypeAs().ReadScope(tempRef_row20, ref setScope, out setScope)); - row = tempRef_row20.argValue; + row = tempRef_row20.get(); TypeArgument innerType = c.TypeArgs[0]; LayoutUniqueScope innerLayout = innerType.getType().TypeAs(); - tangible.RefObject tempRef_row21 = - new tangible.RefObject(row); + RefObject tempRef_row21 = + new RefObject(row); RowCursor tempCursor1; // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'out' keyword - these // cannot be converted using the 'OutObject' helper class unless the method is within the code being modified: root.Clone(out tempCursor1).Find(tempRef_row21, Utf8String.Empty); - row = tempRef_row21.argValue; - tangible.RefObject tempRef_row22 = - new tangible.RefObject(row); + row = tempRef_row21.get(); + RefObject tempRef_row22 = + new RefObject(row); RowCursor innerScope; // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'out' keyword - these // cannot be converted using the 'OutObject' helper class unless the method is within the code being modified: @@ -535,125 +538,125 @@ public final class TypedSetUnitTests { // cannot be converted using the 'RefObject' helper class unless the method is within the code being modified: ResultAssert.IsSuccess(innerLayout.WriteScope(tempRef_row22, ref tempCursor1, innerType.getTypeArgs().clone() , out innerScope)); - row = tempRef_row22.argValue; + row = tempRef_row22.get(); for (float innerItem : t1.Prices.get(0)) { LayoutFloat32 itemLayout = innerType.getTypeArgs().get(0).getType().TypeAs(); - tangible.RefObject tempRef_row23 = - new tangible.RefObject(row); + RefObject tempRef_row23 = + new RefObject(row); RowCursor tempCursor2; // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'out' keyword - these // cannot be converted using the 'OutObject' helper class unless the method is within the code being // modified: root.Clone(out tempCursor2).Find(tempRef_row23, "prices.0.0"); - row = tempRef_row23.argValue; - tangible.RefObject tempRef_row24 = - new tangible.RefObject(row); - tangible.RefObject tempRef_tempCursor2 = - new tangible.RefObject(tempCursor2); + row = tempRef_row23.get(); + RefObject tempRef_row24 = + new RefObject(row); + RefObject tempRef_tempCursor2 = + new RefObject(tempCursor2); ResultAssert.IsSuccess(itemLayout.WriteSparse(tempRef_row24, tempRef_tempCursor2, innerItem)); - tempCursor2 = tempRef_tempCursor2.argValue; - row = tempRef_row24.argValue; - tangible.RefObject tempRef_row25 = - new tangible.RefObject(row); - tangible.RefObject tempRef_innerScope = - new tangible.RefObject(innerScope); - tangible.RefObject tempRef_tempCursor22 = - new tangible.RefObject(tempCursor2); + tempCursor2 = tempRef_tempCursor2.get(); + row = tempRef_row24.get(); + RefObject tempRef_row25 = + new RefObject(row); + RefObject tempRef_innerScope = + new RefObject(innerScope); + RefObject tempRef_tempCursor22 = + new RefObject(tempCursor2); ResultAssert.IsSuccess(innerLayout.MoveField(tempRef_row25, tempRef_innerScope, tempRef_tempCursor22)); - tempCursor2 = tempRef_tempCursor22.argValue; - innerScope = tempRef_innerScope.argValue; - row = tempRef_row25.argValue; + tempCursor2 = tempRef_tempCursor22.get(); + innerScope = tempRef_innerScope.get(); + row = tempRef_row25.get(); } - tangible.RefObject tempRef_row26 = - new tangible.RefObject(row); + RefObject tempRef_row26 = + new RefObject(row); // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'ref' keyword - these // cannot be converted using the 'RefObject' helper class unless the method is within the code being modified: ResultAssert.Exists(c.TypeAs().MoveField(tempRef_row26, ref setScope, ref tempCursor1, UpdateOptions.Insert)); - row = tempRef_row26.argValue; + row = tempRef_row26.get(); // Attempt to move a duplicate UDT into a set of UDT. // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'out' keyword - these // cannot be converted using the 'OutObject' helper class unless the method is within the code being modified: assert this.layout.TryFind("shopping", out c); - tangible.RefObject tempRef_row27 = - new tangible.RefObject(row); + RefObject tempRef_row27 = + new RefObject(row); // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'out' keyword - these // cannot be converted using the 'OutObject' helper class unless the method is within the code being modified: root.Clone(out setScope).Find(tempRef_row27, c.Path); - row = tempRef_row27.argValue; - tangible.RefObject tempRef_row28 = - new tangible.RefObject(row); + row = tempRef_row27.get(); + RefObject tempRef_row28 = + new RefObject(row); // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'out' keyword - these // cannot be converted using the 'OutObject' 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 // cannot be converted using the 'RefObject' helper class unless the method is within the code being modified: ResultAssert.IsSuccess(c.TypeAs().ReadScope(tempRef_row28, ref setScope, out setScope)); - row = tempRef_row28.argValue; + row = tempRef_row28.get(); LayoutUDT udtLayout = c.TypeArgs[0].Type.TypeAs(); - tangible.RefObject tempRef_row29 = - new tangible.RefObject(row); + RefObject tempRef_row29 = + new RefObject(row); // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'out' keyword - these // cannot be converted using the 'OutObject' helper class unless the method is within the code being modified: root.Clone(out tempCursor).Find(tempRef_row29, Utf8String.Empty); - row = tempRef_row29.argValue; - tangible.RefObject tempRef_row30 = - new tangible.RefObject(row); - tangible.RefObject tempRef_tempCursor = - new tangible.RefObject(tempCursor); + row = tempRef_row29.get(); + RefObject tempRef_row30 = + new RefObject(row); + RefObject tempRef_tempCursor = + new RefObject(tempCursor); RowCursor udtScope; - tangible.OutObject tempOut_udtScope = - new tangible.OutObject(); + OutObject tempOut_udtScope = + new OutObject(); ResultAssert.IsSuccess(udtLayout.WriteScope(tempRef_row30, tempRef_tempCursor, c.TypeArgs[0].TypeArgs, tempOut_udtScope)); - udtScope = tempOut_udtScope.argValue; - tempCursor = tempRef_tempCursor.argValue; - row = tempRef_row30.argValue; - tangible.RefObject tempRef_row31 = - new tangible.RefObject(row); - tangible.RefObject tempRef_udtScope = - new tangible.RefObject(udtScope); + udtScope = tempOut_udtScope.get(); + tempCursor = tempRef_tempCursor.get(); + row = tempRef_row30.get(); + RefObject tempRef_row31 = + new RefObject(row); + RefObject tempRef_udtScope = + new RefObject(udtScope); TypedSetUnitTests.WriteShoppingItem(tempRef_row31, tempRef_udtScope, c.TypeArgs[0].TypeArgs, t1.Shopping.get(0)); - udtScope = tempRef_udtScope.argValue; - row = tempRef_row31.argValue; - tangible.RefObject tempRef_row32 = - new tangible.RefObject(row); + udtScope = tempRef_udtScope.get(); + row = tempRef_row31.get(); + RefObject tempRef_row32 = + new RefObject(row); // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'ref' keyword - these // cannot be converted using the 'RefObject' helper class unless the method is within the code being modified: ResultAssert.Exists(c.TypeAs().MoveField(tempRef_row32, ref setScope, ref tempCursor, UpdateOptions.Insert)); - row = tempRef_row32.argValue; + row = tempRef_row32.get(); // Attempt to move a duplicate tuple into a set of tuple. // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'out' keyword - these // cannot be converted using the 'OutObject' helper class unless the method is within the code being modified: assert this.layout.TryFind("work", out c); - tangible.RefObject tempRef_row33 = - new tangible.RefObject(row); + RefObject tempRef_row33 = + new RefObject(row); // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'out' keyword - these // cannot be converted using the 'OutObject' helper class unless the method is within the code being modified: root.Clone(out setScope).Find(tempRef_row33, c.Path); - row = tempRef_row33.argValue; - tangible.RefObject tempRef_row34 = - new tangible.RefObject(row); + row = tempRef_row33.get(); + RefObject tempRef_row34 = + new RefObject(row); // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'out' keyword - these // cannot be converted using the 'OutObject' 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 // cannot be converted using the 'RefObject' helper class unless the method is within the code being modified: ResultAssert.IsSuccess(c.TypeAs().ReadScope(tempRef_row34, ref setScope, out setScope)); - row = tempRef_row34.argValue; + row = tempRef_row34.get(); innerType = c.TypeArgs[0]; LayoutIndexedScope tupleLayout = innerType.getType().TypeAs(); - tangible.RefObject tempRef_row35 = - new tangible.RefObject(row); + RefObject tempRef_row35 = + new RefObject(row); // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'out' keyword - these // cannot be converted using the 'OutObject' helper class unless the method is within the code being modified: root.Clone(out tempCursor).Find(tempRef_row35, Utf8String.Empty); - row = tempRef_row35.argValue; - tangible.RefObject tempRef_row36 = - new tangible.RefObject(row); + row = tempRef_row35.get(); + RefObject tempRef_row36 = + new RefObject(row); RowCursor tupleScope; // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'out' keyword - these // cannot be converted using the 'OutObject' helper class unless the method is within the code being modified: @@ -661,32 +664,32 @@ public final class TypedSetUnitTests { // cannot be converted using the 'RefObject' helper class unless the method is within the code being modified: ResultAssert.IsSuccess(tupleLayout.WriteScope(tempRef_row36, ref tempCursor, innerType.getTypeArgs().clone(), out tupleScope)); - row = tempRef_row36.argValue; - tangible.RefObject tempRef_row37 = - new tangible.RefObject(row); - tangible.RefObject tempRef_tupleScope = - new tangible.RefObject(tupleScope); + row = tempRef_row36.get(); + RefObject tempRef_row37 = + new RefObject(row); + RefObject tempRef_tupleScope = + new RefObject(tupleScope); ResultAssert.IsSuccess(innerType.getTypeArgs().get(0).getType().TypeAs().WriteSparse(tempRef_row37, tempRef_tupleScope, t1.Work.get(0).Item1)); - tupleScope = tempRef_tupleScope.argValue; - row = tempRef_row37.argValue; - tangible.RefObject tempRef_row38 = - new tangible.RefObject(row); + tupleScope = tempRef_tupleScope.get(); + row = tempRef_row37.get(); + RefObject tempRef_row38 = + new RefObject(row); assert tupleScope.MoveNext(tempRef_row38); - row = tempRef_row38.argValue; - tangible.RefObject tempRef_row39 = - new tangible.RefObject(row); - tangible.RefObject tempRef_tupleScope2 = - new tangible.RefObject(tupleScope); + row = tempRef_row38.get(); + RefObject tempRef_row39 = + new RefObject(row); + RefObject tempRef_tupleScope2 = + new RefObject(tupleScope); ResultAssert.IsSuccess(innerType.getTypeArgs().get(1).getType().TypeAs().WriteSparse(tempRef_row39, tempRef_tupleScope2, t1.Work.get(0).Item2)); - tupleScope = tempRef_tupleScope2.argValue; - row = tempRef_row39.argValue; - tangible.RefObject tempRef_row40 = - new tangible.RefObject(row); + tupleScope = tempRef_tupleScope2.get(); + row = tempRef_row39.get(); + RefObject tempRef_row40 = + new RefObject(row); // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'ref' keyword - these // cannot be converted using the 'RefObject' helper class unless the method is within the code being modified: ResultAssert.Exists(c.TypeAs().MoveField(tempRef_row40, ref setScope, ref tempCursor, UpdateOptions.Insert)); - row = tempRef_row40.argValue; + row = tempRef_row40.get(); } // TODO: C# TO JAVA CONVERTER: Java annotations will not correspond to .NET attributes: @@ -700,107 +703,107 @@ public final class TypedSetUnitTests { // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'out' keyword - these // cannot be converted using the 'OutObject' helper class unless the method is within the code being modified: assert this.layout.TryFind("attendees", out c); - tangible.RefObject tempRef_row = - new tangible.RefObject(row); - tangible.RefObject tempRef_row2 = - new tangible.RefObject(row); + RefObject tempRef_row = + new RefObject(row); + RefObject tempRef_row2 = + new RefObject(row); RowCursor setScope; // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'out' keyword - these // cannot be converted using the 'OutObject' helper class unless the method is within the code being modified: RowCursor.Create(tempRef_row, out setScope).Find(tempRef_row2, c.Path); - row = tempRef_row2.argValue; - row = tempRef_row.argValue; - tangible.RefObject tempRef_row3 = - new tangible.RefObject(row); + row = tempRef_row2.get(); + row = tempRef_row.get(); + RefObject tempRef_row3 = + new RefObject(row); // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'out' keyword - these // cannot be converted using the 'OutObject' 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 // cannot be converted using the 'RefObject' helper class unless the method is within the code being modified: ResultAssert.IsSuccess(c.TypeAs().WriteScope(tempRef_row3, ref setScope, c.TypeArgs, out setScope)); - row = tempRef_row3.argValue; - tangible.RefObject tempRef_row4 = - new tangible.RefObject(row); + row = tempRef_row3.get(); + RefObject tempRef_row4 = + new RefObject(row); // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'ref' keyword - these // cannot be converted using the 'RefObject' helper class unless the method is within the code being modified: ResultAssert.InsufficientPermissions(c.TypeArgs[0].Type.TypeAs().WriteSparse(tempRef_row4, ref setScope, "foo")); - row = tempRef_row4.argValue; - tangible.RefObject tempRef_row5 = - new tangible.RefObject(row); - tangible.RefObject tempRef_row6 = - new tangible.RefObject(row); + row = tempRef_row4.get(); + RefObject tempRef_row5 = + new RefObject(row); + RefObject tempRef_row6 = + new RefObject(row); RowCursor tempCursor; // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'out' keyword - these // cannot be converted using the 'OutObject' helper class unless the method is within the code being modified: RowCursor.Create(tempRef_row5, out tempCursor).Find(tempRef_row6, Utf8String.Empty); - row = tempRef_row6.argValue; - row = tempRef_row5.argValue; - tangible.RefObject tempRef_row7 = - new tangible.RefObject(row); + row = tempRef_row6.get(); + row = tempRef_row5.get(); + RefObject tempRef_row7 = + new RefObject(row); // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'ref' keyword - these // cannot be converted using the 'RefObject' helper class unless the method is within the code being modified: ResultAssert.IsSuccess(c.TypeArgs[0].Type.TypeAs().WriteSparse(tempRef_row7, ref tempCursor, "foo" )); - row = tempRef_row7.argValue; - tangible.RefObject tempRef_row8 = - new tangible.RefObject(row); + row = tempRef_row7.get(); + RefObject tempRef_row8 = + new RefObject(row); // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'ref' keyword - these // cannot be converted using the 'RefObject' helper class unless the method is within the code being modified: ResultAssert.IsSuccess(c.TypeAs().MoveField(tempRef_row8, ref setScope, ref tempCursor)); - row = tempRef_row8.argValue; - tangible.RefObject tempRef_row9 = - new tangible.RefObject(row); + row = tempRef_row8.get(); + RefObject tempRef_row9 = + new RefObject(row); // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'ref' keyword - these // cannot be converted using the 'RefObject' helper class unless the method is within the code being modified: ResultAssert.InsufficientPermissions(c.TypeArgs[0].Type.TypeAs().WriteSparse(tempRef_row9, ref setScope, "foo")); - row = tempRef_row9.argValue; - tangible.RefObject tempRef_row10 = - new tangible.RefObject(row); + row = tempRef_row9.get(); + RefObject tempRef_row10 = + new RefObject(row); // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'ref' keyword - these // cannot be converted using the 'RefObject' helper class unless the method is within the code being modified: ResultAssert.IsSuccess(c.TypeArgs[0].Type.TypeAs().DeleteSparse(tempRef_row10, ref setScope)); - row = tempRef_row10.argValue; + row = tempRef_row10.get(); // Write a set of sets, successfully insert an empty set into it, and then try to write directly to the inner // set. // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'out' keyword - these // cannot be converted using the 'OutObject' helper class unless the method is within the code being modified: assert this.layout.TryFind("prices", out c); - tangible.RefObject tempRef_row11 = - new tangible.RefObject(row); - tangible.RefObject tempRef_row12 = - new tangible.RefObject(row); + RefObject tempRef_row11 = + new RefObject(row); + RefObject tempRef_row12 = + new RefObject(row); // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'out' keyword - these // cannot be converted using the 'OutObject' helper class unless the method is within the code being modified: RowCursor.Create(tempRef_row11, out setScope).Find(tempRef_row12, c.Path); - row = tempRef_row12.argValue; - row = tempRef_row11.argValue; - tangible.RefObject tempRef_row13 = - new tangible.RefObject(row); + row = tempRef_row12.get(); + row = tempRef_row11.get(); + RefObject tempRef_row13 = + new RefObject(row); // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'out' keyword - these // cannot be converted using the 'OutObject' 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 // cannot be converted using the 'RefObject' helper class unless the method is within the code being modified: ResultAssert.IsSuccess(c.TypeAs().WriteScope(tempRef_row13, ref setScope, c.TypeArgs, out setScope)); - row = tempRef_row13.argValue; + row = tempRef_row13.get(); TypeArgument innerType = c.TypeArgs[0]; TypeArgument itemType = innerType.getTypeArgs().get(0).clone(); LayoutUniqueScope innerLayout = innerType.getType().TypeAs(); - tangible.RefObject tempRef_row14 = - new tangible.RefObject(row); - tangible.RefObject tempRef_row15 = - new tangible.RefObject(row); + RefObject tempRef_row14 = + new RefObject(row); + RefObject tempRef_row15 = + new RefObject(row); RowCursor tempCursor1; // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'out' keyword - these // cannot be converted using the 'OutObject' helper class unless the method is within the code being modified: RowCursor.Create(tempRef_row14, out tempCursor1).Find(tempRef_row15, "prices.0"); - row = tempRef_row15.argValue; - row = tempRef_row14.argValue; - tangible.RefObject tempRef_row16 = - new tangible.RefObject(row); + row = tempRef_row15.get(); + row = tempRef_row14.get(); + RefObject tempRef_row16 = + new RefObject(row); RowCursor innerScope; // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'out' keyword - these // cannot be converted using the 'OutObject' helper class unless the method is within the code being modified: @@ -808,71 +811,71 @@ public final class TypedSetUnitTests { // cannot be converted using the 'RefObject' helper class unless the method is within the code being modified: ResultAssert.IsSuccess(innerLayout.WriteScope(tempRef_row16, ref tempCursor1, innerType.getTypeArgs().clone() , out innerScope)); - row = tempRef_row16.argValue; - tangible.RefObject tempRef_row17 = - new tangible.RefObject(row); - tangible.RefObject tempRef_row18 = - new tangible.RefObject(row); + row = tempRef_row16.get(); + RefObject tempRef_row17 = + new RefObject(row); + RefObject tempRef_row18 = + new RefObject(row); RowCursor tempCursor2; // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'out' keyword - these // cannot be converted using the 'OutObject' helper class unless the method is within the code being modified: RowCursor.Create(tempRef_row17, out tempCursor2).Find(tempRef_row18, "prices.0.0"); - row = tempRef_row18.argValue; - row = tempRef_row17.argValue; - tangible.RefObject tempRef_row19 = - new tangible.RefObject(row); - tangible.RefObject tempRef_tempCursor2 = - new tangible.RefObject(tempCursor2); + row = tempRef_row18.get(); + row = tempRef_row17.get(); + RefObject tempRef_row19 = + new RefObject(row); + RefObject tempRef_tempCursor2 = + new RefObject(tempCursor2); ResultAssert.IsSuccess(itemType.getType().TypeAs().WriteSparse(tempRef_row19, tempRef_tempCursor2, 1.0F)); - tempCursor2 = tempRef_tempCursor2.argValue; - row = tempRef_row19.argValue; - tangible.RefObject tempRef_row20 = - new tangible.RefObject(row); - tangible.RefObject tempRef_innerScope = - new tangible.RefObject(innerScope); - tangible.RefObject tempRef_tempCursor22 = - new tangible.RefObject(tempCursor2); + tempCursor2 = tempRef_tempCursor2.get(); + row = tempRef_row19.get(); + RefObject tempRef_row20 = + new RefObject(row); + RefObject tempRef_innerScope = + new RefObject(innerScope); + RefObject tempRef_tempCursor22 = + new RefObject(tempCursor2); ResultAssert.IsSuccess(innerLayout.MoveField(tempRef_row20, tempRef_innerScope, tempRef_tempCursor22)); - tempCursor2 = tempRef_tempCursor22.argValue; - innerScope = tempRef_innerScope.argValue; - row = tempRef_row20.argValue; - tangible.RefObject tempRef_row21 = - new tangible.RefObject(row); + tempCursor2 = tempRef_tempCursor22.get(); + innerScope = tempRef_innerScope.get(); + row = tempRef_row20.get(); + RefObject tempRef_row21 = + new RefObject(row); // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'ref' keyword - these // cannot be converted using the 'RefObject' helper class unless the method is within the code being modified: ResultAssert.IsSuccess(c.TypeAs().MoveField(tempRef_row21, ref setScope, ref tempCursor1)); - row = tempRef_row21.argValue; - tangible.RefObject tempRef_row22 = - new tangible.RefObject(row); + row = tempRef_row21.get(); + RefObject tempRef_row22 = + new RefObject(row); assert setScope.MoveNext(tempRef_row22); - row = tempRef_row22.argValue; - tangible.RefObject tempRef_row23 = - new tangible.RefObject(row); - tangible.RefObject tempRef_setScope = - new tangible.RefObject(setScope); - tangible.OutObject tempOut_innerScope = - new tangible.OutObject(); + row = tempRef_row22.get(); + RefObject tempRef_row23 = + new RefObject(row); + RefObject tempRef_setScope = + new RefObject(setScope); + OutObject tempOut_innerScope = + new OutObject(); ResultAssert.IsSuccess(innerLayout.ReadScope(tempRef_row23, tempRef_setScope, tempOut_innerScope)); - innerScope = tempOut_innerScope.argValue; - setScope = tempRef_setScope.argValue; - row = tempRef_row23.argValue; - tangible.RefObject tempRef_row24 = - new tangible.RefObject(row); - tangible.RefObject tempRef_innerScope2 = - new tangible.RefObject(innerScope); + innerScope = tempOut_innerScope.get(); + setScope = tempRef_setScope.get(); + row = tempRef_row23.get(); + RefObject tempRef_row24 = + new RefObject(row); + RefObject tempRef_innerScope2 = + new RefObject(innerScope); ResultAssert.InsufficientPermissions(itemType.getType().TypeAs().WriteSparse(tempRef_row24, tempRef_innerScope2, 1.0F)); - innerScope = tempRef_innerScope2.argValue; - row = tempRef_row24.argValue; - tangible.RefObject tempRef_row25 = - new tangible.RefObject(row); - tangible.RefObject tempRef_innerScope3 = - new tangible.RefObject(innerScope); + innerScope = tempRef_innerScope2.get(); + row = tempRef_row24.get(); + RefObject tempRef_row25 = + new RefObject(row); + RefObject tempRef_innerScope3 = + new RefObject(innerScope); ResultAssert.InsufficientPermissions(itemType.getType().TypeAs().DeleteSparse(tempRef_row25, tempRef_innerScope3)); - innerScope = tempRef_innerScope3.argValue; - row = tempRef_row25.argValue; + innerScope = tempRef_innerScope3.get(); + row = tempRef_row25.get(); } // TODO: C# TO JAVA CONVERTER: Java annotations will not correspond to .NET attributes: @@ -889,10 +892,10 @@ public final class TypedSetUnitTests { t1.Projects = new ArrayList(permutation); row.InitLayout(HybridRowVersion.V1, this.layout, this.resolver); - tangible.RefObject tempRef_row = - new tangible.RefObject(row); + RefObject tempRef_row = + new RefObject(row); ResultAssert.IsSuccess(RowWriter.WriteBuffer(tempRef_row, t1, TypedSetUnitTests.SerializeTodo)); - row = tempRef_row.argValue; + row = tempRef_row.get(); // Update the existing Set by updating each item with itself. This ensures that the RowWriter has // maintained the unique index correctly. @@ -901,24 +904,24 @@ public final class TypedSetUnitTests { // cannot be converted using the 'OutObject' helper class unless the method is within the code being // modified: assert this.layout.TryFind("projects", out c); - tangible.RefObject tempRef_row2 = - new tangible.RefObject(row); + RefObject tempRef_row2 = + new RefObject(row); RowCursor root; // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'out' keyword - these // cannot be converted using the 'OutObject' helper class unless the method is within the code being // modified: RowCursor.Create(tempRef_row2, out root); - row = tempRef_row2.argValue; - tangible.RefObject tempRef_row3 = - new tangible.RefObject(row); + row = tempRef_row2.get(); + RefObject tempRef_row3 = + new RefObject(row); RowCursor projScope; // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'out' keyword - these // cannot be converted using the 'OutObject' helper class unless the method is within the code being // modified: root.Clone(out projScope).Find(tempRef_row3, c.Path); - row = tempRef_row3.argValue; - tangible.RefObject tempRef_row4 = - new tangible.RefObject(row); + row = tempRef_row3.get(); + RefObject tempRef_row4 = + new RefObject(row); // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'out' keyword - these // cannot be converted using the 'OutObject' helper class unless the method is within the code being // modified: @@ -926,45 +929,45 @@ public final class TypedSetUnitTests { // cannot be converted using the 'RefObject' helper class unless the method is within the code being // modified: ResultAssert.IsSuccess(c.TypeAs().ReadScope(tempRef_row4, ref projScope, out projScope)); - row = tempRef_row4.argValue; + row = tempRef_row4.get(); for (UUID item : t1.Projects) { - tangible.RefObject tempRef_row5 = - new tangible.RefObject(row); + RefObject tempRef_row5 = + new RefObject(row); RowCursor tempCursor; // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'out' keyword - // these cannot be converted using the 'OutObject' helper class unless the method is within the code // being modified: root.Clone(out tempCursor).Find(tempRef_row5, Utf8String.Empty); - row = tempRef_row5.argValue; - tangible.RefObject tempRef_row6 = - new tangible.RefObject(row); + row = tempRef_row5.get(); + RefObject tempRef_row6 = + new RefObject(row); // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'ref' keyword - // these cannot be converted using the 'RefObject' helper class unless the method is within the code // being modified: ResultAssert.IsSuccess(c.TypeArgs[0].Type.TypeAs().WriteSparse(tempRef_row6, ref tempCursor, item)); - row = tempRef_row6.argValue; - tangible.RefObject tempRef_row7 = - new tangible.RefObject(row); + row = tempRef_row6.get(); + RefObject tempRef_row7 = + new RefObject(row); // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'ref' keyword - // these cannot be converted using the 'RefObject' helper class unless the method is within the code // being modified: ResultAssert.IsSuccess(c.TypeAs().MoveField(tempRef_row7, ref projScope, ref tempCursor)); - row = tempRef_row7.argValue; + row = tempRef_row7.get(); } - tangible.RefObject tempRef_row8 = - new tangible.RefObject(row); - tangible.RefObject tempRef_row9 = - new tangible.RefObject(row); + RefObject tempRef_row8 = + new RefObject(row); + RefObject tempRef_row9 = + new RefObject(row); RowCursor _; // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'out' keyword - these // cannot be converted using the 'OutObject' helper class unless the method is within the code being // modified: Todo t2 = this.ReadTodo(tempRef_row8, RowCursor.Create(tempRef_row9, out _)); - row = tempRef_row9.argValue; - row = tempRef_row8.argValue; + row = tempRef_row9.get(); + row = tempRef_row8.get(); assert t1 == t2; } } @@ -983,38 +986,38 @@ public final class TypedSetUnitTests { Todo t1 = new Todo(); t1.Projects = new ArrayList(permutation); - tangible.RefObject tempRef_row = - new tangible.RefObject(row); - tangible.RefObject tempRef_row2 = - new tangible.RefObject(row); + RefObject tempRef_row = + new RefObject(row); + RefObject tempRef_row2 = + new RefObject(row); RowCursor _; // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'out' keyword - these // cannot be converted using the 'OutObject' helper class unless the method is within the code being // modified: this.WriteTodo(tempRef_row, RowCursor.Create(tempRef_row2, out _), t1); - row = tempRef_row2.argValue; - row = tempRef_row.argValue; + row = tempRef_row2.get(); + row = tempRef_row.get(); // Attempt to find each item in turn and then delete it. - tangible.RefObject tempRef_row3 = - new tangible.RefObject(row); + RefObject tempRef_row3 = + new RefObject(row); RowCursor root = RowCursor.Create(tempRef_row3); - row = tempRef_row3.argValue; + row = tempRef_row3.get(); LayoutColumn c; // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'out' keyword - these // cannot be converted using the 'OutObject' helper class unless the method is within the code being // modified: assert this.layout.TryFind("projects", out c); - tangible.RefObject tempRef_row4 = - new tangible.RefObject(row); + RefObject tempRef_row4 = + new RefObject(row); RowCursor setScope; // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'out' keyword - these // cannot be converted using the 'OutObject' helper class unless the method is within the code being // modified: root.Clone(out setScope).Find(tempRef_row4, c.Path); - row = tempRef_row4.argValue; - tangible.RefObject tempRef_row5 = - new tangible.RefObject(row); + row = tempRef_row4.get(); + RefObject tempRef_row5 = + new RefObject(row); // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'out' keyword - these // cannot be converted using the 'OutObject' helper class unless the method is within the code being // modified: @@ -1022,27 +1025,27 @@ public final class TypedSetUnitTests { // cannot be converted using the 'RefObject' helper class unless the method is within the code being // modified: ResultAssert.IsSuccess(c.TypeAs().ReadScope(tempRef_row5, ref setScope, out setScope)); - row = tempRef_row5.argValue; + row = tempRef_row5.get(); for (UUID elm : t1.Projects) { // Verify it is already there. - tangible.RefObject tempRef_row6 = - new tangible.RefObject(row); + RefObject tempRef_row6 = + new RefObject(row); RowCursor tempCursor; // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'out' keyword - // these cannot be converted using the 'OutObject' helper class unless the method is within the code // being modified: root.Clone(out tempCursor).Find(tempRef_row6, Utf8String.Empty); - row = tempRef_row6.argValue; - tangible.RefObject tempRef_row7 = - new tangible.RefObject(row); + row = tempRef_row6.get(); + RefObject tempRef_row7 = + new RefObject(row); // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'ref' keyword - // these cannot be converted using the 'RefObject' helper class unless the method is within the code // being modified: ResultAssert.IsSuccess(c.TypeArgs[0].Type.TypeAs().WriteSparse(tempRef_row7, ref tempCursor, elm)); - row = tempRef_row7.argValue; - tangible.RefObject tempRef_row8 = - new tangible.RefObject(row); + row = tempRef_row7.get(); + RefObject tempRef_row8 = + new RefObject(row); // TODO: C# TO JAVA CONVERTER: C# to Java Converter could not resolve the named parameters in the // following line: //ORIGINAL LINE: ResultAssert.IsSuccess(c.TypeAs().Find(ref row, ref setScope, ref @@ -1053,131 +1056,131 @@ public final class TypedSetUnitTests { ResultAssert.IsSuccess(c.TypeAs().Find(tempRef_row8, ref setScope, ref tempCursor, value: out RowCursor _)) - row = tempRef_row8.argValue; + row = tempRef_row8.get(); // Insert it again with update. - tangible.RefObject tempRef_row9 = - new tangible.RefObject(row); + RefObject tempRef_row9 = + new RefObject(row); // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'out' keyword - // these cannot be converted using the 'OutObject' helper class unless the method is within the code // being modified: root.Clone(out tempCursor).Find(tempRef_row9, Utf8String.Empty); - row = tempRef_row9.argValue; - tangible.RefObject tempRef_row10 = - new tangible.RefObject(row); + row = tempRef_row9.get(); + RefObject tempRef_row10 = + new RefObject(row); // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'ref' keyword - // these cannot be converted using the 'RefObject' helper class unless the method is within the code // being modified: ResultAssert.IsSuccess(c.TypeArgs[0].Type.TypeAs().WriteSparse(tempRef_row10, ref tempCursor, elm)); - row = tempRef_row10.argValue; - tangible.RefObject tempRef_row11 = - new tangible.RefObject(row); + row = tempRef_row10.get(); + RefObject tempRef_row11 = + new RefObject(row); // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'ref' keyword - // these cannot be converted using the 'RefObject' helper class unless the method is within the code // being modified: ResultAssert.IsSuccess(c.TypeAs().MoveField(tempRef_row11, ref setScope, ref tempCursor, UpdateOptions.Update)); - row = tempRef_row11.argValue; + row = tempRef_row11.get(); // Insert it again with upsert. - tangible.RefObject tempRef_row12 = - new tangible.RefObject(row); + RefObject tempRef_row12 = + new RefObject(row); // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'out' keyword - // these cannot be converted using the 'OutObject' helper class unless the method is within the code // being modified: root.Clone(out tempCursor).Find(tempRef_row12, Utf8String.Empty); - row = tempRef_row12.argValue; - tangible.RefObject tempRef_row13 = - new tangible.RefObject(row); + row = tempRef_row12.get(); + RefObject tempRef_row13 = + new RefObject(row); // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'ref' keyword - // these cannot be converted using the 'RefObject' helper class unless the method is within the code // being modified: ResultAssert.IsSuccess(c.TypeArgs[0].Type.TypeAs().WriteSparse(tempRef_row13, ref tempCursor, elm)); - row = tempRef_row13.argValue; - tangible.RefObject tempRef_row14 = - new tangible.RefObject(row); + row = tempRef_row13.get(); + RefObject tempRef_row14 = + new RefObject(row); // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'ref' keyword - // these cannot be converted using the 'RefObject' helper class unless the method is within the code // being modified: ResultAssert.IsSuccess(c.TypeAs().MoveField(tempRef_row14, ref setScope, ref tempCursor)); - row = tempRef_row14.argValue; + row = tempRef_row14.get(); // Insert it again with insert (fail: exists). - tangible.RefObject tempRef_row15 = - new tangible.RefObject(row); + RefObject tempRef_row15 = + new RefObject(row); // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'out' keyword - // these cannot be converted using the 'OutObject' helper class unless the method is within the code // being modified: root.Clone(out tempCursor).Find(tempRef_row15, Utf8String.Empty); - row = tempRef_row15.argValue; - tangible.RefObject tempRef_row16 = - new tangible.RefObject(row); + row = tempRef_row15.get(); + RefObject tempRef_row16 = + new RefObject(row); // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'ref' keyword - // these cannot be converted using the 'RefObject' helper class unless the method is within the code // being modified: ResultAssert.IsSuccess(c.TypeArgs[0].Type.TypeAs().WriteSparse(tempRef_row16, ref tempCursor, elm)); - row = tempRef_row16.argValue; - tangible.RefObject tempRef_row17 = - new tangible.RefObject(row); + row = tempRef_row16.get(); + RefObject tempRef_row17 = + new RefObject(row); // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'ref' keyword - // these cannot be converted using the 'RefObject' helper class unless the method is within the code // being modified: ResultAssert.Exists(c.TypeAs().MoveField(tempRef_row17, ref setScope, ref tempCursor, UpdateOptions.Insert)); - row = tempRef_row17.argValue; + row = tempRef_row17.get(); // Insert it again with insert at (fail: disallowed). - tangible.RefObject tempRef_row18 = - new tangible.RefObject(row); + RefObject tempRef_row18 = + new RefObject(row); // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'out' keyword - // these cannot be converted using the 'OutObject' helper class unless the method is within the code // being modified: root.Clone(out tempCursor).Find(tempRef_row18, Utf8String.Empty); - row = tempRef_row18.argValue; - tangible.RefObject tempRef_row19 = - new tangible.RefObject(row); + row = tempRef_row18.get(); + RefObject tempRef_row19 = + new RefObject(row); // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'ref' keyword - // these cannot be converted using the 'RefObject' helper class unless the method is within the code // being modified: ResultAssert.IsSuccess(c.TypeArgs[0].Type.TypeAs().WriteSparse(tempRef_row19, ref tempCursor, elm)); - row = tempRef_row19.argValue; - tangible.RefObject tempRef_row20 = - new tangible.RefObject(row); + row = tempRef_row19.get(); + RefObject tempRef_row20 = + new RefObject(row); // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'ref' keyword - // these cannot be converted using the 'RefObject' helper class unless the method is within the code // being modified: ResultAssert.TypeConstraint(c.TypeAs().MoveField(tempRef_row20, ref setScope, ref tempCursor, UpdateOptions.InsertAt)); - row = tempRef_row20.argValue; + row = tempRef_row20.get(); } } } - private static ShoppingItem ReadShoppingItem(tangible.RefObject row, tangible.RefObject matchScope) { - Layout matchLayout = matchScope.argValue.getLayout(); + private static ShoppingItem ReadShoppingItem(RefObject row, RefObject matchScope) { + Layout matchLayout = matchScope.get().getLayout(); ShoppingItem m = new ShoppingItem(); LayoutColumn c; // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'out' keyword - these cannot be converted using the 'OutObject' helper class unless the method is within the code being modified: assert matchLayout.TryFind("label", out c); - tangible.OutObject tempOut_Label = new tangible.OutObject(); + OutObject tempOut_Label = new OutObject(); ResultAssert.IsSuccess(c.TypeAs().ReadVariable(row, matchScope, c, tempOut_Label)); - m.Label = tempOut_Label.argValue; + m.Label = tempOut_Label.get(); // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'out' keyword - these cannot be converted using the 'OutObject' helper class unless the method is within the code being modified: assert matchLayout.TryFind("count", out c); - tangible.OutObject tempOut_Count = new tangible.OutObject(); + OutObject tempOut_Count = new OutObject(); //C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java: //ORIGINAL LINE: ResultAssert.IsSuccess(c.TypeAs().ReadFixed(ref row, ref matchScope, c, out m.Count)); ResultAssert.IsSuccess(c.TypeAs().ReadFixed(row, matchScope, c, tempOut_Count)); - m.Count = tempOut_Count.argValue; + m.Count = tempOut_Count.get(); return m; } - private Todo ReadTodo(tangible.RefObject row, tangible.RefObject root) { + private Todo ReadTodo(RefObject row, RefObject root) { Todo value = new Todo(); LayoutColumn c; @@ -1187,7 +1190,7 @@ public final class TypedSetUnitTests { RowCursor tagsScope; // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'out' keyword - these // cannot be converted using the 'OutObject' helper class unless the method is within the code being modified: - root.argValue.Clone(out tagsScope).Find(row, c.Path); + root.get().Clone(out tagsScope).Find(row, c.Path); // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'out' keyword - these // cannot be converted using the 'OutObject' 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 @@ -1214,7 +1217,7 @@ public final class TypedSetUnitTests { RowCursor projScope; // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'out' keyword - these // cannot be converted using the 'OutObject' helper class unless the method is within the code being modified: - root.argValue.Clone(out projScope).Find(row, c.Path); + root.get().Clone(out projScope).Find(row, c.Path); // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'out' keyword - these // cannot be converted using the 'OutObject' 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 @@ -1241,7 +1244,7 @@ public final class TypedSetUnitTests { RowCursor checkboxScope; // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'out' keyword - these // cannot be converted using the 'OutObject' helper class unless the method is within the code being modified: - root.argValue.Clone(out checkboxScope).Find(row, c.Path); + root.get().Clone(out checkboxScope).Find(row, c.Path); // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'out' keyword - these // cannot be converted using the 'OutObject' 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 @@ -1268,7 +1271,7 @@ public final class TypedSetUnitTests { RowCursor pricesScope; // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'out' keyword - these // cannot be converted using the 'OutObject' helper class unless the method is within the code being modified: - root.argValue.Clone(out pricesScope).Find(row, c.Path); + root.get().Clone(out pricesScope).Find(row, c.Path); // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'out' keyword - these // cannot be converted using the 'OutObject' 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 @@ -1279,23 +1282,23 @@ public final class TypedSetUnitTests { LayoutUniqueScope innerLayout = innerType.getType().TypeAs(); while (pricesScope.MoveNext(row)) { ArrayList item = new ArrayList(); - tangible.RefObject tempRef_pricesScope = - new tangible.RefObject(pricesScope); + RefObject tempRef_pricesScope = + new RefObject(pricesScope); RowCursor innerScope; - tangible.OutObject tempOut_innerScope = - new tangible.OutObject(); + OutObject tempOut_innerScope = + new OutObject(); ResultAssert.IsSuccess(innerLayout.ReadScope(row, tempRef_pricesScope, tempOut_innerScope)); - innerScope = tempOut_innerScope.argValue; - pricesScope = tempRef_pricesScope.argValue; + innerScope = tempOut_innerScope.get(); + pricesScope = tempRef_pricesScope.get(); while (innerScope.MoveNext(row)) { LayoutFloat32 itemLayout = innerType.getTypeArgs().get(0).getType().TypeAs(); - tangible.RefObject tempRef_innerScope = - new tangible.RefObject(innerScope); + RefObject tempRef_innerScope = + new RefObject(innerScope); float innerItem; - tangible.OutObject tempOut_innerItem = new tangible.OutObject(); + OutObject tempOut_innerItem = new OutObject(); ResultAssert.IsSuccess(itemLayout.ReadSparse(row, tempRef_innerScope, tempOut_innerItem)); - innerItem = tempOut_innerItem.argValue; - innerScope = tempRef_innerScope.argValue; + innerItem = tempOut_innerItem.get(); + innerScope = tempRef_innerScope.get(); item.add(innerItem); } @@ -1309,7 +1312,7 @@ public final class TypedSetUnitTests { RowCursor nestedScope; // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'out' keyword - these // cannot be converted using the 'OutObject' helper class unless the method is within the code being modified: - root.argValue.Clone(out nestedScope).Find(row, c.Path); + root.get().Clone(out nestedScope).Find(row, c.Path); // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'out' keyword - these // cannot be converted using the 'OutObject' 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 @@ -1320,34 +1323,34 @@ public final class TypedSetUnitTests { LayoutUniqueScope in2Layout = in2Type.getType().TypeAs(); while (nestedScope.MoveNext(row)) { ArrayList> item = new ArrayList>(); - tangible.RefObject tempRef_nestedScope = - new tangible.RefObject(nestedScope); + RefObject tempRef_nestedScope = + new RefObject(nestedScope); RowCursor in2Scope; - tangible.OutObject tempOut_in2Scope = - new tangible.OutObject(); + OutObject tempOut_in2Scope = + new OutObject(); ResultAssert.IsSuccess(in2Layout.ReadScope(row, tempRef_nestedScope, tempOut_in2Scope)); - in2Scope = tempOut_in2Scope.argValue; - nestedScope = tempRef_nestedScope.argValue; + in2Scope = tempOut_in2Scope.get(); + nestedScope = tempRef_nestedScope.get(); while (in2Scope.MoveNext(row)) { TypeArgument in3Type = in2Type.getTypeArgs().get(0).clone(); LayoutUniqueScope in3Layout = in3Type.getType().TypeAs(); ArrayList item2 = new ArrayList(); - tangible.RefObject tempRef_in2Scope = - new tangible.RefObject(in2Scope); + RefObject tempRef_in2Scope = + new RefObject(in2Scope); RowCursor in3Scope; - tangible.OutObject tempOut_in3Scope = - new tangible.OutObject(); + OutObject tempOut_in3Scope = + new OutObject(); ResultAssert.IsSuccess(in3Layout.ReadScope(row, tempRef_in2Scope, tempOut_in3Scope)); - in3Scope = tempOut_in3Scope.argValue; - in2Scope = tempRef_in2Scope.argValue; + in3Scope = tempOut_in3Scope.get(); + in2Scope = tempRef_in2Scope.get(); while (in3Scope.MoveNext(row)) { LayoutInt32 itemLayout = in3Type.getTypeArgs().get(0).getType().TypeAs(); - tangible.RefObject tempRef_in3Scope = new tangible.RefObject(in3Scope); + RefObject tempRef_in3Scope = new RefObject(in3Scope); int innerItem; - tangible.OutObject tempOut_innerItem2 = new tangible.OutObject(); + OutObject tempOut_innerItem2 = new OutObject(); ResultAssert.IsSuccess(itemLayout.ReadSparse(row, tempRef_in3Scope, tempOut_innerItem2)); - innerItem = tempOut_innerItem2.argValue; - in3Scope = tempRef_in3Scope.argValue; + innerItem = tempOut_innerItem2.get(); + in3Scope = tempRef_in3Scope.get(); item2.add(innerItem); } @@ -1364,7 +1367,7 @@ public final class TypedSetUnitTests { RowCursor shoppingScope; // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'out' keyword - these // cannot be converted using the 'OutObject' helper class unless the method is within the code being modified: - root.argValue.Clone(out shoppingScope).Find(row, c.Path); + root.get().Clone(out shoppingScope).Find(row, c.Path); // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'out' keyword - these // cannot be converted using the 'OutObject' 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 @@ -1374,18 +1377,18 @@ public final class TypedSetUnitTests { while (shoppingScope.MoveNext(row)) { TypeArgument innerType = c.TypeArgs[0]; LayoutUDT innerLayout = innerType.getType().TypeAs(); - tangible.RefObject tempRef_shoppingScope = - new tangible.RefObject(shoppingScope); + RefObject tempRef_shoppingScope = + new RefObject(shoppingScope); RowCursor matchScope; - tangible.OutObject tempOut_matchScope = - new tangible.OutObject(); + OutObject tempOut_matchScope = + new OutObject(); ResultAssert.IsSuccess(innerLayout.ReadScope(row, tempRef_shoppingScope, tempOut_matchScope)); - matchScope = tempOut_matchScope.argValue; - shoppingScope = tempRef_shoppingScope.argValue; - tangible.RefObject tempRef_matchScope = - new tangible.RefObject(matchScope); + matchScope = tempOut_matchScope.get(); + shoppingScope = tempRef_shoppingScope.get(); + RefObject tempRef_matchScope = + new RefObject(matchScope); ShoppingItem item = TypedSetUnitTests.ReadShoppingItem(row, tempRef_matchScope); - matchScope = tempRef_matchScope.argValue; + matchScope = tempRef_matchScope.get(); value.Shopping.add(item); } } @@ -1396,7 +1399,7 @@ public final class TypedSetUnitTests { RowCursor workScope; // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'out' keyword - these // cannot be converted using the 'OutObject' helper class unless the method is within the code being modified: - root.argValue.Clone(out workScope).Find(row, c.Path); + root.get().Clone(out workScope).Find(row, c.Path); // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'out' keyword - these // cannot be converted using the 'OutObject' 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 cannot be converted using the 'RefObject' helper class unless the method is within the code being modified: @@ -1408,28 +1411,28 @@ public final class TypedSetUnitTests { TypeArgument innerType = c.TypeArgs[0]; LayoutIndexedScope innerLayout = innerType.getType().TypeAs(); - tangible.RefObject tempRef_workScope = new tangible.RefObject(workScope); + RefObject tempRef_workScope = new RefObject(workScope); RowCursor tupleScope; - tangible.OutObject tempOut_tupleScope = new tangible.OutObject(); + OutObject tempOut_tupleScope = new OutObject(); ResultAssert.IsSuccess(innerLayout.ReadScope(row, tempRef_workScope, tempOut_tupleScope)); - tupleScope = tempOut_tupleScope.argValue; - workScope = tempRef_workScope.argValue; + tupleScope = tempOut_tupleScope.get(); + workScope = tempRef_workScope.get(); assert tupleScope.MoveNext(row); - tangible.RefObject tempRef_tupleScope = new tangible.RefObject(tupleScope); + RefObject tempRef_tupleScope = new RefObject(tupleScope); boolean item1; - tangible.OutObject tempOut_item1 = new tangible.OutObject(); + OutObject tempOut_item1 = new OutObject(); ResultAssert.IsSuccess(innerType.getTypeArgs().get(0).getType().TypeAs().ReadSparse(row, tempRef_tupleScope, tempOut_item1)); - item1 = tempOut_item1.argValue; - tupleScope = tempRef_tupleScope.argValue; + item1 = tempOut_item1.get(); + tupleScope = tempRef_tupleScope.get(); assert tupleScope.MoveNext(row); - tangible.RefObject tempRef_tupleScope2 = new tangible.RefObject(tupleScope); + RefObject tempRef_tupleScope2 = new RefObject(tupleScope); long item2; - tangible.OutObject tempOut_item2 = new tangible.OutObject(); + OutObject tempOut_item2 = new OutObject(); //C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java: //ORIGINAL LINE: ResultAssert.IsSuccess(innerType.TypeArgs[1].Type.TypeAs().ReadSparse(ref row, ref tupleScope, out ulong item2)); ResultAssert.IsSuccess(innerType.getTypeArgs().get(1).getType().TypeAs().ReadSparse(row, tempRef_tupleScope2, tempOut_item2)); - item2 = tempOut_item2.argValue; - tupleScope = tempRef_tupleScope2.argValue; + item2 = tempOut_item2.get(); + tupleScope = tempRef_tupleScope2.get(); value.Work.add(Tuple.Create(item1, item2)); } } @@ -1437,17 +1440,17 @@ public final class TypedSetUnitTests { return value; } - private static Result SerializeTodo(tangible.RefObject writer, TypeArgument typeArg, Todo value) { + private static Result SerializeTodo(RefObject writer, TypeArgument typeArg, Todo value) { if (value.Projects != null) { LayoutColumn c; // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'out' keyword - these // cannot be converted using the 'OutObject' helper class unless the method is within the code being // modified: - assert writer.argValue.getLayout().TryFind("projects", out c); + assert writer.get().getLayout().TryFind("projects", out c); // TODO: C# TO JAVA CONVERTER: The following lambda contained an unresolved 'ref' keyword - these are // not converted by C# to Java Converter: - Result r = writer.argValue.WriteScope("projects", c.TypeArg, value.Projects, (ref RowWriter writer2, - TypeArgument typeArg2, ArrayList value2) -> + Result r = writer.get().WriteScope("projects", c.TypeArg, value.Projects, (ref RowWriter writer2, + TypeArgument typeArg2, ArrayList value2) -> { for (UUID item : value2) { ResultAssert.IsSuccess(writer2.WriteGuid(null, item)); @@ -1461,8 +1464,8 @@ public final class TypedSetUnitTests { return Result.Success; } - private static void WriteShoppingItem(tangible.RefObject row, tangible.RefObject matchScope, TypeArgumentList typeArgs, ShoppingItem m) { - Layout matchLayout = row.argValue.getResolver().Resolve(typeArgs.getSchemaId().clone()); + private static void WriteShoppingItem(RefObject row, RefObject matchScope, TypeArgumentList typeArgs, ShoppingItem m) { + Layout matchLayout = row.get().getResolver().Resolve(typeArgs.getSchemaId().clone()); LayoutColumn c; // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'out' keyword - these cannot be converted using the 'OutObject' helper class unless the method is within the code being modified: assert matchLayout.TryFind("label", out c); @@ -1472,19 +1475,19 @@ public final class TypedSetUnitTests { ResultAssert.IsSuccess(c.TypeAs().WriteFixed(row, matchScope, c, m.Count)); } - private void WriteTodo(tangible.RefObject row, tangible.RefObject root, Todo value) { + private void WriteTodo(RefObject row, RefObject root, Todo value) { LayoutColumn c; if (value.Attendees != null) { - tangible.OutObject tempOut_c = - new tangible.OutObject(); + OutObject tempOut_c = + new OutObject(); assert this.layout.TryFind("attendees", tempOut_c); - c = tempOut_c.argValue; + c = tempOut_c.get(); RowCursor attendScope; // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'out' keyword - these // cannot be converted using the 'OutObject' helper class unless the method is within the code being // modified: - root.argValue.Clone(out attendScope).Find(row, c.getPath()); + root.get().Clone(out attendScope).Find(row, c.getPath()); // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'out' keyword - these // cannot be converted using the 'OutObject' helper class unless the method is within the code being // modified: @@ -1498,33 +1501,33 @@ public final class TypedSetUnitTests { // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'out' keyword - // these cannot be converted using the 'OutObject' helper class unless the method is within the code // being modified: - root.argValue.Clone(out tempCursor).Find(row, Utf8String.Empty); + root.get().Clone(out tempCursor).Find(row, Utf8String.Empty); // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'ref' keyword - // these cannot be converted using the 'RefObject' helper class unless the method is within the code // being modified: ResultAssert.IsSuccess(c.getTypeArgs().get(0).getType().TypeAs().WriteSparse(row, ref tempCursor, item)); - tangible.RefObject tempRef_attendScope = - new tangible.RefObject(attendScope); - tangible.RefObject tempRef_tempCursor = - new tangible.RefObject(tempCursor); + RefObject tempRef_attendScope = + new RefObject(attendScope); + RefObject tempRef_tempCursor = + new RefObject(tempCursor); ResultAssert.IsSuccess(c.TypeAs().MoveField(row, tempRef_attendScope, tempRef_tempCursor)); - tempCursor = tempRef_tempCursor.argValue; - attendScope = tempRef_attendScope.argValue; + tempCursor = tempRef_tempCursor.get(); + attendScope = tempRef_attendScope.get(); } } if (value.Projects != null) { - tangible.OutObject tempOut_c2 = - new tangible.OutObject(); + OutObject tempOut_c2 = + new OutObject(); assert this.layout.TryFind("projects", tempOut_c2); - c = tempOut_c2.argValue; + c = tempOut_c2.get(); RowCursor projScope; // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'out' keyword - these // cannot be converted using the 'OutObject' helper class unless the method is within the code being // modified: - root.argValue.Clone(out projScope).Find(row, c.getPath()); + root.get().Clone(out projScope).Find(row, c.getPath()); // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'out' keyword - these // cannot be converted using the 'OutObject' helper class unless the method is within the code being // modified: @@ -1538,33 +1541,33 @@ public final class TypedSetUnitTests { // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'out' keyword - // these cannot be converted using the 'OutObject' helper class unless the method is within the code // being modified: - root.argValue.Clone(out tempCursor).Find(row, Utf8String.Empty); - tangible.RefObject tempRef_tempCursor2 = - new tangible.RefObject(tempCursor); + root.get().Clone(out tempCursor).Find(row, Utf8String.Empty); + RefObject tempRef_tempCursor2 = + new RefObject(tempCursor); ResultAssert.IsSuccess(c.getTypeArgs().get(0).getType().TypeAs().WriteSparse(row, tempRef_tempCursor2, item)); - tempCursor = tempRef_tempCursor2.argValue; - tangible.RefObject tempRef_projScope = - new tangible.RefObject(projScope); - tangible.RefObject tempRef_tempCursor3 = - new tangible.RefObject(tempCursor); + tempCursor = tempRef_tempCursor2.get(); + RefObject tempRef_projScope = + new RefObject(projScope); + RefObject tempRef_tempCursor3 = + new RefObject(tempCursor); ResultAssert.IsSuccess(c.TypeAs().MoveField(row, tempRef_projScope, tempRef_tempCursor3)); - tempCursor = tempRef_tempCursor3.argValue; - projScope = tempRef_projScope.argValue; + tempCursor = tempRef_tempCursor3.get(); + projScope = tempRef_projScope.get(); } } if (value.Checkboxes != null) { - tangible.OutObject tempOut_c3 = - new tangible.OutObject(); + OutObject tempOut_c3 = + new OutObject(); assert this.layout.TryFind("checkboxes", tempOut_c3); - c = tempOut_c3.argValue; + c = tempOut_c3.get(); RowCursor checkboxScope; // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'out' keyword - these // cannot be converted using the 'OutObject' helper class unless the method is within the code being // modified: - root.argValue.Clone(out checkboxScope).Find(row, c.getPath()); + root.get().Clone(out checkboxScope).Find(row, c.getPath()); // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'out' keyword - these // cannot be converted using the 'OutObject' helper class unless the method is within the code being // modified: @@ -1578,33 +1581,33 @@ public final class TypedSetUnitTests { // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'out' keyword - // these cannot be converted using the 'OutObject' helper class unless the method is within the code // being modified: - root.argValue.Clone(out tempCursor).Find(row, Utf8String.Empty); - tangible.RefObject tempRef_tempCursor4 = - new tangible.RefObject(tempCursor); + root.get().Clone(out tempCursor).Find(row, Utf8String.Empty); + RefObject tempRef_tempCursor4 = + new RefObject(tempCursor); ResultAssert.IsSuccess(c.getTypeArgs().get(0).getType().TypeAs().WriteSparse(row, tempRef_tempCursor4, item)); - tempCursor = tempRef_tempCursor4.argValue; - tangible.RefObject tempRef_checkboxScope = - new tangible.RefObject(checkboxScope); - tangible.RefObject tempRef_tempCursor5 = - new tangible.RefObject(tempCursor); + tempCursor = tempRef_tempCursor4.get(); + RefObject tempRef_checkboxScope = + new RefObject(checkboxScope); + RefObject tempRef_tempCursor5 = + new RefObject(tempCursor); ResultAssert.IsSuccess(c.TypeAs().MoveField(row, tempRef_checkboxScope, tempRef_tempCursor5)); - tempCursor = tempRef_tempCursor5.argValue; - checkboxScope = tempRef_checkboxScope.argValue; + tempCursor = tempRef_tempCursor5.get(); + checkboxScope = tempRef_checkboxScope.get(); } } if (value.Prices != null) { - tangible.OutObject tempOut_c4 = - new tangible.OutObject(); + OutObject tempOut_c4 = + new OutObject(); assert this.layout.TryFind("prices", tempOut_c4); - c = tempOut_c4.argValue; + c = tempOut_c4.get(); RowCursor pricesScope; // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'out' keyword - these // cannot be converted using the 'OutObject' helper class unless the method is within the code being // modified: - root.argValue.Clone(out pricesScope).Find(row, c.getPath()); + root.get().Clone(out pricesScope).Find(row, c.getPath()); // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'out' keyword - these // cannot be converted using the 'OutObject' helper class unless the method is within the code being // modified: @@ -1621,7 +1624,7 @@ public final class TypedSetUnitTests { // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'out' keyword - // these cannot be converted using the 'OutObject' helper class unless the method is within the code // being modified: - root.argValue.Clone(out tempCursor1).Find(row, "prices.0"); + root.get().Clone(out tempCursor1).Find(row, "prices.0"); RowCursor innerScope; // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'out' keyword - // these cannot be converted using the 'OutObject' helper class unless the method is within the code @@ -1637,40 +1640,40 @@ public final class TypedSetUnitTests { // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'out' keyword // - these cannot be converted using the 'OutObject' helper class unless the method is within the // code being modified: - root.argValue.Clone(out tempCursor2).Find(row, "prices.0.0"); - tangible.RefObject tempRef_tempCursor2 - = new tangible.RefObject(tempCursor2); + root.get().Clone(out tempCursor2).Find(row, "prices.0.0"); + RefObject tempRef_tempCursor2 + = new RefObject(tempCursor2); ResultAssert.IsSuccess(itemLayout.WriteSparse(row, tempRef_tempCursor2, innerItem)); - tempCursor2 = tempRef_tempCursor2.argValue; - tangible.RefObject tempRef_innerScope = - new tangible.RefObject(innerScope); - tangible.RefObject tempRef_tempCursor22 = new tangible.RefObject(tempCursor2); + tempCursor2 = tempRef_tempCursor2.get(); + RefObject tempRef_innerScope = + new RefObject(innerScope); + RefObject tempRef_tempCursor22 = new RefObject(tempCursor2); ResultAssert.IsSuccess(innerLayout.MoveField(row, tempRef_innerScope, tempRef_tempCursor22)); - tempCursor2 = tempRef_tempCursor22.argValue; - innerScope = tempRef_innerScope.argValue; + tempCursor2 = tempRef_tempCursor22.get(); + innerScope = tempRef_innerScope.get(); } - tangible.RefObject tempRef_pricesScope = - new tangible.RefObject(pricesScope); - tangible.RefObject tempRef_tempCursor1 = - new tangible.RefObject(tempCursor1); + RefObject tempRef_pricesScope = + new RefObject(pricesScope); + RefObject tempRef_tempCursor1 = + new RefObject(tempCursor1); ResultAssert.IsSuccess(c.TypeAs().MoveField(row, tempRef_pricesScope, tempRef_tempCursor1)); - tempCursor1 = tempRef_tempCursor1.argValue; - pricesScope = tempRef_pricesScope.argValue; + tempCursor1 = tempRef_tempCursor1.get(); + pricesScope = tempRef_pricesScope.get(); } } if (value.Nested != null) { - tangible.OutObject tempOut_c5 = - new tangible.OutObject(); + OutObject tempOut_c5 = + new OutObject(); assert this.layout.TryFind("nested", tempOut_c5); - c = tempOut_c5.argValue; + c = tempOut_c5.get(); RowCursor nestedScope; // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'out' keyword - these // cannot be converted using the 'OutObject' helper class unless the method is within the code being // modified: - root.argValue.Clone(out nestedScope).Find(row, c.getPath()); + root.get().Clone(out nestedScope).Find(row, c.getPath()); // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'out' keyword - these // cannot be converted using the 'OutObject' helper class unless the method is within the code being // modified: @@ -1687,7 +1690,7 @@ public final class TypedSetUnitTests { // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'out' keyword - // these cannot be converted using the 'OutObject' helper class unless the method is within the code // being modified: - root.argValue.Clone(out tempCursor1).Find(row, "prices.0"); + root.get().Clone(out tempCursor1).Find(row, "prices.0"); RowCursor in2Scope; // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'out' keyword - // these cannot be converted using the 'OutObject' helper class unless the method is within the code @@ -1705,7 +1708,7 @@ public final class TypedSetUnitTests { // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'out' keyword // - these cannot be converted using the 'OutObject' helper class unless the method is within the // code being modified: - root.argValue.Clone(out tempCursor2).Find(row, "prices.0.0"); + root.get().Clone(out tempCursor2).Find(row, "prices.0.0"); RowCursor in3Scope; // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'out' keyword // - these cannot be converted using the 'OutObject' helper class unless the method is within the @@ -1721,46 +1724,46 @@ public final class TypedSetUnitTests { // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'out' // keyword - these cannot be converted using the 'OutObject' helper class unless the method // is within the code being modified: - root.argValue.Clone(out tempCursor3).Find(row, "prices.0.0.0"); - tangible.RefObject tempRef_tempCursor3 = new tangible.RefObject(tempCursor3); + root.get().Clone(out tempCursor3).Find(row, "prices.0.0.0"); + RefObject tempRef_tempCursor3 = new RefObject(tempCursor3); ResultAssert.IsSuccess(itemLayout.WriteSparse(row, tempRef_tempCursor3, innerItem)); - tempCursor3 = tempRef_tempCursor3.argValue; - tangible.RefObject tempRef_in3Scope = new tangible.RefObject(in3Scope); - tangible.RefObject tempRef_tempCursor32 = new tangible.RefObject(tempCursor3); + tempCursor3 = tempRef_tempCursor3.get(); + RefObject tempRef_in3Scope = new RefObject(in3Scope); + RefObject tempRef_tempCursor32 = new RefObject(tempCursor3); ResultAssert.IsSuccess(in3Layout.MoveField(row, tempRef_in3Scope, tempRef_tempCursor32)); - tempCursor3 = tempRef_tempCursor32.argValue; - in3Scope = tempRef_in3Scope.argValue; + tempCursor3 = tempRef_tempCursor32.get(); + in3Scope = tempRef_in3Scope.get(); } - tangible.RefObject tempRef_in2Scope = - new tangible.RefObject(in2Scope); - tangible.RefObject tempRef_tempCursor23 = new tangible.RefObject(tempCursor2); + RefObject tempRef_in2Scope = + new RefObject(in2Scope); + RefObject tempRef_tempCursor23 = new RefObject(tempCursor2); ResultAssert.IsSuccess(in2Layout.MoveField(row, tempRef_in2Scope, tempRef_tempCursor23)); - tempCursor2 = tempRef_tempCursor23.argValue; - in2Scope = tempRef_in2Scope.argValue; + tempCursor2 = tempRef_tempCursor23.get(); + in2Scope = tempRef_in2Scope.get(); } - tangible.RefObject tempRef_nestedScope = - new tangible.RefObject(nestedScope); - tangible.RefObject tempRef_tempCursor12 = - new tangible.RefObject(tempCursor1); + RefObject tempRef_nestedScope = + new RefObject(nestedScope); + RefObject tempRef_tempCursor12 = + new RefObject(tempCursor1); ResultAssert.IsSuccess(c.TypeAs().MoveField(row, tempRef_nestedScope, tempRef_tempCursor12)); - tempCursor1 = tempRef_tempCursor12.argValue; - nestedScope = tempRef_nestedScope.argValue; + tempCursor1 = tempRef_tempCursor12.get(); + nestedScope = tempRef_nestedScope.get(); } } if (value.Shopping != null) { - tangible.OutObject tempOut_c6 = - new tangible.OutObject(); + OutObject tempOut_c6 = + new OutObject(); assert this.layout.TryFind("shopping", tempOut_c6); - c = tempOut_c6.argValue; + c = tempOut_c6.get(); RowCursor shoppingScope; // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'out' keyword - these // cannot be converted using the 'OutObject' helper class unless the method is within the code being // modified: - root.argValue.Clone(out shoppingScope).Find(row, c.getPath()); + root.get().Clone(out shoppingScope).Find(row, c.getPath()); // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'out' keyword - these // cannot be converted using the 'OutObject' helper class unless the method is within the code being // modified: @@ -1776,41 +1779,41 @@ public final class TypedSetUnitTests { // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'out' keyword - // these cannot be converted using the 'OutObject' helper class unless the method is within the code // being modified: - root.argValue.Clone(out tempCursor).Find(row, Utf8String.Empty); - tangible.RefObject tempRef_tempCursor6 = - new tangible.RefObject(tempCursor); + root.get().Clone(out tempCursor).Find(row, Utf8String.Empty); + RefObject tempRef_tempCursor6 = + new RefObject(tempCursor); RowCursor itemScope; - tangible.OutObject tempOut_itemScope = - new tangible.OutObject(); + OutObject tempOut_itemScope = + new OutObject(); ResultAssert.IsSuccess(innerLayout.WriteScope(row, tempRef_tempCursor6, innerType.getTypeArgs().clone(), tempOut_itemScope)); - itemScope = tempOut_itemScope.argValue; - tempCursor = tempRef_tempCursor6.argValue; - tangible.RefObject tempRef_itemScope = - new tangible.RefObject(itemScope); + itemScope = tempOut_itemScope.get(); + tempCursor = tempRef_tempCursor6.get(); + RefObject tempRef_itemScope = + new RefObject(itemScope); TypedSetUnitTests.WriteShoppingItem(row, tempRef_itemScope, innerType.getTypeArgs().clone(), item); - itemScope = tempRef_itemScope.argValue; - tangible.RefObject tempRef_shoppingScope = - new tangible.RefObject(shoppingScope); - tangible.RefObject tempRef_tempCursor7 = - new tangible.RefObject(tempCursor); + itemScope = tempRef_itemScope.get(); + RefObject tempRef_shoppingScope = + new RefObject(shoppingScope); + RefObject tempRef_tempCursor7 = + new RefObject(tempCursor); ResultAssert.IsSuccess(c.TypeAs().MoveField(row, tempRef_shoppingScope, tempRef_tempCursor7)); - tempCursor = tempRef_tempCursor7.argValue; - shoppingScope = tempRef_shoppingScope.argValue; + tempCursor = tempRef_tempCursor7.get(); + shoppingScope = tempRef_shoppingScope.get(); } } if (value.Work != null) { - tangible.OutObject tempOut_c7 = - new tangible.OutObject(); + OutObject tempOut_c7 = + new OutObject(); assert this.layout.TryFind("work", tempOut_c7); - c = tempOut_c7.argValue; + c = tempOut_c7.get(); RowCursor workScope; // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'out' keyword - these // cannot be converted using the 'OutObject' helper class unless the method is within the code being // modified: - root.argValue.Clone(out workScope).Find(row, c.getPath()); + root.get().Clone(out workScope).Find(row, c.getPath()); // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'out' keyword - these // cannot be converted using the 'OutObject' helper class unless the method is within the code being // modified: @@ -1828,7 +1831,7 @@ public final class TypedSetUnitTests { // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'out' keyword - // these cannot be converted using the 'OutObject' helper class unless the method is within the code // being modified: - root.argValue.Clone(out tempCursor).Find(row, Utf8String.Empty); + root.get().Clone(out tempCursor).Find(row, Utf8String.Empty); RowCursor tupleScope; // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'out' keyword - // these cannot be converted using the 'OutObject' helper class unless the method is within the code @@ -1838,23 +1841,23 @@ public final class TypedSetUnitTests { // being modified: ResultAssert.IsSuccess(innerLayout.WriteScope(row, ref tempCursor, innerType.getTypeArgs().clone(), out tupleScope)); - tangible.RefObject tempRef_tupleScope = - new tangible.RefObject(tupleScope); + RefObject tempRef_tupleScope = + new RefObject(tupleScope); ResultAssert.IsSuccess(innerType.getTypeArgs().get(0).getType().TypeAs().WriteSparse(row, tempRef_tupleScope, item.Item1)); - tupleScope = tempRef_tupleScope.argValue; + tupleScope = tempRef_tupleScope.get(); assert tupleScope.MoveNext(row); - tangible.RefObject tempRef_tupleScope2 = - new tangible.RefObject(tupleScope); + RefObject tempRef_tupleScope2 = + new RefObject(tupleScope); ResultAssert.IsSuccess(innerType.getTypeArgs().get(1).getType().TypeAs().WriteSparse(row, tempRef_tupleScope2, item.Item2)); - tupleScope = tempRef_tupleScope2.argValue; - tangible.RefObject tempRef_workScope = - new tangible.RefObject(workScope); - tangible.RefObject tempRef_tempCursor8 = - new tangible.RefObject(tempCursor); + tupleScope = tempRef_tupleScope2.get(); + RefObject tempRef_workScope = + new RefObject(workScope); + RefObject tempRef_tempCursor8 = + new RefObject(tempCursor); ResultAssert.IsSuccess(c.TypeAs().MoveField(row, tempRef_workScope, tempRef_tempCursor8)); - tempCursor = tempRef_tempCursor8.argValue; - workScope = tempRef_workScope.argValue; + tempCursor = tempRef_tempCursor8.get(); + workScope = tempRef_workScope.get(); } } } diff --git a/jre/src/test/java/azure/data/cosmos/serialization/hybridrow/unit/UpdateOptionsUnitTests.java b/jre/src/test/java/com/azure/data/cosmos/serialization/hybridrow/unit/UpdateOptionsUnitTests.java similarity index 87% rename from jre/src/test/java/azure/data/cosmos/serialization/hybridrow/unit/UpdateOptionsUnitTests.java rename to jre/src/test/java/com/azure/data/cosmos/serialization/hybridrow/unit/UpdateOptionsUnitTests.java index 6e558dc..af0412a 100644 --- a/jre/src/test/java/azure/data/cosmos/serialization/hybridrow/unit/UpdateOptionsUnitTests.java +++ b/jre/src/test/java/com/azure/data/cosmos/serialization/hybridrow/unit/UpdateOptionsUnitTests.java @@ -2,9 +2,9 @@ // Copyright (c) Microsoft Corporation. All rights reserved. //------------------------------------------------------------ -package azure.data.cosmos.serialization.hybridrow.unit; +package com.azure.data.cosmos.serialization.hybridrow.unit; -import 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: //ORIGINAL LINE: [TestClass] public class UpdateOptionsUnitTests diff --git a/jre/src/test/java/com/azure/data/cosmos/serialization/hybridrow/unit/WriteRowDispatcher.java b/jre/src/test/java/com/azure/data/cosmos/serialization/hybridrow/unit/WriteRowDispatcher.java new file mode 100644 index 0000000..757f378 --- /dev/null +++ b/jre/src/test/java/com/azure/data/cosmos/serialization/hybridrow/unit/WriteRowDispatcher.java @@ -0,0 +1,248 @@ +//------------------------------------------------------------ +// Copyright (c) Microsoft Corporation. All rights reserved. +//------------------------------------------------------------ + +package com.azure.data.cosmos.serialization.hybridrow.unit; + +import com.azure.data.cosmos.core.OutObject; +import com.azure.data.cosmos.core.RefObject; +import com.azure.data.cosmos.serialization.hybridrow.RowBuffer; +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.LayoutTypedArray; +import com.azure.data.cosmos.serialization.hybridrow.layouts.TypeArgumentList; + +import java.util.List; +import java.util.UUID; + +//C# TO JAVA CONVERTER WARNING: Java does not allow user-defined value types. The behavior of this class may differ +// from the original: +//ORIGINAL LINE: internal struct WriteRowDispatcher : IDispatcher +public final class WriteRowDispatcher implements IDispatcher { + + public , TValue> void Dispatch(RefObject dispatcher, RefObject field, LayoutColumn col, LayoutType t) { + Dispatch(dispatcher, field, col, t, null); + } + + //C# TO JAVA CONVERTER NOTE: Java does not support optional parameters. Overloaded method(s) are created above: + //ORIGINAL LINE: public void Dispatch(ref RowOperationDispatcher dispatcher, ref RowCursor + // field, LayoutColumn col, LayoutType t, TValue value = default) where TLayout : LayoutType + public , TValue> void Dispatch(RefObject dispatcher, RefObject field, LayoutColumn col, LayoutType t, TValue value) { + switch (col == null ? null : col.getStorage()) { + case Fixed: + RefObject tempRef_Row = + new RefObject(dispatcher.get().Row); + ResultAssert.IsSuccess(t.TypeAs().WriteFixed(tempRef_Row, field, col, value)); + dispatcher.get().argValue.Row = tempRef_Row.get(); + break; + case Variable: + RefObject tempRef_Row2 = + new RefObject(dispatcher.get().Row); + ResultAssert.IsSuccess(t.TypeAs().WriteVariable(tempRef_Row2, field, col, value)); + dispatcher.get().argValue.Row = tempRef_Row2.get(); + break; + default: + RefObject tempRef_Row3 = + new RefObject(dispatcher.get().Row); + ResultAssert.IsSuccess(t.TypeAs().WriteSparse(tempRef_Row3, field, value)); + dispatcher.get().argValue.Row = tempRef_Row3.get(); + break; + } + } + + public void DispatchArray(RefObject dispatcher, + RefObject scope, LayoutType t, TypeArgumentList typeArgs, + Object value) { + checkArgument(typeArgs.getCount() == 1); + + RefObject tempRef_Row = + new RefObject(dispatcher.get().Row); + RowCursor arrayScope; + OutObject tempOut_arrayScope = + new OutObject(); + ResultAssert.IsSuccess(t.TypeAs().WriteScope(tempRef_Row, scope, typeArgs.clone(), + tempOut_arrayScope)); + arrayScope = tempOut_arrayScope.get(); + dispatcher.get().argValue.Row = tempRef_Row.get(); + + List items = (List)value; + for (Object item : items) { + // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'ref' keyword - these + // cannot be converted using the 'RefObject' helper class unless the method is within the code being + // modified: + dispatcher.get().LayoutCodeSwitch(ref arrayScope, null, typeArgs.get(0).getType(), + typeArgs.get(0).getTypeArgs().clone(), item); + RefObject tempRef_Row2 = + new RefObject(dispatcher.get().Row); + arrayScope.MoveNext(tempRef_Row2); + dispatcher.get().argValue.Row = tempRef_Row2.get(); + } + } + + public void DispatchMap(RefObject dispatcher, + RefObject scope, LayoutType t, TypeArgumentList typeArgs, + Object value) { + checkArgument(typeArgs.getCount() == 2); + + RefObject tempRef_Row = + new RefObject(dispatcher.get().Row); + RowCursor mapScope; + OutObject tempOut_mapScope = + new OutObject(); + ResultAssert.IsSuccess(t.TypeAs().WriteScope(tempRef_Row, scope, typeArgs.clone(), + tempOut_mapScope)); + mapScope = tempOut_mapScope.get(); + dispatcher.get().argValue.Row = tempRef_Row.get(); + RefObject tempRef_mapScope = + new RefObject(mapScope); + TypeArgument fieldType = t.TypeAs().FieldType(tempRef_mapScope).clone(); + mapScope = tempRef_mapScope.get(); + List pairs = (List)value; + for (Object pair : pairs) { + String elmPath = UUID.NewGuid().toString(); + RefObject tempRef_Row2 = + new RefObject(dispatcher.get().Row); + RowCursor tempCursor; + // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'out' keyword - these + // cannot be converted using the 'OutObject' helper class unless the method is within the code being + // modified: + RowCursor.CreateForAppend(tempRef_Row2, out tempCursor); + dispatcher.get().argValue.Row = tempRef_Row2.get(); + // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'ref' keyword - these + // cannot be converted using the 'RefObject' helper class unless the method is within the code being + // modified: + dispatcher.get().LayoutCodeSwitch(ref tempCursor, elmPath, fieldType.getType(), + fieldType.getTypeArgs().clone(), pair); + + // Move item into the map. + RefObject tempRef_Row3 = + new RefObject(dispatcher.get().Row); + RefObject tempRef_mapScope2 = + new RefObject(mapScope); + RefObject tempRef_tempCursor = + new RefObject(tempCursor); + ResultAssert.IsSuccess(t.TypeAs().MoveField(tempRef_Row3, tempRef_mapScope2, + tempRef_tempCursor)); + tempCursor = tempRef_tempCursor.get(); + mapScope = tempRef_mapScope2.get(); + dispatcher.get().argValue.Row = tempRef_Row3.get(); + } + } + + public void DispatchNullable(RefObject dispatcher, + RefObject scope, LayoutType t, TypeArgumentList typeArgs, + Object value) { + checkArgument(typeArgs.getCount() == 1); + + RefObject tempRef_Row = + new RefObject(dispatcher.get().Row); + RowCursor nullableScope; + // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'out' keyword - these + // cannot be converted using the 'OutObject' helper class unless the method is within the code being modified: + ResultAssert.IsSuccess(t.TypeAs().WriteScope(tempRef_Row, scope, typeArgs.clone(), + value != null, out nullableScope)); + dispatcher.get().argValue.Row = tempRef_Row.get(); + + if (value != null) { + // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'ref' keyword - these + // cannot be converted using the 'RefObject' helper class unless the method is within the code being + // modified: + dispatcher.get().LayoutCodeSwitch(ref nullableScope, null, typeArgs.get(0).getType(), + typeArgs.get(0).getTypeArgs().clone(), value); + } + } + + public void DispatchObject(RefObject dispatcher, + RefObject scope) { + } + + public void DispatchSet(RefObject dispatcher, + RefObject scope, LayoutType t, TypeArgumentList typeArgs, + Object value) { + checkArgument(typeArgs.getCount() == 1); + + RefObject tempRef_Row = + new RefObject(dispatcher.get().Row); + RowCursor setScope; + OutObject tempOut_setScope = + new OutObject(); + ResultAssert.IsSuccess(t.TypeAs().WriteScope(tempRef_Row, scope, typeArgs.clone(), + tempOut_setScope)); + setScope = tempOut_setScope.get(); + dispatcher.get().argValue.Row = tempRef_Row.get(); + List items = (List)value; + for (Object item : items) { + String elmPath = UUID.NewGuid().toString(); + RefObject tempRef_Row2 = + new RefObject(dispatcher.get().Row); + RowCursor tempCursor; + // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'out' keyword - these + // cannot be converted using the 'OutObject' helper class unless the method is within the code being + // modified: + RowCursor.CreateForAppend(tempRef_Row2, out tempCursor); + dispatcher.get().argValue.Row = tempRef_Row2.get(); + // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'ref' keyword - these + // cannot be converted using the 'RefObject' helper class unless the method is within the code being + // modified: + dispatcher.get().LayoutCodeSwitch(ref tempCursor, elmPath, typeArgs.get(0).getType(), + typeArgs.get(0).getTypeArgs().clone(), item); + + // Move item into the set. + RefObject tempRef_Row3 = + new RefObject(dispatcher.get().Row); + RefObject tempRef_setScope = + new RefObject(setScope); + RefObject tempRef_tempCursor = + new RefObject(tempCursor); + ResultAssert.IsSuccess(t.TypeAs().MoveField(tempRef_Row3, tempRef_setScope, + tempRef_tempCursor)); + tempCursor = tempRef_tempCursor.get(); + setScope = tempRef_setScope.get(); + dispatcher.get().argValue.Row = tempRef_Row3.get(); + } + } + + public void DispatchTuple(RefObject dispatcher, + RefObject scope, LayoutType t, TypeArgumentList typeArgs, + Object value) { + checkArgument(typeArgs.getCount() >= 2); + + RefObject tempRef_Row = + new RefObject(dispatcher.get().Row); + RowCursor tupleScope; + // TODO: C# TO JAVA CONVERTER: The following method call contained an unresolved 'out' keyword - these + // cannot be converted using the 'OutObject' helper class unless the method is within the code being modified: + ResultAssert.IsSuccess(t.TypeAs().WriteScope(tempRef_Row, scope, typeArgs.clone(), + out tupleScope)); + dispatcher.get().argValue.Row = tempRef_Row.get(); + + for (int i = 0; i < typeArgs.getCount(); i++) { + 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 + // cannot be converted using the 'RefObject' helper class unless the method is within the code being + // modified: + dispatcher.get().LayoutCodeSwitch(ref tupleScope, null, typeArgs.get(i).getType(), + typeArgs.get(i).getTypeArgs().clone(), valueAccessor.GetValue(value)); + RefObject tempRef_Row2 = + new RefObject(dispatcher.get().Row); + tupleScope.MoveNext(tempRef_Row2); + dispatcher.get().argValue.Row = tempRef_Row2.get(); + } + } + + public void DispatchUDT(RefObject dispatcher, + RefObject scope, LayoutType t, TypeArgumentList typeArgs, + Object value) { + RefObject tempRef_Row = new RefObject(dispatcher.get().Row); + RowCursor udtScope; + OutObject tempOut_udtScope = new OutObject(); + ResultAssert.IsSuccess(t.TypeAs().WriteScope(tempRef_Row, scope, typeArgs.clone(), tempOut_udtScope)); + udtScope = tempOut_udtScope.get(); + dispatcher.get().argValue.Row = tempRef_Row.get(); + IDispatchable valueDispatcher = value instanceof IDispatchable ? (IDispatchable)value : null; + assert valueDispatcher != null; + RefObject tempRef_udtScope = new RefObject(udtScope); + valueDispatcher.Dispatch(dispatcher, tempRef_udtScope); + udtScope = tempRef_udtScope.get(); + } +} \ No newline at end of file diff --git a/jre/src/test/java/azure/data/cosmos/serialization/hybridrow/unit/customerschema/Address.java b/jre/src/test/java/com/azure/data/cosmos/serialization/hybridrow/unit/customerschema/Address.java similarity index 89% rename from jre/src/test/java/azure/data/cosmos/serialization/hybridrow/unit/customerschema/Address.java rename to jre/src/test/java/com/azure/data/cosmos/serialization/hybridrow/unit/customerschema/Address.java index 55e2b71..753e316 100644 --- a/jre/src/test/java/azure/data/cosmos/serialization/hybridrow/unit/customerschema/Address.java +++ b/jre/src/test/java/com/azure/data/cosmos/serialization/hybridrow/unit/customerschema/Address.java @@ -2,9 +2,9 @@ // Copyright (c) Microsoft Corporation. All rights reserved. //------------------------------------------------------------ -package azure.data.cosmos.serialization.hybridrow.unit.customerschema; +package com.azure.data.cosmos.serialization.hybridrow.unit.customerschema; -import azure.data.cosmos.serialization.hybridrow.Tests.Unit.*; +import azure.data.cosmos.serialization.hybridrow.unit.*; // TODO: C# TO JAVA CONVERTER: There is no preprocessor in Java: ///#pragma warning disable SA1401 // Fields should be private diff --git a/jre/src/test/java/com/azure/data/cosmos/serialization/hybridrow/unit/customerschema/AddressSerializer.java b/jre/src/test/java/com/azure/data/cosmos/serialization/hybridrow/unit/customerschema/AddressSerializer.java new file mode 100644 index 0000000..7f800c5 --- /dev/null +++ b/jre/src/test/java/com/azure/data/cosmos/serialization/hybridrow/unit/customerschema/AddressSerializer.java @@ -0,0 +1,97 @@ +//------------------------------------------------------------ +// Copyright (c) Microsoft Corporation. All rights reserved. +//------------------------------------------------------------ + +package com.azure.data.cosmos.serialization.hybridrow.unit.customerschema; + +import com.azure.data.cosmos.core.OutObject; +import com.azure.data.cosmos.core.RefObject; +import com.azure.data.cosmos.serialization.hybridrow.Result; +import azure.data.cosmos.serialization.hybridrow.unit.*; +import com.azure.data.cosmos.serialization.hybridrow.io.RowReader; + +public final class AddressSerializer { + public static Result Read(RefObject reader, OutObject
obj) { + obj.set(new Address()); + while (reader.get().Read()) { + Result r; + switch (reader.get().getPath()) { + case "street": + OutObject tempOut_Street = new OutObject(); + r = reader.get().ReadString(tempOut_Street); + obj.get().argValue.Street = tempOut_Street.get(); + if (r != Result.Success) { + return r; + } + + break; + case "city": + OutObject tempOut_City = new OutObject(); + r = reader.get().ReadString(tempOut_City); + obj.get().argValue.City = tempOut_City.get(); + if (r != Result.Success) { + return r; + } + + break; + case "state": + OutObject tempOut_State = new OutObject(); + r = reader.get().ReadString(tempOut_State); + obj.get().argValue.State = tempOut_State.get(); + if (r != Result.Success) { + return r; + } + + break; + case "postal_code": + RefObject tempRef_child = + new RefObject(child); + OutObject tempOut_PostalCode = new OutObject(); + // 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(), (ref RowReader child, Address parent) -> PostalCodeSerializer.Read(tempRef_child, tempOut_PostalCode)); + parent.PostalCode = tempOut_PostalCode.get(); + child = tempRef_child.get(); + + if (r != Result.Success) { + return r; + } + + break; + } + } + + return Result.Success; + } + + public static Result Write(RefObject writer, TypeArgument typeArg, Address obj) { + Result r; + if (obj.Street != null) { + r = writer.get().WriteString("street", obj.Street); + if (r != Result.Success) { + return r; + } + } + + if (obj.City != null) { + r = writer.get().WriteString("city", obj.City); + if (r != Result.Success) { + return r; + } + } + + if (obj.State != null) { + r = writer.get().WriteString("state", obj.State); + if (r != Result.Success) { + return r; + } + } + + if (obj.PostalCode != null) { + r = writer.get().WriteScope("postal_code", PostalCodeSerializer.TypeArg, obj.PostalCode, + PostalCodeSerializer.Write); + return r; + } + + return Result.Success; + } +} \ No newline at end of file diff --git a/jre/src/test/java/azure/data/cosmos/serialization/hybridrow/unit/customerschema/Guest.java b/jre/src/test/java/com/azure/data/cosmos/serialization/hybridrow/unit/customerschema/Guest.java similarity index 94% rename from jre/src/test/java/azure/data/cosmos/serialization/hybridrow/unit/customerschema/Guest.java rename to jre/src/test/java/com/azure/data/cosmos/serialization/hybridrow/unit/customerschema/Guest.java index 2c48cfb..3276cdf 100644 --- a/jre/src/test/java/azure/data/cosmos/serialization/hybridrow/unit/customerschema/Guest.java +++ b/jre/src/test/java/com/azure/data/cosmos/serialization/hybridrow/unit/customerschema/Guest.java @@ -2,9 +2,9 @@ // Copyright (c) Microsoft Corporation. All rights reserved. //------------------------------------------------------------ -package azure.data.cosmos.serialization.hybridrow.unit.customerschema; +package com.azure.data.cosmos.serialization.hybridrow.unit.customerschema; -import azure.data.cosmos.serialization.hybridrow.Tests.Unit.*; +import azure.data.cosmos.serialization.hybridrow.unit.*; import java.util.List; import java.util.Map; diff --git a/jre/src/test/java/azure/data/cosmos/serialization/hybridrow/unit/customerschema/Hotel.java b/jre/src/test/java/com/azure/data/cosmos/serialization/hybridrow/unit/customerschema/Hotel.java similarity index 90% rename from jre/src/test/java/azure/data/cosmos/serialization/hybridrow/unit/customerschema/Hotel.java rename to jre/src/test/java/com/azure/data/cosmos/serialization/hybridrow/unit/customerschema/Hotel.java index d57a32f..9a09f06 100644 --- a/jre/src/test/java/azure/data/cosmos/serialization/hybridrow/unit/customerschema/Hotel.java +++ b/jre/src/test/java/com/azure/data/cosmos/serialization/hybridrow/unit/customerschema/Hotel.java @@ -2,9 +2,9 @@ // Copyright (c) Microsoft Corporation. All rights reserved. //------------------------------------------------------------ -package azure.data.cosmos.serialization.hybridrow.unit.customerschema; +package com.azure.data.cosmos.serialization.hybridrow.unit.customerschema; -import azure.data.cosmos.serialization.hybridrow.Tests.Unit.*; +import azure.data.cosmos.serialization.hybridrow.unit.*; // TODO: C# TO JAVA CONVERTER: There is no preprocessor in Java: ///#pragma warning disable SA1401 // Fields should be private diff --git a/jre/src/test/java/azure/data/cosmos/serialization/hybridrow/unit/customerschema/PostalCode.java b/jre/src/test/java/com/azure/data/cosmos/serialization/hybridrow/unit/customerschema/PostalCode.java similarity index 85% rename from jre/src/test/java/azure/data/cosmos/serialization/hybridrow/unit/customerschema/PostalCode.java rename to jre/src/test/java/com/azure/data/cosmos/serialization/hybridrow/unit/customerschema/PostalCode.java index 87f150e..e7a5911 100644 --- a/jre/src/test/java/azure/data/cosmos/serialization/hybridrow/unit/customerschema/PostalCode.java +++ b/jre/src/test/java/com/azure/data/cosmos/serialization/hybridrow/unit/customerschema/PostalCode.java @@ -2,9 +2,9 @@ // Copyright (c) Microsoft Corporation. All rights reserved. //------------------------------------------------------------ -package azure.data.cosmos.serialization.hybridrow.unit.customerschema; +package com.azure.data.cosmos.serialization.hybridrow.unit.customerschema; -import azure.data.cosmos.serialization.hybridrow.Tests.Unit.*; +import azure.data.cosmos.serialization.hybridrow.unit.*; // TODO: C# TO JAVA CONVERTER: There is no preprocessor in Java: ///#pragma warning disable SA1401 // Fields should be private diff --git a/jre/src/test/java/com/azure/data/cosmos/serialization/hybridrow/unit/customerschema/PostalCodeSerializer.java b/jre/src/test/java/com/azure/data/cosmos/serialization/hybridrow/unit/customerschema/PostalCodeSerializer.java new file mode 100644 index 0000000..0fdac89 --- /dev/null +++ b/jre/src/test/java/com/azure/data/cosmos/serialization/hybridrow/unit/customerschema/PostalCodeSerializer.java @@ -0,0 +1,70 @@ +//------------------------------------------------------------ +// Copyright (c) Microsoft Corporation. All rights reserved. +//------------------------------------------------------------ + +package com.azure.data.cosmos.serialization.hybridrow.unit.customerschema; + +import com.azure.data.cosmos.core.OutObject; +import com.azure.data.cosmos.core.RefObject; +import com.azure.data.cosmos.serialization.hybridrow.Result; +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.RowWriter; +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.TypeArgumentList; +import azure.data.cosmos.serialization.hybridrow.unit.*; + +// TODO: C# TO JAVA CONVERTER: There is no preprocessor in Java: +///#pragma warning disable SA1401 // Fields should be private + + +public final class PostalCodeSerializer { + public static TypeArgument TypeArg = new TypeArgument(LayoutType.UDT, new TypeArgumentList(new SchemaId(1))); + + public static Result Read(RefObject reader, OutObject obj) { + obj.set(new PostalCode()); + while (reader.get().Read()) { + Result r; + switch (reader.get().getPath()) { + case "zip": + OutObject tempOut_Zip = new OutObject(); + r = reader.get().ReadInt32(tempOut_Zip); + obj.get().argValue.Zip = tempOut_Zip.get(); + if (r != Result.Success) { + return r; + } + + break; + case "plus4": + short value; + OutObject tempOut_value = new OutObject(); + r = reader.get().ReadInt16(tempOut_value); + value = tempOut_value.get(); + if (r != Result.Success) { + return r; + } + + obj.get().Plus4 = value; + break; + } + } + + return Result.Success; + } + + public static Result Write(RefObject writer, TypeArgument typeArg, PostalCode obj) { + Result r; + r = writer.get().WriteInt32("zip", obj.Zip); + if (r != Result.Success) { + return r; + } + + if (obj.Plus4.HasValue) { + r = writer.get().WriteInt16("plus4", obj.Plus4.Value); + return r; + } + + return Result.Success; + } +} \ No newline at end of file diff --git a/jre/src/test/java/azure/data/cosmos/serialization/hybridrow/unit/internal/MurmurHash3UnitTests.java b/jre/src/test/java/com/azure/data/cosmos/serialization/hybridrow/unit/internal/MurmurHash3UnitTests.java similarity index 60% rename from jre/src/test/java/azure/data/cosmos/serialization/hybridrow/unit/internal/MurmurHash3UnitTests.java rename to jre/src/test/java/com/azure/data/cosmos/serialization/hybridrow/unit/internal/MurmurHash3UnitTests.java index 2ed3034..e7d2d00 100644 --- a/jre/src/test/java/azure/data/cosmos/serialization/hybridrow/unit/internal/MurmurHash3UnitTests.java +++ b/jre/src/test/java/com/azure/data/cosmos/serialization/hybridrow/unit/internal/MurmurHash3UnitTests.java @@ -2,34 +2,17 @@ // Copyright (c) Microsoft Corporation. All rights reserved. //------------------------------------------------------------ -package azure.data.cosmos.serialization.hybridrow.unit.internal; +package com.azure.data.cosmos.serialization.hybridrow.unit.internal; -import azure.data.cosmos.serialization.hybridrow.Tests.Unit.*; +import com.azure.data.cosmos.serialization.hybridrow.internal.MurmurHash3; import java.util.Random; // TODO: C# TO JAVA CONVERTER: Java annotations will not correspond to .NET attributes: //ORIGINAL LINE: [TestClass] public class MurmurHash3UnitTests public class MurmurHash3UnitTests { - { - (0x56F1549659CBEE1A, 0xCEB3EE124C3E3855),(0xFE84B58886F9D717, 0xD24C5DE024F5EA6B), - (0x89F6250648BB11BF, 0x95595FB9D4CF58B0),(0xC76AFDB39EDC6262, 0xB9286AF4FADAF497), - (0xC2CB4D9B3C9C247E, 0xB465D40116B8B7A2),(0x317178F5B26D0B35, 0x1D564F53E2E468AD), - (0xE8D75F7C05F43F09, 0xA81CEA052AE92D6F),(0x8F837665508C08A8, 0x2A74E6E47E5497BC), - (0x609778FDA1AFD731, 0x3EB1A0E3BFC653E4),(0x0F59B8965FA49D1A, 0xCB3BC158243A5DEE), - (0x7A6D0AC9C98F5908, 0xBC93D3042C3E7178),(0x863FE5AEBA9A3DFA, 0xDF42416658CB87C5), - (0xDB4C82337C8FB216, 0xCA7616B64ABF6B3D),(0x0049223177425B48, 0x25510D7246BC3C2C), - (0x31AC129B24F82CAB, 0xCD7174C2040E9834),(0xCE39465288116345, 0x1CE6A26BA2E9E67D), - (0xD2BE55791E13DB17, 0xCF30BF3D93B3A9FA),(0x43E323DD0F079145, 0xF06721555571ABBA), - (0xB0CE9F170A96F5BC, 0x18EE95960369D702),(0xBFFAF6BEBC84A2A9, 0xE0612B6FC0C9D502), - (0x33E2D699697BC2DA, 0xB7E9CD6313DE05EE),(0xCBFD7D8DA2A962BF, 0xCF4C281A7750E88A), - (0xBD8D863F83863088, 0x01AFFBDE3D405D35),(0xBA2E05DF3328C7DB, 0x9620867ADDFE6579), - (0xC57BD1FB63CA0947, 0xE1391F8454D4EA9F),(0x6AB710460A5BF9BA, 0x11D7E13FBEF63775), - (0x55C2C7C95F41C483, 0xA4DCC9F547A89563),(0x8AA5A2031027F216, 0x1653FC7AD6CC6104), - (0xAD8A899FF093D9A5, 0x0EB26F6D1CCEB258),(0xA3B6D57EBEB965D1, 0xE8078FCC5D8C2E3E), - (0x91ABF587B38224F6, 0x35899665A8A9252C),(0xF05B1AF0487EE2D4, 0x5D7496C1665DDE12)} =new Object[] -//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, // 0xCEB3EE124C3E3855UL), (0xFE84B58886F9D717UL, 0xD24C5DE024F5EA6BUL), (0x89F6250648BB11BFUL, // 0x95595FB9D4CF58B0UL), (0xC76AFDB39EDC6262UL, 0xB9286AF4FADAF497UL), (0xC2CB4D9B3C9C247EUL, @@ -47,18 +30,50 @@ public class MurmurHash3UnitTests { // 0xA4DCC9F547A89563UL), (0x8AA5A2031027F216UL, 0x1653FC7AD6CC6104UL), (0xAD8A899FF093D9A5UL, // 0x0EB26F6D1CCEB258UL), (0xA3B6D57EBEB965D1UL, 0xE8078FCC5D8C2E3EUL), (0x91ABF587B38224F6UL, // 0x35899665A8A9252CUL), (0xF05B1AF0487EE2D4UL, 0x5D7496C1665DDE12UL)}; - private static readonly(long low, long high)[] Expected - ; + private static final MurmurHash3.Value[] EXPECTED_VALUES = new MurmurHash3.Value[] { + new MurmurHash3.Value(0x56F1549659CBEE1AL, 0xCEB3EE124C3E3855L), + new MurmurHash3.Value(0xFE84B58886F9D717L, 0xD24C5DE024F5EA6BL), + new MurmurHash3.Value(0x89F6250648BB11BFL, 0x95595FB9D4CF58B0L), + new MurmurHash3.Value(0xC76AFDB39EDC6262L, 0xB9286AF4FADAF497L), + new MurmurHash3.Value(0xC2CB4D9B3C9C247EL, 0xB465D40116B8B7A2L), + new MurmurHash3.Value(0x317178F5B26D0B35L, 0x1D564F53E2E468ADL), + new MurmurHash3.Value(0xE8D75F7C05F43F09L, 0xA81CEA052AE92D6FL), + new MurmurHash3.Value(0x8F837665508C08A8L, 0x2A74E6E47E5497BCL), + new MurmurHash3.Value(0x609778FDA1AFD731L, 0x3EB1A0E3BFC653E4L), + new MurmurHash3.Value(0x0F59B8965FA49D1AL, 0xCB3BC158243A5DEEL), + new MurmurHash3.Value(0x7A6D0AC9C98F5908L, 0xBC93D3042C3E7178L), + new MurmurHash3.Value(0x863FE5AEBA9A3DFAL, 0xDF42416658CB87C5L), + new MurmurHash3.Value(0xDB4C82337C8FB216L, 0xCA7616B64ABF6B3DL), + new MurmurHash3.Value(0x0049223177425B48L, 0x25510D7246BC3C2CL), + new MurmurHash3.Value(0x31AC129B24F82CABL, 0xCD7174C2040E9834L), + new MurmurHash3.Value(0xCE39465288116345L, 0x1CE6A26BA2E9E67DL), + new MurmurHash3.Value(0xD2BE55791E13DB17L, 0xCF30BF3D93B3A9FAL), + new MurmurHash3.Value(0x43E323DD0F079145L, 0xF06721555571ABBAL), + new MurmurHash3.Value(0xB0CE9F170A96F5BCL, 0x18EE95960369D702L), + new MurmurHash3.Value(0xBFFAF6BEBC84A2A9L, 0xE0612B6FC0C9D502L), + new MurmurHash3.Value(0x33E2D699697BC2DAL, 0xB7E9CD6313DE05EEL), + new MurmurHash3.Value(0xCBFD7D8DA2A962BFL, 0xCF4C281A7750E88AL), + new MurmurHash3.Value(0xBD8D863F83863088L, 0x01AFFBDE3D405D35L), + new MurmurHash3.Value(0xBA2E05DF3328C7DBL, 0x9620867ADDFE6579L), + new MurmurHash3.Value(0xC57BD1FB63CA0947L, 0xE1391F8454D4EA9FL), + new MurmurHash3.Value(0x6AB710460A5BF9BAL, 0x11D7E13FBEF63775L), + new MurmurHash3.Value(0x55C2C7C95F41C483L, 0xA4DCC9F547A89563L), + new MurmurHash3.Value(0x8AA5A2031027F216L, 0x1653FC7AD6CC6104L), + new MurmurHash3.Value(0xAD8A899FF093D9A5L, 0x0EB26F6D1CCEB258L), + new MurmurHash3.Value(0xA3B6D57EBEB965D1L, 0xE8078FCC5D8C2E3EL), + new MurmurHash3.Value(0x91ABF587B38224F6L, 0x35899665A8A9252CL), + new MurmurHash3.Value(0xF05B1AF0487EE2D4L, 0x5D7496C1665DDE12L) }; // TODO: C# TO JAVA CONVERTER: Java annotations will not correspond to .NET attributes: - //ORIGINAL LINE: [TestMethod][Owner("jthunter")] public void Hash128Check() + // ORIGINAL LINE: + // [TestMethod][Owner("jthunter")] public void Hash128Check() public final void Hash128Check() { // Generate deterministic data for which the MurmurHash3 is known (see Expected). Random rand = new Random(42); //C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java: //ORIGINAL LINE: byte[][] samples = new byte[MurmurHash3UnitTests.Expected.Length][]; - byte[][] samples = new byte[MurmurHash3UnitTests.Expected.Length][]; + byte[][] samples = new byte[MurmurHash3UnitTests.EXPECTED_VALUES.length][]; for (int i = 0; i < samples.length; i++) { int sampleLength = rand.nextInt(10 * 1024); //C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java: @@ -73,10 +88,10 @@ public class MurmurHash3UnitTests { //ORIGINAL LINE: byte[] sample = samples[i]; byte[] sample = samples[i]; // TODO: C# TO JAVA CONVERTER: Java has no equivalent to C# deconstruction declarations: - ( long low, long high) =MurmurHash3.Hash128(sample, (0, 0)) + ( long low, long high) = MurmurHash3.Hash128(sample, (0, 0)) System.out.println(String.format("(0x%016XUL, 0x%1.16XUL),", high, low)); - assert MurmurHash3UnitTests.Expected[i].high == high; - assert MurmurHash3UnitTests.Expected[i].low == low; + assert MurmurHash3UnitTests.EXPECTED_VALUES[i].high == high; + assert MurmurHash3UnitTests.EXPECTED_VALUES[i].low == low; } // Measure performance.