List of usage examples for java.util ArrayList contains
public boolean contains(Object o)
From source file:com.meetingninja.csse.MainActivity.java
@Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { super.onActivityResult(requestCode, resultCode, data); if (requestCode == 3) frag_notes.populateList();//from ww w.j av a 2 s . c o m if (requestCode == VOICE_RECOGNITION_REQUEST_CODE && resultCode == RESULT_OK) { ArrayList<String> thingsYouSaid = data.getStringArrayListExtra(RecognizerIntent.EXTRA_RESULTS); if (thingsYouSaid.contains("meetings")) { selectItem(DrawerLabel.MEETINGS.getPosition()); } else if (thingsYouSaid.contains("groups")) { selectItem(DrawerLabel.GROUPS.getPosition()); } else if (thingsYouSaid.contains("notes")) { selectItem(DrawerLabel.NOTES.getPosition()); } else if (thingsYouSaid.contains("profile")) { selectItem(DrawerLabel.PROFILE.getPosition()); } else if (thingsYouSaid.contains("tasks")) { selectItem(DrawerLabel.TASKS.getPosition()); } else if (thingsYouSaid.contains("projects")) { selectItem(DrawerLabel.PROJECTS.getPosition()); } else if (thingsYouSaid.contains("contacts")) { selectItem(DrawerLabel.CONTACTS.getPosition()); } } }
From source file:com.amalto.workbench.actions.XSDDeleteConceptWrapAction.java
/** * Author: Fliu this fun is to populate all offsprings for a specific object *///w w w .j av a2s . co m private Object[] populateAllOffspring(Object obj, ArrayList offspringList) { SchemaTreeContentProvider provider = (SchemaTreeContentProvider) viewer.getContentProvider(); Object[] offersprings = provider.getChildren(obj); for (Object subObj : offersprings) { if (!offspringList.contains(subObj)) { offspringList.add(subObj); if (provider.hasChildren(subObj)) { populateAllOffspring(subObj, offspringList); } } else { continue; } } return offspringList.toArray(); }
From source file:com.yahoo.athenz.zts.store.impl.S3ChangeLogStoreTest.java
@Test public void testListObjectsAllObjectsMultiplePages() { MockS3ChangeLogStore store = new MockS3ChangeLogStore(null); ArrayList<S3ObjectSummary> objectList1 = new ArrayList<>(); S3ObjectSummary objectSummary = new S3ObjectSummary(); objectSummary.setKey("iaas"); objectList1.add(objectSummary);/* w ww .java 2 s .co m*/ objectSummary = new S3ObjectSummary(); objectSummary.setKey("iaas.athenz"); objectList1.add(objectSummary); ArrayList<S3ObjectSummary> objectList2 = new ArrayList<>(); objectSummary = new S3ObjectSummary(); objectSummary.setKey("cd"); objectList2.add(objectSummary); objectSummary = new S3ObjectSummary(); objectSummary.setKey("cd.docker"); objectList2.add(objectSummary); ArrayList<S3ObjectSummary> objectList3 = new ArrayList<>(); objectSummary = new S3ObjectSummary(); objectSummary.setKey("platforms"); objectList3.add(objectSummary); objectSummary = new S3ObjectSummary(); objectSummary.setKey("platforms.mh2"); objectList3.add(objectSummary); ObjectListing objectListing = mock(ObjectListing.class); when(objectListing.getObjectSummaries()).thenReturn(objectList1).thenReturn(objectList2) .thenReturn(objectList3); when(objectListing.isTruncated()).thenReturn(true).thenReturn(true).thenReturn(false); when(store.s3.listObjects(any(ListObjectsRequest.class))).thenReturn(objectListing); when(store.s3.listNextBatchOfObjects(any(ObjectListing.class))).thenReturn(objectListing); ArrayList<String> domains = new ArrayList<>(); store.listObjects(store.s3, domains, 0); assertEquals(domains.size(), 6); assertTrue(domains.contains("iaas")); assertTrue(domains.contains("iaas.athenz")); assertTrue(domains.contains("cd")); assertTrue(domains.contains("cd.docker")); assertTrue(domains.contains("platforms")); assertTrue(domains.contains("platforms.mh2")); }
From source file:com.clustercontrol.monitor.run.factory.SelectMonitor.java
/** * ????????//from w w w . j a va2s. co m * @param condition * @return * @throws HinemosUnknown * @throws InvalidRole * @throws MonitorNotFound */ public ArrayList<MonitorInfo> getMonitorList(MonitorFilterInfo condition) throws HinemosUnknown, InvalidRole, MonitorNotFound { m_log.debug("getMonitorList() condition "); if (m_log.isDebugEnabled()) { if (condition != null) { m_log.debug("getMonitorList() " + "monitorId = " + condition.getMonitorId() + ", monitorTypeId = " + condition.getMonitorTypeId() + ", description = " + condition.getDescription() + ", facilityId = " + condition.getFacilityId() + ", calendarId = " + condition.getCalendarId() + ", regUser = " + condition.getRegUser() + ", regFromDate = " + condition.getRegFromDate() + ", regToDate = " + condition.getRegToDate() + ", updateUser = " + condition.getUpdateUser() + ", updateFromDate = " + condition.getUpdateFromDate() + ", updateToDate = " + condition.getUpdateToDate() + ", monitorFlg = " + condition.getMonitorFlg() + ", collectorFlg = " + condition.getCollectorFlg() + ", ownerRoleId = " + condition.getOwnerRoleId()); } } ArrayList<MonitorInfo> filterList = new ArrayList<MonitorInfo>(); // ??????? if (condition == null) { m_log.debug("getMonitorList() condition is null"); return filterList; } // facilityId???? List<MonitorInfo> entityList = QueryUtil.getMonitorInfoByFilter(condition.getMonitorId(), condition.getMonitorTypeId(), condition.getDescription(), condition.getCalendarId(), condition.getRegUser(), condition.getRegFromDate(), condition.getRegToDate(), condition.getUpdateUser(), condition.getUpdateFromDate(), condition.getUpdateToDate(), condition.getMonitorFlg(), condition.getCollectorFlg(), condition.getOwnerRoleId()); // facilityId??Java?? for (MonitorInfo entity : entityList) { // facilityId if (condition.getFacilityId() != null && !"".equals(condition.getFacilityId()) && entity.getFacilityId() != null) { // FacilitySelector.getNodeFacilityIdList???????????????if if (!ReservedFacilityIdConstant.ROOT_SCOPE.equals(entity.getFacilityId())) { ArrayList<String> searchIdList = FacilitySelector.getNodeFacilityIdList(entity.getFacilityId(), entity.getOwnerRoleId(), RepositoryControllerBean.ALL, false, true); if (!searchIdList.contains(condition.getFacilityId())) { m_log.debug("getMonitorList() continue : collectorFlg target = " + entity.getFacilityId() + ", filter = " + condition.getFacilityId()); continue; } } } m_log.debug("getMonitorList() add display list : target = " + entity.getMonitorId()); filterList.add(entity); } return filterList; }
From source file:com.yahoo.athenz.zts.store.impl.S3ChangeLogStoreTest.java
@Test public void testListObjectsAllObjectsNoPageModTime() { MockS3ChangeLogStore store = new MockS3ChangeLogStore(null); ArrayList<S3ObjectSummary> objectList = new ArrayList<>(); S3ObjectSummary objectSummary = new S3ObjectSummary(); objectSummary.setKey("iaas"); objectSummary.setLastModified(new Date(100)); objectList.add(objectSummary);//w w w .j a v a 2 s . c om objectSummary = new S3ObjectSummary(); objectSummary.setKey("iaas.athenz"); objectSummary.setLastModified(new Date(200)); objectList.add(objectSummary); ObjectListing objectListing = mock(ObjectListing.class); when(objectListing.getObjectSummaries()).thenReturn(objectList); when(objectListing.isTruncated()).thenReturn(false); when(store.s3.listObjects(any(ListObjectsRequest.class))).thenReturn(objectListing); ArrayList<String> domains = new ArrayList<>(); store.listObjects(store.s3, domains, (new Date(150)).getTime()); assertEquals(domains.size(), 1); assertTrue(domains.contains("iaas.athenz")); }
From source file:ee.ioc.cs.vsle.ccl.PackageClassLoader.java
private void initNameEnvironment() { ArrayList<String> fileNames = new ArrayList<String>(); for (URL u : getURLs()) { try {//from w ww . j a v a 2s. c om fileNames.add(new File(u.toURI()).getAbsolutePath()); } catch (URISyntaxException e) { logger.error(null, e); } } for (String s : getCompilerClassPath()) { if (!fileNames.contains(s)) { fileNames.add(s); } } environment = new FileSystem(fileNames.toArray(new String[fileNames.size()]), new String[] {}, null); }
From source file:module.siadap.presentationTier.actions.SiadapProcessCountAction.java
@EntryPoint public ActionForward showUnit(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { SiadapYearWrapper siadapYearWrapper = (SiadapYearWrapper) getRenderedObject("siadapYearWrapper"); if (siadapYearWrapper == null) { //let's try to get the year through the parameter String yearString = getAttribute(request, "year"); if (yearString == null) { ArrayList<Integer> yearsWithConfigs = SiadapYearsFromExistingSiadapConfigurations .getYearsWithExistingConfigs(); if (yearsWithConfigs.contains(new Integer(new LocalDate().getYear()))) { int year = new LocalDate().getYear(); siadapYearWrapper = new SiadapYearWrapper(year); } else { siadapYearWrapper = new SiadapYearWrapper(yearsWithConfigs.get(yearsWithConfigs.size() - 1)); }/*from ww w .ja v a2s.co m*/ } else { siadapYearWrapper = new SiadapYearWrapper(Integer.parseInt(yearString)); } } request.setAttribute("siadapYearWrapper", siadapYearWrapper); SiadapYearConfiguration configuration = siadapYearWrapper.getSiadapYearConfiguration(); if (configuration == null) { return forward("/module/siadap/unit.jsp"); } request.setAttribute("configuration", configuration); SiadapProcessStateEnumWrapper siadapProcessStateToFilter = (SiadapProcessStateEnumWrapper) getRenderedObject( "siadapProcessStateToFilter"); if (siadapProcessStateToFilter == null) { String enumAsParam = request.getParameter("siadapProcessStateEnumToFilterOrdinal"); SiadapProcessStateEnum enumToUse = SiadapStateToShowInCount.getDefaultStateToFilter(); if (!StringUtils.isBlank(enumAsParam)) { enumToUse = SiadapProcessStateEnum.valueOf(enumAsParam); } siadapProcessStateToFilter = new SiadapProcessStateEnumWrapper(enumToUse); } request.setAttribute("siadapProcessStateToFilter", siadapProcessStateToFilter); Unit unit = (Unit) getDomainObject(request, "unitId"); if (unit == null) { unit = configuration.getSiadapStructureTopUnit(); //and let's also get the total number of SIADAPs for this year int siadapsCount = SiadapYearConfiguration.getSiadapYearConfiguration(siadapYearWrapper.getChosenYear()) .getSiadapsSet().size(); int siadapsDefinitiveCount = 0; Map<SiadapProcessStateEnum, Integer> stateCount = new HashMap<SiadapProcessStateEnum, Integer>(); for (Siadap siadap : SiadapRootModule.getInstance().getSiadaps()) { if (siadap.getYear().equals(siadapYearWrapper.getChosenYear())) { siadapsDefinitiveCount++; //let's put them on an HashMap by state TODO use Guave to do this SiadapProcessStateEnum state = siadap.getState(); Integer integer = stateCount.get(state); if (integer == null) { integer = 0; } integer++; stateCount.put(state, integer); } } request.setAttribute("totalDefinitiveCount", stateCount); request.setAttribute("siadapsCount", siadapsCount); request.setAttribute("siadapsDefinitiveCount", siadapsDefinitiveCount); } final Collection<Party> parents = UnitSiadapWrapper.UnitTransverseUtil.getActiveParents(unit, configuration); final Collection<Party> children = UnitSiadapWrapper.UnitTransverseUtil.getActiveChildren(unit, configuration); OrganizationChart<Party> chart = new OrganizationChart<Party>(unit, parents, children, 3); request.setAttribute("chart", chart); final Collection<Accountability> workerAccountabilities = UnitSiadapWrapper.UnitTransverseUtil .getActiveChildrenWorkers(unit, configuration); request.setAttribute("workerAccountabilities", workerAccountabilities); UnitSiadapWrapper unitSiadapWrapper = new UnitSiadapWrapper(unit, configuration.getYear()); final Person unitResponsible = unitSiadapWrapper.getEvaluationResponsible(); request.setAttribute("unitResponsible", unitResponsible); final Collection<Person> unitHarmonizers = new TreeSet<Person>(Party.COMPARATOR_BY_NAME); UnitSiadapWrapper harmonizationUnit = new UnitSiadapWrapper(unitSiadapWrapper.getHarmonizationUnit(), configuration.getYear()); if (harmonizationUnit.isValidHarmonizationUnit()) { unitHarmonizers.addAll(harmonizationUnit.getHarmonizationResponsibles()); } request.setAttribute("unitHarmonizers", unitHarmonizers); return forward("/module/siadap/unit.jsp"); }
From source file:alxpez.blog.BlogController.java
private ArrayList<String> extractTags(String tags) { tags = tags.replaceAll("\\s", ""); String tagArray[] = tags.split(","); // let's clean it up, removing the empty string and removing dups ArrayList<String> cleaned = new ArrayList<String>(); for (String tag : tagArray) { if (!tag.equals("") && !cleaned.contains(tag)) { cleaned.add(tag);// www. j a va 2 s . co m } } return cleaned; }
From source file:fr.natoine.model_annotation.Annotation.java
private String annotated(String _url_resource) { String rdf = ""; if (annotated != null && annotated.size() > 0) { rdf = rdf.concat("<annotea:annotates>"); ArrayList<Resource> filtred_annotated = new ArrayList<Resource>(); for (Resource resource : annotated) { if (resource instanceof Selection) { Resource origin = ((Selection) resource).getSelectionOrigin(); if (!filtred_annotated.contains(origin)) { rdf = rdf.concat(origin.toSeeAlso(_url_resource)); filtred_annotated.add(origin); }/*from w w w .ja va2 s .co m*/ } else { if (!filtred_annotated.contains(resource)) { rdf = rdf.concat(resource.toSeeAlso(_url_resource)); filtred_annotated.add(resource); } } } rdf = rdf.concat("</annotea:annotates>"); } return rdf; }
From source file:au.com.wallaceit.reddinator.SubredditManager.java
public JSONArray filterFeed(JSONArray feedArray) { String allFilter = prefs.getString("allFilter", ""); if (allFilter == null || allFilter.equals("")) return feedArray; // no filters applied JSONArray filtered = new JSONArray(); ArrayList<String> filter = getAllFilter(); JSONObject feedObj;//from w w w . j ava 2 s . c o m String subreddit; for (int i = 0; i < feedArray.length(); i++) { try { feedObj = feedArray.getJSONObject(i); subreddit = feedObj.getJSONObject("data").getString("subreddit"); if (!filter.contains(subreddit)) // add item if not exlcuded (in filter) filtered.put(feedObj); } catch (JSONException e) { e.printStackTrace(); } } return filtered; }