Line | Hits | Source |
---|---|---|
1 | package umich.cac.data; | |
2 | ||
3 | import umich.cac.pbs.FieldFactory; | |
4 | ||
5 | /** | |
6 | * | |
7 | * This class encapsulates B record Node fields. A node consists of a nodename, | |
8 | * and optionally a cpu. | |
9 | * | |
10 | * PBS encodes these together in a single field, using different separators. | |
11 | * | |
12 | * <p> | |
13 | * | |
14 | * An example rendering output from this Field would be | |
15 | * | |
16 | * <pre> | |
17 | * | |
18 | * | |
19 | * <node> | |
20 | * | |
21 | * <nodename>node047</nodename> | |
22 | * | |
23 | * <cpu>0</cpu> | |
24 | * | |
25 | * </node> | |
26 | * | |
27 | * </pre> | |
28 | * | |
29 | * @author rmach@umich.edu | |
30 | * @version $Header: /cvsroot/pbsaccounting/pbsaccounting/src/umich/cac/data/BNodeField.java,v 1.2 2003/10/21 19:08:00 rodmach Exp $ | |
31 | * | |
32 | */ | |
33 | ||
34 | public class BNodeField extends Field { | |
35 | ||
36 | ||
37 | /** Nodes are seperated by + */ | |
38 | 0 | private String NODE_SEPARATOR = "\\+"; |
39 | ||
40 | /** | |
41 | * Constructor for NodeField field, for a GENERIC field type | |
42 | * | |
43 | * @param fieldName | |
44 | * Name of this field | |
45 | * @param rawValue | |
46 | * the raw value of this field from PBS accounting data | |
47 | */ | |
48 | ||
49 | public BNodeField(FieldName fieldName, String rawValue) { | |
50 | ||
51 | 0 | super(fieldName, rawValue, FieldType.GENERIC); |
52 | 0 | setupChildren(rawValue); |
53 | ||
54 | 0 | } |
55 | ||
56 | /** | |
57 | * Contains children of type node. If just a hostname is encoded, only the | |
58 | * NODENAME field is added. If a CPU and NAME are encoded both NODENAME and | |
59 | * CPU fields are added. | |
60 | * | |
61 | * @param rawValue | |
62 | * Description of the Parameter | |
63 | */ | |
64 | ||
65 | private void setupChildren(String rawValue) { | |
66 | ||
67 | 0 | String[] innerNodes = rawValue.split(NODE_SEPARATOR); |
68 | ||
69 | 0 | for (int j = 0; j < innerNodes.length; j++) { |
70 | 0 | Field nodeField = |
71 | FieldFactory.getInstance().getField( | |
72 | FieldName.NODE, | |
73 | innerNodes[j]); | |
74 | 0 | addChild(nodeField); |
75 | } | |
76 | 0 | } |
77 | ||
78 | } |
this report was generated by version 1.0.5 of jcoverage. |
copyright © 2003, jcoverage ltd. all rights reserved. |