@Override protected Pair<BasicPlane, Integer> cleanPlane() { List<BasicBlock> cleanBlocks = getNewBlocksList(); Pair<Integer, BasicBlock> pickedToClean = pickBlockToClean(); int toMove = pickedToClean.getValue1().getValidCounter(); int active = getActiveBlockIndex(); BasicBlock activeBlock = cleanBlocks.get(active); for (BasicPage page : pickedToClean.getValue1().getPages()) { if (page.isValid()) { activeBlock = activeBlock.move(page.getLp()); } } if (!activeBlock.hasRoomForWrite()) { activeBlock = (BasicBlock) activeBlock.setStatus(BlockStatusGeneral.USED); } cleanBlocks.set(active, activeBlock); cleanBlocks.set(pickedToClean.getValue0(), (BasicBlock) pickedToClean.getValue1().eraseBlock()); Builder builder = getSelfBuilder(); builder.setBlocks(cleanBlocks); return new Pair<>(builder.build(), toMove); }
/** {@inheritDoc} */ @Override protected void processTemplate(FreenetRequest request, TemplateContext templateContext) throws RedirectException { super.processTemplate(request, templateContext); Set<OwnIdentity> ownIdentities = identityManager.getAllOwnIdentities(); List<OwnIdentity> enabledIdentities = new ArrayList<OwnIdentity>(); List<OwnIdentity> disabledIdentities = new ArrayList<OwnIdentity>(); for (OwnIdentity ownIdentity : ownIdentities) { if (ownIdentity.hasContext("WoTNS")) { enabledIdentities.add(ownIdentity); } else { disabledIdentities.add(ownIdentity); } } templateContext.set("enabledIdentities", enabledIdentities); templateContext.set("disabledIdentities", disabledIdentities); }