List of usage examples for org.apache.commons.collections.functors TruePredicate getInstance
public static Predicate getInstance()
From source file:com.moteiv.trawler.Trawler.java
private void processEvent(AbstractButton source) { if (source == vLog) { if (source.isSelected()) { JFileChooser jfc = new JFileChooser(); File logFile;/* ww w . j a v a 2s .c o m*/ int retval; retval = jfc.showSaveDialog(null); if (retval == JFileChooser.APPROVE_OPTION) { mif.setLogFile(jfc.getSelectedFile()); } else { vLog.setSelected(false); } } else { mif.setLogFile(null); } } else if (source == vLabels) { if (source.isSelected()) { pr.setVertexStringer(m_vs); } else { pr.setVertexStringer(new ConstantVertexStringer(null)); } } else if (source == vBlink) { if (source.isSelected()) { pr.setVertexColorFunction(new myVertexColorFunction(Color.RED.darker().darker(), Color.RED, 500)); ; } else { pr.setVertexPaintFunction( new PickableVertexPaintFunction(pr, Color.BLACK, Color.RED, Color.ORANGE)); } } else if (source == vSave) { if (source.isSelected()) { } else { } } else if (source == eLabels) { if (source.isSelected()) { pr.setEdgeStringer(m_es); } else { pr.setEdgeStringer(new ConstantEdgeStringer(null)); } } else if (source == eFilter) { if (source.isSelected()) { pr.setEdgeIncludePredicate(TruePredicate.getInstance()); } else { pr.setEdgeIncludePredicate(new myEdgeFilter()); } } else if (source == graphReset) { GraphIO.resetPrefs(g, layout, mif, Trawler.NODEFILE); } savePrefs(); }
From source file:org.jasig.cas.CentralAuthenticationServiceImplWithMokitoTests.java
@Test public void getTicketsWithNoPredicate() { final Collection<Ticket> c = this.cas.getTickets(TruePredicate.getInstance()); assertEquals(c.size(), this.ticketRegMock.getTickets().size()); }
From source file:org.jasig.cas.web.StatisticsController.java
@Override protected ModelAndView handleRequestInternal(final HttpServletRequest httpServletRequest, final HttpServletResponse httpServletResponse) throws Exception { final ModelAndView modelAndView = new ModelAndView(new InternalResourceView(viewPath)); modelAndView.addObject("startTime", this.upTimeStartDate); final double difference = System.currentTimeMillis() - this.upTimeStartDate.getTime(); modelAndView/*from ww w .j av a2s. c o m*/ .addObject("upTime", calculateUptime(difference, new LinkedList<Integer>(Arrays.asList(NUMBER_OF_MILLISECONDS_IN_A_DAY, NUMBER_OF_MILLISECONDS_IN_AN_HOUR, NUMBER_OF_MILLISECONDS_IN_A_MINUTE, NUMBER_OF_MILLISECONDS_IN_A_SECOND, 1)), new LinkedList<String>( Arrays.asList("day", "hour", "minute", "second", "millisecond")))); modelAndView.addObject("totalMemory", convertToMegaBytes(Runtime.getRuntime().totalMemory())); modelAndView.addObject("maxMemory", convertToMegaBytes(Runtime.getRuntime().maxMemory())); modelAndView.addObject("freeMemory", convertToMegaBytes(Runtime.getRuntime().freeMemory())); modelAndView.addObject("availableProcessors", Runtime.getRuntime().availableProcessors()); modelAndView.addObject("serverHostName", httpServletRequest.getServerName()); modelAndView.addObject("serverIpAddress", httpServletRequest.getLocalAddr()); modelAndView.addObject("casTicketSuffix", this.casTicketSuffix); int unexpiredTgts = 0; int unexpiredSts = 0; int expiredTgts = 0; int expiredSts = 0; try { final Collection<Ticket> tickets = this.centralAuthenticationService .getTickets(TruePredicate.getInstance()); for (final Ticket ticket : tickets) { if (ticket instanceof ServiceTicket) { if (ticket.isExpired()) { expiredSts++; } else { unexpiredSts++; } } else { if (ticket.isExpired()) { expiredTgts++; } else { unexpiredTgts++; } } } } catch (final UnsupportedOperationException e) { logger.trace("The ticket registry doesn't support this information."); } final Collection<GraphingStatisticsAppender> appenders = GraphingStatisticsAppender .getAllGraphingStatisticsAppenders(); modelAndView.addObject("unexpiredTgts", unexpiredTgts); modelAndView.addObject("unexpiredSts", unexpiredSts); modelAndView.addObject("expiredTgts", expiredTgts); modelAndView.addObject("expiredSts", expiredSts); modelAndView.addObject("pageTitle", modelAndView.getViewName()); modelAndView.addObject("graphingStatisticAppenders", appenders); return modelAndView; }