yijunyu/c-to-rust huggingface dataset:
// Original:
public PutAccountSettingDefaultResult putAccountSettingDefault(PutAccountSettingDefaultRequest request) {request = beforeClientExecution(request);return executePutAccountSettingDefault(request);}

// Translation:
public virtual PutAccountSettingDefaultResponse PutAccountSettingDefault(PutAccountSettingDefaultRequest request){var options = new InvokeOptions();options.RequestMarshaller = PutAccountSettingDefaultRequestMarshaller.Instance;options.ResponseUnmarshaller = PutAccountSettingDefaultResponseUnmarshaller.Instance;return Invoke<PutAccountSettingDefaultResponse>(request, options);}
// Original:
public static Path categoriesLineFile(Path f) {Path dir = f.toAbsolutePath().getParent();String categoriesName = "categories-"+f.getFileName();return dir.resolve(categoriesName);}

// Translation:
public static FileInfo CategoriesLineFile(FileInfo f){DirectoryInfo dir = f.Directory;string categoriesName = "categories-" + f.Name;return dir == null ? new FileInfo(categoriesName) : new FileInfo(System.IO.Path.Combine(dir.FullName, categoriesName));}
// Original:
public String toJson() {return new JsonPolicyWriter().writePolicyToString(this);}

// Translation:
public string ToJson(){return ToJson(true);}
// Original:
public String getFunctionName(int idx) {return _funcMap.get(idx);}

// Translation:
public String GetFunctionName(int idx){return _funcMap[idx];}
// Original:
public RecordHandlerProgressResult recordHandlerProgress(RecordHandlerProgressRequest request) {request = beforeClientExecution(request);return executeRecordHandlerProgress(request);}

// Translation:
public virtual RecordHandlerProgressResponse RecordHandlerProgress(RecordHandlerProgressRequest request){var options = new InvokeOptions();options.RequestMarshaller = RecordHandlerProgressRequestMarshaller.Instance;options.ResponseUnmarshaller = RecordHandlerProgressResponseUnmarshaller.Instance;return Invoke<RecordHandlerProgressResponse>(request, options);}
// Original:
public synchronized StringBuffer insert(int index, char[] chars, int start, int length) {insert0(index, chars, start, length);return this;}

// Translation:
public java.lang.StringBuffer insert(int index, char[] chars, int start, int length_1){lock (this){insert0(index, chars, start, length_1);return this;}}
// Original:
public RevObject lookupAny(AnyObjectId id, int type) {RevObject r = objects.get(id);if (r == null) {switch (type) {case Constants.OBJ_COMMIT:r = createCommit(id);break;case Constants.OBJ_TREE:r = new RevTree(id);break;case Constants.OBJ_BLOB:r = new RevBlob(id);break;case Constants.OBJ_TAG:r = new RevTag(id);break;default:throw new IllegalArgumentException(MessageFormat.format(JGitText.get().invalidGitType, Integer.valueOf(type)));}objects.add(r);}return r;}

// Translation:
public virtual RevObject LookupAny(AnyObjectId id, int type){RevObject r = objects.Get(id);if (r == null){switch (type){case Constants.OBJ_COMMIT:{r = CreateCommit(id);break;}case Constants.OBJ_TREE:{r = new RevTree(id);break;}case Constants.OBJ_BLOB:{r = new RevBlob(id);break;}case Constants.OBJ_TAG:{r = new RevTag(id);break;}default:{throw new ArgumentException(MessageFormat.Format(JGitText.Get().invalidGitType, Sharpen.Extensions.ValueOf(type)));}}objects.Add(r);}return r;}
// Original:
public BytesRef encode(char[] buffer) {return encode(buffer, 0, buffer.length);}

// Translation:
public virtual BytesRef Encode(char[] buffer){return Encode(buffer, 0, buffer.Length);}
// Original:
public StringBuilder append(int i) {IntegralToString.appendInt(this, i);return this;}

