Java Code Examples for java.util.Vector.firstElement()

The following are Jave code examples for showing how to use firstElement() of the java.util.Vector class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
+ Save this method
Example 1
Project: OpenJSharp   File: NativeGSSFactory.java   View Source Code Vote up 7 votes
private GSSCredElement getCredFromSubject(GSSNameElement name,
                                          boolean initiate)
    throws GSSException {
    Oid mech = cStub.getMech();
    Vector<GSSCredElement> creds = GSSUtil.searchSubject
        (name, mech, initiate, GSSCredElement.class);

    // If Subject is present but no native creds available
    if (creds != null && creds.isEmpty()) {
        if (GSSUtil.useSubjectCredsOnly(caller)) {
            throw new GSSException(GSSException.NO_CRED);
        }
    }

    GSSCredElement result = ((creds == null || creds.isEmpty()) ?
                             null : creds.firstElement());
    // Force permission check before returning the cred to caller
    if (result != null) {
        result.doServicePermCheck();
    }
    return result;
}
 
Example 2
Project: OpenJSharp   File: Krb5MechFactory.java   View Source Code Vote up 7 votes
private static Krb5CredElement getCredFromSubject(GSSNameSpi name,
                                                  boolean initiate)
    throws GSSException {
    Vector<Krb5CredElement> creds =
        GSSUtil.searchSubject(name, GSS_KRB5_MECH_OID, initiate,
                              (initiate ?
                               Krb5InitCredential.class :
                               Krb5AcceptCredential.class));

    Krb5CredElement result = ((creds == null || creds.isEmpty()) ?
                              null : creds.firstElement());

    // Force permission check before returning the cred to caller
    if (result != null) {
        if (initiate) {
            checkInitCredPermission((Krb5NameElement) result.getName());
        } else {
            checkAcceptCredPermission
                ((Krb5NameElement) result.getName(), name);
        }
    }
    return result;
}
 
Example 3
Project: openjdk-jdk10   File: Krb5MechFactory.java   View Source Code Vote up 7 votes
private static Krb5CredElement getCredFromSubject(GSSNameSpi name,
                                                  boolean initiate)
    throws GSSException {
    Vector<Krb5CredElement> creds =
        GSSUtil.searchSubject(name, GSS_KRB5_MECH_OID, initiate,
                              (initiate ?
                               Krb5InitCredential.class :
                               Krb5AcceptCredential.class));

    Krb5CredElement result = ((creds == null || creds.isEmpty()) ?
                              null : creds.firstElement());

    // Force permission check before returning the cred to caller
    if (result != null) {
        if (initiate) {
            checkInitCredPermission((Krb5NameElement) result.getName());
        } else {
            checkAcceptCredPermission
                ((Krb5NameElement) result.getName(), name);
        }
    }
    return result;
}
 
Example 4
Project: jdk8u-jdk   File: Krb5MechFactory.java   View Source Code Vote up 7 votes
private static Krb5CredElement getCredFromSubject(GSSNameSpi name,
                                                  boolean initiate)
    throws GSSException {
    Vector<Krb5CredElement> creds =
        GSSUtil.searchSubject(name, GSS_KRB5_MECH_OID, initiate,
                              (initiate ?
                               Krb5InitCredential.class :
                               Krb5AcceptCredential.class));

    Krb5CredElement result = ((creds == null || creds.isEmpty()) ?
                              null : creds.firstElement());

    // Force permission check before returning the cred to caller
    if (result != null) {
        if (initiate) {
            checkInitCredPermission((Krb5NameElement) result.getName());
        } else {
            checkAcceptCredPermission
                ((Krb5NameElement) result.getName(), name);
        }
    }
    return result;
}
 
Example 5
Project: FX-Trade   File: Login.java   View Source Code Vote up 7 votes
@SuppressWarnings("unchecked")
public static double getBalance(){
	User me;
	try {
		me = fxclient.getUser();
		Vector<Account> accounts = me.getAccounts();
		Account myaccount = (Account)accounts.firstElement();
		return myaccount.getBalance();
		
	} catch (SessionException | AccountException e) {
		e.printStackTrace();
	}
	
	return 0;
	
}
 
