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


Java Vector.trimToSize方法代码示例

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


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

示例1: initVectors

import java.util.Vector; //导入方法依赖的package包/类
public void initVectors(){
	hiddenV = new Vector<String>();
	visibleV = new Vector<String>();
	Vector<String> v = (Vector<String>) ds.header.clone();
	visibleV.add(v.get(ds.latIndex));
	visibleV.add(v.get(ds.lonIndex));
	visibleV.add(v.get(xIndex));
	visibleV.add(v.get(yIndex));
	for (int i=0;i<visibleV.size();i++)
		for (int z=0;z<v.size();z++)
			if (visibleV.get(i).equals(v.get(z)))
				v.remove(z);
	v.trimToSize();
	for (int i =0; i < v.size(); i++)
		hiddenV.add(v.get(i));
}
 
开发者ID:iedadata,项目名称:geomapapp,代码行数:17,代码来源:DBOutputConfigDialog.java

示例2: getTagListing

import java.util.Vector; //导入方法依赖的package包/类
protected static Vector getTagListing(Branch b, String path) {
    Vector vector = new Vector(10, 1000);

    Branch branchToList;
    try {
        branchToList = getBranch(b, path); //will toss a improper cast
        // thing if it goes wrong.
    } catch (NonExistantPathException ex) {
        return null;
    }
    if (branchToList == null)
        return null; //bad path

    Link.list(branchToList.head, vector);

    vector.trimToSize();
    return vector;
}
 
开发者ID:addertheblack,项目名称:myster,代码行数:19,代码来源:MML.java

示例3: getFossilGroups

import java.util.Vector; //导入方法依赖的package包/类
public Vector getFossilGroups() {
	Enumeration keys = fossilGroups.keys();
	Vector groups = new Vector(fossilGroups.size());
	while( keys.hasMoreElements() )groups.add( keys.nextElement());
	groups.trimToSize();
	return groups;
}
 
开发者ID:iedadata,项目名称:geomapapp,代码行数:8,代码来源:DSDP.java

示例4: init

import java.util.Vector; //导入方法依赖的package包/类
static void init() {
	try {
		glossary = new Vector();
		URL url = URLFactory.url( DSDP.ROOT+"fauna/glossary.gz");
		BufferedReader in = new BufferedReader(
			new InputStreamReader( 
			new GZIPInputStream( url.openStream() )));
		String s;
		while( (s=in.readLine())!=null ) glossary.add(s.getBytes());
		glossary.trimToSize();
	} catch(IOException e) {
		e.printStackTrace();
	}
}
 
开发者ID:iedadata,项目名称:geomapapp,代码行数:15,代码来源:FossilGlossary.java

示例5: init

import java.util.Vector; //导入方法依赖的package包/类
static void init() {
	try {
		glossary = new Vector();
		URL url = URLFactory.url( DSDP.ROOT+"authors.list.gz");
		BufferedReader in = new BufferedReader(
			new InputStreamReader(
			new GZIPInputStream( url.openStream() )));
		String s = in.readLine();
		while( (s=in.readLine())!=null ) glossary.add(s.getBytes());
		glossary.trimToSize();
	} catch(IOException e) {
	}
}
 
开发者ID:iedadata,项目名称:geomapapp,代码行数:14,代码来源:AuthorGlossary.java

示例6: 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

示例7: initVectors

import java.util.Vector; //导入方法依赖的package包/类
public void initVectors(){
	hiddenV = new Vector<String>();
	visibleV = new Vector<String>();
	Vector<String> v = (Vector<String>) ds.header.clone();
	for (int i = 0; i < ds.tm.indexH.size(); i++){
		String columnName = ds.header.get(ds.tm.indexH.get(i));
		if (columnName != XBTable.PLOT_COLUMN_NAME) {
			visibleV.add(columnName);
		}				
		v.remove(columnName);
	}
	v.trimToSize();
	for (int i =0; i < v.size(); i++)
		hiddenV.add(v.get(i));
}
 
开发者ID:iedadata,项目名称:geomapapp,代码行数:16,代码来源:KMLExport.java

示例8: initVectors

import java.util.Vector; //导入方法依赖的package包/类
public void initVectors(){
	hiddenV = new Vector<String>();
	visibleV = new Vector<String>();
	Vector<String> v = (Vector<String>) ds.header.clone();
	for (int i = 0; i < ds.tm.indexH.size(); i++){
		visibleV.add(ds.header.get(ds.tm.indexH.get(i)));
		v.remove(visibleV.get(visibleV.size()-1));
	}
	v.trimToSize();
	for (int i =0; i < v.size(); i++)
		hiddenV.add(v.get(i));
}
 
开发者ID:iedadata,项目名称:geomapapp,代码行数:13,代码来源:DBTableConfigDialog.java

示例9: wrap

import java.util.Vector; //导入方法依赖的package包/类
public static Vector wrap(String string, final int x, FontMetrics metrics) {
    Vector lines = new Vector(100, 100);

    StringTokenizer tokens = new StringTokenizer(string, " ", true);

    String working = "";

    String temp = "";

    //Andrew's awsome wrap system :-)
    if (tokens.hasMoreTokens()) {
        for (temp = tokens.nextToken(); true; temp = tokens.nextToken()) {
            working = doReturns(working, lines);

            //continue working on the string.
            if ((metrics.stringWidth(working + "" + temp)) >= x) {
                lines.addElement(working);
                working = "";
            }
            working = working + temp + "";
            if (!(tokens.hasMoreTokens())) {
                break;
            }
        }

        working = doReturns(working, lines);
        lines.addElement(working);
    }

    lines.trimToSize();
    return lines;
}
 
开发者ID:addertheblack,项目名称:myster,代码行数:33,代码来源:MrWrap.java

示例10: indexFiles

import java.util.Vector; //导入方法依赖的package包/类
/**
 * an internal procedure used to do the setup of file indexing. This function is only called
 * in one place at this writting.
 */
private Vector indexFiles(MysterType type, File rootdir) {
    Vector temp = new Vector(10000, 10000); // Preallocates a whole lot
    // of
    // space
    if (rootdir.exists() && rootdir.isDirectory())
        indexDir(type, rootdir, temp, 5); // Indexes root dir into temp with
    // 5 levels
    // deep.
    temp.trimToSize(); // save some space
    return temp;
}
 
开发者ID:addertheblack,项目名称:myster,代码行数:16,代码来源:FileTypeList.java

示例11: computeControl

import java.util.Vector; //导入方法依赖的package包/类
public double[][][] computeControl( MapProjection proj, double xWrap, double maxDT, double maxDX, double maxDR ) {
	toArray();
	forward(proj);
	int npt = pts.length;
	wrapX( xWrap );
	int i=0;
	Vector segs = new Vector();
	int[] seg = new int[] {0, 0};
	double test = maxDX*maxDX;
	double[] p1 = pts[0];
	while( i<pts.length-1 ) {
		double[] p2= pts[i+1];
		seg[1] = i;
		if( maxDX>0. && Math.pow(p2[0]-p1[0], 2) + Math.pow(p2[1]-p1[1], 2) >test ) {
			if(seg[0] < seg[1]) segs.add(seg);
			seg = new int[] {i+1, i+1};
		} else if( maxDT>0. && p1.length>2 && p2[2]-p1[2]>maxDT ) {
			if(seg[0] < seg[1]) segs.add(seg);
			seg = new int[] {i+1, i+1};
		}
		p1 = p2;
		i++;
	}
	seg[1] = npt-1;
	if(seg[0] < seg[1]) segs.add(seg);
	segs.trimToSize();
	control = new int[segs.size()][];
	test = maxDR*maxDR;
	for( int iseg = 0; iseg<segs.size() ; iseg++ ) {
		seg = (int[]) segs.get(iseg);
		int i1 = seg[0];
		int i2 = seg[1];
		Vector segControl = new Vector();
		segControl.add( new Integer(i1) );
		segControl.add( new Integer(i2) );
		int imax = i2;
		int k=1;
		while(i1<imax) {
			i2 = ((Integer)segControl.get(k)).intValue();
			while( (i=segment(i1,i2, test)) != -1 ) {
				segControl.add(k, new Integer(i) );
				i2=i;
			}
			k++;
			i1 = i2;
		}
		control[iseg] = new int[segControl.size()];
		for( k=0 ; k<segControl.size() ; k++) control[iseg][k]=((Integer)segControl.get(k)).intValue();
	}
	inverse(proj);
	return getControl();
}
 
开发者ID:iedadata,项目名称:geomapapp,代码行数:53,代码来源:Navigation.java


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