Package: LexCharacterToken

LexCharacterToken

nameinstructionbranchcomplexitylinemethod
LexCharacterToken(char, 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: 4 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 1 C: 0
0%
M: 1 C: 0
0%
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: 21 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: 11 C: 26
70%
M: 1 C: 1
50%
M: 1 C: 1
50%
M: 0 C: 2
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.ILexCharacterToken;
35: import org.overture.ast.intf.lex.ILexLocation;
36:
37: public class LexCharacterToken extends LexToken implements ILexCharacterToken
38: {
39:         private static final long serialVersionUID = 1L;
40:         public final char unicode;
41:
42:         public LexCharacterToken(char value, ILexLocation location)
43:         {
44:                 super(location, VDMToken.CHARACTER);
45:                 this.unicode = value;
46:         }
47:
48:         @Override
49:         public String toString()
50:         {
51:                 return super.toString()
52:                                 + " value "
53:•                                + (Character.isISOControl(unicode) ? Integer.toString(unicode)
54:                                                 + " decimal" : "[" + unicode + "]");
55:         }
56:
57:         @Override
58:         public char getValue()
59:         {
60:                 return unicode;
61:         }
62:
63:         @Override
64:         public ILexCharacterToken clone()
65:         {
66:                 return new LexCharacterToken(unicode, location);
67:         }
68:
69:         @Override
70:         public void apply(IAnalysis analysis) throws AnalysisException
71:         {
72:                 analysis.caseILexCharacterToken(this);
73:         }
74:
75:         @Override
76:         public <A> A apply(IAnswer<A> caller) throws AnalysisException
77:         {
78:                 return caller.caseILexCharacterToken(this);
79:         }
80:
81:         @Override
82:         public <Q> void apply(IQuestion<Q> caller, Q question)
83:                         throws AnalysisException
84:         {
85:                 caller.caseILexCharacterToken(this, question);
86:         }
87:
88:         @Override
89:         public <Q, A> A apply(IQuestionAnswer<Q, A> caller, Q question)
90:                         throws AnalysisException
91:         {
92:                 return caller.caseILexCharacterToken(this, question);
93:         }
94:
95:         /**
96:          * Creates a map of all field names and their value
97:          *
98:          * @param includeInheritedFields
99:          * if true all inherited fields are included
100:          * @return a a map of names to values of all fields
101:          */
102:         @Override
103:         public Map<String, Object> getChildren(Boolean includeInheritedFields)
104:         {
105:                 Map<String, Object> fields = new HashMap<String, Object>();
106:•                if (includeInheritedFields)
107:                 {
108:                         fields.putAll(super.getChildren(includeInheritedFields));
109:                 }
110:                 fields.put("unicode", this.unicode);
111:                 return fields;
112:         }
113: }