yijunyu/c-to-rust huggingface dataset:
// Original:
public static <T> T[] grow(T[] array, int minSize) {assert minSize >= 0 : "size must be positive (got " + minSize + "): likely integer overflow?";if (array.length < minSize) {final int newLength = oversize(minSize, RamUsageEstimator.NUM_BYTES_OBJECT_REF);return growExact(array, newLength);} elsereturn array;}

// Translation:
public static int[] Grow(int[] array, int minSize){Debug.Assert(minSize >= 0, "size must be positive (got " + minSize + "): likely integer overflow?");if (array.Length < minSize){int[] newArray = new int[Oversize(minSize, RamUsageEstimator.NUM_BYTES_INT32)];Array.Copy(array, 0, newArray, 0, array.Length);return newArray;}else{return array;}}
// Original:
public ByteArrayDataOutput() {reset(BytesRef.EMPTY_BYTES);}

// Translation:
public ByteArrayDataOutput(){Reset(BytesRef.EMPTY_BYTES);}
// Original:
public void balance() {int i = 0, n = length;String[] k = new String[n];char[] v = new char[n];Iterator iter = new Iterator();while (iter.hasMoreElements()) {v[i] = iter.getValue();k[i++] = iter.nextElement();}init();insertBalanced(k, v, 0, n);}

// Translation:
public virtual void Balance(){int i = 0, n = m_length;string[] k = new string[n];char[] v = new char[n];Iterator iter = new Iterator(this);while (iter.MoveNext()){v[i] = iter.Value;k[i++] = iter.Current;}Init();InsertBalanced(k, v, 0, n);}
// Original:
public MultiPhraseQueryNode() {setLeaf(false);allocate();}

// Translation:
public MultiPhraseQueryNode(){IsLeaf = false;Allocate();}
// Original:
public PublishRequest(String topicArn, String message, String subject) {setTopicArn(topicArn);setMessage(message);setSubject(subject);}

// Translation:
public PublishRequest(string topicArn, string message, string subject){_topicArn = topicArn;_message = message;_subject = subject;}
// Original:
public SendCommandResult sendCommand(SendCommandRequest request) {request = beforeClientExecution(request);return executeSendCommand(request);}

// Translation:
public virtual SendCommandResponse SendCommand(SendCommandRequest request){var options = new InvokeOptions();options.RequestMarshaller = SendCommandRequestMarshaller.Instance;options.ResponseUnmarshaller = SendCommandResponseUnmarshaller.Instance;return Invoke<SendCommandResponse>(request, options);}
// Original:
public ListDeploymentInstancesResult listDeploymentInstances(ListDeploymentInstancesRequest request) {request = beforeClientExecution(request);return executeListDeploymentInstances(request);}

// Translation:
public virtual ListDeploymentInstancesResponse ListDeploymentInstances(ListDeploymentInstancesRequest request){var options = new InvokeOptions();options.RequestMarshaller = ListDeploymentInstancesRequestMarshaller.Instance;options.ResponseUnmarshaller = ListDeploymentInstancesResponseUnmarshaller.Instance;return Invoke<ListDeploymentInstancesResponse>(request, options);}
// Original:
public Iterator<E> iterator() {return delegate().iterator(); }

// Translation:
public virtual java.util.Iterator<E> iterator(){lock (mutex){return c.iterator();}}
// Original:
public ProvisionedThroughput(Long readCapacityUnits, Long writeCapacityUnits) {setReadCapacityUnits(readCapacityUnits);setWriteCapacityUnits(writeCapacityUnits);}

// Translation:
public ProvisionedThroughput(long readCapacityUnits, long writeCapacityUnits){_readCapacityUnits = readCapacityUnits;_writeCapacityUnits = writeCapacityUnits;}
// Original:
public DescribeTagsResult describeTags() {return describeTags(new DescribeTagsRequest());}

// Translation:
public virtual DescribeTagsResponse DescribeTags(){return DescribeTags(new DescribeTagsRequest());}
// Original:
public DeprovisionByoipCidrResult deprovisionByoipCidr(DeprovisionByoipCidrRequest request) {request = beforeClientExecution(request);return executeDeprovisionByoipCidr(request);}

