Skip to content
GitLab
Menu
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
bad6607d
Commit
bad6607d
authored
Nov 05, 2021
by
Florian Grabowski
Browse files
IDP Update
parent
92fedcf1
Changes
72
Hide whitespace changes
Inline
Side-by-side
src/main/java/de/_82grfl1bif/KPI_Visualizer/helpers/Shape.java
0 → 100644
View file @
bad6607d
package
de._82grfl1bif.KPI_Visualizer.helpers
;
import
java.awt.Point
;
public
class
Shape
{
protected
Point
bottomLeftCorner
;
protected
Point
topRightCorner
;
protected
int
xEdgeLength
;
protected
Shape
(){}
}
src/main/java/de/_82grfl1bif/KPI_Visualizer/main.java
0 → 100644
View file @
bad6607d
package
de._82grfl1bif.KPI_Visualizer
;
import
de._82grfl1bif.KPI_Visualizer.commands.SetPreset
;
import
de._82grfl1bif.KPI_Visualizer.commands.generateLayout
;
import
org.bukkit.plugin.java.JavaPlugin
;
public
final
class
main
extends
JavaPlugin
{
@Override
public
void
onEnable
()
{
// Plugin startup logic
getCommand
(
"setPreset"
).
setExecutor
(
new
SetPreset
());
getCommand
(
"generateLayout"
).
setExecutor
(
new
generateLayout
());
}
@Override
public
void
onDisable
()
{
// Plugin shutdown logic
}
}
src/main/java/de/_82grfl1bif/KPI_Visualizer/structures/Building.java
0 → 100644
View file @
bad6607d
package
de._82grfl1bif.KPI_Visualizer.structures
;
import
org.bukkit.Material
;
import
javax.persistence.Column
;
public
class
Building
extends
Structure
{
@Column
(
name
=
"height"
)
private
final
int
height
;
public
Building
(
int
width
,
int
height
,
Material
material
){
//Buildings are Square -> no depth
this
.
width
=
width
;
this
.
height
=
height
;
this
.
material
=
material
;
if
(
this
.
width
<
3
){
throw
new
IllegalArgumentException
(
"keine Gebäude kleiner 3 wegen 2 gehweg"
);
}
}
public
int
getHeight
()
{
return
this
.
height
;
}
}
src/main/java/de/_82grfl1bif/KPI_Visualizer/structures/Foundation.java
0 → 100644
View file @
bad6607d
package
de._82grfl1bif.KPI_Visualizer.structures
;
import
de._82grfl1bif.KPI_Visualizer.helpers.Layout
;
import
org.bukkit.Location
;
import
org.bukkit.Material
;
import
org.bukkit.util.Vector
;
import
javax.management.AttributeNotFoundException
;
import
java.awt.Point
;
import
java.util.ArrayList
;
import
java.util.Collections
;
import
java.util.Comparator
;
public
class
Foundation
extends
Structure
{
private
ArrayList
<
Structure
>
children
=
new
ArrayList
<>();
private
Layout
layout
;
public
Foundation
(
int
depth
,
Material
material
){
//Foundations are uniform Height
this
.
width
=
0
;
this
.
depth
=
depth
;
this
.
material
=
material
;
}
public
ArrayList
<
Structure
>
getChildren
()
{
return
children
;
}
public
void
addChildren
(
ArrayList
<
Structure
>
children
)
{
for
(
Structure
s:
children
)
{
s
.
setDepth
(
this
.
depth
);
}
this
.
children
.
addAll
(
children
);
}
public
void
removeChildren
(){
this
.
children
=
new
ArrayList
<>();
}
public
void
optimizeLayout
(){
//TODO: find cool Algorithms to do this scientifically and optimal.
int
cWith
=
0
;
for
(
Structure
s
:
children
)
{
s
.
setLocation
(
location
.
clone
().
add
(
new
Vector
(
1
,
depth
,((
cWith
)+
1
))));
cWith
+=
(
s
.
getWidth
()
+
2
);
}
this
.
width
=
cWith
;
}
private
static
class
DepthComparator
implements
Comparator
<
Foundation
>{
@Override
public
int
compare
(
Foundation
o1
,
Foundation
o2
)
{
return
Integer
.
compare
(
o1
.
getDepth
(),
o2
.
getDepth
());
}
}
private
static
class
WidthComparator
implements
Comparator
<
Structure
>{
@Override
public
int
compare
(
Structure
o1
,
Structure
o2
)
{
return
Integer
.
compare
(
o1
.
getWidth
(),
o2
.
getWidth
());
}
}
private
boolean
baseFoundation
=
true
;
public
void
organizeFoundation
(){
if
(
this
.
depth
==
0
&&
baseFoundation
){
//rootElement prepwork and recursion call
ArrayList
<
Foundation
>
allFoundations
=
collectAllFoundations
();
baseFoundation
=
false
;
allFoundations
.
sort
(
new
DepthComparator
());
Collections
.
reverse
(
allFoundations
);
//higher Depths first
for
(
Foundation
f:
allFoundations
)
{
//if(!this.equals(f))
f
.
organizeFoundation
();
}
}
else
{
//normal Call and recursion
this
.
children
.
sort
(
new
WidthComparator
());
Collections
.
reverse
(
this
.
children
);
//Widest Building or Foundation first
this
.
layout
=
new
Layout
(
this
.
children
);
this
.
layout
.
createLayout
();
this
.
width
=
layout
.
getSize
();
}
}
private
ArrayList
<
Foundation
>
collectAllFoundations
(){
//called on the base Foundation
ArrayList
<
Foundation
>
fCollection
=
new
ArrayList
<>();
fCollection
.
add
(
this
);
int
currentDepth
=
this
.
depth
;
int
lastDepthAdded
=
-
1
;
while
(
lastDepthAdded
!=
0
){
//while there are new nextDepths in this Depth.
for
(
int
i
=
0
;
i
<
fCollection
.
size
();
i
++)
{
if
(!(
fCollection
.
get
(
i
).
getDepth
()
<
currentDepth
)){
//if f is not part of a historical depth
fCollection
.
addAll
(
fCollection
.
get
(
i
).
getNextDepth
());
lastDepthAdded
=
fCollection
.
get
(
i
).
getNextDepth
().
size
();
}
}
currentDepth
+=
1
;
}
return
fCollection
;
}
private
ArrayList
<
Foundation
>
getNextDepth
(){
ArrayList
<
Foundation
>
result
=
new
ArrayList
<>();
for
(
Structure
s:
this
.
children
)
{
if
(
s
.
getClass
()
==
Foundation
.
class
){
result
.
add
((
Foundation
)
s
);
}
else
{
s
.
setDepth
(
this
.
depth
);
}
}
for
(
Foundation
f:
result
)
{
f
.
setDepth
((
this
.
depth
)+
1
);
}
return
result
;
}
public
void
correctAllLocations
(
Location
location
){
for
(
Structure
s:
this
.
children
)
{
try
{
Point
temp
=
this
.
layout
.
getCoordinateOf
(
s
);
s
.
setLocation
(
location
.
clone
().
add
(
temp
.
x
,
0
,
temp
.
y
));
if
(
s
.
getClass
()
==
Foundation
.
class
){
Foundation
f
=
(
Foundation
)
s
;
f
.
correctAllLocations
(
f
.
getLocation
());
}
}
catch
(
AttributeNotFoundException
e
)
{
e
.
printStackTrace
();
}
}
}
}
src/main/java/de/_82grfl1bif/KPI_Visualizer/structures/Structure.java
0 → 100644
View file @
bad6607d
package
de._82grfl1bif.KPI_Visualizer.structures
;
import
org.bukkit.Location
;
import
org.bukkit.Material
;
import
org.bukkit.util.Vector
;
import
javax.persistence.Column
;
import
javax.persistence.Entity
;
@Entity
public
class
Structure
{
@Column
(
name
=
"width"
)
protected
int
width
;
@Column
(
name
=
"material"
)
protected
Material
material
;
protected
Location
location
;
protected
int
depth
;
public
Material
getMaterial
()
{
return
material
;
}
public
Location
getLocation
()
{
return
location
;
}
public
void
setLocation
(
Location
location
)
{
this
.
location
=
location
;
}
public
void
addVector
(
Vector
vector
){
this
.
location
.
add
(
vector
);
}
public
int
getWidth
()
{
return
width
;
}
public
void
setDepth
(
int
depth
)
{
this
.
depth
=
depth
;
}
public
int
getDepth
()
{
return
depth
;
}
}
src/main/resources/plugin.yml
0 → 100644
View file @
bad6607d
name
:
main
version
:
'
${project.version}'
main
:
de._82grfl1bif.KPI_Visualizer.main
api-version
:
1.17
authors
:
[
FlorianGrabowski
]
description
:
Testing automated construcion of Buildings.
commands
:
setPreset
:
description
:
setzt einen ein Json Preset.
generateLayout
:
description
:
generates Json
\ No newline at end of file
target/classes/plugin.yml
0 → 100644
View file @
bad6607d
name
:
main
version
:
'
1.0-SNAPSHOT'
main
:
de._82grfl1bif.KPI_Visualizer.main
api-version
:
1.17
authors
:
[
FlorianGrabowski
]
description
:
Testing automated construcion of Buildings.
commands
:
setPreset
:
description
:
setzt einen ein Json Preset.
generateLayout
:
description
:
generates Json
\ No newline at end of file
target/maven-archiver/pom.properties
0 → 100644
View file @
bad6607d
#Generated by Maven
#Thu Oct 07 13:56:29 CEST 2021
groupId
=
de.82grfl1bif
artifactId
=
BlockPlacer
version
=
1.0-SNAPSHOT
target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst
0 → 100644
View file @
bad6607d
de/_82grfl1bif/blockplacer/commands/SetPreset.class
de/_82grfl1bif/blockplacer/structures/Foundation.class
de/_82grfl1bif/blockplacer/commands/generateLayout.class
de/_82grfl1bif/blockplacer/structures/Structure.class
de/_82grfl1bif/blockplacer/helpers/DataHolder.class
de/_82grfl1bif/blockplacer/BlockPlacer.class
de/_82grfl1bif/blockplacer/structures/Building.class
de/_82grfl1bif/blockplacer/commands/TestTread.class
target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst
0 → 100644
View file @
bad6607d
/Users/flgr/IdeaProjects/BlockPlacerTest/src/main/java/de/_82grfl1bif/blockplacer/structures/Foundation.java
/Users/flgr/IdeaProjects/BlockPlacerTest/src/main/java/de/_82grfl1bif/blockplacer/structures/Structure.java
/Users/flgr/IdeaProjects/BlockPlacerTest/src/main/java/de/_82grfl1bif/blockplacer/commands/TestTread.java
/Users/flgr/IdeaProjects/BlockPlacerTest/src/main/java/de/_82grfl1bif/blockplacer/commands/generateLayout.java
/Users/flgr/IdeaProjects/BlockPlacerTest/src/main/java/de/_82grfl1bif/blockplacer/helpers/DataHolder.java
/Users/flgr/IdeaProjects/BlockPlacerTest/src/main/java/de/_82grfl1bif/blockplacer/structures/Building.java
/Users/flgr/IdeaProjects/BlockPlacerTest/src/main/java/de/_82grfl1bif/blockplacer/BlockPlacer.java
/Users/flgr/IdeaProjects/BlockPlacerTest/src/main/java/de/_82grfl1bif/blockplacer/commands/SetPreset.java
target/maven-status/maven-compiler-plugin/testCompile/default-testCompile/createdFiles.lst
0 → 100644
View file @
bad6607d
target/maven-status/maven-compiler-plugin/testCompile/default-testCompile/inputFiles.lst
0 → 100644
View file @
bad6607d
Prev
1
2
3
4
Next
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a 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