yijunyu/c-to-rust huggingface dataset:
// Original:
public final CharBuffer get(char[] dst, int dstOffset, int charCount) {Arrays.checkOffsetAndCount(dst.length, dstOffset, charCount);if (charCount > remaining()) {throw new BufferUnderflowException();}int newPosition = position + charCount;sequence.toString().getChars(position, newPosition, dst, dstOffset);position = newPosition;return this;}

// Translation:
public sealed override java.nio.CharBuffer get(char[] dst, int dstOffset, int charCount){java.util.Arrays.checkOffsetAndCount(dst.Length, dstOffset, charCount);if (charCount > remaining()){throw new java.nio.BufferUnderflowException();}int newPosition = _position + charCount;Sharpen.StringHelper.GetCharsForString(sequence.ToString(), _position, newPosition, dst, dstOffset);_position = newPosition;return this;}
// Original:
public Set<String> getNames(String section, String subsection) {return getState().getNames(section, subsection);}

// Translation:
public virtual ICollection<string> GetNames(string section, string subsection){return GetState().GetNames(section, subsection);}
// Original:
public CreateBrokerResult createBroker(CreateBrokerRequest request) {request = beforeClientExecution(request);return executeCreateBroker(request);}

// Translation:
public virtual CreateBrokerResponse CreateBroker(CreateBrokerRequest request){var options = new InvokeOptions();options.RequestMarshaller = CreateBrokerRequestMarshaller.Instance;options.ResponseUnmarshaller = CreateBrokerResponseUnmarshaller.Instance;return Invoke<CreateBrokerResponse>(request, options);}
// Original:
public void onAbsorb(int velocity) {mState = STATE_ABSORB;velocity = Math.max(MIN_VELOCITY, Math.abs(velocity));mStartTime = AnimationUtils.currentAnimationTimeMillis();mDuration = 0.1f + (velocity * 0.03f);mEdgeAlphaStart = 0.f;mEdgeScaleY = mEdgeScaleYStart = 0.f;mGlowAlphaStart = 0.5f;mGlowScaleYStart = 0.f;mEdgeAlphaFinish = Math.max(0, Math.min(velocity * VELOCITY_EDGE_FACTOR, 1));mEdgeScaleYFinish = Math.max(HELD_EDGE_SCALE_Y, Math.min(velocity * VELOCITY_EDGE_FACTOR, 1.f));mGlowScaleYFinish = Math.min(0.025f + (velocity * (velocity / 100) * 0.00015f), 1.75f);mGlowAlphaFinish = Math.max(mGlowAlphaStart, Math.min(velocity * VELOCITY_GLOW_FACTOR * .00001f, MAX_ALPHA));}

// Translation:
public virtual void onAbsorb(int velocity){mState = STATE_ABSORB;velocity = System.Math.Max(MIN_VELOCITY, System.Math.Abs(velocity));mStartTime = android.view.animation.AnimationUtils.currentAnimationTimeMillis();mDuration = 0.1f + (velocity * 0.03f);mEdgeAlphaStart = 0.0f;mEdgeScaleY = mEdgeScaleYStart = 0.0f;mGlowAlphaStart = 0.5f;mGlowScaleYStart = 0.0f;mEdgeAlphaFinish = System.Math.Max(0, System.Math.Min(velocity * VELOCITY_EDGE_FACTOR, 1));mEdgeScaleYFinish = System.Math.Max(HELD_EDGE_SCALE_Y, System.Math.Min(velocity *VELOCITY_EDGE_FACTOR, 1.0f));mGlowScaleYFinish = System.Math.Min(0.025f + (velocity * (velocity / 100) * 0.00015f), 1.75f);mGlowAlphaFinish = System.Math.Max(mGlowAlphaStart, System.Math.Min(velocity * VELOCITY_GLOW_FACTOR* .00001f, MAX_ALPHA));}
// Original:
public ListSuppressedDestinationsResult listSuppressedDestinations(ListSuppressedDestinationsRequest request) {request = beforeClientExecution(request);return executeListSuppressedDestinations(request);}

