clarion.common
Class Chunk

java.lang.Object
  extended byclarion.common.Chunk
All Implemented Interfaces:
java.lang.Cloneable
Direct Known Subclasses:
EMChunk, GKSChunk, GoalChunk

public class Chunk
extends java.lang.Object
implements java.lang.Cloneable


Field Summary
protected  double BLA
          base level activation.
protected  double c
          the three parameters for calculating BLA: c, d, iBLA.
protected  int chunkBlaOption
          the chunk BLA option.
protected  java.lang.String chunkLabel
          the chunk label.
protected  int chunkType
          the chunk type.
protected  double d
          the three parameters for calculating BLA: c, d, iBLA.
protected  Feature[] featList
          the feature list composing the chunk.
protected  Global global
          gloabl settings.
protected  double iBLA
          the three parameters for calculating BLA: c, d, iBLA.
protected  int MAX_USAGE_NUM
          maximum number of usages of a chunk.
protected  double strength
          chunk strength used for conclusion chunks.
protected  int usageNum
          the number of usages of a chunk.
protected  long[] usageRecords
          used for recording the times when the chunk was used.
 
Constructor Summary
Chunk(int type, java.lang.String label, Chunk[] chunks, Global g)
           
Chunk(int type, java.lang.String label, Feature[] list, Global g)
           
 
Method Summary
 void append(int type, java.lang.String label, Chunk[] chunks)
          appends an array of chunks into one chunk.
 void calcBLA(long currentTime)
          calculate chunk BLA.
 java.lang.Object clone()
          methods from class Object
 boolean equals(java.lang.Object other)
          methods from class Object
 double getBLA()
          returns the chunk BLA .
 int getBlaOption()
          returns the chunk BLA option: constant or variable.
 int getChunkType()
          returns the chunk type.
 void getContent(double[] arr)
          returns the content of this chunk in term of activations.
 void getContent(short[] arr)
          returns the content of this chunk in term of active values.
 int getDimNum()
          returns the number of dimesnions in this chunk.
 Feature getFeature(int idx)
          returns a specified feasure in this chunk.
 int getFeatureNum()
          returns the number of feasures in this chunk.
 Feature[] getFeatures()
          returns the list of feasures in this chunk.
 void getFeatures(Feature[] other)
          returns the list of feasures in this chunk.
 java.lang.String getLabel()
          returns the chunk label.
 int getLength()
          returns the chunk length in term of the sum of the lengths of the features in list.
 double getStrength()
          returns the chunk strength.
 int getUsageNum()
          returns the number of usages of this chunk.
 long[] getUsageRecords()
          returns the info of usages of this chunk.
 void getUsageRecords(long[] arr)
          return the info of usages of this chunk.
 int hashCode()
          methods from class Object
 void increaseUsage(long currentTime)
          increase number of chunk usages.
 boolean isEqual(Feature[] features)
          compare two feature list is equal or not.
 void reinit()
          reinit the chunk
 void resetUsage()
          reset the usage of this chunk.
 int searchFeature(java.lang.String label)
          search a specified feature labeled label in this chunk.
 void setBLA_C(double val)
          set chunk BLA parameter.
 void setBLA_D(double val)
          set chunk BLA parameter.
 void setBLA_INIT(double val)
          set chunk BLA parameter.
 void setBla(double bla)
          set chunk BLA.
 void setBlaOption(int option)
          set chunk BLA option.
 void setBlaParams(double[] blaParams)
          set chunk BLA parameters.
 void setLabel(java.lang.String str)
          set chunk label.
 void setStrength(double val)
          set chunk strength.
 void setUsageNum(int num)
          set number of chunk usages.
 void setUsageRecords(long[] records)
          set the info of chunk usages.
 java.lang.String toString()
          methods from class Object
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

global

protected Global global
gloabl settings.


featList

protected Feature[] featList
the feature list composing the chunk.


chunkType

protected int chunkType
the chunk type.


chunkLabel

protected java.lang.String chunkLabel
the chunk label.


chunkBlaOption

protected int chunkBlaOption
the chunk BLA option.


MAX_USAGE_NUM

protected int MAX_USAGE_NUM
maximum number of usages of a chunk.


usageNum

protected int usageNum
the number of usages of a chunk.


usageRecords

protected long[] usageRecords
used for recording the times when the chunk was used.


c

protected double c
the three parameters for calculating BLA: c, d, iBLA.


d

protected double d
the three parameters for calculating BLA: c, d, iBLA.


iBLA

protected double iBLA
the three parameters for calculating BLA: c, d, iBLA.


BLA

protected double BLA
base level activation.


