public class Type extends Object
Representation of a class of a KnowledgeChunk
: could be an asserted class or an excluded class.
This is in fact an association between a class (represented by a KnowledgeChunk
of type T)
and a knowledge chunk being its instance.
The same class could appear in more than one Type
instance, every time connected with different
KnowledgeChunk
s.
KnowledgeChunk
Modifier | Constructor and Description |
---|---|
protected |
Type()
Empty constructor needed for Hibernate compatibility.
|
protected |
Type(KnowledgeChunk kc,
KnowledgeChunk type,
boolean assertedType)
Direct use of this constructor is discouraged.
|
Modifier and Type | Method and Description |
---|---|
boolean |
equals(Object obj)
Check if the given object
obj is equal to the current instance. |
Integer |
getId()
Getter for the
id field. |
KnowledgeChunk |
getInstance()
Getter for the
instance field. |
KnowledgeChunk |
getType()
Getter for the
type field. |
int |
hashCode()
Computes an hash code for the current type.
|
boolean |
isAssertedType()
Getter for the
assertedType field. |
void |
setAssertedType(boolean assertedType)
Setter for the
assertedType field. |
String |
toString()
Generates a string representation of the current class wrapper.
|
protected Type()
protected Type(KnowledgeChunk kc, KnowledgeChunk type, boolean assertedType) throws PropertyValueException
Direct use of this constructor is discouraged. Use KnowledgeChunk.addType
instead.
kc
- the KnowledgeChunk
being instance of the class type
.type
- the KnowledgeChunk
of type T being a class of kc
.assertedType
- could be kc
is an instance of type
kc
is not an instance of type
PropertyValueException
KnowledgeChunk.addType(KnowledgeChunk)
,
KnowledgeChunk.addType(KnowledgeChunk, boolean)
public boolean equals(Object obj)
Check if the given object obj
is equal to the current instance. To be
considered equal, obj
must be an instance of Type
and must have
the fields type.id
, instance.id
and assertedType
identical
to the corresponding fields of the current object.
equals
in class Object
obj
- the object instance to be compared with the current one.obj
is equal to this instance, false otherwise.Object.equals(Object)
public int hashCode()
true
or false
depending on the assertion or negation of the current type.public String toString()
Generates a string representation of the current class wrapper.
public KnowledgeChunk getType()
Getter for the type
field.
KnowledgeChunk
being a class of kc
public KnowledgeChunk getInstance()
Getter for the instance
field.
KnowledgeChunk
being an instance of type
public Integer getId()
Getter for the id
field.
public boolean isAssertedType()
Getter for the assertedType
field.
type
is an asserted class of kc
type
is an excluded class of kc
public void setAssertedType(boolean assertedType)
Setter for the assertedType
field.
assertedType
- must be set to
type
is an asserted class of kc
type
is an excluded class of kc