1 | /******************************************************************************* | |
2 | * Copyhacked (H) 2012-2020. | |
3 | * This program and the accompanying materials | |
4 | * are made available under no term at all, use it like | |
5 | * you want, but share and discuss about it | |
6 | * every time possible with every body. | |
7 | * | |
8 | * Contributors: | |
9 | * ron190 at ymail dot com - initial implementation | |
10 | ******************************************************************************/ | |
11 | package com.jsql.model.bean.database; | |
12 | ||
13 | /** | |
14 | * Class used by the model to properly define components of the database. | |
15 | * When the model ends a process of injection, it builds the corresponding database elements | |
16 | * and provides them to the view. | |
17 | * You can traverse elements from columns, to its corresponding table, to its corresponding database, | |
18 | * inverse isn't required (database>table>column is not used) | |
19 | * Concern only databases, tables and columns, values are raw data directly processed by the view | |
20 | */ | |
21 | public abstract class AbstractElementDatabase { | |
22 | | |
23 | /** | |
24 | * Label of the current element. | |
25 | */ | |
26 | protected String elementValue; | |
27 | ||
28 | /** | |
29 | * Used by non-progressing threads like File, metadata and shells. | |
30 | * Required for suspendable concurrent map tracking. | |
31 | */ | |
32 | public static final AbstractElementDatabase MOCK = new AbstractElementDatabase() { | |
33 | ||
34 | @Override | |
35 | public AbstractElementDatabase getParent() { | |
36 | return null; | |
37 | } | |
38 | ||
39 | @Override | |
40 | public int getChildCount() { | |
41 | return 0; | |
42 | } | |
43 | ||
44 | @Override | |
45 | public String getLabelCount() { | |
46 |
1
1. getLabelCount : replaced return value with "" for com/jsql/model/bean/database/AbstractElementDatabase$1::getLabelCount → NO_COVERAGE |
return null; |
47 | } | |
48 | }; | |
49 | | |
50 | /** | |
51 | * Traverse upward, and return the parent. | |
52 | * @return | |
53 | */ | |
54 | public abstract AbstractElementDatabase getParent(); | |
55 | | |
56 | /** | |
57 | * Return the number of elements contained by current element :<br> | |
58 | * - for database: number of tables,<br> | |
59 | * - for table: number of rows.<br> | |
60 | */ | |
61 | public abstract int getChildCount(); | |
62 | | |
63 | /** | |
64 | * Return a readable label displayed by the view. | |
65 | * @return | |
66 | */ | |
67 | public abstract String getLabelCount(); | |
68 | | |
69 | /** | |
70 | * Return the label of current element. | |
71 | */ | |
72 | @Override | |
73 | public String toString() { | |
74 |
1
1. toString : replaced return value with "" for com/jsql/model/bean/database/AbstractElementDatabase::toString → KILLED |
return this.elementValue; |
75 | } | |
76 | | |
77 | public void setElementValue(String elementValue) { | |
78 | this.elementValue = elementValue; | |
79 | } | |
80 | } | |
Mutations | ||
46 |
1.1 |
|
74 |
1.1 |