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

📄 concepttype.java

📁 toocom源代码,主要应用在本体匹配方面!
💻 JAVA
字号:
package toocom.ocgl;

import java.util.*;
import javax.swing.*;
import java.awt.*;
import java.awt.geom.*;
import java.awt.font.*;

/**
 * This class represents the concept types in the ontology. 
 *
 * @author Fr閐閞ic F黵st
 */
public class ConceptType extends ConceptualPrimitive{
	

	/** Creates the ConceptType class with the given set of terms. */
	public ConceptType(Terms terms){
		super(terms);
	}
	
	/** Creates the ConceptType class with an undefined terms. */
	public ConceptType(){
		super(Terms.getUndefinedTerms());
	}
	
	/** Returns a concept type with an undefined label. */
	public static ConceptType getUndefinedConceptType(){
		return new ConceptType(Terms.getUndefinedTerms());
	}
	
	/** Returns true if the concept type is an undefined concept type. */
	public boolean isUndefined(){
		return this.getTerms().equals(Terms.getUndefinedTerms());
	}
	
	public String toString(Language l){
		return this.getTerm(l);
	}
	
	public void destroy(Ontology onto){
		super.destroy(onto);
		for(Iterator i = onto.getIndividuals().iterator();i.hasNext();){
			Individual ind = (Individual) i.next();	
			if((ind.getType() != null) && ind.getType().equals(this)) ind.setType(onto.getUniversalConceptType());
		}
		for(Iterator i = onto.getRelationTypes().iterator();i.hasNext();){
			RelationType rt = (RelationType) i.next();
			int index = rt.linkConceptType(this);	
			if(index != -1) rt.getSignature().setConceptType(null,index);
		}
		for(Iterator i = onto.getConcepts().iterator();i.hasNext();){
			Concept c = (Concept) i.next();
			if((c.getType() != null) && c.getType().equals(this)) c.setType(onto.getUniversalConceptType());
		}
		onto.removeConceptType(this);
	}
	
	/** Returns the bounds of the image according to the font size of the given Graphics. */
	public RectangularShape getBounds(Graphics g,Language l){
		String s = this.toString(l);
		return GraphicsToolkit.getRectangularBounds(g,s,new Point(this.x,this.y));
	}
		
	/** Only draw the lines which represent the is-a link between the concept type and its children. */
	public void paintChildrenLinks(Graphics g,Language l){
		g.setColor(CGConstants.IS_A_LINK_COLOR);
		for(Iterator i = this.getChildren().iterator();i.hasNext();){
			ConceptType ctTemp = (ConceptType) i.next();
			Point p1 = ctTemp.getCenter();
			Point p2 = this.getCenter();
			GraphicsToolkit.paintArrowLine(g,p1,p2);
		}	
	}
	
	/** Paint the concept type with its label in a rectangular shape. */
	public void paintObject(Graphics g,Language l){
		this.paintObject(g,CGConstants.CONCEPT_TYPE_COLOR,CGConstants.CONCEPT_TYPE_BORDER_COLOR,CGConstants.SELECTED_ABSTRACT_CONCEPT_TYPE_BORDER_COLOR,CGConstants.HIGHLIGHTED_CONCEPT_TYPE_COLOR,CGConstants.CONCEPT_TYPE_TEXT_COLOR,l);
	}
	
}

⌨️ 快捷键说明

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