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

📄 bmstatement.java

📁 这是外国一个开源推理机
💻 JAVA
字号:
/*  Sesame - Storage and Querying architecture for RDF and RDF Schema *  Copyright (C) 2001-2005 Aduna * *  Contact:  *  	Aduna *  	Prinses Julianaplein 14 b *  	3817 CS Amersfoort *  	The Netherlands *  	tel. +33 (0)33 465 99 87 *  	fax. +33 (0)33 465 99 87 * *  	http://aduna.biz/ *  	http://www.openrdf.org/ *   *  This library is free software; you can redistribute it and/or *  modify it under the terms of the GNU Lesser General Public *  License as published by the Free Software Foundation; either *  version 2.1 of the License, or (at your option) any later version. * *  This library 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 *  Lesser General Public License for more details. * *  You should have received a copy of the GNU Lesser General Public *  License along with this library; if not, write to the Free Software *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA */package org.openrdf.sesame.sail.test.benchmark.model;import java.io.Serializable;import org.openrdf.model.Resource;import org.openrdf.model.URI;import org.openrdf.model.Value;/** * Represents a statement used by benchmark test. Test uses a slightly different * statement than Sesame does, e.g. its subject, predicate and object may be null * to indicate wildcards. * * @author Peter van 't Hof * @version %I%, %G% */public class BMStatement implements Serializable {/*----------+| Variables |+----------*/	protected Resource _subject;	protected URI _predicate;	protected Value _object;/*-------------+| Constructors |+-------------*/	/**	 * Creates a new BMStatement.	 *	 * @param subject Subject of statement, may be null to indicate a wildcard.	 * @param predicate Predicate of statement, may be null to indicate a	 * wildcard.	 * @param object Object of statement, may be null to indicate a wildcard.	 */	public BMStatement(Resource subject, URI predicate, Value object) {		_subject = subject;		_predicate = predicate;		_object = object;	}/*--------+| Methods |+--------*/		/**	 * Gets subject of statement.	 *	 * @return Subject of statement.	 */	public Resource getSubject() {		return _subject;	}	/**	 * Gets predicate of statement.	 *	 * @return Predicate of statement.	 */	public URI getPredicate() {		return _predicate;	}	/**	 * Gets object of statement.	 *	 * @return Object of statement.	 */	public Value getObject() {		return _object;	}	/**	 * Indicates whether some other object is equal to this one.	 *	 * @return True if this object is the same as the obj argument; false	 * otherwise.	 */	public boolean equals(Object other) {		if (this == other) {			return true;		}		else {			if (other instanceof BMStatement) {				BMStatement bmStatement = (BMStatement)other;								return _equals(_subject, bmStatement.getSubject()) && 					_equals(_predicate, bmStatement.getPredicate()) && 					_equals(_object, bmStatement.getObject());			}		}		return false;	}	/* Equals two Values. Both may be null to indicate wildcards. If both are	 * wildcards, they are equal. If one of them is a wildcard they are not.	 */	protected boolean _equals(Value value1, Value value2) {		if (value1 == null && value2 != null || value1 != null && value2 == null) {			return false;		}		else {			if (value1 == null && value2 == null) {				return true;			}			else {				return value1.equals(value2);			}		}	}	/**	 * Returns hashcode of BMStatement.	 *	 * @return Hashcode of BMStatement.	 */	public int hashCode() {		int hashCode = 0;		if (_subject != null) {			hashCode |= _subject.hashCode() & 0xFF0000;		}		if (_predicate != null) {			hashCode |= _predicate.hashCode() & 0x00FF00;		}		if (_object != null) {			hashCode |= _object.hashCode() & 0x0000FF;		} 		return hashCode; 	}	/**	 * Returns String representation of BMStatement.	 *	 * @return String representation of BMStatement.	 */	public String toString() {		String toString = "";		if (_subject == null) {			toString += "*";		}		else {			toString += _subject.toString();		}		toString += ", ";		if (_predicate == null) {			toString += "*";		}		else {			toString += _predicate.toString();		}		toString += ", ";		if (_object == null) {			toString += "*";		}		else {			toString += _object.toString();		}		return toString;	}}

⌨️ 快捷键说明

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