easik.sketch.util.ini
Class IniFileNode

java.lang.Object
  extended by easik.sketch.util.ini.IniFileNode

public class IniFileNode
extends java.lang.Object

Class used to keep information stored under a particular header of an ini file

Since:
2006-07-11 Kevin Green
Version:
2006-07-13 Kevin Green
Author:
Ian Rutherford 2001, Kevin Green 2006

Field Summary
private  java.util.HashMap<java.lang.String,java.lang.String> _items
          Hash map of items stored in the node, indexed by the name of the item
private  java.lang.String _title
          The name of the header
 
Constructor Summary
IniFileNode(java.lang.String title)
          Default constructor
 
Method Summary
 boolean addItem(java.lang.String name, java.lang.String value)
          Adds a new item to this header.
 boolean changeItem(java.lang.String name, java.lang.String value)
          Changes the value of an item
 void erase()
          Clears all the items from the header
 java.util.HashMap<java.lang.String,java.lang.String> getAllItems()
          Returns the HashMap of all items
 java.lang.String getItem(java.lang.String name)
          Returns the item given by the name
 java.lang.String getTitle()
          Returns the name of this header
 int numItems()
          Returns the number of items in this header
 boolean removeItem(java.lang.String name)
          Removes an item from the header
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

_title

private java.lang.String _title
The name of the header


_items

private java.util.HashMap<java.lang.String,java.lang.String> _items
Hash map of items stored in the node, indexed by the name of the item

Constructor Detail

IniFileNode

public IniFileNode(java.lang.String title)
Default constructor

Parameters:
title - The name of this header
Method Detail

getTitle

public java.lang.String getTitle()
Returns the name of this header

Returns:
The name of this header

numItems

public int numItems()
Returns the number of items in this header

Returns:
The number of items in this header

addItem

public boolean addItem(java.lang.String name,
                       java.lang.String value)
Adds a new item to this header. If it already exists then it overwrites it with the new value

Parameters:
name - The name of the new item
value - The value of the new item
Returns:
True if added successfully, false otherwise

getItem

public java.lang.String getItem(java.lang.String name)
Returns the item given by the name

Parameters:
name - The name of the item to be returned
Returns:
The value of the item to be returned, null if it doesn't exist

getAllItems

public java.util.HashMap<java.lang.String,java.lang.String> getAllItems()
Returns the HashMap of all items

Returns:
The HashMap of all items

changeItem

public boolean changeItem(java.lang.String name,
                          java.lang.String value)
Changes the value of an item

Parameters:
name - The name of the item to be changed
value - The value of the item to be changed
Returns:
True if the change was successfull, false otherwise

removeItem

public boolean removeItem(java.lang.String name)
Removes an item from the header

Parameters:
name - The name of the item to be removed
Returns:
True if it was removed successfully, false otherwise

erase

public void erase()
Clears all the items from the header