// Translation:
public virtual ListSuppressedDestinationsResponse ListSuppressedDestinations(ListSuppressedDestinationsRequest request){var options = new InvokeOptions();options.RequestMarshaller = ListSuppressedDestinationsRequestMarshaller.Instance;options.ResponseUnmarshaller = ListSuppressedDestinationsResponseUnmarshaller.Instance;return Invoke<ListSuppressedDestinationsResponse>(request, options);}
// Original:
public List<Pair<K,V>> getPairs() {List<Pair<K,V>> pairs = new ArrayList<Pair<K,V>>();for (K key : keySet()) {for (V value : get(key)) {pairs.add(new Pair<K,V>(key, value));}}return pairs;}

// Translation:
public virtual IList<Tuple<K, V>> GetPairs(){IList<Tuple<K, V>> pairs = new ArrayList<Tuple<K, V>>();foreach (KeyValuePair<K, IList<V>> pair in this){foreach (V value in pair.Value){pairs.Add(Tuple.Create(pair.Key, value));}}return pairs;}
// Original:
public void setParams(String params) {super.setParams(params);int k = params.indexOf(",");name = params.substring(0,k).trim();value = params.substring(k+1).trim();}

// Translation:
public override void SetParams(string @params){base.SetParams(@params);int k = @params.IndexOf(',');name = @params.Substring(0, k - 0).Trim();value = @params.Substring(k + 1).Trim();}
// Original:
@Override public V put(K key, V value) {if (!isInBounds(key)) {throw outOfBounds(key, fromBound, toBound);}return putInternal(key, value);}

// Translation:
public override V put(K key, V value){if (!this.isInBounds(key)){throw this.outOfBounds(key, this.fromBound, this.toBound);}return this._enclosing.putInternal(key, value);}
// Original:
public DeregisterImageRequest(String imageId) {setImageId(imageId);}

// Translation:
public DeregisterImageRequest(string imageId){_imageId = imageId;}
// Original:
public GetApplicationResult getApplication(GetApplicationRequest request) {request = beforeClientExecution(request);return executeGetApplication(request);}

// Translation:
public virtual GetApplicationResponse GetApplication(GetApplicationRequest request){var options = new InvokeOptions();options.RequestMarshaller = GetApplicationRequestMarshaller.Instance;options.ResponseUnmarshaller = GetApplicationResponseUnmarshaller.Instance;return Invoke<GetApplicationResponse>(request, options);}
// Original:
public DescribeProblemObservationsResult describeProblemObservations(DescribeProblemObservationsRequest request) {request = beforeClientExecution(request);return executeDescribeProblemObservations(request);}

// Translation:
public virtual DescribeProblemObservationsResponse DescribeProblemObservations(DescribeProblemObservationsRequest request){var options = new InvokeOptions();options.RequestMarshaller = DescribeProblemObservationsRequestMarshaller.Instance;options.ResponseUnmarshaller = DescribeProblemObservationsResponseUnmarshaller.Instance;return Invoke<DescribeProblemObservationsResponse>(request, options);}
// Original:
public int fillFields(byte[] data, int offset, EscherRecordFactory recordFactory) {int bytesAfterHeader = readHeader( data, offset );int pos = offset + HEADER_SIZE;System.arraycopy( data, pos, field_1_UID, 0, 16 ); pos += 16;field_2_marker = data[pos]; pos++;setPictureData(data, pos, bytesAfterHeader - 17);return bytesAfterHeader + HEADER_SIZE;}

// Translation:
public override int FillFields(byte[] data, int offset, IEscherRecordFactory recordFactory){int bytesAfterHeader = ReadHeader(data, offset);int pos = offset + HEADER_SIZE;field_1_UID = new byte[16];Array.Copy(data, pos, field_1_UID, 0, 16); pos += 16;field_2_marker = data[pos]; pos++;field_pictureData = new byte[bytesAfterHeader - 17];Array.Copy(data, pos, field_pictureData, 0, field_pictureData.Length);return bytesAfterHeader + HEADER_SIZE;}
// Original:
public static boolean endsWith(BytesRef ref, BytesRef suffix) {int startAt = ref.length - suffix.length;if (startAt < 0) {return false;}return Arrays.equals(ref.bytes, ref.offset + startAt, ref.offset + startAt + suffix.length,suffix.bytes, suffix.offset, suffix.offset + suffix.length);}

