From a988c80723122145b4d79277a3c02d4287b9d183 Mon Sep 17 00:00:00 2001 From: ryahiaoui Date: Tue, 3 Jan 2017 09:31:04 +0100 Subject: [PATCH] Rename MessageErrors class to Messages --- .../yedgen/graph/managers/GraphExtractor.java | 16 +++++++------- .../org/inra/yedgen/processor/Processor.java | 22 +++++++++---------- .../{MessageErrors.java => Messages.java} | 2 +- .../managers/ManagerPatternContext.java | 8 +++---- .../managers/ManagerPatternParallel.java | 6 ++--- .../processor/managers/ManagerVariable.java | 4 ++-- .../managers/MetaPatternManager.java | 14 ++++++------ .../inra/yedgen/properties/CsvProperties.java | 10 ++++----- 8 files changed, 40 insertions(+), 42 deletions(-) rename src/main/java/org/inra/yedgen/processor/errors/{MessageErrors.java => Messages.java} (99%) diff --git a/src/main/java/org/inra/yedgen/graph/managers/GraphExtractor.java b/src/main/java/org/inra/yedgen/graph/managers/GraphExtractor.java index 6c99cea..7019c53 100644 --- a/src/main/java/org/inra/yedgen/graph/managers/GraphExtractor.java +++ b/src/main/java/org/inra/yedgen/graph/managers/GraphExtractor.java @@ -20,7 +20,7 @@ import org.inra.yedgen.graph.entities.Edge; import org.inra.yedgen.processor.entities.Node; import static java.util.stream.Collectors.toList; -import org.inra.yedgen.processor.errors.MessageErrors; +import org.inra.yedgen.processor.errors.Messages; /** * @@ -502,7 +502,7 @@ else if ( jsonObject.getJSONObject("data").has("y:ArcEdge") ) { } else { - MessageErrors.printExtractionError() ; + Messages.printExtractionError() ; } } @@ -547,7 +547,7 @@ else if(jsonObject.getJSONArray("data") } } else { - MessageErrors.printNotFoundLabelError() ; + Messages.printNotFoundLabelError() ; } String id = jsonObject.getString("id") ; @@ -562,7 +562,7 @@ else if(jsonObject.getJSONArray("data") } else { - MessageErrors.printExtractionError() ; + Messages.printExtractionError() ; } } } @@ -578,7 +578,7 @@ private void process( String pathFile ) throws IOException { public void genGraphPopulatingManagers( String directory , String extensionFile ) throws Exception { - MessageErrors.printMessageExtractGraph( directory ) ; + Messages.printMessageExtractGraph( directory ) ; boolean processed = false ; @@ -588,7 +588,7 @@ public void genGraphPopulatingManagers( String directory , if(path.toString().endsWith(extensionFile )) { - MessageErrors.printMessageProcessingGraphFile( path.toAbsolutePath() + Messages.printMessageProcessingGraphFile( path.toAbsolutePath() .toString()) ; process(path.toString() ) ; @@ -598,12 +598,12 @@ public void genGraphPopulatingManagers( String directory , if ( ! processed ) { - MessageErrors.printMessageFilesNotFoundExtentsion( directory, + Messages.printMessageFilesNotFoundExtentsion( directory, extensionFile ) ; System.exit ( 0 ) ; } - MessageErrors.printSeparator(); + Messages.printSeparator(); } public Map> getMapUris() { diff --git a/src/main/java/org/inra/yedgen/processor/Processor.java b/src/main/java/org/inra/yedgen/processor/Processor.java index 91d4288..d611be0 100644 --- a/src/main/java/org/inra/yedgen/processor/Processor.java +++ b/src/main/java/org/inra/yedgen/processor/Processor.java @@ -23,7 +23,7 @@ import org.inra.yedgen.graph.managers.ManagerConcept; import org.inra.yedgen.graph.managers.GraphExtractor; import org.inra.yedgen.processor.managers.ManagerNode; -import org.inra.yedgen.processor.errors.MessageErrors; +import org.inra.yedgen.processor.errors.Messages; import org.inra.yedgen.processor.factories.FactoryNode; import org.inra.yedgen.processor.managers.ManagerQuery; import org.inra.yedgen.processor.managers.ManagerVariable; @@ -134,7 +134,7 @@ public boolean processFull ( String outputFile, String csvFile ) { public boolean processOnlyGraphVariables ( String outputFile ) { - MessageErrors.printMessageStartProcessVariableGraphGeneration() ; + Messages.printMessageStartProcessVariableGraphGeneration() ; for( Variable variable : managerVariable.getVariables()) { @@ -163,7 +163,7 @@ public boolean processOnlyGraphVariables ( String outputFile ) { Writer.checkFile( outFile ) ; Writer.writeTextFile(outPut, outFile) ; - MessageErrors.printMessageInfoGeneratedVariable( variable.getVariableName() , + Messages.printMessageInfoGeneratedVariable( variable.getVariableName() , outFile ) ; } catch (IOException ex) { @@ -177,10 +177,10 @@ public boolean processOnlyGraphVariables ( String outputFile ) { public boolean processOnlyCSV ( String outputFile , String csvFile ) { - MessageErrors.printMessageStartProcessCsvVariableGeneration( csvFile ) ; + Messages.printMessageStartProcessCsvVariableGeneration( csvFile ) ; if( ! Writer.existFile ( csvFile ) ) { - MessageErrors.printMessageErrorCSV ( csvFile) ; + Messages.printMessageErrorCSV ( csvFile) ; return true ; } @@ -192,15 +192,13 @@ public boolean processOnlyCSV ( String outputFile , String csvFile ) { pattVariable == null || pattParallel == null ) { - MessageErrors.printMessageMetaPatternsNull() ; + Messages.printMessageMetaPatternsNull() ; return false ; } try { - Files.lines ( Paths.get(csvFile) ).skip(1).forEach ( - - (String line) -> { + Files.lines ( Paths.get(csvFile) ).skip(1).forEach ((String line) -> { List outPut = new ArrayList<>() ; @@ -235,7 +233,7 @@ public boolean processOnlyCSV ( String outputFile , String csvFile ) { Writer.checkFile( outFile ) ; Writer.writeTextFile(outPut, outFile) ; - MessageErrors.printMessageInfoGeneratedVariable( variable.getVariableName() , + Messages.printMessageInfoGeneratedVariable( variable.getVariableName() , outFile ) ; } catch (IOException ex) { @@ -284,7 +282,7 @@ public boolean processOnlyGraphWithoutVariables ( String outputFile ) { Writer.checkFile( outFile ) ; Writer.writeTextFile(outPut, outFile) ; - MessageErrors.printMessageInfoGeneratedVariable( "Undefined Variable" , + Messages.printMessageInfoGeneratedVariable( "Undefined Variable" , outFile ) ; } catch (IOException ex) { @@ -326,7 +324,7 @@ private void checkMatchers( String variableName , String outLine ) { for ( String patt : patts ) { if ( patt.contains("?") ) - MessageErrors.printErrorMatcher( variableName , patt ) ; + Messages.printErrorMatcher( variableName , patt ) ; } } diff --git a/src/main/java/org/inra/yedgen/processor/errors/MessageErrors.java b/src/main/java/org/inra/yedgen/processor/errors/Messages.java similarity index 99% rename from src/main/java/org/inra/yedgen/processor/errors/MessageErrors.java rename to src/main/java/org/inra/yedgen/processor/errors/Messages.java index 91eda37..c695680 100644 --- a/src/main/java/org/inra/yedgen/processor/errors/MessageErrors.java +++ b/src/main/java/org/inra/yedgen/processor/errors/Messages.java @@ -5,7 +5,7 @@ * * @author ryahiaoui */ -public class MessageErrors { +public class Messages { public static void printMessageErrorContext(String id_pattern) { System.err.println("") ; diff --git a/src/main/java/org/inra/yedgen/processor/managers/ManagerPatternContext.java b/src/main/java/org/inra/yedgen/processor/managers/ManagerPatternContext.java index de6a410..43dec0b 100644 --- a/src/main/java/org/inra/yedgen/processor/managers/ManagerPatternContext.java +++ b/src/main/java/org/inra/yedgen/processor/managers/ManagerPatternContext.java @@ -13,7 +13,7 @@ import java.util.regex.Matcher; import org.inra.yedgen.processor.entities.Node; import org.inra.yedgen.graph.managers.GraphExtractor; -import org.inra.yedgen.processor.errors.MessageErrors; +import org.inra.yedgen.processor.errors.Messages; import org.inra.yedgen.processor.factories.FactoryNode; /** @@ -62,7 +62,7 @@ public List genereatePatternContext( Integer hash, String id_pattern ) { } else if ( PATTERNS_CONTEXT.get(hash) == null ) { - MessageErrors.printMessageErrorContext(id_pattern) ; + Messages.printMessageErrorContext(id_pattern) ; return nodes ; } else { @@ -71,7 +71,7 @@ else if ( PATTERNS_CONTEXT.get(hash) == null ) { if( pattern == null ) { - MessageErrors.printMessageErrorContext(id_pattern) ; + Messages.printMessageErrorContext(id_pattern) ; return nodes ; } @@ -107,7 +107,7 @@ else if ( PATTERNS_CONTEXT.get(hash) == null ) { String queryForSubject = managerQuery.getQuery( hash, numQuery ) ; if( queryForSubject == null ) { - MessageErrors.printErrorNumQueryNotFound( numQuery ); + Messages.printErrorNumQueryNotFound( numQuery ); } String uriSubject = URI_PATTERN.replace(MATCHER_ENTITY , cleanName(entityName) ) ; diff --git a/src/main/java/org/inra/yedgen/processor/managers/ManagerPatternParallel.java b/src/main/java/org/inra/yedgen/processor/managers/ManagerPatternParallel.java index f70973f..212109c 100644 --- a/src/main/java/org/inra/yedgen/processor/managers/ManagerPatternParallel.java +++ b/src/main/java/org/inra/yedgen/processor/managers/ManagerPatternParallel.java @@ -8,7 +8,7 @@ import java.util.ArrayList; import java.util.regex.Pattern; import org.inra.yedgen.processor.entities.Node; -import org.inra.yedgen.processor.errors.MessageErrors; +import org.inra.yedgen.processor.errors.Messages; import org.inra.yedgen.processor.factories.FactoryNode; /** @@ -71,7 +71,7 @@ public List genereatePatternParallel( Integer hashNode, String id_pattern hash = findParallelPatternByID ( id_pattern ) ; if( hash == null ) { - MessageErrors.printMessageErrorParallel( id_pattern ) ; + Messages.printMessageErrorParallel( id_pattern ) ; return nodes ; } @@ -79,7 +79,7 @@ public List genereatePatternParallel( Integer hashNode, String id_pattern } if( pattern == null ) { - MessageErrors.printMessageErrorParallel(id_pattern) ; + Messages.printMessageErrorParallel(id_pattern) ; return nodes ; } diff --git a/src/main/java/org/inra/yedgen/processor/managers/ManagerVariable.java b/src/main/java/org/inra/yedgen/processor/managers/ManagerVariable.java index 1f9e18d..9fae090 100644 --- a/src/main/java/org/inra/yedgen/processor/managers/ManagerVariable.java +++ b/src/main/java/org/inra/yedgen/processor/managers/ManagerVariable.java @@ -11,7 +11,7 @@ import org.inra.yedgen.processor.entities.Node; import org.inra.yedgen.processor.entities.PatternParallel; import org.inra.yedgen.processor.entities.Variable; -import org.inra.yedgen.processor.errors.MessageErrors; +import org.inra.yedgen.processor.errors.Messages; /** * @@ -172,7 +172,7 @@ private Variable transformToVariable ( Integer hash , patternContextId != null && patternContext == null ) - MessageErrors.printMessageErrorContext( patternContextId , variableName ) ; + Messages.printMessageErrorContext( patternContextId , variableName ) ; return new Variable( hash , id , diff --git a/src/main/java/org/inra/yedgen/processor/managers/MetaPatternManager.java b/src/main/java/org/inra/yedgen/processor/managers/MetaPatternManager.java index ccbcec8..fed0da4 100644 --- a/src/main/java/org/inra/yedgen/processor/managers/MetaPatternManager.java +++ b/src/main/java/org/inra/yedgen/processor/managers/MetaPatternManager.java @@ -8,7 +8,7 @@ import java.util.regex.Matcher; import java.util.regex.Pattern; import org.inra.yedgen.properties.CsvProperties; -import static org.inra.yedgen.processor.errors.MessageErrors.* ; +import static org.inra.yedgen.processor.errors.Messages.* ; /** * * @author ryahiaoui @@ -77,7 +77,7 @@ public String generatePatternVariable ( String csvLine ) { .trim() ; String[] nums = params.split("_") ; - List tmp = new ArrayList<>(); + List tmp = new ArrayList<>() ; for( int i = 1 ; i < nums.length ; i ++ ) { @@ -110,12 +110,12 @@ public String generatePatternContext ( String csvLine ) { int variablesColumnNum = Integer.parseInt( matcher.split(" ")[0].split("_COLUMN_")[1]) ; - String nums = matcher.split("Q_")[1] ; - int startQueryNum = Integer.parseInt(nums.split("_")[0]) ; - int middleQueryNum = Integer.parseInt(nums.split("_")[1]) ; - int endQueryNum = Integer.parseInt(nums.split("_")[2]) ; + String nums = matcher.split("Q_")[1] ; + int startQueryNum = Integer.parseInt(nums.split("_")[0]) ; + int middleQueryNum = Integer.parseInt(nums.split("_")[1]) ; + int endQueryNum = Integer.parseInt(nums.split("_")[2]) ; - int loop = startQueryNum ; + int loop = startQueryNum ; if(csvLine.split(SEPARATOR)[variablesColumnNum].trim().length() == 0 ) return null ; diff --git a/src/main/java/org/inra/yedgen/properties/CsvProperties.java b/src/main/java/org/inra/yedgen/properties/CsvProperties.java index 40d4721..51a3237 100644 --- a/src/main/java/org/inra/yedgen/properties/CsvProperties.java +++ b/src/main/java/org/inra/yedgen/properties/CsvProperties.java @@ -5,7 +5,7 @@ import java.util.logging.Level; import java.util.logging.Logger; import org.inra.yedgen.processor.io.Writer; -import org.inra.yedgen.processor.errors.MessageErrors; +import org.inra.yedgen.processor.errors.Messages; import org.apache.commons.configuration.Configuration; import org.inra.yedgen.processor.scripts.ScriptsEngine; import org.apache.commons.configuration.ConfigurationException; @@ -59,19 +59,19 @@ public CsvProperties( String prFile, String jsFile ) { try { if ( Writer.existFile( jsFile ) ) { this.scriptsEngine = new ScriptsEngine ( jsFile ) ; - MessageErrors.printLoadingFile( typeJs , jsFile ) ; + Messages.printLoadingFile( typeJs , jsFile ) ; } else if ( jsFile != null ) { - MessageErrors.printErrorLoadingFile( typeJs , jsFile) ; + Messages.printErrorLoadingFile( typeJs , jsFile) ; } if ( Writer.existFile( prFile ) ) { this.config = new PropertiesConfiguration( prFile ) ; - MessageErrors.printLoadingFile( typeProperties , prFile ) ; + Messages.printLoadingFile( typeProperties , prFile ) ; } else if ( prFile != null ) { - MessageErrors.printErrorLoadingFile( typeProperties , prFile ) ; + Messages.printErrorLoadingFile( typeProperties , prFile ) ; } } catch (ConfigurationException ex) {