// Translation:
public virtual DeprovisionByoipCidrResponse DeprovisionByoipCidr(DeprovisionByoipCidrRequest request){var options = new InvokeOptions();options.RequestMarshaller = DeprovisionByoipCidrRequestMarshaller.Instance;options.ResponseUnmarshaller = DeprovisionByoipCidrResponseUnmarshaller.Instance;return Invoke<DeprovisionByoipCidrResponse>(request, options);}
// Original:
public boolean isDone(TreeWalk walker) {return pathRaw.length == walker.getPathLength();}

// Translation:
public virtual bool IsDone(TreeWalk walker){return pathRaw.Length == walker.GetPathLength();}
// Original:
public String buildExtensionField(String extensionKey, String field) {StringBuilder builder = new StringBuilder(field);builder.append(this.extensionFieldDelimiter);builder.append(extensionKey);return escapeExtensionField(builder.toString());}

// Translation:
public virtual string BuildExtensionField(string extensionKey, string field){StringBuilder builder = new StringBuilder(field);builder.Append(this.extensionFieldDelimiter);builder.Append(extensionKey);return EscapeExtensionField(builder.ToString());}
// Original:
public void reset(byte[] bytes, int offset, int len) {this.bytes = bytes;pos = offset;limit = offset + len;}

// Translation:
public virtual void Reset(byte[] bytes, int offset, int len){this.bytes = bytes;pos = offset;limit = offset + len;}
// Original:
public boolean equals(Object obj) {if (!(obj instanceof Loc)) {return false;}Loc other = (Loc) obj;return _bookSheetColumn == other._bookSheetColumn && _rowIndex == other._rowIndex;}

// Translation:
public override bool Equals(Object obj){Loc other = (Loc)obj;return _bookSheetColumn == other._bookSheetColumn && _rowIndex == other._rowIndex;}
// Original:
public DeleteDeploymentConfigResult deleteDeploymentConfig(DeleteDeploymentConfigRequest request) {request = beforeClientExecution(request);return executeDeleteDeploymentConfig(request);}

// Translation:
public virtual DeleteDeploymentConfigResponse DeleteDeploymentConfig(DeleteDeploymentConfigRequest request){var options = new InvokeOptions();options.RequestMarshaller = DeleteDeploymentConfigRequestMarshaller.Instance;options.ResponseUnmarshaller = DeleteDeploymentConfigResponseUnmarshaller.Instance;return Invoke<DeleteDeploymentConfigResponse>(request, options);}
// Original:
public StartQueryExecutionResult startQueryExecution(StartQueryExecutionRequest request) {request = beforeClientExecution(request);return executeStartQueryExecution(request);}

// Translation:
public virtual StartQueryExecutionResponse StartQueryExecution(StartQueryExecutionRequest request){var options = new InvokeOptions();options.RequestMarshaller = StartQueryExecutionRequestMarshaller.Instance;options.ResponseUnmarshaller = StartQueryExecutionResponseUnmarshaller.Instance;return Invoke<StartQueryExecutionResponse>(request, options);}
// Original:
public GetRepoListRequest() {super("cr", "2016-06-07", "GetRepoList", "cr");setUriPattern("/repos");setMethod(MethodType.GET);}

// Translation:
public GetRepoListRequest(): base("cr", "2016-06-07", "GetRepoList", "cr", "openAPI"){UriPattern = "/repos";Method = MethodType.GET;}
// Original:
public CreateDistributionResult createDistribution(CreateDistributionRequest request) {request = beforeClientExecution(request);return executeCreateDistribution(request);}

// Translation:
public virtual CreateDistributionResponse CreateDistribution(CreateDistributionRequest request){var options = new InvokeOptions();options.RequestMarshaller = CreateDistributionRequestMarshaller.Instance;options.ResponseUnmarshaller = CreateDistributionResponseUnmarshaller.Instance;return Invoke<CreateDistributionResponse>(request, options);}
// Original:
public LongField(final int offset)throws ArrayIndexOutOfBoundsException{if (offset < 0){throw new ArrayIndexOutOfBoundsException("Illegal offset: "+ offset);}_offset = offset;}

// Translation:
public LongField(int offset){if (offset < 0){throw new IndexOutOfRangeException("Illegal offset: " + offset);}_offset = offset;}
// Original:
public String toString() {StringBuilder b = new StringBuilder();b.append(" target=").append(target());b.append(" label=0x").append(Integer.toHexString(label()));if (flag(BIT_FINAL_ARC)) {b.append(" final");}if (flag(BIT_LAST_ARC)) {b.append(" last");}if (flag(BIT_TARGET_NEXT)) {b.append(" targetNext");}if (flag(BIT_STOP_NODE)) {b.append(" stop");}if (flag(BIT_ARC_HAS_OUTPUT)) {b.append(" output=").append(output());}if (flag(BIT_ARC_HAS_FINAL_OUTPUT)) {b.append(" nextFinalOutput=").append(nextFinalOutput());}if (bytesPerArc() != 0) {b.append(" arcArray(idx=").append(arcIdx()).append(" of ").append(numArcs()).append(")");}return b.toString();}