Example 6
Project: openjdk-jdk10   File: NativeGSSFactory.java   View Source Code Vote up 7 votes
private GSSCredElement getCredFromSubject(GSSNameElement name,
                                          boolean initiate)
    throws GSSException {
    Oid mech = cStub.getMech();
    Vector<GSSCredElement> creds = GSSUtil.searchSubject
        (name, mech, initiate, GSSCredElement.class);

    // If Subject is present but no native creds available
    if (creds != null && creds.isEmpty()) {
        if (GSSUtil.useSubjectCredsOnly(caller)) {
            throw new GSSException(GSSException.NO_CRED);
        }
    }

    GSSCredElement result = ((creds == null || creds.isEmpty()) ?
                             null : creds.firstElement());
    // Force permission check before returning the cred to caller
    if (result != null) {
        result.doServicePermCheck();
    }
    return result;
}
 
Example 7
Project: ideal   File: VectorTarget2.java   View Source Code Vote up 6 votes
public static void main(String... args) throws IOException {
  Vector s = new Vector();
  s.add(new Object());
  if (args == null)
    s.firstElement();
  else
    s.elementAt(0);
}
 
Example 8
Project: FX-Trade   File: MainController.java   View Source Code Vote up 6 votes
public void confirmOrderBtnPressed() throws SessionException{
	
	//need to get rates and update text field 
	//need to move this method to model
	
	CurrentOrder  co = new CurrentOrder();
	co.setPair(CurrentPair.getCurrentPair());
	co.setUnits(unitsTF.getText(), (String) group.getSelectedToggle().getUserData());	
	if(!stopLossTF.getText().equals("")){co.setSL(stopLossTF.getText());}
	if(!takeProfitTF.getText().equals("")){co.setTP(takeProfitTF.getText());}
	co.executeOrder();
	
	
	FXClient fxclient = Login.returnFXClient();
	User me = fxclient.getUser();
	Vector<Account> accounts = me.getAccounts();
	Account myaccount = (Account)accounts.firstElement();
	Vector<MarketOrder> trades = new Vector<MarketOrder>();
	try {
		trades = myaccount.getTrades();
	}
	catch (OAException oe) {
		System.out.println("Example: caught: " + oe);
	}
	System.out.println("CURRENT TRADES:");
	for (int i = 0; i < trades.size(); i++) {
		System.out.println(trades.elementAt(i));
	}
		
}
 
Example 9
Project: ideal   File: VectorTarget4.java   View Source Code Vote up 6 votes
public static void main(String[] args) {
	try {
		Vector v = new Vector();
		v.removeAllElements();
		v.firstElement();
	} catch (Exception e) {
		e.printStackTrace();
	}
}
 
Example 10
Project: OpenJSharp   File: RBTableBuilder.java   View Source Code Vote up 6 votes
private final int getCharOrder(int ch) {
    int order = mapping.elementAt(ch);

    if (order >= RBCollationTables.CONTRACTCHARINDEX) {
        Vector<EntryPair> groupList = getContractValuesImpl(order - RBCollationTables.CONTRACTCHARINDEX);
        EntryPair pair = groupList.firstElement();
        order = pair.value;
    }
    return order;
}
 
