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

📄 vertex.java

📁 这是一个从音频信号里提取特征参量的程序
💻 JAVA
📖 第 1 页 / 共 3 页
字号:
	setContentAreaFilled(false); 	// set the horizontal text position	//	setHorizontalTextPosition(SwingConstants.CENTER);	// set the default dimensions of the vertex	//	switch (vertexType) {	case ALGORITHM:	    setBackground(Color.white);	    setContentAreaFilled(false); 	    setHorizontalTextPosition(SwingConstants.CENTER);	    setSize(ALGORITHM_WIDTH, ALGORITHM_HEIGHT);	    setPreferredSize(new Dimension(ALGORITHM_WIDTH, ALGORITHM_HEIGHT));	    setMinimumSize(new Dimension(ALGORITHM_WIDTH, ALGORITHM_HEIGHT));	    setVertexWidth(ALGORITHM_WIDTH);	    setVertexHeight(ALGORITHM_HEIGHT);	    break;	case CONTAINER:	    setBackground(Color.white);	    setContentAreaFilled(false);	    setHorizontalTextPosition(SwingConstants.CENTER);	    setSize(CONT_WIDTH, CONT_HEIGHT);	    setPreferredSize(new Dimension(CONT_WIDTH, CONT_HEIGHT));	    setMinimumSize(new Dimension(CONT_WIDTH, CONT_HEIGHT));	    setVertexWidth(CONT_WIDTH);	    setVertexHeight(CONT_HEIGHT);	    break;	    	default:	    setBackground(Color.cyan);	    setContentAreaFilled(false);	    setHorizontalTextPosition(SwingConstants.CENTER);	    setSize(VERTEX_WIDTH, VERTEX_HEIGHT);	    setPreferredSize(new Dimension(VERTEX_WIDTH, VERTEX_HEIGHT));	    setMinimumSize(new Dimension(VERTEX_WIDTH, VERTEX_HEIGHT));	    setVertexWidth(VERTEX_WIDTH);	    setVertexHeight(VERTEX_HEIGHT);	    break;	}    }    // ---------------------------------------------------    //    // declare class public methods    //    // ---------------------------------------------------    // method: clear    //    // arguments: none    // returns: none    //    // clears all lists associated this the vertex    //    public void clear() {	if (vertexParents != null) {	    vertexParents.removeAllElements();	}	if (vertexChildren != null) {	    vertexChildren.removeAllElements();	}	if (vertexContainer != null) {	    vertexContainer.removeAllElements();	}    }    // method: changeConnectors    //    // arguments:    //   int destination: destination connector    //   Vertex src:  the parent vertex that will be set to the destination    // returns  : none    //    // method changes the order of the connectors for the connector vertex    //    public void changeConnectors(int dest, Vertex src) {	// declare local variables	//	int stop = 0;	Vertex vertex = src;	// reduce to the source and destination to zero based values	//	stop = dest - 1;		// determine if the source is valid	//	if (stop >= vertexParents.size()) {	    return;	}		// remove the element at the start location	//	vertexParents.set(stop, vertex);    }    // method: getVertexName    //    // arguments: none    // returns: class name    //    // gets the class name    //    public String getVertexName() {	return vertexName;    }    // method: setVertexName    //    // arguments:    //   String name: class name    // returns: method status    //    // sets the class name    //     public boolean setVertexName(String name) {	vertexName = name;	return true;    }    // method: getIconName    //    // arguments: none    // returns: class icon name    //    // gets the class icon name    //    public String getIconName() {	return iconName;    }    // method: setIconName    //    // arguments:    //   String name: class icon name    // returns: method status    //    // sets the class icon name    //     public boolean setIconName(String name) {	iconName = name;	return true;    }    // method: getVertexIcon    //    // arguments: none    // returns: class icon    //    // gets the class icon    //    public ImageIcon getVertexIcon() {	return vertexIcon;    }    // method: setVertexIcon    //    // arguments:    //   ImageIcon icon: class icon    // returns: method status    //    // sets the class icon    //     public boolean setVertexIcon(ImageIcon icon) {	vertexIcon = icon;	return true;    }    // method: getInDegree    //    // arguments: none    // returns: number of incoming arcs    //    // get the number of arcs coming into the vertex    //     public int getInDegree() {	return vertexParents.size();    }    // method: getOutDegree    //    // arguments: none    // returns: number of outgoing arcs    //    // get the number of arcs leaving th vertex    //     public int getOutDegree() {	return vertexChildren.size();    }    // method: getVertexType    //    // arguments: none    // returns: vertex type    //    // gets the vertex type    //     public int getVertexType() {	return vertexType;    }    // method: setType    //    // arguments:    //   int type: (input) vertex type    // returns: method status    //    // sets the vertex type    //     public boolean setType(int type) {	vertexType = type;	return true;    }    // method: setType    //    // arguments:    //   String type: (input) vertex type    // returns: method status    //    // sets the vertex type    //     public boolean setType(String type) {        	return true;    }    // method: getType    //    // arguments: none    // returns: method status    //    // gets the vertex type    //     public String getType() {	// return the vertex type	//	if (vertexType == SAMPLED_DATA) {	    return SAMPLED_DATA_STR;	}	else if (vertexType == FEATURE_DATA) {	    return FEATURE_DATA_STR;	}	else if (vertexType == GENERATOR_DATA) {	    return GENERATOR_DATA_STR;	}	else if (vertexType == ALGORITHM) {	    return ALGORITHM_STR;	}	else if (vertexType == CONTAINER) {	    return CONTAINER_STR;	}	else if (vertexType == INPUT) {	    return INPUT_STR;	}	else if (vertexType == OUTPUT) {	    return OUTPUT_STR;	}	else if (vertexType == CUSTOM) {	    return CUSTOM_STR;	}	else {	    return NONE_STR;	}    }    // method: getVertexImpl    //    // arguments: none    // returns: class implementation    //    // gets the class implementation    //    public int getVertexImpl() {	return vertexImpl;    }    // method: setVertexImpl    //    // arguments:    //   String impl: class implementation    // returns: method status    //    // sets the class implementation    //     public boolean setVertexImpl(int impl) {	vertexImpl = impl;	return true;    }    // method: containsChild    //    // arguments:    //   Vertex child: (input) child we intend to find    // returns: method status    //    // checks if the input is a child    //     public boolean containsChild(Vertex child) {	return vertexChildren.contains(child);    }    // method: containsParent    //    // arguments:    //   Vertex parent: (input) parent we intend to find    // returns: method status    //    // checks if the input is a parent    //     public boolean containsParent(Vertex parent) {	return vertexParents.contains(parent);    }    // method: insertContainerElement    //    // arguments:    //   Vertex vertex: (input) vetrex to be inserted    // returns: none    //    // inserts a vertex into the container    //     public void insertContainerElement(Vertex vertex) {		// add the vertex to the required data structures	//	vertexContainer.addElement(vertex);    }    // method: getVertexLocation    //    // arguments: none    // returns: method status    //    // gets the location of the vertex    //     public Point getVertexLocation() {	// declare local variables	//	Point point = null;	// get the position of the bean	//	point = this.getLocation(point);	// retrieve the location of the bean	//	double xloc = point.getX();	double yloc = point.getY();	// return the location of the bean	//	return (new Point((int)xloc, (int)yloc));    }    // method: updateLocation    //    // arguments:     //    int xloc: x-coordinate of the bean    //    int yloc: y-coordinate of the bean    //    // returns  : none    //    // method returns the name of the bean    //    public void updateLocation(int xloc, int yloc) {	// check to make sure that the memory has been allocated	//	if (vertexLocation == null) {	    vertexLocation = new Point();	}	// update the location of the bean	//	vertexLocation.x = xloc;	vertexLocation.y = yloc;    }    // method: getVertexWidth    //    // arguments: none    // returns: method status    //    // gets the width of the vertex    //     public int getVertexWidth() {	return vertexWidth;    }    // method: getVertexHeight    //    // arguments: none    // returns: method status    //    // gets the height of the vertex    //     public int getVertexHeight() {	return vertexHeight;    }    // method: setVertexHeight    //    // arguments:    //   int height: (input) new height of the vertex    // returns: method status    //    // sets the height of the vertex    //     public boolean setVertexHeight(int height) {	vertexHeight = height;	return true;    }    // method: setVertexWidth    //    // arguments:    //   int width: (input) new width of the vertex    // returns: method status    //    // sets the width of the vertex    //     public boolean setVertexWidth(int width) {	vertexWidth = width;	return true;    }    // method: getParents    //    // arguments: none    // returns: list of parents    //    // gets the list of parents associated with the vertex    //    public Vector getParents() {	return vertexParents;    }    // method: addParent    //    // arguments:    //   Vertex parent: (input) new parent to be added    // returns: method status    //    // adds the parent to the list    //     public boolean addParent(Vertex parent) {		if (!vertexParents.contains(parent)) {	    vertexParents.addElement(parent);	    return true;	}	return false;    }    // method: addParent    //    // arguments:    //   Vertex parent: (input) new parent to be added    //   int index: (input) index at which the parent is to be added    // returns: method status    //    // adds the parent to the list    //     public boolean addParent(Vertex parent, int index) {		if (!vertexParents.contains(parent)) {	    if (index >= vertexParents.size()) {		vertexParents.setSize(index + 1);	    }	    vertexParents.setElementAt(parent, index);	    return true;	}	return false;    }    // method: removeParent    //    // arguments:    //   Vertex parent: (input) parent to be removed    // returns: method status    //    // removes the parent from the list    //     public boolean removeParent(Vertex parent) {	return vertexParents.removeElement(parent);    }    // method: getChildren    //    // arguments: none    // returns: list of children    //    // gets the list of children associated with the vertex    //    public Vector getChildren() {	return vertexChildren;    }    // method: addChild    //    // arguments:    //   Vertex child: (input) new child to be added    // returns: none

⌨️ 快捷键说明

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