// Translation:
public override string ToString(){var b = new StringBuilder();b.Append("node=" + Node);b.Append(" target=" + Target);b.Append(" label=" + Label);if (Flag(BIT_LAST_ARC)) b.Append(" last");if (Flag(BIT_FINAL_ARC)) b.Append(" final");if (Flag(BIT_TARGET_NEXT)) b.Append(" targetNext");if (Flag(BIT_ARC_HAS_OUTPUT)) b.Append(" output=" + Output);if (Flag(BIT_ARC_HAS_FINAL_OUTPUT)) b.Append(" nextFinalOutput=" + NextFinalOutput);if (BytesPerArc != 0) b.Append(" arcArray(idx=" + ArcIdx + " of " + NumArcs + ")");return b.ToString();}
// Original:
public final int getRefCount() {return refCount.get();}

// Translation:
public int GetRefCount() {return refCount;}
// Original:
public int readInt() {byte[] buf = new byte[LittleEndianConsts.INT_SIZE];try {checkEOF(read(buf), buf.length);} catch (IOException e) {throw new RuntimeException(e);}return LittleEndian.getInt(buf);}

// Translation:
public int ReadInt(){int ch1;int ch2;int ch3;int ch4;try{ch1 = in1.ReadByte();ch2 = in1.ReadByte();ch3 = in1.ReadByte();ch4 = in1.ReadByte();}catch (IOException e){throw new RuntimeException(e);}CheckEOF(ch1 | ch2 | ch3 | ch4);return (ch4 << 24) + (ch3 << 16) + (ch2 << 8) + (ch1 << 0);}
// Original:
public BatchCreateAttendeeResult batchCreateAttendee(BatchCreateAttendeeRequest request) {request = beforeClientExecution(request);return executeBatchCreateAttendee(request);}

// Translation:
public virtual BatchCreateAttendeeResponse BatchCreateAttendee(BatchCreateAttendeeRequest request){var options = new InvokeOptions();options.RequestMarshaller = BatchCreateAttendeeRequestMarshaller.Instance;options.ResponseUnmarshaller = BatchCreateAttendeeResponseUnmarshaller.Instance;return Invoke<BatchCreateAttendeeResponse>(request, options);}
// Original:
public DetachInstancesFromLoadBalancerResult detachInstancesFromLoadBalancer(DetachInstancesFromLoadBalancerRequest request) {request = beforeClientExecution(request);return executeDetachInstancesFromLoadBalancer(request);}

// Translation:
public virtual DetachInstancesFromLoadBalancerResponse DetachInstancesFromLoadBalancer(DetachInstancesFromLoadBalancerRequest request){var options = new InvokeOptions();options.RequestMarshaller = DetachInstancesFromLoadBalancerRequestMarshaller.Instance;options.ResponseUnmarshaller = DetachInstancesFromLoadBalancerResponseUnmarshaller.Instance;return Invoke<DetachInstancesFromLoadBalancerResponse>(request, options);}
// Original:
public int getSourceStart() {return outRegion.sourceStart;}

// Translation:
public virtual int GetSourceStart(){return currentSource.regionList.sourceStart;}
// Original:
public String toString() {StringBuilder buffer = new StringBuilder();buffer.append("[FORMAT]\n");buffer.append("    .indexcode       = ").append(HexDump.shortToHex(getIndexCode())).append("\n");buffer.append("    .isUnicode       = ").append(field_3_hasMultibyte ).append("\n");buffer.append("    .formatstring    = ").append(getFormatString()).append("\n");buffer.append("[/FORMAT]\n");return buffer.toString();}

// Translation:
public override String ToString(){StringBuilder buffer = new StringBuilder();buffer.Append("[FORMAT]\n");buffer.Append("    .indexcode       = ").Append(HexDump.ShortToHex(IndexCode)).Append("\n");buffer.Append("    .isUnicode       = ").Append(field_3_hasMultibyte).Append("\n");buffer.Append("    .formatstring    = ").Append(FormatString).Append("\n");buffer.Append("[/FORMAT]\n");return buffer.ToString();}
// Original:
public void remove() {if (lastReturned == null) {throw new IllegalStateException();}Impl.this.remove(lastReturned.getKey());lastReturned = null;}

