KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > DEOS > Budget


1 //
2
// Copyright (C) 2005 United States Government as represented by the
3
// Administrator of the National Aeronautics and Space Administration
4
// (NASA). All Rights Reserved.
5
//
6
// This software is distributed under the NASA Open Source Agreement
7
// (NOSA), version 1.3. The NOSA has been approved by the Open Source
8
// Initiative. See the file NOSA-1.3-JPF at the top of the distribution
9
// directory tree for the complete NOSA document.
10
//
11
// THE SUBJECT SOFTWARE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY OF ANY
12
// KIND, EITHER EXPRESSED, IMPLIED, OR STATUTORY, INCLUDING, BUT NOT
13
// LIMITED TO, ANY WARRANTY THAT THE SUBJECT SOFTWARE WILL CONFORM TO
14
// SPECIFICATIONS, ANY IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR
15
// A PARTICULAR PURPOSE, OR FREEDOM FROM INFRINGEMENT, ANY WARRANTY THAT
16
// THE SUBJECT SOFTWARE WILL BE ERROR FREE, OR ANY WARRANTY THAT
17
// DOCUMENTATION, IF PROVIDED, WILL CONFORM TO THE SUBJECT SOFTWARE.
18
//
19
package DEOS;
20
21 /**
22  * DOCUMENT ME!
23  */

24 class Budget {
25   private int itsTotalBudget;
26   private int itsRemainingBudget;
27
28   public void setRemainingBudgetInUsec (int b) {
29     //System.out.println("Budget.setRemainingBudgetInUsec " + b);
30
itsRemainingBudget = b;
31   }
32
33   public void setTotalBudgetInUsec (int b) {
34     itsTotalBudget = b;
35   }
36
37   public void adjustRemainingTime (int b) {
38     itsRemainingBudget += b;
39   }
40
41   public int remainingBudgetInUsec () {
42     return itsRemainingBudget;
43   }
44
45   public void replenish () {
46     //System.out.println("Budget.replenish");
47
itsRemainingBudget = itsTotalBudget;
48   }
49
50   public void replenishAndStartTimer () {
51     itsRemainingBudget = itsTotalBudget;
52     startTimer();
53   }
54
55   public void startTimer () {
56     //System.out.println("Budget.startTimer");
57
// Modified by ckong - June 26, 2001
58
// DEOS.theTimer.write(itsRemainingBudget);
59
DEOS.systemClock.setTimer(itsRemainingBudget);
60   }
61
62   public int totalBudgetInUsec () {
63     return itsTotalBudget;
64   }
65
66   int stopTimer () {
67     // Modified by ckong - June 25, 2001
68
//itsRemainingBudget = DEOS.theTimer.timeRemaining();
69
itsRemainingBudget = DEOS.theTimer.getRemainingTime(
70                                DEOS.systemClock.getCurrentTime());
71
72     return itsRemainingBudget;
73   }
74 };
75
Popular Tags