List of usage examples for java.util SortedMap containsKey
boolean containsKey(Object key);
From source file:at.illecker.hama.rootbeer.examples.matrixmultiplication.compositeinput.cpu.MatrixMultiplicationBSPCpu.java
@Override public void cleanup(BSPPeer<IntWritable, TupleWritable, IntWritable, VectorWritable, MatrixRowMessage> peer) throws IOException { // MasterTask accumulates result if (peer.getPeerName().equals(masterTask)) { // SortedMap because the final matrix rows should be in order SortedMap<Integer, Vector> accumlatedRows = new TreeMap<Integer, Vector>(); MatrixRowMessage currentMatrixRowMessage = null; // Collect messages while ((currentMatrixRowMessage = peer.getCurrentMessage()) != null) { int rowIndex = currentMatrixRowMessage.getRowIndex(); Vector rowValues = currentMatrixRowMessage.getRowValues().get(); if (isDebuggingEnabled) { logger.writeChars("bsp,gotMsg,key=" + rowIndex + ",value=" + rowValues.toString() + "\n"); }/*from w ww . j a v a2 s.co m*/ if (accumlatedRows.containsKey(rowIndex)) { accumlatedRows.get(rowIndex).assign(rowValues, Functions.PLUS); } else { accumlatedRows.put(rowIndex, new RandomAccessSparseVector(rowValues)); } } // Write accumulated results for (Map.Entry<Integer, Vector> row : accumlatedRows.entrySet()) { if (isDebuggingEnabled) { logger.writeChars( "bsp,write,key=" + row.getKey() + ",value=" + row.getValue().toString() + "\n"); } peer.write(new IntWritable(row.getKey()), new VectorWritable(row.getValue())); } } }
From source file:at.tuwien.ifs.somtoolbox.apps.viewer.controls.ClusteringControl.java
/** Makes sure all controls are displayed as needed. Currently deals with the {@link #kmeansInitialisationPanel} */ public void updateControlDisplay() { kmeansInitialisationPanel.setVisible(mapPane.getMap().getCurrentClusteringTree() != null && mapPane.getMap().getClusteringTreeBuilder() instanceof KMeansTreeBuilder); ClusteringTree clusteringTree = mapPane.getMap().getCurrentClusteringTree(); if (clusteringTree == null) return;/*from w w w. ja v a2 s .co m*/ Tree<ClusterNode, Integer> tree = clusteringTree.getJUNGTree(); TreeLayout<ClusterNode, Integer> layout = new TreeLayout<ClusterNode, Integer>(tree, 30, 100); final double maxMergeCost = clusteringTree.getMaxMergeCost(); final double minMergeCost = clusteringTree.getMinMergeCost(); final VisualizationViewer<ClusterNode, Integer> vv = new VisualizationViewer<ClusterNode, Integer>(layout); // setup edge rendering vv.getRenderContext().setEdgeShapeTransformer(new EdgeShape.Line<ClusterNode, Integer>()); vv.getRenderContext().setEdgeStrokeTransformer(new Transformer<Integer, Stroke>() { @Override public Stroke transform(Integer integer) { return new BasicStroke(1.0f); } }); vv.getRenderContext().setEdgeArrowPredicate( PredicateUtils.<Context<Graph<ClusterNode, Integer>, Integer>>falsePredicate()); vv.getRenderContext().setEdgeDrawPaintTransformer(new Transformer<Integer, Paint>() { @Override public Paint transform(Integer edge) { return Color.BLACK; } }); // setup vertex rendering vv.getRenderContext().setVertexLabelTransformer(new Transformer<ClusterNode, String>() { @Override public String transform(ClusterNode clusterNode) { Point2D.Double centroid = clusterNode.getCentroid(); return String.format("%d @ (%f, %f)", clusterNode.getNodes().length, centroid.getX(), centroid.getY()); } }); vv.getRenderContext().setVertexFillPaintTransformer(new Transformer<ClusterNode, Paint>() { @Override public Paint transform(ClusterNode clusterNode) { Palette palette = mapPane.getState().getSOMViewer().getCurrentlySelectedPalette(); double pos = clusterNode.getMergeCost() - minMergeCost; pos /= maxMergeCost - minMergeCost; pos *= palette.getNumberOfColours() - 1; return palette.getColor((int) pos); } }); vv.getRenderContext().setVertexStrokeTransformer(new Transformer<ClusterNode, Stroke>() { @Override public Stroke transform(ClusterNode clusterNode) { if (vv.getPickedVertexState().isPicked(clusterNode)) return new BasicStroke(3.0f); else return new BasicStroke(1.0f); } }); vv.setVertexToolTipTransformer(new Transformer<ClusterNode, String>() { @Override public String transform(ClusterNode clusterNode) { StringBuilder result = new StringBuilder(); result.append("Level: ").append(clusterNode.getLevel()).append("\r\n"); result.append("Merge-cost: ").append(String.format("%.2f", clusterNode.getMergeCost())) .append("\r\n"); result.append("Centroid: ").append(String.format("%.2f", clusterNode.getCentroid().getX())) .append(", ").append(String.format("%.2f", clusterNode.getCentroid().getY())) .append("\r\n"); result.append("Factor-value: ").append(String.format("%.2f", clusterNode.getFactorValue())) .append("\r\n"); result.append("#Nodes: ").append(clusterNode.getUnitNodes().length).append("\r\n"); result.append("Mean-vector: "); for (double d : clusterNode.getMeanVector()) result.append(String.format("%.2f", d)).append(", "); result.append("\r\n"); result.append("Bounds: (x=").append(String.format("%.2f", clusterNode.getX())).append(", y=") .append(String.format("%.2f", clusterNode.getY())).append(", w=") .append(String.format("%.2f", clusterNode.getWidth())).append(", h=") .append(String.format("%.2f", clusterNode.getHeight())).append(")\r\n"); return result.toString(); } }); GraphZoomScrollPane vv2 = new GraphZoomScrollPane(vv); vv2.setPreferredSize(new Dimension(dendogramPanel.getParent().getWidth(), 200)); vv2.setVisible(true); DefaultModalGraphMouse<ClusterNode, Integer> graphMouse = new DefaultModalGraphMouse<ClusterNode, Integer>(); vv.setGraphMouse(graphMouse); graphMouse.setMode(ModalGraphMouse.Mode.PICKING); vv.addGraphMouseListener(new GraphMouseListener<ClusterNode>() { private ClusterNode previouslySelected; @Override public void graphClicked(ClusterNode clusterNode, MouseEvent me) { if (previouslySelected != null) previouslySelected.setSelected(false); clusterNode.setSelected(true); previouslySelected = clusterNode; numClusters = clusterNode.getLevel(); SortedMap<Integer, ClusterElementsStorage> m = mapPane.getMap().getCurrentClusteringTree() .getAllClusteringElements(); if (m.containsKey(numClusters)) { st = m.get(numClusters).sticky; } else { st = false; } sticky.setSelected(st); redrawClustering(); } @Override public void graphPressed(ClusterNode clusterNode, MouseEvent me) { } @Override public void graphReleased(ClusterNode clusterNode, MouseEvent me) { } }); dendogramPanel.removeAll(); dendogramPanel.add(vv2); getContentPane().validate(); }
From source file:org.apache.felix.webconsole.internal.misc.ConfigurationRender.java
private final void addConfigurationPrinter(final SortedMap printers, final ConfigurationPrinter cfgPrinter, final Bundle provider, final Object labelProperty, final Object mode) { if (cfgPrinter != null) { final String title = getTitle(cfgPrinter.getTitle(), provider); String sortKey = title;//from w w w . jav a2s . co m if (printers.containsKey(sortKey)) { int idx = -1; String idxTitle; do { idx++; idxTitle = sortKey + idx; } while (printers.containsKey(idxTitle)); sortKey = idxTitle; } String label = (labelProperty instanceof String) ? (String) labelProperty : sortKey; printers.put(sortKey, new PrinterDesc(cfgPrinter, title, label, mode)); } }
From source file:tajo.master.GlobalPlanner.java
@VisibleForTesting public static Map<String, Map<ScanNode, List<URI>>> hashFetches(Map<ScanNode, List<URI>> uriMap) { SortedMap<String, Map<ScanNode, List<URI>>> hashed = new TreeMap<String, Map<ScanNode, List<URI>>>(); String uriPath, key;/*from w w w .j a va 2 s .c o m*/ Map<ScanNode, List<URI>> m = null; List<URI> uriList = null; for (Entry<ScanNode, List<URI>> e : uriMap.entrySet()) { for (URI uri : e.getValue()) { uriPath = uri.toString(); key = uriPath.substring(uriPath.lastIndexOf("=") + 1); if (hashed.containsKey(key)) { m = hashed.get(key); } else { m = new HashMap<ScanNode, List<URI>>(); } if (m.containsKey(e.getKey())) { uriList = m.get(e.getKey()); } else { uriList = new ArrayList<URI>(); } uriList.add(uri); m.put(e.getKey(), uriList); hashed.put(key, m); } } SortedMap<String, Map<ScanNode, List<URI>>> finalHashed = new TreeMap<String, Map<ScanNode, List<URI>>>(); for (Entry<String, Map<ScanNode, List<URI>>> entry : hashed.entrySet()) { finalHashed.put(entry.getKey(), combineURIByHostForBinary(entry.getValue())); } return finalHashed; }
From source file:org.lmnl.xml.XMLImportHandlerTest.java
@Test public void showTextContents() throws IOException { final String resource = "george-algabal-tei.xml"; //final String resource = "homer-iliad-tei.xml"; final Text source = source(resource); final Text document = document(resource); final int textLength = textRepository.length(document); assertTrue(textLength > 0);/*from w w w . ja va2s . co m*/ if (LOG.isDebugEnabled()) { final SortedMap<String, Annotation> annotations = Maps.newTreeMap(); for (Annotation annotation : annotationRepository.find(document)) { final Object data = annotation.getData(); if (data == null || !Map.class.isAssignableFrom(data.getClass())) { LOG.debug(annotation + " has no attributes"); continue; } @SuppressWarnings("unchecked") final Map<QName, String> attrs = (Map<QName, String>) data; final String nodePath = attrs.get(XMLParser.NODE_PATH_NAME); if (nodePath == null) { LOG.debug(annotation + " has no XML node path"); continue; } if (annotations.containsKey(nodePath)) { LOG.debug(nodePath + " already assigned to " + annotations.get(nodePath)); } annotations.put(nodePath, annotation); } for (Map.Entry<String, Annotation> annotation : annotations.entrySet()) { LOG.debug(annotation.getKey() + " ==> " + annotation.getValue()); } if (LOG.isDebugEnabled()) { textRepository.read(document, new TextContentReader() { public void read(Reader content, int contentLength) throws IOException { LOG.debug(CharStreams.toString(content)); } }); } final List<Range> textRanges = Lists.newArrayList(); final List<Range> sourceRanges = Lists.newArrayList(); for (Annotation offset : annotationRepository.find(document, OFFSET_DELTA_NAME)) { textRanges.add(offset.getRange()); sourceRanges.add((Range) offset.getData()); } final SortedMap<Range, String> texts = textRepository.bulkRead(document, Sets.newTreeSet(textRanges)); final SortedMap<Range, String> sources = textRepository.bulkRead(source, Sets.newTreeSet(sourceRanges)); final Iterator<Range> sourceRangesIt = sourceRanges.iterator(); for (Range textRange : textRanges) { if (!sourceRangesIt.hasNext()) { break; } final Range sourceRange = sourceRangesIt.next(); //LOG.debug(textRange + " ==> " + sourceRange); LOG.debug(texts.get(textRange) + " ==> " + sources.get(sourceRange)); } } }
From source file:net.sourceforge.fenixedu.presentationTier.Action.publico.ViewHomepageDA.java
public ActionForward listTeachers(ActionMapping mapping, ActionForm actionForm, HttpServletRequest request, HttpServletResponse response) throws Exception { final SortedMap<Unit, SortedSet<Homepage>> homepages = new TreeMap<Unit, SortedSet<Homepage>>( Unit.COMPARATOR_BY_NAME_AND_ID); for (final Teacher teacher : rootDomainObject.getTeachersSet()) { final Person person = teacher.getPerson(); final Employee employee = person.getEmployee(); if (employee != null) { final Contract contract = employee.getCurrentWorkingContract(); if (contract != null) { final Unit unit = contract.getWorkingUnit(); final SortedSet<Homepage> unitHomepages; if (homepages.containsKey(unit)) { unitHomepages = homepages.get(unit); } else { unitHomepages = new TreeSet<Homepage>(Homepage.HOMEPAGE_COMPARATOR_BY_NAME); homepages.put(unit, unitHomepages); }/* www . j av a 2 s .com*/ final Homepage homepage = person.getHomepage(); if (homepage != null && homepage.getActivated().booleanValue()) { unitHomepages.add(homepage); } } } } request.setAttribute("homepages", homepages); final String selectedPage = request.getParameter("selectedPage"); if (selectedPage != null) { request.setAttribute("selectedPage", selectedPage); } return mapping.findForward("list-homepages-teachers"); }
From source file:io.wcm.handler.url.suffix.SuffixBuilder.java
/** * Build complete suffix.//from ww w. ja v a 2 s.c om * @return the suffix */ public String build() { SortedMap<String, Object> sortedParameterMap = new TreeMap<>(parameterMap); // gather resource paths in a treeset (having them in a defined order helps with caching) SortedSet<String> resourcePathsSet = new TreeSet<>(); // iterate over all parts that should be kept from the current request for (String nextPart : initialSuffixParts) { // if this is a key-value-part: if (nextPart.indexOf(KEY_VALUE_DELIMITER) > 0) { String key = decodeKey(nextPart); // decode and keep the part if it is not overridden in the given parameter-map if (!sortedParameterMap.containsKey(key)) { String value = decodeValue(nextPart); sortedParameterMap.put(key, value); } } else { // decode and keep the resource paths (unless they are specified again in resourcePaths) String path = decodeResourcePathPart(nextPart); if (!resourcePaths.contains(path)) { resourcePathsSet.add(path); } } } // copy the resources specified as parameters to the sorted set of paths if (resourcePaths != null) { resourcePathsSet.addAll(ImmutableList.copyOf(resourcePaths)); } // gather all suffix parts in this list List<String> suffixParts = new ArrayList<>(); // now encode all resource paths for (String path : resourcePathsSet) { suffixParts.add(encodeResourcePathPart(path)); } // now encode all entries from the parameter map for (Entry<String, Object> entry : sortedParameterMap.entrySet()) { Object value = entry.getValue(); if (value == null) { // don't add suffix part if value is null continue; } String encodedKey = encodeKeyValuePart(entry.getKey()); String encodedValue = encodeKeyValuePart(value.toString()); suffixParts.add(encodedKey + KEY_VALUE_DELIMITER + encodedValue); } // finally join these parts to a single string return StringUtils.join(suffixParts, SUFFIX_PART_DELIMITER); }
From source file:de.micromata.genome.gwiki.umgmt.GWikiUserAuthorization.java
public void getUsersRights(GWikiContext wikiContext, SortedMap<String, GWikiRight> rights) { List<GWikiElementInfo> users = wikiContext.getElementFinder() .getPageInfos(new GWikiPageIdMatcher(wikiContext, new StartWithMatcher<String>("admin/user/"))); for (GWikiElementInfo el : users) { GWikiSimpleUser user = findUser(wikiContext, FileNameUtils.getNamePart(el.getId())); String rules = user.getRightsMatcherRule(); List<String> roles = getRoleListFromUserRoleString(rules); for (String r : roles) { if (rights.containsKey(r) == false) { rights.put(r, new GWikiRight(r, GWikiRight.RIGHT_CAT_OTHER_RIGHT, "")); }//ww w . ja v a 2 s. c o m } } }
From source file:de.tudarmstadt.ukp.experiments.argumentation.sequence.feature.coreference.CoreferenceFeatures.java
@Override protected List<Feature> extract(JCas jCas, Sentence sentence, String sentencePrefix) throws TextClassificationException { List<List<CoreferenceLink>> coreferenceChains = extractCoreferenceChains(jCas); FrequencyDistribution<String> featuresAcrossAllChains = new FrequencyDistribution<>(); DescriptiveStatistics chainLength = new DescriptiveStatistics(); DescriptiveStatistics distanceToPreviousSentence = new DescriptiveStatistics(); DescriptiveStatistics distanceToNextSentence = new DescriptiveStatistics(); DescriptiveStatistics interSentencesCorLinks = new DescriptiveStatistics(); for (List<CoreferenceLink> chain : coreferenceChains) { SortedMap<Integer, List<CoreferenceLink>> sentencesAndLinks = extractSentencesAndLinksFromChain(chain, jCas);//from w w w. j a va 2 s .c o m int currentSentencePos = getCurrentSentencePos(jCas, sentence); log.debug(sentencesAndLinks.keySet() + ", current " + currentSentencePos); // is the sentence in chain that spans more sentences? boolean partOfChain = sentencesAndLinks.containsKey(currentSentencePos) && sentencesAndLinks.size() > 1; // is part of a chain? if (partOfChain) { log.debug(chainToString(chain)); featuresAcrossAllChains.inc(FN_PART_OF_CHAIN); // starts the chain? if (sentencesAndLinks.firstKey().equals(currentSentencePos)) { featuresAcrossAllChains.inc(FN_STARTS_THE_CHAIN); } else if (sentencesAndLinks.lastKey().equals(currentSentencePos)) { // ends the chain? featuresAcrossAllChains.inc(FN_ENDS_THE_CHAIN); } else { // in the middle of chain? featuresAcrossAllChains.inc(FN_IN_THE_MIDDLE_OF_CHAIN); } // length of the chain chainLength.addValue(sentencesAndLinks.size()); List<CoreferenceLink> currentSentenceLinks = sentencesAndLinks.get(currentSentencePos); CoreferenceLink currentSentenceFirstLink = currentSentenceLinks.get(0); CoreferenceLink currentSentenceLastLink = currentSentenceLinks.get(currentSentenceLinks.size() - 1); // transition to the previous link, i.e. NOMINAL -> PRONOMINAL if (!sentencesAndLinks.firstKey().equals(currentSentencePos)) { // find the previous sentence List<CoreferenceLink> previousSentenceLinks = null; int prevSentNo = currentSentencePos; while (previousSentenceLinks == null && prevSentNo >= 0) { prevSentNo--; if (sentencesAndLinks.containsKey(prevSentNo)) { previousSentenceLinks = sentencesAndLinks.get(prevSentNo); } } if (previousSentenceLinks == null) { throw new IllegalStateException("Oops :))"); } // distance to previous sentence distanceToPreviousSentence.addValue(currentSentencePos - prevSentNo); // get the last link from the previous sentence CoreferenceLink prevSentenceLastLink = previousSentenceLinks .get(previousSentenceLinks.size() - 1); // add type type transition String prevSentenceLastLinkReferenceType = prevSentenceLastLink.getReferenceType(); String currentSentenceFirstLinkReferenceType = currentSentenceFirstLink.getReferenceType(); String transitionType = prevSentenceLastLinkReferenceType + GLUE + currentSentenceFirstLinkReferenceType; featuresAcrossAllChains.addSample(FN_TRANSITION_IN_TYPE_TYPE + transitionType, 1); // add token - type transition String glueCoreferenceCurrentSentence = glueCoreferenceLinkTokens(currentSentenceFirstLink); String typeToken = prevSentenceLastLinkReferenceType + GLUE + glueCoreferenceCurrentSentence; featuresAcrossAllChains.addSample(FN_TRANSITION_IN_TYPE_TOKEN + typeToken, 1); // add type - token transition String glueCoreferencePrevSentence = glueCoreferenceLinkTokens(prevSentenceLastLink); String tokenType = glueCoreferencePrevSentence + GLUE + currentSentenceFirstLinkReferenceType; featuresAcrossAllChains.addSample(FN_TRANSITION_IN_TOKEN_TYPE + tokenType, 1); // add token token transition String tokenToken = glueCoreferencePrevSentence + GLUE + glueCoreferenceCurrentSentence; featuresAcrossAllChains.addSample(FN_TRANSITION_IN_TOKEN_TOKEN + tokenToken, 1); // exact matching token-token reference? if (glueCoreferencePrevSentence.equals(glueCoreferenceCurrentSentence)) { featuresAcrossAllChains.addSample(FN_TRANSITION_IN_TOKEN_TOKEN_MATCH, 1); } } // transition to the previous link, i.e. NOMINAL -> PRONOMINAL if (!sentencesAndLinks.lastKey().equals(currentSentencePos)) { // find the previous sentence List<CoreferenceLink> nextSentenceLinks = null; int nextSentNo = currentSentencePos; while (nextSentenceLinks == null && nextSentNo <= sentencesAndLinks.lastKey()) { nextSentNo++; if (sentencesAndLinks.containsKey(nextSentNo)) { nextSentenceLinks = sentencesAndLinks.get(nextSentNo); } } if (nextSentenceLinks == null) { throw new IllegalStateException("Oops :))"); } // distance to next sentence distanceToNextSentence.addValue(nextSentNo - currentSentencePos); // get the last link from the previous sentence CoreferenceLink nextSentenceFirstLink = nextSentenceLinks.get(0); // add type type transition String currentSentenceLastLinkReferenceType = currentSentenceLastLink.getReferenceType(); String nextSentenceFirstLinkReferenceType = nextSentenceFirstLink.getReferenceType(); String transitionType = currentSentenceLastLinkReferenceType + GLUE + nextSentenceFirstLinkReferenceType; featuresAcrossAllChains.addSample(FN_TRANSITION_OUT_TYPE_TYPE + transitionType, 1); // add token - type transition String glueCoreferenceCurrentSent = glueCoreferenceLinkTokens(currentSentenceLastLink); String typeToken = glueCoreferenceCurrentSent + GLUE + nextSentenceFirstLinkReferenceType; featuresAcrossAllChains.addSample(FN_TRANSITION_OUT_TOKEN_TYPE + typeToken, 1); // add type - token transition String glueCoreferenceNextSent = glueCoreferenceLinkTokens(nextSentenceFirstLink); String tokenType = currentSentenceLastLinkReferenceType + GLUE + glueCoreferenceNextSent; featuresAcrossAllChains.addSample(FN_TRANSITION_OUT_TYPE_TOKEN + tokenType, 1); // add token token transition String tokenToken = glueCoreferenceCurrentSent + GLUE + glueCoreferenceNextSent; featuresAcrossAllChains.addSample(FN_TRANSITION_OUT_TOKEN_TOKEN + tokenToken, 1); // exact matching token-token reference? if (glueCoreferenceNextSent.equals(glueCoreferenceCurrentSent)) { featuresAcrossAllChains.addSample(FN_TRANSITION_OUT_TOKEN_TOKEN_MATCH, 1); } } } // number of inter-sentence coreference links if (sentencesAndLinks.containsKey(currentSentencePos)) { int coreferenceLinks = sentencesAndLinks.get(currentSentencePos).size(); interSentencesCorLinks.addValue(coreferenceLinks); } /* List<Integer> positions = positionsOfSentenceInCurrentChain(chain, sentence); // ok, we're in a chain if (!positions.isEmpty()) { log.debug(printChain(chain)); log.debug(sentence.getCoveredText()); log.debug(positions); Integer lastPosition = positions.get(positions.size() - 1); Integer firstPosition = positions.get(0); if (lastPosition == positions.size() - 1) { log.debug("Last sentence of chain"); } log.debug("-----"); } */ } List<Feature> result = new ArrayList<>(); log.debug(featuresAcrossAllChains); if (distanceToNextSentence.getN() > 0) { log.debug("Next:" + distanceToNextSentence); result.add(new Feature(sentencePrefix + FEATURE_NAME + FN_DIST_TO_NEXT_MIN, distanceToNextSentence.getMin())); result.add(new Feature(sentencePrefix + FEATURE_NAME + FN_DIST_TO_NEXT_MAX, distanceToNextSentence.getMax())); result.add(new Feature(sentencePrefix + FEATURE_NAME + FN_DIST_TO_NEXT_AVG, distanceToNextSentence.getMean())); } if (distanceToPreviousSentence.getN() > 0) { log.debug("Prev: " + distanceToPreviousSentence); result.add(new Feature(sentencePrefix + FEATURE_NAME + FN_DIST_TO_PREV_MIN, distanceToPreviousSentence.getMin())); result.add(new Feature(sentencePrefix + FEATURE_NAME + FN_DIST_TO_PREV_MAX, distanceToPreviousSentence.getMax())); result.add(new Feature(sentencePrefix + FEATURE_NAME + FN_DIST_TO_PREV_AVG, distanceToPreviousSentence.getMean())); } if (interSentencesCorLinks.getN() > 0) { result.add(new Feature(sentencePrefix + FEATURE_NAME + FN_INTER_SENT_COR_MIN, interSentencesCorLinks.getMin())); result.add(new Feature(sentencePrefix + FEATURE_NAME + FN_INTER_SENT_COR_MAX, interSentencesCorLinks.getMax())); result.add(new Feature(sentencePrefix + FEATURE_NAME + FN_INTER_SENT_COR_AVG, interSentencesCorLinks.getMean())); } log.debug("----"); for (String feat : featuresAcrossAllChains.getKeys()) { // binary result.add(new Feature(sentencePrefix + FEATURE_NAME + feat, 1)); } return result; }
From source file:net.sourceforge.fenixedu.presentationTier.Action.publico.ViewHomepageDA.java
public ActionForward listEmployees(ActionMapping mapping, ActionForm actionForm, HttpServletRequest request, HttpServletResponse response) throws Exception { final SortedMap<Unit, SortedSet<Homepage>> homepages = new TreeMap<Unit, SortedSet<Homepage>>( Unit.COMPARATOR_BY_NAME_AND_ID); for (final Employee employee : rootDomainObject.getEmployeesSet()) { final Person person = employee.getPerson(); if (person != null) { final Teacher teacher = person.getTeacher(); if (teacher == null) { final Contract contract = employee.getCurrentWorkingContract(); if (contract != null) { final Unit unit = contract.getWorkingUnit(); final SortedSet<Homepage> unitHomepages; if (homepages.containsKey(unit)) { unitHomepages = homepages.get(unit); } else { unitHomepages = new TreeSet<Homepage>(Homepage.HOMEPAGE_COMPARATOR_BY_NAME); homepages.put(unit, unitHomepages); }// w ww . j a v a2 s . c om final Homepage homepage = person.getHomepage(); if (homepage != null && homepage.getActivated().booleanValue()) { unitHomepages.add(homepage); } } } } } request.setAttribute("homepages", homepages); final String selectedPage = request.getParameter("selectedPage"); if (selectedPage != null) { request.setAttribute("selectedPage", selectedPage); } return mapping.findForward("list-homepages-employees"); }