// Translation:
public java.lang.StringBuilder append(char c){append0(c);return this;}
// Original:
public void removeName(Name name) {int index = getNameIndex((HSSFName) name);removeName(index);}

// Translation:
public void RemoveName(String name){int index = GetNameIndex(name);RemoveName(index);}
// Original:
public WrappedPositionArray() {for(int i=0;i<positions.length;i++) {positions[i] = new Position();}}

// Translation:
public WrappedPositionArray(){for (int i = 0; i < positions.Length; i++){positions[i] = new Position();}}
// Original:
public PasswordRev4Record(int pw) {field_1_password = pw;}

// Translation:
public PasswordRev4Record(int pw){field_1_password = pw;}
// Original:
public static String intToHex(int value) {StringBuilder sb = new StringBuilder(10);writeHex(sb, value & 0xFFFFFFFFL, 8, "0x");return sb.toString();}

// Translation:
public static char[] IntToHex(int value){return ToHexChars(value, 4);}
// Original:
public RemovePermissionRequest(String topicArn, String label) {setTopicArn(topicArn);setLabel(label);}

// Translation:
public RemovePermissionRequest(string topicArn, string label){_topicArn = topicArn;_label = label;}
// Original:
public UpdateOrganizationConfigurationResult updateOrganizationConfiguration(UpdateOrganizationConfigurationRequest request) {request = beforeClientExecution(request);return executeUpdateOrganizationConfiguration(request);}

// Translation:
public virtual UpdateOrganizationConfigurationResponse UpdateOrganizationConfiguration(UpdateOrganizationConfigurationRequest request){var options = new InvokeOptions();options.RequestMarshaller = UpdateOrganizationConfigurationRequestMarshaller.Instance;options.ResponseUnmarshaller = UpdateOrganizationConfigurationResponseUnmarshaller.Instance;return Invoke<UpdateOrganizationConfigurationResponse>(request, options);}
// Original:
public void seekExact(BytesRef target, TermState otherState) {assert otherState != null && otherState instanceof BlockTermState;assert !doOrd || ((BlockTermState) otherState).ord < numTerms;state.copyFrom(otherState);seekPending = true;indexIsCurrent = false;term.copyBytes(target);}

// Translation:
public override void SeekExact(BytesRef target, TermState otherState){if (!target.Equals(term)){state.CopyFrom(otherState);term = BytesRef.DeepCopyOf(target);seekPending = true;}}
// Original:
public void println() {newline();}

// Translation:
public virtual void println(){newline();}
// Original:
public String toString() {return "NRTCachingDirectory(" + in + "; maxCacheMB=" + (maxCachedBytes/1024/1024.) + " maxMergeSizeMB=" + (maxMergeSizeBytes/1024/1024.) + ")";}

// Translation:
public override string ToString(){return "NRTCachingDirectory(" + @delegate + "; maxCacheMB=" + (maxCachedBytes / 1024 / 1024.0) + " maxMergeSizeMB=" + (maxMergeSizeBytes / 1024 / 1024.0) + ")";}
// Original:
public DescribeWorkforceResult describeWorkforce(DescribeWorkforceRequest request) {request = beforeClientExecution(request);return executeDescribeWorkforce(request);}

// Translation:
public virtual DescribeWorkforceResponse DescribeWorkforce(DescribeWorkforceRequest request){var options = new InvokeOptions();options.RequestMarshaller = DescribeWorkforceRequestMarshaller.Instance;options.ResponseUnmarshaller = DescribeWorkforceResponseUnmarshaller.Instance;return Invoke<DescribeWorkforceResponse>(request, options);}
// Original:
public ToggleFeaturesRequest() {super("CloudPhoto", "2017-07-11", "ToggleFeatures", "cloudphoto");setProtocol(ProtocolType.HTTPS);}