Example 11
Project: parabuild-ci   File: Transfer.java   View Source Code Vote up 5 votes
private boolean CatalogToSelect() {

        Vector result = null;

        try {
            lTable.removeAll();

            if (iSelectionStep == Transfer.SELECT_SOURCE_CATALOG) {
                result = sourceDb.getCatalog();
            } else if (iSelectionStep == Transfer.SELECT_DEST_CATALOG) {
                result = targetDb.getCatalog();
            } else {
                exit();
            }

            if (result.size() > 1) {
                lTable.setMultipleMode(true);

                if (iSelectionStep == Transfer.SELECT_SOURCE_CATALOG) {
                    bStart.setLabel("Select Catalog: Source");
                } else {
                    bStart.setLabel("Select Catalog: Destination");
                }

                bStart.invalidate();
                bStart.setEnabled(true);

                for (Enumeration e =
                        result.elements(); e.hasMoreElements(); ) {
                    lTable.add(e.nextElement().toString());
                }

                lTable.repaint();
                trace("Select correct Catalog");
            } else {
                if (result.size() == 1) {
                    if (iSelectionStep == Transfer.SELECT_SOURCE_CATALOG) {
                        sSourceCatalog = (String) result.firstElement();
                        sSourceSchemas = null;
                    } else {
                        sDestCatalog = (String) result.firstElement();
                        sDestSchema  = null;
                    }
                } else {
                    if (iSelectionStep == Transfer.SELECT_SOURCE_CATALOG) {
                        sSourceCatalog = null;
                        sSourceSchemas = null;
                    } else {
                        sDestCatalog = null;
                        sDestSchema  = null;
                    }
                }

                if ((iSelectionStep == Transfer.SELECT_DEST_CATALOG)
                        && (sDestCatalog != null)) {
                    try {
                        targetDb.setCatalog(sDestCatalog);
                    } catch (Exception ex) {
                        trace("Catalog " + sSourceCatalog
                              + " could not be selected in the target database");

                        sSourceCatalog = null;
                    }
                }

                iSelectionStep++;

                ProcessNextStep();

                return false;
            }
        } catch (Exception exp) {
            lTable.removeAll();
            trace("Exception reading catalog: " + exp);
            exp.printStackTrace();
        }

        return (lTable.getItemCount() > 0);
    }
 
Example 12
Project: openjdk-jdk10   File: CollationElementIterator.java   View Source Code Vote up 5 votes
/**
 * Get the ordering priority of the next contracting character in the
 * string.
 * @param ch the starting character of a contracting character token
 * @return the next contracting character's ordering.  Returns NULLORDER
 * if the end of string is reached.
 */
private int nextContractChar(int ch)
{
    // First get the ordering of this single character,
    // which is always the first element in the list
    Vector<EntryPair> list = ordering.getContractValues(ch);
    EntryPair pair = list.firstElement();
    int order = pair.value;

    // find out the length of the longest contracting character sequence in the list.
    // There's logic in the builder code to make sure the longest sequence is always
    // the last.
    pair = list.lastElement();
    int maxLength = pair.entryName.length();

    // (the Normalizer is cloned here so that the seeking we do in the next loop
    // won't affect our real position in the text)
    NormalizerBase tempText = (NormalizerBase)text.clone();

    // extract the next maxLength characters in the string (we have to do this using the
    // Normalizer to ensure that our offsets correspond to those the rest of the
    // iterator is using) and store it in "fragment".
    tempText.previous();
    key.setLength(0);
    int c = tempText.next();
    while (maxLength > 0 && c != NormalizerBase.DONE) {
        if (Character.isSupplementaryCodePoint(c)) {
            key.append(Character.toChars(c));
            maxLength -= 2;
        } else {
            key.append((char)c);
            --maxLength;
        }
        c = tempText.next();
    }
    String fragment = key.toString();
    // now that we have that fragment, iterate through this list looking for the
    // longest sequence that matches the characters in the actual text.  (maxLength
    // is used here to keep track of the length of the longest sequence)
    // Upon exit from this loop, maxLength will contain the length of the matching
    // sequence and order will contain the collation-element value corresponding
    // to this sequence
    maxLength = 1;
    for (int i = list.size() - 1; i > 0; i--) {
        pair = list.elementAt(i);
        if (!pair.fwd)
            continue;

        if (fragment.startsWith(pair.entryName) && pair.entryName.length()
                > maxLength) {
            maxLength = pair.entryName.length();
            order = pair.value;
        }
    }

    // seek our current iteration position to the end of the matching sequence
    // and return the appropriate collation-element value (if there was no matching
    // sequence, we're already seeked to the right position and order already contains
    // the correct collation-element value for the single character)
    while (maxLength > 1) {
        c = text.next();
        maxLength -= Character.charCount(c);
    }
    return order;
}
 
