old projects

This commit is contained in:
2022-10-12 19:59:56 +02:00
parent 3415a1383b
commit 199325ac33
75 changed files with 5172 additions and 0 deletions

View File

@@ -0,0 +1,28 @@
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"type": "java",
"name": "Launch programm",
"request": "launch",
"mainClass": "programm",
"projectName": "Bwinf_Pakplatz_vscode_7dd615c3"
},
{
"type": "java",
"name": "Launch Current File",
"request": "launch",
"mainClass": "${file}"
},
{
"type": "java",
"name": "Launch programm",
"request": "launch",
"mainClass": "programm",
"projectName": "Bwinf_Pakplatz_backup_5ab7755b"
}
]
}

View File

@@ -0,0 +1,12 @@
------------------------------------------------------------------------
This is the project README file. Here, you should describe your project.
Tell the reader (someone who does not know anything about this project)
all he/she needs to know. The comments should usually include at least:
------------------------------------------------------------------------
PROJECT TITLE:
PURPOSE OF PROJECT:
VERSION or DATE:
HOW TO START THIS PROJECT:
AUTHORS:
USER INSTRUCTIONS:

Binary file not shown.

View File

@@ -0,0 +1,20 @@
<!DOCTYPE HTML>
<!-- NewPage -->
<html lang="de">
<head>
<!-- Generated by javadoc (11.0.10) on Thu Sep 23 20:21:36 CEST 2021 -->
<title>All Classes</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta name="dc.created" content="2021-09-23">
<link rel="stylesheet" type="text/css" href="stylesheet.css" title="Style">
<script type="text/javascript" src="script.js"></script>
</head>
<body>
<h1 class="bar">All&nbsp;Classes</h1>
<main role="main" class="indexContainer">
<ul>
<li><a href="programm.html" title="class in &lt;Unnamed&gt;">programm</a></li>
</ul>
</main>
</body>
</html>

View File

@@ -0,0 +1,35 @@
<!DOCTYPE HTML>
<!-- NewPage -->
<html lang="de">
<head>
<!-- Generated by javadoc (11.0.10) on Thu Sep 23 20:21:36 CEST 2021 -->
<title>Constant Field Values</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta name="dc.created" content="2021-09-23">
<link rel="stylesheet" type="text/css" href="stylesheet.css" title="Style">
<script type="text/javascript" src="script.js"></script>
</head>
<body>
<script type="text/javascript"><!--
try {
if (location.href.indexOf('is-external=true') == -1) {
parent.document.title="Constant Field Values";
}
}
catch(err) {
}
//-->
</script>
<noscript>
<div>JavaScript is disabled on your browser.</div>
</noscript>
<main role="main">
<div class="header">
<h1 title="Constant Field Values" class="title">Constant Field Values</h1>
<section role="region">
<h2 title="Contents">Contents</h2>
</section>
</div>
</main>
</body>
</html>

View File

@@ -0,0 +1 @@
unnamed package

View File

@@ -0,0 +1,23 @@
<!DOCTYPE HTML>
<!-- NewPage -->
<html lang="de">
<head>
<!-- Generated by javadoc (11.0.10) on Thu Sep 23 20:21:36 CEST 2021 -->
<title>Generated Documentation (Untitled)</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<script type="text/javascript">window.location.replace('programm.html')</script>
<noscript>
<meta http-equiv="Refresh" content="0;programm.html">
</noscript>
<link rel="canonical" href="programm.html">
<link rel="stylesheet" type="text/css" href="stylesheet.css" title="Style">
</head>
<body>
<main role="main">
<noscript>
<p>JavaScript is disabled on your browser.</p>
</noscript>
<p><a href="programm.html">programm.html</a></p>
</main>
</body>
</html>

View File

@@ -0,0 +1,36 @@
Class documentation
<---- javadoc command: ---->
C:\Program Files\BlueJ\jdk\bin\javadoc.exe
-author
-version
-nodeprecated
-package
-Xdoclint:none
-noindex
-notree
-nohelp
-nonavbar
-source
11
-classpath
C:\Program Files\BlueJ\lib\bluejcore.jar;C:\Program Files\BlueJ\lib\junit-4.12.jar;C:\Program Files\BlueJ\lib\junit-jupiter-5.5.2.jar;C:\Program Files\BlueJ\lib\junit-jupiter-api-5.5.2.jar;C:\Program Files\BlueJ\lib\junit-jupiter-engine-5.5.2.jar;C:\Program Files\BlueJ\lib\junit-jupiter-migrationsupport-5.5.2.jar;C:\Program Files\BlueJ\lib\junit-jupiter-params-5.5.2.jar;C:\Program Files\BlueJ\lib\junit-platform-commons-1.5.2.jar;C:\Program Files\BlueJ\lib\junit-platform-console-1.5.2.jar;C:\Program Files\BlueJ\lib\junit-platform-console-standalone-1.5.2.jar;C:\Program Files\BlueJ\lib\junit-platform-engine-1.5.2.jar;C:\Program Files\BlueJ\lib\junit-platform-launcher-1.5.2.jar;C:\Program Files\BlueJ\lib\junit-platform-reporting-1.5.2.jar;C:\Program Files\BlueJ\lib\junit-platform-runner-1.5.2.jar;C:\Program Files\BlueJ\lib\junit-platform-suite-api-1.5.2.jar;C:\Program Files\BlueJ\lib\junit-platform-testkit-1.5.2.jar;C:\Program Files\BlueJ\lib\junit-quickcheck-core-0.9.jar;C:\Program Files\BlueJ\lib\junit-vintage-engine-5.5.2.jar;C:\Program Files\BlueJ\lib\hamcrest-core-1.3.jar;C:\Program Files\BlueJ\lib\hamcrest-library-1.3.jar;C:\Program Files\BlueJ\lib\lang-stride.jar;C:\Program Files\BlueJ\lib\javafx\lib\javafx.base.jar;C:\Program Files\BlueJ\lib\javafx\lib\javafx.controls.jar;C:\Program Files\BlueJ\lib\javafx\lib\javafx.fxml.jar;C:\Program Files\BlueJ\lib\javafx\lib\javafx.graphics.jar;C:\Program Files\BlueJ\lib\javafx\lib\javafx.media.jar;C:\Program Files\BlueJ\lib\javafx\lib\javafx.properties.jar;C:\Program Files\BlueJ\lib\javafx\lib\javafx.swing.jar;C:\Program Files\BlueJ\lib\javafx\lib\javafx.web.jar;C:\Users\Jordi\BWINF_Parkplatz
-d
C:\Users\Jordi\BWINF_Parkplatz\doc
-encoding
UTF-8
-charset
UTF-8
C:\Users\Jordi\BWINF_Parkplatz\programm.java
<---- end of javadoc command ---->
Loading source file C:\Users\Jordi\BWINF_Parkplatz\programm.java...
Constructing Javadoc information...
Standard Doclet version 11.0.10
Building tree for all the packages and classes...
Generating C:\Users\Jordi\BWINF_Parkplatz\doc\programm.html...
Generating C:\Users\Jordi\BWINF_Parkplatz\doc\package-summary.html...
Generating C:\Users\Jordi\BWINF_Parkplatz\doc\constant-values.html...
Building index for all the packages and classes...
Building index for all classes...
Generating C:\Users\Jordi\BWINF_Parkplatz\doc\allclasses.html...
Generating C:\Users\Jordi\BWINF_Parkplatz\doc\allclasses.html...
Generating C:\Users\Jordi\BWINF_Parkplatz\doc\index.html...

View File

@@ -0,0 +1,51 @@
<!DOCTYPE HTML>
<!-- NewPage -->
<html lang="de">
<head>
<!-- Generated by javadoc (11.0.10) on Thu Sep 23 20:21:36 CEST 2021 -->
<title>&lt;Unnamed&gt;</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta name="dc.created" content="2021-09-23">
<link rel="stylesheet" type="text/css" href="stylesheet.css" title="Style">
<script type="text/javascript" src="script.js"></script>
</head>
<body>
<script type="text/javascript"><!--
try {
if (location.href.indexOf('is-external=true') == -1) {
parent.document.title="<Unnamed>";
}
}
catch(err) {
}
//-->
</script>
<noscript>
<div>JavaScript is disabled on your browser.</div>
</noscript>
<main role="main">
<div class="header">
<h1 title="Package" class="title">Package&nbsp;&lt;Unnamed&gt;</h1>
</div>
<div class="contentContainer">
<ul class="blockList">
<li class="blockList">
<table class="typeSummary">
<caption><span>Class Summary</span><span class="tabEnd">&nbsp;</span></caption>
<tr>
<th class="colFirst" scope="col">Class</th>
<th class="colLast" scope="col">Description</th>
</tr>
<tbody>
<tr class="altColor">
<th class="colFirst" scope="row"><a href="programm.html" title="class in &lt;Unnamed&gt;">programm</a></th>
<td class="colLast">&nbsp;</td>
</tr>
</tbody>
</table>
</li>
</ul>
</div>
</main>
</body>
</html>

View File

@@ -0,0 +1,467 @@
<!DOCTYPE HTML>
<!-- NewPage -->
<html lang="de">
<head>
<!-- Generated by javadoc (11.0.10) on Thu Sep 23 20:21:36 CEST 2021 -->
<title>programm</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta name="dc.created" content="2021-09-23">
<link rel="stylesheet" type="text/css" href="stylesheet.css" title="Style">
<script type="text/javascript" src="script.js"></script>
</head>
<body>
<script type="text/javascript"><!--
try {
if (location.href.indexOf('is-external=true') == -1) {
parent.document.title="programm";
}
}
catch(err) {
}
//-->
var data = {"i0":10,"i1":10,"i2":10,"i3":10,"i4":10,"i5":10,"i6":10,"i7":10,"i8":10,"i9":10,"i10":10,"i11":10};
var tabs = {65535:["t0","All Methods"],2:["t2","Instance Methods"],8:["t4","Concrete Methods"]};
var altColor = "altColor";
var rowColor = "rowColor";
var tableTab = "tableTab";
var activeTableTab = "activeTableTab";
</script>
<noscript>
<div>JavaScript is disabled on your browser.</div>
</noscript>
<!-- ======== START OF CLASS DATA ======== -->
<main role="main">
<div class="header">
<h2 title="Class programm" class="title">Class programm</h2>
</div>
<div class="contentContainer">
<ul class="inheritance">
<li>java.lang.Object</li>
<li>
<ul class="inheritance">
<li>programm</li>
</ul>
</li>
</ul>
<div class="description">
<ul class="blockList">
<li class="blockList">
<hr>
<pre>public class <span class="typeNameLabel">programm</span>
extends java.lang.Object</pre>
</li>
</ul>
</div>
<div class="summary">
<ul class="blockList">
<li class="blockList">
<!-- =========== FIELD SUMMARY =========== -->
<section role="region">
<ul class="blockList">
<li class="blockList"><a id="field.summary">
<!-- -->
</a>
<h3>Field Summary</h3>
<table class="memberSummary">
<caption><span>Fields</span><span class="tabEnd">&nbsp;</span></caption>
<tr>
<th class="colFirst" scope="col">Modifier and Type</th>
<th class="colSecond" scope="col">Field</th>
<th class="colLast" scope="col">Description</th>
</tr>
<tr class="altColor">
<td class="colFirst"><code>char[]</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#arr">arr</a></span></code></th>
<td class="colLast">&nbsp;</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>(package private) java.lang.String</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#filename">filename</a></span></code></th>
<td class="colLast">&nbsp;</td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>(package private) java.lang.String</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#first">first</a></span></code></th>
<td class="colLast">&nbsp;</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>(package private) int</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#hCars">hCars</a></span></code></th>
<td class="colLast">&nbsp;</td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>(package private) java.lang.String</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#last">last</a></span></code></th>
<td class="colLast">&nbsp;</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>(package private) java.util.Scanner</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#scan">scan</a></span></code></th>
<td class="colLast">&nbsp;</td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>char[]</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#tmpArr">tmpArr</a></span></code></th>
<td class="colLast">&nbsp;</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>(package private) int</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#vCars">vCars</a></span></code></th>
<td class="colLast">&nbsp;</td>
</tr>
</table>
</li>
</ul>
</section>
<!-- ======== CONSTRUCTOR SUMMARY ======== -->
<section role="region">
<ul class="blockList">
<li class="blockList"><a id="constructor.summary">
<!-- -->
</a>
<h3>Constructor Summary</h3>
<table class="memberSummary">
<caption><span>Constructors</span><span class="tabEnd">&nbsp;</span></caption>
<tr>
<th class="colFirst" scope="col">Constructor</th>
<th class="colLast" scope="col">Description</th>
</tr>
<tr class="altColor">
<th class="colConstructorName" scope="row"><code><span class="memberNameLink"><a href="#%3Cinit%3E()">programm</a></span>()</code></th>
<td class="colLast">&nbsp;</td>
</tr>
<tr class="rowColor">
<th class="colConstructorName" scope="row"><code><span class="memberNameLink"><a href="#%3Cinit%3E(java.lang.String)">programm</a></span>&#8203;(java.lang.String&nbsp;pFilename)</code></th>
<td class="colLast">&nbsp;</td>
</tr>
</table>
</li>
</ul>
</section>
<!-- ========== METHOD SUMMARY =========== -->
<section role="region">
<ul class="blockList">
<li class="blockList"><a id="method.summary">
<!-- -->
</a>
<h3>Method Summary</h3>
<table class="memberSummary">
<caption><span id="t0" class="activeTableTab"><span>All Methods</span><span class="tabEnd">&nbsp;</span></span><span id="t2" class="tableTab"><span><a href="javascript:show(2);">Instance Methods</a></span><span class="tabEnd">&nbsp;</span></span><span id="t4" class="tableTab"><span><a href="javascript:show(8);">Concrete Methods</a></span><span class="tabEnd">&nbsp;</span></span></caption>
<tr>
<th class="colFirst" scope="col">Modifier and Type</th>
<th class="colSecond" scope="col">Method</th>
<th class="colLast" scope="col">Description</th>
</tr>
<tr id="i0" class="altColor">
<td class="colFirst"><code>boolean</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#canLeft(int)">canLeft</a></span>&#8203;(int&nbsp;ppos)</code></th>
<td class="colLast">&nbsp;</td>
</tr>
<tr id="i1" class="rowColor">
<td class="colFirst"><code>boolean</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#canRight(int)">canRight</a></span>&#8203;(int&nbsp;ppos)</code></th>
<td class="colLast">&nbsp;</td>
</tr>
<tr id="i2" class="altColor">
<td class="colFirst"><code>void</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#createArray()">createArray</a></span>()</code></th>
<td class="colLast">&nbsp;</td>
</tr>
<tr id="i3" class="rowColor">
<td class="colFirst"><code>int</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#hCars()">hCars</a></span>()</code></th>
<td class="colLast">&nbsp;</td>
</tr>
<tr id="i4" class="altColor">
<td class="colFirst"><code>void</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#outputVars()">outputVars</a></span>()</code></th>
<td class="colLast">&nbsp;</td>
</tr>
<tr id="i5" class="rowColor">
<td class="colFirst"><code>void</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#read()">read</a></span>()</code></th>
<td class="colLast">&nbsp;</td>
</tr>
<tr id="i6" class="altColor">
<td class="colFirst"><code>void</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#readFile()">readFile</a></span>()</code></th>
<td class="colLast">&nbsp;</td>
</tr>
<tr id="i7" class="rowColor">
<td class="colFirst"><code>void</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#rereadFile()">rereadFile</a></span>()</code></th>
<td class="colLast">&nbsp;</td>
</tr>
<tr id="i8" class="altColor">
<td class="colFirst"><code>void</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#setArr()">setArr</a></span>()</code></th>
<td class="colLast">&nbsp;</td>
</tr>
<tr id="i9" class="rowColor">
<td class="colFirst"><code>void</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#solve()">solve</a></span>()</code></th>
<td class="colLast">&nbsp;</td>
</tr>
<tr id="i10" class="altColor">
<td class="colFirst"><code>void</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#test()">test</a></span>()</code></th>
<td class="colLast">&nbsp;</td>
</tr>
<tr id="i11" class="rowColor">
<td class="colFirst"><code>int</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#vCars()">vCars</a></span>()</code></th>
<td class="colLast">&nbsp;</td>
</tr>
</table>
<ul class="blockList">
<li class="blockList"><a id="methods.inherited.from.class.java.lang.Object">
<!-- -->
</a>
<h3>Methods inherited from class&nbsp;java.lang.Object</h3>
<code>clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait</code></li>
</ul>
</li>
</ul>
</section>
</li>
</ul>
</div>
<div class="details">
<ul class="blockList">
<li class="blockList">
<!-- ============ FIELD DETAIL =========== -->
<section role="region">
<ul class="blockList">
<li class="blockList"><a id="field.detail">
<!-- -->
</a>
<h3>Field Detail</h3>
<a id="scan">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>scan</h4>
<pre>java.util.Scanner scan</pre>
</li>
</ul>
<a id="first">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>first</h4>
<pre>java.lang.String first</pre>
</li>
</ul>
<a id="last">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>last</h4>
<pre>java.lang.String last</pre>
</li>
</ul>
<a id="filename">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>filename</h4>
<pre>java.lang.String filename</pre>
</li>
</ul>
<a id="hCars">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>hCars</h4>
<pre>int hCars</pre>
</li>
</ul>
<a id="vCars">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>vCars</h4>
<pre>int vCars</pre>
</li>
</ul>
<a id="arr">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>arr</h4>
<pre>public&nbsp;char[] arr</pre>
</li>
</ul>
<a id="tmpArr">
<!-- -->
</a>
<ul class="blockListLast">
<li class="blockList">
<h4>tmpArr</h4>
<pre>public&nbsp;char[] tmpArr</pre>
</li>
</ul>
</li>
</ul>
</section>
<!-- ========= CONSTRUCTOR DETAIL ======== -->
<section role="region">
<ul class="blockList">
<li class="blockList"><a id="constructor.detail">
<!-- -->
</a>
<h3>Constructor Detail</h3>
<a id="&lt;init&gt;()">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>programm</h4>
<pre>public&nbsp;programm()</pre>
</li>
</ul>
<a id="&lt;init&gt;(java.lang.String)">
<!-- -->
</a>
<ul class="blockListLast">
<li class="blockList">
<h4>programm</h4>
<pre>public&nbsp;programm&#8203;(java.lang.String&nbsp;pFilename)</pre>
</li>
</ul>
</li>
</ul>
</section>
<!-- ============ METHOD DETAIL ========== -->
<section role="region">
<ul class="blockList">
<li class="blockList"><a id="method.detail">
<!-- -->
</a>
<h3>Method Detail</h3>
<a id="readFile()">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>readFile</h4>
<pre class="methodSignature">public&nbsp;void&nbsp;readFile()</pre>
</li>
</ul>
<a id="rereadFile()">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>rereadFile</h4>
<pre class="methodSignature">public&nbsp;void&nbsp;rereadFile()</pre>
</li>
</ul>
<a id="read()">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>read</h4>
<pre class="methodSignature">public&nbsp;void&nbsp;read()</pre>
</li>
</ul>
<a id="createArray()">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>createArray</h4>
<pre class="methodSignature">public&nbsp;void&nbsp;createArray()</pre>
</li>
</ul>
<a id="outputVars()">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>outputVars</h4>
<pre class="methodSignature">public&nbsp;void&nbsp;outputVars()</pre>
</li>
</ul>
<a id="test()">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>test</h4>
<pre class="methodSignature">public&nbsp;void&nbsp;test()</pre>
</li>
</ul>
<a id="hCars()">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>hCars</h4>
<pre class="methodSignature">public&nbsp;int&nbsp;hCars()</pre>
</li>
</ul>
<a id="vCars()">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>vCars</h4>
<pre class="methodSignature">public&nbsp;int&nbsp;vCars()</pre>
</li>
</ul>
<a id="solve()">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>solve</h4>
<pre class="methodSignature">public&nbsp;void&nbsp;solve()</pre>
</li>
</ul>
<a id="setArr()">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>setArr</h4>
<pre class="methodSignature">public&nbsp;void&nbsp;setArr()</pre>
</li>
</ul>
<a id="canLeft(int)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>canLeft</h4>
<pre class="methodSignature">public&nbsp;boolean&nbsp;canLeft&#8203;(int&nbsp;ppos)</pre>
</li>
</ul>
<a id="canRight(int)">
<!-- -->
</a>
<ul class="blockListLast">
<li class="blockList">
<h4>canRight</h4>
<pre class="methodSignature">public&nbsp;boolean&nbsp;canRight&#8203;(int&nbsp;ppos)</pre>
</li>
</ul>
</li>
</ul>
</section>
</li>
</ul>
</div>
</div>
</main>
<!-- ========= END OF CLASS DATA ========= -->
</body>
</html>

