XMLTagWord.java from Texai at Krugle
Show XMLTagWord.java syntax highlighted
/*
* XMLTagWord.java
*
* Created on January 16, 2007, 8:35 PM
*
* Description: Provides an XML tag word construction.
*
* Copyright (C) 2007 Stephen L. Reed.
*
* This program is free software; you can redistribute it and/or modify it under the terms
* of the GNU General Public License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along with this program;
* if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
package org.texai.grammar.domainEntity;
import net.jcip.annotations.NotThreadSafe;
import org.openrdf.model.URI;
import org.texai.grammar.understanding.ActiveConstituent;
import org.texai.grammar.understanding.ActiveXMLTagWord;
import org.texai.kb.Constants;
import org.texai.kb.persistence.RDFEntity;
import org.texai.kb.persistence.RDFNamespace;
/** Provides an XML tag word construction.
*
* @author reed
*/
@RDFEntity(
namespaces={
@RDFNamespace(prefix="texai", namespaceURI=Constants.TEXAI_NAMESPACE),
@RDFNamespace(prefix="cyc", namespaceURI=Constants.CYC_NAMESPACE)},
subject="texai:org.texai.grammar.domainEntity.XMLTagWord", type="cyc:LinguisticObjectType", subClassOf="texai:CxgWordFormConstruction", context="texai:EnglishConstructionGrammarDomainContext")
@NotThreadSafe // but effectively immutable
public class XMLTagWord extends AbstractConstruction {
/**
* Creates a new instance of XMLTagWord.
*/
public XMLTagWord() {
super();
setLoggerUsingClass(this.getClass());
}
/**
* Creates a new instance of XMLTagWord.
*
* @param name the construction name that identifies this instance
* @param naturalLanguage the natural language to which this construction applies
* @param wordNetEnglishWord the WordNet English word
*/
public XMLTagWord(final String name, final URI naturalLanguage) {
super(name, naturalLanguage);
setLoggerUsingClass(this.getClass());
}
/** Decorates this construction with an active construction that contains the
* behavior and transient state for parsing text.
*
* @return an ActiveXMLTagWord that decorates this object
*/
public ActiveConstituent decorate() {
return new ActiveXMLTagWord(this);
}
/** Returns a hash code for this object.
*
* @return a hash code for this object
*/
@Override
public int hashCode() {
if (getId() == null) {
return super.hashCode();
} else {
return getId().hashCode();
}
}
/** Returns whether the given object is equal to this object.
*
* @param obj the given object
* @return whether the given object is equal to this object
*/
@Override
public boolean equals(final Object obj) {
if (obj instanceof XMLTagWord) {
final XMLTagWord that = (XMLTagWord) obj;
return this.getId().equals(that.getId());
} else {
return false;
}
}
}
See more files for this project here