Download this file

LicenseID.java    56 lines (45 with data), 1.3 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
/**
* SPDXVersion: SPDX-1.1
* Creator: Person: Nuno Brito (nuno.brito@triplecheck.de)
* Creator: Organization: TripleCheck (http://triplecheck.de)
* Created: 2014-01-25T00:00:00Z
* LicenseName: NOASSERTION
* FileName: LicenseID.java
* FileType: SOURCE
* FileCopyrightText: <text> Copyright (c) 2014 Nuno Brito, TripleCheck </text>
* FileComment: <text> Defines a specific license </text>
*/
package script;
import java.util.Date;
/**
*
* @author Nuno Brito, 21st of December 2013 in Darsmtadt, Germany
*/
public class LicenseID {
public String
shortID,
longID,
URL;
public Date
datePublished;
// the list of id's that we can use to identify a license
public String[] identifiers = {
"gnu general public license",
"gnu gpl",
"gplv2 or later"
};
/**
* Verifies if any of the ids for this license is inside the text
* of source code that was provided
* @param text the source code text
* @return
*/
public boolean hasId(String text){
for(String id : identifiers){
if(text.contains(id)){
return true;
}
}
return false;
}
}