View File

@@ -0,0 +1,149 @@
/*
* Copyright (c) 2013, 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
var moduleSearchIndex;
var packageSearchIndex;
var typeSearchIndex;
var memberSearchIndex;
var tagSearchIndex;
function loadScripts(doc, tag) {
createElem(doc, tag, 'jquery/jszip/dist/jszip.js');
createElem(doc, tag, 'jquery/jszip-utils/dist/jszip-utils.js');
if (window.navigator.userAgent.indexOf('MSIE ') > 0 || window.navigator.userAgent.indexOf('Trident/') > 0 ||
window.navigator.userAgent.indexOf('Edge/') > 0) {
createElem(doc, tag, 'jquery/jszip-utils/dist/jszip-utils-ie.js');
}
createElem(doc, tag, 'search.js');
$.get(pathtoroot + "module-search-index.zip")
.done(function() {
JSZipUtils.getBinaryContent(pathtoroot + "module-search-index.zip", function(e, data) {
JSZip.loadAsync(data).then(function(zip){
zip.file("module-search-index.json").async("text").then(function(content){
moduleSearchIndex = JSON.parse(content);
});
});
});
});
$.get(pathtoroot + "package-search-index.zip")
.done(function() {
JSZipUtils.getBinaryContent(pathtoroot + "package-search-index.zip", function(e, data) {
JSZip.loadAsync(data).then(function(zip){
zip.file("package-search-index.json").async("text").then(function(content){
packageSearchIndex = JSON.parse(content);
});
});
});
});
$.get(pathtoroot + "type-search-index.zip")
.done(function() {
JSZipUtils.getBinaryContent(pathtoroot + "type-search-index.zip", function(e, data) {
JSZip.loadAsync(data).then(function(zip){
zip.file("type-search-index.json").async("text").then(function(content){
typeSearchIndex = JSON.parse(content);
});
});
});
});
$.get(pathtoroot + "member-search-index.zip")
.done(function() {
JSZipUtils.getBinaryContent(pathtoroot + "member-search-index.zip", function(e, data) {
JSZip.loadAsync(data).then(function(zip){
zip.file("member-search-index.json").async("text").then(function(content){
memberSearchIndex = JSON.parse(content);
});
});
});
});
$.get(pathtoroot + "tag-search-index.zip")
.done(function() {
JSZipUtils.getBinaryContent(pathtoroot + "tag-search-index.zip", function(e, data) {
JSZip.loadAsync(data).then(function(zip){
zip.file("tag-search-index.json").async("text").then(function(content){
tagSearchIndex = JSON.parse(content);
});
});
});
});
if (!moduleSearchIndex) {
createElem(doc, tag, 'module-search-index.js');
}
if (!packageSearchIndex) {
createElem(doc, tag, 'package-search-index.js');
}
if (!typeSearchIndex) {
createElem(doc, tag, 'type-search-index.js');
}
if (!memberSearchIndex) {
createElem(doc, tag, 'member-search-index.js');
}
if (!tagSearchIndex) {
createElem(doc, tag, 'tag-search-index.js');
}
$(window).resize(function() {
$('.navPadding').css('padding-top', $('.fixedNav').css("height"));
});
}
function createElem(doc, tag, path) {
var script = doc.createElement(tag);
var scriptElement = doc.getElementsByTagName(tag)[0];
script.src = pathtoroot + path;
scriptElement.parentNode.insertBefore(script, scriptElement);
}
function show(type) {
count = 0;
for (var key in data) {
var row = document.getElementById(key);
if ((data[key] & type) !== 0) {
row.style.display = '';
row.className = (count++ % 2) ? rowColor : altColor;
}
else
row.style.display = 'none';
}
updateTabs(type);
}
function updateTabs(type) {
for (var value in tabs) {
var sNode = document.getElementById(tabs[value][0]);
var spanNode = sNode.firstChild;
if (value == type) {
sNode.className = activeTableTab;
spanNode.innerHTML = tabs[value][1];
}
else {
sNode.className = tableTab;
spanNode.innerHTML = "<a href=\"javascript:show("+ value + ");\">" + tabs[value][1] + "</a>";
}
}
}
function updateModuleFrame(pFrame, cFrame) {
top.packageFrame.location = pFrame;
top.classFrame.location = cFrame;
}

View File

@@ -0,0 +1,906 @@
/*
* Javadoc style sheet
*/
@import url('resources/fonts/dejavu.css');
/*
* Styles for individual HTML elements.
*
* These are styles that are specific to individual HTML elements. Changing them affects the style of a particular
* HTML element throughout the page.
*/
body {
background-color:#ffffff;
color:#353833;
font-family:'DejaVu Sans', Arial, Helvetica, sans-serif;
font-size:14px;
margin:0;
padding:0;
height:100%;
width:100%;
}
iframe {
margin:0;
padding:0;
height:100%;
width:100%;
overflow-y:scroll;
border:none;
}
a:link, a:visited {
text-decoration:none;
color:#4A6782;
}
a[href]:hover, a[href]:focus {
text-decoration:none;
color:#bb7a2a;
}
a[name] {
color:#353833;
}
a[name]:before, a[name]:target, a[id]:before, a[id]:target {
content:"";
display:inline-block;
position:relative;
padding-top:129px;
margin-top:-129px;
}
pre {
font-family:'DejaVu Sans Mono', monospace;
font-size:14px;
}
h1 {
font-size:20px;
}
h2 {
font-size:18px;
}
h3 {
font-size:16px;
font-style:italic;
}
h4 {
font-size:13px;
}
h5 {
font-size:12px;
}
h6 {
font-size:11px;
}
ul {
list-style-type:disc;
}
code, tt {
font-family:'DejaVu Sans Mono', monospace;
font-size:14px;
padding-top:4px;
margin-top:8px;
line-height:1.4em;
}
dt code {
font-family:'DejaVu Sans Mono', monospace;
font-size:14px;
padding-top:4px;
}
table tr td dt code {
font-family:'DejaVu Sans Mono', monospace;
font-size:14px;
vertical-align:top;
padding-top:4px;
}
sup {
font-size:8px;
}
/*
* Styles for HTML generated by javadoc.
*
* These are style classes that are used by the standard doclet to generate HTML documentation.
*/
/*
* Styles for document title and copyright.
*/
.clear {
clear:both;
height:0px;
overflow:hidden;
}
.aboutLanguage {
float:right;
padding:0px 21px;
font-size:11px;
z-index:200;
margin-top:-9px;
}
.legalCopy {
margin-left:.5em;
}
.bar a, .bar a:link, .bar a:visited, .bar a:active {
color:#FFFFFF;
text-decoration:none;
}
.bar a:hover, .bar a:focus {
color:#bb7a2a;
}
.tab {
background-color:#0066FF;
color:#ffffff;
padding:8px;
width:5em;
font-weight:bold;
}
/*
* Styles for navigation bar.
*/
.bar {
background-color:#4D7A97;
color:#FFFFFF;
padding:.8em .5em .4em .8em;
height:auto;/*height:1.8em;*/
font-size:11px;
margin:0;
}
.navPadding {
padding-top: 107px;
}
.fixedNav {
position:fixed;
width:100%;
z-index:999;
background-color:#ffffff;
}
.topNav {
background-color:#4D7A97;
color:#FFFFFF;
float:left;
padding:0;
width:100%;
clear:right;
height:2.8em;
padding-top:10px;
overflow:hidden;
font-size:12px;
}
.bottomNav {
margin-top:10px;
background-color:#4D7A97;
color:#FFFFFF;
float:left;
padding:0;
width:100%;
clear:right;
height:2.8em;
padding-top:10px;
overflow:hidden;
font-size:12px;
}
.subNav {
background-color:#dee3e9;
float:left;
width:100%;
overflow:hidden;
font-size:12px;
}
.subNav div {
clear:left;
float:left;
padding:0 0 5px 6px;
text-transform:uppercase;
}
ul.navList, ul.subNavList {
float:left;
margin:0 25px 0 0;
padding:0;
}
ul.navList li{
list-style:none;
float:left;
padding: 5px 6px;
text-transform:uppercase;
}
ul.navListSearch {
float:right;
margin:0 0 0 0;
padding:0;
}
ul.navListSearch li {
list-style:none;
float:right;
padding: 5px 6px;
text-transform:uppercase;
}
ul.navListSearch li label {
position:relative;
right:-16px;
}
ul.subNavList li {
list-style:none;
float:left;
}
.topNav a:link, .topNav a:active, .topNav a:visited, .bottomNav a:link, .bottomNav a:active, .bottomNav a:visited {
color:#FFFFFF;
text-decoration:none;
text-transform:uppercase;
}
.topNav a:hover, .bottomNav a:hover {
text-decoration:none;
color:#bb7a2a;
text-transform:uppercase;
}
.navBarCell1Rev {
background-color:#F8981D;
color:#253441;
margin: auto 5px;
}
.skipNav {
position:absolute;
top:auto;
left:-9999px;
overflow:hidden;
}
/*
* Styles for page header and footer.
*/
.header, .footer {
clear:both;
margin:0 20px;
padding:5px 0 0 0;
}
.indexNav {
position:relative;
font-size:12px;
background-color:#dee3e9;
}
.indexNav ul {
margin-top:0;
padding:5px;
}
.indexNav ul li {
display:inline;
list-style-type:none;
padding-right:10px;
text-transform:uppercase;
}
.indexNav h1 {
font-size:13px;
}
.title {
color:#2c4557;
margin:10px 0;
}
.subTitle {
margin:5px 0 0 0;
}
.header ul {
margin:0 0 15px 0;
padding:0;
}
.footer ul {
margin:20px 0 5px 0;
}
.header ul li, .footer ul li {
list-style:none;
font-size:13px;
}
/*
* Styles for headings.
*/
div.details ul.blockList ul.blockList ul.blockList li.blockList h4, div.details ul.blockList ul.blockList ul.blockListLast li.blockList h4 {
background-color:#dee3e9;
border:1px solid #d0d9e0;
margin:0 0 6px -8px;
padding:7px 5px;
}
ul.blockList ul.blockList ul.blockList li.blockList h3 {
background-color:#dee3e9;
border:1px solid #d0d9e0;
margin:0 0 6px -8px;
padding:7px 5px;
}
ul.blockList ul.blockList li.blockList h3 {
padding:0;
margin:15px 0;
}
ul.blockList li.blockList h2 {
padding:0px 0 20px 0;
}
/*
* Styles for page layout containers.
*/
.contentContainer, .sourceContainer, .classUseContainer, .serializedFormContainer, .constantValuesContainer,
.allClassesContainer, .allPackagesContainer {
clear:both;
padding:10px 20px;
position:relative;
}
.indexContainer {
margin:10px;
position:relative;
font-size:12px;
}
.indexContainer h2 {
font-size:13px;
padding:0 0 3px 0;
}
.indexContainer ul {
margin:0;
padding:0;
}
.indexContainer ul li {
list-style:none;
padding-top:2px;
}
.contentContainer .description dl dt, .contentContainer .details dl dt, .serializedFormContainer dl dt {
font-size:12px;
font-weight:bold;
margin:10px 0 0 0;
color:#4E4E4E;
}
.contentContainer .description dl dd, .contentContainer .details dl dd, .serializedFormContainer dl dd {
margin:5px 0 10px 0px;
font-size:14px;
font-family:'DejaVu Serif', Georgia, "Times New Roman", Times, serif;
}
.serializedFormContainer dl.nameValue dt {
margin-left:1px;
font-size:1.1em;
display:inline;
font-weight:bold;
}
.serializedFormContainer dl.nameValue dd {
margin:0 0 0 1px;
font-size:1.1em;
display:inline;
}
/*
* Styles for lists.
*/
li.circle {
list-style:circle;
}
ul.horizontal li {
display:inline;
font-size:0.9em;
}
ul.inheritance {
margin:0;
padding:0;
}
ul.inheritance li {
display:inline;
list-style:none;
}
ul.inheritance li ul.inheritance {
margin-left:15px;
padding-left:15px;
padding-top:1px;
}
ul.blockList, ul.blockListLast {
margin:10px 0 10px 0;
padding:0;
}
ul.blockList li.blockList, ul.blockListLast li.blockList {
list-style:none;
margin-bottom:15px;
line-height:1.4;
}
ul.blockList ul.blockList li.blockList, ul.blockList ul.blockListLast li.blockList {
padding:0px 20px 5px 10px;
border:1px solid #ededed;
background-color:#f8f8f8;
}
ul.blockList ul.blockList ul.blockList li.blockList, ul.blockList ul.blockList ul.blockListLast li.blockList {
padding:0 0 5px 8px;
background-color:#ffffff;
border:none;
}
ul.blockList ul.blockList ul.blockList ul.blockList li.blockList {
margin-left:0;
padding-left:0;
padding-bottom:15px;
border:none;
}
ul.blockList ul.blockList ul.blockList ul.blockList li.blockListLast {
list-style:none;
border-bottom:none;
padding-bottom:0;
}
table tr td dl, table tr td dl dt, table tr td dl dd {
margin-top:0;
margin-bottom:1px;
}
/*
* Styles for tables.
*/
.overviewSummary, .memberSummary, .typeSummary, .useSummary, .constantsSummary, .deprecatedSummary,
.requiresSummary, .packagesSummary, .providesSummary, .usesSummary {
width:100%;
border-spacing:0;
border-left:1px solid #EEE;
border-right:1px solid #EEE;
border-bottom:1px solid #EEE;
}
.overviewSummary, .memberSummary, .requiresSummary, .packagesSummary, .providesSummary, .usesSummary {
padding:0px;
}
.overviewSummary caption, .memberSummary caption, .typeSummary caption,
.useSummary caption, .constantsSummary caption, .deprecatedSummary caption,
.requiresSummary caption, .packagesSummary caption, .providesSummary caption, .usesSummary caption {
position:relative;
text-align:left;
background-repeat:no-repeat;
color:#253441;
font-weight:bold;
clear:none;
overflow:hidden;
padding:0px;
padding-top:10px;
padding-left:1px;
margin:0px;
white-space:pre;
}
.overviewSummary caption a:link, .memberSummary caption a:link, .typeSummary caption a:link,
.constantsSummary caption a:link, .deprecatedSummary caption a:link,
.requiresSummary caption a:link, .packagesSummary caption a:link, .providesSummary caption a:link,
.usesSummary caption a:link,
.overviewSummary caption a:hover, .memberSummary caption a:hover, .typeSummary caption a:hover,
.constantsSummary caption a:hover, .deprecatedSummary caption a:hover,
.requiresSummary caption a:hover, .packagesSummary caption a:hover, .providesSummary caption a:hover,
.usesSummary caption a:hover,
.overviewSummary caption a:active, .memberSummary caption a:active, .typeSummary caption a:active,
.constantsSummary caption a:active, .deprecatedSummary caption a:active,
.requiresSummary caption a:active, .packagesSummary caption a:active, .providesSummary caption a:active,
.usesSummary caption a:active,
.overviewSummary caption a:visited, .memberSummary caption a:visited, .typeSummary caption a:visited,
.constantsSummary caption a:visited, .deprecatedSummary caption a:visited,
.requiresSummary caption a:visited, .packagesSummary caption a:visited, .providesSummary caption a:visited,
.usesSummary caption a:visited {
color:#FFFFFF;
}
.useSummary caption a:link, .useSummary caption a:hover, .useSummary caption a:active,
.useSummary caption a:visited {
color:#1f389c;
}
.overviewSummary caption span, .memberSummary caption span, .typeSummary caption span,
.useSummary caption span, .constantsSummary caption span, .deprecatedSummary caption span,
.requiresSummary caption span, .packagesSummary caption span, .providesSummary caption span,
.usesSummary caption span {
white-space:nowrap;
padding-top:5px;
padding-left:12px;
padding-right:12px;
padding-bottom:7px;
display:inline-block;
float:left;
background-color:#F8981D;
border: none;
height:16px;
}
.memberSummary caption span.activeTableTab span, .packagesSummary caption span.activeTableTab span,
.overviewSummary caption span.activeTableTab span, .typeSummary caption span.activeTableTab span {
white-space:nowrap;
padding-top:5px;
padding-left:12px;
padding-right:12px;
margin-right:3px;
display:inline-block;
float:left;
background-color:#F8981D;
height:16px;
}
.memberSummary caption span.tableTab span, .packagesSummary caption span.tableTab span,
.overviewSummary caption span.tableTab span, .typeSummary caption span.tableTab span {
white-space:nowrap;
padding-top:5px;
padding-left:12px;
padding-right:12px;
margin-right:3px;
display:inline-block;
float:left;
background-color:#4D7A97;
height:16px;
}
.memberSummary caption span.tableTab, .memberSummary caption span.activeTableTab,
.packagesSummary caption span.tableTab, .packagesSummary caption span.activeTableTab,
.overviewSummary caption span.tableTab, .overviewSummary caption span.activeTableTab,
.typeSummary caption span.tableTab, .typeSummary caption span.activeTableTab {
padding-top:0px;
padding-left:0px;
padding-right:0px;
background-image:none;
float:none;
display:inline;
}
.overviewSummary .tabEnd, .memberSummary .tabEnd, .typeSummary .tabEnd,
.useSummary .tabEnd, .constantsSummary .tabEnd, .deprecatedSummary .tabEnd,
.requiresSummary .tabEnd, .packagesSummary .tabEnd, .providesSummary .tabEnd, .usesSummary .tabEnd {
display:none;
width:5px;
position:relative;
float:left;
background-color:#F8981D;
}
.memberSummary .activeTableTab .tabEnd, .packagesSummary .activeTableTab .tabEnd,
.overviewSummary .activeTableTab .tabEnd, .typeSummary .activeTableTab .tabEnd {
display:none;
width:5px;
margin-right:3px;
position:relative;
float:left;
background-color:#F8981D;
}
.memberSummary .tableTab .tabEnd, .packagesSummary .tableTab .tabEnd,
.overviewSummary .tableTab .tabEnd, .typeSummary .tableTab .tabEnd {
display:none;
width:5px;
margin-right:3px;
position:relative;
background-color:#4D7A97;
float:left;
}
.rowColor th, .altColor th {
font-weight:normal;
}
.overviewSummary td, .memberSummary td, .typeSummary td,
.useSummary td, .constantsSummary td, .deprecatedSummary td,
.requiresSummary td, .packagesSummary td, .providesSummary td, .usesSummary td {
text-align:left;
padding:0px 0px 12px 10px;
}
th.colFirst, th.colSecond, th.colLast, th.colConstructorName, th.colDeprecatedItemName, .useSummary th,
.constantsSummary th, .packagesSummary th, td.colFirst, td.colSecond, td.colLast, .useSummary td,
.constantsSummary td {
vertical-align:top;
padding-right:0px;
padding-top:8px;
padding-bottom:3px;
}
th.colFirst, th.colSecond, th.colLast, th.colConstructorName, th.colDeprecatedItemName, .constantsSummary th,
.packagesSummary th {
background:#dee3e9;
text-align:left;
padding:8px 3px 3px 7px;
}
td.colFirst, th.colFirst {
font-size:13px;
}
td.colSecond, th.colSecond, td.colLast, th.colConstructorName, th.colDeprecatedItemName, th.colLast {
font-size:13px;
}
.constantsSummary th, .packagesSummary th {
font-size:13px;
}
.providesSummary th.colFirst, .providesSummary th.colLast, .providesSummary td.colFirst,
.providesSummary td.colLast {
white-space:normal;
font-size:13px;
}
.overviewSummary td.colFirst, .overviewSummary th.colFirst,
.requiresSummary td.colFirst, .requiresSummary th.colFirst,
.packagesSummary td.colFirst, .packagesSummary td.colSecond, .packagesSummary th.colFirst, .packagesSummary th,
.usesSummary td.colFirst, .usesSummary th.colFirst,
.providesSummary td.colFirst, .providesSummary th.colFirst,
.memberSummary td.colFirst, .memberSummary th.colFirst,
.memberSummary td.colSecond, .memberSummary th.colSecond, .memberSummary th.colConstructorName,
.typeSummary td.colFirst, .typeSummary th.colFirst {
vertical-align:top;
}
.packagesSummary th.colLast, .packagesSummary td.colLast {
white-space:normal;
}
td.colFirst a:link, td.colFirst a:visited,
td.colSecond a:link, td.colSecond a:visited,
th.colFirst a:link, th.colFirst a:visited,
th.colSecond a:link, th.colSecond a:visited,
th.colConstructorName a:link, th.colConstructorName a:visited,
th.colDeprecatedItemName a:link, th.colDeprecatedItemName a:visited,
.constantValuesContainer td a:link, .constantValuesContainer td a:visited,
.allClassesContainer td a:link, .allClassesContainer td a:visited,
.allPackagesContainer td a:link, .allPackagesContainer td a:visited {
font-weight:bold;
}
.tableSubHeadingColor {
background-color:#EEEEFF;
}
.altColor, .altColor th {
background-color:#FFFFFF;
}
.rowColor, .rowColor th {
background-color:#EEEEEF;
}
/*
* Styles for contents.
*/
.description pre {
margin-top:0;
}
.deprecatedContent {
margin:0;
padding:10px 0;
}
.docSummary {
padding:0;
}
ul.blockList ul.blockList ul.blockList li.blockList h3 {
font-style:normal;
}
div.block {
font-size:14px;
font-family:'DejaVu Serif', Georgia, "Times New Roman", Times, serif;
}
td.colLast div {
padding-top:0px;
}
td.colLast a {
padding-bottom:3px;
}
/*
* Styles for formatting effect.
*/
.sourceLineNo {
color:green;
padding:0 30px 0 0;
}
h1.hidden {
visibility:hidden;
overflow:hidden;
font-size:10px;
}
.block {
display:block;
margin:3px 10px 2px 0px;
color:#474747;
}
.deprecatedLabel, .descfrmTypeLabel, .implementationLabel, .memberNameLabel, .memberNameLink,
.moduleLabelInPackage, .moduleLabelInType, .overrideSpecifyLabel, .packageLabelInType,
.packageHierarchyLabel, .paramLabel, .returnLabel, .seeLabel, .simpleTagLabel,
.throwsLabel, .typeNameLabel, .typeNameLink, .searchTagLink {
font-weight:bold;
}
.deprecationComment, .emphasizedPhrase, .interfaceName {
font-style:italic;
}
.deprecationBlock {
font-size:14px;
font-family:'DejaVu Serif', Georgia, "Times New Roman", Times, serif;
border-style:solid;
border-width:thin;
border-radius:10px;
padding:10px;
margin-bottom:10px;
margin-right:10px;
display:inline-block;
}
div.block div.deprecationComment, div.block div.block span.emphasizedPhrase,
div.block div.block span.interfaceName {
font-style:normal;
}
div.contentContainer ul.blockList li.blockList h2 {
padding-bottom:0px;
}
/*
* Styles for IFRAME.
*/
.mainContainer {
margin:0 auto;
padding:0;
height:100%;
width:100%;
position:fixed;
top:0;
left:0;
}
.leftContainer {
height:100%;
position:fixed;
width:320px;
}
.leftTop {
position:relative;
float:left;
width:315px;
top:0;
left:0;
height:30%;
border-right:6px solid #ccc;
border-bottom:6px solid #ccc;
}
.leftBottom {
position:relative;
float:left;
width:315px;
bottom:0;
left:0;
height:70%;
border-right:6px solid #ccc;
border-top:1px solid #000;
}
.rightContainer {
position:absolute;
left:320px;
top:0;
bottom:0;
height:100%;
right:0;
border-left:1px solid #000;
}
.rightIframe {
margin:0;
padding:0;
height:100%;
right:30px;
width:100%;
overflow:visible;
margin-bottom:30px;
}
/*
* Styles specific to HTML5 elements.
*/
main, nav, header, footer, section {
display:block;
}
/*
* Styles for javadoc search.
*/
.ui-autocomplete-category {
font-weight:bold;
font-size:15px;
padding:7px 0 7px 3px;
background-color:#4D7A97;
color:#FFFFFF;
}
.resultItem {
font-size:13px;
}
.ui-autocomplete {
max-height:85%;
max-width:65%;
overflow-y:scroll;
overflow-x:scroll;
white-space:nowrap;
box-shadow: 0 3px 6px rgba(0,0,0,0.16), 0 3px 6px rgba(0,0,0,0.23);
}
ul.ui-autocomplete {
position:fixed;
z-index:999999;
}
ul.ui-autocomplete li {
float:left;
clear:both;
width:100%;
}
.resultHighlight {
font-weight:bold;
}
#search {
background-image:url('resources/glass.png');
background-size:13px;
background-repeat:no-repeat;
background-position:2px 3px;
padding-left:20px;
position:relative;
right:-18px;
}
#reset {
background-color: rgb(255,255,255);
background-image:url('resources/x.png');
background-position:center;
background-repeat:no-repeat;
background-size:12px;
border:0 none;
width:16px;
height:17px;
position:relative;
left:-4px;
top:-4px;
font-size:0px;
}
.watermark {
color:#545454;
}
.searchTagDescResult {
font-style:italic;
font-size:11px;
}
.searchTagHolderResult {
font-style:italic;
font-size:12px;
}
.searchTagResult:before, .searchTagResult:target {
color:red;
}
.moduleGraph span {
display:none;
position:absolute;
}
.moduleGraph:hover span {
display:block;
margin: -100px 0 0 100px;
z-index: 1;
}
.methodSignature {
white-space:normal;
}
/*
* Styles for user-provided tables.
*
* borderless:
* No borders, vertical margins, styled caption.
* This style is provided for use with existing doc comments.
* In general, borderless tables should not be used for layout purposes.
*
* plain:
* Plain borders around table and cells, vertical margins, styled caption.
* Best for small tables or for complex tables for tables with cells that span
* rows and columns, when the "striped" style does not work well.
*
* striped:
* Borders around the table and vertical borders between cells, striped rows,
* vertical margins, styled caption.
* Best for tables that have a header row, and a body containing a series of simple rows.
*/
table.borderless,
table.plain,
table.striped {
margin-top: 10px;
margin-bottom: 10px;
}
table.borderless > caption,
table.plain > caption,
table.striped > caption {
font-weight: bold;
font-size: smaller;
}
table.borderless th, table.borderless td,
table.plain th, table.plain td,
table.striped th, table.striped td {
padding: 2px 5px;
}
table.borderless,
table.borderless > thead > tr > th, table.borderless > tbody > tr > th, table.borderless > tr > th,
table.borderless > thead > tr > td, table.borderless > tbody > tr > td, table.borderless > tr > td {
border: none;
}
table.borderless > thead > tr, table.borderless > tbody > tr, table.borderless > tr {
background-color: transparent;
}
table.plain {
border-collapse: collapse;
border: 1px solid black;
}
table.plain > thead > tr, table.plain > tbody tr, table.plain > tr {
background-color: transparent;
}
table.plain > thead > tr > th, table.plain > tbody > tr > th, table.plain > tr > th,
table.plain > thead > tr > td, table.plain > tbody > tr > td, table.plain > tr > td {
border: 1px solid black;
}
table.striped {
border-collapse: collapse;
border: 1px solid black;
}
table.striped > thead {
background-color: #E3E3E3;
}
table.striped > thead > tr > th, table.striped > thead > tr > td {
border: 1px solid black;
}
table.striped > tbody > tr:nth-child(even) {
background-color: #EEE
}
table.striped > tbody > tr:nth-child(odd) {
background-color: #FFF
}
table.striped > tbody > tr > th, table.striped > tbody > tr > td {
border-left: 1px solid black;
border-right: 1px solid black;
}
table.striped > tbody > tr > th {
font-weight: normal;
}

