当前位置: 首页>>代码示例>>Java>>正文


Java Vector.addElement方法代码示例

本文整理汇总了Java中java.util.Vector.addElement方法的典型用法代码示例。如果您正苦于以下问题:Java Vector.addElement方法的具体用法?Java Vector.addElement怎么用?Java Vector.addElement使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在java.util.Vector的用法示例。


在下文中一共展示了Vector.addElement方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: generateOcts

import java.util.Vector; //导入方法依赖的package包/类
private Vector generateOcts()
{ 
    Vector vec = new Vector();
    for (int i = 0; i < string.length; i += MAX_LENGTH) 
    { 
        int end; 

        if (i + MAX_LENGTH > string.length) 
        { 
            end = string.length; 
        } 
        else 
        { 
            end = i + MAX_LENGTH; 
        } 

        byte[] nStr = new byte[end - i]; 

        System.arraycopy(string, i, nStr, 0, nStr.length);

        vec.addElement(new DEROctetString(nStr));
     } 
    
     return vec; 
}
 
开发者ID:Appdome,项目名称:ipack,代码行数:26,代码来源:BEROctetString.java

示例2: getCleanMessages

import java.util.Vector; //导入方法依赖的package包/类
public static Vector getCleanMessages(Vector messages, String messageId)
    throws ProtocolException {
  if (messages == null || messageId == null) {
    return messages;
  }
  Vector cleanMessages = new Vector();
  Enumeration en = messages.elements();
  while (en.hasMoreElements()) {
    String msg = (String) en.nextElement();
    MessageHeader hd = new MessageHeader(msg);
    if (messageId.equals(hd.getMessageId())) {
      cleanMessages.addElement(msg);
    }
  }
  return cleanMessages;
}
 
开发者ID:logistimo,项目名称:logistimo-web-service,代码行数:17,代码来源:MessageUtil.java

示例3: testFirstAndNext

