⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 filehdr.html

📁 本程序是由JAVA实现的R-树新建、结点增加、删除功能。
💻 HTML
📖 第 1 页 / 共 3 页
字号:
<TD><CODE><B><A HREF="../rtree/FileHdr.html#push(long)">push</A></B>(long&nbsp;lval)</CODE>

<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Pass the index of the node that needs to be pushed in the stack</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>(package private) &nbsp;void</CODE></FONT></TD>
<TD><CODE><B><A HREF="../rtree/FileHdr.html#resetHeader()">resetHeader</A></B>()</CODE>

<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Will set the file header size to zero and remake the file header.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>&nbsp;void</CODE></FONT></TD>
<TD><CODE><B><A HREF="../rtree/FileHdr.html#setBufferPolicy(boolean)">setBufferPolicy</A></B>(boolean&nbsp;writeThr)</CODE>

<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;This method at the moment is only for Pack.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>(package private) &nbsp;void</CODE></FONT></TD>
<TD><CODE><B><A HREF="../rtree/FileHdr.html#setDirty(boolean)">setDirty</A></B>(boolean&nbsp;val)</CODE>

<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>(package private) &nbsp;void</CODE></FONT></TD>
<TD><CODE><B><A HREF="../rtree/FileHdr.html#setWaiters(java.util.Vector)">setWaiters</A></B>(java.util.Vector&nbsp;wtrs)</CODE>

<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>(package private) &nbsp;int</CODE></FONT></TD>
<TD><CODE><B><A HREF="../rtree/FileHdr.html#stackSize()">stackSize</A></B>()</CODE>

<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;returns the size of the stck of free nodes.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>&nbsp;java.lang.String</CODE></FONT></TD>
<TD><CODE><B><A HREF="../rtree/FileHdr.html#toString()">toString</A></B>()</CODE>

<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;This method will return only internal varaibles.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>&nbsp;void</CODE></FONT></TD>
<TD><CODE><B><A HREF="../rtree/FileHdr.html#unlock()">unlock</A></B>()</CODE>

<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>(package private) &nbsp;void</CODE></FONT></TD>
<TD><CODE><B><A HREF="../rtree/FileHdr.html#update(java.lang.String)">update</A></B>(java.lang.String&nbsp;fileName)</CODE>

<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;This method will be used by the Pack class to update this header from the file again.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>private &nbsp;void</CODE></FONT></TD>
<TD><CODE><B><A HREF="../rtree/FileHdr.html#writeFileHeader()">writeFileHeader</A></B>()</CODE>

<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>(package private) &nbsp;void</CODE></FONT></TD>
<TD><CODE><B><A HREF="../rtree/FileHdr.html#writeFileHeader(int, long)">writeFileHeader</A></B>(int&nbsp;totNodes,                long&nbsp;rootIdx)</CODE>

<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;this function writes to file header as well as to  the local variables     an atomic function.Does not concern itself with the stack info.</TD>
</TR>
</TABLE>
&nbsp;<A NAME="methods_inherited_from_class_java.lang.Object"><!-- --></A><TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#EEEEFF" CLASS="TableSubHeadingColor">
<TD><B>Methods inherited from class java.lang.Object</B></TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD><CODE>clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait</CODE></TD>
</TR>
</TABLE>
&nbsp;
<P>

<!-- ============ FIELD DETAIL =========== -->

<A NAME="field_detail"><!-- --></A><TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TD COLSPAN=1><FONT SIZE="+2">
<B>Field Detail</B></FONT></TD>
</TR>
</TABLE>

<A NAME="totalNodes"><!-- --></A><H3>
totalNodes</H3>
<PRE>
int <B>totalNodes</B></PRE>
<DL>
<DD>total no. of nodes in the file
<P>
<DL>
</DL>
</DL>
<HR>

<A NAME="rootIndex"><!-- --></A><H3>
rootIndex</H3>
<PRE>
long <B>rootIndex</B></PRE>
<DL>
<DD>the index of the root
<P>
<DL>
</DL>
</DL>
<HR>

<A NAME="writeThr"><!-- --></A><H3>
writeThr</H3>
<PRE>
protected boolean <B>writeThr</B></PRE>
<DL>
<DD>------------local variables--------------------------------------
<P>
<DL>
</DL>
</DL>
<HR>

<A NAME="stkLimit"><!-- --></A><H3>
stkLimit</H3>
<PRE>
int <B>stkLimit</B></PRE>
<DL>
<DD>Overflow limit
<P>
<DL>
</DL>
</DL>
<HR>

<A NAME="S"><!-- --></A><H3>
S</H3>
<PRE>
private int[] <B>S</B></PRE>
<DL>
<DD>The stack data. Although the indices are <code>long</code> but they can be easily represented as     <code>int</code>
<P>
<DL>
</DL>
</DL>
<HR>

<A NAME="topIdx"><!-- --></A><H3>
topIdx</H3>
<PRE>
private int <B>topIdx</B></PRE>
<DL>
<DD>Index of the top most element
<P>
<DL>
</DL>
</DL>
<HR>