View File

@@ -0,0 +1,4 @@
A G
2
H 2
I 5

View File

@@ -0,0 +1,6 @@
A N
4
O 1
P 3
Q 6
R 10

View File

@@ -0,0 +1,7 @@
A N
5
O 2
P 5
Q 7
R 9
S 12

View File

@@ -0,0 +1,7 @@
A N
5
O 1
P 4
Q 8
R 10
S 12

View File

@@ -0,0 +1,7 @@
A P
5
Q 0
R 2
S 6
T 10
U 13

View File

@@ -0,0 +1,8 @@
A T
5
U 0
V 2
W 4
X 6
Y 8
Z 10

Binary file not shown.

View File

@@ -0,0 +1,35 @@
#BlueJ class context
comment0.target=programm
comment1.params=
comment1.target=programm()
comment10.params=
comment10.target=void\ setArr2()
comment11.params=ppos
comment11.target=boolean\ canLeft(int)
comment12.params=ppos
comment12.target=boolean\ canRight(int)
comment13.params=input
comment13.target=boolean\ canCanRight(int)
comment14.params=input
comment14.target=boolean\ canCanLeft(int)
comment15.params=car
comment15.target=void\ moveRight(char)
comment16.params=car
comment16.target=void\ moveLeft(char)
comment2.params=pFilename
comment2.target=programm(java.lang.String)
comment3.params=
comment3.target=void\ readFile()
comment4.params=
comment4.target=void\ read()
comment5.params=
comment5.target=void\ createArray()
comment6.params=
comment6.target=int\ vCars()
comment7.params=
comment7.target=void\ printArr()
comment8.params=
comment8.target=void\ solve()
comment9.params=input
comment9.target=boolean\ goRight(int)
numComments=17