Example 13
Project: jdk8u-jdk   File: CollationElementIterator.java   View Source Code Vote up 5 votes
/**
 * Get the ordering priority of the next contracting character in the
 * string.
 * @param ch the starting character of a contracting character token
 * @return the next contracting character's ordering.  Returns NULLORDER
 * if the end of string is reached.
 */
private int nextContractChar(int ch)
{
    // First get the ordering of this single character,
    // which is always the first element in the list
    Vector<EntryPair> list = ordering.getContractValues(ch);
    EntryPair pair = list.firstElement();
    int order = pair.value;

    // find out the length of the longest contracting character sequence in the list.
    // There's logic in the builder code to make sure the longest sequence is always
    // the last.
    pair = list.lastElement();
    int maxLength = pair.entryName.length();

    // (the Normalizer is cloned here so that the seeking we do in the next loop
    // won't affect our real position in the text)
    NormalizerBase tempText = (NormalizerBase)text.clone();

    // extract the next maxLength characters in the string (we have to do this using the
    // Normalizer to ensure that our offsets correspond to those the rest of the
    // iterator is using) and store it in "fragment".
    tempText.previous();
    key.setLength(0);
    int c = tempText.next();
    while (maxLength > 0 && c != NormalizerBase.DONE) {
        if (Character.isSupplementaryCodePoint(c)) {
            key.append(Character.toChars(c));
            maxLength -= 2;
        } else {
            key.append((char)c);
            --maxLength;
        }
        c = tempText.next();
    }
    String fragment = key.toString();
    // now that we have that fragment, iterate through this list looking for the
    // longest sequence that matches the characters in the actual text.  (maxLength
    // is used here to keep track of the length of the longest sequence)
    // Upon exit from this loop, maxLength will contain the length of the matching
    // sequence and order will contain the collation-element value corresponding
    // to this sequence
    maxLength = 1;
    for (int i = list.size() - 1; i > 0; i--) {
        pair = list.elementAt(i);
        if (!pair.fwd)
            continue;

        if (fragment.startsWith(pair.entryName) && pair.entryName.length()
                > maxLength) {
            maxLength = pair.entryName.length();
            order = pair.value;
        }
    }

    // seek our current iteration position to the end of the matching sequence
    // and return the appropriate collation-element value (if there was no matching
    // sequence, we're already seeked to the right position and order already contains
    // the correct collation-element value for the single character)
    while (maxLength > 1) {
        c = text.next();
        maxLength -= Character.charCount(c);
    }
    return order;
}
 
Example 14
Project: sstore-soft   File: Transfer.java   View Source Code Vote up 5 votes
private boolean CatalogToSelect() {

        Vector result = null;

        try {
            lTable.removeAll();

            if (iSelectionStep == Transfer.SELECT_SOURCE_CATALOG) {
                result = sourceDb.getCatalog();
            } else if (iSelectionStep == Transfer.SELECT_DEST_CATALOG) {
                result = targetDb.getCatalog();
            } else {
                exit();
            }

            if (result.size() > 1) {
                lTable.setMultipleMode(true);

                if (iSelectionStep == Transfer.SELECT_SOURCE_CATALOG) {
                    bStart.setLabel("Select Catalog: Source");
                } else {
                    bStart.setLabel("Select Catalog: Destination");
                }

                bStart.invalidate();
                bStart.setEnabled(true);

                for (Enumeration e =
                        result.elements(); e.hasMoreElements(); ) {
                    lTable.add(e.nextElement().toString());
                }

                lTable.repaint();
                trace("Select correct Catalog");
            } else {
                if (result.size() == 1) {
                    if (iSelectionStep == Transfer.SELECT_SOURCE_CATALOG) {
                        sSourceCatalog = (String) result.firstElement();
                        sSourceSchemas = null;
                    } else {
                        sDestCatalog = (String) result.firstElement();
                        sDestSchema  = null;
                    }
                } else {
                    if (iSelectionStep == Transfer.SELECT_SOURCE_CATALOG) {
                        sSourceCatalog = null;
                        sSourceSchemas = null;
                    } else {
                        sDestCatalog = null;
                        sDestSchema  = null;
                    }
                }

                if ((iSelectionStep == Transfer.SELECT_DEST_CATALOG)
                        && (sDestCatalog != null)) {
                    try {
                        targetDb.setCatalog(sDestCatalog);
                    } catch (Exception ex) {
                        trace("Catalog " + sSourceCatalog
                              + " could not be selected in the target database");

                        sSourceCatalog = null;
                    }
                }

                iSelectionStep++;

                ProcessNextStep();

                return false;
            }
        } catch (Exception exp) {
            lTable.removeAll();
            trace("Exception reading catalog: " + exp);
            exp.printStackTrace();
        }

        return (lTable.getItemCount() > 0);
    }
 
