Package graphs

Source Code of graphs.XYInputsvOuputByThetaGraph

package graphs;


import odor.Odor;

import org.jfree.data.xy.XYSeries;
import org.jfree.data.xy.XYSeriesCollection;

import visualization.JNetwork;

public class XYInputsvOuputByThetaGraph extends graphs.XYInputsVOuputGraph
  public XYInputsvOuputByThetaGraph(JNetwork network)
  {
    XYSeries data = new XYSeries(network.toString());
    double[] inputs = network.getInput().getInputs();
    double[] outputs = network.getOutput();
   
    for (int x=0; x<outputs.length; x++)
    {
      //Input v.s Output, ordered by Theta
      data.add(inputs[x], outputs[x]);
    }
   
    if (this.contains(network) == false)
    { 
      this.dataSet.addSeries(data);
    }
   
    super.makeChart("Inputs v.s. Outputs by Network", "Input", "Output");
  }
 
  public XYInputsvOuputByThetaGraph(JNetwork network, Odor odorUsed)
  {
    XYSeries data = new XYSeries(network.toString());
    double[] inputs = network.getInput().getInputs();
    double[] outputs = network.getOutput();
   
    for (int x=0; x<outputs.length; x++)
    {
      //Input v.s Output, ordered by Theta
      data.add(inputs[x], outputs[x]);
    }
   
    if (this.contains(network) == false)
    { 
      this.dataSet.addSeries(data);
    }
   
    super.makeChart("Inputs v.s. Outputs by Network", "Input", "Output");
   
    super.chartFrame.setTitle(odorUsed.toString());
  }
 
  public void addXYSeries(JNetwork series)
  {
    XYSeries data = new XYSeries(series.toString());
    double[] inputs = series.getInput().getInputs();
    double[] outputs = series.getOutput();
   
    for (int x=0; x<outputs.length; x++)
    {
      //Input v.s Input/Output, ordered by Theta
      data.add(inputs[x], inputs[x]/outputs[x]);
    }
   
    if (this.contains(series) == false)
    { 
      this.dataSet.addSeries(data);
    }
  }
 
  public boolean contains(JNetwork input)
  {
    if (this.dataSet.getSeries() == null || input == null)
    {
      return false;
    }
   
    for(int x=0; x<this.dataSet.getSeriesCount(); x++)
    {
      XYSeries serie = this.dataSet.getSeries(x);

      if (((String)serie.getKey()).compareTo(input.toString()) == 0)
      {
        return true;
      }
    }
   
    return false;
   
  }
}
TOP

Related Classes of graphs.XYInputsvOuputByThetaGraph

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.