12 | * The number of auth-no-change verbs and nouns based on the 13 | * {@link SecurityVocabulary#AUTH_NO_CHANGE_VERBS} 14 | * and {@link SecurityVocabulary#AUTHENTICATION_NOUNS} lists. 15 | * 16 | * @author Oshando Johnson on 07.08.20 17 | */ 18 | public class AuthNoChangeWordCountFeature extends WordCountFeature implements IDocFeature { 19 | 20 | public AuthNoChangeWordCountFeature() { 21 | super(); 22 | } 23 | 24 | @Override 25 | public FeatureResult evaluate(AnnotatedMethod annotatedMethod) { 26 | 27 | featureResult.setMethodValue(wordCounter(annotatedMethod.getMethodMap(), Category.AUTHENTICATION_NEUTRAL)); 28 | featureResult.setClassValue(wordCounter(annotatedMethod.getClassMap(), Category.AUTHENTICATION_NEUTRAL)); 29 | 30 | return featureResult; 31 | } 32 | 33 | @Override 34 | public String toString() { 35 | return "AuthNoChangeWordCountFeature [" + featureResult + "]"; 36 | } 37 | 38 | @Override 39 | public String getName() { 40 | return "AuthNoChangeWordCountFeature"; 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /swan-cmd/src/main/java/de/fraunhofer/iem/swan/features/doc/manual/annotated/AuthSafeWordCountFeature.java: -------------------------------------------------------------------------------- 1 | package de.fraunhofer.iem.swan.features.doc.manual.annotated; 2 | 3 | import de.fraunhofer.iem.swan.data.Category; 4 | import de.fraunhofer.iem.swan.features.doc.manual.FeatureResult; 5 | import de.fraunhofer.iem.swan.features.doc.manual.IDocFeature; 6 | import de.fraunhofer.iem.swan.features.doc.nlp.AnnotatedMethod; 7 | import de.fraunhofer.iem.swan.features.doc.manual.SecurityVocabulary; 8 | 9 | /** 10 | * Evaluates if auth-safe-state words are found in the doc comment. 11 | *
12 | * The number of auth-safe-state verbs and nouns based on the 13 | * {@link SecurityVocabulary#AUTH_SAFE_VERBS} 14 | * and {@link SecurityVocabulary#AUTHENTICATION_NOUNS} lists. 15 | * 16 | * @author Oshando Johnson on 07.08.20 17 | */ 18 | public class AuthSafeWordCountFeature extends WordCountFeature implements IDocFeature { 19 | 20 | public AuthSafeWordCountFeature() { 21 | super(); 22 | } 23 | 24 | @Override 25 | public FeatureResult evaluate(AnnotatedMethod annotatedMethod) { 26 | 27 | featureResult.setMethodValue(wordCounter(annotatedMethod.getMethodMap(), Category.AUTHENTICATION_TO_HIGH)); 28 | featureResult.setClassValue(wordCounter(annotatedMethod.getClassMap(), Category.AUTHENTICATION_TO_HIGH)); 29 | 30 | return featureResult; 31 | } 32 | 33 | @Override 34 | public String toString() { 35 | return "AuthSafeWordCountFeature [" + featureResult + "]"; 36 | } 37 | 38 | @Override 39 | public String getName() { 40 | return "AuthSafeWordCountFeature"; 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /swan-cmd/src/main/java/de/fraunhofer/iem/swan/features/doc/manual/annotated/AuthUnsafeWordCountFeature.java: -------------------------------------------------------------------------------- 1 | package de.fraunhofer.iem.swan.features.doc.manual.annotated; 2 | 3 | import de.fraunhofer.iem.swan.data.Category; 4 | import de.fraunhofer.iem.swan.features.doc.manual.FeatureResult; 5 | import de.fraunhofer.iem.swan.features.doc.manual.IDocFeature; 6 | import de.fraunhofer.iem.swan.features.doc.nlp.AnnotatedMethod; 7 | import de.fraunhofer.iem.swan.features.doc.manual.SecurityVocabulary; 8 | 9 | /** 10 | * Evaluates if auth-unsafe-state words are found in the doc comment. 11 | *
12 | * The number of auth-unsafe-state verbs and nouns based on the 13 | * {@link SecurityVocabulary#AUTH_UNSAFE_VERBS} 14 | * and {@link SecurityVocabulary#AUTHENTICATION_NOUNS} lists. 15 | * 16 | * @author Oshando Johnson on 07.08.20 17 | */ 18 | public class AuthUnsafeWordCountFeature extends WordCountFeature implements IDocFeature { 19 | 20 | public AuthUnsafeWordCountFeature() { 21 | super(); 22 | } 23 | 24 | @Override 25 | public FeatureResult evaluate(AnnotatedMethod annotatedMethod) { 26 | 27 | featureResult.setMethodValue(wordCounter(annotatedMethod.getMethodMap(), Category.AUTHENTICATION_TO_LOW)); 28 | featureResult.setClassValue(wordCounter(annotatedMethod.getClassMap(), Category.AUTHENTICATION_TO_LOW)); 29 | 30 | return featureResult; 31 | } 32 | 33 | @Override 34 | public String toString() { 35 | return "AuthUnsafeWordCountFeature [" + featureResult + "]"; 36 | } 37 | 38 | @Override 39 | public String getName() { 40 | return "AuthUnsafeWordCountFeature"; 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /swan-cmd/src/main/java/de/fraunhofer/iem/swan/features/doc/manual/annotated/AuthenticationDataFlowFeature.java: -------------------------------------------------------------------------------- 1 | package de.fraunhofer.iem.swan.features.doc.manual.annotated; 2 | 3 | import de.fraunhofer.iem.swan.data.Category; 4 | import de.fraunhofer.iem.swan.features.doc.manual.FeatureResult; 5 | import de.fraunhofer.iem.swan.features.doc.manual.IDocFeature; 6 | import de.fraunhofer.iem.swan.features.doc.nlp.AnnotatedMethod; 7 | import de.fraunhofer.iem.swan.features.doc.manual.SecurityVocabulary; 8 | 9 | /** 10 | * Evaluates if authentication data flow prepositions are found in the doc comment. 11 | *
12 | * The authentication prepositions and nouns are based on the 13 | * {@link SecurityVocabulary#AUTHENTICATION_PREPOSITIONS} and {@link SecurityVocabulary#AUTHENTICATION_NOUNS} lists. 14 | * 15 | * @author Oshando Johnson on 01.09.20 16 | */ 17 | public class AuthenticationDataFlowFeature extends DataFlowFeature implements IDocFeature { 18 | 19 | public AuthenticationDataFlowFeature() { 20 | super(); 21 | } 22 | 23 | @Override 24 | public FeatureResult evaluate(AnnotatedMethod annotatedMethod) { 25 | 26 | featureResult.setMethodValue(wordCounter(annotatedMethod.getMethodMap(), Category.AUTHENTICATION_NEUTRAL)); 27 | featureResult.setClassValue(wordCounter(annotatedMethod.getClassMap(), Category.AUTHENTICATION_NEUTRAL)); 28 | 29 | return featureResult; 30 | } 31 | 32 | @Override 33 | public String toString() { 34 | return "AuthenticationDataFlowFeature [" + featureResult + "]"; 35 | } 36 | 37 | @Override 38 | public String getName() { 39 | return "AuthenticationDataFlowFeature"; 40 | } 41 | } -------------------------------------------------------------------------------- /swan-cmd/src/main/java/de/fraunhofer/iem/swan/features/doc/manual/annotated/CommandInjectionCountFeature.java: -------------------------------------------------------------------------------- 1 | package de.fraunhofer.iem.swan.features.doc.manual.annotated; 2 | 3 | import de.fraunhofer.iem.swan.data.Category; 4 | import de.fraunhofer.iem.swan.features.doc.manual.FeatureResult; 5 | import de.fraunhofer.iem.swan.features.doc.manual.IDocFeature; 6 | import de.fraunhofer.iem.swan.features.doc.nlp.AnnotatedMethod; 7 | import de.fraunhofer.iem.swan.features.doc.manual.SecurityVocabulary; 8 | 9 | /** 10 | * Evaluates if Command Injection words are found in the doc comment. 11 | * *
12 | * * The number of Command Injection verbs and nouns is based on the 13 | * * {@link SecurityVocabulary#CWE78_VERBS} 14 | * * and {@link SecurityVocabulary#CWE78_NOUNS} lists. 15 | * 16 | * @author Oshando Johnson on 30.09.20 17 | */ 18 | public class CommandInjectionCountFeature extends WordCountFeature implements IDocFeature { 19 | 20 | 21 | public CommandInjectionCountFeature() { 22 | super(); 23 | } 24 | 25 | @Override 26 | public FeatureResult evaluate(AnnotatedMethod annotatedMethod) { 27 | 28 | featureResult.setMethodValue(wordCounter(annotatedMethod.getMethodMap(), Category.CWE78)); 29 | featureResult.setClassValue(wordCounter(annotatedMethod.getClassMap(), Category.CWE78)); 30 | 31 | return featureResult; 32 | } 33 | 34 | @Override 35 | public String toString() { 36 | return "CommandInjectionCountFeature [" + featureResult + "]"; 37 | } 38 | 39 | @Override 40 | public String getName() { 41 | return "CommandInjectionCountFeature"; 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /swan-cmd/src/main/java/de/fraunhofer/iem/swan/features/doc/manual/annotated/ConjunctionCountFeature.java: -------------------------------------------------------------------------------- 1 | package de.fraunhofer.iem.swan.features.doc.manual.annotated; 2 | 3 | import de.fraunhofer.iem.swan.features.doc.manual.FeatureResult; 4 | import de.fraunhofer.iem.swan.features.doc.manual.IDocFeature; 5 | import de.fraunhofer.iem.swan.features.doc.nlp.AnnotatedMethod; 6 | import de.fraunhofer.iem.swan.features.doc.nlp.NLPUtils; 7 | 8 | /** 9 | * Counts the number of conjunction tokens in the doc comment. 10 | * 11 | * @author Oshando Johnson on 20.08.20 12 | */ 13 | public class ConjunctionCountFeature extends POSCountFeature implements IDocFeature { 14 | 15 | public ConjunctionCountFeature() { 16 | super(); 17 | } 18 | 19 | @Override 20 | public FeatureResult evaluate(AnnotatedMethod annotatedMethod) { 21 | 22 | featureResult.setMethodValue(countPartOfSpeech(annotatedMethod.getMethodMap(), NLPUtils.POS.CONJUNCTION)); 23 | featureResult.setClassValue(countPartOfSpeech(annotatedMethod.getClassMap(), NLPUtils.POS.CONJUNCTION)); 24 | 25 | return featureResult; 26 | } 27 | 28 | @Override 29 | public String toString() { 30 | return "ConjunctionCountFeature [" + featureResult + "]"; 31 | } 32 | 33 | @Override 34 | public String getName() { 35 | return "ConjunctionCountFeature"; 36 | } 37 | } -------------------------------------------------------------------------------- /swan-cmd/src/main/java/de/fraunhofer/iem/swan/features/doc/manual/annotated/CrossSiteScriptingCountFeature.java: -------------------------------------------------------------------------------- 1 | package de.fraunhofer.iem.swan.features.doc.manual.annotated; 2 | 3 | import de.fraunhofer.iem.swan.data.Category; 4 | import de.fraunhofer.iem.swan.features.doc.manual.FeatureResult; 5 | import de.fraunhofer.iem.swan.features.doc.manual.IDocFeature; 6 | import de.fraunhofer.iem.swan.features.doc.nlp.AnnotatedMethod; 7 | import de.fraunhofer.iem.swan.features.doc.manual.SecurityVocabulary; 8 | 9 | 10 | /** 11 | * Evaluates if cross-site scripting words are found in the doc comment. 12 | * *
13 | * * The number of cross-site scripting verbs and nouns is based on the 14 | * * {@link SecurityVocabulary#CWE79_VERBS} 15 | * * and {@link SecurityVocabulary#CWE79_NOUNS} lists. 16 | * 17 | * @author Oshando Johnson on 30.09.20 18 | */ 19 | public class CrossSiteScriptingCountFeature extends WordCountFeature implements IDocFeature { 20 | 21 | public CrossSiteScriptingCountFeature() { 22 | super(); 23 | } 24 | 25 | @Override 26 | public FeatureResult evaluate(AnnotatedMethod annotatedMethod) { 27 | 28 | featureResult.setMethodValue(wordCounter(annotatedMethod.getMethodMap(), Category.CWE79)); 29 | featureResult.setClassValue(wordCounter(annotatedMethod.getClassMap(), Category.CWE79)); 30 | 31 | return featureResult; 32 | } 33 | 34 | @Override 35 | public String toString() { 36 | return "CrossSiteScriptingCountFeature [" + featureResult + "]"; 37 | } 38 | 39 | @Override 40 | public String getName() { 41 | return "CrossSiteScriptingCountFeature"; 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /swan-cmd/src/main/java/de/fraunhofer/iem/swan/features/doc/manual/annotated/IncorrectAuthorizationCountFeature.java: -------------------------------------------------------------------------------- 1 | package de.fraunhofer.iem.swan.features.doc.manual.annotated; 2 | 3 | import de.fraunhofer.iem.swan.data.Category; 4 | import de.fraunhofer.iem.swan.features.doc.manual.FeatureResult; 5 | import de.fraunhofer.iem.swan.features.doc.manual.IDocFeature; 6 | import de.fraunhofer.iem.swan.features.doc.nlp.AnnotatedMethod; 7 | import de.fraunhofer.iem.swan.features.doc.manual.SecurityVocabulary; 8 | 9 | 10 | /** 11 | * Evaluates if incorrect authorization words are found in the doc comment. 12 | *
13 | * The number of incorrect authorization verbs and nouns is based on the
14 | * {@link SecurityVocabulary#CWE863_VERBS}
15 | * and {@link SecurityVocabulary#CWE863_NOUNS} lists.
16 | *
17 | * @author Oshando Johnson on 30.09.20
18 | */
19 | public class IncorrectAuthorizationCountFeature extends WordCountFeature implements IDocFeature {
20 |
21 | public IncorrectAuthorizationCountFeature() {
22 | super();
23 | }
24 |
25 | @Override
26 | public FeatureResult evaluate(AnnotatedMethod annotatedMethod) {
27 |
28 | featureResult.setMethodValue(wordCounter(annotatedMethod.getMethodMap(), Category.CWE863));
29 | featureResult.setClassValue(wordCounter(annotatedMethod.getClassMap(), Category.CWE863));
30 |
31 | return featureResult;
32 | }
33 |
34 | @Override
35 | public String toString() {
36 | return "IncorrectAuthorizationCountFeature [" + featureResult + "]";
37 | }
38 |
39 | @Override
40 | public String getName() {
41 | return "IncorrectAuthorizationCountFeature";
42 | }
43 | }
--------------------------------------------------------------------------------
/swan-cmd/src/main/java/de/fraunhofer/iem/swan/features/doc/manual/annotated/LemmaCountFeature.java:
--------------------------------------------------------------------------------
1 | package de.fraunhofer.iem.swan.features.doc.manual.annotated;
2 |
3 | import de.fraunhofer.iem.swan.features.doc.manual.FeatureResult;
4 | import de.fraunhofer.iem.swan.features.doc.manual.IDocFeature;
5 | import de.fraunhofer.iem.swan.features.doc.nlp.AnnotatedMethod;
6 | import edu.stanford.nlp.ling.CoreAnnotations;
7 | import edu.stanford.nlp.ling.CoreLabel;
8 | import edu.stanford.nlp.util.CoreMap;
9 |
10 | import java.util.HashSet;
11 | import java.util.List;
12 | import java.util.Set;
13 |
14 | /**
15 | * Counts the number of unique lemmas in the doc comment.
16 | *
17 | * @author Oshando Johnson on 23.07.20
18 | */
19 | public class LemmaCountFeature implements IDocFeature {
20 |
21 | private FeatureResult featureResult;
22 |
23 | public LemmaCountFeature() {
24 | featureResult = new FeatureResult();
25 | }
26 |
27 |
28 | @Override
29 | public FeatureResult evaluate(AnnotatedMethod annotatedMethod) {
30 |
31 | featureResult.setMethodValue(countLemmas(annotatedMethod.getMethodMap()));
32 | featureResult.setClassValue(countLemmas(annotatedMethod.getClassMap()));
33 |
34 | return featureResult;
35 | }
36 |
37 | public int countLemmas(List
12 | * * The number of missing authentication verbs and nouns is based on the
13 | * * {@link SecurityVocabulary#CWE306_VERBS}
14 | * * and {@link SecurityVocabulary#CWE306_NOUNS} lists.
15 | *
16 | * @author Oshando Johnson on 30.09.20
17 | */
18 | public class MissingAuthCountFeature extends WordCountFeature implements IDocFeature {
19 |
20 |
21 | public MissingAuthCountFeature() {
22 | super();
23 | }
24 |
25 | @Override
26 | public FeatureResult evaluate(AnnotatedMethod annotatedMethod) {
27 |
28 | featureResult.setMethodValue(wordCounter(annotatedMethod.getMethodMap(), Category.CWE306));
29 | featureResult.setClassValue(wordCounter(annotatedMethod.getClassMap(), Category.CWE306));
30 |
31 | return featureResult;
32 | }
33 |
34 | @Override
35 | public String toString() {
36 | return "MissingAuthCountFeature [" + featureResult + "]";
37 | }
38 |
39 | @Override
40 | public String getName() {
41 | return "MissingAuthCountFeature";
42 | }
43 | }
44 |
--------------------------------------------------------------------------------
/swan-cmd/src/main/java/de/fraunhofer/iem/swan/features/doc/manual/annotated/MissingAuthorizationCountFeature.java:
--------------------------------------------------------------------------------
1 | package de.fraunhofer.iem.swan.features.doc.manual.annotated;
2 |
3 | import de.fraunhofer.iem.swan.data.Category;
4 | import de.fraunhofer.iem.swan.features.doc.manual.FeatureResult;
5 | import de.fraunhofer.iem.swan.features.doc.manual.IDocFeature;
6 | import de.fraunhofer.iem.swan.features.doc.nlp.AnnotatedMethod;
7 | import de.fraunhofer.iem.swan.features.doc.manual.SecurityVocabulary;
8 |
9 |
10 | /**
11 | * Evaluates if missing authorization words are found in the doc comment.
12 | *
13 | * The number of missing authorization verbs and nouns is based on the
14 | * {@link SecurityVocabulary#CWE862_VERBS}
15 | * and {@link SecurityVocabulary#CWE862_NOUNS} lists.
16 | *
17 | * @author Oshando Johnson on 30.09.20
18 | */
19 | public class MissingAuthorizationCountFeature extends WordCountFeature implements IDocFeature {
20 |
21 |
22 | public MissingAuthorizationCountFeature() {
23 | super();
24 | }
25 |
26 | @Override
27 | public FeatureResult evaluate(AnnotatedMethod annotatedMethod) {
28 |
29 | featureResult.setMethodValue(wordCounter(annotatedMethod.getMethodMap(), Category.CWE862));
30 | featureResult.setClassValue(wordCounter(annotatedMethod.getClassMap(), Category.CWE862));
31 |
32 | return featureResult;
33 | }
34 |
35 | @Override
36 | public String toString() {
37 | return "MissingAuthorizationCountFeature [" + featureResult + "]";
38 | }
39 |
40 | @Override
41 | public String getName() {
42 | return "MissingAuthorizationCountFeature";
43 | }
44 | }
--------------------------------------------------------------------------------
/swan-cmd/src/main/java/de/fraunhofer/iem/swan/features/doc/manual/annotated/NounCountFeature.java:
--------------------------------------------------------------------------------
1 | package de.fraunhofer.iem.swan.features.doc.manual.annotated;
2 |
3 | import de.fraunhofer.iem.swan.features.doc.manual.FeatureResult;
4 | import de.fraunhofer.iem.swan.features.doc.manual.IDocFeature;
5 | import de.fraunhofer.iem.swan.features.doc.nlp.AnnotatedMethod;
6 | import de.fraunhofer.iem.swan.features.doc.nlp.NLPUtils;
7 |
8 | /**
9 | * Counts the number of noun tokens in the doc comment.
10 | *
11 | * @author Oshando Johnson on 20.08.20
12 | */
13 | public class NounCountFeature extends POSCountFeature implements IDocFeature {
14 |
15 | public NounCountFeature() {
16 | super();
17 | }
18 |
19 | @Override
20 | public FeatureResult evaluate(AnnotatedMethod annotatedMethod) {
21 |
22 | featureResult.setMethodValue(countPartOfSpeech(annotatedMethod.getMethodMap(), NLPUtils.POS.NOUN));
23 | featureResult.setClassValue(countPartOfSpeech(annotatedMethod.getClassMap(), NLPUtils.POS.NOUN));
24 |
25 | return featureResult;
26 | }
27 |
28 | @Override
29 | public String toString() {
30 | return "NounCountFeature [" + featureResult + "]";
31 | }
32 |
33 | @Override
34 | public String getName() {
35 | return "NounCountFeature";
36 | }
37 | }
38 |
--------------------------------------------------------------------------------
/swan-cmd/src/main/java/de/fraunhofer/iem/swan/features/doc/manual/annotated/OpenRedirectCountFeature.java:
--------------------------------------------------------------------------------
1 | package de.fraunhofer.iem.swan.features.doc.manual.annotated;
2 |
3 | import de.fraunhofer.iem.swan.data.Category;
4 | import de.fraunhofer.iem.swan.features.doc.manual.FeatureResult;
5 | import de.fraunhofer.iem.swan.features.doc.manual.IDocFeature;
6 | import de.fraunhofer.iem.swan.features.doc.nlp.AnnotatedMethod;
7 | import de.fraunhofer.iem.swan.features.doc.manual.SecurityVocabulary;
8 |
9 | /**
10 | * Evaluates if open redirect words are found in the doc comment.
11 | *
12 | * The number of open redirect verbs and nouns is based on the
13 | * {@link SecurityVocabulary#CWE601_VERBS}
14 | * and {@link SecurityVocabulary#CWE601_NOUNS} lists.
15 | *
16 | * @author Oshando Johnson on 30.09.20
17 | */
18 | public class OpenRedirectCountFeature extends WordCountFeature implements IDocFeature {
19 |
20 | public OpenRedirectCountFeature() {
21 | super();
22 | }
23 |
24 | @Override
25 | public FeatureResult evaluate(AnnotatedMethod annotatedMethod) {
26 |
27 | featureResult.setMethodValue(wordCounter(annotatedMethod.getMethodMap(), Category.CWE601));
28 | featureResult.setClassValue(wordCounter(annotatedMethod.getClassMap(), Category.CWE601));
29 |
30 | return featureResult;
31 | }
32 |
33 | @Override
34 | public String toString() {
35 | return "OpenRedirectCountFeature [" + featureResult + "]";
36 | }
37 |
38 | @Override
39 | public String getName() {
40 | return "OpenRedirectCountFeature";
41 | }
42 | }
--------------------------------------------------------------------------------
/swan-cmd/src/main/java/de/fraunhofer/iem/swan/features/doc/manual/annotated/PrepositionCountFeature.java:
--------------------------------------------------------------------------------
1 | package de.fraunhofer.iem.swan.features.doc.manual.annotated;
2 |
3 | import de.fraunhofer.iem.swan.features.doc.manual.FeatureResult;
4 | import de.fraunhofer.iem.swan.features.doc.manual.IDocFeature;
5 | import de.fraunhofer.iem.swan.features.doc.nlp.AnnotatedMethod;
6 | import de.fraunhofer.iem.swan.features.doc.nlp.NLPUtils;
7 |
8 | /**
9 | * Counts the number of preposition tokens in the doc comment.
10 | *
11 | * @author Oshando Johnson on 20.08.20
12 | */
13 | public class PrepositionCountFeature extends POSCountFeature implements IDocFeature {
14 |
15 | public PrepositionCountFeature() {
16 | super();
17 | }
18 |
19 | @Override
20 | public FeatureResult evaluate(AnnotatedMethod annotatedMethod) {
21 |
22 | featureResult.setMethodValue(countPartOfSpeech(annotatedMethod.getMethodMap(), NLPUtils.POS.PREPOSITION));
23 | featureResult.setClassValue(countPartOfSpeech(annotatedMethod.getClassMap(), NLPUtils.POS.PREPOSITION));
24 |
25 | return featureResult;
26 | }
27 |
28 | @Override
29 | public String toString() {
30 | return "PrepositionCountFeature [" + featureResult + "]";
31 | }
32 |
33 | @Override
34 | public String getName() {
35 | return "PrepositionCountFeature";
36 | }
37 | }
--------------------------------------------------------------------------------
/swan-cmd/src/main/java/de/fraunhofer/iem/swan/features/doc/manual/annotated/PronounCountFeature.java:
--------------------------------------------------------------------------------
1 | package de.fraunhofer.iem.swan.features.doc.manual.annotated;
2 |
3 | import de.fraunhofer.iem.swan.features.doc.manual.FeatureResult;
4 | import de.fraunhofer.iem.swan.features.doc.manual.IDocFeature;
5 | import de.fraunhofer.iem.swan.features.doc.nlp.AnnotatedMethod;
6 | import de.fraunhofer.iem.swan.features.doc.nlp.NLPUtils;
7 |
8 | /**
9 | * Counts the number of pronoun tokens in the doc comment.
10 | *
11 | * @author Oshando Johnson on 20.08.20
12 | */
13 | public class PronounCountFeature extends POSCountFeature implements IDocFeature {
14 |
15 | public PronounCountFeature() {
16 | super();
17 | }
18 |
19 | @Override
20 | public FeatureResult evaluate(AnnotatedMethod annotatedMethod) {
21 |
22 | featureResult.setMethodValue(countPartOfSpeech(annotatedMethod.getMethodMap(), NLPUtils.POS.PRONOUN));
23 | featureResult.setClassValue(countPartOfSpeech(annotatedMethod.getClassMap(), NLPUtils.POS.PRONOUN));
24 |
25 | return featureResult;
26 | }
27 |
28 | @Override
29 | public String toString() {
30 | return "PronounCountFeature [" + featureResult + "]";
31 | }
32 |
33 | @Override
34 | public String getName() {
35 | return "PronounCountFeature";
36 | }
37 | }
--------------------------------------------------------------------------------
/swan-cmd/src/main/java/de/fraunhofer/iem/swan/features/doc/manual/annotated/PunctuationCountFeature.java:
--------------------------------------------------------------------------------
1 | package de.fraunhofer.iem.swan.features.doc.manual.annotated;
2 |
3 | import de.fraunhofer.iem.swan.features.doc.manual.FeatureResult;
4 | import de.fraunhofer.iem.swan.features.doc.manual.IDocFeature;
5 | import de.fraunhofer.iem.swan.features.doc.nlp.AnnotatedMethod;
6 | import de.fraunhofer.iem.swan.features.doc.nlp.NLPUtils;
7 |
8 | /**
9 | * Counts the number of punctuation tokens in the doc comment.
10 | *
11 | * @author Oshando Johnson on 20.08.20
12 | */
13 | public class PunctuationCountFeature extends POSCountFeature implements IDocFeature {
14 |
15 | public PunctuationCountFeature() {
16 | super();
17 | }
18 |
19 | @Override
20 | public FeatureResult evaluate(AnnotatedMethod annotatedMethod) {
21 |
22 | featureResult.setMethodValue(countPartOfSpeech(annotatedMethod.getMethodMap(), NLPUtils.POS.PUNCTUATION));
23 | featureResult.setClassValue(countPartOfSpeech(annotatedMethod.getClassMap(), NLPUtils.POS.PUNCTUATION));
24 |
25 | return featureResult;
26 | }
27 |
28 | @Override
29 | public String toString() {
30 | return "PunctuationCountFeature [" + featureResult + "]";
31 | }
32 |
33 | @Override
34 | public String getName() {
35 | return "PunctuationCountFeature";
36 | }
37 | }
--------------------------------------------------------------------------------
/swan-cmd/src/main/java/de/fraunhofer/iem/swan/features/doc/manual/annotated/SanitizerDataFlowFeature.java:
--------------------------------------------------------------------------------
1 | package de.fraunhofer.iem.swan.features.doc.manual.annotated;
2 |
3 | import de.fraunhofer.iem.swan.data.Category;
4 | import de.fraunhofer.iem.swan.features.doc.manual.FeatureResult;
5 | import de.fraunhofer.iem.swan.features.doc.manual.IDocFeature;
6 | import de.fraunhofer.iem.swan.features.doc.nlp.AnnotatedMethod;
7 | import de.fraunhofer.iem.swan.features.doc.manual.SecurityVocabulary;
8 |
9 | /**
10 | * Evaluates if sanitizer data flow prepositions are found in the doc comment.
11 | *
12 | * The sanitizer prepositions and nouns are based on the
13 | * {@link SecurityVocabulary#SANITIZER_PREPOSITIONS} and {@link SecurityVocabulary#SANITIZER_NOUNS} lists.
14 | *
15 | * @author Oshando Johnson on 01.09.20
16 | */
17 | public class SanitizerDataFlowFeature extends DataFlowFeature implements IDocFeature {
18 |
19 | public SanitizerDataFlowFeature() {
20 | super();
21 | }
22 |
23 | @Override
24 | public FeatureResult evaluate(AnnotatedMethod annotatedMethod) {
25 |
26 | featureResult.setMethodValue(wordCounter(annotatedMethod.getMethodMap(), Category.SANITIZER));
27 | featureResult.setClassValue(wordCounter(annotatedMethod.getClassMap(), Category.SANITIZER));
28 |
29 | return featureResult;
30 | }
31 |
32 | @Override
33 | public String toString() {
34 | return "SanitizerDataFlowFeature [" + featureResult + "]";
35 | }
36 |
37 | @Override
38 | public String getName() {
39 | return "SanitizerDataFlowFeature";
40 | }
41 | }
--------------------------------------------------------------------------------
/swan-cmd/src/main/java/de/fraunhofer/iem/swan/features/doc/manual/annotated/SanitizerWordCountFeature.java:
--------------------------------------------------------------------------------
1 | package de.fraunhofer.iem.swan.features.doc.manual.annotated;
2 |
3 | import de.fraunhofer.iem.swan.data.Category;
4 | import de.fraunhofer.iem.swan.features.doc.manual.FeatureResult;
5 | import de.fraunhofer.iem.swan.features.doc.manual.IDocFeature;
6 | import de.fraunhofer.iem.swan.features.doc.nlp.AnnotatedMethod;
7 | import de.fraunhofer.iem.swan.features.doc.manual.SecurityVocabulary;
8 |
9 | /**
10 | * Evaluates if sink words are found in the doc comment.
11 | *
12 | * The number of sanitizer verbs and nouns based on the
13 | * {@link SecurityVocabulary#SANITIZER_VERBS}
14 | * and {@link SecurityVocabulary#SANITIZER_NOUNS} lists.
15 | *
16 | * @author Oshando Johnson on 29.07.20
17 | */
18 | public class SanitizerWordCountFeature extends WordCountFeature implements IDocFeature {
19 |
20 | public SanitizerWordCountFeature() {
21 | super();
22 | }
23 |
24 | @Override
25 | public FeatureResult evaluate(AnnotatedMethod annotatedMethod) {
26 |
27 | featureResult.setMethodValue(wordCounter(annotatedMethod.getMethodMap(), Category.SANITIZER));
28 | featureResult.setClassValue(wordCounter(annotatedMethod.getClassMap(), Category.SANITIZER));
29 |
30 | return featureResult;
31 | }
32 |
33 | @Override
34 | public String toString() {
35 | return "SanitizerWordCountFeature [" + featureResult + "]";
36 | }
37 |
38 | @Override
39 | public String getName() {
40 | return "SanitizerWordCountFeature";
41 | }
42 | }
--------------------------------------------------------------------------------
/swan-cmd/src/main/java/de/fraunhofer/iem/swan/features/doc/manual/annotated/SinkDataFlowFeature.java:
--------------------------------------------------------------------------------
1 | package de.fraunhofer.iem.swan.features.doc.manual.annotated;
2 |
3 | import de.fraunhofer.iem.swan.data.Category;
4 | import de.fraunhofer.iem.swan.features.doc.manual.FeatureResult;
5 | import de.fraunhofer.iem.swan.features.doc.manual.IDocFeature;
6 | import de.fraunhofer.iem.swan.features.doc.nlp.AnnotatedMethod;
7 | import de.fraunhofer.iem.swan.features.doc.manual.SecurityVocabulary;
8 |
9 | /**
10 | * Evaluates if sink data flow prepositions are found in the doc comment.
11 | *
12 | * The sink prepositions and nouns are based on the
13 | * {@link SecurityVocabulary#SINK_PREPOSITIONS} and {@link SecurityVocabulary#SINK_NOUNS} lists.
14 | *
15 | * @author Oshando Johnson on 01.09.20
16 | */
17 | public class SinkDataFlowFeature extends DataFlowFeature implements IDocFeature {
18 |
19 | public SinkDataFlowFeature() {
20 | super();
21 | }
22 |
23 | @Override
24 | public FeatureResult evaluate(AnnotatedMethod annotatedMethod) {
25 |
26 | featureResult.setMethodValue(wordCounter(annotatedMethod.getMethodMap(), Category.SINK));
27 | featureResult.setClassValue(wordCounter(annotatedMethod.getClassMap(), Category.SINK));
28 |
29 | return featureResult;
30 | }
31 |
32 | @Override
33 | public String toString() {
34 | return "SinkDataFlowFeature [" + featureResult + "]";
35 | }
36 |
37 | @Override
38 | public String getName() {
39 | return "SinkDataFlowFeature";
40 | }
41 | }
--------------------------------------------------------------------------------
/swan-cmd/src/main/java/de/fraunhofer/iem/swan/features/doc/manual/annotated/SinkWordCountFeature.java:
--------------------------------------------------------------------------------
1 | package de.fraunhofer.iem.swan.features.doc.manual.annotated;
2 |
3 | import de.fraunhofer.iem.swan.data.Category;
4 | import de.fraunhofer.iem.swan.features.doc.manual.FeatureResult;
5 | import de.fraunhofer.iem.swan.features.doc.manual.IDocFeature;
6 | import de.fraunhofer.iem.swan.features.doc.nlp.AnnotatedMethod;
7 | import de.fraunhofer.iem.swan.features.doc.manual.SecurityVocabulary;
8 |
9 | /**
10 | * Evaluates if sink words are found in the doc comment.
11 | *
12 | * The number of sink verbs and nouns based on the
13 | * {@link SecurityVocabulary#SINK_VERBS}
14 | * and {@link SecurityVocabulary#SINK_NOUNS} lists.
15 | *
16 | * @author Oshando Johnson on 20.07.20
17 | */
18 | public class SinkWordCountFeature extends WordCountFeature implements IDocFeature {
19 |
20 | public SinkWordCountFeature() {
21 | super();
22 | }
23 |
24 | @Override
25 | public FeatureResult evaluate(AnnotatedMethod annotatedMethod) {
26 |
27 | featureResult.setMethodValue(wordCounter(annotatedMethod.getMethodMap(), Category.SINK));
28 | featureResult.setClassValue(wordCounter(annotatedMethod.getClassMap(), Category.SINK));
29 |
30 | return featureResult;
31 | }
32 |
33 | @Override
34 | public String toString() {
35 | return "SinkWordCountFeature [" + featureResult + "]";
36 | }
37 |
38 | @Override
39 | public String getName() {
40 | return "SinkWordCountFeature";
41 | }
42 | }
43 |
--------------------------------------------------------------------------------
/swan-cmd/src/main/java/de/fraunhofer/iem/swan/features/doc/manual/annotated/SourceDataFlowFeature.java:
--------------------------------------------------------------------------------
1 | package de.fraunhofer.iem.swan.features.doc.manual.annotated;
2 |
3 | import de.fraunhofer.iem.swan.data.Category;
4 | import de.fraunhofer.iem.swan.features.doc.manual.FeatureResult;
5 | import de.fraunhofer.iem.swan.features.doc.manual.IDocFeature;
6 | import de.fraunhofer.iem.swan.features.doc.nlp.AnnotatedMethod;
7 | import de.fraunhofer.iem.swan.features.doc.manual.SecurityVocabulary;
8 |
9 | /**
10 | * Evaluates if source data flow prepositions are found in the doc comment.
11 | *
12 | * The source prepositions and nouns are based on the
13 | * {@link SecurityVocabulary#SOURCE_PREPOSITIONS} and {@link SecurityVocabulary#SOURCE_NOUNS} lists.
14 | *
15 | * @author Oshando Johnson on 01.09.20
16 | */
17 | public class SourceDataFlowFeature extends DataFlowFeature implements IDocFeature {
18 |
19 | public SourceDataFlowFeature() {
20 | super();
21 | }
22 |
23 | @Override
24 | public FeatureResult evaluate(AnnotatedMethod annotatedMethod) {
25 |
26 | featureResult.setMethodValue(wordCounter(annotatedMethod.getMethodMap(), Category.SOURCE));
27 | featureResult.setClassValue(wordCounter(annotatedMethod.getClassMap(), Category.SOURCE));
28 |
29 | return featureResult;
30 | }
31 |
32 | @Override
33 | public String toString() {
34 | return "SourceDataFlowFeature [" + featureResult + "]";
35 | }
36 |
37 | @Override
38 | public String getName() {
39 | return "SourceDataFlowFeature";
40 | }
41 | }
--------------------------------------------------------------------------------
/swan-cmd/src/main/java/de/fraunhofer/iem/swan/features/doc/manual/annotated/SourceWordCountFeature.java:
--------------------------------------------------------------------------------
1 | package de.fraunhofer.iem.swan.features.doc.manual.annotated;
2 |
3 | import de.fraunhofer.iem.swan.data.Category;
4 | import de.fraunhofer.iem.swan.features.doc.manual.FeatureResult;
5 | import de.fraunhofer.iem.swan.features.doc.manual.IDocFeature;
6 | import de.fraunhofer.iem.swan.features.doc.nlp.AnnotatedMethod;
7 | import de.fraunhofer.iem.swan.features.doc.manual.SecurityVocabulary;
8 |
9 | /**
10 | * Evaluates if source words are found in the doc comment.
11 | *
12 | * The number of source verbs and nouns based on the
13 | * {@link SecurityVocabulary#SOURCE_VERBS}
14 | * and {@link SecurityVocabulary#SOURCE_NOUNS} lists.
15 | *
16 | * @author Oshando Johnson on 29.07.20
17 | */
18 | public class SourceWordCountFeature extends WordCountFeature implements IDocFeature {
19 |
20 | public SourceWordCountFeature() {
21 | super();
22 | }
23 |
24 | @Override
25 | public FeatureResult evaluate(AnnotatedMethod annotatedMethod) {
26 |
27 | featureResult.setMethodValue(wordCounter(annotatedMethod.getMethodMap(), Category.SOURCE));
28 | featureResult.setClassValue(wordCounter(annotatedMethod.getClassMap(), Category.SOURCE));
29 |
30 | return featureResult;
31 | }
32 |
33 | @Override
34 | public String toString() {
35 | return "SourceWordCountFeature [" + featureResult + "]";
36 | }
37 |
38 | @Override
39 | public String getName() {
40 | return "SourceWordCountFeature";
41 | }
42 | }
43 |
--------------------------------------------------------------------------------
/swan-cmd/src/main/java/de/fraunhofer/iem/swan/features/doc/manual/annotated/SqlInjectionCountFeature.java:
--------------------------------------------------------------------------------
1 | package de.fraunhofer.iem.swan.features.doc.manual.annotated;
2 |
3 | import de.fraunhofer.iem.swan.data.Category;
4 | import de.fraunhofer.iem.swan.features.doc.manual.FeatureResult;
5 | import de.fraunhofer.iem.swan.features.doc.manual.IDocFeature;
6 | import de.fraunhofer.iem.swan.features.doc.nlp.AnnotatedMethod;
7 | import de.fraunhofer.iem.swan.features.doc.manual.SecurityVocabulary;
8 |
9 | /**
10 | * Evaluates if SQL Injection words are found in the doc comment.
11 | *
12 | * The number of SQL Injection verbs and nouns based on the
13 | * {@link SecurityVocabulary#CWE89_VERBS}
14 | * and {@link SecurityVocabulary#CWE89_NOUNS} lists.
15 | *
16 | * @author Oshando Johnson on 07.08.20
17 | */
18 | public class SqlInjectionCountFeature extends WordCountFeature implements IDocFeature {
19 |
20 | public SqlInjectionCountFeature() {
21 | super();
22 | }
23 |
24 | @Override
25 | public FeatureResult evaluate(AnnotatedMethod annotatedMethod) {
26 |
27 | featureResult.setMethodValue(wordCounter(annotatedMethod.getMethodMap(), Category.CWE89));
28 | featureResult.setClassValue(wordCounter(annotatedMethod.getClassMap(), Category.CWE89));
29 |
30 | return featureResult;
31 | }
32 |
33 | @Override
34 | public String toString() {
35 | return "SqlInjectionCountFeature [" + featureResult + "]";
36 | }
37 |
38 | @Override
39 | public String getName() {
40 | return "SqlInjectionCountFeature";
41 | }
42 | }
--------------------------------------------------------------------------------
/swan-cmd/src/main/java/de/fraunhofer/iem/swan/features/doc/manual/annotated/VerbCountFeature.java:
--------------------------------------------------------------------------------
1 | package de.fraunhofer.iem.swan.features.doc.manual.annotated;
2 |
3 | import de.fraunhofer.iem.swan.features.doc.manual.FeatureResult;
4 | import de.fraunhofer.iem.swan.features.doc.manual.IDocFeature;
5 | import de.fraunhofer.iem.swan.features.doc.nlp.AnnotatedMethod;
6 | import de.fraunhofer.iem.swan.features.doc.nlp.NLPUtils;
7 |
8 | /**
9 | * Counts the number of verb tokens in the doc comment.
10 | *
11 | * @author Oshando Johnson on 20.08.20
12 | */
13 | public class VerbCountFeature extends POSCountFeature implements IDocFeature {
14 |
15 | public VerbCountFeature() {
16 | super();
17 | }
18 |
19 | @Override
20 | public FeatureResult evaluate(AnnotatedMethod annotatedMethod) {
21 |
22 | featureResult.setMethodValue(countPartOfSpeech(annotatedMethod.getMethodMap(), NLPUtils.POS.VERB));
23 | featureResult.setClassValue(countPartOfSpeech(annotatedMethod.getClassMap(), NLPUtils.POS.VERB));
24 |
25 | return featureResult;
26 | }
27 |
28 | @Override
29 | public String toString() {
30 | return "VerbCountFeature [" + featureResult + "]";
31 | }
32 |
33 | @Override
34 | public String getName() {
35 | return "VerbCountFeature";
36 | }
37 | }
--------------------------------------------------------------------------------
/swan-cmd/src/main/java/de/fraunhofer/iem/swan/features/doc/manual/preprocessed/AverageSentenceLengthFeature.java:
--------------------------------------------------------------------------------
1 | package de.fraunhofer.iem.swan.features.doc.manual.preprocessed;
2 |
3 | import de.fraunhofer.iem.swan.features.doc.manual.FeatureResult;
4 | import de.fraunhofer.iem.swan.features.doc.manual.IDocFeature;
5 | import de.fraunhofer.iem.swan.features.doc.nlp.AnnotatedMethod;
6 | import edu.stanford.nlp.simple.Document;
7 | import edu.stanford.nlp.simple.Sentence;
8 |
9 | /**
10 | * Calculates the average length of sentences in the comment.
11 | *
12 | * @author Oshando Johnson on 29.07.20
13 | */
14 | public class AverageSentenceLengthFeature implements IDocFeature {
15 |
16 | private FeatureResult unprocessedDocResult;
17 |
18 | public AverageSentenceLengthFeature() {
19 | unprocessedDocResult = new FeatureResult();
20 | }
21 |
22 | @Override
23 | public FeatureResult evaluate(AnnotatedMethod annotatedMethod) {
24 |
25 | Document classComment = new Document(annotatedMethod.getMethod().getJavadoc().getClassComment());
26 | Document methodComment = new Document(annotatedMethod.getMethod().getJavadoc().getMethodComment());
27 |
28 | unprocessedDocResult.setClassValue(calculateAverage(classComment));
29 | unprocessedDocResult.setMethodValue(calculateAverage(methodComment));
30 |
31 | return unprocessedDocResult;
32 | }
33 |
34 | /**
35 | * Returns average length of sentences for the document.
36 | *
37 | * @param document list of sentences
38 | * @return returns average length of sentences
39 | */
40 | public double calculateAverage(Document document) {
41 |
42 | int sentenceLength = 0;
43 |
44 | for (Sentence sentence : document.sentences()) {
45 | sentenceLength += sentence.length();
46 | }
47 |
48 | return (double)sentenceLength / (document.sentences().size() <= 0 ? 1 : document.sentences().size());
49 | }
50 |
51 | @Override
52 | public String toString() {
53 | return "AverageSentenceLengthFeature [" + unprocessedDocResult + "]";
54 | }
55 |
56 | @Override
57 | public String getName() {
58 | return "AverageSentenceLengthFeature";
59 | }
60 | }
61 |
--------------------------------------------------------------------------------
/swan-cmd/src/main/java/de/fraunhofer/iem/swan/features/doc/manual/preprocessed/CharacterCountFeature.java:
--------------------------------------------------------------------------------
1 | package de.fraunhofer.iem.swan.features.doc.manual.preprocessed;
2 |
3 | import de.fraunhofer.iem.swan.features.doc.manual.IDocFeature;
4 | import de.fraunhofer.iem.swan.features.doc.manual.FeatureResult;
5 | import de.fraunhofer.iem.swan.features.doc.nlp.AnnotatedMethod;
6 | import edu.stanford.nlp.simple.Document;
7 | import edu.stanford.nlp.simple.Sentence;
8 | import edu.stanford.nlp.simple.Token;
9 |
10 | /**
11 | * Counts the number of characters in the comment.
12 | *
13 | * @author Oshando Johnson on 29.07.20
14 | */
15 | public class CharacterCountFeature implements IDocFeature {
16 |
17 | private FeatureResult unprocessedDocResult;
18 |
19 | public CharacterCountFeature() {
20 | unprocessedDocResult = new FeatureResult();
21 | }
22 |
23 | @Override
24 | public FeatureResult evaluate(AnnotatedMethod annotatedMethod) {
25 |
26 | Document classComment = new Document(annotatedMethod.getMethod().getJavadoc().getClassComment());
27 | Document methodComment = new Document(annotatedMethod.getMethod().getJavadoc().getMethodComment());
28 |
29 | unprocessedDocResult.setClassValue(getCount(classComment));
30 | unprocessedDocResult.setMethodValue(getCount(methodComment));
31 |
32 | return unprocessedDocResult;
33 | }
34 |
35 | /**
36 | * Calculates average token length in the document.
37 | *
38 | * @param document document with sentences
39 | * @return number of
40 | */
41 | public int getCount(Document document) {
42 |
43 | int characterCount = 0;
44 |
45 | for (Sentence sentence : document.sentences()) {
46 | for (Token token : sentence.tokens()) {
47 | characterCount += token.originalText().length();
48 | }
49 | }
50 |
51 | return characterCount;
52 | }
53 |
54 | @Override
55 | public String toString() {
56 | return "CharacterCountFeature [" + unprocessedDocResult + "]";
57 | }
58 |
59 | @Override
60 | public String getName() {
61 | return "CharacterCountFeature";
62 | }
63 | }
64 |
--------------------------------------------------------------------------------
/swan-cmd/src/main/java/de/fraunhofer/iem/swan/features/doc/manual/preprocessed/CodeTagCountFeature.java:
--------------------------------------------------------------------------------
1 | package de.fraunhofer.iem.swan.features.doc.manual.preprocessed;
2 |
3 | import de.fraunhofer.iem.swan.features.doc.manual.FeatureResult;
4 | import de.fraunhofer.iem.swan.features.doc.manual.IDocFeature;
5 | import de.fraunhofer.iem.swan.features.doc.nlp.AnnotatedMethod;
6 |
7 | /**
8 | * Counts the number of code blocks in the Javadoc comment. Code tags are of the form {@code text}.
9 | *
10 | * @author Oshando Johnson on 30.07.20
11 | */
12 | public class CodeTagCountFeature extends TagCountFeature implements IDocFeature {
13 |
14 | public CodeTagCountFeature() {
15 | super();
16 | }
17 |
18 | @Override
19 | public FeatureResult evaluate(AnnotatedMethod annotatedMethod) {
20 |
21 | unprocessedDocResult.setClassValue(countTags(annotatedMethod.getMethod().getJavadoc().getClassComment(),
22 | Constants.TAG.CODE));
23 | unprocessedDocResult.setMethodValue(countTags(annotatedMethod.getMethod().getJavadoc().getMethodComment(),
24 | Constants.TAG.CODE));
25 |
26 | return unprocessedDocResult;
27 | }
28 |
29 | @Override
30 | public String toString() {
31 | return "CodeTagCountFeature [" + unprocessedDocResult + "]";
32 | }
33 |
34 | @Override
35 | public String getName() {
36 | return "CodeTagCountFeature";
37 | }
38 | }
39 |
--------------------------------------------------------------------------------
/swan-cmd/src/main/java/de/fraunhofer/iem/swan/features/doc/manual/preprocessed/Constants.java:
--------------------------------------------------------------------------------
1 | package de.fraunhofer.iem.swan.features.doc.manual.preprocessed;
2 |
3 | /**
4 | * @author Oshando Johnson on 30.07.20
5 | */
6 | public class Constants {
7 |
8 | //Regex patterns
9 | public static final String LINK_TAG_REGEX = "\\{@link(plain)?\\s(\\S+)(\\s\\S+)?}";
10 | public static final String CODE_TAG_REGEX = "\\{@code\\s(\\S+)}";
11 | public static final String SEE_TAG_REGEX = "\\{@see\\s(\\S+)}";
12 | public static final String DEPRECATED_TAG_REGEX = "\\{@deprecated\\s(\\S+)}";
13 | public static final String NUMBER_PATTERN = "[0-9]+";
14 | public static final String UPPERCASE_WORD_PATTERN = "([A-Z]+)\\b";
15 |
16 | public enum TAG{
17 | CODE,
18 | DEPRECATED,
19 | LINK,
20 | SEE
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/swan-cmd/src/main/java/de/fraunhofer/iem/swan/features/doc/manual/preprocessed/DeprecatedTagCountFeature.java:
--------------------------------------------------------------------------------
1 | package de.fraunhofer.iem.swan.features.doc.manual.preprocessed;
2 |
3 | import de.fraunhofer.iem.swan.features.doc.manual.IDocFeature;
4 | import de.fraunhofer.iem.swan.features.doc.manual.FeatureResult;
5 | import de.fraunhofer.iem.swan.features.doc.nlp.AnnotatedMethod;
6 |
7 | /**
8 | * Counts the the number of deprecated tags in the document.
9 | * Deprecated tags have this format: @deprecated deprecated-text
10 | *
11 | * @author Oshando Johnson on 02.08.20
12 | */
13 | public class DeprecatedTagCountFeature extends TagCountFeature implements IDocFeature {
14 |
15 | public DeprecatedTagCountFeature() {
16 | super();
17 | }
18 |
19 | @Override
20 | public FeatureResult evaluate(AnnotatedMethod annotatedMethod) {
21 |
22 | unprocessedDocResult.setClassValue(countTags(annotatedMethod.getMethod().getJavadoc().getClassComment(),
23 | Constants.TAG.DEPRECATED));
24 | unprocessedDocResult.setMethodValue(countTags(annotatedMethod.getMethod().getJavadoc().getMethodComment(),
25 | Constants.TAG.DEPRECATED));
26 |
27 | return unprocessedDocResult;
28 | }
29 |
30 | @Override
31 | public String toString() {
32 | return "DeprecatedTagCountFeature [" + unprocessedDocResult + "]";
33 | }
34 |
35 | @Override
36 | public String getName() {
37 | return "DeprecatedTagCountFeature";
38 | }
39 | }
--------------------------------------------------------------------------------
/swan-cmd/src/main/java/de/fraunhofer/iem/swan/features/doc/manual/preprocessed/IncompleteCodeFeature.java:
--------------------------------------------------------------------------------
1 | package de.fraunhofer.iem.swan.features.doc.manual.preprocessed;
2 |
3 | import de.fraunhofer.iem.swan.features.doc.manual.IDocFeature;
4 | import de.fraunhofer.iem.swan.features.doc.manual.FeatureResult;
5 | import de.fraunhofer.iem.swan.features.doc.nlp.AnnotatedMethod;
6 | import de.fraunhofer.iem.swan.features.doc.manual.SecurityVocabulary;
7 | import edu.stanford.nlp.simple.Document;
8 | import edu.stanford.nlp.simple.Sentence;
9 | import edu.stanford.nlp.simple.Token;
10 |
11 | /**
12 | * Checks if words that indicate incomplete implementation are used in the doc comment.
13 | *
14 | * List of words are found in {@link SecurityVocabulary#INCOMPLETE_CODE_KEYWORDS}
15 | *
16 | * @author Oshando Johnson on 02.09.20
17 | */
18 | public class IncompleteCodeFeature implements IDocFeature {
19 |
20 | private FeatureResult featureResult;
21 |
22 | public IncompleteCodeFeature() {
23 | featureResult = new FeatureResult();
24 | }
25 |
26 | @Override
27 | public FeatureResult evaluate(AnnotatedMethod annotatedMethod) {
28 | featureResult.setMethodValue(countWords(annotatedMethod.getMethod().getJavadoc().getMethodComment()));
29 | featureResult.setClassValue(countWords(annotatedMethod.getMethod().getJavadoc().getClassComment()));
30 |
31 | return featureResult;
32 | }
33 |
34 | private int countWords(String comment) {
35 |
36 | int counter = 0;
37 | Document document = new Document(comment.toLowerCase());
38 |
39 | for (Sentence sentence : document.sentences()) {
40 |
41 | for (Token token : sentence.tokens()) {
42 | if (SecurityVocabulary.INCOMPLETE_CODE_KEYWORDS.contains(token.lemma()))
43 | counter++;
44 | }
45 | }
46 |
47 | return counter;
48 | }
49 |
50 | @Override
51 | public String getName() {
52 | return "IncompleteCodeFeature";
53 | }
54 |
55 | @Override
56 | public String toString() {
57 | return "IncompleteCodeFeature [" + featureResult + "]";
58 | }
59 |
60 | }
61 |
--------------------------------------------------------------------------------
/swan-cmd/src/main/java/de/fraunhofer/iem/swan/features/doc/manual/preprocessed/LinkTagCountFeature.java:
--------------------------------------------------------------------------------
1 | package de.fraunhofer.iem.swan.features.doc.manual.preprocessed;
2 |
3 | import de.fraunhofer.iem.swan.features.doc.manual.IDocFeature;
4 | import de.fraunhofer.iem.swan.features.doc.manual.FeatureResult;
5 | import de.fraunhofer.iem.swan.features.doc.nlp.AnnotatedMethod;
6 |
7 | /**
8 | * Counts the number of linked classes and methods in the Javadoc comment.
9 | * Link tags have the following format: {@link package.class# label}
10 | * {@linkplain package.class# label}
11 | *
12 | * @author Oshando Johnson on 23.07.20
13 | */
14 | public class LinkTagCountFeature extends TagCountFeature implements IDocFeature {
15 |
16 | public LinkTagCountFeature() {
17 | super();
18 | }
19 |
20 | @Override
21 | public FeatureResult evaluate(AnnotatedMethod annotatedMethod) {
22 |
23 | unprocessedDocResult.setClassValue(countTags(annotatedMethod.getMethod().getJavadoc().getClassComment(),
24 | Constants.TAG.LINK));
25 | unprocessedDocResult.setMethodValue(countTags(annotatedMethod.getMethod().getJavadoc().getMethodComment(),
26 | Constants.TAG.LINK));
27 |
28 | return unprocessedDocResult;
29 | }
30 |
31 | @Override
32 | public String toString() {
33 | return "LinkTagCountFeature [" + unprocessedDocResult + "]";
34 | }
35 |
36 | @Override
37 | public String getName() {
38 | return "LinkTagCountFeature";
39 | }
40 | }
41 |
--------------------------------------------------------------------------------
/swan-cmd/src/main/java/de/fraunhofer/iem/swan/features/doc/manual/preprocessed/NumberCountFeature.java:
--------------------------------------------------------------------------------
1 | package de.fraunhofer.iem.swan.features.doc.manual.preprocessed;
2 |
3 | import de.fraunhofer.iem.swan.features.doc.manual.IDocFeature;
4 | import de.fraunhofer.iem.swan.features.doc.manual.FeatureResult;
5 | import de.fraunhofer.iem.swan.features.doc.nlp.AnnotatedMethod;
6 | import de.fraunhofer.iem.swan.features.doc.nlp.NLPUtils;
7 |
8 | /**
9 | * Counts the number of numerical characters in the original text.
10 | *
11 | * @author Oshando Johnson on 23.07.20
12 | */
13 | public class NumberCountFeature implements IDocFeature {
14 |
15 | private FeatureResult unprocessedDocResult;
16 |
17 | public NumberCountFeature() {
18 | unprocessedDocResult = new FeatureResult();
19 | }
20 |
21 | @Override
22 | public FeatureResult evaluate(AnnotatedMethod annotatedMethod) {
23 |
24 | unprocessedDocResult.setClassValue(NLPUtils.regexCounter(annotatedMethod.getMethod().getJavadoc().getClassComment(), Constants.NUMBER_PATTERN));
25 | unprocessedDocResult.setMethodValue(NLPUtils.regexCounter(annotatedMethod.getMethod().getJavadoc().getMethodComment(), Constants.NUMBER_PATTERN));
26 |
27 | return unprocessedDocResult;
28 | }
29 |
30 | @Override
31 | public String toString() {
32 | return "NumberCountFeature [" + unprocessedDocResult + "]";
33 | }
34 |
35 | @Override
36 | public String getName() {
37 | return "NumberCountFeature";
38 | }
39 | }
--------------------------------------------------------------------------------
/swan-cmd/src/main/java/de/fraunhofer/iem/swan/features/doc/manual/preprocessed/SeeTagCountFeature.java:
--------------------------------------------------------------------------------
1 | package de.fraunhofer.iem.swan.features.doc.manual.preprocessed;
2 |
3 | import de.fraunhofer.iem.swan.features.doc.manual.IDocFeature;
4 | import de.fraunhofer.iem.swan.features.doc.manual.FeatureResult;
5 | import de.fraunhofer.iem.swan.features.doc.nlp.AnnotatedMethod;
6 |
7 | /**
8 | * Counts the number of see Javadoc tags used in the documentation.
9 | * See tags have the following format: @see reference
10 | *
11 | * @author Oshando Johnson on 02.08.20
12 | */
13 | public class SeeTagCountFeature extends TagCountFeature implements IDocFeature {
14 |
15 | public SeeTagCountFeature() {
16 | super();
17 | }
18 |
19 | @Override
20 | public FeatureResult evaluate(AnnotatedMethod annotatedMethod) {
21 |
22 | unprocessedDocResult.setClassValue(countTags(annotatedMethod.getMethod().getJavadoc().getClassComment(),
23 | Constants.TAG.SEE));
24 | unprocessedDocResult.setMethodValue(countTags(annotatedMethod.getMethod().getJavadoc().getMethodComment(),
25 | Constants.TAG.SEE));
26 |
27 | return unprocessedDocResult;
28 | }
29 |
30 | @Override
31 | public String toString() {
32 | return "SeeTagCountFeature [" + unprocessedDocResult + "]";
33 | }
34 |
35 | @Override
36 | public String getName() {
37 | return "SeeTagCountFeature";
38 | }
39 | }
40 |
--------------------------------------------------------------------------------
/swan-cmd/src/main/java/de/fraunhofer/iem/swan/features/doc/manual/preprocessed/SentenceCountFeature.java:
--------------------------------------------------------------------------------
1 | package de.fraunhofer.iem.swan.features.doc.manual.preprocessed;
2 |
3 | import de.fraunhofer.iem.swan.features.doc.manual.FeatureResult;
4 | import de.fraunhofer.iem.swan.features.doc.manual.IDocFeature;
5 | import de.fraunhofer.iem.swan.features.doc.nlp.AnnotatedMethod;
6 | import edu.stanford.nlp.simple.Document;
7 |
8 | /**
9 | * Counts the number of sentences found in the comment.
10 | *
11 | * @author Oshando Johnson on 29.07.20
12 | */
13 | public class SentenceCountFeature implements IDocFeature {
14 |
15 | private FeatureResult unprocessedDocResult;
16 |
17 | public SentenceCountFeature() {
18 | unprocessedDocResult = new FeatureResult();
19 | }
20 |
21 | @Override
22 | public FeatureResult evaluate(AnnotatedMethod annotatedMethod) {
23 |
24 | Document classComment = new Document(annotatedMethod.getMethod().getJavadoc().getClassComment());
25 | Document methodComment = new Document(annotatedMethod.getMethod().getJavadoc().getMethodComment());
26 |
27 | unprocessedDocResult.setClassValue(classComment.sentences().size());
28 | unprocessedDocResult.setMethodValue(methodComment.sentences().size());
29 |
30 | return unprocessedDocResult;
31 | }
32 |
33 | @Override
34 | public String toString() {
35 | return "SentenceCountFeature [" + unprocessedDocResult + "]";
36 | }
37 |
38 | @Override
39 | public String getName() {
40 | return "SentenceCountFeature";
41 | }
42 | }
43 |
--------------------------------------------------------------------------------
/swan-cmd/src/main/java/de/fraunhofer/iem/swan/features/doc/manual/preprocessed/TagCountFeature.java:
--------------------------------------------------------------------------------
1 | package de.fraunhofer.iem.swan.features.doc.manual.preprocessed;
2 |
3 | import de.fraunhofer.iem.swan.features.doc.manual.FeatureResult;
4 | import de.fraunhofer.iem.swan.features.doc.nlp.NLPUtils;
5 |
6 | /**
7 | * @author Oshando Johnson on 23.08.20
8 | */
9 | public abstract class TagCountFeature {
10 |
11 | FeatureResult unprocessedDocResult;
12 |
13 | public TagCountFeature() {
14 | unprocessedDocResult = new FeatureResult();
15 | }
16 |
17 | /**
18 | * @param text
19 | * @param tag
20 | * @return
21 | */
22 | public int countTags(String text, Constants.TAG tag) {
23 |
24 | switch (tag) {
25 |
26 | case SEE:
27 | return NLPUtils.regexCounter(text, Constants.SEE_TAG_REGEX);
28 | case CODE:
29 | return NLPUtils.regexCounter(text, Constants.CODE_TAG_REGEX);
30 | case LINK:
31 | return NLPUtils.regexCounter(text, Constants.LINK_TAG_REGEX);
32 | case DEPRECATED:
33 | return NLPUtils.regexCounter(text, Constants.DEPRECATED_TAG_REGEX);
34 | default:
35 | return 0;
36 | }
37 | }
38 | }
39 |
--------------------------------------------------------------------------------
/swan-cmd/src/main/java/de/fraunhofer/iem/swan/features/doc/manual/preprocessed/TokenCountFeature.java:
--------------------------------------------------------------------------------
1 | package de.fraunhofer.iem.swan.features.doc.manual.preprocessed;
2 |
3 | import de.fraunhofer.iem.swan.features.doc.manual.IDocFeature;
4 | import de.fraunhofer.iem.swan.features.doc.manual.FeatureResult;
5 | import de.fraunhofer.iem.swan.features.doc.nlp.AnnotatedMethod;
6 | import edu.stanford.nlp.simple.Document;
7 | import edu.stanford.nlp.simple.Sentence;
8 |
9 | /**
10 | * Counts the number of tokens in the method and class comment.
11 | *
12 | * @author Oshando Johnson on 29.07.20
13 | */
14 | public class TokenCountFeature implements IDocFeature {
15 |
16 | private FeatureResult unprocessedDocResult;
17 |
18 | public TokenCountFeature() {
19 | unprocessedDocResult = new FeatureResult();
20 | }
21 |
22 |
23 | @Override
24 | public FeatureResult evaluate(AnnotatedMethod annotatedMethod) {
25 |
26 | Document classComment = new Document(annotatedMethod.getMethod().getJavadoc().getClassComment());
27 | Document methodComment = new Document(annotatedMethod.getMethod().getJavadoc().getMethodComment());
28 |
29 | unprocessedDocResult.setClassValue(getCount(classComment));
30 | unprocessedDocResult.setMethodValue(getCount(methodComment));
31 |
32 | return unprocessedDocResult;
33 | }
34 |
35 | /**
36 | * Counts the number of words in the document.
37 | *
38 | * @param document document with sentences
39 | * @return number of
40 | */
41 | public int getCount(Document document) {
42 |
43 | int tokenCount = 0;
44 |
45 | for (Sentence sentence : document.sentences()) {
46 | tokenCount += sentence.tokens().size();
47 | }
48 |
49 | return tokenCount;
50 | }
51 |
52 | @Override
53 | public String toString() {
54 | return "TokenCountFeature [" + unprocessedDocResult + "]";
55 | }
56 |
57 | @Override
58 | public String getName() {
59 | return "TokenCountFeature";
60 | }
61 | }
62 |
--------------------------------------------------------------------------------
/swan-cmd/src/main/java/de/fraunhofer/iem/swan/features/doc/manual/preprocessed/UppercaseWordsCountFeature.java:
--------------------------------------------------------------------------------
1 | package de.fraunhofer.iem.swan.features.doc.manual.preprocessed;
2 |
3 | import de.fraunhofer.iem.swan.features.doc.manual.IDocFeature;
4 | import de.fraunhofer.iem.swan.features.doc.manual.FeatureResult;
5 | import de.fraunhofer.iem.swan.features.doc.nlp.AnnotatedMethod;
6 | import de.fraunhofer.iem.swan.features.doc.nlp.NLPUtils;
7 |
8 | /**
9 | * Counts the number of uppercase words in the original text.
10 | * Uppercase words can either be abbreviations or warnings.
11 | *
12 | * @author Oshando Johnson on 23.07.20
13 | */
14 | public class UppercaseWordsCountFeature implements IDocFeature {
15 |
16 | private FeatureResult unprocessedDocResult;
17 |
18 | public UppercaseWordsCountFeature() {
19 | unprocessedDocResult = new FeatureResult();
20 | }
21 |
22 |
23 | @Override
24 | public FeatureResult evaluate(AnnotatedMethod annotatedMethod) {
25 |
26 | unprocessedDocResult.setClassValue(NLPUtils.regexCounter(annotatedMethod.getMethod().getJavadoc().getClassComment(), Constants.UPPERCASE_WORD_PATTERN));
27 | unprocessedDocResult.setMethodValue(NLPUtils.regexCounter(annotatedMethod.getMethod().getJavadoc().getMethodComment(), Constants.UPPERCASE_WORD_PATTERN));
28 |
29 | return unprocessedDocResult;
30 | }
31 |
32 | @Override
33 | public String toString() {
34 | return "UppercaseWordsCountFeature [" + unprocessedDocResult + "]";
35 | }
36 |
37 | @Override
38 | public String getName() {
39 | return "UppercaseWordsCountFeature";
40 | }
41 | }
42 |
--------------------------------------------------------------------------------
/swan-cmd/src/main/java/de/fraunhofer/iem/swan/features/doc/nlp/AnnotatedMethod.java:
--------------------------------------------------------------------------------
1 | package de.fraunhofer.iem.swan.features.doc.nlp;
2 |
3 | import de.fraunhofer.iem.swan.data.Method;
4 | import edu.stanford.nlp.util.CoreMap;
5 |
6 | import java.util.List;
7 |
8 | /**
9 | * @author Oshando Johnson on 19.07.20
10 | */
11 | public class AnnotatedMethod {
12 |
13 | private Method method;
14 | private List Java-Klasse für Class_Comment_BlockType complex type.
12 | *
13 | * Das folgende Schemafragment gibt den erwarteten Content an, der in dieser Klasse enthalten ist.
14 | *
15 | * Java-Klasse für Constructor_Comment_BlockType complex type.
12 | *
13 | * Das folgende Schemafragment gibt den erwarteten Content an, der in dieser Klasse enthalten ist.
14 | *
15 | * Java-Klasse für ConstructorsType complex type.
12 | *
13 | * Das folgende Schemafragment gibt den erwarteten Content an, der in dieser Klasse enthalten ist.
14 | *
15 | * Java-Klasse für Method_Comment_BlockType complex type.
12 | *
13 | * Das folgende Schemafragment gibt den erwarteten Content an, der in dieser Klasse enthalten ist.
14 | *
15 | * Java-Klasse für MethodsType complex type.
14 | *
15 | * Das folgende Schemafragment gibt den erwarteten Content an, der in dieser Klasse enthalten ist.
16 | *
17 | *
44 | * This accessor method returns a reference to the live list,
45 | * not a snapshot. Therefore any modification you make to the
46 | * returned list will be present inside the JAXB object.
47 | * This is why there is not a
50 | * For example, to add a new item, do as follows:
51 | *
57 | * Objects of the following type(s) are allowed in the list
58 | * {@link MethodBlockType }
59 | *
60 | *
61 | */
62 | public List
16 | * <complexType name="Class_Comment_BlockType">
17 | * <complexContent>
18 | * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
19 | * <sequence>
20 | * <element name="Class_Comment" type="{}Class_CommentType"/>
21 | * </sequence>
22 | * </restriction>
23 | * </complexContent>
24 | * </complexType>
25 | *
26 | *
27 | *
28 | */
29 | @XmlAccessorType(XmlAccessType.FIELD)
30 | @XmlType(name = "Class_Comment_BlockType", propOrder = {
31 | "classComment"
32 | })
33 | public class ClassCommentBlockType {
34 |
35 | @XmlElement(name = "Class_Comment", required = true)
36 | protected ClassCommentType classComment;
37 |
38 | /**
39 | * Ruft den Wert der classComment-Eigenschaft ab.
40 | *
41 | * @return
42 | * possible object is
43 | * {@link ClassCommentType }
44 | *
45 | */
46 | public ClassCommentType getClassComment() {
47 | return classComment;
48 | }
49 |
50 | /**
51 | * Legt den Wert der classComment-Eigenschaft fest.
52 | *
53 | * @param value
54 | * allowed object is
55 | * {@link ClassCommentType }
56 | *
57 | */
58 | public void setClassComment(ClassCommentType value) {
59 | this.classComment = value;
60 | }
61 |
62 | }
63 |
--------------------------------------------------------------------------------
/swan-cmd/src/main/java/de/fraunhofer/iem/swan/io/doc/ssldoclet/ConstructorCommentBlockType.java:
--------------------------------------------------------------------------------
1 |
2 | package de.fraunhofer.iem.swan.io.doc.ssldoclet;
3 |
4 | import javax.xml.bind.annotation.XmlAccessType;
5 | import javax.xml.bind.annotation.XmlAccessorType;
6 | import javax.xml.bind.annotation.XmlElement;
7 | import javax.xml.bind.annotation.XmlType;
8 |
9 |
10 | /**
11 | *
16 | * <complexType name="Constructor_Comment_BlockType">
17 | * <complexContent>
18 | * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
19 | * <sequence>
20 | * <element name="Constructor_Comment" type="{}Constructor_CommentType"/>
21 | * </sequence>
22 | * </restriction>
23 | * </complexContent>
24 | * </complexType>
25 | *
26 | *
27 | *
28 | */
29 | @XmlAccessorType(XmlAccessType.FIELD)
30 | @XmlType(name = "Constructor_Comment_BlockType", propOrder = {
31 | "constructorComment"
32 | })
33 | public class ConstructorCommentBlockType {
34 |
35 | @XmlElement(name = "Constructor_Comment", required = true)
36 | protected ConstructorCommentType constructorComment;
37 |
38 | /**
39 | * Ruft den Wert der constructorComment-Eigenschaft ab.
40 | *
41 | * @return
42 | * possible object is
43 | * {@link ConstructorCommentType }
44 | *
45 | */
46 | public ConstructorCommentType getConstructorComment() {
47 | return constructorComment;
48 | }
49 |
50 | /**
51 | * Legt den Wert der constructorComment-Eigenschaft fest.
52 | *
53 | * @param value
54 | * allowed object is
55 | * {@link ConstructorCommentType }
56 | *
57 | */
58 | public void setConstructorComment(ConstructorCommentType value) {
59 | this.constructorComment = value;
60 | }
61 |
62 | }
63 |
--------------------------------------------------------------------------------
/swan-cmd/src/main/java/de/fraunhofer/iem/swan/io/doc/ssldoclet/ConstructorsType.java:
--------------------------------------------------------------------------------
1 |
2 | package de.fraunhofer.iem.swan.io.doc.ssldoclet;
3 |
4 | import javax.xml.bind.annotation.XmlAccessType;
5 | import javax.xml.bind.annotation.XmlAccessorType;
6 | import javax.xml.bind.annotation.XmlElement;
7 | import javax.xml.bind.annotation.XmlType;
8 |
9 |
10 | /**
11 | *
16 | * <complexType name="ConstructorsType">
17 | * <complexContent>
18 | * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
19 | * <sequence>
20 | * <element name="Constructor_Block" type="{}Constructor_BlockType"/>
21 | * </sequence>
22 | * </restriction>
23 | * </complexContent>
24 | * </complexType>
25 | *
26 | *
27 | *
28 | */
29 | @XmlAccessorType(XmlAccessType.FIELD)
30 | @XmlType(name = "ConstructorsType", propOrder = {
31 | "constructorBlock"
32 | })
33 | public class ConstructorsType {
34 |
35 | @XmlElement(name = "Constructor_Block", required = true)
36 | protected ConstructorBlockType constructorBlock;
37 |
38 | /**
39 | * Ruft den Wert der constructorBlock-Eigenschaft ab.
40 | *
41 | * @return
42 | * possible object is
43 | * {@link ConstructorBlockType }
44 | *
45 | */
46 | public ConstructorBlockType getConstructorBlock() {
47 | return constructorBlock;
48 | }
49 |
50 | /**
51 | * Legt den Wert der constructorBlock-Eigenschaft fest.
52 | *
53 | * @param value
54 | * allowed object is
55 | * {@link ConstructorBlockType }
56 | *
57 | */
58 | public void setConstructorBlock(ConstructorBlockType value) {
59 | this.constructorBlock = value;
60 | }
61 |
62 | }
63 |
--------------------------------------------------------------------------------
/swan-cmd/src/main/java/de/fraunhofer/iem/swan/io/doc/ssldoclet/MethodCommentBlockType.java:
--------------------------------------------------------------------------------
1 |
2 | package de.fraunhofer.iem.swan.io.doc.ssldoclet;
3 |
4 | import javax.xml.bind.annotation.XmlAccessType;
5 | import javax.xml.bind.annotation.XmlAccessorType;
6 | import javax.xml.bind.annotation.XmlElement;
7 | import javax.xml.bind.annotation.XmlType;
8 |
9 |
10 | /**
11 | *
16 | * <complexType name="Method_Comment_BlockType">
17 | * <complexContent>
18 | * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
19 | * <sequence>
20 | * <element name="Method_Comment" type="{}Method_CommentType"/>
21 | * </sequence>
22 | * </restriction>
23 | * </complexContent>
24 | * </complexType>
25 | *
26 | *
27 | *
28 | */
29 | @XmlAccessorType(XmlAccessType.FIELD)
30 | @XmlType(name = "Method_Comment_BlockType", propOrder = {
31 | "methodComment"
32 | })
33 | public class MethodCommentBlockType {
34 |
35 | @XmlElement(name = "Method_Comment", required = true)
36 | protected MethodCommentType methodComment;
37 |
38 | /**
39 | * Ruft den Wert der methodComment-Eigenschaft ab.
40 | *
41 | * @return
42 | * possible object is
43 | * {@link MethodCommentType }
44 | *
45 | */
46 | public MethodCommentType getMethodComment() {
47 | return methodComment;
48 | }
49 |
50 | /**
51 | * Legt den Wert der methodComment-Eigenschaft fest.
52 | *
53 | * @param value
54 | * allowed object is
55 | * {@link MethodCommentType }
56 | *
57 | */
58 | public void setMethodComment(MethodCommentType value) {
59 | this.methodComment = value;
60 | }
61 |
62 | }
63 |
--------------------------------------------------------------------------------
/swan-cmd/src/main/java/de/fraunhofer/iem/swan/io/doc/ssldoclet/MethodsType.java:
--------------------------------------------------------------------------------
1 |
2 | package de.fraunhofer.iem.swan.io.doc.ssldoclet;
3 |
4 | import java.util.ArrayList;
5 | import java.util.List;
6 | import javax.xml.bind.annotation.XmlAccessType;
7 | import javax.xml.bind.annotation.XmlAccessorType;
8 | import javax.xml.bind.annotation.XmlElement;
9 | import javax.xml.bind.annotation.XmlType;
10 |
11 |
12 | /**
13 | *
18 | * <complexType name="MethodsType">
19 | * <complexContent>
20 | * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
21 | * <sequence>
22 | * <element name="Method_Block" type="{}Method_BlockType" maxOccurs="unbounded" minOccurs="0"/>
23 | * </sequence>
24 | * </restriction>
25 | * </complexContent>
26 | * </complexType>
27 | *
28 | *
29 | *
30 | */
31 | @XmlAccessorType(XmlAccessType.FIELD)
32 | @XmlType(name = "MethodsType", propOrder = {
33 | "methodBlock"
34 | })
35 | public class MethodsType {
36 |
37 | @XmlElement(name = "Method_Block")
38 | protected Listset
method for the methodBlock property.
48 | *
49 | *
52 | * getMethodBlock().add(newItem);
53 | *
54 | *
55 | *
56 | *