logicell
Class CLogicellUniverse

java.lang.Object
  |
  +--logicell.CLogicellUniverse

public class CLogicellUniverse
extends java.lang.Object
implements java.lang.Runnable

This class is the Universe of Logicell, the place where everything happens.


Field Summary
(package private)  CLogicellUI App
          Pointer to App
private  java.util.Vector Blocks1
          2 lists of blocks
private  java.util.Vector Blocks2
          2 lists of blocks
private  java.util.Vector BlocTmp
          Contains the working list.
private  java.util.Vector CellsBlocs
          Contains the current cells blocks.
(package private) static int DefaultDisplayStep
           
(package private) static int DefaultSpeed
           
private  int DisplayStep
          Display only each x generations
(package private)  int EntryBinVal
          Value of bin entry in digit mode
(package private) static char FirstEntry
           
private  int Generation
           
(package private)  boolean IsRunning
          Running flag
(package private)  java.lang.Thread LogicellUnivThread
          Thread
private  CLogiTemplate[] LogiTempl
          Logical structure e.d. a list of templates (equations) representing a problem
private  boolean[] LookUp
          Lookup table
private  int[] LTOutput
          Current templates OutputStates.
(package private) static int M_BINADD
           
(package private) static int M_BINADD2
           
(package private) static int M_CONWAY
           
(package private) static int M_DIGIT
           
(package private) static int M_DIGIT2
           
(package private) static int M_EQUATION
           
(package private) static int M_INIT
          Working mode
(package private) static int M_LIGHT
           
(package private)  CLogicellView MainView
          View
(package private) static int MAXENTRY
          Maximum entries, in fact the algorithm is not limited.
private  int Mode
          Mode
private  int NbTemplate
          Template # in a problem
(package private)  COpDispView OpDispView
          Output View
(package private)  int PatHeight
          Pattern size x
private  CPattern Pattern
          A pattern
(package private)  int PatWidth
          Pattern size y
private  int RemoveEmptyGen
          Remove empty block every # generation.
private  boolean SolFound
           
(package private)  int Speed
          Iteration delay
private  int SpeedOffset
          Speed offset used for speed modification.
(package private)  long Time1
           
(package private)  long TimeAdd
           
(package private)  long TimeCalc
           
(package private)  long TimeDisp
           
(package private)  long TimePoint
           
 
Constructor Summary
CLogicellUniverse(CLogicellUI lu)
          Constructor
 
Method Summary
private  int CheckOutput(CLogiTemplate lt, int gen)
          Check Ouput Value
(package private)  void DrawEquation()
          Draw Equation
(package private)  void DrawOutput()
          Draw Output
 void DrawWorld()
          Default drawing
private  void DrawWorld(jpUtil.JPView jpv)
          Draw World
 void end()
          This is the end...
(package private)  void GenConwayPat(int pat)
          Construct a simple conway pattern
 void GenLogiProblem(java.lang.String[] templ, int st, boolean[] entries, int se)
          Construct a Logical Problem e.d. a combination of templates.
private  void GenNewBlocs()
          Generation of next pop.
(package private)  java.lang.String GetInfoText(int mode, int pat)
          Get Info text
 int GetLtOutputState(int i)
          Return a Logitempl output state
 int GetMode()
          Get Mode
 int GetSpeed()
          Get Speed
 void Go()
          Run the World in View e.g. creates a new pop and draw world.
private  void InitLookUp()
          Init lookup table
 void InitView()
          Init View
(package private)  void InitWorld()
          Init the world
(package private)  void Launch()
          Start the world
private  int Neighbour(long v, boolean c)
          Calc #neighbour
 void RemoveViews()
          Remove views
 void run()
          Launch thread
 void SetMode(int mode)
          Set the Mode
private  void SetSpeed(int s)
          Set speed
 void SpeedDecr()
          Decrease speed
 void SpeedIncr()
          Increase speed
 void stop()
           
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait
 

Field Detail

MAXENTRY

static final int MAXENTRY
Maximum entries, in fact the algorithm is not limited.

DefaultSpeed

static final int DefaultSpeed

DefaultDisplayStep

static final int DefaultDisplayStep

FirstEntry