Example 15
Project: s-store   File: Transfer.java   View Source Code Vote up 5 votes
private boolean CatalogToSelect() {

        Vector result = null;

        try {
            lTable.removeAll();

            if (iSelectionStep == Transfer.SELECT_SOURCE_CATALOG) {
                result = sourceDb.getCatalog();
            } else if (iSelectionStep == Transfer.SELECT_DEST_CATALOG) {
                result = targetDb.getCatalog();
            } else {
                exit();
            }

            if (result.size() > 1) {
                lTable.setMultipleMode(true);

                if (iSelectionStep == Transfer.SELECT_SOURCE_CATALOG) {
                    bStart.setLabel("Select Catalog: Source");
                } else {
                    bStart.setLabel("Select Catalog: Destination");
                }

                bStart.invalidate();
                bStart.setEnabled(true);

                for (Enumeration e =
                        result.elements(); e.hasMoreElements(); ) {
                    lTable.add(e.nextElement().toString());
                }

                lTable.repaint();
                trace("Select correct Catalog");
            } else {
                if (result.size() == 1) {
                    if (iSelectionStep == Transfer.SELECT_SOURCE_CATALOG) {
                        sSourceCatalog = (String) result.firstElement();
                        sSourceSchemas = null;
                    } else {
                        sDestCatalog = (String) result.firstElement();
                        sDestSchema  = null;
                    }
                } else {
                    if (iSelectionStep == Transfer.SELECT_SOURCE_CATALOG) {
                        sSourceCatalog = null;
                        sSourceSchemas = null;
                    } else {
                        sDestCatalog = null;
                        sDestSchema  = null;
                    }
                }

                if ((iSelectionStep == Transfer.SELECT_DEST_CATALOG)
                        && (sDestCatalog != null)) {
                    try {
                        targetDb.setCatalog(sDestCatalog);
                    } catch (Exception ex) {
                        trace("Catalog " + sSourceCatalog
                              + " could not be selected in the target database");

                        sSourceCatalog = null;
                    }
                }

                iSelectionStep++;

                ProcessNextStep();

                return false;
            }
        } catch (Exception exp) {
            lTable.removeAll();
            trace("Exception reading catalog: " + exp);
            exp.printStackTrace();
        }

        return (lTable.getItemCount() > 0);
    }
 
