Renamed jre as java because Java is used to can refer to two things: the platform and the language. In this case we are referring to the Java Platform, not the Java Runtime Environment.

This commit is contained in:
David Noble
2019-09-01 14:26:40 -07:00
parent ab82943fe0
commit 7ae43bf830
193 changed files with 3840 additions and 2117 deletions

View File

@@ -0,0 +1,7 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
package com.azure.data.cosmos.core;
public class Codecs {
}

View File

@@ -3,6 +3,9 @@
package com.azure.data.cosmos.serialization.hybridrow; package com.azure.data.cosmos.serialization.hybridrow;
import it.unimi.dsi.fastutil.ints.Int2ObjectMap;
import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap;
public enum Result { public enum Result {
Success(0), Success(0),
Failure(1), Failure(1),
@@ -40,28 +43,29 @@ public enum Result {
*/ */
Canceled(10); Canceled(10);
public static final int SIZE = java.lang.Integer.SIZE; public static final int SIZE = Integer.SIZE;
private static java.util.HashMap<Integer, Result> mappings;
private int intValue; private static Int2ObjectMap<Result> mappings;
private final int value;
Result(int value) { Result(int value) {
intValue = value; this.value = value;
getMappings().put(value, this); mappings().put(value, this);
} }
public int getValue() { public static Result from(int value) {
return intValue; return mappings().get(value);
} }
public static Result forValue(int value) { public int value() {
return getMappings().get(value); return this.value;
} }
private static java.util.HashMap<Integer, Result> getMappings() { private static Int2ObjectMap<Result> mappings() {
if (mappings == null) { if (mappings == null) {
synchronized (Result.class) { synchronized (Result.class) {
if (mappings == null) { if (mappings == null) {
mappings = new java.util.HashMap<Integer, Result>(); mappings = new Int2ObjectOpenHashMap<>();
} }
} }
} }

View File

@@ -128,8 +128,8 @@ public final class RowCursor implements Cloneable {
return this.endOffset; return this.endOffset;
} }
public RowCursor endOffset(int endOffset) { public RowCursor endOffset(int value) {
this.endOffset = endOffset; this.endOffset = value;
return this; return this;
} }
@@ -140,8 +140,8 @@ public final class RowCursor implements Cloneable {
return this.exists; return this.exists;
} }
public RowCursor exists(boolean exists) { public RowCursor exists(boolean value) {
this.exists = exists; this.exists = value;
return this; return this;
} }
@@ -154,8 +154,8 @@ public final class RowCursor implements Cloneable {
return this.immutable; return this.immutable;
} }
public RowCursor immutable(boolean immutable) { public RowCursor immutable(boolean value) {
this.immutable = immutable; this.immutable = value;
return this; return this;
} }
@@ -166,8 +166,8 @@ public final class RowCursor implements Cloneable {
return this.index; return this.index;
} }
public RowCursor index(int index) { public RowCursor index(int value) {
this.index = index; this.index = value;
return this; return this;
} }
@@ -178,8 +178,8 @@ public final class RowCursor implements Cloneable {
return this.layout; return this.layout;
} }
public RowCursor layout(Layout layout) { public RowCursor layout(Layout value) {
this.layout = layout; this.layout = value;
return this; return this;
} }
@@ -191,8 +191,8 @@ public final class RowCursor implements Cloneable {
return this.metaOffset; return this.metaOffset;
} }
public RowCursor metaOffset(int metaOffset) { public RowCursor metaOffset(final int value) {
this.metaOffset = metaOffset; this.metaOffset = value;
return this; return this;
} }
@@ -203,6 +203,11 @@ public final class RowCursor implements Cloneable {
return this.pathOffset; return this.pathOffset;
} }
public RowCursor pathOffset(final int value) {
this.pathOffset = value;
return this;
}
/** /**
* If existing, the layout string token of scope relative path for reading. * If existing, the layout string token of scope relative path for reading.
*/ */
@@ -210,6 +215,11 @@ public final class RowCursor implements Cloneable {
return this.pathToken; return this.pathToken;
} }
public RowCursor pathToken(int value) {
this.pathToken = value;
return this;
}
/** /**
* The kind of scope within which this edit was prepared * The kind of scope within which this edit was prepared
*/ */

View File