Binary file not shown.

View File

@@ -0,0 +1,278 @@
import java.util.Scanner;
import java.io.File;
import java.io.FileNotFoundException;
public class programm
{
Scanner scan;
Scanner scanOut;
Scanner scanOut2;
String last;
String filename;
int vCars;
int hCars;
char[] arr;
char[] tmpArr;
String tmpOutput;
int steps;
char tmpChar2;
public static void main(String[] args)
{
if(args.length == 0)
{
new programm();
}
else{
for (int i=0;i<args.length;i++)
{
new programm(args[i]);
}
}
}
public programm()
{
filename="parkplatz0.txt";
readFile();
read();
createArray();
printArr();
solve();
}
public programm(String pFilename)
{
filename=pFilename;
readFile();
read();
createArray();
printArr();
solve();
}
public void readFile()
{
try {
scan= new Scanner(new File(filename));
} catch (FileNotFoundException e) {
e.printStackTrace();
}
}
public void read()
{
scan.next();
last = scan.next();
hCars = scan.nextInt();
vCars = vCars();//anzahl vertikaler Autos
}
public void createArray()
{
arr = new char[vCars];
readFile();
scan.nextLine();
for(int i=0;i<vCars;i++)
{
arr[i]='0';
}
int x = scan.nextInt();
for(int i=0;i<x;i++)
{
String tmpString = scan.next();//System.out.println("S:"+tmpString);
char tmpChar = tmpString.charAt(0);
String stringPos = scan.next();//System.out.println("P:"+stringPos);
int pos = Integer.parseInt(stringPos);
arr[pos]=tmpChar;
arr[pos+1]=tmpChar;
}
}
public int vCars()
{
char cLast=last.charAt(0);
int vc = (int)(cLast-64);
return vc;
}
public void printArr()
{
System.out.println(arr);
}
public void solve()
{
steps = 0;
setArr2();
for (int i=0;i<tmpArr.length;i++)
{
setArr2();
tmpOutput = "";
char tmpChar = (char)(i+65);
tmpOutput += tmpChar;
tmpOutput += ": ";
if (tmpArr[i]=='0')
{
System.out.println(tmpOutput +"Frei");
}
else{
while (tmpArr[i] != '0')
{
if(goRight(i) == true && canRight(i) == true && canCanRight(i) == true)
{
moveRight(tmpArr[i]);
}
else if(canLeft(i) == true && canCanLeft(i))
{
moveLeft(tmpArr[i]);
}
else if (canRight(i) == true && canCanRight(i) == true)
{
moveRight(tmpArr[i]);
}
else
{
System.out.println("Error");
return;
}
}
System.out.println(tmpOutput);
steps = 0;
}
}
}
public boolean goRight(int input)
{
boolean goRight;
if(input < tmpArr.length-1 && tmpArr[input] == tmpArr[input+1])
{
goRight = true;
}
else
{
goRight = false;
}
return goRight;
}
public void setArr2()
{
createArray();
tmpArr = arr;
}
public boolean canLeft(int ppos)
{
boolean cl = false;
if ( ppos>=2 )
{
cl = true;
}
return cl;
}
public boolean canRight(int ppos)
{
boolean cr = false;
if ( ppos<tmpArr.length-2)
{
cr = true;
}
return cr;
}
public boolean canCanRight(int input)
{
boolean ccr = false;
int n = 0;
for(int i=0;i<tmpArr.length;i++)
{
if(i>input && tmpArr[i] == '0')
{
n++;
}
}
if (n>0 && goRight(input) == true)
{
ccr = true;
}
if (n>=2 && goRight(input) == false)
{
ccr = true;
}
return ccr;
}
public boolean canCanLeft(int input)
{
boolean ccl = false;
int n = 0;
for(int i=0;i<tmpArr.length;i++)
{
if(i<input && tmpArr[i] == '0')
{
n++;
}
}
if (n>0 && goRight(input) == false)
{
ccl = true;
}
if (n>=2 && goRight(input) == true)
{
ccl = true;
}
return ccl;
}
public void moveRight(char car)
{
boolean found = false ;
int t = 0;
while (found == false)
{
if(tmpArr[t] == car)
{
if(tmpArr[t+2] != '0' && canRight(t+2) == true )
{
moveRight(tmpArr[t+2]);
}
if (canRight(t) == false)
{
moveLeft(car);
}
tmpOutput += tmpArr[t];
tmpOutput += " Rechts ";
tmpArr[t+2]=tmpArr[t];
tmpArr[t]='0';
found = true;
}
t++;
}
}
public void moveLeft(char car)
{
boolean found = false ;
int t = 0;
while (found == false)
{
if(tmpArr[t] == car)
{
if(tmpArr[t-1] != '0' && canLeft(t+1))
{
moveLeft(tmpArr[t-1]);
}
tmpOutput += tmpArr[t];
tmpOutput += " Links ";
tmpArr[t-1]=tmpArr[t];
tmpArr[t+1]='0';
found = true;
}
t++;
}
}
}

View File

@@ -0,0 +1,15 @@
n 100 250
n 266 100
n 266 400
n 433 100
n 433 300
n 600 250
e 2 4 33
e 3 5 2
e 3 4 20
e 4 5 1
e 2 3 20
e 1 4 10
e 1 3 50
e 0 2 20
e 0 1 10

View File

@@ -0,0 +1,14 @@
n 100 250
n 200 250
n 350 100
n 350 400
n 500 250
n 600 250
e 0 1 10
e 1 2 1
e 2 4 3
e 4 3 10
e 3 1 4
e 4 5 22

View File

@@ -0,0 +1,39 @@
n 217 300
n 403 316
n 118 60
n 645 303
n 402 71
n 245 234
n 580 376
n 448 483
n 146 366
n 453 215
e 0 5 343
e 1 6 954
e 1 5 879
e 2 5 1054
e 2 4 1364
e 3 6 433
e 4 5 1106
e 8 0 464
e 0 7 1435
e 1 7 811
e 6 7 837
e 4 9 766
e 3 9 1053
e 1 9 524
e 5 0 343
e 6 1 954
e 5 1 879
e 5 2 1054
e 4 2 1364
e 6 3 433
e 5 4 1106
e 0 8 464
e 7 0 1435
e 7 1 811
e 7 6 837
e 9 4 766
e 9 3 1053
e 9 1 524

Binary file not shown.

View File

@@ -0,0 +1,132 @@
import java.util.Scanner;
import java.io.File;
import java.io.FileNotFoundException;
import javax.swing.*;
import java.awt.*;
import java.lang.Math;
import java.util.Random;
import java.util.*;
public class yeet extends JFrame {
Scanner scan;
int n, e;// n: Anzahl Punkte, e: Anzahl Wege
String tmpStr1, filename;
int[] xarr, yarr;
int[][] earr;
char tmpChar;
public static void main(String[] args) {
if (args.length == 0) {
new yeet();
} else {
for (int i = 0; i < args.length; i++) {
new yeet(args[i]);
}
}
}
public yeet() {
setSize(800, 800);
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setLocationRelativeTo(null);
setVisible(true);
setBackground(new Color(0, 0, 0));
filename = "input.txt";
steps();
}
public yeet(String input) {
setSize(800, 800);
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setLocationRelativeTo(null);
setVisible(true);
setBackground(new Color(0, 0, 0));
filename = input;
steps();
}
public void steps() {
readFile(); // einlesen
readNE(); // anzahl von n und e finden. Als int n und e gespeichert
make(); // Arrays erstellen
repaint();
}
public void readFile() {
try {
scan = new Scanner(new File(filename));
} catch (FileNotFoundException e) {
e.printStackTrace();
}
}
public void readNE() {
n = 0;
e = 0;
while (scan.hasNext() == true) {
tmpChar = scan.next().charAt(0);
if (tmpChar == 'n') {
n++;
}
if (tmpChar == 'e') {
e++;
}
}
readFile();
}
public void make() {
readFile();
xarr = new int[n];// X Position
yarr = new int[n];// Y Position
earr = new int[e][3];// [x][y]; x:Wert, y:0=xPos, 1=yPos, 2=Abstand
for (int i = 0; i < n; i++) {
scan.next();
xarr[i] = scan.nextInt();
yarr[i] = scan.nextInt();
}
for (int i = 0; i < e; i++) {
scan.next();
earr[i][0] = scan.nextInt();// Start
earr[i][1] = scan.nextInt();// Ziel
earr[i][2] = scan.nextInt();// Entfernung
}
readFile();
}
public void paint(Graphics g) {
labAnzeigen(g);
}
public void neuzeichnen() {
repaint();
}
public void anzeigen(Graphics g) {
labAnzeigen(g);
}
public void labAnzeigen(Graphics g) {
g.clearRect(0, 0, 800, 800);// Feld clearen
g.setColor(new Color(200, 10, 100));// Farbe setzen
for (int i = 0; i < n; i++) {
g.fillOval(xarr[i], yarr[i], 36, 36);// Punkt fur Stadt erstellen
g.setColor(new Color(0, 0, 0));
g.drawString(Integer.toString(i), xarr[i] + 14, yarr[i] + 22);// Stadt bezeichnen
g.setColor(new Color(200, 10, 100));
}
for (int i = 0; i < e; i++) {
g.drawLine(xarr[earr[i][0]] + 16, yarr[earr[i][0]] + 16, xarr[earr[i][1]] + 16, yarr[earr[i][1]] + 16);// linie
// zwischen
// zwei
// Punkten
}
for (int i = 0; i < e; i++) {
g.setColor(new Color(100, 255, 100));
g.drawString(Integer.toString(earr[i][2]), (xarr[earr[i][0]] + xarr[earr[i][1]]) / 2 + 10,
(yarr[earr[i][0]] + yarr[earr[i][1]]) / 2 + 20);// zeichnung der Linie
g.setColor(new Color(200, 10, 100));
}
}
}

15
Dijkstra_vs/input.txt Normal file
View File

@@ -0,0 +1,15 @@
n 100 250
n 266 100
n 266 400
n 433 100
n 433 300
n 600 250
e 2 4 33
e 3 5 2
e 3 4 20
e 4 5 1
e 2 3 20
e 1 4 10
e 1 3 50
e 0 2 20
e 0 1 10

14
Dijkstra_vs/input2.txt Normal file
View File

@@ -0,0 +1,14 @@
n 100 250
n 200 250
n 350 100
n 350 400
n 500 250
n 600 250
e 0 1 10
e 1 2 1
e 2 4 3
e 4 3 10
e 3 1 4
e 4 5 22

39
Dijkstra_vs/input3.txt Normal file
View File

@@ -0,0 +1,39 @@
n 217 300
n 403 316
n 118 60
n 645 303
n 402 71
n 245 234
n 580 376
n 448 483
n 146 366
n 453 215
e 0 5 343
e 1 6 954
e 1 5 879
e 2 5 1054
e 2 4 1364
e 3 6 433
e 4 5 1106
e 8 0 464
e 0 7 1435
e 1 7 811
e 6 7 837
e 4 9 766
e 3 9 1053
e 1 9 524
e 5 0 343
e 6 1 954
e 5 1 879
e 5 2 1054
e 4 2 1364
e 6 3 433
e 5 4 1106
e 0 8 464
e 7 0 1435
e 7 1 811
e 7 6 837
e 9 4 766
e 9 3 1053
e 9 1 524

BIN
Dijkstra_vs/yeet.class Normal file

Binary file not shown.