// Translation:
public static bool EndsWith(BytesRef @ref, BytesRef suffix) {return SliceEquals(@ref, suffix, @ref.Length - suffix.Length);}
// Original:
public DeleteOptionGroupResult deleteOptionGroup(DeleteOptionGroupRequest request) {request = beforeClientExecution(request);return executeDeleteOptionGroup(request);}

// Translation:
public virtual DeleteOptionGroupResponse DeleteOptionGroup(DeleteOptionGroupRequest request){var options = new InvokeOptions();options.RequestMarshaller = DeleteOptionGroupRequestMarshaller.Instance;options.ResponseUnmarshaller = DeleteOptionGroupResponseUnmarshaller.Instance;return Invoke<DeleteOptionGroupResponse>(request, options);}
// Original:
public static String getFromUnicodeLE(byte[] string) {if (string.length == 0) {return "";}return getFromUnicodeLE(string, 0, string.length / 2);}

// Translation:
public static String GetFromUnicodeLE(byte[] str){if (str.Length == 0) { return ""; }return GetFromUnicodeLE(str, 0, str.Length / 2);}
// Original:
public CellRangeAddressList() {_list = new ArrayList<>();}

// Translation:
public CellRangeAddressList(){_list = new ArrayList();}
// Original:
public ValueEval evaluate(ValueEval[] args, OperationEvaluationContext ec) {throw new NotImplementedFunctionException(_functionName);}

// Translation:
public ValueEval Evaluate(ValueEval[] args, OperationEvaluationContext ec){throw new NotImplementedFunctionException(_functionName);}
// Original:
public DescribeOptionGroupsResult describeOptionGroups() {return describeOptionGroups(new DescribeOptionGroupsRequest());}

// Translation:
public virtual DescribeOptionGroupsResponse DescribeOptionGroups(){return DescribeOptionGroups(new DescribeOptionGroupsRequest());}
// Original:
public DisableVpcClassicLinkResult disableVpcClassicLink(DisableVpcClassicLinkRequest request) {request = beforeClientExecution(request);return executeDisableVpcClassicLink(request);}

// Translation:
public virtual DisableVpcClassicLinkResponse DisableVpcClassicLink(DisableVpcClassicLinkRequest request){var options = new InvokeOptions();options.RequestMarshaller = DisableVpcClassicLinkRequestMarshaller.Instance;options.ResponseUnmarshaller = DisableVpcClassicLinkResponseUnmarshaller.Instance;return Invoke<DisableVpcClassicLinkResponse>(request, options);}
// Original:
public String toString() {StringBuilder buffer = new StringBuilder();buffer.append("[SXIDSTM]\n");buffer.append("    .idstm      =").append(HexDump.shortToHex(idstm)).append('\n');buffer.append("[/SXIDSTM]\n");return buffer.toString();}

// Translation:
public override string ToString(){StringBuilder buffer = new StringBuilder();buffer.Append("[SXIDSTM]\n");buffer.Append("    .idstm      =").Append(HexDump.ShortToHex(idstm)).Append('\n');buffer.Append("[/SXIDSTM]\n");return buffer.ToString();}
// Original:
public ListStackInstancesResult listStackInstances(ListStackInstancesRequest request) {request = beforeClientExecution(request);return executeListStackInstances(request);}

// Translation:
public virtual ListStackInstancesResponse ListStackInstances(ListStackInstancesRequest request){var options = new InvokeOptions();options.RequestMarshaller = ListStackInstancesRequestMarshaller.Instance;options.ResponseUnmarshaller = ListStackInstancesResponseUnmarshaller.Instance;return Invoke<ListStackInstancesResponse>(request, options);}
// Original:
public DescribeCompanyNetworkConfigurationResult describeCompanyNetworkConfiguration(DescribeCompanyNetworkConfigurationRequest request) {request = beforeClientExecution(request);return executeDescribeCompanyNetworkConfiguration(request);}

// Translation:
public virtual DescribeCompanyNetworkConfigurationResponse DescribeCompanyNetworkConfiguration(DescribeCompanyNetworkConfigurationRequest request){var options = new InvokeOptions();options.RequestMarshaller = DescribeCompanyNetworkConfigurationRequestMarshaller.Instance;options.ResponseUnmarshaller = DescribeCompanyNetworkConfigurationResponseUnmarshaller.Instance;return Invoke<DescribeCompanyNetworkConfigurationResponse>(request, options);}
// Original:
public final CoderResult flush(CharBuffer out) {if (status != END && status != INIT) {throw new IllegalStateException();}CoderResult result = implFlush(out);if (result == CoderResult.UNDERFLOW) {status = FLUSH;}return result;}

