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
mohammad.salama
Lab1
Commits
c8611a15
Commit
c8611a15
authored
Oct 27, 2023
by
mohammad.salama
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Creating Simple Finding Primes in Interval
parent
12c61a0c
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
134 additions
and
4 deletions
+134
-4
workspace.xml
.idea/workspace.xml
+67
-3
pom.xml
pom.xml
+7
-1
SearchForPrimes.java
src/main/java/SearchForPrimes.java
+38
-0
FindPrimesTest.java
src/test/java/FindPrimesTest.java
+22
-0
No files found.
.idea/workspace.xml
View file @
c8611a15
<?xml version="1.0" encoding="UTF-8"?>
<?xml version="1.0" encoding="UTF-8"?>
<project
version=
"4"
>
<project
version=
"4"
>
<component
name=
"AutoImportSettings"
>
<option
name=
"autoReloadType"
value=
"SELECTIVE"
/>
</component>
<component
name=
"ChangeListManager"
>
<component
name=
"ChangeListManager"
>
<list
default=
"true"
id=
"156428c6-b9a7-4d3a-9504-b3537029ac6a"
name=
"Changes"
comment=
""
/>
<list
default=
"true"
id=
"156428c6-b9a7-4d3a-9504-b3537029ac6a"
name=
"Changes"
comment=
"creat"
>
<change
afterPath=
"$PROJECT_DIR$/src/main/java/SearchForPrimes.java"
afterDir=
"false"
/>
<change
afterPath=
"$PROJECT_DIR$/src/test/java/FindPrimesTest.java"
afterDir=
"false"
/>
<change
beforePath=
"$PROJECT_DIR$/.idea/workspace.xml"
beforeDir=
"false"
afterPath=
"$PROJECT_DIR$/.idea/workspace.xml"
afterDir=
"false"
/>
<change
beforePath=
"$PROJECT_DIR$/pom.xml"
beforeDir=
"false"
afterPath=
"$PROJECT_DIR$/pom.xml"
afterDir=
"false"
/>
</list>
<option
name=
"SHOW_DIALOG"
value=
"false"
/>
<option
name=
"SHOW_DIALOG"
value=
"false"
/>
<option
name=
"HIGHLIGHT_CONFLICTS"
value=
"true"
/>
<option
name=
"HIGHLIGHT_CONFLICTS"
value=
"true"
/>
<option
name=
"HIGHLIGHT_NON_ACTIVE_CHANGELIST"
value=
"false"
/>
<option
name=
"HIGHLIGHT_NON_ACTIVE_CHANGELIST"
value=
"false"
/>
<option
name=
"LAST_RESOLUTION"
value=
"IGNORE"
/>
<option
name=
"LAST_RESOLUTION"
value=
"IGNORE"
/>
</component>
</component>
<component
name=
"FileTemplateManagerImpl"
>
<option
name=
"RECENT_TEMPLATES"
>
<list>
<option
value=
"Class"
/>
</list>
</option>
</component>
<component
name=
"Git.Settings"
>
<option
name=
"RECENT_GIT_ROOT_PATH"
value=
"$PROJECT_DIR$"
/>
</component>
<component
name=
"MarkdownSettingsMigration"
>
<option
name=
"stateVersion"
value=
"1"
/>
</component>
<component
name=
"ProjectId"
id=
"2XMJWqEVXOWOWiBZtLhpTJDKlyw"
/>
<component
name=
"ProjectId"
id=
"2XMJWqEVXOWOWiBZtLhpTJDKlyw"
/>
<component
name=
"ProjectLevelVcsManager"
settingsEditedManually=
"true"
/>
<component
name=
"ProjectLevelVcsManager"
settingsEditedManually=
"true"
>
<ConfirmationsSetting
value=
"2"
id=
"Add"
/>
</component>
<component
name=
"ProjectViewState"
>
<component
name=
"ProjectViewState"
>
<option
name=
"hideEmptyMiddlePackages"
value=
"true"
/>
<option
name=
"hideEmptyMiddlePackages"
value=
"true"
/>
<option
name=
"showLibraryContents"
value=
"true"
/>
<option
name=
"showLibraryContents"
value=
"true"
/>
...
@@ -16,9 +39,27 @@
...
@@ -16,9 +39,27 @@
<component
name=
"PropertiesComponent"
>
<![CDATA[{
<component
name=
"PropertiesComponent"
>
<![CDATA[{
"keyToString": {
"keyToString": {
"RunOnceActivity.OpenProjectViewOnStart": "true",
"RunOnceActivity.OpenProjectViewOnStart": "true",
"RunOnceActivity.ShowReadmeOnStart": "true"
"RunOnceActivity.ShowReadmeOnStart": "true",
"last_opened_file_path": "D:/HIAST/FIY/FS/Parallel Programming/Lab/1/PP-lec01-Threads"
}
}
}]]>
</component>
}]]>
</component>
<component
name=
"RunManager"
>
<configuration
name=
"FindPrimesTest.testFindPrimes"
type=
"JUnit"
factoryName=
"JUnit"
temporary=
"true"
nameIsGenerated=
"true"
>
<module
name=
"Lab101"
/>
<option
name=
"PACKAGE_NAME"
value=
""
/>
<option
name=
"MAIN_CLASS_NAME"
value=
"FindPrimesTest"
/>
<option
name=
"METHOD_NAME"
value=
"testFindPrimes"
/>
<option
name=
"TEST_OBJECT"
value=
"method"
/>
<method
v=
"2"
>
<option
name=
"Make"
enabled=
"true"
/>
</method>
</configuration>
<recent_temporary>
<list>
<item
itemvalue=
"JUnit.FindPrimesTest.testFindPrimes"
/>
</list>
</recent_temporary>
</component>
<component
name=
"SpellCheckerSettings"
RuntimeDictionaries=
"0"
Folders=
"0"
CustomDictionaries=
"0"
DefaultDictionary=
"application-level"
UseSingleDictionary=
"true"
transferred=
"true"
/>
<component
name=
"SpellCheckerSettings"
RuntimeDictionaries=
"0"
Folders=
"0"
CustomDictionaries=
"0"
DefaultDictionary=
"application-level"
UseSingleDictionary=
"true"
transferred=
"true"
/>
<component
name=
"TaskManager"
>
<component
name=
"TaskManager"
>
<task
active=
"true"
id=
"Default"
summary=
"Default task"
>
<task
active=
"true"
id=
"Default"
summary=
"Default task"
>
...
@@ -28,6 +69,29 @@
...
@@ -28,6 +69,29 @@
<option
name=
"presentableId"
value=
"Default"
/>
<option
name=
"presentableId"
value=
"Default"
/>
<updated>
1698433053905
</updated>
<updated>
1698433053905
</updated>
</task>
</task>
<task
id=
"LOCAL-00001"
summary=
"first"
>
<created>
1698433083690
</created>
<option
name=
"number"
value=
"00001"
/>
<option
name=
"presentableId"
value=
"LOCAL-00001"
/>
<option
name=
"project"
value=
"LOCAL"
/>
<updated>
1698433083690
</updated>
</task>
<option
name=
"localTasksCounter"
value=
"2"
/>
<servers
/>
<servers
/>
</component>
</component>
<component
name=
"Vcs.Log.Tabs.Properties"
>
<option
name=
"TAB_STATES"
>
<map>
<entry
key=
"MAIN"
>
<value>
<State
/>
</value>
</entry>
</map>
</option>
</component>
<component
name=
"VcsManagerConfiguration"
>
<MESSAGE
value=
"first"
/>
<option
name=
"LAST_COMMIT_MESSAGE"
value=
"first"
/>
</component>
</project>
</project>
\ No newline at end of file
pom.xml
View file @
c8611a15
...
@@ -7,7 +7,13 @@
...
@@ -7,7 +7,13 @@
<groupId>
org.example
</groupId>
<groupId>
org.example
</groupId>
<artifactId>
Lab101
</artifactId>
<artifactId>
Lab101
</artifactId>
<version>
1.0-SNAPSHOT
</version>
<version>
1.0-SNAPSHOT
</version>
<dependencies>
<dependency>
<groupId>
junit
</groupId>
<artifactId>
junit
</artifactId>
<version>
4.13.2
</version>
</dependency>
</dependencies>
<properties>
<properties>
<maven.compiler.source>
11
</maven.compiler.source>
<maven.compiler.source>
11
</maven.compiler.source>
<maven.compiler.target>
11
</maven.compiler.target>
<maven.compiler.target>
11
</maven.compiler.target>
...
...
src/main/java/SearchForPrimes.java
0 → 100644
View file @
c8611a15
import
java.util.ArrayList
;
import
java.util.List
;
public
class
SearchForPrimes
{
private
int
start
;
private
int
end
;
private
List
<
Integer
>
Primes
;
public
SearchForPrimes
(
int
start
,
int
end
)
{
this
.
start
=
start
;
this
.
end
=
end
;
this
.
Primes
=
new
ArrayList
<>();
}
public
List
<
Integer
>
getPrimes
()
{
for
(
int
i
=
this
.
start
;
i
<=
this
.
end
;
i
++)
{
boolean
isPrime
=
true
;
for
(
int
j
=
2
;
j
*
j
<=
i
;
j
++)
{
if
(
i
%
j
==
0
)
{
isPrime
=
false
;
break
;
}
}
if
(
isPrime
)
{
Primes
.
add
(
i
);
}
}
return
this
.
Primes
;
}
}
src/test/java/FindPrimesTest.java
0 → 100644
View file @
c8611a15
import
junit.framework.TestCase
;
import
java.util.List
;
public
class
FindPrimesTest
extends
TestCase
{
public
void
testFindPrimes
()
{
SearchForPrimes
searchForPrimes
=
new
SearchForPrimes
(
1
,
10000000
);
long
startTimer
=
System
.
currentTimeMillis
();
List
<
Integer
>
Primes1
=
searchForPrimes
.
getPrimes
();
long
endTimer
=
System
.
currentTimeMillis
();
System
.
out
.
println
(
"Time Taken = "
+
(
endTimer
-
startTimer
));
for
(
int
i
=
0
;
i
<
Primes1
.
size
()
;
i
++)
{
System
.
out
.
println
(
Primes1
.
get
(
i
));
}
}
}
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