Algorithm
Development Kit 1.0

algs.model.data.points
Class LoadFromFileGenerator

java.lang.Object
  extended by algs.model.data.Generator<IPoint>
      extended by algs.model.data.points.LoadFromFileGenerator

public class LoadFromFileGenerator
extends Generator<IPoint>

Generator of IPoint objects that loads requested points from a designated file (rather then through some computation).

Tries to honor the 'size' parameter when generating. That is, if there are more points in the file than 'size' it will be truncated. However if the file contains fewer points, the returned array will be smaller than requested.

Format of file: Individual lines with space-separated doubles

Since:
1.0
Version:
1.0, 6/15/08
Author:
George Heineman

Constructor Summary
LoadFromFileGenerator(java.lang.String s)
           
 
Method Summary
 Generator<IPoint> construct(java.lang.String[] args)
          Provide reflective behavior to construct instance of generator given an array of string arguments.
 IPoint[] generate(int size)
          Generate a set of elements according to specialized criteria defined by the subclass.
 java.lang.String[] parameters()
          Declares the name of the parameters used when constructing the generator in order from left to right.
 
Methods inherited from class algs.model.data.Generator
toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

LoadFromFileGenerator

public LoadFromFileGenerator(java.lang.String s)
Method Detail

parameters

public java.lang.String[] parameters()
Description copied from class: Generator
Declares the name of the parameters used when constructing the generator in order from left to right.

Specified by:
parameters in class Generator<IPoint>

construct

public Generator<IPoint> construct(java.lang.String[] args)
Provide reflective behavior to construct instance of generator given an array of string arguments.

Specified by:
construct in class Generator<IPoint>

generate

public IPoint[] generate(int size)
Description copied from class: Generator
Generate a set of elements according to specialized criteria defined by the subclass.

There is no guarantee that the elements are unique.

Specified by:
generate in class Generator<IPoint>
Parameters:
size - The number of elements to be created.

Algorithm Development Kit 1.0

This code supports the Algorithms in a Nutshell book, published by O'Reilly Media, Inc. in November 2008. Please visit the book web page to learn of any changes to the code repository or to record a potential defect.