1 2 3 4 5 6 7 | public ForumFactoryProxy(ForumFactory factory, Authorization authorization, ForumPermissions permissions) { this.factory = factory; this.authorization = authorization; this.permissions = permissions; } |
1 2 3 4 5 6 7 8 9 10 11 | public Forum createForum(String name, String description) throws UnauthorizedException, ForumAlreadyExistsException { if (permissions.get(ForumPermissions.SYSTEM_ADMIN)) { Forum newForum = factory.createForum(name, description); return new ForumProxy(newForum, authorization, permissions); } else { throw new UnauthorizedException(); } } |
1 2 3 4 5 6 | public static ForumFactory getInstance(Authorization authorization) { ...... ForumFactoryProxy proxy = new ForumFactoryProxy(factory,authorization, factory.getPermissions(authorization)); return proxy; } |
1 2 3 | public String getBody() { return highlightCode(message.getBody()); } |
1 2 3 4 5 6 7 | public ForumMessage applyFilters(ForumMessage message) { //Loop through filters and apply them for (int i=0; i < filters.length; i++) { message = filters.clone(message); } return message; } |
1 2 3 4 5 6 | public boolean hasNext() { if (currentIndex+1 >= messages.length) { return false; } return true; } |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | public Object next() throws java.util.NoSuchElementException { ForumMessage message = null; if (nextMessage != null) { message = nextMessage; nextMessage = null; } else { message = getNextMessage(); if (message == null) { throw new java.util.NoSuchElementException(); } } return message; } |
1 2 3 4 5 6 7 | public interface TreeWalker { public ForumMessage getRoot(); public ForumMessage getChild(ForumMessage parent, int index); public int getChildCount(ForumMessage parent); public int getRecursiveChildCount(ForumMessage parent); public int getIndexOfChild(ForumMessage parent, ForumMessage child); public boolean isLeaf(ForumMessage node); |
欢迎光临 电子技术论坛_中国专业的电子工程师学习交流社区-中电网技术论坛 (http://bbs.eccn.com/) | Powered by Discuz! 7.0.0 |