Skip to content

Commit

Permalink
Merge branch 'release/1.8.2'
Browse files Browse the repository at this point in the history
  • Loading branch information
miguelpinia committed Jan 24, 2021
2 parents 0742895 + b75bf32 commit 20d2d5a
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 10 deletions.
12 changes: 11 additions & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>org.mx.unam.imate</groupId>
<artifactId>concurrentAlgorithms</artifactId>
<version>1.9.0-SNAPSHOT</version>
<version>1.8.2</version>
<packaging>jar</packaging>
<dependencies>
<dependency>
Expand Down Expand Up @@ -44,6 +44,12 @@
<artifactId>json</artifactId>
<version>20200518</version>
</dependency>
<!-- https://mvnrepository.com/artifact/gnu.trove/trove -->
<dependency>
<groupId>gnu.trove</groupId>
<artifactId>trove</artifactId>
<version>3.0.3</version>
</dependency>
</dependencies>
<build>
<plugins>
Expand Down Expand Up @@ -115,6 +121,10 @@
<id>java-net-repo</id>
<url>https://maven.java.net/content/repositories/public/</url>
</repository>
<repository>
<id>mvnrepository</id>
<url>http://zoidberg.ukp.informatik.tu-darmstadt.de/artifactory/public-releases/</url>
</repository>
</repositories>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,9 @@ public void compareAlgs() {
System.out.println(header);
JSONObject results = exp.putSteals(types, putStealsOptions);
System.out.println(results.toString(2));
WorkStealingUtils.saveJsonObjectToFile(results, "putsSteals.json");
SimpleDateFormat format = new SimpleDateFormat("dd_MM_yyyy-HH:mm:ss");
String time = format.format(new Date());
WorkStealingUtils.saveJsonObjectToFile(results, String.format("putsSteals-%s.json", time));
}
if (putTakes) {
String header
Expand All @@ -108,7 +110,9 @@ public void compareAlgs() {
System.out.println(header);
JSONObject results = exp.putTakes(types, putTakesOptions);
System.out.println(results.toString(2));
WorkStealingUtils.saveJsonObjectToFile(results, "putsTakes.json");
SimpleDateFormat format = new SimpleDateFormat("dd_MM_yyyy-HH:mm:ss");
String time = format.format(new Date());
WorkStealingUtils.saveJsonObjectToFile(results, String.format("putsTakes-%s.json", time));
}
if (putsTakesSteals) {
String header
Expand All @@ -119,7 +123,9 @@ public void compareAlgs() {
System.out.println(header);
JSONObject results = exp.putTakesSteals(types, ptsOptions);
System.out.println(results.toString(2));
WorkStealingUtils.saveJsonObjectToFile(results, "putsTakesSteals.json");
SimpleDateFormat format = new SimpleDateFormat("dd_MM_yyyy-HH:mm:ss");
String time = format.format(new Date());
WorkStealingUtils.saveJsonObjectToFile(results, String.format("putsTakesSteals-%s.json", time));
}
if (spanningTree) {
String header
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
package org.mx.unam.imate.concurrent.datastructures.graph;

import gnu.trove.list.TIntList;
import gnu.trove.list.array.TIntArrayList;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.stream.Collectors;

/**
* Represent the vertex of a graph. Use a <b>List</b> to store its neighbours,
Expand All @@ -15,14 +20,14 @@ public class Vertex {

private final boolean directed;
private final Integer value;
private final List<Integer> neighbours;
private final List<Integer> childs;
private final TIntList neighbours;
private final TIntList childs;

public Vertex(boolean directed, Integer value) {
this.directed = directed;
this.value = value;
this.neighbours = new ArrayList<>();
this.childs = directed ? new ArrayList<>() : null;
this.neighbours = new TIntArrayList();
this.childs = directed ? new TIntArrayList() : null;
}

public boolean isDirected() {
Expand All @@ -34,11 +39,17 @@ public Integer getValue() {
}

public List<Integer> getNeighbours() {
return neighbours;
List<Integer> result = Arrays.stream(neighbours.toArray())
.boxed()
.collect(Collectors.toList());
return result;
}

public List<Integer> getChilds() {
return childs;
List<Integer> result = Arrays.stream(childs.toArray())
.boxed()
.collect(Collectors.toList());
return result;
}

public void addNeighbour(int neighbour) {
Expand Down

0 comments on commit 20d2d5a

Please sign in to comment.