package de._82grfl1bif.KPI_Visualizer.data; import java.time.Duration; import java.time.LocalDateTime; import java.util.ArrayList; public class Klasse { public String name; public String path; public int qloc; public static int qlocMin = Integer.MAX_VALUE; public static int qlocMax; public int loc; public static int locMin= Integer.MAX_VALUE; public static int locMax; public int commits; public static int commitsMin= Integer.MAX_VALUE; public static int commitsMax; public int depth; public static int depthMax; public int complexity; public static int complexityMax; public static int complexityMin= Integer.MAX_VALUE; public final int id; public int functions; public static int functionsMin= Integer.MAX_VALUE; public static int functionsMax; public int variables; public static int variablesMin= Integer.MAX_VALUE; public static int variablesMax; public Duration bearbeiteteZeit; public static Duration bearbeiteteZeitMin; public static Duration bearbeiteteZeitMax; public Duration zeitSeitLetzterBearbeitung; public static Duration zeitSeitLetzterBearbeitungMin; public static Duration zeitSeitLetzterBearbeitungMax; public Duration zeitSeitErstemCommit; public static Duration zeitSeitErstemCommitMin; public static Duration zeitSeitErstemCommitMax; ArrayList commitTimes; public Klasse(int id, String name, String path, int qloc, int loc, int commits, int functions, int variables,int complexity, ArrayList commitTimes){ this.id = id; this.commits = commits; commitsMax = Math.max(commitsMax,commits); commitsMin = Math.min(commitsMin,commits); this.depth = getDepthOfPath(path); depthMax = Math.max(depthMax,depth); this.loc = loc; locMax = Math.max(locMax,loc); locMin = Math.min(locMin,loc); this.qloc = qloc; qlocMax = Math.max(qlocMax,qloc); qlocMin = Math.min(qlocMin,qloc); this.functions = functions; functionsMax = Math.max(functionsMax,functions); functionsMin = Math.min(functionsMin,functions); this.variables = variables; variablesMax = Math.max(variablesMax,variables); variablesMin = Math.min(variablesMin,variables); this.complexity = complexity; complexityMax = Math.max(complexityMax,complexity); complexityMin = Math.min(complexityMin,complexity); this.name = name; this.path = path; this.commitTimes = commitTimes; this.bearbeiteteZeit = (commitTimes.isEmpty()) ? null:Duration.between(commitTimes.get(commitTimes.size()-1), commitTimes.get(0)); if (bearbeiteteZeit != null) { if(bearbeiteteZeitMax == null)bearbeiteteZeitMax = Duration.ofMillis(Long.MIN_VALUE); if(bearbeiteteZeitMin == null)bearbeiteteZeitMin = Duration.ofMillis((Long.MAX_VALUE)); bearbeiteteZeitMax = (bearbeiteteZeitMax.toMillis() >= bearbeiteteZeit.toMillis()) ? bearbeiteteZeitMax:bearbeiteteZeit; bearbeiteteZeitMin = (bearbeiteteZeitMin.toMillis() <= bearbeiteteZeit.toMillis()) ? bearbeiteteZeitMin:bearbeiteteZeit; } this.zeitSeitLetzterBearbeitung = (commitTimes.isEmpty()) ? null:Duration.between(commitTimes.get(0),LocalDateTime.now()); if (zeitSeitLetzterBearbeitung != null) { if(zeitSeitLetzterBearbeitungMax == null)zeitSeitLetzterBearbeitungMax = Duration.ofMillis(Long.MIN_VALUE); if(zeitSeitLetzterBearbeitungMin == null)zeitSeitLetzterBearbeitungMin = Duration.ofMillis(Long.MAX_VALUE); zeitSeitLetzterBearbeitungMax = (zeitSeitLetzterBearbeitungMax.toMillis() >= zeitSeitLetzterBearbeitung.toMillis()) ? zeitSeitLetzterBearbeitungMax:zeitSeitLetzterBearbeitung; zeitSeitLetzterBearbeitungMin = (zeitSeitLetzterBearbeitungMin.toMillis() <= zeitSeitLetzterBearbeitung.toMillis()) ? zeitSeitLetzterBearbeitungMin:zeitSeitLetzterBearbeitung; } this.zeitSeitErstemCommit = (commitTimes.isEmpty()) ? null:Duration.between(commitTimes.get(commitTimes.size()-1),LocalDateTime.now()); if (zeitSeitErstemCommit != null) { if(zeitSeitErstemCommitMax == null)zeitSeitErstemCommitMax = Duration.ofMillis(Long.MIN_VALUE); if(zeitSeitErstemCommitMin == null)zeitSeitErstemCommitMin = Duration.ofMillis(Long.MAX_VALUE); zeitSeitErstemCommitMax = (zeitSeitErstemCommitMax.toMillis() >= zeitSeitErstemCommit.toMillis()) ? zeitSeitErstemCommitMax:zeitSeitErstemCommit; zeitSeitErstemCommitMin = (zeitSeitErstemCommitMin.toMillis() <= zeitSeitErstemCommit.toMillis()) ? zeitSeitErstemCommitMin:zeitSeitErstemCommit; } } private int getDepthOfPath(String path){ int result = -1; if(path.contains("tmp")){ result = path.split("/").length-2; } return result; } }