clarion.nacs
Class GKSChunk

java.lang.Object
  extended byclarion.common.Chunk
      extended byclarion.nacs.GKSChunk
All Implemented Interfaces:
java.lang.Cloneable

public class GKSChunk
extends Chunk


Field Summary
 
Fields inherited from class clarion.common.Chunk
BLA, c, chunkBlaOption, chunkLabel, chunkType, d, featList, iBLA, MAX_USAGE_NUM, strength, usageNum, usageRecords
 
Constructor Summary
GKSChunk(int cId, int type, java.lang.String label, Chunk[] chunks, int idnIdx, int amnIdx, Global g)
          new constructor for a combined chunk.
GKSChunk(int cId, int type, java.lang.String label, Feature[] features, int idnIdx, int amnIdx, Global g)
          new constructor.
 
Method Summary
 boolean activateChunk(Feature[] cue, int whichLevel)
          Checks if this chunk is activated or not and computes the chunk strength.
 void calcRetrievalTime()
          Computes the retrieval time.
 void calculateStrength(java.util.Vector con)
          Calculates the support from the associative rules pointing to this chunk.
 java.lang.Object clone()
          methods from class Object
 short[][] getActiveRuleConditions()
          Returns the conditions of the activated rules with this chunk as conclusion.
 int getAge()
          Returns the chunk age.
 int getAmnIdx()
          Returns the index to an AMN this chunk is from.
 int getAssocRuleAppTime()
          Returns the associated rule application time.
 boolean getAvailableFlag()
          not used any more.
 Feature getConclusion()
          Deprecated. it is not used any more.
 int getConclusionDimIdx()
          Deprecated. it is not used any more.
 int getIdnIdx()
          Returns the index to an IDN this chunk is from.
 int getRetrievalTime()
          Returns the retrieval time.
 short[][] getRuleConditions()
          Returns the conditions of the rules with this chunk as conclusion.
 int getRuleNum()
          Returns the number of rules with this chunk as conclusion.
 AssocRuleGrp getRules()
          Returns the rules with this chunk as conclusion.
 void increaseUsage()
          Updates the usage.
 boolean insertRule(short[] condition, short conclusion)
          insert a rule with the specific condition and conclusion in terms of the chunk indices on the chunk list in GKS.
 boolean isInEmOn()
          Returns if chunk is in EM or not.
 boolean removeCondition(int chunkIdx)
          Removes any rule which condition contains the specific chunk index.
 boolean removeRule(short[] condition, short conclusion)
          Remove a rule with the specific condition and conclusion in terms of the chunk indices on the chunk list in GKS.
 void resetAge()
          reset the chunk age.
 boolean searchRule(short[] conditions)
          Search a rule in this chunk with the specific condition in terms of chunk indices on the chunk list in GKS.
 void setAvailableFlag(boolean flag)
          not used any more.
 void setConclusionDimIdx(short idx)
          Deprecated. it is not used any more.
 void setCurrentTime(long curTime)
          Sets current time.
 void setInEmOn(boolean flag)
          Sets flag indicating this chunk is in EM or not.
 void setReasoningMethod(int method)
          Sets GKS reasoning method.
 void setRules(AssocRuleGrp ruleGrp)
          Sets the assoicated rules.
 java.lang.String toString()
          methods from class Object
 boolean update()
          Update routine.
 
Methods inherited from class clarion.common.Chunk
append, calcBLA, equals, getBLA, getBlaOption, getChunkType, getContent, getContent, getDimNum, getFeature, getFeatureNum, getFeatures, getFeatures, getLabel, getLength, getStrength, getUsageNum, getUsageRecords, getUsageRecords, hashCode, increaseUsage, isEqual, reinit, resetUsage, searchFeature, setBLA_C, setBLA_D, setBLA_INIT, setBla, setBlaOption, setBlaParams, setLabel, setStrength, setUsageNum, setUsageRecords
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

GKSChunk

public GKSChunk(int cId,
                int type,
                java.lang.String label,
                Feature[] features,
                int idnIdx,
                int amnIdx,
                Global g)
new constructor.

Parameters:
cId - chunk ID.
type - chunk type.
label - chunk label.
features - chunk features.
idnIdx - the index to an IDN this chunk is from.
amnIdx - the index to an AMN this chunk is from.
g - the global settings.

GKSChunk

public GKSChunk(int cId,
                int type,
                java.lang.String label,
                Chunk[] chunks,
                int idnIdx,
                int amnIdx,
                Global g)
new constructor for a combined chunk.

Parameters:
cId - chunk ID.
type - chunk type.
label - chunk label.
chunks - chunks to compose this chunk.
idnIdx - the index to an IDN this chunk is from.
amnIdx - the index to an AMN this chunk is from.
g - the global settings.
Method Detail

getIdnIdx

public int getIdnIdx()
Returns the index to an IDN this chunk is from.

