@@ -21,6 +21,7 @@ public class Library {
21
21
private String sentence ;
22
22
private String paragraph ;
23
23
private String url ;
24
+ private String category ;
24
25
private List <String > architectures ;
25
26
private File folder ;
26
27
private File srcFolder ;
@@ -31,6 +32,11 @@ public class Library {
31
32
.asList (new String [] { "name" , "version" , "author" , "maintainer" ,
32
33
"sentence" , "paragraph" , "url" });
33
34
35
+ private static final List <String > CATEGORIES = Arrays .asList (new String [] {
36
+ "Display" , "Communication" , "Signal Input/Output" , "Sensors" ,
37
+ "Device Control" , "Timing" , "Data Storage" , "Data Processing" , "Other" ,
38
+ "Uncategorized" });
39
+
34
40
/**
35
41
* Scans inside a folder and create a Library object out of it. Automatically
36
42
* detects legacy libraries. Automatically fills metadata from
@@ -113,6 +119,12 @@ private static Library createLibrary(File libFolder) throws IOException {
113
119
for (String arch : architectures .split ("," ))
114
120
archs .add (arch .trim ());
115
121
122
+ String category = properties .get ("category" );
123
+ if (category == null )
124
+ category = "Uncategorized" ;
125
+ if (!CATEGORIES .contains (category ))
126
+ category = "Uncategorized" ;
127
+
116
128
Library res = new Library ();
117
129
res .folder = libFolder ;
118
130
res .srcFolder = srcFolder ;
@@ -123,6 +135,7 @@ private static Library createLibrary(File libFolder) throws IOException {
123
135
res .sentence = properties .get ("sentence" ).trim ();
124
136
res .paragraph = properties .get ("paragraph" ).trim ();
125
137
res .url = properties .get ("url" ).trim ();
138
+ res .category = category .trim ();
126
139
res .architectures = archs ;
127
140
res .useRecursion = useRecursion ;
128
141
res .isLegacy = false ;
@@ -183,6 +196,14 @@ public String getUrl() {
183
196
return url ;
184
197
}
185
198
199
+ public String getCategory () {
200
+ return category ;
201
+ }
202
+
203
+ public static List <String > getCategories () {
204
+ return CATEGORIES ;
205
+ }
206
+
186
207
public String getVersion () {
187
208
return version ;
188
209
}
0 commit comments