List of usage examples for java.util Vector elementAt
public synchronized E elementAt(int index)
From source file:gov.nih.nci.evs.browser.utils.CodeSearchUtils.java
public static LocalNameList vector2LocalNameList(Vector<String> v) { if (v == null) return null; LocalNameList list = new LocalNameList(); for (int i = 0; i < v.size(); i++) { String vEntry = (String) v.elementAt(i); list.addEntry(vEntry);/*www. j av a 2 s . co m*/ } return list; }
From source file:gov.nih.nci.caIMAGE.util.NewDropdownUtil.java
/** * Returns a list of all Institution /* w w w .j a v a 2s. c om*/ * Used for submission and search screens * * @return Institution * @throws Exception */ private static List getQueryInstitutionList(HttpServletRequest inRequest, String inAddBlank) throws Exception { log.debug("Entering NewDropdownUtil.getQueryInstitutionList"); Annotations annot = new Annotations(); Login login = new Login(); // Get values for dropdown lists for Institution List<DropdownOption> theReturnList = new ArrayList<DropdownOption>(); Vector logins = login.retrieveAllWhere("loginuid is not null order by pi_name"); Hashtable v1 = new Hashtable(); for (int j = 0; j < logins.size(); j++) { Login LogIn = (Login) logins.elementAt(j); if (LogIn.getLoginuid() != null) { if (LogIn.getInstitute() != null) { Vector v = annot.retrieveByANNOTATIONS__DONATOR_ID(LogIn.getLoginuid()); if (v.size() != 0) { DropdownOption theOption = new DropdownOption(LogIn.getInstitute(), LogIn.getInstitute()); theReturnList.add(theOption); } //if } //if } //if } //for log.debug("Exiting getQueryInstitutionList.size " + theReturnList.size()); return theReturnList; }
From source file:gov.nih.nci.caIMAGE.util.NewDropdownUtil.java
/** * Returns a list of all Institution /*from ww w .j ava2 s .co m*/ * Used for submission and search screens * * @return Institution * @throws Exception */ private static List getQueryPIList(HttpServletRequest inRequest, String inAddBlank) throws Exception { log.debug("Entering NewDropdownUtil.getQueryPIList"); Annotations annot = new Annotations(); Login login = new Login(); // Get values for dropdown lists for Institution List<DropdownOption> theReturnList = new ArrayList<DropdownOption>(); Vector logins = login.retrieveAllWhere("loginuid is not null order by pi_name"); Hashtable v1 = new Hashtable(); for (int j = 0; j < logins.size(); j++) { Login LogIn = (Login) logins.elementAt(j); if (LogIn.getLoginuid() != null) { if (LogIn.getInstitute() != null) { Vector v = annot.retrieveByANNOTATIONS__DONATOR_ID(LogIn.getLoginuid()); if (v.size() != 0) { DropdownOption theOption = new DropdownOption(LogIn.getPi_name(), LogIn.getLoginuid().toString()); theReturnList.add(theOption); } //if } //if } //if } //for log.debug("Exiting getQueryPIList.size " + theReturnList.size()); return theReturnList; }
From source file:Sort.java
private static void swap(Vector v, int i, int j) { Object o;/*w w w. j av a 2 s. c o m*/ o = v.elementAt(i); v.setElementAt(v.elementAt(j), i); v.setElementAt(o, j); }
From source file:core.PlanC.java
private static void initEnviorement() { try {//from www. j a v a 2 s.c o m connectToLocalDB(); TSplash splash = new TSplash(); // connection a perfiles de datos DBAccess dba = ConnectionManager.getAccessTo("t_connections"); Vector v = dba.search(null, null); Properties prps = new Properties(); for (int i = 0; i < v.size(); i++) { Record r = (Record) v.elementAt(i); // for planc: save the conection user as master user if (r.getFieldValue("t_cnname").equals("SleOracle")) { Session.setMasterUser((String) r.getFieldValue("t_cnuser")); // 1823: override fields value from table values to values stored in jdbc.properties file String[] rp = PUserLogIn.getJdbcProperties("jdbc.username", "jdbc.password", "jdbc.url"); r.setFieldValue("T_CNUSER", rp[0]); r.setFieldValue("T_CNPASSWORD", rp[1]); r.setFieldValue("T_CNURL", rp[2]); } String pl = (String) r.getFieldValue("T_CNEXTENDED_PRP"); prps.clear(); TStringUtils.parseProperties(pl, prps); String sc = " (" + prps.getProperty("*schema", "") + ")"; String msg = "Connecting to database " + r.getFieldValue("t_cnname") + sc; String ac = prps.getProperty("*autoconnection", ""); SystemLog.info(msg + " with *autoconnection=" + ac); if (!ac.equals("false")) { splash.increment(msg); ConnectionManager.connect(r); } } // update running hardware info splash.increment("Updating instalation info"); // checkInstalation(); // EN ESTE ORDEN splash.increment("Starting download subsystem"); DownloadManager.init(); // patch update need download manager splash.increment("Checking for updates"); // UpdateManager.checkForPTF(); splash.increment("Starting task manager"); TTaskManager.init(); // load plugins MUST BE last splash.increment("Loading plugins"); PluginManager.init(); splash.increment("Configuring general aspect and L&F..."); setContentPane(SIGNIN); splash.dispose(); } catch (Exception e) { SystemLog.logException1(e, true); System.exit(-1); } }
From source file:gov.nih.nci.caIMAGE.util.NewDropdownUtil.java
/** * Returns a list of all Gender /*from w ww. j a v a2 s.c o m*/ * Used for submission and search screens * * @return genders * @throws Exception */ private static List getQueryGenderList(HttpServletRequest inRequest, String inAddBlank) throws Exception { log.debug("Entering NewDropdownUtil.getQueryGenderList"); // Get values for dropdown lists for Gender Gender gen = new Gender(); Vector gender = gen.retrieveAllWhere("gender_name IS NOT NULL ORDER BY gender_name"); List<DropdownOption> theReturnList = new ArrayList<DropdownOption>(); for (int j = 0; j < gender.size(); j++) { Gender Gen = (Gender) gender.elementAt(j); if (Gen.getGender_id() != null) { DropdownOption theOption = new DropdownOption(Gen.getGender_name(), Gen.getGender_id().toString()); theReturnList.add(theOption); } } log.debug("Exiting getQueryGenderList.size " + theReturnList.size()); return theReturnList; }
From source file:Main.java
/** * Method getLimit.//from w w w. jav a2s. c om * @param vector Vector * @param getter String * @param limitType int * @return Object * @throws NoSuchMethodException * @throws IllegalAccessException * @throws Exception */ private static Object getLimit(Vector vector, String getter, int limitType) throws NoSuchMethodException, IllegalAccessException, Exception { Object limitObject = null; Object currentObject = null; Method getterMethod = null; Method compareMethod = null; Object vectorElement = null; Class[] clsParms = new Class[0]; Object[] objParms = new Object[0]; Class[] objectClass = new Class[1]; Object[] limitObjectArray = new Object[1]; int compareResult = 0; try { objectClass[0] = Class.forName("java.lang.Object"); } catch (Exception e) { } if (vector.size() > 0) { vectorElement = vector.elementAt(0); getterMethod = vectorElement.getClass().getMethod(getter, clsParms); limitObject = getterMethod.invoke(vectorElement, objParms); if ((limitObject == null) && (limitType == MIN)) { return null; } } for (int i = 1; i < vector.size(); i++) { vectorElement = vector.elementAt(i); if (vectorElement != null) { getterMethod = vectorElement.getClass().getMethod(getter, clsParms); currentObject = getterMethod.invoke(vectorElement, objParms); } else { currentObject = null; } if (currentObject != null) { if (limitObject != null) { compareMethod = currentObject.getClass().getMethod("compareTo", objectClass); limitObjectArray[0] = limitObject; compareResult = ((Integer) compareMethod.invoke(currentObject, limitObjectArray)).intValue(); } else { compareResult = 1; } } else { if (limitObject != null) { compareResult = -1; } else { compareResult = 0; } } if (((compareResult > 0) && (limitType == MAX)) || ((compareResult < 0) && (limitType == MIN))) { limitObject = currentObject; } } return limitObject; }
From source file:org.ariadne.oai.utils.HarvesterUtils.java
public static Vector<OAIRepository> getRepositories() throws OAIException { Vector list = getReposList(); Vector<OAIRepository> repositories = new Vector<OAIRepository>(); for (int i = 0; i < list.size(); i++) { try {// w w w . j a v a2 s . c o m OAIRepository repository = new OAIRepository(); repository.setBaseURL(PropertiesManager.getInstance().getProperty(list.elementAt(i) + ".baseURL")); repositories.add(repository); } catch (OAIException e) { // NOOP } } return repositories; }
From source file:Main.java
/** * Method getLimit./*w w w . ja v a 2 s . c om*/ * @param vector Vector * @param getter String * @param limitType int * @return Object * @throws NoSuchMethodException * @throws IllegalAccessException * @throws InvocationTargetException */ private static Object getLimit(Vector vector, String getter, int limitType) throws NoSuchMethodException, IllegalAccessException, InvocationTargetException { Object limitObject = null; Object currentObject = null; Method getterMethod = null; Method compareMethod = null; Object vectorElement = null; Class[] clsParms = new Class[0]; Object[] objParms = new Object[0]; Class[] objectClass = new Class[1]; Object[] limitObjectArray = new Object[1]; int compareResult = 0; try { objectClass[0] = Class.forName("java.lang.Object"); } catch (Exception e) { } if (vector.size() > 0) { vectorElement = vector.elementAt(0); getterMethod = vectorElement.getClass().getMethod(getter, clsParms); limitObject = getterMethod.invoke(vectorElement, objParms); if ((limitObject == null) && (limitType == MIN)) { return null; } } for (int i = 1; i < vector.size(); i++) { vectorElement = vector.elementAt(i); if (vectorElement != null) { getterMethod = vectorElement.getClass().getMethod(getter, clsParms); currentObject = getterMethod.invoke(vectorElement, objParms); } else { currentObject = null; } if (currentObject != null) { if (limitObject != null) { compareMethod = currentObject.getClass().getMethod("compareTo", objectClass); limitObjectArray[0] = limitObject; compareResult = ((Integer) compareMethod.invoke(currentObject, limitObjectArray)).intValue(); } else { compareResult = 1; } } else { if (limitObject != null) { compareResult = -1; } else { compareResult = 0; } } if (((compareResult > 0) && (limitType == MAX)) || ((compareResult < 0) && (limitType == MIN))) { limitObject = currentObject; } } return limitObject; }
From source file:gov.nih.nci.evs.browser.utils.ViewInHierarchyUtils.java
public static ConceptReferenceList createConceptReferenceList(Vector codes, String codingSchemeName) { if (codes == null) { return null; }/* w w w . j ava2 s . com*/ ConceptReferenceList list = new ConceptReferenceList(); for (int i = 0; i < codes.size(); i++) { String code = (String) codes.elementAt(i); ConceptReference cr = new ConceptReference(); cr.setCodingSchemeName(codingSchemeName); cr.setConceptCode(code); list.addConceptReference(cr); } return list; }