axiomschematwo.java

来自「toocom源代码,主要应用在本体匹配方面!」· Java 代码 · 共 44 行

JAVA
44 行
字号
package toocom.ocgl;

import java.util.*;

/**
 * This class represents the axiom schemata that deal with two primitives. 
 *
 * @author Fr閐閞ic F黵st
 */
public abstract class AxiomSchemaTwo extends AxiomSchema{
	
	protected ConceptualPrimitive cp1,cp2;
	
	public AxiomSchemaTwo(Terms t, ConceptualPrimitive cp1,ConceptualPrimitive cp2){
		super(t);
		this.getTerms().appendWithSeparator(cp1.getTerms(),CGConstants.AXIOM_SCHEMA_NAME_SEPARATOR);
		this.getTerms().appendWithSeparator(cp2.getTerms(),CGConstants.AXIOM_SCHEMA_NAME_SEPARATOR);
		this.cp1 = cp1;
		this.cp2 = cp2;
		this.cp1.addAxiomSchema(this);
		this.cp2.addAxiomSchema(this);
	}
	
	/** Returns true if the axiom schema links cp. */
	public boolean links(ConceptualPrimitive cp){
		return (cp1.equals(cp) || cp2.equals(cp));
	}
	
	public void destroy(){
		cp1.removeAxiomSchema(this);
		cp2.removeAxiomSchema(this);
	}
	
	/** Returns the other primitive linked by the axiom schema, one of the primitive
	 *  is those given as parameter. Return null if the given primitive is not linked 
	 *  by the axiom schema. */
	public ConceptualPrimitive getTheOtherPrimitive(ConceptualPrimitive cp){
		if(cp1.equals(cp)) return cp2;
		if(cp2.equals(cp)) return cp1;
		return null;
	}
	
}
	

⌨️ 快捷键说明

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