// Translation:
public ToggleFeaturesRequest(): base("CloudPhoto", "2017-07-11", "ToggleFeatures", "cloudphoto", "openAPI"){Protocol = ProtocolType.HTTPS;}
// Original:
public synchronized StringBuffer append(char[] chars, int start, int length) {append0(chars, start, length);return this;}

// Translation:
public java.lang.StringBuffer append(char[] chars, int start, int length_1){lock (this){append0(chars, start, length_1);return this;}}
// Original:
public ShortBuffer put(short c) {if (position == limit) {throw new BufferOverflowException();}byteBuffer.putShort(position++ * SizeOf.SHORT, c);return this;}

// Translation:
public override java.nio.ShortBuffer put(short c){if (_position == _limit){throw new java.nio.BufferOverflowException();}byteBuffer.putShort(_position++ * libcore.io.SizeOf.SHORT, c);return this;}
// Original:
public char last() {index = (limit == start) ? limit : limit - 1;return current();}

// Translation:
public override char Last(){index = (limit == start) ? limit : limit - 1;return Current;}
// Original:
public WeightedSpanTermExtractor(String defaultField) {this.defaultField = defaultField;}

// Translation:
public WeightedSpanTermExtractor(string defaultField){if (defaultField != null){this.defaultField = defaultField.Intern();}}
// Original:
public StringReader(String str) {this.str = str;this.count = str.length();}

// Translation:
public StringReader(string str){this.str = str;this.count = str.Length;}
// Original:
public GetThumbnailsRequest() {super("CloudPhoto", "2017-07-11", "GetThumbnails", "cloudphoto");setProtocol(ProtocolType.HTTPS);}

// Translation:
public GetThumbnailsRequest(): base("CloudPhoto", "2017-07-11", "GetThumbnails", "cloudphoto", "openAPI"){Protocol = ProtocolType.HTTPS;}
// Original:
public TagCommand setName(String name) {checkCallable();this.name = name;return this;}

// Translation:
public virtual NGit.Api.TagCommand SetName(string name){CheckCallable();this.name = name;return this;}
// Original:
@Override public String toString() {synchronized (mutex) {return c.toString();}}

// Translation:
public override string ToString(){lock (mutex){return c.ToString();}}
// Original:
public String toString() {return toString((List<String>)null, (RuleContext)null);}

// Translation:
public override string ToString(){return ToString((IList<string>)null, (Antlr4.Runtime.RuleContext)null);}
// Original:
public String toString() {return "StandardDirectoryReader.ReaderCommit(" + segmentsFileName + " files=" + files + ")";}

// Translation:
public override string ToString(){return "DirectoryReader.ReaderCommit(" + segmentsFileName + ")";}
// Original:
public int fillFields(byte[] data, int offset, EscherRecordFactory recordFactory) {int bytesAfterHeader = readHeader( data, offset );int pos              = offset + HEADER_SIZE;field_pictureData = IOUtils.safelyAllocate(bytesAfterHeader, MAX_RECORD_LENGTH);System.arraycopy(data, pos, field_pictureData, 0, bytesAfterHeader);return bytesAfterHeader + 8;}

// Translation:
public override int FillFields(byte[] data, int offset, IEscherRecordFactory recordFactory){int bytesAfterHeader = ReadHeader(data, offset);int pos = offset + HEADER_SIZE;field_pictureData = new byte[bytesAfterHeader];Array.Copy(data, pos, field_pictureData, 0, bytesAfterHeader);return bytesAfterHeader + 8;}
// Original:
public static int[] copyOf(int[] original, int newLength) {if (newLength < 0) {throw new NegativeArraySizeException();}return copyOfRange(original, 0, newLength);}

// Translation:
public static int[] copyOf(int[] original, int newLength){if (newLength < 0){throw new java.lang.NegativeArraySizeException();}return copyOfRange(original, 0, newLength);}
// Original:
public void serialize(LittleEndianOutput out) {out.write(data);}

