| ConfigNode.java |
/*
*/
package de.spieleck.config;
import java.io.PrintWriter;
import java.io.IOException;
import java.util.Iterator;
/**
* Basic interface to programm against when using the Config tool.
*/
public interface ConfigNode
{
/**
* Find sub node matching name.
*/
public ConfigNode node(String path);
/**
* Find node or parent sub node matching name.
*/
public ConfigNode nodeInh(String path);
/**
* Find the node responsible for reading this node from file.
*/
public ConfigFileNode getBranchNode();
/**
* Get the name of the node.
*/
public String getName();
/**
* Get the complete path of the node.
*/
public String getPath();
/**
* Get the node above.
*/
public ConfigNode getParent();
/**
* Get value as a boolean.
*/
public boolean getBoolean();
/**
* Get value as an integer.
*/
public int getInt();
/**
* Get value as a double.
*/
public double getDouble();
/**
* Get value as String.
*/
public String getString();
/**
* Get value of subnode as boolean, using default if necessary.
*/
public boolean getBoolean(String path, boolean deflt);
/**
* Get value of subnode as integer, using default when necessary.
*/
public int getInt(String path, int deflt);
/**
* Get value of subnode as double, using default when necessary.
*/
public double getDouble(String path, double deflt);
/**
* Get value of subnode as String, using default when necessary.
*/
public String getString(String path, String deflt);
/**
* Get value of subnode as boolean searching parent nodes before using
* default.
*/
public boolean getInhBoolean(String path, boolean deflt);
/**
* Get value of subnode as int searching parent nodes before using
* default.
*/
public int getInhInt(String path, int deflt);
/**
* Get value of subnode as double searching parent nodes before using
* default.
*/
public double getInhDouble(String path, double deflt);
/**
* Get value of subnode as String searching parent nodes before using
* default.
*/
public String getInhString(String path, String deflt);
/**
* Count the number of children we have.
*/
public int countChildren();
/**
* Enumerate my children.
*/
public Iterator children();
/**
* Enumerate children of me, having a certain name.
*/
public Iterator childrenNamed(String key);
/**
* Count the number of children we have.
*/
public int countChildrenNamed(String key);
/**
* Pretty print this node with its whole subtree.
*/
public void print(PrintWriter os)
throws IOException;
}
//
// Jacson - Text Filtering with Java.
// Copyright (C) 2002 Frank S. Nestel (nestefan -at- users.sourceforge.net)
//
// 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
//
| ConfigNode.java |