170
Dijkstra_vs/yeet.java Normal file
View File

@@ -0,0 +1,170 @@
import java.util.Scanner;
import java.io.File;
import java.io.FileNotFoundException;
import javax.swing.*;
import java.awt.*;
import java.lang.Math;
import java.util.Random;
import java.util.*;
public class yeet extends JFrame {
Scanner scan;
int n, e; // n: Anzahl Punkte, e: Anzahl Wege
String tmpStr1, filename;
int[] xarr, yarr;
int[][] earr;
char tmpChar;
int[] dist; // distanzen
int[][] con; // connections
public static void main(String[] args) {
if (args.length == 0) {
new yeet();
} else {
for (int i = 0; i < args.length; i++) {
new yeet(args[i]);
}
}
}
public yeet() {
setSize(800, 800);
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setLocationRelativeTo(null);
setVisible(true);
setBackground(new Color(0, 0, 0));
filename = "input.txt";
steps();
}
public yeet(String input) {
setSize(800, 800);
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setLocationRelativeTo(null);
setVisible(true);
setBackground(new Color(0, 0, 0));
filename = input;
steps();
}
public void steps() {
readFile(); // einlesen
readNE(); // anzahl von n und e finden. Als int n und e gespeichert
make(); // Arrays erstellen
repaint();
}
public void readFile() {
try {
scan = new Scanner(new File(filename));
} catch (FileNotFoundException e) {
e.printStackTrace();
}
}
public void readNE() {
n = 0;
e = 0;
while (scan.hasNext() == true) {
tmpChar = scan.next().charAt(0);
if (tmpChar == 'n') {
n++;
}
if (tmpChar == 'e') {
e++;
}
}
readFile();
}
public void make() {
readFile();
xarr = new int[n]; // X Position
yarr = new int[n]; // Y Position
earr = new int[e][3]; // [x][y]; x:Wert, y:0=Start, 1=Ziel, 2=Abstand
for (int i = 0; i < n; i++) {
scan.next();
xarr[i] = scan.nextInt();
yarr[i] = scan.nextInt();
}
for (int i = 0; i < e; i++) {
scan.next();
earr[i][0] = scan.nextInt();// Start
earr[i][1] = scan.nextInt();// Ziel
earr[i][2] = scan.nextInt();// Entfernung
}
readFile();
}
public int[] qwerty(int node) {
dist = new int[n]; // kurzeste Distanz von 0 zu Punkt i
int boi = 0;
for (int r = 0; r < n; r++) {
if (conn(node, r)) {
boi++;
}
}
int[] out;
out = new int[boi];
int boii = 0;
for (int r = 0; r < n; r++) {
if (conn(node, r)) {
out[boii] = r;
}
}
return out;
}
public boolean conn(int input, int input2) {
boolean fish = false;
for (int i = 0; i < n; i++) {
if (earr[i][0] == input && earr[i][1] == input2) {
fish = true;
}
if (earr[i][0] == input2 && earr[i][1] == input) {
fish = true;
}
}
return fish;
}
public int distance(int input, int input2) {
for (int i = 0; i < n; i++) {
if (earr[i][0] == input && earr[i][1] == input2) {
return earr[i][2];
}
if (earr[i][0] == input2 && earr[i][1] == input) {
return earr[i][2];
}
}
return 0;
}
public void paint(Graphics g) {
labAnzeigen(g);
}
public void labAnzeigen(Graphics g) {
g.clearRect(0, 0, 800, 800); // Feld clearen
g.setColor(new Color(200, 10, 100)); // Farbe setzen
for (int i = 0; i < n; i++) {
g.fillOval(xarr[i], yarr[i], 36, 36); // Punkt fur Stadt erstellen
g.setColor(new Color(0, 0, 0));
g.drawString(Integer.toString(i), xarr[i] + 14, yarr[i] + 22); // Stadt bezeichnen
g.setColor(new Color(200, 10, 100));
}
for (int i = 0; i < e; i++) {
g.drawLine(xarr[earr[i][0]] + 16, yarr[earr[i][0]] + 16, xarr[earr[i][1]] + 16, yarr[earr[i][1]] + 16); // linie
}
for (int i = 0; i < e; i++) {
g.setColor(new Color(100, 255, 100));
g.drawString(Integer.toString(earr[i][2]), (xarr[earr[i][0]] + xarr[earr[i][1]]) / 2 + 10,
(yarr[earr[i][0]] + yarr[earr[i][1]]) / 2 + 20); // zeichnung der Linie
g.setColor(new Color(200, 10, 100));
}
}
}

View File

@@ -0,0 +1,12 @@
------------------------------------------------------------------------
This is the project README file. Here, you should describe your project.
Tell the reader (someone who does not know anything about this project)
all they need to know. The comments should usually include at least:
------------------------------------------------------------------------
PROJECT TITLE:
PURPOSE OF PROJECT:
VERSION or DATE:
HOW TO START THIS PROJECT:
AUTHORS:
USER INSTRUCTIONS:

View File

@@ -0,0 +1,3 @@
#! /usr/bin/bash
javac rotation.java
java rotation

View File

@@ -0,0 +1,6 @@
5
#####
# 00#
#1 2#
#1 2#
## ##

View File

@@ -0,0 +1,9 @@
8
########
# 0#
# 0#
#112222#
#33 4#
#55 4#
#666 4#
### ####

View File

@@ -0,0 +1,11 @@
10
##########
# #
# #
# #
# 7775#
# 11 5#
# 2 888#
#990233 #
#44066666#
##### ####

View File

@@ -0,0 +1,13 @@
12
############
# #
# 01 #
# 01 #
# 01 #
# 222222#
# 34 5 #
# 34 5 #
# 634 5 #
# 63477775 #
# 63888885 #
###### #####

View File

@@ -0,0 +1,32 @@
#BlueJ package file
editor.fx.0.height=1396
editor.fx.0.width=2160
editor.fx.0.x=0
editor.fx.0.y=0
objectbench.height=94
objectbench.width=776
package.divider.horizontal=0.6
package.divider.vertical=0.8003952569169961
package.editor.height=398
package.editor.width=670
package.editor.x=125
package.editor.y=598
package.frame.height=600
package.frame.width=800
package.numDependencies=0
package.numTargets=1
package.showExtends=true
package.showUses=true
project.charset=UTF-8
readme.height=60
readme.name=@README
readme.width=49
readme.x=10
readme.y=10
target1.height=70
target1.name=rotation
target1.showInterface=false
target1.type=ClassTarget
target1.width=120
target1.x=134
target1.y=90

View File

@@ -0,0 +1,3 @@
#! /usr/bin/bash
javac rotation.java
java rotation

Binary file not shown.

View File

@@ -0,0 +1,39 @@
#BlueJ class context
comment0.target=rotation
comment1.params=
comment1.target=rotation()
comment10.params=pX\ pY\ block
comment10.target=void\ fallV(int,\ int,\ int)
comment11.params=input
comment11.target=void\ delete(int)
comment12.params=g
comment12.target=void\ paint(java.awt.Graphics)
comment13.params=
comment13.target=void\ neuzeichnen()
comment14.params=g
comment14.target=void\ anzeigen(java.awt.Graphics)
comment15.params=g
comment15.target=void\ feldAnzeigen(java.awt.Graphics)
comment16.params=
comment16.target=void\ anzeigenTxt()
comment17.params=milliseconds
comment17.target=void\ wait(int)
comment18.params=
comment18.target=void\ rotateClockwise()
comment2.params=
comment2.target=void\ rd()
comment3.params=
comment3.target=void\ ld()
comment4.params=
comment4.target=void\ richten()
comment5.params=
comment5.target=void\ checkFall()
comment6.params=px\ py
comment6.target=boolean\ movedBlocks(int,\ int)
comment7.params=pX\ pY\ block
comment7.target=void\ fall(int,\ int,\ int)
comment8.params=pX\ pY\ block
comment8.target=boolean\ horizontal(int,\ int,\ int)
comment9.params=pX\ pY\ block
comment9.target=void\ fallH(int,\ int,\ int)
numComments=19

View File

@@ -0,0 +1,404 @@
import javax.swing.*;
import java.awt.*;
import java.util.*;
import java.util.Random;
import java.util.ArrayList;
import java.io.FileReader;
import java.io.BufferedReader;
import java.io.IOException;
import java.util.ArrayList;
import java.awt.event.KeyEvent;
import java.awt.event.KeyListener;
public class rotation extends JFrame implements KeyListener {
int feldGroesse;
int[][] feld;
private int ppX, len; // laengen und tmp ints
public boolean cheggin, moved, canMove, solved;
public static String filename;
ArrayList<Integer> mBlocks = new ArrayList<Integer>();
ArrayList<Integer> arraylist = new ArrayList<Integer>();
public static void main(String[] args) {
if (args.length != 0) {
new rotation(args[0]);
} else {
new rotation("file1.txt");
}
}
public rotation(String pFilename) {
filename = pFilename;
einlesen();
setSize(800, 800);
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setLocationRelativeTo(null);
setVisible(true);
setBackground(new Color(0, 0, 0));
addKeyListener(this);
anzeigenTxt();
richten();
findZiel();
// i = feld.length;
// j = feld[0].length;
}
public void rd() {
rotateClockwise();
checkFall();
}
public void ld() {
// TODO: BS
rotateClockwise();
rotateClockwise();
rotateClockwise();
checkFall();
}
@Override
public void keyTyped(KeyEvent e) {
}
@Override
public void keyPressed(KeyEvent e) {
System.out.println("Key: " + e.getKeyChar());
if (e.getKeyChar() == 'a') {
ld();
}
if (e.getKeyChar() == 'd') {
rd();
}
if (e.getKeyChar() == 's') {
solve();
}
}
@Override
public void keyReleased(KeyEvent e) {
}
public void findZiel() {
for (int i = 0; i < feld.length; i++)
if (feld[i][feld.length - 1] == 0) {
feld[i][feld.length - 1] = -2;
}
}
public void richten() {
rotateClockwise();
int[][] matrixNeu = new int[feld.length][feld.length];
for (int m = 0; m < feld.length; m++) {
for (int l = 0; l < feld.length; l++) {
matrixNeu[m][l] = feld[feld.length - 1 - m][l];
}
}
feld = matrixNeu;
repaint();
}
public void solve() {
solved = false;
while (!solved) {
if (Math.random() > 0.5) {
rd();
System.out.println("rechts");
} else {
ld();
System.out.println("links");
}
repaint();
wait(10);
}
}
public void checkFall() {
moved = false;
// while(moved == false){
mBlocks.clear();
for (int y = 0; y < feld.length; y++) {
for (int x = 0; x < feld.length; x++) {
if (feld[x][y] > 0 && movedBlocks(x, y) == false) {
mBlocks.add(feld[x][y]);
fall(x, y, feld[x][y]);
repaint();
// System.out.println("yeet");
}
}
}
// }
}
public boolean movedBlocks(int px, int py) {
// DONE check array-list, ob zahl schon abgefragt wurde
if (mBlocks.contains(feld[px][py])) {
return true;
} else {
return false;
}
}
public void fall(int pX, int pY, int block) {
if (horizontal(pX, pY, block) == true) {
fallH(pX, pY, block);
} else {
fallV(pX, pY, block);
}
}
public boolean horizontal(int pX, int pY, int block) {
if (feld[pX + 1][pY] == block) {
return true;
} else {
return false;
}
}
public void fallH(int pX, int pY, int block) {
ppX = pX;
len = 0;
while (feld[ppX][pY] == block) {
// System.out.println("ppX" + ppX + "py" + pY + "block" + block);
len++;
ppX++;
}
canMove = true;
for (int i = 0; i < len; i++) {
if (feld[pX + i][pY + 1] != 0) {
canMove = false;
}
}
if (canMove == true) {
moved = true;
for (int i = 0; i < len; i++) {
feld[pX + i][pY + 1] = block;
feld[pX + i][pY] = 0;
}
checkFall();
return;
}
}
public void fallV(int pX, int pY, int block) {
cheggin = true;
int i = 0;
int ppY = pY;
while (cheggin == true) {
if (feld[pX][ppY] != block) {
cheggin = false;
} else {
ppY++;
}
}
// TODO siegesabfrage
// System.out.println("ppy:" + ppY + "px:" + pX);
if (feld[pX][ppY] == -2) {
solved = true;
delete(block);
}
if (feld[pX][ppY] == 0) {
for (int j = ppY; j > pY; j--) {
feld[pX][j] = feld[pX][j - 1];
feld[pX][j - 1] = 0;
}
moved = true;
checkFall();
return;
} else {
return;
}
}
public void delete(int input) {
int[][] matrixNeu = new int[feld.length][feld.length];
matrixNeu = feld;
for (int m = 0; m < feld.length; m++) {
for (int l = 0; l < feld.length; l++) {
if (matrixNeu[m][l] == input) {
matrixNeu[m][l] = 0;
}
}
}
feld = matrixNeu;
repaint();
}
public void auslesen(String pString, int index) {
for (int i = 0; i < feldGroesse; i++) {
String pos = pString.substring(i, i + 1);
System.out.print(pos + ",");
// System.out.println("i: " + i + " index: " + index);
if (pos.equals("#")) {
feld[index][i] = -2;
} else if (pos.equals(" ")) {
feld[index][i] = -1;
} else
feld[index][i] = Integer.parseInt(pos);
feld[index][i]++;
}
// System.out.println();
}
public void einlesen() {
try {
ArrayList<Integer> arrayTxtDatei1 = new ArrayList<Integer>();
FileReader f = new FileReader(filename);
BufferedReader br = new BufferedReader(f);
String zeile = br.readLine();
System.out.println("Erste Zeile: " + zeile);
// Feld initialisieren
feldGroesse = Integer.parseInt(zeile);
feld = new int[feldGroesse][feldGroesse];
System.out.println("Feldgroesse ist: [" + feldGroesse + "][" + feldGroesse + "]");
int index = 0;
while (zeile != null && index < feldGroesse) {
// System.out.println("file1.txt " + zeile);
// arrayTxtDatei1.add(Integer.valueOf(zeile));
zeile = br.readLine();
auslesen(zeile, index);
index++;
}
br.close();
}
catch (IOException e) {
e.printStackTrace();
}
Integer array[] = new Integer[arraylist.size()];
array = arraylist.toArray(array);
}
public void paint(Graphics g) {
feldAnzeigen(g);
}
public void neuzeichnen() {
repaint();
}
public void anzeigen(Graphics g) {
feldAnzeigen(g);
}
public void feldAnzeigen(Graphics g) {
for (int j = 0; j < feld.length; j++) {
for (int i = 0; i < feld.length; i++) {
if (feld[j][i] == 0) {
g.setColor(new Color(255, 255, 255));
}
if (feld[j][i] == -1) {
g.setColor(new Color(100, 100, 100));
}
if (feld[j][i] == 1) {
g.setColor(new Color(255, 0, 0));
}
if (feld[j][i] == 2) {
g.setColor(new Color(0, 255, 0));
}
if (feld[j][i] == 3) {
g.setColor(new Color(0, 0, 255));
}
if (feld[j][i] == 4) {
g.setColor(new Color(255, 0, 255));
}
if (feld[j][i] == 5) {
g.setColor(new Color(0, 255, 255));
}
if (feld[j][i] == 6) {
g.setColor(new Color(138, 43, 226));
}
if (feld[j][i] == 7) {
g.setColor(new Color(147, 112, 219));
}
if (feld[j][i] == 8) {
g.setColor(new Color(255, 140, 0));
}
if (feld[j][i] == 9) {
g.setColor(new Color(0, 100, 0));
}
if (feld[j][i] == 10) {
g.setColor(new Color(151, 255, 255));
}
if (feld[j][i] == -2) {
g.setColor(new Color(255, 255, 0));
}
g.fillRect(100 + 21 * j, 100 + 21 * i, 20, 20);
}
}
}
public void anzeigenTxt() {
for (int xpos = 0; xpos < feld.length; xpos++) {
for (int ypos = 0; ypos < feld[0].length; ypos++) {
System.out.print(feld[ypos][xpos] + " \t");
}
System.out.println();
}
}
public void wait(int milliseconds) {
try {
Thread.sleep(milliseconds);
} catch (Exception e) {
// ignoring exception at the moment
}
}
void rotateClockwise() {
int[][] matrixNeu = new int[feld.length][feld.length];
for (int m = 0; m < feld.length; m++) {
for (int l = 0; l < feld.length; l++) {
// matrixNeu[k][i-l]=feld[i][j];
matrixNeu[feld.length - 1 - m][l] = feld[l][m];
}
}
feld = matrixNeu;
repaint();
}
}

View File

@@ -0,0 +1,347 @@
import javax.swing.*;
import java.awt.*;
import java.util.Random;
import java.util.ArrayList;
import java.awt.event.KeyEvent;
import java.awt.event.KeyListener;
import java.util.Scanner;
import java.io.*;
public class rotation extends JFrame implements KeyListener
{
private int feld[][]= //Feld... duh
{{-1, -1, -1, -1, -1 }, //-1=wand, 0=leeres feld, 1-3=bloecke, -2=ausgang
{ -1, 0, 1, 1, -1 },
{ -1, 2, 0, 3, -1 },
{ -1, 2, 0, 3, -1 },
{ -1, -1, -2, -1, -1 }};
private int fl=feld.length, ppX, len; //laengen und tmp ints
public boolean cheggin, moved, canMove;
Scanner scan;
public static String filename;
ArrayList<Integer> mBlocks = new ArrayList<Integer>();
public static void main(String[] args){
if(args.length!=0){
filename=args[0];
}
new rotation();
}
@Override
public void keyTyped(KeyEvent e) {
}
@Override
public void keyPressed(KeyEvent e) {
System.out.println("Key: " + e.getKeyChar());
if(e.getKeyChar()=='a'){
ld();
}
if(e.getKeyChar()=='d'){
rd();
}
}
@Override
public void keyReleased(KeyEvent e) {
}
public void readFile(String filename){
try{
scan = new Scanner(new File(filename));
}
catch (FileNotFoundException e){
e.printStackTrace();
}
}
public rotation() {
setSize(800,800);
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setLocationRelativeTo(null);
setVisible(true);
anzeigenTxt();
setBackground(new Color(0,0,0));
addKeyListener(this);
richten();
}
public void rd() {
rotateClockwise();
checkFall();
}
public void ld() {
//TODO: BS
rotateClockwise();
rotateClockwise();
rotateClockwise();
checkFall();
}
public void richten(){
rotateClockwise();
int[][] matrixNeu= new int[feld.length][feld.length];
for(int m = 0;m < 5; m++)
{
for(int l = 0; l < 5;l++)
{
matrixNeu[m][l] = feld[fl-1-m][l];
}
}
feld=matrixNeu;
repaint();
}
public void checkFall(){
moved = false;
mBlocks.clear();
for(int y=0;y<fl;y++){
for(int x=0;x<fl;x++){
if(feld[x][y]>0 && movedBlocks(x,y)==false){
mBlocks.add(feld[x][y]);
fall(x,y,feld[x][y]);
repaint();
//System.out.println("yeet");
}
}
}
}
public boolean movedBlocks(int px, int py){
//DONE check array-list, ob zahl schon abgefragt wurde
if(mBlocks.contains(feld[px][py])){
return true;
}
else{
return false;
}
}
public void fall(int pX,int pY,int block){
if(horizontal(pX,pY,block)==true){
fallH(pX,pY,block);
}
else{
fallV(pX,pY,block);
}
}
public boolean horizontal(int pX,int pY,int block){
if(feld[pX+1][pY]==block){
return true;
}
else{
return false;
}
}
public void fallH(int pX,int pY,int block){
ppX = pX;
len = 0;
while(feld[ppX][pY]==block){
//System.out.println("ppX"+ppX+"py"+pY+"block"+block);
len++;
ppX++;
}
canMove = true;
for(int i = 0;i<len;i++){
if(feld[pX + i][pY + 1] != 0){
canMove=false;
}
}
if(canMove == true){
for(int i = 0;i<len;i++){
feld[pX + i][pY + 1] = block;
feld[pX + i][pY] = 0;
wait(100);
}
checkFall();
return;
}
}
public void fallV(int pX,int pY,int block){
cheggin = true;
int i = 0;
int ppY = pY;
while(cheggin==true){
if(feld[pX][ppY]!=block){
cheggin=false;
}
else{
ppY++;
}
}
//DONE siegesabfrage
//System.out.println("ppy:"+ppY+"px:"+pX);
if(feld[pX][ppY] == -2){
delete(block);
}
if(feld[pX][ppY]==0){
for(int j=ppY;j>pY;j--){
feld[pX][j]=feld[pX][j-1];
feld[pX][j-1]=0;
wait(100);
}
checkFall();
return;
}
else{
return;
}
}
public void delete(int input){
int[][] matrixNeu= new int[feld.length][feld.length];
matrixNeu = feld;
for(int m=0;m < fl; m++)
{
for(int l=0;l< fl;l++)
{
if(matrixNeu[m][l] == input){
matrixNeu[m][l] = 0;
wait(50);
}
}
}
feld=matrixNeu;
repaint();
}
public void paint(Graphics g)
{
feldAnzeigen(g);
}
public void neuzeichnen()
{
repaint();
}
public void anzeigen(Graphics g)
{
feldAnzeigen(g);
}
public void feldAnzeigen(Graphics g)
{
for(int j=0;j < 5; j++)
{
for(int i=0;i< 5;i++)
{
if(feld[j][i] == 0){
g.setColor(new Color(255,255,255));
}
if(feld[j][i] == -1){
g.setColor(new Color(100,100,100));
}
if(feld[j][i] == 1){
g.setColor(new Color(255,0,0));
}
if(feld[j][i] == 2){
g.setColor(new Color(0,255,0));
}
if(feld[j][i] == 3){
g.setColor(new Color(0,0,255));
}
if(feld[j][i] == -2){
g.setColor(new Color(255,215,0));
}
g.fillRect(100+42*j ,100+42*i ,40, 40);
}
}
}
public void anzeigenTxt()
{
for (int xpos=0;xpos<feld.length;xpos++)
{
for (int ypos=0;ypos<feld[0].length;ypos++)
{
//System.out.println(feld[xpos][ypos]+" x:"+xpos+" y:"+ypos);
}
}
}
public void wait(int milliseconds)
{
try
{
Thread.sleep(milliseconds);
}
catch (Exception e)
{
// ignoring exception at the moment
}
}
void rotateClockwise()
{
int[][] matrixNeu= new int[feld.length][feld.length];
for(int m=0;m < 5; m++)
{
for(int l=0;l< 5;l++)
{
matrixNeu[feld.length-1-m][l]=feld[l][m];
}
}
feld=matrixNeu;
repaint();
}
}

View File

@@ -0,0 +1,5 @@
#####
# 00#
#1 2#
#1 2#
## ##

Binary file not shown.

View File

@@ -0,0 +1,403 @@
import javax.swing.*;
import java.awt.*;
import java.util.Random;
import java.util.ArrayList;
import java.awt.event.KeyEvent;
import java.awt.event.KeyListener;
import java.util.Scanner;
import java.io.*;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Paths;
import java.util.List;
import java.util.Scanner;
public class rotation extends JFrame implements KeyListener {
private int feld[][] = // Feld... duh
{ { -1, -1, -1, -1, -1 }, // -1=wand, 0=leeres feld, 1-3=bloecke, -2=ausgang
{ -1, 0, 1, 1, -1 },
{ -1, 2, 0, 3, -1 },
{ -1, 2, 0, 3, -1 },
{ -1, -1, -2, -1, -1 } };
private int fl, ppX, len; // laengen und tmp ints
public boolean cheggin, moved, canMove;
Scanner scan;
public static String filename;
public String[] array, tmpArray;
public String[][] sArray;
ArrayList<Integer> mBlocks = new ArrayList<Integer>();
public static void main(String[] args) {
if (args.length != 0) {
filename = args[0];
}
new rotation();
}
@Override
public void keyTyped(KeyEvent e) {
}
@Override
public void keyPressed(KeyEvent e) {
System.out.println("Key: " + e.getKeyChar());
if (e.getKeyChar() == 'a') {
ld();
}
if (e.getKeyChar() == 'd') {
rd();
}
}
@Override
public void keyReleased(KeyEvent e) {
}
public void readFile() {
try {
scan = new Scanner(new File(filename));
} catch (FileNotFoundException e) {
e.printStackTrace();
}
}
public void createString() {
List<String> listOfStrings = new ArrayList<String>();
// load the data from file
try {
listOfStrings = Files.readAllLines(Paths.get(filename));
} catch (IOException e) {
}
// convert arraylist to array
array = listOfStrings.toArray(new String[0]);
for (int i = 0; i < array.length; i++) {
array[i] = array[i].replace(' ', 'a');
}
System.out.println(array[3]);
}
public void dimension() {
tmpArray = new String[array.length];
sArray = new String[array.length][array.length];
for (int i = 0; i < array.length; i++) {
scan = new Scanner(array[i]).useDelimiter("\\s*\\s*");
int j = 0;
while (scan.hasNext()) {
tmpArray[j] = scan.next();
// tmpArray[j] = tmpArray[j].replace("#","-1");
tmpArray[j] = tmpArray[j].replace("a", "99");
System.out.println(tmpArray[j]);
j++;
for (int k = 0; k < tmpArray.length; k++) {
System.out.println(tmpArray[k]);
}
}
sArray[i] = tmpArray;
}
System.out.println(sArray[0][0]);
System.out.println(sArray[4][4]);
for (int x = 0; x < sArray.length; x++) {
for (int y = 0; y < sArray.length; y++) {
if (sArray[y][x] == "#") {
sArray[y][x] = "-1";
}
}
}
}
public void fill() {
feld = new int[sArray.length][sArray.length];
for (int x = 0; x < sArray.length; x++) {
for (int y = 0; y < sArray.length; y++) {
feld[y][x] = Integer.parseInt(sArray[y][x]);
System.out.println(feld[y][x]);
if (feld[y][x] == 99) {
feld[y][x] = 0;
} else if (feld[y][x] >= 0) {
feld[y][x]++;
}
System.out.println(feld[y][x]);
}
}
printNew();
}
public void printNew() {
for (int x = 0; x < sArray.length; x++) {
for (int y = 0; y < sArray.length; y++) {
System.out.print(sArray[x][y] + " \t");
}
System.out.println();
}
}
public rotation() {
setSize(800, 800);
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setLocationRelativeTo(null);
setVisible(true);
// anzeigenTxt();
setBackground(new Color(0, 0, 0));
addKeyListener(this);
if (filename != null) {
readFile();
createString();
dimension();
fill();
}
richten();
fl = feld.length;
}
public void rd() {
rotateClockwise();
checkFall();
}
public void ld() {
// TODO: BS
rotateClockwise();
rotateClockwise();
rotateClockwise();
checkFall();
}
public void richten() {
rotateClockwise();
fl = feld.length;
int[][] matrixNeu = new int[feld.length][feld.length];
for (int m = 0; m < 5; m++) {
for (int l = 0; l < 5; l++) {
matrixNeu[m][l] = feld[fl - 1 - m][l];
}
}
feld = matrixNeu;
repaint();
}
public void checkFall() {
moved = false;
mBlocks.clear();
for (int y = 0; y < fl; y++) {
for (int x = 0; x < fl; x++) {
if (feld[x][y] > 0 && movedBlocks(x, y) == false) {
mBlocks.add(feld[x][y]);
fall(x, y, feld[x][y]);
repaint();
// System.out.println("yeet");
}
}
}
}
public boolean movedBlocks(int px, int py) {
// DONE check array-list, ob zahl schon abgefragt wurde
if (mBlocks.contains(feld[px][py])) {
return true;
} else {
return false;
}
}
public void fall(int pX, int pY, int block) {
if (horizontal(pX, pY, block) == true) {
fallH(pX, pY, block);
} else {
fallV(pX, pY, block);
}
}
public boolean horizontal(int pX, int pY, int block) {
if (feld[pX + 1][pY] == block) {
return true;
} else {
return false;
}
}
public void fallH(int pX, int pY, int block) {
ppX = pX;
len = 0;
while (feld[ppX][pY] == block) {
// System.out.println("ppX"+ppX+"py"+pY+"block"+block);
len++;
ppX++;
}
canMove = true;
for (int i = 0; i < len; i++) {
if (feld[pX + i][pY + 1] != 0) {
canMove = false;
}
}
if (canMove == true) {
for (int i = 0; i < len; i++) {
feld[pX + i][pY + 1] = block;
feld[pX + i][pY] = 0;
wait(100);
repaint();
}
checkFall();
return;
}
}
public void fallV(int pX, int pY, int block) {
cheggin = true;
int i = 0;
int ppY = pY;
while (cheggin == true) {
if (feld[pX][ppY] != block) {
cheggin = false;
} else {
ppY++;
}
}
// DONE siegesabfrage
// System.out.println("ppy:"+ppY+"px:"+pX);
if (feld[pX][ppY] == -2) {
delete(block);
}
if (feld[pX][ppY] == 0) {
for (int j = ppY; j > pY; j--) {
feld[pX][j] = feld[pX][j - 1];
feld[pX][j - 1] = 0;
wait(100);
repaint();
}
checkFall();
return;
} else {
return;
}
}
public void delete(int input) {
int[][] matrixNeu = new int[feld.length][feld.length];
matrixNeu = feld;
for (int m = 0; m < fl; m++) {
for (int l = 0; l < fl; l++) {
if (matrixNeu[m][l] == input) {
matrixNeu[m][l] = 0;
wait(50);
}
}
}
feld = matrixNeu;
repaint();
}
public void paint(Graphics g) {
feldAnzeigen(g);
}
public void neuzeichnen() {
repaint();
}
public void anzeigen(Graphics g) {
feldAnzeigen(g);
}
public void feldAnzeigen(Graphics g) {
for (int j = 0; j < 5; j++) {
for (int i = 0; i < 5; i++) {
if (feld[j][i] == 0) {
g.setColor(new Color(255, 255, 255));
}
if (feld[j][i] == -1) {
g.setColor(new Color(100, 100, 100));
}
if (feld[j][i] == 1) {
g.setColor(new Color(255, 0, 0));
}
if (feld[j][i] == 2) {
g.setColor(new Color(0, 255, 0));
}
if (feld[j][i] == 3) {
g.setColor(new Color(0, 0, 255));
}
if (feld[j][i] == -2) {
g.setColor(new Color(255, 215, 0));
}
g.fillRect(100 + 42 * j, 100 + 42 * i, 40, 40);
}
}
}
public void anzeigenTxt() {
for (int xpos = 0; xpos < feld.length; xpos++) {
for (int ypos = 0; ypos < feld[0].length; ypos++) {
System.out.println(feld[xpos][ypos] + " x:" + xpos + " y:" + ypos);
}
}
}
public void wait(int milliseconds) {
try {
Thread.sleep(milliseconds);
} catch (Exception e) {
// ignoring exception at the moment
}
}
void rotateClockwise() {
int[][] matrixNeu = new int[feld.length][feld.length];
for (int m = 0; m < 5; m++) {
for (int l = 0; l < 5; l++) {
matrixNeu[feld.length - 1 - m][l] = feld[l][m];
}
}
feld = matrixNeu;
repaint();
}
}

View File

@@ -0,0 +1,5 @@
#####
# 00#
#1 2#
#1 2#
## ##

View File

@@ -0,0 +1,8 @@
########
# 0#
# 0#
#112222#
#33 4#
#55 4#
#666 4#
### ####

View File

@@ -0,0 +1,10 @@
##########
# #
# #
# #
# 7775#
# 11 5#
# 2 888#
#990233 #
#44066666#
##### ####

View File

@@ -0,0 +1,12 @@
############
# #
# 01 #
# 01 #
# 01 #
# 222222#
# 34 5 #
# 34 5 #
# 634 5 #
# 63477775 #
# 63888885 #
###### #####

Binary file not shown.

View File

@@ -0,0 +1,371 @@
import javax.swing.*;
import java.awt.*;
import java.util.Random;
import java.util.ArrayList;
import java.awt.event.KeyEvent;
import java.awt.event.KeyListener;
import java.util.Scanner;
import java.io.*;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Paths;
import java.util.List;
public class rotation extends JFrame implements KeyListener {
public int feld[][];
/*
* private int feld[][] = // Feld... duh
*
* { { -1, -1, -1, -1, -1 }, // -1=wand, 0=leeres feld, 1-3=bloecke, -2=ausgang
* { -1, 0, 1, 1, -1 },
* { -1, 2, 0, 3, -1 },
* { -1, 2, 0, 3, -1 },
* { -1, -1, -2, -1, -1 } };
*/
private int ppX, len; // laengen und tmp ints
public boolean cheggin, moved, canMove;
Scanner scan;
public static String filename = "file2.txt";
public int[][] feld2;
int feldGroesse;
ArrayList<Integer> arraylist = new ArrayList<Integer>();
ArrayList<Integer> mBlocks = new ArrayList<Integer>();
public static void main(String[] args) {
if (args.length != 0) {
filename = args[0];
}
new rotation();
}
public rotation() {
setSize(800, 800);
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setLocationRelativeTo(null);
setVisible(true);
// anzeigenTxt();
setBackground(new Color(0, 0, 0));
addKeyListener(this);
if (filename != null) {
System.out.print("einlesen");
einlesen();
System.out.print("auslesen");
}
richten();
}
@Override
public void keyTyped(KeyEvent e) {
}
@Override
public void keyPressed(KeyEvent e) {
System.out.println("Key: " + e.getKeyChar());
if (e.getKeyChar() == 'a') {
ld();
}
if (e.getKeyChar() == 'd') {
rd();
}
}
@Override
public void keyReleased(KeyEvent e) {
}
public void auslesen(String pString, int index) {
for (int i = 0; i < feldGroesse; i++) {
String pos = pString.substring(i, i + 1);
System.out.print(pos + ",");
System.out.println("i: " + i + " index: " + index);
if (pos.equals("#")) {
feld[index][i] = -2;
} else if (pos.equals(" ")) {
feld[index][i] = -1;
} else
feld[index][i] = Integer.parseInt(pos);
}
System.out.println();
}
public void einlesen() {
try {
ArrayList<Integer> arrayTxtDatei1 = new ArrayList<Integer>();
FileReader f = new FileReader(filename);
BufferedReader br = new BufferedReader(f);
String zeile = br.readLine();
System.out.println("Erste Zeile: " + zeile);
// Feld initialisieren
feldGroesse = Integer.parseInt(zeile);
feld = new int[feldGroesse][feldGroesse];
System.out.println("Feldgroesse ist: [" + feldGroesse + "][" + feldGroesse + "]");
int index = 0;
while (zeile != null && index < feldGroesse) {
// System.out.println("file1.txt " + zeile);
// arrayTxtDatei1.add(Integer.valueOf(zeile));
zeile = br.readLine();
auslesen(zeile, index);
index++;
}
br.close();
}
catch (IOException e) {
e.printStackTrace();
}
Integer array[] = new Integer[arraylist.size()];
array = arraylist.toArray(array);
}
public void rd() {
rotateClockwise();
checkFall();
}
public void ld() {
// TODO: BS
rotateClockwise();
rotateClockwise();
rotateClockwise();
checkFall();
}
public void richten() {
rotateClockwise();
int[][] matrixNeu = new int[feld.length][feld.length];
for (int m = 0; m < 5; m++) {
for (int l = 0; l < 5; l++) {
matrixNeu[m][l] = feld[feld.length - 1 - m][l];
}
}
feld = matrixNeu;
repaint();
}
public void checkFall() {
moved = false;
mBlocks.clear();
for (int y = 0; y < feld.length; y++) {
for (int x = 0; x < feld.length; x++) {
if (feld[x][y] > 0 && movedBlocks(x, y) == false) {
mBlocks.add(feld[x][y]);
fall(x, y, feld[x][y]);
repaint();
// System.out.println("yeet");
}
}
}
}
public boolean movedBlocks(int px, int py) {
// DONE check array-list, ob zahl schon abgefragt wurde
if (mBlocks.contains(feld[px][py])) {
return true;
} else {
return false;
}
}
public void fall(int pX, int pY, int block) {
if (horizontal(pX, pY, block) == true) {
fallH(pX, pY, block);
} else {
fallV(pX, pY, block);
}
}
public boolean horizontal(int pX, int pY, int block) {
if (feld[pX + 1][pY] == block) {
return true;
} else {
return false;
}
}
public void fallH(int pX, int pY, int block) {
ppX = pX;
len = 0;
while (feld[ppX][pY] == block) {
// System.out.println("ppX"+ppX+"py"+pY+"block"+block);
len++;
ppX++;
}
canMove = true;
for (int i = 0; i < len; i++) {
if (feld[pX + i][pY + 1] != 0) {
canMove = false;
}
}
if (canMove == true) {
for (int i = 0; i < len; i++) {
feld[pX + i][pY + 1] = block;
feld[pX + i][pY] = 0;
wait(100);
}
checkFall();
return;
}
}
public void fallV(int pX, int pY, int block) {
cheggin = true;
int i = 0;
int ppY = pY;
while (cheggin == true) {
if (feld[pX][ppY] != block) {
cheggin = false;
} else {
ppY++;
}
}
// DONE siegesabfrage
// System.out.println("ppy:"+ppY+"px:"+pX);
if (feld[pX][ppY] == -2) {
delete(block);
}
if (feld[pX][ppY] == 0) {
for (int j = ppY; j > pY; j--) {
feld[pX][j] = feld[pX][j - 1];
feld[pX][j - 1] = 0;
wait(100);
}
checkFall();
return;
} else {
return;
}
}
public void delete(int input) {
int[][] matrixNeu = new int[feld.length][feld.length];
matrixNeu = feld;
for (int m = 0; m < feld.length; m++) {
for (int l = 0; l < feld.length; l++) {
if (matrixNeu[m][l] == input) {
matrixNeu[m][l] = 0;
wait(50);
}
}
}
feld = matrixNeu;
repaint();
}
public void paint(Graphics g) {
feldAnzeigen(g);
}
public void neuzeichnen() {
repaint();
}
public void anzeigen(Graphics g) {
feldAnzeigen(g);
}
public void feldAnzeigen(Graphics g) {
for (int j = 0; j < 5; j++) {
for (int i = 0; i < 5; i++) {
if (feld[j][i] == 0) {
g.setColor(new Color(255, 255, 255));
}
if (feld[j][i] == -1) {
g.setColor(new Color(100, 100, 100));
}
if (feld[j][i] == 1) {
g.setColor(new Color(255, 0, 0));
}
if (feld[j][i] == 2) {
g.setColor(new Color(0, 255, 0));
}
if (feld[j][i] == 3) {
g.setColor(new Color(0, 0, 255));
}
if (feld[j][i] == -2) {
g.setColor(new Color(255, 215, 0));
}
g.fillRect(100 + 42 * j, 100 + 42 * i, 40, 40);
}
}
}
public void anzeigenTxt() {
for (int xpos = 0; xpos < feld2.length; xpos++) {
for (int ypos = 0; ypos < feld2[0].length; ypos++) {
System.out.print(feld2[xpos][ypos] + " \t");
}
System.out.println();
}
}
public void wait(int milliseconds) {
try {
Thread.sleep(milliseconds);
} catch (Exception e) {
// ignoring exception at the moment
}
}
void rotateClockwise() {
int[][] matrixNeu = new int[feld.length][feld.length];
for (int m = 0; m < 5; m++) {
for (int l = 0; l < 5; l++) {
matrixNeu[feld.length - 1 - m][l] = feld[l][m];
}
}
feld = matrixNeu;
repaint();
}
}

View File

@@ -0,0 +1,5 @@
#####
# 00#
#1 2#
#1 2#
## ##

View File

@@ -0,0 +1,9 @@
8
########
# 0#
# 0#
#112222#
#33 4#
#55 4#
#666 4#
### ####

View File

@@ -0,0 +1,11 @@
10
##########
# #
# #
# #
# 7775#
# 11 5#
# 2 888#
#990233 #
#44066666#
##### ####

View File

@@ -0,0 +1,14 @@
12
############
# #
# 01 #
# 01 #
# 01 #
# 222222#
# 34 5 #
# 34 5 #
# 634 5 #
# 63477775 #
# 63888885 #
###### #####

Binary file not shown.

View File

@@ -0,0 +1,374 @@
import javax.swing.*;
import java.awt.*;
import java.util.Random;
import java.util.ArrayList;
import java.io.FileReader;
import java.io.BufferedReader;
import java.io.IOException;
import java.util.ArrayList;
import java.awt.event.KeyEvent;
import java.awt.event.KeyListener;
public class rotation extends JFrame implements KeyListener {
int feldGroesse;
int[][] feld;
private int ppX, len; // laengen und tmp ints
public boolean cheggin, moved, canMove;
public static String filename;
ArrayList<Integer> mBlocks = new ArrayList<Integer>();
ArrayList<Integer> arraylist = new ArrayList<Integer>();
public static void main(String[] args) {
if (args.length != 0) {
filename = args[0];
}
new rotation();
}
public rotation() {
if (filename == null) {
filename = "file1.txt";
}
einlesen();
setSize(800, 800);
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setLocationRelativeTo(null);
setVisible(true);
setBackground(new Color(0, 0, 0));
addKeyListener(this);
anzeigenTxt();
richten();
findZiel();
// i = feld.length;
// j = feld[0].length;
}
@Override
public void keyTyped(KeyEvent e) {
}
@Override
public void keyPressed(KeyEvent e) {
System.out.println("Key: " + e.getKeyChar());
if (e.getKeyChar() == 'a') {
ld();
}
if (e.getKeyChar() == 'd') {
rd();
}
}
@Override
public void keyReleased(KeyEvent e) {
}
public void rd() {
rotateClockwise();
checkFall();
}
public void ld() {
// TODO: BS
rotateClockwise();
rotateClockwise();
rotateClockwise();
checkFall();
}
public void findZiel() {
for (int i = 0; i < feld.length; i++)
if (feld[i][feld.length - 1] == 0) {
feld[i][feld.length - 1] = -2;
}
}
public void richten() {
rotateClockwise();
int[][] matrixNeu = new int[feld.length][feld.length];
for (int m = 0; m < feld.length; m++) {
for (int l = 0; l < feld.length; l++) {
matrixNeu[m][l] = feld[feld.length - 1 - m][l];
}
}
feld = matrixNeu;
repaint();
}
public void checkFall() {
moved = false;
// while(moved == false){
mBlocks.clear();
for (int y = 0; y < feld.length; y++) {
for (int x = 0; x < feld.length; x++) {
if (feld[x][y] > 0 && movedBlocks(x, y) == false) {
mBlocks.add(feld[x][y]);
fall(x, y, feld[x][y]);
repaint();
System.out.println("yeet");
}
}
}
// }
}
public boolean movedBlocks(int px, int py) {
// DONE check array-list, ob zahl schon abgefragt wurde
if (mBlocks.contains(feld[px][py])) {
return true;
} else {
return false;
}
}
public void fall(int pX, int pY, int block) {
if (horizontal(pX, pY, block) == true) {
fallH(pX, pY, block);
} else {
fallV(pX, pY, block);
}
}
public boolean horizontal(int pX, int pY, int block) {
if (feld[pX + 1][pY] == block) {
return true;
} else {
return false;
}
}
public void fallH(int pX, int pY, int block) {
ppX = pX;
len = 0;
while (feld[ppX][pY] == block) {
System.out.println("ppX" + ppX + "py" + pY + "block" + block);
len++;
ppX++;
}
canMove = true;
for (int i = 0; i < len; i++) {
if (feld[pX + i][pY + 1] != 0) {
canMove = false;
}
}
if (canMove == true) {
moved = true;
for (int i = 0; i < len; i++) {
feld[pX + i][pY + 1] = block;
feld[pX + i][pY] = 0;
}
checkFall();
return;
}
}
public void fallV(int pX, int pY, int block) {
cheggin = true;
int i = 0;
int ppY = pY;
while (cheggin == true) {
if (feld[pX][ppY] != block) {
cheggin = false;
} else {
ppY++;
}
}
// TODO siegesabfrage
System.out.println("ppy:" + ppY + "px:" + pX);
if (feld[pX][ppY] == -2) {
delete(block);
}
if (feld[pX][ppY] == 0) {
for (int j = ppY; j > pY; j--) {
feld[pX][j] = feld[pX][j - 1];
feld[pX][j - 1] = 0;
}
moved = true;
checkFall();
return;
} else {
return;
}
}
public void delete(int input) {
int[][] matrixNeu = new int[feld.length][feld.length];
matrixNeu = feld;
for (int m = 0; m < feld.length; m++) {
for (int l = 0; l < feld.length; l++) {
if (matrixNeu[m][l] == input) {
matrixNeu[m][l] = 0;
}
}
}
feld = matrixNeu;
repaint();
}
public void auslesen(String pString, int index) {
for (int i = 0; i < feldGroesse; i++) {
String pos = pString.substring(i, i + 1);
System.out.print(pos + ",");
System.out.println("i: " + i + " index: " + index);
if (pos.equals("#")) {
feld[index][i] = -2;
} else if (pos.equals(" ")) {
feld[index][i] = -1;
} else
feld[index][i] = Integer.parseInt(pos);
feld[index][i]++;
}
System.out.println();
}
public void einlesen() {
try {
ArrayList<Integer> arrayTxtDatei1 = new ArrayList<Integer>();
FileReader f = new FileReader(filename);
BufferedReader br = new BufferedReader(f);
String zeile = br.readLine();
System.out.println("Erste Zeile: " + zeile);
// Feld initialisieren
feldGroesse = Integer.parseInt(zeile);
feld = new int[feldGroesse][feldGroesse];
System.out.println("Feldgroesse ist: [" + feldGroesse + "][" + feldGroesse + "]");
int index = 0;
while (zeile != null && index < feldGroesse) {
// System.out.println("file1.txt " + zeile);
// arrayTxtDatei1.add(Integer.valueOf(zeile));
zeile = br.readLine();
auslesen(zeile, index);
index++;
}
br.close();
}
catch (IOException e) {
e.printStackTrace();
}
Integer array[] = new Integer[arraylist.size()];
array = arraylist.toArray(array);
}
public void paint(Graphics g) {
feldAnzeigen(g);
}
public void neuzeichnen() {
repaint();
}
public void anzeigen(Graphics g) {
feldAnzeigen(g);
}
public void feldAnzeigen(Graphics g) {
for (int j = 0; j < feld.length; j++) {
for (int i = 0; i < feld.length; i++) {
if (feld[j][i] == 0) {
g.setColor(new Color(255, 255, 255));
}
if (feld[j][i] == -1) {
g.setColor(new Color(100, 100, 100));
}
if (feld[j][i] == 1) {
g.setColor(new Color(255, 0, 0));
}
if (feld[j][i] == 2) {
g.setColor(new Color(0, 255, 0));
}
if (feld[j][i] == 3) {
g.setColor(new Color(0, 0, 255));
}
if (feld[j][i] == 4) {
g.setColor(new Color(255, 0, 255));
}
if (feld[j][i] == 5) {
g.setColor(new Color(0, 255, 255));
}
if (feld[j][i] == 6) {
g.setColor(new Color(138, 43, 226));
}
if (feld[j][i] == 7) {
g.setColor(new Color(147, 112, 219));
}
if (feld[j][i] == -2) {
g.setColor(new Color(255, 255, 0));
}
g.fillRect(100 + 21 * j, 100 + 21 * i, 20, 20);
}
}
}
public void anzeigenTxt() {
for (int xpos = 0; xpos < feld.length; xpos++) {
for (int ypos = 0; ypos < feld[0].length; ypos++) {
System.out.print(feld[xpos][ypos] + " \t");
}
System.out.println();
}
}
public void wait(int milliseconds) {
try {
Thread.sleep(milliseconds);
} catch (Exception e) {
// ignoring exception at the moment
}
}
void rotateClockwise() {
int[][] matrixNeu = new int[feld.length][feld.length];
for (int m = 0; m < feld.length; m++) {
for (int l = 0; l < feld.length; l++) {
// matrixNeu[k][i-l]=feld[i][j];
matrixNeu[feld.length - 1 - m][l] = feld[l][m];
}
}
feld = matrixNeu;
repaint();
}
}