// Translation:
public virtual void remove(){if (this.lastEntryReturned == null){throw new System.InvalidOperationException();}if (this._enclosing.modCount != this.expectedModCount){throw new java.util.ConcurrentModificationException();}this._enclosing.remove(this.lastEntryReturned.key);this.lastEntryReturned = null;this.expectedModCount = this._enclosing.modCount;}
// Original:
public String toString() {if (getChildren() == null || getChildren().size() == 0)return "<boolean operation='or'/>";StringBuilder sb = new StringBuilder();sb.append("<boolean operation='or'>");for (QueryNode child : getChildren()) {sb.append("\n");sb.append(child.toString());}sb.append("\n</boolean>");return sb.toString();}

// Translation:
public override string ToString(){var children = GetChildren();if (children == null || children.Count == 0)return "<boolean operation='or'/>";StringBuilder sb = new StringBuilder();sb.Append("<boolean operation='or'>");foreach (IQueryNode child in children){sb.Append("\n");sb.Append(child.ToString());}sb.Append("\n</boolean>");return sb.ToString();}
// Original:
public String getPartOfSpeech(int wordId) {return getFeature(wordId, 1);}

// Translation:
public string GetPartOfSpeech(int wordId){return GetFeature(wordId, 1);}
// Original:
public BatchWriteResult batchWrite(BatchWriteRequest request) {request = beforeClientExecution(request);return executeBatchWrite(request);}

// Translation:
public virtual BatchWriteResponse BatchWrite(BatchWriteRequest request){var options = new InvokeOptions();options.RequestMarshaller = BatchWriteRequestMarshaller.Instance;options.ResponseUnmarshaller = BatchWriteResponseUnmarshaller.Instance;return Invoke<BatchWriteResponse>(request, options);}
// Original:
public ObjectId idFor(int type, byte[] data) {return delegate().idFor(type, data);}

// Translation:
public virtual ObjectId IdFor(int type, byte[] data){return IdFor(type, data, 0, data.Length);}
// Original:
public ConfirmTransitVirtualInterfaceResult confirmTransitVirtualInterface(ConfirmTransitVirtualInterfaceRequest request) {request = beforeClientExecution(request);return executeConfirmTransitVirtualInterface(request);}

// Translation:
public virtual ConfirmTransitVirtualInterfaceResponse ConfirmTransitVirtualInterface(ConfirmTransitVirtualInterfaceRequest request){var options = new InvokeOptions();options.RequestMarshaller = ConfirmTransitVirtualInterfaceRequestMarshaller.Instance;options.ResponseUnmarshaller = ConfirmTransitVirtualInterfaceResponseUnmarshaller.Instance;return Invoke<ConfirmTransitVirtualInterfaceResponse>(request, options);}
// Original:
public GetFileUploadURLResult getFileUploadURL(GetFileUploadURLRequest request) {request = beforeClientExecution(request);return executeGetFileUploadURL(request);}

// Translation:
public virtual GetFileUploadURLResponse GetFileUploadURL(GetFileUploadURLRequest request){var options = new InvokeOptions();options.RequestMarshaller = GetFileUploadURLRequestMarshaller.Instance;options.ResponseUnmarshaller = GetFileUploadURLResponseUnmarshaller.Instance;return Invoke<GetFileUploadURLResponse>(request, options);}
// Original:
public TokenStream create(TokenStream input) {return new KeywordRepeatFilter(input);}

// Translation:
public override TokenStream Create(TokenStream input){return new KeywordRepeatFilter(input);}
// Original:
public StartWorkspacesResult startWorkspaces(StartWorkspacesRequest request) {request = beforeClientExecution(request);return executeStartWorkspaces(request);}

// Translation:
public virtual StartWorkspacesResponse StartWorkspaces(StartWorkspacesRequest request){var options = new InvokeOptions();options.RequestMarshaller = StartWorkspacesRequestMarshaller.Instance;options.ResponseUnmarshaller = StartWorkspacesResponseUnmarshaller.Instance;return Invoke<StartWorkspacesResponse>(request, options);}
// Original:
public int getDeltaCacheLimit() {return deltaCacheLimit;}

