當前位置: 首頁>>代碼示例>>Java>>正文


Java Vector.add方法代碼示例

本文整理匯總了Java中java.util.Vector.add方法的典型用法代碼示例。如果您正苦於以下問題:Java Vector.add方法的具體用法?Java Vector.add怎麽用?Java Vector.add使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在java.util.Vector的用法示例。


在下文中一共展示了Vector.add方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: getAllResources

import java.util.Vector; //導入方法依賴的package包/類
/**
 * List of all resources
 * @return Vector
 */
public Vector getAllResources() {
    Vector v = new Vector();
    Elements rs = _root.getChildElements("resource");
    for (int i = 0; i < rs.size(); i++)
        v.add(new Resource(rs.get(i).getAttribute("path").getValue(), rs.get(i).getAttribute("isInetShortcut") != null, rs.get(i).getAttribute("isProjectFile") != null));
    return v;
}
 
開發者ID:ser316asu,項目名稱:SER316-Dresden,代碼行數:12,代碼來源:ResourcesListImpl.java

示例2: getActiveProjects

import java.util.Vector; //導入方法依賴的package包/類
public static Vector getActiveProjects() {
    Elements prjs = _root.getChildElements("project");
    Vector v = new Vector();
    for (int i = 0; i < prjs.size(); i++) {
        Project prj = new ProjectImpl((Element) prjs.get(i));
        if (prj.getStatus() == Project.ACTIVE)
            v.add(prj);
    }
    return v;
}
 
開發者ID:ser316asu,項目名稱:Neukoelln_SER316,代碼行數:11,代碼來源:ProjectManager.java

示例3: getExtensions

import java.util.Vector; //導入方法依賴的package包/類
public String[] getExtensions() {
    Vector v = new Vector();
    String[] ss = {};
    Elements exts = _root.getChildElements("ext");
    for (int i = 0; i < exts.size(); i++)
        v.add(exts.get(i).getValue());
    return (String[]) v.toArray(ss);
}
 
開發者ID:ser316asu,項目名稱:Reinickendorf_SER316,代碼行數:9,代碼來源:MimeType.java

示例4: updateButtons

import java.util.Vector; //導入方法依賴的package包/類
void updateButtons() {
	ColorComponent cc=null;
	Color col;
	if( buttonPanel==null ) {
		buttonPanel=new JPanel(new GridLayout(1,0));
		buttons = new Vector();
	}
	for( int k=0 ; k<buttons.size() ; k++) {
		cc = (ColorComponent)buttons.get(k);
		cc.removeMouseListener(buttonL);
		buttonPanel.remove(cc);
	}
	float[][] model = lut.getModel();
	float[] red = model[1];
	float[] green = model[2];
	float[] blue = model[3];
	for( int k=0 ; k<red.length ; k++) {
		col = new Color(red[k], green[k], blue[k]);
		if( k<buttons.size() ) {
			cc = (ColorComponent)buttons.get(k);
			cc.setColor(col);
		} else {
			cc = new ColorComponent(col);
			buttons.add(cc);
		}
		buttonPanel.add( cc );
		cc.addMouseListener(buttonL);
	}
	for( int k=red.length ; k<buttons.size() ; k++) {
		cc = (ColorComponent)buttons.remove(k);
	}
	buttonPanel.revalidate();
	cc = (ColorComponent)buttons.get(0);
	select(cc);
}
 
開發者ID:iedadata,項目名稱:geomapapp,代碼行數:36,代碼來源:PaletteTool.java

示例5: getMonths

import java.util.Vector; //導入方法依賴的package包/類
public Vector getMonths() {
    Vector v = new Vector();
    Elements ms = yearElement.getChildElements("month");
    for (int i = 0; i < ms.size(); i++)
        v.add(new Month(ms.get(i)));
    return v;
}
 
開發者ID:ser316asu,項目名稱:Wilmersdorf_SER316,代碼行數:8,代碼來源:NoteListImpl.java

示例6: scan

