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

📄 classes.html

📁 SR-tree is an index structure for high-dimensional nearest neighbor queries
💻 HTML
📖 第 1 页 / 共 2 页
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">

<head>
<title>Classes used in this Library</title>
</head>

<body bgcolor=white>

<h1>Classes used in this Library</h1>

<hr>

<ul>
<li><a href="#HnProperties">HnProperties</a></li>
<li><a href="#HnPoint">HnPoint</a></li>
<li><a href="#HnDataItem">HnDataItem</a></li>
<li><a href="#HnPointVector">HnPointVector</a></li>
<li><a href="#HnDataItemVector">HnDataItemVector</a></li>
<li><a href="#HnSphere">HnSphere</a></li>
<li><a href="#HnRange">HnRange</a></li>
<li><a href="#HnRect">HnRect</a></li>
<li><a href="#HnSRTreeProfileSt">HnSRTreeProfileSt</a></li>
</ul>

<hr>

<a name="HnProperties"></a><h2>HnProperties</h2>

<blockquote>

<blockquote>
<table border=1 bgcolor=lightyellow cellpadding=10>
<tr><td>
<pre>
(C++) 
    Class:
            HnProperties

    Constructor:
            HnProperties new_HnProperties(void);

    Methods:
            HnString setProperty(const HnString &amp;key, const HnString &amp;value);
            void load(const char *buffer);

(C  )
    Structure:
            HnPropertiesSt

    Allocation:
            HnProperties *HnPropertiesSt_allocate(void);

    Deletion:
            void HnPropertiesSt_free(HnPropertiesSt *properties);

    Methods:
            void HnPropertiesSt_setProperty(HnPropertiesSt *properties,
                                            const char *key,
                                            const char *value);
            void HnPropertiesSt_load(HnPropertiesSt *properties,
                                     const char *buffer);
</pre>
</td></tr>
</table>
</blockquote>

An object of the class `<code>HnProperties</code>' is a set of
label-value pairs. Both labels and values are given in the form of a
character string. For example, the following code allocates an object
of the class `<code>HnProperties</code>' and then sets the property
whose label and value are `HnSRTreeBlockSize' and `16384'
respectively.

<blockquote>
<pre>
(C++)
        HnProperties properties;

        properties = new_HnProperties();
        properties.setProperty("HnSRTreeBlockSize", "16384");

(C  )
        HnPropertiesSt *properties;

        properties = HnPropertiesSt_allocate();
        HnPropertiesSt_setProperty(properties, "HnSRTreeBlockSize", "16384");
</pre>
</blockquote>
<p>
In the C++ language interface, the arguments of the method
`<code>setProperties</code>' has the type `<code>HnString</code>'.
`<code>HnString</code>' is the class defined for a character
string. Because this class has the type converter from a character
string to itself, you can set character strings directly to the
arguments of `<code>setProperties</code>'.
</p>
<p>
Alternatively, properties can be loaded from a character string.  The
character string should consist of one or more lines and each line
should be a label-value pair connected by the equal sign. For example,
the following code loads two properties, `<code>A=B</code>' and
`<code>P=Q</code>' from the character string <code>"A=B\nP=Q\n"</code>.
</p>
<blockquote>
<pre>
(C++)
        properties.load("A=B\nP=Q\n");

(C  )
        HnPropertiesSt_load(properties, "A=B\nP=Q\n");
</pre>
</blockquote>

</blockquote>

<hr>

<a name="HnPoint"></a><h2>HnPoint</h2>

<blockquote>

<blockquote>
<table border=1 bgcolor=lightyellow cellpadding=10>
<tr><td>
<pre>
(C++) 
    Class:
            HnPoint

    Constructor:
            HnPoint new_HnPoint(int dimension);

    Methods:
            int getDimension(void) const;
            void setCoordAt(double coord, int index);
            double &amp;getCoordAt(int index) const;
            double *getCoords(void) const;

            HnBool equals(const HnPoint &amp;point) const;
            double getDistance(const HnPoint &amp;point) const;
            HnString toString(void) const;

(C  )
    Structure:
            HnPointSt

    Allocation:
            HnPoint *HnPointSt_allocate(int dimension);

    Deletion:
            void HnPointSt_free(HnPointSt *point);

    Member variables:
            int dimension;
            double *coords;

    Methods:
            HnBool HnPointSt_equals(const HnPointSt *point1,
                                    const HnPointSt *point2);
            HnPointSt_getDistance(const HnPointSt *point1,
                                  const HnPointSt *point2);
            const char *HnPointSt_toString(const HnPointSt *point);
</pre>
</td></tr>
</table>
</blockquote>

