List of usage examples for java.util HashSet add
public boolean add(E e)
From source file:maltcms.ui.fileHandles.cdf.CDF2ChartOpenSupport.java
/** * * @return/* w ww .j ava 2 s . co m*/ */ @Override protected CloneableTopComponent createCloneableTopComponent() { final HashSet<IFileFragment> fragments = new LinkedHashSet<>(); for (CDFDataObject dataObject : auxDataObjects) { fragments.add(new FileFragment(dataObject.getPrimaryFile().toURI())); } Chromatogram1DChartProvider c1d = new Chromatogram1DChartProvider(); JFCTopComponent jtc = new JFCTopComponent(); JFreeChart jfc = c1d.provideChart(new LinkedList<>(fragments)); if (jfc == null) { return null; } jtc.setChart(jfc); jtc.setDisplayName("Chart"); return jtc; }
From source file:com.rockagen.gnext.test.ServiceTest.java
@Test @Ignore//www .j a v a 2 s .c om // @Rollback(true) public void testIniAuthUserServ() { AuthRole ar = new AuthRole(); ar.setName("ROLE_ROOT"); ar.setDescription("root privileges"); AuthRole ar2 = new AuthRole(); ar2.setName("ROLE_USER"); ar2.setDescription("user privileges"); HashSet<AuthRole> roles = new HashSet<AuthRole>(); roles.add(ar); HashSet<AuthRole> roles2 = new HashSet<AuthRole>(); roles2.add(ar2); AuthResource res = new AuthResource(); res.setResDescription("Need ROLE_ROOT privileges"); res.setResPriority(0); res.setRoles(roles); res.setResUrl("/*"); AuthResource res2 = new AuthResource(); res2.setResDescription("Need ROLE_USER privileges"); res2.setResPriority(50); res2.setRoles(roles2); res2.setResUrl("/user/*"); authRoleServ.add(ar); authRoleServ.add(ar2); authResourceServ.add(res); authResourceServ.add(res2); AuthUser a = new AuthUser(); a.setEmail("ra@rockagen.com"); a.setEnabled(1); a.setErrorCount(0); a.setNickName("rockagen"); a.setUserName("root"); a.setPassWord("admin"); a.setRoles(roles); authUserServ.add(a); }
From source file:com.talis.rdf.solr.DefaultDocumentBuilder.java
@Override public SolrInputDocument getDocument(String subject, Iterable<Quad> quads) { LOG.debug("Creating SolrInputDocument for subject {}", subject); notNull(subject, "Subject URI cannot be null."); notNull(quads, "Quads cannot be null."); SolrInputDocument doc = new SolrInputDocument(); doc.setField(INDEX_DATE, DateTools.dateToString(new Date(), DateTools.Resolution.SECOND)); doc.setField(DOCUMENT_KEY, subject); doc.setField(SUBJECT_URI, subject); HashSet<String> graphUris = new HashSet<String>(); for (Quad quad : quads) { LOG.debug("Processing quad {}", quad); graphUris.add(quad.getGraph().getURI()); isTrue(quad.getSubject().getURI().equals(subject), "Subject URI not consistent with key"); Node predicate = quad.getPredicate(); Node object = quad.getObject(); String predicateStr = predicate.getURI(); if (predicateStr.equals(RDF.type.getURI()) && object.isURI()) { doc.addField(CLASS, object.getURI()); doc.addField(CLASS_NS, object.getNameSpace()); }/*w w w .java 2 s .c o m*/ doc.addField(PROPERTY, predicateStr); doc.addField(PROPERTY_NS, predicate.getNameSpace()); if (object.isLiteral()) { doc.addField(predicateStr, object.getLiteralValue()); } } for (String graphUri : graphUris) { doc.addField(GRAPH_URI, graphUri); } return doc; }
From source file:edu.harvard.i2b2.explorer.serviceClient.PDOQueryClient.java
public static String getlldString(ArrayList<TimelineRow> tlrows, String patientRefId, int minPatient, int maxPatient, boolean bDisplayAll, boolean writeFile, boolean displayDemographics, MainComposite explorer, String filter) { try {// w ww . java 2s .com HashSet<String> conceptPaths = new HashSet<String>(); // HashSet<String> providerPaths = new HashSet<String>(); // HashSet<String> visitPaths = new HashSet<String>(); ArrayList<PDOItem> items = new ArrayList<PDOItem>(); for (int i = 0; i < tlrows.size(); i++) { for (int j = 0; j < tlrows.get(i).pdoItems.size(); j++) { PDOItem pdoItem = tlrows.get(i).pdoItems.get(j); String path = pdoItem.fullPath; if (conceptPaths.contains(path)) { //continue; } conceptPaths.add(path); // for(int k=0; k<pdoItem.valDisplayProperties.size(); k++) // { items.add(pdoItem); // } } } PDORequestMessageModel pdoFactory = new PDORequestMessageModel(); String pid = null; if (patientRefId.equalsIgnoreCase("All")) { pid = "-1"; } else { pid = patientRefId; } String xmlStr = pdoFactory.requestXmlMessage(items, pid, new Integer(minPatient), new Integer(maxPatient), false, filter); // explorer.lastRequestMessage(xmlStr); String result = null;// sendPDOQueryRequestREST(xmlStr); if (System.getProperty("webServiceMethod").equals("SOAP")) { result = PDOQueryClient.sendPDOQueryRequestSOAP(xmlStr); } else { result = PDOQueryClient.sendPDOQueryRequestREST(xmlStr); } if (result == null || result.equalsIgnoreCase("memory error")) { return result; } // explorer.lastResponseMessage(result); return new TimelineFactory().generateTimelineData(result, tlrows, writeFile, bDisplayAll, displayDemographics, explorer); } /* * catch(org.apache.axis2.AxisFault e) { e.printStackTrace(); * java.awt.EventQueue.invokeLater(new Runnable() { public void run() { * JOptionPane.showMessageDialog(null, * "Trouble with connection to the remote server, " + * "this is often a network error, please try again", "Network Error", * JOptionPane.INFORMATION_MESSAGE); } }); * * return null; } */ catch (Exception e) { e.printStackTrace(); return null; } }
From source file:ca.weblite.xmlvm.XMLVMTest.java
@Test public void testCollectDirtyClasses() throws IOException { org.apache.tools.ant.Project proj = new org.apache.tools.ant.Project(); File basedir = new File("/Volumes/Windows VMS/NetbeansProjects/HelloWorldCN1"); proj.setBasedir(basedir.getAbsolutePath()); XMLVM xmlvm = new XMLVM(); xmlvm.setProject(proj);/* www . j av a 2 s.c o m*/ File dest = new File(basedir, "cout"); dest.mkdir(); Path src = new Path(proj, new File(basedir, "src").getAbsolutePath()); xmlvm.setSrc(src); xmlvm.setDest(dest); File buildDir = new File(basedir, "build"); buildDir = new File(buildDir, "classes"); xmlvm.setJavaBuildDir(buildDir); File iOSPort = new File(basedir, "iOSPort"); Path classPath = new Path(proj); classPath.add(new Path(proj, buildDir.getAbsolutePath())); src.add(new Path(proj, new File("/Volumes/Windows VMS/src/codenameone-read-only/CodenameOne/src").getAbsolutePath())); src.add(new Path(proj, new File(iOSPort, "src").getAbsolutePath())); xmlvm.setClassPath(classPath); xmlvm.setTarget("c"); HashSet<String> changedClasses = new HashSet<>(); changedClasses.add("com.mycompany.myapp.MyApplication"); Set<String> dirty = xmlvm.collectDirtyClasses(changedClasses); System.out.println(dirty.size() + " classes are dirty"); System.out.println(dirty); }
From source file:com.vmware.bdd.service.resmgmt.sync.filter.HostFilterByNetwork.java
@Override public boolean isFiltered(VcHost vcHost) { boolean networkAccessible = false; HashSet<String> hostNetworkNameSet = new HashSet<>(); if (CollectionUtils.isNotEmpty(vcHost.getNetworks())) { for (VcNetwork vcNetwork : vcHost.getNetworks()) { hostNetworkNameSet.add(vcNetwork.getName()); }/*from w ww. jav a2 s .com*/ networkAccessible = hostNetworkNameSet.containsAll(requiredNetworkNameSet); } return !networkAccessible; }
From source file:mml.handler.get.MMLGetImgHandler.java
/** * Compile a page ref list that is the intersection of pageRefs and names * @param names the image names found on disk * @return the sorted and available list of page-refs *///from ww w.j a va2 s . c om private String[] sortByPageRefs(String[] names) { ArrayList<String> available = new ArrayList<String>(); HashSet<String> set = new HashSet<String>(); for (String name : names) set.add(name); for (String ref : pageRefs) { if (set.contains(ref)) available.add(ref); } String[] array = new String[available.size()]; available.toArray(array); return array; }
From source file:net.sf.diningout.app.AppApplication.java
@Override public void onVersionChanged(int oldCode, String oldName, int newCode, String newName) { PreferenceManager.setDefaultValues(this, R.xml.preferences, true); if (oldCode > 0 && oldCode < 110) { // first so that prefs are moved to right location HashSet<String> notifs = new HashSet<>(Prefs.getStringSet(this, SHOW_NOTIFICATIONS)); notifs.add(getString(R.string.at_restaurant_notifications_value)); Prefs.putStringSet(this, SHOW_NOTIFICATIONS, notifs); migrateAppPrefs();/*from w ww. ja va 2 s . com*/ } TokenService.refreshTokens(this); if (oldCode < 100) { // delete pre-1.0.0 restaurant images File file = getExternalFilesDir(null); if (file != null) { FileUtils.deleteQuietly(new File(file, "images")); } } if (oldCode == 0) { // nothing else to do if run for the first time return; } if (oldCode < 107) { // get colors of existing photos startService(new Intent(this, RestaurantColorService.class)); startService(new Intent(this, FriendColorService.class)); } if (oldCode < 109) { startService(new Intent(this, RestaurantsRefreshService.class)); } if (oldCode < 112) { startService(new Intent(this, ContactNormalisedNameService.class)); } if (oldCode < 113 && TextUtils.isEmpty(Prefs.getString(this, DISTANCE_UNIT))) { Prefs.putString(this, DISTANCE_UNIT, getString(R.string.automatic_value)); } }
From source file:game.com.AjaxAddGameServlet.java
private HashSet<Integer> getCategorySet(String category) { HashSet<Integer> result = new HashSet(); for (String id : category.split(",")) { result.add(Integer.parseInt(id)); }/*from ww w . j a v a 2 s .c o m*/ return result; }
From source file:com.agileapes.webexport.decorate.Decorator.java
@Override public void onApplicationEvent(CrawlerEvent event) { if (event instanceof AfterParseEvent) { final PageModel model = ((AfterParseEvent) event).getModel(); if (getSelector().matches(model)) { decorate(model);//from w w w.java2 s. c o m } } else if (event instanceof BeforeShutdownEvent) { final Collection<PageModel> models = ((BeforeShutdownEvent) event).getModels(); final HashSet<PageModel> set = new HashSet<PageModel>(); for (PageModel model : models) { if (getSelector().matches(model)) { set.add(model); } } decorate(set); } }