// Translation:
public java.nio.charset.CoderResult flush(java.nio.CharBuffer @out){if (status != END && status != INIT){throw new System.InvalidOperationException();}java.nio.charset.CoderResult result = implFlush(@out);if (result == java.nio.charset.CoderResult.UNDERFLOW){status = FLUSH;}return result;}
// Original:
public DescribeDBClustersResult describeDBClusters(DescribeDBClustersRequest request) {request = beforeClientExecution(request);return executeDescribeDBClusters(request);}

// Translation:
public virtual DescribeDBClustersResponse DescribeDBClusters(DescribeDBClustersRequest request){var options = new InvokeOptions();options.RequestMarshaller = DescribeDBClustersRequestMarshaller.Instance;options.ResponseUnmarshaller = DescribeDBClustersResponseUnmarshaller.Instance;return Invoke<DescribeDBClustersResponse>(request, options);}
// Original:
public GetDocumentVersionResult getDocumentVersion(GetDocumentVersionRequest request) {request = beforeClientExecution(request);return executeGetDocumentVersion(request);}

// Translation:
public virtual GetDocumentVersionResponse GetDocumentVersion(GetDocumentVersionRequest request){var options = new InvokeOptions();options.RequestMarshaller = GetDocumentVersionRequestMarshaller.Instance;options.ResponseUnmarshaller = GetDocumentVersionResponseUnmarshaller.Instance;return Invoke<GetDocumentVersionResponse>(request, options);}
// Original:
public TermData subtract(TermData t1, TermData t2) {if (t2 == NO_OUTPUT) {return t1;}TermData ret;if (statsEqual(t1, t2) && bytesEqual(t1, t2)) {ret = NO_OUTPUT;} else {ret = new TermData(t1.bytes, t1.docFreq, t1.totalTermFreq);}return ret;}

// Translation:
public override TermData Subtract(TermData t1, TermData t2){if (Equals(t2, NO_OUTPUT))return t1;Debug.Assert(t1.longs.Length == t2.longs.Length);int pos = 0;long diff = 0;var share = new long[_longsSize];while (pos < _longsSize){share[pos] = t1.longs[pos] - t2.longs[pos];diff += share[pos];pos++;}TermData ret;if (diff == 0 && StatsEqual(t1, t2) && BytesEqual(t1, t2)){ret = NO_OUTPUT;}else{ret = new TermData(share, t1.bytes, t1.docFreq, t1.totalTermFreq);}return ret;}
// Original:
public ModifyCapacityReservationResult modifyCapacityReservation(ModifyCapacityReservationRequest request) {request = beforeClientExecution(request);return executeModifyCapacityReservation(request);}

// Translation:
public virtual ModifyCapacityReservationResponse ModifyCapacityReservation(ModifyCapacityReservationRequest request){var options = new InvokeOptions();options.RequestMarshaller = ModifyCapacityReservationRequestMarshaller.Instance;options.ResponseUnmarshaller = ModifyCapacityReservationResponseUnmarshaller.Instance;return Invoke<ModifyCapacityReservationResponse>(request, options);}
// Original:
@Override public int size() {synchronized (mutex) {return c.size();}}

// Translation:
public virtual int size(){lock (mutex){return c.size();}}
// Original:
public void decode(byte[] blocks, int blocksOffset, long[] values, int valuesOffset, int iterations) {for (int j = 0; j < iterations; ++j) {values[valuesOffset++] = blocks[blocksOffset++] & 0xFF;}}

// Translation:
public override void Decode(byte[] blocks, int blocksOffset, int[] values, int valuesOffset, int iterations){for (int j = 0; j < iterations; ++j){values[valuesOffset++] = blocks[blocksOffset++] & 0xFF;}}
// Original:
public int length() throws UnsupportedOperationException {if (this.type == TYPE_MALFORMED_INPUT || this.type == TYPE_UNMAPPABLE_CHAR) {return this.length;}throw new UnsupportedOperationException("length meaningless for " + toString());}