@@ -107,7 +107,7 @@ public final class RowCursors {
return true; return true;
} }
public static void skip(RowCursor edit, RowBuffer row, RowCursor childScope) { public static void skip(@Nonnull final RowCursor edit, @Nonnull final RowBuffer row, @Nonnull final RowCursor childScope) {
checkArgument(childScope.start() == edit.valueOffset()); checkArgument(childScope.start() == edit.valueOffset());

View File

@@ -143,7 +143,7 @@ public final class RowReader {
this.cursor = cursor.get(); this.cursor = cursor.get();
Reference<RowBuffer> row = new Reference<>(this.row); Reference<RowBuffer> row = new Reference<>(this.row);
Reference<RowCursor> tempReference_nullableScope = new Reference<>(nullableScope); Reference<RowCursor> tempReference_nullableScope = new Reference<>(nullableScope);
boolean tempVar = LayoutNullable.HasValue(row, tempReference_nullableScope) == Result.Success; boolean tempVar = LayoutNullable.hasValue(row, tempReference_nullableScope) == Result.Success;
nullableScope = tempReference_nullableScope.get(); nullableScope = tempReference_nullableScope.get();
this.row = row.get(); this.row = row.get();
return tempVar; return tempVar;
@@ -534,7 +534,7 @@ public final class RowReader {
Reference<RowCursor> tempReference_cursor = Reference<RowCursor> tempReference_cursor =
new Reference<RowCursor>(this.cursor); new Reference<RowCursor>(this.cursor);
value.setAndGet(this.row.ReadSparseFloat64(tempReference_cursor)); value.setAndGet(this.row.readSparseFloat64(tempReference_cursor));
this.cursor = tempReference_cursor.get(); this.cursor = tempReference_cursor.get();
return Result.Success; return Result.Success;
default: default:
@@ -561,7 +561,7 @@ public final class RowReader {
Reference<RowCursor> tempReference_cursor = Reference<RowCursor> tempReference_cursor =
new Reference<RowCursor>(this.cursor); new Reference<RowCursor>(this.cursor);
value.setAndGet(this.row.ReadSparseGuid(tempReference_cursor)); value.setAndGet(this.row.readSparseGuid(tempReference_cursor));
this.cursor = tempReference_cursor.get(); this.cursor = tempReference_cursor.get();
return Result.Success; return Result.Success;
default: default:
@@ -588,7 +588,7 @@ public final class RowReader {
Reference<RowCursor> tempReference_cursor = Reference<RowCursor> tempReference_cursor =
new Reference<RowCursor>(this.cursor); new Reference<RowCursor>(this.cursor);
value.setAndGet(this.row.ReadSparseInt16(tempReference_cursor)); value.setAndGet(this.row.readSparseInt16(tempReference_cursor));
this.cursor = tempReference_cursor.get(); this.cursor = tempReference_cursor.get();
return Result.Success; return Result.Success;
default: default:
@@ -615,7 +615,7 @@ public final class RowReader {
Reference<RowCursor> tempReference_cursor = Reference<RowCursor> tempReference_cursor =
new Reference<RowCursor>(this.cursor); new Reference<RowCursor>(this.cursor);
value.setAndGet(this.row.ReadSparseInt32(tempReference_cursor)); value.setAndGet(this.row.readSparseInt32(tempReference_cursor));
this.cursor = tempReference_cursor.get(); this.cursor = tempReference_cursor.get();
return Result.Success; return Result.Success;
default: default:
@@ -642,7 +642,7 @@ public final class RowReader {
Reference<RowCursor> tempReference_cursor = Reference<RowCursor> tempReference_cursor =
new Reference<RowCursor>(this.cursor); new Reference<RowCursor>(this.cursor);
value.setAndGet(this.row.ReadSparseInt64(tempReference_cursor)); value.setAndGet(this.row.readSparseInt64(tempReference_cursor));
this.cursor = tempReference_cursor.get(); this.cursor = tempReference_cursor.get();
return Result.Success; return Result.Success;
default: default:
@@ -669,7 +669,7 @@ public final class RowReader {
Reference<RowCursor> tempReference_cursor = Reference<RowCursor> tempReference_cursor =
new Reference<RowCursor>(this.cursor); new Reference<RowCursor>(this.cursor);
value.setAndGet(this.row.ReadSparseInt8(tempReference_cursor)); value.setAndGet(this.row.readSparseInt8(tempReference_cursor));
this.cursor = tempReference_cursor.get(); this.cursor = tempReference_cursor.get();
return Result.Success; return Result.Success;
default: default:

View File

@@ -398,7 +398,7 @@ public final class RowWriter {
new Reference<RowCursor>(this.cursor); new Reference<RowCursor>(this.cursor);
Out<RowCursor> tempOut_nestedScope2 = Out<RowCursor> tempOut_nestedScope2 =
new Out<RowCursor>(); new Out<RowCursor>();
this.row.WriteSparseArray(tempRef_cursor2, scopeType, UpdateOptions.Upsert, tempOut_nestedScope2); this.row.writeSparseArray(tempRef_cursor2, scopeType, UpdateOptions.Upsert, tempOut_nestedScope2);
nestedScope = tempOut_nestedScope2.get(); nestedScope = tempOut_nestedScope2.get();
this.cursor = tempRef_cursor2.argValue; this.cursor = tempRef_cursor2.argValue;
break; break;

View File

@@ -4,53 +4,48 @@
package com.azure.data.cosmos.serialization.hybridrow.layouts; package com.azure.data.cosmos.serialization.hybridrow.layouts;
import com.azure.data.cosmos.core.Out; import com.azure.data.cosmos.core.Out;
import com.azure.data.cosmos.core.Reference;
import com.azure.data.cosmos.serialization.hybridrow.Result; import com.azure.data.cosmos.serialization.hybridrow.Result;
import com.azure.data.cosmos.serialization.hybridrow.RowBuffer; import com.azure.data.cosmos.serialization.hybridrow.RowBuffer;
import com.azure.data.cosmos.serialization.hybridrow.RowCursor; import com.azure.data.cosmos.serialization.hybridrow.RowCursor;
import javax.annotation.Nonnull;
import static com.azure.data.cosmos.serialization.hybridrow.layouts.LayoutCode.ARRAY_SCOPE; import static com.azure.data.cosmos.serialization.hybridrow.layouts.LayoutCode.ARRAY_SCOPE;
import static com.azure.data.cosmos.serialization.hybridrow.layouts.LayoutCode.IMMUTABLE_ARRAY_SCOPE; import static com.azure.data.cosmos.serialization.hybridrow.layouts.LayoutCode.IMMUTABLE_ARRAY_SCOPE;
public final class LayoutArray extends LayoutIndexedScope { public final class LayoutArray extends LayoutIndexedScope {
private TypeArgument TypeArg = new TypeArgument();
public LayoutArray(boolean immutable) { public LayoutArray(final boolean immutable) {
super(immutable ? IMMUTABLE_ARRAY_SCOPE : ARRAY_SCOPE, immutable, false, false, false, false); super(immutable ? IMMUTABLE_ARRAY_SCOPE : ARRAY_SCOPE, immutable, false, false, false, false);
this.TypeArg = new TypeArgument(this);
} }
public String name() { public String name() {
return this.Immutable ? "im_array" : "array"; return this.isImmutable() ? "im_array" : "array";
}
public TypeArgument typeArg() {
return TypeArg;
} }
@Override @Override
public Result WriteScope( public Result writeScope(
Reference<RowBuffer> b, @Nonnull final RowBuffer b,
Reference<RowCursor> edit, @Nonnull final RowCursor edit,
TypeArgumentList typeArgs, @Nonnull final TypeArgumentList typeArgs,
Out<RowCursor> value @Nonnull Out<RowCursor> value
) { ) {
return WriteScope(b, edit, typeArgs, value, UpdateOptions.Upsert); return this.writeScope(b, edit, typeArgs, UpdateOptions.Upsert, value);
} }
//C# TO JAVA CONVERTER NOTE: Java does not support optional parameters. Overloaded method(s) are created above: //C# TO JAVA CONVERTER NOTE: Java does not support optional parameters. Overloaded method(s) are created above:
//ORIGINAL LINE: public override Result WriteScope(ref RowBuffer b, ref RowCursor edit, TypeArgumentList //ORIGINAL LINE: public override Result WriteScope(ref RowBuffer b, ref RowCursor edit, TypeArgumentList
// typeArgs, out RowCursor value, UpdateOptions options = UpdateOptions.Upsert) // typeArgs, out RowCursor value, UpdateOptions options = UpdateOptions.Upsert)
@Override @Override
public Result WriteScope(Reference<RowBuffer> b, Reference<RowCursor> edit, public Result writeScope(RowBuffer b, RowCursor edit,
TypeArgumentList typeArgs, Out<RowCursor> value, UpdateOptions options) { TypeArgumentList typeArgs, UpdateOptions options, Out<RowCursor> value) {
Result result = prepareSparseWrite(b, edit, this.typeArg().clone(), options); Result result = prepareSparseWrite(b, edit, this.typeArg(), options);
if (result != Result.Success) { if (result != Result.Success) {
value.setAndGet(null); value.setAndGet(null);
return result; return result;
} }
b.get().WriteSparseArray(edit, this, options, value.clone()); b.writeSparseArray(edit, this, options, value);
return Result.Success; return Result.Success;
} }
} }

View File

@@ -11,12 +11,12 @@ public final class LayoutBit {
*/ */
public static final LayoutBit INVALID = new LayoutBit(-1); public static final LayoutBit INVALID = new LayoutBit(-1);
private int index; private final int index;
/** /**
* Initializes a new instance of the {@link LayoutBit} struct. * Initializes a new instance of the {@link LayoutBit} struct.
* *
* @param index The 0-based offset into the layout bitmask. * @param index The zero-based offset into the layout bitmask.
*/ */
public LayoutBit(int index) { public LayoutBit(int index) {
checkArgument(index >= -1); checkArgument(index >= -1);
@@ -52,6 +52,10 @@ public final class LayoutBit {
return this.index; return this.index;
} }
public boolean isInvalid() {
return this.index == INVALID.index;
}
/** /**
* Returns the zero-based byte offset from the beginning of the row or scope that contains the bit from the bitmask * Returns the zero-based byte offset from the beginning of the row or scope that contains the bit from the bitmask
* <p> * <p>

View File

@@ -4,7 +4,6 @@
package com.azure.data.cosmos.serialization.hybridrow.layouts; package com.azure.data.cosmos.serialization.hybridrow.layouts;
import com.azure.data.cosmos.core.Out; import com.azure.data.cosmos.core.Out;
import com.azure.data.cosmos.core.Reference;
import com.azure.data.cosmos.serialization.hybridrow.Result; import com.azure.data.cosmos.serialization.hybridrow.Result;
import com.azure.data.cosmos.serialization.hybridrow.RowBuffer; import com.azure.data.cosmos.serialization.hybridrow.RowBuffer;
import com.azure.data.cosmos.serialization.hybridrow.RowCursor; import com.azure.data.cosmos.serialization.hybridrow.RowCursor;
@@ -25,17 +24,17 @@ public final class LayoutEndScope extends LayoutScope {
@Override @Override
public Result WriteScope(Reference<RowBuffer> b, Reference<RowCursor> scope, public Result writeScope(RowBuffer b, RowCursor scope,
TypeArgumentList typeArgs, Out<RowCursor> value) { TypeArgumentList typeArgs, Out<RowCursor> value) {
return WriteScope(b, scope, typeArgs, value, UpdateOptions.Upsert); return writeScope(b, scope, typeArgs, UpdateOptions.Upsert, value);
} }
//C# TO JAVA CONVERTER NOTE: Java does not support optional parameters. Overloaded method(s) are created above: //C# TO JAVA CONVERTER NOTE: Java does not support optional parameters. Overloaded method(s) are created above:
//ORIGINAL LINE: public override Result WriteScope(ref RowBuffer b, ref RowCursor scope, TypeArgumentList //ORIGINAL LINE: public override Result WriteScope(ref RowBuffer b, ref RowCursor scope, TypeArgumentList
// typeArgs, out RowCursor value, UpdateOptions options = UpdateOptions.Upsert) // typeArgs, out RowCursor value, UpdateOptions options = UpdateOptions.Upsert)
@Override @Override
public Result WriteScope(Reference<RowBuffer> b, Reference<RowCursor> scope, public Result writeScope(RowBuffer b, RowCursor scope,
TypeArgumentList typeArgs, Out<RowCursor> value, UpdateOptions options) { TypeArgumentList typeArgs, UpdateOptions options, Out<RowCursor> value) {
Contract.Fail("Cannot write an EndScope directly"); Contract.Fail("Cannot write an EndScope directly");
value.setAndGet(null); value.setAndGet(null);
return Result.Failure; return Result.Failure;

View File

@@ -3,23 +3,23 @@
package com.azure.data.cosmos.serialization.hybridrow.layouts; package com.azure.data.cosmos.serialization.hybridrow.layouts;
import com.azure.data.cosmos.core.Reference;
import com.azure.data.cosmos.core.Reference;
import com.azure.data.cosmos.serialization.hybridrow.RowBuffer; import com.azure.data.cosmos.serialization.hybridrow.RowBuffer;
import com.azure.data.cosmos.serialization.hybridrow.RowCursor; import com.azure.data.cosmos.serialization.hybridrow.RowCursor;
import javax.annotation.Nonnull;
public abstract class LayoutIndexedScope extends LayoutScope { public abstract class LayoutIndexedScope extends LayoutScope {
protected LayoutIndexedScope( protected LayoutIndexedScope(
LayoutCode code, boolean immutable, boolean isSizedScope, boolean isFixedArity, boolean isUniqueScope, @Nonnull final LayoutCode code, final boolean immutable, final boolean isSizedScope, final boolean isFixedArity,
boolean isTypedScope final boolean isUniqueScope, final boolean isTypedScope) {
) {
super(code, immutable, isSizedScope, true, isFixedArity, isUniqueScope, isTypedScope); super(code, immutable, isSizedScope, true, isFixedArity, isUniqueScope, isTypedScope);
} }
@Override @Override
public void ReadSparsePath(Reference<RowBuffer> row, Reference<RowCursor> edit) { public void readSparsePath(@Nonnull final RowBuffer row, @Nonnull final RowCursor edit) {
edit.get().pathToken = 0; edit.pathToken(0);
edit.get().pathOffset = 0; edit.pathOffset(0);
} }
} }

View File

@@ -9,7 +9,10 @@ import com.azure.data.cosmos.serialization.hybridrow.Result;
import com.azure.data.cosmos.serialization.hybridrow.RowBuffer; import com.azure.data.cosmos.serialization.hybridrow.RowBuffer;
import com.azure.data.cosmos.serialization.hybridrow.RowCursor; import com.azure.data.cosmos.serialization.hybridrow.RowCursor;
import javax.annotation.Nonnull;
import static com.google.common.base.Preconditions.checkArgument; 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.Preconditions.checkState;
public final class LayoutNullable extends LayoutIndexedScope { public final class LayoutNullable extends LayoutIndexedScope {
@@ -22,49 +25,53 @@ public final class LayoutNullable extends LayoutIndexedScope {
return this.Immutable ? "im_nullable" : "nullable"; return this.Immutable ? "im_nullable" : "nullable";
} }
public int countTypeArgument(TypeArgumentList value) { public int countTypeArgument(@Nonnull final TypeArgumentList value) {
checkState(value.count() == 1); checkNotNull(value, "expected non-null value");
return (com.azure.data.cosmos.serialization.hybridrow.layouts.LayoutCode.SIZE / Byte.SIZE) + value.get(0).type().CountTypeArgument(value.get(0).typeArgs().clone()); checkArgument(value.count() == 1);
return (LayoutCode.SIZE / Byte.SIZE) + value.get(0).type().countTypeArgument(value.get(0).typeArgs());
} }
@Override @Override
public boolean HasImplicitTypeCode(Reference<RowCursor> edit) { public boolean hasImplicitTypeCode(@Nonnull final RowCursor edit) {
checkState(edit.get().index() >= 0); checkNotNull(edit, "expected non-null edit");
checkState(edit.get().scopeTypeArgs().count() == 1); checkArgument(edit.index() >= 0);
checkState(edit.get().index() == 1); checkArgument(edit.scopeTypeArgs().count() == 1);
return !LayoutCodeTraits.AlwaysRequiresTypeCode(edit.get().scopeTypeArgs().get(0).type().LayoutCode); checkArgument(edit.index() == 1);
return !LayoutCodeTraits.AlwaysRequiresTypeCode(edit.scopeTypeArgs().get(0).type().layoutCode());
} }
public static Result HasValue(Reference<RowBuffer> b, Reference<RowCursor> scope) { public static Result hasValue(@Nonnull final RowBuffer b, @Nonnull final RowCursor scope) {
checkArgument(scope.get().scopeType() instanceof LayoutNullable); checkNotNull(b);
checkState(scope.get().index() == 1 || scope.get().index() == 2, "Nullable scopes always point at the value"); checkNotNull(scope);
checkState(scope.get().scopeTypeArgs().count() == 1); checkArgument(scope.scopeType() instanceof LayoutNullable);
boolean hasValue = b.get().ReadInt8(scope.get().start()) != 0; checkArgument(scope.index() == 1 || scope.index() == 2);
checkArgument(scope.scopeTypeArgs().count() == 1);
boolean hasValue = b.readInt8(scope.start()) != 0;
return hasValue ? Result.Success : Result.NotFound; return hasValue ? Result.Success : Result.NotFound;
} }
@Override @Override
public TypeArgumentList readTypeArgumentList(Reference<RowBuffer> row, int offset, public TypeArgumentList readTypeArgumentList(
Out<Integer> lenInBytes) { @Nonnull final RowBuffer row, int offset, @Nonnull final Out<Integer> lenInBytes) {
return new TypeArgumentList(new TypeArgument[] { LayoutType.readTypeArgument(row, offset, lenInBytes) }); return new TypeArgumentList(LayoutType.readTypeArgument(row, offset, lenInBytes));
} }
@Override @Override
public void SetImplicitTypeCode(Reference<RowCursor> edit) { public void setImplicitTypeCode(RowCursor edit) {
checkState(edit.get().index() == 1); checkState(edit.index() == 1);
edit.get().cellType = edit.get().scopeTypeArgs().get(0).type(); edit.get().cellType(edit.get().scopeTypeArgs().get(0).type());
edit.get().cellTypeArgs = edit.get().scopeTypeArgs().get(0).typeArgs().clone(); edit.get().cellTypeArgs(edit.get().scopeTypeArgs().get(0).typeArgs());
} }
public Result WriteScope(Reference<RowBuffer> b, Reference<RowCursor> edit, public Result writeScope(Reference<RowBuffer> b, Reference<RowCursor> edit,
TypeArgumentList typeArgs, boolean hasValue, Out<RowCursor> value) { TypeArgumentList typeArgs, boolean hasValue, Out<RowCursor> value) {
return WriteScope(b, edit, typeArgs, hasValue, value, UpdateOptions.Upsert); 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: //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 //ORIGINAL LINE: public Result WriteScope(ref RowBuffer b, ref RowCursor edit, TypeArgumentList typeArgs, bool
// hasValue, out RowCursor value, UpdateOptions options = UpdateOptions.Upsert) // hasValue, out RowCursor value, UpdateOptions options = UpdateOptions.Upsert)
public Result WriteScope(Reference<RowBuffer> b, Reference<RowCursor> edit, public Result writeScope(Reference<RowBuffer> b, Reference<RowCursor> edit,
TypeArgumentList typeArgs, boolean hasValue, Out<RowCursor> value, TypeArgumentList typeArgs, boolean hasValue, Out<RowCursor> value,
UpdateOptions options) { UpdateOptions options) {
Result result = LayoutType.prepareSparseWrite(b, edit, new TypeArgument(this, typeArgs.clone()), options); Result result = LayoutType.prepareSparseWrite(b, edit, new TypeArgument(this, typeArgs.clone()), options);
@@ -78,17 +85,17 @@ public final class LayoutNullable extends LayoutIndexedScope {
} }
@Override @Override
public Result WriteScope(Reference<RowBuffer> b, Reference<RowCursor> edit, public Result writeScope(RowBuffer b, RowCursor edit,
TypeArgumentList typeArgs, Out<RowCursor> value) { TypeArgumentList typeArgs, Out<RowCursor> value) {
return WriteScope(b, edit, typeArgs, value, UpdateOptions.Upsert); return writeScope(b, edit, typeArgs, UpdateOptions.Upsert, value);
} }
//C# TO JAVA CONVERTER NOTE: Java does not support optional parameters. Overloaded method(s) are created above: //C# TO JAVA CONVERTER NOTE: Java does not support optional parameters. Overloaded method(s) are created above:
//ORIGINAL LINE: public override Result WriteScope(ref RowBuffer b, ref RowCursor edit, TypeArgumentList //ORIGINAL LINE: public override Result WriteScope(ref RowBuffer b, ref RowCursor edit, TypeArgumentList
// typeArgs, out RowCursor value, UpdateOptions options = UpdateOptions.Upsert) // typeArgs, out RowCursor value, UpdateOptions options = UpdateOptions.Upsert)
@Override @Override
public Result WriteScope(Reference<RowBuffer> b, Reference<RowCursor> edit, public Result writeScope(RowBuffer b, RowCursor edit,
TypeArgumentList typeArgs, Out<RowCursor> value, UpdateOptions options) { TypeArgumentList typeArgs, UpdateOptions options, Out<RowCursor> value) {
return this.WriteScope(b, edit, typeArgs.clone(), true, value, options); return this.WriteScope(b, edit, typeArgs.clone(), true, value, options);
} }

View File

@@ -4,7 +4,6 @@
package com.azure.data.cosmos.serialization.hybridrow.layouts; package com.azure.data.cosmos.serialization.hybridrow.layouts;
import com.azure.data.cosmos.core.Out; import com.azure.data.cosmos.core.Out;
import com.azure.data.cosmos.core.Reference;
import com.azure.data.cosmos.serialization.hybridrow.Result; import com.azure.data.cosmos.serialization.hybridrow.Result;
import com.azure.data.cosmos.serialization.hybridrow.RowBuffer; import com.azure.data.cosmos.serialization.hybridrow.RowBuffer;
import com.azure.data.cosmos.serialization.hybridrow.RowCursor; import com.azure.data.cosmos.serialization.hybridrow.RowCursor;
@@ -28,17 +27,17 @@ public final class LayoutObject extends LayoutPropertyScope {
@Override @Override
public Result WriteScope(Reference<RowBuffer> b, Reference<RowCursor> edit, public Result writeScope(RowBuffer b, RowCursor edit,
TypeArgumentList typeArgs, Out<RowCursor> value) { TypeArgumentList typeArgs, Out<RowCursor> value) {
return WriteScope(b, edit, typeArgs, value, UpdateOptions.Upsert); return writeScope(b, edit, typeArgs, UpdateOptions.Upsert, value);
} }
//C# TO JAVA CONVERTER NOTE: Java does not support optional parameters. Overloaded method(s) are created above: //C# TO JAVA CONVERTER NOTE: Java does not support optional parameters. Overloaded method(s) are created above:
//ORIGINAL LINE: public override Result WriteScope(ref RowBuffer b, ref RowCursor edit, TypeArgumentList //ORIGINAL LINE: public override Result WriteScope(ref RowBuffer b, ref RowCursor edit, TypeArgumentList
// typeArgs, out RowCursor value, UpdateOptions options = UpdateOptions.Upsert) // typeArgs, out RowCursor value, UpdateOptions options = UpdateOptions.Upsert)
@Override @Override
public Result WriteScope(Reference<RowBuffer> b, Reference<RowCursor> edit, public Result writeScope(RowBuffer b, RowCursor edit,
TypeArgumentList typeArgs, Out<RowCursor> value, UpdateOptions options) { TypeArgumentList typeArgs, UpdateOptions options, Out<RowCursor> value) {
Result result = LayoutType.prepareSparseWrite(b, edit, this.typeArg().clone(), options); Result result = LayoutType.prepareSparseWrite(b, edit, this.typeArg().clone(), options);
if (result != Result.Success) { if (result != Result.Success) {
value.setAndGet(null); value.setAndGet(null);

View File

@@ -0,0 +1,194 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
package com.azure.data.cosmos.serialization.hybridrow.layouts;
import com.azure.data.cosmos.core.Out;
import com.azure.data.cosmos.core.Reference;
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.RowCursors;
import javax.annotation.Nonnull;
import static com.google.common.base.Preconditions.checkNotNull;
public abstract class LayoutScope extends LayoutType {
private final boolean isFixedArity;
private final boolean isIndexedScope;
private final boolean isSizedScope;
private final boolean isTypedScope;
private final boolean isUniqueScope;
protected LayoutScope(
@Nonnull final LayoutCode code, final boolean immutable, final boolean isSizedScope,
final boolean isIndexedScope, final boolean isFixedArity, final boolean isUniqueScope, boolean isTypedScope) {
super(code, immutable, 0);
this.isSizedScope = isSizedScope;
this.isIndexedScope = isIndexedScope;
this.isFixedArity = isFixedArity;
this.isUniqueScope = isUniqueScope;
this.isTypedScope = isTypedScope;
}
/**
* Returns true if this is a fixed arity scope.
*/
public boolean isFixedArity() {
return this.isFixedArity;
}
/**
* Returns true if this is an indexed scope.
*/
public boolean isIndexedScope() {
return this.isIndexedScope;
}
/**
* Returns true if this is a sized scope.
*/
public boolean isSizedScope() {
return this.isSizedScope;
}
/**
* Returns true if this is a typed scope.
*/
public boolean isTypedScope() {
return this.isTypedScope;
}
/**
* Returns true if the scope's elements cannot be updated directly.
*/
public boolean isUniqueScope() {
return this.isUniqueScope;
}
public final Result deleteScope(@Nonnull final RowBuffer b, @Nonnull final RowCursor edit) {
checkNotNull(b);
checkNotNull(edit);
Result result = LayoutType.prepareSparseDelete(b, edit, this.layoutCode());
if (result != Result.Success) {
return result;
}
b.deleteSparse(edit);
return Result.Success;
}
/**
* {@code true} if writing an item in the specified typed scope would elide the type code because it is implied by
* the type arguments
*
* @param edit a non-null {@link RowCursor} specifying a typed scope
* @return {@code true} if the type code is implied (not written); {@code false} otherwise.
*/
public boolean hasImplicitTypeCode(@Nonnull final RowCursor edit) {
checkNotNull(edit, "expected non-null edit");
return false;
}
@Nonnull
public final Result readScope(
@Nonnull final RowBuffer b, @Nonnull final RowCursor edit, @Nonnull final Out<RowCursor> value) {
checkNotNull(b);
checkNotNull(edit);
checkNotNull(value);
Result result = LayoutType.prepareSparseRead(b, edit, this.layoutCode());
if (result != Result.Success) {
value.setAndGet(null);
return result;
}
boolean immutable = this.isImmutable() || edit.immutable() || edit.scopeType().isUniqueScope();
value.set(b.sparseIteratorReadScope(edit, immutable));
return Result.Success;
}
public void readSparsePath(@Nonnull final RowBuffer row, @Nonnull final RowCursor edit) {
Out<Integer> pathLenInBytes = new Out<>();
Out<Integer> pathOffset = new Out<>();
edit.pathToken(row.readSparsePathLen(edit.layout(), edit.valueOffset(), pathLenInBytes, pathOffset));
edit.pathOffset(pathOffset.get());
edit.valueOffset(edit.valueOffset() + pathLenInBytes.get());
}
public void setImplicitTypeCode(final RowCursor edit) {
throw new UnsupportedOperationException();
}
public abstract Result writeScope(
RowBuffer b,
RowCursor scope,
TypeArgumentList typeArgs, Out<RowCursor> value);
public abstract Result writeScope(
RowBuffer b,
RowCursor scope,
TypeArgumentList typeArgs,
UpdateOptions options, Out<RowCursor> value);
public <TContext> Result writeScope(
RowBuffer b,
RowCursor scope,
TypeArgumentList typeArgs,
TContext context, WriterFunc<TContext> func) {
return this.writeScope(b, scope, typeArgs, context, func, UpdateOptions.Upsert);
}
//C# TO JAVA CONVERTER NOTE: Java does not support optional parameters. Overloaded method(s) are created above:
//ORIGINAL LINE: public virtual Result WriteScope<TContext>(ref RowBuffer b, ref RowCursor scope,
// TypeArgumentList typeArgs, TContext context, WriterFunc<TContext> func, UpdateOptions options = UpdateOptions
// .Upsert)
public <TContext> Result writeScope(
RowBuffer b,
RowCursor scope,
TypeArgumentList typeArgs,
TContext context, WriterFunc<TContext> func, UpdateOptions options) {
final Out<RowCursor> out = new Out<>();
Result result = this.writeScope(b, scope, typeArgs, options, out);
if (result != Result.Success) {
return result;
}
final RowCursor childScope = out.get();
if (func != null) {
result = func.invoke(b, childScope, context);
if (result != Result.Success) {
this.deleteScope(b, scope);
return result;
}
}
RowCursors.skip(scope, b, childScope);
return Result.Success;
}
/**
* A function to write content into a {@link RowBuffer}.
* <typeparam name="TContext">The type of the context value passed by the caller.</typeparam>
*
* @param b The row to write to.
* @param scope The type of the scope to write into.
* @param context A context value provided by the caller.
* @return The result.
*/
@FunctionalInterface
public interface WriterFunc<TContext> {
@Nonnull Result invoke(RowBuffer b, RowCursor scope, TContext context);
}
}

View File

@@ -43,23 +43,23 @@ public final class LayoutTagged extends LayoutIndexedScope {
} }
@Override @Override
public void SetImplicitTypeCode(Reference<RowCursor> edit) { public void setImplicitTypeCode(RowCursor edit) {
edit.get().cellType = edit.get().scopeTypeArgs().get(edit.get().index()).type(); edit.get().cellType = edit.get().scopeTypeArgs().get(edit.get().index()).type();
edit.get().cellTypeArgs = edit.get().scopeTypeArgs().get(edit.get().index()).typeArgs().clone(); edit.get().cellTypeArgs = edit.get().scopeTypeArgs().get(edit.get().index()).typeArgs().clone();
} }
@Override @Override
public Result WriteScope(Reference<RowBuffer> b, Reference<RowCursor> edit, public Result writeScope(RowBuffer b, RowCursor edit,
TypeArgumentList typeArgs, Out<RowCursor> value) { TypeArgumentList typeArgs, Out<RowCursor> value) {
return WriteScope(b, edit, typeArgs, value, UpdateOptions.Upsert); return writeScope(b, edit, typeArgs, UpdateOptions.Upsert, value);
} }
//C# TO JAVA CONVERTER NOTE: Java does not support optional parameters. Overloaded method(s) are created above: //C# TO JAVA CONVERTER NOTE: Java does not support optional parameters. Overloaded method(s) are created above:
//ORIGINAL LINE: public override Result WriteScope(ref RowBuffer b, ref RowCursor edit, TypeArgumentList //ORIGINAL LINE: public override Result WriteScope(ref RowBuffer b, ref RowCursor edit, TypeArgumentList
// typeArgs, out RowCursor value, UpdateOptions options = UpdateOptions.Upsert) // typeArgs, out RowCursor value, UpdateOptions options = UpdateOptions.Upsert)
@Override @Override
public Result WriteScope(Reference<RowBuffer> b, Reference<RowCursor> edit, public Result writeScope(RowBuffer b, RowCursor edit,
TypeArgumentList typeArgs, Out<RowCursor> value, UpdateOptions options) { TypeArgumentList typeArgs, UpdateOptions options, Out<RowCursor> value) {
Result result = prepareSparseWrite(b, edit, new TypeArgument(this, typeArgs.clone()), options); Result result = prepareSparseWrite(b, edit, new TypeArgument(this, typeArgs.clone()), options);
if (result != Result.Success) { if (result != Result.Success) {
value.setAndGet(null); value.setAndGet(null);

View File

@@ -56,23 +56,23 @@ public final class LayoutTagged2 extends LayoutIndexedScope {
} }
@Override @Override
public void SetImplicitTypeCode(Reference<RowCursor> edit) { public void setImplicitTypeCode(RowCursor edit) {
edit.get().cellType = edit.get().scopeTypeArgs().get(edit.get().index()).type(); edit.get().cellType = edit.get().scopeTypeArgs().get(edit.get().index()).type();
edit.get().cellTypeArgs = edit.get().scopeTypeArgs().get(edit.get().index()).typeArgs().clone(); edit.get().cellTypeArgs = edit.get().scopeTypeArgs().get(edit.get().index()).typeArgs().clone();
} }
@Override @Override
public Result WriteScope(Reference<RowBuffer> b, Reference<RowCursor> edit, public Result writeScope(RowBuffer b, RowCursor edit,
TypeArgumentList typeArgs, Out<RowCursor> value) { TypeArgumentList typeArgs, Out<RowCursor> value) {
return WriteScope(b, edit, typeArgs, value, UpdateOptions.Upsert); return writeScope(b, edit, typeArgs, UpdateOptions.Upsert, value);
} }
//C# TO JAVA CONVERTER NOTE: Java does not support optional parameters. Overloaded method(s) are created above: //C# TO JAVA CONVERTER NOTE: Java does not support optional parameters. Overloaded method(s) are created above:
//ORIGINAL LINE: public override Result WriteScope(ref RowBuffer b, ref RowCursor edit, TypeArgumentList //ORIGINAL LINE: public override Result WriteScope(ref RowBuffer b, ref RowCursor edit, TypeArgumentList
// typeArgs, out RowCursor value, UpdateOptions options = UpdateOptions.Upsert) // typeArgs, out RowCursor value, UpdateOptions options = UpdateOptions.Upsert)
@Override @Override
public Result WriteScope(Reference<RowBuffer> b, Reference<RowCursor> edit, public Result writeScope(RowBuffer b, RowCursor edit,
TypeArgumentList typeArgs, Out<RowCursor> value, UpdateOptions options) { TypeArgumentList typeArgs, UpdateOptions options, Out<RowCursor> value) {
Result result = prepareSparseWrite(b, edit, new TypeArgument(this, typeArgs.clone()), options); Result result = prepareSparseWrite(b, edit, new TypeArgument(this, typeArgs.clone()), options);
if (result != Result.Success) { if (result != Result.Success) {
value.setAndGet(null); value.setAndGet(null);

View File

@@ -50,17 +50,17 @@ public final class LayoutTuple extends LayoutIndexedScope {
} }
@Override @Override
public Result WriteScope(Reference<RowBuffer> b, Reference<RowCursor> edit, public Result writeScope(RowBuffer b, RowCursor edit,
TypeArgumentList typeArgs, Out<RowCursor> value) { TypeArgumentList typeArgs, Out<RowCursor> value) {
return WriteScope(b, edit, typeArgs, value, UpdateOptions.Upsert); return writeScope(b, edit, typeArgs, UpdateOptions.Upsert, value);
} }
//C# TO JAVA CONVERTER NOTE: Java does not support optional parameters. Overloaded method(s) are created above: //C# TO JAVA CONVERTER NOTE: Java does not support optional parameters. Overloaded method(s) are created above:
//ORIGINAL LINE: public override Result WriteScope(ref RowBuffer b, ref RowCursor edit, TypeArgumentList //ORIGINAL LINE: public override Result WriteScope(ref RowBuffer b, ref RowCursor edit, TypeArgumentList
// typeArgs, out RowCursor value, UpdateOptions options = UpdateOptions.Upsert) // typeArgs, out RowCursor value, UpdateOptions options = UpdateOptions.Upsert)
@Override @Override
public Result WriteScope(Reference<RowBuffer> b, Reference<RowCursor> edit, public Result writeScope(RowBuffer b, RowCursor edit,
TypeArgumentList typeArgs, Out<RowCursor> value, UpdateOptions options) { TypeArgumentList typeArgs, UpdateOptions options, Out<RowCursor> value) {
Result result = prepareSparseWrite(b, edit, new TypeArgument(this, typeArgs.clone()), options); Result result = prepareSparseWrite(b, edit, new TypeArgument(this, typeArgs.clone()), options);
if (result != Result.Success) { if (result != Result.Success) {
value.setAndGet(null); value.setAndGet(null);

View File

@@ -287,13 +287,14 @@ public abstract class LayoutType<T> implements ILayoutType {
* @param code The expected type of the field. * @param code The expected type of the field.
* @return Success if the read is permitted, the error code otherwise. * @return Success if the read is permitted, the error code otherwise.
*/ */
public static Result prepareSparseRead(Reference<RowBuffer> b, Reference<RowCursor> edit, LayoutCode code) { public static Result prepareSparseRead(
@Nonnull final RowBuffer b, @Nonnull final RowCursor edit, @Nonnull LayoutCode code) {
if (!edit.get().exists()) { if (!edit.exists()) {
return Result.NotFound; return Result.NotFound;
} }
if (LayoutCodeTraits.Canonicalize(edit.get().cellType().layoutCode()) != code) { if (LayoutCodeTraits.Canonicalize(edit.cellType().layoutCode()) != code) {
return Result.TypeMismatch; return Result.TypeMismatch;
} }

View File

@@ -38,23 +38,23 @@ public final class LayoutTypedArray extends LayoutIndexedScope {
} }
@Override @Override
public void SetImplicitTypeCode(Reference<RowCursor> edit) { public void setImplicitTypeCode(RowCursor edit) {
edit.get().cellType = edit.get().scopeTypeArgs().get(0).type(); edit.get().cellType = edit.get().scopeTypeArgs().get(0).type();
edit.get().cellTypeArgs = edit.get().scopeTypeArgs().get(0).typeArgs().clone(); edit.get().cellTypeArgs = edit.get().scopeTypeArgs().get(0).typeArgs().clone();
} }
@Override @Override
public Result WriteScope(Reference<RowBuffer> b, Reference<RowCursor> edit, public Result writeScope(RowBuffer b, RowCursor edit,
TypeArgumentList typeArgs, Out<RowCursor> value) { TypeArgumentList typeArgs, Out<RowCursor> value) {
return WriteScope(b, edit, typeArgs, value, UpdateOptions.Upsert); return writeScope(b, edit, typeArgs, UpdateOptions.Upsert, value);
} }
//C# TO JAVA CONVERTER NOTE: Java does not support optional parameters. Overloaded method(s) are created above: //C# TO JAVA CONVERTER NOTE: Java does not support optional parameters. Overloaded method(s) are created above:
//ORIGINAL LINE: public override Result WriteScope(ref RowBuffer b, ref RowCursor edit, TypeArgumentList //ORIGINAL LINE: public override Result WriteScope(ref RowBuffer b, ref RowCursor edit, TypeArgumentList
// typeArgs, out RowCursor value, UpdateOptions options = UpdateOptions.Upsert) // typeArgs, out RowCursor value, UpdateOptions options = UpdateOptions.Upsert)
@Override @Override
public Result WriteScope(Reference<RowBuffer> b, Reference<RowCursor> edit, public Result writeScope(RowBuffer b, RowCursor edit,
TypeArgumentList typeArgs, Out<RowCursor> value, UpdateOptions options) { TypeArgumentList typeArgs, UpdateOptions options, Out<RowCursor> value) {
Result result = LayoutType.prepareSparseWrite(b, edit, new TypeArgument(this, typeArgs.clone()), options); Result result = LayoutType.prepareSparseWrite(b, edit, new TypeArgument(this, typeArgs.clone()), options);
if (result != Result.Success) { if (result != Result.Success) {
value.setAndGet(null); value.setAndGet(null);

View File

@@ -58,24 +58,24 @@ public final class LayoutTypedMap extends LayoutUniqueScope {
} }
@Override @Override
public void SetImplicitTypeCode(Reference<RowCursor> edit) { public void setImplicitTypeCode(RowCursor edit) {
edit.get().cellType = edit.get().scopeType().Immutable ? ImmutableTypedTuple : edit.get().cellType = edit.get().scopeType().Immutable ? ImmutableTypedTuple :
TypedTuple; TypedTuple;
edit.get().cellTypeArgs = edit.get().scopeTypeArgs().clone(); edit.get().cellTypeArgs = edit.get().scopeTypeArgs().clone();
} }
@Override @Override
public Result WriteScope(Reference<RowBuffer> b, Reference<RowCursor> edit, public Result writeScope(RowBuffer b, RowCursor edit,
TypeArgumentList typeArgs, Out<RowCursor> value) { TypeArgumentList typeArgs, Out<RowCursor> value) {
return WriteScope(b, edit, typeArgs, value, UpdateOptions.Upsert); return writeScope(b, edit, typeArgs, UpdateOptions.Upsert, value);
} }
//C# TO JAVA CONVERTER NOTE: Java does not support optional parameters. Overloaded method(s) are created above: //C# TO JAVA CONVERTER NOTE: Java does not support optional parameters. Overloaded method(s) are created above:
//ORIGINAL LINE: public override Result WriteScope(ref RowBuffer b, ref RowCursor edit, TypeArgumentList //ORIGINAL LINE: public override Result WriteScope(ref RowBuffer b, ref RowCursor edit, TypeArgumentList
// typeArgs, out RowCursor value, UpdateOptions options = UpdateOptions.Upsert) // typeArgs, out RowCursor value, UpdateOptions options = UpdateOptions.Upsert)
@Override @Override
public Result WriteScope(Reference<RowBuffer> b, Reference<RowCursor> edit, public Result writeScope(RowBuffer b, RowCursor edit,
TypeArgumentList typeArgs, Out<RowCursor> value, UpdateOptions options) { TypeArgumentList typeArgs, UpdateOptions options, Out<RowCursor> value) {
Result result = prepareSparseWrite(b, edit, new TypeArgument(this, typeArgs.clone()), options); Result result = prepareSparseWrite(b, edit, new TypeArgument(this, typeArgs.clone()), options);
if (result != Result.Success) { if (result != Result.Success) {
value.setAndGet(null); value.setAndGet(null);

View File

@@ -45,23 +45,23 @@ public final class LayoutTypedSet extends LayoutUniqueScope {
} }
@Override @Override
public void SetImplicitTypeCode(Reference<RowCursor> edit) { public void setImplicitTypeCode(RowCursor edit) {
edit.get().cellType = edit.get().scopeTypeArgs().get(0).type(); edit.get().cellType = edit.get().scopeTypeArgs().get(0).type();
edit.get().cellTypeArgs = edit.get().scopeTypeArgs().get(0).typeArgs().clone(); edit.get().cellTypeArgs = edit.get().scopeTypeArgs().get(0).typeArgs().clone();
} }
@Override @Override
public Result WriteScope(Reference<RowBuffer> b, Reference<RowCursor> edit, public Result writeScope(RowBuffer b, RowCursor edit,
TypeArgumentList typeArgs, Out<RowCursor> value) { TypeArgumentList typeArgs, Out<RowCursor> value) {
return WriteScope(b, edit, typeArgs, value, UpdateOptions.Upsert); return writeScope(b, edit, typeArgs, UpdateOptions.Upsert, value);
} }
//C# TO JAVA CONVERTER NOTE: Java does not support optional parameters. Overloaded method(s) are created above: //C# TO JAVA CONVERTER NOTE: Java does not support optional parameters. Overloaded method(s) are created above:
//ORIGINAL LINE: public override Result WriteScope(ref RowBuffer b, ref RowCursor edit, TypeArgumentList //ORIGINAL LINE: public override Result WriteScope(ref RowBuffer b, ref RowCursor edit, TypeArgumentList
// typeArgs, out RowCursor value, UpdateOptions options = UpdateOptions.Upsert) // typeArgs, out RowCursor value, UpdateOptions options = UpdateOptions.Upsert)
@Override @Override
public Result WriteScope(Reference<RowBuffer> b, Reference<RowCursor> edit, public Result writeScope(RowBuffer b, RowCursor edit,
TypeArgumentList typeArgs, Out<RowCursor> value, UpdateOptions options) { TypeArgumentList typeArgs, UpdateOptions options, Out<RowCursor> value) {
Result result = prepareSparseWrite(b, edit, new TypeArgument(this, typeArgs.clone()), options); Result result = prepareSparseWrite(b, edit, new TypeArgument(this, typeArgs.clone()), options);
if (result != Result.Success) { if (result != Result.Success) {
value.setAndGet(null); value.setAndGet(null);

View File

@@ -57,23 +57,23 @@ public final class LayoutTypedTuple extends LayoutIndexedScope {
} }
@Override @Override
public void SetImplicitTypeCode(Reference<RowCursor> edit) { public void setImplicitTypeCode(RowCursor edit) {
edit.get().cellType = edit.get().scopeTypeArgs().get(edit.get().index()).type(); edit.get().cellType = edit.get().scopeTypeArgs().get(edit.get().index()).type();
edit.get().cellTypeArgs = edit.get().scopeTypeArgs().get(edit.get().index()).typeArgs().clone(); edit.get().cellTypeArgs = edit.get().scopeTypeArgs().get(edit.get().index()).typeArgs().clone();
} }
@Override @Override
public Result WriteScope(Reference<RowBuffer> b, Reference<RowCursor> edit, public Result writeScope(RowBuffer b, RowCursor edit,
TypeArgumentList typeArgs, Out<RowCursor> value) { TypeArgumentList typeArgs, Out<RowCursor> value) {
return WriteScope(b, edit, typeArgs, value, UpdateOptions.Upsert); return writeScope(b, edit, typeArgs, UpdateOptions.Upsert, value);
} }
//C# TO JAVA CONVERTER NOTE: Java does not support optional parameters. Overloaded method(s) are created above: //C# TO JAVA CONVERTER NOTE: Java does not support optional parameters. Overloaded method(s) are created above:
//ORIGINAL LINE: public override Result WriteScope(ref RowBuffer b, ref RowCursor edit, TypeArgumentList //ORIGINAL LINE: public override Result WriteScope(ref RowBuffer b, ref RowCursor edit, TypeArgumentList
// typeArgs, out RowCursor value, UpdateOptions options = UpdateOptions.Upsert) // typeArgs, out RowCursor value, UpdateOptions options = UpdateOptions.Upsert)
@Override @Override
public Result WriteScope(Reference<RowBuffer> b, Reference<RowCursor> edit, public Result writeScope(RowBuffer b, RowCursor edit,
TypeArgumentList typeArgs, Out<RowCursor> value, UpdateOptions options) { TypeArgumentList typeArgs, UpdateOptions options, Out<RowCursor> value) {
Result result = LayoutType.prepareSparseWrite(b, edit, new TypeArgument(this, typeArgs.clone()), options); Result result = LayoutType.prepareSparseWrite(b, edit, new TypeArgument(this, typeArgs.clone()), options);
if (result != Result.Success) { if (result != Result.Success) {
value.setAndGet(null); value.setAndGet(null);

View File

@@ -7,14 +7,14 @@ package com.azure.data.cosmos.serialization.hybridrow.layouts;
* Layout type definitions * Layout type definitions
*/ */
public abstract class LayoutTypes { public abstract class LayoutTypes {
public static final LayoutArray Array = new LayoutArray(false); public static final LayoutArray ARRAY = new LayoutArray(false);
public static final LayoutBinary Binary = new LayoutBinary(); public static final LayoutBinary BINARY = new LayoutBinary();
public static final int BitsPerByte = 8; public static final int BitsPerByte = 8;
public static final LayoutBoolean Boolean = new LayoutBoolean(true); public static final LayoutBoolean BOOLEAN = new LayoutBoolean(true);
public static final LayoutBoolean BooleanFalse = new LayoutBoolean(false); public static final LayoutBoolean BooleanFalse = new LayoutBoolean(false);
public static final LayoutDateTime DATE_TIME = new LayoutDateTime(); public static final LayoutDateTime DATE_TIME = new LayoutDateTime();
public static final LayoutDecimal DECIMAL = new LayoutDecimal(); public static final LayoutDecimal DECIMAL = new LayoutDecimal();
public static final LayoutEndScope EndScope = new LayoutEndScope(); public static final LayoutEndScope END_SCOPE = new LayoutEndScope();
public static final LayoutFloat128 FLOAT_128 = new LayoutFloat128(); public static final LayoutFloat128 FLOAT_128 = new LayoutFloat128();
public static final LayoutFloat32 FLOAT_32 = new LayoutFloat32(); public static final LayoutFloat32 FLOAT_32 = new LayoutFloat32();
public static final LayoutFloat64 FLOAT_64 = new LayoutFloat64(); public static final LayoutFloat64 FLOAT_64 = new LayoutFloat64();
@@ -34,24 +34,24 @@ public abstract class LayoutTypes {
public static final LayoutInt32 INT_32 = new LayoutInt32(); public static final LayoutInt32 INT_32 = new LayoutInt32();
public static final LayoutInt64 INT_64 = new LayoutInt64(); public static final LayoutInt64 INT_64 = new LayoutInt64();
public static final LayoutInt8 INT_8 = new LayoutInt8(); public static final LayoutInt8 INT_8 = new LayoutInt8();
public static final LayoutMongoDbObjectId MongoDbObjectId = new LayoutMongoDbObjectId(); public static final LayoutMongoDbObjectId MONGODB_OBJECT_ID = new LayoutMongoDbObjectId();
public static final LayoutNull Null = new LayoutNull(); public static final LayoutNull NULL = new LayoutNull();
public static final LayoutNullable Nullable = new LayoutNullable(false); public static final LayoutNullable NULLABLE = new LayoutNullable(false);
public static final LayoutObject Object = new LayoutObject(false); public static final LayoutObject OBJECT = new LayoutObject(false);
public static final LayoutTagged Tagged = new LayoutTagged(false); public static final LayoutTagged TAGGED = new LayoutTagged(false);
public static final LayoutTagged2 Tagged2 = new LayoutTagged2(false); public static final LayoutTagged2 TAGGED_2 = new LayoutTagged2(false);
public static final LayoutTuple Tuple = new LayoutTuple(false); public static final LayoutTuple TUPLE = new LayoutTuple(false);
public static final LayoutTypedArray TypedArray = new LayoutTypedArray(false); public static final LayoutTypedArray TYPED_ARRAY = new LayoutTypedArray(false);
public static final LayoutTypedMap TypedMap = new LayoutTypedMap(false); public static final LayoutTypedMap TypedMap = new LayoutTypedMap(false);
public static final LayoutTypedSet TypedSet = new LayoutTypedSet(false); public static final LayoutTypedSet TypedSet = new LayoutTypedSet(false);
public static final LayoutTypedTuple TypedTuple = new LayoutTypedTuple(false); public static final LayoutTypedTuple TYPED_TUPLE = new LayoutTypedTuple(false);
public static final LayoutUDT UDT = new LayoutUDT(false); public static final LayoutUDT UDT = new LayoutUDT(false);
public static final LayoutUInt16 UINT_16 = new LayoutUInt16(); public static final LayoutUInt16 UINT_16 = new LayoutUInt16();
public static final LayoutUInt32 UINT_32 = new LayoutUInt32(); public static final LayoutUInt32 UINT_32 = new LayoutUInt32();
public static final LayoutUInt64 UINT_64 = new LayoutUInt64(); public static final LayoutUInt64 UINT_64 = new LayoutUInt64();
public static final LayoutUInt8 UINT_8 = new LayoutUInt8(); public static final LayoutUInt8 UINT_8 = new LayoutUInt8();
public static final LayoutUnixDateTime UNIX_DATE_TIME = new LayoutUnixDateTime(); public static final LayoutUnixDateTime UNIX_DATE_TIME = new LayoutUnixDateTime();
public static final LayoutUtf8 Utf8 = new LayoutUtf8(); public static final LayoutUtf8 UTF_8 = new LayoutUtf8();
public static final LayoutVarInt VarInt = new LayoutVarInt(); public static final LayoutVarInt VAR_INT = new LayoutVarInt();
public static final LayoutVarUInt VarUInt = new LayoutVarUInt(); public static final LayoutVarUInt VAR_UINT = new LayoutVarUInt();
} }

View File

@@ -33,17 +33,17 @@ public final class LayoutUDT extends LayoutPropertyScope {
} }
@Override @Override
public Result WriteScope(Reference<RowBuffer> b, Reference<RowCursor> edit, public Result writeScope(RowBuffer b, RowCursor edit,
TypeArgumentList typeArgs, Out<RowCursor> value) { TypeArgumentList typeArgs, Out<RowCursor> value) {
return WriteScope(b, edit, typeArgs, value, UpdateOptions.Upsert); return writeScope(b, edit, typeArgs, UpdateOptions.Upsert, value);
} }
//C# TO JAVA CONVERTER NOTE: Java does not support optional parameters. Overloaded method(s) are created above: //C# TO JAVA CONVERTER NOTE: Java does not support optional parameters. Overloaded method(s) are created above:
//ORIGINAL LINE: public override Result WriteScope(ref RowBuffer b, ref RowCursor edit, TypeArgumentList //ORIGINAL LINE: public override Result WriteScope(ref RowBuffer b, ref RowCursor edit, TypeArgumentList
// typeArgs, out RowCursor value, UpdateOptions options = UpdateOptions.Upsert) // typeArgs, out RowCursor value, UpdateOptions options = UpdateOptions.Upsert)
@Override @Override
public Result WriteScope(Reference<RowBuffer> b, Reference<RowCursor> edit, public Result writeScope(RowBuffer b, RowCursor edit,
TypeArgumentList typeArgs, Out<RowCursor> value, UpdateOptions options) { TypeArgumentList typeArgs, UpdateOptions options, Out<RowCursor> value) {
Layout udt = b.get().resolver().resolve(typeArgs.schemaId().clone()); Layout udt = b.get().resolver().resolve(typeArgs.schemaId().clone());
Result result = prepareSparseWrite(b, edit, new TypeArgument(this, typeArgs.clone()), options); Result result = prepareSparseWrite(b, edit, new TypeArgument(this, typeArgs.clone()), options);
if (result != Result.Success) { if (result != Result.Success) {

View File

@@ -101,7 +101,7 @@ public abstract class LayoutUniqueScope extends LayoutIndexedScope {
// TypeArgumentList typeArgs, TContext context, WriterFunc<TContext> func, UpdateOptions options = UpdateOptions // TypeArgumentList typeArgs, TContext context, WriterFunc<TContext> func, UpdateOptions options = UpdateOptions
// .Upsert) // .Upsert)
@Override @Override
public <TContext> Result WriteScope(Reference<RowBuffer> b, Reference<RowCursor> scope, public <TContext> Result writeScope(RowBuffer b, RowCursor scope,
TypeArgumentList typeArgs, TContext context, WriterFunc<TContext> func, TypeArgumentList typeArgs, TContext context, WriterFunc<TContext> func,
UpdateOptions options) { UpdateOptions options) {
RowCursor uniqueScope; RowCursor uniqueScope;
@@ -146,8 +146,8 @@ public abstract class LayoutUniqueScope extends LayoutIndexedScope {
} }
@Override @Override
public <TContext> Result WriteScope(Reference<RowBuffer> b, Reference<RowCursor> scope, public <TContext> Result writeScope(RowBuffer b, RowCursor scope,
TypeArgumentList typeArgs, TContext context, WriterFunc<TContext> func) { TypeArgumentList typeArgs, TContext context, WriterFunc<TContext> func) {
return WriteScope(b, scope, typeArgs, context, func, UpdateOptions.Upsert); return writeScope(b, scope, typeArgs, context, func, UpdateOptions.Upsert);
} }
} }

Some files were not shown because too many files have changed in this diff Show More