Code Search for Developers
 
 
  

Plotter.java from Oscill8 at Krugle


Show Plotter.java syntax highlighted

/******************************************************************************
 * 
 *   File: $Id: Plotter.java,v 1.1 2005/05/02 03:37:49 emeryconrad Exp $
 *   Author: Emery Conrad
 * 
 *   Descritption:
 *     ...
 * 
 *   Oscill8 Dynamical Systems Toolset
 *   Copyright (C) 2005, Emery Conrad
 *
 *   This library is free software; you can redistribute it and/or
 *   modify it under the terms of the GNU Lesser General Public
 *   License as published by the Free Software Foundation; either
 *   version 2.1 of the License, or (at your option) any later version.
 *
 *   This library is distributed in the hope that it will be useful,
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 *   Lesser General Public License for more details.
 *
 *   You should have received a copy of the GNU Lesser General Public
 *   License along with this library; if not, write to the Free Software
 *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 *
 *****************************************************************************/

package com.oscill8.o8biospice;

import java.io.*;
import java.util.Iterator;

import org.biospice.analyzer.Analyzer;
import org.biospice.analyzer.AnalysisException;
import org.biospice.analyzer.AnalyzerFactory;
import org.biospice.analyzer.ParameterDeclaration;
import org.biospice.analyzer.ParameterDeclarationGroup;
import org.biospice.analyzer.ParameterValue;
import org.biospice.analyzer.ParameterValueGroup;
import org.biospice.datatypes.*;
import org.biospice.datatypes.impl.*;

public class Plotter extends AnalyzerFactory implements Analyzer 
{
	private static final ParameterDeclarationGroup INPUTS = 
		new ParameterDeclarationGroup(new ParameterDeclaration[] {
			new ParameterDeclaration("plot",
			                         String.class,
			                         false,
			                         true,
			                         null,
			                         null)});

	public Plotter()
	{
		ICON_NAME = "/com/oscill8/o8biospice/o8plot_icon.gif";
	}

	/******************************************************************
	 * 
	 *  analyze
	 *
	 *****************************************************************/
	public ParameterValueGroup analyze(ParameterValueGroup inputs) throws AnalysisException
	{
		// check if all input arguments are non-null
		ParameterValue pv = (ParameterValue)inputs.getParameterValue("plot");
		String name = pv.getDeclaration().getName();
		if(!name.equals("plot"))
			throw new AnalysisException("Expected plot input parameter, got " + name + " instead");
		if(pv.getValue() == null)
			throw new AnalysisException("Input parameter " + name + " is not set.");

		try
		{
			String plot = (String)pv.getValue();
			System.out.println("plot=" + plot);

			// run o8plot
			Runtime rt = Runtime.getRuntime();
			String []cmd = new String[] 
				{
					System.getenv("OSCILL8_DIR") + "/bin/o8plot", "-i", plot
				};

			Process p = rt.exec(cmd);
			p.waitFor();
		}
		catch(Exception e)
		{
			throw new AnalysisException(e.getMessage());
		}

		return ParameterValueGroup.EMPTY;
	}



	/******************************************************************
	 * 
	 *  factory implementation
	 *
	 *****************************************************************/


	public Analyzer getAnalyzer() 
	{
		return this;
	}
    
	public String getDisplayName() 
	{
		return "Oscill8 Plotter";
	}
    
	public String getName() 
	{
		return "com.oscill8.o8biospice.Plotter";
	}
    
	public String getDescription() 
	{
		return "Plotter tool";
	}
    
	public ParameterDeclarationGroup getInputs() 
	{
		return INPUTS;
	}
    
	public ParameterDeclarationGroup getOutputs() 
	{
		return ParameterDeclarationGroup.EMPTY;
	}
    
	public String getReferences() 
	{
		return "http://oscill8.sourceforge.net";
	}    
}





See more files for this project here

Oscill8

Oscill8 is a suite of tools for analyzing dynamical systems which concentrates on understanding how the dynamical behavior depends on the parameters using bifurcation theory and reaction network theory.

Project homepage: http://sourceforge.net/projects/oscill8
Programming language(s): C,C#,C++
License: other

  NonJavaAnalyzer.java
  OneParameterBD.java
  Plotter.java
  Simulator.java