Example 16
Project: s-store   File: Transfer.java   View Source Code Vote up 5 votes
private boolean SchemaToSelect() {

        Vector result = null;

        try {
            lTable.removeAll();

            if (iSelectionStep == Transfer.SELECT_SOURCE_SCHEMA) {
                result = sourceDb.getSchemas();
            } else if (iSelectionStep == Transfer.SELECT_DEST_SCHEMA) {
                result = targetDb.getSchemas();
            } else {
                exit();
            }

            if (result.size() > 1) {
                lTable.setMultipleMode(true);

                if (iSelectionStep == Transfer.SELECT_SOURCE_SCHEMA) {
                    bStart.setLabel("Select Schema: Source");
                } else {
                    bStart.setLabel("Select Schema: Destination");
                }

                bStart.invalidate();
                bStart.setEnabled(true);

                for (Enumeration e =
                        result.elements(); e.hasMoreElements(); ) {
                    lTable.add(e.nextElement().toString());
                }

                lTable.repaint();
                trace("Select correct Schema or load Settings file");
            } else {
                if (result.size() == 1) {
                    if (iSelectionStep == Transfer.SELECT_SOURCE_SCHEMA) {
                        sSourceSchemas    = new String[1];
                        sSourceSchemas[0] = (String) result.firstElement();
                    } else {
                        sDestSchema = (String) result.firstElement();
                    }
                } else {
                    if (iSelectionStep == Transfer.SELECT_SOURCE_SCHEMA) {
                        sSourceSchemas = null;
                    } else {
                        sDestSchema = null;
                    }
                }

                if (iTransferMode == TRFM_DUMP) {
                    iSelectionStep = Transfer.SELECT_SOURCE_TABLES;
                } else {
                    iSelectionStep++;
                }

                ProcessNextStep();

                return false;
            }
        } catch (Exception exp) {
            lTable.removeAll();
            trace("Exception reading schemas: " + exp);
            exp.printStackTrace();
        }

        return (lTable.getItemCount() > 0);
    }
 
Example 17
Project: parabuild-ci   File: Transfer.java   View Source Code Vote up 5 votes
private boolean CatalogToSelect() {

        Vector result = null;

        try {
            lTable.removeAll();

            if (iSelectionStep == Transfer.SELECT_SOURCE_CATALOG) {
                result = sourceDb.getCatalog();
            } else if (iSelectionStep == Transfer.SELECT_DEST_CATALOG) {
                result = targetDb.getCatalog();
            } else {
                exit();
            }

            if (result.size() > 1) {
                lTable.setMultipleMode(true);

                if (iSelectionStep == Transfer.SELECT_SOURCE_CATALOG) {
                    bStart.setLabel("Select Catalog: Source");
                } else {
                    bStart.setLabel("Select Catalog: Destination");
                }

                bStart.invalidate();
                bStart.setEnabled(true);

                for (Enumeration e =
                        result.elements(); e.hasMoreElements(); ) {
                    lTable.add(e.nextElement().toString());
                }

                lTable.repaint();
                trace("Select correct Catalog");
            } else {
                if (result.size() == 1) {
                    if (iSelectionStep == Transfer.SELECT_SOURCE_CATALOG) {
                        sSourceCatalog = (String) result.firstElement();
                        sSourceSchemas = null;
                    } else {
                        sDestCatalog = (String) result.firstElement();
                        sDestSchema  = null;
                    }
                } else {
                    if (iSelectionStep == Transfer.SELECT_SOURCE_CATALOG) {
                        sSourceCatalog = null;
                        sSourceSchemas = null;
                    } else {
                        sDestCatalog = null;
                        sDestSchema  = null;
                    }
                }

                if ((iSelectionStep == Transfer.SELECT_DEST_CATALOG)
                        && (sDestCatalog != null)) {
                    try {
                        targetDb.setCatalog(sDestCatalog);
                    } catch (Exception ex) {
                        trace("Catalog " + sSourceCatalog
                              + " could not be selected in the target database");

                        sSourceCatalog = null;
                    }
                }

                iSelectionStep++;

                ProcessNextStep();

                return false;
            }
        } catch (Exception exp) {
            lTable.removeAll();
            trace("Exception reading catalog: " + exp);
            exp.printStackTrace();
        }

        return (lTable.getItemCount() > 0);
    }
 