// Translation:
public virtual int length(){if (this.type == TYPE_MALFORMED_INPUT || this.type == TYPE_UNMAPPABLE_CHAR){return this._length;}throw new System.NotSupportedException("length meaningless for " + ToString());}
// Original:
public String toFormulaString() {throw invalid();}

// Translation:
public override String ToFormulaString(){throw Invalid();}
// Original:
public E next() {if (iterator.nextIndex() < end) {return iterator.next();}throw new NoSuchElementException();}

// Translation:
public E next(){if (iterator.nextIndex() < end){return iterator.next();}throw new java.util.NoSuchElementException();}
// Original:
public static String toHex(long value) {StringBuilder sb = new StringBuilder(16);writeHex(sb, value, 16, "");return sb.toString();}

// Translation:
public static string ToHex(byte value){return ToHex((long)value, 2);}
// Original:
public long get(int index) {final int o = index >>> 6;final int b = index & 63;final int shift = b << 0;return (blocks[o] >>> shift) & 1L;}

// Translation:
public override long Get(int index){int o = (int)((uint)index >> 6);int b = index & 63;int shift = b << 0;return ((long)((ulong)blocks[o] >> shift)) & 1L;}
// Original:
public int[] clear() {start = end = null;return super.clear();}

// Translation:
public override int[] Clear(){start = end = null;return base.Clear();}
// Original:
public TokenStream init(TokenStream tokenStream) {termAtt = tokenStream.addAttribute(CharTermAttribute.class);return null;}

// Translation:
public virtual TokenStream Init(TokenStream tokenStream){termAtt = tokenStream.AddAttribute<ICharTermAttribute>();return null;}
// Original:
public UpdateGameServerGroupResult updateGameServerGroup(UpdateGameServerGroupRequest request) {request = beforeClientExecution(request);return executeUpdateGameServerGroup(request);}

// Translation:
public virtual UpdateGameServerGroupResponse UpdateGameServerGroup(UpdateGameServerGroupRequest request){var options = new InvokeOptions();options.RequestMarshaller = UpdateGameServerGroupRequestMarshaller.Instance;options.ResponseUnmarshaller = UpdateGameServerGroupResponseUnmarshaller.Instance;return Invoke<UpdateGameServerGroupResponse>(request, options);}
// Original:
public UnmappableCharacterException(int length) {this.inputLength = length;}

// Translation:
public UnmappableCharacterException(int length){this.inputLength = length;}
// Original:
public UpdateIdentityProviderConfigurationResult updateIdentityProviderConfiguration(UpdateIdentityProviderConfigurationRequest request) {request = beforeClientExecution(request);return executeUpdateIdentityProviderConfiguration(request);}

// Translation:
public virtual UpdateIdentityProviderConfigurationResponse UpdateIdentityProviderConfiguration(UpdateIdentityProviderConfigurationRequest request){var options = new InvokeOptions();options.RequestMarshaller = UpdateIdentityProviderConfigurationRequestMarshaller.Instance;options.ResponseUnmarshaller = UpdateIdentityProviderConfigurationResponseUnmarshaller.Instance;return Invoke<UpdateIdentityProviderConfigurationResponse>(request, options);}
// Original:
@Override public int lastIndexOf(Object object) {Object[] a = array;if (object != null) {for (int i = size - 1; i >= 0; i--) {if (object.equals(a[i])) {return i;}}} else {for (int i = size - 1; i >= 0; i--) {if (a[i] == null) {return i;}}}return -1;}

// Translation:
public override int lastIndexOf(object @object){if (@object != null){{for (int i = a.Length - 1; i >= 0; i--){if (@object.Equals(a[i])){return i;}}}}else{{for (int i = a.Length - 1; i >= 0; i--){if ((object)a[i] == null){return i;}}}}return -1;}
// Original:
public ConstantScoreQueryBuilder(QueryBuilderFactory queryFactory) {this.queryFactory = queryFactory;}

// Translation:
public ConstantScoreQueryBuilder(FilterBuilderFactory filterFactory){this.filterFactory = filterFactory;}
// Original:
public int getNumberOfOnChannelTokens() {int n = 0;fill();for (int i = 0; i < tokens.size(); i++) {Token t = tokens.get(i);if ( t.getChannel()==channel ) n++;if ( t.getType()==Token.EOF ) break;}return n;}

