List of usage examples for java.util Vector addAll
public boolean addAll(Collection<? extends E> c)
From source file:logica.Estacion.java
/** * @brief Ubicacion de los resumenes, en un Vector<String> * /* w ww. j a v a2 s .co m*/ * Retorna la ubicacion de los resumenes de esta estacion y de sus * sub-estaciones, en un Vector<String>. * Se guardan en esa forma, primero la direccion propia y luego la de las * sub-estaciones. * * @return Direccion donde se encuentra el resumen. */ public Vector<String> getResumen() { Vector<String> direcciones = new Vector(); // Instancio el manejador de XML XMLConfiguration registro = new XMLConfiguration(); registro.setFileName(String.format("resumenes/%d.xml", ID)); // No es necesario crear el resumen si no existe // if ( !registro.getFile().exists() ) { // // Si no existe, simplemente seteo el nombre del elemento base // registro.setRootElementName("resumen"); // // Y creo el archivo // try { // registro.save(); // } catch (ConfigurationException ex1) { // LOGGER.log(Level.SEVERE, null, ex1); // } // } // getFileName() me devuelve la direccion dentro del proyecto. // getURL() me devuelve la direccion desde el root de la maquina. if (registro.getFile().exists()) direcciones.add(registro.getFileName()); for (Estacion subestacion : redEstaciones) { if (subestacion != null) direcciones.addAll(subestacion.getResumen()); } return direcciones; }
From source file:org.kepler.objectmanager.repository.EcogridRepository.java
/** * Search the repository and return an iterator of EcogridRepositoryResults. * //from w ww. ja v a 2 s . c o m * @param queryDocument * - the query document to give the QueryServiceClient * @return * @throws RepositoryException * @throws AuthenticationException */ public Iterator<EcogridRepositoryResults> advancedSearch(Reader queryDocument, boolean authenticate) throws RepositoryException, AuthenticationException { Vector<EcogridRepositoryResults> resultsVector = new Vector<EcogridRepositoryResults>(); ResultsetType rst = arbitrarySearch(queryDocument, authenticate); if (rst == null) { // check to see if the resultsettype is null return null; } ResultsetTypeRecord[] records = rst.getRecord(); if (records == null || records.length == 0) { // check to see if // there are records return null; } if (isDebugging) { log.debug("There are " + records.length + " records"); } // create the EcogridRepositoryResult object and put it in the // vector for (int i = 0; i < records.length; i++) { try { // catch this here so one result can't hose the whole // resultset List<EcogridRepositoryResults> results = EcogridRepositoryResults .parseKarXml(records[i].getIdentifier(), name, i, authenticate); resultsVector.addAll(results); } catch (Exception e) { System.out .println("could not load result: " + records[i].toString() + " error: " + e.getMessage()); } // ResultsetTypeRecord currentRecord = records[i]; } return resultsVector.iterator(); }
From source file:edu.ku.brc.specify.datamodel.Taxon.java
/** * Returns a <code>List</code> of all descendants of the called <code>node</code>. * /*from w ww.j av a2 s . c o m*/ * @return all descendants of <code>node</code> */ @Transient public List<Taxon> getAllDescendants() { Vector<Taxon> descendants = new Vector<Taxon>(); for (Taxon child : getChildren()) { descendants.add(child); descendants.addAll(child.getAllDescendants()); } return descendants; }
From source file:gda.data.metadata.NXMetaDataProvider.java
public List<String> getScannableInputNames(Scannable scannable) { Vector<String> outNames = new Vector<String>(); // if detector the inputNames are not returned in ScanDataPoint so do not add if (!(scannable instanceof Detector)) { outNames.addAll(Arrays.asList(scannable.getInputNames())); }//w ww . ja va 2 s . c om return outNames; }
From source file:org.jopac2.jbal.iso2709.Unimarc.java
public Vector<String> getAuthors() { Vector<Tag> v = getTags("700"); v.addAll(getTags("701")); v.addAll(getTags("702")); Vector<String> r = new Vector<String>(); String k = ""; if (v.size() > 0) { for (int i = 0; i < v.size(); i++) { k = ""; k += Utils.ifExists("", v.elementAt(i).getField("a")); //k=v.elementAt(i).getField("a").getContent(); k += Utils.ifExists(" ", v.elementAt(i).getField("b")); //k+=" "+v.elementAt(i).getField("b").getContent(); if (!r.contains(k)) r.addElement(k);/* ww w . j a v a 2s. co m*/ } } return r; }
From source file:gda.data.metadata.NXMetaDataProvider.java
public List<String> getScannableExtraNames(Scannable scannable) { Vector<String> outNames = new Vector<String>(); String[] extraNames = scannable.getExtraNames(); if (scannable instanceof Detector) { if (extraNames.length > 0) { outNames.addAll(Arrays.asList(extraNames)); } else {//ww w . j a v a 2 s .com outNames.add(scannable.getName()); } } else { outNames.addAll(Arrays.asList(extraNames)); } return outNames; }
From source file:org.unitime.timetable.model.Solution.java
public void export(CSVFile file, String instructorFormat) { file.setSeparator(","); file.setQuotationMark("\""); if (isCommited().booleanValue()) { file.setHeader(new CSVField[] { new CSVField("COURSE"), new CSVField("ITYPE"), new CSVField("SECTION"), new CSVField("SUFFIX"), new CSVField("EXTERNAL_ID"), new CSVField("DATE_PATTERN"), new CSVField("DAY"), new CSVField("START_TIME"), new CSVField("END_TIME"), new CSVField("ROOM"), new CSVField("INSTRUCTOR"), new CSVField("SCHEDULE_NOTE") }); } else {/*from ww w . j a v a 2s .com*/ file.setHeader(new CSVField[] { new CSVField("COURSE"), new CSVField("ITYPE"), new CSVField("SECTION"), new CSVField("SUFFIX"), new CSVField("DATE_PATTERN"), new CSVField("DAY"), new CSVField("START_TIME"), new CSVField("END_TIME"), new CSVField("ROOM"), new CSVField("INSTRUCTOR"), new CSVField("SCHEDULE_NOTE") }); } Vector assignments = new Vector(getAssignments()); assignments.addAll(getOwner().getNotAssignedClasses(this)); Collections.sort(assignments, new ClassOrAssignmentComparator()); for (Iterator i = assignments.iterator(); i.hasNext();) { Object o = i.next(); if (o instanceof Assignment) { Assignment assignment = (Assignment) o; Class_ clazz = assignment.getClazz(); List<DepartmentalInstructor> leads = clazz.getLeadInstructors(); StringBuffer leadsSb = new StringBuffer(); for (Iterator<DepartmentalInstructor> e = leads.iterator(); e.hasNext();) { DepartmentalInstructor instructor = (DepartmentalInstructor) e.next(); leadsSb.append(instructor.getName(instructorFormat)); if (e.hasNext()) leadsSb.append(";"); } Placement placement = assignment.getPlacement(); if (isCommited().booleanValue()) { file.addLine(new CSVField[] { new CSVField(clazz.getCourseName()), new CSVField(clazz.getItypeDesc()), new CSVField(clazz.getSectionNumber()), new CSVField(clazz.getSchedulingSubpart().getSchedulingSubpartSuffix()), new CSVField(clazz.getDivSecNumber()), new CSVField(clazz.effectiveDatePattern().getName()), new CSVField(placement.getTimeLocation().getDayHeader()), new CSVField(placement.getTimeLocation().getStartTimeHeader(CONSTANTS.useAmPm())), new CSVField(placement.getTimeLocation().getEndTimeHeader(CONSTANTS.useAmPm())), new CSVField(placement.getRoomName(",")), new CSVField(leadsSb), new CSVField( clazz.getSchedulePrintNote() == null ? "" : clazz.getSchedulePrintNote()) }); } else { file.addLine(new CSVField[] { new CSVField(clazz.getCourseName()), new CSVField(clazz.getItypeDesc()), new CSVField(clazz.getSectionNumber()), new CSVField(clazz.getSchedulingSubpart().getSchedulingSubpartSuffix()), new CSVField(clazz.effectiveDatePattern().getName()), new CSVField(placement.getTimeLocation().getDayHeader()), new CSVField(placement.getTimeLocation().getStartTimeHeader(CONSTANTS.useAmPm())), new CSVField(placement.getTimeLocation().getEndTimeHeader(CONSTANTS.useAmPm())), new CSVField(placement.getRoomName(",")), new CSVField(leadsSb), new CSVField( clazz.getSchedulePrintNote() == null ? "" : clazz.getSchedulePrintNote()) }); } } else { Class_ clazz = (Class_) o; List<DepartmentalInstructor> leads = clazz.getLeadInstructors(); StringBuffer leadsSb = new StringBuffer(); for (Iterator<DepartmentalInstructor> e = leads.iterator(); e.hasNext();) { DepartmentalInstructor instructor = (DepartmentalInstructor) e.next(); leadsSb.append(instructor.getName(instructorFormat)); if (e.hasNext()) leadsSb.append(";"); } if (isCommited().booleanValue()) { file.addLine(new CSVField[] { new CSVField(clazz.getCourseName()), new CSVField(clazz.getItypeDesc()), new CSVField(clazz.getSectionNumber()), new CSVField(clazz.getSchedulingSubpart().getSchedulingSubpartSuffix()), new CSVField(clazz.getDivSecNumber()), new CSVField(clazz.effectiveDatePattern().getName()), new CSVField(""), new CSVField(""), new CSVField(""), new CSVField(""), new CSVField(leadsSb), new CSVField( clazz.getSchedulePrintNote() == null ? "" : clazz.getSchedulePrintNote()) }); } else { file.addLine(new CSVField[] { new CSVField(clazz.getCourseName()), new CSVField(clazz.getItypeDesc()), new CSVField(clazz.getSectionNumber()), new CSVField(clazz.getSchedulingSubpart().getSchedulingSubpartSuffix()), new CSVField(clazz.effectiveDatePattern().getName()), new CSVField(""), new CSVField(""), new CSVField(""), new CSVField(""), new CSVField(leadsSb), new CSVField( clazz.getSchedulePrintNote() == null ? "" : clazz.getSchedulePrintNote()) }); } } } }
From source file:org.hdl.caffe.yarn.app.CaffeAmContainer.java
public StringBuilder makeCommands(long amMemory, String appMasterMainClass, int containerMemory, int containerVirtualCores, int workerNumContainers, String jarDfsPath, Vector<CharSequence> containerRetryOptions, boolean train, String solver, boolean feature, String label, String model, String output, int connection) { // Set the necessary command to execute the application master Vector<CharSequence> vargs = new Vector<CharSequence>(30); // Set java executable command LOG.info("Setting up app master command"); vargs.add(ApplicationConstants.Environment.JAVA_HOME.$$() + "/bin/java"); // Set Xmx based on am memory size vargs.add("-Xmx" + amMemory + "m"); // Set class name vargs.add(appMasterMainClass);//from w w w .java 2s . co m // Set params for Application Master vargs.add("--container_memory " + String.valueOf(containerMemory)); vargs.add("--container_vcores " + String.valueOf(containerVirtualCores)); vargs.add(CaffeApplication.makeOption(CaffeApplication.OPT_CAFFE_PROCESSOR_NUM, String.valueOf(workerNumContainers))); vargs.add("--" + CaffeApplication.OPT_CAFFE_PROCESSOR_JAR + " " + String.valueOf(jarDfsPath)); vargs.add(CaffeApplication.makeOption(CaffeApplication.OPT_CAFFE_PROCESSOR_TRAIN, train)); vargs.add(CaffeApplication.makeOption(CaffeApplication.OPT_CAFFE_PROCESSOR_FEATURES, feature)); vargs.add(CaffeApplication.makeOption(CaffeApplication.OPT_CAFFE_PROCESSOR_SOLVER, solver)); vargs.add(CaffeApplication.makeOption(CaffeApplication.OPT_CAFFE_PROCESSOR_LABEL, label)); vargs.add(CaffeApplication.makeOption(CaffeApplication.OPT_CAFFE_PROCESSOR_MODEL, model)); vargs.add(CaffeApplication.makeOption(CaffeApplication.OPT_CAFFE_PROCESSOR_OUTPUT, output)); vargs.add(CaffeApplication.makeOption(CaffeApplication.OPT_CAFFE_PROCESSOR_CONNECTION, connection)); vargs.addAll(containerRetryOptions); vargs.add("1>" + ApplicationConstants.LOG_DIR_EXPANSION_VAR + "/AppMaster.stdout"); vargs.add("2>" + ApplicationConstants.LOG_DIR_EXPANSION_VAR + "/AppMaster.stderr"); // Get final commmand StringBuilder command = new StringBuilder(); for (CharSequence str : vargs) { command.append(str).append(" "); } return command; }
From source file:de.juwimm.cms.remote.UserServiceSpringImpl.java
/** * Returns all users regardings the active site and the given unit.<br> * If the Group will be <b>null</b>, it will return all users for this unit.<br> * PLEASE NOTE: DOES NOT RETURN SITEROOTS! <b>SECURITY INFORMATION:</b> * Available only to: <i>siteRoot, unitAdmin</i> * //from w w w. j av a2 s .c o m * @param unitId * The Unit * @return Returns all UserValue Objects in an Array. Is empty if nobody was * found. * * @see de.juwimm.cms.remote.UserServiceSpring#getAllUser4Unit(java.lang.Integer) */ @Override protected UserValue[] handleGetAllUser4Unit(Integer unitId) throws Exception { if (unitId == null) { return new UserValue[0]; } Vector<UserValue> userValues = new Vector<UserValue>(); try { UserHbm userMe = super.getUserHbmDao().load(AuthenticationHelper.getUserName()); if (getUserHbmDao().isInUnit(unitId, userMe)) { UnitHbm unit = super.getUnitHbmDao().load(unitId); userValues.addAll(this.getUsers4Unit(userMe, unit)); } } catch (Exception e) { throw new UserException(e.getMessage()); } return userValues.toArray(new UserValue[0]); }
From source file:gda.data.metadata.NXMetaDataProvider.java
public List<String> getScannableFieldNames(Scannable scannable) { Vector<String> fieldNames = new Vector<String>(); // if detector the inputNames are not returned in ScanDataPoint so do not add String[] extraNames = scannable.getExtraNames(); if (scannable instanceof Detector) { if (extraNames.length > 0) { fieldNames.addAll(Arrays.asList(extraNames)); } else {/*from w w w.j a va 2 s. c om*/ fieldNames.add(scannable.getName()); } } else { fieldNames.addAll(Arrays.asList(scannable.getInputNames())); fieldNames.addAll(Arrays.asList(extraNames)); } return fieldNames; }