Returns:
the index to an IDN this chunk is from.

getAmnIdx

public int getAmnIdx()
Returns the index to an AMN this chunk is from.

Returns:
the index to an AMN this chunk is from.

getAge

public int getAge()
Returns the chunk age.

Returns:
the chunk age.

getRuleNum

public int getRuleNum()
Returns the number of rules with this chunk as conclusion.

Returns:
the number of rules.

getRules

public AssocRuleGrp getRules()
Returns the rules with this chunk as conclusion.

Returns:
the rules.

getRuleConditions

public short[][] getRuleConditions()
Returns the conditions of the rules with this chunk as conclusion. The conditions are in terms of chunk indices to the chunk list in GKS.

Returns:
the conditions of the rules.

getActiveRuleConditions

public short[][] getActiveRuleConditions()
Returns the conditions of the activated rules with this chunk as conclusion. The conditions are in terms of chunk indices to the chunk list in GKS.

Returns:
the conditions of the activated rules.

getConclusionDimIdx

public int getConclusionDimIdx()
Deprecated. it is not used any more.

Returns the index to the conclusion dimension.

Returns:
the index to the conclusion dimension.

getAvailableFlag

public boolean getAvailableFlag()
not used any more.


isInEmOn

public boolean isInEmOn()
Returns if chunk is in EM or not.


getConclusion

public Feature getConclusion()
Deprecated. it is not used any more.

Returns the conclusion dimension.

Returns:
the conclusion dimension.

getRetrievalTime

public int getRetrievalTime()
Returns the retrieval time.

Returns:
the retrieval time.

getAssocRuleAppTime

public int getAssocRuleAppTime()
Returns the associated rule application time.

Returns:
the associated rule application time.

resetAge

public void resetAge()
reset the chunk age.


setReasoningMethod

public void setReasoningMethod(int method)
Sets GKS reasoning method.

Parameters:
method - the reasoning method to set.

setCurrentTime

public void setCurrentTime(long curTime)
Sets current time.

Parameters:
curTime - the time to set.

setRules

public void setRules(AssocRuleGrp ruleGrp)
Sets the assoicated rules.

Parameters:
ruleGrp - the rule group to set.

setAvailableFlag

public void setAvailableFlag(boolean flag)
not used any more.


setInEmOn

public void setInEmOn(boolean flag)
Sets flag indicating this chunk is in EM or not.

Parameters:
flag - the value to set.

setConclusionDimIdx

public void setConclusionDimIdx(short idx)
Deprecated. it is not used any more.

Sets the index to the conclusion dimension.

Parameters:
idx - the index to set.

activateChunk

public boolean activateChunk(Feature[] cue,
                             int whichLevel)
Checks if this chunk is activated or not and computes the chunk strength. To say a chunk is activated, it means that all or some of its dimensions are activated to a strength level. A dimension of the chunk is activated to a strength level means one of allowable values in the dimension is activated with a strength( only for the case that the value # cue has in that dimension is 1. ) Generally, To say a dimension of a chunk is activated, all of the values cue has in the dimension should be contained in the dimension of the chunk.

Parameters:
cue - the cue to activate the reasoning.
whichLevel - the level (GKS or AMN) this reasoning process is in.
Returns:
true if the reasoning is similarity-based and some dimensions are matched or the reasoning is rule-based and all dimensions are matched. false, otherwise.

calculateStrength

public void calculateStrength(java.util.Vector con)
Calculates the support from the associative rules pointing to this chunk.

Parameters:
con - the vector of chunks to trigger the proccess of computing rule support.

searchRule

public boolean searchRule(short[] conditions)
Search a rule in this chunk with the specific condition in terms of chunk indices on the chunk list in GKS.


increaseUsage

public void increaseUsage()
Updates the usage.


calcRetrievalTime

public void calcRetrievalTime()
Computes the retrieval time.


insertRule

public boolean insertRule(short[] condition,
                          short conclusion)
insert a rule with the specific condition and conclusion in terms of the chunk indices on the chunk list in GKS.

Parameters:
condition - the rule condition.
conclusion - the rule conclusion.

removeRule

public boolean removeRule(short[] condition,
                          short conclusion)
Remove a rule with the specific condition and conclusion in terms of the chunk indices on the chunk list in GKS.

Parameters:
condition - the rule condition.
conclusion - the rule conclusion.

removeCondition

public boolean removeCondition(int chunkIdx)
Removes any rule which condition contains the specific chunk index.

Parameters:
chunkIdx - the chunk index.
Returns:
true if such rules exist, false otherwise.

update

public boolean update()
Update routine.


toString

public java.lang.String toString()
methods from class Object

Overrides:
toString in class Chunk

clone

public java.lang.Object clone()
                       throws java.lang.CloneNotSupportedException
methods from class Object

Overrides:
clone in class Chunk
Throws:
java.lang.CloneNotSupportedException