Skip to content

Commit 8fa9526

Browse files
committed
add project 4
1 parent bc30e47 commit 8fa9526

24 files changed

+1612
-0
lines changed
Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
# Directories #
2+
/build/
3+
/bin/
4+
target/
5+
# OS Files #
6+
.DS_Store
7+
*.class
8+
# Package Files #
9+
*.jar
10+
*.war
11+
*.ear
12+
*.db
13+
######################
14+
# Windows
15+
######################
16+
# Windows image file caches
17+
Thumbs.db
18+
# Folder config file
19+
Desktop.ini
20+
######################
21+
# OSX
22+
######################
23+
.DS_Store
24+
.svn
25+
# Thumbnails
26+
._*
27+
# Files that might appear on external disk
28+
.Spotlight-V100
29+
.Trashes
30+
######################
31+
# Eclipse
32+
######################
33+
*.pydevproject
34+
.project
35+
.metadata
36+
bin/**
37+
tmp/**
38+
tmp/**/*
39+
*.tmp
40+
*.bak
41+
*.swp
42+
*~.nib
43+
local.properties
44+
.classpath
45+
.settings/
46+
.loadpath
47+
/src/main/resources/rebel.xml
48+
# External tool builders
49+
.externalToolBuilders/
50+
# Locally stored "Eclipse launch configurations"
51+
*.launch
52+
# CDT-specific
53+
.cproject
54+
# PDT-specific
55+
.buildpath
56+
57+
# For Android Project
58+
# built application files
59+
*.apk
60+
*.ap_
61+
62+
# files for the dex VM
63+
*.dex
64+
65+
# Java class files
66+
*.class
67+
68+
# generated files
69+
bin/
70+
gen/
71+
72+
#libraries
73+
libs/
74+
75+
#logs
76+
*.log
77+
78+
# Local configuration file (sdk path, etc)
79+
local.properties
Lines changed: 109 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,109 @@
1+
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
2+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
3+
4+
<modelVersion>4.0.0</modelVersion>
5+
<groupId>edu.coursera.concurrent</groupId>
6+
<artifactId>miniproject_4</artifactId>
7+
<packaging>jar</packaging>
8+
<version>0.0</version>
9+
<name>miniproject_4</name>
10+
11+
<properties>
12+
<pcdp.version>0.0.4-SNAPSHOT</pcdp.version>
13+
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
14+
</properties>
15+
16+
<repositories>
17+
<repository>
18+
<id>pcdp-repo</id>
19+
<url>https://raw.github.com/habanero-maven/hjlib-maven-repo/mvn-repo-pcdp-${pcdp.version}/</url>
20+
<snapshots>
21+
<enabled>true</enabled>
22+
<updatePolicy>always</updatePolicy>
23+
</snapshots>
24+
</repository>
25+
</repositories>
26+
27+
<dependencies>
28+
<dependency>
29+
<groupId>org.apache.maven.plugins</groupId>
30+
<artifactId>maven-resources-plugin</artifactId>
31+
<version>2.4.3</version>
32+
</dependency>
33+
<dependency>
34+
<groupId>edu.rice.pcdp</groupId>
35+
<artifactId>pcdp-core</artifactId>
36+
<version>${pcdp.version}</version>
37+
</dependency>
38+
39+
<dependency>
40+
<groupId>junit</groupId>
41+
<artifactId>junit</artifactId>
42+
<version>3.8.2</version>
43+
<scope>test</scope>
44+
</dependency>
45+
</dependencies>
46+
47+
<build>
48+
<pluginManagement>
49+
<plugins>
50+
<plugin>
51+
<!-- specify the java version to use during compilation -->
52+
<groupId>org.apache.maven.plugins</groupId>
53+
<artifactId>maven-compiler-plugin</artifactId>
54+
<version>3.1</version>
55+
<configuration>
56+
<source>1.8</source>
57+
<target>1.8</target>
58+
</configuration>
59+
</plugin>
60+
<plugin>
61+
<!-- populates the properties for dependency jar paths -->
62+
<groupId>org.apache.maven.plugins</groupId>
63+
<artifactId>maven-dependency-plugin</artifactId>
64+
<version>2.9</version>
65+
<executions>
66+
<execution>
67+
<goals>
68+
<goal>properties</goal>
69+
</goals>
70+
</execution>
71+
</executions>
72+
</plugin>
73+
<plugin>
74+
<!-- executes test with -Xmx option -->
75+
<groupId>org.apache.maven.plugins</groupId>
76+
<artifactId>maven-surefire-plugin</artifactId>
77+
<version>2.17</version>
78+
<configuration>
79+
<forkMode>pertest</forkMode>
80+
<argLine>-Xmx4g</argLine>
81+
<useSystemClassLoader>true</useSystemClassLoader>
82+
<testFailureIgnore>true</testFailureIgnore>
83+
</configuration>
84+
</plugin>
85+
<plugin>
86+
<groupId>org.apache.maven.plugins</groupId>
87+
<artifactId>maven-checkstyle-plugin</artifactId>
88+
<version>2.17</version>
89+
<executions>
90+
<execution>
91+
<id>checkstyle</id>
92+
<phase>validate</phase>
93+
<configuration>
94+
<configLocation>${basedir}/src/main/resources/checkstyle.xml</configLocation>
95+
<encoding>UTF-8</encoding>
96+
<consoleOutput>true</consoleOutput>
97+
<failsOnError>true</failsOnError>
98+
<failOnViolation>true</failOnViolation>
99+
</configuration>
100+
<goals>
101+
<goal>check</goal>
102+
</goals>
103+
</execution>
104+
</executions>
105+
</plugin>
106+
</plugins>
107+
</pluginManagement>
108+
</build>
109+
</project>
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
package edu.coursera.concurrent;
2+
3+
import edu.coursera.concurrent.boruvka.Component;
4+
5+
import java.util.Queue;
6+
7+
/**
8+
* An abstract interface of the APIs to test for computing a spanning tree using
9+
* Boruvka's algorithm.
10+
*
11+
* @param <C> Type of component this Boruvka implementation operates on.
12+
*/
13+
public abstract class AbstractBoruvka<C extends Component> {
14+
/**
15+
* Given a queue of nodes making up the initial graph, compute a minimal
16+
* spanning tree and return the result in the provided solution object.
17+
*
18+
* For SeqBoruvka, this method is called single-threaded and passed
19+
* nodesLoaded as a LinkedList.
20+
*
21+
* However, for ParBoruvka this method is called from multiple threads at
22+
* the same time and passed nodesLoaded as a ConcurrentLinkedQueue. Hence,
23+
* the programmer is essentially handed their thread pool and a thread-safe
24+
* work pool at the start of execution, and can safely grab work from that
25+
* work pool from any thread. However, synchronization is still required on
26+
* the graph itself, just not on the input work queue.
27+
*
28+
* @param nodesLoaded A queue of all nodes in the input graph. For
29+
* SeqBoruvka, this is guaranteed to be a LinkedList. For
30+
* ParBoruvka, this is guaranteed to be a
31+
* ConcurrentLinkedQueue (i.e. you may perform operations
32+
* on it from multiple threads safely).
33+
* @param solution An object for storing the final component the graph
34+
* collapsed down to using Boruvka's algorithm. *** At the
35+
* completion of your kernel, call setSolution on this
36+
* object to return your result to the testing code ***
37+
*/
38+
public abstract void computeBoruvka(final Queue<C> nodesLoaded,
39+
final SolutionToBoruvka<C> solution);
40+
}

0 commit comments

Comments
 (0)