Servertec   QuickSort
Content
Introduction
Release Notes
Features
FAQs
Requirements
Installation
Add-ons
How To
Change Log
Future Plans
Knowledge Base
Documentation
Conventions
Users
Reference
iServer API
AccessLogEntry
Codecs
Connection
ConnectionPool...
DString
ErrorLogEntry
EventLogEntry
FileCache
FileUpload
IOHandler
IOManager
iws
Logger
MultiPartForm
QuickSort
QuickSortString...
Realm
RealmAdmin...
RealmManager
ServletContextImpl
ServletContext...
ServletImpl
ServletManager
Utils

Servlet API
CGI
SSI
Servlets
Config Files
Log Files
Classes
Directory Tree

Samples
Sales
Legal
Feedback

 

java.lang.Object
 |
 +--stec.lang.QuickSort

public abstract class QuickSort

Abstract class for sorting objects.

Methods

Method Description
compare Compares the two objects.
count Returns the number of objects to sort.
extract Returns the specified object.
replace Overwrites the specified object with the given object.
sort Sorts the given objects.

compare

Compares the two objects.

Syntax

public abstract int compare(Object object1, Object object2)

Parameters

object1 the object to compare.
object1 the object to compare to.

Returns

int a negative value if the first object is less than the second object, zero if both objects are equal and a positive value if the first object is greater than the second object.

Throws

Nothing

Example

public int compare(Object object1, Object object2)
{
  return ((String) object1).compareTo((String)object2);
}

count

Returns the number of objects to sort.

Syntax

public abstract int count(Object objects)

Parameters

objects the objects to count.

Returns

int the number of objects.

Throws

Nothing

Example

public int count(Object objects)
{
  return ((String[])objects).length;
}

extract

Returns the specified object.

Syntax

public abstract Object extract(Object objects, int index)

Parameters

objects the objects to use.
index the index of the object to return.

Returns

Object the object at the specified index.

Throws

Nothing

Example

public Object extract(Object objects, int index)
{
  return ((String[])objects)[index];
}

replace

Overwrites the specified object with the given object.

Syntax

public abstract Object replace(Object objects,
                               int index,
                               Object object)

Parameters

objects the objects to use.
index the index of the object to replace.
object the object to use.

Returns

Object the resultant objects.

Throws

Nothing

Example

public Object replace(Object objects, int index, Object object)
{
  return ((String[])objects)[index] = object;
}

sort

Sorts the given objects.

Syntax

public abstract Object sort(Object objects)

Parameters

objects the objects to sort.

Returns

Object the sorted objects.

Throws

Nothing

Example

String[] sitems = sort(items)
 top of page
 Built with iScript Copyright © 1997-2000 Servertec. All rights reserved.
Last Modified: Thu Aug 10 13:06:59 EDT 2000