Package: LexQuoteToken

LexQuoteToken

nameinstructionbranchcomplexitylinemethod
LexQuoteToken(String, ILexLocation)
M: 0 C: 8
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 3
100%
M: 0 C: 1
100%
apply(IAnalysis)
M: 0 C: 4
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 2
100%
M: 0 C: 1
100%
apply(IAnswer)
M: 0 C: 4
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 1
100%
M: 0 C: 1
100%
apply(IQuestion, Object)
M: 5 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 2 C: 0
0%
M: 1 C: 0
0%
apply(IQuestionAnswer, Object)
M: 5 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 1 C: 0
0%
M: 1 C: 0
0%
clone()
M: 0 C: 8
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 1
100%
M: 0 C: 1
100%
getChildren(Boolean)
M: 20 C: 0
0%
M: 2 C: 0
0%
M: 2 C: 0
0%
M: 5 C: 0
0%
M: 1 C: 0
0%
getValue()
M: 0 C: 3
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 1
100%
M: 0 C: 1
100%
toString()
M: 0 C: 12
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 1
100%
M: 0 C: 1
100%

Coverage

1: /*******************************************************************************
2: *
3: *        Copyright (c) 2008 Fujitsu Services Ltd.
4: *
5: *        Author: Nick Battle
6: *
7: *        This file is part of VDMJ.
8: *
9: *        VDMJ is free software: you can redistribute it and/or modify
10: *        it under the terms of the GNU General Public License as published by
11: *        the Free Software Foundation, either version 3 of the License, or
12: *        (at your option) any later version.
13: *
14: *        VDMJ is distributed in the hope that it will be useful,
15: *        but WITHOUT ANY WARRANTY; without even the implied warranty of
16: *        MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17: *        GNU General Public License for more details.
18: *
19: *        You should have received a copy of the GNU General Public License
20: *        along with VDMJ. If not, see <http://www.gnu.org/licenses/>.
21: *
22: ******************************************************************************/
23:
24: package org.overture.ast.lex;
25:
26: import java.util.HashMap;
27: import java.util.Map;
28:
29: import org.overture.ast.analysis.AnalysisException;
30: import org.overture.ast.analysis.intf.IAnalysis;
31: import org.overture.ast.analysis.intf.IAnswer;
32: import org.overture.ast.analysis.intf.IQuestion;
33: import org.overture.ast.analysis.intf.IQuestionAnswer;
34: import org.overture.ast.intf.lex.ILexLocation;
35: import org.overture.ast.intf.lex.ILexQuoteToken;
36:
37: public class LexQuoteToken extends LexToken implements ILexQuoteToken
38: {
39:         private static final long serialVersionUID = 1L;
40:         public final String value;
41:
42:         public LexQuoteToken(String value, ILexLocation location)
43:         {
44:                 super(location, VDMToken.QUOTE);
45:                 this.value = value;
46:         }
47:
48:         @Override
49:         public String getValue()
50:         {
51:                 return value;
52:         }
53:
54:         @Override
55:         public String toString()
56:         {
57:                 return "<" + value + ">";
58:         }
59:
60:         @Override
61:         public LexQuoteToken clone()
62:         {
63:                 return new LexQuoteToken(value, location);
64:         }
65:
66:         @Override
67:         public void apply(IAnalysis analysis) throws AnalysisException
68:         {
69:                 analysis.caseILexQuoteToken(this);
70:         }
71:
72:         @Override
73:         public <A> A apply(IAnswer<A> caller) throws AnalysisException
74:         {
75:                 return caller.caseILexQuoteToken(this);
76:         }
77:
78:         @Override
79:         public <Q> void apply(IQuestion<Q> caller, Q question)
80:                         throws AnalysisException
81:         {
82:                 caller.caseILexQuoteToken(this, question);
83:         }
84:
85:         @Override
86:         public <Q, A> A apply(IQuestionAnswer<Q, A> caller, Q question)
87:                         throws AnalysisException
88:         {
89:                 return caller.caseILexQuoteToken(this, question);
90:         }
91:
92:         /**
93:          * Creates a map of all field names and their value
94:          *
95:          * @param includeInheritedFields
96:          * if true all inherited fields are included
97:          * @return a a map of names to values of all fields
98:          */
99:         @Override
100:         public Map<String, Object> getChildren(Boolean includeInheritedFields)
101:         {
102:                 Map<String, Object> fields = new HashMap<String, Object>();
103:•                if (includeInheritedFields)
104:                 {
105:                         fields.putAll(super.getChildren(includeInheritedFields));
106:                 }
107:                 fields.put("value", this.value);
108:                 return fields;
109:         }
110: }