⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 vertex.java

📁 这是一个从音频信号里提取特征参量的程序
💻 JAVA
📖 第 1 页 / 共 3 页
字号:
    //    // adds the child to the list    //     public boolean addChild(Vertex child) {	if (!vertexChildren.contains(child)) {	    vertexChildren.addElement(child);	    return true;	}	return false;    }    // method: addChild    //    // arguments:    //   Vertex child: (input) new child to be added    //   int index: (input) index at which the child is to be added    // returns: none    //    // adds the child to the list    //     public boolean addChild(Vertex child, int index) {	if (!vertexChildren.contains(child)) {	    if (index >= vertexChildren.size()) {		vertexChildren.setSize(index + 1);	    }	    vertexChildren.setElementAt(child, index);	    return true;	}	return false;    }    // method: removeChild    //    // arguments:    //   Vertex child: (input) child to be removed    // returns: method status    //    // removes the child from the list    //     public boolean removeChild(Vertex child) {	return vertexChildren.removeElement(child);    }    // method: updateVertexDimensions    //    // arguments: none    // returns  : none    //    // method resets and revalidates the vertex dimension    //    public void updateVertexDimensions() {		// declare local variables	//	int newWidth = 0;	int newHeight = 0;	// check if the parent vector has been initialized	//	if (vertexParents == null) {	    return;	}	// determine the width of the vertex	//	if (vertexParents.size() == 0) {	    newWidth =  this.vertexWidth;	} else {	    newWidth =  (vertexParents.size() * this.vertexWidth);	}	// determine the height of the vertex	//	newHeight = this.getVertexHeight();	// set the new vertex dimensions	//	this.setSize(new Dimension(newWidth, newHeight));	this.setMinimumSize(new Dimension(newWidth, newHeight));	this.setPreferredSize(new Dimension(newWidth, newHeight));    }    // method: initializeConfig    //    // arguments:    //   Vector n: (input) vector of algorithm names    //   Vector v: (input) vector of algorithm values    //   Vector t: (input) vector of algorithm data types    //   String s: (input) algorithm immage association    //   Data d: (input) algorithm data object    // returns  : none    //    // initializes the configuration parameters of the algorithm vertex    //    public void initializeConfig(Vector n, Vector v, Vector t, 				 String a, Data d) {		// initialize data members	//	names = n;	types = t;	association = a;	Data data = d;	values = new Vector(5,5);	subclass = new Vector(2,1);	for(int i=0; i < v.size(); i++) {	    // if enumerated type, get the first value	    //		    if(types.get(i).equals(ALGORITHM_ENUM)){		Vector enum_values = (Vector)v.get(i);		values.add(enum_values.get(0));	    }	    // add a default subclass with basic parameters here to begin with	    // this still needs to be worked out properly	    //	    else if (types.get(i).equals(ALGORITHM_CLASS)) {		values.add(v.get(i));		max_subclass++;				String image_name = null;		String image_association= null;				// tells the program which ALGORITHM it is looking to match		//		image_association = (String)values.get(i);		// scans through the association until it finds the 		// smallIcon key		//		for(int j=data.association.indexOf(image_association); 		    j <= data.association.lastIndexOf(image_association);		    j++) {		    if(j != -1) {			if(((String)(data.name.get(j))).equals(ALGORITHM_ICON_SMALL)) {			    // sets the image_name to the value held in 			    // small icon			    //			    image_name = (String)data.values.get(j);			}		    }		}		    		// check to see if the file exists. If it does not exist,		// use a default image		//		if(image_name != null){		    File image_file = new File(image_name);		    if (image_file.exists() == false)			image_name = ALGORITHM_DEFAULT;		}		else {		    image_name = ALGORITHM_DEFAULT;		}		if(image_association.equals("FourierTransform"))		    image_name = GUI_PATH +"/lib/images/isip_transform_builder/icons/fourier_01.gif";		// create the icons for the config panel		//		ImageIcon icon = new ImageIcon(image_name);				// create the button for the config panel		//		Vertex button = new Vertex(icon, ALGORITHM);				// to simplify the creation, the data vectors will be trimmed 		// to only include the ALGORITHM we're looking at and saved 		// into these three vectors for use in a bit		//		Vector labels2 = new Vector(5,5);		Vector types2 = new Vector(5,5);		Vector values2 = new Vector(5,5);				for(int j=data.association.indexOf(image_association); 		    j <= data.association.lastIndexOf(image_association);		    j++) {		    if(j != -1) {			labels2.add(data.name.get(j));			types2.add(data.type.get(j));			values2.add(data.values.get(j));		    }		}	 		// initialize the vertex to the default values for its type		//		button.initializeConfig(labels2, values2, types2,					image_association, data);				// add subclass button to the vector		//		subclass.add(button);			// attach an action listener to the button		//		button.setActionCommand(ALGORITHM_CLASS);	    }	    // add sub parameters here to begin with	    // this still needs to be worked out properly	    //	    else if (types.get(i).equals(ALGORITHM_PARAM)) {		values.add(v.get(i));		max_subparam++;				String image_name = null;		String image_association= null;				// tells the program which ALGORITHM it is looking to match		//		image_association = (String)values.get(i);		// scans through the association until it finds the 		// smallIcon key		//		for(int j=data.association.indexOf(image_association); 		    j <= data.association.lastIndexOf(image_association);		    j++) {		    if(j != -1) {			if(((String)(data.name.get(j))).equals(ALGORITHM_ICON_SMALL)) {			    // sets the image_name to the value held in 			    // small icon			    //			    image_name = (String)data.values.get(j);			}		    }		}		    		// check to see if the file exists. If it does not exist,		// use a default image		//		if(image_name != null){		    File image_file = new File(image_name);		    if (image_file.exists() == false)			image_name = ALGORITHM_DEFAULT;		}		else {		    image_name = ALGORITHM_DEFAULT;		}				if(image_association.equals("FourierTransform"))		    image_name = GUI_PATH +"/lib/images/isip_transform_builder/icons/fourier_01.gif";		// create the icons for the config panel		//		ImageIcon icon = new ImageIcon(image_name);				// create the button for the config panel		//		Vertex button = new Vertex(icon, ALGORITHM);		button.association = image_association;		// to simplify the creation, the data vectors will be trimmed 		// to only include the ALGORITHM we're looking at and saved 		// into these three vectors for use in a bit		//		Vector labels2 = new Vector(5,5);		Vector types2 = new Vector(5,5);		Vector values2 = new Vector(5,5);				for(int j=data.association.indexOf(image_association); 		    j <= data.association.lastIndexOf(image_association);		    j++) {		    if(j != -1) {			labels2.add(data.name.get(j));			types2.add(data.type.get(j));			values2.add(data.values.get(j));		    }		}	 		// initialize the vertex to the default values for its type		//		//button.initializeConfig(labels2, values2, types2,		//		image_association, data);				// add subclass button to the vector		//		subparam.add(button);				// attach an action listener to the button		//		button.setActionCommand(ALGORITHM_PARAM);	    }	    // do nothing if the type is image	    //	    else if (types.get(i).equals(ALGORITHM_IMAGE)) {		values.add(v.get(i));	    }	    // If there is only one value given, set the default as the value	    //	    else {				// add the defaults to the values vector		//		values.add(v.get(i));	    }    	}    }    // method: initializeConfigGen    //    // arguments:    //   Vector n: (input) vector of algorithm names    //   Vector v: (input) vector of algorithm values    //   Vector t: (input) vector of algorithm data types    //   String s: (input) algorithm immage association    //   Data d: (input) algorithm data object    // returns  : none    //    // initializes the configuration parameters of the algorithm vertex    //    public void initializeConfigGen(Vector n, Vector v, Vector t, 				 String a, Data d) {		// initialize data members	//	names = n;	types = t;	association = a;	Data data = d;	values = new Vector(5,5);	//subparam = new Vector(2,1);	for(int i=0; i < v.size(); i++) {	    // if enumerated type, get the first value	    //		    if(types.get(i).equals(ALGORITHM_ENUM)){		Vector enum_values = (Vector)v.get(i);		values.add(enum_values.get(0));	    }	    // add a default object with basic parameters here to begin with	    // this still needs to be worked out properly	    //	    else if (types.get(i).equals(ALGORITHM_PARAM)) {		values.add(v.get(i));		max_subparam++;				String image_name = null;		String image_association= null;				// tells the program which ALGORITHM it is looking to match		//		image_association = (String)values.get(i);		// scans through the association until it finds the 		// smallIcon key		//		for(int j=data.association.indexOf(image_association); 		    j <= data.association.lastIndexOf(image_association);		    j++) {		    if(j != -1) {			if(((String)(data.name.get(j))).equals(ALGORITHM_ICON_SMALL)) {			    // sets the image_name to the value held in 			    // small icon			    //			    image_name = (String)data.values.get(j);			}		    }		}		    		// check to see if the file exists. If it does not exist,		// use a default image		//		if(image_name != null){		    File image_file = new File(image_name);		    if (image_file.exists() == false)			image_name = ALGORITHM_DEFAULT;		}		else {		    image_name = ALGORITHM_DEFAULT;		}				image_name = GUI_PATH+"/lib/images/isip_transform_builder/icons/algorithm_00.gif";				// create the icons for the config panel		//		ImageIcon icon = new ImageIcon(image_name);				// create the button for the config panel		//		Vertex button = new Vertex(icon, ALGORITHM);		button.association = image_association;				// to simplify the creation, the data vectors will be trimmed 		// to only include the ALGORITHM we're looking at and saved 		// into these three vectors for use in a bit		//		Vector labels2 = new Vector(5,5);		Vector types2 = new Vector(5,5);		Vector values2 = new Vector(5,5);				for(int j=data.association.indexOf(image_association); 		    j <= data.association.lastIndexOf(image_association);		    j++) {		    if(j != -1) {			labels2.add(data.name.get(j));			types2.add(data.type.get(j));			values2.add(data.values.get(j));		    }		}	 		// initialize the vertex to the default values for its type		//		//button.initializeConfig(labels2, values2, types2,		//		image_association, data);				// add subclass button to the vector		//		subparam.add(button);				// attach an action listener to the button		//		//xbutton.setActionCommand(ALGORITHM_CLASS);		button.setActionCommand("param");		//button.addActionListener(digraph);	    }	    // do nothing if the type is image	    //	    else if (types.get(i).equals(ALGORITHM_IMAGE)) {		values.add(v.get(i));	    }	    // If there is only one value given, set the default as the value	    //	    else {				// add the defaults to the values vector		//		values.add(v.get(i));	    }    	}    }    // ---------------------------------------------------    //    // class required methods    //    // ---------------------------------------------------    // method: paintComponent    //    // arguments:    //   Graphics g: (input) graphics object    //    // return: none    //    protected void paintComponent(Graphics g) {	// set the background color of the vertex	//	switch (vertexType) {	case ALGORITHM:	    break;	case CONTAINER:	    break;	default:	    break;	}	// this call will paint the label and the focus	//	super.paintComponent(g);     }    // method: paintBorder    //    // arguments:    //    Graphics g: (input) graphics object    //    // return: none    //    protected void paintBorder(Graphics g) { 	// not implemented    }}//// end of file

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -