-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Conflicts: pom.xml
- Loading branch information
Showing
41 changed files
with
1,494 additions
and
921 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
/target/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
src/main/java/edu/pitt/dbmi/causal/cmd/AlgorithmRunException.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
/* | ||
* Copyright (C) 2017 University of Pittsburgh. | ||
* Copyright (C) 2019 University of Pittsburgh. | ||
* | ||
* This library is free software; you can redistribute it and/or | ||
* modify it under the terms of the GNU Lesser General Public | ||
|
@@ -16,9 +16,8 @@ | |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, | ||
* MA 02110-1301 USA | ||
*/ | ||
package edu.pitt.dbmi.causal.cmd.util; | ||
package edu.pitt.dbmi.causal.cmd; | ||
|
||
import edu.pitt.dbmi.causal.cmd.ParseOptions; | ||
import java.text.DateFormat; | ||
import java.text.SimpleDateFormat; | ||
import java.util.Date; | ||
|
@@ -33,15 +32,15 @@ | |
|
||
/** | ||
* | ||
* Mar 10, 2017 1:26:52 PM | ||
* Jan 8, 2019 12:04:29 PM | ||
* | ||
* @author Kevin V. Bui ([email protected]) | ||
*/ | ||
public class Application { | ||
public final class Applications { | ||
|
||
private static final DateFormat DF = new SimpleDateFormat("EEE, MMMM dd, yyyy hh:mm:ss a"); | ||
|
||
private Application() { | ||
private Applications() { | ||
} | ||
|
||
public static void showHelp(String[] args, ParseOptions parseOptions, String footer) { | ||
|
@@ -108,11 +107,11 @@ public static String fmtDateNow() { | |
} | ||
|
||
public static String jarTitle() { | ||
return Application.class.getPackage().getImplementationTitle(); | ||
return Applications.class.getPackage().getImplementationTitle(); | ||
} | ||
|
||
public static String jarVersion() { | ||
String version = Application.class.getPackage().getImplementationVersion(); | ||
String version = Applications.class.getPackage().getImplementationVersion(); | ||
|
||
return (version == null) ? "unknown" : version; | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
/* | ||
* Copyright (C) 2017 University of Pittsburgh. | ||
* Copyright (C) 2019 University of Pittsburgh. | ||
* | ||
* This library is free software; you can redistribute it and/or | ||
* modify it under the terms of the GNU Lesser General Public | ||
|
@@ -16,13 +16,14 @@ | |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, | ||
* MA 02110-1301 USA | ||
*/ | ||
package edu.pitt.dbmi.causal.cmd.util; | ||
package edu.pitt.dbmi.causal.cmd; | ||
|
||
import edu.pitt.dbmi.causal.cmd.CmdOptions; | ||
import java.util.Arrays; | ||
import java.util.HashMap; | ||
import java.util.LinkedList; | ||
import java.util.List; | ||
import java.util.Map; | ||
import java.util.Objects; | ||
import org.apache.commons.cli.CommandLine; | ||
import org.apache.commons.cli.DefaultParser; | ||
import org.apache.commons.cli.Option; | ||
|
@@ -35,7 +36,7 @@ | |
* | ||
* @author Kevin V. Bui ([email protected]) | ||
*/ | ||
public class Args { | ||
public final class Args { | ||
|
||
private Args() { | ||
} | ||
|
@@ -138,6 +139,13 @@ public static String[] extractOptions(String[] args, Options options) { | |
return argsList.toArray(new String[argsList.size()]); | ||
} | ||
|
||
/** | ||
* Parse the long parameters from the command inputs to map where the | ||
* parameters are map keys and parameter values are map values. | ||
* | ||
* @param args | ||
* @return | ||
*/ | ||
public static Map<String, String> toMapLongOptions(String[] args) { | ||
Map<String, String> map = new HashMap<>(); | ||
|
||
|
@@ -163,6 +171,13 @@ public static Map<String, String> toMapLongOptions(String[] args) { | |
return map; | ||
} | ||
|
||
/** | ||
* Parse the command inputs to map where the parameters are map keys and | ||
* parameter values are map values. | ||
* | ||
* @param args | ||
* @return | ||
*/ | ||
public static Map<String, String> toMapOptions(String[] args) { | ||
Map<String, String> map = new HashMap<>(); | ||
|
||
|
@@ -214,21 +229,13 @@ public static boolean isEmpty(String[] args) { | |
} | ||
|
||
public static String[] clean(String[] args) { | ||
if (args == null) { | ||
return new String[0]; | ||
} | ||
|
||
List<String> argList = new LinkedList<>(); | ||
for (String arg : args) { | ||
if (arg != null) { | ||
arg = arg.trim(); | ||
if (!arg.isEmpty()) { | ||
argList.add(arg); | ||
} | ||
} | ||
} | ||
|
||
return argList.toArray(new String[argList.size()]); | ||
return (args == null) | ||
? new String[0] | ||
: Arrays.stream(args) | ||
.filter(Objects::nonNull) | ||
.map(String::trim) | ||
.filter(e -> !e.isEmpty()) | ||
.toArray(String[]::new); | ||
} | ||
|
||
} |
Oops, something went wrong.