static final char FirstEntry

M_INIT

static final int M_INIT
Working mode

M_EQUATION

static final int M_EQUATION

M_CONWAY

static final int M_CONWAY

M_LIGHT

static final int M_LIGHT

M_DIGIT

static final int M_DIGIT

M_DIGIT2

static final int M_DIGIT2

M_BINADD

static final int M_BINADD

M_BINADD2

static final int M_BINADD2

App

CLogicellUI App
Pointer to App

PatHeight

int PatHeight
Pattern size x

PatWidth

int PatWidth
Pattern size y

MainView

CLogicellView MainView
View

OpDispView

COpDispView OpDispView
Output View

LogicellUnivThread

java.lang.Thread LogicellUnivThread
Thread

EntryBinVal

int EntryBinVal
Value of bin entry in digit mode

IsRunning

boolean IsRunning
Running flag

Speed

int Speed
Iteration delay

Time1

long Time1

TimeCalc

long TimeCalc

TimeDisp

long TimeDisp

TimePoint

long TimePoint

TimeAdd

long TimeAdd

RemoveEmptyGen

private final int RemoveEmptyGen
Remove empty block every # generation. Woks only in Conway mode.

SpeedOffset

private final int SpeedOffset
Speed offset used for speed modification.

LookUp

private boolean[] LookUp
Lookup table

CellsBlocs

private java.util.Vector CellsBlocs
Contains the current cells blocks. Just a pointer

BlocTmp

private java.util.Vector BlocTmp
Contains the working list. Just a pointer

Blocks1

private java.util.Vector Blocks1
2 lists of blocks

Blocks2

private java.util.Vector Blocks2
2 lists of blocks

Pattern

private CPattern Pattern
A pattern

LogiTempl

private CLogiTemplate[] LogiTempl
Logical structure e.d. a list of templates (equations) representing a problem

LTOutput

private int[] LTOutput
Current templates OutputStates. Used to display output only when a state changes.

NbTemplate

private int NbTemplate
Template # in a problem

Mode

private int Mode
Mode

SolFound

private boolean SolFound

Generation

private int Generation

DisplayStep

private int DisplayStep
Display only each x generations
Constructor Detail

CLogicellUniverse

public CLogicellUniverse(CLogicellUI lu)
Constructor
Method Detail

InitWorld

void InitWorld()
Init the world

InitView

public void InitView()
Init View

run

public void run()
Launch thread
Specified by:
run in interface java.lang.Runnable

Launch

void Launch()
Start the world

GenLogiProblem

public void GenLogiProblem(java.lang.String[] templ,
                           int st,
                           boolean[] entries,
                           int se)
Construct a Logical Problem e.d. a combination of templates.

GenConwayPat

void GenConwayPat(int pat)
Construct a simple conway pattern

Go

public void Go()
Run the World in View e.g. creates a new pop and draw world.

SetMode

public void SetMode(int mode)
Set the Mode

GetMode

public int GetMode()
Get Mode

DrawWorld

public void DrawWorld()
Default drawing

DrawEquation

void DrawEquation()
Draw Equation

DrawOutput

void DrawOutput()
Draw Output

RemoveViews

public void RemoveViews()
Remove views

stop

public void stop()

end

public void end()
This is the end...

GetInfoText

java.lang.String GetInfoText(int mode,
                             int pat)
Get Info text

GetSpeed

public int GetSpeed()
Get Speed

SpeedIncr

public void SpeedIncr()
Increase speed

SpeedDecr

public void SpeedDecr()
Decrease speed

GetLtOutputState

public int GetLtOutputState(int i)
Return a Logitempl output state

CheckOutput

private int CheckOutput(CLogiTemplate lt,
                        int gen)
Check Ouput Value

GenNewBlocs

private void GenNewBlocs()
Generation of next pop. For each cell, generation of the 3x3 neighbourood and process new value.

InitLookUp

private void InitLookUp()
Init lookup table

Neighbour

private int Neighbour(long v,
                      boolean c)
Calc #neighbour

DrawWorld

private void DrawWorld(jpUtil.JPView jpv)
Draw World

SetSpeed

private void SetSpeed(int s)
Set speed