swishej
Class SortResult

java.lang.Object
  |
  +--swishej.SortResult

class SortResult
extends java.lang.Object

Sorting and formatting of a search result.

See Also:
SortInfo

Field Summary
(package private)  java.lang.String fileinfo
          File information, usually filename, title, and size in bytes.
(package private)  SortResult left
          Left and right result for sorting.
(package private)  int rank
          Rank for sorting.
(package private)  SortResult right
          Left and right result for sorting.
 
Constructor Summary
(package private) SortResult(int rank, java.lang.String fileinfo)
          Create a sort result entry.
 
Method Summary
(package private) static SortResult addSortResult(SortResult sr, int rank, SortInfo si, java.lang.String fileinfo)
          Add, i.e.
(package private) static int countResults(SortResult sr)
          Retrieve number of entries given sort result.
(package private) static void doprint(SortResult sr, double num, SortInfo si, java.lang.StringBuffer sb)
          Recursively traverse sort result tree and format the result information.
(package private) static java.lang.String printrank(int rank)
          Given rank print HTML representation of it.
(package private) static void printResults(SortResult sr, int max, SortInfo si, java.lang.StringBuffer sb)
          Format the result information.
(package private) static java.lang.String printsize(java.lang.String size)
          Given file size print HTML representation of it.
(package private) static java.lang.String[] splitfileinfo(java.lang.String s)
          Split file information in pieces: 0.
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait
 

Field Detail

fileinfo

java.lang.String fileinfo
File information, usually filename, title, and size in bytes.

rank

int rank
Rank for sorting.

left

SortResult left
Left and right result for sorting.

right

SortResult right
Left and right result for sorting.
Constructor Detail

SortResult

SortResult(int rank,
           java.lang.String fileinfo)
Create a sort result entry.
Parameters:
rank - rank for sorting
fileinfo - file information of entry
Method Detail

addSortResult

static SortResult addSortResult(SortResult sr,
                                int rank,
                                SortInfo si,
                                java.lang.String fileinfo)
Add, i.e. insert a new entry to given sort result.
Parameters:
sr - SortResult for accumulating sort results.
rank - rank for sorting
si - information for finding biggest rank.
fileinfo - file information of entry
Returns:
new SortResult entry

countResults

static int countResults(SortResult sr)
Retrieve number of entries given sort result.
Parameters:
sr - SortResult for counting
Returns:
number of SortResults

printrank

static java.lang.String printrank(int rank)
Given rank print HTML representation of it.
Parameters:
rank - rank of result
Returns:
string with HTML representation of rank

printsize

static java.lang.String printsize(java.lang.String size)
Given file size print HTML representation of it.
Parameters:
size - file size part of file information
Returns:
string with HTML representation of size

splitfileinfo

static java.lang.String[] splitfileinfo(java.lang.String s)
Split file information in pieces: 0. file name, 1. title, 2. file size
Parameters:
s - file information
Returns:
broken down String[] with file information

doprint

static void doprint(SortResult sr,
                    double num,
                    SortInfo si,
                    java.lang.StringBuffer sb)
Recursively traverse sort result tree and format the result information.
Parameters:
sr - current sort result
num - scaling factor for printing rank
si - SortInfo to be used for printing
sb - StringBuffer which gets printed result representation appended

printResults

static void printResults(SortResult sr,
                         int max,
                         SortInfo si,
                         java.lang.StringBuffer sb)
Format the result information.
Parameters:
sr - first sort result
max - maximum number of hits to be printed
si - SortInfo to be used for printing
sb - StringBuffer which receives printed result representations


Contact: Christian.Werner@t-online.de