import java.util.Vector; //导入方法依赖的package包/类
private Vector testFirstAndNext(BreakIterator bi, String text) {
    int p = bi.first();
    int lastP = p;
    Vector<String> result = new Vector<String>();

    if (p != 0)
        errln("first() returned " + p + " instead of 0");
    while (p != BreakIterator.DONE) {
        p = bi.next();
        if (p != BreakIterator.DONE) {
            if (p <= lastP)
                errln("next() failed to move forward: next() on position "
                                + lastP + " yielded " + p);

            result.addElement(text.substring(lastP, p));
        }
        else {
            if (lastP != text.length())
                errln("next() returned DONE prematurely: offset was "
                                + lastP + " instead of " + text.length());
        }
        lastP = p;
    }
    return result;
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:26,代码来源:BreakIteratorTest.java

示例4: getTargetFormats

import java.util.Vector; //导入方法依赖的package包/类
/**
 */
public AudioFormat[] getTargetFormats(AudioFormat.Encoding targetEncoding, AudioFormat sourceFormat){

    // filter out targetEncoding from the old getOutputFormats( sourceFormat ) method

    AudioFormat[] formats = getOutputFormats( sourceFormat );
    Vector newFormats = new Vector();
    for(int i=0; i<formats.length; i++ ) {
        if( formats[i].getEncoding().equals( targetEncoding ) ) {
            newFormats.addElement( formats[i] );
        }
    }

    AudioFormat[] formatArray = new AudioFormat[newFormats.size()];

    for (int i = 0; i < formatArray.length; i++) {
        formatArray[i] = (AudioFormat)(newFormats.elementAt(i));
    }

    return formatArray;
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:23,代码来源:PCMtoPCMCodec.java

示例5: addFun

import java.util.Vector; //导入方法依赖的package包/类
private static void addFun(String name, String cspec,
	Vector sha3classes)
{
	int n = cspec.indexOf(',');
	if (n < 0) {
		NAME_TO_CLASSNAMES.put(name, cspec);
		ORDERED_CLASSNAMES.addElement(cspec);
	} else {
		String base = cspec.substring(0, n);
		NAME_TO_CLASSNAMES.put(name + "224", base + "224");
		ORDERED_CLASSNAMES.addElement(base + "224");
		NAME_TO_CLASSNAMES.put(name + "256", base + "256");
		ORDERED_CLASSNAMES.addElement(base + "256");
		NAME_TO_CLASSNAMES.put(name + "384", base + "384");
		ORDERED_CLASSNAMES.addElement(base + "384");
		NAME_TO_CLASSNAMES.put(name + "512", base + "512");
		ORDERED_CLASSNAMES.addElement(base + "512");
		int len = cspec.length();
		StringBuffer sb = new StringBuffer();
		n ++;
		while (n < len) {
			int p = cspec.indexOf(',', n);
			if (p < 0)
				p = len;
			String suffix = cspec.substring(n, p);
			if (sb.length() > 0)
				sb.append(',');
			String cname = base + suffix;
			sb.append(cname);
			if (sha3classes != null)
				sha3classes.addElement(cname);
			n = p + 1;
		}
		String ac = sb.toString();
		NAME_TO_CLASSNAMES.put(name, ac);
	}
}
 
开发者ID:muhatzg,项目名称:burstcoin,代码行数:38,代码来源:Speed.java

示例6: addSubclassInstances

import java.util.Vector; //导入方法依赖的package包/类
private void addSubclassInstances(Vector<JavaHeapObject> v) {
    for (int i = 0; i < subclasses.length; i++) {
        subclasses[i].addSubclassInstances(v);
    }
    for (int i = 0; i < instances.size(); i++) {
        v.addElement(instances.elementAt(i));
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:9,代码来源:JavaClass.java

示例7: getArguments

import java.util.Vector; //导入方法依赖的package包/类
/**
 * Get arguments
 */
public Vector getArguments() {
    if (isConstructor() && (getClassDefinition().getSuperClass() == null)) {
        Vector v = new Vector();
        v.addElement(new LocalMember(0, getClassDefinition(), 0,
                                    getClassDefinition().getType(), idThis));
        return v;
    }
    return null;
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:13,代码来源:BinaryMember.java

示例8: ConjQuery

import java.util.Vector; //导入方法依赖的package包/类
final public QueryNode ConjQuery(CharSequence field) throws ParseException {
QueryNode first, c;
Vector<QueryNode> clauses = null;
  first = ModClause(field);
  label_3:
  while (true) {
    switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
    case AND:
      ;
      break;
    default:
      jj_la1[6] = jj_gen;
      break label_3;
    }
    jj_consume_token(AND);
    c = ModClause(field);
   if (clauses == null) {
       clauses = new Vector<>();
       clauses.addElement(first);
   }
   clauses.addElement(c);
  }
  if (clauses != null) {
    {if (true) return new AndQueryNode(clauses);}
  } else {
      {if (true) return first;}
  }
  throw new Error("Missing return statement in function");
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:30,代码来源:StandardSyntaxParser.java

示例9: getAllTables

import java.util.Vector; //导入方法依赖的package包/类
private Vector getAllTables() {

        Vector result = new Vector(20);

        try {
            if (cConn == null) {
                return null;
            }

            dbmeta = cConn.getMetaData();

            String[] tableTypes = { "TABLE" };
            ResultSet allTables = dbmeta.getTables(null, null, null,
                                                   tableTypes);

            while (allTables.next()) {
                String aktTable = allTables.getString("TABLE_NAME");
                ResultSet primKeys = dbmeta.getPrimaryKeys(null, null,
                    aktTable);

                // take only table with a primary key
                if (primKeys.next()) {
                    result.addElement(aktTable);
                }

                primKeys.close();
            }

            allTables.close();
        } catch (SQLException e) {

            // System.out.println("SQL Exception: " + e.getMessage());
        }

        return result;
    }
 
开发者ID:s-store,项目名称:s-store,代码行数:37,代码来源:ZaurusEditor.java

示例10: contextReturn

import java.util.Vector; //导入方法依赖的package包/类
public void contextReturn(Algorithm alg)
{
    Vector<Command> oldCommands = commandsStack.pop();
    oldCommands.addElement(alg);
    commands = oldCommands;
    currentCommand = commands.size() - 1;
}
 
开发者ID:guilhebl,项目名称:routerapp,代码行数:8,代码来源:Graph.java

示例11: addReference

import java.util.Vector; //导入方法依赖的package包/类
/**
 * Adds a further ontoReference as start argument to the vector of start arguments.
 *
 * @param agentReference the agent reference
 * @param ontoReference the onto reference
 * @return the index position of the new element
 */
public int addReference(String agentReference, String ontoReference) {
	
	if (ontoReference==null) return -1;
	
	Vector<AgentStartArgument> argumentVector = this.get(agentReference);
	if (argumentVector==null) {
		argumentVector = new Vector<AgentStartArgument>();
		this.put(agentReference, argumentVector);
	}
	AgentStartArgument agentStartArgument = new AgentStartArgument(argumentVector.size()+1, ontoReference);
	argumentVector.addElement(agentStartArgument);
	return argumentVector.size()-1;
}
 
开发者ID:EnFlexIT,项目名称:AgentWorkbench,代码行数:21,代码来源:AgentStartConfiguration.java

示例12: addGateListener

import java.util.Vector; //导入方法依赖的package包/类
@Override
public synchronized void addGateListener(GateListener l) {
  @SuppressWarnings("unchecked")
  Vector<GateListener> v = gateListeners == null ? new Vector<GateListener>(2) : (Vector<GateListener>)gateListeners
          .clone();
  if(!v.contains(l)) {
    v.addElement(l);
    gateListeners = v;
  }
}
 
开发者ID:GateNLP,项目名称:gate-core,代码行数:11,代码来源:AnnotationSetImpl.java

示例13: getDOMImplementationList

import java.util.Vector; //导入方法依赖的package包/类
/**
 * Return a list of implementations that support the
 * desired features.
 *
 * @param features
 *            A string that specifies which features are required. This is
 *            a space separated list in which each feature is specified by
 *            its name optionally followed by a space and a version number.
 *            This is something like: "XML 1.0 Traversal +Events 2.0"
 * @return A list of DOMImplementations that support the desired features.
 */
public DOMImplementationList getDOMImplementationList(final String features) {
    final Vector implementations = new Vector();
    int size = sources.size();
    for (int i = 0; i < size; i++) {
        DOMImplementationSource source =
            (DOMImplementationSource) sources.elementAt(i);
        DOMImplementationList impls =
            source.getDOMImplementationList(features);
        for (int j = 0; j < impls.getLength(); j++) {
            DOMImplementation impl = impls.item(j);
            implementations.addElement(impl);
        }
    }
    return new DOMImplementationList() {
            public DOMImplementation item(final int index) {
                if (index >= 0 && index < implementations.size()) {
                    try {
                        return (DOMImplementation)
                            implementations.elementAt(index);
                    } catch (ArrayIndexOutOfBoundsException e) {
                        return null;
                    }
                }
                return null;
            }

            public int getLength() {
                return implementations.size();
            }
        };
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:43,代码来源:DOMImplementationRegistry.java

示例14: insert

import java.util.Vector; //导入方法依赖的package包/类
/**
 * Inserts the specified component into the menu at a given
 * position.
 *
 * @param component  the <code>Component</code> to insert
 * @param index      specifies the position at which
 *                   to insert the component, where 0 is the first
 * @exception IllegalArgumentException if <code>index</code> &lt; 0
 */
public void insert(Component component, int index) {
    if (index < 0) {
        throw new IllegalArgumentException("index less than zero.");
    }

    int nitems = getComponentCount();
    // PENDING(ges): Why not use an array?
    Vector<Component> tempItems = new Vector<Component>();

    /* Remove the item at index, nitems-index times
       storing them in a temporary vector in the
       order they appear on the menu.
       */
    for (int i = index ; i < nitems; i++) {
        tempItems.addElement(getComponent(index));
        remove(index);
    }

    add(component);

    /* Add the removed items back to the menu, they are
       already in the correct order in the temp vector.
       */
    for (Component tempItem : tempItems) {
        add(tempItem);
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:37,代码来源:JPopupMenu.java

示例15: testSpeed

import java.util.Vector; //导入方法依赖的package包/类
public void testSpeed() {

        randomGenerator = new Random(System.currentTimeMillis());

        int           TEST_RUNS     = 100000;
        int           LOOP_COUNT    = 1000;
        HsqlArrayList arrayList     = new HsqlArrayList(TEST_RUNS);
        ArrayList     utilArrayList = new ArrayList(TEST_RUNS);
        Vector        vector        = new Vector(TEST_RUNS);
        Integer       value         = new Integer(randomGenerator.nextInt());
        Integer       INT_0         = new Integer(0);
        StopWatch     sw            = new StopWatch();

        System.out.println(sw.currentElapsedTimeToMessage("time"));

        for (int i = 0; i < TEST_RUNS; i++) {
            arrayList.add(INT_0);
        }

        for (int i = 0; i < TEST_RUNS; i++) {
            for (int j = 0; j < LOOP_COUNT; j++) {
                arrayList.set(i, INT_0);
            }
        }

        System.out.println(
            sw.currentElapsedTimeToMessage("time HsqlArrayLsit"));
        sw.zero();

        for (int i = 0; i < TEST_RUNS; i++) {
            utilArrayList.add(INT_0);
        }

        for (int i = 0; i < TEST_RUNS; i++) {
            for (int j = 0; j < LOOP_COUNT; j++) {
                utilArrayList.set(i, INT_0);
            }
        }

        System.out.println(sw.currentElapsedTimeToMessage("time ArrayList"));
        sw.zero();

        for (int i = 0; i < TEST_RUNS; i++) {
            vector.addElement(INT_0);
        }

        for (int i = 0; i < TEST_RUNS; i++) {
            for (int j = 0; j < LOOP_COUNT; j++) {
                vector.setElementAt(INT_0, i);
            }
        }

        System.out.println(sw.currentElapsedTimeToMessage("time Vector"));
    }
 
开发者ID:Julien35,项目名称:dev-courses,代码行数:55,代码来源:TestDataStructures.java


注:本文中的java.util.Vector.addElement方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。