Example 18
Project: dev-courses   File: Transfer.java   View Source Code Vote up 5 votes
private boolean CatalogToSelect() {

        Vector result = null;

        try {
            lTable.removeAll();

            if (iSelectionStep == Transfer.SELECT_SOURCE_CATALOG) {
                result = sourceDb.getCatalog();
            } else if (iSelectionStep == Transfer.SELECT_DEST_CATALOG) {
                result = targetDb.getCatalog();
            } else {
                exit();
            }

            if (result.size() > 1) {
                lTable.setMultipleMode(true);

                if (iSelectionStep == Transfer.SELECT_SOURCE_CATALOG) {
                    bStart.setLabel("Select Catalog: Source");
                } else {
                    bStart.setLabel("Select Catalog: Destination");
                }

                bStart.invalidate();
                bStart.setEnabled(true);

                for (Enumeration e =
                        result.elements(); e.hasMoreElements(); ) {
                    lTable.add(e.nextElement().toString());
                }

                lTable.repaint();
                trace("Select correct Catalog");
            } else {
                if (result.size() == 1) {
                    if (iSelectionStep == Transfer.SELECT_SOURCE_CATALOG) {
                        sSourceCatalog = (String) result.firstElement();
                        sSourceSchemas = null;
                    } else {
                        sDestCatalog = (String) result.firstElement();
                        sDestSchema  = null;
                    }
                } else {
                    if (iSelectionStep == Transfer.SELECT_SOURCE_CATALOG) {
                        sSourceCatalog = null;
                        sSourceSchemas = null;
                    } else {
                        sDestCatalog = null;
                        sDestSchema  = null;
                    }
                }

                if ((iSelectionStep == Transfer.SELECT_DEST_CATALOG)
                        && (sDestCatalog != null)) {
                    try {
                        targetDb.setCatalog(sDestCatalog);
                    } catch (Exception ex) {
                        trace("Catalog " + sSourceCatalog
                              + " could not be selected in the target database");

                        sSourceCatalog = null;
                    }
                }

                iSelectionStep++;

                ProcessNextStep();

                return false;
            }
        } catch (Exception exp) {
            lTable.removeAll();
            trace("Exception reading catalog: " + exp);
            exp.printStackTrace();
        }

        return (lTable.getItemCount() > 0);
    }
 
Example 19
Project: unitimes   File: Assignment.java   View Source Code Vote up 5 votes
public TimetableInfo getConstraintInfo(String name) {
	Vector infos = getConstraintInfos(name);
	if (infos==null || infos.isEmpty()) return null;
	return (TimetableInfo)infos.firstElement();
}
 
Example 20
Project: parabuild-ci   File: Transfer.java   View Source Code Vote up 5 votes
private boolean SchemaToSelect() {

        Vector result = null;

        try {
            lTable.removeAll();

            if (iSelectionStep == Transfer.SELECT_SOURCE_SCHEMA) {
                result = sourceDb.getSchemas();
            } else if (iSelectionStep == Transfer.SELECT_DEST_SCHEMA) {
                result = targetDb.getSchemas();
            } else {
                exit();
            }

            if (result.size() > 1) {
                lTable.setMultipleMode(true);

                if (iSelectionStep == Transfer.SELECT_SOURCE_SCHEMA) {
                    bStart.setLabel("Select Schema: Source");
                } else {
                    bStart.setLabel("Select Schema: Destination");
                }

                bStart.invalidate();
                bStart.setEnabled(true);

                for (Enumeration e =
                        result.elements(); e.hasMoreElements(); ) {
                    lTable.add(e.nextElement().toString());
                }

                lTable.repaint();
                trace("Select correct Schema or load Settings file");
            } else {
                if (result.size() == 1) {
                    if (iSelectionStep == Transfer.SELECT_SOURCE_SCHEMA) {
                        sSourceSchemas    = new String[1];
                        sSourceSchemas[0] = (String) result.firstElement();
                    } else {
                        sDestSchema = (String) result.firstElement();
                    }
                } else {
                    if (iSelectionStep == Transfer.SELECT_SOURCE_SCHEMA) {
                        sSourceSchemas = null;
                    } else {
                        sDestSchema = null;
                    }
                }

                if (iTransferMode == TRFM_DUMP) {
                    iSelectionStep = Transfer.SELECT_SOURCE_TABLES;
                } else {
                    iSelectionStep++;
                }

                ProcessNextStep();

                return false;
            }
        } catch (Exception exp) {
            lTable.removeAll();
            trace("Exception reading schemas: " + exp);
            exp.printStackTrace();
        }

        return (lTable.getItemCount() > 0);
    }