// Translation:
public void Serialize(ILittleEndianOutput out1){out1.Write(data);}
// Original:
public E get(int location) {if (location >= 0 && location < size) {Link<E> link = voidLink;if (location < (size / 2)) {for (int i = 0; i <= location; i++) {link = link.next;}} else {for (int i = size; i > location; i--) {link = link.previous;}}return link.data;}throw new IndexOutOfBoundsException();}

// Translation:
public override E get(int location){if (location >= 0 && location < _size){java.util.LinkedList.Link<E> link = voidLink;if (location < (_size / 2)){{for (int i = 0; i <= location; i++){link = link.next;}}}else{{for (int i = _size; i > location; i--){link = link.previous;}}}return link.data;}throw new System.IndexOutOfRangeException();}
// Original:
public static boolean hasExactSharedBorder(CellRangeAddress crA, CellRangeAddress crB) {int oFirstRow = crB.getFirstRow();int oLastRow  = crB.getLastRow();int oFirstCol = crB.getFirstColumn();int oLastCol  = crB.getLastColumn();if (crA.getFirstRow() > 0 && crA.getFirstRow()-1 == oLastRow ||oFirstRow > 0 && oFirstRow-1 == crA.getLastRow()) {return crA.getFirstColumn() == oFirstCol && crA.getLastColumn() == oLastCol;}if (crA.getFirstColumn()>0 && crA.getFirstColumn() - 1 == oLastCol ||oFirstCol>0 && crA.getLastColumn() == oFirstCol -1) {return crA.getFirstRow() == oFirstRow && crA.getLastRow() == oLastRow;}return false;}

// Translation:
public static bool HasExactSharedBorder(CellRangeAddress crA, CellRangeAddress crB){int oFirstRow = crB.FirstRow;int oLastRow = crB.LastRow;int oFirstCol = crB.FirstColumn;int oLastCol = crB.LastColumn;if (crA.FirstRow > 0 && crA.FirstRow - 1 == oLastRow ||oFirstRow > 0 && oFirstRow - 1 == crA.LastRow){return crA.FirstColumn == oFirstCol && crA.LastColumn == oLastCol;}if (crA.FirstColumn > 0 && crA.FirstColumn - 1 == oLastCol ||oFirstCol > 0 && crA.LastColumn == oFirstCol - 1){return crA.FirstRow == oFirstRow && crA.LastRow == oLastRow;}return false;}
// Original:
public void visitCellsForRow(int rowIndex, RecordVisitor rv) {CellValueRecordInterface[] rowCells = records[rowIndex];if(rowCells == null) {throw new IllegalArgumentException("Row [" + rowIndex + "] is empty");}for (int i = 0; i < rowCells.length; i++) {RecordBase cvr = (RecordBase) rowCells[i];if(cvr == null) {continue;}int nBlank = countBlanks(rowCells, i);if (nBlank > 1) {rv.visitRecord(createMBR(rowCells, i, nBlank));i+=nBlank-1;} else if (cvr instanceof RecordAggregate) {RecordAggregate agg = (RecordAggregate) cvr;agg.visitContainedRecords(rv);} else {rv.visitRecord((org.apache.poi.hssf.record.Record) cvr);}}}

// Translation:
public void VisitCellsForRow(int rowIndex, RecordVisitor rv){CellValueRecordInterface[] rowCells = records[rowIndex];if (rowCells == null){throw new ArgumentException("Row [" + rowIndex + "] is empty");}for (int i = 0; i < rowCells.Length; i++){RecordBase cvr = (RecordBase)rowCells[i];if (cvr == null){continue;}int nBlank = CountBlanks(rowCells, i);if (nBlank > 1){rv.VisitRecord(CreateMBR(rowCells, i, nBlank));i += nBlank - 1;}else if (cvr is RecordAggregate){RecordAggregate agg = (RecordAggregate)cvr;agg.VisitContainedRecords(rv);}else{rv.VisitRecord((Record)cvr);}}}
// Original:
public DeleteVpnConnectionResult deleteVpnConnection(DeleteVpnConnectionRequest request) {request = beforeClientExecution(request);return executeDeleteVpnConnection(request);}

