本文整理汇总了Java中java.util.Vector.firstElement方法的典型用法代码示例。如果您正苦于以下问题:Java Vector.firstElement方法的具体用法?Java Vector.firstElement怎么用?Java Vector.firstElement使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类java.util.Vector
的用法示例。
在下文中一共展示了Vector.firstElement方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getCredFromSubject
import java.util.Vector; //导入方法依赖的package包/类
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;
}
示例2: getCredFromSubject
import java.util.Vector; //导入方法依赖的package包/类
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;
}
示例3: getBalance
import java.util.Vector; //导入方法依赖的package包/类
@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;
}
示例4: main
import java.util.Vector; //导入方法依赖的package包/类
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);
}
示例5: confirmOrderBtnPressed
import java.util.Vector; //导入方法依赖的package包/类
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));
}
}
示例6: main
import java.util.Vector; //导入方法依赖的package包/类
public static void main(String[] args) {
try {
Vector v = new Vector();
v.removeAllElements();
v.firstElement();
} catch (Exception e) {
e.printStackTrace();
}
}
示例7: getCharOrder
import java.util.Vector; //导入方法依赖的package包/类
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;
}
示例8: CatalogToSelect
import java.util.Vector; //导入方法依赖的package包/类
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);
}
示例9: nextContractChar
import java.util.Vector; //导入方法依赖的package包/类
/**
* 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;
}
示例10: SchemaToSelect
import java.util.Vector; //导入方法依赖的package包/类
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);
}
示例11: getConstraintInfo
import java.util.Vector; //导入方法依赖的package包/类
public TimetableInfo getConstraintInfo(String name) {
Vector infos = getConstraintInfos(name);
if (infos==null || infos.isEmpty()) return null;
return (TimetableInfo)infos.firstElement();
}