// Translation:
public virtual int GetDeltaCacheLimit(){return deltaCacheLimit;}
// Original:
public RebootJumpserverRequest() {super("HPC", "2016-06-03", "RebootJumpserver", "hpc");setMethod(MethodType.POST);}

// Translation:
public RebootJumpserverRequest(): base("HPC", "2016-06-03", "RebootJumpserver"){Method = MethodType.POST;}
// Original:
public int getResultEnd() {Region r = outRegion;return r.resultStart + r.length;}

// Translation:
public virtual int GetResultEnd(){Region r = currentSource.regionList;return r.resultStart + r.length;}
// Original:
public CreateLagResult createLag(CreateLagRequest request) {request = beforeClientExecution(request);return executeCreateLag(request);}

// Translation:
public virtual CreateLagResponse CreateLag(CreateLagRequest request){var options = new InvokeOptions();options.RequestMarshaller = CreateLagRequestMarshaller.Instance;options.ResponseUnmarshaller = CreateLagResponseUnmarshaller.Instance;return Invoke<CreateLagResponse>(request, options);}
// Original:
public ConflictState getConflictState() {return conflictState;}

// Translation:
public virtual MergeChunk.ConflictState GetConflictState(){return conflictState;}
// Original:
public final void writeByte(int val) throws IOException {write(val & 0xFF);}

// Translation:
public virtual void writeByte(int val){throw new System.NotImplementedException();}
// Original:
public UpdateRelationalDatabaseResult updateRelationalDatabase(UpdateRelationalDatabaseRequest request) {request = beforeClientExecution(request);return executeUpdateRelationalDatabase(request);}

// Translation:
public virtual UpdateRelationalDatabaseResponse UpdateRelationalDatabase(UpdateRelationalDatabaseRequest request){var options = new InvokeOptions();options.RequestMarshaller = UpdateRelationalDatabaseRequestMarshaller.Instance;options.ResponseUnmarshaller = UpdateRelationalDatabaseResponseUnmarshaller.Instance;return Invoke<UpdateRelationalDatabaseResponse>(request, options);}
// Original:
public Entry<K, V> lowerEntry(K key) {return immutableCopy(findBounded(key, LOWER));}

// Translation:
public java.util.MapClass.Entry<K, V> lowerEntry(K key){return this._enclosing.immutableCopy(this.findBounded(key, java.util.TreeMap.Relation.LOWER));}
// Original:
public ExternalNameRecord() {field_2_ixals = 0;}

// Translation:
public ExternalNameRecord(){field_2_ixals = 0;}
// Original:
public int stem(char s[], int len) {len = stemPrefix(s, len);len = stemSuffix(s, len);return len;}

// Translation:
public virtual int Stem(char[] s, int len){len = StemPrefix(s, len);len = StemSuffix(s, len);return len;}
// Original:
public final void remove(RevFlagSet set) {flags &= ~set.mask;}

// Translation:
public void Remove(RevFlag flag){flags &= ~flag.mask;}
// Original:
public IllegalFormatFlagsException(String flags) {if (flags == null) {throw new NullPointerException();}this.flags = flags;}

// Translation:
public IllegalFormatFlagsException(string flags){if (flags == null){throw new System.ArgumentNullException();}this.flags = flags;}
// Original:
public boolean shouldBeRecursive() {return false;}

// Translation:
public override bool ShouldBeRecursive(){return false;}
// Original:
public CapitalizationFilter create(TokenStream input) {return new CapitalizationFilter(input, onlyFirstWord, keep,forceFirstLetter, okPrefix, minWordLength, maxWordCount, maxTokenLength);}

// Translation:
public override TokenStream Create(TokenStream input){return new CapitalizationFilter(input, onlyFirstWord, keep, forceFirstLetter, okPrefix, minWordLength, maxWordCount, maxTokenLength, culture);}
// Original:
public GetAppliedSchemaVersionResult getAppliedSchemaVersion(GetAppliedSchemaVersionRequest request) {request = beforeClientExecution(request);return executeGetAppliedSchemaVersion(request);}

// Translation:
public virtual GetAppliedSchemaVersionResponse GetAppliedSchemaVersion(GetAppliedSchemaVersionRequest request){var options = new InvokeOptions();options.RequestMarshaller = GetAppliedSchemaVersionRequestMarshaller.Instance;options.ResponseUnmarshaller = GetAppliedSchemaVersionResponseUnmarshaller.Instance;return Invoke<GetAppliedSchemaVersionResponse>(request, options);}
// Original:
public DescribeLabelingJobResult describeLabelingJob(DescribeLabelingJobRequest request) {request = beforeClientExecution(request);return executeDescribeLabelingJob(request);}

