yijunyu/c-to-rust huggingface dataset:
// Original:
public boolean removeValue(final int o){boolean rval = false;for (int j = 0; !rval && (j < _limit); j++){if (o == _array[ j ]){if (j+1 < _limit) {System.arraycopy(_array, j + 1, _array, j, _limit - j);}_limit--;rval = true;}}return rval;}

// Translation:
public bool RemoveValue(int o){bool rval = false;for (int j = 0; !rval && (j < _limit); j++){if (o == _array[j]){if (j + 1 < _limit){Array.Copy(_array, j + 1, _array, j, _limit - j);}_limit--;rval = true;}}return rval;}
// Original:
public String toString() {return new String(buf, 0, size());}

// Translation:
public override string ToString(){return new string(m_buf, 0, Length);}
// Original:
public void setDirCacheIterator(TreeWalk walk, int treeId) {state.walk = walk;state.dirCacheTree = treeId;}

// Translation:
public virtual void SetDirCacheIterator(TreeWalk walk, int treeId){state.walk = walk;state.dirCacheTree = treeId;}
// Original:
public DescribeOrganizationResult describeOrganization(DescribeOrganizationRequest request) {request = beforeClientExecution(request);return executeDescribeOrganization(request);}

// Translation:
public virtual DescribeOrganizationResponse DescribeOrganization(DescribeOrganizationRequest request){var options = new InvokeOptions();options.RequestMarshaller = DescribeOrganizationRequestMarshaller.Instance;options.ResponseUnmarshaller = DescribeOrganizationResponseUnmarshaller.Instance;return Invoke<DescribeOrganizationResponse>(request, options);}
// Original:
public CharsRef(int capacity) {chars = new char[capacity];}

// Translation:
public CharsRef(int capacity){chars = new char[capacity];}
// Original:
public RebootInstanceResult rebootInstance(RebootInstanceRequest request) {request = beforeClientExecution(request);return executeRebootInstance(request);}

// Translation:
public virtual RebootInstanceResponse RebootInstance(RebootInstanceRequest request){var options = new InvokeOptions();options.RequestMarshaller = RebootInstanceRequestMarshaller.Instance;options.ResponseUnmarshaller = RebootInstanceResponseUnmarshaller.Instance;return Invoke<RebootInstanceResponse>(request, options);}
// Original:
public static TreeFilter create(Collection<TreeFilter> list) {if (list.size() < 2)throw new IllegalArgumentException(JGitText.get().atLeastTwoFiltersNeeded);final TreeFilter[] subfilters = new TreeFilter[list.size()];list.toArray(subfilters);if (subfilters.length == 2)return create(subfilters[0], subfilters[1]);return new List(subfilters);}

// Translation:
public static TreeFilter Create(ICollection<TreeFilter> list){if (list.Count < 2){throw new ArgumentException(JGitText.Get().atLeastTwoFiltersNeeded);}TreeFilter[] subfilters = new TreeFilter[list.Count];Sharpen.Collections.ToArray(list, subfilters);if (subfilters.Length == 2){return Create(subfilters[0], subfilters[1]);}return new AndTreeFilter.List(subfilters);}
// Original:
public long ramBytesUsed() {long ramBytesUsed = BASE_RAM_BYTES_USED;ramBytesUsed += fields.size() * 2L * RamUsageEstimator.NUM_BYTES_OBJECT_REF;ramBytesUsed += formats.size() * 2L * RamUsageEstimator.NUM_BYTES_OBJECT_REF;for(Map.Entry<String,FieldsProducer> entry: formats.entrySet()) {ramBytesUsed += entry.getValue().ramBytesUsed();}return ramBytesUsed;}

// Translation:
public override long RamBytesUsed(){long size = 0;foreach (KeyValuePair<string, DocValuesProducer> entry in formats){size += (entry.Key.Length * RamUsageEstimator.NUM_BYTES_CHAR)+ entry.Value.RamBytesUsed();}return size;}
// Original:
public ExportApiResult exportApi(ExportApiRequest request) {request = beforeClientExecution(request);return executeExportApi(request);}

// Translation:
public virtual ExportApiResponse ExportApi(ExportApiRequest request){var options = new InvokeOptions();options.RequestMarshaller = ExportApiRequestMarshaller.Instance;options.ResponseUnmarshaller = ExportApiResponseUnmarshaller.Instance;return Invoke<ExportApiResponse>(request, options);}
// Original:
public void setExpectedOldObjectId(AnyObjectId id) {expValue = id != null ? id.toObjectId() : null;}