// Translation:
public virtual DeleteVpnConnectionResponse DeleteVpnConnection(DeleteVpnConnectionRequest request){var options = new InvokeOptions();options.RequestMarshaller = DeleteVpnConnectionRequestMarshaller.Instance;options.ResponseUnmarshaller = DeleteVpnConnectionResponseUnmarshaller.Instance;return Invoke<DeleteVpnConnectionResponse>(request, options);}
// Original:
public void clear() {username = null;if (password != null) {Arrays.fill(password, (char) 0);password = null;}}

// Translation:
public virtual void Clear(){username = null;if (password != null){Arrays.Fill(password, (char)0);password = null;}}
// Original:
public String toString() {return String.format(Locale.ROOT,"time=%.2f sec. total (%.2f reading, %.2f sorting, %.2f merging), lines=%d, temp files=%d, merges=%d, soft ram limit=%.2f MB",totalTimeMS / 1000.0d, readTimeMS / 1000.0d, sortTimeMS.get() / 1000.0d, mergeTimeMS.get() / 1000.0d,lineCount, tempMergeFiles, mergeRounds,(double) bufferSize / MB);}

// Translation:
public override string ToString(){return string.Format(CultureInfo.InvariantCulture,"time={0:0.00} sec. total ({1:0.00} reading, {2:0.00} sorting, {3:0.00} merging), lines={4}, temp files={5}, merges={6}, soft ram limit={7:0.00} MB",TotalTime / 1000.0d, ReadTime / 1000.0d, SortTime / 1000.0d, MergeTime / 1000.0d,Lines, TempMergeFiles, MergeRounds,(double)BufferSize / MB);}
// Original:
public DetachLoadBalancersResult detachLoadBalancers(DetachLoadBalancersRequest request) {request = beforeClientExecution(request);return executeDetachLoadBalancers(request);}

// Translation:
public virtual DetachLoadBalancersResponse DetachLoadBalancers(DetachLoadBalancersRequest request){var options = new InvokeOptions();options.RequestMarshaller = DetachLoadBalancersRequestMarshaller.Instance;options.ResponseUnmarshaller = DetachLoadBalancersResponseUnmarshaller.Instance;return Invoke<DetachLoadBalancersResponse>(request, options);}
// Original:
public synchronized Span[] splitSentences(String line) {if (sentenceSplitter != null) {return sentenceSplitter.sentPosDetect(line);} else {Span[] shorty = new Span[1];shorty[0] = new Span(0, line.length());return shorty;}}

// Translation:
public virtual Span[] SplitSentences(string line){lock (this){if (sentenceSplitter != null){return sentenceSplitter.sentPosDetect(line);}else{Span[] shorty = new Span[1];shorty[0] = new Span(0, line.Length);return shorty;}}}
// Original:
public boolean isRemote() {return getHost() != null;}

// Translation:
public virtual bool IsRemote(){return GetHost() != null;}
// Original:
public void setBuiltinStyle(int builtinStyleId) {field_1_xf_index = isBuiltinFlag.set(field_1_xf_index);field_2_builtin_style = builtinStyleId;}

// Translation:
public void SetBuiltinStyle(int builtinStyleId){field_1_xf_index = isBuiltinFlag.Set(field_1_xf_index);field_2_builtin_style = builtinStyleId;}
// Original:
public ObjectReader getObjectReader() {return reader;}

// Translation:
public virtual ObjectReader GetObjectReader(){return reader;}
// Original:
public void addEscherProperty( EscherProperty prop ){properties.add( prop );}

