Regain 2.1.0-STABLE API

net.sf.regain.crawler.config
Class PreparatorConfig

java.lang.Object
  extended by net.sf.regain.crawler.config.PreparatorConfig
All Implemented Interfaces:
Iterable<Map.Entry<String,Map<String,String>>>

public class PreparatorConfig
extends Object
implements Iterable<Map.Entry<String,Map<String,String>>>

The configuration of a preparator. Consists of a set of sections which contain a set of key-value-pairs. Is the order of sections relevant? Currently, it isn't guaranteed. Ignores Case of section name.

Author:
Til Schneider, www.murfman.de

Field Summary
private  ChainedHashMap<String,Map<String,String>> mSectionList
          The sections of this config.
private  Map<String,String>[] sectionContents
          Deprecated. 
private  String[] sectionNames
          Deprecated. 
 
Constructor Summary
PreparatorConfig()
           
 
Method Summary
(package private)  void addSection(String name, Map<String,String> content)
          Adds a section to the config
private  void fillSectionCache()
          Deprecated. 
 Map<String,String> getSectionContent(int index)
          Deprecated. This method assumes that the config won't change anymore. Use iterator() instead.
 int getSectionCount()
          Gets the number of sections this config has.
 String getSectionName(int index)
          Deprecated. This method assumes that the config won't change anymore. Use iterator() instead.
 Map<String,String>[] getSectionsWithName(String name)
          Deprecated. Use getSectionsWithNameList() instead.
 List<Map<String,String>> getSectionsWithNameList(String name)
          Gets all sections with the given name.
 Map<String,String> getSectionWithName(String name)
          Gets the first section with the given name.
 Iterator<Map.Entry<String,Map<String,String>>> iterator()
          Iterate through all section-Parameter pairs.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

mSectionList

private ChainedHashMap<String,Map<String,String>> mSectionList
The sections of this config.
String: The name of the section
Map: The key-value-pairs of the section.

We use no HashMap here, because two sections may have the same name.


sectionNames

@Deprecated
private String[] sectionNames
Deprecated. 

sectionContents

@Deprecated
private Map<String,String>[] sectionContents
Deprecated. 
Constructor Detail

PreparatorConfig

public PreparatorConfig()
Method Detail

addSection

void addSection(String name,
                Map<String,String> content)
Adds a section to the config

Parameters:
name - The name of the section to add.
content - The key-value-pairs of the section to add.

getSectionCount

public int getSectionCount()
Gets the number of sections this config has.

Returns:
The number of sections.

getSectionWithName

public Map<String,String> getSectionWithName(String name)
Gets the first section with the given name.

Parameters:
name - The name of the sections
Returns:
The first section with the given name or null if there is no such section.

getSectionsWithNameList

public List<Map<String,String>> getSectionsWithNameList(String name)
Gets all sections with the given name.

Parameters:
name - The name of the sections
Returns:
All sections with the given name.

iterator

public Iterator<Map.Entry<String,Map<String,String>>> iterator()
Iterate through all section-Parameter pairs. Section names will be lowercase. The order that the sections are given isn't guaranteed. Usage: for (Map.Entry> section : config) { String sectionName = section.getEntry(); Map params = section.getValue(); }

Specified by:
iterator in interface Iterable<Map.Entry<String,Map<String,String>>>

getSectionsWithName

@Deprecated
public Map<String,String>[] getSectionsWithName(String name)
Deprecated. Use getSectionsWithNameList() instead.

Gets all sections with the given name.

Parameters:
name - The name of the sections
Returns:
All sections with the given name.

fillSectionCache

@Deprecated
private void fillSectionCache()
Deprecated. 


getSectionName

@Deprecated
public String getSectionName(int index)
Deprecated. This method assumes that the config won't change anymore. Use iterator() instead.

Gets the name of a section.

Parameters:
index - The index of the section.
Returns:
The name of the section.

getSectionContent

@Deprecated
public Map<String,String> getSectionContent(int index)
Deprecated. This method assumes that the config won't change anymore. Use iterator() instead.

Gets the key-value-pairs of a section.

Parameters:
index - The index of the section.
Returns:
The key-value-pairs of the section.

Regain 2.1.0-STABLE API

Regain 2.1.0-STABLE, Copyright (C) 2004-2010 Til Schneider, www.murfman.de, Thomas Tesche, www.clustersystems.info