LGames
Class Context

java.lang.Object
  |
  +--LGames.Context

public class Context
extends java.lang.Object

This class implements the construction and maintanance of the context Each element of the context is a geometrical figure that is specified by certain features. Possible figures include rectangles, squares, triangles and circles. The context keeps also track of the categorisation of its featureVector.

Copyright (c) 2004 Paul Vogt


Field Summary
 float[] blue
           
 int[][] description
           
 boolean[] distinctive
           
 double[][] featureVector
           
 boolean[] foa
           
 float[] green
           
 int[] height
           
protected  java.lang.String labels
           
 int[] pointX
           
 int[] pointY
           
 float[] red
           
 int[] types
           
 int[] width
           
 
Constructor Summary
Context()
          Empty constructor
Context(Context C, double noise)
           
Context(int cxtSize, boolean[] features, boolean fixedColors)
          This constructor constructs a new context from scratch.
Context(int cxtSize, boolean[] features, boolean fixedColors, int[][] ts, int tslength)
          This constructor constructs a context based on the training set given.
Context(int nMeanings, int cxtSize)
          This constructor creates a context using predefined meanings.
 
Method Summary
 int categoryLength()
          Basically returns the context size
 int getCategory(int i)
           
 java.lang.String getDString(int t)
           
 double[] getFV(int T)
          Returns the feature vector of segment T
 java.lang.String getLabels()
          Returns the string representation of the labels that indicate the selected features
 Meaning getMeaning()
           
 void initDGame()
          Initialises a discrimination game by setting for all objects distinctive to false;
 void print(int n)
          Writes the feature vectors of the context to the standard output
 void print(java.util.List o)
          Writes the context to the standard output
 void setCategory(int[] n)
          This function sets the categories of the context
 void setCategory(int i, int n)
          This function sets the category of an object
 void setFOA(int t, int length)
          Sets the focus of attention
 void setMeaning(Meaning M, int T)
          Sets the meaning of the topic T to meaning M
 int[][] setTrainingSet(int size)
          This function constructs the training set, which is a subset of all objects.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

description

public int[][] description

labels

protected java.lang.String labels

featureVector

public double[][] featureVector

distinctive

public boolean[] distinctive

foa

public boolean[] foa

types

public int[] types

height

public int[] height

width

public int[] width

pointX

public int[] pointX

pointY

public int[] pointY

red

public float[] red

green

public float[] green

blue

public float[] blue
Constructor Detail

Context

public Context()
Empty constructor


Context

public Context(int nMeanings,
               int cxtSize)
This constructor creates a context using predefined meanings. Used in a test function.


Context

public Context(Context C,
               double noise)

Context

public Context(int cxtSize,
               boolean[] features,
               boolean fixedColors)
This constructor constructs a new context from scratch.

Parameters:
cxtSize - The size of the context
features - This is a boolean array telling which features are selected of the RGBSXY
fixedColors - This boolean tells if the colours should be generated randomly (true) or selected from a list (false)

Context

public Context(int cxtSize,
               boolean[] features,
               boolean fixedColors,
               int[][] ts,
               int tslength)
This constructor constructs a context based on the training set given.

Parameters:
cxtSize - number of objects in the context
features - an array of features that are used
fixedColors - whether colors are selected from a fixed set (true) or not (false)
ts - the training set.
tslength - the size of the first dimension (ie. the size of the training set)
Method Detail

setTrainingSet

public int[][] setTrainingSet(int size)
This function constructs the training set, which is a subset of all objects. It is used to implement a bottleneck in the compositionality study.

Parameters:
size - the size of the subset.
Returns:
a 2-dimensional array. The first dimension relates to the object number, the second has 2 places, the first specifies the shape, the second the colour.

getLabels

public java.lang.String getLabels()
Returns the string representation of the labels that indicate the selected features


setFOA

public void setFOA(int t,
                   int length)
Sets the focus of attention


getFV

public double[] getFV(int T)
Returns the feature vector of segment T


setMeaning

public void setMeaning(Meaning M,
                       int T)
Sets the meaning of the topic T to meaning M


initDGame

public void initDGame()
Initialises a discrimination game by setting for all objects distinctive to false;


getMeaning

public Meaning getMeaning()
Returns:
the meaning of the topic

getDString

public java.lang.String getDString(int t)
Returns:
a string describing the object. Helps to analyse what objects are used

print

public void print(java.util.List o)
Writes the context to the standard output


print

public void print(int n)
Writes the feature vectors of the context to the standard output


getCategory

public int getCategory(int i)
Parameters:
i - the index of an object in the context
Returns:
the index of the category of object i

setCategory

public void setCategory(int i,
                        int n)
This function sets the category of an object

Parameters:
i - the index of the object
n - the category (Meaning/ANMeaning) of the object

setCategory

public void setCategory(int[] n)
This function sets the categories of the context

Parameters:
n - an array with the categories (Meaning/ANMeaning) of the objects

categoryLength

public int categoryLength()
Basically returns the context size