// Translation:
public virtual void SetExpectedOldObjectId(AnyObjectId id){expValue = id != null ? id.ToObjectId() : null;}
// Original:
public void skipBytes(long count) {pos += count;}

// Translation:
public override void SkipBytes(int count){pos += count;}
// Original:
public String toString(){return String.valueOf(_value);}

// Translation:
public override String ToString(){return Convert.ToString(_value, CultureInfo.CurrentCulture);}
// Original:
public boolean isPopupShowing() {return mPopup.isShowing();}

// Translation:
public virtual bool isPopupShowing(){return mPopup.isShowing();}
// Original:
public DBClusterSnapshot deleteDBClusterSnapshot(DeleteDBClusterSnapshotRequest request) {request = beforeClientExecution(request);return executeDeleteDBClusterSnapshot(request);}

// Translation:
public virtual DeleteDBClusterSnapshotResponse DeleteDBClusterSnapshot(DeleteDBClusterSnapshotRequest request){var options = new InvokeOptions();options.RequestMarshaller = DeleteDBClusterSnapshotRequestMarshaller.Instance;options.ResponseUnmarshaller = DeleteDBClusterSnapshotResponseUnmarshaller.Instance;return Invoke<DeleteDBClusterSnapshotResponse>(request, options);}
// Original:
public Filter(String name, java.util.List<String> values) {setName(name);setValues(values);}

// Translation:
public Filter(string name, List<string> values){_name = name;_values = values;}
// Original:
public SearchRoomsResult searchRooms(SearchRoomsRequest request) {request = beforeClientExecution(request);return executeSearchRooms(request);}

// Translation:
public virtual SearchRoomsResponse SearchRooms(SearchRoomsRequest request){var options = new InvokeOptions();options.RequestMarshaller = SearchRoomsRequestMarshaller.Instance;options.ResponseUnmarshaller = SearchRoomsResponseUnmarshaller.Instance;return Invoke<SearchRoomsResponse>(request, options);}
// Original:
public int read(byte[] buf, int off, int cnt) throws IOException {try {beginRead();return super.read(buf, off, cnt);} catch (InterruptedIOException e) {throw readTimedOut(e);} finally {endRead();}}

// Translation:
public override int Read(byte[] buf, int off, int cnt){try{BeginRead();return base.Read(buf, off, cnt);}catch (ThreadInterruptedException){throw ReadTimedOut();}finally{EndRead();}}
// Original:
public DeleteLoadBalancerTlsCertificateResult deleteLoadBalancerTlsCertificate(DeleteLoadBalancerTlsCertificateRequest request) {request = beforeClientExecution(request);return executeDeleteLoadBalancerTlsCertificate(request);}

// Translation:
public virtual DeleteLoadBalancerTlsCertificateResponse DeleteLoadBalancerTlsCertificate(DeleteLoadBalancerTlsCertificateRequest request){var options = new InvokeOptions();options.RequestMarshaller = DeleteLoadBalancerTlsCertificateRequestMarshaller.Instance;options.ResponseUnmarshaller = DeleteLoadBalancerTlsCertificateResponseUnmarshaller.Instance;return Invoke<DeleteLoadBalancerTlsCertificateResponse>(request, options);}
// Original:
public static MessageDigest newMessageDigest() {try {return MessageDigest.getInstance(HASH_FUNCTION);} catch (NoSuchAlgorithmException nsae) {throw new RuntimeException(MessageFormat.format(JGitText.get().requiredHashFunctionNotAvailable, HASH_FUNCTION), nsae);}}

// Translation:
public static MessageDigest NewMessageDigest(){try{return MessageDigest.GetInstance(HASH_FUNCTION);}catch (NoSuchAlgorithmException nsae){throw new RuntimeException(MessageFormat.Format(JGitText.Get().requiredHashFunctionNotAvailable, HASH_FUNCTION), nsae);}}
// Original:
public IfFunction(ValueSource ifSource, ValueSource trueSource, ValueSource falseSource) {this.ifSource = ifSource;this.trueSource = trueSource;this.falseSource = falseSource;}

// Translation:
public IfFunction(ValueSource ifSource, ValueSource trueSource, ValueSource falseSource){this.ifSource = ifSource;this.trueSource = trueSource;this.falseSource = falseSource;}
// Original:
public static double npv(double r, double[] cfs) {double npv = 0;double r1 = r + 1;double trate = r1;for (int i=0, iSize=cfs.length; i<iSize; i++) {npv += cfs[i] / trate;trate *= r1;}return npv;}

