diff options
author | Matt Windsor <mattwindsor@btinternet.com> | 2011-03-19 17:25:07 +0000 |
---|---|---|
committer | Matt Windsor <mattwindsor@btinternet.com> | 2011-03-19 17:25:07 +0000 |
commit | 8f0360d9e72843d527b2db28047ae5f0498f3a3e (patch) | |
tree | 3ceb39d46aae2b913c1999e636cd282d93622b5c /src/uk/org/ury/library/LibraryUtils.java | |
parent | 410219d08abdb859315c4d6d0e0375287d64a88b (diff) |
Library viewer now retrieves tracks from server. Code will need a LOT of cleanup, but this is a triumph. I'm making a note here-- huge success.
Diffstat (limited to 'src/uk/org/ury/library/LibraryUtils.java')
-rw-r--r-- | src/uk/org/ury/library/LibraryUtils.java | 98 |
1 files changed, 0 insertions, 98 deletions
diff --git a/src/uk/org/ury/library/LibraryUtils.java b/src/uk/org/ury/library/LibraryUtils.java index 474c58a..9b4471a 100644 --- a/src/uk/org/ury/library/LibraryUtils.java +++ b/src/uk/org/ury/library/LibraryUtils.java @@ -141,102 +141,4 @@ public class LibraryUtils return new LibraryItem (properties); } - - - /** - * Construct items from a server response body. - * - * @param response The list of strings that constitute the response. - * - * @return a list of LibraryItems corresponding to the item - * stanzas in the response. - */ - -/* public static List<LibraryItem> - extractItemsFromResponse (List<String> response) - { - List<LibraryItem> result = new ArrayList<LibraryItem> (); - - boolean inItem = false; - List<String> itemBuffer = new ArrayList<String> (); - - for (String line : response) - { - if (inItem == false) - { - if (line.startsWith (Directive.ITEM_START.toString ())) - { - inItem = true; - itemBuffer.clear (); - } - } - - if (inItem == true) - { - itemBuffer.add (line); - - if (line.startsWith (Directive.ITEM_END.toString ())) - { - inItem = false; - result.add (createItemFromResponse (itemBuffer)); - } - } - } - - return result; - }*/ - - - /** - * Construct a new item from a server response fragment. - * - * @param response The list of strings that constitutes the response. - * The list must begin with Directive.ITEM_START and - * end with Directive.ITEM_END's string - * representations and otherwise contain solely - * Directive.ITEM_PROPERTY lines. - * - * @return a LibraryItem embodying the properties described - * in the response fragment. - * - * @throws IllegalArgumentException if the response is - * malformed or null, or if the instantiation of - * DatabaseItem does not use String as its data type. - */ - - /*public static LibraryItem - createItemFromResponse (List<String> response) - { - // TODO: More appropriate exceptions. - - if (response == null) - throw new IllegalArgumentException ("Response is null."); - else if (response.get (0).equals (Directive.ITEM_START.toString ()) - && response.get (response.size () - 1) - .equals (Directive.ITEM_END.toString ())) - { - // Response of size 2 must be blank. - if (response.size () <= 2) - throw new IllegalArgumentException ("Blank response."); - - Map<LibraryItemProperty, String> properties = new HashMap<LibraryItemProperty, String> (); - - for (int i = 0; i < response.size () - 1; i++) - { - // TODO: fan out impl. details to separate class - if (response.get (i) - .startsWith (Directive.ITEM_PROPERTY.toString ())) - { - String[] responseTuple = response.get (i).split (":="); - - properties.put (LibraryItemProperty.getFromSQL (responseTuple[1]), - responseTuple[2]); - } - } - - return new LibraryItem (properties); - } - else - throw new IllegalArgumentException ("Malformed response."); - }*/ } |