1 package eu.fbk.dkm.premon.util;
2
3 import javax.annotation.Nullable;
4
5
6
7
8
9 public class NF {
10
11 private String n;
12 private String f;
13
14 public static final String AGENT = "a";
15 public static final String MOD = "mod";
16
17 public NF(@Nullable String n, @Nullable String f) {
18
19
20
21 if (n != null && n.length() > 0) {
22
23
24
25
26
27
28
29
30
31
32
33 if (n.toLowerCase().equals("dir")) {
34 n = "m";
35 f = "dir";
36 }
37
38
39 if (n.toLowerCase().equals("argm-adv")) {
40 n = "m";
41 f = "adv";
42 }
43 } else {
44 n = null;
45 }
46
47 if (n != null) {
48 n = n.toLowerCase();
49 }
50
51
52
53 if (f == null || f.length() <= 0) {
54 f = null;
55 }
56
57 if (f != null) {
58 f = f.toLowerCase();
59 if (f.equals("str")) {
60 f = null;
61 }
62 }
63
64 this.n = n;
65 this.f = f;
66 }
67
68 public String getArgName() {
69 if (n != null) {
70 if (n.equals("a")) {
71 return AGENT;
72 } else if (n.equals("m")) {
73 if (f != null) {
74 return f;
75 } else {
76
77
78 return null;
79 }
80 } else {
81 return n;
82 }
83 }
84
85 return f;
86 }
87
88 public String getN() {
89 return n;
90 }
91
92 public String getF() {
93 return f;
94 }
95
96 @Override public String toString() {
97 return "NF{" +
98 "n='" + n + '\'' +
99 ", f='" + f + '\'' +
100 '}';
101 }
102 }