// Translation:
public static double npv(double r, double[] cfs){double npv = 0;double r1 = r + 1;double trate = r1;for (int i = 0, iSize = cfs.Length; i < iSize; i++){npv += cfs[i] / trate;trate *= r1;}return npv;}
// Original:
public StandardQueryTreeBuilder() {setBuilder(GroupQueryNode.class, new GroupQueryNodeBuilder());setBuilder(FieldQueryNode.class, new FieldQueryNodeBuilder());setBuilder(BooleanQueryNode.class, new BooleanQueryNodeBuilder());setBuilder(FuzzyQueryNode.class, new FuzzyQueryNodeBuilder());setBuilder(PointQueryNode.class, new DummyQueryNodeBuilder());setBuilder(PointRangeQueryNode.class, new PointRangeQueryNodeBuilder());setBuilder(BoostQueryNode.class, new BoostQueryNodeBuilder());setBuilder(ModifierQueryNode.class, new ModifierQueryNodeBuilder());setBuilder(WildcardQueryNode.class, new WildcardQueryNodeBuilder());setBuilder(TokenizedPhraseQueryNode.class, new PhraseQueryNodeBuilder());setBuilder(MatchNoDocsQueryNode.class, new MatchNoDocsQueryNodeBuilder());setBuilder(PrefixWildcardQueryNode.class,new PrefixWildcardQueryNodeBuilder());setBuilder(TermRangeQueryNode.class, new TermRangeQueryNodeBuilder());setBuilder(RegexpQueryNode.class, new RegexpQueryNodeBuilder());setBuilder(SlopQueryNode.class, new SlopQueryNodeBuilder());setBuilder(SynonymQueryNode.class,new SynonymQueryNodeBuilder());setBuilder(MultiPhraseQueryNode.class, new MultiPhraseQueryNodeBuilder());setBuilder(MatchAllDocsQueryNode.class, new MatchAllDocsQueryNodeBuilder());}

// Translation:
public StandardQueryTreeBuilder(){SetBuilder(typeof(GroupQueryNode), new GroupQueryNodeBuilder());SetBuilder(typeof(FieldQueryNode), new FieldQueryNodeBuilder());SetBuilder(typeof(BooleanQueryNode), new BooleanQueryNodeBuilder());SetBuilder(typeof(FuzzyQueryNode), new FuzzyQueryNodeBuilder());SetBuilder(typeof(NumericQueryNode), new DummyQueryNodeBuilder());SetBuilder(typeof(NumericRangeQueryNode), new NumericRangeQueryNodeBuilder());SetBuilder(typeof(BoostQueryNode), new BoostQueryNodeBuilder());SetBuilder(typeof(ModifierQueryNode), new ModifierQueryNodeBuilder());SetBuilder(typeof(WildcardQueryNode), new WildcardQueryNodeBuilder());SetBuilder(typeof(TokenizedPhraseQueryNode), new PhraseQueryNodeBuilder());SetBuilder(typeof(MatchNoDocsQueryNode), new MatchNoDocsQueryNodeBuilder());SetBuilder(typeof(PrefixWildcardQueryNode),new PrefixWildcardQueryNodeBuilder());SetBuilder(typeof(TermRangeQueryNode), new TermRangeQueryNodeBuilder());SetBuilder(typeof(RegexpQueryNode), new RegexpQueryNodeBuilder());SetBuilder(typeof(SlopQueryNode), new SlopQueryNodeBuilder());SetBuilder(typeof(StandardBooleanQueryNode),new StandardBooleanQueryNodeBuilder());SetBuilder(typeof(MultiPhraseQueryNode), new MultiPhraseQueryNodeBuilder());SetBuilder(typeof(MatchAllDocsQueryNode), new MatchAllDocsQueryNodeBuilder());}
// Original:
public StringBuilder append(double d) {RealToString.getInstance().appendDouble(this, d);return this;}

// Translation:
public java.lang.StringBuilder append(bool b){append0(b ? "true" : "false");return this;}
// Original:
public Tag(String key, String value) {setKey(key);setValue(value);}

// Translation:
public Tag(string key, string value){_key = key;_value = value;}
// Original:
public FederatedUser(String federatedUserId, String arn) {setFederatedUserId(federatedUserId);setArn(arn);}

// Translation:
public FederatedUser(string federatedUserId, string arn){_federatedUserId = federatedUserId;_arn = arn;}
// Original:
public QueryRescorer(Query query) {this.query = query;}