// Translation:
public void AddEscherProperty(EscherProperty prop){properties.Add(prop);}
// Original:
public String toString() {StringBuilder sb = new StringBuilder();sb.append("[").append("USERSVIEWBEGIN").append("] (0x");sb.append(Integer.toHexString(sid).toUpperCase(Locale.ROOT)).append(")\n");sb.append("  rawData=").append(HexDump.toHex(_rawData)).append("\n");sb.append("[/").append("USERSVIEWBEGIN").append("]\n");return sb.toString();}

// Translation:
public override String ToString(){StringBuilder sb = new StringBuilder();sb.Append("[").Append("USERSVIEWBEGIN").Append("] (0x");sb.Append(StringUtil.ToHexString(sid).ToUpper() + ")\n");sb.Append("  rawData=").Append(HexDump.ToHex(_rawData)).Append("\n");sb.Append("[/").Append("USERSVIEWBEGIN").Append("]\n");return sb.ToString();}
// Original:
public String group(int group) {ensureMatch();int from = matchOffsets[group * 2];int to = matchOffsets[(group * 2) + 1];if (from == -1 || to == -1) {return null;} else {return input.substring(from, to);}}

// Translation:
public string group(int group_1){ensureMatch();int from = matchOffsets[group_1 * 2];int to = matchOffsets[(group_1 * 2) + 1];if (from == -1 || to == -1){return null;}else{return Sharpen.StringHelper.Substring(input, from, to);}}
// Original:
public void removeCompany() {remove1stProperty(PropertyIDMap.PID_COMPANY);}

// Translation:
public void RemoveCompany(){MutableSection s = (MutableSection)FirstSection;s.RemoveProperty(PropertyIDMap.PID_COMPANY);}
// Original:
public RevFilter clone() {final RevFilter[] s = new RevFilter[subfilters.length];for (int i = 0; i < s.length; i++)s[i] = subfilters[i].clone();return new List(s);}

// Translation:
public override RevFilter Clone(){RevFilter[] s = new RevFilter[subfilters.Length];for (int i = 0; i < s.Length; i++){s[i] = subfilters[i].Clone();}return new OrRevFilter.List(s);}
// Original:
public static Charset defaultCharset() {return DEFAULT_CHARSET;}

// Translation:
public static java.nio.charset.Charset defaultCharset(){return DEFAULT_CHARSET;}
// Original:
public void removeName(Name name) {int index = getNameIndex((HSSFName) name);removeName(index);}

// Translation:
public void RemoveName(HSSFName name){int index = GetNameIndex(name);RemoveName(index);}
// Original:
public AttributeValueUpdate(AttributeValue value, AttributeAction action) {setValue(value);setAction(action.toString());}

// Translation:
public AttributeValueUpdate(AttributeValue value, AttributeAction action){_value = value;_action = action;}
// Original:
public String toString() {StringBuilder buffer = new StringBuilder();buffer.append("[FOOTER]\n");buffer.append("    .footer = ").append(getText()).append("\n");buffer.append("[/FOOTER]\n");return buffer.toString();}

// Translation:
public override String ToString(){StringBuilder buffer = new StringBuilder();buffer.Append("[FOOTER]\n");buffer.Append("    .footer         = ").Append(this.Text).Append("\n");buffer.Append("[/FOOTER]\n");return buffer.ToString();}
// Original:
public DisassociateSkillFromSkillGroupResult disassociateSkillFromSkillGroup(DisassociateSkillFromSkillGroupRequest request) {request = beforeClientExecution(request);return executeDisassociateSkillFromSkillGroup(request);}

// Translation:
public virtual DisassociateSkillFromSkillGroupResponse DisassociateSkillFromSkillGroup(DisassociateSkillFromSkillGroupRequest request){var options = new InvokeOptions();options.RequestMarshaller = DisassociateSkillFromSkillGroupRequestMarshaller.Instance;options.ResponseUnmarshaller = DisassociateSkillFromSkillGroupResponseUnmarshaller.Instance;return Invoke<DisassociateSkillFromSkillGroupResponse>(request, options);}
// Original:
public String toString(String field) {StringBuilder buffer = new StringBuilder();if (!getField().equals(field)) {buffer.append(getField());buffer.append(':');}buffer.append(term.text());buffer.append('*');return buffer.toString();}

