All Downloads are FREE. Search and download functionalities are using the official Maven repository.

decodes.tsdb.compedit.PyFuncList Maven / Gradle / Ivy

Go to download

A collection of software for aggregatting and processing environmental data such as from NOAA GOES satellites.

The newest version!
package decodes.tsdb.compedit;

import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;

import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;

import ilex.util.EnvExpander;
import ilex.util.ErrorException;
import ilex.util.Logger;
import ilex.xml.DomHelper;

/**
 * Holds a python function list read from a file.
 */
public class PyFuncList
{
	public static final String module = "PyFuncList";
	private String filename = null;
	private String listName = null;
	
	private HashMap funcs = new HashMap(); 
	
	public PyFuncList(String listName, String filename)
	{
		this.listName = listName;
		this.filename = filename;
	}
	
	public void readFile()
	{
		Document doc;
		try
		{
			doc = DomHelper.readFile(module, EnvExpander.expand(filename));
		}
		catch (ErrorException ex)
		{
			warning("Cannot read file: " + ex);
			return;
		}
        Node element = doc.getDocumentElement();
        if (!element.getNodeName().equalsIgnoreCase("funclist"))
        {
            warning("Wrong type of xml file -- Cannot initialize. "
                + "Root element is not 'funclist'.");
            return;
        }

        NodeList children = element.getChildNodes();
        if (children != null)
		{
			int length = children.getLength();
            for(int i=0; i getList()
	{
		return funcs.values();
	}

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy