@Test public void isTrashTest() { Folder folder; folder = new Folder(Folder.ROOT_FOLDER_ID); assertFalse(folder.isTrash()); folder = new Folder("a"); assertFalse(folder.isTrash()); folder = new Folder("a/b"); assertFalse(folder.isTrash()); folder = new Folder(Folder.TRASH_FOLDER_ID); assertTrue(folder.isTrash()); folder = new Folder(Folder.TRASH_FOLDER_ID + "/a"); assertTrue(folder.isTrash()); folder = new Folder(Folder.TRASH_FOLDER_ID + "/a/b"); assertTrue(folder.isTrash()); }
public boolean isTrash() { if (isRoot()) return false; return getId().split("/")[0].equals(TRASH_FOLDER_ID); }
Folder { public boolean isTrash() { if (isRoot()) return false; return getId().split("/")[0].equals(TRASH_FOLDER_ID); } }
Folder { public boolean isTrash() { if (isRoot()) return false; return getId().split("/")[0].equals(TRASH_FOLDER_ID); } Folder(String id); }
Folder { public boolean isTrash() { if (isRoot()) return false; return getId().split("/")[0].equals(TRASH_FOLDER_ID); } Folder(String id); String getId(); String getName(); String getParentFolderId(); static String normalizeFolderId(String id); void rename(String newId); void merge(Folder folder); void addFolderListener(FolderListener listener); void notifyRenamed(String oldFolderId); Folder getParent(); Map<String, Folder> getChildren(); void setParent(Folder parent); void addChild(Folder child); void removeChild(String folderId); void addNote(Note note); void addNotes(List<Note> newNotes); void removeNote(Note note); List<Note> getNotes(); List<Note> getNotesRecursively(); int countNotes(); boolean hasChild(); boolean isTrash(); }
Folder { public boolean isTrash() { if (isRoot()) return false; return getId().split("/")[0].equals(TRASH_FOLDER_ID); } Folder(String id); String getId(); String getName(); String getParentFolderId(); static String normalizeFolderId(String id); void rename(String newId); void merge(Folder folder); void addFolderListener(FolderListener listener); void notifyRenamed(String oldFolderId); Folder getParent(); Map<String, Folder> getChildren(); void setParent(Folder parent); void addChild(Folder child); void removeChild(String folderId); void addNote(Note note); void addNotes(List<Note> newNotes); void removeNote(Note note); List<Note> getNotes(); List<Note> getNotesRecursively(); int countNotes(); boolean hasChild(); boolean isTrash(); static final String ROOT_FOLDER_ID; static final String TRASH_FOLDER_ID; static final String TRASH_FOLDER_CONFLICT_INFIX; }