|
From: <mar...@us...> - 2007-10-31 03:45:27
|
Revision: 76
http://gridsim.svn.sourceforge.net/gridsim/?rev=76&view=rev
Author: marcos_dias
Date: 2007-10-30 20:45:23 -0700 (Tue, 30 Oct 2007)
Log Message:
-----------
Modified Paths:
--------------
branches/gridsim4.0-branch3/source/gridsim/gui/AllocationListener.java
branches/gridsim4.0-branch3/source/gridsim/gui/DefaultGridSimVisualizer.java
branches/gridsim4.0-branch3/source/gridsim/gui/GridSimVisualizer.java
branches/gridsim4.0-branch3/source/gridsim/gui/ResourceWindow.java
branches/gridsim4.0-branch3/source/gridsim/turbo/ARMessage.java
branches/gridsim4.0-branch3/source/gridsim/turbo/ARParallelSpaceShared.java
branches/gridsim4.0-branch3/source/gridsim/turbo/ARTPolicy.java
branches/gridsim4.0-branch3/source/gridsim/turbo/AvailabilityProfileEntry.java
branches/gridsim4.0-branch3/source/gridsim/turbo/FilterARMessage.java
branches/gridsim4.0-branch3/source/gridsim/turbo/PERange.java
branches/gridsim4.0-branch3/source/gridsim/turbo/ParallelSpaceShared.java
branches/gridsim4.0-branch3/source/gridsim/turbo/Reservation.java
branches/gridsim4.0-branch3/source/gridsim/turbo/ReservationRequester.java
branches/gridsim4.0-branch3/source/gridsim/turbo/SSGridlet.java
branches/gridsim4.0-branch3/source/gridsim/turbo/SSReservation.java
branches/gridsim4.0-branch3/source/gridsim/turbo/ScheduleItem.java
branches/gridsim4.0-branch3/source/gridsim/turbo/TAllocPolicy.java
branches/gridsim4.0-branch3/source/gridsim/turbo/TResourceCharacteristics.java
branches/gridsim4.0-branch3/source/gridsim/turbo/TimeSlotEntry.java
branches/gridsim4.0-branch3/source/gridsim/turbo/TimeSlotList.java
Added Paths:
-----------
branches/gridsim4.0-branch3/source/gridsim/turbo/OrderGridletByStartTime.java
Removed Paths:
-------------
branches/gridsim4.0-branch3/source/gridsim/turbo/OrderGridletbyStartTime.java
Modified: branches/gridsim4.0-branch3/source/gridsim/gui/AllocationListener.java
===================================================================
--- branches/gridsim4.0-branch3/source/gridsim/gui/AllocationListener.java 2007-10-19 00:52:11 UTC (rev 75)
+++ branches/gridsim4.0-branch3/source/gridsim/gui/AllocationListener.java 2007-10-31 03:45:23 UTC (rev 76)
@@ -7,6 +7,8 @@
package gridsim.gui;
+import gridsim.Gridlet;
+
/**
* {@link AllocationListener} interface has to be implemented by
* classes that register with the allocation policy to receive
@@ -23,7 +25,7 @@
/**
* This method has to be implemented by the listener
* to handle the action
- * @param action the action taken by the {@link AllocationSubject} object
+ * @param action the action taken by an entity
* @return <tt>true</tt> if the action has been handled successfully
* or <tt>false</tt> otherwise.
*/
Modified: branches/gridsim4.0-branch3/source/gridsim/gui/DefaultGridSimVisualizer.java
===================================================================
--- branches/gridsim4.0-branch3/source/gridsim/gui/DefaultGridSimVisualizer.java 2007-10-19 00:52:11 UTC (rev 75)
+++ branches/gridsim4.0-branch3/source/gridsim/gui/DefaultGridSimVisualizer.java 2007-10-31 03:45:23 UTC (rev 76)
@@ -51,8 +51,8 @@
import javax.swing.event.ListSelectionListener;
/**
- * {@link GridSimVisualiser} is the class that represents the main window.
- * used by the visualisation tool. From this window it is possible to
+ * {@link DefaultGridSimVisualizer} is the class that represents the
+ * main window used by the visualisation tool. From this window it is possible to
* start the simulation, run step by step or run it in slow motion. <br>
* <b>NOTE:</b> This visualisation tool should be used for debugging
* purposes only. It is useful if you want to evaluate a new allocation
@@ -68,10 +68,11 @@
* @see gridsim.GridSim#startGridSimulation(boolean)
* @see gridsim.GridSim#startGridSimulation()
* @see gridsim.turbo.ParallelSpaceShared
- * @see gridsim.turbo.ARTParallelSpaceShared
+ * @see gridsim.turbo.ARParallelSpaceShared
*/
public class DefaultGridSimVisualizer extends JFrame
- implements ActionListener, ListSelectionListener, GridSimVisualizer {
+ implements ActionListener, ListSelectionListener,
+ GridSimVisualizer {
private static final long serialVersionUID = 2059324063853260682L;
public static final int WINDOW_WIDTH = 400;
@@ -100,17 +101,11 @@
// a list of all the allocation listeners in the system
private static LinkedHashMap<Integer, AllocationListener> listeners_;
-
- // constants to indicate the time unit to be used for displaying
- // information
- public static final int TIME_UNIT_SECOND = 0;
- public static final int TIME_UNIT_MINUTE = 1;
- public static final int TIME_UNIT_HOUR = 2;
-
+
static {
listeners_ = new LinkedHashMap<Integer, AllocationListener>();
}
-
+
/**
* Creates the main window of the visualiser.
*/
Modified: branches/gridsim4.0-branch3/source/gridsim/gui/GridSimVisualizer.java
===================================================================
--- branches/gridsim4.0-branch3/source/gridsim/gui/GridSimVisualizer.java 2007-10-19 00:52:11 UTC (rev 75)
+++ branches/gridsim4.0-branch3/source/gridsim/gui/GridSimVisualizer.java 2007-10-31 03:45:23 UTC (rev 76)
@@ -9,6 +9,12 @@
public interface GridSimVisualizer {
+ // constants to indicate the time unit to be used for displaying
+ // information
+ public static final int TIME_UNIT_SECOND = 1;
+ public static final int TIME_UNIT_MINUTE = 60;
+ public static final int TIME_UNIT_HOUR = 60 * 60;
+
/**
* Notifies a listener about the action performed
* @param action the action performed
Modified: branches/gridsim4.0-branch3/source/gridsim/gui/ResourceWindow.java
===================================================================
--- branches/gridsim4.0-branch3/source/gridsim/gui/ResourceWindow.java 2007-10-19 00:52:11 UTC (rev 75)
+++ branches/gridsim4.0-branch3/source/gridsim/gui/ResourceWindow.java 2007-10-31 03:45:23 UTC (rev 76)
@@ -28,6 +28,7 @@
import gridsim.turbo.ScheduleItem;
import java.awt.AlphaComposite;
+import java.awt.BasicStroke;
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Composite;
@@ -114,7 +115,7 @@
private JRadioButton secondButton_;
private JRadioButton minuteButton_;
private JRadioButton hourButton_;
- private boolean drawID_;
+ private boolean drawID_ = true;
// the left panel itself, the scroller for the scheduling queue panel
// and the panel where the jobs are drawn
@@ -122,7 +123,7 @@
private JScrollPane scroller_;
private DrawingPanel drawingPanel_;
private long currentTime_;
- private double timeSpan_;
+ private double timeSpan_ = 200;
// the panel that shows the list of gridlets or advance reservations
private ItemPanel itemPanel_;
@@ -131,12 +132,12 @@
private ArrayList<ScheduleItem> scheduledItems_;
// time unit used to display information on the screen
- private int timeUnit_;
+ private int timeUnit_ = GridSimVisualizer.TIME_UNIT_SECOND;
private static final int WINDOW_WIDTH = 1100;
private static final int WINDOW_HEIGHT = 300;
- private static final int SHIFT_X = 20;
- private static final int SHIFT_Y = 30;
+ private static final int SHIFT_X = 30;
+ private static final int SHIFT_Y = 25;
private static final int SHIFT_BOTTOM = 15;
/**
@@ -146,23 +147,21 @@
*/
public ResourceWindow(GridResource resource, int windowId) {
resource_ = resource;
- numPE_ = resource_.getResourceCharacteristics().getNumPE();
- timeSpan_ = 200; // default time span of 200 seconds
+ numPE_ = resource_.getResourceCharacteristics().getNumPE();
// sets layout to null as the components are resized
// by a component adaptor triggered by resizing the window
super.getContentPane().setLayout(null);
super.setSize(WINDOW_WIDTH, WINDOW_HEIGHT);
- drawID_ = true;
- timeUnit_ = DefaultGridSimVisualizer.TIME_UNIT_SECOND;
-
// initialises the list of Gridlets
scheduledItems_ = new ArrayList<ScheduleItem>();
// initialise the left and right panels
initPanels();
- super.addComponentListener(new ResizeFrame(this));
+ ResizeFrame adapter = new ResizeFrame();
+ adapter.frame_ = this;
+ super.addComponentListener(adapter);
super.setLocation(DefaultGridSimVisualizer.WINDOW_WIDTH, windowId * 200);
super.setTitle("Resource Information Window - " +
@@ -175,13 +174,13 @@
* Returns the name of the resource associated with this window
* @return the resource name
*/
- public String getResourceName(){
+ public String getResourceName() {
return resource_.get_name();
}
/**
* Handles allocation actions
- * @param an allocation action performed by the @link{AllocationSubject}
+ * @param action an allocation action performed
*/
public boolean allocationActionPerformed(AllocationAction action) {
int type = action.getActionType();
@@ -233,24 +232,19 @@
* @param e the event received
*/
public void actionPerformed(ActionEvent e) {
- if (e.getSource() == secondButton_) {
- if(secondButton_.isSelected()) {
- timeUnit_ = DefaultGridSimVisualizer.TIME_UNIT_SECOND;
- itemPanel_.updatePanel();
- }
+ if (e.getSource() == secondButton_ && secondButton_.isSelected()) {
+ timeUnit_ = GridSimVisualizer.TIME_UNIT_SECOND;
}
- else if (e.getSource() == minuteButton_) {
- if(minuteButton_.isSelected()) {
- timeUnit_ = DefaultGridSimVisualizer.TIME_UNIT_MINUTE;
- itemPanel_.updatePanel();
- }
+ else if (e.getSource() == minuteButton_ && minuteButton_.isSelected()) {
+ timeUnit_ = GridSimVisualizer.TIME_UNIT_MINUTE;
}
- else if (e.getSource() == hourButton_) {
- if(hourButton_.isSelected()) {
- timeUnit_ = DefaultGridSimVisualizer.TIME_UNIT_HOUR;
- itemPanel_.updatePanel();
- }
+ else if (e.getSource() == hourButton_ && hourButton_.isSelected()) {
+ timeUnit_ = GridSimVisualizer.TIME_UNIT_HOUR;
}
+
+ if(scheduledItems_.size() > 0)
+ itemPanel_.updatePanel();
+
updateResourceWindow();
}
@@ -265,12 +259,9 @@
// calculates the size of the two panels
// to be added to the window
- int windowWidth = super.getWidth();
- int windowHeight = super.getHeight();
-
- int leftPanelWidth = (int)((windowWidth/3.5) * 2.3);
- int leftPanelHeight = (int)((windowHeight) - 20);
- int gridletPanelWidth = (int)((windowWidth/3.5) * 1.2);
+ int leftPanelWidth = (int)((super.getWidth()/3.5) * 2.3);
+ int leftPanelHeight = (int)((super.getHeight()) - 20);
+ int gridletPanelWidth = (int)((super.getWidth()/3.5) * 1.2);
int gridletPanelHeight = leftPanelHeight;
int leftPanelXPos = 0;
int gridletPanelXPos = leftPanelXPos + leftPanelWidth;
@@ -353,7 +344,6 @@
//Set up the drawing area.
drawingPanel_ = new DrawingPanel();
- drawingPanel_.setBackground(new Color(20, 15, 60));
//Put the drawing area in a scroll pane.
scroller_ = new JScrollPane(drawingPanel_);
@@ -384,14 +374,10 @@
timeSpan_ = time;
return true;
}
- else {
+ else
return false;
- }
}
- /**
- * Updates the interface of the resource window
- */
private void updateResourceWindow(){
drawingPanel_.repaint();
}
@@ -401,30 +387,21 @@
* @param the time in seconds
* @return the time in the unit in use
*/
- private double convertToUnitInUse(double time) {
- if(timeUnit_ == DefaultGridSimVisualizer.TIME_UNIT_SECOND) {
- return time;
- }
- else if(timeUnit_ == DefaultGridSimVisualizer.TIME_UNIT_MINUTE) {
- return time/60;
- }
- else {
- return time/60/60;
- }
+ private double convertTime(double time) {
+ return time / timeUnit_;
}
// -------------------------- PRIVATE CLASSES -----------------------
/**
- * Private class responsible for resizing the two main panels
+ * Class responsible for resizing the two main panels
* that compose the resource window interface
*/
class ResizeFrame extends ComponentAdapter {
JFrame frame_ = null;
- public ResizeFrame(JFrame frame) {
+ public ResizeFrame() {
super();
- frame_ = frame;
}
public void componentResized(ComponentEvent evt) {
@@ -449,10 +426,9 @@
}
/**
- * The panel inside the scroll pane where the
- * gridlets are shown.
+ * The panel inside the scroll pane where the jobs are shown.
*/
- private class DrawingPanel extends JPanel {
+ class DrawingPanel extends JPanel {
private static final long serialVersionUID = -636030997043222745L;
@@ -460,6 +436,20 @@
private int panelWidth_;
private float scaleY_;
private float scaleX_;
+
+ private BasicStroke dashedStroke_ = new BasicStroke(1, BasicStroke.CAP_ROUND,
+ BasicStroke.JOIN_ROUND, 4, new float[]{2.0f}, 0);
+ private BasicStroke normalStroke_ = new BasicStroke(1);
+
+ private Color backgroundColor_ = new Color(20, 15, 60);
+ private Color timeGridColor_ = Color.LIGHT_GRAY;
+ private Color topTextColor_ = Color.WHITE;
+ private Color bottomTextColor_ = Color.RED;
+ private Color graphBorderColor_ = Color.WHITE;
+ private Color currentTimeLineColor_ = Color.GREEN;
+ private Font graphFont_ = new Font("Dialog", Font.BOLD, 10);
+
+ private Composite transpComp_ = AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 0.6f);
// some colors to draw the jobs
private final Color colorsQueued[] =
@@ -477,35 +467,17 @@
// a job to be highlited. That is, if the user selects a gridlet or advance
// reservation in the list, then it can see in the panel what gridlet has
// been selected
- private ScheduleItem highlightedItem_;
+ ScheduleItem highlightedItem_ = null;
- /**
- * Default constructor
- */
public DrawingPanel(){
super();
-
- // starts the highlighted item as none
- highlightedItem_ = null;
+ super.setBackground(backgroundColor_);
}
-
- /**
- * Sets the item to be highlighted
- * @param item the item to be highlighted
- */
- protected synchronized void setHighlightedItem(ScheduleItem item) {
- highlightedItem_ = item;
- }
- /*
- * (non-Javadoc)
- * @see javax.swing.JComponent#paintComponent(java.awt.Graphics)
- */
- protected synchronized void paintComponent(Graphics g2D) {
- super.paintComponent(g2D);
-
- Font font = new Font("Dialog", Font.BOLD, 10);
- g2D.setFont(font);
+ protected synchronized void paintComponent(Graphics g2) {
+ super.paintComponent(g2);
+ Graphics2D g2D = (Graphics2D)g2;
+ g2D.setFont(graphFont_);
panelHeight_ = leftPanel_.getHeight() - 100 - SHIFT_Y - SHIFT_BOTTOM;
panelWidth_ = leftPanel_.getWidth() - 50 - 2 * SHIFT_X;
@@ -519,63 +491,90 @@
super.setPreferredSize(new Dimension((int) (timeSpan_ * scaleX_) + 2 * SHIFT_X,
(int) ((numPE_) * scaleY_) + SHIFT_Y + SHIFT_BOTTOM));
- super.setForeground(Color.GREEN);
-
- g2D.drawRect(SHIFT_X, SHIFT_Y, (int) (timeSpan_ * scaleX_),
- (int) (numPE_ * scaleY_));
-
- drawSchedulingQueue(scheduledItems_, scaleY_, scaleX_, g2D);
- drawTimeGrid(scaleX_, scaleY_, timeSpan_, g2D);
+ drawSchedulingQueue(g2D);
+ drawGridsAndAxes(g2D);
super.revalidate();
}
/**
* Draws the lines and time scale on the scheduling window
- * @param scaleX the current zoom scale of the X axis
- * @param scaleY the current zoom scale of the Y axis
* @param timeSpan the time span of the simulation
* @param g2D the graphics 2D context
*/
- private void drawTimeGrid(float scaleX, float scaleY, double timeSpan, Graphics g2D) {
- for(int i = 0 ; i <= (int)(timeSpan * scaleX) ; i += 50) {
- g2D.setColor(Color.GREEN);
- g2D.drawLine(SHIFT_X + (int)(i), SHIFT_Y + 0, SHIFT_X +
- (int)( i ), SHIFT_Y + (int)(numPE_ * scaleY));
-
- g2D.setColor(Color.RED);
- g2D.drawString(new Integer((int)convertToUnitInUse((i/scaleX))).toString(),
- SHIFT_X + i, SHIFT_Y + (int)(numPE_ * scaleY) + 20);
+ private void drawGridsAndAxes(Graphics2D g2D) {
+
+ String text = null;
+ g2D.setColor(timeGridColor_);
+ g2D.setStroke(dashedStroke_);
+
+ Composite previousComposite = g2D.getComposite();
+ g2D.setComposite(transpComp_);
+
+ int heightGph = (int)(numPE_ * scaleY_);
+ int widthGph = (int) (timeSpan_ * scaleX_);
+ int x, y;
+
+ for(int i=0; i<=widthGph; i+=50) {
+ x = SHIFT_X + i;
+ g2D.drawLine(x, SHIFT_Y, x, SHIFT_Y + heightGph);
}
-
- g2D.setColor(Color.WHITE);
-
- g2D.drawLine(SHIFT_X + (int)(currentTime_ * scaleX), SHIFT_Y - 10,
- SHIFT_X + (int)(currentTime_ * scaleX), SHIFT_Y + (int)(numPE_ * scaleY) + 10);
-
- g2D.drawString("CT: "+ (new Integer((int)(convertToUnitInUse(currentTime_)) ).toString()),
- SHIFT_X + (int)(currentTime_ * scaleX), SHIFT_Y - 20);
-
- g2D.drawLine(SHIFT_X + (int)(timeSpan * scaleX), SHIFT_Y - 10,
- SHIFT_X + (int)(timeSpan * scaleX), SHIFT_Y + (int)(numPE_ * scaleY) + 10);
-
- g2D.drawString("Time Span: "+ (new Integer((int)(convertToUnitInUse(timeSpan)) ).toString()),
- (int)(timeSpan * scaleX) - 40, SHIFT_Y - 20);
+
+ g2D.setComposite(previousComposite);
+ g2D.setStroke(normalStroke_);
+
+ g2D.setColor(graphBorderColor_);
+ g2D.drawRect(SHIFT_X, SHIFT_Y, widthGph, heightGph);
+
+ for(int i=0; i <= widthGph; i+=50) {
+ x = SHIFT_X + i;
+ g2D.drawLine(x, SHIFT_Y + heightGph - 5, x, SHIFT_Y + heightGph + 3);
+ }
+
+ g2D.setColor(bottomTextColor_);
+ y = SHIFT_Y + heightGph + 20;
+ for(int i=0; i<=widthGph; i+=50) {
+ text = "" + (int)convertTime((i/scaleX_));
+ g2D.drawString(text, SHIFT_X + i - ((text.length() * 6)/2), y);
+ }
+
+ g2D.setColor(topTextColor_);
+ text = "CT: "+ (int)(convertTime(currentTime_));
+ g2D.drawString(text, SHIFT_X + (int)(currentTime_ * scaleX_) - (text.length() * 5),
+ SHIFT_Y - 10);
+
+ text = "Time Span: " + (int)(convertTime(timeSpan_));
+ y = SHIFT_Y + (text.length() * 6);
+ x = widthGph + SHIFT_X + 15;
+ g2D.rotate(-1.571, x, y);
+ g2D.drawString(text, x, y);
+ g2D.rotate(1.571, x, y);
+
+ x = SHIFT_X - 5;
+ y = heightGph + SHIFT_Y - 10;
+ g2D.rotate(-1.571, x, y);
+ g2D.drawString("Processing Elements", x, y);
+ g2D.rotate(1.571, x, y);
+
+ g2D.setColor(currentTimeLineColor_);
+ x = SHIFT_X + (int)(currentTime_ * scaleX_);
+ g2D.drawLine(x, SHIFT_Y - 7, x, SHIFT_Y + heightGph + 10);
}
/*
* Draws the boxes representing the gridlets or advance reservations
*/
- private void drawSchedulingQueue(ArrayList<ScheduleItem> queue,
- float scaleY, float scaleX, Graphics g2D) {
+ private void drawSchedulingQueue(Graphics2D g2D) {
Color boxColor = null;
Color fontColor = null;
- int size = queue.size();
+ int size = scheduledItems_.size();
for(int i=0; i<size; i++) {
- ScheduleItem item = (ScheduleItem)queue.get(i);
+ ScheduleItem item = (ScheduleItem)scheduledItems_.get(i);
+ if(item == null)
+ continue;
+
int itemId = item.getID();
-
if (item.getPERangeList() != null){
// the color of the font for normal gridlets is black
fontColor = Color.BLACK;
@@ -613,13 +612,13 @@
boxColor = colorsDone[(itemId % colorsDone.length)];
}
}
- drawItem((Graphics2D) g2D, item, boxColor, fontColor, scaleY, scaleX);
+ drawItem((Graphics2D) g2D, item, boxColor, fontColor);
}
}
// if there is an item to be highlighted, then do it
if(highlightedItem_ != null) {
- highlightItem((Graphics2D) g2D, highlightedItem_, scaleY, scaleX);
+ highlightItem((Graphics2D) g2D, highlightedItem_);
}
}
@@ -628,7 +627,7 @@
* This method assumes that the gridlet has a range of PEs
*/
private void drawItem(Graphics2D g2D, ScheduleItem item, Color boxColor,
- Color fontColor, float scaleY, float scaleX) {
+ Color fontColor) {
int y;
int h = 0; //controls the height to draw the gridlet
PERangeList gridletPERanges = item.getPERangeList();
@@ -642,8 +641,8 @@
// gets the time duration of the gridlet
double duration = item.getFinishTime() - item.getStartTime();
- width = (int) (duration * scaleX);
- firstX = SHIFT_X + (int) (item.getStartTime() * scaleX);
+ width = (int) (duration * scaleX_);
+ firstX = SHIFT_X + (int) (item.getStartTime() * scaleX_);
String boxText;
LineMetrics lineMetrics;
@@ -658,8 +657,8 @@
y = range.getEnd();
h = range.getNumPE();
- firstY = SHIFT_Y + (int) ((numPE_ - (y + 1)) * scaleY);
- height = (int) ((h) * scaleY);
+ firstY = SHIFT_Y + (int) ((numPE_ - (y + 1)) * scaleY_);
+ height = (int) ((h) * scaleY_);
// if it is a gridlet that reserved resources, then make it
// transparent to show the advance reservation as well
@@ -667,9 +666,7 @@
Composite previousComposite = null;
if(reservedGridlet) {
previousComposite = g2D.getComposite();
- AlphaComposite ac =
- AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 0.65f);
- g2D.setComposite(ac);
+ g2D.setComposite(transpComp_);
}
g2D.setColor(boxColor);
@@ -702,8 +699,7 @@
* Highlights a schedule item. This method basically draws the item
* in the resource window with red lines.
*/
- private void highlightItem(Graphics2D g2D, ScheduleItem item,
- float scaleY, float scaleX) {
+ private void highlightItem(Graphics2D g2D, ScheduleItem item) {
int y;
int h = 0; //controls the height to draw the gridlet
@@ -720,8 +716,8 @@
// gets the time duration of the gridlet
double duration = item.getFinishTime() - item.getStartTime();
- width = (int) (duration * scaleX);
- firstX = SHIFT_X + (int) (item.getStartTime() * scaleX);
+ width = (int) (duration * scaleX_);
+ firstX = SHIFT_X + (int) (item.getStartTime() * scaleX_);
// A gridlet can have the nodes 0-2, 5-7, etc.
// So it must be painted in parts
@@ -729,8 +725,8 @@
y = range.getEnd();
h = range.getNumPE();
- firstY = SHIFT_Y + (int) ((numPE_ - (y + 1)) * scaleY);
- height = (int) ((h) * scaleY);
+ firstY = SHIFT_Y + (int) ((numPE_ - (y + 1)) * scaleY_);
+ height = (int) ((h) * scaleY_);
g2D.setColor(Color.RED);
g2D.drawRect(firstX, firstY, width, height);
@@ -763,16 +759,11 @@
private JTextArea itemInfoArea_;
private Vector<ScheduleItem> items_;
- /**
- * Creates a new {@link ItemPanel} object.
- * @param frame the frame in which the panel will be inserted
- */
- public ItemPanel() {
+
+ protected ItemPanel() {
init("Information About Gridlets and Reservations");
}
- // ---------------------- PUBLIC METHODS ----------------------
-
/**
* Handles events triggered by the change of the list of Gridlets
* @see ListSelectionListener#valueChanged(ListSelectionEvent)
@@ -783,7 +774,7 @@
if (item != null) {
updateItemDetails(item);
- drawingPanel_.setHighlightedItem(item);
+ drawingPanel_.highlightedItem_ = item;
drawingPanel_.repaint();
}
}
@@ -795,7 +786,7 @@
* the list and updates the details.
* @param item the item whose information has to be updated
*/
- public void updateItem(ScheduleItem item) {
+ protected void updateItem(ScheduleItem item) {
int position = getPosition(item.getID(), item.getUserID(),
item.isAdvanceReservation());
@@ -811,7 +802,7 @@
/**
* Called when an update of the whole panel is needed
*/
- public void updatePanel() {
+ protected void updatePanel() {
int selectedIndex = (int) itemQueueJList_.getSelectedIndex();
ScheduleItem item = items_.get(selectedIndex);
@@ -840,11 +831,13 @@
scrollPaneJobs.setBorder(new TitledBorder("List"));
super.setLayout(new GridLayout(1, 2));
+ itemQueueJList_.setFont(itemQueueJList_.getFont().deriveFont(9.5f));
itemQueueJList_.setBackground(super.getBackground());
scrollPaneJobs.setBackground(super.getBackground());
// the list that contains the details of an item
itemInfoArea_ = new JTextArea();
+ itemInfoArea_.setFont(itemInfoArea_.getFont().deriveFont(9.5f));
Border panelBorder =
new CompoundBorder(BorderFactory.createEmptyBorder(10, 0, 10, 0),
Modified: branches/gridsim4.0-branch3/source/gridsim/turbo/ARMessage.java
===================================================================
--- branches/gridsim4.0-branch3/source/gridsim/turbo/ARMessage.java 2007-10-19 00:52:11 UTC (rev 75)
+++ branches/gridsim4.0-branch3/source/gridsim/turbo/ARMessage.java 2007-10-31 03:45:23 UTC (rev 76)
@@ -120,7 +120,8 @@
* Instantiates a new {@link ARMessage} object.
* @param sourceId the id of entity that is the source of this message
* @param reservation the reservation to which this message refers
- * @throws ParameterException is thrown if the ID is < 0
+ * @throws ParameterException is thrown if the IDs are < 0 or
+ * the reservation object is <tt>null</tt>
*/
public ARMessage(int sourceId,
Reservation reservation) throws ParameterException {
@@ -140,7 +141,7 @@
* @param destId the id of the entity that is the recipient of this message
* @param reservation the reservation to which this message refers
* @throws ParameterException is thrown if the IDs are < 0 or
- * the negotiation object is <tt>null</tt>
+ * the reservation object is <tt>null</tt>
*/
public ARMessage(int sourceId, int destId,
Reservation reservation) throws ParameterException {
@@ -431,7 +432,7 @@
* @return a String representing the negotiation message
*/
public String toString() {
- String result = "{AR Message: " +
+ return "{AR Message: " +
"[Type = " + getMessageTypeString(msgType_) + "]," +
"[Source ID = " + srcId_ + "],"+
"[Destination ID = " + dstId_ + "],"+
@@ -439,7 +440,5 @@
"[Reservation ID = " + ((reservation_ == null) ? -1 : reservation_.getID()) + "],"+
"[Error Code = " + getErrorCodeString(errorCode_) + "],"+
"[Price = " + price_ + "]}";
-
- return result;
}
}
Modified: branches/gridsim4.0-branch3/source/gridsim/turbo/ARParallelSpaceShared.java
===================================================================
--- branches/gridsim4.0-branch3/source/gridsim/turbo/ARParallelSpaceShared.java 2007-10-19 00:52:11 UTC (rev 75)
+++ branches/gridsim4.0-branch3/source/gridsim/turbo/ARParallelSpaceShared.java 2007-10-31 03:45:23 UTC (rev 76)
@@ -2293,7 +2293,7 @@
* in the scheduling queue managed by this scheduler or
* resource allocation policy.
* @param startTime the start time in which the requester is interested.
- * @param finishTime the finish time in which the requester is interested.
+ * @param duration the duration in which the requester is interested.
* @return the list of free time slots. The list is actually a list of
* entries that correspond to the availability profile between the times
* specified by the requester.
Modified: branches/gridsim4.0-branch3/source/gridsim/turbo/ARTPolicy.java
===================================================================
--- branches/gridsim4.0-branch3/source/gridsim/turbo/ARTPolicy.java 2007-10-19 00:52:11 UTC (rev 75)
+++ branches/gridsim4.0-branch3/source/gridsim/turbo/ARTPolicy.java 2007-10-31 03:45:23 UTC (rev 76)
@@ -59,7 +59,7 @@
* @pre entityName != null
* @post $none
*/
- protected ARTPolicy(String resourceName, String entityName)
+ public ARTPolicy(String resourceName, String entityName)
throws Exception {
super(resourceName, entityName);
}
Modified: branches/gridsim4.0-branch3/source/gridsim/turbo/AvailabilityProfileEntry.java
===================================================================
--- branches/gridsim4.0-branch3/source/gridsim/turbo/AvailabilityProfileEntry.java 2007-10-19 00:52:11 UTC (rev 75)
+++ branches/gridsim4.0-branch3/source/gridsim/turbo/AvailabilityProfileEntry.java 2007-10-31 03:45:23 UTC (rev 76)
@@ -100,6 +100,7 @@
/**
* Returns the number of Gridlets that rely on this entry to mark
* their expected completion time or their anchor point
+ * @return the number of Gridlets that use this entry
*/
public int getNumGridlets(){
return numGridlets_;
Modified: branches/gridsim4.0-branch3/source/gridsim/turbo/FilterARMessage.java
===================================================================
--- branches/gridsim4.0-branch3/source/gridsim/turbo/FilterARMessage.java 2007-10-19 00:52:11 UTC (rev 75)
+++ branches/gridsim4.0-branch3/source/gridsim/turbo/FilterARMessage.java 2007-10-31 03:45:23 UTC (rev 76)
@@ -8,7 +8,6 @@
package gridsim.turbo;
-import gridsim.GridSimTags;
import eduni.simjava.Sim_predicate;
import eduni.simjava.Sim_event;
Added: branches/gridsim4.0-branch3/source/gridsim/turbo/OrderGridletByStartTime.java
===================================================================
--- branches/gridsim4.0-branch3/source/gridsim/turbo/OrderGridletByStartTime.java (rev 0)
+++ branches/gridsim4.0-branch3/source/gridsim/turbo/OrderGridletByStartTime.java 2007-10-31 03:45:23 UTC (rev 76)
@@ -0,0 +1,51 @@
+/*
+ * Title: GridSim Toolkit
+ * Description: GridSim (Grid Simulation) Toolkit for Modelling and Simulation
+ * of Parallel and Distributed Systems such as Clusters and Grids
+ * Licence: GPL - http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+package gridsim.turbo;
+
+import java.util.Comparator;
+
+/**
+ * Class used to order the gridlets according to their
+ * potential start times
+ * @author Marcos Dias de Assuncao
+ *
+ */
+public class OrderGridletByStartTime implements Comparator<SSGridlet> {
+
+ /**
+ * Default constructor.
+ */
+ public OrderGridletByStartTime() {
+ super();
+ }
+
+ /**
+ * Compares two SSGridlets objects. It uses the potential start time
+ * for comparison. If the two gridlets have the same start time, then
+ * the serial number of the gridlets is used. That is, the order in
+ * which the gridlets have been created
+ * @see java.util.Comparator#compare(java.lang.Object, java.lang.Object)
+ */
+ public int compare(SSGridlet gridletA, SSGridlet gridletB) {
+ if(gridletA == gridletB)
+ return 0;
+
+ int result = 0;
+ Double timeA = gridletA.getStartTime();
+ Double timeB = gridletB.getStartTime();
+ result = timeA.compareTo(timeB);
+
+ if(result == 0){
+ Long serialA = gridletA.getSerial();
+ Long serialB = gridletB.getSerial();
+ result = serialA.compareTo(serialB);
+ }
+ return result;
+ }
+}
\ No newline at end of file
Deleted: branches/gridsim4.0-branch3/source/gridsim/turbo/OrderGridletbyStartTime.java
===================================================================
--- branches/gridsim4.0-branch3/source/gridsim/turbo/OrderGridletbyStartTime.java 2007-10-19 00:52:11 UTC (rev 75)
+++ branches/gridsim4.0-branch3/source/gridsim/turbo/OrderGridletbyStartTime.java 2007-10-31 03:45:23 UTC (rev 76)
@@ -1,58 +0,0 @@
-/*
- * Title: GridSim Toolkit
- * Description: GridSim (Grid Simulation) Toolkit for Modelling and Simulation
- * of Parallel and Distributed Systems such as Clusters and Grids
- * Licence: GPL - http://www.gnu.org/copyleft/gpl.html
- *
- */
-
-package gridsim.turbo;
-
-import java.util.Comparator;
-
-/**
- * Class used to order the gridlets according to their
- * potential start times
- * @author Marcos Dias de Assuncao
- *
- */
-class OrderGridletByStartTime implements Comparator<SSGridlet> {
-
- /**
- * Default constructor.
- */
- public OrderGridletByStartTime() {
- super();
- }
-
- /**
- * Default constructor.
- */
- public OrderGridletByStartTime(int order) {
- super();
- }
-
- /**
- * Compares two SSGridlets objects. It uses the potential start time
- * for comparison. If the two gridlets have the same start time, then
- * the serial number of the gridlets is used. That is, the order in
- * which the gridlets have been created
- * @see java.util.Comparator#compare(java.lang.Object, java.lang.Object)
- */
- public int compare(SSGridlet gridletA, SSGridlet gridletB) {
- if(gridletA == gridletB)
- return 0;
-
- int result = 0;
- Double timeA = gridletA.getStartTime();
- Double timeB = gridletB.getStartTime();
- result = timeA.compareTo(timeB);
-
- if(result == 0){
- Long serialA = gridletA.getSerial();
- Long serialB = gridletB.getSerial();
- result = serialA.compareTo(serialB);
- }
- return result;
- }
-}
\ No newline at end of file
Modified: branches/gridsim4.0-branch3/source/gridsim/turbo/PERange.java
===================================================================
--- branches/gridsim4.0-branch3/source/gridsim/turbo/PERange.java 2007-10-19 00:52:11 UTC (rev 75)
+++ branches/gridsim4.0-branch3/source/gridsim/turbo/PERange.java 2007-10-31 03:45:23 UTC (rev 76)
@@ -89,7 +89,7 @@
/**
* Compares this range against another range of PEs.
- * @param the range to compare this range with
+ * @param range the range to compare this range with
* @return <tt>-1</tt> if the beginning of this range is
* smaller than the other range, <tt>0</tt> if they are
* the same and <tt>1<tt> the beginning of this range is bigger
@@ -115,7 +115,7 @@
}
/**
- * Creates a string represenation of this class
+ * Creates a string representation of this class
* @return the string representation
*/
public String toString(){
Modified: branches/gridsim4.0-branch3/source/gridsim/turbo/ParallelSpaceShared.java
===================================================================
--- branches/gridsim4.0-branch3/source/gridsim/turbo/ParallelSpaceShared.java 2007-10-19 00:52:11 UTC (rev 75)
+++ branches/gridsim4.0-branch3/source/gridsim/turbo/ParallelSpaceShared.java 2007-10-31 03:45:23 UTC (rev 76)
@@ -10,6 +10,7 @@
import eduni.simjava.Sim_event;
import eduni.simjava.Sim_system;
+import gridsim.GridResource;
import gridsim.GridSim;
import gridsim.GridSimTags;
import gridsim.Gridlet;
Modified: branches/gridsim4.0-branch3/source/gridsim/turbo/Reservation.java
===================================================================
--- branches/gridsim4.0-branch3/source/gridsim/turbo/Reservation.java 2007-10-19 00:52:11 UTC (rev 75)
+++ branches/gridsim4.0-branch3/source/gridsim/turbo/Reservation.java 2007-10-31 03:45:23 UTC (rev 76)
@@ -109,6 +109,8 @@
/**
* This method is implemented as ScheduleItem requires
+ * @return <tt>true</tt> if the gridlet has made a reservation or
+ * <tt>false</tt> otherwise.
*/
public boolean hasReserved() {
return true;
@@ -140,13 +142,8 @@
/**
* Sets the start time (in seconds) for this reservation.
- * The start time should be greater than simulation init time defined
- * in {@link gridsim.GridSim#init(int, Calendar, boolean)}
- * @param startTime the reservation start time in milliseconds
+ * @param startTime the reservation start time in seconds
* @return <tt>true</tt> if successful, <tt>false</tt> otherwise
- * @see gridsim.GridSim#init(int, Calendar, boolean)
- * @pre startTime > 0
- * @post $none
*/
public boolean setStartTime(double startTime) {
if (startTime < 0) {
@@ -159,10 +156,9 @@
/**
* Sets the duration time (unit in seconds) for this reservation.
- * @param duration the reservation duration time. Time unit is in milliseconds.
+ * @param duration the reservation duration time. Time unit is in seconds.
* @return <tt>true</tt> if successful, <tt>false</tt> otherwise
* @pre duration > 0
- * @post $none
*/
public boolean setDurationTime(int duration) {
if (duration <= 0) {
@@ -221,8 +217,8 @@
}
/**
- * Gets this object's start time in seconds
- * @return the reservation start time in seconds
+ * Gets this object's finish time in seconds
+ * @return the reservation finish time in seconds
* @pre $none
* @post $none
*/
@@ -309,7 +305,7 @@
/**
* Returns a clone of this object
- * @see java.lang.Object#clone()
+ * @return a cloned reservation object
*/
public Reservation clone() {
Reservation reservation = new Reservation(userID_);
@@ -322,7 +318,8 @@
* Returns a negative integer, zero, or a positive integer as this
* reservation is less than, equal to, or greater than the specified
* reservation.
- * @param the reservation against which this reservation has to be compared
+ * @param reservation the reservation against which this reservation
+ * has to be compared
* @see java.lang.Comparable#compareTo(java.lang.Object)
*/
public int compareTo(Reservation reservation) {
Modified: branches/gridsim4.0-branch3/source/gridsim/turbo/ReservationRequester.java
===================================================================
--- branches/gridsim4.0-branch3/source/gridsim/turbo/ReservationRequester.java 2007-10-19 00:52:11 UTC (rev 75)
+++ branches/gridsim4.0-branch3/source/gridsim/turbo/ReservationRequester.java 2007-10-31 03:45:23 UTC (rev 76)
@@ -169,7 +169,6 @@
* @param startTime reservation start time in seconds
* @param duration reservation end time in seconds
* @param numPE number of PEs required for this reservation
- * @param resID a resource ID
* @return a reservation object containing the new reservation or
* <tt>null</tt> if an error happened during the request
*/
Modified: branches/gridsim4.0-branch3/source/gridsim/turbo/SSGridlet.java
===================================================================
--- branches/gridsim4.0-branch3/source/gridsim/turbo/SSGridlet.java 2007-10-19 00:52:11 UTC (rev 75)
+++ branches/gridsim4.0-branch3/source/gridsim/turbo/SSGridlet.java 2007-10-31 03:45:23 UTC (rev 76)
@@ -11,14 +11,14 @@
import gridsim.GridSim;
import gridsim.Gridlet;
-import gridsim.gui.DefaultGridSimVisualizer;
+import gridsim.gui.GridSimVisualizer;
/**
* GridSim @link{SSGridlet} represents a Gridlet submitted to
* @link{GridResource} for processing (Server Side). This class keeps track of the time
* for all activities in the @link{GridResource} for a specific Gridlet.
* Before a Gridlet exits the GridResource, it is RECOMMENDED to call this method
- * {@link #finalizeGridlet()}.
+ * {@link SSGridlet#finalizeGridlet()}.
* <p>
* It contains a Gridlet object along with its arrival time and
* the ranges of PEs (Processing Element) allocated to it.
@@ -436,26 +436,25 @@
* Creates a String representation of this Gridlet
* for displaying purposes
* @param timeUnit the time unit to be used
- * @see DefaultGridSimVisualizer#TIME_UNIT_SECOND
- * @see DefaultGridSimVisualizer#TIME_UNIT_MINUTE
- * @see DefaultGridSimVisualizer#TIME_UNIT_HOUR
+ * @see GridSimVisualizer#TIME_UNIT_SECOND
+ * @see GridSimVisualizer#TIME_UNIT_MINUTE
+ * @see GridSimVisualizer#TIME_UNIT_HOUR
*/
public String toString(int timeUnit){
- String unitDesc = getTimeUnitDescription(timeUnit);
- String result = "Gridlet ID: " + gridlet_.getGridletID() + "\n" +
+ String timeDescr = getTimeDescr(timeUnit);
+ return "Gridlet ID: " + gridlet_.getGridletID() + "\n" +
"User ID: " + gridlet_.getUserID() + "\n" +
"Status: " + Gridlet.getStatusString(gridlet_.getGridletStatus()) + "\n" +
- "Sub. Time: " + decFormater_.format(convertToUnitInUse(getSubmissionTime(), timeUnit)) +
- " " + unitDesc + "\n" +
- "Start Time: " + decFormater_.format(convertToUnitInUse(startTime_, timeUnit)) +
- " " + unitDesc + "\n" +
- "FinishTime: " + decFormater_.format(convertToUnitInUse(finishedTime_, timeUnit)) +
- " " + unitDesc + "\n" +
- "Duration: " + decFormater_.format(convertToUnitInUse(finishedTime_ - startTime_, timeUnit)) +
- " " + unitDesc + "\n" +
+ "Sub. Time: " + decFormater_.format(convertTime(getSubmissionTime(), timeUnit)) +
+ " " + timeDescr + "\n" +
+ "Start Time: " + decFormater_.format(convertTime(startTime_, timeUnit)) +
+ " " + timeDescr + "\n" +
+ "FinishTime: " + decFormater_.format(convertTime(finishedTime_, timeUnit)) +
+ " " + timeDescr + "\n" +
+ "Duration: " + decFormater_.format(convertTime(finishedTime_ - startTime_, timeUnit)) +
+ " " + timeDescr + "\n" +
"Length: " + decFormater_.format(gridlet_.getGridletLength()) + " MIs" + "\n" +
"Num. PEs: " + numPE_;
- return result;
}
// -------------------- PRIVATE METHODS ---------------------
@@ -468,7 +467,6 @@
private void init() {
// get number of PEs required to run this Gridlet
this.numPE_ = gridlet_.getNumPE();
- peRangeList_ = new PERangeList();
this.arrivalTime_ = GridSim.clock();
this.gridlet_.setSubmissionTime(arrivalTime_);
@@ -490,11 +488,11 @@
* @param timeUnit the time unit id
* @return the string containing the description
*/
- private String getTimeUnitDescription(int timeUnit) {
- if(timeUnit == DefaultGridSimVisualizer.TIME_UNIT_SECOND) {
+ private String getTimeDescr(int timeUnit) {
+ if(timeUnit == GridSimVisualizer.TIME_UNIT_SECOND) {
return "sec.";
}
- else if(timeUnit == DefaultGridSimVisualizer.TIME_UNIT_MINUTE) {
+ else if(timeUnit == GridSimVisualizer.TIME_UNIT_MINUTE) {
return "min.";
}
else {
@@ -507,18 +505,9 @@
* @param the time in seconds
* @return the time in the unit in use
*/
- private double convertToUnitInUse(double time, int timeUnit) {
- if(timeUnit == DefaultGridSimVisualizer.TIME_UNIT_SECOND) {
- return time;
- }
- else if(timeUnit == DefaultGridSimVisualizer.TIME_UNIT_MINUTE) {
- return time/60;
- }
- else {
- return time/60/60;
- }
+ private double convertTime(double time, int timeUnit) {
+ return time / timeUnit;
}
-
} // end class
Modified: branches/gridsim4.0-branch3/source/gridsim/turbo/SSReservation.java
===================================================================
--- branches/gridsim4.0-branch3/source/gridsim/turbo/SSReservation.java 2007-10-19 00:52:11 UTC (rev 75)
+++ branches/gridsim4.0-branch3/source/gridsim/turbo/SSReservation.java 2007-10-31 03:45:23 UTC (rev 76)
@@ -7,10 +7,8 @@
package gridsim.turbo;
-import gridsim.gui.DefaultGridSimVisualizer;
-
+import gridsim.gui.GridSimVisualizer;
import java.text.DecimalFormat;
-import java.util.Calendar;
/**
* GridSim @link{SSReservation} represents a reservation on the resource
@@ -114,9 +112,6 @@
return peRanges_;
}
-
-
-
/**
* Returns the number of PEs still available that have not been
* allocated to gridlets
@@ -184,13 +179,8 @@
/**
* Sets the start time (in seconds) for this reservation.
- * The start time should be greater than simulation init time defined
- * in {@link gridsim.GridSim#init(int, Calendar, boolean)}
- * @param startTime the reservation start time in milliseconds
+ * @param startTime the reservation start time in seconds
* @return <tt>true</tt> if successful, <tt>false</tt> otherwise
- * @see gridsim.GridSim#init(int, Calendar, boolean)
- * @pre startTime > 0
- * @post $none
*/
public boolean setStartTime(double startTime) {
if(reservation_==null)
@@ -201,7 +191,7 @@
/**
* Sets the duration time (unit in seconds) for this reservation.
- * @param duration the reservation duration time. Time unit is in milliseconds.
+ * @param duration the reservation duration time. Time unit is in seconds.
* @return <tt>true</tt> if successful, <tt>false</tt> otherwise
* @pre duration > 0
* @post $none
@@ -266,8 +256,8 @@
}
/**
- * Gets this object's start time in seconds
- * @return the reservation start time in seconds
+ * Gets this object's finish time in seconds
+ * @return the reservation finish time in seconds
* @pre $none
* @post $none
*/
@@ -345,22 +335,22 @@
* for displaying purposes
* @param timeUnit the time unit to be used
* @return the string representation
- * @see DefaultGridSimVisualizer#TIME_UNIT_SECOND
- * @see DefaultGridSimVisualizer#TIME_UNIT_MINUTE
- * @see DefaultGridSimVisualizer#TIME_UNIT_HOUR
+ * @see GridSimVisualizer#TIME_UNIT_SECOND
+ * @see GridSimVisualizer#TIME_UNIT_MINUTE
+ * @see GridSimVisualizer#TIME_UNIT_HOUR
*/
public String toString(int timeUnit) {
- String unitDesc = getTimeUnitDescription(timeUnit);
+ String unitDesc = getTimeDescr(timeUnit);
String result = "Reservation ID: " + reservation_.getID() + "\n" +
"User ID: " + getUserID() + "\n" +
"Status: " + Reservation.getStatusString(reservation_.getStatus()) + "\n" +
- "Sub. Time: " + decFormater_.format(convertToUnitInUse(getSubmissionTime(), timeUnit)) +
+ "Sub. Time: " + decFormater_.format(convertTime(getSubmissionTime(), timeUnit)) +
" " + unitDesc + "\n" +
- "Start Time: " + decFormater_.format(convertToUnitInUse(reservation_.getStartTime(), timeUnit)) +
+ "Start Time: " + decFormater_.format(convertTime(reservation_.getStartTime(), timeUnit)) +
" " + unitDesc + "\n" +
- "FinishTime: " + decFormater_.format(convertToUnitInUse(getFinishTime(), timeUnit)) +
+ "FinishTime: " + decFormater_.format(convertTime(getFinishTime(), timeUnit)) +
" " + unitDesc + "\n" +
- "Duration: " + decFormater_.format(convertToUnitInUse(reservation_.getDurationTime(), timeUnit)) +
+ "Duration: " + decFormater_.format(convertTime(reservation_.getDurationTime(), timeUnit)) +
" " + unitDesc + "\n" +
"Num. PEs: " + reservation_.getNumPE();
return result;
@@ -372,7 +362,7 @@
* @return the string representation
*/
public String toString() {
- return toString(DefaultGridSimVisualizer.TIME_UNIT_SECOND);
+ return toString(GridSimVisualizer.TIME_UNIT_SECOND);
}
/**
@@ -381,11 +371,11 @@
* @param timeUnit the time unit id
* @return the string containing the description
*/
- private static String getTimeUnitDescription(int timeUnit) {
- if(timeUnit == DefaultGridSimVisualizer.TIME_UNIT_SECOND) {
+ private static String getTimeDescr(int timeUnit) {
+ if(timeUnit == GridSimVisualizer.TIME_UNIT_SECOND) {
return "sec.";
}
- else if(timeUnit == DefaultGridSimVisualizer.TIME_UNIT_MINUTE) {
+ else if(timeUnit == GridSimVisualizer.TIME_UNIT_MINUTE) {
return "min.";
}
else {
@@ -398,16 +388,8 @@
* @param the time in seconds
* @return the time in the unit in use
*/
- private static double convertToUnitInUse(double time, int timeUnit) {
- if(timeUnit == DefaultGridSimVisualizer.TIME_UNIT_SECOND) {
- return time;
- }
- else if(timeUnit == DefaultGridSimVisualizer.TIME_UNIT_MINUTE) {
- return time/60;
- }
- else {
- return time/60/60;
- }
+ private static double convertTime(double time, int timeUnit) {
+ return time / timeUnit;
}
/**
Modified: branches/gridsim4.0-branch3/source/gridsim/turbo/ScheduleItem.java
===================================================================
--- branches/gridsim4.0-branch3/source/gridsim/turbo/ScheduleItem.java 2007-10-19 00:52:11 UTC (rev 75)
+++ branches/gridsim4.0-branch3/source/gridsim/turbo/ScheduleItem.java 2007-10-31 03:45:23 UTC (rev 76)
@@ -7,7 +7,7 @@
package gridsim.turbo;
-import gridsim.gui.DefaultGridSimVisualizer;
+import gridsim.gui.GridSimVisualizer;
import gridsim.gui.ResourceWindow;
/**
@@ -98,9 +98,11 @@
* Creates a String representation of this item
* for displaying purposes
* @param timeUnit the time unit to be used
- * @see DefaultGridSimVisualizer#TIME_UNIT_SECOND
- * @see DefaultGridSimVisualizer#TIME_UNIT_MINUTE
- * @see DefaultGridSimVisualizer#TIME_UNIT_HOUR
+ * @see GridSimVisualizer#TIME_UNIT_SECOND
+ * @see GridSimVisualizer#TIME_UNIT_MINUTE
+ * @see GridSimVisualizer#TIME_UNIT_HOUR
+ * @return a String representation of this item
+ * for displaying purposes
*/
public String toString(int timeUnit);
Modified: branches/gridsim4.0-branch3/source/gridsim/turbo/TAllocPolicy.java
===================================================================
--- branches/gridsim4.0-branch3/source/gridsim/turbo/TAllocPolicy.java 2007-10-19 00:52:11 UTC (rev 75)
+++ branches/gridsim4.0-branch3/source/gridsim/turbo/TAllocPolicy.java 2007-10-31 03:45:23 UTC (rev 76)
@@ -8,6 +8,7 @@
package gridsim.turbo;
import gridsim.AllocPolicy;
+import gridsim.GridResource;
import java.util.Calendar;
import java.util.Collection;
@@ -15,8 +16,8 @@
/**
* {@link TAllocPolicy} is an abstract class that handles the internal
- * {@link TGridResource} allocation policy. New scheduling algorithms
- * can be added into a {@link TGridResource} entity by extending this
+ * {@link GridResource} allocation policy. New scheduling algorithms
+ * can be added into a {@link GridResource} entity by extending this
* class and implement the required abstract methods.
* <p>
* All the implementation details and the data structures chosen are up to
@@ -31,10 +32,8 @@
* @since GridSim Turbo Alpha 0.1
*
* @see gridsim.AllocPolicy
- * @see gridsim.ARPolicy
- * @see gridsim.ARTPolicy
* @see gridsim.GridSim
- * @see gridsim.TResourceCharacteristics
+ * @see TResourceCharacteristics
*/
public abstract class TAllocPolicy extends AllocPolicy {
Modified: branches/gridsim4.0-branch3/source/gridsim/turbo/TResourceCharacteristics.java
===================================================================
--- branches/gridsim4.0-branch3/source/gridsim/turbo/TResourceCharacteristics.java 2007-10-19 00:52:11 UTC (rev 75)
+++ branches/gridsim4.0-branch3/source/gridsim/turbo/TResourceCharacteristics.java 2007-10-31 03:45:23 UTC (rev 76)
@@ -34,7 +34,7 @@
// This variable stores the ranges of PEs available at the
// present simulation time
private PERangeList freePERanges_;
- // the number of
+ // the number of PEs in this resource
private int numPE_;
/** Parallel spaced-shared system using First Come First Serve (FCFS)
Modified: branches/gridsim4.0-branch3/source/gridsim/turbo/TimeSlotEntry.java
===================================================================
--- branches/gridsim4.0-branch3/source/gridsim/turbo/TimeSlotEntry.java 2007-10-19 00:52:11 UTC (rev 75)
+++ branches/gridsim4.0-branch3/source/gridsim/turbo/TimeSlotEntry.java 2007-10-31 03:45:23 UTC (rev 76)
@@ -31,7 +31,7 @@
/**
* Creates a new instance of {@link TimeSlotEntry}
- * @time the time associated with this entry
+ * @param time the time associated with this entry
*/
public TimeSlotEntry(double time) {
time_ = time;
@@ -40,8 +40,8 @@
/**
* Creates a new instance of {@link TimeSlotEntry}
- * @time the time associated with this entry
- * @ranges the list of ranges of PEs available
+ * @param time the time associated with this entry
+ * @param ranges the list of ranges of PEs available
*/
public TimeSlotEntry(double time, PERangeList ranges) {
time_ = time;
@@ -111,7 +111,7 @@
* Gets the number of PEs associated with this entry
* @return the number of PEs
*/
- public int getNumPE(){
+ public int getNumPE() {
if(availRanges_ == null)
return 0;
else
@@ -122,7 +122,7 @@
* Creates a string representation of this entry
* @return a representation of this entry
*/
- public String toString(){
+ public String toString() {
return "{time="+ time_ + "; "
+ ( (availRanges_!=null) ? availRanges_ : "{[]}") + "}";
}
Modified: branches/gridsim4.0-branch3/source/gridsim/turbo/TimeSlotList.java
===================================================================
--- branches/gridsim4.0-branch3/source/gridsim/turbo/TimeSlotList.java 2007-10-19 00:52:11 UTC (rev 75)
+++ branches/gridsim4.0-branch3/source/gridsim/turbo/TimeSlotList.java 2007-10-31 03:45:23 UTC (rev 76)
@@ -217,7 +217,7 @@
* Scans the entries in a list and returns the first time frame over
* which a request with the characteristics provided can be scheduled
* @param duration the duration of the request
- * @param numPE the number of PEs required
+ * @param reqPE the number of PEs required
* @return the start time or <tt>-1</tt> if not found
*/
public double getPotentialStartTime(int duration, int reqPE) {
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|