http://git-wip-us.apache.org/repos/asf/incubator-samoa/blob/23a35dbe/samoa-api/src/main/java/com/yahoo/labs/samoa/moa/options/OptionsHandler.java ---------------------------------------------------------------------- diff --git a/samoa-api/src/main/java/com/yahoo/labs/samoa/moa/options/OptionsHandler.java b/samoa-api/src/main/java/com/yahoo/labs/samoa/moa/options/OptionsHandler.java index c643115..42628b2 100644 --- a/samoa-api/src/main/java/com/yahoo/labs/samoa/moa/options/OptionsHandler.java +++ b/samoa-api/src/main/java/com/yahoo/labs/samoa/moa/options/OptionsHandler.java @@ -20,7 +20,6 @@ package com.yahoo.labs.samoa.moa.options; * #L% */ - import java.util.HashMap; import com.github.javacliparser.JavaCLIParser; import com.github.javacliparser.Option; @@ -34,169 +33,151 @@ import com.yahoo.labs.samoa.moa.tasks.TaskMonitor; */ /** - * + * * @author abifet */ public class OptionsHandler extends JavaCLIParser { - //public Object handler; - - public OptionsHandler(Object c, String cliString) { - super(c,cliString); - //this.handler = c; - //this.prepareForUse(); - /*int firstSpaceIndex = cliString.indexOf(' ', 0); - String classOptions; - String className; - if (firstSpaceIndex > 0) { - className = cliString.substring(0, firstSpaceIndex); - classOptions = cliString.substring(firstSpaceIndex + 1, cliString.length()); - classOptions = classOptions.trim(); - } else { - className = cliString; - classOptions = ""; - }*/ - //options.setViaCLIString(cliString); - } - - - //private static final long serialVersionUID = 1L; - - /** Options to handle */ - //protected Options options; - - /** Dictionary with option texts and objects */ - //protected Map<String, Object> classOptionNamesToPreparedObjects; - - - /*public String getPurposeString() { - return "Anonymous object: purpose undocumented."; - } - - public Options getOptions() { - if (this.options == null) { - this.options = new Options(); - Option[] myOptions = discoverOptionsViaReflection(); - for (Option option : myOptions) { - this.options.addOption(option); - } - } - return this.options; - }*/ - - public void prepareForUse() { - prepareForUse(new NullMonitor(), null); - } - - public void prepareForUse(TaskMonitor monitor, ObjectRepository repository) { - prepareClassOptions(monitor, repository); - //prepareForUseImpl(monitor, repository); - } - - /** - * This method describes the implementation of how to prepare this object for use. - * All classes that extends this class have to implement <code>prepareForUseImpl</code> - * and not <code>prepareForUse</code> since - * <code>prepareForUse</code> calls <code>prepareForUseImpl</code>. - * - * @param monitor the TaskMonitor to use - * @param repository the ObjectRepository to use + // public Object handler; + + public OptionsHandler(Object c, String cliString) { + super(c, cliString); + // this.handler = c; + // this.prepareForUse(); + /* + * int firstSpaceIndex = cliString.indexOf(' ', 0); String classOptions; + * String className; if (firstSpaceIndex > 0) { className = + * cliString.substring(0, firstSpaceIndex); classOptions = + * cliString.substring(firstSpaceIndex + 1, cliString.length()); + * classOptions = classOptions.trim(); } else { className = cliString; + * classOptions = ""; } */ - //protected abstract void prepareForUseImpl(TaskMonitor monitor, - // ObjectRepository repository); - - /* public String getCLICreationString(Class<?> expectedType) { - return ClassOption.stripPackagePrefix(this.getClass().getName(), - expectedType) - + " " + getOptions().getAsCLIString(); - }*/ - - - /** - * Gets the options of this class via reflection. - * - * @return an array of options - */ - /*public Option[] discoverOptionsViaReflection() { - //Class<? extends AbstractOptionHandler> c = this.getClass(); - Class c = this.handler.getClass(); - Field[] fields = c.getFields(); - List<Option> optList = new LinkedList<Option>(); - for (Field field : fields) { - String fName = field.getName(); - Class<?> fType = field.getType(); - if (fType.getName().endsWith("Option")) { - if (Option.class.isAssignableFrom(fType)) { - Option oVal = null; - try { - field.setAccessible(true); - oVal = (Option) field.get(this.handler); - } catch (IllegalAccessException ignored) { - // cannot access this field - } - if (oVal != null) { - optList.add(oVal); - } - } - } + // options.setViaCLIString(cliString); + } + + // private static final long serialVersionUID = 1L; + + /** Options to handle */ + // protected Options options; + + /** Dictionary with option texts and objects */ + // protected Map<String, Object> classOptionNamesToPreparedObjects; + + /* + * public String getPurposeString() { return + * "Anonymous object: purpose undocumented."; } + * + * public Options getOptions() { if (this.options == null) { this.options = + * new Options(); Option[] myOptions = discoverOptionsViaReflection(); for + * (Option option : myOptions) { this.options.addOption(option); } } return + * this.options; } + */ + + public void prepareForUse() { + prepareForUse(new NullMonitor(), null); + } + + public void prepareForUse(TaskMonitor monitor, ObjectRepository repository) { + prepareClassOptions(monitor, repository); + // prepareForUseImpl(monitor, repository); + } + + /** + * This method describes the implementation of how to prepare this object for + * use. All classes that extends this class have to implement + * <code>prepareForUseImpl</code> and not <code>prepareForUse</code> since + * <code>prepareForUse</code> calls <code>prepareForUseImpl</code>. + * + * @param monitor + * the TaskMonitor to use + * @param repository + * the ObjectRepository to use + */ + // protected abstract void prepareForUseImpl(TaskMonitor monitor, + // ObjectRepository repository); + + /* + * public String getCLICreationString(Class<?> expectedType) { return + * ClassOption.stripPackagePrefix(this.getClass().getName(), expectedType) + + * " " + getOptions().getAsCLIString(); } + */ + + /** + * Gets the options of this class via reflection. + * + * @return an array of options + */ + /* + * public Option[] discoverOptionsViaReflection() { //Class<? extends + * AbstractOptionHandler> c = this.getClass(); Class c = + * this.handler.getClass(); Field[] fields = c.getFields(); List<Option> + * optList = new LinkedList<Option>(); for (Field field : fields) { String + * fName = field.getName(); Class<?> fType = field.getType(); if + * (fType.getName().endsWith("Option")) { if + * (Option.class.isAssignableFrom(fType)) { Option oVal = null; try { + * field.setAccessible(true); oVal = (Option) field.get(this.handler); } catch + * (IllegalAccessException ignored) { // cannot access this field } if (oVal + * != null) { optList.add(oVal); } } } } return optList.toArray(new + * Option[optList.size()]); } + */ + + /** + * Prepares the options of this class. + * + * @param monitor + * the TaskMonitor to use + * @param repository + * the ObjectRepository to use + */ + public void prepareClassOptions(TaskMonitor monitor, + ObjectRepository repository) { + this.classOptionNamesToPreparedObjects = null; + Option[] optionArray = getOptions().getOptionArray(); + for (Option option : optionArray) { + if (option instanceof ClassOption) { + ClassOption classOption = (ClassOption) option; + monitor.setCurrentActivity("Materializing option " + + classOption.getName() + "...", -1.0); + Object optionObj = classOption.materializeObject(monitor, + repository); + if (monitor.taskShouldAbort()) { + return; } - return optList.toArray(new Option[optList.size()]); - }*/ - - /** - * Prepares the options of this class. - * - * @param monitor the TaskMonitor to use - * @param repository the ObjectRepository to use - */ - public void prepareClassOptions(TaskMonitor monitor, - ObjectRepository repository) { - this.classOptionNamesToPreparedObjects = null; - Option[] optionArray = getOptions().getOptionArray(); - for (Option option : optionArray) { - if (option instanceof ClassOption) { - ClassOption classOption = (ClassOption) option; - monitor.setCurrentActivity("Materializing option " - + classOption.getName() + "...", -1.0); - Object optionObj = classOption.materializeObject(monitor, - repository); - if (monitor.taskShouldAbort()) { - return; - } - if (optionObj instanceof OptionHandler) { - monitor.setCurrentActivity("Preparing option " - + classOption.getName() + "...", -1.0); - ((OptionHandler) optionObj).prepareForUse(monitor, - repository); - if (monitor.taskShouldAbort()) { - return; - } - } - if (this.classOptionNamesToPreparedObjects == null) { - this.classOptionNamesToPreparedObjects = new HashMap<String, Object>(); - } - this.classOptionNamesToPreparedObjects.put(option.getName(), - optionObj); - } + if (optionObj instanceof OptionHandler) { + monitor.setCurrentActivity("Preparing option " + + classOption.getName() + "...", -1.0); + ((OptionHandler) optionObj).prepareForUse(monitor, + repository); + if (monitor.taskShouldAbort()) { + return; + } } - } - - /** - * Gets a prepared option of this class. - * - * @param opt the class option to get - * @return an option stored in the dictionary - */ - public Object getPreparedClassOption(ClassOption opt) { if (this.classOptionNamesToPreparedObjects == null) { - this.prepareForUse(); - } - return this.classOptionNamesToPreparedObjects.get(opt.getName()); + this.classOptionNamesToPreparedObjects = new HashMap<String, Object>(); + } + this.classOptionNamesToPreparedObjects.put(option.getName(), + optionObj); + } + } + } + + /** + * Gets a prepared option of this class. + * + * @param opt + * the class option to get + * @return an option stored in the dictionary + */ + public Object getPreparedClassOption(ClassOption opt) { + if (this.classOptionNamesToPreparedObjects == null) { + this.prepareForUse(); } + return this.classOptionNamesToPreparedObjects.get(opt.getName()); + } + + // @Override + // public void getDescription(StringBuilder sb, int i) { + // throw new UnsupportedOperationException("Not supported yet."); + // } - //@Override - //public void getDescription(StringBuilder sb, int i) { - // throw new UnsupportedOperationException("Not supported yet."); - //} - }
http://git-wip-us.apache.org/repos/asf/incubator-samoa/blob/23a35dbe/samoa-api/src/main/java/com/yahoo/labs/samoa/moa/streams/ArffFileStream.java ---------------------------------------------------------------------- diff --git a/samoa-api/src/main/java/com/yahoo/labs/samoa/moa/streams/ArffFileStream.java b/samoa-api/src/main/java/com/yahoo/labs/samoa/moa/streams/ArffFileStream.java index aa2717d..0edd48f 100644 --- a/samoa-api/src/main/java/com/yahoo/labs/samoa/moa/streams/ArffFileStream.java +++ b/samoa-api/src/main/java/com/yahoo/labs/samoa/moa/streams/ArffFileStream.java @@ -39,161 +39,161 @@ import com.yahoo.labs.samoa.moa.tasks.TaskMonitor; /** * Stream reader of ARFF files. - * + * * @author Richard Kirkby ([email protected]) * @version $Revision: 7 $ */ public class ArffFileStream extends AbstractOptionHandler implements InstanceStream { - @Override - public String getPurposeString() { - return "A stream read from an ARFF file."; - } + @Override + public String getPurposeString() { + return "A stream read from an ARFF file."; + } - private static final long serialVersionUID = 1L; + private static final long serialVersionUID = 1L; - public FileOption arffFileOption = new FileOption("arffFile", 'f', - "ARFF file to load.", null, "arff", false); + public FileOption arffFileOption = new FileOption("arffFile", 'f', + "ARFF file to load.", null, "arff", false); - public IntOption classIndexOption = new IntOption( - "classIndex", - 'c', - "Class index of data. 0 for none or -1 for last attribute in file.", - -1, -1, Integer.MAX_VALUE); + public IntOption classIndexOption = new IntOption( + "classIndex", + 'c', + "Class index of data. 0 for none or -1 for last attribute in file.", + -1, -1, Integer.MAX_VALUE); - protected Instances instances; + protected Instances instances; - transient protected Reader fileReader; + transient protected Reader fileReader; - protected boolean hitEndOfFile; + protected boolean hitEndOfFile; - protected InstanceExample lastInstanceRead; + protected InstanceExample lastInstanceRead; - protected int numInstancesRead; + protected int numInstancesRead; - transient protected InputStreamProgressMonitor fileProgressMonitor; - - protected boolean hasStarted; + transient protected InputStreamProgressMonitor fileProgressMonitor; - public ArffFileStream() { - } + protected boolean hasStarted; - public ArffFileStream(String arffFileName, int classIndex) { - this.arffFileOption.setValue(arffFileName); - this.classIndexOption.setValue(classIndex); - this.hasStarted = false; - restart(); - } + public ArffFileStream() { + } - @Override - public void prepareForUseImpl(TaskMonitor monitor, - ObjectRepository repository) { - //restart(); - this.hasStarted = false; - this.lastInstanceRead = null; - } + public ArffFileStream(String arffFileName, int classIndex) { + this.arffFileOption.setValue(arffFileName); + this.classIndexOption.setValue(classIndex); + this.hasStarted = false; + restart(); + } - @Override - public InstancesHeader getHeader() { - return new InstancesHeader(this.instances); - } + @Override + public void prepareForUseImpl(TaskMonitor monitor, + ObjectRepository repository) { + // restart(); + this.hasStarted = false; + this.lastInstanceRead = null; + } - @Override - public long estimatedRemainingInstances() { - double progressFraction = this.fileProgressMonitor.getProgressFraction(); - if ((progressFraction > 0.0) && (this.numInstancesRead > 0)) { - return (long) ((this.numInstancesRead / progressFraction) - this.numInstancesRead); - } - return -1; - } + @Override + public InstancesHeader getHeader() { + return new InstancesHeader(this.instances); + } - @Override - public boolean hasMoreInstances() { - return !this.hitEndOfFile; + @Override + public long estimatedRemainingInstances() { + double progressFraction = this.fileProgressMonitor.getProgressFraction(); + if ((progressFraction > 0.0) && (this.numInstancesRead > 0)) { + return (long) ((this.numInstancesRead / progressFraction) - this.numInstancesRead); } - - @Override - public InstanceExample nextInstance() { - if (this.lastInstanceRead == null) { - readNextInstanceFromFile(); - } - InstanceExample prevInstance = this.lastInstanceRead; - this.hitEndOfFile = !readNextInstanceFromFile(); - return prevInstance; + return -1; + } + + @Override + public boolean hasMoreInstances() { + return !this.hitEndOfFile; + } + + @Override + public InstanceExample nextInstance() { + if (this.lastInstanceRead == null) { + readNextInstanceFromFile(); } - - @Override - public boolean isRestartable() { - return true; + InstanceExample prevInstance = this.lastInstanceRead; + this.hitEndOfFile = !readNextInstanceFromFile(); + return prevInstance; + } + + @Override + public boolean isRestartable() { + return true; + } + + @Override + public void restart() { + try { + reset(); + // this.hitEndOfFile = !readNextInstanceFromFile(); + } catch (IOException ioe) { + throw new RuntimeException("ArffFileStream restart failed.", ioe); } - - @Override - public void restart() { - try { - reset(); - //this.hitEndOfFile = !readNextInstanceFromFile(); - } catch (IOException ioe) { - throw new RuntimeException("ArffFileStream restart failed.", ioe); - } + } + + protected boolean readNextInstanceFromFile() { + boolean ret; + if (!this.hasStarted) { + try { + reset(); + ret = getNextInstanceFromFile(); + this.hitEndOfFile = !ret; + } catch (IOException ioe) { + throw new RuntimeException("ArffFileStream restart failed.", ioe); + } + this.hasStarted = true; + } else { + ret = getNextInstanceFromFile(); } + return ret; + } - protected boolean readNextInstanceFromFile() { - boolean ret; - if (!this.hasStarted){ - try { - reset(); - ret = getNextInstanceFromFile(); - this.hitEndOfFile = !ret; - } catch (IOException ioe) { - throw new RuntimeException("ArffFileStream restart failed.", ioe); - } - this.hasStarted = true; - } else { - ret = getNextInstanceFromFile(); - } - return ret; - } + @Override + public void getDescription(StringBuilder sb, int indent) { + // TODO Auto-generated method stub + } - @Override - public void getDescription(StringBuilder sb, int indent) { - // TODO Auto-generated method stub + private void reset() throws IOException { + if (this.fileReader != null) { + this.fileReader.close(); } - - private void reset() throws IOException { - if (this.fileReader != null) { - this.fileReader.close(); - } - InputStream fileStream = new FileInputStream(this.arffFileOption.getFile()); - this.fileProgressMonitor = new InputStreamProgressMonitor( - fileStream); - this.fileReader = new BufferedReader(new InputStreamReader( - this.fileProgressMonitor)); - this.instances = new Instances(this.fileReader, 1, this.classIndexOption.getValue()); - if (this.classIndexOption.getValue() < 0) { - this.instances.setClassIndex(this.instances.numAttributes() - 1); - } else if (this.classIndexOption.getValue() > 0) { - this.instances.setClassIndex(this.classIndexOption.getValue() - 1); - } - this.numInstancesRead = 0; - this.lastInstanceRead = null; + InputStream fileStream = new FileInputStream(this.arffFileOption.getFile()); + this.fileProgressMonitor = new InputStreamProgressMonitor( + fileStream); + this.fileReader = new BufferedReader(new InputStreamReader( + this.fileProgressMonitor)); + this.instances = new Instances(this.fileReader, 1, this.classIndexOption.getValue()); + if (this.classIndexOption.getValue() < 0) { + this.instances.setClassIndex(this.instances.numAttributes() - 1); + } else if (this.classIndexOption.getValue() > 0) { + this.instances.setClassIndex(this.classIndexOption.getValue() - 1); } - - private boolean getNextInstanceFromFile() throws RuntimeException { - try { - if (this.instances.readInstance(this.fileReader)) { - this.lastInstanceRead = new InstanceExample(this.instances.instance(0)); - this.instances.delete(); // keep instances clean - this.numInstancesRead++; - return true; - } - if (this.fileReader != null) { - this.fileReader.close(); - this.fileReader = null; - } - return false; - } catch (IOException ioe) { - throw new RuntimeException( - "ArffFileStream failed to read instance from stream.", ioe); - } + this.numInstancesRead = 0; + this.lastInstanceRead = null; + } + + private boolean getNextInstanceFromFile() throws RuntimeException { + try { + if (this.instances.readInstance(this.fileReader)) { + this.lastInstanceRead = new InstanceExample(this.instances.instance(0)); + this.instances.delete(); // keep instances clean + this.numInstancesRead++; + return true; + } + if (this.fileReader != null) { + this.fileReader.close(); + this.fileReader = null; + } + return false; + } catch (IOException ioe) { + throw new RuntimeException( + "ArffFileStream failed to read instance from stream.", ioe); } + } } http://git-wip-us.apache.org/repos/asf/incubator-samoa/blob/23a35dbe/samoa-api/src/main/java/com/yahoo/labs/samoa/moa/streams/ExampleStream.java ---------------------------------------------------------------------- diff --git a/samoa-api/src/main/java/com/yahoo/labs/samoa/moa/streams/ExampleStream.java b/samoa-api/src/main/java/com/yahoo/labs/samoa/moa/streams/ExampleStream.java index dbdeba3..471d83c 100644 --- a/samoa-api/src/main/java/com/yahoo/labs/samoa/moa/streams/ExampleStream.java +++ b/samoa-api/src/main/java/com/yahoo/labs/samoa/moa/streams/ExampleStream.java @@ -25,55 +25,54 @@ import com.yahoo.labs.samoa.moa.MOAObject; import com.yahoo.labs.samoa.moa.core.Example; /** - * Interface representing a data stream of examples. - * + * Interface representing a data stream of examples. + * * @author Richard Kirkby ([email protected]) - * @version $Revision: 7 $ + * @version $Revision: 7 $ */ public interface ExampleStream<E extends Example> extends MOAObject { - /** - * Gets the header of this stream. - * This is useful to know attributes and classes. - * InstancesHeader is an extension of weka.Instances. - * - * @return the header of this stream - */ - public InstancesHeader getHeader(); + /** + * Gets the header of this stream. This is useful to know attributes and + * classes. InstancesHeader is an extension of weka.Instances. + * + * @return the header of this stream + */ + public InstancesHeader getHeader(); - /** - * Gets the estimated number of remaining instances in this stream - * - * @return the estimated number of instances to get from this stream - */ - public long estimatedRemainingInstances(); + /** + * Gets the estimated number of remaining instances in this stream + * + * @return the estimated number of instances to get from this stream + */ + public long estimatedRemainingInstances(); - /** - * Gets whether this stream has more instances to output. - * This is useful when reading streams from files. - * - * @return true if this stream has more instances to output - */ - public boolean hasMoreInstances(); + /** + * Gets whether this stream has more instances to output. This is useful when + * reading streams from files. + * + * @return true if this stream has more instances to output + */ + public boolean hasMoreInstances(); - /** - * Gets the next example from this stream. - * - * @return the next example of this stream - */ - public E nextInstance(); + /** + * Gets the next example from this stream. + * + * @return the next example of this stream + */ + public E nextInstance(); - /** - * Gets whether this stream can restart. - * - * @return true if this stream can restart - */ - public boolean isRestartable(); + /** + * Gets whether this stream can restart. + * + * @return true if this stream can restart + */ + public boolean isRestartable(); - /** - * Restarts this stream. It must be similar to - * starting a new stream from scratch. - * - */ - public void restart(); + /** + * Restarts this stream. It must be similar to starting a new stream from + * scratch. + * + */ + public void restart(); } http://git-wip-us.apache.org/repos/asf/incubator-samoa/blob/23a35dbe/samoa-api/src/main/java/com/yahoo/labs/samoa/moa/streams/InstanceStream.java ---------------------------------------------------------------------- diff --git a/samoa-api/src/main/java/com/yahoo/labs/samoa/moa/streams/InstanceStream.java b/samoa-api/src/main/java/com/yahoo/labs/samoa/moa/streams/InstanceStream.java index 1166e81..30289bd 100644 --- a/samoa-api/src/main/java/com/yahoo/labs/samoa/moa/streams/InstanceStream.java +++ b/samoa-api/src/main/java/com/yahoo/labs/samoa/moa/streams/InstanceStream.java @@ -24,14 +24,11 @@ import com.yahoo.labs.samoa.moa.core.Example; import com.yahoo.labs.samoa.instances.Instance; /** - * Interface representing a data stream of instances. - * + * Interface representing a data stream of instances. + * * @author Richard Kirkby ([email protected]) - * @version $Revision: 7 $ + * @version $Revision: 7 $ */ public interface InstanceStream extends ExampleStream<Example<Instance>> { - - - } http://git-wip-us.apache.org/repos/asf/incubator-samoa/blob/23a35dbe/samoa-api/src/main/java/com/yahoo/labs/samoa/moa/streams/clustering/ClusterEvent.java ---------------------------------------------------------------------- diff --git a/samoa-api/src/main/java/com/yahoo/labs/samoa/moa/streams/clustering/ClusterEvent.java b/samoa-api/src/main/java/com/yahoo/labs/samoa/moa/streams/clustering/ClusterEvent.java index 7062d99..1bada9d 100644 --- a/samoa-api/src/main/java/com/yahoo/labs/samoa/moa/streams/clustering/ClusterEvent.java +++ b/samoa-api/src/main/java/com/yahoo/labs/samoa/moa/streams/clustering/ClusterEvent.java @@ -1,4 +1,3 @@ - package com.yahoo.labs.samoa.moa.streams.clustering; /* @@ -36,15 +35,15 @@ public class ClusterEvent extends EventObject { this.timestamp = timestamp; } - public String getMessage(){ - return message; + public String getMessage() { + return message; } - public long getTimestamp(){ - return timestamp; + public long getTimestamp() { + return timestamp; } - public String getType(){ - return type; + public String getType() { + return type; } } http://git-wip-us.apache.org/repos/asf/incubator-samoa/blob/23a35dbe/samoa-api/src/main/java/com/yahoo/labs/samoa/moa/streams/clustering/ClusterEventListener.java ---------------------------------------------------------------------- diff --git a/samoa-api/src/main/java/com/yahoo/labs/samoa/moa/streams/clustering/ClusterEventListener.java b/samoa-api/src/main/java/com/yahoo/labs/samoa/moa/streams/clustering/ClusterEventListener.java index ff05afd..07d9aca 100644 --- a/samoa-api/src/main/java/com/yahoo/labs/samoa/moa/streams/clustering/ClusterEventListener.java +++ b/samoa-api/src/main/java/com/yahoo/labs/samoa/moa/streams/clustering/ClusterEventListener.java @@ -1,4 +1,3 @@ - package com.yahoo.labs.samoa.moa.streams.clustering; /* @@ -28,4 +27,3 @@ public interface ClusterEventListener extends EventListener { public void changeCluster(ClusterEvent e); } - http://git-wip-us.apache.org/repos/asf/incubator-samoa/blob/23a35dbe/samoa-api/src/main/java/com/yahoo/labs/samoa/moa/streams/clustering/ClusteringStream.java ---------------------------------------------------------------------- diff --git a/samoa-api/src/main/java/com/yahoo/labs/samoa/moa/streams/clustering/ClusteringStream.java b/samoa-api/src/main/java/com/yahoo/labs/samoa/moa/streams/clustering/ClusteringStream.java index 6e38348..3db9ec6 100644 --- a/samoa-api/src/main/java/com/yahoo/labs/samoa/moa/streams/clustering/ClusteringStream.java +++ b/samoa-api/src/main/java/com/yahoo/labs/samoa/moa/streams/clustering/ClusteringStream.java @@ -1,4 +1,3 @@ - package com.yahoo.labs.samoa.moa.streams.clustering; /* @@ -26,30 +25,29 @@ import com.github.javacliparser.FloatOption; import com.github.javacliparser.IntOption; import com.yahoo.labs.samoa.moa.streams.InstanceStream; -public abstract class ClusteringStream extends AbstractOptionHandler implements InstanceStream{ - public IntOption decayHorizonOption = new IntOption("decayHorizon", 'h', - "Decay horizon", 1000, 0, Integer.MAX_VALUE); - - public FloatOption decayThresholdOption = new FloatOption("decayThreshold", 't', - "Decay horizon threshold", 0.01, 0, 1); +public abstract class ClusteringStream extends AbstractOptionHandler implements InstanceStream { + public IntOption decayHorizonOption = new IntOption("decayHorizon", 'h', + "Decay horizon", 1000, 0, Integer.MAX_VALUE); - public IntOption evaluationFrequencyOption = new IntOption("evaluationFrequency", 'e', - "Evaluation frequency", 1000, 0, Integer.MAX_VALUE); + public FloatOption decayThresholdOption = new FloatOption("decayThreshold", 't', + "Decay horizon threshold", 0.01, 0, 1); - public IntOption numAttsOption = new IntOption("numAtts", 'a', - "The number of attributes to generate.", 2, 0, Integer.MAX_VALUE); + public IntOption evaluationFrequencyOption = new IntOption("evaluationFrequency", 'e', + "Evaluation frequency", 1000, 0, Integer.MAX_VALUE); - public int getDecayHorizon(){ - return decayHorizonOption.getValue(); - } + public IntOption numAttsOption = new IntOption("numAtts", 'a', + "The number of attributes to generate.", 2, 0, Integer.MAX_VALUE); - public double getDecayThreshold(){ - return decayThresholdOption.getValue(); - } + public int getDecayHorizon() { + return decayHorizonOption.getValue(); + } - public int getEvaluationFrequency(){ - return evaluationFrequencyOption.getValue(); - } + public double getDecayThreshold() { + return decayThresholdOption.getValue(); + } + public int getEvaluationFrequency() { + return evaluationFrequencyOption.getValue(); + } }