The class `<code>HnPoint</code>' is used for allocating an object
representing a point. A point whose coordinates are (0.2, 0.4, 0.6)
can be allocated in the following way:

<blockquote>
<pre>
(C++)
        HnPoint point;

        point = new_HnPoint(3);
        point.setCoordAt(0.2, 0);
        point.setCoordAt(0.4, 1);
        point.setCoordAt(0.6, 2);

(C  )
        HnPointSt *point;

        point = HnPointSt_allocate(3);
        point-&gt;coords[0] = 0.2;
        point-&gt;coords[1] = 0.4;
        point-&gt;coords[2] = 0.6;
</pre>
</blockquote>

The dimensionality and the coordinates of an object can be accessed in
the following way:

<blockquote>
<pre>
(C++)
        for ( i=0; i&lt;point.getDimension(); i++ ) {
            printf("%g\n", point.getCoordAt(i));
        }

(C  )
        for ( i=0; i&lt;point-&gt;dimension; i++ ) {
            printf("%g\n", point-&gt;coords[i]);
        }
</pre>
</blockquote>

</blockquote>

<hr>

<a name="HnDataItem"></a><h2>HnDataItem</h2>

<blockquote>

<blockquote>
<table border=1 bgcolor=lightyellow cellpadding=10>
<tr><td>
<pre>
(C++) 
    Class:
            HnDataItem

    Constructor:
            HnDataItem new_HnDataItem(const void *bytes, int length);

    Methods:
            int length(void) const;
            char *toCharArray(void) const;

(C  )
    Structure:
            HnDataItemSt

    Allocation:
            HnDataItemSt *HnDataItemSt_allocate(const char *bytes, int length);

    Deletion:
            void HnDataItemSt_free(HnDataItemSt *dataItem);

    Member variables:
            int length;
            unsigned char *buffer;

    Methods:
            HnDataItemSt_equals(const HnDataItemSt *dataItem1,
                                const HnDataItemSt *dataItem2);         
</pre>
</td></tr>
</table>
</blockquote>

The class `<code>HnDataItem</code>' is used for allocating an object
which contains a piece of data in the form of a byte string. A data
item whose content is the character string <code>"Hello world!"</code>
can be allocated in the following way:

<blockquote>
<pre>
(C++)
        char *s = "Hello world!";
        HnDataItem dataItem;

        dataItem = new_HnDataItem(s, strlen(s) + 1);

(C  )
        char *s = "Hello world!";
        HnDataItemSt *dataItem;

        dataItem = HnDataItemSt_allocate(s, strlen(s) + 1);
</pre>
</blockquote>

<p>
The content of an object can be accessed in the following way:
</p>

<blockquote>
<pre>
(C++)
        printf("%s\n", dataItem.toCharArray());

(C  )
        printf("%s\n", dataItem-&gt;buffer);
</pre>
</blockquote>

<p>
In the following example, an integer value <code>1234</code> is stored
in an object of the class `<code>HnDataItem</code>':
</p>

<blockquote>
<pre>
(C++)
        int n = 1234;
        HnDataItem dataItem;

        dataItem = new_HnDataItem(&amp;n, sizeof(n));

        printf("%d\n", *((int *)dataItem.toCharArray()));

(C  )
        int n = 1234;
        HnDataItemSt *dataItem;

        dataItem = HnDataItemSt_allocate(&amp;n, sizeof(n));

        printf("%d\n", *((int *)dataItem-&gt;buffer));
</pre>
</blockquote>

</blockquote>

<hr>

<a name="HnPointVector"></a><h2>HnPointVector</h2>

<blockquote>

<blockquote>
<table border=1 bgcolor=lightyellow cellpadding=10>
<tr><td>
<pre>
(C++) 
    Class:
            HnPointVector

    Constructor:
            HnPointVector new_HnPointVector(void);

    Methods:
            /* access to elements */
            int size(void) const;
            HnPoint &amp;elementAt(int index);
            HnPoint &amp;operator[](int index); // abbreviation of elementAt()

            /* editing */
            void addElement(const HnPoint &amp;element);
            void insertElementAt(const HnPoint &amp;element, int index);
            HnPoint removeElementAt(int index);
            void setElementAt(const HnPoint &amp;element, int index);

(C  )
    Structure:
            HnPointVectorSt

    Allocation:
            HnPointVectorSt *HnPointVectorSt_allocate();

    Deletion:
            void HnPointVectorSt_free(HnPointVectorSt *vector);

    Member variables:
            int size;
            HnPointSt **elements;

    Methods:
            /* editing */          
            void HnPointVectorSt_addElement(HnPointVectorSt *vector,
                                            HnPointSt *element);
            void HnPointVectorSt_insertElementAt(HnPointVectorSt *vector,
                                                 HnPointSt *element, int index);
            void HnPointVectorSt_removeElementAt(HnPointVectorSt *vector,
                                                 int index);
            void HnPointVectorSt_setElementAt(HnPointVectorSt *vector,
                                              HnPoint *element, int index);

            /* utility */
            void HnPointVectorSt_freeElements(const HnPointVectorSt *vector);
</pre>
</td></tr>
</table>
</blockquote>

An object of the class `<code>HnPointVector</code>' is a
variable-length array of <a href="#HnPoint"><code>HnPoint</code></a>
objects.  You can access the elements of an array in the following
way:

<blockquote>
<pre>
(C++)
        for ( i=0; i&lt;vector.size(); i++ ) {
            HnPoint element = vector.elementAt(i);

            . . .
        }

(C  )
        for ( i=0; i&lt;vector-&gt;size; i++ ) {
            HnPointSt *element = vector-&gt;elements[i];

            . . .
        }
</pre>
</blockquote>

</blockquote>

<hr>

⌨️ 快捷键说明

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