de.knipp.rritoolkit
Class KVMultiList

java.lang.Object
  extended by de.knipp.rritoolkit.KVMultiList

public class KVMultiList
extends java.lang.Object

class that represents a key-value list consisting of multiple sections. each section itself is represented by a KVList. Please note that the comparison of section names is performed case-sensitive. Therefore, all keys are expected to be lower-case normalized.

Version:
$Revision: 14987 $
Author:
Klaus Malorny

Nested Class Summary
private static class KVMultiList.Section
          small class that represents a section.
 
Field Summary
private  java.util.Map<KVList,KVMultiList.Section> listMap
          the map from the list to the section
private  KVList mainList
          the main key-value list
private  java.util.Map<java.lang.String,java.util.List<KVMultiList.Section>> nameMap
          mapping from the section names to the sections
private  java.util.Set<KVMultiList.Section> sections
          the set of all sections
 
Constructor Summary
KVMultiList()
          constructor
 
Method Summary
 void addSection(KVList list, java.lang.String... names)
          add the given list as a new section
 KVList getFirstSection(java.lang.String name)
          return the first section with the given name
 KVList getMainSection()
          return the main section
 java.lang.String[] getSectionNames(KVList list)
          return the subsection names of the given list.
 java.util.List<KVList> getSections(java.lang.String name)
          return the subsections with the given name
 java.util.Iterator<KVList> getSubsections()
          return an iterator over all subsections
 KVList newSection(java.lang.String... names)
          create a new section with the given name(s)
 void removeSection(KVList list)
          remove the section represented by the given list
private  void removeSection(KVMultiList.Section s)
          remove the given section
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

mainList

private KVList mainList
the main key-value list


sections

private java.util.Set<KVMultiList.Section> sections
the set of all sections


nameMap

private java.util.Map<java.lang.String,java.util.List<KVMultiList.Section>> nameMap
mapping from the section names to the sections


listMap

private java.util.Map<KVList,KVMultiList.Section> listMap
the map from the list to the section

Constructor Detail

KVMultiList

public KVMultiList()
constructor

Method Detail

getMainSection

public KVList getMainSection()
return the main section

Returns:
the main section

getSections

public java.util.List<KVList> getSections(java.lang.String name)
return the subsections with the given name

Parameters:
name - the name
Returns:
the list of key-value lists

getFirstSection

public KVList getFirstSection(java.lang.String name)
return the first section with the given name

Parameters:
name - the name
Returns:
the first key-value list or null if no section with the given name exists

removeSection

private void removeSection(KVMultiList.Section s)
remove the given section

Parameters:
s - the section to remove

removeSection

public void removeSection(KVList list)
remove the section represented by the given list

Parameters:
list - the list to remove

newSection

public KVList newSection(java.lang.String... names)
create a new section with the given name(s)

Parameters:
names - the names
Returns:
the list created for the section

addSection

public void addSection(KVList list,
                       java.lang.String... names)
add the given list as a new section

Parameters:
list - the list to add
names - the names for the section

getSectionNames

public java.lang.String[] getSectionNames(KVList list)
return the subsection names of the given list. The list must be managed by this object

Parameters:
list - the list of which the names shall be return
Returns:
the names or null if the list not a subsection

getSubsections

public java.util.Iterator<KVList> getSubsections()
return an iterator over all subsections

Returns:
the iterator


Copyright © 2005-2011 Knipp Medien und Kommunikation GmbH