Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in
Toggle navigation
L
Lab1
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
mohamad.alturky
Lab1
Commits
a3f25bfa
Commit
a3f25bfa
authored
Oct 28, 2023
by
mohamad
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Adding Normal Fibonacci
parent
fa018a23
Changes
11
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
87 additions
and
4 deletions
+87
-4
workspace.xml
.idea/workspace.xml
+25
-1
DockerFile
DockerFile
+8
-3
IFibonacciCalculator.java
...va/FibonacciSeries/abstractions/IFibonacciCalculator.java
+5
-0
NormalFibonacciCalculator.java
...nacciSeries/implementation/NormalFibonacciCalculator.java
+25
-0
ParallelFibonacciCalculator.java
...cciSeries/implementation/ParallelFibonacciCalculator.java
+10
-0
Main.java
src/main/java/FibonacciSeries/runners/Main.java
+13
-0
ParallelPrimeNumbersExtractor.java
...reading/implementation/ParallelPrimeNumbersExtractor.java
+1
-0
IFibonacciCalculator.class
...s/FibonacciSeries/abstractions/IFibonacciCalculator.class
+0
-0
NormalFibonacciCalculator.class
...acciSeries/implementation/NormalFibonacciCalculator.class
+0
-0
ParallelFibonacciCalculator.class
...ciSeries/implementation/ParallelFibonacciCalculator.class
+0
-0
Main.class
target/classes/FibonacciSeries/runners/Main.class
+0
-0
No files found.
.idea/workspace.xml
View file @
a3f25bfa
...
...
@@ -30,9 +30,32 @@
"keyToString": {
"RunOnceActivity.OpenProjectViewOnStart": "true",
"RunOnceActivity.ShowReadmeOnStart": "true"
},
"keyToStringList": {
"com.intellij.ide.scratch.ScratchImplUtil$2/New Scratch File": [
"PLAIN_TEXT"
]
}
}]]>
</component>
<component
name=
"RunManager"
>
<component
name=
"RecentsManager"
>
<key
name=
"CopyClassDialog.RECENTS_KEY"
>
<recent
name=
"FibonacciSeries.implementation"
/>
</key>
</component>
<component
name=
"RunManager"
selected=
"Application.FibonacciSeries.runners.Main"
>
<configuration
name=
"FibonacciSeries.runners.Main"
type=
"Application"
factoryName=
"Application"
temporary=
"true"
nameIsGenerated=
"true"
>
<option
name=
"MAIN_CLASS_NAME"
value=
"FibonacciSeries.runners.Main"
/>
<module
name=
"Lab1"
/>
<extension
name=
"coverage"
>
<pattern>
<option
name=
"PATTERN"
value=
"FibonacciSeries.runners.*"
/>
<option
name=
"ENABLED"
value=
"true"
/>
</pattern>
</extension>
<method
v=
"2"
>
<option
name=
"Make"
enabled=
"true"
/>
</method>
</configuration>
<configuration
name=
"Main"
type=
"Application"
factoryName=
"Application"
temporary=
"true"
nameIsGenerated=
"true"
>
<option
name=
"MAIN_CLASS_NAME"
value=
"threading.runners.Main"
/>
<module
name=
"Lab1"
/>
...
...
@@ -48,6 +71,7 @@
</configuration>
<recent_temporary>
<list>
<item
itemvalue=
"Application.FibonacciSeries.runners.Main"
/>
<item
itemvalue=
"Application.Main"
/>
</list>
</recent_temporary>
...
...
DockerFile
View file @
a3f25bfa
FROM
openjdk:17
COPY
./target/ /tmp
WORKDIR
/tmp
ENTRYPOINT
["java","classes/runners/Main.class"]
\ No newline at end of file
RUN
mkdir
/app
COPY
. /app
WORKDIR
/app
CMD
java src/main/java/threading/runners/Main.java
\ No newline at end of file
src/main/java/FibonacciSeries/abstractions/IFibonacciCalculator.java
0 → 100644
View file @
a3f25bfa
package
FibonacciSeries
.
abstractions
;
public
interface
IFibonacciCalculator
{
long
calculate
(
long
number
);
}
src/main/java/FibonacciSeries/implementation/NormalFibonacciCalculator.java
0 → 100644
View file @
a3f25bfa
package
FibonacciSeries
.
implementation
;
import
FibonacciSeries.abstractions.IFibonacciCalculator
;
public
class
NormalFibonacciCalculator
implements
IFibonacciCalculator
{
@Override
public
long
calculate
(
long
number
)
{
long
firstItem
=
0
;
long
secondItem
=
1
;
if
(
number
==
0
)
{
return
firstItem
;
}
if
(
number
==
1
)
{
return
secondItem
;
}
long
ans
=
0
;
for
(
int
i
=
2
;
i
<=
number
;
i
++){
ans
=
secondItem
+
firstItem
;
firstItem
=
secondItem
;
secondItem
=
ans
;
}
return
ans
;
}
}
src/main/java/FibonacciSeries/implementation/ParallelFibonacciCalculator.java
0 → 100644
View file @
a3f25bfa
package
FibonacciSeries
.
implementation
;
import
FibonacciSeries.abstractions.IFibonacciCalculator
;
public
class
ParallelFibonacciCalculator
implements
IFibonacciCalculator
{
@Override
public
long
calculate
(
long
number
)
{
return
0
;
}
}
src/main/java/FibonacciSeries/runners/Main.java
0 → 100644
View file @
a3f25bfa
package
FibonacciSeries
.
runners
;
import
FibonacciSeries.abstractions.IFibonacciCalculator
;
import
FibonacciSeries.implementation.NormalFibonacciCalculator
;
public
class
Main
{
public
static
void
main
(
String
[]
args
)
{
IFibonacciCalculator
calculator
=
new
NormalFibonacciCalculator
();
for
(
int
i
=
0
;
i
<
10
;
i
++)
{
System
.
out
.
println
(
"F("
+
i
+
") = "
+
calculator
.
calculate
(
i
));
}
}
}
src/main/java/threading/implementation/ParallelPrimeNumbersExtractor.java
View file @
a3f25bfa
...
...
@@ -8,6 +8,7 @@ import java.util.Collection;
public
class
ParallelPrimeNumbersExtractor
implements
IPrimeNumbersExtractor
{
private
final
int
_numberOfThreads
;
// https://www.primesfordays.com/api/primes/nth/555/ for testing purposes
public
ParallelPrimeNumbersExtractor
(
int
numberOfThreads
)
{
_numberOfThreads
=
numberOfThreads
;
}
...
...
target/classes/FibonacciSeries/abstractions/IFibonacciCalculator.class
0 → 100644
View file @
a3f25bfa
File added
target/classes/FibonacciSeries/implementation/NormalFibonacciCalculator.class
0 → 100644
View file @
a3f25bfa
File added
target/classes/FibonacciSeries/implementation/ParallelFibonacciCalculator.class
0 → 100644
View file @
a3f25bfa
File added
target/classes/FibonacciSeries/runners/Main.class
0 → 100644
View file @
a3f25bfa
File added
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment