init refactoring exercise
This commit is contained in:
parent
51f58d19bc
commit
e31f2e3544
8
dev_ops/.idea/.gitignore
vendored
Normal file
8
dev_ops/.idea/.gitignore
vendored
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
# Default ignored files
|
||||||
|
/shelf/
|
||||||
|
/workspace.xml
|
||||||
|
# Editor-based HTTP Client requests
|
||||||
|
/httpRequests/
|
||||||
|
# Datasource local storage ignored files
|
||||||
|
/dataSources/
|
||||||
|
/dataSources.local.xml
|
9
dev_ops/.idea/continious_integration.iml
Normal file
9
dev_ops/.idea/continious_integration.iml
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<module type="JAVA_MODULE" version="4">
|
||||||
|
<component name="NewModuleRootManager" inherit-compiler-output="true">
|
||||||
|
<exclude-output />
|
||||||
|
<content url="file://$MODULE_DIR$" />
|
||||||
|
<orderEntry type="inheritedJdk" />
|
||||||
|
<orderEntry type="sourceFolder" forTests="false" />
|
||||||
|
</component>
|
||||||
|
</module>
|
6
dev_ops/.idea/misc.xml
Normal file
6
dev_ops/.idea/misc.xml
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="ProjectRootManager" version="2" languageLevel="JDK_23" default="true" project-jdk-name="openjdk-23" project-jdk-type="JavaSDK">
|
||||||
|
<output url="file://$PROJECT_DIR$/out" />
|
||||||
|
</component>
|
||||||
|
</project>
|
8
dev_ops/.idea/modules.xml
Normal file
8
dev_ops/.idea/modules.xml
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="ProjectModuleManager">
|
||||||
|
<modules>
|
||||||
|
<module fileurl="file://$PROJECT_DIR$/.idea/continious_integration.iml" filepath="$PROJECT_DIR$/.idea/continious_integration.iml" />
|
||||||
|
</modules>
|
||||||
|
</component>
|
||||||
|
</project>
|
8
dev_ops/.idea/vcs.xml
Normal file
8
dev_ops/.idea/vcs.xml
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="VcsDirectoryMappings">
|
||||||
|
<mapping directory="$PROJECT_DIR$/.." vcs="Git" />
|
||||||
|
<mapping directory="$PROJECT_DIR$/fst-chat-app" vcs="Git" />
|
||||||
|
<mapping directory="$PROJECT_DIR$/fst-demo-app" vcs="Git" />
|
||||||
|
</component>
|
||||||
|
</project>
|
8
dev_ops/gradle/.idea/.gitignore
vendored
Normal file
8
dev_ops/gradle/.idea/.gitignore
vendored
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
# Default ignored files
|
||||||
|
/shelf/
|
||||||
|
/workspace.xml
|
||||||
|
# Editor-based HTTP Client requests
|
||||||
|
/httpRequests/
|
||||||
|
# Datasource local storage ignored files
|
||||||
|
/dataSources/
|
||||||
|
/dataSources.local.xml
|
9
dev_ops/gradle/.idea/gradle.iml
Normal file
9
dev_ops/gradle/.idea/gradle.iml
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<module type="JAVA_MODULE" version="4">
|
||||||
|
<component name="NewModuleRootManager" inherit-compiler-output="true">
|
||||||
|
<exclude-output />
|
||||||
|
<content url="file://$MODULE_DIR$" />
|
||||||
|
<orderEntry type="inheritedJdk" />
|
||||||
|
<orderEntry type="sourceFolder" forTests="false" />
|
||||||
|
</component>
|
||||||
|
</module>
|
6
dev_ops/gradle/.idea/misc.xml
Normal file
6
dev_ops/gradle/.idea/misc.xml
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="ProjectRootManager" version="2" languageLevel="JDK_22" default="true" project-jdk-name="corretto-22" project-jdk-type="JavaSDK">
|
||||||
|
<output url="file://$PROJECT_DIR$/out" />
|
||||||
|
</component>
|
||||||
|
</project>
|
8
dev_ops/gradle/.idea/modules.xml
Normal file
8
dev_ops/gradle/.idea/modules.xml
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="ProjectModuleManager">
|
||||||
|
<modules>
|
||||||
|
<module fileurl="file://$PROJECT_DIR$/.idea/gradle.iml" filepath="$PROJECT_DIR$/.idea/gradle.iml" />
|
||||||
|
</modules>
|
||||||
|
</component>
|
||||||
|
</project>
|
6
dev_ops/gradle/.idea/vcs.xml
Normal file
6
dev_ops/gradle/.idea/vcs.xml
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="VcsDirectoryMappings">
|
||||||
|
<mapping directory="$PROJECT_DIR$/.." vcs="Git" />
|
||||||
|
</component>
|
||||||
|
</project>
|
BIN
dev_ops/gradle/uebung-01/.gradle/8.10.2/checksums/checksums.lock
Normal file
BIN
dev_ops/gradle/uebung-01/.gradle/8.10.2/checksums/checksums.lock
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -0,0 +1,2 @@
|
|||||||
|
#Tue Nov 05 16:02:41 CET 2024
|
||||||
|
gradle.version=8.10.2
|
27
dev_ops/gradle/uebung-01/build.gradle
Normal file
27
dev_ops/gradle/uebung-01/build.gradle
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
// Define an extra property for the correct code
|
||||||
|
ext.correctCode = "1234"
|
||||||
|
|
||||||
|
// Task to save the code to a file
|
||||||
|
task save {
|
||||||
|
doLast {
|
||||||
|
def code = correctCode
|
||||||
|
file("code.txt").text = code
|
||||||
|
println "Code wurde gespeichert!"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Task to check the saved code, depends on the 'save' task
|
||||||
|
task check() {
|
||||||
|
doLast {
|
||||||
|
def code = file("code.txt").text.trim()
|
||||||
|
|
||||||
|
if (code == correctCode)
|
||||||
|
println "Ausgelesener Code ${code} ist korrekt."
|
||||||
|
else
|
||||||
|
throw new Exception("Fehler: Der Code ist inkorrekt.")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
task unlock(dependsOn: check) {
|
||||||
|
println "Das Schloss wurde geoeffnet."
|
||||||
|
}
|
1
dev_ops/gradle/uebung-01/code.txt
Normal file
1
dev_ops/gradle/uebung-01/code.txt
Normal file
@ -0,0 +1 @@
|
|||||||
|
1235
|
BIN
dev_ops/gradle/uebung-02/.gradle/8.10.2/checksums/checksums.lock
Normal file
BIN
dev_ops/gradle/uebung-02/.gradle/8.10.2/checksums/checksums.lock
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -0,0 +1,2 @@
|
|||||||
|
#Tue Nov 05 15:48:22 CET 2024
|
||||||
|
gradle.version=8.10.2
|
Binary file not shown.
BIN
dev_ops/gradle/uebung-02/.gradle/file-system.probe
Normal file
BIN
dev_ops/gradle/uebung-02/.gradle/file-system.probe
Normal file
Binary file not shown.
13
dev_ops/gradle/uebung-02/build.gradle
Normal file
13
dev_ops/gradle/uebung-02/build.gradle
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
plugins {
|
||||||
|
id "de.undercouch.download" version "4.1.1"
|
||||||
|
}
|
||||||
|
|
||||||
|
task download(type: Download) {
|
||||||
|
src 'http://st.uni-trier.de/Gradle/Rezept.zip'
|
||||||
|
dest buildDir
|
||||||
|
onlyIfModified true
|
||||||
|
}
|
||||||
|
|
||||||
|
task unzip(type: Copy, dependsOn: download) {
|
||||||
|
|
||||||
|
}
|
BIN
dev_ops/gradle/uebung-02/build/Rezept.zip
Normal file
BIN
dev_ops/gradle/uebung-02/build/Rezept.zip
Normal file
Binary file not shown.
38
refactoring/flappy-bird/.gitignore
vendored
Normal file
38
refactoring/flappy-bird/.gitignore
vendored
Normal file
@ -0,0 +1,38 @@
|
|||||||
|
target/
|
||||||
|
!.mvn/wrapper/maven-wrapper.jar
|
||||||
|
!**/src/main/**/target/
|
||||||
|
!**/src/test/**/target/
|
||||||
|
|
||||||
|
### IntelliJ IDEA ###
|
||||||
|
.idea/modules.xml
|
||||||
|
.idea/jarRepositories.xml
|
||||||
|
.idea/compiler.xml
|
||||||
|
.idea/libraries/
|
||||||
|
*.iws
|
||||||
|
*.iml
|
||||||
|
*.ipr
|
||||||
|
|
||||||
|
### Eclipse ###
|
||||||
|
.apt_generated
|
||||||
|
.classpath
|
||||||
|
.factorypath
|
||||||
|
.project
|
||||||
|
.settings
|
||||||
|
.springBeans
|
||||||
|
.sts4-cache
|
||||||
|
|
||||||
|
### NetBeans ###
|
||||||
|
/nbproject/private/
|
||||||
|
/nbbuild/
|
||||||
|
/dist/
|
||||||
|
/nbdist/
|
||||||
|
/.nb-gradle/
|
||||||
|
build/
|
||||||
|
!**/src/main/**/build/
|
||||||
|
!**/src/test/**/build/
|
||||||
|
|
||||||
|
### VS Code ###
|
||||||
|
.vscode/
|
||||||
|
|
||||||
|
### Mac OS ###
|
||||||
|
.DS_Store
|
8
refactoring/flappy-bird/.idea/.gitignore
vendored
Normal file
8
refactoring/flappy-bird/.idea/.gitignore
vendored
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
# Default ignored files
|
||||||
|
/shelf/
|
||||||
|
/workspace.xml
|
||||||
|
# Editor-based HTTP Client requests
|
||||||
|
/httpRequests/
|
||||||
|
# Datasource local storage ignored files
|
||||||
|
/dataSources/
|
||||||
|
/dataSources.local.xml
|
7
refactoring/flappy-bird/.idea/encodings.xml
Normal file
7
refactoring/flappy-bird/.idea/encodings.xml
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="Encoding">
|
||||||
|
<file url="file://$PROJECT_DIR$/src/main/java" charset="UTF-8" />
|
||||||
|
<file url="file://$PROJECT_DIR$/src/main/resources" charset="UTF-8" />
|
||||||
|
</component>
|
||||||
|
</project>
|
14
refactoring/flappy-bird/.idea/misc.xml
Normal file
14
refactoring/flappy-bird/.idea/misc.xml
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="ExternalStorageConfigurationManager" enabled="true" />
|
||||||
|
<component name="MavenProjectsManager">
|
||||||
|
<option name="originalFiles">
|
||||||
|
<list>
|
||||||
|
<option value="$PROJECT_DIR$/pom.xml" />
|
||||||
|
</list>
|
||||||
|
</option>
|
||||||
|
</component>
|
||||||
|
<component name="ProjectRootManager" version="2" languageLevel="JDK_23" default="true" project-jdk-name="openjdk-23" project-jdk-type="JavaSDK">
|
||||||
|
<output url="file://$PROJECT_DIR$/out" />
|
||||||
|
</component>
|
||||||
|
</project>
|
6
refactoring/flappy-bird/.idea/vcs.xml
Normal file
6
refactoring/flappy-bird/.idea/vcs.xml
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="VcsDirectoryMappings">
|
||||||
|
<mapping directory="$PROJECT_DIR$/../.." vcs="Git" />
|
||||||
|
</component>
|
||||||
|
</project>
|
BIN
refactoring/flappy-bird/.mvn/wrapper/maven-wrapper.jar
vendored
Normal file
BIN
refactoring/flappy-bird/.mvn/wrapper/maven-wrapper.jar
vendored
Normal file
Binary file not shown.
2
refactoring/flappy-bird/.mvn/wrapper/maven-wrapper.properties
vendored
Normal file
2
refactoring/flappy-bird/.mvn/wrapper/maven-wrapper.properties
vendored
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.8.5/apache-maven-3.8.5-bin.zip
|
||||||
|
wrapperUrl=https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.1.0/maven-wrapper-3.1.0.jar
|
14
refactoring/flappy-bird/README.md
Normal file
14
refactoring/flappy-bird/README.md
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
Flappy-Bird
|
||||||
|
===========
|
||||||
|
|
||||||
|
A flappy bird clone written in Java, for the ICS4U Simple Game Assignment.
|
||||||
|
|
||||||
|
<img src="https://raw.githubusercontent.com/paulkr/Flappy-Bird/master/demo.png" width="500" />
|
||||||
|
|
||||||
|
Build & Run
|
||||||
|
-----------
|
||||||
|
|
||||||
|
```shell
|
||||||
|
$ cd lib
|
||||||
|
$ javac FlappyBird.java && java FlappyBird
|
||||||
|
```
|
BIN
refactoring/flappy-bird/demo.png
Normal file
BIN
refactoring/flappy-bird/demo.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 168 KiB |
316
refactoring/flappy-bird/mvnw
vendored
Normal file
316
refactoring/flappy-bird/mvnw
vendored
Normal file
@ -0,0 +1,316 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
# ----------------------------------------------------------------------------
|
||||||
|
# Licensed to the Apache Software Foundation (ASF) under one
|
||||||
|
# or more contributor license agreements. See the NOTICE file
|
||||||
|
# distributed with this work for additional information
|
||||||
|
# regarding copyright ownership. The ASF licenses this file
|
||||||
|
# to you under the Apache License, Version 2.0 (the
|
||||||
|
# "License"); you may not use this file except in compliance
|
||||||
|
# with the License. You may obtain a copy of the License at
|
||||||
|
#
|
||||||
|
# https://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
#
|
||||||
|
# Unless required by applicable law or agreed to in writing,
|
||||||
|
# software distributed under the License is distributed on an
|
||||||
|
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||||
|
# KIND, either express or implied. See the License for the
|
||||||
|
# specific language governing permissions and limitations
|
||||||
|
# under the License.
|
||||||
|
# ----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
# ----------------------------------------------------------------------------
|
||||||
|
# Maven Start Up Batch script
|
||||||
|
#
|
||||||
|
# Required ENV vars:
|
||||||
|
# ------------------
|
||||||
|
# JAVA_HOME - location of a JDK home dir
|
||||||
|
#
|
||||||
|
# Optional ENV vars
|
||||||
|
# -----------------
|
||||||
|
# M2_HOME - location of maven2's installed home dir
|
||||||
|
# MAVEN_OPTS - parameters passed to the Java VM when running Maven
|
||||||
|
# e.g. to debug Maven itself, use
|
||||||
|
# set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000
|
||||||
|
# MAVEN_SKIP_RC - flag to disable loading of mavenrc files
|
||||||
|
# ----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
if [ -z "$MAVEN_SKIP_RC" ] ; then
|
||||||
|
|
||||||
|
if [ -f /usr/local/etc/mavenrc ] ; then
|
||||||
|
. /usr/local/etc/mavenrc
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -f /etc/mavenrc ] ; then
|
||||||
|
. /etc/mavenrc
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -f "$HOME/.mavenrc" ] ; then
|
||||||
|
. "$HOME/.mavenrc"
|
||||||
|
fi
|
||||||
|
|
||||||
|
fi
|
||||||
|
|
||||||
|
# OS specific support. $var _must_ be set to either true or false.
|
||||||
|
cygwin=false;
|
||||||
|
darwin=false;
|
||||||
|
mingw=false
|
||||||
|
case "`uname`" in
|
||||||
|
CYGWIN*) cygwin=true ;;
|
||||||
|
MINGW*) mingw=true;;
|
||||||
|
Darwin*) darwin=true
|
||||||
|
# Use /usr/libexec/java_home if available, otherwise fall back to /Library/Java/Home
|
||||||
|
# See https://developer.apple.com/library/mac/qa/qa1170/_index.html
|
||||||
|
if [ -z "$JAVA_HOME" ]; then
|
||||||
|
if [ -x "/usr/libexec/java_home" ]; then
|
||||||
|
export JAVA_HOME="`/usr/libexec/java_home`"
|
||||||
|
else
|
||||||
|
export JAVA_HOME="/Library/Java/Home"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
if [ -z "$JAVA_HOME" ] ; then
|
||||||
|
if [ -r /etc/gentoo-release ] ; then
|
||||||
|
JAVA_HOME=`java-config --jre-home`
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -z "$M2_HOME" ] ; then
|
||||||
|
## resolve links - $0 may be a link to maven's home
|
||||||
|
PRG="$0"
|
||||||
|
|
||||||
|
# need this for relative symlinks
|
||||||
|
while [ -h "$PRG" ] ; do
|
||||||
|
ls=`ls -ld "$PRG"`
|
||||||
|
link=`expr "$ls" : '.*-> \(.*\)$'`
|
||||||
|
if expr "$link" : '/.*' > /dev/null; then
|
||||||
|
PRG="$link"
|
||||||
|
else
|
||||||
|
PRG="`dirname "$PRG"`/$link"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
saveddir=`pwd`
|
||||||
|
|
||||||
|
M2_HOME=`dirname "$PRG"`/..
|
||||||
|
|
||||||
|
# make it fully qualified
|
||||||
|
M2_HOME=`cd "$M2_HOME" && pwd`
|
||||||
|
|
||||||
|
cd "$saveddir"
|
||||||
|
# echo Using m2 at $M2_HOME
|
||||||
|
fi
|
||||||
|
|
||||||
|
# For Cygwin, ensure paths are in UNIX format before anything is touched
|
||||||
|
if $cygwin ; then
|
||||||
|
[ -n "$M2_HOME" ] &&
|
||||||
|
M2_HOME=`cygpath --unix "$M2_HOME"`
|
||||||
|
[ -n "$JAVA_HOME" ] &&
|
||||||
|
JAVA_HOME=`cygpath --unix "$JAVA_HOME"`
|
||||||
|
[ -n "$CLASSPATH" ] &&
|
||||||
|
CLASSPATH=`cygpath --path --unix "$CLASSPATH"`
|
||||||
|
fi
|
||||||
|
|
||||||
|
# For Mingw, ensure paths are in UNIX format before anything is touched
|
||||||
|
if $mingw ; then
|
||||||
|
[ -n "$M2_HOME" ] &&
|
||||||
|
M2_HOME="`(cd "$M2_HOME"; pwd)`"
|
||||||
|
[ -n "$JAVA_HOME" ] &&
|
||||||
|
JAVA_HOME="`(cd "$JAVA_HOME"; pwd)`"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -z "$JAVA_HOME" ]; then
|
||||||
|
javaExecutable="`which javac`"
|
||||||
|
if [ -n "$javaExecutable" ] && ! [ "`expr \"$javaExecutable\" : '\([^ ]*\)'`" = "no" ]; then
|
||||||
|
# readlink(1) is not available as standard on Solaris 10.
|
||||||
|
readLink=`which readlink`
|
||||||
|
if [ ! `expr "$readLink" : '\([^ ]*\)'` = "no" ]; then
|
||||||
|
if $darwin ; then
|
||||||
|
javaHome="`dirname \"$javaExecutable\"`"
|
||||||
|
javaExecutable="`cd \"$javaHome\" && pwd -P`/javac"
|
||||||
|
else
|
||||||
|
javaExecutable="`readlink -f \"$javaExecutable\"`"
|
||||||
|
fi
|
||||||
|
javaHome="`dirname \"$javaExecutable\"`"
|
||||||
|
javaHome=`expr "$javaHome" : '\(.*\)/bin'`
|
||||||
|
JAVA_HOME="$javaHome"
|
||||||
|
export JAVA_HOME
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -z "$JAVACMD" ] ; then
|
||||||
|
if [ -n "$JAVA_HOME" ] ; then
|
||||||
|
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
|
||||||
|
# IBM's JDK on AIX uses strange locations for the executables
|
||||||
|
JAVACMD="$JAVA_HOME/jre/sh/java"
|
||||||
|
else
|
||||||
|
JAVACMD="$JAVA_HOME/bin/java"
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
JAVACMD="`\\unset -f command; \\command -v java`"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ ! -x "$JAVACMD" ] ; then
|
||||||
|
echo "Error: JAVA_HOME is not defined correctly." >&2
|
||||||
|
echo " We cannot execute $JAVACMD" >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -z "$JAVA_HOME" ] ; then
|
||||||
|
echo "Warning: JAVA_HOME environment variable is not set."
|
||||||
|
fi
|
||||||
|
|
||||||
|
CLASSWORLDS_LAUNCHER=org.codehaus.plexus.classworlds.launcher.Launcher
|
||||||
|
|
||||||
|
# traverses directory structure from process work directory to filesystem root
|
||||||
|
# first directory with .mvn subdirectory is considered project base directory
|
||||||
|
find_maven_basedir() {
|
||||||
|
|
||||||
|
if [ -z "$1" ]
|
||||||
|
then
|
||||||
|
echo "Path not specified to find_maven_basedir"
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
basedir="$1"
|
||||||
|
wdir="$1"
|
||||||
|
while [ "$wdir" != '/' ] ; do
|
||||||
|
if [ -d "$wdir"/.mvn ] ; then
|
||||||
|
basedir=$wdir
|
||||||
|
break
|
||||||
|
fi
|
||||||
|
# workaround for JBEAP-8937 (on Solaris 10/Sparc)
|
||||||
|
if [ -d "${wdir}" ]; then
|
||||||
|
wdir=`cd "$wdir/.."; pwd`
|
||||||
|
fi
|
||||||
|
# end of workaround
|
||||||
|
done
|
||||||
|
echo "${basedir}"
|
||||||
|
}
|
||||||
|
|
||||||
|
# concatenates all lines of a file
|
||||||
|
concat_lines() {
|
||||||
|
if [ -f "$1" ]; then
|
||||||
|
echo "$(tr -s '\n' ' ' < "$1")"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
BASE_DIR=`find_maven_basedir "$(pwd)"`
|
||||||
|
if [ -z "$BASE_DIR" ]; then
|
||||||
|
exit 1;
|
||||||
|
fi
|
||||||
|
|
||||||
|
##########################################################################################
|
||||||
|
# Extension to allow automatically downloading the maven-wrapper.jar from Maven-central
|
||||||
|
# This allows using the maven wrapper in projects that prohibit checking in binary data.
|
||||||
|
##########################################################################################
|
||||||
|
if [ -r "$BASE_DIR/.mvn/wrapper/maven-wrapper.jar" ]; then
|
||||||
|
if [ "$MVNW_VERBOSE" = true ]; then
|
||||||
|
echo "Found .mvn/wrapper/maven-wrapper.jar"
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
if [ "$MVNW_VERBOSE" = true ]; then
|
||||||
|
echo "Couldn't find .mvn/wrapper/maven-wrapper.jar, downloading it ..."
|
||||||
|
fi
|
||||||
|
if [ -n "$MVNW_REPOURL" ]; then
|
||||||
|
jarUrl="$MVNW_REPOURL/org/apache/maven/wrapper/maven-wrapper/3.1.0/maven-wrapper-3.1.0.jar"
|
||||||
|
else
|
||||||
|
jarUrl="https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.1.0/maven-wrapper-3.1.0.jar"
|
||||||
|
fi
|
||||||
|
while IFS="=" read key value; do
|
||||||
|
case "$key" in (wrapperUrl) jarUrl="$value"; break ;;
|
||||||
|
esac
|
||||||
|
done < "$BASE_DIR/.mvn/wrapper/maven-wrapper.properties"
|
||||||
|
if [ "$MVNW_VERBOSE" = true ]; then
|
||||||
|
echo "Downloading from: $jarUrl"
|
||||||
|
fi
|
||||||
|
wrapperJarPath="$BASE_DIR/.mvn/wrapper/maven-wrapper.jar"
|
||||||
|
if $cygwin; then
|
||||||
|
wrapperJarPath=`cygpath --path --windows "$wrapperJarPath"`
|
||||||
|
fi
|
||||||
|
|
||||||
|
if command -v wget > /dev/null; then
|
||||||
|
if [ "$MVNW_VERBOSE" = true ]; then
|
||||||
|
echo "Found wget ... using wget"
|
||||||
|
fi
|
||||||
|
if [ -z "$MVNW_USERNAME" ] || [ -z "$MVNW_PASSWORD" ]; then
|
||||||
|
wget "$jarUrl" -O "$wrapperJarPath" || rm -f "$wrapperJarPath"
|
||||||
|
else
|
||||||
|
wget --http-user=$MVNW_USERNAME --http-password=$MVNW_PASSWORD "$jarUrl" -O "$wrapperJarPath" || rm -f "$wrapperJarPath"
|
||||||
|
fi
|
||||||
|
elif command -v curl > /dev/null; then
|
||||||
|
if [ "$MVNW_VERBOSE" = true ]; then
|
||||||
|
echo "Found curl ... using curl"
|
||||||
|
fi
|
||||||
|
if [ -z "$MVNW_USERNAME" ] || [ -z "$MVNW_PASSWORD" ]; then
|
||||||
|
curl -o "$wrapperJarPath" "$jarUrl" -f
|
||||||
|
else
|
||||||
|
curl --user $MVNW_USERNAME:$MVNW_PASSWORD -o "$wrapperJarPath" "$jarUrl" -f
|
||||||
|
fi
|
||||||
|
|
||||||
|
else
|
||||||
|
if [ "$MVNW_VERBOSE" = true ]; then
|
||||||
|
echo "Falling back to using Java to download"
|
||||||
|
fi
|
||||||
|
javaClass="$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.java"
|
||||||
|
# For Cygwin, switch paths to Windows format before running javac
|
||||||
|
if $cygwin; then
|
||||||
|
javaClass=`cygpath --path --windows "$javaClass"`
|
||||||
|
fi
|
||||||
|
if [ -e "$javaClass" ]; then
|
||||||
|
if [ ! -e "$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.class" ]; then
|
||||||
|
if [ "$MVNW_VERBOSE" = true ]; then
|
||||||
|
echo " - Compiling MavenWrapperDownloader.java ..."
|
||||||
|
fi
|
||||||
|
# Compiling the Java class
|
||||||
|
("$JAVA_HOME/bin/javac" "$javaClass")
|
||||||
|
fi
|
||||||
|
if [ -e "$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.class" ]; then
|
||||||
|
# Running the downloader
|
||||||
|
if [ "$MVNW_VERBOSE" = true ]; then
|
||||||
|
echo " - Running MavenWrapperDownloader.java ..."
|
||||||
|
fi
|
||||||
|
("$JAVA_HOME/bin/java" -cp .mvn/wrapper MavenWrapperDownloader "$MAVEN_PROJECTBASEDIR")
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
##########################################################################################
|
||||||
|
# End of extension
|
||||||
|
##########################################################################################
|
||||||
|
|
||||||
|
export MAVEN_PROJECTBASEDIR=${MAVEN_BASEDIR:-"$BASE_DIR"}
|
||||||
|
if [ "$MVNW_VERBOSE" = true ]; then
|
||||||
|
echo $MAVEN_PROJECTBASEDIR
|
||||||
|
fi
|
||||||
|
MAVEN_OPTS="$(concat_lines "$MAVEN_PROJECTBASEDIR/.mvn/jvm.config") $MAVEN_OPTS"
|
||||||
|
|
||||||
|
# For Cygwin, switch paths to Windows format before running java
|
||||||
|
if $cygwin; then
|
||||||
|
[ -n "$M2_HOME" ] &&
|
||||||
|
M2_HOME=`cygpath --path --windows "$M2_HOME"`
|
||||||
|
[ -n "$JAVA_HOME" ] &&
|
||||||
|
JAVA_HOME=`cygpath --path --windows "$JAVA_HOME"`
|
||||||
|
[ -n "$CLASSPATH" ] &&
|
||||||
|
CLASSPATH=`cygpath --path --windows "$CLASSPATH"`
|
||||||
|
[ -n "$MAVEN_PROJECTBASEDIR" ] &&
|
||||||
|
MAVEN_PROJECTBASEDIR=`cygpath --path --windows "$MAVEN_PROJECTBASEDIR"`
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Provide a "standardized" way to retrieve the CLI args that will
|
||||||
|
# work with both Windows and non-Windows executions.
|
||||||
|
MAVEN_CMD_LINE_ARGS="$MAVEN_CONFIG $@"
|
||||||
|
export MAVEN_CMD_LINE_ARGS
|
||||||
|
|
||||||
|
WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain
|
||||||
|
|
||||||
|
exec "$JAVACMD" \
|
||||||
|
$MAVEN_OPTS \
|
||||||
|
$MAVEN_DEBUG_OPTS \
|
||||||
|
-classpath "$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.jar" \
|
||||||
|
"-Dmaven.home=${M2_HOME}" \
|
||||||
|
"-Dmaven.multiModuleProjectDirectory=${MAVEN_PROJECTBASEDIR}" \
|
||||||
|
${WRAPPER_LAUNCHER} $MAVEN_CONFIG "$@"
|
188
refactoring/flappy-bird/mvnw.cmd
vendored
Normal file
188
refactoring/flappy-bird/mvnw.cmd
vendored
Normal file
@ -0,0 +1,188 @@
|
|||||||
|
@REM ----------------------------------------------------------------------------
|
||||||
|
@REM Licensed to the Apache Software Foundation (ASF) under one
|
||||||
|
@REM or more contributor license agreements. See the NOTICE file
|
||||||
|
@REM distributed with this work for additional information
|
||||||
|
@REM regarding copyright ownership. The ASF licenses this file
|
||||||
|
@REM to you under the Apache License, Version 2.0 (the
|
||||||
|
@REM "License"); you may not use this file except in compliance
|
||||||
|
@REM with the License. You may obtain a copy of the License at
|
||||||
|
@REM
|
||||||
|
@REM https://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
@REM
|
||||||
|
@REM Unless required by applicable law or agreed to in writing,
|
||||||
|
@REM software distributed under the License is distributed on an
|
||||||
|
@REM "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||||
|
@REM KIND, either express or implied. See the License for the
|
||||||
|
@REM specific language governing permissions and limitations
|
||||||
|
@REM under the License.
|
||||||
|
@REM ----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
@REM ----------------------------------------------------------------------------
|
||||||
|
@REM Maven Start Up Batch script
|
||||||
|
@REM
|
||||||
|
@REM Required ENV vars:
|
||||||
|
@REM JAVA_HOME - location of a JDK home dir
|
||||||
|
@REM
|
||||||
|
@REM Optional ENV vars
|
||||||
|
@REM M2_HOME - location of maven2's installed home dir
|
||||||
|
@REM MAVEN_BATCH_ECHO - set to 'on' to enable the echoing of the batch commands
|
||||||
|
@REM MAVEN_BATCH_PAUSE - set to 'on' to wait for a keystroke before ending
|
||||||
|
@REM MAVEN_OPTS - parameters passed to the Java VM when running Maven
|
||||||
|
@REM e.g. to debug Maven itself, use
|
||||||
|
@REM set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000
|
||||||
|
@REM MAVEN_SKIP_RC - flag to disable loading of mavenrc files
|
||||||
|
@REM ----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
@REM Begin all REM lines with '@' in case MAVEN_BATCH_ECHO is 'on'
|
||||||
|
@echo off
|
||||||
|
@REM set title of command window
|
||||||
|
title %0
|
||||||
|
@REM enable echoing by setting MAVEN_BATCH_ECHO to 'on'
|
||||||
|
@if "%MAVEN_BATCH_ECHO%" == "on" echo %MAVEN_BATCH_ECHO%
|
||||||
|
|
||||||
|
@REM set %HOME% to equivalent of $HOME
|
||||||
|
if "%HOME%" == "" (set "HOME=%HOMEDRIVE%%HOMEPATH%")
|
||||||
|
|
||||||
|
@REM Execute a user defined script before this one
|
||||||
|
if not "%MAVEN_SKIP_RC%" == "" goto skipRcPre
|
||||||
|
@REM check for pre script, once with legacy .bat ending and once with .cmd ending
|
||||||
|
if exist "%USERPROFILE%\mavenrc_pre.bat" call "%USERPROFILE%\mavenrc_pre.bat" %*
|
||||||
|
if exist "%USERPROFILE%\mavenrc_pre.cmd" call "%USERPROFILE%\mavenrc_pre.cmd" %*
|
||||||
|
:skipRcPre
|
||||||
|
|
||||||
|
@setlocal
|
||||||
|
|
||||||
|
set ERROR_CODE=0
|
||||||
|
|
||||||
|
@REM To isolate internal variables from possible post scripts, we use another setlocal
|
||||||
|
@setlocal
|
||||||
|
|
||||||
|
@REM ==== START VALIDATION ====
|
||||||
|
if not "%JAVA_HOME%" == "" goto OkJHome
|
||||||
|
|
||||||
|
echo.
|
||||||
|
echo Error: JAVA_HOME not found in your environment. >&2
|
||||||
|
echo Please set the JAVA_HOME variable in your environment to match the >&2
|
||||||
|
echo location of your Java installation. >&2
|
||||||
|
echo.
|
||||||
|
goto error
|
||||||
|
|
||||||
|
:OkJHome
|
||||||
|
if exist "%JAVA_HOME%\bin\java.exe" goto init
|
||||||
|
|
||||||
|
echo.
|
||||||
|
echo Error: JAVA_HOME is set to an invalid directory. >&2
|
||||||
|
echo JAVA_HOME = "%JAVA_HOME%" >&2
|
||||||
|
echo Please set the JAVA_HOME variable in your environment to match the >&2
|
||||||
|
echo location of your Java installation. >&2
|
||||||
|
echo.
|
||||||
|
goto error
|
||||||
|
|
||||||
|
@REM ==== END VALIDATION ====
|
||||||
|
|
||||||
|
:init
|
||||||
|
|
||||||
|
@REM Find the project base dir, i.e. the directory that contains the folder ".mvn".
|
||||||
|
@REM Fallback to current working directory if not found.
|
||||||
|
|
||||||
|
set MAVEN_PROJECTBASEDIR=%MAVEN_BASEDIR%
|
||||||
|
IF NOT "%MAVEN_PROJECTBASEDIR%"=="" goto endDetectBaseDir
|
||||||
|
|
||||||
|
set EXEC_DIR=%CD%
|
||||||
|
set WDIR=%EXEC_DIR%
|
||||||
|
:findBaseDir
|
||||||
|
IF EXIST "%WDIR%"\.mvn goto baseDirFound
|
||||||
|
cd ..
|
||||||
|
IF "%WDIR%"=="%CD%" goto baseDirNotFound
|
||||||
|
set WDIR=%CD%
|
||||||
|
goto findBaseDir
|
||||||
|
|
||||||
|
:baseDirFound
|
||||||
|
set MAVEN_PROJECTBASEDIR=%WDIR%
|
||||||
|
cd "%EXEC_DIR%"
|
||||||
|
goto endDetectBaseDir
|
||||||
|
|
||||||
|
:baseDirNotFound
|
||||||
|
set MAVEN_PROJECTBASEDIR=%EXEC_DIR%
|
||||||
|
cd "%EXEC_DIR%"
|
||||||
|
|
||||||
|
:endDetectBaseDir
|
||||||
|
|
||||||
|
IF NOT EXIST "%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config" goto endReadAdditionalConfig
|
||||||
|
|
||||||
|
@setlocal EnableExtensions EnableDelayedExpansion
|
||||||
|
for /F "usebackq delims=" %%a in ("%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config") do set JVM_CONFIG_MAVEN_PROPS=!JVM_CONFIG_MAVEN_PROPS! %%a
|
||||||
|
@endlocal & set JVM_CONFIG_MAVEN_PROPS=%JVM_CONFIG_MAVEN_PROPS%
|
||||||
|
|
||||||
|
:endReadAdditionalConfig
|
||||||
|
|
||||||
|
SET MAVEN_JAVA_EXE="%JAVA_HOME%\bin\java.exe"
|
||||||
|
set WRAPPER_JAR="%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.jar"
|
||||||
|
set WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain
|
||||||
|
|
||||||
|
set DOWNLOAD_URL="https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.1.0/maven-wrapper-3.1.0.jar"
|
||||||
|
|
||||||
|
FOR /F "usebackq tokens=1,2 delims==" %%A IN ("%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.properties") DO (
|
||||||
|
IF "%%A"=="wrapperUrl" SET DOWNLOAD_URL=%%B
|
||||||
|
)
|
||||||
|
|
||||||
|
@REM Extension to allow automatically downloading the maven-wrapper.jar from Maven-central
|
||||||
|
@REM This allows using the maven wrapper in projects that prohibit checking in binary data.
|
||||||
|
if exist %WRAPPER_JAR% (
|
||||||
|
if "%MVNW_VERBOSE%" == "true" (
|
||||||
|
echo Found %WRAPPER_JAR%
|
||||||
|
)
|
||||||
|
) else (
|
||||||
|
if not "%MVNW_REPOURL%" == "" (
|
||||||
|
SET DOWNLOAD_URL="%MVNW_REPOURL%/org/apache/maven/wrapper/maven-wrapper/3.1.0/maven-wrapper-3.1.0.jar"
|
||||||
|
)
|
||||||
|
if "%MVNW_VERBOSE%" == "true" (
|
||||||
|
echo Couldn't find %WRAPPER_JAR%, downloading it ...
|
||||||
|
echo Downloading from: %DOWNLOAD_URL%
|
||||||
|
)
|
||||||
|
|
||||||
|
powershell -Command "&{"^
|
||||||
|
"$webclient = new-object System.Net.WebClient;"^
|
||||||
|
"if (-not ([string]::IsNullOrEmpty('%MVNW_USERNAME%') -and [string]::IsNullOrEmpty('%MVNW_PASSWORD%'))) {"^
|
||||||
|
"$webclient.Credentials = new-object System.Net.NetworkCredential('%MVNW_USERNAME%', '%MVNW_PASSWORD%');"^
|
||||||
|
"}"^
|
||||||
|
"[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; $webclient.DownloadFile('%DOWNLOAD_URL%', '%WRAPPER_JAR%')"^
|
||||||
|
"}"
|
||||||
|
if "%MVNW_VERBOSE%" == "true" (
|
||||||
|
echo Finished downloading %WRAPPER_JAR%
|
||||||
|
)
|
||||||
|
)
|
||||||
|
@REM End of extension
|
||||||
|
|
||||||
|
@REM Provide a "standardized" way to retrieve the CLI args that will
|
||||||
|
@REM work with both Windows and non-Windows executions.
|
||||||
|
set MAVEN_CMD_LINE_ARGS=%*
|
||||||
|
|
||||||
|
%MAVEN_JAVA_EXE% ^
|
||||||
|
%JVM_CONFIG_MAVEN_PROPS% ^
|
||||||
|
%MAVEN_OPTS% ^
|
||||||
|
%MAVEN_DEBUG_OPTS% ^
|
||||||
|
-classpath %WRAPPER_JAR% ^
|
||||||
|
"-Dmaven.multiModuleProjectDirectory=%MAVEN_PROJECTBASEDIR%" ^
|
||||||
|
%WRAPPER_LAUNCHER% %MAVEN_CONFIG% %*
|
||||||
|
if ERRORLEVEL 1 goto error
|
||||||
|
goto end
|
||||||
|
|
||||||
|
:error
|
||||||
|
set ERROR_CODE=1
|
||||||
|
|
||||||
|
:end
|
||||||
|
@endlocal & set ERROR_CODE=%ERROR_CODE%
|
||||||
|
|
||||||
|
if not "%MAVEN_SKIP_RC%"=="" goto skipRcPost
|
||||||
|
@REM check for post script, once with legacy .bat ending and once with .cmd ending
|
||||||
|
if exist "%USERPROFILE%\mavenrc_post.bat" call "%USERPROFILE%\mavenrc_post.bat"
|
||||||
|
if exist "%USERPROFILE%\mavenrc_post.cmd" call "%USERPROFILE%\mavenrc_post.cmd"
|
||||||
|
:skipRcPost
|
||||||
|
|
||||||
|
@REM pause the script if MAVEN_BATCH_PAUSE is set to 'on'
|
||||||
|
if "%MAVEN_BATCH_PAUSE%"=="on" pause
|
||||||
|
|
||||||
|
if "%MAVEN_TERMINATE_CMD%"=="on" exit %ERROR_CODE%
|
||||||
|
|
||||||
|
cmd /C exit /B %ERROR_CODE%
|
78
refactoring/flappy-bird/pom.xml
Normal file
78
refactoring/flappy-bird/pom.xml
Normal file
@ -0,0 +1,78 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||||
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
|
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||||
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
<groupId>com.example</groupId>
|
||||||
|
<artifactId>FlappyBirdRefactoring</artifactId>
|
||||||
|
<version>1.0-SNAPSHOT</version>
|
||||||
|
<name>FlappyBirdRefactoring</name>
|
||||||
|
|
||||||
|
<properties>
|
||||||
|
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||||
|
<junit.version>5.9.2</junit.version>
|
||||||
|
</properties>
|
||||||
|
|
||||||
|
<dependencies>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.openjfx</groupId>
|
||||||
|
<artifactId>javafx-controls</artifactId>
|
||||||
|
<version>21-ea+24</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.openjfx</groupId>
|
||||||
|
<artifactId>javafx-fxml</artifactId>
|
||||||
|
<version>21-ea+24</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.junit.jupiter</groupId>
|
||||||
|
<artifactId>junit-jupiter-api</artifactId>
|
||||||
|
<version>${junit.version}</version>
|
||||||
|
<scope>test</scope>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.junit.jupiter</groupId>
|
||||||
|
<artifactId>junit-jupiter-engine</artifactId>
|
||||||
|
<version>${junit.version}</version>
|
||||||
|
<scope>test</scope>
|
||||||
|
</dependency>
|
||||||
|
</dependencies>
|
||||||
|
|
||||||
|
<build>
|
||||||
|
<plugins>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
|
<artifactId>maven-compiler-plugin</artifactId>
|
||||||
|
<version>3.11.0</version>
|
||||||
|
<configuration>
|
||||||
|
<source>21</source>
|
||||||
|
<target>21</target>
|
||||||
|
</configuration>
|
||||||
|
</plugin>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.openjfx</groupId>
|
||||||
|
<artifactId>javafx-maven-plugin</artifactId>
|
||||||
|
<version>0.0.8</version>
|
||||||
|
<executions>
|
||||||
|
<execution>
|
||||||
|
<!-- Default configuration for running with: mvn clean javafx:run -->
|
||||||
|
<id>default-cli</id>
|
||||||
|
<configuration>
|
||||||
|
<mainClass>
|
||||||
|
com.example.flappybirdrefactoring/com.example.flappybird.HelloApplication
|
||||||
|
</mainClass>
|
||||||
|
<launcher>app</launcher>
|
||||||
|
<jlinkZipName>app</jlinkZipName>
|
||||||
|
<jlinkImageName>app</jlinkImageName>
|
||||||
|
<noManPages>true</noManPages>
|
||||||
|
<stripDebug>true</stripDebug>
|
||||||
|
<noHeaderFiles>true</noHeaderFiles>
|
||||||
|
</configuration>
|
||||||
|
</execution>
|
||||||
|
</executions>
|
||||||
|
</plugin>
|
||||||
|
</plugins>
|
||||||
|
</build>
|
||||||
|
</project>
|
@ -0,0 +1,53 @@
|
|||||||
|
package com.example.flappybird; /**
|
||||||
|
* Animation.java
|
||||||
|
* Creates animation with array of sprites
|
||||||
|
*
|
||||||
|
* @author Paul Krishnamurthy
|
||||||
|
*/
|
||||||
|
|
||||||
|
import java.awt.Graphics;
|
||||||
|
import java.awt.Graphics2D;
|
||||||
|
import java.awt.image.BufferedImage;
|
||||||
|
import java.awt.geom.AffineTransform;
|
||||||
|
|
||||||
|
public class Animation {
|
||||||
|
|
||||||
|
// Start at first frame
|
||||||
|
private static double currentFrame = 0;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates an animation with an array of sprites
|
||||||
|
*
|
||||||
|
* @param sprites Array of BufferedImages
|
||||||
|
* @param x x-coordinate
|
||||||
|
* @param y y-coordinate
|
||||||
|
* @param speed Speed of animation
|
||||||
|
* @param angle Angle to rotate sprite
|
||||||
|
*/
|
||||||
|
public static void animate (Graphics g, BufferedImage[] sprites, int x, int y, double speed, double angle) {
|
||||||
|
|
||||||
|
Graphics2D g2d = (Graphics2D) g;
|
||||||
|
AffineTransform trans = g2d.getTransform();
|
||||||
|
AffineTransform at = new AffineTransform();
|
||||||
|
|
||||||
|
// Number of frames
|
||||||
|
int count = sprites.length;
|
||||||
|
|
||||||
|
// Rotate the image
|
||||||
|
at.rotate(angle, x + 25, y + 25);
|
||||||
|
g2d.transform(at);
|
||||||
|
|
||||||
|
// Draw the current rotated frame
|
||||||
|
g2d.drawImage(sprites[(int) (Math.round(currentFrame))], x, y, null);
|
||||||
|
|
||||||
|
g2d.setTransform(trans);
|
||||||
|
|
||||||
|
// Switch animation frames
|
||||||
|
if (currentFrame >= count - 1) {
|
||||||
|
currentFrame = 0;
|
||||||
|
} else currentFrame += speed;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,56 @@
|
|||||||
|
package com.example.flappybird; /**
|
||||||
|
* Audio.java
|
||||||
|
* Plays all sound effects
|
||||||
|
*
|
||||||
|
* @author Paul Krishnamurthy
|
||||||
|
*/
|
||||||
|
|
||||||
|
import javax.sound.sampled.AudioInputStream;
|
||||||
|
import javax.sound.sampled.AudioSystem;
|
||||||
|
import javax.sound.sampled.Clip;
|
||||||
|
|
||||||
|
public class Audio {
|
||||||
|
|
||||||
|
private AudioInputStream audioInputStream;
|
||||||
|
private Clip clip;
|
||||||
|
|
||||||
|
private void playSound (String sound) {
|
||||||
|
|
||||||
|
// Path to sound file
|
||||||
|
String soundURL = "/res/sound/" + sound + ".wav";
|
||||||
|
|
||||||
|
// Try to load and play sound
|
||||||
|
try {
|
||||||
|
audioInputStream = AudioSystem.getAudioInputStream(this.getClass().getResource(soundURL));
|
||||||
|
clip = AudioSystem.getClip();
|
||||||
|
clip.open(audioInputStream);
|
||||||
|
clip.start();
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
System.out.printf("Count not load %s.wav!\n", sound);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Public method for bird jump sound
|
||||||
|
*/
|
||||||
|
public void jump () {
|
||||||
|
playSound("jump");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Public method for point sound
|
||||||
|
*/
|
||||||
|
public void point () {
|
||||||
|
playSound("point");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Public method for collision/death sound
|
||||||
|
*/
|
||||||
|
public void hit () {
|
||||||
|
playSound("hit");
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,164 @@
|
|||||||
|
package com.example.flappybird; /**
|
||||||
|
* Bird.java
|
||||||
|
* Handles bird's state and actions
|
||||||
|
*
|
||||||
|
* @author Paul Krishnamurthy
|
||||||
|
*/
|
||||||
|
|
||||||
|
import javax.swing.JPanel;
|
||||||
|
import java.awt.image.BufferedImage;
|
||||||
|
import java.awt.Graphics;
|
||||||
|
|
||||||
|
public class Bird extends JPanel {
|
||||||
|
|
||||||
|
// Bird attributes
|
||||||
|
public String color;
|
||||||
|
private int x, y;
|
||||||
|
private boolean isAlive = true;
|
||||||
|
|
||||||
|
// Bird constants
|
||||||
|
private int FLOAT_MULTIPLIER = -1;
|
||||||
|
public final int BIRD_WIDTH = 44;
|
||||||
|
public final int BIRD_HEIGHT = 31;
|
||||||
|
private final int BASE_COLLISION = 521 - BIRD_HEIGHT - 5;
|
||||||
|
private final int SHIFT = 10;
|
||||||
|
private final int STARTING_BIRD_X = 90;
|
||||||
|
private final int STARTING_BIRD_Y = 343;
|
||||||
|
|
||||||
|
// Physics variables
|
||||||
|
private double velocity = 0;
|
||||||
|
private double gravity = .41;
|
||||||
|
private double delay = 0;
|
||||||
|
private double rotation = 0;
|
||||||
|
|
||||||
|
// Bird sprites
|
||||||
|
private BufferedImage[] sprites;
|
||||||
|
|
||||||
|
|
||||||
|
public Bird (String color, int x, int y, BufferedImage[] s) {
|
||||||
|
this.color = color;
|
||||||
|
this.x = x;
|
||||||
|
this.y = y;
|
||||||
|
this.sprites = s;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return Bird's x-coordinate
|
||||||
|
*/
|
||||||
|
public int getX () {
|
||||||
|
return x;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return Bird's y-coordinate
|
||||||
|
*/
|
||||||
|
public int getY () {
|
||||||
|
return y;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return If bird is alive
|
||||||
|
*/
|
||||||
|
public boolean isAlive () {
|
||||||
|
return isAlive;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Kills bird
|
||||||
|
*/
|
||||||
|
public void kill () {
|
||||||
|
isAlive = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set new coordinates when starting game
|
||||||
|
*/
|
||||||
|
public void setGameStartPos () {
|
||||||
|
x = STARTING_BIRD_X;
|
||||||
|
y = STARTING_BIRD_Y;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Floating bird effect on menu screen
|
||||||
|
*/
|
||||||
|
public void menuFloat () {
|
||||||
|
|
||||||
|
y += FLOAT_MULTIPLIER;
|
||||||
|
|
||||||
|
// Change direction within floating range
|
||||||
|
if (y < 220) {
|
||||||
|
FLOAT_MULTIPLIER *= -1;
|
||||||
|
} else if (y > 280) {
|
||||||
|
FLOAT_MULTIPLIER *= -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Bird jump
|
||||||
|
*/
|
||||||
|
public void jump () {
|
||||||
|
|
||||||
|
if (delay < 1) {
|
||||||
|
velocity = -SHIFT;
|
||||||
|
delay = SHIFT;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Bird movement during the game
|
||||||
|
*/
|
||||||
|
public void inGame () {
|
||||||
|
|
||||||
|
// If the bird did not hit the base, lower it
|
||||||
|
if (y < BASE_COLLISION) {
|
||||||
|
|
||||||
|
// Change and velocity
|
||||||
|
velocity += gravity;
|
||||||
|
|
||||||
|
// Lower delay if possible
|
||||||
|
if (delay > 0) { delay--; }
|
||||||
|
|
||||||
|
// Add rounded velocity to y-coordinate
|
||||||
|
y += (int) velocity;
|
||||||
|
|
||||||
|
} else {
|
||||||
|
|
||||||
|
// Play audio and set state to dead
|
||||||
|
GamePanel.audio.hit();
|
||||||
|
isAlive = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Renders bird
|
||||||
|
*/
|
||||||
|
public void renderBird (Graphics g) {
|
||||||
|
|
||||||
|
// Calculate angle to rotate bird based on y-velocity
|
||||||
|
rotation = ((90 * (velocity + 25) / 25) - 90) * Math.PI / 180;
|
||||||
|
|
||||||
|
// Divide for clean jump
|
||||||
|
rotation /= 2;
|
||||||
|
|
||||||
|
// Handle rotation offset
|
||||||
|
rotation = rotation > Math.PI / 2 ? Math.PI / 2 : rotation;
|
||||||
|
|
||||||
|
if (!isAlive()) {
|
||||||
|
|
||||||
|
// Drop bird on death
|
||||||
|
if (y < BASE_COLLISION - 10) {
|
||||||
|
velocity += gravity;
|
||||||
|
y += (int) velocity;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// Create bird animation and pass in rotation angle
|
||||||
|
Animation.animate(g, sprites, x, y, .09, rotation);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,59 @@
|
|||||||
|
package com.example.flappybird; /**
|
||||||
|
* FlappyBird.java
|
||||||
|
* Main game class
|
||||||
|
*
|
||||||
|
* @author Paul Krishnamurthy
|
||||||
|
*/
|
||||||
|
|
||||||
|
import javax.swing.*;
|
||||||
|
import java.awt.event.*;
|
||||||
|
import java.awt.Toolkit;
|
||||||
|
|
||||||
|
public class FlappyBird extends JFrame implements ActionListener {
|
||||||
|
|
||||||
|
GamePanel game;
|
||||||
|
Timer gameTimer;
|
||||||
|
|
||||||
|
// Game setup constants
|
||||||
|
public static final int WIDTH = 375;
|
||||||
|
public static final int HEIGHT = 667;
|
||||||
|
private static final int DELAY = 12;
|
||||||
|
|
||||||
|
public FlappyBird () {
|
||||||
|
|
||||||
|
super("Flappy Bird");
|
||||||
|
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
|
||||||
|
setSize(WIDTH, HEIGHT);
|
||||||
|
|
||||||
|
// Game timer
|
||||||
|
gameTimer = new Timer(DELAY, this);
|
||||||
|
gameTimer.start();
|
||||||
|
|
||||||
|
// Add Panel to Frame
|
||||||
|
game = new GamePanel();
|
||||||
|
add(game);
|
||||||
|
|
||||||
|
// Set game icon
|
||||||
|
setIconImage(Toolkit.getDefaultToolkit().getImage("res/img/icons.png"));
|
||||||
|
|
||||||
|
setResizable(false);
|
||||||
|
setVisible(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void actionPerformed (ActionEvent e) {
|
||||||
|
|
||||||
|
if (game != null && game.ready) {
|
||||||
|
game.repaint();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public static void main(String[] args) {
|
||||||
|
|
||||||
|
FlappyBird game = new FlappyBird();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,616 @@
|
|||||||
|
package com.example.flappybird; /**
|
||||||
|
* GamePanel.java
|
||||||
|
* Main game panel
|
||||||
|
*
|
||||||
|
* @author Paul Krishnamurthy
|
||||||
|
*/
|
||||||
|
|
||||||
|
import java.awt.*;
|
||||||
|
import java.awt.event.*;
|
||||||
|
import javax.swing.*;
|
||||||
|
import java.util.Random;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.io.InputStream;
|
||||||
|
import java.io.BufferedInputStream;
|
||||||
|
import java.io.FileInputStream;
|
||||||
|
import java.awt.image.BufferedImage;
|
||||||
|
import java.util.Calendar;
|
||||||
|
|
||||||
|
public class GamePanel extends JPanel implements KeyListener, MouseListener {
|
||||||
|
|
||||||
|
private Random rand;
|
||||||
|
private Calendar cal;
|
||||||
|
|
||||||
|
////////////////////
|
||||||
|
// Game variables //
|
||||||
|
////////////////////
|
||||||
|
|
||||||
|
// Fonts
|
||||||
|
private Font flappyFontBase,
|
||||||
|
flappyFontReal,
|
||||||
|
flappyScoreFont,
|
||||||
|
flappyMiniFont = null;
|
||||||
|
|
||||||
|
// Textures
|
||||||
|
public static HashMap<String, Texture> textures = new Sprites().getGameTextures();
|
||||||
|
|
||||||
|
// Moving base effect
|
||||||
|
private static int baseSpeed = 2;
|
||||||
|
private static int[] baseCoords = { 0, 435 };
|
||||||
|
|
||||||
|
// Game states
|
||||||
|
final static int MENU = 0;
|
||||||
|
final static int GAME = 1;
|
||||||
|
private int gameState = MENU;
|
||||||
|
|
||||||
|
private int score; // Player score
|
||||||
|
private int pipeDistTracker; // Distance between pipes
|
||||||
|
|
||||||
|
public boolean ready = false; // If game has loaded
|
||||||
|
private boolean inStartGameState = false; // To show instructions scren
|
||||||
|
private Point clickedPoint = new Point(-1, -1); // Store point when player clicks
|
||||||
|
private boolean scoreWasGreater; // If score was greater than previous highscore
|
||||||
|
private boolean darkTheme; // Boolean to show dark or light screen
|
||||||
|
private String randomBird; // Random bird color
|
||||||
|
private String medal; // Medal to be awarded after each game
|
||||||
|
public ArrayList<Pipe> pipes; // Arraylist of Pipe objects
|
||||||
|
|
||||||
|
private Bird gameBird;
|
||||||
|
private Highscore highscore = new Highscore();
|
||||||
|
public static Audio audio = new Audio();
|
||||||
|
|
||||||
|
|
||||||
|
public GamePanel () {
|
||||||
|
|
||||||
|
rand = new Random();
|
||||||
|
|
||||||
|
// Try to load ttf file
|
||||||
|
try {
|
||||||
|
InputStream is = new BufferedInputStream(this.getClass().getResourceAsStream("/res/fonts/flappy-font.ttf"));
|
||||||
|
flappyFontBase = Font.createFont(Font.TRUETYPE_FONT, is);
|
||||||
|
|
||||||
|
// Header and sub-header fonts
|
||||||
|
flappyScoreFont = flappyFontBase.deriveFont(Font.PLAIN, 50);
|
||||||
|
flappyFontReal = flappyFontBase.deriveFont(Font.PLAIN, 20);
|
||||||
|
flappyMiniFont = flappyFontBase.deriveFont(Font.PLAIN, 15);
|
||||||
|
|
||||||
|
} catch (Exception ex) {
|
||||||
|
|
||||||
|
// Exit is font cannot be loaded
|
||||||
|
ex.printStackTrace();
|
||||||
|
System.err.println("Could not load Flappy Font!");
|
||||||
|
System.exit(-1);
|
||||||
|
}
|
||||||
|
|
||||||
|
restart(); // Reset game variables
|
||||||
|
|
||||||
|
// Input listeners
|
||||||
|
addKeyListener(this);
|
||||||
|
addMouseListener(this);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* To start game after everything has been loaded
|
||||||
|
*/
|
||||||
|
public void addNotify() {
|
||||||
|
super.addNotify();
|
||||||
|
requestFocus();
|
||||||
|
ready = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Restarts game by resetting game variables
|
||||||
|
*/
|
||||||
|
public void restart () {
|
||||||
|
|
||||||
|
// Reset game statistics
|
||||||
|
score = 0;
|
||||||
|
pipeDistTracker = 0;
|
||||||
|
scoreWasGreater = false;
|
||||||
|
|
||||||
|
// Get current hour with Calendar
|
||||||
|
// If it is past noon, use the dark theme
|
||||||
|
cal = Calendar.getInstance();
|
||||||
|
int currentHour = cal.get(Calendar.HOUR_OF_DAY);
|
||||||
|
|
||||||
|
// Array of bird colors
|
||||||
|
String[] birds = new String[] {
|
||||||
|
"yellow",
|
||||||
|
"blue",
|
||||||
|
"red"
|
||||||
|
};
|
||||||
|
|
||||||
|
// Set random scene assets
|
||||||
|
darkTheme = currentHour > 12; // If we should use the dark theme
|
||||||
|
randomBird = birds[rand.nextInt(3)]; // Random bird color
|
||||||
|
|
||||||
|
// Game bird
|
||||||
|
gameBird = new Bird(randomBird, 172, 250, new BufferedImage[] {
|
||||||
|
textures.get(randomBird + "Bird1").getImage(),
|
||||||
|
textures.get(randomBird + "Bird2").getImage(),
|
||||||
|
textures.get(randomBird + "Bird3").getImage()
|
||||||
|
});
|
||||||
|
|
||||||
|
// Remove old pipes
|
||||||
|
pipes = new ArrayList<Pipe>();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Checks if point is in rectangle
|
||||||
|
*
|
||||||
|
* @param r Rectangle
|
||||||
|
* @return Boolean if point collides with rectangle
|
||||||
|
*/
|
||||||
|
private boolean isTouching (Rectangle r) {
|
||||||
|
return r.contains(clickedPoint);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void paintComponent (Graphics g) {
|
||||||
|
super.paintComponent(g);
|
||||||
|
|
||||||
|
// Set font and color
|
||||||
|
g.setFont(flappyFontReal);
|
||||||
|
g.setColor(Color.white);
|
||||||
|
|
||||||
|
// Only move screen if bird is alive
|
||||||
|
if (gameBird.isAlive()) {
|
||||||
|
|
||||||
|
// Move base
|
||||||
|
baseCoords[0] = baseCoords[0] - baseSpeed < -435 ? 435 : baseCoords[0] - baseSpeed;
|
||||||
|
baseCoords[1] = baseCoords[1] - baseSpeed < -435 ? 435 : baseCoords[1] - baseSpeed;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// Background
|
||||||
|
g.drawImage(darkTheme ? textures.get("background2").getImage() :
|
||||||
|
textures.get("background1").getImage(), 0, 0, null);
|
||||||
|
|
||||||
|
// Draw bird
|
||||||
|
gameBird.renderBird(g);
|
||||||
|
|
||||||
|
switch (gameState) {
|
||||||
|
|
||||||
|
case MENU:
|
||||||
|
|
||||||
|
drawBase(g);
|
||||||
|
drawMenu(g);
|
||||||
|
|
||||||
|
gameBird.menuFloat();
|
||||||
|
|
||||||
|
break;
|
||||||
|
|
||||||
|
case GAME:
|
||||||
|
|
||||||
|
if (gameBird.isAlive()) {
|
||||||
|
|
||||||
|
// Start at instructions state
|
||||||
|
if (inStartGameState) {
|
||||||
|
startGameScreen(g);
|
||||||
|
|
||||||
|
} else {
|
||||||
|
// Start game
|
||||||
|
pipeHandler(g);
|
||||||
|
gameBird.inGame();
|
||||||
|
}
|
||||||
|
|
||||||
|
drawBase(g); // Draw base over pipes
|
||||||
|
drawScore(g, score, false, 0, 0); // Draw player score
|
||||||
|
|
||||||
|
} else {
|
||||||
|
|
||||||
|
pipeHandler(g);
|
||||||
|
drawBase(g);
|
||||||
|
|
||||||
|
// Draw game over assets
|
||||||
|
gameOver(g);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/////////////////////////
|
||||||
|
// All drawing methods //
|
||||||
|
/////////////////////////
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Draws a string centered based on given restrictions
|
||||||
|
*
|
||||||
|
* @param s String to be drawn
|
||||||
|
* @param w Constraining width
|
||||||
|
* @param h Constraining height
|
||||||
|
* @param y Fixed y-coordiate
|
||||||
|
*/
|
||||||
|
public void drawCentered (String s, int w, int h, int y, Graphics g) {
|
||||||
|
FontMetrics fm = g.getFontMetrics();
|
||||||
|
|
||||||
|
// Calculate x-coordinate based on string length and width
|
||||||
|
int x = (w - fm.stringWidth(s)) / 2;
|
||||||
|
g.drawString(s, x, y);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Needs to be called differently based on screen
|
||||||
|
*/
|
||||||
|
public void drawBase (Graphics g) {
|
||||||
|
|
||||||
|
// Moving base effect
|
||||||
|
g.drawImage(textures.get("base").getImage(), baseCoords[0], textures.get("base").getY(), null);
|
||||||
|
g.drawImage(textures.get("base").getImage(), baseCoords[1], textures.get("base").getY(), null);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
////////////////
|
||||||
|
// Menuscreen //
|
||||||
|
////////////////
|
||||||
|
|
||||||
|
private void drawMenu (Graphics g) {
|
||||||
|
|
||||||
|
// Title
|
||||||
|
g.drawImage(textures.get("titleText").getImage(),
|
||||||
|
textures.get("titleText").getX(),
|
||||||
|
textures.get("titleText").getY(), null);
|
||||||
|
|
||||||
|
// Buttons
|
||||||
|
g.drawImage(textures.get("playButton").getImage(),
|
||||||
|
textures.get("playButton").getX(),
|
||||||
|
textures.get("playButton").getY(), null);
|
||||||
|
g.drawImage(textures.get("leaderboard").getImage(),
|
||||||
|
textures.get("leaderboard").getX(),
|
||||||
|
textures.get("leaderboard").getY(), null);
|
||||||
|
g.drawImage(textures.get("rateButton").getImage(),
|
||||||
|
textures.get("rateButton").getX(),
|
||||||
|
textures.get("rateButton").getY(), null);
|
||||||
|
|
||||||
|
// Credits :p
|
||||||
|
drawCentered("Created by Paul Krishnamurthy", FlappyBird.WIDTH, FlappyBird.HEIGHT, 600, g);
|
||||||
|
g.setFont(flappyMiniFont); // Change font
|
||||||
|
drawCentered("www.PaulKr.com", FlappyBird.WIDTH, FlappyBird.HEIGHT, 630, g);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/////////////////
|
||||||
|
// Game screen //
|
||||||
|
/////////////////
|
||||||
|
|
||||||
|
public void startGameScreen (Graphics g) {
|
||||||
|
|
||||||
|
// Set bird's new position
|
||||||
|
gameBird.setGameStartPos();
|
||||||
|
|
||||||
|
// Get ready text
|
||||||
|
g.drawImage(textures.get("getReadyText").getImage(),
|
||||||
|
textures.get("getReadyText").getX(),
|
||||||
|
textures.get("getReadyText").getY(), null);
|
||||||
|
|
||||||
|
// Instructions image
|
||||||
|
g.drawImage(textures.get("instructions").getImage(),
|
||||||
|
textures.get("instructions").getX(),
|
||||||
|
textures.get("instructions").getY(), null);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Aligns and draws score using image textures
|
||||||
|
*
|
||||||
|
* @param mini Boolean for drawing small or large numbers
|
||||||
|
* @param x X-coordinate to draw for mini numbers
|
||||||
|
*/
|
||||||
|
public void drawScore (Graphics g, int drawNum, boolean mini, int x, int y) {
|
||||||
|
|
||||||
|
// Char array of digits
|
||||||
|
char[] digits = ("" + drawNum).toCharArray();
|
||||||
|
|
||||||
|
int digitCount = digits.length;
|
||||||
|
|
||||||
|
// Calculate width for numeric textures
|
||||||
|
int takeUp = 0;
|
||||||
|
for (char digit : digits) {
|
||||||
|
|
||||||
|
// Size to add varies based on texture
|
||||||
|
if (mini) {
|
||||||
|
takeUp += 18;
|
||||||
|
} else {
|
||||||
|
takeUp += digit == '1' ? 25 : 35;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Calculate x-coordinate
|
||||||
|
int drawScoreX = mini ? (x - takeUp) : (FlappyBird.WIDTH / 2 - takeUp / 2);
|
||||||
|
|
||||||
|
// Draw every digit
|
||||||
|
for (int i = 0; i < digitCount; i++) {
|
||||||
|
g.drawImage(textures.get((mini ? "mini-score-" : "score-") + digits[i]).getImage(), drawScoreX, (mini ? y : 60), null);
|
||||||
|
|
||||||
|
// Size to add varies based on texture
|
||||||
|
if (mini) {
|
||||||
|
drawScoreX += 18;
|
||||||
|
} else {
|
||||||
|
drawScoreX += digits[i] == '1' ? 25 : 35;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Moves and repositions pipes
|
||||||
|
*/
|
||||||
|
public void pipeHandler (Graphics g) {
|
||||||
|
|
||||||
|
// Decrease distance between pipes
|
||||||
|
if (gameBird.isAlive()) {
|
||||||
|
pipeDistTracker --;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Initialize pipes as null
|
||||||
|
Pipe topPipe = null;
|
||||||
|
Pipe bottomPipe = null;
|
||||||
|
|
||||||
|
// If there is no distance,
|
||||||
|
// a new pipe is needed
|
||||||
|
if (pipeDistTracker < 0) {
|
||||||
|
|
||||||
|
// Reset distance
|
||||||
|
pipeDistTracker = Pipe.PIPE_DISTANCE;
|
||||||
|
|
||||||
|
for (Pipe p : pipes) {
|
||||||
|
|
||||||
|
// If pipe is out of screen
|
||||||
|
if (p.getX() < 0) {
|
||||||
|
if (topPipe == null) {
|
||||||
|
topPipe = p;
|
||||||
|
topPipe.canAwardPoint = true;
|
||||||
|
}
|
||||||
|
else if (bottomPipe == null) {
|
||||||
|
bottomPipe = p;
|
||||||
|
topPipe.canAwardPoint = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Pipe currentPipe; // New pipe object for top and bottom pipes
|
||||||
|
|
||||||
|
// Move and handle initial creation of top and bottom pipes
|
||||||
|
|
||||||
|
if (topPipe == null) {
|
||||||
|
currentPipe = new Pipe("top");
|
||||||
|
topPipe = currentPipe;
|
||||||
|
pipes.add(topPipe);
|
||||||
|
} else {
|
||||||
|
topPipe.reset();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (bottomPipe == null) {
|
||||||
|
currentPipe = new Pipe("bottom");
|
||||||
|
bottomPipe = currentPipe;
|
||||||
|
pipes.add(bottomPipe);
|
||||||
|
|
||||||
|
// Avoid doubling points when passing initial pipes
|
||||||
|
bottomPipe.canAwardPoint = false;
|
||||||
|
} else {
|
||||||
|
bottomPipe.reset();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Set y-coordinate of bottom pipe based on
|
||||||
|
// y-coordinate of top pipe
|
||||||
|
bottomPipe.setY(topPipe.getY() + Pipe.PIPE_SPACING);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// Move and draw each pipe
|
||||||
|
|
||||||
|
for (Pipe p : pipes) {
|
||||||
|
|
||||||
|
// Move the pipe
|
||||||
|
if (gameBird.isAlive()) {
|
||||||
|
p.move();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Draw the top and bottom pipes
|
||||||
|
if (p.getY() <= 0) {
|
||||||
|
g.drawImage(textures.get("pipe-top").getImage(), p.getX(), p.getY(), null);
|
||||||
|
} else {
|
||||||
|
g.drawImage(textures.get("pipe-bottom").getImage(), p.getX(), p.getY(), null);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Check if bird hits pipes
|
||||||
|
if (gameBird.isAlive()) {
|
||||||
|
if (p.collide(
|
||||||
|
gameBird.getX(),
|
||||||
|
gameBird.getY(),
|
||||||
|
gameBird.BIRD_WIDTH,
|
||||||
|
gameBird.BIRD_HEIGHT
|
||||||
|
)) {
|
||||||
|
// Kill bird and play sound
|
||||||
|
gameBird.kill();
|
||||||
|
audio.hit();
|
||||||
|
} else {
|
||||||
|
|
||||||
|
// Checks if bird passes a pipe
|
||||||
|
if (gameBird.getX() >= p.getX() + p.WIDTH / 2) {
|
||||||
|
|
||||||
|
// Increase score and play sound
|
||||||
|
if (p.canAwardPoint) {
|
||||||
|
audio.point();
|
||||||
|
score ++;
|
||||||
|
p.canAwardPoint = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void gameOver (Graphics g) {
|
||||||
|
|
||||||
|
// Game over text
|
||||||
|
g.drawImage(textures.get("gameOverText").getImage(),
|
||||||
|
textures.get("gameOverText").getX(),
|
||||||
|
textures.get("gameOverText").getY(), null);
|
||||||
|
|
||||||
|
// Scorecard
|
||||||
|
g.drawImage(textures.get("scoreCard").getImage(),
|
||||||
|
textures.get("scoreCard").getX(),
|
||||||
|
textures.get("scoreCard").getY(), null);
|
||||||
|
|
||||||
|
// New highscore image
|
||||||
|
if (scoreWasGreater) {
|
||||||
|
g.drawImage(textures.get("newHighscore").getImage(),
|
||||||
|
textures.get("newHighscore").getX(),
|
||||||
|
textures.get("newHighscore").getY(), null);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Draw mini fonts for current and best scores
|
||||||
|
drawScore(g, score, true, 303, 276);
|
||||||
|
drawScore(g, highscore.bestScore(), true, 303, 330);
|
||||||
|
|
||||||
|
// Handle highscore
|
||||||
|
if (score > highscore.bestScore()) {
|
||||||
|
|
||||||
|
// New best score
|
||||||
|
scoreWasGreater = true;
|
||||||
|
highscore.setNewBest(score); // Set in data file
|
||||||
|
}
|
||||||
|
|
||||||
|
// Medal
|
||||||
|
if (score >= 10) { medal = "bronze"; }
|
||||||
|
if (score >= 20) { medal = "silver"; }
|
||||||
|
if (score >= 30) { medal = "gold"; }
|
||||||
|
if (score >= 40) { medal = "platinum"; }
|
||||||
|
|
||||||
|
// Only award a medal if they deserve it
|
||||||
|
if (score > 9) {
|
||||||
|
g.drawImage(textures.get(medal).getImage(),
|
||||||
|
textures.get(medal).getX(),
|
||||||
|
textures.get(medal).getY(), null);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Buttons
|
||||||
|
g.drawImage(textures.get("playButton").getImage(),
|
||||||
|
textures.get("playButton").getX(),
|
||||||
|
textures.get("playButton").getY(), null);
|
||||||
|
g.drawImage(textures.get("leaderboard").getImage(),
|
||||||
|
textures.get("leaderboard").getX(),
|
||||||
|
textures.get("leaderboard").getY(), null);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//////////////////////
|
||||||
|
// Keyboard actions //
|
||||||
|
//////////////////////
|
||||||
|
|
||||||
|
public void keyTyped (KeyEvent e) {}
|
||||||
|
public void keyReleased (KeyEvent e) {}
|
||||||
|
|
||||||
|
public void keyPressed (KeyEvent e) {
|
||||||
|
|
||||||
|
int keyCode = e.getKeyCode();
|
||||||
|
|
||||||
|
if (gameState == MENU) {
|
||||||
|
|
||||||
|
// Start game on 'enter' key
|
||||||
|
if (keyCode == KeyEvent.VK_ENTER) {
|
||||||
|
gameState = GAME;
|
||||||
|
inStartGameState = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
} else if (gameState == GAME && gameBird.isAlive()) {
|
||||||
|
|
||||||
|
if (keyCode == KeyEvent.VK_SPACE) {
|
||||||
|
|
||||||
|
// Exit instructions state
|
||||||
|
if (inStartGameState) {
|
||||||
|
inStartGameState = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Jump and play audio even if in instructions state
|
||||||
|
gameBird.jump();
|
||||||
|
audio.jump();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
///////////////////
|
||||||
|
// Mouse actions //
|
||||||
|
///////////////////
|
||||||
|
|
||||||
|
public void mouseExited (MouseEvent e) {}
|
||||||
|
public void mouseEntered (MouseEvent e) {}
|
||||||
|
public void mouseReleased (MouseEvent e) {}
|
||||||
|
public void mouseClicked (MouseEvent e) {}
|
||||||
|
|
||||||
|
public void mousePressed (MouseEvent e) {
|
||||||
|
|
||||||
|
// Save clicked point
|
||||||
|
clickedPoint = e.getPoint();
|
||||||
|
|
||||||
|
if (gameState == MENU) {
|
||||||
|
|
||||||
|
if (isTouching(textures.get("playButton").getRect())) {
|
||||||
|
gameState = GAME;
|
||||||
|
inStartGameState = true;
|
||||||
|
|
||||||
|
} else if (isTouching(textures.get("leaderboard").getRect())) {
|
||||||
|
|
||||||
|
// Dummy message
|
||||||
|
JOptionPane.showMessageDialog(this,
|
||||||
|
"We can't access the leaderboard right now!",
|
||||||
|
"Oops!",
|
||||||
|
JOptionPane.ERROR_MESSAGE);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (gameBird.isAlive()) {
|
||||||
|
|
||||||
|
if (isTouching(textures.get("rateButton").getRect())) {
|
||||||
|
Helper.openURL("http://paulkr.com"); // Open website
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
} else if (gameState == GAME) {
|
||||||
|
|
||||||
|
if (gameBird.isAlive()) {
|
||||||
|
|
||||||
|
// Allow jump with clicks
|
||||||
|
if (inStartGameState) {
|
||||||
|
inStartGameState = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Jump and play sound
|
||||||
|
gameBird.jump();
|
||||||
|
audio.jump();
|
||||||
|
|
||||||
|
} else {
|
||||||
|
|
||||||
|
// On game over screen, allow restart and leaderboard buttons
|
||||||
|
if (isTouching(textures.get("playButton").getRect())) {
|
||||||
|
inStartGameState = true;
|
||||||
|
gameState = GAME;
|
||||||
|
restart();
|
||||||
|
gameBird.setGameStartPos();
|
||||||
|
|
||||||
|
} else if (isTouching(textures.get("leaderboard").getRect())) {
|
||||||
|
|
||||||
|
// Dummy message
|
||||||
|
JOptionPane.showMessageDialog(this,
|
||||||
|
"We can't access the leaderboard right now!",
|
||||||
|
"Oops!",
|
||||||
|
JOptionPane.ERROR_MESSAGE);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,31 @@
|
|||||||
|
package com.example.flappybird; /**
|
||||||
|
* Helper.java
|
||||||
|
* Helper class with various tools
|
||||||
|
*
|
||||||
|
* @author Paul Krishnamurthy
|
||||||
|
*/
|
||||||
|
|
||||||
|
import java.awt.Desktop;
|
||||||
|
import java.net.URI;
|
||||||
|
|
||||||
|
public class Helper {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Tries to open url in default web browser
|
||||||
|
*
|
||||||
|
* @param url Destination URL
|
||||||
|
*/
|
||||||
|
public static void openURL (String url) {
|
||||||
|
|
||||||
|
try {
|
||||||
|
if (Desktop.isDesktopSupported()) {
|
||||||
|
Desktop.getDesktop().browse(new URI(url));
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
System.out.println("Sorry could not open URL...");
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,83 @@
|
|||||||
|
package com.example.flappybird; /**
|
||||||
|
* Highscore.java
|
||||||
|
* Handles setting and getting highscores
|
||||||
|
*
|
||||||
|
* @author Paul Krishnamurthy
|
||||||
|
*/
|
||||||
|
|
||||||
|
import java.net.URISyntaxException;
|
||||||
|
import java.net.URL;
|
||||||
|
import java.nio.file.Paths;
|
||||||
|
import java.util.Scanner;
|
||||||
|
import java.io.File;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.io.PrintWriter;
|
||||||
|
import java.io.FileNotFoundException;
|
||||||
|
import java.io.UnsupportedEncodingException;
|
||||||
|
|
||||||
|
|
||||||
|
public class Highscore {
|
||||||
|
|
||||||
|
// Read / Write to file setup
|
||||||
|
private static final String FILE_PATH = "/res/data/highscore.dat";
|
||||||
|
|
||||||
|
private static URL dataURL = Highscore.class.getResource(FILE_PATH);
|
||||||
|
private static File dataFile;
|
||||||
|
|
||||||
|
static {
|
||||||
|
try {
|
||||||
|
dataFile = Paths.get(dataURL.toURI()).toFile();
|
||||||
|
} catch (URISyntaxException e) {
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private static Scanner dataScanner = null;
|
||||||
|
private static PrintWriter dataWriter = null;
|
||||||
|
|
||||||
|
// Highscore
|
||||||
|
private int bestScore;
|
||||||
|
|
||||||
|
public Highscore () {
|
||||||
|
|
||||||
|
// Load scanner with data file
|
||||||
|
try {
|
||||||
|
dataScanner = new Scanner(dataFile);
|
||||||
|
} catch (IOException e) {
|
||||||
|
System.out.println("Cannot load highscore!");
|
||||||
|
}
|
||||||
|
|
||||||
|
// Store highscore
|
||||||
|
bestScore = Integer.parseInt(dataScanner.nextLine());
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return Player's highscore
|
||||||
|
*/
|
||||||
|
public int bestScore () {
|
||||||
|
return bestScore;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets new highscore in the data file
|
||||||
|
*
|
||||||
|
* @param newBest New score update
|
||||||
|
*/
|
||||||
|
public void setNewBest (int newBest) {
|
||||||
|
|
||||||
|
// Set new best score
|
||||||
|
bestScore = newBest;
|
||||||
|
|
||||||
|
try {
|
||||||
|
// Write new highscore to data file
|
||||||
|
dataWriter = new PrintWriter(FILE_PATH, "UTF-8");
|
||||||
|
dataWriter.println(Integer.toString(newBest));
|
||||||
|
dataWriter.close();
|
||||||
|
} catch (FileNotFoundException | UnsupportedEncodingException e) {
|
||||||
|
System.out.println("Could not set new highscore!");
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,99 @@
|
|||||||
|
package com.example.flappybird;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Pipe.java
|
||||||
|
* Handles collisions and rendering for pipes
|
||||||
|
*
|
||||||
|
* @author Paul Krishnamurthy
|
||||||
|
*/
|
||||||
|
|
||||||
|
public class Pipe {
|
||||||
|
|
||||||
|
// Pipe coordinates
|
||||||
|
private int x = FlappyBird.WIDTH + 5;
|
||||||
|
private int y;
|
||||||
|
|
||||||
|
// Placement (top or bottom) of pipe
|
||||||
|
String location;
|
||||||
|
|
||||||
|
// Pipe constants
|
||||||
|
public static final int WIDTH = 67;
|
||||||
|
public static final int HEIGHT = 416;
|
||||||
|
public static final int PIPE_DISTANCE = 150; // Horizontal distance between pipes
|
||||||
|
public static final int PIPE_SPACING = HEIGHT + 170; // Vertical distance between pipes
|
||||||
|
private static final int SPEED = -2;
|
||||||
|
|
||||||
|
// If the bird can get a point passing this pipe
|
||||||
|
public boolean canAwardPoint = true;
|
||||||
|
|
||||||
|
public Pipe (String location) {
|
||||||
|
this.location = location;
|
||||||
|
reset();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void reset () {
|
||||||
|
x = FlappyBird.WIDTH + 5; // Reset x-coordinate
|
||||||
|
|
||||||
|
// Set boundaries for top pipes
|
||||||
|
// This y-coordinte + PIPE_SPACING will be for the bottom pipe
|
||||||
|
if (location.equals("top")) {
|
||||||
|
y = - Math.max((int) (Math.random() * 320) + 30, 140);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Moves the pipe
|
||||||
|
*/
|
||||||
|
public void move () {
|
||||||
|
x += SPEED;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Checks for bird colliding with pipe
|
||||||
|
*
|
||||||
|
* @param nX Bird x-coordinate
|
||||||
|
* @param nY Bird y-coordinate
|
||||||
|
* @param nW Bird width
|
||||||
|
* @param nH Bird height
|
||||||
|
* @return If bird is colliding with the pipe
|
||||||
|
*/
|
||||||
|
public boolean collide (int nX, int nY, int nW, int nH) {
|
||||||
|
|
||||||
|
// Do not allow bird to jump over pipe
|
||||||
|
if (nX > x && nY < 0 && canAwardPoint) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return nX < x + WIDTH &&
|
||||||
|
nX + nW > x &&
|
||||||
|
nY < y + HEIGHT &&
|
||||||
|
nY + nH > y;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return Pipe's x-coordinate
|
||||||
|
*/
|
||||||
|
public int getX () {
|
||||||
|
return x;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return Pipe's y-coordinate
|
||||||
|
*/
|
||||||
|
public int getY () {
|
||||||
|
return y;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set's pipe's y-coordinate (for bottom pipes)
|
||||||
|
*
|
||||||
|
* @param newY New y-coordinate
|
||||||
|
*/
|
||||||
|
public void setY (int newY) {
|
||||||
|
y = newY;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,135 @@
|
|||||||
|
package com.example.flappybird; /**
|
||||||
|
* Sprites.java
|
||||||
|
* Cuts up the main sprite sheet
|
||||||
|
*
|
||||||
|
* @author Paul Krishnamurthy
|
||||||
|
*/
|
||||||
|
|
||||||
|
import java.awt.image.BufferedImage;
|
||||||
|
import java.awt.Graphics2D;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.io.File;
|
||||||
|
import javax.imageio.ImageIO;
|
||||||
|
import java.util.HashMap;
|
||||||
|
|
||||||
|
public class Sprites {
|
||||||
|
|
||||||
|
// Resize factor to match frame size
|
||||||
|
private static final double RESIZE_FACTOR = 2.605;
|
||||||
|
|
||||||
|
private static BufferedImage spriteSheet = null;
|
||||||
|
|
||||||
|
// HashMap of texture objects
|
||||||
|
private static HashMap<String, Texture> textures = new HashMap<String, Texture>();
|
||||||
|
|
||||||
|
public Sprites () {
|
||||||
|
|
||||||
|
// Try to load sprite sheet, exit program if cannot
|
||||||
|
|
||||||
|
try {
|
||||||
|
spriteSheet = ImageIO.read(this.getClass().getResource("/res/img/spriteSheet.png"));
|
||||||
|
} catch (IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
System.out.println("Could not load sprite sheet.");
|
||||||
|
System.exit(-1); // Exit program if file could not be found
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Backgrounds
|
||||||
|
textures.put("background1", new Texture(resize(spriteSheet.getSubimage(0, 0, 144, 256)), 0, 0));
|
||||||
|
textures.put("background2", new Texture(resize(spriteSheet.getSubimage(146, 0, 144, 256)), 0, 0));
|
||||||
|
|
||||||
|
// Pipes
|
||||||
|
textures.put("pipe-top", new Texture(resize(spriteSheet.getSubimage(56, 323, 26, 160)), 0, 0));
|
||||||
|
textures.put("pipe-bottom", new Texture(resize(spriteSheet.getSubimage(84, 323, 26, 160)), 0, 0));
|
||||||
|
|
||||||
|
// Birds
|
||||||
|
textures.put("yellowBird1", new Texture(resize(spriteSheet.getSubimage(31, 491, 17, 12)), 172, 250));
|
||||||
|
textures.put("yellowBird2", new Texture(resize(spriteSheet.getSubimage(59, 491, 17, 12)), 172, 250));
|
||||||
|
textures.put("yellowBird3", new Texture(resize(spriteSheet.getSubimage(3, 491, 17, 12)), 172, 250));
|
||||||
|
|
||||||
|
textures.put("blueBird1", new Texture(resize(spriteSheet.getSubimage(115, 329, 17, 12)), 172, 250));
|
||||||
|
textures.put("blueBird2", new Texture(resize(spriteSheet.getSubimage(115, 355, 17, 12)), 172, 250));
|
||||||
|
textures.put("blueBird3", new Texture(resize(spriteSheet.getSubimage(87, 491, 17, 12)), 172, 250));
|
||||||
|
|
||||||
|
textures.put("redBird1", new Texture(resize(spriteSheet.getSubimage(115, 407, 17, 12)), 172, 250));
|
||||||
|
textures.put("redBird2", new Texture(resize(spriteSheet.getSubimage(115, 433, 17, 12)), 172, 250));
|
||||||
|
textures.put("redBird3", new Texture(resize(spriteSheet.getSubimage(115, 381, 17, 12)), 172, 250));
|
||||||
|
|
||||||
|
// Buttons
|
||||||
|
textures.put("playButton", new Texture(resize(spriteSheet.getSubimage(354, 118, 52, 29)), 34, 448));
|
||||||
|
textures.put("leaderboard", new Texture(resize(spriteSheet.getSubimage(414, 118, 52, 29)), 203, 448));
|
||||||
|
textures.put("rateButton", new Texture(resize(spriteSheet.getSubimage(465, 1, 31, 18)), 147, 355));
|
||||||
|
|
||||||
|
// Helpful / Text
|
||||||
|
textures.put("newHighscore", new Texture(resize(spriteSheet.getSubimage(112, 501, 16, 7)), 210, 305));
|
||||||
|
textures.put("titleText", new Texture(resize(spriteSheet.getSubimage(351, 91, 89, 24)), 72, 100));
|
||||||
|
textures.put("getReadyText", new Texture(resize(spriteSheet.getSubimage(295, 59, 92, 25)), 68, 180));
|
||||||
|
textures.put("gameOverText", new Texture(resize(spriteSheet.getSubimage(395, 59, 96, 21)), 62, 100));
|
||||||
|
textures.put("instructions", new Texture(resize(spriteSheet.getSubimage(292, 91, 57, 49)), 113, 300));
|
||||||
|
|
||||||
|
// SCORE IMAGES
|
||||||
|
|
||||||
|
// Large numbers
|
||||||
|
textures.put("score-0", new Texture(resize(spriteSheet.getSubimage(496, 60, 12, 18)), 0, 0));
|
||||||
|
textures.put("score-1", new Texture(resize(spriteSheet.getSubimage(136, 455, 8, 18)), 0, 0));
|
||||||
|
|
||||||
|
int score = 2;
|
||||||
|
for (int i = 292; i < 335; i += 14) {
|
||||||
|
textures.put("score-" + score, new Texture(resize(spriteSheet.getSubimage(i, 160, 12, 18)), 0, 0));
|
||||||
|
textures.put("score-" + (score + 4), new Texture(resize(spriteSheet.getSubimage(i, 184, 12, 18)), 0, 0));
|
||||||
|
score++;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Mini numbers
|
||||||
|
score = 0;
|
||||||
|
for (int i = 323; score < 10; i += 9) {
|
||||||
|
textures.put("mini-score-" + score, new Texture(resize(spriteSheet.getSubimage(138, i, 10, 7)), 0, 0));
|
||||||
|
score ++;
|
||||||
|
if (score % 2 == 0) { i += 8; }
|
||||||
|
}
|
||||||
|
|
||||||
|
// Medals
|
||||||
|
textures.put("bronze", new Texture(resize(spriteSheet.getSubimage(112, 477, 22, 22)), 73, 285));
|
||||||
|
textures.put("silver", new Texture(resize(spriteSheet.getSubimage(112, 453, 22, 22)), 73, 285));
|
||||||
|
textures.put("gold", new Texture(resize(spriteSheet.getSubimage(121, 282, 22, 22)), 73, 285));
|
||||||
|
textures.put("platinum", new Texture(resize(spriteSheet.getSubimage(121, 258, 22, 22)), 73, 285));
|
||||||
|
|
||||||
|
// Other assets
|
||||||
|
textures.put("base", new Texture(resize(spriteSheet.getSubimage(292, 0, 168, 56)), 0, 521));
|
||||||
|
textures.put("scoreCard", new Texture(resize(spriteSheet.getSubimage(3, 259, 113, 57)), 40, 230));
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Resizes a BufferedImage
|
||||||
|
*
|
||||||
|
* @param image BufferedImage object
|
||||||
|
* @return New resized image
|
||||||
|
*/
|
||||||
|
private static BufferedImage resize (BufferedImage image) {
|
||||||
|
|
||||||
|
// New width and height
|
||||||
|
int newWidth = (int) (image.getWidth() * RESIZE_FACTOR);
|
||||||
|
int newHeight = (int) (image.getHeight() * RESIZE_FACTOR);
|
||||||
|
|
||||||
|
// Create new BufferedImage with updated width and height
|
||||||
|
BufferedImage resizedImage = new BufferedImage(newWidth, newHeight, BufferedImage.TYPE_INT_ARGB);
|
||||||
|
Graphics2D g = resizedImage.createGraphics();
|
||||||
|
g.drawImage(image, 0, 0, newWidth, newHeight, null);
|
||||||
|
g.dispose();
|
||||||
|
|
||||||
|
return resizedImage;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Public getter method for Textures HashMap
|
||||||
|
*
|
||||||
|
* @return Texture
|
||||||
|
*/
|
||||||
|
public HashMap<String, Texture> getGameTextures () {
|
||||||
|
return textures;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,57 @@
|
|||||||
|
package com.example.flappybird; /**
|
||||||
|
* Texture.java
|
||||||
|
* Stores data for game textures
|
||||||
|
*
|
||||||
|
* @author Paul Krishnamurthy
|
||||||
|
*/
|
||||||
|
|
||||||
|
import java.awt.image.BufferedImage;
|
||||||
|
import java.awt.Rectangle;
|
||||||
|
|
||||||
|
public class Texture {
|
||||||
|
|
||||||
|
// Image attributes
|
||||||
|
private BufferedImage image;
|
||||||
|
private int x, y, width, height;
|
||||||
|
private Rectangle rect;
|
||||||
|
|
||||||
|
|
||||||
|
public Texture (BufferedImage image, int x, int y) {
|
||||||
|
this.image = image;
|
||||||
|
this.x = x;
|
||||||
|
this.y = y;
|
||||||
|
this.width = image.getWidth();
|
||||||
|
this.height = image.getHeight();
|
||||||
|
this.rect = new Rectangle(x, y, width, height);
|
||||||
|
}
|
||||||
|
|
||||||
|
////////////////////////////////////////////////
|
||||||
|
// Public getter methods for image attributes //
|
||||||
|
////////////////////////////////////////////////
|
||||||
|
|
||||||
|
public BufferedImage getImage () {
|
||||||
|
return image;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getX () {
|
||||||
|
return x;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getY () {
|
||||||
|
return y;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getWidth () {
|
||||||
|
return width;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getHeight () {
|
||||||
|
return height;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Rectangle getRect () {
|
||||||
|
return rect;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
3
refactoring/flappy-bird/src/main/java/module-info.java
Normal file
3
refactoring/flappy-bird/src/main/java/module-info.java
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
module com.example.flappybirdrefactoring {
|
||||||
|
requires java.desktop;
|
||||||
|
}
|
@ -0,0 +1 @@
|
|||||||
|
2
|
Binary file not shown.
BIN
refactoring/flappy-bird/src/main/resources/res/img/icon.png
Normal file
BIN
refactoring/flappy-bird/src/main/resources/res/img/icon.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 32 KiB |
Binary file not shown.
After Width: | Height: | Size: 40 KiB |
BIN
refactoring/flappy-bird/src/main/resources/res/sound/hit.wav
Normal file
BIN
refactoring/flappy-bird/src/main/resources/res/sound/hit.wav
Normal file
Binary file not shown.
BIN
refactoring/flappy-bird/src/main/resources/res/sound/jump.wav
Normal file
BIN
refactoring/flappy-bird/src/main/resources/res/sound/jump.wav
Normal file
Binary file not shown.
BIN
refactoring/flappy-bird/src/main/resources/res/sound/point.wav
Normal file
BIN
refactoring/flappy-bird/src/main/resources/res/sound/point.wav
Normal file
Binary file not shown.
6
testing/.idea/encodings.xml
Normal file
6
testing/.idea/encodings.xml
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="Encoding">
|
||||||
|
<file url="file://$PROJECT_DIR$/AufgabeUserRegistration/crash-8aa38ce6c46a280b6f52662a14c7ff005082d353" charset="US-ASCII" />
|
||||||
|
</component>
|
||||||
|
</project>
|
@ -5,33 +5,24 @@
|
|||||||
</component>
|
</component>
|
||||||
<component name="ChangeListManager">
|
<component name="ChangeListManager">
|
||||||
<list default="true" id="8b58daba-b979-4e25-9211-ae1b5daed24c" name="Changes" comment="">
|
<list default="true" id="8b58daba-b979-4e25-9211-ae1b5daed24c" name="Changes" comment="">
|
||||||
<change afterPath="$PROJECT_DIR$/.idea/libraries/JAZZER.xml" afterDir="false" />
|
<change afterPath="$PROJECT_DIR$/../gradle/.idea/.gitignore" afterDir="false" />
|
||||||
<change afterPath="$PROJECT_DIR$/.idea/libraries/example_junit.xml" afterDir="false" />
|
<change afterPath="$PROJECT_DIR$/../gradle/.idea/gradle.iml" afterDir="false" />
|
||||||
<change afterPath="$PROJECT_DIR$/.idea/libraries/example_junit2.xml" afterDir="false" />
|
<change afterPath="$PROJECT_DIR$/../gradle/.idea/misc.xml" afterDir="false" />
|
||||||
<change afterPath="$PROJECT_DIR$/.idea/libraries/example_unit_jazzer.xml" afterDir="false" />
|
<change afterPath="$PROJECT_DIR$/../gradle/.idea/modules.xml" afterDir="false" />
|
||||||
<change afterPath="$PROJECT_DIR$/.idea/libraries/example_unit_jazzer2.xml" afterDir="false" />
|
<change afterPath="$PROJECT_DIR$/../gradle/.idea/vcs.xml" afterDir="false" />
|
||||||
<change afterPath="$PROJECT_DIR$/.idea/libraries/jars.xml" afterDir="false" />
|
<change afterPath="$PROJECT_DIR$/../gradle/uebung-01/build.gradle" afterDir="false" />
|
||||||
<change afterPath="$PROJECT_DIR$/.idea/libraries/jazzer_standalone.xml" afterDir="false" />
|
<change afterPath="$PROJECT_DIR$/../gradle/uebung-01/code.txt" afterDir="false" />
|
||||||
<change afterPath="$PROJECT_DIR$/.idea/misc.xml" afterDir="false" />
|
<change afterPath="$PROJECT_DIR$/../gradle/uebung-02/build.gradle" afterDir="false" />
|
||||||
<change afterPath="$PROJECT_DIR$/.idea/modules.xml" afterDir="false" />
|
<change afterPath="$PROJECT_DIR$/.idea/encodings.xml" afterDir="false" />
|
||||||
<change afterPath="$PROJECT_DIR$/.idea/vcs.xml" afterDir="false" />
|
<change afterPath="$PROJECT_DIR$/out/production/testing/fuzz.bat" afterDir="false" />
|
||||||
<change afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
|
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
|
||||||
<change afterPath="$PROJECT_DIR$/AufgabeEmailMatcher/EmailMatcher.class" afterDir="false" />
|
<change beforePath="$PROJECT_DIR$/AufgabeEmailMatcher/EmailMatcher.class" beforeDir="false" />
|
||||||
<change afterPath="$PROJECT_DIR$/AufgabeEmailMatcher/EmailMatcher.java" afterDir="false" />
|
<change beforePath="$PROJECT_DIR$/AufgabeEmailMatcher/EmailMatcher.java" beforeDir="false" afterPath="$PROJECT_DIR$/AufgabeEmailMatcher/EmailMatcher.java" afterDir="false" />
|
||||||
<change afterPath="$PROJECT_DIR$/AufgabeEmailMatcher/EmailMatcherFuzzTest.class" afterDir="false" />
|
<change beforePath="$PROJECT_DIR$/AufgabeEmailMatcher/EmailMatcherFuzzTest.class" beforeDir="false" />
|
||||||
<change afterPath="$PROJECT_DIR$/AufgabeEmailMatcher/EmailMatcherFuzzTest.java" afterDir="false" />
|
<change beforePath="$PROJECT_DIR$/AufgabeEmailMatcher/EmailMatcherFuzzTest.java" beforeDir="false" afterPath="$PROJECT_DIR$/AufgabeEmailMatcher/EmailMatcherFuzzTest.java" afterDir="false" />
|
||||||
<change afterPath="$PROJECT_DIR$/AufgabeEmailMatcher/ExampleMatcher.class" afterDir="false" />
|
<change beforePath="$PROJECT_DIR$/AufgabeEmailMatcher/ExampleMatcher.class" beforeDir="false" />
|
||||||
<change afterPath="$PROJECT_DIR$/AufgabeEmailMatcher/ExampleMatcher.java" afterDir="false" />
|
<change beforePath="$PROJECT_DIR$/AufgabeUserRegistration/EmailMatcher.java" beforeDir="false" afterPath="$PROJECT_DIR$/AufgabeUserRegistration/EmailMatcher.java" afterDir="false" />
|
||||||
<change afterPath="$PROJECT_DIR$/AufgabeEmailMatcher/fuzz.bat" afterDir="false" />
|
<change beforePath="$PROJECT_DIR$/testing.iml" beforeDir="false" afterPath="$PROJECT_DIR$/testing.iml" afterDir="false" />
|
||||||
<change afterPath="$PROJECT_DIR$/AufgabeUserRegistration/EmailMatcher.java" afterDir="false" />
|
|
||||||
<change afterPath="$PROJECT_DIR$/AufgabeUserRegistration/ExampleUserRegistration.java" afterDir="false" />
|
|
||||||
<change afterPath="$PROJECT_DIR$/AufgabeUserRegistration/UserRegistration.java" afterDir="false" />
|
|
||||||
<change afterPath="$PROJECT_DIR$/AufgabeUserRegistration/UserRegistrationFuzzTest.java" afterDir="false" />
|
|
||||||
<change afterPath="$PROJECT_DIR$/AufgabeUserRegistration/fuzz.bat" afterDir="false" />
|
|
||||||
<change afterPath="$PROJECT_DIR$/jars/jazzer-junit-0.22.1.jar" afterDir="false" />
|
|
||||||
<change afterPath="$PROJECT_DIR$/jars/jazzer_standalone.jar" afterDir="false" />
|
|
||||||
<change afterPath="$PROJECT_DIR$/jars/junit5-4.6.14.jar" afterDir="false" />
|
|
||||||
<change afterPath="$PROJECT_DIR$/testing.iml" afterDir="false" />
|
|
||||||
</list>
|
</list>
|
||||||
<option name="SHOW_DIALOG" value="false" />
|
<option name="SHOW_DIALOG" value="false" />
|
||||||
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
||||||
@ -48,39 +39,47 @@
|
|||||||
<component name="Git.Settings">
|
<component name="Git.Settings">
|
||||||
<option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$/.." />
|
<option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$/.." />
|
||||||
</component>
|
</component>
|
||||||
<component name="ProjectColorInfo"><![CDATA[{
|
<component name="ProjectColorInfo">{
|
||||||
"associatedIndex": 1
|
"associatedIndex": 1
|
||||||
}]]></component>
|
}</component>
|
||||||
<component name="ProjectId" id="2o7Ha53qsIzLXvN7m9IjC7BvDQt" />
|
<component name="ProjectId" id="2o7Ha53qsIzLXvN7m9IjC7BvDQt" />
|
||||||
<component name="ProjectViewState">
|
<component name="ProjectViewState">
|
||||||
<option name="hideEmptyMiddlePackages" value="true" />
|
<option name="hideEmptyMiddlePackages" value="true" />
|
||||||
<option name="showLibraryContents" value="true" />
|
<option name="showLibraryContents" value="true" />
|
||||||
</component>
|
</component>
|
||||||
<component name="PropertiesComponent"><![CDATA[{
|
<component name="PropertiesComponent">{
|
||||||
"keyToString": {
|
"keyToString": {
|
||||||
"Batch.fuzz.executor": "Run",
|
"Batch.fuzz.executor": "Run",
|
||||||
"RunOnceActivity.ShowReadmeOnStart": "true",
|
"Downloaded.Files.Path.Enabled": "false",
|
||||||
"SHARE_PROJECT_CONFIGURATION_FILES": "true",
|
"Repository.Attach.Annotations": "false",
|
||||||
"git-widget-placeholder": "main",
|
"Repository.Attach.JavaDocs": "false",
|
||||||
"kotlin-language-version-configured": "true",
|
"Repository.Attach.Sources": "false",
|
||||||
"last_opened_file_path": "C:/Users/Jan-Niclas Loosen/Documents/Projekte/softwaretechnik_II/testing/jars",
|
"RunOnceActivity.ShowReadmeOnStart": "true",
|
||||||
"node.js.detected.package.eslint": "true",
|
"SHARE_PROJECT_CONFIGURATION_FILES": "true",
|
||||||
"node.js.detected.package.tslint": "true",
|
"git-widget-placeholder": "main",
|
||||||
"node.js.selected.package.eslint": "(autodetect)",
|
"kotlin-language-version-configured": "true",
|
||||||
"node.js.selected.package.tslint": "(autodetect)",
|
"last_opened_file_path": "C:/Users/Jan-Niclas Loosen/Documents/Projekte/softwaretechnik_II/testing",
|
||||||
"nodejs_package_manager_path": "npm",
|
"node.js.detected.package.eslint": "true",
|
||||||
"project.structure.last.edited": "Project",
|
"node.js.detected.package.tslint": "true",
|
||||||
"project.structure.proportion": "0.0",
|
"node.js.selected.package.eslint": "(autodetect)",
|
||||||
"project.structure.side.proportion": "0.0",
|
"node.js.selected.package.tslint": "(autodetect)",
|
||||||
"vue.rearranger.settings.migration": "true"
|
"nodejs_package_manager_path": "npm",
|
||||||
|
"project.structure.last.edited": "Project",
|
||||||
|
"project.structure.proportion": "0.0",
|
||||||
|
"project.structure.side.proportion": "0.0",
|
||||||
|
"vue.rearranger.settings.migration": "true"
|
||||||
}
|
}
|
||||||
}]]></component>
|
}</component>
|
||||||
<component name="RecentsManager">
|
<component name="RecentsManager">
|
||||||
<key name="CopyFile.RECENT_KEYS">
|
<key name="CopyFile.RECENT_KEYS">
|
||||||
<recent name="C:\Users\Jan-Niclas Loosen\Documents\Projekte\softwaretechnik_II\testing\jars" />
|
<recent name="C:\Users\Jan-Niclas Loosen\Documents\Projekte\softwaretechnik_II\testing\jars" />
|
||||||
<recent name="C:\Users\Jan-Niclas Loosen\Documents\Projekte\softwaretechnik_II\testing\AufgabeEmailMatcher" />
|
<recent name="C:\Users\Jan-Niclas Loosen\Documents\Projekte\softwaretechnik_II\testing\AufgabeEmailMatcher" />
|
||||||
<recent name="C:\Users\Jan-Niclas Loosen\Documents\Projekte\softwaretechnik_II\testing\AufgabeUserRegistration" />
|
<recent name="C:\Users\Jan-Niclas Loosen\Documents\Projekte\softwaretechnik_II\testing\AufgabeUserRegistration" />
|
||||||
</key>
|
</key>
|
||||||
|
<key name="MoveFile.RECENT_KEYS">
|
||||||
|
<recent name="C:\Users\Jan-Niclas Loosen\Documents\Projekte\softwaretechnik_II\testing\AufgabeEmailMatcher\reports" />
|
||||||
|
<recent name="C:\Users\Jan-Niclas Loosen\Documents\Projekte\softwaretechnik_II\testing\AufgabeEmailMatcher\" />
|
||||||
|
</key>
|
||||||
<key name="CopyClassDialog.RECENTS_KEY">
|
<key name="CopyClassDialog.RECENTS_KEY">
|
||||||
<recent name="" />
|
<recent name="" />
|
||||||
</key>
|
</key>
|
||||||
@ -89,7 +88,7 @@
|
|||||||
<configuration name="fuzz" type="BatchConfigurationType" factoryName="Batch" temporary="true">
|
<configuration name="fuzz" type="BatchConfigurationType" factoryName="Batch" temporary="true">
|
||||||
<module name="testing" />
|
<module name="testing" />
|
||||||
<option name="INTERPRETER_OPTIONS" value="" />
|
<option name="INTERPRETER_OPTIONS" value="" />
|
||||||
<option name="WORKING_DIRECTORY" value="C:\Users\Jan-Niclas Loosen\Documents\Projekte\softwaretechnik_II\testing\AufgabeEmailMatcher" />
|
<option name="WORKING_DIRECTORY" value="./AufgabeEmailMatcher" />
|
||||||
<option name="PARENT_ENVS" value="true" />
|
<option name="PARENT_ENVS" value="true" />
|
||||||
<option name="SCRIPT_NAME" value="fuzz.bat" />
|
<option name="SCRIPT_NAME" value="fuzz.bat" />
|
||||||
<option name="PARAMETERS" value="" />
|
<option name="PARAMETERS" value="" />
|
||||||
@ -120,6 +119,10 @@
|
|||||||
<option name="presentableId" value="Default" />
|
<option name="presentableId" value="Default" />
|
||||||
<updated>1730213753923</updated>
|
<updated>1730213753923</updated>
|
||||||
<workItem from="1730213754948" duration="5609000" />
|
<workItem from="1730213754948" duration="5609000" />
|
||||||
|
<workItem from="1730800417513" duration="6972000" />
|
||||||
|
<workItem from="1730814043728" duration="248000" />
|
||||||
|
<workItem from="1730821844612" duration="4675000" />
|
||||||
|
<workItem from="1730832348993" duration="331000" />
|
||||||
</task>
|
</task>
|
||||||
<servers />
|
<servers />
|
||||||
</component>
|
</component>
|
||||||
|
Binary file not shown.
Binary file not shown.
@ -1,5 +1,7 @@
|
|||||||
import com.code_intelligence.jazzer.api.FuzzedDataProvider;
|
import com.code_intelligence.jazzer.api.FuzzedDataProvider;
|
||||||
import com.code_intelligence.jazzer.junit.FuzzTest;
|
import com.code_intelligence.jazzer.junit.FuzzTest;
|
||||||
|
import org.junit.Assert;
|
||||||
|
import org.junit.Test;
|
||||||
|
|
||||||
import java.security.InvalidParameterException;
|
import java.security.InvalidParameterException;
|
||||||
|
|
||||||
@ -8,6 +10,7 @@ public class EmailMatcherFuzzTest {
|
|||||||
public static void fuzzerTestOneInput(FuzzedDataProvider data) {
|
public static void fuzzerTestOneInput(FuzzedDataProvider data) {
|
||||||
String email = data.consumeString(100);
|
String email = data.consumeString(100);
|
||||||
if(EmailMatcher.isValidEmail(email)) {
|
if(EmailMatcher.isValidEmail(email)) {
|
||||||
|
System.out.println("Valid email address: " + email);
|
||||||
throw new InvalidParameterException("Valid email found!");
|
throw new InvalidParameterException("Valid email found!");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Binary file not shown.
@ -0,0 +1,28 @@
|
|||||||
|
import java.lang.reflect.InvocationTargetException;
|
||||||
|
import java.lang.reflect.Method;
|
||||||
|
|
||||||
|
public class Crash_0c8760ec829043093b19b0dd6d6bad3e9c5b2a34 {
|
||||||
|
static final String base64Bytes = String.join("", "rO0ABXNyABNqYXZhLnV0aWwuQXJyYXlMaXN0eIHSHZnHYZ0DAAFJAARzaXpleHAAAAABdwQAAAABdABkVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVLS1Aei5VVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVXg=");
|
||||||
|
|
||||||
|
public static void main(String[] args) throws Throwable {
|
||||||
|
Crash_0c8760ec829043093b19b0dd6d6bad3e9c5b2a34.class.getClassLoader().setDefaultAssertionStatus(true);
|
||||||
|
try {
|
||||||
|
Method fuzzerInitialize = EmailMatcherFuzzTest.class.getMethod("fuzzerInitialize");
|
||||||
|
fuzzerInitialize.invoke(null);
|
||||||
|
} catch (NoSuchMethodException ignored) {
|
||||||
|
try {
|
||||||
|
Method fuzzerInitialize = EmailMatcherFuzzTest.class.getMethod("fuzzerInitialize", String[].class);
|
||||||
|
fuzzerInitialize.invoke(null, (Object) args);
|
||||||
|
} catch (NoSuchMethodException ignored1) {
|
||||||
|
} catch (IllegalAccessException | InvocationTargetException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
System.exit(1);
|
||||||
|
}
|
||||||
|
} catch (IllegalAccessException | InvocationTargetException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
System.exit(1);
|
||||||
|
}
|
||||||
|
com.code_intelligence.jazzer.api.CannedFuzzedDataProvider input = new com.code_intelligence.jazzer.api.CannedFuzzedDataProvider(base64Bytes);
|
||||||
|
EmailMatcherFuzzTest.fuzzerTestOneInput(input);
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,28 @@
|
|||||||
|
import java.lang.reflect.InvocationTargetException;
|
||||||
|
import java.lang.reflect.Method;
|
||||||
|
|
||||||
|
public class Crash_1023597a010e233f09ae0f371f507df5760ed654 {
|
||||||
|
static final String base64Bytes = String.join("", "rO0ABXNyABNqYXZhLnV0aWwuQXJyYXlMaXN0eIHSHZnHYZ0DAAFJAARzaXpleHAAAAABdwQAAAABdABkV1dXV1dXV1dXV1dXV1dXV1dXV1dXV1dKQFdXV1dXV1dXV1dXV1dXV1dXV1dXV1dXV1dXV1dXV1dXV1dXV1dXV1dXV1dXV1dXV1dXV1cyLldXV1dXV1dXV1dXV1dXV1dXV1dXV3g=");
|
||||||
|
|
||||||
|
public static void main(String[] args) throws Throwable {
|
||||||
|
Crash_1023597a010e233f09ae0f371f507df5760ed654.class.getClassLoader().setDefaultAssertionStatus(true);
|
||||||
|
try {
|
||||||
|
Method fuzzerInitialize = EmailMatcherFuzzTest.class.getMethod("fuzzerInitialize");
|
||||||
|
fuzzerInitialize.invoke(null);
|
||||||
|
} catch (NoSuchMethodException ignored) {
|
||||||
|
try {
|
||||||
|
Method fuzzerInitialize = EmailMatcherFuzzTest.class.getMethod("fuzzerInitialize", String[].class);
|
||||||
|
fuzzerInitialize.invoke(null, (Object) args);
|
||||||
|
} catch (NoSuchMethodException ignored1) {
|
||||||
|
} catch (IllegalAccessException | InvocationTargetException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
System.exit(1);
|
||||||
|
}
|
||||||
|
} catch (IllegalAccessException | InvocationTargetException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
System.exit(1);
|
||||||
|
}
|
||||||
|
com.code_intelligence.jazzer.api.CannedFuzzedDataProvider input = new com.code_intelligence.jazzer.api.CannedFuzzedDataProvider(base64Bytes);
|
||||||
|
EmailMatcherFuzzTest.fuzzerTestOneInput(input);
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,28 @@
|
|||||||
|
import java.lang.reflect.InvocationTargetException;
|
||||||
|
import java.lang.reflect.Method;
|
||||||
|
|
||||||
|
public class Crash_143bd80f3cf030decbebd209621a090d46fb9be7 {
|
||||||
|
static final String base64Bytes = String.join("", "rO0ABXNyABNqYXZhLnV0aWwuQXJyYXlMaXN0eIHSHZnHYZ0DAAFJAARzaXpleHAAAAABdwQAAAABdABkY2NjY2NjY2NjY2NjY2NjY2NjY2NjY2NjY2NjY2NjY2NjY2NjY2NjUUBjY2NjY2NjY2NjcnJycnJycnJyci5jY2NjY2NjY2NjY2NjY2NjY2NjY2NjY2NjY2NjY2NjY2NjY2NjY3g=");
|
||||||
|
|
||||||
|
public static void main(String[] args) throws Throwable {
|
||||||
|
Crash_143bd80f3cf030decbebd209621a090d46fb9be7.class.getClassLoader().setDefaultAssertionStatus(true);
|
||||||
|
try {
|
||||||
|
Method fuzzerInitialize = EmailMatcherFuzzTest.class.getMethod("fuzzerInitialize");
|
||||||
|
fuzzerInitialize.invoke(null);
|
||||||
|
} catch (NoSuchMethodException ignored) {
|
||||||
|
try {
|
||||||
|
Method fuzzerInitialize = EmailMatcherFuzzTest.class.getMethod("fuzzerInitialize", String[].class);
|
||||||
|
fuzzerInitialize.invoke(null, (Object) args);
|
||||||
|
} catch (NoSuchMethodException ignored1) {
|
||||||
|
} catch (IllegalAccessException | InvocationTargetException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
System.exit(1);
|
||||||
|
}
|
||||||
|
} catch (IllegalAccessException | InvocationTargetException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
System.exit(1);
|
||||||
|
}
|
||||||
|
com.code_intelligence.jazzer.api.CannedFuzzedDataProvider input = new com.code_intelligence.jazzer.api.CannedFuzzedDataProvider(base64Bytes);
|
||||||
|
EmailMatcherFuzzTest.fuzzerTestOneInput(input);
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,28 @@
|
|||||||
|
import java.lang.reflect.InvocationTargetException;
|
||||||
|
import java.lang.reflect.Method;
|
||||||
|
|
||||||
|
public class Crash_20cb65ffbb219a01fbc1341e2d38a57e3d0a550f {
|
||||||
|
static final String base64Bytes = String.join("", "rO0ABXNyABNqYXZhLnV0aWwuQXJyYXlMaXN0eIHSHZnHYZ0DAAFJAARzaXpleHAAAAABdwQAAAABdABkbm5ubm5ubm5ubkBCQkJCQi5CQkJCQkJCQkJCQkJCQkJCQkJCQkJCQkJCQkJCQkJCQkJCQkJCQkJCQkJCQkJCQkJCQkJCQkJCQkJCQkJCQkJCQkJCQkJCQkJCQkJCQkJCQkJCQng=");
|
||||||
|
|
||||||
|
public static void main(String[] args) throws Throwable {
|
||||||
|
Crash_20cb65ffbb219a01fbc1341e2d38a57e3d0a550f.class.getClassLoader().setDefaultAssertionStatus(true);
|
||||||
|
try {
|
||||||
|
Method fuzzerInitialize = EmailMatcherFuzzTest.class.getMethod("fuzzerInitialize");
|
||||||
|
fuzzerInitialize.invoke(null);
|
||||||
|
} catch (NoSuchMethodException ignored) {
|
||||||
|
try {
|
||||||
|
Method fuzzerInitialize = EmailMatcherFuzzTest.class.getMethod("fuzzerInitialize", String[].class);
|
||||||
|
fuzzerInitialize.invoke(null, (Object) args);
|
||||||
|
} catch (NoSuchMethodException ignored1) {
|
||||||
|
} catch (IllegalAccessException | InvocationTargetException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
System.exit(1);
|
||||||
|
}
|
||||||
|
} catch (IllegalAccessException | InvocationTargetException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
System.exit(1);
|
||||||
|
}
|
||||||
|
com.code_intelligence.jazzer.api.CannedFuzzedDataProvider input = new com.code_intelligence.jazzer.api.CannedFuzzedDataProvider(base64Bytes);
|
||||||
|
EmailMatcherFuzzTest.fuzzerTestOneInput(input);
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,28 @@
|
|||||||
|
import java.lang.reflect.InvocationTargetException;
|
||||||
|
import java.lang.reflect.Method;
|
||||||
|
|
||||||
|
public class Crash_4a070dbfa61328b644f6724be00f2897c80f986c {
|
||||||
|
static final String base64Bytes = String.join("", "rO0ABXNyABNqYXZhLnV0aWwuQXJyYXlMaXN0eIHSHZnHYZ0DAAFJAARzaXpleHAAAAABdwQAAAABdABhenR0dHR0dHR0dHR0dHR0dHR0dHR0dHR0dHR0dHR0dHR0dHR0dHR0dHR0dHR0dHR0dHR0dHR0dHR0dHR0dHR0dHR0dHR0dHlAMi50dHR0dHR0dHR0dHR0dHR0dHR0dHR0dHg=");
|
||||||
|
|
||||||
|
public static void main(String[] args) throws Throwable {
|
||||||
|
Crash_4a070dbfa61328b644f6724be00f2897c80f986c.class.getClassLoader().setDefaultAssertionStatus(true);
|
||||||
|
try {
|
||||||
|
Method fuzzerInitialize = EmailMatcherFuzzTest.class.getMethod("fuzzerInitialize");
|
||||||
|
fuzzerInitialize.invoke(null);
|
||||||
|
} catch (NoSuchMethodException ignored) {
|
||||||
|
try {
|
||||||
|
Method fuzzerInitialize = EmailMatcherFuzzTest.class.getMethod("fuzzerInitialize", String[].class);
|
||||||
|
fuzzerInitialize.invoke(null, (Object) args);
|
||||||
|
} catch (NoSuchMethodException ignored1) {
|
||||||
|
} catch (IllegalAccessException | InvocationTargetException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
System.exit(1);
|
||||||
|
}
|
||||||
|
} catch (IllegalAccessException | InvocationTargetException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
System.exit(1);
|
||||||
|
}
|
||||||
|
com.code_intelligence.jazzer.api.CannedFuzzedDataProvider input = new com.code_intelligence.jazzer.api.CannedFuzzedDataProvider(base64Bytes);
|
||||||
|
EmailMatcherFuzzTest.fuzzerTestOneInput(input);
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,28 @@
|
|||||||
|
import java.lang.reflect.InvocationTargetException;
|
||||||
|
import java.lang.reflect.Method;
|
||||||
|
|
||||||
|
public class Crash_60c239837ee2bcee5ad3a003af539846059367bc {
|
||||||
|
static final String base64Bytes = String.join("", "rO0ABXNyABNqYXZhLnV0aWwuQXJyYXlMaXN0eIHSHZnHYZ0DAAFJAARzaXpleHAAAAABdwQAAAABdABkdXV1dXV1dXV1dXV1LUB1dXV1dS51dXV1dXV1dXV1dXV1dXV1dXV1dXV1dXV1dXV1dXV1dXV1dXV1dXV1dXV1dXV1dXV1dXV1dXV1dXV1dXV1dXV1dXV1dXV1dXV1dXV1dXV1dXg=");
|
||||||
|
|
||||||
|
public static void main(String[] args) throws Throwable {
|
||||||
|
Crash_60c239837ee2bcee5ad3a003af539846059367bc.class.getClassLoader().setDefaultAssertionStatus(true);
|
||||||
|
try {
|
||||||
|
Method fuzzerInitialize = EmailMatcherFuzzTest.class.getMethod("fuzzerInitialize");
|
||||||
|
fuzzerInitialize.invoke(null);
|
||||||
|
} catch (NoSuchMethodException ignored) {
|
||||||
|
try {
|
||||||
|
Method fuzzerInitialize = EmailMatcherFuzzTest.class.getMethod("fuzzerInitialize", String[].class);
|
||||||
|
fuzzerInitialize.invoke(null, (Object) args);
|
||||||
|
} catch (NoSuchMethodException ignored1) {
|
||||||
|
} catch (IllegalAccessException | InvocationTargetException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
System.exit(1);
|
||||||
|
}
|
||||||
|
} catch (IllegalAccessException | InvocationTargetException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
System.exit(1);
|
||||||
|
}
|
||||||
|
com.code_intelligence.jazzer.api.CannedFuzzedDataProvider input = new com.code_intelligence.jazzer.api.CannedFuzzedDataProvider(base64Bytes);
|
||||||
|
EmailMatcherFuzzTest.fuzzerTestOneInput(input);
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,28 @@
|
|||||||
|
import java.lang.reflect.InvocationTargetException;
|
||||||
|
import java.lang.reflect.Method;
|
||||||
|
|
||||||
|
public class Crash_66d46e7fbde585cc83e2bbe391f0c72a5a25f80e {
|
||||||
|
static final String base64Bytes = String.join("", "rO0ABXNyABNqYXZhLnV0aWwuQXJyYXlMaXN0eIHSHZnHYZ0DAAFJAARzaXpleHAAAAABdwQAAAABdABkdXV1dXV1dXV1dXV1dXV1dXV1dXV1dXV1dXV1dXV1dXV1dXV1dXV1dXV1dXV1dXV1dXV1dXV1dXV1dXV1dXV1dXV1dXV1dXV1dXV1dXV1dXV1dTU1dkA1QTU1NS51dXV1dXV1dXg=");
|
||||||
|
|
||||||
|
public static void main(String[] args) throws Throwable {
|
||||||
|
Crash_66d46e7fbde585cc83e2bbe391f0c72a5a25f80e.class.getClassLoader().setDefaultAssertionStatus(true);
|
||||||
|
try {
|
||||||
|
Method fuzzerInitialize = EmailMatcherFuzzTest.class.getMethod("fuzzerInitialize");
|
||||||
|
fuzzerInitialize.invoke(null);
|
||||||
|
} catch (NoSuchMethodException ignored) {
|
||||||
|
try {
|
||||||
|
Method fuzzerInitialize = EmailMatcherFuzzTest.class.getMethod("fuzzerInitialize", String[].class);
|
||||||
|
fuzzerInitialize.invoke(null, (Object) args);
|
||||||
|
} catch (NoSuchMethodException ignored1) {
|
||||||
|
} catch (IllegalAccessException | InvocationTargetException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
System.exit(1);
|
||||||
|
}
|
||||||
|
} catch (IllegalAccessException | InvocationTargetException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
System.exit(1);
|
||||||
|
}
|
||||||
|
com.code_intelligence.jazzer.api.CannedFuzzedDataProvider input = new com.code_intelligence.jazzer.api.CannedFuzzedDataProvider(base64Bytes);
|
||||||
|
EmailMatcherFuzzTest.fuzzerTestOneInput(input);
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,28 @@
|
|||||||
|
import java.lang.reflect.InvocationTargetException;
|
||||||
|
import java.lang.reflect.Method;
|
||||||
|
|
||||||
|
public class Crash_8758e78756a367f9e484d8186f77ef69bdd0c29a {
|
||||||
|
static final String base64Bytes = String.join("", "rO0ABXNyABNqYXZhLnV0aWwuQXJyYXlMaXN0eIHSHZnHYZ0DAAFJAARzaXpleHAAAAABdwQAAAABdAA/KytVVVVVVVVVVVVVZ0BLLlVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVeA==");
|
||||||
|
|
||||||
|
public static void main(String[] args) throws Throwable {
|
||||||
|
Crash_8758e78756a367f9e484d8186f77ef69bdd0c29a.class.getClassLoader().setDefaultAssertionStatus(true);
|
||||||
|
try {
|
||||||
|
Method fuzzerInitialize = EmailMatcherFuzzTest.class.getMethod("fuzzerInitialize");
|
||||||
|
fuzzerInitialize.invoke(null);
|
||||||
|
} catch (NoSuchMethodException ignored) {
|
||||||
|
try {
|
||||||
|
Method fuzzerInitialize = EmailMatcherFuzzTest.class.getMethod("fuzzerInitialize", String[].class);
|
||||||
|
fuzzerInitialize.invoke(null, (Object) args);
|
||||||
|
} catch (NoSuchMethodException ignored1) {
|
||||||
|
} catch (IllegalAccessException | InvocationTargetException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
System.exit(1);
|
||||||
|
}
|
||||||
|
} catch (IllegalAccessException | InvocationTargetException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
System.exit(1);
|
||||||
|
}
|
||||||
|
com.code_intelligence.jazzer.api.CannedFuzzedDataProvider input = new com.code_intelligence.jazzer.api.CannedFuzzedDataProvider(base64Bytes);
|
||||||
|
EmailMatcherFuzzTest.fuzzerTestOneInput(input);
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,28 @@
|
|||||||
|
import java.lang.reflect.InvocationTargetException;
|
||||||
|
import java.lang.reflect.Method;
|
||||||
|
|
||||||
|
public class Crash_8f4b5c6ab0c550df8d506b36c7a2c8c3c745a8da {
|
||||||
|
static final String base64Bytes = String.join("", "rO0ABXNyABNqYXZhLnV0aWwuQXJyYXlMaXN0eIHSHZnHYZ0DAAFJAARzaXpleHAAAAABdwQAAAABdABKUVFRUVFRUVFRUVFRUVFRUVFRUVFRUVFRUVFRUVFRUVFRUVFRUXhfeF9AeHguUVFRUVFRUVFRUVFRUVFRUVFRUVFRUVFRUVFRUVF4");
|
||||||
|
|
||||||
|
public static void main(String[] args) throws Throwable {
|
||||||
|
Crash_8f4b5c6ab0c550df8d506b36c7a2c8c3c745a8da.class.getClassLoader().setDefaultAssertionStatus(true);
|
||||||
|
try {
|
||||||
|
Method fuzzerInitialize = EmailMatcherFuzzTest.class.getMethod("fuzzerInitialize");
|
||||||
|
fuzzerInitialize.invoke(null);
|
||||||
|
} catch (NoSuchMethodException ignored) {
|
||||||
|
try {
|
||||||
|
Method fuzzerInitialize = EmailMatcherFuzzTest.class.getMethod("fuzzerInitialize", String[].class);
|
||||||
|
fuzzerInitialize.invoke(null, (Object) args);
|
||||||
|
} catch (NoSuchMethodException ignored1) {
|
||||||
|
} catch (IllegalAccessException | InvocationTargetException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
System.exit(1);
|
||||||
|
}
|
||||||
|
} catch (IllegalAccessException | InvocationTargetException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
System.exit(1);
|
||||||
|
}
|
||||||
|
com.code_intelligence.jazzer.api.CannedFuzzedDataProvider input = new com.code_intelligence.jazzer.api.CannedFuzzedDataProvider(base64Bytes);
|
||||||
|
EmailMatcherFuzzTest.fuzzerTestOneInput(input);
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,28 @@
|
|||||||
|
import java.lang.reflect.InvocationTargetException;
|
||||||
|
import java.lang.reflect.Method;
|
||||||
|
|
||||||
|
public class Crash_a121217356a1146df4a44b5ed87088196ae276a3 {
|
||||||
|
static final String base64Bytes = String.join("", "rO0ABXNyABNqYXZhLnV0aWwuQXJyYXlMaXN0eIHSHZnHYZ0DAAFJAARzaXpleHAAAAABdwQAAAABdAAOLkBhYWFhLmFhYWFhYWF4");
|
||||||
|
|
||||||
|
public static void main(String[] args) throws Throwable {
|
||||||
|
Crash_a121217356a1146df4a44b5ed87088196ae276a3.class.getClassLoader().setDefaultAssertionStatus(true);
|
||||||
|
try {
|
||||||
|
Method fuzzerInitialize = EmailMatcherFuzzTest.class.getMethod("fuzzerInitialize");
|
||||||
|
fuzzerInitialize.invoke(null);
|
||||||
|
} catch (NoSuchMethodException ignored) {
|
||||||
|
try {
|
||||||
|
Method fuzzerInitialize = EmailMatcherFuzzTest.class.getMethod("fuzzerInitialize", String[].class);
|
||||||
|
fuzzerInitialize.invoke(null, (Object) args);
|
||||||
|
} catch (NoSuchMethodException ignored1) {
|
||||||
|
} catch (IllegalAccessException | InvocationTargetException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
System.exit(1);
|
||||||
|
}
|
||||||
|
} catch (IllegalAccessException | InvocationTargetException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
System.exit(1);
|
||||||
|
}
|
||||||
|
com.code_intelligence.jazzer.api.CannedFuzzedDataProvider input = new com.code_intelligence.jazzer.api.CannedFuzzedDataProvider(base64Bytes);
|
||||||
|
EmailMatcherFuzzTest.fuzzerTestOneInput(input);
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,28 @@
|
|||||||
|
import java.lang.reflect.InvocationTargetException;
|
||||||
|
import java.lang.reflect.Method;
|
||||||
|
|
||||||
|
public class Crash_c0c78c8c6f8468424cdf48dfd39a28e04e0ec416 {
|
||||||
|
static final String base64Bytes = String.join("", "rO0ABXNyABNqYXZhLnV0aWwuQXJyYXlMaXN0eIHSHZnHYZ0DAAFJAARzaXpleHAAAAABdwQAAAABdAAOeXl5eXlNQHkueXl5eU14");
|
||||||
|
|
||||||
|
public static void main(String[] args) throws Throwable {
|
||||||
|
Crash_c0c78c8c6f8468424cdf48dfd39a28e04e0ec416.class.getClassLoader().setDefaultAssertionStatus(true);
|
||||||
|
try {
|
||||||
|
Method fuzzerInitialize = EmailMatcherFuzzTest.class.getMethod("fuzzerInitialize");
|
||||||
|
fuzzerInitialize.invoke(null);
|
||||||
|
} catch (NoSuchMethodException ignored) {
|
||||||
|
try {
|
||||||
|
Method fuzzerInitialize = EmailMatcherFuzzTest.class.getMethod("fuzzerInitialize", String[].class);
|
||||||
|
fuzzerInitialize.invoke(null, (Object) args);
|
||||||
|
} catch (NoSuchMethodException ignored1) {
|
||||||
|
} catch (IllegalAccessException | InvocationTargetException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
System.exit(1);
|
||||||
|
}
|
||||||
|
} catch (IllegalAccessException | InvocationTargetException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
System.exit(1);
|
||||||
|
}
|
||||||
|
com.code_intelligence.jazzer.api.CannedFuzzedDataProvider input = new com.code_intelligence.jazzer.api.CannedFuzzedDataProvider(base64Bytes);
|
||||||
|
EmailMatcherFuzzTest.fuzzerTestOneInput(input);
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,28 @@
|
|||||||
|
import java.lang.reflect.InvocationTargetException;
|
||||||
|
import java.lang.reflect.Method;
|
||||||
|
|
||||||
|
public class Crash_c16113223e5edd851edc5f877c163edeeeea886c {
|
||||||
|
static final String base64Bytes = String.join("", "rO0ABXNyABNqYXZhLnV0aWwuQXJyYXlMaXN0eIHSHZnHYZ0DAAFJAARzaXpleHAAAAABdwQAAAABdAAPampqampqQGpqLmpqampqeA==");
|
||||||
|
|
||||||
|
public static void main(String[] args) throws Throwable {
|
||||||
|
Crash_c16113223e5edd851edc5f877c163edeeeea886c.class.getClassLoader().setDefaultAssertionStatus(true);
|
||||||
|
try {
|
||||||
|
Method fuzzerInitialize = EmailMatcherFuzzTest.class.getMethod("fuzzerInitialize");
|
||||||
|
fuzzerInitialize.invoke(null);
|
||||||
|
} catch (NoSuchMethodException ignored) {
|
||||||
|
try {
|
||||||
|
Method fuzzerInitialize = EmailMatcherFuzzTest.class.getMethod("fuzzerInitialize", String[].class);
|
||||||
|
fuzzerInitialize.invoke(null, (Object) args);
|
||||||
|
} catch (NoSuchMethodException ignored1) {
|
||||||
|
} catch (IllegalAccessException | InvocationTargetException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
System.exit(1);
|
||||||
|
}
|
||||||
|
} catch (IllegalAccessException | InvocationTargetException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
System.exit(1);
|
||||||
|
}
|
||||||
|
com.code_intelligence.jazzer.api.CannedFuzzedDataProvider input = new com.code_intelligence.jazzer.api.CannedFuzzedDataProvider(base64Bytes);
|
||||||
|
EmailMatcherFuzzTest.fuzzerTestOneInput(input);
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,28 @@
|
|||||||
|
import java.lang.reflect.InvocationTargetException;
|
||||||
|
import java.lang.reflect.Method;
|
||||||
|
|
||||||
|
public class Crash_c37aee0a0c6db682583e5afe00e6c1264ede4bbb {
|
||||||
|
static final String base64Bytes = String.join("", "rO0ABXNyABNqYXZhLnV0aWwuQXJyYXlMaXN0eIHSHZnHYZ0DAAFJAARzaXpleHAAAAABdwQAAAABdABkRERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERGK0A3Ny5ERERERERERERERERERERERERERERERHg=");
|
||||||
|
|
||||||
|
public static void main(String[] args) throws Throwable {
|
||||||
|
Crash_c37aee0a0c6db682583e5afe00e6c1264ede4bbb.class.getClassLoader().setDefaultAssertionStatus(true);
|
||||||
|
try {
|
||||||
|
Method fuzzerInitialize = EmailMatcherFuzzTest.class.getMethod("fuzzerInitialize");
|
||||||
|
fuzzerInitialize.invoke(null);
|
||||||
|
} catch (NoSuchMethodException ignored) {
|
||||||
|
try {
|
||||||
|
Method fuzzerInitialize = EmailMatcherFuzzTest.class.getMethod("fuzzerInitialize", String[].class);
|
||||||
|
fuzzerInitialize.invoke(null, (Object) args);
|
||||||
|
} catch (NoSuchMethodException ignored1) {
|
||||||
|
} catch (IllegalAccessException | InvocationTargetException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
System.exit(1);
|
||||||
|
}
|
||||||
|
} catch (IllegalAccessException | InvocationTargetException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
System.exit(1);
|
||||||
|
}
|
||||||
|
com.code_intelligence.jazzer.api.CannedFuzzedDataProvider input = new com.code_intelligence.jazzer.api.CannedFuzzedDataProvider(base64Bytes);
|
||||||
|
EmailMatcherFuzzTest.fuzzerTestOneInput(input);
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,28 @@
|
|||||||
|
import java.lang.reflect.InvocationTargetException;
|
||||||
|
import java.lang.reflect.Method;
|
||||||
|
|
||||||
|
public class Crash_c668afa6b6bf106dd2b56978e97b39fa671a8363 {
|
||||||
|
static final String base64Bytes = String.join("", "rO0ABXNyABNqYXZhLnV0aWwuQXJyYXlMaXN0eIHSHZnHYZ0DAAFJAARzaXpleHAAAAABdwQAAAABdABkRERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERFBQUFBQQFAuUERQUERERHg=");
|
||||||
|
|
||||||
|
public static void main(String[] args) throws Throwable {
|
||||||
|
Crash_c668afa6b6bf106dd2b56978e97b39fa671a8363.class.getClassLoader().setDefaultAssertionStatus(true);
|
||||||
|
try {
|
||||||
|
Method fuzzerInitialize = EmailMatcherFuzzTest.class.getMethod("fuzzerInitialize");
|
||||||
|
fuzzerInitialize.invoke(null);
|
||||||
|
} catch (NoSuchMethodException ignored) {
|
||||||
|
try {
|
||||||
|
Method fuzzerInitialize = EmailMatcherFuzzTest.class.getMethod("fuzzerInitialize", String[].class);
|
||||||
|
fuzzerInitialize.invoke(null, (Object) args);
|
||||||
|
} catch (NoSuchMethodException ignored1) {
|
||||||
|
} catch (IllegalAccessException | InvocationTargetException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
System.exit(1);
|
||||||
|
}
|
||||||
|
} catch (IllegalAccessException | InvocationTargetException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
System.exit(1);
|
||||||
|
}
|
||||||
|
com.code_intelligence.jazzer.api.CannedFuzzedDataProvider input = new com.code_intelligence.jazzer.api.CannedFuzzedDataProvider(base64Bytes);
|
||||||
|
EmailMatcherFuzzTest.fuzzerTestOneInput(input);
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1 @@
|
|||||||
|
UUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUU--@z.UUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUU]
|
@ -0,0 +1 @@
|
|||||||
|
WWWWWWWWWWWWWWWWWWWWWWWJ@WWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWW2.WWWWWWWWWWWWWWWWWWWWWWWWWWW2.WWWWWWWWWWWWWWWWWWWW
|
@ -0,0 +1 @@
|
|||||||
|
cccccccccccccccccccccccccccccccccccccccQ@ccccccccccrrrrrrrrrr.ccccccccccccccccccccccccccccccccccccccccccccccccc(
|
@ -0,0 +1 @@
|
|||||||
|
nnnnnnnnnn@BBBBB.BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB
|
@ -0,0 +1 @@
|
|||||||
|
zttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttty@2.ttttttttttttttttttttttt
|
@ -0,0 +1 @@
|
|||||||
|
uuuuuuuuuuuu-@uuuuu.uuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuu笈uuuuuuu
|
@ -0,0 +1 @@
|
|||||||
|
uuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuu55v@5A555.uuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuu
|
@ -0,0 +1 @@
|
|||||||
|
++UUUUUUUUUUg@K.UUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUU
|
@ -0,0 +1 @@
|
|||||||
|
QQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQx_x_@xx.QQQQQQQQQQQQQQQQQQQQQQQQQQQQQチ
|
@ -0,0 +1 @@
|
|||||||
|
.@aaaa.aaaaaaa
|
@ -0,0 +1 @@
|
|||||||
|
yyyyyM@y.yyyyMµ
|
@ -0,0 +1 @@
|
|||||||
|
jjjjjj@jj.jjjjj
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user