com.github.croesch.micro_debug.mic1.controlstore
Class MicroControlStore

java.lang.Object
  extended by com.github.croesch.micro_debug.commons.AbstractCodeContainer
      extended by com.github.croesch.micro_debug.mic1.controlstore.MicroControlStore

public final class MicroControlStore
extends AbstractCodeContainer

The store for MicroInstructions.

Since:
Date: Nov 19, 2011
Author:
croesch

Constructor Summary
MicroControlStore(java.io.InputStream in)
          Constructs a MicroControlStore with the MicroInstruction fetched from the given stream.
 
Method Summary
 boolean equals(java.lang.Object obj)
           
protected  int getFirstPossibleCodeAddress()
          Returns the address where the first possible code is stored.
 MicroInstruction getInstruction(int mpc)
          Returns the instruction from the store that is stored under the given mpc (address).
protected  int getLastPossibleCodeAddress()
          Returns the address where the last possible code is stored.
 int getSize()
          Returns the size of this store - the number of instructions that this store contains.
 int hashCode()
           
protected  int printCodeLine(int i)
          Prints the line with the given number to the user.
 
Methods inherited from class com.github.croesch.micro_debug.commons.AbstractCodeContainer
formatIntToHex, printCode, printCode, printCodeAroundLine
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MicroControlStore

public MicroControlStore(java.io.InputStream in)
                  throws MicroFileFormatException
Constructs a MicroControlStore with the MicroInstruction fetched from the given stream. If the magic number is incorrect, or if there are too few or too many bytes to read, a MicroFileFormatException will be thrown.

Parameters:
in - the stream to read the instructions from
Throws:
MicroFileFormatException - if
  • the stream does only contain less or equal than four bytes
  • the magic number isn't correct
  • the stream contains too much data
  • an IOException occurs
Since:
Date: Nov 19, 2011
Method Detail

getInstruction

@Nullable
public MicroInstruction getInstruction(int mpc)
Returns the instruction from the store that is stored under the given mpc (address).

Parameters:
mpc - the address of the instruction to fetch - only the least nine bits will be used.
Returns:
the MicroInstruction that is stored at the given address, or null if there is no instruction at the given address.
Since:
Date: Nov 20, 2011

getSize

public int getSize()
Returns the size of this store - the number of instructions that this store contains.

Returns:
the number of MicroInstructions this store can contain
Since:
Date: Apr 18, 2012

getFirstPossibleCodeAddress

protected int getFirstPossibleCodeAddress()
Description copied from class: AbstractCodeContainer
Returns the address where the first possible code is stored.

Specified by:
getFirstPossibleCodeAddress in class AbstractCodeContainer
Returns:
the number of the first code line.

getLastPossibleCodeAddress

protected int getLastPossibleCodeAddress()
Description copied from class: AbstractCodeContainer
Returns the address where the last possible code is stored.

Specified by:
getLastPossibleCodeAddress in class AbstractCodeContainer
Returns:
the number of the last code line.

printCodeLine

protected int printCodeLine(int i)
Description copied from class: AbstractCodeContainer
Prints the line with the given number to the user. Returns the number of code lines to skip after this line, in case of reading arguments.

Specified by:
printCodeLine in class AbstractCodeContainer
Parameters:
i - the line number of the code instruction to print
Returns:
the number of lines that can be skipped after printing this line

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object

equals

public boolean equals(java.lang.Object obj)
Overrides:
equals in class java.lang.Object


Copyright © 2012. All Rights Reserved.