// Translation:
public QueryRescorer(Query query){this.query = query;}
// Original:
public void setRule(int idx, HSSFConditionalFormattingRule cfRule) {cfAggregate.setRule(idx, cfRule.getCfRuleRecord());}

// Translation:
public void SetRule(int idx, HSSFConditionalFormattingRule cfRule){cfAggregate.SetRule(idx, cfRule.CfRuleRecord);}
// Original:
public RenameDetector getRenameDetector() {return renameDetector;}

// Translation:
public virtual RenameDetector GetRenameDetector(){return renameDetector;}
// Original:
public UpdateTemplatePermissionsResult updateTemplatePermissions(UpdateTemplatePermissionsRequest request) {request = beforeClientExecution(request);return executeUpdateTemplatePermissions(request);}

// Translation:
public virtual UpdateTemplatePermissionsResponse UpdateTemplatePermissions(UpdateTemplatePermissionsRequest request){var options = new InvokeOptions();options.RequestMarshaller = UpdateTemplatePermissionsRequestMarshaller.Instance;options.ResponseUnmarshaller = UpdateTemplatePermissionsResponseUnmarshaller.Instance;return Invoke<UpdateTemplatePermissionsResponse>(request, options);}
// Original:
public DoubleBuffer put(int index, double c) {checkIndex(index);byteBuffer.putDouble(index * SizeOf.DOUBLE, c);return this;}

// Translation:
public override java.nio.DoubleBuffer put(int index, double c){checkIndex(index);byteBuffer.putDouble(index * libcore.io.SizeOf.DOUBLE, c);return this;}
// Original:
public ResetInstanceAttributeResult resetInstanceAttribute(ResetInstanceAttributeRequest request) {request = beforeClientExecution(request);return executeResetInstanceAttribute(request);}

// Translation:
public virtual ResetInstanceAttributeResponse ResetInstanceAttribute(ResetInstanceAttributeRequest request){var options = new InvokeOptions();options.RequestMarshaller = ResetInstanceAttributeRequestMarshaller.Instance;options.ResponseUnmarshaller = ResetInstanceAttributeResponseUnmarshaller.Instance;return Invoke<ResetInstanceAttributeResponse>(request, options);}
// Original:
public DirectoryEntry getDirectory() throws IOException {EmbeddedObjectRefSubRecord subRecord = findObjectRecord();int streamId = subRecord.getStreamId().intValue();String streamName = "MBD" + HexDump.toHex(streamId);Entry entry = _root.getEntry(streamName);if (entry instanceof DirectoryEntry) {return (DirectoryEntry) entry;}throw new IOException("Stream " + streamName + " was not an OLE2 directory");}

// Translation:
public DirectoryEntry GetDirectory(){EmbeddedObjectRefSubRecord subRecord = FindObjectRecord();int? streamId = ((EmbeddedObjectRefSubRecord)subRecord).StreamId;String streamName = "MBD" + HexDump.ToHex((int)streamId);Entry entry = _root.GetEntry(streamName);if (entry is DirectoryEntry){return (DirectoryEntry)entry;}else{throw new IOException("Stream " + streamName + " was not an OLE2 directory");}}
// Original:
public HashMap(int capacity) {if (capacity < 0) {throw new IllegalArgumentException("Capacity: " + capacity);}if (capacity == 0) {@SuppressWarnings("unchecked")HashMapEntry<K, V>[] tab = (HashMapEntry<K, V>[]) EMPTY_TABLE;table = tab;threshold = -1; return;}if (capacity < MINIMUM_CAPACITY) {capacity = MINIMUM_CAPACITY;} else if (capacity > MAXIMUM_CAPACITY) {capacity = MAXIMUM_CAPACITY;} else {capacity = roundUpToPowerOfTwo(capacity);}makeTable(capacity);}

// Translation:
public HashMap(int capacity){if (capacity < 0){throw new System.ArgumentException("Capacity: " + capacity);}if (capacity == 0){java.util.HashMap.HashMapEntry<K, V>[] tab = (java.util.HashMap.HashMapEntry<K, V>[])EMPTY_TABLE;table = tab;threshold = -1;return;}if (capacity < java.util.HashMap.MINIMUM_CAPACITY){capacity = java.util.HashMap.MINIMUM_CAPACITY;}else{if (capacity > java.util.HashMap.MAXIMUM_CAPACITY){capacity = java.util.HashMap.MAXIMUM_CAPACITY;}else{capacity = roundUpToPowerOfTwo(capacity);}}makeTable(capacity);}
// Original:
public int getCachedErrorValue() {return specialCachedValue.getErrorValue();}