// Translation:
public virtual DescribeLabelingJobResponse DescribeLabelingJob(DescribeLabelingJobRequest request){var options = new InvokeOptions();options.RequestMarshaller = DescribeLabelingJobRequestMarshaller.Instance;options.ResponseUnmarshaller = DescribeLabelingJobResponseUnmarshaller.Instance;return Invoke<DescribeLabelingJobResponse>(request, options);}
// Original:
public DeleteAttendeeResult deleteAttendee(DeleteAttendeeRequest request) {request = beforeClientExecution(request);return executeDeleteAttendee(request);}

// Translation:
public virtual DeleteAttendeeResponse DeleteAttendee(DeleteAttendeeRequest request){var options = new InvokeOptions();options.RequestMarshaller = DeleteAttendeeRequestMarshaller.Instance;options.ResponseUnmarshaller = DeleteAttendeeResponseUnmarshaller.Instance;return Invoke<DeleteAttendeeResponse>(request, options);}
// Original:
public final String toString(List<String> ruleNames) {return toString(ruleNames, null);}

// Translation:
public string ToString(IList<string> ruleNames){return ToString(ruleNames, null);}
// Original:
public RejectAssignmentResult rejectAssignment(RejectAssignmentRequest request) {request = beforeClientExecution(request);return executeRejectAssignment(request);}

// Translation:
public virtual RejectAssignmentResponse RejectAssignment(RejectAssignmentRequest request){var options = new InvokeOptions();options.RequestMarshaller = RejectAssignmentRequestMarshaller.Instance;options.ResponseUnmarshaller = RejectAssignmentResponseUnmarshaller.Instance;return Invoke<RejectAssignmentResponse>(request, options);}
// Original:
public CharVector(char[] a, int capacity) {if (capacity > 0) {blockSize = capacity;} else {blockSize = DEFAULT_BLOCK_SIZE;}array = a;n = a.length;}

// Translation:
public CharVector(char[] a, int capacity){if (capacity > 0){blockSize = capacity;}else{blockSize = DEFAULT_BLOCK_SIZE;}array = a;n = a.Length;}
// Original:
public UnsubscribeFromEventResult unsubscribeFromEvent(UnsubscribeFromEventRequest request) {request = beforeClientExecution(request);return executeUnsubscribeFromEvent(request);}

// Translation:
public virtual UnsubscribeFromEventResponse UnsubscribeFromEvent(UnsubscribeFromEventRequest request){var options = new InvokeOptions();options.RequestMarshaller = UnsubscribeFromEventRequestMarshaller.Instance;options.ResponseUnmarshaller = UnsubscribeFromEventResponseUnmarshaller.Instance;return Invoke<UnsubscribeFromEventResponse>(request, options);}
// Original:
public String getNextToken() {if( pos >= format.length() ) {return null;}int subStart = pos;final char curChar = format.charAt(pos);++pos;if( curChar == '\'' ) {while( ( pos < format.length() ) && ( format.charAt(pos) != '\'' ) ) {++pos;}if( pos < format.length() ) {++pos;}} else {while( ( pos < format.length() ) && ( format.charAt(pos) == curChar ) ) {++pos;}}return format.substring(subStart,pos);}

// Translation:
public string GetNextToken(){if (pos >= format.Length){return null;}int subStart = pos;char curChar = format[pos];++pos;if (curChar == '\''){while ((pos < format.Length) && ((curChar = format[pos]) != '\'')){++pos;}if (pos < format.Length){++pos;}}else{char activeChar = curChar;while ((pos < format.Length) && ((curChar = format[pos])) == activeChar){++pos;}}return format.Substring(subStart, pos - subStart);}
// Original:
public Policy withId(String id) {setId(id);return this;}

// Translation:
public Policy WithId(string id){Id = id;return this;}
// Original:
public void setStringValue(String value) {if (!(fieldsData instanceof String)) {throw new IllegalArgumentException("cannot change value type from " + fieldsData.getClass().getSimpleName() + " to String");}if (value == null) {throw new IllegalArgumentException("value must not be null");}fieldsData = value;}

// Translation:
public virtual void SetStringValue(string value){if (!(FieldsData is string)){throw new ArgumentException("cannot change value type from " + FieldsData.GetType().Name + " to string");}FieldsData = value;}