<A NAME="file"><!-- --></A><H3>
file</H3>
<PRE>
private java.io.RandomAccessFile <B>file</B></PRE>
<DL>
<DL>
</DL>
</DL>
<HR>

<A NAME="dirty"><!-- --></A><H3>
dirty</H3>
<PRE>
private boolean <B>dirty</B></PRE>
<DL>
<DL>
</DL>
</DL>
<HR>

<A NAME="interested"><!-- --></A><H3>
interested</H3>
<PRE>
private boolean <B>interested</B></PRE>
<DL>
<DD>If any write thread is interested then increment this. This variable      results in the fact that writes will always have the preference.      Even when the JVM chooses a READ thread to run, it would have to wait      till <b>one</b> of all the waiting WRITE threads run. After one of the WRITE     thread runs, the situation is open for all. Again, if any of the WRITE     thread sets <tt>interested</tt>, then on next  <tt>notifyAll</tt> it is     gauranteed that one of the WRITE threads will run before any other READ.
<P>
<DL>
</DL>
</DL>
<HR>

<A NAME="waiters"><!-- --></A><H3>
waiters</H3>
<PRE>
private java.util.Vector <B>waiters</B></PRE>
<DL>
<DD>The wait thread queue
<P>
<DL>
</DL>
</DL>

<!-- ========= CONSTRUCTOR DETAIL ======== -->

<A NAME="constructor_detail"><!-- --></A><TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TD COLSPAN=1><FONT SIZE="+2">
<B>Constructor Detail</B></FONT></TD>
</TR>
</TABLE>

<A NAME="FileHdr(int, java.lang.String)"><!-- --></A><H3>
FileHdr</H3>
<PRE>
<B>FileHdr</B>(int&nbsp;stkLimit,        java.lang.String&nbsp;fileName)  throws <A HREF="../rtree/RTreeException.html" title="class in rtree">RTreeException</A></PRE>
<DL>
<DD>Although this 'stack' is part of the file header but it acts totally      independently of the rest of the file header. All of the file reads and     writes are handled by the 'Node' class but the free node list('stack') is     maintained by this class independently. Therefore all the 'Node' class      needs to do is call the 'push' and 'pop' method to read and write to the     file regarding the free node list.<br>     Note:- This class will work well with 150 element delets at one go but      beyond that it will not maintain the list of nodes that have been     deleted. This is not fatal but the size of the file will increase and the     deleted nodes that did not register with the stack will be lost forever.     This condition can be rectified by calling <tt>Pack.packTree</tt>.
<P>
</DL>

<!-- ============ METHOD DETAIL ========== -->

<A NAME="method_detail"><!-- --></A><TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TD COLSPAN=1><FONT SIZE="+2">
<B>Method Detail</B></FONT></TD>
</TR>
</TABLE>

<A NAME="setBufferPolicy(boolean)"><!-- --></A><H3>
setBufferPolicy</H3>
<PRE>
public void <B>setBufferPolicy</B>(boolean&nbsp;writeThr)                     throws java.io.IOException</PRE>
<DL>
<DD>This method at the moment is only for Pack. This one has potential!
<P>
<DD><DL>
<DT><B>Throws:</B><DD><CODE>java.io.IOException</CODE></DL>
</DD>
</DL>
<HR>

<A NAME="update(java.lang.String)"><!-- --></A><H3>
update</H3>
<PRE>
void <B>update</B>(java.lang.String&nbsp;fileName)      throws <A HREF="../rtree/RTreeException.html" title="class in rtree">RTreeException</A></PRE>
<DL>
<DD>This method will be used by the Pack class to update this header from the file again. I assume that     the object that called this method has write lock with it.
<P>
<DD><DL>
<DT><B>Throws:</B><DD><CODE><A HREF="../rtree/RTreeException.html" title="class in rtree">RTreeException</A></CODE></DL>
</DD>
</DL>
<HR>

<A NAME="resetHeader()"><!-- --></A><H3>
resetHeader</H3>
<PRE>
void <B>resetHeader</B>()           throws java.lang.Exception</PRE>
<DL>
<DD>Will set the file header size to zero and remake the file header.
<P>
<DD><DL>
<DT><B>Throws:</B><DD><CODE>java.lang.Exception</CODE></DL>
</DD>
</DL>
<HR>

<A NAME="push(long)"><!-- --></A><H3>
push</H3>
<PRE>
void <B>push</B>(long&nbsp;lval)    throws <A HREF="../rtree/StackOverflowException.html" title="class in rtree">StackOverflowException</A>,           java.io.IOException</PRE>
<DL>
<DD>Pass the index of the node that needs to be pushed in the stack
<P>
<DD><DL>
<DT><B>Throws:</B><DD><CODE><A HREF="../rtree/StackOverflowException.html" title="class in rtree">StackOverflowException</A></CODE><DD><CODE>java.io.IOException</CODE></DL>
</DD>
</DL>
<HR>

<A NAME="pop()"><!-- --></A><H3>
pop</H3>
<PRE>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -