CCB Premier Import
This commit is contained in:
0
.metadata/.lock
Normal file
0
.metadata/.lock
Normal file
28
.metadata/.log
Normal file
28
.metadata/.log
Normal file
@@ -0,0 +1,28 @@
|
||||
!SESSION 2018-05-18 10:48:43.985 -----------------------------------------------
|
||||
eclipse.buildId=4.7.3.M20180330-0640
|
||||
java.version=1.8.0_171
|
||||
java.vendor=Oracle Corporation
|
||||
BootLoader constants: OS=win32, ARCH=x86_64, WS=win32, NL=fr_FR
|
||||
Framework arguments: -product org.eclipse.epp.package.java.product
|
||||
Command-line arguments: -os win32 -ws win32 -arch x86_64 -product org.eclipse.epp.package.java.product
|
||||
|
||||
!ENTRY org.eclipse.egit.ui 2 0 2018-05-18 10:49:48.484
|
||||
!MESSAGE Warning: The environment variable HOME is not set. The following directory will be used to store the Git
|
||||
user global configuration and to define the default location to store repositories: 'C:\Users\chris'. If this is
|
||||
not correct please set the HOME environment variable and restart Eclipse. Otherwise Git for Windows and
|
||||
EGit might behave differently since they see different configuration options.
|
||||
This warning can be switched off on the Team > Git > Confirmations and Warnings preference page.
|
||||
!SESSION 2018-05-20 13:44:07.411 -----------------------------------------------
|
||||
eclipse.buildId=4.7.3.M20180330-0640
|
||||
java.version=1.8.0_171
|
||||
java.vendor=Oracle Corporation
|
||||
BootLoader constants: OS=win32, ARCH=x86_64, WS=win32, NL=fr_FR
|
||||
Framework arguments: -product org.eclipse.epp.package.java.product
|
||||
Command-line arguments: -os win32 -ws win32 -arch x86_64 -product org.eclipse.epp.package.java.product
|
||||
|
||||
!ENTRY org.eclipse.egit.ui 2 0 2018-05-20 13:44:31.319
|
||||
!MESSAGE Warning: The environment variable HOME is not set. The following directory will be used to store the Git
|
||||
user global configuration and to define the default location to store repositories: 'C:\Users\chris'. If this is
|
||||
not correct please set the HOME environment variable and restart Eclipse. Otherwise Git for Windows and
|
||||
EGit might behave differently since they see different configuration options.
|
||||
This warning can be switched off on the Team > Git > Confirmations and Warnings preference page.
|
||||
BIN
.metadata/.mylyn/.taskListIndex/segments_1
Normal file
BIN
.metadata/.mylyn/.taskListIndex/segments_1
Normal file
Binary file not shown.
0
.metadata/.mylyn/.taskListIndex/write.lock
Normal file
0
.metadata/.mylyn/.taskListIndex/write.lock
Normal file
BIN
.metadata/.mylyn/.tasks.xml.zip
Normal file
BIN
.metadata/.mylyn/.tasks.xml.zip
Normal file
Binary file not shown.
BIN
.metadata/.mylyn/repositories.xml.zip
Normal file
BIN
.metadata/.mylyn/repositories.xml.zip
Normal file
Binary file not shown.
BIN
.metadata/.mylyn/tasks.xml.zip
Normal file
BIN
.metadata/.mylyn/tasks.xml.zip
Normal file
Binary file not shown.
@@ -0,0 +1,7 @@
|
||||
eclipse.preferences.version=1
|
||||
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
|
||||
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
|
||||
org.eclipse.jdt.core.compiler.compliance=1.8
|
||||
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
|
||||
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
|
||||
org.eclipse.jdt.core.compiler.source=1.8
|
||||
Binary file not shown.
Binary file not shown.
@@ -0,0 +1 @@
|
||||
|
||||
Binary file not shown.
@@ -0,0 +1 @@
|
||||
|
||||
BIN
.metadata/.plugins/org.eclipse.core.resources/.root/2.tree
Normal file
BIN
.metadata/.plugins/org.eclipse.core.resources/.root/2.tree
Normal file
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,2 @@
|
||||
eclipse.preferences.version=1
|
||||
version=1
|
||||
@@ -0,0 +1,4 @@
|
||||
eclipse.preferences.version=1
|
||||
resetSendMode=KEEP
|
||||
resetSendModeOn=0
|
||||
sendMode=NOTIFY
|
||||
@@ -0,0 +1,7 @@
|
||||
eclipse.preferences.version=1
|
||||
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
|
||||
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
|
||||
org.eclipse.jdt.core.compiler.compliance=1.8
|
||||
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
|
||||
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
|
||||
org.eclipse.jdt.core.compiler.source=1.8
|
||||
@@ -0,0 +1,2 @@
|
||||
eclipse.preferences.version=1
|
||||
org.eclipse.jdt.launching.PREF_VM_XML=<?xml version\="1.0" encoding\="UTF-8" standalone\="no"?>\r\n<vmSettings defaultVM\="57,org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType13,1526816683777">\r\n<vmType id\="org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType">\r\n<vm id\="1526816683777" name\="jre1.8.0_171" path\="C\:\\Program Files\\Java\\jre1.8.0_171"/>\r\n</vmType>\r\n</vmSettings>\r\n
|
||||
@@ -0,0 +1,7 @@
|
||||
content_assist_proposals_background=255,255,255
|
||||
content_assist_proposals_foreground=0,0,0
|
||||
eclipse.preferences.version=1
|
||||
org.eclipse.jdt.ui.formatterprofiles.version=13
|
||||
spelling_locale_initialized=true
|
||||
useAnnotationsPrefPage=true
|
||||
useQuickDiffPrefPage=true
|
||||
@@ -0,0 +1,2 @@
|
||||
eclipse.preferences.version=1
|
||||
org.eclipse.m2e.discovery.pref.projects=
|
||||
@@ -0,0 +1,2 @@
|
||||
eclipse.preferences.version=1
|
||||
mylyn.attention.migrated=true
|
||||
@@ -0,0 +1,2 @@
|
||||
eclipse.preferences.version=1
|
||||
org.eclipse.mylyn.monitor.activity.tracking.enabled.checked=true
|
||||
@@ -0,0 +1,5 @@
|
||||
eclipse.preferences.version=1
|
||||
migrated.task.repositories.secure.store=true
|
||||
org.eclipse.mylyn.tasks.ui.filters.nonmatching=true
|
||||
org.eclipse.mylyn.tasks.ui.filters.nonmatching.encouraged=true
|
||||
org.eclipse.mylyn.tasks.ui.welcome.message=true
|
||||
@@ -0,0 +1,2 @@
|
||||
eclipse.preferences.version=1
|
||||
org.eclipse.team.ui.first_time=false
|
||||
@@ -0,0 +1,2 @@
|
||||
eclipse.preferences.version=1
|
||||
overviewRuler_migration=migrated_3.1
|
||||
@@ -0,0 +1,5 @@
|
||||
PROBLEMS_FILTERS_MIGRATE=true
|
||||
eclipse.preferences.version=1
|
||||
platformState=1526632350390
|
||||
quickStart=false
|
||||
tipsAndTricks=true
|
||||
@@ -0,0 +1,3 @@
|
||||
//org.eclipse.ui.commands/state/org.eclipse.ui.navigator.resources.nested.changeProjectPresentation/org.eclipse.ui.commands.radioState=false
|
||||
PLUGINS_NOT_ACTIVATED_ON_STARTUP=;org.eclipse.m2e.discovery;
|
||||
eclipse.preferences.version=1
|
||||
2293
.metadata/.plugins/org.eclipse.e4.workbench/workbench.xmi
Normal file
2293
.metadata/.plugins/org.eclipse.e4.workbench/workbench.xmi
Normal file
File diff suppressed because it is too large
Load Diff
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,72 @@
|
||||
{
|
||||
"version": "v1",
|
||||
"title": "Eclipse",
|
||||
"timestamp": 1526633390403,
|
||||
"ttl": 10080,
|
||||
"helpUrl": "https://dev.eclipse.org/recommenders/community/aeri/v2/help/",
|
||||
"feedbackUrl": "https://www.codetrails.com/error-analytics/",
|
||||
"aboutUrl": "https://wiki.eclipse.org/EPP/Logging",
|
||||
"submitUrl": "https://dev.eclipse.org/recommenders/community/confess/0.6/reports/",
|
||||
"maxReportSize": 262144,
|
||||
"problemsUrl": "https://www.eclipse.org/downloads/download.php?r\u003d1\u0026file\u003d/technology/epp/logging/problems.zip",
|
||||
"problemsTtl": 20160,
|
||||
"interestUrl": "https://dev.eclipse.org/recommenders/community/confess/v2/interest",
|
||||
"connectTimeout": 10,
|
||||
"socketTimeout": 10,
|
||||
"acceptedProducts": [
|
||||
"org.eclipse.*",
|
||||
"org.fordiac.*"
|
||||
],
|
||||
"acceptedPlugins": [
|
||||
"org.apache.log4j.*",
|
||||
"org.eclipse.*",
|
||||
"org.fordiac.*"
|
||||
],
|
||||
"acceptedPackages": [
|
||||
"ch.qos.*",
|
||||
"com.cforcoding.*",
|
||||
"com.google.*",
|
||||
"com.gradleware.tooling.*",
|
||||
"com.mountainminds.eclemma.*",
|
||||
"com.naef.*",
|
||||
"com.sun.*",
|
||||
"java.*",
|
||||
"javafx.*",
|
||||
"javax.*",
|
||||
"org.apache.*",
|
||||
"org.eclipse.*",
|
||||
"org.fordiac.*",
|
||||
"org.gradle.*",
|
||||
"org.jacoco.*",
|
||||
"org.osgi.*",
|
||||
"org.slf4j.*",
|
||||
"sun.*"
|
||||
],
|
||||
"requiredPackages": [
|
||||
"com.cforcoding.*",
|
||||
"com.gradleware.tooling.*",
|
||||
"com.mountainminds.eclemma.*",
|
||||
"com.naef.*",
|
||||
"org.eclipse.*",
|
||||
"org.fordiac.*",
|
||||
"org.gradle.*",
|
||||
"org.jacoco.*"
|
||||
],
|
||||
"acceptOtherPackages": false,
|
||||
"acceptUiFreezes": true,
|
||||
"ignoredStatuses": [
|
||||
":java.io.IOException:There is not enough space on the disk",
|
||||
":java.net.*:",
|
||||
"org.eclipse.core.filesystem::Could not delete*",
|
||||
"org.eclipse.core.filesystem::Could not move*",
|
||||
"org.eclipse.core.resources:org.eclipse.core.internal.resources.ResourceException:Resource is out of sync with the file system*",
|
||||
"org.eclipse.core.runtime::Invalid input url*",
|
||||
"org.eclipse.epp.mpc.ui:java.io.IOException:",
|
||||
"org.eclipse.equinox.p2.*::",
|
||||
"org.eclipse.jface:java.io.IOException:Unable to resolve plug-in*",
|
||||
"org.eclipse.oomph.setup.core:$org.apache.http.ConnectionClosedException:",
|
||||
"org.eclipse.pde.core::The current target platform contains errors*",
|
||||
"org.eclipse.ui::Conflicting handlers for*"
|
||||
],
|
||||
"problemsZipLastDownloadTimestamp": 0
|
||||
}
|
||||
BIN
.metadata/.plugins/org.eclipse.jdt.core/100574398.index
Normal file
BIN
.metadata/.plugins/org.eclipse.jdt.core/100574398.index
Normal file
Binary file not shown.
BIN
.metadata/.plugins/org.eclipse.jdt.core/1177904427.index
Normal file
BIN
.metadata/.plugins/org.eclipse.jdt.core/1177904427.index
Normal file
Binary file not shown.
BIN
.metadata/.plugins/org.eclipse.jdt.core/1204375214.index
Normal file
BIN
.metadata/.plugins/org.eclipse.jdt.core/1204375214.index
Normal file
Binary file not shown.
BIN
.metadata/.plugins/org.eclipse.jdt.core/1205824980.index
Normal file
BIN
.metadata/.plugins/org.eclipse.jdt.core/1205824980.index
Normal file
Binary file not shown.
BIN
.metadata/.plugins/org.eclipse.jdt.core/2043626465.index
Normal file
BIN
.metadata/.plugins/org.eclipse.jdt.core/2043626465.index
Normal file
Binary file not shown.
BIN
.metadata/.plugins/org.eclipse.jdt.core/2088728460.index
Normal file
BIN
.metadata/.plugins/org.eclipse.jdt.core/2088728460.index
Normal file
Binary file not shown.
BIN
.metadata/.plugins/org.eclipse.jdt.core/2569137926.index
Normal file
BIN
.metadata/.plugins/org.eclipse.jdt.core/2569137926.index
Normal file
Binary file not shown.
BIN
.metadata/.plugins/org.eclipse.jdt.core/2872033403.index
Normal file
BIN
.metadata/.plugins/org.eclipse.jdt.core/2872033403.index
Normal file
Binary file not shown.
BIN
.metadata/.plugins/org.eclipse.jdt.core/3273689814.index
Normal file
BIN
.metadata/.plugins/org.eclipse.jdt.core/3273689814.index
Normal file
Binary file not shown.
BIN
.metadata/.plugins/org.eclipse.jdt.core/3363692690.index
Normal file
BIN
.metadata/.plugins/org.eclipse.jdt.core/3363692690.index
Normal file
Binary file not shown.
BIN
.metadata/.plugins/org.eclipse.jdt.core/3487609244.index
Normal file
BIN
.metadata/.plugins/org.eclipse.jdt.core/3487609244.index
Normal file
Binary file not shown.
BIN
.metadata/.plugins/org.eclipse.jdt.core/3609888128.index
Normal file
BIN
.metadata/.plugins/org.eclipse.jdt.core/3609888128.index
Normal file
Binary file not shown.
BIN
.metadata/.plugins/org.eclipse.jdt.core/4121661813.index
Normal file
BIN
.metadata/.plugins/org.eclipse.jdt.core/4121661813.index
Normal file
Binary file not shown.
BIN
.metadata/.plugins/org.eclipse.jdt.core/710797068.index
Normal file
BIN
.metadata/.plugins/org.eclipse.jdt.core/710797068.index
Normal file
Binary file not shown.
BIN
.metadata/.plugins/org.eclipse.jdt.core/806062888.index
Normal file
BIN
.metadata/.plugins/org.eclipse.jdt.core/806062888.index
Normal file
Binary file not shown.
BIN
.metadata/.plugins/org.eclipse.jdt.core/823384711.index
Normal file
BIN
.metadata/.plugins/org.eclipse.jdt.core/823384711.index
Normal file
Binary file not shown.
BIN
.metadata/.plugins/org.eclipse.jdt.core/890887124.index
Normal file
BIN
.metadata/.plugins/org.eclipse.jdt.core/890887124.index
Normal file
Binary file not shown.
BIN
.metadata/.plugins/org.eclipse.jdt.core/916900781.index
Normal file
BIN
.metadata/.plugins/org.eclipse.jdt.core/916900781.index
Normal file
Binary file not shown.
Binary file not shown.
BIN
.metadata/.plugins/org.eclipse.jdt.core/externalFilesCache
Normal file
BIN
.metadata/.plugins/org.eclipse.jdt.core/externalFilesCache
Normal file
Binary file not shown.
BIN
.metadata/.plugins/org.eclipse.jdt.core/externalLibsTimeStamps
Normal file
BIN
.metadata/.plugins/org.eclipse.jdt.core/externalLibsTimeStamps
Normal file
Binary file not shown.
0
.metadata/.plugins/org.eclipse.jdt.core/index.db
Normal file
0
.metadata/.plugins/org.eclipse.jdt.core/index.db
Normal file
@@ -0,0 +1 @@
|
||||
INDEX VERSION 1.130
|
||||
@@ -0,0 +1 @@
|
||||
java
|
||||
BIN
.metadata/.plugins/org.eclipse.jdt.core/nonChainingJarsCache
Normal file
BIN
.metadata/.plugins/org.eclipse.jdt.core/nonChainingJarsCache
Normal file
Binary file not shown.
19
.metadata/.plugins/org.eclipse.jdt.core/savedIndexNames.txt
Normal file
19
.metadata/.plugins/org.eclipse.jdt.core/savedIndexNames.txt
Normal file
@@ -0,0 +1,19 @@
|
||||
INDEX VERSION 1.130+C:\Users\chris\Documents\WorkspaceJava\.metadata\.plugins\org.eclipse.jdt.core
|
||||
2872033403.index
|
||||
3363692690.index
|
||||
890887124.index
|
||||
3487609244.index
|
||||
2043626465.index
|
||||
2088728460.index
|
||||
100574398.index
|
||||
3273689814.index
|
||||
806062888.index
|
||||
1204375214.index
|
||||
1177904427.index
|
||||
2569137926.index
|
||||
710797068.index
|
||||
3609888128.index
|
||||
1205824980.index
|
||||
4121661813.index
|
||||
916900781.index
|
||||
823384711.index
|
||||
Binary file not shown.
@@ -0,0 +1,4 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<dirs>
|
||||
<entry loc="C:\Program Files\Java\jre1.8.0_171" stamp="1526630584109"/>
|
||||
</dirs>
|
||||
@@ -0,0 +1,22 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<libraryInfos>
|
||||
<libraryInfo home="C:\Program Files\Java\jre1.8.0_171" version="1.8.0_171">
|
||||
<bootpath>
|
||||
<entry path="C:\Program Files\Java\jre1.8.0_171\lib\resources.jar"/>
|
||||
<entry path="C:\Program Files\Java\jre1.8.0_171\lib\rt.jar"/>
|
||||
<entry path="C:\Program Files\Java\jre1.8.0_171\lib\sunrsasign.jar"/>
|
||||
<entry path="C:\Program Files\Java\jre1.8.0_171\lib\jsse.jar"/>
|
||||
<entry path="C:\Program Files\Java\jre1.8.0_171\lib\jce.jar"/>
|
||||
<entry path="C:\Program Files\Java\jre1.8.0_171\lib\charsets.jar"/>
|
||||
<entry path="C:\Program Files\Java\jre1.8.0_171\lib\jfr.jar"/>
|
||||
<entry path="C:\Program Files\Java\jre1.8.0_171\classes"/>
|
||||
</bootpath>
|
||||
<extensionDirs>
|
||||
<entry path="C:\Program Files\Java\jre1.8.0_171\lib\ext"/>
|
||||
<entry path="C:\Windows\Sun\Java\lib\ext"/>
|
||||
</extensionDirs>
|
||||
<endorsedDirs>
|
||||
<entry path="C:\Program Files\Java\jre1.8.0_171\lib\endorsed"/>
|
||||
</endorsedDirs>
|
||||
</libraryInfo>
|
||||
</libraryInfos>
|
||||
@@ -0,0 +1,2 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<typeInfoHistroy/>
|
||||
@@ -0,0 +1,2 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<qualifiedTypeNameHistroy/>
|
||||
10
.metadata/.plugins/org.eclipse.jdt.ui/dialog_settings.xml
Normal file
10
.metadata/.plugins/org.eclipse.jdt.ui/dialog_settings.xml
Normal file
@@ -0,0 +1,10 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<section name="Workbench">
|
||||
<section name="org.eclipse.jdt.internal.ui.packageview.PackageExplorerPart">
|
||||
<item value="2" key="layout"/>
|
||||
<item value="true" key="group_libraries"/>
|
||||
<item value="<?xml version="1.0" encoding="UTF-8"?>
<packageExplorer group_libraries="1" layout="2" linkWithEditor="0" rootMode="1" workingSetName="Aggregate for window 1526633384797">
<customFilters userDefinedPatternsEnabled="false">
<xmlDefinedFilters>
<child filterId="org.eclipse.jdt.ui.PackageExplorer.StaticsFilter" isEnabled="false"/>
<child filterId="org.eclipse.buildship.ui.packageexplorer.filter.gradle.buildfolder" isEnabled="true"/>
<child filterId="org.eclipse.mylyn.java.ui.MembersFilter" isEnabled="false"/>
<child filterId="org.eclipse.jdt.ui.PackageExplorer.NonJavaProjectsFilter" isEnabled="false"/>
<child filterId="org.eclipse.jdt.ui.PackageExplorer_patternFilterId_.*" isEnabled="true"/>
<child filterId="org.eclipse.jdt.ui.PackageExplorer.NonSharedProjectsFilter" isEnabled="false"/>
<child filterId="org.eclipse.jdt.ui.PackageExplorer.SyntheticMembersFilter" isEnabled="true"/>
<child filterId="org.eclipse.jdt.ui.PackageExplorer.ContainedLibraryFilter" isEnabled="false"/>
<child filterId="org.eclipse.jdt.internal.ui.PackageExplorer.HideInnerClassFilesFilter" isEnabled="true"/>
<child filterId="org.eclipse.jdt.internal.ui.PackageExplorer.EmptyInnerPackageFilter" isEnabled="true"/>
<child filterId="org.eclipse.m2e.MavenModuleFilter" isEnabled="false"/>
<child filterId="org.eclipse.buildship.ui.packageexplorer.filter.gradle.subProject" isEnabled="true"/>
<child filterId="org.eclipse.jdt.ui.PackageExplorer.ClosedProjectsFilter" isEnabled="false"/>
<child filterId="org.eclipse.jdt.ui.PackageExplorer.DeprecatedMembersFilter" isEnabled="false"/>
<child filterId="org.eclipse.jdt.ui.PackageExplorer.EmptyLibraryContainerFilter" isEnabled="true"/>
<child filterId="org.eclipse.jdt.ui.PackageExplorer.PackageDeclarationFilter" isEnabled="true"/>
<child filterId="org.eclipse.jdt.ui.PackageExplorer.ImportDeclarationFilter" isEnabled="true"/>
<child filterId="org.eclipse.jdt.ui.PackageExplorer.NonJavaElementFilter" isEnabled="false"/>
<child filterId="org.eclipse.jdt.ui.PackageExplorer.LibraryFilter" isEnabled="false"/>
<child filterId="org.eclipse.jdt.ui.PackageExplorer.CuAndClassFileFilter" isEnabled="false"/>
<child filterId="org.eclipse.jdt.internal.ui.PackageExplorer.EmptyPackageFilter" isEnabled="false"/>
<child filterId="org.eclipse.jdt.ui.PackageExplorer.NonPublicFilter" isEnabled="false"/>
<child filterId="org.eclipse.jdt.ui.PackageExplorer.LocalTypesFilter" isEnabled="false"/>
<child filterId="org.eclipse.jdt.ui.PackageExplorer.FieldsFilter" isEnabled="false"/>
</xmlDefinedFilters>
</customFilters>
</packageExplorer>" key="memento"/>
|
||||
<item value="1" key="rootMode"/>
|
||||
<item value="false" key="linkWithEditor"/>
|
||||
</section>
|
||||
</section>
|
||||
@@ -0,0 +1,2 @@
|
||||
2018-05-18 10:49:47,485 [Worker-0] INFO c.g.t.t.d.PublishedGradleVersions - Gradle version information cache is up-to-date. Trying to read.
|
||||
2018-05-20 13:44:31,050 [Worker-5] INFO c.g.t.t.d.PublishedGradleVersions - Gradle version information cache is out-of-date. Trying to update.
|
||||
@@ -0,0 +1,43 @@
|
||||
<configuration scan="true">
|
||||
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
|
||||
<encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
|
||||
<pattern>%date [%thread] %-5level %logger{35} - %msg%n</pattern>
|
||||
</encoder>
|
||||
<filter class="ch.qos.logback.classic.filter.ThresholdFilter">
|
||||
<level>OFF</level> <!-- change to DEBUG to mimic '-consolelog' behaviour -->
|
||||
</filter>
|
||||
</appender>
|
||||
|
||||
<appender name="FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
|
||||
<File>${org.eclipse.m2e.log.dir}/0.log</File>
|
||||
<rollingPolicy class="ch.qos.logback.core.rolling.FixedWindowRollingPolicy">
|
||||
<FileNamePattern>${org.eclipse.m2e.log.dir}/%i.log</FileNamePattern>
|
||||
<MinIndex>1</MinIndex>
|
||||
<MaxIndex>10</MaxIndex>
|
||||
</rollingPolicy>
|
||||
<triggeringPolicy class="ch.qos.logback.core.rolling.SizeBasedTriggeringPolicy">
|
||||
<MaxFileSize>100MB</MaxFileSize>
|
||||
</triggeringPolicy>
|
||||
<encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
|
||||
<pattern>%date [%thread] %-5level %logger{35} - %msg%n</pattern>
|
||||
</encoder>
|
||||
</appender>
|
||||
|
||||
<appender name="EclipseLog" class="org.eclipse.m2e.logback.appender.EclipseLogAppender">
|
||||
<filter class="ch.qos.logback.classic.filter.ThresholdFilter">
|
||||
<level>WARN</level>
|
||||
</filter>
|
||||
</appender>
|
||||
|
||||
<appender name="MavenConsoleLog" class="org.eclipse.m2e.logback.appender.MavenConsoleAppender">
|
||||
</appender>
|
||||
|
||||
<root level="INFO">
|
||||
<appender-ref ref="FILE" />
|
||||
<appender-ref ref="STDOUT" />
|
||||
<appender-ref ref="EclipseLog" />
|
||||
<appender-ref ref="MavenConsoleLog" />
|
||||
</root>
|
||||
|
||||
<logger name="com.ning.http.client" level="INFO" />
|
||||
</configuration>
|
||||
@@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<setup:Workspace
|
||||
xmi:version="2.0"
|
||||
xmlns:xmi="http://www.omg.org/XMI"
|
||||
xmlns:setup="http://www.eclipse.org/oomph/setup/1.0"
|
||||
name="workspace"/>
|
||||
@@ -0,0 +1,13 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<rss version="2.0">
|
||||
<channel>
|
||||
<title>Code Recommenders In-IDE News</title>
|
||||
<link>https://www.eclipse.org/recommenders/</link>
|
||||
<description>The latest news about Code Recommenders, delivered to your Eclipse IDE</description>
|
||||
<item>
|
||||
<title>Insert Knowledge Here - A Guide to Intelligent Code Completion Using Eclipse Code Recommenders</title>
|
||||
<link>https://medium.com/codetrails/insert-knowledge-here-a2f71c2862d2?utm_source=rss-eclipse&utm_medium=eclipse&utm_campaign=cc</link>
|
||||
<pubDate>Tue, 10 Oct 2017 16:00:00 GMT</pubDate>
|
||||
</item>
|
||||
</channel>
|
||||
</rss>
|
||||
2
.metadata/.plugins/org.eclipse.ui.intro/introstate
Normal file
2
.metadata/.plugins/org.eclipse.ui.intro/introstate
Normal file
@@ -0,0 +1,2 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<state reopen="true"/>
|
||||
@@ -0,0 +1,15 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<section name="Workbench">
|
||||
<section name="org.eclipse.ui.internal.QuickAccess">
|
||||
<item value="-1" key="dialogHeight"/>
|
||||
<item value="-1" key="dialogWidth"/>
|
||||
<list key="textEntries">
|
||||
</list>
|
||||
<list key="orderedElements">
|
||||
</list>
|
||||
<list key="orderedProviders">
|
||||
</list>
|
||||
<list key="textArray">
|
||||
</list>
|
||||
</section>
|
||||
</section>
|
||||
@@ -0,0 +1,4 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<workingSetManager>
|
||||
<workingSet aggregate="true" factoryID="org.eclipse.ui.internal.WorkingSetFactory" id="1526633384797_0" label="Window Working Set" name="Aggregate for window 1526633384797"/>
|
||||
</workingSetManager>
|
||||
3
.metadata/version.ini
Normal file
3
.metadata/version.ini
Normal file
@@ -0,0 +1,3 @@
|
||||
#Sun May 20 13:44:12 CEST 2018
|
||||
org.eclipse.core.runtime=2
|
||||
org.eclipse.platform=4.7.3.v20180330-0640
|
||||
37
01-SOURCES/Asteroid.java
Normal file
37
01-SOURCES/Asteroid.java
Normal file
@@ -0,0 +1,37 @@
|
||||
/*****************************************************
|
||||
* Beginning Java Game Programming, 2nd Edition
|
||||
* by Jonathan S. Harbour
|
||||
* Asteroid class - For polygonal asteroid shapes
|
||||
*****************************************************/
|
||||
|
||||
import java.awt.Polygon;
|
||||
import java.awt.Rectangle;
|
||||
|
||||
/*********************************************************
|
||||
* Asteroid class derives from BaseVectorShape
|
||||
**********************************************************/
|
||||
public class Asteroid extends BaseVectorShape {
|
||||
//define the asteroid polygon shape
|
||||
private int[] astx = {-20,-13, 0,20,22, 20, 12, 2,-10,-22,-16};
|
||||
private int[] asty = { 20, 23,17,20,16,-20,-22,-14,-17,-20, -5};
|
||||
|
||||
//rotation speed
|
||||
protected double rotVel;
|
||||
public double getRotationVelocity() { return rotVel; }
|
||||
public void setRotationVelocity(double v) { rotVel = v; }
|
||||
|
||||
//bounding rectangle
|
||||
public Rectangle getBounds() {
|
||||
Rectangle r;
|
||||
r = new Rectangle((int)getX() - 20, (int) getY() - 20, 40, 40);
|
||||
return r;
|
||||
}
|
||||
|
||||
//default constructor
|
||||
Asteroid() {
|
||||
setShape(new Polygon(astx, asty, astx.length));
|
||||
setAlive(true);
|
||||
setRotationVelocity(0.0);
|
||||
}
|
||||
|
||||
}
|
||||
440
01-SOURCES/Asteroids.java
Normal file
440
01-SOURCES/Asteroids.java
Normal file
@@ -0,0 +1,440 @@
|
||||
/*****************************************************
|
||||
* Beginning Java Game Programming, 2nd Edition
|
||||
* by Jonathan S. Harbour
|
||||
* Chapter 3 - ASTEROIDS GAME
|
||||
*****************************************************/
|
||||
|
||||
import java.applet.*;
|
||||
import java.awt.*;
|
||||
import java.awt.event.*;
|
||||
import java.awt.geom.*;
|
||||
import java.awt.image.*;
|
||||
import java.util.*;
|
||||
|
||||
/*****************************************************
|
||||
* Primary class for the game inherits from Applet
|
||||
*****************************************************/
|
||||
public class Asteroids extends Applet implements Runnable, KeyListener {
|
||||
|
||||
//the main thread becomes the game loop
|
||||
Thread gameloop;
|
||||
|
||||
//use this as a double buffer
|
||||
BufferedImage backbuffer;
|
||||
|
||||
//the main drawing object for the back buffer
|
||||
Graphics2D g2d;
|
||||
|
||||
//toggle for drawing bounding boxes
|
||||
boolean showBounds = false;
|
||||
|
||||
//create the asteroid array
|
||||
int ASTEROIDS = 20;
|
||||
Asteroid[] ast = new Asteroid[ASTEROIDS];
|
||||
|
||||
//create the bullet array
|
||||
int BULLETS = 10;
|
||||
Bullet[] bullet = new Bullet[BULLETS];
|
||||
int currentBullet = 0;
|
||||
|
||||
//the player's ship
|
||||
Ship ship = new Ship();
|
||||
|
||||
//create the identity transform (0,0)
|
||||
AffineTransform identity = new AffineTransform();
|
||||
|
||||
//create a random number generator
|
||||
Random rand = new Random();
|
||||
|
||||
/*****************************************************
|
||||
* applet init event
|
||||
*****************************************************/
|
||||
public void init() {
|
||||
//create the back buffer for smooth graphics
|
||||
backbuffer = new BufferedImage(640, 480, BufferedImage.TYPE_INT_RGB);
|
||||
g2d = backbuffer.createGraphics();
|
||||
|
||||
//set up the ship
|
||||
ship.setX(320);
|
||||
ship.setY(240);
|
||||
|
||||
//set up the bullets
|
||||
for (int n = 0; n<BULLETS; n++) {
|
||||
bullet[n] = new Bullet();
|
||||
}
|
||||
|
||||
//create the asteroids
|
||||
for (int n = 0; n<ASTEROIDS; n++) {
|
||||
ast[n] = new Asteroid();
|
||||
ast[n].setRotationVelocity(rand.nextInt(3)+1);
|
||||
ast[n].setX((double)rand.nextInt(600)+20);
|
||||
ast[n].setY((double)rand.nextInt(440)+20);
|
||||
ast[n].setMoveAngle(rand.nextInt(360));
|
||||
double ang = ast[n].getMoveAngle() - 90;
|
||||
ast[n].setVelX(calcAngleMoveX(ang));
|
||||
ast[n].setVelY(calcAngleMoveY(ang));
|
||||
}
|
||||
|
||||
//start the user input listener
|
||||
addKeyListener(this);
|
||||
}
|
||||
|
||||
/*****************************************************
|
||||
* applet update event to redraw the screen
|
||||
*****************************************************/
|
||||
public void update(Graphics g) {
|
||||
//start off transforms at identity
|
||||
g2d.setTransform(identity);
|
||||
|
||||
//erase the background
|
||||
g2d.setPaint(Color.BLACK);
|
||||
g2d.fillRect(0, 0, getSize().width, getSize().height);
|
||||
|
||||
//print some status information
|
||||
g2d.setColor(Color.WHITE);
|
||||
g2d.drawString("Ship: " + Math.round(ship.getX()) + "," +
|
||||
Math.round(ship.getY()) , 5, 10);
|
||||
g2d.drawString("Move angle: " + Math.round(
|
||||
ship.getMoveAngle())+90, 5, 25);
|
||||
g2d.drawString("Face angle: " + Math.round(
|
||||
ship.getFaceAngle()), 5, 40);
|
||||
|
||||
//draw the game graphics
|
||||
drawShip();
|
||||
drawBullets();
|
||||
drawAsteroids();
|
||||
|
||||
//repaint the applet window
|
||||
paint(g);
|
||||
}
|
||||
|
||||
/*****************************************************
|
||||
* drawShip called by applet update event
|
||||
*****************************************************/
|
||||
public void drawShip() {
|
||||
g2d.setTransform(identity);
|
||||
g2d.translate(ship.getX(), ship.getY());
|
||||
g2d.rotate(Math.toRadians(ship.getFaceAngle()));
|
||||
g2d.setColor(Color.ORANGE);
|
||||
g2d.fill(ship.getShape());
|
||||
}
|
||||
|
||||
/*****************************************************
|
||||
* drawBullets called by applet update event
|
||||
*****************************************************/
|
||||
public void drawBullets() {
|
||||
|
||||
//iterate through the array of bullets
|
||||
for (int n = 0; n < BULLETS; n++) {
|
||||
|
||||
//is this bullet currently in use?
|
||||
if (bullet[n].isAlive()) {
|
||||
|
||||
//draw the bullet
|
||||
g2d.setTransform(identity);
|
||||
g2d.translate(bullet[n].getX(), bullet[n].getY());
|
||||
g2d.setColor(Color.MAGENTA);
|
||||
g2d.draw(bullet[n].getShape());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*****************************************************
|
||||
* drawAsteroids called by applet update event
|
||||
*****************************************************/
|
||||
public void drawAsteroids() {
|
||||
|
||||
//iterate through the asteroids array
|
||||
for (int n = 0; n < ASTEROIDS; n++) {
|
||||
|
||||
//is this asteroid being used?
|
||||
if (ast[n].isAlive()) {
|
||||
|
||||
//draw the asteroid
|
||||
g2d.setTransform(identity);
|
||||
g2d.translate(ast[n].getX(), ast[n].getY());
|
||||
g2d.rotate(Math.toRadians(ast[n].getMoveAngle()));
|
||||
g2d.setColor(Color.DARK_GRAY);
|
||||
g2d.fill(ast[n].getShape());
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*****************************************************
|
||||
* applet window repaint event--draw the back buffer
|
||||
*****************************************************/
|
||||
public void paint(Graphics g) {
|
||||
|
||||
//draw the back buffer onto the applet window
|
||||
g.drawImage(backbuffer, 0, 0, this);
|
||||
|
||||
}
|
||||
|
||||
/*****************************************************
|
||||
* thread start event - start the game loop running
|
||||
*****************************************************/
|
||||
public void start() {
|
||||
|
||||
//create the gameloop thread for real-time updates
|
||||
gameloop = new Thread(this);
|
||||
gameloop.start();
|
||||
}
|
||||
|
||||
/*****************************************************
|
||||
* thread run event (game loop)
|
||||
*****************************************************/
|
||||
public void run() {
|
||||
|
||||
//acquire the current thread
|
||||
Thread t = Thread.currentThread();
|
||||
|
||||
//keep going as long as the thread is alive
|
||||
while (t == gameloop) {
|
||||
|
||||
try {
|
||||
//update the game loop
|
||||
gameUpdate();
|
||||
|
||||
//target framerate is 50 fps
|
||||
Thread.sleep(20);
|
||||
}
|
||||
catch(InterruptedException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
repaint();
|
||||
}
|
||||
}
|
||||
/*****************************************************
|
||||
* thread stop event
|
||||
*****************************************************/
|
||||
public void stop() {
|
||||
|
||||
//kill the gameloop thread
|
||||
gameloop = null;
|
||||
}
|
||||
|
||||
/*****************************************************
|
||||
* move and animate the objects in the game
|
||||
*****************************************************/
|
||||
private void gameUpdate() {
|
||||
updateShip();
|
||||
updateBullets();
|
||||
updateAsteroids();
|
||||
checkCollisions();
|
||||
}
|
||||
|
||||
/*****************************************************
|
||||
* Update the ship position based on velocity
|
||||
*****************************************************/
|
||||
public void updateShip() {
|
||||
|
||||
//update ship's X position
|
||||
ship.incX(ship.getVelX());
|
||||
|
||||
//wrap around left/right
|
||||
if (ship.getX() < -10)
|
||||
ship.setX(getSize().width + 10);
|
||||
else if (ship.getX() > getSize().width + 10)
|
||||
ship.setX(-10);
|
||||
|
||||
//update ship's Y position
|
||||
ship.incY(ship.getVelY());
|
||||
|
||||
//wrap around top/bottom
|
||||
if (ship.getY() < -10)
|
||||
ship.setY(getSize().height + 10);
|
||||
else if (ship.getY() > getSize().height + 10)
|
||||
ship.setY(-10);
|
||||
}
|
||||
|
||||
/*****************************************************
|
||||
* Update the bullets based on velocity
|
||||
*****************************************************/
|
||||
public void updateBullets() {
|
||||
|
||||
//move each of the bullets
|
||||
for (int n = 0; n < BULLETS; n++) {
|
||||
|
||||
//is this bullet being used?
|
||||
if (bullet[n].isAlive()) {
|
||||
|
||||
//update bullet's x position
|
||||
bullet[n].incX(bullet[n].getVelX());
|
||||
|
||||
//bullet disappears at left/right edge
|
||||
if (bullet[n].getX() < 0 ||
|
||||
bullet[n].getX() > getSize().width)
|
||||
{
|
||||
bullet[n].setAlive(false);
|
||||
}
|
||||
|
||||
//update bullet's y position
|
||||
bullet[n].incY(bullet[n].getVelY());
|
||||
|
||||
//bullet disappears at top/bottom edge
|
||||
if (bullet[n].getY() < 0 ||
|
||||
bullet[n].getY() > getSize().height)
|
||||
{
|
||||
bullet[n].setAlive(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*****************************************************
|
||||
* Update the asteroids based on velocity
|
||||
*****************************************************/
|
||||
public void updateAsteroids() {
|
||||
|
||||
//move and rotate the asteroids
|
||||
for (int n = 0; n < ASTEROIDS; n++) {
|
||||
|
||||
//is this asteroid being used?
|
||||
if (ast[n].isAlive()) {
|
||||
|
||||
//update the asteroid's X value
|
||||
ast[n].incX(ast[n].getVelX());
|
||||
|
||||
//warp the asteroid at screen edges
|
||||
if (ast[n].getX() < -20)
|
||||
ast[n].setX(getSize().width + 20);
|
||||
else if (ast[n].getX() > getSize().width + 20)
|
||||
ast[n].setX(-20);
|
||||
|
||||
//update the asteroid's Y value
|
||||
ast[n].incY(ast[n].getVelY());
|
||||
|
||||
//warp the asteroid at screen edges
|
||||
if (ast[n].getY() < -20)
|
||||
ast[n].setY(getSize().height + 20);
|
||||
else if (ast[n].getY() > getSize().height + 20)
|
||||
ast[n].setY(-20);
|
||||
|
||||
//update the asteroid's rotation
|
||||
ast[n].incMoveAngle(ast[n].getRotationVelocity());
|
||||
|
||||
//keep the angle within 0-359 degrees
|
||||
if (ast[n].getMoveAngle() < 0)
|
||||
ast[n].setMoveAngle(360 - ast[n].getRotationVelocity());
|
||||
else if (ast[n].getMoveAngle() > 359)
|
||||
ast[n].setMoveAngle(ast[n].getRotationVelocity());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*****************************************************
|
||||
* Test asteroids for collisions with ship or bullets
|
||||
*****************************************************/
|
||||
public void checkCollisions() {
|
||||
|
||||
//iterate through the asteroids array
|
||||
for (int m = 0; m<ASTEROIDS; m++) {
|
||||
|
||||
//is this asteroid being used?
|
||||
if (ast[m].isAlive()) {
|
||||
|
||||
/*
|
||||
* check for collision with bullet
|
||||
*/
|
||||
for (int n = 0; n < BULLETS; n++) {
|
||||
|
||||
//is this bullet being used?
|
||||
if (bullet[n].isAlive()) {
|
||||
|
||||
//perform the collision test
|
||||
if (ast[m].getBounds().contains(
|
||||
bullet[n].getX(), bullet[n].getY()))
|
||||
{
|
||||
bullet[n].setAlive(false);
|
||||
ast[m].setAlive(false);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* check for collision with ship
|
||||
*/
|
||||
if (ast[m].getBounds().intersects(ship.getBounds())) {
|
||||
ast[m].setAlive(false);
|
||||
ship.setX(320);
|
||||
ship.setY(240);
|
||||
ship.setFaceAngle(0);
|
||||
ship.setVelX(0);
|
||||
ship.setVelY(0);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*****************************************************
|
||||
* key listener events
|
||||
*****************************************************/
|
||||
public void keyReleased(KeyEvent k) { }
|
||||
public void keyTyped(KeyEvent k) { }
|
||||
public void keyPressed(KeyEvent k) {
|
||||
int keyCode = k.getKeyCode();
|
||||
|
||||
switch (keyCode) {
|
||||
|
||||
case KeyEvent.VK_LEFT:
|
||||
//left arrow rotates ship left 5 degrees
|
||||
ship.incFaceAngle(-5);
|
||||
if (ship.getFaceAngle() < 0) ship.setFaceAngle(360-5);
|
||||
break;
|
||||
|
||||
case KeyEvent.VK_RIGHT:
|
||||
//right arrow rotates ship right 5 degrees
|
||||
ship.incFaceAngle(5);
|
||||
if (ship.getFaceAngle() > 360) ship.setFaceAngle(5);
|
||||
break;
|
||||
|
||||
case KeyEvent.VK_UP:
|
||||
//up arrow adds thrust to ship (1/10 normal speed)
|
||||
ship.setMoveAngle(ship.getFaceAngle() - 90);
|
||||
ship.incVelX(calcAngleMoveX(ship.getMoveAngle()) * 0.1);
|
||||
ship.incVelY(calcAngleMoveY(ship.getMoveAngle()) * 0.1);
|
||||
break;
|
||||
|
||||
//Ctrl, Enter, or Space can be used to fire weapon
|
||||
case KeyEvent.VK_CONTROL:
|
||||
case KeyEvent.VK_ENTER:
|
||||
case KeyEvent.VK_SPACE:
|
||||
//fire a bullet
|
||||
currentBullet++;
|
||||
if (currentBullet > BULLETS - 1) currentBullet = 0;
|
||||
bullet[currentBullet].setAlive(true);
|
||||
|
||||
//point bullet in same direction ship is facing
|
||||
bullet[currentBullet].setX(ship.getX());
|
||||
bullet[currentBullet].setY(ship.getY());
|
||||
bullet[currentBullet].setMoveAngle(ship.getFaceAngle() - 90);
|
||||
|
||||
//fire bullet at angle of the ship
|
||||
double angle = bullet[currentBullet].getMoveAngle();
|
||||
double svx = ship.getVelX();
|
||||
double svy = ship.getVelY();
|
||||
bullet[currentBullet].setVelX(svx + calcAngleMoveX(angle) * 2);
|
||||
bullet[currentBullet].setVelY(svy + calcAngleMoveY(angle) * 2);
|
||||
break;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
/*****************************************************
|
||||
* calculate X movement value based on direction angle
|
||||
*****************************************************/
|
||||
public double calcAngleMoveX(double angle) {
|
||||
return (double) (Math.cos(angle * Math.PI / 180));
|
||||
}
|
||||
|
||||
/*****************************************************
|
||||
* calculate Y movement value based on direction angle
|
||||
*****************************************************/
|
||||
public double calcAngleMoveY(double angle) {
|
||||
return (double) (Math.sin(angle * Math.PI / 180));
|
||||
}
|
||||
|
||||
}
|
||||
422
01-SOURCES/AsteroidsACompleter.java
Normal file
422
01-SOURCES/AsteroidsACompleter.java
Normal file
@@ -0,0 +1,422 @@
|
||||
/*****************************************************
|
||||
* Beginning Java Game Programming, 2nd Edition
|
||||
* by Jonathan S. Harbour
|
||||
* Chapter 3 - ASTEROIDS GAME
|
||||
*****************************************************/
|
||||
|
||||
import java.applet.*;
|
||||
import java.awt.*;
|
||||
import java.awt.event.*;
|
||||
import java.awt.geom.*;
|
||||
import java.awt.image.*;
|
||||
import java.util.*;
|
||||
|
||||
/*****************************************************
|
||||
* Primary class for the game inherits from Applet
|
||||
*****************************************************/
|
||||
public class AsteroidsACompleter extends Applet implements Runnable, KeyListener {
|
||||
|
||||
//the main thread becomes the game loop
|
||||
Thread gameloop;
|
||||
|
||||
//use this as a double buffer
|
||||
BufferedImage backbuffer;
|
||||
|
||||
//the main drawing object for the back buffer
|
||||
Graphics2D g2d;
|
||||
|
||||
//toggle for drawing bounding boxes
|
||||
boolean showBounds = false;
|
||||
|
||||
//create the asteroid array
|
||||
int ASTEROIDS = 20;
|
||||
Asteroid[] ast = new Asteroid[ASTEROIDS];
|
||||
|
||||
//create the bullet array
|
||||
int BULLETS = 10;
|
||||
Bullet[] bullet = new Bullet[BULLETS];
|
||||
int currentBullet = 0;
|
||||
|
||||
//the player's ship
|
||||
Ship ship = new Ship();
|
||||
|
||||
//create the identity transform (0,0)
|
||||
AffineTransform identity = new AffineTransform();
|
||||
|
||||
//create a random number generator
|
||||
Random rand = new Random();
|
||||
|
||||
/*****************************************************
|
||||
* applet init event
|
||||
*****************************************************/
|
||||
public void init() {
|
||||
//create the back buffer for smooth graphics
|
||||
backbuffer = new BufferedImage(640, 480, BufferedImage.TYPE_INT_RGB);
|
||||
g2d = backbuffer.createGraphics();
|
||||
|
||||
//set up the ship
|
||||
ship.setX(320);
|
||||
ship.setY(240);
|
||||
|
||||
//set up the bullets
|
||||
for (int n = 0; n<BULLETS; n++) {
|
||||
bullet[n] = new Bullet();
|
||||
}
|
||||
|
||||
//create the asteroids
|
||||
for (int n = 0; n<ASTEROIDS; n++) {
|
||||
ast[n] = new Asteroid();
|
||||
ast[n].setRotationVelocity(rand.nextInt(3)+1);
|
||||
ast[n].setX((double)rand.nextInt(600)+20);
|
||||
ast[n].setY((double)rand.nextInt(440)+20);
|
||||
ast[n].setMoveAngle(rand.nextInt(360));
|
||||
double ang = ast[n].getMoveAngle() - 90;
|
||||
ast[n].setVelX(calcAngleMoveX(ang));
|
||||
ast[n].setVelY(calcAngleMoveY(ang));
|
||||
}
|
||||
|
||||
//start the user input listener
|
||||
addKeyListener(this);
|
||||
}
|
||||
|
||||
/*****************************************************
|
||||
* applet update event to redraw the screen
|
||||
*****************************************************/
|
||||
public void update(Graphics g) {
|
||||
//start off transforms at identity
|
||||
g2d.setTransform(identity);
|
||||
|
||||
//erase the background
|
||||
g2d.setPaint(Color.BLACK);
|
||||
g2d.fillRect(0, 0, getSize().width, getSize().height);
|
||||
|
||||
//print some status information
|
||||
g2d.setColor(Color.WHITE);
|
||||
g2d.drawString("Ship: " + Math.round(ship.getX()) + "," +
|
||||
Math.round(ship.getY()) , 5, 10);
|
||||
g2d.drawString("Move angle: " + Math.round(
|
||||
ship.getMoveAngle())+90, 5, 25);
|
||||
g2d.drawString("Face angle: " + Math.round(
|
||||
ship.getFaceAngle()), 5, 40);
|
||||
|
||||
//draw the game graphics
|
||||
drawShip();
|
||||
drawBullets();
|
||||
drawAsteroids();
|
||||
|
||||
//repaint the applet window
|
||||
paint(g);
|
||||
}
|
||||
|
||||
/*****************************************************
|
||||
* drawShip called by applet update event
|
||||
*****************************************************/
|
||||
public void drawShip() {
|
||||
g2d.setTransform(identity);
|
||||
g2d.translate(ship.getX(), ship.getY());
|
||||
g2d.rotate(Math.toRadians(ship.getFaceAngle()));
|
||||
g2d.setColor(Color.ORANGE);
|
||||
g2d.fill(ship.getShape());
|
||||
}
|
||||
|
||||
/*****************************************************
|
||||
* drawBullets called by applet update event
|
||||
*****************************************************/
|
||||
public void drawBullets() {
|
||||
|
||||
//iterate through the array of bullets
|
||||
for (int n = 0; n < BULLETS; n++) {
|
||||
|
||||
//is this bullet currently in use?
|
||||
if (bullet[n].isAlive()) {
|
||||
|
||||
//draw the bullet
|
||||
g2d.setTransform(identity);
|
||||
g2d.translate(bullet[n].getX(), bullet[n].getY());
|
||||
g2d.setColor(Color.MAGENTA);
|
||||
g2d.draw(bullet[n].getShape());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*****************************************************
|
||||
* drawAsteroids called by applet update event
|
||||
*****************************************************/
|
||||
public void drawAsteroids() {
|
||||
|
||||
//iterate through the asteroids array
|
||||
for (int n = 0; n < ASTEROIDS; n++) {
|
||||
|
||||
//is this asteroid being used?
|
||||
if (ast[n].isAlive()) {
|
||||
|
||||
//draw the asteroid
|
||||
g2d.setTransform(identity);
|
||||
g2d.translate(ast[n].getX(), ast[n].getY());
|
||||
g2d.rotate(Math.toRadians(ast[n].getMoveAngle()));
|
||||
g2d.setColor(Color.DARK_GRAY);
|
||||
g2d.fill(ast[n].getShape());
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*****************************************************
|
||||
* applet window repaint event--draw the back buffer
|
||||
*****************************************************/
|
||||
public void paint(Graphics g) {
|
||||
|
||||
//draw the back buffer onto the applet window
|
||||
g.drawImage(backbuffer, 0, 0, this);
|
||||
|
||||
}
|
||||
|
||||
/*****************************************************
|
||||
* thread start event - start the game loop running
|
||||
*****************************************************/
|
||||
public void start() {
|
||||
|
||||
//create the gameloop thread for real-time updates
|
||||
gameloop = new Thread(this);
|
||||
gameloop.start();
|
||||
}
|
||||
|
||||
/*****************************************************
|
||||
* thread run event (game loop)
|
||||
*****************************************************/
|
||||
public void run() {
|
||||
|
||||
//acquire the current thread
|
||||
Thread t = Thread.currentThread();
|
||||
|
||||
//keep going as long as the thread is alive
|
||||
while (t == gameloop) {
|
||||
|
||||
try {
|
||||
//update the game loop
|
||||
gameUpdate();
|
||||
|
||||
//target framerate is 50 fps
|
||||
Thread.sleep(20);
|
||||
}
|
||||
catch(InterruptedException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
repaint();
|
||||
}
|
||||
}
|
||||
/*****************************************************
|
||||
* thread stop event
|
||||
*****************************************************/
|
||||
public void stop() {
|
||||
|
||||
//kill the gameloop thread
|
||||
gameloop = null;
|
||||
}
|
||||
|
||||
/*****************************************************
|
||||
* move and animate the objects in the game
|
||||
*****************************************************/
|
||||
private void gameUpdate() {
|
||||
updateShip();
|
||||
updateBullets();
|
||||
updateAsteroids();
|
||||
checkCollisions();
|
||||
}
|
||||
|
||||
/*****************************************************
|
||||
* Update the ship position based on velocity
|
||||
*****************************************************/
|
||||
public void updateShip() {
|
||||
|
||||
//update ship's X position
|
||||
ship.incX(ship.getVelX());
|
||||
|
||||
//wrap around left/right
|
||||
if (ship.getX() < -10)
|
||||
ship.setX(getSize().width + 10);
|
||||
else if (ship.getX() > getSize().width + 10)
|
||||
ship.setX(-10);
|
||||
|
||||
//update ship's Y position
|
||||
ship.incY(ship.getVelY());
|
||||
|
||||
//wrap around top/bottom
|
||||
if (ship.getY() < -10)
|
||||
ship.setY(getSize().height + 10);
|
||||
else if (ship.getY() > getSize().height + 10)
|
||||
ship.setY(-10);
|
||||
}
|
||||
|
||||
/*****************************************************
|
||||
* Update the bullets based on velocity
|
||||
*****************************************************/
|
||||
public void updateBullets() {
|
||||
|
||||
//move each of the bullets
|
||||
for (int n = 0; n < BULLETS; n++) {
|
||||
|
||||
//is this bullet being used?
|
||||
if (bullet[n].isAlive()) {
|
||||
|
||||
//update bullet's x position
|
||||
bullet[n].incX(bullet[n].getVelX());
|
||||
|
||||
//bullet disappears at left/right edge
|
||||
if (bullet[n].getX() < 0 ||
|
||||
bullet[n].getX() > getSize().width)
|
||||
{
|
||||
bullet[n].setAlive(false);
|
||||
}
|
||||
|
||||
//update bullet's y position
|
||||
bullet[n].incY(bullet[n].getVelY());
|
||||
|
||||
//bullet disappears at top/bottom edge
|
||||
if (bullet[n].getY() < 0 ||
|
||||
bullet[n].getY() > getSize().height)
|
||||
{
|
||||
bullet[n].setAlive(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*****************************************************
|
||||
* Update the asteroids based on velocity
|
||||
*****************************************************/
|
||||
public void updateAsteroids() {
|
||||
|
||||
//move and rotate the asteroids
|
||||
for (int n = 0; n < ASTEROIDS; n++) {
|
||||
|
||||
//is this asteroid being used?
|
||||
if (ast[n].isAlive()) {
|
||||
|
||||
//update the asteroid's X value
|
||||
ast[n].incX(ast[n].getVelX());
|
||||
|
||||
//warp the asteroid at screen edges
|
||||
if (ast[n].getX() < -20)
|
||||
ast[n].setX(getSize().width + 20);
|
||||
else if (ast[n].getX() > getSize().width + 20)
|
||||
ast[n].setX(-20);
|
||||
|
||||
//update the asteroid's Y value
|
||||
ast[n].incY(ast[n].getVelY());
|
||||
|
||||
//warp the asteroid at screen edges
|
||||
if (ast[n].getY() < -20)
|
||||
ast[n].setY(getSize().height + 20);
|
||||
else if (ast[n].getY() > getSize().height + 20)
|
||||
ast[n].setY(-20);
|
||||
|
||||
//update the asteroid's rotation
|
||||
ast[n].incMoveAngle(ast[n].getRotationVelocity());
|
||||
|
||||
//keep the angle within 0-359 degrees
|
||||
if (ast[n].getMoveAngle() < 0)
|
||||
ast[n].setMoveAngle(360 - ast[n].getRotationVelocity());
|
||||
else if (ast[n].getMoveAngle() > 359)
|
||||
ast[n].setMoveAngle(ast[n].getRotationVelocity());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*****************************************************
|
||||
* Test asteroids for collisions with ship or bullets
|
||||
*****************************************************/
|
||||
public void checkCollisions() {
|
||||
|
||||
//iterate through the asteroids array
|
||||
for (int m = 0; m<ASTEROIDS; m++) {
|
||||
|
||||
//is this asteroid being used?
|
||||
if (ast[m].isAlive()) {
|
||||
|
||||
/*
|
||||
* check for collision with bullet
|
||||
*/
|
||||
for (int n = 0; n < BULLETS; n++) {
|
||||
|
||||
//is this bullet being used?
|
||||
if (bullet[n].isAlive()) {
|
||||
|
||||
//perform the collision test
|
||||
if (ast[m].getBounds().contains(
|
||||
bullet[n].getX(), bullet[n].getY()))
|
||||
{
|
||||
bullet[n].setAlive(false);
|
||||
ast[m].setAlive(false);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* check for collision with ship
|
||||
*/
|
||||
if (ast[m].getBounds().intersects(ship.getBounds())) {
|
||||
ast[m].setAlive(false);
|
||||
ship.setX(320);
|
||||
ship.setY(240);
|
||||
ship.setFaceAngle(0);
|
||||
ship.setVelX(0);
|
||||
ship.setVelY(0);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*****************************************************
|
||||
* key listener events
|
||||
*****************************************************/
|
||||
public void keyReleased(KeyEvent k) { }
|
||||
public void keyTyped(KeyEvent k) { }
|
||||
public void keyPressed(KeyEvent k) {
|
||||
int keyCode = k.getKeyCode();
|
||||
|
||||
switch (keyCode) {
|
||||
|
||||
case KeyEvent.VK_LEFT:
|
||||
//left arrow rotates ship left 5 degrees
|
||||
break;
|
||||
|
||||
case KeyEvent.VK_RIGHT:
|
||||
//right arrow rotates ship right 5 degrees
|
||||
break;
|
||||
|
||||
case KeyEvent.VK_UP:
|
||||
//up arrow adds thrust to ship (1/10 normal speed)
|
||||
break;
|
||||
|
||||
//Ctrl, Enter, or Space can be used to fire weapon
|
||||
case KeyEvent.VK_CONTROL:
|
||||
case KeyEvent.VK_ENTER:
|
||||
case KeyEvent.VK_SPACE:
|
||||
//fire a bullet
|
||||
|
||||
//point bullet in same direction ship is facing
|
||||
|
||||
//fire bullet at angle of the ship
|
||||
break;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
/*****************************************************
|
||||
* calculate X movement value based on direction angle
|
||||
*****************************************************/
|
||||
public double calcAngleMoveX(double angle) {
|
||||
return (double) (Math.cos(angle * Math.PI / 180));
|
||||
}
|
||||
|
||||
/*****************************************************
|
||||
* calculate Y movement value based on direction angle
|
||||
*****************************************************/
|
||||
public double calcAngleMoveY(double angle) {
|
||||
return (double) (Math.sin(angle * Math.PI / 180));
|
||||
}
|
||||
|
||||
}
|
||||
54
01-SOURCES/BaseVectorShape.java
Normal file
54
01-SOURCES/BaseVectorShape.java
Normal file
@@ -0,0 +1,54 @@
|
||||
/*****************************************************
|
||||
* Beginning Java Game Programming, 2nd Edition
|
||||
* by Jonathan S. Harbour
|
||||
* Base vector shape class for polygonal shapes
|
||||
*****************************************************/
|
||||
|
||||
import java.awt.Shape;
|
||||
|
||||
public class BaseVectorShape {
|
||||
//variables
|
||||
private Shape shape;
|
||||
private boolean alive;
|
||||
private double x,y;
|
||||
private double velX, velY;
|
||||
private double moveAngle, faceAngle;
|
||||
|
||||
//accessor methods
|
||||
public Shape getShape() { return shape; }
|
||||
public boolean isAlive() { return alive; }
|
||||
public double getX() { return x; }
|
||||
public double getY() { return y; }
|
||||
public double getVelX() { return velX; }
|
||||
public double getVelY() { return velY; }
|
||||
public double getMoveAngle() { return moveAngle; }
|
||||
public double getFaceAngle() { return faceAngle; }
|
||||
|
||||
//mutator methods
|
||||
public void setShape(Shape shape) { this.shape = shape; }
|
||||
public void setAlive(boolean alive) { this.alive = alive; }
|
||||
public void setX(double x) { this.x = x; }
|
||||
public void incX(double i) { this.x += i; }
|
||||
public void setY(double y) { this.y = y; }
|
||||
public void incY(double i) { this.y += i; }
|
||||
public void setVelX(double velX) { this.velX = velX; }
|
||||
public void incVelX(double i) { this.velX += i; }
|
||||
public void setVelY(double velY) { this.velY = velY; }
|
||||
public void incVelY(double i) { this.velY += i; }
|
||||
public void setFaceAngle(double angle) { this.faceAngle = angle; }
|
||||
public void incFaceAngle(double i) { this.faceAngle += i; }
|
||||
public void setMoveAngle(double angle) { this.moveAngle = angle; }
|
||||
public void incMoveAngle(double i) { this.moveAngle += i; }
|
||||
|
||||
//default constructor
|
||||
BaseVectorShape() {
|
||||
setShape(null);
|
||||
setAlive(false);
|
||||
setX(0.0);
|
||||
setY(0.0);
|
||||
setVelX(0.0);
|
||||
setVelY(0.0);
|
||||
setMoveAngle(0.0);
|
||||
setFaceAngle(0.0);
|
||||
}
|
||||
}
|
||||
27
01-SOURCES/Bullet.java
Normal file
27
01-SOURCES/Bullet.java
Normal file
@@ -0,0 +1,27 @@
|
||||
/*****************************************************
|
||||
* Beginning Java Game Programming, 2nd Edition
|
||||
* by Jonathan S. Harbour
|
||||
* Bullet class - polygonal shape of a bullet
|
||||
*****************************************************/
|
||||
|
||||
import java.awt.*;
|
||||
import java.awt.Rectangle;
|
||||
|
||||
/*********************************************************
|
||||
* Bullet class derives from BaseVectorShape
|
||||
**********************************************************/
|
||||
public class Bullet extends BaseVectorShape {
|
||||
|
||||
//bounding rectangle
|
||||
public Rectangle getBounds() {
|
||||
Rectangle r;
|
||||
r = new Rectangle((int)getX(), (int) getY(), 1, 1);
|
||||
return r;
|
||||
}
|
||||
|
||||
Bullet() {
|
||||
//create the bullet shape
|
||||
setShape(new Rectangle(0, 0, 1, 1));
|
||||
setAlive(false);
|
||||
}
|
||||
}
|
||||
9
01-SOURCES/Hello.java
Normal file
9
01-SOURCES/Hello.java
Normal file
@@ -0,0 +1,9 @@
|
||||
|
||||
public class Hello {
|
||||
|
||||
public static void main(String[] args) {
|
||||
// TODO Auto-generated method stub
|
||||
System.out.println ("Enchant<EFBFBD> de faire votre connaissance");
|
||||
}
|
||||
|
||||
}
|
||||
8
01-SOURCES/HelloWorld.java
Normal file
8
01-SOURCES/HelloWorld.java
Normal file
@@ -0,0 +1,8 @@
|
||||
|
||||
public class HelloWorld {
|
||||
|
||||
public static void main(String[] args) {
|
||||
System.out.println("Bonjour les DUT 1 AN !");
|
||||
}
|
||||
|
||||
}
|
||||
86
01-SOURCES/Methodes.java
Normal file
86
01-SOURCES/Methodes.java
Normal file
@@ -0,0 +1,86 @@
|
||||
|
||||
public class Methodes {
|
||||
|
||||
// L'ordre de declaration des methodes n'a pas d'importance
|
||||
|
||||
//------------------------------------------------------------------
|
||||
// Declarer un nombre variable d'arguments
|
||||
//------------------------------------------------------------------
|
||||
static int somme (int ... valeurs) {
|
||||
int s = 0 ;
|
||||
for (int i=0; i < valeurs.length ; i++)
|
||||
s += valeurs [i];
|
||||
return s ;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------
|
||||
// Procedure tentant d'echanger 2 parametres entiers
|
||||
// Resultat :
|
||||
//------------------------------------------------------------------
|
||||
static void echange (int a, int b) {
|
||||
int aux = b ;
|
||||
b = a ;
|
||||
a = aux ;
|
||||
System.out.println ("durant l'appel apres echange : a = " + a + ", b = " + b);
|
||||
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------
|
||||
// Procedure tentant de modifier la case d'un tableau passe en parametre
|
||||
// Resultat :
|
||||
//------------------------------------------------------------------
|
||||
static void modifierTab (int t[]) {
|
||||
t[0] = 9 ;
|
||||
}
|
||||
|
||||
static void affiche (int a) {
|
||||
System.out.println ("Entree dans affiche : a = " + a);
|
||||
a = 20 ;
|
||||
System.out.println ("Avant de sortir de affiche : a = " + a);
|
||||
}
|
||||
//------------------------------------------------------------------
|
||||
// Programme principal
|
||||
//------------------------------------------------------------------
|
||||
public static void main(String[] args) {
|
||||
|
||||
int a ;
|
||||
a = 10 ;
|
||||
System.out.println ("Avant appel : a = " + a);
|
||||
affiche (a);
|
||||
System.out.println ("Apres appel : a = " + a);
|
||||
|
||||
|
||||
//------------------------------------------------------------------
|
||||
// Nombre variable de parametres
|
||||
//------------------------------------------------------------------
|
||||
System.out.println (somme (1, 2, 3));
|
||||
System.out.println (somme (2, 8));
|
||||
System.out.println (somme ());
|
||||
|
||||
|
||||
//------------------------------------------------------------------
|
||||
// Appel de la procedure tentant d'echanger 2 parametres entiers
|
||||
//------------------------------------------------------------------
|
||||
int i = 1 ;
|
||||
int j = 2 ;
|
||||
System.out.println ("avant appel echange : i = " + i + ", j = " + j);
|
||||
echange (i, j);
|
||||
System.out.println ("apres appel echange : i = " + i + ", j = " + j);
|
||||
|
||||
|
||||
//------------------------------------------------------------------
|
||||
// Appel de la procedure tentant de modifier la case d'un tableau passe en parametre
|
||||
//------------------------------------------------------------------
|
||||
int t[] = {1, 2, 3};
|
||||
|
||||
System.out.println ("\n Affichage avant appel : ");
|
||||
for (int valeur : t)
|
||||
System.out.println (valeur);
|
||||
|
||||
modifierTab (t);
|
||||
|
||||
System.out.println ("\n Affichage apres appel : ");
|
||||
for (int valeur : t)
|
||||
System.out.println (valeur);
|
||||
}
|
||||
}
|
||||
25
01-SOURCES/Ship.java
Normal file
25
01-SOURCES/Ship.java
Normal file
@@ -0,0 +1,25 @@
|
||||
/*****************************************************
|
||||
* Beginning Java Game Programming, 2nd Edition
|
||||
* by Jonathan S. Harbour
|
||||
* Ship class - polygonal shape of the player's ship
|
||||
*****************************************************/
|
||||
import java.awt.Polygon;
|
||||
import java.awt.Rectangle;
|
||||
|
||||
public class Ship extends BaseVectorShape {
|
||||
//define the ship polygon
|
||||
private int[] shipx = { -6, -3, 0, 3, 6, 0 };
|
||||
private int[] shipy = { 6, 7, 7, 7, 6, -7 };
|
||||
|
||||
//bounding rectangle
|
||||
public Rectangle getBounds() {
|
||||
Rectangle r;
|
||||
r = new Rectangle((int)getX() - 6, (int) getY() - 6, 12,12);
|
||||
return r;
|
||||
}
|
||||
|
||||
Ship() {
|
||||
setShape(new Polygon(shipx, shipy, shipx.length));
|
||||
setAlive(true);
|
||||
}
|
||||
}
|
||||
79
01-SOURCES/TableauxEtBoucles.java
Normal file
79
01-SOURCES/TableauxEtBoucles.java
Normal file
@@ -0,0 +1,79 @@
|
||||
import java.util.Arrays;
|
||||
|
||||
|
||||
public class TableauxEtBoucles {
|
||||
|
||||
public static void main(String[] args) {
|
||||
|
||||
//-----------------------------------------------------
|
||||
// Tableau de type de base
|
||||
//-----------------------------------------------------
|
||||
int t [] ; // DECLARATION d'une REFERENCE de type tableau
|
||||
t = new int [3]; // ALLOCATION d'une zone mŽmoire pour n entiers dans le TAS
|
||||
t[2] = 7; // AFFECTATION d'une valeur ˆ une case du tableau
|
||||
System.out.println(t[2]); // ACCES / LECTURE de la valeur d'une case du tableau et affichage
|
||||
|
||||
//-----------------------------------------------------
|
||||
// Parcours du tableau
|
||||
//-----------------------------------------------------
|
||||
|
||||
// Avec une boucle et un boolŽen
|
||||
boolean fini = false ;
|
||||
int i = 0 ;
|
||||
System.out.println ("\n Parcours du tableau avec un boolŽen et une boucle while : ");
|
||||
while (! fini) {
|
||||
System.out.println (t[i]);
|
||||
i++ ;
|
||||
fini = i == t.length ;
|
||||
}
|
||||
|
||||
// Avec une boucle foreach
|
||||
System.out.println ("\n Parcours du tableau avec une boucle foreach : ");
|
||||
for (int valeur : t)
|
||||
System.out.println (valeur);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// Copie d'un tableau
|
||||
int [] t2 = t ; // RECOPIE JUSTE L'ADRESSE DU TABLEAU
|
||||
t2 [0] = 33 ;
|
||||
|
||||
|
||||
|
||||
// Affichage apr<70>s copie : ........................
|
||||
System.out.println ("\n Parcours du tableau t apr<70>s modification t2 = t ; t2[0] = 33 : ");
|
||||
for (int valeur : t)
|
||||
System.out.println (valeur);
|
||||
|
||||
// Initialiser un tableau lors de la dŽclaration
|
||||
double notes [] = {12, 8, 17.5, 2, 19};
|
||||
|
||||
// Affichage avant tri
|
||||
System.out.println ("\n Affichage avant tri : ");
|
||||
for (double valeur : notes)
|
||||
System.out.println (valeur);
|
||||
|
||||
// Trier un tableau
|
||||
Arrays.sort(notes);
|
||||
|
||||
// Affichage apr<70>s tri
|
||||
System.out.println ("\n Affichage apr<70>s tri : ");
|
||||
for (double valeur : notes)
|
||||
System.out.println (valeur);
|
||||
|
||||
//-----------------------------------------------------
|
||||
// Exceptions
|
||||
//-----------------------------------------------------
|
||||
|
||||
// DŽbordement du tableau
|
||||
System.out.println (t[2]);
|
||||
|
||||
// Oubli d'allouer le tableau
|
||||
int tab [];
|
||||
tab = null ;
|
||||
// ...
|
||||
tab[0] = 10 ;
|
||||
}
|
||||
}
|
||||
86
01-SOURCES/TypesDeBase.java
Normal file
86
01-SOURCES/TypesDeBase.java
Normal file
@@ -0,0 +1,86 @@
|
||||
import java.util.Scanner;
|
||||
|
||||
|
||||
public class TypesDeBase {
|
||||
|
||||
public static void main(String[] args) {
|
||||
|
||||
//-----------------------------------------------------
|
||||
// D<>clarations de variables locales <20> la m<>thode main () : types de base qui existent en C
|
||||
//-----------------------------------------------------
|
||||
short s ; // taille : 2 octets
|
||||
int i ; // taille : 4 octets
|
||||
long l ; // taille : 8 octets
|
||||
|
||||
float f ; // taille : 4 octets
|
||||
double d ; // taille : 8 octets
|
||||
char c ; // format Unicode sur 2 octets
|
||||
|
||||
//-----------------------------------------------------
|
||||
// D<>clarations de types de base qui n<>existent pas en C
|
||||
//-----------------------------------------------------
|
||||
byte by ; // taille : 1 octet
|
||||
boolean b ;
|
||||
|
||||
//-----------------------------------------------------
|
||||
// Affectation de quelques valeurs
|
||||
//-----------------------------------------------------
|
||||
i = 0 ;
|
||||
b = true ;
|
||||
c = 'a' ;
|
||||
|
||||
//-----------------------------------------------------
|
||||
// Affichages
|
||||
//-----------------------------------------------------
|
||||
System.out.print (i); // AFFICHE 0.
|
||||
System.out.println (i); // AFFICHE 0 ET VA A LA LIGNE.....
|
||||
System.out.println ("i vaut " + i); // AFFICHE i vaut 0
|
||||
System.out.printf ("affichage format<61> : %3.2f", 100.678); // 100,68.
|
||||
System.out.println (); // ALLER A LA LIGNE
|
||||
|
||||
//-----------------------------------------------------
|
||||
// Lecture au clavier
|
||||
//-----------------------------------------------------
|
||||
Scanner sc = new Scanner(System.in);
|
||||
System.out.println("Veuillez saisir un mot : ");
|
||||
String str = sc.nextLine();
|
||||
System.out.println("Vous avez saisi : " + str); // AFFICHE Vous avez saisi : au revoir
|
||||
|
||||
System.out.println("Veuillez saisir un entier : ");
|
||||
int j = sc.nextInt();
|
||||
System.out.println("Vous avez saisi le nombre : " + j); // Vous avez saisi le nombre : 20
|
||||
|
||||
//-----------------------------------------------------
|
||||
// D<>claration de constantes et initialisations
|
||||
//-----------------------------------------------------
|
||||
final int N = 20 ; //.....................
|
||||
|
||||
final int M ;
|
||||
System.out.println("Veuillez saisir un entier : ");
|
||||
M = sc.nextInt();
|
||||
// N = 10 ; => erreur de compilation
|
||||
|
||||
//-----------------------------------------------------
|
||||
// Conversions implicites
|
||||
//-----------------------------------------------------
|
||||
int k = 1000 ;
|
||||
long lo ;
|
||||
lo = k ;
|
||||
|
||||
//-----------------------------------------------------
|
||||
// Conversions explicites (cast)
|
||||
//-----------------------------------------------------
|
||||
i = (int) 2.5 ;
|
||||
System.out.println ("valeur de (int) 2.5 : " + i);
|
||||
|
||||
//-----------------------------------------------------
|
||||
// Gestion des erreurs en Java
|
||||
//-----------------------------------------------------
|
||||
|
||||
// Diviser par z<>ro
|
||||
i = i / 0 ;
|
||||
|
||||
// Saisir un caract<63>re alors qu'on attend un nombre
|
||||
|
||||
}
|
||||
}
|
||||
28
02-SOURCES/Assurance.java
Normal file
28
02-SOURCES/Assurance.java
Normal file
@@ -0,0 +1,28 @@
|
||||
public class Assurance {
|
||||
|
||||
public static void main(String[] args) {
|
||||
// Declarer une reference a une voiture
|
||||
Voiture scenic ;
|
||||
|
||||
|
||||
// Utiliser l'operateur new
|
||||
// - allouer de la place memoire dans le tas pour tous les attributs de cet objet
|
||||
// - initialiser les attributs <20> des valeurs par d<>fauut
|
||||
// - retourner l'adresse de la zone allouee
|
||||
scenic = new Voiture ();
|
||||
|
||||
// Affecter des valeurs aux attributs de cet objet
|
||||
scenic.annee = 1998 ;
|
||||
|
||||
// Afficher les valeurs des attributs de cet objet
|
||||
System.out.println(" Annee scenic : " + scenic.annee);
|
||||
|
||||
// Declarer une reference vers une 2eme voiture
|
||||
Voiture audi ;
|
||||
|
||||
// Creer un objet, modifier les attributs et les afficher
|
||||
audi = new Voiture ();
|
||||
audi.annee = 2008 ;
|
||||
System.out.println(" Annee audi : " + audi.annee);
|
||||
}
|
||||
}
|
||||
26
02-SOURCES/CabinetAssurance.java
Normal file
26
02-SOURCES/CabinetAssurance.java
Normal file
@@ -0,0 +1,26 @@
|
||||
|
||||
public class CabinetAssurance {
|
||||
|
||||
final int NB_MAX = 10 ;
|
||||
|
||||
Voiture [] voitures ;
|
||||
int nbVoitures ;
|
||||
|
||||
CabinetAssurance () {
|
||||
voitures = new Voiture [NB_MAX];
|
||||
}
|
||||
|
||||
void ajouterVoiture (Voiture v1) {
|
||||
voitures[nbVoitures] = v1 ;
|
||||
nbVoitures++ ;
|
||||
}
|
||||
public static void main(String[] args) {
|
||||
CabinetAssurance a = new CabinetAssurance();
|
||||
|
||||
Voiture durand = new Voiture ();
|
||||
durand.annee = 1999 ;
|
||||
|
||||
a.ajouterVoiture(durand);
|
||||
}
|
||||
|
||||
}
|
||||
11
02-SOURCES/Ferme.java
Normal file
11
02-SOURCES/Ferme.java
Normal file
@@ -0,0 +1,11 @@
|
||||
|
||||
public class Ferme {
|
||||
public static void main(String[] args) {
|
||||
Panier cabas = new Panier ();
|
||||
System.out.println (cabas.nbEmplacements);
|
||||
|
||||
PanierAC pJC = new PanierAC (2, 100, 12.5);
|
||||
PanierAC pBob = new PanierAC (3, 50, 3.5);
|
||||
pJC.prix = 37 ;
|
||||
}
|
||||
}
|
||||
25
02-SOURCES/Joueur.java
Normal file
25
02-SOURCES/Joueur.java
Normal file
@@ -0,0 +1,25 @@
|
||||
|
||||
public class Joueur {
|
||||
final int SCORE_MAX ;
|
||||
static int nbJoueur ;
|
||||
int numero ;
|
||||
|
||||
Joueur () {
|
||||
SCORE_MAX = 10 ;
|
||||
nbJoueur ++ ;
|
||||
numero = nbJoueur ;
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
|
||||
Joueur j1 = new Joueur ();
|
||||
System.out.println (nbJoueur);
|
||||
System.out.println ("no j1 : " + j1.numero);
|
||||
|
||||
Joueur j2 = new Joueur ();
|
||||
System.out.println (nbJoueur);
|
||||
System.out.println ("no j2 : " + j2.numero);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
24
02-SOURCES/Panier.java
Normal file
24
02-SOURCES/Panier.java
Normal file
@@ -0,0 +1,24 @@
|
||||
|
||||
public class Panier {
|
||||
|
||||
int poids ;
|
||||
int taille ;
|
||||
double prix ;
|
||||
int nbEmplacements ;
|
||||
|
||||
Panier () {
|
||||
// Par d<>faut initialisation
|
||||
// <20> 2 emplacements dans le panier
|
||||
nbEmplacements = 2 ;
|
||||
int i ;
|
||||
i = 10 ;
|
||||
}
|
||||
|
||||
public static void main (String args []) {
|
||||
Panier p1 = new Panier ();
|
||||
System.out.println (p1.nbEmplacements);
|
||||
System.out.println (p1.taille);
|
||||
p1.nbEmplacements = 3 ;
|
||||
System.out.println (p1.nbEmplacements);
|
||||
}
|
||||
}
|
||||
26
02-SOURCES/PanierAC.java
Normal file
26
02-SOURCES/PanierAC.java
Normal file
@@ -0,0 +1,26 @@
|
||||
// Version de la classe Panier avec un constructeur
|
||||
// avec des param<61>tres
|
||||
|
||||
public class PanierAC {
|
||||
|
||||
int poids ;
|
||||
int taille ;
|
||||
double prix ;
|
||||
int nbEmplacements ;
|
||||
|
||||
PanierAC (int p, int t, double pr) {
|
||||
// Par d<>faut initialisation
|
||||
// <20> 2 emplacements dans le panier
|
||||
nbEmplacements = 2 ;
|
||||
poids = p ;
|
||||
taille = t ;
|
||||
prix = pr ;
|
||||
System.out.println ("Dans le constructeur prix vaut " + prix);
|
||||
}
|
||||
|
||||
public static void main (String args []) {
|
||||
PanierAC p1 = new PanierAC (2, 100, 12.5);
|
||||
PanierAC p2 = new PanierAC (2, 100, 7.8 );
|
||||
|
||||
}
|
||||
}
|
||||
4
02-SOURCES/Personne.java
Normal file
4
02-SOURCES/Personne.java
Normal file
@@ -0,0 +1,4 @@
|
||||
|
||||
public class Personne {
|
||||
int anneeNaissance ;
|
||||
}
|
||||
9
02-SOURCES/Test.java
Normal file
9
02-SOURCES/Test.java
Normal file
@@ -0,0 +1,9 @@
|
||||
|
||||
public class Test {
|
||||
|
||||
// Ok
|
||||
static final int CONST = 1;
|
||||
public static void main(String[] args) {
|
||||
System.out.println(CONST);
|
||||
}
|
||||
}
|
||||
6
02-SOURCES/Voiture.java
Normal file
6
02-SOURCES/Voiture.java
Normal file
@@ -0,0 +1,6 @@
|
||||
|
||||
public class Voiture {
|
||||
int annee ;
|
||||
int puissance ;
|
||||
double valeur ;
|
||||
}
|
||||
6
02-SOURCES/VoitureAttribut.java
Normal file
6
02-SOURCES/VoitureAttribut.java
Normal file
@@ -0,0 +1,6 @@
|
||||
|
||||
public class VoitureAttribut {
|
||||
int annee ;
|
||||
int puissance ;
|
||||
double valeur ;
|
||||
}
|
||||
32
02-SOURCES/VoitureConstructeur.java
Normal file
32
02-SOURCES/VoitureConstructeur.java
Normal file
@@ -0,0 +1,32 @@
|
||||
|
||||
public class VoitureConstructeur {
|
||||
int annee ;
|
||||
int puissance ;
|
||||
double valeur ;
|
||||
|
||||
/*
|
||||
* Si on ne d<>finit aucun constructeur,
|
||||
* le compilateur en d<>finit un par d<>faut
|
||||
* qui ne prend aucun param<61>tre
|
||||
* (et qui ne fait rien).
|
||||
* Si on d<>finit un constructeur avec des param<61>tres,
|
||||
* le compilateur ne d<>finit plus de constructeur
|
||||
* par d<>faut sans param<61>tres
|
||||
* => c'est <20> vous de le d<>finir si vous voulez l'utiliser
|
||||
*/
|
||||
public static void main (String args[]) {
|
||||
VoitureConstructeur v ;
|
||||
v = new VoitureConstructeur (2007, 7);
|
||||
VoitureConstructeur v2 = new VoitureConstructeur (); // ERREUR CAR LE CONSTRUCTEUR PAR DEFAUT N'A PAS ETE CREE
|
||||
}
|
||||
|
||||
VoitureConstructeur () {
|
||||
|
||||
}
|
||||
|
||||
VoitureConstructeur (int an, double valeur) {
|
||||
annee = an ;
|
||||
this.valeur = valeur ; // CAR L'ATTRIBUT A LE MEME NOM QU'UN PARAMETRE
|
||||
}
|
||||
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user