// Translation:
public override string ToString(string field){StringBuilder buffer = new StringBuilder();if (!Field.Equals(field, StringComparison.Ordinal)){buffer.Append(Field);buffer.Append(":");}buffer.Append(_prefix.Text());buffer.Append('*');buffer.Append(ToStringUtils.Boost(Boost));return buffer.ToString();}
// Original:
public NameRecord getNameRecord(int index) {return _definedNames.get(index);}

// Translation:
public NameRecord GetNameRecord(int index){return (NameRecord)_definedNames[index];}
// Original:
public BottomMarginRecord clone() {return copy();}

// Translation:
public override Object Clone(){BottomMarginRecord rec = new BottomMarginRecord();rec.field_1_margin = this.field_1_margin;return rec;}
// Original:
@Override public V setValue(V object) {throw new UnsupportedOperationException();}

// Translation:
public virtual V setValue(V @object){throw new System.NotSupportedException();}
// Original:
public QuadPrefixTree(SpatialContext ctx, Rectangle bounds, int maxLevels) {super(ctx, maxLevels);this.xmin = bounds.getMinX();this.xmax = bounds.getMaxX();this.ymin = bounds.getMinY();this.ymax = bounds.getMaxY();levelW = new double[maxLevels + 1];levelH = new double[maxLevels + 1];gridW = xmax - xmin;gridH = ymax - ymin;this.xmid = xmin + gridW/2.0;this.ymid = ymin + gridH/2.0;levelW[0] = gridW/2.0;levelH[0] = gridH/2.0;for (int i = 1; i < levelW.length; i++) {levelW[i] = levelW[i - 1] / 2.0;levelH[i] = levelH[i - 1] / 2.0;}}

// Translation:
public QuadPrefixTree(SpatialContext ctx, IRectangle bounds, int maxLevels): base(ctx, maxLevels){xmin = bounds.MinX;xmax = bounds.MaxX;ymin = bounds.MinY;ymax = bounds.MaxY;levelW = new double[maxLevels];levelH = new double[maxLevels];levelS = new int[maxLevels];levelN = new int[maxLevels];gridW = xmax - xmin;gridH = ymax - ymin;this.xmid = xmin + gridW / 2.0;this.ymid = ymin + gridH / 2.0;levelW[0] = gridW / 2.0;levelH[0] = gridH / 2.0;levelS[0] = 2;levelN[0] = 4;for (int i = 1; i < levelW.Length; i++){levelW[i] = levelW[i - 1] / 2.0;levelH[i] = levelH[i - 1] / 2.0;levelS[i] = levelS[i - 1] * 2;levelN[i] = levelN[i - 1] * 4;}}
// Original:
public static HSSFAnchor createAnchorFromEscher(EscherContainerRecord container){if (null != container.getChildById(EscherChildAnchorRecord.RECORD_ID)){return new HSSFChildAnchor(container.getChildById(EscherChildAnchorRecord.RECORD_ID));} else {if (null != container.getChildById(EscherClientAnchorRecord.RECORD_ID)){return new HSSFClientAnchor(container.getChildById(EscherClientAnchorRecord.RECORD_ID));}return null;}}

// Translation:
public static HSSFAnchor CreateAnchorFromEscher(EscherContainerRecord container){if (null != container.GetChildById(EscherChildAnchorRecord.RECORD_ID)){return new HSSFChildAnchor((EscherChildAnchorRecord)container.GetChildById(EscherChildAnchorRecord.RECORD_ID));}else{if (null != container.GetChildById(EscherClientAnchorRecord.RECORD_ID)){return new HSSFClientAnchor((EscherClientAnchorRecord)container.GetChildById(EscherClientAnchorRecord.RECORD_ID));}return null;}}