1414public class JQA2RD implements Step {
1515 private DatabaseConnector connector = DatabaseConnector .getInstance ();
1616 private Log log = LogFactory .getLog (this .getClass ());
17- private OutputFormat outputFormat ;
1817
1918 private double namespaceTransparency ;
2019
21- private String classColorAsPercentage ;
22- private String classColorHex ;
20+ private String classColor ;
2321 private double classTransparency ;
2422
25- private String methodColorHex ;
23+ private String methodColor ;
2624 private double methodTransparency ;
27- private String methodColorAsPercentage ;
2825 private boolean methodTypeMode ;
2926 private boolean methodDisks ;
3027
31- private String dataColorHex ;
28+ private String dataColor ;
3229 private double dataTransparency ;
33- private String dataColorAsPercentage ;
3430 private double ringWidthAD ;
3531 private boolean dataDisks ;
3632
@@ -45,18 +41,14 @@ public JQA2RD(SettingsConfiguration config) {
4541 this .height = config .getRDHeight ();
4642 this .namespaceTransparency = config .getRDNamespaceTransparency ();
4743 this .ringWidth = config .getRDRingWidth ();
48- this .classColorAsPercentage = config .getRDClassColorAsPercentage ();
49- this .outputFormat = config .getOutputFormat ();
50- this .classColorHex = config .getClassColorHex ();
44+ this .classColor = config .getRDClassColor ();
5145 this .classTransparency = config .getRDClassTransparency ();
52- this .methodColorHex = config .getRDMethodColorHex ();
46+ this .methodColor = config .getRDMethodColor ();
5347 this .methodTransparency = config .getRDMethodTransparency ();
54- this .methodColorAsPercentage = config .getRDMethodColorAsPercentage ();
5548 this .minArea = config .getRDMinArea ();
56- this .dataColorHex = config .getRDDataColorHex ();
49+ this .dataColor = config .getRDDataColor ();
5750 this .dataTransparency = config .getRDDataTransparency ();
5851 this .ringWidthAD = config .getRDRingWidthAD ();
59- this .dataColorAsPercentage = config .getRDDataColorAsPercentage ();
6052 }
6153
6254 public void run () {
@@ -95,12 +87,8 @@ private void namespaceToDisk(Long namespace, Long parent) {
9587 }
9688
9789 private void structureToDisk (Node structure , Long parent ) {
98- String color = classColorAsPercentage ;
99- if (outputFormat == OutputFormat .AFrame ) {
100- color = classColorHex ;
101- }
10290 String properties = String .format ("ringWidth: %f, height: %f, transparency: %f, color: \' %s\' " , ringWidth ,
103- height , classTransparency , color );
91+ height , classTransparency , classColor );
10492 long disk = connector .addNode (cypherCreateNode (parent , structure .id (), Labels .Disk .name (), properties ), "n" ).id ();
10593 StatementResult methods = connector .executeRead ("MATCH (n)-[:DECLARES]->(m:Method) WHERE ID(n) = " + structure .id () +
10694 " AND EXISTS(m.hash) RETURN m" );
@@ -159,22 +147,16 @@ private void structureToDisk(Node structure, Long parent) {
159147 }
160148
161149 private void methodToDisk (Long method , Long parent ) {
162- String color = 153 / 255.0 + " " + 0 / 255.0 + " " + 0 / 255.0 ;
163- if (outputFormat == OutputFormat .AFrame ) {
164- color = methodColorHex ;
165- }
166150 String properties = String .format ("ringWidth: %f, height: %f, transparency: %f, color: \' %s\' " , ringWidth ,
167- height , methodTransparency , color );
151+ height , methodTransparency , methodColor );
168152 connector .executeWrite (cypherCreateNode (parent , method , Labels .Disk .name (), properties ));
169153 }
170154
171155 private void methodToDiskSegment (Node method , Long parent ) {
172156 double frequency = 0.0 ;
173157 double luminance = 0.0 ;
174- String color = methodColorAsPercentage ;
175- if (outputFormat == OutputFormat .AFrame ) {
176- color = methodColorHex ;
177- }
158+ String color = methodColor ;
159+
178160 Integer numberOfStatements = method .get ("effectiveLineCount" ).asInt (0 );
179161 double size = numberOfStatements .doubleValue ();
180162 if (numberOfStatements <= minArea ) {
@@ -187,42 +169,26 @@ private void methodToDiskSegment(Node method, Long parent) {
187169 }
188170
189171 private void attributeToDisk (Long attribute , Long parent ) {
190- String color = 153 / 255.0 + " " + 0 / 255.0 + " " + 0 / 255.0 ;
191- if (outputFormat == OutputFormat .AFrame ) {
192- color = dataColorHex ;
193- }
194172 String properties = String .format ("ringWidth: %f, height: %f, transparency: %f, color: \' %s\' " ,
195- ringWidthAD , height , dataTransparency , color );
173+ ringWidthAD , height , dataTransparency , dataColor );
196174 connector .executeWrite (cypherCreateNode (parent , attribute , Labels .Disk .name (), properties ));
197175 }
198176
199177 private void attributeToDiskSegment (Long attribute , Long parent ) {
200- String color = dataColorAsPercentage ;
201- if (outputFormat == OutputFormat .AFrame ) {
202- color = dataColorHex ;
203- }
204178 String properties = String .format ("size: %f, height: %f, transparency: %f, color: \' %s\' " , 1.0 , height ,
205- dataTransparency , color );
179+ dataTransparency , dataColor );
206180 connector .executeWrite (cypherCreateNode (parent , attribute , Labels .DiskSegment .name (), properties ));
207181 }
208182
209183 private void enumValueToDisk (Long enumValue , Long parent ) {
210- String color = 153 / 255.0 + " " + 0 / 255.0 + " " + 0 / 255.0 ;
211- if (outputFormat == OutputFormat .AFrame ) {
212- color = dataColorHex ;
213- }
214184 String properties = String .format ("ringWidth: %f, height: %f, transparency: %f, color: \' %s\' " ,
215- ringWidthAD , height , dataTransparency , color );
185+ ringWidthAD , height , dataTransparency , dataColor );
216186 connector .executeWrite (cypherCreateNode (parent , enumValue , Labels .Disk .name (), properties ));
217187 }
218188
219189 private void enumValueToDiskSegment (Long enumValue , Long parent ) {
220- String color = dataColorAsPercentage ;
221- if (outputFormat == OutputFormat .AFrame ) {
222- color = dataColorHex ;
223- }
224190 String properties = String .format ("size: %f, height: %f, transparency: %f, color: \' %s\' " , 1.0 , height ,
225- dataTransparency , color );
191+ dataTransparency , dataColor );
226192 connector .executeWrite (cypherCreateNode (parent , enumValue , Labels .DiskSegment .name (), properties ));
227193
228194 }
0 commit comments