strength

protected double strength
chunk strength used for conclusion chunks.

Constructor Detail

Chunk

public Chunk(int type,
             java.lang.String label,
             Feature[] list,
             Global g)

Chunk

public Chunk(int type,
             java.lang.String label,
             Chunk[] chunks,
             Global g)
Method Detail

append

public void append(int type,
                   java.lang.String label,
                   Chunk[] chunks)
appends an array of chunks into one chunk.

Parameters:
type - the chunk type.
label - the chunk label.
chunks - the array of chunks to form a new chunk.

reinit

public void reinit()
reinit the chunk


getChunkType

public int getChunkType()
returns the chunk type.

Returns:
the chunk type.

getDimNum

public int getDimNum()
returns the number of dimesnions in this chunk.

Returns:
the number of dimesnions in this chunk.

getLabel

public java.lang.String getLabel()
returns the chunk label.

Returns:
the chunk label.

getLength

public int getLength()
returns the chunk length in term of the sum of the lengths of the features in list.

Returns:
the chunk length in term of the sum of the lengths of the features in list.

getBlaOption

public int getBlaOption()
returns the chunk BLA option: constant or variable.

Returns:
the chunk BLA option.

getUsageNum

public int getUsageNum()
returns the number of usages of this chunk.

Returns:
the number of usages of this chunk.

getUsageRecords

public long[] getUsageRecords()
returns the info of usages of this chunk.

Returns:
the info of usages of this chunk.

getUsageRecords

public void getUsageRecords(long[] arr)
return the info of usages of this chunk.

Parameters:
arr - the array to store the usage info.

getBLA

public double getBLA()
returns the chunk BLA .

Returns:
the chunk BLA.

getStrength

public double getStrength()
returns the chunk strength.

Returns:
the chunk strength.

getFeatureNum

public int getFeatureNum()
returns the number of feasures in this chunk.

Returns:
the number of feasures in this chunk.

getFeatures

public Feature[] getFeatures()
returns the list of feasures in this chunk.

Returns:
the list of feasures in this chunk.

getFeatures

public void getFeatures(Feature[] other)
returns the list of feasures in this chunk.

Parameters:
other - the feature array to store the feature list of this chunk.

getFeature

public Feature getFeature(int idx)
returns a specified feasure in this chunk.

Returns:
a specified feasure in this chunk.

getContent

public void getContent(short[] arr)
returns the content of this chunk in term of active values.

Parameters:
arr - the array to store the content of this chunk.

getContent

public void getContent(double[] arr)
returns the content of this chunk in term of activations.

Parameters:
arr - the array to store the content of this chunk.

setLabel

public void setLabel(java.lang.String str)
set chunk label.

Parameters:
str - the label to set.

setBlaOption

public void setBlaOption(int option)
set chunk BLA option.

Parameters:
option - the option to set.

setBla

public void setBla(double bla)
set chunk BLA. used for constent BLA option.

Parameters:
bla - the BLA to set.

setBLA_C

public void setBLA_C(double val)
set chunk BLA parameter. used for variable BLA option.

Parameters:
val - the value to set.

setBLA_D

public void setBLA_D(double val)
set chunk BLA parameter. used for variable BLA option.

Parameters:
val - the value to set.

setBLA_INIT

public void setBLA_INIT(double val)
set chunk BLA parameter. used for variable BLA option.

Parameters:
val - the value to set.

setBlaParams

public void setBlaParams(double[] blaParams)
set chunk BLA parameters. used for variable BLA option.

Parameters:
blaParams - the parameters to set.

setUsageNum

public void setUsageNum(int num)
set number of chunk usages.

Parameters:
num - the value to set.

setUsageRecords

public void setUsageRecords(long[] records)
set the info of chunk usages.

Parameters:
records - the value to set.

setStrength

public void setStrength(double val)
set chunk strength.

Parameters:
val - the value to set.

increaseUsage

public void increaseUsage(long currentTime)
increase number of chunk usages.

Parameters:
currentTime - current time to record as one time of this chunk is used.

resetUsage

public void resetUsage()
reset the usage of this chunk.


calcBLA

public void calcBLA(long currentTime)
calculate chunk BLA.


searchFeature

public int searchFeature(java.lang.String label)
search a specified feature labeled label in this chunk.

Parameters:
label - the label of the feasure to search.

isEqual

public boolean isEqual(Feature[] features)
compare two feature list is equal or not.


toString

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


hashCode

public int hashCode()
methods from class Object


equals

public boolean equals(java.lang.Object other)
methods from class Object


clone

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

Throws:
java.lang.CloneNotSupportedException