it.unimi.dico.islab.idbs2.kc
Class Type

java.lang.Object
  extended by it.unimi.dico.islab.idbs2.kc.Type

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 KnowledgeChunks.

The following image shows the relations between the fields of this object and the fields of the wrapped database table (fields with the same color represents a mapping between relational schema and the corresponding object).


Author:
Vegeziel
See Also:
KnowledgeChunk

Constructor Summary
protected Type()
          Empty constructor needed for Hibernate compatibility.
protected Type(KnowledgeChunk kc, KnowledgeChunk type, boolean assertedType)
          Direct use of this constructor is discouraged.
 
Method Summary
 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()
           
 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.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Type

protected Type()
Empty constructor needed for Hibernate compatibility. Direct use is discouraged.


Type

protected Type(KnowledgeChunk kc,
               KnowledgeChunk type,
               boolean assertedType)
        throws org.hibernate.PropertyValueException

Direct use of this constructor is discouraged. Use KnowledgeChunk.addType instead.

Parameters:
kc - the KnowledgeChunk being instance of the class type.
type - the KnowledgeChunk of type T being a class of kc.
assertedType - could be
  • true: if kc is an instance of type
  • false: if kc is not an instance of type
Throws:
org.hibernate.PropertyValueException
See Also:
KnowledgeChunk.addType(KnowledgeChunk), KnowledgeChunk.addType(KnowledgeChunk, boolean)
Method Detail

equals

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.

Overrides:
equals in class Object
Parameters:
obj - the object instance to be compared with the current one.
Returns:
true if obj is equal to this instance, false otherwise.
See Also:
Object.equals(Object)

hashCode

public int hashCode()
Overrides:
hashCode in class Object

toString

public String toString()

Generates a string representation of the current class wrapper.

Overrides:
toString in class Object
Returns:
a string of type kc(type) or kc(!type).

getType

public KnowledgeChunk getType()

Getter for the type field.

Returns:
the KnowledgeChunk being a class of kc

getInstance

public KnowledgeChunk getInstance()

Getter for the instance field.

Returns:
the KnowledgeChunk being an instance of type

getId

public Integer getId()

Getter for the id field.

Returns:
the id of the corresponding database object.

isAssertedType

public boolean isAssertedType()

Getter for the assertedType field.

Returns:
  • true: if type is an asserted class of kc
  • false: if type is an excluded class of kc

setAssertedType

public void setAssertedType(boolean assertedType)

Setter for the assertedType field.

Parameters:
assertedType - must be set to
  • true: if type is an asserted class of kc
  • false: if type is an excluded class of kc