// Translation:
public virtual int GetNumberOfOnChannelTokens(){int n = 0;Fill();for (int i = 0; i < tokens.Count; i++){IToken t = tokens[i];if (t.Channel == channel){n++;}if (t.Type == TokenConstants.EOF){break;}}return n;}
// Original:
public POIFSDocumentPath(final String [] components)throws IllegalArgumentException{if (components == null){this.components = new String[ 0 ];}else{this.components = new String[ components.length ];for (int j = 0; j < components.length; j++){if ((components[ j ] == null)|| (components[ j ].length() == 0)){throw new IllegalArgumentException("components cannot contain null or empty strings");}this.components[ j ] = components[ j ];}}}

// Translation:
public POIFSDocumentPath(string[] components){if (components == null){this.components = new string[0];}else{this.components = new string[components.Length];for (int i = 0; i < components.Length; i++){if ((components[i] == null)|| (components[i].Length == 0)){throw new ArgumentException("components cannot contain null or empty strings");}this.components[i] = components[i];}}}
// Original:
public SQLException(String theReason) {this(theReason, null, 0);}

// Translation:
public SQLException(string error) : base(error){throw new System.NotImplementedException();}
// Original:
public ListFragmentsResult listFragments(ListFragmentsRequest request) {request = beforeClientExecution(request);return executeListFragments(request);}

// Translation:
public virtual ListFragmentsResponse ListFragments(ListFragmentsRequest request){var options = new InvokeOptions();options.RequestMarshaller = ListFragmentsRequestMarshaller.Instance;options.ResponseUnmarshaller = ListFragmentsResponseUnmarshaller.Instance;return Invoke<ListFragmentsResponse>(request, options);}
// Original:
public QueryBuilder getQueryBuilder(String nodeName) {return builders.get(nodeName);}

// Translation:
public virtual IQueryBuilder GetQueryBuilder(string nodeName){IQueryBuilder result;builders.TryGetValue(nodeName, out result);return result;}
// Original:
public CreateDirectoryResult createDirectory(CreateDirectoryRequest request) {request = beforeClientExecution(request);return executeCreateDirectory(request);}

// Translation:
public virtual CreateDirectoryResponse CreateDirectory(CreateDirectoryRequest request){var options = new InvokeOptions();options.RequestMarshaller = CreateDirectoryRequestMarshaller.Instance;options.ResponseUnmarshaller = CreateDirectoryResponseUnmarshaller.Instance;return Invoke<CreateDirectoryResponse>(request, options);}
// Original:
public int getExternalSheetIndex(String workbookName, String sheetName) {return getOrCreateLinkTable().getExternalSheetIndex(workbookName, sheetName, sheetName);}

// Translation:
public int GetExternalSheetIndex(String workbookName, String sheetName){return OrCreateLinkTable.GetExternalSheetIndex(workbookName, sheetName, sheetName);}
// Original:
public V getValue() {return value;}

// Translation:
public virtual V getValue(){return value;}
// Original:
public K getKey() {return key;}

// Translation:
public virtual K getKey(){return key;}
// Original:
public boolean hasTransparentBounds() {return transparentBounds;}

// Translation:
public bool hasTransparentBounds(){return transparentBounds;}
// Original:
public void setKeepEmpty(boolean empty) {keepEmpty = empty;}

// Translation:
public virtual void SetKeepEmpty(bool empty){keepEmpty = empty;}
// Original:
public XPathRuleAnywhereElement(String ruleName, int ruleIndex) {super(ruleName);this.ruleIndex = ruleIndex;}

// Translation:
public XPathRuleAnywhereElement(string ruleName, int ruleIndex): base(ruleName){this.ruleIndex = ruleIndex;}
// Original:
public int getHeight(){return _height;}

// Translation:
public int GetHeight(){return height;}
// Original:
public final void write(OpenStringBuilder arr) {write(arr.buf, 0, len);}

// Translation:
public void Write(OpenStringBuilder arr){Write(arr.m_buf, 0, arr.Length); }
// Original:
public void jumpDrawablesToCurrentState() {super.jumpDrawablesToCurrentState();if (mThumb != null) mThumb.jumpToCurrentState();}

// Translation:
public override void jumpDrawablesToCurrentState(){base.jumpDrawablesToCurrentState();if (mThumb != null){mThumb.jumpToCurrentState();}}