ItemNode root = ...; public ItemNode findNode(int value){ if(root !=null){ ItemNode temp = root; while(temp!=null){ if(temp.getID() == value) return temp; temp = temp.next; } } return null; }
public ItemNode findItem(){ int inputID; boolean found = false; ItemNode current = null; try{ System.out.print("\nGreetings, please enter the ID number for item:\n"); inputID = scannerObject.nextInt(); scannerObject.nextLine(); for (current = head; !found; current = current.getNext()){ if (current.getID() == inputID){ return current; // return the result when you find the node } } }catch(Exception e) { System.out.println("\nERROR!"); } return current; }
public void addContentNode(ContentNode node) { addNode(node); node.setParentID(getID()); node.setContentDirectory(getContentDirectory()); }
public void addContentNode(ContentNode node) { addNode(node); node.setParentID(getID()); node.setContentDirectory(getContentDirectory()); }
public static MediaItem create(ItemNode node){ MediaItem item = new MediaItem(); item.setStringid(node.getID()); item.setTitle(node.getTitle()); item.setObjectClass(node.getUPnPClass()); item.setDate(node.getDateTime()); item.setAlbum(node.getAlbum()); item.setAlbumUri(node.getAlbumArtURI()); item.setArtist(node.getArtist()); ResourceNode resourceNode = node.getFirstResource(); if (resourceNode != null){ item.setRes(resourceNode.getURL()); item.setprotocolInfo(resourceNode.getProtocolInfo()); item.setDuration(DlnaUtil.formatDurationString(resourceNode.getDuration())); item.setSize(DlnaUtil.formatSizeString(resourceNode.getSize())); } return item; } }