darwin.domain
Class MySpecies

java.lang.Object
  extended bydarwin.domain.MySpecies
All Implemented Interfaces:
Species

public class MySpecies
extends java.lang.Object
implements Species

The individual creatures in the world are all representatives of some species class and share certain common characteristics, such as the species name and the program they execute. Rather than copy this information into each creature, this data can be recorded once as part of the description for a species and then each creature can simply include the appropriate species reference as part of its internal data structure.

To encapsulate all of the operations operating on a Species within this abstraction, this provides a constructor that will read a file containing the name of the Species and its Program, as described in the assignment. Note: The instruction addresses start at one, not zero.


Constructor Summary
MySpecies(java.lang.String aFileName)
          Create a Species from a file.
MySpecies(java.lang.String aName, java.lang.String aColor, Program aProgram)
          Create a Species with a given name, color and program.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface darwin.domain.Species
getColor, getName, getProgramSize, getProgramStep
 

Constructor Detail

MySpecies

public MySpecies(java.lang.String aFileName)
          throws java.io.IOException
Create a Species from a file. See the Darwin documentation for the format of a Species file.

Parameters:
aFileName - the name of the Species file.
Throws:
java.io.IOException - if there is an I/O error.

MySpecies

public MySpecies(java.lang.String aName,
                 java.lang.String aColor,
                 Program aProgram)
Create a Species with a given name, color and program.

Parameters:
aName - the name of the species.
aColor - the color of the species.
aProgram - the program of the species.