BIN
linenSicht/Shape.class Normal file

Binary file not shown.

34
linenSicht/Shape.java Normal file
View File

@@ -0,0 +1,34 @@
import javax.swing.*;
import java.awt.*;
import java.util.*;
public class Shape {
ArrayList<Integer> x = new ArrayList<Integer>();
ArrayList<Integer> y = new ArrayList<Integer>();
int len = 0;
public Shape() {
}
public void addPoint(int posX, int posY) {
x.add(posX);
y.add(posY);
len++;
}
public int getX(int index) {
return x.get(index);
}
public int getY(int index) {
return y.get(index);
}
public int getLength() {
return len;
}
}

3
linenSicht/file1.txt Normal file
View File

@@ -0,0 +1,3 @@
1
3 535 410 610 70 460 70
633 189

5
linenSicht/file2.txt Normal file
View File

@@ -0,0 +1,5 @@
3
4 390 260 505 213 551 329 413 444
5 410 50 433 50 594 96 525 188 387 165
5 170 80 193 80 340 150 331 287 170 402
633 189

10
linenSicht/file3.txt Normal file
View File

@@ -0,0 +1,10 @@
8
6 539 98 549 98 599 118 569 158 519 198 489 138
4 559 178 569 178 609 248 519 238
8 389 78 459 68 599 68 479 88 459 178 509 248 599 258 499 298
7 320 98 330 98 370 118 360 158 330 198 300 158 280 118
7 380 208 390 188 430 208 380 228 390 288 360 248 340 208
4 352 287 445 305 386 366 291 296
5 319 18 293 53 365 80 238 73 257 15
9 637 248 516 330 426 238 462 302 451 350 613 348 761 346 754 231 685 183
479 168

13
linenSicht/file4.txt Normal file
View File

@@ -0,0 +1,13 @@
11
5 121 39 290 27 284 86 156 110 121 88
6 133 206 202 144 254 170 278 224 201 194 156 258
6 160 290 247 301 162 398 365 280 276 253 208 233
3 170 421 386 298 384 472
4 408 297 428 297 565 199 413 475
4 300 120 440 160 382 227 320 201
3 323 34 440 20 308 85
3 500 20 500 140 376 103
8 540 20 600 40 600 100 740 100 700 340 660 340 660 140 540 140
4 580 240 633 402 896 475 508 466
10 780 140 1020 140 1020 480 960 480 960 200 800 200 773 301 900 300 900 340 740 340
856 270

14
linenSicht/file5.txt Normal file
View File

@@ -0,0 +1,14 @@
12
4 400 185 650 185 650 255 400 255
5 497 10 598 19 604 102 549 165 447 141
7 320 165 380 165 380 285 510 285 510 305 420 305 320 305
4 300 55 360 45 380 135 320 145
4 200 35 280 35 280 215 200 215
5 170 215 300 265 300 325 180 305 150 245
6 90 35 130 95 170 55 180 155 120 195 70 135
4 400 125 430 145 410 175 380 155
4 90 225 140 225 130 265 90 285
5 540 280 541 280 800 280 800 400 540 400
10 380 340 381 340 520 340 460 380 540 440 720 460 420 460 140 440 140 300 280 380
4 80 300 81 300 140 280 120 360
621 162

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.

469
linenSicht/sichtlinien.java Normal file
View File

@@ -0,0 +1,469 @@
//TODO sterne wegmachen
import javax.swing.*;
import java.awt.*;
import java.util.*;
import java.util.Random;
import java.util.ArrayList;
//keys
import java.awt.event.KeyEvent;
import java.awt.event.KeyListener;
//files
import java.io.FileReader;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.BufferedReader;
//mouse
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
//refresh
import java.awt.event.ActionEvent;
import javax.swing.Timer;
import java.awt.event.ActionListener;
public class sichtlinien extends JFrame implements KeyListener {
public static String filename;
Scanner scan;
Polygon p;
Shape[] shapes = makeArr();
int amount, startX, startY, HEIGHT = 1100, WIDTH = 1100;
Timer looper = new Timer(1000 / 60, new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
// repaint();
}
});
boolean first = false, showLines = false;
Segment[] segments = makeSegments();
Segment[] rays = createRays();
public static void main(String[] args) {
// DONE for-loop fur mehrere inputs
if (args.length != 0) {
for (String arg : args) {
filename = arg;
new sichtlinien(arg);
}
} else {
filename = "file1.txt";
new sichtlinien("file1.txt");
}
}
public sichtlinien(String input) {
filename = input;
System.out.println("Before");
setSize(WIDTH, HEIGHT);
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setLocationRelativeTo(null);
setVisible(true);
setBackground(new Color(0, 0, 0));
addKeyListener(this);
JPanel panel = new JPanel();
add(panel);
panel.addMouseListener(new MouseAdapter() {
@Override
public void mousePressed(MouseEvent e) {
System.out.println(e.getX() + "," + e.getY());
startX = e.getX();
startY = e.getY() - 75;
repaint();
}
});
// looper.start();
repaint();
}
@Override
public void keyTyped(KeyEvent e) {
}
@Override
public void keyPressed(KeyEvent e) {
System.out.println("Key: " + e.getKeyChar());
if (e.getKeyChar() == 'a') {
}
if (e.getKeyChar() == 'd') {
showLines = false;
repaint();
}
if (e.getKeyChar() == 's') {
showLines = true;
repaint();
}
}
@Override
public void keyReleased(KeyEvent e) {
}
public void readFile(String filename) {
try {
scan = new Scanner(new File(filename));
} catch (FileNotFoundException e) {
e.printStackTrace();
}
}
public Shape[] makeArr() {
readFile(filename);
amount = scan.nextInt();
System.out.println(amount);
Shape shapes[] = new Shape[amount];
for (int i = 0; i < amount; i++) {
shapes[i] = new Shape();
System.out.println("added");
int aPoints = scan.nextInt();
for (int j = 0; j < aPoints; j++) {
shapes[i].addPoint(scan.nextInt(), scan.nextInt());
System.out.println("added2");
System.out.println(shapes[i].getLength());
}
}
startX = scan.nextInt();
startY = scan.nextInt();
return shapes;
}
public int numberLines() {
int out = 0;
for (Shape shape : shapes) {
out = out + shape.getLength();
}
return out;
}
public Segment[] makeSegments() {
Segment[] segments = new Segment[numberLines() + 4];
int tmpCounter = 0;
for (Shape shape : shapes) {
for (int i = 0; i < shape.getLength(); i++) {
if (i < shape.getLength() - 1) {
segments[tmpCounter] = new Segment(new Vector(shape.getX(i), shape.getY(i)),
new Vector(shape.getX(i + 1), shape.getY(i + 1)));
} else {
segments[tmpCounter] = new Segment(new Vector(shape.getX(i), shape.getY(i)),
new Vector(shape.getX(0), shape.getY(0)));
}
tmpCounter++;
}
}
segments[tmpCounter] = new Segment(new Vector(0, 0), new Vector(WIDTH, 0));
tmpCounter++;
segments[tmpCounter] = new Segment(new Vector(WIDTH, 0), new Vector(WIDTH, HEIGHT));
tmpCounter++;
segments[tmpCounter] = new Segment(new Vector(WIDTH, HEIGHT), new Vector(0, HEIGHT));
tmpCounter++;
segments[tmpCounter] = new Segment(new Vector(0, HEIGHT), new Vector(0, 0));
return segments;
}
Segment[] createRays() {
rays = new Segment[segments.length * 3];
int counter = 0;
for (int s = 0; s < segments.length; s++) {
Vector a = new Vector(startX, startY);
Vector b = segments[s].b;
Vector c = b.subtract(a).normalize();
Segment s1 = new Segment(
a,
b);
Segment s2 = new Segment(
a,
a.add(c.setDir(c.getAngle() + 0.00001f).normalize().scale(WIDTH)));
Segment s3 = new Segment(
a,
a.add(c.setDir(c.getAngle() - 0.00001f).normalize().scale(WIDTH)));
rays[counter] = s1;
rays[counter + 1] = s2;
rays[counter + 2] = s3;
counter += 3;
}
return (sortRays());
}
Segment[] sortRays() {
ArrayList<Segment> list = new ArrayList<Segment>();
for (int r = 0; r < rays.length; r++) {
list.add(rays[r]);
}
list.sort(new Comparator<Segment>() {
@Override
public int compare(Segment e1, Segment e2) {
Vector v1 = e1.b.subtract(e1.a);
Vector v2 = e2.b.subtract(e2.a);
if (v1.getAngle() < v2.getAngle())
return -1;
if (v1.getAngle() > v2.getAngle())
return 1;
return 0;
}
});
for (int i = 0; i < list.size(); i++) {
rays[i] = list.get(i);
}
return rays;
}
public void paint(Graphics g) {
createRays();
sortRays();
// TODO farbpalette und farben speichern
// reset field
g.clearRect(0, 0, WIDTH, HEIGHT);
// shapes
g.setColor(new Color(100, 255, 100));
drawShapes(g);
// borders
g.setColor(new Color(255, 255, 255));
drawBorders(g);
// TODO fix polygons
// make polygons
// g.setColor(new Color(100, 100, 200));
// drawPolygons(g);
// make lines
g.setColor(new Color(0, 0, 255));
drawRays(g);
// point
g.setColor(new Color(255, 100, 100));
g.fillOval(startX - 10, startY - 10 + 100, 20, 20);
}
void drawBorders(Graphics g) {
for (Shape shape : shapes) {
p = new Polygon();
for (int j = 0; j < shape.getLength(); j++) {
p.addPoint(shape.getX(j), shape.getY(j) + 100);
}
g.drawPolygon(p);
}
}
void drawShapes(Graphics g) {
for (Shape shape : shapes) {
p = new Polygon();
for (int j = 0; j < shape.getLength(); j++) {
p.addPoint(shape.getX(j), shape.getY(j) + 100);
}
g.fillPolygon(p);
}
}
void drawRays(Graphics g) {
for (int r = 0; r < rays.length; r++) {
Segment ray = rays[r];
Vector closestIntersect = ray.b;
float distToIntersect = WIDTH;
for (int i = 0; i < segments.length; i++) {
Intersect inter = getIntersection(ray, segments[i]);
if (inter != null) {
float d = inter.distance;
if (distToIntersect > d) {
distToIntersect = d;
closestIntersect = inter.intersect;
}
}
}
ray.b = closestIntersect;
}
for (int r = 0; r < rays.length; r++) {
Segment ray = rays[r];
g.drawLine((int) ray.a.x, (int) ray.a.y + 100, (int) ray.b.x, (int) ray.b.y + 100);
}
}
void drawPolygons(Graphics g) {
for (int r = 0; r < rays.length; r++) {
Segment ray1 = rays[r];
Segment ray2;
if (r == rays.length - 1) {
ray2 = rays[0];
} else {
ray2 = rays[r + 1];
}
Polygon p;
int[] x_points = { (int) ray1.a.x, (int) ray1.b.x, (int) ray2.b.x };
int[] y_points = { (int) ray1.a.y + 100, (int) ray1.b.y + 100, (int) ray2.b.y + 100 };
p = new Polygon(x_points, y_points, 3);
g.fillPolygon(p);
// g.setClip(p);
}
}
public void neuzeichnen() {
repaint();
}
public void anzeigenTxt() {
}
public void wait(int milliseconds) {
try {
Thread.sleep(milliseconds);
} catch (Exception e) {
}
}
Intersect getIntersection(Segment s1, Segment s2) {
Vector p = s1.a;
Vector q = s2.a;
Vector r = s1.b.subtract(s1.a);
Vector s = s2.b.subtract(s2.a);
float t = (crossProduct(q, s) - crossProduct(p, s)) / crossProduct(r, s);
float u = (crossProduct(p, r) - crossProduct(q, r)) / crossProduct(s, r);
if (t >= 0 && t <= 1 && u >= 0 && u <= 1) {
return new Intersect(new Vector(p.x + t * r.x, p.y + t * r.y), t);
}
return null;
}
float crossProduct(Vector a, Vector b) {
return a.x * b.y - a.y * b.x;
}
class Intersect {
Vector intersect;
float distance;
Intersect(Vector i, float d) {
this.intersect = i;
this.distance = d;
}
}
class Segment {
Vector a;
Vector b;
Segment(Vector a, Vector b) {
this.a = a;
this.b = b;
}
}
class Vector {
float x;
float y;
Vector(float x, float y) {
this.x = x;
this.y = y;
}
Vector add(Vector v) {
return new Vector(x + v.x, y + v.y);
}
Vector subtract(Vector v) {
return new Vector(x - v.x, y - v.y);
}
float getM() {
return (float) (Math.sqrt(x * x + y * y));
}
Vector normalize() {
float m = getM();
x = x / m;
y = y / m;
return this;
}
Vector scale(float t) {
x *= t;
y *= t;
return this;
}
Vector setDir(float angle) {
float m = getM();
return new Vector((float) (m * Math.cos(angle)), (float) (m * Math.sin(angle)));
}
float getAngle() {
return (float) Math.atan2(y, x);
}
}
}