Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Florian Grabowski
Informationslandschaften in Minecraft zur Visualisierung von Softwarequalität
Commits
b7e294e8
Commit
b7e294e8
authored
Feb 03, 2022
by
Florian Grabowski
Browse files
Code Style and Imports
parent
b262e83d
Changes
29
Show whitespace changes
Inline
Side-by-side
.gitignore
View file @
b7e294e8
/src/server/logs/
/src/server/logs/
/src/server/world/
/src/server/plugins/
/src/server/world_nether/
/src/server/world_the_end/
*.class
*.class
/.idea/inspectionProfiles/Project_Default.xml
/.idea/inspectionProfiles/Project_Default.xml
/.idea/sqldialects.xml
/.idea/sqldialects.xml
*.mca
.console_history
src/main/java/de/_82grfl1bif/
KPI_
Visualizer/commands/
g
enerateLayout.java
→
src/main/java/de/_82grfl1bif/
kpi
Visualizer/commands/
G
enerateLayout.java
View file @
b7e294e8
package
de._82grfl1bif.
KPI_
Visualizer.commands
;
package
de._82grfl1bif.
kpi
Visualizer.commands
;
import
de._82grfl1bif.KPI_Visualizer.data.DataHolder
;
import
de._82grfl1bif.kpiVisualizer.data.DataHolder
;
import
de._82grfl1bif.KPI_Visualizer.data.JsonParser
;
import
de._82grfl1bif.kpiVisualizer.data.JsonParser
;
import
de._82grfl1bif.KPI_Visualizer.layouts.TreeMap.Rectangle
;
import
de._82grfl1bif.kpiVisualizer.layouts.treeMap.Rectangle
;
import
de._82grfl1bif.KPI_Visualizer.layouts.TreeMap.Row
;
import
de._82grfl1bif.kpiVisualizer.layouts.treeMap.Row
;
import
de._82grfl1bif.KPI_Visualizer.layouts.TreeMap.SquarifiedTreemapLayout
;
import
de._82grfl1bif.kpiVisualizer.layouts.treeMap.SquarifiedTreemapLayout
;
import
de._82grfl1bif.KPI_Visualizer.structures.*
;
import
de._82grfl1bif.kpiVisualizer.structures.Builder
;
import
de._82grfl1bif.kpiVisualizer.structures.Building
;
import
de._82grfl1bif.kpiVisualizer.structures.Foundation
;
import
de._82grfl1bif.kpiVisualizer.structures.Structure
;
import
org.bukkit.Bukkit
;
import
org.bukkit.Bukkit
;
import
org.bukkit.Location
;
import
org.bukkit.Location
;
import
org.bukkit.Material
;
import
org.bukkit.Material
;
...
@@ -21,7 +24,7 @@ import java.awt.*;
...
@@ -21,7 +24,7 @@ import java.awt.*;
import
java.util.Map
;
import
java.util.Map
;
import
java.util.logging.Level
;
import
java.util.logging.Level
;
public
class
g
enerateLayout
implements
CommandExecutor
{
public
class
G
enerateLayout
implements
CommandExecutor
{
@Override
@Override
public
boolean
onCommand
(
@NotNull
CommandSender
sender
,
@NotNull
Command
command
,
@NotNull
String
label
,
@NotNull
String
[]
args
)
{
public
boolean
onCommand
(
@NotNull
CommandSender
sender
,
@NotNull
Command
command
,
@NotNull
String
label
,
@NotNull
String
[]
args
)
{
...
@@ -29,7 +32,6 @@ public class generateLayout implements CommandExecutor {
...
@@ -29,7 +32,6 @@ public class generateLayout implements CommandExecutor {
sender
.
sendMessage
(
"please type or select the needed Arguments with tab."
);
sender
.
sendMessage
(
"please type or select the needed Arguments with tab."
);
return
false
;
return
false
;
}
}
sender
.
sendMessage
(
"generating SimpleSquareLayout"
);
Server
server
=
sender
.
getServer
();
Server
server
=
sender
.
getServer
();
Builder
builder
=
new
Builder
(
server
);
Builder
builder
=
new
Builder
(
server
);
Player
player
=
server
.
getPlayer
(
sender
.
getName
());
Player
player
=
server
.
getPlayer
(
sender
.
getName
());
...
@@ -41,6 +43,7 @@ public class generateLayout implements CommandExecutor {
...
@@ -41,6 +43,7 @@ public class generateLayout implements CommandExecutor {
if
(
player
!=
null
)
{
//check if Player exists for getting Start coordinates.
if
(
player
!=
null
)
{
//check if Player exists for getting Start coordinates.
Location
location
=
player
.
getLocation
();
Location
location
=
player
.
getLocation
();
if
(
args
[
1
].
equals
(
"SquarifiedTreemap"
))
{
//check 2. Argument whether to use SquarifiedTreemap or SimpleSquare Layout.
if
(
args
[
1
].
equals
(
"SquarifiedTreemap"
))
{
//check 2. Argument whether to use SquarifiedTreemap or SimpleSquare Layout.
sender
.
sendMessage
(
"generating SquarifiedTreemapLayout"
);
BukkitRunnable
t
=
new
BukkitRunnable
()
{
BukkitRunnable
t
=
new
BukkitRunnable
()
{
@Override
@Override
public
void
run
()
{
public
void
run
()
{
...
@@ -56,18 +59,13 @@ public class generateLayout implements CommandExecutor {
...
@@ -56,18 +59,13 @@ public class generateLayout implements CommandExecutor {
}
else
{
}
else
{
builder
.
fillQube
(
location
.
clone
().
add
(
r
.
getOrigin
().
x
,
s
.
getDepth
()+
100
,
r
.
getOrigin
().
y
),(
int
)(
r
.
getWidth
()),((
Building
)
s
).
getHeight
(),(
int
)(
r
.
getHeight
()),
s
.
getMaterial
());
builder
.
fillQube
(
location
.
clone
().
add
(
r
.
getOrigin
().
x
,
s
.
getDepth
()+
100
,
r
.
getOrigin
().
y
),(
int
)(
r
.
getWidth
()),((
Building
)
s
).
getHeight
(),(
int
)(
r
.
getHeight
()),
s
.
getMaterial
());
}
}
if
(
r
.
getHeight
()
>=
5
&&
r
.
getWidth
()
>=
5
){
}
else
{
Bukkit
.
getLogger
().
log
(
Level
.
SEVERE
,
"the rectangle is too small"
);
}
}
}
}
}
}
}
};
};
t
.
run
();
t
.
run
();
return
true
;
}
else
{
}
else
{
sender
.
sendMessage
(
"generating SimpleSquareLayout"
);
BukkitRunnable
t
=
new
BukkitRunnable
()
{
BukkitRunnable
t
=
new
BukkitRunnable
()
{
@Override
@Override
public
void
run
()
{
public
void
run
()
{
...
@@ -80,8 +78,8 @@ public class generateLayout implements CommandExecutor {
...
@@ -80,8 +78,8 @@ public class generateLayout implements CommandExecutor {
}
}
};
};
t
.
run
();
t
.
run
();
return
true
;
}
}
return
true
;
}
else
{
}
else
{
Bukkit
.
getLogger
().
log
(
Level
.
SEVERE
,
"Kein Spieler gefunden."
);
Bukkit
.
getLogger
().
log
(
Level
.
SEVERE
,
"Kein Spieler gefunden."
);
...
...
src/main/java/de/_82grfl1bif/
KPI_
Visualizer/commands/SetPreset.java
→
src/main/java/de/_82grfl1bif/
kpi
Visualizer/commands/SetPreset.java
View file @
b7e294e8
package
de._82grfl1bif.
KPI_
Visualizer.commands
;
package
de._82grfl1bif.
kpi
Visualizer.commands
;
import
de._82grfl1bif.
KPI_
Visualizer.data.DataHolder
;
import
de._82grfl1bif.
kpi
Visualizer.data.DataHolder
;
import
de._82grfl1bif.
KPI_
Visualizer.structures.Builder
;
import
de._82grfl1bif.
kpi
Visualizer.structures.Builder
;
import
de._82grfl1bif.
KPI_
Visualizer.structures.Building
;
import
de._82grfl1bif.
kpi
Visualizer.structures.Building
;
import
de._82grfl1bif.
KPI_
Visualizer.structures.Structure
;
import
de._82grfl1bif.
kpi
Visualizer.structures.Structure
;
import
org.bukkit.Bukkit
;
import
org.bukkit.Bukkit
;
import
org.bukkit.Location
;
import
org.bukkit.Location
;
import
org.bukkit.Server
;
import
org.bukkit.Server
;
...
@@ -15,6 +15,7 @@ import org.jetbrains.annotations.NotNull;
...
@@ -15,6 +15,7 @@ import org.jetbrains.annotations.NotNull;
import
java.util.logging.Level
;
import
java.util.logging.Level
;
@Deprecated
public
class
SetPreset
implements
CommandExecutor
{
public
class
SetPreset
implements
CommandExecutor
{
@Override
@Override
...
...
src/main/java/de/_82grfl1bif/
KPI_
Visualizer/data/DataHolder.java
→
src/main/java/de/_82grfl1bif/
kpi
Visualizer/data/DataHolder.java
View file @
b7e294e8
package
de._82grfl1bif.
KPI_
Visualizer.data
;
package
de._82grfl1bif.
kpi
Visualizer.data
;
import
de._82grfl1bif.
KPI_
Visualizer.structures.Building
;
import
de._82grfl1bif.
kpi
Visualizer.structures.Building
;
import
de._82grfl1bif.
KPI_
Visualizer.structures.Foundation
;
import
de._82grfl1bif.
kpi
Visualizer.structures.Foundation
;
import
de._82grfl1bif.
KPI_
Visualizer.structures.Structure
;
import
de._82grfl1bif.
kpi
Visualizer.structures.Structure
;
import
org.bukkit.Material
;
import
org.bukkit.Material
;
import
java.util.ArrayList
;
import
java.util.ArrayList
;
...
@@ -70,7 +70,6 @@ public class DataHolder {
...
@@ -70,7 +70,6 @@ public class DataHolder {
public
static
void
generateTreeFromKlassenList
(
ArrayList
<
Klasse
>
klassen
)
{
public
static
void
generateTreeFromKlassenList
(
ArrayList
<
Klasse
>
klassen
)
{
foundation
=
new
Foundation
(
0
,
Material
.
YELLOW_CONCRETE
);
foundation
=
new
Foundation
(
0
,
Material
.
YELLOW_CONCRETE
);
ArrayList
<
String
>
Pakete
=
new
ArrayList
<>();
for
(
Klasse
currentKlasse
:
klassen
)
{
for
(
Klasse
currentKlasse
:
klassen
)
{
if
(
currentKlasse
.
depth
>=
0
)
{
if
(
currentKlasse
.
depth
>=
0
)
{
String
[]
strings
=
currentKlasse
.
path
.
split
(
"/"
);
String
[]
strings
=
currentKlasse
.
path
.
split
(
"/"
);
...
@@ -98,6 +97,7 @@ public class DataHolder {
...
@@ -98,6 +97,7 @@ public class DataHolder {
}
}
}
}
@Deprecated
private
static
Building
generateBuilding
()
{
private
static
Building
generateBuilding
()
{
Building
result
=
new
Building
(
ThreadLocalRandom
.
current
().
nextInt
(
4
,
60
+
1
),
ThreadLocalRandom
.
current
().
nextInt
(
4
,
200
+
1
),
Material
.
LIME_CONCRETE
);
Building
result
=
new
Building
(
ThreadLocalRandom
.
current
().
nextInt
(
4
,
60
+
1
),
ThreadLocalRandom
.
current
().
nextInt
(
4
,
200
+
1
),
Material
.
LIME_CONCRETE
);
result
.
setLocation
(
foundation
.
getLocation
());
result
.
setLocation
(
foundation
.
getLocation
());
...
...
src/main/java/de/_82grfl1bif/
KPI_
Visualizer/data/JsonParser.java
→
src/main/java/de/_82grfl1bif/
kpi
Visualizer/data/JsonParser.java
View file @
b7e294e8
package
de._82grfl1bif.
KPI_
Visualizer.data
;
package
de._82grfl1bif.
kpi
Visualizer.data
;
import
org.bukkit.Bukkit
;
import
org.bukkit.Bukkit
;
import
org.jetbrains.annotations.NotNull
;
import
org.jetbrains.annotations.NotNull
;
...
@@ -6,10 +6,16 @@ import org.json.simple.JSONArray;
...
@@ -6,10 +6,16 @@ import org.json.simple.JSONArray;
import
org.json.simple.JSONObject
;
import
org.json.simple.JSONObject
;
import
org.json.simple.parser.JSONParser
;
import
org.json.simple.parser.JSONParser
;
import
java.io.*
;
import
java.io.BufferedReader
;
import
java.io.BufferedWriter
;
import
java.io.File
;
import
java.io.FileReader
;
import
java.io.FileWriter
;
import
java.time.LocalDateTime
;
import
java.time.LocalDateTime
;
import
java.time.format.DateTimeFormatter
;
import
java.time.format.DateTimeFormatter
;
import
java.util.*
;
import
java.util.ArrayList
;
import
java.util.Comparator
;
import
java.util.List
;
import
java.util.logging.Level
;
import
java.util.logging.Level
;
public
class
JsonParser
{
public
class
JsonParser
{
...
@@ -36,13 +42,13 @@ public class JsonParser {
...
@@ -36,13 +42,13 @@ public class JsonParser {
JSONArray
entities
=
(
JSONArray
)
jsonObject
.
get
(
"entities"
);
JSONArray
entities
=
(
JSONArray
)
jsonObject
.
get
(
"entities"
);
ArrayList
<
Klasse
>
entitiesList
=
new
ArrayList
<>();
ArrayList
<
Klasse
>
entitiesList
=
new
ArrayList
<>();
DateTimeFormatter
formatter
=
DateTimeFormatter
.
ofPattern
(
"yyyy-MM-dd kk:mm:ss Z"
);
DateTimeFormatter
formatter
=
DateTimeFormatter
.
ofPattern
(
"yyyy-MM-dd kk:mm:ss Z"
);
for
(
int
i
=
0
;
i
<
entities
.
size
();
i
++
)
{
for
(
Object
entity
:
entities
)
{
JSONObject
object
=
(
JSONObject
)
entit
ies
.
get
(
i
)
;
JSONObject
object
=
(
JSONObject
)
entit
y
;
JSONArray
commits
=
(
JSONArray
)
((
JSONObject
)
entit
ies
.
get
(
i
)
).
get
(
"commits"
);
JSONArray
commits
=
(
JSONArray
)
((
JSONObject
)
entit
y
).
get
(
"commits"
);
ArrayList
<
LocalDateTime
>
dates
=
new
ArrayList
<>();
ArrayList
<
LocalDateTime
>
dates
=
new
ArrayList
<>();
for
(
Object
o:
commits
){
for
(
Object
o
:
commits
)
{
Object
date
=
((
JSONObject
)
o
).
get
(
"date"
);
Object
date
=
((
JSONObject
)
o
).
get
(
"date"
);
LocalDateTime
time
=
LocalDateTime
.
parse
(
date
.
toString
(),
formatter
);
LocalDateTime
time
=
LocalDateTime
.
parse
(
date
.
toString
(),
formatter
);
dates
.
add
(
time
);
dates
.
add
(
time
);
}
}
Klasse
currentKlasse
=
new
Klasse
(
Klasse
currentKlasse
=
new
Klasse
(
...
@@ -56,7 +62,7 @@ public class JsonParser {
...
@@ -56,7 +62,7 @@ public class JsonParser {
((
JSONArray
)
object
.
get
(
"variables"
)).
size
(),
((
JSONArray
)
object
.
get
(
"variables"
)).
size
(),
Math
.
round
(
Float
.
parseFloat
(
object
.
get
(
"complexity"
).
toString
())),
Math
.
round
(
Float
.
parseFloat
(
object
.
get
(
"complexity"
).
toString
())),
dates
);
dates
);
if
(
currentKlasse
.
depth
!=
-
1
)
entitiesList
.
add
(
currentKlasse
);
if
(
currentKlasse
.
depth
!=
-
1
)
entitiesList
.
add
(
currentKlasse
);
}
}
entitiesList
.
sort
(
new
DepthComparator
());
entitiesList
.
sort
(
new
DepthComparator
());
DataHolder
.
generateTreeFromKlassenList
(
entitiesList
);
DataHolder
.
generateTreeFromKlassenList
(
entitiesList
);
...
...
src/main/java/de/_82grfl1bif/
KPI_
Visualizer/data/Klasse.java
→
src/main/java/de/_82grfl1bif/
kpi
Visualizer/data/Klasse.java
View file @
b7e294e8
package
de._82grfl1bif.
KPI_
Visualizer.data
;
package
de._82grfl1bif.
kpi
Visualizer.data
;
import
java.time.Duration
;
import
java.time.Duration
;
import
java.time.LocalDateTime
;
import
java.time.LocalDateTime
;
...
...
src/main/java/de/_82grfl1bif/
KPI_
Visualizer/helpers/FileInputTabCompleter.java
→
src/main/java/de/_82grfl1bif/
kpi
Visualizer/helpers/FileInputTabCompleter.java
View file @
b7e294e8
package
de._82grfl1bif.
KPI_
Visualizer.helpers
;
package
de._82grfl1bif.
kpi
Visualizer.helpers
;
import
de._82grfl1bif.
KPI_
Visualizer.data.JsonParser
;
import
de._82grfl1bif.
kpi
Visualizer.data.JsonParser
;
import
org.bukkit.command.Command
;
import
org.bukkit.command.Command
;
import
org.bukkit.command.CommandSender
;
import
org.bukkit.command.CommandSender
;
import
org.bukkit.command.TabCompleter
;
import
org.bukkit.command.TabCompleter
;
...
...
src/main/java/de/_82grfl1bif/
KPI_
Visualizer/layouts/
S
impleSquare/Quadrat.java
→
src/main/java/de/_82grfl1bif/
kpi
Visualizer/layouts/
s
impleSquare/Quadrat.java
View file @
b7e294e8
package
de._82grfl1bif.
KPI_
Visualizer.layouts.
S
impleSquare
;
package
de._82grfl1bif.
kpi
Visualizer.layouts.
s
impleSquare
;
import
de._82grfl1bif.
KPI_
Visualizer.structures.Structure
;
import
de._82grfl1bif.
kpi
Visualizer.structures.Structure
;
import
java.awt.
*
;
import
java.awt.
Point
;
import
java.util.ArrayList
;
import
java.util.ArrayList
;
public
class
Quadrat
extends
Shape
{
public
class
Quadrat
extends
Shape
{
...
@@ -62,6 +62,7 @@ public class Quadrat extends Shape {
...
@@ -62,6 +62,7 @@ public class Quadrat extends Shape {
return
new
Point
(
topRightCorner
.
x
-
bottomLeftCorner
.
x
,
topRightCorner
.
y
-
bottomLeftCorner
.
y
);
return
new
Point
(
topRightCorner
.
x
-
bottomLeftCorner
.
x
,
topRightCorner
.
y
-
bottomLeftCorner
.
y
);
}
}
@Deprecated
public
void
applyCoordinates
(
Point
coordinates
){
public
void
applyCoordinates
(
Point
coordinates
){
this
.
bottomLeftCorner
=
coordinates
;
this
.
bottomLeftCorner
=
coordinates
;
}
}
...
...
src/main/java/de/_82grfl1bif/
KPI_
Visualizer/layouts/
S
impleSquare/Rectangle.java
→
src/main/java/de/_82grfl1bif/
kpi
Visualizer/layouts/
s
impleSquare/Rectangle.java
View file @
b7e294e8
package
de._82grfl1bif.
KPI_
Visualizer.layouts.
S
impleSquare
;
package
de._82grfl1bif.
kpi
Visualizer.layouts.
s
impleSquare
;
import
java.awt.
*
;
import
java.awt.
Point
;
import
java.util.ArrayList
;
import
java.util.ArrayList
;
public
class
Rectangle
extends
Shape
{
public
class
Rectangle
extends
Shape
{
...
...
src/main/java/de/_82grfl1bif/
KPI_
Visualizer/layouts/
S
impleSquare/Shape.java
→
src/main/java/de/_82grfl1bif/
kpi
Visualizer/layouts/
s
impleSquare/Shape.java
View file @
b7e294e8
package
de._82grfl1bif.
KPI_
Visualizer.layouts.
S
impleSquare
;
package
de._82grfl1bif.
kpi
Visualizer.layouts.
s
impleSquare
;
import
java.awt.Point
;
import
java.awt.Point
;
...
...
src/main/java/de/_82grfl1bif/
KPI_
Visualizer/layouts/
S
impleSquare/SimpleSquareLayout.java
→
src/main/java/de/_82grfl1bif/
kpi
Visualizer/layouts/
s
impleSquare/SimpleSquareLayout.java
View file @
b7e294e8
package
de._82grfl1bif.
KPI_
Visualizer.layouts.
S
impleSquare
;
package
de._82grfl1bif.
kpi
Visualizer.layouts.
s
impleSquare
;
import
de._82grfl1bif.KPI_Visualizer.layouts.SimpleSquare.Quadrat
;
import
de._82grfl1bif.kpiVisualizer.structures.Structure
;
import
de._82grfl1bif.KPI_Visualizer.layouts.SimpleSquare.Rectangle
;
import
de._82grfl1bif.KPI_Visualizer.structures.Structure
;
import
javax.management.AttributeNotFoundException
;
import
javax.management.AttributeNotFoundException
;
import
java.awt.
*
;
import
java.awt.
Point
;
import
java.util.ArrayList
;
import
java.util.ArrayList
;
import
java.util.Comparator
;
import
java.util.Comparator
;
...
@@ -78,9 +76,9 @@ public class SimpleSquareLayout {
...
@@ -78,9 +76,9 @@ public class SimpleSquareLayout {
layout
.
add
(
new
Quadrat
(
new
Point
(
q
.
bottomLeftCorner
.
y
,
q
.
bottomLeftCorner
.
x
),
new
Point
(
q
.
topRightCorner
.
y
,
q
.
topRightCorner
.
x
)));
// gespiegeltes Quadrat
layout
.
add
(
new
Quadrat
(
new
Point
(
q
.
bottomLeftCorner
.
y
,
q
.
bottomLeftCorner
.
x
),
new
Point
(
q
.
topRightCorner
.
y
,
q
.
topRightCorner
.
x
)));
// gespiegeltes Quadrat
layout
.
add
(
new
Quadrat
(
new
Point
(
q
.
bottomLeftCorner
.
x
,
q
.
bottomLeftCorner
.
x
),
structure
.
getWidth
().
x
));
// Oberes rechtes Quadrat
layout
.
add
(
new
Quadrat
(
new
Point
(
q
.
bottomLeftCorner
.
x
,
q
.
bottomLeftCorner
.
x
),
structure
.
getWidth
().
x
));
// Oberes rechtes Quadrat
if
((
this
.
size
-(
2
*
structure
.
getWidth
().
x
))
>
0
){
//falls Abstand zwischen den Quadraten ist.
if
((
this
.
size
-(
2
*
structure
.
getWidth
().
x
))
>
0
){
//falls Abstand zwischen den Quadraten ist.
de
.
_82grfl1bif
.
KPI_
Visualizer
.
layouts
.
S
impleSquare
.
Rectangle
rTop
=
new
de
.
_82grfl1bif
.
KPI_
Visualizer
.
layouts
.
S
impleSquare
.
Rectangle
(
structure
.
getWidth
().
x
,(
this
.
size
-
2
*
structure
.
getWidth
().
x
),
new
Point
(
q
.
topRightCorner
.
y
,
q
.
bottomLeftCorner
.
x
));
de
.
_82grfl1bif
.
kpi
Visualizer
.
layouts
.
s
impleSquare
.
Rectangle
rTop
=
new
de
.
_82grfl1bif
.
kpi
Visualizer
.
layouts
.
s
impleSquare
.
Rectangle
(
structure
.
getWidth
().
x
,(
this
.
size
-
2
*
structure
.
getWidth
().
x
),
new
Point
(
q
.
topRightCorner
.
y
,
q
.
bottomLeftCorner
.
x
));
layout
.
addAll
(
rTop
.
splitToQuads
(
rTop
));
layout
.
addAll
(
rTop
.
splitToQuads
(
rTop
));
de
.
_82grfl1bif
.
KPI_
Visualizer
.
layouts
.
S
impleSquare
.
Rectangle
rRight
=
new
Rectangle
((
this
.
size
-
2
*
structure
.
getWidth
().
x
),
structure
.
getWidth
().
x
,
new
Point
(
q
.
bottomLeftCorner
.
x
,
q
.
topRightCorner
.
y
));
de
.
_82grfl1bif
.
kpi
Visualizer
.
layouts
.
s
impleSquare
.
Rectangle
rRight
=
new
Rectangle
((
this
.
size
-
2
*
structure
.
getWidth
().
x
),
structure
.
getWidth
().
x
,
new
Point
(
q
.
bottomLeftCorner
.
x
,
q
.
topRightCorner
.
y
));
layout
.
addAll
(
rRight
.
splitToQuads
(
rRight
));
layout
.
addAll
(
rRight
.
splitToQuads
(
rRight
));
}
}
}
}
...
...
src/main/java/de/_82grfl1bif/
KPI_
Visualizer/layouts/
T
reeMap/Rectangle.java
→
src/main/java/de/_82grfl1bif/
kpi
Visualizer/layouts/
t
reeMap/Rectangle.java
View file @
b7e294e8
package
de._82grfl1bif.
KPI_
Visualizer.layouts.
T
reeMap
;
package
de._82grfl1bif.
kpi
Visualizer.layouts.
t
reeMap
;
import
de._82grfl1bif.KPI_Visualizer.structures.Structure
;
import
java.awt.Point
;
import
java.awt.*
;
import
java.util.ArrayList
;
import
java.util.HashMap
;
public
class
Rectangle
{
public
class
Rectangle
{
...
...
src/main/java/de/_82grfl1bif/
KPI_
Visualizer/layouts/
T
reeMap/Row.java
→
src/main/java/de/_82grfl1bif/
kpi
Visualizer/layouts/
t
reeMap/Row.java
View file @
b7e294e8
package
de._82grfl1bif.
KPI_
Visualizer.layouts.
T
reeMap
;
package
de._82grfl1bif.
kpi
Visualizer.layouts.
t
reeMap
;
import
de._82grfl1bif.
KPI_
Visualizer.structures.Structure
;
import
de._82grfl1bif.
kpi
Visualizer.structures.Structure
;
import
java.awt.
*
;
import
java.awt.
Point
;
import
java.util.HashMap
;
import
java.util.HashMap
;
import
java.util.Map
;
import
java.util.Map
;
...
...
src/main/java/de/_82grfl1bif/
KPI_
Visualizer/layouts/
T
reeMap/SquarifiedTreemapLayout.java
→
src/main/java/de/_82grfl1bif/
kpi
Visualizer/layouts/
t
reeMap/SquarifiedTreemapLayout.java
View file @
b7e294e8
package
de._82grfl1bif.
KPI_
Visualizer.layouts.
T
reeMap
;
package
de._82grfl1bif.
kpi
Visualizer.layouts.
t
reeMap
;
import
de._82grfl1bif.
KPI_
Visualizer.structures.Foundation
;
import
de._82grfl1bif.
kpi
Visualizer.structures.Foundation
;
import
de._82grfl1bif.
KPI_
Visualizer.structures.Structure
;
import
de._82grfl1bif.
kpi
Visualizer.structures.Structure
;
import
java.util.ArrayList
;
import
java.util.ArrayList
;
import
java.util.List
;
import
java.util.stream.Collectors
;
import
java.util.stream.Stream
;
public
class
SquarifiedTreemapLayout
{
public
class
SquarifiedTreemapLayout
{
private
ArrayList
<
Row
>
rows
=
new
ArrayList
<>()
;
private
final
ArrayList
<
Row
>
rows
;
public
ArrayList
<
Row
>
getRows
()
{
public
ArrayList
<
Row
>
getRows
()
{
return
rows
;
return
rows
;
...
...
src/main/java/de/_82grfl1bif/
KPI_
Visualizer/main.java
→
src/main/java/de/_82grfl1bif/
kpi
Visualizer/main.java
View file @
b7e294e8
package
de._82grfl1bif.
KPI_
Visualizer
;
package
de._82grfl1bif.
kpi
Visualizer
;
import
de._82grfl1bif.
KPI_
Visualizer.commands.
SetPrese
t
;
import
de._82grfl1bif.
kpi
Visualizer.commands.
GenerateLayou
t
;
import
de._82grfl1bif.
KPI_
Visualizer.commands.
generateLayou
t
;
import
de._82grfl1bif.
kpi
Visualizer.commands.
SetPrese
t
;
import
de._82grfl1bif.
KPI_
Visualizer.helpers.FileInputTabCompleter
;
import
de._82grfl1bif.
kpi
Visualizer.helpers.FileInputTabCompleter
;
import
org.bukkit.plugin.java.JavaPlugin
;
import
org.bukkit.plugin.java.JavaPlugin
;
import
java.util.Objects
;
public
final
class
main
extends
JavaPlugin
{
public
final
class
main
extends
JavaPlugin
{
@Override
@Override
public
void
onEnable
()
{
public
void
onEnable
()
{
// Plugin startup logic
// Plugin startup logic
getCommand
(
"setPreset"
).
setExecutor
(
new
SetPreset
());
Objects
.
requireNonNull
(
getCommand
(
"setPreset"
)
)
.
setExecutor
(
new
SetPreset
());
getCommand
(
"generateLayout"
).
setExecutor
(
new
g
enerateLayout
());
Objects
.
requireNonNull
(
getCommand
(
"generateLayout"
)
)
.
setExecutor
(
new
G
enerateLayout
());
getCommand
(
"generateLayout"
).
setTabCompleter
(
new
FileInputTabCompleter
());
Objects
.
requireNonNull
(
getCommand
(
"generateLayout"
)
)
.
setTabCompleter
(
new
FileInputTabCompleter
());
}
}
@Override
@Override
...
...
src/main/java/de/_82grfl1bif/
KPI_
Visualizer/structures/Builder.java
→
src/main/java/de/_82grfl1bif/
kpi
Visualizer/structures/Builder.java
View file @
b7e294e8
package
de._82grfl1bif.
KPI_
Visualizer.structures
;
package
de._82grfl1bif.
kpi
Visualizer.structures
;
import
de._82grfl1bif.
KPI_
Visualizer.data.Klasse
;
import
de._82grfl1bif.
kpi
Visualizer.data.Klasse
;
import
org.bukkit.Bukkit
;
import
org.bukkit.Bukkit
;
import
org.bukkit.Location
;
import
org.bukkit.Location
;
import
org.bukkit.Material
;
import
org.bukkit.Material
;
...
@@ -10,11 +10,11 @@ import org.bukkit.block.BlockFace;
...
@@ -10,11 +10,11 @@ import org.bukkit.block.BlockFace;
import
org.bukkit.block.Sign
;
import
org.bukkit.block.Sign
;
import
java.time.Duration
;
import
java.time.Duration
;
import
java.util.Objects
;
import
java.util.Random
;
import
java.util.Random
;
import
java.util.logging.Level
;
import
java.util.logging.Level
;
import
static
de
.
_82grfl1bif
.
KPI_Visualizer
.
data
.
Klasse
.
zeitSeitLetzterBearbeitungMin
;
@SuppressWarnings
(
"ALL"
)
public
class
Builder
{
public
class
Builder
{
Server
server
;
Server
server
;
...
@@ -94,7 +94,7 @@ public class Builder {
...
@@ -94,7 +94,7 @@ public class Builder {
setWalls
(
startLocation
,
x
,
y
,
z
,
innerMaterial
,
glassMaterial
);
setWalls
(
startLocation
,
x
,
y
,
z
,
innerMaterial
,
glassMaterial
);
setCorners
(
startLocation
,
x
,
y
,
z
,
facadeMaterial
);
setCorners
(
startLocation
,
x
,
y
,
z
,
facadeMaterial
);
setFoundation
(
startLocation
.
clone
().
add
(
0
,
y
,
0
),
x
,
z
,
facadeMaterial
);
//roof
setFoundation
(
startLocation
.
clone
().
add
(
0
,
y
,
0
),
x
,
z
,
facadeMaterial
);
//roof
fillQube
(
startLocation
.
clone
().
add
(
Math
.
round
(
x
/
2
),
y
+
1
,
Math
.
round
(
x
/
2
)),
1
,
antennaHeight
,
1
,
Material
.
COBBLESTONE_WALL
);
fillQube
(
startLocation
.
clone
().
add
(
Math
.
round
(
x
/
2
f
),
y
+
1
,
Math
.
round
(
x
/
2
f
)),
1
,
antennaHeight
,
1
,
Material
.
COBBLESTONE_WALL
);
Random
rm
=
new
Random
();
Random
rm
=
new
Random
();
switch
(
rm
.
nextInt
(
3
)+
1
){
switch
(
rm
.
nextInt
(
3
)+
1
){
case
1
:
setCrane
(
startLocation
,
x
,
y
,
z
,
craneHeight
,
BlockFace
.
NORTH
);
case
1
:
setCrane
(
startLocation
,
x
,
y
,
z
,
craneHeight
,
BlockFace
.
NORTH
);
...
@@ -150,13 +150,13 @@ public class Builder {
...
@@ -150,13 +150,13 @@ public class Builder {
}
else
{
}
else
{
facadeInnerMaterial
=
Material
.
IRON_BARS
;
facadeInnerMaterial
=
Material
.
IRON_BARS
;
}
}
System
.
out
.
println
(
letzterBearbeitung
);
//
System.out.println(letzterBearbeitung);
System
.
out
.
println
(
scaleLetzterBearbeitung
);
//
System.out.println(scaleLetzterBearbeitung);
this
.
buildBuilding
(
s
.
getLocation
().
clone
().
add
(
1
,
s
.
getDepth
()
+
1
,
1
),
this
.
buildBuilding
(
s
.
getLocation
().
clone
().
add
(
1
,
s
.
getDepth
()
+
1
,
1
),
s
.
getWidth
().
x
-
2
,
s
.
getWidth
().
x
-
2
,
((
Building
)
s
).
getHeight
()+
1
,
((
Building
)
s
).
getHeight
()+
1
,
((
Building
)
s
).
klasse
.
commits
,
((
Building
)
s
).
klasse
.
commits
,
Math
.
round
(((
Building
)
s
).
klasse
.
complexity
/
100
),
Math
.
round
(((
Building
)
s
).
klasse
.
complexity
/
100
f
),
s
.
getWidth
().
x
-
2
,
s
.
getWidth
().
x
-
2
,
facadeMaterial
,
facadeMaterial
,
facadeInnerMaterial
,
facadeInnerMaterial
,
...
@@ -281,13 +281,13 @@ public class Builder {
...
@@ -281,13 +281,13 @@ public class Builder {
default
:
default
:
Bukkit
.
getLogger
().
log
(
Level
.
SEVERE
,
"falsche Orientierung übergeben!"
);
Bukkit
.
getLogger
().
log
(
Level
.
SEVERE
,
"falsche Orientierung übergeben!"
);
}
}
sign1
.
setData
(
matSign
);
Objects
.
requireNonNull
(
sign1
)
.
setData
(
matSign
);
sign2
.
setData
(
matSign
);
Objects
.
requireNonNull
(
sign2
o
)
.
setData
(
matSign
);
sign1
.
setGlowingText
(
true
);
sign1
.
setGlowingText
(
true
);
sign2
.
setGlowingText
(
true
);
sign2
.
setGlowingText
(
true
);
if
(
building
.
name
.
length
()
>
60
)
{
if
(
building
.
name
.
length
()
>
60
)
{
sign1o
.
setData
(
matSign
);
Objects
.
requireNonNull
(
sign1o
)
.
setData
(
matSign
);
sign2o
.
setData
(
matSign
);
Objects
.
requireNonNull
(
sign2o
)
.
setData
(
matSign
);
sign1o
.
setGlowingText
(
true
);
sign1o
.
setGlowingText
(
true
);
sign2o
.
setGlowingText
(
true
);
sign2o
.
setGlowingText
(
true
);
setTextToSign
(
sign1
,
sign1o
,
building
.
name
);
setTextToSign
(
sign1
,
sign1o
,
building
.
name
);
...
@@ -351,7 +351,6 @@ public class Builder {
...
@@ -351,7 +351,6 @@ public class Builder {
}
}
public
void
setLegend
(
Location
startLocation
){
public
void
setLegend
(
Location
startLocation
){
org
.
bukkit
.
material
.
Sign
matSign
=
new
org
.
bukkit
.
material
.
Sign
(
Material
.
OAK_WALL_SIGN
);
server
.
getWorlds
().
get
(
0
).
getBlockAt
(
startLocation
.
clone
().
add
(
0
,
0
,-
6
)).
setType
(
Material
.
WAXED_COPPER_BLOCK
);
server
.
getWorlds
().
get
(
0
).
getBlockAt
(
startLocation
.
clone
().
add
(
0
,
0
,-
6
)).
setType
(
Material
.
WAXED_COPPER_BLOCK
);
server
.
getWorlds
().
get
(
0
).
getBlockAt
(
startLocation
.
clone
().
add
(
0
,
1
,-
6
)).
setType
(
Material
.
WAXED_EXPOSED_COPPER
);
server
.
getWorlds
().
get
(
0
).
getBlockAt
(
startLocation
.
clone
().
add
(
0
,
1
,-
6
)).
setType
(
Material
.
WAXED_EXPOSED_COPPER
);
server
.
getWorlds
().
get
(
0
).
getBlockAt
(
startLocation
.
clone
().
add
(
0
,
2
,-
6
)).
setType
(
Material
.
WAXED_WEATHERED_COPPER
);
server
.
getWorlds
().
get
(
0
).
getBlockAt
(
startLocation
.
clone
().
add
(
0
,
2
,-
6
)).
setType
(
Material
.
WAXED_WEATHERED_COPPER
);
...
@@ -378,7 +377,7 @@ public class Builder {
...
@@ -378,7 +377,7 @@ public class Builder {
private
void
setLegendBlock
(
Location
startLocation
,
String
s1
,
String
s2
,
String
s3
){
private
void
setLegendBlock
(
Location
startLocation
,
String
s1
,
String
s2
,
String
s3
){
org
.
bukkit
.
material
.
Sign
matSign
=
new
org
.
bukkit
.
material
.
Sign
(
Material
.
OAK_WALL_SIGN
);
org
.
bukkit
.
material
.
Sign
matSign
=
new
org
.
bukkit
.
material
.
Sign
(
Material
.
OAK_WALL_SIGN
);
org
.
bukkit
.
block
.
Sign
sign
=
null
;
org
.
bukkit
.
block
.
Sign
sign
;
server
.
getWorlds
().
get
(
0
).
getBlockAt
(
startLocation
).
setType
(
Material
.
OAK_WALL_SIGN
);
server
.
getWorlds
().
get
(
0
).
getBlockAt
(
startLocation
).
setType
(
Material
.
OAK_WALL_SIGN
);
sign
=
(
org
.
bukkit
.
block
.
Sign
)
server
.
getWorlds
().
get
(
0
).
getBlockAt
(
startLocation
).
getState
();
sign
=
(
org
.
bukkit
.
block
.
Sign
)
server
.
getWorlds
().
get
(
0
).
getBlockAt
(
startLocation
).
getState
();
sign
.
setGlowingText
(
true
);
sign
.
setGlowingText
(
true
);
...
...
src/main/java/de/_82grfl1bif/
KPI_
Visualizer/structures/Building.java
→
src/main/java/de/_82grfl1bif/
kpi
Visualizer/structures/Building.java
View file @
b7e294e8
package
de._82grfl1bif.
KPI_
Visualizer.structures
;
package
de._82grfl1bif.
kpi
Visualizer.structures
;
import
de._82grfl1bif.
KPI_
Visualizer.data.Klasse
;
import
de._82grfl1bif.
kpi
Visualizer.data.Klasse
;
import
org.bukkit.Material
;
import
org.bukkit.Material
;
import
java.awt.Point
;
import
java.awt.Point
;
...
@@ -20,19 +20,10 @@ public class Building extends Structure{
...
@@ -20,19 +20,10 @@ public class Building extends Structure{
}
}
}
}
public
Building
(
Point
width
/*and depth for complex algorithms*/
,
int
height
,
Material
material
){
this
.
width
=
width
;
this
.
height
=
height
;
this
.
material
=
material
;
if
(
this
.
width
.
x
<
5
||
this
.
width
.
y
<
5
){
throw
new
IllegalArgumentException
(
"keine Gebäude kleiner 5 wegen 2 Gehweg"
);
}
}
public
Building
(
Material
material
,
Klasse
klasse
,
String
name
){
//Buildings are Square -> no depth
public
Building
(
Material
material
,
Klasse
klasse
,
String
name
){
//Buildings are Square -> no depth
this
.
klasse
=
klasse
;
this
.
klasse
=
klasse
;
this
.
material
=
material
;
this
.
material
=
material
;
this
.
width
=
new
Point
(
(
int
)
Math
.
round
((
klasse
.
variables
+
5
)),
(
int
)
Math
.
round
((
klasse
.
variables
+
5
)));
//TODO: make this work with treemap and square
this
.
width
=
new
Point
(
Math
.
round
((
klasse
.
variables
+
5
)),
Math
.
round
((
klasse
.
variables
+
5
)));
//TODO: make this work with treemap and square
this
.
area
=
klasse
.
variables
*
25
;
this
.
area
=
klasse
.
variables
*
25
;
this
.
name
=
name
;
this
.
name
=
name
;
this
.
height
=
klasse
.
functions
;
this
.
height
=
klasse
.
functions
;
...
...
src/main/java/de/_82grfl1bif/
KPI_
Visualizer/structures/Foundation.java
→
src/main/java/de/_82grfl1bif/
kpi
Visualizer/structures/Foundation.java
View file @
b7e294e8
package
de._82grfl1bif.
KPI_
Visualizer.structures
;
package
de._82grfl1bif.
kpi
Visualizer.structures
;
import
de._82grfl1bif.
KPI_
Visualizer.data.Klasse
;
import
de._82grfl1bif.
kpi
Visualizer.data.Klasse
;
import
de._82grfl1bif.
KPI_
Visualizer.layouts.
S
impleSquare.SimpleSquareLayout
;
import
de._82grfl1bif.
kpi
Visualizer.layouts.
s
impleSquare.SimpleSquareLayout
;
import
org.bukkit.Location
;
import
org.bukkit.Location
;
import
org.bukkit.Material
;
import
org.bukkit.Material
;
import
org.bukkit.util.Vector
;
import
org.bukkit.util.Vector
;
import
javax.management.AttributeNotFoundException
;
import
javax.management.AttributeNotFoundException
;
import
java.awt.
*
;
import
java.awt.
Point
;
import
java.util.ArrayList
;
import
java.util.ArrayList
;
import
java.util.Collections
;
import
java.util.Collections
;
import
java.util.Comparator
;
import
java.util.Comparator
;
...
@@ -214,7 +214,7 @@ public class Foundation extends Structure {
...
@@ -214,7 +214,7 @@ public class Foundation extends Structure {
private
boolean
baseFoundation
=
true
;
private
boolean
baseFoundation
=
true
;
public
void
organizeFoundation
()
{
public
void
organizeFoundation
()
{
if
(
this
.
depth
==
0
&&
baseFoundation
)
{
//rootElement prepwork and recursion call
if
(
this
.
depth
==
0
&&
baseFoundation
)
{
//rootElement prep
-
work and recursion call
ArrayList
<
Foundation
>
allFoundations
=
collectAllFoundations
();
ArrayList
<
Foundation
>
allFoundations
=
collectAllFoundations
();
baseFoundation
=
false
;
baseFoundation
=
false
;
allFoundations
.
sort
(
new
DepthComparator
());
allFoundations
.
sort
(
new
DepthComparator
());
...
@@ -249,6 +249,7 @@ public class Foundation extends Structure {
...
@@ -249,6 +249,7 @@ public class Foundation extends Structure {
return
fCollection
;
return
fCollection
;
}
}
@Deprecated
public
ArrayList
<
Building
>
collectAllBuildings
()
{
//called on the base Foundation
public
ArrayList
<
Building
>
collectAllBuildings
()
{
//called on the base Foundation
ArrayList
<
Building
>
buildings
=
new
ArrayList
<>();
ArrayList
<
Building
>
buildings
=
new
ArrayList
<>();
for
(
Structure
s:
children
)
{
for
(
Structure
s:
children
)
{
...
...
src/main/java/de/_82grfl1bif/
KPI_
Visualizer/structures/Structure.java
→
src/main/java/de/_82grfl1bif/
kpi
Visualizer/structures/Structure.java
View file @
b7e294e8
package
de._82grfl1bif.
KPI_
Visualizer.structures
;
package
de._82grfl1bif.
kpi
Visualizer.structures
;
import
org.bukkit.Location
;
import
org.bukkit.Location
;
import
org.bukkit.Material
;
import
org.bukkit.Material
;
import
org.bukkit.util.Vector
;
import
org.bukkit.util.Vector
;
import
javax.persistence.Column
;
import
java.awt.Point
;
import
javax.persistence.Entity
;
import
java.awt.*
;
public
abstract
class
Structure
{
public
abstract
class
Structure
{
...
@@ -33,6 +31,7 @@ public abstract class Structure{
...
@@ -33,6 +31,7 @@ public abstract class Structure{
this
.
location
=
location
;
this
.
location
=
location
;
}
}
@Deprecated
public
void
addVector
(
Vector
vector
){
public
void
addVector
(
Vector
vector
){
this
.
location
.
add
(
vector
);
this
.
location
.
add
(
vector
);
}
}
...
...
src/main/resources/plugin.yml
View file @
b7e294e8
name
:
main
name
:
main
version
:
'
${project.version}'
version
:
'
${project.version}'
main
:
de._82grfl1bif.
KPI_
Visualizer.main
main
:
de._82grfl1bif.
kpi
Visualizer.main
api-version
:
1.17
api-version
:
1.17
authors
:
[
FlorianGrabowski
]
authors
:
[
FlorianGrabowski
]
description
:
Testing automated construcion of Buildings.
description
:
Testing automated construcion of Buildings.
...
...
Prev
1
2
Next
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment