uk.org.ogsadai.client.toolkit.activity.transform
Class RandomSample

java.lang.Object
  |
  +--uk.org.ogsadai.client.toolkit.activity.RequestComponent
        |
        +--uk.org.ogsadai.client.toolkit.activity.Activity
              |
              +--uk.org.ogsadai.client.toolkit.activity.transform.RandomSample

public class RandomSample
extends Activity

This activity performs random sampling of a sequence of values it receives as input and delivers these as output. The random sample is selected according to the fraction parameter. A seed can also optionally be provided.

The activity has one input - the values to be sampled - and one output - the sampled values.

Author:
The OGSA-DAI Project Team

Field Summary
private static java.lang.String COPYRIGHT_NOTICE
          Copyright statement
private  double mFraction
          Fraction according to which the random sample will be generated
private  boolean mIs_seed
          Has a seed value been provided?
private  long mSeed
          Seed value
 
Fields inherited from class uk.org.ogsadai.client.toolkit.activity.Activity
 
Fields inherited from class uk.org.ogsadai.client.toolkit.activity.RequestComponent
 
Constructor Summary
RandomSample(ActivityOutput input, double fraction)
          Constructor.
RandomSample(ActivityOutput input, double fraction, long seed)
          Constructor.
 
Method Summary
protected  java.lang.String generateXML()
          Generates the XML representing the activity.
 ActivityOutput getOutput()
          Gets the activity output - the sampled values.
 void setInput(ActivityOutput input)
          Sets the input of this activity to be the output from another activity that will provide the data to be sampled.
 
Methods inherited from class uk.org.ogsadai.client.toolkit.activity.Activity
addInput, addOutput, addOutputs, getDataResourceID, getInputParameters, getOutputParameters, getOutputs, replaceSpecialCharacters, setDataResourceID, setInput
 
Methods inherited from class uk.org.ogsadai.client.toolkit.activity.RequestComponent
getDataService, getName, getSession, setDataService, setSession
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

COPYRIGHT_NOTICE

private static final java.lang.String COPYRIGHT_NOTICE
Copyright statement

See Also:
Constant Field Values

mFraction

private double mFraction
Fraction according to which the random sample will be generated


mSeed

private long mSeed
Seed value


mIs_seed

private boolean mIs_seed
Has a seed value been provided?

Constructor Detail

RandomSample

public RandomSample(ActivityOutput input,
                    double fraction)
Constructor.

Parameters:
input - Output from another activity which provides the data to be sampled.
fraction - Fraction according to which the random sample will be generated.
Throws:
java.lang.IllegalArgumentException - If input is null.

RandomSample

public RandomSample(ActivityOutput input,
                    double fraction,
                    long seed)
Constructor.

Parameters:
input - Output from another activity which provides the data to be sampled.
fraction - Fraction according to which the random sample will be generated.
seed - Seed value for the random sampling.
Throws:
java.lang.IllegalArgumentException - If input is null.
Method Detail

setInput

public final void setInput(ActivityOutput input)
Sets the input of this activity to be the output from another activity that will provide the data to be sampled.

Parameters:
input - Output from another activity.
Throws:
java.lang.IllegalArgumentException - If input is null.

getOutput

public ActivityOutput getOutput()
Gets the activity output - the sampled values.

Returns:
the activity output

generateXML

protected java.lang.String generateXML()
Description copied from class: RequestComponent
Generates the XML representing the activity. This XML can then be inserted into a perform document that is sent to a data service.

Specified by:
generateXML in class Activity
Returns:
the XML for the activity