-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathMemman.java
More file actions
86 lines (75 loc) · 2.53 KB
/
Memman.java
File metadata and controls
86 lines (75 loc) · 2.53 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
import java.lang.reflect.InvocationTargetException;
import java.io.IOException;
// On my honor:
//
// - I have not used source code obtained from another student,
// or any other unauthorized source, either modified or
// unmodified.
//
// - All source code and documentation used in my program is
// either my original work, or was derived by me from the
// source code published in the textbook for this course.
//
// - I have not discussed coding details about this project with
// anyone other than my partner (in the case of a joint
// submission), instructor, ACM/UPE tutors or the TAs assigned
// to this course. I understand that I may discuss the concepts
// of this program with other students, and that another student
// may help me debug my program so long as neither of us writes
// anything during the discussion or modifies any computer file
// during the discussion. I have violated neither the spirit nor
// letter of this restriction.
// -------------------------------------------------------------------------
/**
* This is the main class.
*
* @author wenfeng ren (rwenfeng)
* @version Sep 11, 2014
*/
public class Memman
{
/**
* the initial table size for hash table.
*/
public static int tableSize;
/**
* the initial memory pool size.
*/
public static int blockSize;
/**
* the name of the file which contains the commands we need to to parser.
*/
public static String fileName;
// ----------------------------------------------------------
/**
* main method.
*
* @param args
* input arguments
* @throws IOException
* @throws IllegalArgumentException
* @throws IllegalAccessException
* @throws InvocationTargetException
*/
public static void main(String[] args)
throws IOException,
IllegalArgumentException,
IllegalAccessException,
InvocationTargetException
{
if (args.length != 3)
{
System.out.println("invalid command, please follow: "
+ "java Memman{initial-hash-size}");
}
// get the argument from the command line
tableSize = Integer.parseInt(args[0]);
blockSize = Integer.parseInt(args[1]);
fileName = args[2];
// create memory manager object and initialize it with blockSize
MemManager manager = new MemManager(blockSize);
// create client object and initialize it
@SuppressWarnings("unused")
Client client = new Client(manager, tableSize, fileName);
}
}