model
Class InstructionSet<STATE,SYMBOL>

java.lang.Object
  extended by model.InstructionSet<STATE,SYMBOL>
Type Parameters:
STATE - States domain
SYMBOL - Symbols domain
All Implemented Interfaces:
java.io.Serializable

public class InstructionSet<STATE,SYMBOL>
extends java.lang.Object
implements java.io.Serializable

An HashMap containing all the instruction. It is possible to extract an instruction by his current state and the read symbol Copyright (C) 2011 Federico "MrModd" Cosentino (http://mrmodd.it/)

See Also:
Serialized Form

Field Summary
private static long serialVersionUID
           
private  java.util.HashMap<STATE,java.util.HashMap<SYMBOL,Instruction>> states
           
 
Constructor Summary
InstructionSet()
          Create the set
 
Method Summary
 void add(Instruction i)
          Add an instruction
 void erase()
          Delete all the content of this set
 Instruction get(STATE q, SYMBOL s)
          Extract an instruction
 Instruction remove(STATE q, SYMBOL s)
          Remove an instruction
 int size()
          Determine the number of the instructions contained in this set
 Instruction[] toArray()
          Extract all the instruction ad put them on an array
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

serialVersionUID

private static final long serialVersionUID
See Also:
Constant Field Values

states

private java.util.HashMap<STATE,java.util.HashMap<SYMBOL,Instruction>> states
Constructor Detail

InstructionSet

public InstructionSet()
Create the set

Method Detail

add

public void add(Instruction i)
Add an instruction

Parameters:
i - the instruction to add

get

public Instruction get(STATE q,
                       SYMBOL s)
Extract an instruction

Parameters:
q - the current state of the instruction
s - the read symbol of the instruction
Returns:
the instruction if present or null

remove

public Instruction remove(STATE q,
                          SYMBOL s)
Remove an instruction

Parameters:
q - the current state of the instruction
s - the read symbol of the instruction
Returns:
the instruction if present or null

size

public int size()
Determine the number of the instructions contained in this set

Returns:
an int representing the dimension of the set

toArray

public Instruction[] toArray()
Extract all the instruction ad put them on an array

Returns:
an array of Instruction

erase

public void erase()
Delete all the content of this set