import java.util.Vector; //導入方法依賴的package包/類
/** Scans data for [] brackets and prepares data for formatting
* using MapFormat utility
*/
private Vector scan(StringTokenizer tok) throws ParseException {
    Vector objvec = new Vector();
    while (tok.hasMoreTokens()) {
        String token = (String) tok.nextElement();
        Object obj = token;
        if (token.equals("["))
            obj = (Object)scan(tok);
        else if (token.equals("]"))
            break;
        objvec.add(obj);
    }

    return objvec;
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:18,代碼來源:CommandFormatter.java

示例7: assignTileAssociationsWithinRadius

import java.util.Vector; //導入方法依賴的package包/類
private void assignTileAssociationsWithinRadius(TileAssociation s, int radius, Vector<TileAssociation> vec) {
	if (!vec.contains(s)) {
		vec.add(s);
	}
	if (radius != 0) {
		for (TileAssociation t : s.getNeighbors()) {
			assignTileAssociationsWithinRadius(t, radius-1, vec);
		}
	}
}
 
開發者ID:Team-Fourtran,項目名稱:OOPIter2,代碼行數:11,代碼來源:Radius.java

示例8: addBestGuess

import java.util.Vector; //導入方法依賴的package包/類
/**
 * When we don't come up with any suggestions (probably because the threshold was too strict),
 * then pick the best guesses from the those words that have the same phonetic code.
 * @param word - the word we are trying spell correct
 * @param Two dimensional array of int used to calculate
 * edit distance. Allocating this memory outside of the function will greatly improve efficiency.
 * @param wordList - the linked list that will get the best guess
 */
private void addBestGuess(String word, Vector<Word> wordList, int[][] matrix) {
	if(matrix == null)
		matrix = new int[0][0];

  if (wordList.size() != 0)
    throw new InvalidParameterException("the wordList vector must be empty");

  int bestScore = Integer.MAX_VALUE;

  String code = getCode(word);
  List<String> simwordlist = getWords(code);

  LinkedList<Word> candidates = new LinkedList<Word>();

  for (String similar : simwordlist) {
    int distance = EditDistance.getDistance(word, similar, matrix);
    if (distance <= bestScore) {
      bestScore = distance;
      Word goodGuess = new Word(similar, distance);
      candidates.add(goodGuess);
    }
  }

  //now, only pull out the guesses that had the best score
  for (Iterator<Word> iter = candidates.iterator(); iter.hasNext();) {
    Word candidate = iter.next();
    if (candidate.getCost() == bestScore)
      wordList.add(candidate);
  }

}
 
開發者ID:Thecarisma,項目名稱:powertext,代碼行數:40,代碼來源:SpellDictionaryASpell.java

示例9: makeSetterChange

import java.util.Vector; //導入方法依賴的package包/類
public static AtomicChange makeSetterChange(char typ, String methodQualifiedName, String fieldQualifiedName){
	Vector<String> params = new Vector<String>();
	params.add(methodQualifiedName);
	params.add(fieldQualifiedName);
	return new AtomicChange(typ=='A'?ChangeTypes.ADD_SETTER:
		ChangeTypes.DEL_SETTER, params);
}
 
開發者ID:aserg-ufmg,項目名稱:RefDiff,代碼行數:8,代碼來源:AtomicChange.java

示例10: bencodeDictionary

import java.util.Vector; //導入方法依賴的package包/類
/**
 * Bencodes a HashMap into a bencoded dictionary.The HashMap must contain
 * only bencoded strings representing bencoded integers, strings, lists, and
 * dictionaries.
 * 
 * @param input
 *            A HashMap containing bencoded objects representing the entries
 *            in a dictionary.
 * @return
 */
public byte[] bencodeDictionary(HashMap input)
{
	byte[] return_bytes = null;
	int length = 0;
	Vector dictionary_entries = new Vector();

	Iterator input_iterator = input.entrySet().iterator();

	while (input_iterator.hasNext())
	{
		Map.Entry me = (Map.Entry) input_iterator.next();
		length += ((byte[]) me.getKey()).length;
		length += ((byte[]) me.getValue()).length;
		dictionary_entries.add((byte[]) me.getKey());
		dictionary_entries.add((byte[]) me.getValue());
	}
	return_bytes = new byte[length + 2];
	return_bytes[0] = (byte) 'd';
	return_bytes[return_bytes.length - 1] = (byte) 'e';

	int index = 1;

	for (int i = 0; i < dictionary_entries.size(); i++)
	{

		for (int j = 0; j < ((byte[]) dictionary_entries.get(i)).length; j++)
		{
			return_bytes[index] = ((byte[]) dictionary_entries.get(i))[j];
			index++;
		}
	}

	return return_bytes;
}
 
開發者ID:cybershrapnel,項目名稱:nanocheeze,代碼行數:45,代碼來源:Bencoder.java

示例11: select

import java.util.Vector; //導入方法依賴的package包/類
protected void select() {
	try {
		minD = 10f*Float.parseFloat( minDep.getText() );
		maxD = 10f*Float.parseFloat( maxDep.getText() );
		minM = 10f*Float.parseFloat( minMag.getText() );
		maxM = 10f*Float.parseFloat( maxMag.getText() );
		int minY = Integer.parseInt( minYear.getText() );
		Calendar cal = Calendar.getInstance(TimeZone.getTimeZone("GMT"));
		cal.set( minY, 0, 1);
		minTime = (int)( cal.getTime().getTime()/1000L);
		int maxY = Integer.parseInt( maxYear.getText() );
		cal.set( maxY, 0, 1);
		maxTime = (int)( cal.getTime().getTime()/1000L);
		current = new Vector(earthquakes.size());
		currentIndexInEQ = new Vector(earthquakes.size());
		for( int k=0 ; k<earthquakes.size() ; k++) {
			EarthQuake eq = (EarthQuake)earthquakes.get(k);
			if( eq.time<minTime || eq.time>maxTime )continue;
			if( (float)eq.dep<minD || (float)eq.dep>maxD )continue;
			if( (float)eq.mag<minM || (float)eq.mag>maxM )continue;
			current.add( eq );
			currentIndexInEQ.add(new Integer(k));
		}
		current.trimToSize();
		currentIndexInEQ.trimToSize();
	} catch(NumberFormatException ex) {
		JOptionPane.showMessageDialog( map.getTopLevelAncestor(), "number format exception");
	}
}
 
開發者ID:iedadata,項目名稱:geomapapp,代碼行數:30,代碼來源:EQ.java

示例12: init

import java.util.Vector; //導入方法依賴的package包/類
protected void init(Vector includes, Vector defines) {
     defines.add("_DEBUG");
     defines.add("ASSERT");

     super.init(includes, defines);

     getV("CompilerFlags").addAll(getCI().getDebugCompilerFlags(getOptFlag(), get("PlatformName")));
     getV("LinkerFlags").addAll(getCI().getDebugLinkerFlags());
}
 
開發者ID:AdoptOpenJDK,項目名稱:openjdk-jdk10,代碼行數:10,代碼來源:BuildConfig.java

示例13: getDays

import java.util.Vector; //導入方法依賴的package包/類
public Vector getDays() {
    if (mElement == null)
        return null;
    Vector v = new Vector();
    Elements ds = mElement.getChildElements("day");
    for (int i = 0; i < ds.size(); i++)
        v.add(new Day(ds.get(i)));
    return v;
}
 
開發者ID:ser316asu,項目名稱:SER316-Dresden,代碼行數:10,代碼來源:NoteListImpl.java

示例14: getListPart

import java.util.Vector; //導入方法依賴的package包/類
public Vector<Vector<String>> getListPart() {
	Vector<Vector<String>> ret = new Vector<Vector<String>>();
	for (Event e: this.eventsPart) {
		Vector<String> ite = new Vector<String>();
		ite.add(Long.toString(e.getId()));
		ite.add(e.getName());
		ite.add(e.getLieu());
		ite.add(e.getDate_event().toString());
		ite.add(Integer.toString(e.getParticipants().size()));
		ite.add("?");
		
		ret.add(ite);
	}
	return ret;
}
 
開發者ID:antonin-arquey,項目名稱:polyevent,代碼行數:16,代碼來源:EventModel.java

示例15: viterbi

import java.util.Vector; //導入方法依賴的package包/類
public void viterbi(String sentence, List<String> tokens) {
    Vector<Map<Character, Double>> v = new Vector<Map<Character, Double>>();
    Map<Character, Node> path = new HashMap<Character, Node>();

    v.add(new HashMap<Character, Double>());
    for (char state : states) {
        Double emP = emit.get(state).get(sentence.charAt(0));
        if (null == emP)
            emP = MIN_FLOAT;
        v.get(0).put(state, start.get(state) + emP);
        path.put(state, new Node(state, null));
    }

    for (int i = 1; i < sentence.length(); ++i) {
        Map<Character, Double> vv = new HashMap<Character, Double>();
        v.add(vv);
        Map<Character, Node> newPath = new HashMap<Character, Node>();
        for (char y : states) {
            Double emp = emit.get(y).get(sentence.charAt(i));
            if (emp == null)
                emp = MIN_FLOAT;
            Pair<Character> candidate = null;
            for (char y0 : prevStatus.get(y)) {
                Double tranp = trans.get(y0).get(y);
                if (null == tranp)
                    tranp = MIN_FLOAT;
                tranp += (emp + v.get(i - 1).get(y0));
                if (null == candidate)
                    candidate = new Pair<Character>(y0, tranp);
                else if (candidate.freq <= tranp) {
                    candidate.freq = tranp;
                    candidate.key = y0;
                }
            }
            vv.put(y, candidate.freq);
            newPath.put(y, new Node(y, path.get(candidate.key)));
        }
        path = newPath;
    }
    double probE = v.get(sentence.length() - 1).get('E');
    double probS = v.get(sentence.length() - 1).get('S');
    Vector<Character> posList = new Vector<Character>(sentence.length());
    Node win;
    if (probE < probS)
        win = path.get('S');
    else
        win = path.get('E');

    while (win != null) {
        posList.add(win.value);
        win = win.parent;
    }
    Collections.reverse(posList);

    int begin = 0, next = 0;
    for (int i = 0; i < sentence.length(); ++i) {
        char pos = posList.get(i);
        if (pos == 'B')
            begin = i;
        else if (pos == 'E') {
            tokens.add(sentence.substring(begin, i + 1));
            next = i + 1;
        }
        else if (pos == 'S') {
            tokens.add(sentence.substring(i, i + 1));
            next = i + 1;
        }
    }
    if (next < sentence.length())
        tokens.add(sentence.substring(next));
}
 
開發者ID:zoyanhui,項目名稱:jieba4j-tag,代碼行數:72,代碼來源:FinalSeg.java


注:本文中的java.util.Vector.add方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。