visualmodeler
Class ResourceMachine

Object
  extended byvisualmodeler.ResourceMachine

public class ResourceMachine
extends Object

ResourceMachine stores the values assossiated for each machine

Version:
1.1
Author:
Anthony Sulistio and Chee Shin Yeo
Invariant:
$none

Constructor Summary
ResourceMachine(int id, boolean random, Random r)
          Allocates a new ResourceMachine object
 
Method Summary
 String generateCode(String indent)
          Generates the Java code for the creation of PEs
 int getMachineId()
          Gets the machine id
 int getNumPE()
          Gets the number of PEs (Processing Elements)
 void loadXml(org.w3c.dom.NodeList nodeList)
          Loads XML file
 void resetValue()
          Resets the value of PEs into the previous ones
 String saveFile(String indent)
          Saves an information about Machine and PE into XML format
 void saveValue()
          Saves the value of PEs
 void showDialog(javax.swing.JPanel panel)
          Shows a Resource Machine dialog
 
Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ResourceMachine

public ResourceMachine(int id,
                       boolean random,
                       Random r)
Allocates a new ResourceMachine object

Parameters:
id - resource id
random - a flag to determine whether to randomize values or not
r - a Random object
Pre Condition:
r != null
Post Condition:
$none
Method Detail

getMachineId

public int getMachineId()
Gets the machine id

Returns:
the machine id
Pre Condition:
$none
Post Condition:
$result >= 0

getNumPE

public int getNumPE()
Gets the number of PEs (Processing Elements)

Returns:
number of PEs
Pre Condition:
$none
Post Condition:
$result >= 0

generateCode

public String generateCode(String indent)
Generates the Java code for the creation of PEs

Parameters:
indent - indentation
Returns:
a piece of Java code
Pre Condition:
indent != null
Post Condition:
$result != null

saveFile

public String saveFile(String indent)
Saves an information about Machine and PE into XML format

Parameters:
indent - indentation
Returns:
an XML information
Pre Condition:
indent != null
Post Condition:
$result != null

showDialog

public void showDialog(javax.swing.JPanel panel)
Shows a Resource Machine dialog

Parameters:
panel - a JPanel object
Pre Condition:
panel != null
Post Condition:
$none

saveValue

public void saveValue()
Saves the value of PEs

Pre Condition:
$none
Post Condition:
$none

resetValue

public void resetValue()
Resets the value of PEs into the previous ones

Pre Condition:
$none
Post Condition:
$none

loadXml

public void loadXml(org.w3c.dom.NodeList nodeList)
Loads XML file

Parameters:
nodeList - a NodeList object
Pre Condition:
nodeList != null
Post Condition:
$none