本文整理汇总了Java中java.util.Vector.insertElementAt方法的典型用法代码示例。如果您正苦于以下问题:Java Vector.insertElementAt方法的具体用法?Java Vector.insertElementAt怎么用?Java Vector.insertElementAt使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类java.util.Vector
的用法示例。
在下文中一共展示了Vector.insertElementAt方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getTableDataAsObjectVector
import java.util.Vector; //导入方法依赖的package包/类
/**
* Converts the table data to a Vector of Object Vectors
* @param addHeaders If true, an additional vector containing the column headers will be added
* @param isTimeSeriesData If true, the first column is interpreted as timestamps and converted to a time format
* @return The table data as a Vector of Object Vectors
*/
public Vector<Vector<Object>> getTableDataAsObjectVector(boolean addHeaders, boolean isTimeSeriesData){
Vector<Vector<Object>> dataVector = new Vector<Vector<Object>>();
DateFormat dateFormat = new SimpleDateFormat("dd.MM.yyyy HH:mm:ss");
if(addHeaders == true){
dataVector.addElement(new Vector<Object>(Arrays.asList(columnTitles.toArray())));
}
Collection<Vector<Number>> treeMapData = this.getTableModelDataVector().getKeyRowVectorTreeMap().values();
for(Vector<Number> numberVector : treeMapData){
Vector<Object> objectVector = new Vector<Object>(Arrays.asList(numberVector.toArray()));
if(isTimeSeriesData == true){
long timestamp = (long) objectVector.get(0);
String dateTime = dateFormat.format(new Date(timestamp));
objectVector.remove(0);
objectVector.insertElementAt(dateTime, 0);
}
dataVector.addElement(objectVector);
}
return dataVector;
}
示例2: orderByX
import java.util.Vector; //导入方法依赖的package包/类
/**
* This function return a vector that contains the same point of the parameter one but
* the points are ordered from the point with the biggest X to the point with the smallest X
* @param v The vector to order
* @return The vector ordered
*/
private Vector<Point2D> orderByX(Vector<Point2D> v) {
Vector<Point2D> r = (Vector<Point2D>) v.clone();
boolean again = true;
while (again) {
again = false;
for (int k = 0; k < r.size() - 1; k++) {
//Take the points
Point2D p1 = r.get(k);
Point2D p2 = r.get(k + 1);
if (p1.getX() < p2.getX()) {
//swap
r.remove(k);
r.insertElementAt(p2, k);
r.remove(k + 1);
r.insertElementAt(p1, k + 1);
again = true;
}
}
}
return r;
}
示例3: loadState
import java.util.Vector; //导入方法依赖的package包/类
/**
* @see ring.gui.context.UIState#loadState()
*/
public void loadState() {
init();
executed = new Vector();
executed.insertElementAt(new Boolean(true),frame);
executed.insertElementAt(new Boolean(false),frame+1);
frame++;
lastCommand = frame;
algorithmFinished = false;
this.execThread = new Thread(new AlgorithmExecutionThread(algName,graph,animationView.getWorkspace(),this));
graph.addGraphObserver(this);
animationView.refresh();
execThread.start();
}
示例4: getOrderedDescriptions
import java.util.Vector; //导入方法依赖的package包/类
private Vector getOrderedDescriptions(String repositoryID,
com.sun.org.omg.SendingContext.CodeBase sender) {
Vector descs = new Vector();
if (sender == null) {
return descs;
}
FullValueDescription aFVD = sender.meta(repositoryID);
while (aFVD != null) {
descs.insertElementAt(aFVD, 0);
if ((aFVD.base_value != null) && !kEmptyStr.equals(aFVD.base_value)) {
aFVD = sender.meta(aFVD.base_value);
}
else return descs;
}
return descs;
}
示例5: updateTable
import java.util.Vector; //导入方法依赖的package包/类
private void updateTable(Iterator iterator) {
int rowCount = dftm.getRowCount();
for (int i = 0; i < rowCount; i++) {
dftm.removeRow(0);
}
while (iterator.hasNext()) {
Vector vector = new Vector();
List view = (List) iterator.next();
Vector row=new Vector(view);
int rowSize = row.size();
for(int i=rowSize-2;i<rowSize;i++){
Object colValue = row.get(i);
row.remove(i);
row.insertElementAt(colValue, 2);
}
vector.addAll(row);
dftm.addRow(vector);
}
}
示例6: orderByX
import java.util.Vector; //导入方法依赖的package包/类
/**
* This function return a vector that contains the same point of the parameter one but
* the points are orderet from the point whith the biggest X to the point whith the smallest X
* @param v The vector to order
* @return The vector ordered
*/
private Vector<Point2D> orderByX(Vector<Point2D> v) {
Vector<Point2D> r = (Vector<Point2D>) v.clone();
boolean again = true;
while (again) {
again = false;
for (int k = 0; k < r.size() - 1; k++) {
//Take the points
Point2D p1 = r.get(k);
Point2D p2 = r.get(k + 1);
if (p1.getX() < p2.getX()) {
//swap
r.remove(k);
r.insertElementAt(p2, k);
r.remove(k + 1);
r.insertElementAt(p1, k + 1);
again = true;
}
}
}
return r;
}
示例7: getDn
import java.util.Vector; //导入方法依赖的package包/类
Vector<Rdn> getDn() throws InvalidNameException {
cur = 0;
Vector<Rdn> rdns = new Vector<>(len / 3 + 10); // leave room for growth
if (len == 0) {
return rdns;
}
rdns.addElement(parseRdn());
while (cur < len) {
if (chars[cur] == ',' || chars[cur] == ';') {
++cur;
rdns.insertElementAt(parseRdn(), 0);
} else {
throw new InvalidNameException("Invalid name: " + name);
}
}
return rdns;
}
示例8: getCourseNbrs
import java.util.Vector; //导入方法依赖的package包/类
public Collection getCourseNbrs(int idx) {
Vector ret = new Vector();
boolean contains = false;
if (getSubjectArea(idx)>=0) {
for (Iterator i= new CourseOfferingDAO().
getSession().
createQuery("select co.uniqueId, co.courseNbr, co.title from CourseOffering co "+
"where co.subjectArea.uniqueId = :subjectAreaId "+
"and co.instructionalOffering.notOffered = false "+
"order by co.courseNbr ").
setFetchSize(200).
setCacheable(true).
setLong("subjectAreaId", getSubjectArea(idx)).iterate();i.hasNext();) {
Object[] o = (Object[])i.next();
ret.add(new IdValue((Long)o[0],((String)o[1] + " - " + (String)o[2])));
if (o[0].equals(getCourseNbr(idx))) contains = true;
}
}
if (!contains) setCourseNbr(idx, -1L);
if (ret.size()==1) setCourseNbr(idx, ((IdValue)ret.firstElement()).getId());
else ret.insertElementAt(new IdValue(-1L,"-"), 0);
return ret;
}
示例9: getData
import java.util.Vector; //导入方法依赖的package包/类
/**
* Collect and sort data fields for a ValueType.
* Sort in Java (not IDL) Unicode name string lexicographic increasing
* order.
* Non-static, non-transient fields are mapped.
* If the type is a custom valuetype, only public fields are mapped.
* @param t The current CompoundType
* @return Vector containing the data fields
*/
protected Vector getData(
CompoundType t ) {
Vector vec = new Vector();
if ( t.getTypeCode() != TYPE_VALUE ) return vec;
ValueType vt = (ValueType)t;
CompoundType.Member[] mems = vt.getMembers();
boolean notCust = !vt.isCustom();
for ( int i1 = 0; i1 < mems.length; i1++ ) { //forall members
if ( !mems[i1].isStatic() &&
!mems[i1].isTransient() &&
( mems[i1].isPublic() || notCust ) ) {
int i2;
String memName = mems[i1].getName();
for ( i2 = 0; i2 < vec.size(); i2++ ) { //insert in java lex order
CompoundType.Member aMem = (CompoundType.Member)vec.elementAt( i2 );
if ( memName.compareTo( aMem.getName() ) < 0 ) break;
}
vec.insertElementAt( mems[i1],i2 ); //insert this one
}
}
return vec;
}
示例10: getCourseNbrs
import java.util.Vector; //导入方法依赖的package包/类
public Collection getCourseNbrs(int idx) {
Vector ret = new Vector();
boolean contains = false;
if (getSubjectArea(idx)>=0) {
for (Iterator i= new CourseOfferingDAO().
getSession().
createQuery("select co.uniqueId, co.courseNbr, co.title from CourseOffering co "+
"where co.subjectArea.uniqueId = :subjectAreaId "+
"and co.instructionalOffering.notOffered = false "+
"order by co.courseNbr ").
setFetchSize(200).
setCacheable(true).
setLong("subjectAreaId", getSubjectArea(idx)).iterate();i.hasNext();) {
Object[] o = (Object[])i.next();
ret.add(new IdValue((Long)o[0],((String)o[1]) + " - " + (String) o[2]));
if (o[0].equals(getCourseNbr(idx))) contains = true;
}
}
if (!contains) setCourseNbr(idx, -1L);
if (ret.size()==1) setCourseNbr(idx, ((IdValue)ret.firstElement()).getId());
else ret.insertElementAt(new IdValue(-1L,"-"), 0);
return ret;
}
示例11: getExams
import java.util.Vector; //导入方法依赖的package包/类
public Collection getExams(int idx) {
Vector ret = new Vector();
boolean contains = false;
if (getCourseNbr(idx)>=0) {
TreeSet exams = new TreeSet(Exam.findExamsOfCourseOffering(getCourseNbr(idx),getExamType()));
for (Iterator i=exams.iterator();i.hasNext();) {
Exam exam = (Exam)i.next();
ret.add(new IdValue(exam.getUniqueId(),exam.getLabel()));
if (exam.getUniqueId().equals(getExam(idx))) contains = true;
}
}
if (!contains) setExam(idx, -1L);
if (ret.size()==1) setCourseNbr(idx, ((IdValue)ret.firstElement()).getId());
else ret.insertElementAt(new IdValue(-1L,"-"), 0);
return ret;
}
示例12: reverse
import java.util.Vector; //导入方法依赖的package包/类
/**
* Reverse the order of the vertices that define a contour
*/
public void reverse() {
/* Add vertices in reverse order */
Vector<Vertex> vertices = getVertices();
int size = vertices.size();
for (int i = 1; i < size; i++) {
vertices.insertElementAt(vertices.elementAt(i), 0);
vertices.removeElementAt(i + 1);
}
}
示例13: buildMenuElementArray
import java.util.Vector; //导入方法依赖的package包/类
private String buildMenuElementArray(JMenuItem leaf) {
Vector<JMenuItem> elements = new Vector<JMenuItem>();
elements.insertElementAt(leaf, 0);
Component current = leaf.getParent();
while (current != null) {
if (current instanceof JPopupMenu) {
JPopupMenu pop = (JPopupMenu) current;
current = pop.getInvoker();
} else if (current instanceof JMenu) {
JMenu menu = (JMenu) current;
elements.insertElementAt(menu, 0);
current = menu.getParent();
} else if (current instanceof JMenuBar) {
break;
} else {
current = current.getParent();
}
}
mainMenu = elements.get(0);
JMenuItem parent = null;
StringBuilder sb = new StringBuilder();
RComponentFactory finder = new RComponentFactory(omapConfig);
for (JMenuItem jMenuItem : elements) {
RComponent rComponent = finder.findRComponent(jMenuItem, null, recorder);
recorder.recordMenuItem(rComponent);
String text = JMenuItemJavaElement.getText(JMenuItemJavaElement.getItemText(jMenuItem), jMenuItem,
parent == null ? new Component[0] : ((JMenu) parent).getMenuComponents());
parent = jMenuItem;
sb.append(text).append(">>");
}
sb.setLength(sb.length() - 2);
return sb.toString();
}
示例14: getSelRows
import java.util.Vector; //导入方法依赖的package包/类
private Row[] getSelRows(Qualifier clasificator) {
final Enumeration e = params.keys();
Vector v = new Vector();
final String base = params.get("base");
if (base == null) {
while (e.hasMoreElements()) {
final Object key = e.nextElement();
final GlobalId id = GlobalId.convert(key.toString());
if (id != null) {
if (!params.get(key).equals("")) {
final Row r = dataPlugin.findRowByGlobalId(id);
if (r != null)
v.add(r);
}
}
}
final Vector rec = dataPlugin.getRecChildren(clasificator);
final Vector res = new Vector();
Object tmp;
for (int i = 0; i < rec.size(); i++)
if (v.indexOf(tmp = rec.get(i)) >= 0)
res.add(tmp);
v = res;
} else {
try {
final Row row = dataPlugin.findRowByGlobalId(GlobalId
.convert(base));
v = dataPlugin.getRecChilds(row, true);
v.insertElementAt(row, 0);
} catch (final Exception ex) {
}
}
final Row[] rows = new Row[v.size()];
for (int i = 0; i < rows.length; i++)
rows[i] = (Row) v.get(i);
return rows;
}
示例15: X509Name
import java.util.Vector; //导入方法依赖的package包/类
/**
* Takes an X509 dir name as a string of the format "C=AU, ST=Victoria", or
* some such, converting it into an ordered set of name attributes. lookUp
* should provide a table of lookups, indexed by lowercase only strings and
* yielding a ASN1ObjectIdentifier, other than that OID. and numeric oids
* will be processed automatically. The passed in converter is used to convert the
* string values to the right of each equals sign to their ASN.1 counterparts.
* <br>
* @param reverse true if we should start scanning from the end, false otherwise.
* @param lookUp table of names and oids.
* @param dirName the string dirName
* @param converter the converter to convert string values into their ASN.1 equivalents
*/
public X509Name(
boolean reverse,
Hashtable lookUp,
String dirName,
X509NameEntryConverter converter)
{
this.converter = converter;
X509NameTokenizer nTok = new X509NameTokenizer(dirName);
while (nTok.hasMoreTokens())
{
String token = nTok.nextToken();
if (token.indexOf('+') > 0)
{
X509NameTokenizer pTok = new X509NameTokenizer(token, '+');
addEntry(lookUp, pTok.nextToken(), FALSE);
while (pTok.hasMoreTokens())
{
addEntry(lookUp, pTok.nextToken(), TRUE);
}
}
else
{
addEntry(lookUp, token, FALSE);
}
}
if (reverse)
{
Vector o = new Vector();
Vector v = new Vector();
Vector a = new Vector();
int count = 1;
for (int i = 0; i < this.ordering.size(); i++)
{
if (((Boolean)this.added.elementAt(i)).booleanValue())
{
o.insertElementAt(this.ordering.elementAt(i), count);
v.insertElementAt(this.values.elementAt(i), count);
a.insertElementAt(this.added.elementAt(i), count);
count++;
}
else
{
o.insertElementAt(this.ordering.elementAt(i), 0);
v.insertElementAt(this.values.elementAt(i), 0);
a.insertElementAt(this.added.elementAt(i), 0);
count = 1;
}
}
this.ordering = o;
this.values = v;
this.added = a;
}
}