1 /*
2 * Copyright (C) 2002-2003, Mark Diggory
3 *
4 * This file is part of the Repast Taglibrary Package for use with Jelly.
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. License
19 * information is also available at http://www.gnu.org.
20 *
21 * @author Mark Diggory <mdiggory@latte.harvard.edu>
22 */
23 package org.mrd.repast.util;
24
25 import uchicago.src.sim.engine.*;
26 import java.util.*;
27 import java.io.*;
28
29 public class PropertiesFileReader extends Hashtable{
30
31 public PropertiesFileReader(String fileName) throws IOException {
32
33 Properties props = new Properties();
34 props.load(new java.io.FileInputStream(fileName));
35
36 for(Enumeration enum = props.keys();enum.hasMoreElements();){
37 String key = (String)enum.nextElement();
38 String value = (String)props.getProperty(key);
39
40 Parameter param = new NumericParameter();
41
42 param.setName(key);
43 param.setConstVal(value);
44 param.setNumRuns(1);
45
46 this.put(key,param);
47 }
48 }
49
50 public Vector getParameters() {
51 return new Vector(this.values());
52 }
53 }
This page was automatically generated by Maven