Package: ValuesDefinitionLocator

ValuesDefinitionLocator

nameinstructionbranchcomplexitylinemethod
ValuesDefinitionLocator(IInterpreterAssistantFactory)
M: 6 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 3 C: 0
0%
M: 1 C: 0
0%
caseAAssignmentDefinition(AAssignmentDefinition, ObjectContext)
M: 8 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 1 C: 0
0%
M: 1 C: 0
0%
caseAEqualsDefinition(AEqualsDefinition, ObjectContext)
M: 24 C: 0
0%
M: 2 C: 0
0%
M: 2 C: 0
0%
M: 4 C: 0
0%
M: 1 C: 0
0%
caseAInstanceVariableDefinition(AInstanceVariableDefinition, ObjectContext)
M: 8 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 1 C: 0
0%
M: 1 C: 0
0%
caseAValueDefinition(AValueDefinition, ObjectContext)
M: 8 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 1 C: 0
0%
M: 1 C: 0
0%
createNewReturnValue(INode, ObjectContext)
M: 2 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 1 C: 0
0%
M: 1 C: 0
0%
createNewReturnValue(Object, ObjectContext)
M: 2 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 1 C: 0
0%
M: 1 C: 0
0%
defaultPDefinition(PDefinition, ObjectContext)
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%

Coverage

1: package org.overture.interpreter.utilities.definition;
2:
3: import org.overture.ast.analysis.AnalysisException;
4: import org.overture.ast.analysis.QuestionAnswerAdaptor;
5: import org.overture.ast.definitions.AAssignmentDefinition;
6: import org.overture.ast.definitions.AEqualsDefinition;
7: import org.overture.ast.definitions.AInstanceVariableDefinition;
8: import org.overture.ast.definitions.AValueDefinition;
9: import org.overture.ast.definitions.PDefinition;
10: import org.overture.ast.node.INode;
11: import org.overture.interpreter.assistant.IInterpreterAssistantFactory;
12: import org.overture.interpreter.runtime.ObjectContext;
13: import org.overture.interpreter.values.ValueList;
14:
15: /***************************************
16: * This method locates a value for a definition node.
17: *
18: * @author gkanos
19: ****************************************/
20: public class ValuesDefinitionLocator extends
21:                 QuestionAnswerAdaptor<ObjectContext, ValueList>
22: {
23:         protected IInterpreterAssistantFactory af;
24:
25:         public ValuesDefinitionLocator(IInterpreterAssistantFactory af)
26:         {
27:                 this.af = af;
28:         }
29:
30:         @Override
31:         public ValueList caseAAssignmentDefinition(AAssignmentDefinition def,
32:                         ObjectContext ctxt) throws AnalysisException
33:         {
34:                 return af.createPExpAssistant().getValues(def.getExpression(), ctxt);
35:         }
36:
37:         @Override
38:         public ValueList caseAEqualsDefinition(AEqualsDefinition def,
39:                         ObjectContext ctxt) throws AnalysisException
40:         {
41:                 ValueList list = af.createPExpAssistant().getValues(def.getTest(), ctxt);
42:
43:•                if (def.getSetbind() != null)
44:                 {
45:                         list.addAll(af.createPBindAssistant().getBindValues(def.getSetbind(), ctxt, false));
46:                 }
47:
48:                 return list;
49:         }
50:
51:         @Override
52:         public ValueList caseAInstanceVariableDefinition(
53:                         AInstanceVariableDefinition def, ObjectContext ctxt)
54:                         throws AnalysisException
55:         {
56:                 return af.createPExpAssistant().getValues(def.getExpression(), ctxt);
57:         }
58:
59:         @Override
60:         public ValueList caseAValueDefinition(AValueDefinition def,
61:                         ObjectContext ctxt) throws AnalysisException
62:         {
63:                 return af.createPExpAssistant().getValues(def.getExpression(), ctxt);
64:         }
65:
66:         @Override
67:         public ValueList defaultPDefinition(PDefinition def, ObjectContext ctxt)
68:                         throws AnalysisException
69:         {
70:                 return new ValueList();
71:         }
72:
73:         @Override
74:         public ValueList createNewReturnValue(INode node, ObjectContext question)
75:                         throws AnalysisException
76:         {
77:                 // TODO Auto-generated method stub
78:                 return null;
79:         }
80:
81:         @Override
82:         public ValueList createNewReturnValue(Object node, ObjectContext question)
83:                         throws AnalysisException
84:         {
85:                 // TODO Auto-generated method stub
86:                 return null;
87:         }
88:
89: }