Skip to content

Commit

Permalink
FSM.Matched
Browse files Browse the repository at this point in the history
  • Loading branch information
Pastor committed Dec 24, 2024
1 parent c618c8d commit 99768c3
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 5 deletions.
2 changes: 2 additions & 0 deletions server.cmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
@echo off
python3 -m http.server 8000 -d .
14 changes: 10 additions & 4 deletions vol8/src/main/java/ru/mifi/practice/vol8/process/Duplicate.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
import java.io.IOException;
import java.io.InputStream;
import java.io.Writer;
import java.nio.file.FileSystems;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
Expand All @@ -26,7 +27,12 @@
public interface Duplicate {
int MINIMUM_LINES = 50;
int MINIMUM_RELATIONS = 2;
String DIRECTORY = "/Users/pastor/github/algorithms-and-data-structures-2024";
// String DIRECTORY = "/Users/pastor/github/algorithms-and-data-structures-2024";
String FILE_SEPARATOR = FileSystems.getDefault().getSeparator();
// String REGEXP_SEPARATOR = "/";
String REGEXP_SEPARATOR = "\\\\";
String DIRECTORY = "E:\\GitHub\\algorithms-and-data-structures-2024";
String DIRECTORY_STUDENTS = DIRECTORY + FILE_SEPARATOR + "students" + FILE_SEPARATOR;

static void main(String[] args) throws XMLStreamException, IOException {
Default duplicate = new Default();
Expand Down Expand Up @@ -115,7 +121,7 @@ record CodeFile(String path, int line, int endLine, int lines) {
}

String code() {
return path.split("/")[0];
return path.split(REGEXP_SEPARATOR)[0];
}

@Override
Expand All @@ -134,7 +140,7 @@ public int hashCode() {

@Override
public String toString() {
String[] parts = path.split("/");
String[] parts = path.split(REGEXP_SEPARATOR);
return lines + ":" + parts[parts.length - 1];
}
}
Expand Down Expand Up @@ -224,7 +230,7 @@ private void parseDuplicate(CodeSegment segment, XMLEventReader reader) throws X
String localPart = element.getName().getLocalPart();
if ("file".equals(localPart)) {
CodeFile file = new CodeFile(
readString(element, "path").replace(DIRECTORY + "/students/", ""),
readString(element, "path").replace(DIRECTORY_STUDENTS, ""),
readInt(element, "line"),
readInt(element, "endline")
);
Expand Down
2 changes: 1 addition & 1 deletion vol8/src/main/resources/visibility.html
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
.attr("transform", `translate(${margin.left}, ${margin.top})`);

//Read the data
d3.csv("/AaDS/duplicate.csv").then(function (data) {
d3.csv("http://127.0.0.1:8000/duplicate.csv").then(function (data) {

// Labels of row and columns -> unique identifier of the column called 'group' and 'variable'
const mSource = Array.from(new Set(data.map(d => d.Source)))
Expand Down

0 comments on commit 99768c3

Please sign in to comment.