// Translation:
public int GetCachedErrorValue(){return specialCachedValue.GetErrorValue();}
// Original:
public void add(BytesRef utf8) throws IOException {if (writer == null) {throw new IllegalStateException();}writer.write(utf8);}

// Translation:
public virtual void Add(BytesRef utf8){if (writer == null){throw new InvalidOperationException();}writer.Write(utf8);}
// Original:
public UpdateHITReviewStatusResult updateHITReviewStatus(UpdateHITReviewStatusRequest request) {request = beforeClientExecution(request);return executeUpdateHITReviewStatus(request);}

// Translation:
public virtual UpdateHITReviewStatusResponse UpdateHITReviewStatus(UpdateHITReviewStatusRequest request){var options = new InvokeOptions();options.RequestMarshaller = UpdateHITReviewStatusRequestMarshaller.Instance;options.ResponseUnmarshaller = UpdateHITReviewStatusResponseUnmarshaller.Instance;return Invoke<UpdateHITReviewStatusResponse>(request, options);}
// Original:
public ScandinavianNormalizationFilterFactory(Map<String, String> args) {super(args);if (!args.isEmpty()) {throw new IllegalArgumentException("Unknown parameters: " + args);}}

// Translation:
public ScandinavianNormalizationFilterFactory(IDictionary<string, string> args): base(args){if (args.Count > 0){throw new System.ArgumentException("Unknown parameters: " + args);}}
// Original:
public DBSnapshotAttributesResult describeDBSnapshotAttributes(DescribeDBSnapshotAttributesRequest request) {request = beforeClientExecution(request);return executeDescribeDBSnapshotAttributes(request);}

// Translation:
public virtual DescribeDBSnapshotAttributesResponse DescribeDBSnapshotAttributes(DescribeDBSnapshotAttributesRequest request){var options = new InvokeOptions();options.RequestMarshaller = DescribeDBSnapshotAttributesRequestMarshaller.Instance;options.ResponseUnmarshaller = DescribeDBSnapshotAttributesResponseUnmarshaller.Instance;return Invoke<DescribeDBSnapshotAttributesResponse>(request, options);}
// Original:
public GetNamespaceAuthorizationListRequest() {super("cr", "2016-06-07", "GetNamespaceAuthorizationList", "cr");setUriPattern("/namespace/[Namespace]/authorizations");setMethod(MethodType.GET);}

// Translation:
public GetNamespaceAuthorizationListRequest(): base("cr", "2016-06-07", "GetNamespaceAuthorizationList", "cr", "openAPI"){UriPattern = "/namespace/[Namespace]/authorizations";Method = MethodType.GET;}
// Original:
public LowFreqTerm(int[] postings, byte[] payloads, int docFreq, int totalTermFreq) {this.postings = postings;this.payloads = payloads;this.docFreq = docFreq;this.totalTermFreq = totalTermFreq;}

// Translation:
public LowFreqTerm(int[] postings, byte[] payloads, int docFreq, int totalTermFreq){this.postings = postings;this.payloads = payloads;this.docFreq = docFreq;this.totalTermFreq = totalTermFreq;}
// Original:
public void reset() {state = null;consumed = true;keepOrig = false;matched = false;}

// Translation:
public void Reset(){state = null;consumed = true;keepOrig = false;matched = false;}
// Original:
public static final boolean isId(String id) {if (id.length() < 2 || Constants.OBJECT_ID_STRING_LENGTH < id.length())return false;try {for (int i = 0; i < id.length(); i++)RawParseUtils.parseHexInt4((byte) id.charAt(i));return true;} catch (ArrayIndexOutOfBoundsException e) {return false;}}

// Translation:
public static bool IsId(string id){if (id.Length < 2 || Constants.OBJECT_ID_STRING_LENGTH < id.Length){return false;}try{for (int i = 0; i < id.Length; i++){RawParseUtils.ParseHexInt4(unchecked((byte)id[i]));}return true;}catch (IndexOutOfRangeException){return false;}}
// Original:
public static int entrySize(FileMode mode, int nameLen) {return mode.copyToLength() + nameLen + OBJECT_ID_LENGTH + 2;}

// Translation:
public static int EntrySize(FileMode mode, int nameLen){return mode.CopyToLength() + nameLen + Constants.OBJECT_ID_LENGTH + 2;}
// Original:
public void exitEveryRule(ParserRuleContext ctx) {System.out.println("exit    "+getRuleNames()[ctx.getRuleIndex()]+", LT(1)="+_input.LT(1).getText());}

// Translation:
public virtual void ExitEveryRule(ParserRuleContext ctx){Output.WriteLine("exit    " + this._enclosing.RuleNames[ctx.RuleIndex] + ", LT(1)=" + this._enclosing._input.LT(1).Text);}
// Original:
public EventSubscription modifyEventSubscription(ModifyEventSubscriptionRequest request) {request = beforeClientExecution(request);return executeModifyEventSubscription(request);}

// Translation:
public virtual ModifyEventSubscriptionResponse ModifyEventSubscription(ModifyEventSubscriptionRequest request){var options = new InvokeOptions();options.RequestMarshaller = ModifyEventSubscriptionRequestMarshaller.Instance;options.ResponseUnmarshaller = ModifyEventSubscriptionResponseUnmarshaller.Instance;return Invoke<ModifyEventSubscriptionResponse>(request, options);}
// Original:
public NormalizeCharMap build() {final FST<CharsRef> map;try {final Outputs<CharsRef> outputs = CharSequenceOutputs.getSingleton();final FSTCompiler<CharsRef> fstCompiler = new FSTCompiler<>(FST.INPUT_TYPE.BYTE2, outputs);final IntsRefBuilder scratch = new IntsRefBuilder();for(Map.Entry<String,String> ent : pendingPairs.entrySet()) {fstCompiler.add(Util.toUTF16(ent.getKey(), scratch),new CharsRef(ent.getValue()));}map = fstCompiler.compile();pendingPairs.clear();} catch (IOException ioe) {throw new RuntimeException(ioe);}return new NormalizeCharMap(map);}

// Translation:
public virtual NormalizeCharMap Build(){FST<CharsRef> map;try{Outputs<CharsRef> outputs = CharSequenceOutputs.Singleton;Builder<CharsRef> builder = new Builder<CharsRef>(FST.INPUT_TYPE.BYTE2, outputs);Int32sRef scratch = new Int32sRef();foreach (var ent in pendingPairs){builder.Add(Lucene.Net.Util.Fst.Util.ToUTF16(ent.Key, scratch), new CharsRef(ent.Value));}map = builder.Finish();pendingPairs.Clear();}catch (IOException ioe){throw new Exception("Should never happen", ioe);}return new NormalizeCharMap(map);}
// Original:
public BootstrapActions(String bucket) {this.bucket = bucket;}

// Translation:
public BootstrapActions(string bucket){this.bucket = bucket;}
// Original:
public ValueEval evaluate(int srcRowIndex, int srcColumnIndex, ValueEval arg0) {ValueEval ve;try {ve = OperandResolver.getSingleValue(arg0, srcRowIndex, srcColumnIndex);} catch (EvaluationException e) {ve = e.getErrorEval();}return BoolEval.valueOf(evaluate(ve));}

// Translation:
public override ValueEval Evaluate(int srcRowIndex, int srcColumnIndex, ValueEval arg0){ValueEval ve;try{ve = OperandResolver.GetSingleValue(arg0, srcRowIndex, srcColumnIndex);}catch (EvaluationException e){ve = e.GetErrorEval();}return BoolEval.ValueOf(Evaluate(ve));}
// Original:
public static IndexDeletionPolicy getIndexDeletionPolicy(Config config) {String deletionPolicyName = config.get("deletion.policy", "org.apache.lucene.index.KeepOnlyLastCommitDeletionPolicy");if (deletionPolicyName.equals(NoDeletionPolicy.class.getName())) {return NoDeletionPolicy.INSTANCE;} else {try {return Class.forName(deletionPolicyName).asSubclass(IndexDeletionPolicy.class).getConstructor().newInstance();} catch (Exception e) {

// Translation:
public static IndexDeletionPolicy GetIndexDeletionPolicy(Config config){string deletionPolicyName = config.Get("deletion.policy", "Lucene.Net.Index.KeepOnlyLastCommitDeletionPolicy, Lucene.Net");Type deletionPolicyType = Type.GetType(deletionPolicyName);if (deletionPolicyType == null){throw new Exception("Unrecognized deletion policy type '" + deletionPolicyName + "'");}else if (deletionPolicyType.Equals(typeof(NoDeletionPolicy))){return NoDeletionPolicy.INSTANCE;}else{try{return (IndexDeletionPolicy)Activator.CreateInstance(deletionPolicyType);}catch (Exception e){