org.jpop.util
Class PopListUtils

java.lang.Object
  extended byorg.jpop.util.PopListUtils

public class PopListUtils
extends java.lang.Object

Contains methods to perform useful operations on pop lists

Version:
1.0
Author:
dsm

Field Summary
static char LIST_END_CHAR
          Poplog list delimiters
static char LIST_START_CHAR
          Poplog list delimiters
 
Constructor Summary
PopListUtils()
           
 
Method Summary
static void main(java.lang.String[] args)
          The main program for the PopListUtils class
static void parsePopList(java.lang.String poplist, java.util.List list)
          Takes a String representing a poplog list and adds it as a linked list to the list provided.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

LIST_START_CHAR

public static final char LIST_START_CHAR
Poplog list delimiters

See Also:
Constant Field Values

LIST_END_CHAR

public static final char LIST_END_CHAR
Poplog list delimiters

See Also:
Constant Field Values
Constructor Detail

PopListUtils

public PopListUtils()
Method Detail

parsePopList

public static void parsePopList(java.lang.String poplist,
                                java.util.List list)
Takes a String representing a poplog list and adds it as a linked list to the list provided. This works by recursively adding all the items of the string to a list, then if nested lists are found the method creates a new list, adds it, and calls itself upon the rest of the list, returning when the list closes. For example:
String s = [a long and winding [pop11 list [with nested stuff] just to check [that] it] works];
LinkedList ll = new LinkedList();
parsePopList(s, ll);
System.out.println(ll);
will print: [[a, long, and, winding, [pop11, list, [with, nested, stuff], just, to, check, [that], it], works]]
or:
String s = "long and winding [pop11 list [with nested stuff] just to check [that] it] works";
LinkedList ll = new LinkedList();
parsePopList(s, ll);
System.out.println(ll);
will print: [long, and, winding, [pop11, list, [with, nested, stuff], just, to, check, [that], it], works]

Parameters:
poplist - The list to convert
list - A linked list that will contain the items of the String

main

public static void main(java.lang.String[] args)
The main program for the PopListUtils class

Parameters:
args - The command line arguments