id
int32
0
165k
repo
stringlengths
7
58
path
stringlengths
12
218
func_name
stringlengths
3
140
original_string
stringlengths
73
34.1k
language
stringclasses
1 value
code
stringlengths
73
34.1k
code_tokens
list
docstring
stringlengths
3
16k
docstring_tokens
list
sha
stringlengths
40
40
url
stringlengths
105
339
26,300
datacleaner/DataCleaner
components/machine-learning/src/main/java/org/datacleaner/components/machinelearning/impl/MLFeatureUtils.java
MLFeatureUtils.toFeatureVector
public static double[][] toFeatureVector(Iterable<? extends MLRecord> data, List<MLFeatureModifier> featureModifiers) { final List<double[]> trainingInstances = new ArrayList<>(); for (MLRecord record : data) { final double[] features = generateFeatureValues(record, featureModifiers); trainingInstances.add(features); } final double[][] x = trainingInstances.toArray(new double[trainingInstances.size()][]); return x; }
java
public static double[][] toFeatureVector(Iterable<? extends MLRecord> data, List<MLFeatureModifier> featureModifiers) { final List<double[]> trainingInstances = new ArrayList<>(); for (MLRecord record : data) { final double[] features = generateFeatureValues(record, featureModifiers); trainingInstances.add(features); } final double[][] x = trainingInstances.toArray(new double[trainingInstances.size()][]); return x; }
[ "public", "static", "double", "[", "]", "[", "]", "toFeatureVector", "(", "Iterable", "<", "?", "extends", "MLRecord", ">", "data", ",", "List", "<", "MLFeatureModifier", ">", "featureModifiers", ")", "{", "final", "List", "<", "double", "[", "]", ">", "trainingInstances", "=", "new", "ArrayList", "<>", "(", ")", ";", "for", "(", "MLRecord", "record", ":", "data", ")", "{", "final", "double", "[", "]", "features", "=", "generateFeatureValues", "(", "record", ",", "featureModifiers", ")", ";", "trainingInstances", ".", "add", "(", "features", ")", ";", "}", "final", "double", "[", "]", "[", "]", "x", "=", "trainingInstances", ".", "toArray", "(", "new", "double", "[", "trainingInstances", ".", "size", "(", ")", "]", "[", "", "]", ")", ";", "return", "x", ";", "}" ]
Generates a matrix of feature values for each record. @param data @param featureModifiers @return
[ "Generates", "a", "matrix", "of", "feature", "values", "for", "each", "record", "." ]
9aa01fdac3560cef51c55df3cb2ac5c690b57639
https://github.com/datacleaner/DataCleaner/blob/9aa01fdac3560cef51c55df3cb2ac5c690b57639/components/machine-learning/src/main/java/org/datacleaner/components/machinelearning/impl/MLFeatureUtils.java#L58-L67
26,301
datacleaner/DataCleaner
components/machine-learning/src/main/java/org/datacleaner/components/machinelearning/impl/MLFeatureUtils.java
MLFeatureUtils.toClassificationVector
public static int[] toClassificationVector(Iterable<MLClassificationRecord> data) { final List<Integer> responseVariables = new ArrayList<>(); final List<Object> classifications = new ArrayList<>(); for (MLClassificationRecord record : data) { final Object classification = record.getClassification(); int classificationIndex = classifications.indexOf(classification); if (classificationIndex == -1) { classifications.add(classification); classificationIndex = classifications.size() - 1; } responseVariables.add(classificationIndex); } final int[] y = responseVariables.stream().mapToInt(i -> i).toArray(); return y; }
java
public static int[] toClassificationVector(Iterable<MLClassificationRecord> data) { final List<Integer> responseVariables = new ArrayList<>(); final List<Object> classifications = new ArrayList<>(); for (MLClassificationRecord record : data) { final Object classification = record.getClassification(); int classificationIndex = classifications.indexOf(classification); if (classificationIndex == -1) { classifications.add(classification); classificationIndex = classifications.size() - 1; } responseVariables.add(classificationIndex); } final int[] y = responseVariables.stream().mapToInt(i -> i).toArray(); return y; }
[ "public", "static", "int", "[", "]", "toClassificationVector", "(", "Iterable", "<", "MLClassificationRecord", ">", "data", ")", "{", "final", "List", "<", "Integer", ">", "responseVariables", "=", "new", "ArrayList", "<>", "(", ")", ";", "final", "List", "<", "Object", ">", "classifications", "=", "new", "ArrayList", "<>", "(", ")", ";", "for", "(", "MLClassificationRecord", "record", ":", "data", ")", "{", "final", "Object", "classification", "=", "record", ".", "getClassification", "(", ")", ";", "int", "classificationIndex", "=", "classifications", ".", "indexOf", "(", "classification", ")", ";", "if", "(", "classificationIndex", "==", "-", "1", ")", "{", "classifications", ".", "add", "(", "classification", ")", ";", "classificationIndex", "=", "classifications", ".", "size", "(", ")", "-", "1", ";", "}", "responseVariables", ".", "add", "(", "classificationIndex", ")", ";", "}", "final", "int", "[", "]", "y", "=", "responseVariables", ".", "stream", "(", ")", ".", "mapToInt", "(", "i", "->", "i", ")", ".", "toArray", "(", ")", ";", "return", "y", ";", "}" ]
Generates a vector of classifications for each record. @param data @return
[ "Generates", "a", "vector", "of", "classifications", "for", "each", "record", "." ]
9aa01fdac3560cef51c55df3cb2ac5c690b57639
https://github.com/datacleaner/DataCleaner/blob/9aa01fdac3560cef51c55df3cb2ac5c690b57639/components/machine-learning/src/main/java/org/datacleaner/components/machinelearning/impl/MLFeatureUtils.java#L75-L91
26,302
datacleaner/DataCleaner
components/machine-learning/src/main/java/org/datacleaner/components/machinelearning/impl/MLFeatureUtils.java
MLFeatureUtils.toRegressionOutputVector
public static double[] toRegressionOutputVector(Iterable<MLRegressionRecord> data) { final Stream<MLRegressionRecord> stream = StreamSupport.stream(data.spliterator(), false); return stream.mapToDouble(MLRegressionRecord::getRegressionOutput).toArray(); }
java
public static double[] toRegressionOutputVector(Iterable<MLRegressionRecord> data) { final Stream<MLRegressionRecord> stream = StreamSupport.stream(data.spliterator(), false); return stream.mapToDouble(MLRegressionRecord::getRegressionOutput).toArray(); }
[ "public", "static", "double", "[", "]", "toRegressionOutputVector", "(", "Iterable", "<", "MLRegressionRecord", ">", "data", ")", "{", "final", "Stream", "<", "MLRegressionRecord", ">", "stream", "=", "StreamSupport", ".", "stream", "(", "data", ".", "spliterator", "(", ")", ",", "false", ")", ";", "return", "stream", ".", "mapToDouble", "(", "MLRegressionRecord", "::", "getRegressionOutput", ")", ".", "toArray", "(", ")", ";", "}" ]
Generates a vector of regression outputs for every record @param data @return
[ "Generates", "a", "vector", "of", "regression", "outputs", "for", "every", "record" ]
9aa01fdac3560cef51c55df3cb2ac5c690b57639
https://github.com/datacleaner/DataCleaner/blob/9aa01fdac3560cef51c55df3cb2ac5c690b57639/components/machine-learning/src/main/java/org/datacleaner/components/machinelearning/impl/MLFeatureUtils.java#L99-L102
26,303
datacleaner/DataCleaner
desktop/api/src/main/java/org/datacleaner/widgets/properties/AbstractPropertyWidget.java
AbstractPropertyWidget.batchUpdateWidget
public final void batchUpdateWidget(final Runnable action) { _batchUpdateCounter++; try { action.run(); } catch (final RuntimeException e) { logger.error("Exception occurred in widget batch update, fireValueChanged() will not be invoked", e); throw e; } finally { _batchUpdateCounter--; } if (_batchUpdateCounter == 0) { onBatchFinished(); } }
java
public final void batchUpdateWidget(final Runnable action) { _batchUpdateCounter++; try { action.run(); } catch (final RuntimeException e) { logger.error("Exception occurred in widget batch update, fireValueChanged() will not be invoked", e); throw e; } finally { _batchUpdateCounter--; } if (_batchUpdateCounter == 0) { onBatchFinished(); } }
[ "public", "final", "void", "batchUpdateWidget", "(", "final", "Runnable", "action", ")", "{", "_batchUpdateCounter", "++", ";", "try", "{", "action", ".", "run", "(", ")", ";", "}", "catch", "(", "final", "RuntimeException", "e", ")", "{", "logger", ".", "error", "(", "\"Exception occurred in widget batch update, fireValueChanged() will not be invoked\"", ",", "e", ")", ";", "throw", "e", ";", "}", "finally", "{", "_batchUpdateCounter", "--", ";", "}", "if", "(", "_batchUpdateCounter", "==", "0", ")", "{", "onBatchFinished", "(", ")", ";", "}", "}" ]
Executes a "widget batch update". Listeners and other effects of updating individual parts of a widget may be turned off during batch updates. @param action the action to execute
[ "Executes", "a", "widget", "batch", "update", ".", "Listeners", "and", "other", "effects", "of", "updating", "individual", "parts", "of", "a", "widget", "may", "be", "turned", "off", "during", "batch", "updates", "." ]
9aa01fdac3560cef51c55df3cb2ac5c690b57639
https://github.com/datacleaner/DataCleaner/blob/9aa01fdac3560cef51c55df3cb2ac5c690b57639/desktop/api/src/main/java/org/datacleaner/widgets/properties/AbstractPropertyWidget.java#L85-L98
26,304
datacleaner/DataCleaner
engine/core/src/main/java/org/datacleaner/extensions/ExtensionPackage.java
ExtensionPackage.getExtensionClassLoader
public static ClassLoader getExtensionClassLoader() { final Collection<ClassLoader> childClassLoaders = new ArrayList<>(); childClassLoaders.addAll(_allExtensionClassLoaders); childClassLoaders.add(ClassLoaderUtils.getParentClassLoader()); return new CompoundClassLoader(childClassLoaders); }
java
public static ClassLoader getExtensionClassLoader() { final Collection<ClassLoader> childClassLoaders = new ArrayList<>(); childClassLoaders.addAll(_allExtensionClassLoaders); childClassLoaders.add(ClassLoaderUtils.getParentClassLoader()); return new CompoundClassLoader(childClassLoaders); }
[ "public", "static", "ClassLoader", "getExtensionClassLoader", "(", ")", "{", "final", "Collection", "<", "ClassLoader", ">", "childClassLoaders", "=", "new", "ArrayList", "<>", "(", ")", ";", "childClassLoaders", ".", "addAll", "(", "_allExtensionClassLoaders", ")", ";", "childClassLoaders", ".", "add", "(", "ClassLoaderUtils", ".", "getParentClassLoader", "(", ")", ")", ";", "return", "new", "CompoundClassLoader", "(", "childClassLoaders", ")", ";", "}" ]
Gets the classloader that represents the currently loaded extensions' classes. @return
[ "Gets", "the", "classloader", "that", "represents", "the", "currently", "loaded", "extensions", "classes", "." ]
9aa01fdac3560cef51c55df3cb2ac5c690b57639
https://github.com/datacleaner/DataCleaner/blob/9aa01fdac3560cef51c55df3cb2ac5c690b57639/engine/core/src/main/java/org/datacleaner/extensions/ExtensionPackage.java#L79-L84
26,305
datacleaner/DataCleaner
desktop/ui/src/main/java/org/datacleaner/panels/result/TableProgressInformationPanel.java
TableProgressInformationPanel.setProgress
public boolean setProgress(final int currentRow) { final boolean result = _progressBar.setValueIfGreater(currentRow); if (result) { _progressCountLabel.setText(formatNumber(currentRow)); } return result; }
java
public boolean setProgress(final int currentRow) { final boolean result = _progressBar.setValueIfGreater(currentRow); if (result) { _progressCountLabel.setText(formatNumber(currentRow)); } return result; }
[ "public", "boolean", "setProgress", "(", "final", "int", "currentRow", ")", "{", "final", "boolean", "result", "=", "_progressBar", ".", "setValueIfGreater", "(", "currentRow", ")", ";", "if", "(", "result", ")", "{", "_progressCountLabel", ".", "setText", "(", "formatNumber", "(", "currentRow", ")", ")", ";", "}", "return", "result", ";", "}" ]
Sets the progress of the processing of the table. @param currentRow @return
[ "Sets", "the", "progress", "of", "the", "processing", "of", "the", "table", "." ]
9aa01fdac3560cef51c55df3cb2ac5c690b57639
https://github.com/datacleaner/DataCleaner/blob/9aa01fdac3560cef51c55df3cb2ac5c690b57639/desktop/ui/src/main/java/org/datacleaner/panels/result/TableProgressInformationPanel.java#L125-L133
26,306
datacleaner/DataCleaner
engine/core/src/main/java/org/datacleaner/components/tablelookup/TableLookupTransformer.java
TableLookupTransformer.getQueryOutputColumns
private Column[] getQueryOutputColumns(final boolean checkNames) { if (queryOutputColumns == null) { try (DatastoreConnection con = datastore.openConnection()) { queryOutputColumns = con.getSchemaNavigator().convertToColumns(schemaName, tableName, outputColumns); } } else if (checkNames) { if (!isQueryOutputColumnsUpdated()) { queryOutputColumns = null; return getQueryOutputColumns(false); } } return queryOutputColumns; }
java
private Column[] getQueryOutputColumns(final boolean checkNames) { if (queryOutputColumns == null) { try (DatastoreConnection con = datastore.openConnection()) { queryOutputColumns = con.getSchemaNavigator().convertToColumns(schemaName, tableName, outputColumns); } } else if (checkNames) { if (!isQueryOutputColumnsUpdated()) { queryOutputColumns = null; return getQueryOutputColumns(false); } } return queryOutputColumns; }
[ "private", "Column", "[", "]", "getQueryOutputColumns", "(", "final", "boolean", "checkNames", ")", "{", "if", "(", "queryOutputColumns", "==", "null", ")", "{", "try", "(", "DatastoreConnection", "con", "=", "datastore", ".", "openConnection", "(", ")", ")", "{", "queryOutputColumns", "=", "con", ".", "getSchemaNavigator", "(", ")", ".", "convertToColumns", "(", "schemaName", ",", "tableName", ",", "outputColumns", ")", ";", "}", "}", "else", "if", "(", "checkNames", ")", "{", "if", "(", "!", "isQueryOutputColumnsUpdated", "(", ")", ")", "{", "queryOutputColumns", "=", "null", ";", "return", "getQueryOutputColumns", "(", "false", ")", ";", "}", "}", "return", "queryOutputColumns", ";", "}" ]
Gets the output columns of the lookup query @param checkNames whether to check/validate/adjust the names of these columns @return
[ "Gets", "the", "output", "columns", "of", "the", "lookup", "query" ]
9aa01fdac3560cef51c55df3cb2ac5c690b57639
https://github.com/datacleaner/DataCleaner/blob/9aa01fdac3560cef51c55df3cb2ac5c690b57639/engine/core/src/main/java/org/datacleaner/components/tablelookup/TableLookupTransformer.java#L245-L257
26,307
datacleaner/DataCleaner
components/standardizers/src/main/java/org/datacleaner/util/NamedPattern.java
NamedPattern.match
public NamedPatternMatch<E> match(final String string) { final Matcher matcher = pattern.matcher(string); while (matcher.find()) { final int start = matcher.start(); final int end = matcher.end(); if (start == 0 && end == string.length()) { final Map<E, String> resultMap = new EnumMap<>(groupEnum); final Set<Entry<E, Integer>> entries = groupIndexes.entrySet(); for (final Entry<E, Integer> entry : entries) { final E group = entry.getKey(); final Integer groupIndex = entry.getValue(); final String result = matcher.group(groupIndex); resultMap.put(group, result); } return new NamedPatternMatch<>(resultMap); } } return null; }
java
public NamedPatternMatch<E> match(final String string) { final Matcher matcher = pattern.matcher(string); while (matcher.find()) { final int start = matcher.start(); final int end = matcher.end(); if (start == 0 && end == string.length()) { final Map<E, String> resultMap = new EnumMap<>(groupEnum); final Set<Entry<E, Integer>> entries = groupIndexes.entrySet(); for (final Entry<E, Integer> entry : entries) { final E group = entry.getKey(); final Integer groupIndex = entry.getValue(); final String result = matcher.group(groupIndex); resultMap.put(group, result); } return new NamedPatternMatch<>(resultMap); } } return null; }
[ "public", "NamedPatternMatch", "<", "E", ">", "match", "(", "final", "String", "string", ")", "{", "final", "Matcher", "matcher", "=", "pattern", ".", "matcher", "(", "string", ")", ";", "while", "(", "matcher", ".", "find", "(", ")", ")", "{", "final", "int", "start", "=", "matcher", ".", "start", "(", ")", ";", "final", "int", "end", "=", "matcher", ".", "end", "(", ")", ";", "if", "(", "start", "==", "0", "&&", "end", "==", "string", ".", "length", "(", ")", ")", "{", "final", "Map", "<", "E", ",", "String", ">", "resultMap", "=", "new", "EnumMap", "<>", "(", "groupEnum", ")", ";", "final", "Set", "<", "Entry", "<", "E", ",", "Integer", ">", ">", "entries", "=", "groupIndexes", ".", "entrySet", "(", ")", ";", "for", "(", "final", "Entry", "<", "E", ",", "Integer", ">", "entry", ":", "entries", ")", "{", "final", "E", "group", "=", "entry", ".", "getKey", "(", ")", ";", "final", "Integer", "groupIndex", "=", "entry", ".", "getValue", "(", ")", ";", "final", "String", "result", "=", "matcher", ".", "group", "(", "groupIndex", ")", ";", "resultMap", ".", "put", "(", "group", ",", "result", ")", ";", "}", "return", "new", "NamedPatternMatch", "<>", "(", "resultMap", ")", ";", "}", "}", "return", "null", ";", "}" ]
Matches a string against this named pattern. @param string the string to match @return a match object, or null if there was no match
[ "Matches", "a", "string", "against", "this", "named", "pattern", "." ]
9aa01fdac3560cef51c55df3cb2ac5c690b57639
https://github.com/datacleaner/DataCleaner/blob/9aa01fdac3560cef51c55df3cb2ac5c690b57639/components/standardizers/src/main/java/org/datacleaner/util/NamedPattern.java#L147-L168
26,308
datacleaner/DataCleaner
engine/core/src/main/java/org/datacleaner/util/CompareUtils.java
CompareUtils.compare
public static <E> int compare(final Comparable<E> obj1, final E obj2) { if (obj1 == obj2) { return 0; } if (obj1 == null) { return -1; } if (obj2 == null) { return 1; } return obj1.compareTo(obj2); }
java
public static <E> int compare(final Comparable<E> obj1, final E obj2) { if (obj1 == obj2) { return 0; } if (obj1 == null) { return -1; } if (obj2 == null) { return 1; } return obj1.compareTo(obj2); }
[ "public", "static", "<", "E", ">", "int", "compare", "(", "final", "Comparable", "<", "E", ">", "obj1", ",", "final", "E", "obj2", ")", "{", "if", "(", "obj1", "==", "obj2", ")", "{", "return", "0", ";", "}", "if", "(", "obj1", "==", "null", ")", "{", "return", "-", "1", ";", "}", "if", "(", "obj2", "==", "null", ")", "{", "return", "1", ";", "}", "return", "obj1", ".", "compareTo", "(", "obj2", ")", ";", "}" ]
Compares two objects of which one of them is a comparable of the other. @param <E> @param obj1 @param obj2 @return a negative integer, zero, or a positive integer as the first argument is less than, equal to, or greater than the second.
[ "Compares", "two", "objects", "of", "which", "one", "of", "them", "is", "a", "comparable", "of", "the", "other", "." ]
9aa01fdac3560cef51c55df3cb2ac5c690b57639
https://github.com/datacleaner/DataCleaner/blob/9aa01fdac3560cef51c55df3cb2ac5c690b57639/engine/core/src/main/java/org/datacleaner/util/CompareUtils.java#L65-L77
26,309
datacleaner/DataCleaner
engine/env/spark/src/main/java/org/datacleaner/spark/SparkRunner.java
SparkRunner.findFile
private URI findFile(final String filePath, final boolean upload) { try { URI fileURI; try { fileURI = _hadoopDefaultFS.getUri().resolve(filePath); } catch (final Exception e) { fileURI = null; } if ((fileURI == null || !_hadoopDefaultFS.exists(new Path(fileURI))) && upload) { final File file = new File(filePath); if (!file.isFile()) { throw new IllegalArgumentException("'" + filePath + " does not exist, or is not a file"); } final String fileName = file.toPath().getFileName().toString(); return _applicationDriver .copyFileToHdfs(file, DATACLEANER_TEMP_DIR + "/" + UUID.randomUUID() + fileName); } return fileURI; } catch (final IOException e) { throw new IllegalArgumentException("Path '" + filePath + "' is not a proper file path"); } }
java
private URI findFile(final String filePath, final boolean upload) { try { URI fileURI; try { fileURI = _hadoopDefaultFS.getUri().resolve(filePath); } catch (final Exception e) { fileURI = null; } if ((fileURI == null || !_hadoopDefaultFS.exists(new Path(fileURI))) && upload) { final File file = new File(filePath); if (!file.isFile()) { throw new IllegalArgumentException("'" + filePath + " does not exist, or is not a file"); } final String fileName = file.toPath().getFileName().toString(); return _applicationDriver .copyFileToHdfs(file, DATACLEANER_TEMP_DIR + "/" + UUID.randomUUID() + fileName); } return fileURI; } catch (final IOException e) { throw new IllegalArgumentException("Path '" + filePath + "' is not a proper file path"); } }
[ "private", "URI", "findFile", "(", "final", "String", "filePath", ",", "final", "boolean", "upload", ")", "{", "try", "{", "URI", "fileURI", ";", "try", "{", "fileURI", "=", "_hadoopDefaultFS", ".", "getUri", "(", ")", ".", "resolve", "(", "filePath", ")", ";", "}", "catch", "(", "final", "Exception", "e", ")", "{", "fileURI", "=", "null", ";", "}", "if", "(", "(", "fileURI", "==", "null", "||", "!", "_hadoopDefaultFS", ".", "exists", "(", "new", "Path", "(", "fileURI", ")", ")", ")", "&&", "upload", ")", "{", "final", "File", "file", "=", "new", "File", "(", "filePath", ")", ";", "if", "(", "!", "file", ".", "isFile", "(", ")", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"'\"", "+", "filePath", "+", "\" does not exist, or is not a file\"", ")", ";", "}", "final", "String", "fileName", "=", "file", ".", "toPath", "(", ")", ".", "getFileName", "(", ")", ".", "toString", "(", ")", ";", "return", "_applicationDriver", ".", "copyFileToHdfs", "(", "file", ",", "DATACLEANER_TEMP_DIR", "+", "\"/\"", "+", "UUID", ".", "randomUUID", "(", ")", "+", "fileName", ")", ";", "}", "return", "fileURI", ";", "}", "catch", "(", "final", "IOException", "e", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"Path '\"", "+", "filePath", "+", "\"' is not a proper file path\"", ")", ";", "}", "}" ]
Tries to find a file on HDFS, and optionally uploads it if not found. @param filePath Path of the file to find @param upload true if file upload should be attempted. @return Either the resolved URI, or the uploaded file.
[ "Tries", "to", "find", "a", "file", "on", "HDFS", "and", "optionally", "uploads", "it", "if", "not", "found", "." ]
9aa01fdac3560cef51c55df3cb2ac5c690b57639
https://github.com/datacleaner/DataCleaner/blob/9aa01fdac3560cef51c55df3cb2ac5c690b57639/engine/env/spark/src/main/java/org/datacleaner/spark/SparkRunner.java#L88-L112
26,310
datacleaner/DataCleaner
components/html-rendering/src/main/java/org/datacleaner/result/html/FlotChartLocator.java
FlotChartLocator.setFlotHome
public static void setFlotHome(String flotHome) { if (flotHome == null || flotHome.trim().isEmpty()) { System.clearProperty(SYSTEM_PROPERTY_FLOT_HOME); } else { final String propValue = flotHome.endsWith("/") ? flotHome.substring(0, flotHome.length() - 1) : flotHome; System.setProperty(SYSTEM_PROPERTY_FLOT_HOME, propValue); } }
java
public static void setFlotHome(String flotHome) { if (flotHome == null || flotHome.trim().isEmpty()) { System.clearProperty(SYSTEM_PROPERTY_FLOT_HOME); } else { final String propValue = flotHome.endsWith("/") ? flotHome.substring(0, flotHome.length() - 1) : flotHome; System.setProperty(SYSTEM_PROPERTY_FLOT_HOME, propValue); } }
[ "public", "static", "void", "setFlotHome", "(", "String", "flotHome", ")", "{", "if", "(", "flotHome", "==", "null", "||", "flotHome", ".", "trim", "(", ")", ".", "isEmpty", "(", ")", ")", "{", "System", ".", "clearProperty", "(", "SYSTEM_PROPERTY_FLOT_HOME", ")", ";", "}", "else", "{", "final", "String", "propValue", "=", "flotHome", ".", "endsWith", "(", "\"/\"", ")", "?", "flotHome", ".", "substring", "(", "0", ",", "flotHome", ".", "length", "(", ")", "-", "1", ")", ":", "flotHome", ";", "System", ".", "setProperty", "(", "SYSTEM_PROPERTY_FLOT_HOME", ",", "propValue", ")", ";", "}", "}" ]
Sets the home folder of all flot javascript files
[ "Sets", "the", "home", "folder", "of", "all", "flot", "javascript", "files" ]
9aa01fdac3560cef51c55df3cb2ac5c690b57639
https://github.com/datacleaner/DataCleaner/blob/9aa01fdac3560cef51c55df3cb2ac5c690b57639/components/html-rendering/src/main/java/org/datacleaner/result/html/FlotChartLocator.java#L118-L125
26,311
datacleaner/DataCleaner
engine/core/src/main/java/org/datacleaner/result/CrosstabNavigator.java
CrosstabNavigator.attach
public void attach(final AnalyzerResult explorationResult) { final ResultProducer resultProducer; if (explorationResult == null) { resultProducer = null; } else { resultProducer = new DefaultResultProducer(explorationResult); } attach(resultProducer); }
java
public void attach(final AnalyzerResult explorationResult) { final ResultProducer resultProducer; if (explorationResult == null) { resultProducer = null; } else { resultProducer = new DefaultResultProducer(explorationResult); } attach(resultProducer); }
[ "public", "void", "attach", "(", "final", "AnalyzerResult", "explorationResult", ")", "{", "final", "ResultProducer", "resultProducer", ";", "if", "(", "explorationResult", "==", "null", ")", "{", "resultProducer", "=", "null", ";", "}", "else", "{", "resultProducer", "=", "new", "DefaultResultProducer", "(", "explorationResult", ")", ";", "}", "attach", "(", "resultProducer", ")", ";", "}" ]
Attaches an AnalyzerResult as result-exploration data for the navigated position of the crosstab. @param explorationResult
[ "Attaches", "an", "AnalyzerResult", "as", "result", "-", "exploration", "data", "for", "the", "navigated", "position", "of", "the", "crosstab", "." ]
9aa01fdac3560cef51c55df3cb2ac5c690b57639
https://github.com/datacleaner/DataCleaner/blob/9aa01fdac3560cef51c55df3cb2ac5c690b57639/engine/core/src/main/java/org/datacleaner/result/CrosstabNavigator.java#L114-L122
26,312
datacleaner/DataCleaner
components/html-rendering/src/main/java/org/datacleaner/documentation/ComponentDocumentationWrapper.java
ComponentDocumentationWrapper.getHref
public String getHref() { final String displayName = _componentDescriptor.getDisplayName(); final String filename = StringUtils.replaceWhitespaces(displayName.toLowerCase().trim(), "_").replaceAll("\\/", "_") .replaceAll("\\\\", "_"); return filename + ".html"; }
java
public String getHref() { final String displayName = _componentDescriptor.getDisplayName(); final String filename = StringUtils.replaceWhitespaces(displayName.toLowerCase().trim(), "_").replaceAll("\\/", "_") .replaceAll("\\\\", "_"); return filename + ".html"; }
[ "public", "String", "getHref", "(", ")", "{", "final", "String", "displayName", "=", "_componentDescriptor", ".", "getDisplayName", "(", ")", ";", "final", "String", "filename", "=", "StringUtils", ".", "replaceWhitespaces", "(", "displayName", ".", "toLowerCase", "(", ")", ".", "trim", "(", ")", ",", "\"_\"", ")", ".", "replaceAll", "(", "\"\\\\/\"", ",", "\"_\"", ")", ".", "replaceAll", "(", "\"\\\\\\\\\"", ",", "\"_\"", ")", ";", "return", "filename", "+", "\".html\"", ";", "}" ]
Gets the "href" attribute content if a link to this component should be made from elsewhere in the component docs. @return
[ "Gets", "the", "href", "attribute", "content", "if", "a", "link", "to", "this", "component", "should", "be", "made", "from", "elsewhere", "in", "the", "component", "docs", "." ]
9aa01fdac3560cef51c55df3cb2ac5c690b57639
https://github.com/datacleaner/DataCleaner/blob/9aa01fdac3560cef51c55df3cb2ac5c690b57639/components/html-rendering/src/main/java/org/datacleaner/documentation/ComponentDocumentationWrapper.java#L218-L224
26,313
datacleaner/DataCleaner
desktop/ui/src/main/java/org/datacleaner/widgets/properties/MultipleInputColumnsPropertyWidget.java
MultipleInputColumnsPropertyWidget.reorderValue
public void reorderValue(final InputColumn<?>[] sortedValue) { // the offset represents the search textfield and the button panel final int offset = 2; // reorder the visual components for (int i = 0; i < sortedValue.length; i++) { final InputColumn<?> inputColumn = sortedValue[i]; final JComponent decoration = getOrCreateCheckBoxDecoration(inputColumn, true); final int position = offset + i; add(decoration, position); } updateUI(); // recreate the _checkBoxes map final TreeMap<InputColumn<?>, DCCheckBox<InputColumn<?>>> checkBoxesCopy = new TreeMap<>(_checkBoxes); _checkBoxes.clear(); for (final InputColumn<?> inputColumn : sortedValue) { final DCCheckBox<InputColumn<?>> checkBox = checkBoxesCopy.get(inputColumn); _checkBoxes.put(inputColumn, checkBox); } _checkBoxes.putAll(checkBoxesCopy); setValue(sortedValue); }
java
public void reorderValue(final InputColumn<?>[] sortedValue) { // the offset represents the search textfield and the button panel final int offset = 2; // reorder the visual components for (int i = 0; i < sortedValue.length; i++) { final InputColumn<?> inputColumn = sortedValue[i]; final JComponent decoration = getOrCreateCheckBoxDecoration(inputColumn, true); final int position = offset + i; add(decoration, position); } updateUI(); // recreate the _checkBoxes map final TreeMap<InputColumn<?>, DCCheckBox<InputColumn<?>>> checkBoxesCopy = new TreeMap<>(_checkBoxes); _checkBoxes.clear(); for (final InputColumn<?> inputColumn : sortedValue) { final DCCheckBox<InputColumn<?>> checkBox = checkBoxesCopy.get(inputColumn); _checkBoxes.put(inputColumn, checkBox); } _checkBoxes.putAll(checkBoxesCopy); setValue(sortedValue); }
[ "public", "void", "reorderValue", "(", "final", "InputColumn", "<", "?", ">", "[", "]", "sortedValue", ")", "{", "// the offset represents the search textfield and the button panel", "final", "int", "offset", "=", "2", ";", "// reorder the visual components", "for", "(", "int", "i", "=", "0", ";", "i", "<", "sortedValue", ".", "length", ";", "i", "++", ")", "{", "final", "InputColumn", "<", "?", ">", "inputColumn", "=", "sortedValue", "[", "i", "]", ";", "final", "JComponent", "decoration", "=", "getOrCreateCheckBoxDecoration", "(", "inputColumn", ",", "true", ")", ";", "final", "int", "position", "=", "offset", "+", "i", ";", "add", "(", "decoration", ",", "position", ")", ";", "}", "updateUI", "(", ")", ";", "// recreate the _checkBoxes map", "final", "TreeMap", "<", "InputColumn", "<", "?", ">", ",", "DCCheckBox", "<", "InputColumn", "<", "?", ">", ">", ">", "checkBoxesCopy", "=", "new", "TreeMap", "<>", "(", "_checkBoxes", ")", ";", "_checkBoxes", ".", "clear", "(", ")", ";", "for", "(", "final", "InputColumn", "<", "?", ">", "inputColumn", ":", "sortedValue", ")", "{", "final", "DCCheckBox", "<", "InputColumn", "<", "?", ">", ">", "checkBox", "=", "checkBoxesCopy", ".", "get", "(", "inputColumn", ")", ";", "_checkBoxes", ".", "put", "(", "inputColumn", ",", "checkBox", ")", ";", "}", "_checkBoxes", ".", "putAll", "(", "checkBoxesCopy", ")", ";", "setValue", "(", "sortedValue", ")", ";", "}" ]
Reorders the values @param sortedValue
[ "Reorders", "the", "values" ]
9aa01fdac3560cef51c55df3cb2ac5c690b57639
https://github.com/datacleaner/DataCleaner/blob/9aa01fdac3560cef51c55df3cb2ac5c690b57639/desktop/ui/src/main/java/org/datacleaner/widgets/properties/MultipleInputColumnsPropertyWidget.java#L536-L558
26,314
datacleaner/DataCleaner
engine/core/src/main/java/org/datacleaner/util/AverageBuilder.java
AverageBuilder.addValue
public AverageBuilder addValue(final Number number) { final double total = _average * _numValues + number.doubleValue(); _numValues++; _average = total / _numValues; return this; }
java
public AverageBuilder addValue(final Number number) { final double total = _average * _numValues + number.doubleValue(); _numValues++; _average = total / _numValues; return this; }
[ "public", "AverageBuilder", "addValue", "(", "final", "Number", "number", ")", "{", "final", "double", "total", "=", "_average", "*", "_numValues", "+", "number", ".", "doubleValue", "(", ")", ";", "_numValues", "++", ";", "_average", "=", "total", "/", "_numValues", ";", "return", "this", ";", "}" ]
Adds a value to the average that is being built. @param number @return
[ "Adds", "a", "value", "to", "the", "average", "that", "is", "being", "built", "." ]
9aa01fdac3560cef51c55df3cb2ac5c690b57639
https://github.com/datacleaner/DataCleaner/blob/9aa01fdac3560cef51c55df3cb2ac5c690b57639/engine/core/src/main/java/org/datacleaner/util/AverageBuilder.java#L63-L68
26,315
datacleaner/DataCleaner
desktop/ui/src/main/java/org/datacleaner/widgets/DCProgressBar.java
DCProgressBar.setValueIfGreater
public boolean setValueIfGreater(final int newValue) { final boolean greater = _value.setIfSignificantToUser(newValue); if (greater) { WidgetUtils.invokeSwingAction(() -> DCProgressBar.super.setValue(newValue)); } return greater; }
java
public boolean setValueIfGreater(final int newValue) { final boolean greater = _value.setIfSignificantToUser(newValue); if (greater) { WidgetUtils.invokeSwingAction(() -> DCProgressBar.super.setValue(newValue)); } return greater; }
[ "public", "boolean", "setValueIfGreater", "(", "final", "int", "newValue", ")", "{", "final", "boolean", "greater", "=", "_value", ".", "setIfSignificantToUser", "(", "newValue", ")", ";", "if", "(", "greater", ")", "{", "WidgetUtils", ".", "invokeSwingAction", "(", "(", ")", "->", "DCProgressBar", ".", "super", ".", "setValue", "(", "newValue", ")", ")", ";", "}", "return", "greater", ";", "}" ]
Sets the value of the progress bar, if the new value is greater than the previous value. @param newValue @return whether or not the value was greater, and thus updated
[ "Sets", "the", "value", "of", "the", "progress", "bar", "if", "the", "new", "value", "is", "greater", "than", "the", "previous", "value", "." ]
9aa01fdac3560cef51c55df3cb2ac5c690b57639
https://github.com/datacleaner/DataCleaner/blob/9aa01fdac3560cef51c55df3cb2ac5c690b57639/desktop/ui/src/main/java/org/datacleaner/widgets/DCProgressBar.java#L71-L77
26,316
datacleaner/DataCleaner
desktop/ui/src/main/java/org/datacleaner/user/QuickAnalysisStrategy.java
QuickAnalysisStrategy.createAnalyzers
private void createAnalyzers(final AnalysisJobBuilder ajb, final Class<? extends Analyzer<?>> analyzerClass, final List<InputColumn<?>> columns) { final int columnsPerAnalyzer = getColumnsPerAnalyzer(); AnalyzerComponentBuilder<?> analyzerJobBuilder = ajb.addAnalyzer(analyzerClass); int columnCount = 0; for (final InputColumn<?> inputColumn : columns) { if (columnCount == columnsPerAnalyzer) { analyzerJobBuilder = ajb.addAnalyzer(analyzerClass); columnCount = 0; } analyzerJobBuilder.addInputColumn(inputColumn); if (isIncludeValueDistribution()) { ajb.addAnalyzer(ValueDistributionAnalyzer.class).addInputColumn(inputColumn); } if (inputColumn.getDataType() == String.class && isIncludePatternFinder()) { ajb.addAnalyzer(PatternFinderAnalyzer.class).addInputColumn(inputColumn); } columnCount++; } }
java
private void createAnalyzers(final AnalysisJobBuilder ajb, final Class<? extends Analyzer<?>> analyzerClass, final List<InputColumn<?>> columns) { final int columnsPerAnalyzer = getColumnsPerAnalyzer(); AnalyzerComponentBuilder<?> analyzerJobBuilder = ajb.addAnalyzer(analyzerClass); int columnCount = 0; for (final InputColumn<?> inputColumn : columns) { if (columnCount == columnsPerAnalyzer) { analyzerJobBuilder = ajb.addAnalyzer(analyzerClass); columnCount = 0; } analyzerJobBuilder.addInputColumn(inputColumn); if (isIncludeValueDistribution()) { ajb.addAnalyzer(ValueDistributionAnalyzer.class).addInputColumn(inputColumn); } if (inputColumn.getDataType() == String.class && isIncludePatternFinder()) { ajb.addAnalyzer(PatternFinderAnalyzer.class).addInputColumn(inputColumn); } columnCount++; } }
[ "private", "void", "createAnalyzers", "(", "final", "AnalysisJobBuilder", "ajb", ",", "final", "Class", "<", "?", "extends", "Analyzer", "<", "?", ">", ">", "analyzerClass", ",", "final", "List", "<", "InputColumn", "<", "?", ">", ">", "columns", ")", "{", "final", "int", "columnsPerAnalyzer", "=", "getColumnsPerAnalyzer", "(", ")", ";", "AnalyzerComponentBuilder", "<", "?", ">", "analyzerJobBuilder", "=", "ajb", ".", "addAnalyzer", "(", "analyzerClass", ")", ";", "int", "columnCount", "=", "0", ";", "for", "(", "final", "InputColumn", "<", "?", ">", "inputColumn", ":", "columns", ")", "{", "if", "(", "columnCount", "==", "columnsPerAnalyzer", ")", "{", "analyzerJobBuilder", "=", "ajb", ".", "addAnalyzer", "(", "analyzerClass", ")", ";", "columnCount", "=", "0", ";", "}", "analyzerJobBuilder", ".", "addInputColumn", "(", "inputColumn", ")", ";", "if", "(", "isIncludeValueDistribution", "(", ")", ")", "{", "ajb", ".", "addAnalyzer", "(", "ValueDistributionAnalyzer", ".", "class", ")", ".", "addInputColumn", "(", "inputColumn", ")", ";", "}", "if", "(", "inputColumn", ".", "getDataType", "(", ")", "==", "String", ".", "class", "&&", "isIncludePatternFinder", "(", ")", ")", "{", "ajb", ".", "addAnalyzer", "(", "PatternFinderAnalyzer", ".", "class", ")", ".", "addInputColumn", "(", "inputColumn", ")", ";", "}", "columnCount", "++", ";", "}", "}" ]
Registers analyzers and up to 4 columns per analyzer. This restriction is to ensure that results will be nicely readable. A table might contain hundreds of columns. @param ajb @param analyzerClass @param columns
[ "Registers", "analyzers", "and", "up", "to", "4", "columns", "per", "analyzer", ".", "This", "restriction", "is", "to", "ensure", "that", "results", "will", "be", "nicely", "readable", ".", "A", "table", "might", "contain", "hundreds", "of", "columns", "." ]
9aa01fdac3560cef51c55df3cb2ac5c690b57639
https://github.com/datacleaner/DataCleaner/blob/9aa01fdac3560cef51c55df3cb2ac5c690b57639/desktop/ui/src/main/java/org/datacleaner/user/QuickAnalysisStrategy.java#L159-L180
26,317
datacleaner/DataCleaner
engine/utils/src/main/java/org/datacleaner/util/ReflectionUtils.java
ReflectionUtils.getAllFields
public static Field[] getAllFields(final Class<?> clazz) { final List<Field> allFields = new ArrayList<>(); addFields(allFields, clazz); return allFields.toArray(new Field[allFields.size()]); }
java
public static Field[] getAllFields(final Class<?> clazz) { final List<Field> allFields = new ArrayList<>(); addFields(allFields, clazz); return allFields.toArray(new Field[allFields.size()]); }
[ "public", "static", "Field", "[", "]", "getAllFields", "(", "final", "Class", "<", "?", ">", "clazz", ")", "{", "final", "List", "<", "Field", ">", "allFields", "=", "new", "ArrayList", "<>", "(", ")", ";", "addFields", "(", "allFields", ",", "clazz", ")", ";", "return", "allFields", ".", "toArray", "(", "new", "Field", "[", "allFields", ".", "size", "(", ")", "]", ")", ";", "}" ]
Gets all fields of a class, including private fields in super-classes. @param clazz @return
[ "Gets", "all", "fields", "of", "a", "class", "including", "private", "fields", "in", "super", "-", "classes", "." ]
9aa01fdac3560cef51c55df3cb2ac5c690b57639
https://github.com/datacleaner/DataCleaner/blob/9aa01fdac3560cef51c55df3cb2ac5c690b57639/engine/utils/src/main/java/org/datacleaner/util/ReflectionUtils.java#L510-L514
26,318
datacleaner/DataCleaner
engine/utils/src/main/java/org/datacleaner/util/ReflectionUtils.java
ReflectionUtils.getNonSyntheticFields
public static Field[] getNonSyntheticFields(final Class<?> clazz) { final List<Field> fieldList = new ArrayList<>(); addFields(fieldList, clazz, true); return fieldList.toArray(new Field[fieldList.size()]); }
java
public static Field[] getNonSyntheticFields(final Class<?> clazz) { final List<Field> fieldList = new ArrayList<>(); addFields(fieldList, clazz, true); return fieldList.toArray(new Field[fieldList.size()]); }
[ "public", "static", "Field", "[", "]", "getNonSyntheticFields", "(", "final", "Class", "<", "?", ">", "clazz", ")", "{", "final", "List", "<", "Field", ">", "fieldList", "=", "new", "ArrayList", "<>", "(", ")", ";", "addFields", "(", "fieldList", ",", "clazz", ",", "true", ")", ";", "return", "fieldList", ".", "toArray", "(", "new", "Field", "[", "fieldList", ".", "size", "(", ")", "]", ")", ";", "}" ]
Gets non-synthetic fields of a class, including private fields in super-classes. @param clazz @return
[ "Gets", "non", "-", "synthetic", "fields", "of", "a", "class", "including", "private", "fields", "in", "super", "-", "classes", "." ]
9aa01fdac3560cef51c55df3cb2ac5c690b57639
https://github.com/datacleaner/DataCleaner/blob/9aa01fdac3560cef51c55df3cb2ac5c690b57639/engine/utils/src/main/java/org/datacleaner/util/ReflectionUtils.java#L523-L528
26,319
datacleaner/DataCleaner
engine/core/src/main/java/org/datacleaner/descriptors/ClasspathScanDescriptorProvider.java
ClasspathScanDescriptorProvider.awaitTasks
private void awaitTasks() { if (_tasksPending.get() == 0) { return; } synchronized (this) { while (_tasksPending.get() != 0) { try { logger.info("Scan tasks still pending, waiting"); wait(); } catch (final InterruptedException e) { logger.debug("Interrupted while awaiting task completion", e); } } } }
java
private void awaitTasks() { if (_tasksPending.get() == 0) { return; } synchronized (this) { while (_tasksPending.get() != 0) { try { logger.info("Scan tasks still pending, waiting"); wait(); } catch (final InterruptedException e) { logger.debug("Interrupted while awaiting task completion", e); } } } }
[ "private", "void", "awaitTasks", "(", ")", "{", "if", "(", "_tasksPending", ".", "get", "(", ")", "==", "0", ")", "{", "return", ";", "}", "synchronized", "(", "this", ")", "{", "while", "(", "_tasksPending", ".", "get", "(", ")", "!=", "0", ")", "{", "try", "{", "logger", ".", "info", "(", "\"Scan tasks still pending, waiting\"", ")", ";", "wait", "(", ")", ";", "}", "catch", "(", "final", "InterruptedException", "e", ")", "{", "logger", ".", "debug", "(", "\"Interrupted while awaiting task completion\"", ",", "e", ")", ";", "}", "}", "}", "}" ]
Waits for all pending tasks to finish
[ "Waits", "for", "all", "pending", "tasks", "to", "finish" ]
9aa01fdac3560cef51c55df3cb2ac5c690b57639
https://github.com/datacleaner/DataCleaner/blob/9aa01fdac3560cef51c55df3cb2ac5c690b57639/engine/core/src/main/java/org/datacleaner/descriptors/ClasspathScanDescriptorProvider.java#L621-L635
26,320
datacleaner/DataCleaner
engine/core/src/main/java/org/datacleaner/job/runner/AbstractRowProcessingConsumer.java
AbstractRowProcessingConsumer.satisfiedForConsume
@Override public final boolean satisfiedForConsume(final FilterOutcomes outcomes, final InputRow row) { final boolean satisfiedOutcomesForConsume = satisfiedOutcomesForConsume(_hasComponentRequirement, row, outcomes); if (!satisfiedOutcomesForConsume) { return false; } return satisfiedInputsForConsume(row, outcomes); }
java
@Override public final boolean satisfiedForConsume(final FilterOutcomes outcomes, final InputRow row) { final boolean satisfiedOutcomesForConsume = satisfiedOutcomesForConsume(_hasComponentRequirement, row, outcomes); if (!satisfiedOutcomesForConsume) { return false; } return satisfiedInputsForConsume(row, outcomes); }
[ "@", "Override", "public", "final", "boolean", "satisfiedForConsume", "(", "final", "FilterOutcomes", "outcomes", ",", "final", "InputRow", "row", ")", "{", "final", "boolean", "satisfiedOutcomesForConsume", "=", "satisfiedOutcomesForConsume", "(", "_hasComponentRequirement", ",", "row", ",", "outcomes", ")", ";", "if", "(", "!", "satisfiedOutcomesForConsume", ")", "{", "return", "false", ";", "}", "return", "satisfiedInputsForConsume", "(", "row", ",", "outcomes", ")", ";", "}" ]
Ensures that just a single outcome is satisfied
[ "Ensures", "that", "just", "a", "single", "outcome", "is", "satisfied" ]
9aa01fdac3560cef51c55df3cb2ac5c690b57639
https://github.com/datacleaner/DataCleaner/blob/9aa01fdac3560cef51c55df3cb2ac5c690b57639/engine/core/src/main/java/org/datacleaner/job/runner/AbstractRowProcessingConsumer.java#L137-L145
26,321
datacleaner/DataCleaner
desktop/ui/src/main/java/org/datacleaner/widgets/visualization/JobGraphContext.java
JobGraphContext.getVertex
public Object getVertex(final Point2D point2D) { final GraphElementAccessor<?, ?> pickSupport = _visualizationViewer.getPickSupport(); @SuppressWarnings("rawtypes") final Layout graphLayout = _visualizationViewer.getModel().getGraphLayout(); @SuppressWarnings("unchecked") final Object vertex = pickSupport.getVertex(graphLayout, point2D.getX(), point2D.getY()); return vertex; }
java
public Object getVertex(final Point2D point2D) { final GraphElementAccessor<?, ?> pickSupport = _visualizationViewer.getPickSupport(); @SuppressWarnings("rawtypes") final Layout graphLayout = _visualizationViewer.getModel().getGraphLayout(); @SuppressWarnings("unchecked") final Object vertex = pickSupport.getVertex(graphLayout, point2D.getX(), point2D.getY()); return vertex; }
[ "public", "Object", "getVertex", "(", "final", "Point2D", "point2D", ")", "{", "final", "GraphElementAccessor", "<", "?", ",", "?", ">", "pickSupport", "=", "_visualizationViewer", ".", "getPickSupport", "(", ")", ";", "@", "SuppressWarnings", "(", "\"rawtypes\"", ")", "final", "Layout", "graphLayout", "=", "_visualizationViewer", ".", "getModel", "(", ")", ".", "getGraphLayout", "(", ")", ";", "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "final", "Object", "vertex", "=", "pickSupport", ".", "getVertex", "(", "graphLayout", ",", "point2D", ".", "getX", "(", ")", ",", "point2D", ".", "getY", "(", ")", ")", ";", "return", "vertex", ";", "}" ]
Gets the vertex at a particular point, or null if it does not exist. @param point2D @return
[ "Gets", "the", "vertex", "at", "a", "particular", "point", "or", "null", "if", "it", "does", "not", "exist", "." ]
9aa01fdac3560cef51c55df3cb2ac5c690b57639
https://github.com/datacleaner/DataCleaner/blob/9aa01fdac3560cef51c55df3cb2ac5c690b57639/desktop/ui/src/main/java/org/datacleaner/widgets/visualization/JobGraphContext.java#L95-L103
26,322
datacleaner/DataCleaner
desktop/ui/src/main/java/org/datacleaner/actions/DownloadFilesActionListener.java
DownloadFilesActionListener.cancelDownload
public void cancelDownload(final boolean hideWindowImmediately) { logger.info("Cancel of download requested"); _cancelled = true; if (hideWindowImmediately && _downloadProgressWindow != null) { WidgetUtils.invokeSwingAction(_downloadProgressWindow::close); } }
java
public void cancelDownload(final boolean hideWindowImmediately) { logger.info("Cancel of download requested"); _cancelled = true; if (hideWindowImmediately && _downloadProgressWindow != null) { WidgetUtils.invokeSwingAction(_downloadProgressWindow::close); } }
[ "public", "void", "cancelDownload", "(", "final", "boolean", "hideWindowImmediately", ")", "{", "logger", ".", "info", "(", "\"Cancel of download requested\"", ")", ";", "_cancelled", "=", "true", ";", "if", "(", "hideWindowImmediately", "&&", "_downloadProgressWindow", "!=", "null", ")", "{", "WidgetUtils", ".", "invokeSwingAction", "(", "_downloadProgressWindow", "::", "close", ")", ";", "}", "}" ]
Cancels the file download. @param hideWindowImmediately determines if the download progress window should be hidden immediately or only when the progress of cancelling the download has occurred gracefully.
[ "Cancels", "the", "file", "download", "." ]
9aa01fdac3560cef51c55df3cb2ac5c690b57639
https://github.com/datacleaner/DataCleaner/blob/9aa01fdac3560cef51c55df3cb2ac5c690b57639/desktop/ui/src/main/java/org/datacleaner/actions/DownloadFilesActionListener.java#L177-L184
26,323
datacleaner/DataCleaner
desktop/ui/src/main/java/org/datacleaner/panels/result/ProgressInformationPanel.java
ProgressInformationPanel.updateProgress
public void updateProgress(final Table table, final int currentRow) { final TableProgressInformationPanel tableProgressInformationPanel = getTableProgressInformationPanel(table, -1); final boolean greater = tableProgressInformationPanel.setProgress(currentRow); if (!greater) { // this may happen because of the multithreaded nature of the // execution - sometimes a notification can come in later than // previous notifications return; } ProgressCounter counter = _progressTimingCounters.get(table); if (counter == null) { counter = new ProgressCounter(); final ProgressCounter previous = _progressTimingCounters.put(table, counter); if (previous != null) { counter = previous; } } final boolean log; final int previousCount = counter.get(); if (currentRow - previousCount > 1000) { log = counter.setIfSignificantToUser(currentRow); } else { log = false; } if (log) { addUserLog("Progress of " + table.getName() + ": " + formatNumber(currentRow) + " rows processed"); } }
java
public void updateProgress(final Table table, final int currentRow) { final TableProgressInformationPanel tableProgressInformationPanel = getTableProgressInformationPanel(table, -1); final boolean greater = tableProgressInformationPanel.setProgress(currentRow); if (!greater) { // this may happen because of the multithreaded nature of the // execution - sometimes a notification can come in later than // previous notifications return; } ProgressCounter counter = _progressTimingCounters.get(table); if (counter == null) { counter = new ProgressCounter(); final ProgressCounter previous = _progressTimingCounters.put(table, counter); if (previous != null) { counter = previous; } } final boolean log; final int previousCount = counter.get(); if (currentRow - previousCount > 1000) { log = counter.setIfSignificantToUser(currentRow); } else { log = false; } if (log) { addUserLog("Progress of " + table.getName() + ": " + formatNumber(currentRow) + " rows processed"); } }
[ "public", "void", "updateProgress", "(", "final", "Table", "table", ",", "final", "int", "currentRow", ")", "{", "final", "TableProgressInformationPanel", "tableProgressInformationPanel", "=", "getTableProgressInformationPanel", "(", "table", ",", "-", "1", ")", ";", "final", "boolean", "greater", "=", "tableProgressInformationPanel", ".", "setProgress", "(", "currentRow", ")", ";", "if", "(", "!", "greater", ")", "{", "// this may happen because of the multithreaded nature of the", "// execution - sometimes a notification can come in later than", "// previous notifications", "return", ";", "}", "ProgressCounter", "counter", "=", "_progressTimingCounters", ".", "get", "(", "table", ")", ";", "if", "(", "counter", "==", "null", ")", "{", "counter", "=", "new", "ProgressCounter", "(", ")", ";", "final", "ProgressCounter", "previous", "=", "_progressTimingCounters", ".", "put", "(", "table", ",", "counter", ")", ";", "if", "(", "previous", "!=", "null", ")", "{", "counter", "=", "previous", ";", "}", "}", "final", "boolean", "log", ";", "final", "int", "previousCount", "=", "counter", ".", "get", "(", ")", ";", "if", "(", "currentRow", "-", "previousCount", ">", "1000", ")", "{", "log", "=", "counter", ".", "setIfSignificantToUser", "(", "currentRow", ")", ";", "}", "else", "{", "log", "=", "false", ";", "}", "if", "(", "log", ")", "{", "addUserLog", "(", "\"Progress of \"", "+", "table", ".", "getName", "(", ")", "+", "\": \"", "+", "formatNumber", "(", "currentRow", ")", "+", "\" rows processed\"", ")", ";", "}", "}" ]
Informs the panel that the progress for a table is updated @param table @param currentRow
[ "Informs", "the", "panel", "that", "the", "progress", "for", "a", "table", "is", "updated" ]
9aa01fdac3560cef51c55df3cb2ac5c690b57639
https://github.com/datacleaner/DataCleaner/blob/9aa01fdac3560cef51c55df3cb2ac5c690b57639/desktop/ui/src/main/java/org/datacleaner/panels/result/ProgressInformationPanel.java#L227-L257
26,324
datacleaner/DataCleaner
desktop/ui/src/main/java/org/datacleaner/windows/HdfsUrlChooser.java
HdfsUrlChooser.scanHadoopConfigFiles
private boolean scanHadoopConfigFiles(final ServerInformationCatalog serverInformationCatalog, final String selectedServer) { final HadoopClusterInformation clusterInformation; if (selectedServer != null) { clusterInformation = (HadoopClusterInformation) serverInformationCatalog.getServer(selectedServer); } else { clusterInformation = (HadoopClusterInformation) serverInformationCatalog .getServer(HadoopResource.DEFAULT_CLUSTERREFERENCE); } if (clusterInformation == null) { return false; } final Configuration configuration = HdfsUtils.getHadoopConfigurationWithTimeout(clusterInformation); _currentDirectory = new Path("/"); try { _fileSystem = FileSystem.newInstance(configuration); } catch (final IOException e) { throw new IllegalArgumentException("Illegal URI when showing HDFS chooser", e); } final HdfsDirectoryModel model = (HdfsDirectoryModel) _fileList.getModel(); model.updateFileList(); return model._files.length > 0; }
java
private boolean scanHadoopConfigFiles(final ServerInformationCatalog serverInformationCatalog, final String selectedServer) { final HadoopClusterInformation clusterInformation; if (selectedServer != null) { clusterInformation = (HadoopClusterInformation) serverInformationCatalog.getServer(selectedServer); } else { clusterInformation = (HadoopClusterInformation) serverInformationCatalog .getServer(HadoopResource.DEFAULT_CLUSTERREFERENCE); } if (clusterInformation == null) { return false; } final Configuration configuration = HdfsUtils.getHadoopConfigurationWithTimeout(clusterInformation); _currentDirectory = new Path("/"); try { _fileSystem = FileSystem.newInstance(configuration); } catch (final IOException e) { throw new IllegalArgumentException("Illegal URI when showing HDFS chooser", e); } final HdfsDirectoryModel model = (HdfsDirectoryModel) _fileList.getModel(); model.updateFileList(); return model._files.length > 0; }
[ "private", "boolean", "scanHadoopConfigFiles", "(", "final", "ServerInformationCatalog", "serverInformationCatalog", ",", "final", "String", "selectedServer", ")", "{", "final", "HadoopClusterInformation", "clusterInformation", ";", "if", "(", "selectedServer", "!=", "null", ")", "{", "clusterInformation", "=", "(", "HadoopClusterInformation", ")", "serverInformationCatalog", ".", "getServer", "(", "selectedServer", ")", ";", "}", "else", "{", "clusterInformation", "=", "(", "HadoopClusterInformation", ")", "serverInformationCatalog", ".", "getServer", "(", "HadoopResource", ".", "DEFAULT_CLUSTERREFERENCE", ")", ";", "}", "if", "(", "clusterInformation", "==", "null", ")", "{", "return", "false", ";", "}", "final", "Configuration", "configuration", "=", "HdfsUtils", ".", "getHadoopConfigurationWithTimeout", "(", "clusterInformation", ")", ";", "_currentDirectory", "=", "new", "Path", "(", "\"/\"", ")", ";", "try", "{", "_fileSystem", "=", "FileSystem", ".", "newInstance", "(", "configuration", ")", ";", "}", "catch", "(", "final", "IOException", "e", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"Illegal URI when showing HDFS chooser\"", ",", "e", ")", ";", "}", "final", "HdfsDirectoryModel", "model", "=", "(", "HdfsDirectoryModel", ")", "_fileList", ".", "getModel", "(", ")", ";", "model", ".", "updateFileList", "(", ")", ";", "return", "model", ".", "_files", ".", "length", ">", "0", ";", "}" ]
This scans Hadoop environment variables for a directory with configuration files @param serverInformationCatalog @return True if a configuration was yielded.
[ "This", "scans", "Hadoop", "environment", "variables", "for", "a", "directory", "with", "configuration", "files" ]
9aa01fdac3560cef51c55df3cb2ac5c690b57639
https://github.com/datacleaner/DataCleaner/blob/9aa01fdac3560cef51c55df3cb2ac5c690b57639/desktop/ui/src/main/java/org/datacleaner/windows/HdfsUrlChooser.java#L519-L546
26,325
datacleaner/DataCleaner
engine/core/src/main/java/org/datacleaner/result/save/AnalysisResultSaveHandler.java
AnalysisResultSaveHandler.getUnsafeResultElements
public Map<ComponentJob, AnalyzerResult> getUnsafeResultElements() { if (_unsafeResultElements == null) { _unsafeResultElements = new LinkedHashMap<>(); final Map<ComponentJob, AnalyzerResult> resultMap = _analysisResult.getResultMap(); for (final Entry<ComponentJob, AnalyzerResult> entry : resultMap.entrySet()) { final AnalyzerResult analyzerResult = entry.getValue(); try { SerializationUtils.serialize(analyzerResult, new NullOutputStream()); } catch (final SerializationException e) { _unsafeResultElements.put(entry.getKey(), analyzerResult); } } } return _unsafeResultElements; }
java
public Map<ComponentJob, AnalyzerResult> getUnsafeResultElements() { if (_unsafeResultElements == null) { _unsafeResultElements = new LinkedHashMap<>(); final Map<ComponentJob, AnalyzerResult> resultMap = _analysisResult.getResultMap(); for (final Entry<ComponentJob, AnalyzerResult> entry : resultMap.entrySet()) { final AnalyzerResult analyzerResult = entry.getValue(); try { SerializationUtils.serialize(analyzerResult, new NullOutputStream()); } catch (final SerializationException e) { _unsafeResultElements.put(entry.getKey(), analyzerResult); } } } return _unsafeResultElements; }
[ "public", "Map", "<", "ComponentJob", ",", "AnalyzerResult", ">", "getUnsafeResultElements", "(", ")", "{", "if", "(", "_unsafeResultElements", "==", "null", ")", "{", "_unsafeResultElements", "=", "new", "LinkedHashMap", "<>", "(", ")", ";", "final", "Map", "<", "ComponentJob", ",", "AnalyzerResult", ">", "resultMap", "=", "_analysisResult", ".", "getResultMap", "(", ")", ";", "for", "(", "final", "Entry", "<", "ComponentJob", ",", "AnalyzerResult", ">", "entry", ":", "resultMap", ".", "entrySet", "(", ")", ")", "{", "final", "AnalyzerResult", "analyzerResult", "=", "entry", ".", "getValue", "(", ")", ";", "try", "{", "SerializationUtils", ".", "serialize", "(", "analyzerResult", ",", "new", "NullOutputStream", "(", ")", ")", ";", "}", "catch", "(", "final", "SerializationException", "e", ")", "{", "_unsafeResultElements", ".", "put", "(", "entry", ".", "getKey", "(", ")", ",", "analyzerResult", ")", ";", "}", "}", "}", "return", "_unsafeResultElements", ";", "}" ]
Gets a map of unsafe result elements, ie. elements that cannot be saved because serialization fails. @return
[ "Gets", "a", "map", "of", "unsafe", "result", "elements", "ie", ".", "elements", "that", "cannot", "be", "saved", "because", "serialization", "fails", "." ]
9aa01fdac3560cef51c55df3cb2ac5c690b57639
https://github.com/datacleaner/DataCleaner/blob/9aa01fdac3560cef51c55df3cb2ac5c690b57639/engine/core/src/main/java/org/datacleaner/result/save/AnalysisResultSaveHandler.java#L97-L111
26,326
datacleaner/DataCleaner
api/src/main/java/org/datacleaner/api/UsageMeteringMessage.java
UsageMeteringMessage.escapeValueTo
private void escapeValueTo(final String field, final StringBuilder target) { if (field == null) { target.append(DETAILS_QUOTE_CHAR); target.append(DETAILS_QUOTE_CHAR); return; } target.append(DETAILS_QUOTE_CHAR); if (field.indexOf(DETAILS_ESCAPE_CHAR) == -1 && field.indexOf(DETAILS_QUOTE_CHAR) == -1) { target.append(field); } else { final int len = field.length(); for (int i = 0; i < len; i++) { final char charAt = field.charAt(i); if (charAt == DETAILS_ESCAPE_CHAR || charAt == DETAILS_QUOTE_CHAR) { target.append(DETAILS_ESCAPE_CHAR); } target.append(charAt); } } target.append(DETAILS_QUOTE_CHAR); }
java
private void escapeValueTo(final String field, final StringBuilder target) { if (field == null) { target.append(DETAILS_QUOTE_CHAR); target.append(DETAILS_QUOTE_CHAR); return; } target.append(DETAILS_QUOTE_CHAR); if (field.indexOf(DETAILS_ESCAPE_CHAR) == -1 && field.indexOf(DETAILS_QUOTE_CHAR) == -1) { target.append(field); } else { final int len = field.length(); for (int i = 0; i < len; i++) { final char charAt = field.charAt(i); if (charAt == DETAILS_ESCAPE_CHAR || charAt == DETAILS_QUOTE_CHAR) { target.append(DETAILS_ESCAPE_CHAR); } target.append(charAt); } } target.append(DETAILS_QUOTE_CHAR); }
[ "private", "void", "escapeValueTo", "(", "final", "String", "field", ",", "final", "StringBuilder", "target", ")", "{", "if", "(", "field", "==", "null", ")", "{", "target", ".", "append", "(", "DETAILS_QUOTE_CHAR", ")", ";", "target", ".", "append", "(", "DETAILS_QUOTE_CHAR", ")", ";", "return", ";", "}", "target", ".", "append", "(", "DETAILS_QUOTE_CHAR", ")", ";", "if", "(", "field", ".", "indexOf", "(", "DETAILS_ESCAPE_CHAR", ")", "==", "-", "1", "&&", "field", ".", "indexOf", "(", "DETAILS_QUOTE_CHAR", ")", "==", "-", "1", ")", "{", "target", ".", "append", "(", "field", ")", ";", "}", "else", "{", "final", "int", "len", "=", "field", ".", "length", "(", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "len", ";", "i", "++", ")", "{", "final", "char", "charAt", "=", "field", ".", "charAt", "(", "i", ")", ";", "if", "(", "charAt", "==", "DETAILS_ESCAPE_CHAR", "||", "charAt", "==", "DETAILS_QUOTE_CHAR", ")", "{", "target", ".", "append", "(", "DETAILS_ESCAPE_CHAR", ")", ";", "}", "target", ".", "append", "(", "charAt", ")", ";", "}", "}", "target", ".", "append", "(", "DETAILS_QUOTE_CHAR", ")", ";", "}" ]
Escapes value for a CSV line and appends it to the 'target'.
[ "Escapes", "value", "for", "a", "CSV", "line", "and", "appends", "it", "to", "the", "target", "." ]
9aa01fdac3560cef51c55df3cb2ac5c690b57639
https://github.com/datacleaner/DataCleaner/blob/9aa01fdac3560cef51c55df3cb2ac5c690b57639/api/src/main/java/org/datacleaner/api/UsageMeteringMessage.java#L83-L103
26,327
datacleaner/DataCleaner
components/basic-analyzers/src/main/java/org/datacleaner/beans/BooleanAnalyzerReducer.java
BooleanAnalyzerReducer.createMeasureDimensionValueCombinationCrosstab
public void createMeasureDimensionValueCombinationCrosstab( final Map<ValueCombination<Number>, Number> valueCombinations, final Crosstab<Number> valueCombinationCrosstab) { if (CrosstabReducerHelper.findDimension(valueCombinationCrosstab, BooleanAnalyzer.DIMENSION_MEASURE)) { final SortedSet<Entry<ValueCombination<Number>, Number>> entries = new TreeSet<>(frequentValueCombinationComparator); entries.addAll(valueCombinations.entrySet()); final CrosstabNavigator<Number> nav = new CrosstabNavigator<>(valueCombinationCrosstab); final CrosstabDimension measureDimension = valueCombinationCrosstab.getDimension(BooleanAnalyzer.DIMENSION_MEASURE); final CrosstabDimension columnDimension = valueCombinationCrosstab.getDimension(BooleanAnalyzer.DIMENSION_COLUMN); final List<String> columnDimCategories = columnDimension.getCategories(); int row = 0; for (final Entry<ValueCombination<Number>, Number> entry : entries) { // create the category final String measureName; if (row == 0) { measureName = BooleanAnalyzer.MEASURE_MOST_FREQUENT; } else if (row == entries.size() - 1) { measureName = BooleanAnalyzer.MEASURE_LEAST_FREQUENT; } else { measureName = BooleanAnalyzer.DIMENSION_COMBINATION_PREFIX + row; } measureDimension.addCategory(measureName); // extract data final Number[] values = new Number[columnDimCategories.size()]; final ValueCombination<Number> key = entry.getKey(); for (int i = 0; i < key.getValueCount(); i++) { values[i] = key.getValueAt(i); } values[columnDimCategories.size() - 1] = entry.getValue(); // put data into crosstab for (int i = 0; i < columnDimCategories.size(); i++) { nav.where(columnDimension, columnDimCategories.get(i)); nav.where(measureDimension, measureName); nav.put(values[i]); } row++; } } }
java
public void createMeasureDimensionValueCombinationCrosstab( final Map<ValueCombination<Number>, Number> valueCombinations, final Crosstab<Number> valueCombinationCrosstab) { if (CrosstabReducerHelper.findDimension(valueCombinationCrosstab, BooleanAnalyzer.DIMENSION_MEASURE)) { final SortedSet<Entry<ValueCombination<Number>, Number>> entries = new TreeSet<>(frequentValueCombinationComparator); entries.addAll(valueCombinations.entrySet()); final CrosstabNavigator<Number> nav = new CrosstabNavigator<>(valueCombinationCrosstab); final CrosstabDimension measureDimension = valueCombinationCrosstab.getDimension(BooleanAnalyzer.DIMENSION_MEASURE); final CrosstabDimension columnDimension = valueCombinationCrosstab.getDimension(BooleanAnalyzer.DIMENSION_COLUMN); final List<String> columnDimCategories = columnDimension.getCategories(); int row = 0; for (final Entry<ValueCombination<Number>, Number> entry : entries) { // create the category final String measureName; if (row == 0) { measureName = BooleanAnalyzer.MEASURE_MOST_FREQUENT; } else if (row == entries.size() - 1) { measureName = BooleanAnalyzer.MEASURE_LEAST_FREQUENT; } else { measureName = BooleanAnalyzer.DIMENSION_COMBINATION_PREFIX + row; } measureDimension.addCategory(measureName); // extract data final Number[] values = new Number[columnDimCategories.size()]; final ValueCombination<Number> key = entry.getKey(); for (int i = 0; i < key.getValueCount(); i++) { values[i] = key.getValueAt(i); } values[columnDimCategories.size() - 1] = entry.getValue(); // put data into crosstab for (int i = 0; i < columnDimCategories.size(); i++) { nav.where(columnDimension, columnDimCategories.get(i)); nav.where(measureDimension, measureName); nav.put(values[i]); } row++; } } }
[ "public", "void", "createMeasureDimensionValueCombinationCrosstab", "(", "final", "Map", "<", "ValueCombination", "<", "Number", ">", ",", "Number", ">", "valueCombinations", ",", "final", "Crosstab", "<", "Number", ">", "valueCombinationCrosstab", ")", "{", "if", "(", "CrosstabReducerHelper", ".", "findDimension", "(", "valueCombinationCrosstab", ",", "BooleanAnalyzer", ".", "DIMENSION_MEASURE", ")", ")", "{", "final", "SortedSet", "<", "Entry", "<", "ValueCombination", "<", "Number", ">", ",", "Number", ">", ">", "entries", "=", "new", "TreeSet", "<>", "(", "frequentValueCombinationComparator", ")", ";", "entries", ".", "addAll", "(", "valueCombinations", ".", "entrySet", "(", ")", ")", ";", "final", "CrosstabNavigator", "<", "Number", ">", "nav", "=", "new", "CrosstabNavigator", "<>", "(", "valueCombinationCrosstab", ")", ";", "final", "CrosstabDimension", "measureDimension", "=", "valueCombinationCrosstab", ".", "getDimension", "(", "BooleanAnalyzer", ".", "DIMENSION_MEASURE", ")", ";", "final", "CrosstabDimension", "columnDimension", "=", "valueCombinationCrosstab", ".", "getDimension", "(", "BooleanAnalyzer", ".", "DIMENSION_COLUMN", ")", ";", "final", "List", "<", "String", ">", "columnDimCategories", "=", "columnDimension", ".", "getCategories", "(", ")", ";", "int", "row", "=", "0", ";", "for", "(", "final", "Entry", "<", "ValueCombination", "<", "Number", ">", ",", "Number", ">", "entry", ":", "entries", ")", "{", "// create the category", "final", "String", "measureName", ";", "if", "(", "row", "==", "0", ")", "{", "measureName", "=", "BooleanAnalyzer", ".", "MEASURE_MOST_FREQUENT", ";", "}", "else", "if", "(", "row", "==", "entries", ".", "size", "(", ")", "-", "1", ")", "{", "measureName", "=", "BooleanAnalyzer", ".", "MEASURE_LEAST_FREQUENT", ";", "}", "else", "{", "measureName", "=", "BooleanAnalyzer", ".", "DIMENSION_COMBINATION_PREFIX", "+", "row", ";", "}", "measureDimension", ".", "addCategory", "(", "measureName", ")", ";", "// extract data", "final", "Number", "[", "]", "values", "=", "new", "Number", "[", "columnDimCategories", ".", "size", "(", ")", "]", ";", "final", "ValueCombination", "<", "Number", ">", "key", "=", "entry", ".", "getKey", "(", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "key", ".", "getValueCount", "(", ")", ";", "i", "++", ")", "{", "values", "[", "i", "]", "=", "key", ".", "getValueAt", "(", "i", ")", ";", "}", "values", "[", "columnDimCategories", ".", "size", "(", ")", "-", "1", "]", "=", "entry", ".", "getValue", "(", ")", ";", "// put data into crosstab", "for", "(", "int", "i", "=", "0", ";", "i", "<", "columnDimCategories", ".", "size", "(", ")", ";", "i", "++", ")", "{", "nav", ".", "where", "(", "columnDimension", ",", "columnDimCategories", ".", "get", "(", "i", ")", ")", ";", "nav", ".", "where", "(", "measureDimension", ",", "measureName", ")", ";", "nav", ".", "put", "(", "values", "[", "i", "]", ")", ";", "}", "row", "++", ";", "}", "}", "}" ]
Creates the measure dimension based on the sorted value combinations @param valueCombinations @param valueCombinationCrosstab
[ "Creates", "the", "measure", "dimension", "based", "on", "the", "sorted", "value", "combinations" ]
9aa01fdac3560cef51c55df3cb2ac5c690b57639
https://github.com/datacleaner/DataCleaner/blob/9aa01fdac3560cef51c55df3cb2ac5c690b57639/components/basic-analyzers/src/main/java/org/datacleaner/beans/BooleanAnalyzerReducer.java#L107-L154
26,328
datacleaner/DataCleaner
components/basic-analyzers/src/main/java/org/datacleaner/beans/BooleanAnalyzerReducer.java
BooleanAnalyzerReducer.addValueCombinationsCrosstabDimension
public void addValueCombinationsCrosstabDimension(final Map<ValueCombination<Number>, Number> valueCombMapList, final Crosstab<Number> partialCrosstab) { final CrosstabNavigator<Number> nav = new CrosstabNavigator<>(partialCrosstab); final CrosstabDimension columnDimension = partialCrosstab.getDimension(BooleanAnalyzer.DIMENSION_COLUMN); final CrosstabDimension measureDimension = partialCrosstab.getDimension(BooleanAnalyzer.DIMENSION_MEASURE); final List<String> columnDimCategories = columnDimension.getCategories(); final List<String> measureCategories = measureDimension.getCategories(); for (final String measureCategory : measureCategories) { final Number[] values = new Number[columnDimCategories.size() - 1]; for (int i = 0; i < columnDimCategories.size() - 1; i++) { nav.where(columnDimension, columnDimCategories.get(i)); final CrosstabNavigator<Number> where = nav.where(measureDimension, measureCategory); final Number value = where.safeGet(null); if (!columnDimCategories.get(0).equals(BooleanAnalyzer.VALUE_COMBINATION_COLUMN_FREQUENCY)) { values[i] = value; } } final CrosstabNavigator<Number> where = nav.where(columnDimension, BooleanAnalyzer.VALUE_COMBINATION_COLUMN_FREQUENCY); final Number frequency = where.safeGet(null); final Number frequencyVal = frequency != null ? frequency : 0; final ValueCombination<Number> valComb = new ValueCombination<>(values); final Number combination = valueCombMapList.get(valComb); if (combination == null) { valueCombMapList.put(valComb, frequencyVal); } else { final Number newValue = CrosstabReducerHelper.sum(combination, frequencyVal); valueCombMapList.put(valComb, newValue); } } }
java
public void addValueCombinationsCrosstabDimension(final Map<ValueCombination<Number>, Number> valueCombMapList, final Crosstab<Number> partialCrosstab) { final CrosstabNavigator<Number> nav = new CrosstabNavigator<>(partialCrosstab); final CrosstabDimension columnDimension = partialCrosstab.getDimension(BooleanAnalyzer.DIMENSION_COLUMN); final CrosstabDimension measureDimension = partialCrosstab.getDimension(BooleanAnalyzer.DIMENSION_MEASURE); final List<String> columnDimCategories = columnDimension.getCategories(); final List<String> measureCategories = measureDimension.getCategories(); for (final String measureCategory : measureCategories) { final Number[] values = new Number[columnDimCategories.size() - 1]; for (int i = 0; i < columnDimCategories.size() - 1; i++) { nav.where(columnDimension, columnDimCategories.get(i)); final CrosstabNavigator<Number> where = nav.where(measureDimension, measureCategory); final Number value = where.safeGet(null); if (!columnDimCategories.get(0).equals(BooleanAnalyzer.VALUE_COMBINATION_COLUMN_FREQUENCY)) { values[i] = value; } } final CrosstabNavigator<Number> where = nav.where(columnDimension, BooleanAnalyzer.VALUE_COMBINATION_COLUMN_FREQUENCY); final Number frequency = where.safeGet(null); final Number frequencyVal = frequency != null ? frequency : 0; final ValueCombination<Number> valComb = new ValueCombination<>(values); final Number combination = valueCombMapList.get(valComb); if (combination == null) { valueCombMapList.put(valComb, frequencyVal); } else { final Number newValue = CrosstabReducerHelper.sum(combination, frequencyVal); valueCombMapList.put(valComb, newValue); } } }
[ "public", "void", "addValueCombinationsCrosstabDimension", "(", "final", "Map", "<", "ValueCombination", "<", "Number", ">", ",", "Number", ">", "valueCombMapList", ",", "final", "Crosstab", "<", "Number", ">", "partialCrosstab", ")", "{", "final", "CrosstabNavigator", "<", "Number", ">", "nav", "=", "new", "CrosstabNavigator", "<>", "(", "partialCrosstab", ")", ";", "final", "CrosstabDimension", "columnDimension", "=", "partialCrosstab", ".", "getDimension", "(", "BooleanAnalyzer", ".", "DIMENSION_COLUMN", ")", ";", "final", "CrosstabDimension", "measureDimension", "=", "partialCrosstab", ".", "getDimension", "(", "BooleanAnalyzer", ".", "DIMENSION_MEASURE", ")", ";", "final", "List", "<", "String", ">", "columnDimCategories", "=", "columnDimension", ".", "getCategories", "(", ")", ";", "final", "List", "<", "String", ">", "measureCategories", "=", "measureDimension", ".", "getCategories", "(", ")", ";", "for", "(", "final", "String", "measureCategory", ":", "measureCategories", ")", "{", "final", "Number", "[", "]", "values", "=", "new", "Number", "[", "columnDimCategories", ".", "size", "(", ")", "-", "1", "]", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "columnDimCategories", ".", "size", "(", ")", "-", "1", ";", "i", "++", ")", "{", "nav", ".", "where", "(", "columnDimension", ",", "columnDimCategories", ".", "get", "(", "i", ")", ")", ";", "final", "CrosstabNavigator", "<", "Number", ">", "where", "=", "nav", ".", "where", "(", "measureDimension", ",", "measureCategory", ")", ";", "final", "Number", "value", "=", "where", ".", "safeGet", "(", "null", ")", ";", "if", "(", "!", "columnDimCategories", ".", "get", "(", "0", ")", ".", "equals", "(", "BooleanAnalyzer", ".", "VALUE_COMBINATION_COLUMN_FREQUENCY", ")", ")", "{", "values", "[", "i", "]", "=", "value", ";", "}", "}", "final", "CrosstabNavigator", "<", "Number", ">", "where", "=", "nav", ".", "where", "(", "columnDimension", ",", "BooleanAnalyzer", ".", "VALUE_COMBINATION_COLUMN_FREQUENCY", ")", ";", "final", "Number", "frequency", "=", "where", ".", "safeGet", "(", "null", ")", ";", "final", "Number", "frequencyVal", "=", "frequency", "!=", "null", "?", "frequency", ":", "0", ";", "final", "ValueCombination", "<", "Number", ">", "valComb", "=", "new", "ValueCombination", "<>", "(", "values", ")", ";", "final", "Number", "combination", "=", "valueCombMapList", ".", "get", "(", "valComb", ")", ";", "if", "(", "combination", "==", "null", ")", "{", "valueCombMapList", ".", "put", "(", "valComb", ",", "frequencyVal", ")", ";", "}", "else", "{", "final", "Number", "newValue", "=", "CrosstabReducerHelper", ".", "sum", "(", "combination", ",", "frequencyVal", ")", ";", "valueCombMapList", ".", "put", "(", "valComb", ",", "newValue", ")", ";", "}", "}", "}" ]
Gather the sum of all possible value combinations of the partial crosstabs @param valueCombMapList @param partialCrosstab
[ "Gather", "the", "sum", "of", "all", "possible", "value", "combinations", "of", "the", "partial", "crosstabs" ]
9aa01fdac3560cef51c55df3cb2ac5c690b57639
https://github.com/datacleaner/DataCleaner/blob/9aa01fdac3560cef51c55df3cb2ac5c690b57639/components/basic-analyzers/src/main/java/org/datacleaner/beans/BooleanAnalyzerReducer.java#L163-L197
26,329
datacleaner/DataCleaner
desktop/api/src/main/java/org/datacleaner/widgets/properties/PropertyWidgetCollection.java
PropertyWidgetCollection.onConfigurationChanged
public void onConfigurationChanged() { final Collection<PropertyWidget<?>> widgets = getWidgets(); if (logger.isDebugEnabled()) { final StringBuilder sb = new StringBuilder(); sb.append("id="); sb.append(System.identityHashCode(this)); sb.append(" - onConfigurationChanged() - notifying widgets:"); sb.append(widgets.size()); for (final PropertyWidget<?> widget : widgets) { final String propertyName = widget.getPropertyDescriptor().getName(); final String propertyWidgetClassName = widget.getClass().getSimpleName(); sb.append("\n - "); sb.append(propertyName); sb.append(": "); sb.append(propertyWidgetClassName); } logger.debug(sb.toString()); } for (final PropertyWidget<?> widget : widgets) { @SuppressWarnings("unchecked") final PropertyWidget<Object> objectWidget = (PropertyWidget<Object>) widget; final ConfiguredPropertyDescriptor propertyDescriptor = objectWidget.getPropertyDescriptor(); final Object value = _componentBuilder.getConfiguredProperty(propertyDescriptor); objectWidget.onValueTouched(value); } }
java
public void onConfigurationChanged() { final Collection<PropertyWidget<?>> widgets = getWidgets(); if (logger.isDebugEnabled()) { final StringBuilder sb = new StringBuilder(); sb.append("id="); sb.append(System.identityHashCode(this)); sb.append(" - onConfigurationChanged() - notifying widgets:"); sb.append(widgets.size()); for (final PropertyWidget<?> widget : widgets) { final String propertyName = widget.getPropertyDescriptor().getName(); final String propertyWidgetClassName = widget.getClass().getSimpleName(); sb.append("\n - "); sb.append(propertyName); sb.append(": "); sb.append(propertyWidgetClassName); } logger.debug(sb.toString()); } for (final PropertyWidget<?> widget : widgets) { @SuppressWarnings("unchecked") final PropertyWidget<Object> objectWidget = (PropertyWidget<Object>) widget; final ConfiguredPropertyDescriptor propertyDescriptor = objectWidget.getPropertyDescriptor(); final Object value = _componentBuilder.getConfiguredProperty(propertyDescriptor); objectWidget.onValueTouched(value); } }
[ "public", "void", "onConfigurationChanged", "(", ")", "{", "final", "Collection", "<", "PropertyWidget", "<", "?", ">", ">", "widgets", "=", "getWidgets", "(", ")", ";", "if", "(", "logger", ".", "isDebugEnabled", "(", ")", ")", "{", "final", "StringBuilder", "sb", "=", "new", "StringBuilder", "(", ")", ";", "sb", ".", "append", "(", "\"id=\"", ")", ";", "sb", ".", "append", "(", "System", ".", "identityHashCode", "(", "this", ")", ")", ";", "sb", ".", "append", "(", "\" - onConfigurationChanged() - notifying widgets:\"", ")", ";", "sb", ".", "append", "(", "widgets", ".", "size", "(", ")", ")", ";", "for", "(", "final", "PropertyWidget", "<", "?", ">", "widget", ":", "widgets", ")", "{", "final", "String", "propertyName", "=", "widget", ".", "getPropertyDescriptor", "(", ")", ".", "getName", "(", ")", ";", "final", "String", "propertyWidgetClassName", "=", "widget", ".", "getClass", "(", ")", ".", "getSimpleName", "(", ")", ";", "sb", ".", "append", "(", "\"\\n - \"", ")", ";", "sb", ".", "append", "(", "propertyName", ")", ";", "sb", ".", "append", "(", "\": \"", ")", ";", "sb", ".", "append", "(", "propertyWidgetClassName", ")", ";", "}", "logger", ".", "debug", "(", "sb", ".", "toString", "(", ")", ")", ";", "}", "for", "(", "final", "PropertyWidget", "<", "?", ">", "widget", ":", "widgets", ")", "{", "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "final", "PropertyWidget", "<", "Object", ">", "objectWidget", "=", "(", "PropertyWidget", "<", "Object", ">", ")", "widget", ";", "final", "ConfiguredPropertyDescriptor", "propertyDescriptor", "=", "objectWidget", ".", "getPropertyDescriptor", "(", ")", ";", "final", "Object", "value", "=", "_componentBuilder", ".", "getConfiguredProperty", "(", "propertyDescriptor", ")", ";", "objectWidget", ".", "onValueTouched", "(", "value", ")", ";", "}", "}" ]
Invoked whenever a configured property within this widget factory is changed.
[ "Invoked", "whenever", "a", "configured", "property", "within", "this", "widget", "factory", "is", "changed", "." ]
9aa01fdac3560cef51c55df3cb2ac5c690b57639
https://github.com/datacleaner/DataCleaner/blob/9aa01fdac3560cef51c55df3cb2ac5c690b57639/desktop/api/src/main/java/org/datacleaner/widgets/properties/PropertyWidgetCollection.java#L99-L126
26,330
datacleaner/DataCleaner
desktop/ui/src/main/java/org/datacleaner/util/DefaultEnumMatcher.java
DefaultEnumMatcher.normalize
protected Collection<String> normalize(String string, final boolean tokenize) { if (string == null) { return Collections.emptyList(); } if (tokenize) { final Collection<String> result = new LinkedHashSet<>(); result.addAll(normalize(string, false)); final Splitter splitter = Splitter.on(' ').omitEmptyStrings(); final List<String> tokens = splitter.splitToList(string); for (final String token : tokens) { final Collection<String> normalizedTokens = normalize(token, false); result.addAll(normalizedTokens); } return result; } else { string = StringUtils.replaceWhitespaces(string, ""); string = StringUtils.replaceAll(string, "-", ""); string = StringUtils.replaceAll(string, "_", ""); string = StringUtils.replaceAll(string, "|", ""); string = StringUtils.replaceAll(string, "*", ""); string = string.toUpperCase(); if (string.isEmpty()) { return Collections.emptyList(); } final String withoutNumbers = string.replaceAll("[0-9]", ""); if (withoutNumbers.equals(string) || withoutNumbers.isEmpty()) { return Arrays.asList(string); } return Arrays.asList(string, withoutNumbers); } }
java
protected Collection<String> normalize(String string, final boolean tokenize) { if (string == null) { return Collections.emptyList(); } if (tokenize) { final Collection<String> result = new LinkedHashSet<>(); result.addAll(normalize(string, false)); final Splitter splitter = Splitter.on(' ').omitEmptyStrings(); final List<String> tokens = splitter.splitToList(string); for (final String token : tokens) { final Collection<String> normalizedTokens = normalize(token, false); result.addAll(normalizedTokens); } return result; } else { string = StringUtils.replaceWhitespaces(string, ""); string = StringUtils.replaceAll(string, "-", ""); string = StringUtils.replaceAll(string, "_", ""); string = StringUtils.replaceAll(string, "|", ""); string = StringUtils.replaceAll(string, "*", ""); string = string.toUpperCase(); if (string.isEmpty()) { return Collections.emptyList(); } final String withoutNumbers = string.replaceAll("[0-9]", ""); if (withoutNumbers.equals(string) || withoutNumbers.isEmpty()) { return Arrays.asList(string); } return Arrays.asList(string, withoutNumbers); } }
[ "protected", "Collection", "<", "String", ">", "normalize", "(", "String", "string", ",", "final", "boolean", "tokenize", ")", "{", "if", "(", "string", "==", "null", ")", "{", "return", "Collections", ".", "emptyList", "(", ")", ";", "}", "if", "(", "tokenize", ")", "{", "final", "Collection", "<", "String", ">", "result", "=", "new", "LinkedHashSet", "<>", "(", ")", ";", "result", ".", "addAll", "(", "normalize", "(", "string", ",", "false", ")", ")", ";", "final", "Splitter", "splitter", "=", "Splitter", ".", "on", "(", "'", "'", ")", ".", "omitEmptyStrings", "(", ")", ";", "final", "List", "<", "String", ">", "tokens", "=", "splitter", ".", "splitToList", "(", "string", ")", ";", "for", "(", "final", "String", "token", ":", "tokens", ")", "{", "final", "Collection", "<", "String", ">", "normalizedTokens", "=", "normalize", "(", "token", ",", "false", ")", ";", "result", ".", "addAll", "(", "normalizedTokens", ")", ";", "}", "return", "result", ";", "}", "else", "{", "string", "=", "StringUtils", ".", "replaceWhitespaces", "(", "string", ",", "\"\"", ")", ";", "string", "=", "StringUtils", ".", "replaceAll", "(", "string", ",", "\"-\"", ",", "\"\"", ")", ";", "string", "=", "StringUtils", ".", "replaceAll", "(", "string", ",", "\"_\"", ",", "\"\"", ")", ";", "string", "=", "StringUtils", ".", "replaceAll", "(", "string", ",", "\"|\"", ",", "\"\"", ")", ";", "string", "=", "StringUtils", ".", "replaceAll", "(", "string", ",", "\"*\"", ",", "\"\"", ")", ";", "string", "=", "string", ".", "toUpperCase", "(", ")", ";", "if", "(", "string", ".", "isEmpty", "(", ")", ")", "{", "return", "Collections", ".", "emptyList", "(", ")", ";", "}", "final", "String", "withoutNumbers", "=", "string", ".", "replaceAll", "(", "\"[0-9]\"", ",", "\"\"", ")", ";", "if", "(", "withoutNumbers", ".", "equals", "(", "string", ")", "||", "withoutNumbers", ".", "isEmpty", "(", ")", ")", "{", "return", "Arrays", ".", "asList", "(", "string", ")", ";", "}", "return", "Arrays", ".", "asList", "(", "string", ",", "withoutNumbers", ")", ";", "}", "}" ]
Normalizes the incoming string before doing matching @param string @param tokenize @return
[ "Normalizes", "the", "incoming", "string", "before", "doing", "matching" ]
9aa01fdac3560cef51c55df3cb2ac5c690b57639
https://github.com/datacleaner/DataCleaner/blob/9aa01fdac3560cef51c55df3cb2ac5c690b57639/desktop/ui/src/main/java/org/datacleaner/util/DefaultEnumMatcher.java#L106-L138
26,331
datacleaner/DataCleaner
desktop/ui/src/main/java/org/datacleaner/widgets/result/ValueDistributionResultSwingRenderer.java
ValueDistributionResultSwingRenderer.getDistinctValueCount
private ValueFrequency getDistinctValueCount(final ValueCountingAnalyzerResult res) { int distinctValueCounter = 0; ValueFrequency valueCount = null; if (res.getNullCount() > 0) { distinctValueCounter++; valueCount = new SingleValueFrequency(LabelUtils.NULL_LABEL, res.getNullCount()); } final int uniqueCount = res.getUniqueCount(); if (uniqueCount > 0) { if (uniqueCount > 1) { // more than one distinct value return null; } distinctValueCounter++; final Collection<String> uniqueValues = res.getUniqueValues(); String label = LabelUtils.UNIQUE_LABEL; if (!uniqueValues.isEmpty()) { label = uniqueValues.iterator().next(); } valueCount = new CompositeValueFrequency(label, 1); } if (distinctValueCounter > 1) { // more than one distinct value return null; } final Collection<ValueFrequency> valueCounts = res.getValueCounts(); if (valueCounts.size() > 0) { distinctValueCounter += valueCounts.size(); valueCount = valueCounts.iterator().next(); } if (distinctValueCounter > 1) { // more than one distinct value return null; } return valueCount; }
java
private ValueFrequency getDistinctValueCount(final ValueCountingAnalyzerResult res) { int distinctValueCounter = 0; ValueFrequency valueCount = null; if (res.getNullCount() > 0) { distinctValueCounter++; valueCount = new SingleValueFrequency(LabelUtils.NULL_LABEL, res.getNullCount()); } final int uniqueCount = res.getUniqueCount(); if (uniqueCount > 0) { if (uniqueCount > 1) { // more than one distinct value return null; } distinctValueCounter++; final Collection<String> uniqueValues = res.getUniqueValues(); String label = LabelUtils.UNIQUE_LABEL; if (!uniqueValues.isEmpty()) { label = uniqueValues.iterator().next(); } valueCount = new CompositeValueFrequency(label, 1); } if (distinctValueCounter > 1) { // more than one distinct value return null; } final Collection<ValueFrequency> valueCounts = res.getValueCounts(); if (valueCounts.size() > 0) { distinctValueCounter += valueCounts.size(); valueCount = valueCounts.iterator().next(); } if (distinctValueCounter > 1) { // more than one distinct value return null; } return valueCount; }
[ "private", "ValueFrequency", "getDistinctValueCount", "(", "final", "ValueCountingAnalyzerResult", "res", ")", "{", "int", "distinctValueCounter", "=", "0", ";", "ValueFrequency", "valueCount", "=", "null", ";", "if", "(", "res", ".", "getNullCount", "(", ")", ">", "0", ")", "{", "distinctValueCounter", "++", ";", "valueCount", "=", "new", "SingleValueFrequency", "(", "LabelUtils", ".", "NULL_LABEL", ",", "res", ".", "getNullCount", "(", ")", ")", ";", "}", "final", "int", "uniqueCount", "=", "res", ".", "getUniqueCount", "(", ")", ";", "if", "(", "uniqueCount", ">", "0", ")", "{", "if", "(", "uniqueCount", ">", "1", ")", "{", "// more than one distinct value", "return", "null", ";", "}", "distinctValueCounter", "++", ";", "final", "Collection", "<", "String", ">", "uniqueValues", "=", "res", ".", "getUniqueValues", "(", ")", ";", "String", "label", "=", "LabelUtils", ".", "UNIQUE_LABEL", ";", "if", "(", "!", "uniqueValues", ".", "isEmpty", "(", ")", ")", "{", "label", "=", "uniqueValues", ".", "iterator", "(", ")", ".", "next", "(", ")", ";", "}", "valueCount", "=", "new", "CompositeValueFrequency", "(", "label", ",", "1", ")", ";", "}", "if", "(", "distinctValueCounter", ">", "1", ")", "{", "// more than one distinct value", "return", "null", ";", "}", "final", "Collection", "<", "ValueFrequency", ">", "valueCounts", "=", "res", ".", "getValueCounts", "(", ")", ";", "if", "(", "valueCounts", ".", "size", "(", ")", ">", "0", ")", "{", "distinctValueCounter", "+=", "valueCounts", ".", "size", "(", ")", ";", "valueCount", "=", "valueCounts", ".", "iterator", "(", ")", ".", "next", "(", ")", ";", "}", "if", "(", "distinctValueCounter", ">", "1", ")", "{", "// more than one distinct value", "return", "null", ";", "}", "return", "valueCount", ";", "}" ]
Determines if a group result has just a single distinct value count. If so, this value count is returned, or else null is returned. @param res @return
[ "Determines", "if", "a", "group", "result", "has", "just", "a", "single", "distinct", "value", "count", ".", "If", "so", "this", "value", "count", "is", "returned", "or", "else", "null", "is", "returned", "." ]
9aa01fdac3560cef51c55df3cb2ac5c690b57639
https://github.com/datacleaner/DataCleaner/blob/9aa01fdac3560cef51c55df3cb2ac5c690b57639/desktop/ui/src/main/java/org/datacleaner/widgets/result/ValueDistributionResultSwingRenderer.java#L138-L175
26,332
datacleaner/DataCleaner
desktop/api/src/main/java/org/datacleaner/widgets/ComboButton.java
ComboButton.getSelectedToggleButton
public JToggleButton getSelectedToggleButton() { for (final AbstractButton button : _buttons) { if (button instanceof JToggleButton) { if (button.isSelected()) { return (JToggleButton) button; } } } return null; }
java
public JToggleButton getSelectedToggleButton() { for (final AbstractButton button : _buttons) { if (button instanceof JToggleButton) { if (button.isSelected()) { return (JToggleButton) button; } } } return null; }
[ "public", "JToggleButton", "getSelectedToggleButton", "(", ")", "{", "for", "(", "final", "AbstractButton", "button", ":", "_buttons", ")", "{", "if", "(", "button", "instanceof", "JToggleButton", ")", "{", "if", "(", "button", ".", "isSelected", "(", ")", ")", "{", "return", "(", "JToggleButton", ")", "button", ";", "}", "}", "}", "return", "null", ";", "}" ]
Gets the currently selected toggle button, if any. @return
[ "Gets", "the", "currently", "selected", "toggle", "button", "if", "any", "." ]
9aa01fdac3560cef51c55df3cb2ac5c690b57639
https://github.com/datacleaner/DataCleaner/blob/9aa01fdac3560cef51c55df3cb2ac5c690b57639/desktop/api/src/main/java/org/datacleaner/widgets/ComboButton.java#L153-L162
26,333
datacleaner/DataCleaner
desktop/api/src/main/java/org/datacleaner/widgets/ComboButton.java
ComboButton.main
public static void main(final String[] args) { LookAndFeelManager.get().init(); final ComboButton comboButton1 = new ComboButton(); comboButton1.addButton("Foo!", IconUtils.ACTION_ADD_DARK, true); comboButton1.addButton("Boo!", IconUtils.ACTION_REMOVE_DARK, true); final ComboButton comboButton2 = new ComboButton(); comboButton2.addButton("Foo!", IconUtils.ACTION_ADD_DARK, false); comboButton2.addButton("Boo!", IconUtils.ACTION_REMOVE_DARK, false); comboButton2.addButton("Mrr!", IconUtils.ACTION_REFRESH, true); comboButton2.addButton("Rrrh!", IconUtils.ACTION_DRILL_TO_DETAIL, true); final DCPanel panel = new DCPanel(WidgetUtils.COLOR_DEFAULT_BACKGROUND); panel.add(comboButton1); panel.add(comboButton2); final JButton regularButton = WidgetFactory.createDefaultButton("Regular button", IconUtils.ACTION_ADD_DARK); panel.add(regularButton); final JFrame frame = new JFrame("test"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setSize(500, 400); frame.add(panel); frame.pack(); frame.setVisible(true); }
java
public static void main(final String[] args) { LookAndFeelManager.get().init(); final ComboButton comboButton1 = new ComboButton(); comboButton1.addButton("Foo!", IconUtils.ACTION_ADD_DARK, true); comboButton1.addButton("Boo!", IconUtils.ACTION_REMOVE_DARK, true); final ComboButton comboButton2 = new ComboButton(); comboButton2.addButton("Foo!", IconUtils.ACTION_ADD_DARK, false); comboButton2.addButton("Boo!", IconUtils.ACTION_REMOVE_DARK, false); comboButton2.addButton("Mrr!", IconUtils.ACTION_REFRESH, true); comboButton2.addButton("Rrrh!", IconUtils.ACTION_DRILL_TO_DETAIL, true); final DCPanel panel = new DCPanel(WidgetUtils.COLOR_DEFAULT_BACKGROUND); panel.add(comboButton1); panel.add(comboButton2); final JButton regularButton = WidgetFactory.createDefaultButton("Regular button", IconUtils.ACTION_ADD_DARK); panel.add(regularButton); final JFrame frame = new JFrame("test"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setSize(500, 400); frame.add(panel); frame.pack(); frame.setVisible(true); }
[ "public", "static", "void", "main", "(", "final", "String", "[", "]", "args", ")", "{", "LookAndFeelManager", ".", "get", "(", ")", ".", "init", "(", ")", ";", "final", "ComboButton", "comboButton1", "=", "new", "ComboButton", "(", ")", ";", "comboButton1", ".", "addButton", "(", "\"Foo!\"", ",", "IconUtils", ".", "ACTION_ADD_DARK", ",", "true", ")", ";", "comboButton1", ".", "addButton", "(", "\"Boo!\"", ",", "IconUtils", ".", "ACTION_REMOVE_DARK", ",", "true", ")", ";", "final", "ComboButton", "comboButton2", "=", "new", "ComboButton", "(", ")", ";", "comboButton2", ".", "addButton", "(", "\"Foo!\"", ",", "IconUtils", ".", "ACTION_ADD_DARK", ",", "false", ")", ";", "comboButton2", ".", "addButton", "(", "\"Boo!\"", ",", "IconUtils", ".", "ACTION_REMOVE_DARK", ",", "false", ")", ";", "comboButton2", ".", "addButton", "(", "\"Mrr!\"", ",", "IconUtils", ".", "ACTION_REFRESH", ",", "true", ")", ";", "comboButton2", ".", "addButton", "(", "\"Rrrh!\"", ",", "IconUtils", ".", "ACTION_DRILL_TO_DETAIL", ",", "true", ")", ";", "final", "DCPanel", "panel", "=", "new", "DCPanel", "(", "WidgetUtils", ".", "COLOR_DEFAULT_BACKGROUND", ")", ";", "panel", ".", "add", "(", "comboButton1", ")", ";", "panel", ".", "add", "(", "comboButton2", ")", ";", "final", "JButton", "regularButton", "=", "WidgetFactory", ".", "createDefaultButton", "(", "\"Regular button\"", ",", "IconUtils", ".", "ACTION_ADD_DARK", ")", ";", "panel", ".", "add", "(", "regularButton", ")", ";", "final", "JFrame", "frame", "=", "new", "JFrame", "(", "\"test\"", ")", ";", "frame", ".", "setDefaultCloseOperation", "(", "JFrame", ".", "EXIT_ON_CLOSE", ")", ";", "frame", ".", "setSize", "(", "500", ",", "400", ")", ";", "frame", ".", "add", "(", "panel", ")", ";", "frame", ".", "pack", "(", ")", ";", "frame", ".", "setVisible", "(", "true", ")", ";", "}" ]
a simple test app
[ "a", "simple", "test", "app" ]
9aa01fdac3560cef51c55df3cb2ac5c690b57639
https://github.com/datacleaner/DataCleaner/blob/9aa01fdac3560cef51c55df3cb2ac5c690b57639/desktop/api/src/main/java/org/datacleaner/widgets/ComboButton.java#L182-L209
26,334
datacleaner/DataCleaner
engine/core/src/main/java/org/datacleaner/job/builder/AbstractComponentBuilder.java
AbstractComponentBuilder.setMetadataProperty
@Override public final void setMetadataProperty(final String key, final String value) { _metadataProperties.put(key, value); }
java
@Override public final void setMetadataProperty(final String key, final String value) { _metadataProperties.put(key, value); }
[ "@", "Override", "public", "final", "void", "setMetadataProperty", "(", "final", "String", "key", ",", "final", "String", "value", ")", "{", "_metadataProperties", ".", "put", "(", "key", ",", "value", ")", ";", "}" ]
Sets a metadata property @param key @param value
[ "Sets", "a", "metadata", "property" ]
9aa01fdac3560cef51c55df3cb2ac5c690b57639
https://github.com/datacleaner/DataCleaner/blob/9aa01fdac3560cef51c55df3cb2ac5c690b57639/engine/core/src/main/java/org/datacleaner/job/builder/AbstractComponentBuilder.java#L183-L186
26,335
datacleaner/DataCleaner
engine/env/spark/src/main/java/org/datacleaner/spark/ApplicationDriver.java
ApplicationDriver.launch
public int launch(final String configurationHdfsPath, final String jobHdfsPath) throws Exception { // create hadoop configuration directory final File hadoopConfDir = createTemporaryHadoopConfDir(); final SparkLauncher sparkLauncher = createSparkLauncher(hadoopConfDir, configurationHdfsPath, jobHdfsPath, null); return launch(sparkLauncher); }
java
public int launch(final String configurationHdfsPath, final String jobHdfsPath) throws Exception { // create hadoop configuration directory final File hadoopConfDir = createTemporaryHadoopConfDir(); final SparkLauncher sparkLauncher = createSparkLauncher(hadoopConfDir, configurationHdfsPath, jobHdfsPath, null); return launch(sparkLauncher); }
[ "public", "int", "launch", "(", "final", "String", "configurationHdfsPath", ",", "final", "String", "jobHdfsPath", ")", "throws", "Exception", "{", "// create hadoop configuration directory", "final", "File", "hadoopConfDir", "=", "createTemporaryHadoopConfDir", "(", ")", ";", "final", "SparkLauncher", "sparkLauncher", "=", "createSparkLauncher", "(", "hadoopConfDir", ",", "configurationHdfsPath", ",", "jobHdfsPath", ",", "null", ")", ";", "return", "launch", "(", "sparkLauncher", ")", ";", "}" ]
Launches and waits for the execution of a DataCleaner job on Spark. @param configurationHdfsPath configuration file path (on HDFS) @param jobHdfsPath job file path (on HDFS) @return the exit code of the spark-submit process @throws Exception
[ "Launches", "and", "waits", "for", "the", "execution", "of", "a", "DataCleaner", "job", "on", "Spark", "." ]
9aa01fdac3560cef51c55df3cb2ac5c690b57639
https://github.com/datacleaner/DataCleaner/blob/9aa01fdac3560cef51c55df3cb2ac5c690b57639/engine/env/spark/src/main/java/org/datacleaner/spark/ApplicationDriver.java#L103-L111
26,336
datacleaner/DataCleaner
engine/xml-config/src/main/java/org/datacleaner/configuration/DomConfigurationWriter.java
DomConfigurationWriter.removeHadoopClusterServerInformation
public boolean removeHadoopClusterServerInformation(final String serverName) { final Element serverInformationCatalogElement = getServerInformationCatalogElement(); final Element hadoopClustersElement = getOrCreateChildElementByTagName(serverInformationCatalogElement, "hadoop-clusters"); return removeChildElementByNameAttribute(serverName, hadoopClustersElement); }
java
public boolean removeHadoopClusterServerInformation(final String serverName) { final Element serverInformationCatalogElement = getServerInformationCatalogElement(); final Element hadoopClustersElement = getOrCreateChildElementByTagName(serverInformationCatalogElement, "hadoop-clusters"); return removeChildElementByNameAttribute(serverName, hadoopClustersElement); }
[ "public", "boolean", "removeHadoopClusterServerInformation", "(", "final", "String", "serverName", ")", "{", "final", "Element", "serverInformationCatalogElement", "=", "getServerInformationCatalogElement", "(", ")", ";", "final", "Element", "hadoopClustersElement", "=", "getOrCreateChildElementByTagName", "(", "serverInformationCatalogElement", ",", "\"hadoop-clusters\"", ")", ";", "return", "removeChildElementByNameAttribute", "(", "serverName", ",", "hadoopClustersElement", ")", ";", "}" ]
Removes a Hadoop cluster by its name, if it exists and is recognizeable by the externalizer. @param serverName @return true if a server information element was removed from the XML document.
[ "Removes", "a", "Hadoop", "cluster", "by", "its", "name", "if", "it", "exists", "and", "is", "recognizeable", "by", "the", "externalizer", "." ]
9aa01fdac3560cef51c55df3cb2ac5c690b57639
https://github.com/datacleaner/DataCleaner/blob/9aa01fdac3560cef51c55df3cb2ac5c690b57639/engine/xml-config/src/main/java/org/datacleaner/configuration/DomConfigurationWriter.java#L217-L222
26,337
datacleaner/DataCleaner
engine/xml-config/src/main/java/org/datacleaner/configuration/DomConfigurationWriter.java
DomConfigurationWriter.getDictionariesElement
public Element getDictionariesElement() { final Element referenceDataCatalogElement = getReferenceDataCatalogElement(); final Element dictionariesElement = getOrCreateChildElementByTagName(referenceDataCatalogElement, "dictionaries"); if (dictionariesElement == null) { throw new IllegalStateException("Could not find <dictionaries> element in configuration file"); } return dictionariesElement; }
java
public Element getDictionariesElement() { final Element referenceDataCatalogElement = getReferenceDataCatalogElement(); final Element dictionariesElement = getOrCreateChildElementByTagName(referenceDataCatalogElement, "dictionaries"); if (dictionariesElement == null) { throw new IllegalStateException("Could not find <dictionaries> element in configuration file"); } return dictionariesElement; }
[ "public", "Element", "getDictionariesElement", "(", ")", "{", "final", "Element", "referenceDataCatalogElement", "=", "getReferenceDataCatalogElement", "(", ")", ";", "final", "Element", "dictionariesElement", "=", "getOrCreateChildElementByTagName", "(", "referenceDataCatalogElement", ",", "\"dictionaries\"", ")", ";", "if", "(", "dictionariesElement", "==", "null", ")", "{", "throw", "new", "IllegalStateException", "(", "\"Could not find <dictionaries> element in configuration file\"", ")", ";", "}", "return", "dictionariesElement", ";", "}" ]
Gets the XML element that represents the dictionaries @return
[ "Gets", "the", "XML", "element", "that", "represents", "the", "dictionaries" ]
9aa01fdac3560cef51c55df3cb2ac5c690b57639
https://github.com/datacleaner/DataCleaner/blob/9aa01fdac3560cef51c55df3cb2ac5c690b57639/engine/xml-config/src/main/java/org/datacleaner/configuration/DomConfigurationWriter.java#L1046-L1055
26,338
datacleaner/DataCleaner
engine/xml-config/src/main/java/org/datacleaner/configuration/DomConfigurationWriter.java
DomConfigurationWriter.getSynonymCatalogsElement
public Element getSynonymCatalogsElement() { final Element referenceDataCatalogElement = getReferenceDataCatalogElement(); final Element synonymCatalogsElement = getOrCreateChildElementByTagName(referenceDataCatalogElement, "synonym-catalogs"); if (synonymCatalogsElement == null) { throw new IllegalStateException("Could not find <synonym-catalogs> element in configuration file"); } return synonymCatalogsElement; }
java
public Element getSynonymCatalogsElement() { final Element referenceDataCatalogElement = getReferenceDataCatalogElement(); final Element synonymCatalogsElement = getOrCreateChildElementByTagName(referenceDataCatalogElement, "synonym-catalogs"); if (synonymCatalogsElement == null) { throw new IllegalStateException("Could not find <synonym-catalogs> element in configuration file"); } return synonymCatalogsElement; }
[ "public", "Element", "getSynonymCatalogsElement", "(", ")", "{", "final", "Element", "referenceDataCatalogElement", "=", "getReferenceDataCatalogElement", "(", ")", ";", "final", "Element", "synonymCatalogsElement", "=", "getOrCreateChildElementByTagName", "(", "referenceDataCatalogElement", ",", "\"synonym-catalogs\"", ")", ";", "if", "(", "synonymCatalogsElement", "==", "null", ")", "{", "throw", "new", "IllegalStateException", "(", "\"Could not find <synonym-catalogs> element in configuration file\"", ")", ";", "}", "return", "synonymCatalogsElement", ";", "}" ]
Gets the XML element that represents the synonym catalogs @return
[ "Gets", "the", "XML", "element", "that", "represents", "the", "synonym", "catalogs" ]
9aa01fdac3560cef51c55df3cb2ac5c690b57639
https://github.com/datacleaner/DataCleaner/blob/9aa01fdac3560cef51c55df3cb2ac5c690b57639/engine/xml-config/src/main/java/org/datacleaner/configuration/DomConfigurationWriter.java#L1062-L1071
26,339
datacleaner/DataCleaner
engine/xml-config/src/main/java/org/datacleaner/configuration/DomConfigurationWriter.java
DomConfigurationWriter.getStringPatternsElement
public Element getStringPatternsElement() { final Element referenceDataCatalogElement = getReferenceDataCatalogElement(); final Element stringPatternsElement = getOrCreateChildElementByTagName(referenceDataCatalogElement, "string-patterns"); if (stringPatternsElement == null) { throw new IllegalStateException("Could not find <string-patterns> element in configuration file"); } return stringPatternsElement; }
java
public Element getStringPatternsElement() { final Element referenceDataCatalogElement = getReferenceDataCatalogElement(); final Element stringPatternsElement = getOrCreateChildElementByTagName(referenceDataCatalogElement, "string-patterns"); if (stringPatternsElement == null) { throw new IllegalStateException("Could not find <string-patterns> element in configuration file"); } return stringPatternsElement; }
[ "public", "Element", "getStringPatternsElement", "(", ")", "{", "final", "Element", "referenceDataCatalogElement", "=", "getReferenceDataCatalogElement", "(", ")", ";", "final", "Element", "stringPatternsElement", "=", "getOrCreateChildElementByTagName", "(", "referenceDataCatalogElement", ",", "\"string-patterns\"", ")", ";", "if", "(", "stringPatternsElement", "==", "null", ")", "{", "throw", "new", "IllegalStateException", "(", "\"Could not find <string-patterns> element in configuration file\"", ")", ";", "}", "return", "stringPatternsElement", ";", "}" ]
Gets the XML element that represents the string patterns @return
[ "Gets", "the", "XML", "element", "that", "represents", "the", "string", "patterns" ]
9aa01fdac3560cef51c55df3cb2ac5c690b57639
https://github.com/datacleaner/DataCleaner/blob/9aa01fdac3560cef51c55df3cb2ac5c690b57639/engine/xml-config/src/main/java/org/datacleaner/configuration/DomConfigurationWriter.java#L1078-L1087
26,340
datacleaner/DataCleaner
desktop/ui/src/main/java/org/datacleaner/panels/fuse/CoalesceUnitPanel.java
CoalesceUnitPanel.setAvailableInputColumns
public void setAvailableInputColumns(final Collection<InputColumn<?>> inputColumns) { final InputColumn<?>[] items = new InputColumn<?>[inputColumns.size() + 1]; int index = 1; for (final InputColumn<?> inputColumn : inputColumns) { items[index] = inputColumn; index++; } final DefaultComboBoxModel<InputColumn<?>> model = new DefaultComboBoxModel<>(items); _comboBox.setModel(model); }
java
public void setAvailableInputColumns(final Collection<InputColumn<?>> inputColumns) { final InputColumn<?>[] items = new InputColumn<?>[inputColumns.size() + 1]; int index = 1; for (final InputColumn<?> inputColumn : inputColumns) { items[index] = inputColumn; index++; } final DefaultComboBoxModel<InputColumn<?>> model = new DefaultComboBoxModel<>(items); _comboBox.setModel(model); }
[ "public", "void", "setAvailableInputColumns", "(", "final", "Collection", "<", "InputColumn", "<", "?", ">", ">", "inputColumns", ")", "{", "final", "InputColumn", "<", "?", ">", "[", "]", "items", "=", "new", "InputColumn", "<", "?", ">", "[", "inputColumns", ".", "size", "(", ")", "+", "1", "]", ";", "int", "index", "=", "1", ";", "for", "(", "final", "InputColumn", "<", "?", ">", "inputColumn", ":", "inputColumns", ")", "{", "items", "[", "index", "]", "=", "inputColumn", ";", "index", "++", ";", "}", "final", "DefaultComboBoxModel", "<", "InputColumn", "<", "?", ">", ">", "model", "=", "new", "DefaultComboBoxModel", "<>", "(", "items", ")", ";", "_comboBox", ".", "setModel", "(", "model", ")", ";", "}" ]
Called by the parent widget to update the list of available columns @param inputColumns
[ "Called", "by", "the", "parent", "widget", "to", "update", "the", "list", "of", "available", "columns" ]
9aa01fdac3560cef51c55df3cb2ac5c690b57639
https://github.com/datacleaner/DataCleaner/blob/9aa01fdac3560cef51c55df3cb2ac5c690b57639/desktop/ui/src/main/java/org/datacleaner/panels/fuse/CoalesceUnitPanel.java#L109-L118
26,341
datacleaner/DataCleaner
engine/core/src/main/java/org/datacleaner/output/csv/CsvOutputWriterFactory.java
CsvOutputWriterFactory.getWriter
public static OutputWriter getWriter(final String filename, final List<InputColumn<?>> columns) { final InputColumn<?>[] columnArray = columns.toArray(new InputColumn<?>[columns.size()]); final String[] headers = new String[columnArray.length]; for (int i = 0; i < headers.length; i++) { headers[i] = columnArray[i].getName(); } return getWriter(filename, headers, ',', '"', '\\', true, columnArray); }
java
public static OutputWriter getWriter(final String filename, final List<InputColumn<?>> columns) { final InputColumn<?>[] columnArray = columns.toArray(new InputColumn<?>[columns.size()]); final String[] headers = new String[columnArray.length]; for (int i = 0; i < headers.length; i++) { headers[i] = columnArray[i].getName(); } return getWriter(filename, headers, ',', '"', '\\', true, columnArray); }
[ "public", "static", "OutputWriter", "getWriter", "(", "final", "String", "filename", ",", "final", "List", "<", "InputColumn", "<", "?", ">", ">", "columns", ")", "{", "final", "InputColumn", "<", "?", ">", "[", "]", "columnArray", "=", "columns", ".", "toArray", "(", "new", "InputColumn", "<", "?", ">", "[", "columns", ".", "size", "(", ")", "]", ")", ";", "final", "String", "[", "]", "headers", "=", "new", "String", "[", "columnArray", ".", "length", "]", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "headers", ".", "length", ";", "i", "++", ")", "{", "headers", "[", "i", "]", "=", "columnArray", "[", "i", "]", ".", "getName", "(", ")", ";", "}", "return", "getWriter", "(", "filename", ",", "headers", ",", "'", "'", ",", "'", "'", ",", "'", "'", ",", "true", ",", "columnArray", ")", ";", "}" ]
Creates a CSV output writer with default configuration @param filename @param columns @return
[ "Creates", "a", "CSV", "output", "writer", "with", "default", "configuration" ]
9aa01fdac3560cef51c55df3cb2ac5c690b57639
https://github.com/datacleaner/DataCleaner/blob/9aa01fdac3560cef51c55df3cb2ac5c690b57639/engine/core/src/main/java/org/datacleaner/output/csv/CsvOutputWriterFactory.java#L47-L54
26,342
datacleaner/DataCleaner
engine/core/src/main/java/org/datacleaner/output/csv/CsvOutputWriterFactory.java
CsvOutputWriterFactory.getWriter
public static OutputWriter getWriter(final String filename, final String[] headers, final char separatorChar, final char quoteChar, final char escapeChar, final boolean includeHeader, final InputColumn<?>... columns) { return getWriter(new FileResource(filename), headers, FileHelper.DEFAULT_ENCODING, separatorChar, quoteChar, escapeChar, includeHeader, columns); }
java
public static OutputWriter getWriter(final String filename, final String[] headers, final char separatorChar, final char quoteChar, final char escapeChar, final boolean includeHeader, final InputColumn<?>... columns) { return getWriter(new FileResource(filename), headers, FileHelper.DEFAULT_ENCODING, separatorChar, quoteChar, escapeChar, includeHeader, columns); }
[ "public", "static", "OutputWriter", "getWriter", "(", "final", "String", "filename", ",", "final", "String", "[", "]", "headers", ",", "final", "char", "separatorChar", ",", "final", "char", "quoteChar", ",", "final", "char", "escapeChar", ",", "final", "boolean", "includeHeader", ",", "final", "InputColumn", "<", "?", ">", "...", "columns", ")", "{", "return", "getWriter", "(", "new", "FileResource", "(", "filename", ")", ",", "headers", ",", "FileHelper", ".", "DEFAULT_ENCODING", ",", "separatorChar", ",", "quoteChar", ",", "escapeChar", ",", "includeHeader", ",", "columns", ")", ";", "}" ]
Creates a CSV output writer @param filename @param headers @param separatorChar @param quoteChar @param escapeChar @param includeHeader @param columns @return
[ "Creates", "a", "CSV", "output", "writer" ]
9aa01fdac3560cef51c55df3cb2ac5c690b57639
https://github.com/datacleaner/DataCleaner/blob/9aa01fdac3560cef51c55df3cb2ac5c690b57639/engine/core/src/main/java/org/datacleaner/output/csv/CsvOutputWriterFactory.java#L68-L72
26,343
datacleaner/DataCleaner
desktop/ui/src/main/java/org/datacleaner/widgets/visualization/JobGraphMouseListener.java
JobGraphMouseListener.onComponentRightClicked
public void onComponentRightClicked(final ComponentBuilder componentBuilder, final MouseEvent me) { final boolean isMultiStream = componentBuilder.getDescriptor().isMultiStreamComponent(); final JPopupMenu popup = new JPopupMenu(); final JMenuItem configureComponentMenuItem = new JMenuItem("Configure ...", ImageManager.get().getImageIcon(IconUtils.MENU_OPTIONS, IconUtils.ICON_SIZE_SMALL)); configureComponentMenuItem.addActionListener(e -> _actions.showConfigurationDialog(componentBuilder)); popup.add(configureComponentMenuItem); if (!isMultiStream && componentBuilder instanceof InputColumnSourceJob || componentBuilder instanceof HasFilterOutcomes) { popup.add(createLinkMenuItem(componentBuilder)); } for (final OutputDataStream dataStream : componentBuilder.getOutputDataStreams()) { final JobGraphLinkPainter.VertexContext vertexContext = new JobGraphLinkPainter.VertexContext(componentBuilder, componentBuilder.getOutputDataStreamJobBuilder(dataStream), dataStream); popup.add(createLinkMenuItem(vertexContext)); } final Icon renameIcon = ImageManager.get().getImageIcon(IconUtils.ACTION_RENAME, IconUtils.ICON_SIZE_SMALL); final JMenuItem renameMenuItem = WidgetFactory.createMenuItem("Rename component", renameIcon); renameMenuItem.addActionListener(new DefaultRenameComponentActionListener(componentBuilder, _graphContext)); popup.add(renameMenuItem); if (!isMultiStream && componentBuilder instanceof TransformerComponentBuilder) { final TransformerComponentBuilder<?> tjb = (TransformerComponentBuilder<?>) componentBuilder; final JMenuItem previewMenuItem = new JMenuItem("Preview data", ImageManager.get().getImageIcon(IconUtils.ACTION_PREVIEW, IconUtils.ICON_SIZE_SMALL)); previewMenuItem.addActionListener(new PreviewTransformedDataActionListener(_windowContext, tjb)); previewMenuItem.setEnabled(componentBuilder.isConfigured()); popup.add(previewMenuItem); } if (ChangeRequirementMenu.isRelevant(componentBuilder)) { popup.add(new ChangeRequirementMenu(componentBuilder)); } popup.addSeparator(); popup.add(new RemoveComponentMenuItem(componentBuilder)); popup.show(_graphContext.getVisualizationViewer(), me.getX(), me.getY()); }
java
public void onComponentRightClicked(final ComponentBuilder componentBuilder, final MouseEvent me) { final boolean isMultiStream = componentBuilder.getDescriptor().isMultiStreamComponent(); final JPopupMenu popup = new JPopupMenu(); final JMenuItem configureComponentMenuItem = new JMenuItem("Configure ...", ImageManager.get().getImageIcon(IconUtils.MENU_OPTIONS, IconUtils.ICON_SIZE_SMALL)); configureComponentMenuItem.addActionListener(e -> _actions.showConfigurationDialog(componentBuilder)); popup.add(configureComponentMenuItem); if (!isMultiStream && componentBuilder instanceof InputColumnSourceJob || componentBuilder instanceof HasFilterOutcomes) { popup.add(createLinkMenuItem(componentBuilder)); } for (final OutputDataStream dataStream : componentBuilder.getOutputDataStreams()) { final JobGraphLinkPainter.VertexContext vertexContext = new JobGraphLinkPainter.VertexContext(componentBuilder, componentBuilder.getOutputDataStreamJobBuilder(dataStream), dataStream); popup.add(createLinkMenuItem(vertexContext)); } final Icon renameIcon = ImageManager.get().getImageIcon(IconUtils.ACTION_RENAME, IconUtils.ICON_SIZE_SMALL); final JMenuItem renameMenuItem = WidgetFactory.createMenuItem("Rename component", renameIcon); renameMenuItem.addActionListener(new DefaultRenameComponentActionListener(componentBuilder, _graphContext)); popup.add(renameMenuItem); if (!isMultiStream && componentBuilder instanceof TransformerComponentBuilder) { final TransformerComponentBuilder<?> tjb = (TransformerComponentBuilder<?>) componentBuilder; final JMenuItem previewMenuItem = new JMenuItem("Preview data", ImageManager.get().getImageIcon(IconUtils.ACTION_PREVIEW, IconUtils.ICON_SIZE_SMALL)); previewMenuItem.addActionListener(new PreviewTransformedDataActionListener(_windowContext, tjb)); previewMenuItem.setEnabled(componentBuilder.isConfigured()); popup.add(previewMenuItem); } if (ChangeRequirementMenu.isRelevant(componentBuilder)) { popup.add(new ChangeRequirementMenu(componentBuilder)); } popup.addSeparator(); popup.add(new RemoveComponentMenuItem(componentBuilder)); popup.show(_graphContext.getVisualizationViewer(), me.getX(), me.getY()); }
[ "public", "void", "onComponentRightClicked", "(", "final", "ComponentBuilder", "componentBuilder", ",", "final", "MouseEvent", "me", ")", "{", "final", "boolean", "isMultiStream", "=", "componentBuilder", ".", "getDescriptor", "(", ")", ".", "isMultiStreamComponent", "(", ")", ";", "final", "JPopupMenu", "popup", "=", "new", "JPopupMenu", "(", ")", ";", "final", "JMenuItem", "configureComponentMenuItem", "=", "new", "JMenuItem", "(", "\"Configure ...\"", ",", "ImageManager", ".", "get", "(", ")", ".", "getImageIcon", "(", "IconUtils", ".", "MENU_OPTIONS", ",", "IconUtils", ".", "ICON_SIZE_SMALL", ")", ")", ";", "configureComponentMenuItem", ".", "addActionListener", "(", "e", "->", "_actions", ".", "showConfigurationDialog", "(", "componentBuilder", ")", ")", ";", "popup", ".", "add", "(", "configureComponentMenuItem", ")", ";", "if", "(", "!", "isMultiStream", "&&", "componentBuilder", "instanceof", "InputColumnSourceJob", "||", "componentBuilder", "instanceof", "HasFilterOutcomes", ")", "{", "popup", ".", "add", "(", "createLinkMenuItem", "(", "componentBuilder", ")", ")", ";", "}", "for", "(", "final", "OutputDataStream", "dataStream", ":", "componentBuilder", ".", "getOutputDataStreams", "(", ")", ")", "{", "final", "JobGraphLinkPainter", ".", "VertexContext", "vertexContext", "=", "new", "JobGraphLinkPainter", ".", "VertexContext", "(", "componentBuilder", ",", "componentBuilder", ".", "getOutputDataStreamJobBuilder", "(", "dataStream", ")", ",", "dataStream", ")", ";", "popup", ".", "add", "(", "createLinkMenuItem", "(", "vertexContext", ")", ")", ";", "}", "final", "Icon", "renameIcon", "=", "ImageManager", ".", "get", "(", ")", ".", "getImageIcon", "(", "IconUtils", ".", "ACTION_RENAME", ",", "IconUtils", ".", "ICON_SIZE_SMALL", ")", ";", "final", "JMenuItem", "renameMenuItem", "=", "WidgetFactory", ".", "createMenuItem", "(", "\"Rename component\"", ",", "renameIcon", ")", ";", "renameMenuItem", ".", "addActionListener", "(", "new", "DefaultRenameComponentActionListener", "(", "componentBuilder", ",", "_graphContext", ")", ")", ";", "popup", ".", "add", "(", "renameMenuItem", ")", ";", "if", "(", "!", "isMultiStream", "&&", "componentBuilder", "instanceof", "TransformerComponentBuilder", ")", "{", "final", "TransformerComponentBuilder", "<", "?", ">", "tjb", "=", "(", "TransformerComponentBuilder", "<", "?", ">", ")", "componentBuilder", ";", "final", "JMenuItem", "previewMenuItem", "=", "new", "JMenuItem", "(", "\"Preview data\"", ",", "ImageManager", ".", "get", "(", ")", ".", "getImageIcon", "(", "IconUtils", ".", "ACTION_PREVIEW", ",", "IconUtils", ".", "ICON_SIZE_SMALL", ")", ")", ";", "previewMenuItem", ".", "addActionListener", "(", "new", "PreviewTransformedDataActionListener", "(", "_windowContext", ",", "tjb", ")", ")", ";", "previewMenuItem", ".", "setEnabled", "(", "componentBuilder", ".", "isConfigured", "(", ")", ")", ";", "popup", ".", "add", "(", "previewMenuItem", ")", ";", "}", "if", "(", "ChangeRequirementMenu", ".", "isRelevant", "(", "componentBuilder", ")", ")", "{", "popup", ".", "add", "(", "new", "ChangeRequirementMenu", "(", "componentBuilder", ")", ")", ";", "}", "popup", ".", "addSeparator", "(", ")", ";", "popup", ".", "add", "(", "new", "RemoveComponentMenuItem", "(", "componentBuilder", ")", ")", ";", "popup", ".", "show", "(", "_graphContext", ".", "getVisualizationViewer", "(", ")", ",", "me", ".", "getX", "(", ")", ",", "me", ".", "getY", "(", ")", ")", ";", "}" ]
Invoked when a component is right-clicked @param componentBuilder @param me
[ "Invoked", "when", "a", "component", "is", "right", "-", "clicked" ]
9aa01fdac3560cef51c55df3cb2ac5c690b57639
https://github.com/datacleaner/DataCleaner/blob/9aa01fdac3560cef51c55df3cb2ac5c690b57639/desktop/ui/src/main/java/org/datacleaner/widgets/visualization/JobGraphMouseListener.java#L144-L186
26,344
datacleaner/DataCleaner
desktop/ui/src/main/java/org/datacleaner/widgets/visualization/JobGraphMouseListener.java
JobGraphMouseListener.onCanvasRightClicked
public void onCanvasRightClicked(final MouseEvent me) { _linkPainter.cancelLink(); final JPopupMenu popup = new JPopupMenu(); final Point point = me.getPoint(); final AnalysisJobBuilder analysisJobBuilder = _graphContext.getMainAnalysisJobBuilder(); final DataCleanerConfiguration configuration = analysisJobBuilder.getConfiguration(); // add component options final Set<ComponentSuperCategory> superCategories = configuration.getEnvironment().getDescriptorProvider().getComponentSuperCategories(); for (final ComponentSuperCategory superCategory : superCategories) { final DescriptorMenuBuilder menuBuilder = new DescriptorMenuBuilder(analysisJobBuilder, superCategory, point); final JMenu menu = new JMenu(superCategory.getName()); menu.setIcon(IconUtils.getComponentSuperCategoryIcon(superCategory, IconUtils.ICON_SIZE_MENU_ITEM)); menuBuilder.addItemsToMenu(menu); popup.add(menu); } // add (datastore and job) metadata option { final JMenuItem menuItem = WidgetFactory.createMenuItem("Job metadata", IconUtils.MODEL_METADATA); menuItem.addActionListener(e -> { final MetadataDialog dialog = new MetadataDialog(_windowContext, analysisJobBuilder); dialog.open(); }); popup.add(menuItem); } popup.show(_graphContext.getVisualizationViewer(), me.getX(), me.getY()); }
java
public void onCanvasRightClicked(final MouseEvent me) { _linkPainter.cancelLink(); final JPopupMenu popup = new JPopupMenu(); final Point point = me.getPoint(); final AnalysisJobBuilder analysisJobBuilder = _graphContext.getMainAnalysisJobBuilder(); final DataCleanerConfiguration configuration = analysisJobBuilder.getConfiguration(); // add component options final Set<ComponentSuperCategory> superCategories = configuration.getEnvironment().getDescriptorProvider().getComponentSuperCategories(); for (final ComponentSuperCategory superCategory : superCategories) { final DescriptorMenuBuilder menuBuilder = new DescriptorMenuBuilder(analysisJobBuilder, superCategory, point); final JMenu menu = new JMenu(superCategory.getName()); menu.setIcon(IconUtils.getComponentSuperCategoryIcon(superCategory, IconUtils.ICON_SIZE_MENU_ITEM)); menuBuilder.addItemsToMenu(menu); popup.add(menu); } // add (datastore and job) metadata option { final JMenuItem menuItem = WidgetFactory.createMenuItem("Job metadata", IconUtils.MODEL_METADATA); menuItem.addActionListener(e -> { final MetadataDialog dialog = new MetadataDialog(_windowContext, analysisJobBuilder); dialog.open(); }); popup.add(menuItem); } popup.show(_graphContext.getVisualizationViewer(), me.getX(), me.getY()); }
[ "public", "void", "onCanvasRightClicked", "(", "final", "MouseEvent", "me", ")", "{", "_linkPainter", ".", "cancelLink", "(", ")", ";", "final", "JPopupMenu", "popup", "=", "new", "JPopupMenu", "(", ")", ";", "final", "Point", "point", "=", "me", ".", "getPoint", "(", ")", ";", "final", "AnalysisJobBuilder", "analysisJobBuilder", "=", "_graphContext", ".", "getMainAnalysisJobBuilder", "(", ")", ";", "final", "DataCleanerConfiguration", "configuration", "=", "analysisJobBuilder", ".", "getConfiguration", "(", ")", ";", "// add component options", "final", "Set", "<", "ComponentSuperCategory", ">", "superCategories", "=", "configuration", ".", "getEnvironment", "(", ")", ".", "getDescriptorProvider", "(", ")", ".", "getComponentSuperCategories", "(", ")", ";", "for", "(", "final", "ComponentSuperCategory", "superCategory", ":", "superCategories", ")", "{", "final", "DescriptorMenuBuilder", "menuBuilder", "=", "new", "DescriptorMenuBuilder", "(", "analysisJobBuilder", ",", "superCategory", ",", "point", ")", ";", "final", "JMenu", "menu", "=", "new", "JMenu", "(", "superCategory", ".", "getName", "(", ")", ")", ";", "menu", ".", "setIcon", "(", "IconUtils", ".", "getComponentSuperCategoryIcon", "(", "superCategory", ",", "IconUtils", ".", "ICON_SIZE_MENU_ITEM", ")", ")", ";", "menuBuilder", ".", "addItemsToMenu", "(", "menu", ")", ";", "popup", ".", "add", "(", "menu", ")", ";", "}", "// add (datastore and job) metadata option", "{", "final", "JMenuItem", "menuItem", "=", "WidgetFactory", ".", "createMenuItem", "(", "\"Job metadata\"", ",", "IconUtils", ".", "MODEL_METADATA", ")", ";", "menuItem", ".", "addActionListener", "(", "e", "->", "{", "final", "MetadataDialog", "dialog", "=", "new", "MetadataDialog", "(", "_windowContext", ",", "analysisJobBuilder", ")", ";", "dialog", ".", "open", "(", ")", ";", "}", ")", ";", "popup", ".", "add", "(", "menuItem", ")", ";", "}", "popup", ".", "show", "(", "_graphContext", ".", "getVisualizationViewer", "(", ")", ",", "me", ".", "getX", "(", ")", ",", "me", ".", "getY", "(", ")", ")", ";", "}" ]
Invoked when the canvas is right-clicked @param me
[ "Invoked", "when", "the", "canvas", "is", "right", "-", "clicked" ]
9aa01fdac3560cef51c55df3cb2ac5c690b57639
https://github.com/datacleaner/DataCleaner/blob/9aa01fdac3560cef51c55df3cb2ac5c690b57639/desktop/ui/src/main/java/org/datacleaner/widgets/visualization/JobGraphMouseListener.java#L213-L246
26,345
datacleaner/DataCleaner
desktop/api/src/main/java/org/datacleaner/widgets/table/DCTable.java
DCTable.copyToClipboard
public void copyToClipboard(final int rowIndex, final int colIndex, final int width, final int height) { final StringBuilder sb = new StringBuilder(); if (rowIndex == 0 && colIndex == 0 && width == getColumnCount() && height == getRowCount()) { for (int i = 0; i < width; i++) { sb.append(getColumnName(i)); if (i < height - 1) { sb.append("\t"); } } sb.append("\n"); } for (int row = rowIndex; row < rowIndex + height; row++) { for (int col = colIndex; col < colIndex + width; col++) { Object value = getValueAt(row, col); if (value == null) { value = ""; } else if (value instanceof JComponent) { value = WidgetUtils.extractText((JComponent) value); } sb.append(value); sb.append("\t"); } sb.deleteCharAt(sb.length() - 1); sb.append("\n"); } final Clipboard clipboard = Toolkit.getDefaultToolkit().getSystemClipboard(); final StringSelection stsel = new StringSelection(sb.toString()); clipboard.setContents(stsel, stsel); }
java
public void copyToClipboard(final int rowIndex, final int colIndex, final int width, final int height) { final StringBuilder sb = new StringBuilder(); if (rowIndex == 0 && colIndex == 0 && width == getColumnCount() && height == getRowCount()) { for (int i = 0; i < width; i++) { sb.append(getColumnName(i)); if (i < height - 1) { sb.append("\t"); } } sb.append("\n"); } for (int row = rowIndex; row < rowIndex + height; row++) { for (int col = colIndex; col < colIndex + width; col++) { Object value = getValueAt(row, col); if (value == null) { value = ""; } else if (value instanceof JComponent) { value = WidgetUtils.extractText((JComponent) value); } sb.append(value); sb.append("\t"); } sb.deleteCharAt(sb.length() - 1); sb.append("\n"); } final Clipboard clipboard = Toolkit.getDefaultToolkit().getSystemClipboard(); final StringSelection stsel = new StringSelection(sb.toString()); clipboard.setContents(stsel, stsel); }
[ "public", "void", "copyToClipboard", "(", "final", "int", "rowIndex", ",", "final", "int", "colIndex", ",", "final", "int", "width", ",", "final", "int", "height", ")", "{", "final", "StringBuilder", "sb", "=", "new", "StringBuilder", "(", ")", ";", "if", "(", "rowIndex", "==", "0", "&&", "colIndex", "==", "0", "&&", "width", "==", "getColumnCount", "(", ")", "&&", "height", "==", "getRowCount", "(", ")", ")", "{", "for", "(", "int", "i", "=", "0", ";", "i", "<", "width", ";", "i", "++", ")", "{", "sb", ".", "append", "(", "getColumnName", "(", "i", ")", ")", ";", "if", "(", "i", "<", "height", "-", "1", ")", "{", "sb", ".", "append", "(", "\"\\t\"", ")", ";", "}", "}", "sb", ".", "append", "(", "\"\\n\"", ")", ";", "}", "for", "(", "int", "row", "=", "rowIndex", ";", "row", "<", "rowIndex", "+", "height", ";", "row", "++", ")", "{", "for", "(", "int", "col", "=", "colIndex", ";", "col", "<", "colIndex", "+", "width", ";", "col", "++", ")", "{", "Object", "value", "=", "getValueAt", "(", "row", ",", "col", ")", ";", "if", "(", "value", "==", "null", ")", "{", "value", "=", "\"\"", ";", "}", "else", "if", "(", "value", "instanceof", "JComponent", ")", "{", "value", "=", "WidgetUtils", ".", "extractText", "(", "(", "JComponent", ")", "value", ")", ";", "}", "sb", ".", "append", "(", "value", ")", ";", "sb", ".", "append", "(", "\"\\t\"", ")", ";", "}", "sb", ".", "deleteCharAt", "(", "sb", ".", "length", "(", ")", "-", "1", ")", ";", "sb", ".", "append", "(", "\"\\n\"", ")", ";", "}", "final", "Clipboard", "clipboard", "=", "Toolkit", ".", "getDefaultToolkit", "(", ")", ".", "getSystemClipboard", "(", ")", ";", "final", "StringSelection", "stsel", "=", "new", "StringSelection", "(", "sb", ".", "toString", "(", ")", ")", ";", "clipboard", ".", "setContents", "(", "stsel", ",", "stsel", ")", ";", "}" ]
Copies content from the table to the clipboard. Algorithm is a slight rewrite of the article below. @see <a href="http://www.copy--paste.org/copy-paste-jtables-excel.htm">http://www.copy--paste.org/copy-paste-jtables-excel.htm</a>
[ "Copies", "content", "from", "the", "table", "to", "the", "clipboard", ".", "Algorithm", "is", "a", "slight", "rewrite", "of", "the", "article", "below", "." ]
9aa01fdac3560cef51c55df3cb2ac5c690b57639
https://github.com/datacleaner/DataCleaner/blob/9aa01fdac3560cef51c55df3cb2ac5c690b57639/desktop/api/src/main/java/org/datacleaner/widgets/table/DCTable.java#L210-L240
26,346
datacleaner/DataCleaner
components/pattern-finder/src/main/java/org/datacleaner/beans/stringpattern/PatternFinder.java
PatternFinder.run
public void run(final R row, final String value, final int distinctCount) { final List<Token> tokens; try { tokens = _tokenizer.tokenize(value); } catch (final RuntimeException e) { throw new IllegalStateException("Error occurred while tokenizing value: " + value, e); } final String patternCode = getPatternCode(tokens); final Collection<TokenPattern> patterns = getOrCreatePatterns(patternCode); // lock on "patterns" since it is going to be the same collection for // all matching pattern codes. synchronized (patterns) { boolean match = false; for (final TokenPattern pattern : patterns) { if (pattern.match(tokens)) { storeMatch(pattern, row, value, distinctCount); match = true; break; } } if (!match) { final TokenPattern pattern; try { pattern = new TokenPatternImpl(value, tokens, _configuration); } catch (final RuntimeException e) { throw new IllegalStateException("Error occurred while creating pattern for: " + tokens, e); } storeNewPattern(pattern, row, value, distinctCount); patterns.add(pattern); } } }
java
public void run(final R row, final String value, final int distinctCount) { final List<Token> tokens; try { tokens = _tokenizer.tokenize(value); } catch (final RuntimeException e) { throw new IllegalStateException("Error occurred while tokenizing value: " + value, e); } final String patternCode = getPatternCode(tokens); final Collection<TokenPattern> patterns = getOrCreatePatterns(patternCode); // lock on "patterns" since it is going to be the same collection for // all matching pattern codes. synchronized (patterns) { boolean match = false; for (final TokenPattern pattern : patterns) { if (pattern.match(tokens)) { storeMatch(pattern, row, value, distinctCount); match = true; break; } } if (!match) { final TokenPattern pattern; try { pattern = new TokenPatternImpl(value, tokens, _configuration); } catch (final RuntimeException e) { throw new IllegalStateException("Error occurred while creating pattern for: " + tokens, e); } storeNewPattern(pattern, row, value, distinctCount); patterns.add(pattern); } } }
[ "public", "void", "run", "(", "final", "R", "row", ",", "final", "String", "value", ",", "final", "int", "distinctCount", ")", "{", "final", "List", "<", "Token", ">", "tokens", ";", "try", "{", "tokens", "=", "_tokenizer", ".", "tokenize", "(", "value", ")", ";", "}", "catch", "(", "final", "RuntimeException", "e", ")", "{", "throw", "new", "IllegalStateException", "(", "\"Error occurred while tokenizing value: \"", "+", "value", ",", "e", ")", ";", "}", "final", "String", "patternCode", "=", "getPatternCode", "(", "tokens", ")", ";", "final", "Collection", "<", "TokenPattern", ">", "patterns", "=", "getOrCreatePatterns", "(", "patternCode", ")", ";", "// lock on \"patterns\" since it is going to be the same collection for", "// all matching pattern codes.", "synchronized", "(", "patterns", ")", "{", "boolean", "match", "=", "false", ";", "for", "(", "final", "TokenPattern", "pattern", ":", "patterns", ")", "{", "if", "(", "pattern", ".", "match", "(", "tokens", ")", ")", "{", "storeMatch", "(", "pattern", ",", "row", ",", "value", ",", "distinctCount", ")", ";", "match", "=", "true", ";", "break", ";", "}", "}", "if", "(", "!", "match", ")", "{", "final", "TokenPattern", "pattern", ";", "try", "{", "pattern", "=", "new", "TokenPatternImpl", "(", "value", ",", "tokens", ",", "_configuration", ")", ";", "}", "catch", "(", "final", "RuntimeException", "e", ")", "{", "throw", "new", "IllegalStateException", "(", "\"Error occurred while creating pattern for: \"", "+", "tokens", ",", "e", ")", ";", "}", "storeNewPattern", "(", "pattern", ",", "row", ",", "value", ",", "distinctCount", ")", ";", "patterns", ".", "add", "(", "pattern", ")", ";", "}", "}", "}" ]
This method should be invoked by the user of the PatternFinder. Invoke it for each value in your dataset. Repeated values are handled correctly but if available it is more efficient to handle only the distinct values and their corresponding distinct counts. @param row the row containing the value @param value the string value to be tokenized and matched against other patterns @param distinctCount the count of the value
[ "This", "method", "should", "be", "invoked", "by", "the", "user", "of", "the", "PatternFinder", ".", "Invoke", "it", "for", "each", "value", "in", "your", "dataset", ".", "Repeated", "values", "are", "handled", "correctly", "but", "if", "available", "it", "is", "more", "efficient", "to", "handle", "only", "the", "distinct", "values", "and", "their", "corresponding", "distinct", "counts", "." ]
9aa01fdac3560cef51c55df3cb2ac5c690b57639
https://github.com/datacleaner/DataCleaner/blob/9aa01fdac3560cef51c55df3cb2ac5c690b57639/components/pattern-finder/src/main/java/org/datacleaner/beans/stringpattern/PatternFinder.java#L71-L106
26,347
datacleaner/DataCleaner
components/pattern-finder/src/main/java/org/datacleaner/beans/stringpattern/PatternFinder.java
PatternFinder.getPatternCode
private String getPatternCode(final List<Token> tokens) { final StringBuilder sb = new StringBuilder(); sb.append(tokens.size()); for (final Token token : tokens) { sb.append(token.getType().ordinal()); } return sb.toString(); }
java
private String getPatternCode(final List<Token> tokens) { final StringBuilder sb = new StringBuilder(); sb.append(tokens.size()); for (final Token token : tokens) { sb.append(token.getType().ordinal()); } return sb.toString(); }
[ "private", "String", "getPatternCode", "(", "final", "List", "<", "Token", ">", "tokens", ")", "{", "final", "StringBuilder", "sb", "=", "new", "StringBuilder", "(", ")", ";", "sb", ".", "append", "(", "tokens", ".", "size", "(", ")", ")", ";", "for", "(", "final", "Token", "token", ":", "tokens", ")", "{", "sb", ".", "append", "(", "token", ".", "getType", "(", ")", ".", "ordinal", "(", ")", ")", ";", "}", "return", "sb", ".", "toString", "(", ")", ";", "}" ]
Creates an almost unique String code for a list of tokens. This code is used to improve search time when looking for potential matching patterns. @param tokens @return
[ "Creates", "an", "almost", "unique", "String", "code", "for", "a", "list", "of", "tokens", ".", "This", "code", "is", "used", "to", "improve", "search", "time", "when", "looking", "for", "potential", "matching", "patterns", "." ]
9aa01fdac3560cef51c55df3cb2ac5c690b57639
https://github.com/datacleaner/DataCleaner/blob/9aa01fdac3560cef51c55df3cb2ac5c690b57639/components/pattern-finder/src/main/java/org/datacleaner/beans/stringpattern/PatternFinder.java#L138-L145
26,348
datacleaner/DataCleaner
desktop/ui/src/main/java/org/datacleaner/connection/DatastoreDescriptors.java
DatastoreDescriptors.getAvailableDatastoreDescriptors
public List<DatastoreDescriptor> getAvailableDatastoreDescriptors() { final List<DatastoreDescriptor> availableDatabaseDescriptors = new ArrayList<>(); final List<DatastoreDescriptor> manualDatastoreDescriptors = getManualDatastoreDescriptors(); availableDatabaseDescriptors.addAll(manualDatastoreDescriptors); final List<DatastoreDescriptor> driverBasedDatastoreDescriptors = getDriverBasedDatastoreDescriptors(); availableDatabaseDescriptors.addAll(driverBasedDatastoreDescriptors); final Set<String> alreadyAddedDatabaseNames = new HashSet<>(); for (final DatastoreDescriptor datastoreDescriptor : driverBasedDatastoreDescriptors) { alreadyAddedDatabaseNames.add(datastoreDescriptor.getName()); } final List<DatastoreDescriptor> otherDatastoreDescriptors = getOtherDatastoreDescriptors(alreadyAddedDatabaseNames); availableDatabaseDescriptors.addAll(otherDatastoreDescriptors); return availableDatabaseDescriptors; }
java
public List<DatastoreDescriptor> getAvailableDatastoreDescriptors() { final List<DatastoreDescriptor> availableDatabaseDescriptors = new ArrayList<>(); final List<DatastoreDescriptor> manualDatastoreDescriptors = getManualDatastoreDescriptors(); availableDatabaseDescriptors.addAll(manualDatastoreDescriptors); final List<DatastoreDescriptor> driverBasedDatastoreDescriptors = getDriverBasedDatastoreDescriptors(); availableDatabaseDescriptors.addAll(driverBasedDatastoreDescriptors); final Set<String> alreadyAddedDatabaseNames = new HashSet<>(); for (final DatastoreDescriptor datastoreDescriptor : driverBasedDatastoreDescriptors) { alreadyAddedDatabaseNames.add(datastoreDescriptor.getName()); } final List<DatastoreDescriptor> otherDatastoreDescriptors = getOtherDatastoreDescriptors(alreadyAddedDatabaseNames); availableDatabaseDescriptors.addAll(otherDatastoreDescriptors); return availableDatabaseDescriptors; }
[ "public", "List", "<", "DatastoreDescriptor", ">", "getAvailableDatastoreDescriptors", "(", ")", "{", "final", "List", "<", "DatastoreDescriptor", ">", "availableDatabaseDescriptors", "=", "new", "ArrayList", "<>", "(", ")", ";", "final", "List", "<", "DatastoreDescriptor", ">", "manualDatastoreDescriptors", "=", "getManualDatastoreDescriptors", "(", ")", ";", "availableDatabaseDescriptors", ".", "addAll", "(", "manualDatastoreDescriptors", ")", ";", "final", "List", "<", "DatastoreDescriptor", ">", "driverBasedDatastoreDescriptors", "=", "getDriverBasedDatastoreDescriptors", "(", ")", ";", "availableDatabaseDescriptors", ".", "addAll", "(", "driverBasedDatastoreDescriptors", ")", ";", "final", "Set", "<", "String", ">", "alreadyAddedDatabaseNames", "=", "new", "HashSet", "<>", "(", ")", ";", "for", "(", "final", "DatastoreDescriptor", "datastoreDescriptor", ":", "driverBasedDatastoreDescriptors", ")", "{", "alreadyAddedDatabaseNames", ".", "add", "(", "datastoreDescriptor", ".", "getName", "(", ")", ")", ";", "}", "final", "List", "<", "DatastoreDescriptor", ">", "otherDatastoreDescriptors", "=", "getOtherDatastoreDescriptors", "(", "alreadyAddedDatabaseNames", ")", ";", "availableDatabaseDescriptors", ".", "addAll", "(", "otherDatastoreDescriptors", ")", ";", "return", "availableDatabaseDescriptors", ";", "}" ]
Returns the descriptors of datastore types available in DataCleaner.
[ "Returns", "the", "descriptors", "of", "datastore", "types", "available", "in", "DataCleaner", "." ]
9aa01fdac3560cef51c55df3cb2ac5c690b57639
https://github.com/datacleaner/DataCleaner/blob/9aa01fdac3560cef51c55df3cb2ac5c690b57639/desktop/ui/src/main/java/org/datacleaner/connection/DatastoreDescriptors.java#L168-L187
26,349
datacleaner/DataCleaner
desktop/ui/src/main/java/org/datacleaner/connection/DatastoreDescriptors.java
DatastoreDescriptors.getAvailableCloudBasedDatastoreDescriptors
public List<DatastoreDescriptor> getAvailableCloudBasedDatastoreDescriptors() { final List<DatastoreDescriptor> availableCloudBasedDatabaseDescriptors = new ArrayList<>(); availableCloudBasedDatabaseDescriptors.add(SALESFORCE_DATASTORE_DESCRIPTOR); availableCloudBasedDatabaseDescriptors.add(SUGARCRM_DATASTORE_DESCRIPTOR); return availableCloudBasedDatabaseDescriptors; }
java
public List<DatastoreDescriptor> getAvailableCloudBasedDatastoreDescriptors() { final List<DatastoreDescriptor> availableCloudBasedDatabaseDescriptors = new ArrayList<>(); availableCloudBasedDatabaseDescriptors.add(SALESFORCE_DATASTORE_DESCRIPTOR); availableCloudBasedDatabaseDescriptors.add(SUGARCRM_DATASTORE_DESCRIPTOR); return availableCloudBasedDatabaseDescriptors; }
[ "public", "List", "<", "DatastoreDescriptor", ">", "getAvailableCloudBasedDatastoreDescriptors", "(", ")", "{", "final", "List", "<", "DatastoreDescriptor", ">", "availableCloudBasedDatabaseDescriptors", "=", "new", "ArrayList", "<>", "(", ")", ";", "availableCloudBasedDatabaseDescriptors", ".", "add", "(", "SALESFORCE_DATASTORE_DESCRIPTOR", ")", ";", "availableCloudBasedDatabaseDescriptors", ".", "add", "(", "SUGARCRM_DATASTORE_DESCRIPTOR", ")", ";", "return", "availableCloudBasedDatabaseDescriptors", ";", "}" ]
Returns the descriptors of cloud-based datastore types available in DataCleaner.
[ "Returns", "the", "descriptors", "of", "cloud", "-", "based", "datastore", "types", "available", "in", "DataCleaner", "." ]
9aa01fdac3560cef51c55df3cb2ac5c690b57639
https://github.com/datacleaner/DataCleaner/blob/9aa01fdac3560cef51c55df3cb2ac5c690b57639/desktop/ui/src/main/java/org/datacleaner/connection/DatastoreDescriptors.java#L192-L198
26,350
datacleaner/DataCleaner
desktop/ui/src/main/java/org/datacleaner/connection/DatastoreDescriptors.java
DatastoreDescriptors.getAvailableDatabaseBasedDatastoreDescriptors
public List<DatastoreDescriptor> getAvailableDatabaseBasedDatastoreDescriptors() { final List<DatastoreDescriptor> availableCloudBasedDatabaseDescriptors = new ArrayList<>(); availableCloudBasedDatabaseDescriptors.add(POSTGRESQL_DATASTORE_DESCRIPTOR); availableCloudBasedDatabaseDescriptors.add(SQLSERVER_DATASTORE_DESCRIPTOR); availableCloudBasedDatabaseDescriptors.add(ELASTICSEARCH_DATASTORE_DESCRIPTOR); availableCloudBasedDatabaseDescriptors.add(HBASE_DATASTORE_DESCRIPTOR); availableCloudBasedDatabaseDescriptors.add(HIVE_DATASTORE_DESCRIPTOR); availableCloudBasedDatabaseDescriptors.add(CASSANDRA_DATASTORE_DESCRIPTOR); availableCloudBasedDatabaseDescriptors.add(MONGODB_DATASTORE_DESCRIPTOR); availableCloudBasedDatabaseDescriptors.add(COUCHDB_DATASTORE_DESCRIPTOR); availableCloudBasedDatabaseDescriptors.add(DYNAMODB_DATASTORE_DESCRIPTOR); availableCloudBasedDatabaseDescriptors.add(KAFKA_DATASTORE_DESCRIPTOR); availableCloudBasedDatabaseDescriptors.add(NEO4J_DATASTORE_DESCRIPTOR); return availableCloudBasedDatabaseDescriptors; }
java
public List<DatastoreDescriptor> getAvailableDatabaseBasedDatastoreDescriptors() { final List<DatastoreDescriptor> availableCloudBasedDatabaseDescriptors = new ArrayList<>(); availableCloudBasedDatabaseDescriptors.add(POSTGRESQL_DATASTORE_DESCRIPTOR); availableCloudBasedDatabaseDescriptors.add(SQLSERVER_DATASTORE_DESCRIPTOR); availableCloudBasedDatabaseDescriptors.add(ELASTICSEARCH_DATASTORE_DESCRIPTOR); availableCloudBasedDatabaseDescriptors.add(HBASE_DATASTORE_DESCRIPTOR); availableCloudBasedDatabaseDescriptors.add(HIVE_DATASTORE_DESCRIPTOR); availableCloudBasedDatabaseDescriptors.add(CASSANDRA_DATASTORE_DESCRIPTOR); availableCloudBasedDatabaseDescriptors.add(MONGODB_DATASTORE_DESCRIPTOR); availableCloudBasedDatabaseDescriptors.add(COUCHDB_DATASTORE_DESCRIPTOR); availableCloudBasedDatabaseDescriptors.add(DYNAMODB_DATASTORE_DESCRIPTOR); availableCloudBasedDatabaseDescriptors.add(KAFKA_DATASTORE_DESCRIPTOR); availableCloudBasedDatabaseDescriptors.add(NEO4J_DATASTORE_DESCRIPTOR); return availableCloudBasedDatabaseDescriptors; }
[ "public", "List", "<", "DatastoreDescriptor", ">", "getAvailableDatabaseBasedDatastoreDescriptors", "(", ")", "{", "final", "List", "<", "DatastoreDescriptor", ">", "availableCloudBasedDatabaseDescriptors", "=", "new", "ArrayList", "<>", "(", ")", ";", "availableCloudBasedDatabaseDescriptors", ".", "add", "(", "POSTGRESQL_DATASTORE_DESCRIPTOR", ")", ";", "availableCloudBasedDatabaseDescriptors", ".", "add", "(", "SQLSERVER_DATASTORE_DESCRIPTOR", ")", ";", "availableCloudBasedDatabaseDescriptors", ".", "add", "(", "ELASTICSEARCH_DATASTORE_DESCRIPTOR", ")", ";", "availableCloudBasedDatabaseDescriptors", ".", "add", "(", "HBASE_DATASTORE_DESCRIPTOR", ")", ";", "availableCloudBasedDatabaseDescriptors", ".", "add", "(", "HIVE_DATASTORE_DESCRIPTOR", ")", ";", "availableCloudBasedDatabaseDescriptors", ".", "add", "(", "CASSANDRA_DATASTORE_DESCRIPTOR", ")", ";", "availableCloudBasedDatabaseDescriptors", ".", "add", "(", "MONGODB_DATASTORE_DESCRIPTOR", ")", ";", "availableCloudBasedDatabaseDescriptors", ".", "add", "(", "COUCHDB_DATASTORE_DESCRIPTOR", ")", ";", "availableCloudBasedDatabaseDescriptors", ".", "add", "(", "DYNAMODB_DATASTORE_DESCRIPTOR", ")", ";", "availableCloudBasedDatabaseDescriptors", ".", "add", "(", "KAFKA_DATASTORE_DESCRIPTOR", ")", ";", "availableCloudBasedDatabaseDescriptors", ".", "add", "(", "NEO4J_DATASTORE_DESCRIPTOR", ")", ";", "return", "availableCloudBasedDatabaseDescriptors", ";", "}" ]
Returns the descriptors of database-based datastore types available in DataCleaner.
[ "Returns", "the", "descriptors", "of", "database", "-", "based", "datastore", "types", "available", "in", "DataCleaner", "." ]
9aa01fdac3560cef51c55df3cb2ac5c690b57639
https://github.com/datacleaner/DataCleaner/blob/9aa01fdac3560cef51c55df3cb2ac5c690b57639/desktop/ui/src/main/java/org/datacleaner/connection/DatastoreDescriptors.java#L203-L219
26,351
datacleaner/DataCleaner
desktop/ui/src/main/java/org/datacleaner/widgets/properties/SingleColumnNamePropertyWidget.java
SingleColumnNamePropertyWidget.setTable
public void setTable(final Table table) { if (table != _tableRef.get()) { _tableRef.set(table); if (table == null) { _comboBox.setEmptyModel(); } else { _comboBox.setModel(table); } } }
java
public void setTable(final Table table) { if (table != _tableRef.get()) { _tableRef.set(table); if (table == null) { _comboBox.setEmptyModel(); } else { _comboBox.setModel(table); } } }
[ "public", "void", "setTable", "(", "final", "Table", "table", ")", "{", "if", "(", "table", "!=", "_tableRef", ".", "get", "(", ")", ")", "{", "_tableRef", ".", "set", "(", "table", ")", ";", "if", "(", "table", "==", "null", ")", "{", "_comboBox", ".", "setEmptyModel", "(", ")", ";", "}", "else", "{", "_comboBox", ".", "setModel", "(", "table", ")", ";", "}", "}", "}" ]
Sets the table to use as a source for the available columns in the combobox. @param table
[ "Sets", "the", "table", "to", "use", "as", "a", "source", "for", "the", "available", "columns", "in", "the", "combobox", "." ]
9aa01fdac3560cef51c55df3cb2ac5c690b57639
https://github.com/datacleaner/DataCleaner/blob/9aa01fdac3560cef51c55df3cb2ac5c690b57639/desktop/ui/src/main/java/org/datacleaner/widgets/properties/SingleColumnNamePropertyWidget.java#L71-L81
26,352
datacleaner/DataCleaner
desktop/ui/src/main/java/org/datacleaner/panels/DCSplashPanel.java
DCSplashPanel.wrapContent
protected JScrollPane wrapContent(final JComponent panel) { panel.setMaximumSize(new Dimension(WIDTH_CONTENT, Integer.MAX_VALUE)); panel.setAlignmentX(Component.LEFT_ALIGNMENT); final DCPanel wrappingPanel = new DCPanel(); final BoxLayout layout = new BoxLayout(wrappingPanel, BoxLayout.PAGE_AXIS); wrappingPanel.setLayout(layout); wrappingPanel.add(panel); wrappingPanel.setBorder(new EmptyBorder(0, MARGIN_LEFT, 0, 0)); return WidgetUtils.scrolleable(wrappingPanel); }
java
protected JScrollPane wrapContent(final JComponent panel) { panel.setMaximumSize(new Dimension(WIDTH_CONTENT, Integer.MAX_VALUE)); panel.setAlignmentX(Component.LEFT_ALIGNMENT); final DCPanel wrappingPanel = new DCPanel(); final BoxLayout layout = new BoxLayout(wrappingPanel, BoxLayout.PAGE_AXIS); wrappingPanel.setLayout(layout); wrappingPanel.add(panel); wrappingPanel.setBorder(new EmptyBorder(0, MARGIN_LEFT, 0, 0)); return WidgetUtils.scrolleable(wrappingPanel); }
[ "protected", "JScrollPane", "wrapContent", "(", "final", "JComponent", "panel", ")", "{", "panel", ".", "setMaximumSize", "(", "new", "Dimension", "(", "WIDTH_CONTENT", ",", "Integer", ".", "MAX_VALUE", ")", ")", ";", "panel", ".", "setAlignmentX", "(", "Component", ".", "LEFT_ALIGNMENT", ")", ";", "final", "DCPanel", "wrappingPanel", "=", "new", "DCPanel", "(", ")", ";", "final", "BoxLayout", "layout", "=", "new", "BoxLayout", "(", "wrappingPanel", ",", "BoxLayout", ".", "PAGE_AXIS", ")", ";", "wrappingPanel", ".", "setLayout", "(", "layout", ")", ";", "wrappingPanel", ".", "add", "(", "panel", ")", ";", "wrappingPanel", ".", "setBorder", "(", "new", "EmptyBorder", "(", "0", ",", "MARGIN_LEFT", ",", "0", ",", "0", ")", ")", ";", "return", "WidgetUtils", ".", "scrolleable", "(", "wrappingPanel", ")", ";", "}" ]
Wraps a content panel in a scroll pane and applies a maximum width to the content to keep it nicely in place on the screen. @param panel @return
[ "Wraps", "a", "content", "panel", "in", "a", "scroll", "pane", "and", "applies", "a", "maximum", "width", "to", "the", "content", "to", "keep", "it", "nicely", "in", "place", "on", "the", "screen", "." ]
9aa01fdac3560cef51c55df3cb2ac5c690b57639
https://github.com/datacleaner/DataCleaner/blob/9aa01fdac3560cef51c55df3cb2ac5c690b57639/desktop/ui/src/main/java/org/datacleaner/panels/DCSplashPanel.java#L147-L158
26,353
datacleaner/DataCleaner
desktop/ui/src/main/java/org/datacleaner/Main.java
Main.initializeSystemProperties
protected static Map<String, String> initializeSystemProperties(final String[] args) { final Map<String, String> result = new HashMap<>(); final Pattern pattern = Pattern.compile("-D(.+)=(.+)"); for (final String arg : args) { final Matcher matcher = pattern.matcher(arg); if (matcher.matches()) { final String key = matcher.group(1); final String value = matcher.group(2); result.put(key, value); System.setProperty(key, value); } } return result; }
java
protected static Map<String, String> initializeSystemProperties(final String[] args) { final Map<String, String> result = new HashMap<>(); final Pattern pattern = Pattern.compile("-D(.+)=(.+)"); for (final String arg : args) { final Matcher matcher = pattern.matcher(arg); if (matcher.matches()) { final String key = matcher.group(1); final String value = matcher.group(2); result.put(key, value); System.setProperty(key, value); } } return result; }
[ "protected", "static", "Map", "<", "String", ",", "String", ">", "initializeSystemProperties", "(", "final", "String", "[", "]", "args", ")", "{", "final", "Map", "<", "String", ",", "String", ">", "result", "=", "new", "HashMap", "<>", "(", ")", ";", "final", "Pattern", "pattern", "=", "Pattern", ".", "compile", "(", "\"-D(.+)=(.+)\"", ")", ";", "for", "(", "final", "String", "arg", ":", "args", ")", "{", "final", "Matcher", "matcher", "=", "pattern", ".", "matcher", "(", "arg", ")", ";", "if", "(", "matcher", ".", "matches", "(", ")", ")", "{", "final", "String", "key", "=", "matcher", ".", "group", "(", "1", ")", ";", "final", "String", "value", "=", "matcher", ".", "group", "(", "2", ")", ";", "result", ".", "put", "(", "key", ",", "value", ")", ";", "System", ".", "setProperty", "(", "key", ",", "value", ")", ";", "}", "}", "return", "result", ";", "}" ]
Initializes system properties based on the arguments passed @param args @return
[ "Initializes", "system", "properties", "based", "on", "the", "arguments", "passed" ]
9aa01fdac3560cef51c55df3cb2ac5c690b57639
https://github.com/datacleaner/DataCleaner/blob/9aa01fdac3560cef51c55df3cb2ac5c690b57639/desktop/ui/src/main/java/org/datacleaner/Main.java#L51-L64
26,354
datacleaner/DataCleaner
desktop/ui/src/main/java/org/datacleaner/Main.java
Main.initializeLogging
protected static boolean initializeLogging() { try { // initial logging config, used before anything else { final URL url = Main.class.getResource("log4j-initial.xml"); assert url != null; DOMConfigurator.configure(url); } if (ClassLoaderUtils.IS_WEB_START) { final URL url = Main.class.getResource("log4j-jnlp.xml"); assert url != null; println("Using JNLP log configuration: " + url); DOMConfigurator.configure(url); return true; } final File dataCleanerHome = DataCleanerHome.getAsFile(); if (initializeLoggingFromDirectory(dataCleanerHome)) { return true; } if (initializeLoggingFromDirectory(new File("."))) { return true; } // fall back to default log4j.xml file in classpath final URL url = Main.class.getResource("log4j-default.xml"); assert url != null; println("Using default log configuration: " + url); DOMConfigurator.configure(url); return false; } catch (final NoClassDefFoundError e) { // can happen if log4j is not on the classpath println("Failed to initialize logging, class not found: " + e.getMessage()); return false; } }
java
protected static boolean initializeLogging() { try { // initial logging config, used before anything else { final URL url = Main.class.getResource("log4j-initial.xml"); assert url != null; DOMConfigurator.configure(url); } if (ClassLoaderUtils.IS_WEB_START) { final URL url = Main.class.getResource("log4j-jnlp.xml"); assert url != null; println("Using JNLP log configuration: " + url); DOMConfigurator.configure(url); return true; } final File dataCleanerHome = DataCleanerHome.getAsFile(); if (initializeLoggingFromDirectory(dataCleanerHome)) { return true; } if (initializeLoggingFromDirectory(new File("."))) { return true; } // fall back to default log4j.xml file in classpath final URL url = Main.class.getResource("log4j-default.xml"); assert url != null; println("Using default log configuration: " + url); DOMConfigurator.configure(url); return false; } catch (final NoClassDefFoundError e) { // can happen if log4j is not on the classpath println("Failed to initialize logging, class not found: " + e.getMessage()); return false; } }
[ "protected", "static", "boolean", "initializeLogging", "(", ")", "{", "try", "{", "// initial logging config, used before anything else", "{", "final", "URL", "url", "=", "Main", ".", "class", ".", "getResource", "(", "\"log4j-initial.xml\"", ")", ";", "assert", "url", "!=", "null", ";", "DOMConfigurator", ".", "configure", "(", "url", ")", ";", "}", "if", "(", "ClassLoaderUtils", ".", "IS_WEB_START", ")", "{", "final", "URL", "url", "=", "Main", ".", "class", ".", "getResource", "(", "\"log4j-jnlp.xml\"", ")", ";", "assert", "url", "!=", "null", ";", "println", "(", "\"Using JNLP log configuration: \"", "+", "url", ")", ";", "DOMConfigurator", ".", "configure", "(", "url", ")", ";", "return", "true", ";", "}", "final", "File", "dataCleanerHome", "=", "DataCleanerHome", ".", "getAsFile", "(", ")", ";", "if", "(", "initializeLoggingFromDirectory", "(", "dataCleanerHome", ")", ")", "{", "return", "true", ";", "}", "if", "(", "initializeLoggingFromDirectory", "(", "new", "File", "(", "\".\"", ")", ")", ")", "{", "return", "true", ";", "}", "// fall back to default log4j.xml file in classpath", "final", "URL", "url", "=", "Main", ".", "class", ".", "getResource", "(", "\"log4j-default.xml\"", ")", ";", "assert", "url", "!=", "null", ";", "println", "(", "\"Using default log configuration: \"", "+", "url", ")", ";", "DOMConfigurator", ".", "configure", "(", "url", ")", ";", "return", "false", ";", "}", "catch", "(", "final", "NoClassDefFoundError", "e", ")", "{", "// can happen if log4j is not on the classpath", "println", "(", "\"Failed to initialize logging, class not found: \"", "+", "e", ".", "getMessage", "(", ")", ")", ";", "return", "false", ";", "}", "}" ]
Initializes logging, specifically by looking for log4j.xml or log4j.properties file in DataCleaner's home directory. @return true if a logging configuration file was found, or false otherwise
[ "Initializes", "logging", "specifically", "by", "looking", "for", "log4j", ".", "xml", "or", "log4j", ".", "properties", "file", "in", "DataCleaner", "s", "home", "directory", "." ]
9aa01fdac3560cef51c55df3cb2ac5c690b57639
https://github.com/datacleaner/DataCleaner/blob/9aa01fdac3560cef51c55df3cb2ac5c690b57639/desktop/ui/src/main/java/org/datacleaner/Main.java#L73-L112
26,355
datacleaner/DataCleaner
desktop/ui/src/main/java/org/datacleaner/widgets/tabs/Packer.java
Packer.setContainer
public Packer setContainer(final Container cont) throws IllegalAccessException { if (container != null) { final Packer p = (Packer) clone(); container.setLayout(p); } container = cont; cont.setLayout(this); return this; }
java
public Packer setContainer(final Container cont) throws IllegalAccessException { if (container != null) { final Packer p = (Packer) clone(); container.setLayout(p); } container = cont; cont.setLayout(this); return this; }
[ "public", "Packer", "setContainer", "(", "final", "Container", "cont", ")", "throws", "IllegalAccessException", "{", "if", "(", "container", "!=", "null", ")", "{", "final", "Packer", "p", "=", "(", "Packer", ")", "clone", "(", ")", ";", "container", ".", "setLayout", "(", "p", ")", ";", "}", "container", "=", "cont", ";", "cont", ".", "setLayout", "(", "this", ")", ";", "return", "this", ";", "}" ]
Set the designated container for objects packed by this instance. @param cont the Container to use to add the components to when .pack() or .add() is invoked. @exception IllegalAccessException if container already set
[ "Set", "the", "designated", "container", "for", "objects", "packed", "by", "this", "instance", "." ]
9aa01fdac3560cef51c55df3cb2ac5c690b57639
https://github.com/datacleaner/DataCleaner/blob/9aa01fdac3560cef51c55df3cb2ac5c690b57639/desktop/ui/src/main/java/org/datacleaner/widgets/tabs/Packer.java#L146-L154
26,356
datacleaner/DataCleaner
desktop/ui/src/main/java/org/datacleaner/widgets/tabs/Packer.java
Packer.pack
public Packer pack(final Component cp) { if (container != null) { container.add(cp); } comp = cp; gc = new GridBagConstraints(); setConstraints(comp, gc); return this; }
java
public Packer pack(final Component cp) { if (container != null) { container.add(cp); } comp = cp; gc = new GridBagConstraints(); setConstraints(comp, gc); return this; }
[ "public", "Packer", "pack", "(", "final", "Component", "cp", ")", "{", "if", "(", "container", "!=", "null", ")", "{", "container", ".", "add", "(", "cp", ")", ";", "}", "comp", "=", "cp", ";", "gc", "=", "new", "GridBagConstraints", "(", ")", ";", "setConstraints", "(", "comp", ",", "gc", ")", ";", "return", "this", ";", "}" ]
Establishes a new set of constraints to layout the widget passed. The created constraints are applied to the passed Component and if a Container is known to this object, the component is added to the known container. @param cp The component to layout.
[ "Establishes", "a", "new", "set", "of", "constraints", "to", "layout", "the", "widget", "passed", ".", "The", "created", "constraints", "are", "applied", "to", "the", "passed", "Component", "and", "if", "a", "Container", "is", "known", "to", "this", "object", "the", "component", "is", "added", "to", "the", "known", "container", "." ]
9aa01fdac3560cef51c55df3cb2ac5c690b57639
https://github.com/datacleaner/DataCleaner/blob/9aa01fdac3560cef51c55df3cb2ac5c690b57639/desktop/ui/src/main/java/org/datacleaner/widgets/tabs/Packer.java#L179-L187
26,357
datacleaner/DataCleaner
desktop/ui/src/main/java/org/datacleaner/widgets/tabs/Packer.java
Packer.setAnchorNorth
public Packer setAnchorNorth(final boolean how) { if (how == true) { gc.anchor = GridBagConstraints.NORTH; } else { gc.anchor &= ~GridBagConstraints.NORTH; } setConstraints(comp, gc); return this; }
java
public Packer setAnchorNorth(final boolean how) { if (how == true) { gc.anchor = GridBagConstraints.NORTH; } else { gc.anchor &= ~GridBagConstraints.NORTH; } setConstraints(comp, gc); return this; }
[ "public", "Packer", "setAnchorNorth", "(", "final", "boolean", "how", ")", "{", "if", "(", "how", "==", "true", ")", "{", "gc", ".", "anchor", "=", "GridBagConstraints", ".", "NORTH", ";", "}", "else", "{", "gc", ".", "anchor", "&=", "~", "GridBagConstraints", ".", "NORTH", ";", "}", "setConstraints", "(", "comp", ",", "gc", ")", ";", "return", "this", ";", "}" ]
Add anchor=NORTH to the constraints for the current component if how == true remove it if false.
[ "Add", "anchor", "=", "NORTH", "to", "the", "constraints", "for", "the", "current", "component", "if", "how", "==", "true", "remove", "it", "if", "false", "." ]
9aa01fdac3560cef51c55df3cb2ac5c690b57639
https://github.com/datacleaner/DataCleaner/blob/9aa01fdac3560cef51c55df3cb2ac5c690b57639/desktop/ui/src/main/java/org/datacleaner/widgets/tabs/Packer.java#L218-L226
26,358
datacleaner/DataCleaner
desktop/ui/src/main/java/org/datacleaner/widgets/tabs/Packer.java
Packer.setAnchorSouth
public Packer setAnchorSouth(final boolean how) { if (how == true) { gc.anchor = GridBagConstraints.SOUTH; } else { gc.anchor &= ~GridBagConstraints.SOUTH; } setConstraints(comp, gc); return this; }
java
public Packer setAnchorSouth(final boolean how) { if (how == true) { gc.anchor = GridBagConstraints.SOUTH; } else { gc.anchor &= ~GridBagConstraints.SOUTH; } setConstraints(comp, gc); return this; }
[ "public", "Packer", "setAnchorSouth", "(", "final", "boolean", "how", ")", "{", "if", "(", "how", "==", "true", ")", "{", "gc", ".", "anchor", "=", "GridBagConstraints", ".", "SOUTH", ";", "}", "else", "{", "gc", ".", "anchor", "&=", "~", "GridBagConstraints", ".", "SOUTH", ";", "}", "setConstraints", "(", "comp", ",", "gc", ")", ";", "return", "this", ";", "}" ]
Add anchor=SOUTH to the constraints for the current component if how == true remove it if false.
[ "Add", "anchor", "=", "SOUTH", "to", "the", "constraints", "for", "the", "current", "component", "if", "how", "==", "true", "remove", "it", "if", "false", "." ]
9aa01fdac3560cef51c55df3cb2ac5c690b57639
https://github.com/datacleaner/DataCleaner/blob/9aa01fdac3560cef51c55df3cb2ac5c690b57639/desktop/ui/src/main/java/org/datacleaner/widgets/tabs/Packer.java#L247-L255
26,359
datacleaner/DataCleaner
desktop/ui/src/main/java/org/datacleaner/widgets/tabs/Packer.java
Packer.setAnchorEast
public Packer setAnchorEast(final boolean how) { if (how == true) { gc.anchor = GridBagConstraints.EAST; } else { gc.anchor &= ~GridBagConstraints.EAST; } setConstraints(comp, gc); return this; }
java
public Packer setAnchorEast(final boolean how) { if (how == true) { gc.anchor = GridBagConstraints.EAST; } else { gc.anchor &= ~GridBagConstraints.EAST; } setConstraints(comp, gc); return this; }
[ "public", "Packer", "setAnchorEast", "(", "final", "boolean", "how", ")", "{", "if", "(", "how", "==", "true", ")", "{", "gc", ".", "anchor", "=", "GridBagConstraints", ".", "EAST", ";", "}", "else", "{", "gc", ".", "anchor", "&=", "~", "GridBagConstraints", ".", "EAST", ";", "}", "setConstraints", "(", "comp", ",", "gc", ")", ";", "return", "this", ";", "}" ]
Add anchor=EAST to the constraints for the current component if how == true remove it if false.
[ "Add", "anchor", "=", "EAST", "to", "the", "constraints", "for", "the", "current", "component", "if", "how", "==", "true", "remove", "it", "if", "false", "." ]
9aa01fdac3560cef51c55df3cb2ac5c690b57639
https://github.com/datacleaner/DataCleaner/blob/9aa01fdac3560cef51c55df3cb2ac5c690b57639/desktop/ui/src/main/java/org/datacleaner/widgets/tabs/Packer.java#L276-L284
26,360
datacleaner/DataCleaner
desktop/ui/src/main/java/org/datacleaner/widgets/tabs/Packer.java
Packer.setAnchorWest
public Packer setAnchorWest(final boolean how) { if (how == true) { gc.anchor = GridBagConstraints.WEST; } else { gc.anchor &= ~GridBagConstraints.WEST; } setConstraints(comp, gc); return this; }
java
public Packer setAnchorWest(final boolean how) { if (how == true) { gc.anchor = GridBagConstraints.WEST; } else { gc.anchor &= ~GridBagConstraints.WEST; } setConstraints(comp, gc); return this; }
[ "public", "Packer", "setAnchorWest", "(", "final", "boolean", "how", ")", "{", "if", "(", "how", "==", "true", ")", "{", "gc", ".", "anchor", "=", "GridBagConstraints", ".", "WEST", ";", "}", "else", "{", "gc", ".", "anchor", "&=", "~", "GridBagConstraints", ".", "WEST", ";", "}", "setConstraints", "(", "comp", ",", "gc", ")", ";", "return", "this", ";", "}" ]
Add anchor=WEST to the constraints for the current component if how == true remove it if false.
[ "Add", "anchor", "=", "WEST", "to", "the", "constraints", "for", "the", "current", "component", "if", "how", "==", "true", "remove", "it", "if", "false", "." ]
9aa01fdac3560cef51c55df3cb2ac5c690b57639
https://github.com/datacleaner/DataCleaner/blob/9aa01fdac3560cef51c55df3cb2ac5c690b57639/desktop/ui/src/main/java/org/datacleaner/widgets/tabs/Packer.java#L318-L326
26,361
datacleaner/DataCleaner
desktop/ui/src/main/java/org/datacleaner/widgets/tabs/Packer.java
Packer.setAnchorNorthWest
public Packer setAnchorNorthWest(final boolean how) { if (how == true) { gc.anchor = GridBagConstraints.NORTHWEST; } else { gc.anchor &= ~GridBagConstraints.NORTHWEST; } setConstraints(comp, gc); return this; }
java
public Packer setAnchorNorthWest(final boolean how) { if (how == true) { gc.anchor = GridBagConstraints.NORTHWEST; } else { gc.anchor &= ~GridBagConstraints.NORTHWEST; } setConstraints(comp, gc); return this; }
[ "public", "Packer", "setAnchorNorthWest", "(", "final", "boolean", "how", ")", "{", "if", "(", "how", "==", "true", ")", "{", "gc", ".", "anchor", "=", "GridBagConstraints", ".", "NORTHWEST", ";", "}", "else", "{", "gc", ".", "anchor", "&=", "~", "GridBagConstraints", ".", "NORTHWEST", ";", "}", "setConstraints", "(", "comp", ",", "gc", ")", ";", "return", "this", ";", "}" ]
Add anchor=NORTHWEST to the constraints for the current component if how == true remove it if false.
[ "Add", "anchor", "=", "NORTHWEST", "to", "the", "constraints", "for", "the", "current", "component", "if", "how", "==", "true", "remove", "it", "if", "false", "." ]
9aa01fdac3560cef51c55df3cb2ac5c690b57639
https://github.com/datacleaner/DataCleaner/blob/9aa01fdac3560cef51c55df3cb2ac5c690b57639/desktop/ui/src/main/java/org/datacleaner/widgets/tabs/Packer.java#L347-L355
26,362
datacleaner/DataCleaner
desktop/ui/src/main/java/org/datacleaner/widgets/tabs/Packer.java
Packer.setAnchorSouthWest
public Packer setAnchorSouthWest(final boolean how) { if (how == true) { gc.anchor = GridBagConstraints.SOUTHWEST; } else { gc.anchor &= ~GridBagConstraints.SOUTHWEST; } setConstraints(comp, gc); return this; }
java
public Packer setAnchorSouthWest(final boolean how) { if (how == true) { gc.anchor = GridBagConstraints.SOUTHWEST; } else { gc.anchor &= ~GridBagConstraints.SOUTHWEST; } setConstraints(comp, gc); return this; }
[ "public", "Packer", "setAnchorSouthWest", "(", "final", "boolean", "how", ")", "{", "if", "(", "how", "==", "true", ")", "{", "gc", ".", "anchor", "=", "GridBagConstraints", ".", "SOUTHWEST", ";", "}", "else", "{", "gc", ".", "anchor", "&=", "~", "GridBagConstraints", ".", "SOUTHWEST", ";", "}", "setConstraints", "(", "comp", ",", "gc", ")", ";", "return", "this", ";", "}" ]
Add anchor=SOUTHWEST to the constraints for the current component if how == true remove it if false.
[ "Add", "anchor", "=", "SOUTHWEST", "to", "the", "constraints", "for", "the", "current", "component", "if", "how", "==", "true", "remove", "it", "if", "false", "." ]
9aa01fdac3560cef51c55df3cb2ac5c690b57639
https://github.com/datacleaner/DataCleaner/blob/9aa01fdac3560cef51c55df3cb2ac5c690b57639/desktop/ui/src/main/java/org/datacleaner/widgets/tabs/Packer.java#L376-L384
26,363
datacleaner/DataCleaner
desktop/ui/src/main/java/org/datacleaner/widgets/tabs/Packer.java
Packer.setAnchorNorthEast
public Packer setAnchorNorthEast(final boolean how) { if (how == true) { gc.anchor = GridBagConstraints.NORTHEAST; } else { gc.anchor &= ~GridBagConstraints.NORTHEAST; } setConstraints(comp, gc); return this; }
java
public Packer setAnchorNorthEast(final boolean how) { if (how == true) { gc.anchor = GridBagConstraints.NORTHEAST; } else { gc.anchor &= ~GridBagConstraints.NORTHEAST; } setConstraints(comp, gc); return this; }
[ "public", "Packer", "setAnchorNorthEast", "(", "final", "boolean", "how", ")", "{", "if", "(", "how", "==", "true", ")", "{", "gc", ".", "anchor", "=", "GridBagConstraints", ".", "NORTHEAST", ";", "}", "else", "{", "gc", ".", "anchor", "&=", "~", "GridBagConstraints", ".", "NORTHEAST", ";", "}", "setConstraints", "(", "comp", ",", "gc", ")", ";", "return", "this", ";", "}" ]
Add anchor=NORTHEAST to the constraints for the current component if how == true remove it if false.
[ "Add", "anchor", "=", "NORTHEAST", "to", "the", "constraints", "for", "the", "current", "component", "if", "how", "==", "true", "remove", "it", "if", "false", "." ]
9aa01fdac3560cef51c55df3cb2ac5c690b57639
https://github.com/datacleaner/DataCleaner/blob/9aa01fdac3560cef51c55df3cb2ac5c690b57639/desktop/ui/src/main/java/org/datacleaner/widgets/tabs/Packer.java#L405-L413
26,364
datacleaner/DataCleaner
desktop/ui/src/main/java/org/datacleaner/widgets/tabs/Packer.java
Packer.setAnchorSouthEast
public Packer setAnchorSouthEast(final boolean how) { if (how == true) { gc.anchor = GridBagConstraints.SOUTHEAST; } else { gc.anchor &= ~GridBagConstraints.SOUTHEAST; } setConstraints(comp, gc); return this; }
java
public Packer setAnchorSouthEast(final boolean how) { if (how == true) { gc.anchor = GridBagConstraints.SOUTHEAST; } else { gc.anchor &= ~GridBagConstraints.SOUTHEAST; } setConstraints(comp, gc); return this; }
[ "public", "Packer", "setAnchorSouthEast", "(", "final", "boolean", "how", ")", "{", "if", "(", "how", "==", "true", ")", "{", "gc", ".", "anchor", "=", "GridBagConstraints", ".", "SOUTHEAST", ";", "}", "else", "{", "gc", ".", "anchor", "&=", "~", "GridBagConstraints", ".", "SOUTHEAST", ";", "}", "setConstraints", "(", "comp", ",", "gc", ")", ";", "return", "this", ";", "}" ]
Add anchor=SOUTHEAST to the constraints for the current component if how == true remove it if false.
[ "Add", "anchor", "=", "SOUTHEAST", "to", "the", "constraints", "for", "the", "current", "component", "if", "how", "==", "true", "remove", "it", "if", "false", "." ]
9aa01fdac3560cef51c55df3cb2ac5c690b57639
https://github.com/datacleaner/DataCleaner/blob/9aa01fdac3560cef51c55df3cb2ac5c690b57639/desktop/ui/src/main/java/org/datacleaner/widgets/tabs/Packer.java#L434-L442
26,365
datacleaner/DataCleaner
desktop/ui/src/main/java/org/datacleaner/widgets/tabs/Packer.java
Packer.setXLeftRelative
public Packer setXLeftRelative(final boolean how) { if (how == true) { gc.gridx = GridBagConstraints.RELATIVE; } else { gc.gridx = 0; } setConstraints(comp, gc); return this; }
java
public Packer setXLeftRelative(final boolean how) { if (how == true) { gc.gridx = GridBagConstraints.RELATIVE; } else { gc.gridx = 0; } setConstraints(comp, gc); return this; }
[ "public", "Packer", "setXLeftRelative", "(", "final", "boolean", "how", ")", "{", "if", "(", "how", "==", "true", ")", "{", "gc", ".", "gridx", "=", "GridBagConstraints", ".", "RELATIVE", ";", "}", "else", "{", "gc", ".", "gridx", "=", "0", ";", "}", "setConstraints", "(", "comp", ",", "gc", ")", ";", "return", "this", ";", "}" ]
Add gridx=RELATIVE to the constraints for the current component if how == true 0 it if false.
[ "Add", "gridx", "=", "RELATIVE", "to", "the", "constraints", "for", "the", "current", "component", "if", "how", "==", "true", "0", "it", "if", "false", "." ]
9aa01fdac3560cef51c55df3cb2ac5c690b57639
https://github.com/datacleaner/DataCleaner/blob/9aa01fdac3560cef51c55df3cb2ac5c690b57639/desktop/ui/src/main/java/org/datacleaner/widgets/tabs/Packer.java#L463-L471
26,366
datacleaner/DataCleaner
desktop/ui/src/main/java/org/datacleaner/widgets/tabs/Packer.java
Packer.setYTopRelative
public Packer setYTopRelative(final boolean how) { if (how == true) { gc.gridy = GridBagConstraints.RELATIVE; } else { gc.gridy = 0; } setConstraints(comp, gc); return this; }
java
public Packer setYTopRelative(final boolean how) { if (how == true) { gc.gridy = GridBagConstraints.RELATIVE; } else { gc.gridy = 0; } setConstraints(comp, gc); return this; }
[ "public", "Packer", "setYTopRelative", "(", "final", "boolean", "how", ")", "{", "if", "(", "how", "==", "true", ")", "{", "gc", ".", "gridy", "=", "GridBagConstraints", ".", "RELATIVE", ";", "}", "else", "{", "gc", ".", "gridy", "=", "0", ";", "}", "setConstraints", "(", "comp", ",", "gc", ")", ";", "return", "this", ";", "}" ]
Add gridy=RELATIVE to the constraints for the current component if how == true 0 it if false.
[ "Add", "gridy", "=", "RELATIVE", "to", "the", "constraints", "for", "the", "current", "component", "if", "how", "==", "true", "0", "it", "if", "false", "." ]
9aa01fdac3560cef51c55df3cb2ac5c690b57639
https://github.com/datacleaner/DataCleaner/blob/9aa01fdac3560cef51c55df3cb2ac5c690b57639/desktop/ui/src/main/java/org/datacleaner/widgets/tabs/Packer.java#L492-L500
26,367
datacleaner/DataCleaner
desktop/ui/src/main/java/org/datacleaner/widgets/tabs/Packer.java
Packer.setFillX
public Packer setFillX(final boolean how) { if (how == true) { gc.fill = GridBagConstraints.HORIZONTAL; gc.weightx = 1; } else { gc.weightx = 0; gc.fill = 0; } setConstraints(comp, gc); return this; }
java
public Packer setFillX(final boolean how) { if (how == true) { gc.fill = GridBagConstraints.HORIZONTAL; gc.weightx = 1; } else { gc.weightx = 0; gc.fill = 0; } setConstraints(comp, gc); return this; }
[ "public", "Packer", "setFillX", "(", "final", "boolean", "how", ")", "{", "if", "(", "how", "==", "true", ")", "{", "gc", ".", "fill", "=", "GridBagConstraints", ".", "HORIZONTAL", ";", "gc", ".", "weightx", "=", "1", ";", "}", "else", "{", "gc", ".", "weightx", "=", "0", ";", "gc", ".", "fill", "=", "0", ";", "}", "setConstraints", "(", "comp", ",", "gc", ")", ";", "return", "this", ";", "}" ]
Add fill=HORIZONTAL, weightx=1 to the constraints for the current component if how == true. fill=0, weightx=0 if how is false.
[ "Add", "fill", "=", "HORIZONTAL", "weightx", "=", "1", "to", "the", "constraints", "for", "the", "current", "component", "if", "how", "==", "true", ".", "fill", "=", "0", "weightx", "=", "0", "if", "how", "is", "false", "." ]
9aa01fdac3560cef51c55df3cb2ac5c690b57639
https://github.com/datacleaner/DataCleaner/blob/9aa01fdac3560cef51c55df3cb2ac5c690b57639/desktop/ui/src/main/java/org/datacleaner/widgets/tabs/Packer.java#L673-L683
26,368
datacleaner/DataCleaner
desktop/ui/src/main/java/org/datacleaner/widgets/tabs/Packer.java
Packer.fillx
public Packer fillx(final double wtx) { gc.fill = GridBagConstraints.HORIZONTAL; gc.weightx = wtx; setConstraints(comp, gc); return this; }
java
public Packer fillx(final double wtx) { gc.fill = GridBagConstraints.HORIZONTAL; gc.weightx = wtx; setConstraints(comp, gc); return this; }
[ "public", "Packer", "fillx", "(", "final", "double", "wtx", ")", "{", "gc", ".", "fill", "=", "GridBagConstraints", ".", "HORIZONTAL", ";", "gc", ".", "weightx", "=", "wtx", ";", "setConstraints", "(", "comp", ",", "gc", ")", ";", "return", "this", ";", "}" ]
Add fill=HORIZONTAL, weightx=wtx to the constraints for the current component.
[ "Add", "fill", "=", "HORIZONTAL", "weightx", "=", "wtx", "to", "the", "constraints", "for", "the", "current", "component", "." ]
9aa01fdac3560cef51c55df3cb2ac5c690b57639
https://github.com/datacleaner/DataCleaner/blob/9aa01fdac3560cef51c55df3cb2ac5c690b57639/desktop/ui/src/main/java/org/datacleaner/widgets/tabs/Packer.java#L689-L694
26,369
datacleaner/DataCleaner
desktop/ui/src/main/java/org/datacleaner/widgets/tabs/Packer.java
Packer.setFillY
public Packer setFillY(final boolean how) { if (how == true) { gc.fill = GridBagConstraints.VERTICAL; gc.weighty = 1; } else { gc.weighty = 0; gc.fill = 0; } setConstraints(comp, gc); return this; }
java
public Packer setFillY(final boolean how) { if (how == true) { gc.fill = GridBagConstraints.VERTICAL; gc.weighty = 1; } else { gc.weighty = 0; gc.fill = 0; } setConstraints(comp, gc); return this; }
[ "public", "Packer", "setFillY", "(", "final", "boolean", "how", ")", "{", "if", "(", "how", "==", "true", ")", "{", "gc", ".", "fill", "=", "GridBagConstraints", ".", "VERTICAL", ";", "gc", ".", "weighty", "=", "1", ";", "}", "else", "{", "gc", ".", "weighty", "=", "0", ";", "gc", ".", "fill", "=", "0", ";", "}", "setConstraints", "(", "comp", ",", "gc", ")", ";", "return", "this", ";", "}" ]
Add fill=VERITCAL to the constraints for the current component if how == true 1 it if false.
[ "Add", "fill", "=", "VERITCAL", "to", "the", "constraints", "for", "the", "current", "component", "if", "how", "==", "true", "1", "it", "if", "false", "." ]
9aa01fdac3560cef51c55df3cb2ac5c690b57639
https://github.com/datacleaner/DataCleaner/blob/9aa01fdac3560cef51c55df3cb2ac5c690b57639/desktop/ui/src/main/java/org/datacleaner/widgets/tabs/Packer.java#L715-L725
26,370
datacleaner/DataCleaner
desktop/ui/src/main/java/org/datacleaner/widgets/tabs/Packer.java
Packer.filly
public Packer filly(final double wty) { gc.fill = GridBagConstraints.VERTICAL; gc.weighty = wty; setConstraints(comp, gc); return this; }
java
public Packer filly(final double wty) { gc.fill = GridBagConstraints.VERTICAL; gc.weighty = wty; setConstraints(comp, gc); return this; }
[ "public", "Packer", "filly", "(", "final", "double", "wty", ")", "{", "gc", ".", "fill", "=", "GridBagConstraints", ".", "VERTICAL", ";", "gc", ".", "weighty", "=", "wty", ";", "setConstraints", "(", "comp", ",", "gc", ")", ";", "return", "this", ";", "}" ]
Add fill=VERTICAL, weighty=wty to the constraints for the current component.
[ "Add", "fill", "=", "VERTICAL", "weighty", "=", "wty", "to", "the", "constraints", "for", "the", "current", "component", "." ]
9aa01fdac3560cef51c55df3cb2ac5c690b57639
https://github.com/datacleaner/DataCleaner/blob/9aa01fdac3560cef51c55df3cb2ac5c690b57639/desktop/ui/src/main/java/org/datacleaner/widgets/tabs/Packer.java#L731-L736
26,371
datacleaner/DataCleaner
desktop/ui/src/main/java/org/datacleaner/widgets/tabs/Packer.java
Packer.setFillBoth
public Packer setFillBoth(final boolean how) { if (how == true) { gc.fill = GridBagConstraints.BOTH; gc.weightx = 1; gc.weighty = 1; } else { gc.weightx = 0; gc.weighty = 0; gc.fill = 0; } setConstraints(comp, gc); return this; }
java
public Packer setFillBoth(final boolean how) { if (how == true) { gc.fill = GridBagConstraints.BOTH; gc.weightx = 1; gc.weighty = 1; } else { gc.weightx = 0; gc.weighty = 0; gc.fill = 0; } setConstraints(comp, gc); return this; }
[ "public", "Packer", "setFillBoth", "(", "final", "boolean", "how", ")", "{", "if", "(", "how", "==", "true", ")", "{", "gc", ".", "fill", "=", "GridBagConstraints", ".", "BOTH", ";", "gc", ".", "weightx", "=", "1", ";", "gc", ".", "weighty", "=", "1", ";", "}", "else", "{", "gc", ".", "weightx", "=", "0", ";", "gc", ".", "weighty", "=", "0", ";", "gc", ".", "fill", "=", "0", ";", "}", "setConstraints", "(", "comp", ",", "gc", ")", ";", "return", "this", ";", "}" ]
Add fill=BOTH, weightx=1, weighty=1 to the constraints for the current component if how == true, fill=0, weightx=0, weighty=0 if it is false.
[ "Add", "fill", "=", "BOTH", "weightx", "=", "1", "weighty", "=", "1", "to", "the", "constraints", "for", "the", "current", "component", "if", "how", "==", "true", "fill", "=", "0", "weightx", "=", "0", "weighty", "=", "0", "if", "it", "is", "false", "." ]
9aa01fdac3560cef51c55df3cb2ac5c690b57639
https://github.com/datacleaner/DataCleaner/blob/9aa01fdac3560cef51c55df3cb2ac5c690b57639/desktop/ui/src/main/java/org/datacleaner/widgets/tabs/Packer.java#L757-L769
26,372
datacleaner/DataCleaner
desktop/ui/src/main/java/org/datacleaner/widgets/tabs/Packer.java
Packer.fillboth
public Packer fillboth(final double wtx, final double wty) { gc.fill = GridBagConstraints.BOTH; gc.weightx = wtx; gc.weighty = wty; setConstraints(comp, gc); return this; }
java
public Packer fillboth(final double wtx, final double wty) { gc.fill = GridBagConstraints.BOTH; gc.weightx = wtx; gc.weighty = wty; setConstraints(comp, gc); return this; }
[ "public", "Packer", "fillboth", "(", "final", "double", "wtx", ",", "final", "double", "wty", ")", "{", "gc", ".", "fill", "=", "GridBagConstraints", ".", "BOTH", ";", "gc", ".", "weightx", "=", "wtx", ";", "gc", ".", "weighty", "=", "wty", ";", "setConstraints", "(", "comp", ",", "gc", ")", ";", "return", "this", ";", "}" ]
Add fill=BOTH, weighty=1, weightx=1 to the constraints for the current component.
[ "Add", "fill", "=", "BOTH", "weighty", "=", "1", "weightx", "=", "1", "to", "the", "constraints", "for", "the", "current", "component", "." ]
9aa01fdac3560cef51c55df3cb2ac5c690b57639
https://github.com/datacleaner/DataCleaner/blob/9aa01fdac3560cef51c55df3cb2ac5c690b57639/desktop/ui/src/main/java/org/datacleaner/widgets/tabs/Packer.java#L775-L781
26,373
datacleaner/DataCleaner
desktop/ui/src/main/java/org/datacleaner/widgets/tabs/Packer.java
Packer.setInsetTop
public Packer setInsetTop(final int val) { Insets i = gc.insets; if (i == null) { i = new Insets(0, 0, 0, 0); } gc.insets = new Insets(val, i.left, i.bottom, i.right); setConstraints(comp, gc); return this; }
java
public Packer setInsetTop(final int val) { Insets i = gc.insets; if (i == null) { i = new Insets(0, 0, 0, 0); } gc.insets = new Insets(val, i.left, i.bottom, i.right); setConstraints(comp, gc); return this; }
[ "public", "Packer", "setInsetTop", "(", "final", "int", "val", ")", "{", "Insets", "i", "=", "gc", ".", "insets", ";", "if", "(", "i", "==", "null", ")", "{", "i", "=", "new", "Insets", "(", "0", ",", "0", ",", "0", ",", "0", ")", ";", "}", "gc", ".", "insets", "=", "new", "Insets", "(", "val", ",", "i", ".", "left", ",", "i", ".", "bottom", ",", "i", ".", "right", ")", ";", "setConstraints", "(", "comp", ",", "gc", ")", ";", "return", "this", ";", "}" ]
sets top Insets on the constraints for the current component to the value specified.
[ "sets", "top", "Insets", "on", "the", "constraints", "for", "the", "current", "component", "to", "the", "value", "specified", "." ]
9aa01fdac3560cef51c55df3cb2ac5c690b57639
https://github.com/datacleaner/DataCleaner/blob/9aa01fdac3560cef51c55df3cb2ac5c690b57639/desktop/ui/src/main/java/org/datacleaner/widgets/tabs/Packer.java#L815-L823
26,374
datacleaner/DataCleaner
desktop/ui/src/main/java/org/datacleaner/widgets/tabs/Packer.java
Packer.setInsetBottom
public Packer setInsetBottom(final int val) { Insets i = gc.insets; if (i == null) { i = new Insets(0, 0, 0, 0); } gc.insets = new Insets(i.top, i.left, val, i.right); setConstraints(comp, gc); return this; }
java
public Packer setInsetBottom(final int val) { Insets i = gc.insets; if (i == null) { i = new Insets(0, 0, 0, 0); } gc.insets = new Insets(i.top, i.left, val, i.right); setConstraints(comp, gc); return this; }
[ "public", "Packer", "setInsetBottom", "(", "final", "int", "val", ")", "{", "Insets", "i", "=", "gc", ".", "insets", ";", "if", "(", "i", "==", "null", ")", "{", "i", "=", "new", "Insets", "(", "0", ",", "0", ",", "0", ",", "0", ")", ";", "}", "gc", ".", "insets", "=", "new", "Insets", "(", "i", ".", "top", ",", "i", ".", "left", ",", "val", ",", "i", ".", "right", ")", ";", "setConstraints", "(", "comp", ",", "gc", ")", ";", "return", "this", ";", "}" ]
sets bottom Insets on the constraints for the current component to the value specified.
[ "sets", "bottom", "Insets", "on", "the", "constraints", "for", "the", "current", "component", "to", "the", "value", "specified", "." ]
9aa01fdac3560cef51c55df3cb2ac5c690b57639
https://github.com/datacleaner/DataCleaner/blob/9aa01fdac3560cef51c55df3cb2ac5c690b57639/desktop/ui/src/main/java/org/datacleaner/widgets/tabs/Packer.java#L833-L841
26,375
datacleaner/DataCleaner
desktop/ui/src/main/java/org/datacleaner/widgets/tabs/Packer.java
Packer.setInsetLeft
public Packer setInsetLeft(final int val) { Insets i = gc.insets; if (i == null) { i = new Insets(0, 0, 0, 0); } gc.insets = new Insets(i.top, val, i.bottom, i.right); setConstraints(comp, gc); return this; }
java
public Packer setInsetLeft(final int val) { Insets i = gc.insets; if (i == null) { i = new Insets(0, 0, 0, 0); } gc.insets = new Insets(i.top, val, i.bottom, i.right); setConstraints(comp, gc); return this; }
[ "public", "Packer", "setInsetLeft", "(", "final", "int", "val", ")", "{", "Insets", "i", "=", "gc", ".", "insets", ";", "if", "(", "i", "==", "null", ")", "{", "i", "=", "new", "Insets", "(", "0", ",", "0", ",", "0", ",", "0", ")", ";", "}", "gc", ".", "insets", "=", "new", "Insets", "(", "i", ".", "top", ",", "val", ",", "i", ".", "bottom", ",", "i", ".", "right", ")", ";", "setConstraints", "(", "comp", ",", "gc", ")", ";", "return", "this", ";", "}" ]
sets left Insets on the constraints for the current component to the value specified.
[ "sets", "left", "Insets", "on", "the", "constraints", "for", "the", "current", "component", "to", "the", "value", "specified", "." ]
9aa01fdac3560cef51c55df3cb2ac5c690b57639
https://github.com/datacleaner/DataCleaner/blob/9aa01fdac3560cef51c55df3cb2ac5c690b57639/desktop/ui/src/main/java/org/datacleaner/widgets/tabs/Packer.java#L851-L859
26,376
datacleaner/DataCleaner
desktop/ui/src/main/java/org/datacleaner/widgets/tabs/Packer.java
Packer.setInsetRight
public Packer setInsetRight(final int val) { Insets i = gc.insets; if (i == null) { i = new Insets(0, 0, 0, 0); } gc.insets = new Insets(i.top, i.left, i.bottom, val); setConstraints(comp, gc); return this; }
java
public Packer setInsetRight(final int val) { Insets i = gc.insets; if (i == null) { i = new Insets(0, 0, 0, 0); } gc.insets = new Insets(i.top, i.left, i.bottom, val); setConstraints(comp, gc); return this; }
[ "public", "Packer", "setInsetRight", "(", "final", "int", "val", ")", "{", "Insets", "i", "=", "gc", ".", "insets", ";", "if", "(", "i", "==", "null", ")", "{", "i", "=", "new", "Insets", "(", "0", ",", "0", ",", "0", ",", "0", ")", ";", "}", "gc", ".", "insets", "=", "new", "Insets", "(", "i", ".", "top", ",", "i", ".", "left", ",", "i", ".", "bottom", ",", "val", ")", ";", "setConstraints", "(", "comp", ",", "gc", ")", ";", "return", "this", ";", "}" ]
sets right Insets on the constraints for the current component to the value specified.
[ "sets", "right", "Insets", "on", "the", "constraints", "for", "the", "current", "component", "to", "the", "value", "specified", "." ]
9aa01fdac3560cef51c55df3cb2ac5c690b57639
https://github.com/datacleaner/DataCleaner/blob/9aa01fdac3560cef51c55df3cb2ac5c690b57639/desktop/ui/src/main/java/org/datacleaner/widgets/tabs/Packer.java#L869-L877
26,377
datacleaner/DataCleaner
engine/core/src/main/java/org/datacleaner/util/SecurityUtils.java
SecurityUtils.removeSshCertificateChecks
@Deprecated public static void removeSshCertificateChecks(final HttpClient httpClient) throws IllegalStateException { try { // prepare a SSL context which doesn't validate certificates final SSLContext sslContext = SSLContext.getInstance("SSL"); final TrustManager trustManager = new NaiveTrustManager(); sslContext.init(null, new TrustManager[] { trustManager }, new SecureRandom()); final org.apache.http.conn.ssl.SSLSocketFactory schemeSocketFactory = new org.apache.http.conn.ssl.SSLSocketFactory(sslContext); final org.apache.http.conn.scheme.Scheme sslScheme = new org.apache.http.conn.scheme.Scheme("https", 443, schemeSocketFactory); // try again with a new registry final org.apache.http.conn.scheme.SchemeRegistry registry = httpClient.getConnectionManager().getSchemeRegistry(); registry.register(sslScheme); } catch (final Exception e) { throw new IllegalStateException(e); } }
java
@Deprecated public static void removeSshCertificateChecks(final HttpClient httpClient) throws IllegalStateException { try { // prepare a SSL context which doesn't validate certificates final SSLContext sslContext = SSLContext.getInstance("SSL"); final TrustManager trustManager = new NaiveTrustManager(); sslContext.init(null, new TrustManager[] { trustManager }, new SecureRandom()); final org.apache.http.conn.ssl.SSLSocketFactory schemeSocketFactory = new org.apache.http.conn.ssl.SSLSocketFactory(sslContext); final org.apache.http.conn.scheme.Scheme sslScheme = new org.apache.http.conn.scheme.Scheme("https", 443, schemeSocketFactory); // try again with a new registry final org.apache.http.conn.scheme.SchemeRegistry registry = httpClient.getConnectionManager().getSchemeRegistry(); registry.register(sslScheme); } catch (final Exception e) { throw new IllegalStateException(e); } }
[ "@", "Deprecated", "public", "static", "void", "removeSshCertificateChecks", "(", "final", "HttpClient", "httpClient", ")", "throws", "IllegalStateException", "{", "try", "{", "// prepare a SSL context which doesn't validate certificates", "final", "SSLContext", "sslContext", "=", "SSLContext", ".", "getInstance", "(", "\"SSL\"", ")", ";", "final", "TrustManager", "trustManager", "=", "new", "NaiveTrustManager", "(", ")", ";", "sslContext", ".", "init", "(", "null", ",", "new", "TrustManager", "[", "]", "{", "trustManager", "}", ",", "new", "SecureRandom", "(", ")", ")", ";", "final", "org", ".", "apache", ".", "http", ".", "conn", ".", "ssl", ".", "SSLSocketFactory", "schemeSocketFactory", "=", "new", "org", ".", "apache", ".", "http", ".", "conn", ".", "ssl", ".", "SSLSocketFactory", "(", "sslContext", ")", ";", "final", "org", ".", "apache", ".", "http", ".", "conn", ".", "scheme", ".", "Scheme", "sslScheme", "=", "new", "org", ".", "apache", ".", "http", ".", "conn", ".", "scheme", ".", "Scheme", "(", "\"https\"", ",", "443", ",", "schemeSocketFactory", ")", ";", "// try again with a new registry", "final", "org", ".", "apache", ".", "http", ".", "conn", ".", "scheme", ".", "SchemeRegistry", "registry", "=", "httpClient", ".", "getConnectionManager", "(", ")", ".", "getSchemeRegistry", "(", ")", ";", "registry", ".", "register", "(", "sslScheme", ")", ";", "}", "catch", "(", "final", "Exception", "e", ")", "{", "throw", "new", "IllegalStateException", "(", "e", ")", ";", "}", "}" ]
Removes the certificate checks of HTTPS traffic on a HTTP client. Use with caution! @param httpClient @throws IllegalStateException @{@link Deprecated} use {@link #createUnsafeSSLConnectionSocketFactory()} in conjunction with {@link HttpClients#custom()} instead.
[ "Removes", "the", "certificate", "checks", "of", "HTTPS", "traffic", "on", "a", "HTTP", "client", ".", "Use", "with", "caution!" ]
9aa01fdac3560cef51c55df3cb2ac5c690b57639
https://github.com/datacleaner/DataCleaner/blob/9aa01fdac3560cef51c55df3cb2ac5c690b57639/engine/core/src/main/java/org/datacleaner/util/SecurityUtils.java#L73-L93
26,378
datacleaner/DataCleaner
engine/core/src/main/java/org/datacleaner/job/AnalyzerJobHelper.java
AnalyzerJobHelper.getAnalyzerJob
public AnalyzerJob getAnalyzerJob(final String descriptorName, final String analyzerName, final String analyzerInputName) { List<AnalyzerJob> candidates = new ArrayList<>(_jobs); // filter analyzers of the corresponding type candidates = CollectionUtils2.refineCandidates(candidates, o -> { final String actualDescriptorName = o.getDescriptor().getDisplayName(); return descriptorName.equals(actualDescriptorName); }); if (analyzerName != null) { // filter analyzers with a particular name candidates = CollectionUtils2.refineCandidates(candidates, o -> { final String actualAnalyzerName = o.getName(); return analyzerName.equals(actualAnalyzerName); }); } if (analyzerInputName != null) { // filter analyzers with a particular input candidates = CollectionUtils2.refineCandidates(candidates, o -> { final InputColumn<?> inputColumn = getIdentifyingInputColumn(o); if (inputColumn == null) { return false; } return analyzerInputName.equals(inputColumn.getName()); }); } if (candidates.isEmpty()) { logger.error("No more AnalyzerJob candidates to choose from"); return null; } else if (candidates.size() > 1) { logger.warn("Multiple ({}) AnalyzerJob candidates to choose from, picking first"); } return candidates.iterator().next(); }
java
public AnalyzerJob getAnalyzerJob(final String descriptorName, final String analyzerName, final String analyzerInputName) { List<AnalyzerJob> candidates = new ArrayList<>(_jobs); // filter analyzers of the corresponding type candidates = CollectionUtils2.refineCandidates(candidates, o -> { final String actualDescriptorName = o.getDescriptor().getDisplayName(); return descriptorName.equals(actualDescriptorName); }); if (analyzerName != null) { // filter analyzers with a particular name candidates = CollectionUtils2.refineCandidates(candidates, o -> { final String actualAnalyzerName = o.getName(); return analyzerName.equals(actualAnalyzerName); }); } if (analyzerInputName != null) { // filter analyzers with a particular input candidates = CollectionUtils2.refineCandidates(candidates, o -> { final InputColumn<?> inputColumn = getIdentifyingInputColumn(o); if (inputColumn == null) { return false; } return analyzerInputName.equals(inputColumn.getName()); }); } if (candidates.isEmpty()) { logger.error("No more AnalyzerJob candidates to choose from"); return null; } else if (candidates.size() > 1) { logger.warn("Multiple ({}) AnalyzerJob candidates to choose from, picking first"); } return candidates.iterator().next(); }
[ "public", "AnalyzerJob", "getAnalyzerJob", "(", "final", "String", "descriptorName", ",", "final", "String", "analyzerName", ",", "final", "String", "analyzerInputName", ")", "{", "List", "<", "AnalyzerJob", ">", "candidates", "=", "new", "ArrayList", "<>", "(", "_jobs", ")", ";", "// filter analyzers of the corresponding type", "candidates", "=", "CollectionUtils2", ".", "refineCandidates", "(", "candidates", ",", "o", "->", "{", "final", "String", "actualDescriptorName", "=", "o", ".", "getDescriptor", "(", ")", ".", "getDisplayName", "(", ")", ";", "return", "descriptorName", ".", "equals", "(", "actualDescriptorName", ")", ";", "}", ")", ";", "if", "(", "analyzerName", "!=", "null", ")", "{", "// filter analyzers with a particular name", "candidates", "=", "CollectionUtils2", ".", "refineCandidates", "(", "candidates", ",", "o", "->", "{", "final", "String", "actualAnalyzerName", "=", "o", ".", "getName", "(", ")", ";", "return", "analyzerName", ".", "equals", "(", "actualAnalyzerName", ")", ";", "}", ")", ";", "}", "if", "(", "analyzerInputName", "!=", "null", ")", "{", "// filter analyzers with a particular input", "candidates", "=", "CollectionUtils2", ".", "refineCandidates", "(", "candidates", ",", "o", "->", "{", "final", "InputColumn", "<", "?", ">", "inputColumn", "=", "getIdentifyingInputColumn", "(", "o", ")", ";", "if", "(", "inputColumn", "==", "null", ")", "{", "return", "false", ";", "}", "return", "analyzerInputName", ".", "equals", "(", "inputColumn", ".", "getName", "(", ")", ")", ";", "}", ")", ";", "}", "if", "(", "candidates", ".", "isEmpty", "(", ")", ")", "{", "logger", ".", "error", "(", "\"No more AnalyzerJob candidates to choose from\"", ")", ";", "return", "null", ";", "}", "else", "if", "(", "candidates", ".", "size", "(", ")", ">", "1", ")", "{", "logger", ".", "warn", "(", "\"Multiple ({}) AnalyzerJob candidates to choose from, picking first\"", ")", ";", "}", "return", "candidates", ".", "iterator", "(", ")", ".", "next", "(", ")", ";", "}" ]
Gets the "best candidate" analyzer job based on search criteria offered in parameters. @param descriptorName @param analyzerName @param analyzerInputName @return
[ "Gets", "the", "best", "candidate", "analyzer", "job", "based", "on", "search", "criteria", "offered", "in", "parameters", "." ]
9aa01fdac3560cef51c55df3cb2ac5c690b57639
https://github.com/datacleaner/DataCleaner/blob/9aa01fdac3560cef51c55df3cb2ac5c690b57639/engine/core/src/main/java/org/datacleaner/job/AnalyzerJobHelper.java#L121-L159
26,379
datacleaner/DataCleaner
engine/utils/src/main/java/org/datacleaner/util/StringUtils.java
StringUtils.isSingleWord
public static boolean isSingleWord(String value) { if (value == null) { return false; } value = value.trim(); if (value.isEmpty()) { return false; } return !SINGLE_WORD_PATTERN.matcher(value).matches(); }
java
public static boolean isSingleWord(String value) { if (value == null) { return false; } value = value.trim(); if (value.isEmpty()) { return false; } return !SINGLE_WORD_PATTERN.matcher(value).matches(); }
[ "public", "static", "boolean", "isSingleWord", "(", "String", "value", ")", "{", "if", "(", "value", "==", "null", ")", "{", "return", "false", ";", "}", "value", "=", "value", ".", "trim", "(", ")", ";", "if", "(", "value", ".", "isEmpty", "(", ")", ")", "{", "return", "false", ";", "}", "return", "!", "SINGLE_WORD_PATTERN", ".", "matcher", "(", "value", ")", ".", "matches", "(", ")", ";", "}" ]
Determines if a String represents a single word. A single word is defined as a non-null string containing no word boundaries after trimming. @param value @return
[ "Determines", "if", "a", "String", "represents", "a", "single", "word", ".", "A", "single", "word", "is", "defined", "as", "a", "non", "-", "null", "string", "containing", "no", "word", "boundaries", "after", "trimming", "." ]
9aa01fdac3560cef51c55df3cb2ac5c690b57639
https://github.com/datacleaner/DataCleaner/blob/9aa01fdac3560cef51c55df3cb2ac5c690b57639/engine/utils/src/main/java/org/datacleaner/util/StringUtils.java#L173-L182
26,380
datacleaner/DataCleaner
engine/core/src/main/java/org/datacleaner/configuration/SourceColumnMapping.java
SourceColumnMapping.autoMap
public void autoMap(final Datastore datastore) { setDatastore(datastore); try (DatastoreConnection con = datastore.openConnection()) { final SchemaNavigator schemaNavigator = con.getSchemaNavigator(); for (final Entry<String, Column> entry : _map.entrySet()) { if (entry.getValue() == null) { final String path = entry.getKey(); final Column column = schemaNavigator.convertToColumn(path); entry.setValue(column); } } } }
java
public void autoMap(final Datastore datastore) { setDatastore(datastore); try (DatastoreConnection con = datastore.openConnection()) { final SchemaNavigator schemaNavigator = con.getSchemaNavigator(); for (final Entry<String, Column> entry : _map.entrySet()) { if (entry.getValue() == null) { final String path = entry.getKey(); final Column column = schemaNavigator.convertToColumn(path); entry.setValue(column); } } } }
[ "public", "void", "autoMap", "(", "final", "Datastore", "datastore", ")", "{", "setDatastore", "(", "datastore", ")", ";", "try", "(", "DatastoreConnection", "con", "=", "datastore", ".", "openConnection", "(", ")", ")", "{", "final", "SchemaNavigator", "schemaNavigator", "=", "con", ".", "getSchemaNavigator", "(", ")", ";", "for", "(", "final", "Entry", "<", "String", ",", "Column", ">", "entry", ":", "_map", ".", "entrySet", "(", ")", ")", "{", "if", "(", "entry", ".", "getValue", "(", ")", "==", "null", ")", "{", "final", "String", "path", "=", "entry", ".", "getKey", "(", ")", ";", "final", "Column", "column", "=", "schemaNavigator", ".", "convertToColumn", "(", "path", ")", ";", "entry", ".", "setValue", "(", "column", ")", ";", "}", "}", "}", "}" ]
Automatically maps all unmapped paths by looking them up in a datastore. @param schemaNavigator
[ "Automatically", "maps", "all", "unmapped", "paths", "by", "looking", "them", "up", "in", "a", "datastore", "." ]
9aa01fdac3560cef51c55df3cb2ac5c690b57639
https://github.com/datacleaner/DataCleaner/blob/9aa01fdac3560cef51c55df3cb2ac5c690b57639/engine/core/src/main/java/org/datacleaner/configuration/SourceColumnMapping.java#L74-L86
26,381
datacleaner/DataCleaner
desktop/ui/src/main/java/org/datacleaner/widgets/visualization/JobGraphLinkPainter.java
JobGraphLinkPainter.endLink
public boolean endLink(final Object endVertex, final MouseEvent mouseEvent) { logger.debug("endLink({})", endVertex); boolean result = false; if (_startVertex != null && endVertex != null) { if (mouseEvent.getButton() == MouseEvent.BUTTON1) { final boolean created = createLink(_startVertex, endVertex, mouseEvent); if (created && _graphContext.getVisualizationViewer().isVisible()) { _graphContext.getJobGraph().refresh(); } result = true; } } stopDrawing(); return result; }
java
public boolean endLink(final Object endVertex, final MouseEvent mouseEvent) { logger.debug("endLink({})", endVertex); boolean result = false; if (_startVertex != null && endVertex != null) { if (mouseEvent.getButton() == MouseEvent.BUTTON1) { final boolean created = createLink(_startVertex, endVertex, mouseEvent); if (created && _graphContext.getVisualizationViewer().isVisible()) { _graphContext.getJobGraph().refresh(); } result = true; } } stopDrawing(); return result; }
[ "public", "boolean", "endLink", "(", "final", "Object", "endVertex", ",", "final", "MouseEvent", "mouseEvent", ")", "{", "logger", ".", "debug", "(", "\"endLink({})\"", ",", "endVertex", ")", ";", "boolean", "result", "=", "false", ";", "if", "(", "_startVertex", "!=", "null", "&&", "endVertex", "!=", "null", ")", "{", "if", "(", "mouseEvent", ".", "getButton", "(", ")", "==", "MouseEvent", ".", "BUTTON1", ")", "{", "final", "boolean", "created", "=", "createLink", "(", "_startVertex", ",", "endVertex", ",", "mouseEvent", ")", ";", "if", "(", "created", "&&", "_graphContext", ".", "getVisualizationViewer", "(", ")", ".", "isVisible", "(", ")", ")", "{", "_graphContext", ".", "getJobGraph", "(", ")", ".", "refresh", "(", ")", ";", "}", "result", "=", "true", ";", "}", "}", "stopDrawing", "(", ")", ";", "return", "result", ";", "}" ]
If startVertex is non-null this method will attempt to end the link-painting at the given endVertex @return true if a link drawing was ended or false if it wasn't started
[ "If", "startVertex", "is", "non", "-", "null", "this", "method", "will", "attempt", "to", "end", "the", "link", "-", "painting", "at", "the", "given", "endVertex" ]
9aa01fdac3560cef51c55df3cb2ac5c690b57639
https://github.com/datacleaner/DataCleaner/blob/9aa01fdac3560cef51c55df3cb2ac5c690b57639/desktop/ui/src/main/java/org/datacleaner/widgets/visualization/JobGraphLinkPainter.java#L188-L202
26,382
datacleaner/DataCleaner
desktop/ui/src/main/java/org/datacleaner/widgets/visualization/JobGraphLinkPainter.java
JobGraphLinkPainter.scopeUpdatePermitted
private boolean scopeUpdatePermitted(final AnalysisJobBuilder sourceAnalysisJobBuilder, final ComponentBuilder componentBuilder) { if (sourceAnalysisJobBuilder != componentBuilder.getAnalysisJobBuilder()) { if (componentBuilder.getInput().length > 0 || componentBuilder.getComponentRequirement() != null) { final String scopeText; scopeText = LabelUtils.getScopeLabel(sourceAnalysisJobBuilder); final int response = JOptionPane.showConfirmDialog(_graphContext.getVisualizationViewer(), "This will move " + LabelUtils.getLabel(componentBuilder) + " into the " + scopeText + ", thereby losing its configured columns and/or requirements", "Change scope?", JOptionPane.OK_CANCEL_OPTION, JOptionPane.WARNING_MESSAGE); if (response == JOptionPane.CANCEL_OPTION) { _graphContext.getJobGraph().refresh(); return false; } } } return true; }
java
private boolean scopeUpdatePermitted(final AnalysisJobBuilder sourceAnalysisJobBuilder, final ComponentBuilder componentBuilder) { if (sourceAnalysisJobBuilder != componentBuilder.getAnalysisJobBuilder()) { if (componentBuilder.getInput().length > 0 || componentBuilder.getComponentRequirement() != null) { final String scopeText; scopeText = LabelUtils.getScopeLabel(sourceAnalysisJobBuilder); final int response = JOptionPane.showConfirmDialog(_graphContext.getVisualizationViewer(), "This will move " + LabelUtils.getLabel(componentBuilder) + " into the " + scopeText + ", thereby losing its configured columns and/or requirements", "Change scope?", JOptionPane.OK_CANCEL_OPTION, JOptionPane.WARNING_MESSAGE); if (response == JOptionPane.CANCEL_OPTION) { _graphContext.getJobGraph().refresh(); return false; } } } return true; }
[ "private", "boolean", "scopeUpdatePermitted", "(", "final", "AnalysisJobBuilder", "sourceAnalysisJobBuilder", ",", "final", "ComponentBuilder", "componentBuilder", ")", "{", "if", "(", "sourceAnalysisJobBuilder", "!=", "componentBuilder", ".", "getAnalysisJobBuilder", "(", ")", ")", "{", "if", "(", "componentBuilder", ".", "getInput", "(", ")", ".", "length", ">", "0", "||", "componentBuilder", ".", "getComponentRequirement", "(", ")", "!=", "null", ")", "{", "final", "String", "scopeText", ";", "scopeText", "=", "LabelUtils", ".", "getScopeLabel", "(", "sourceAnalysisJobBuilder", ")", ";", "final", "int", "response", "=", "JOptionPane", ".", "showConfirmDialog", "(", "_graphContext", ".", "getVisualizationViewer", "(", ")", ",", "\"This will move \"", "+", "LabelUtils", ".", "getLabel", "(", "componentBuilder", ")", "+", "\" into the \"", "+", "scopeText", "+", "\", thereby losing its configured columns and/or requirements\"", ",", "\"Change scope?\"", ",", "JOptionPane", ".", "OK_CANCEL_OPTION", ",", "JOptionPane", ".", "WARNING_MESSAGE", ")", ";", "if", "(", "response", "==", "JOptionPane", ".", "CANCEL_OPTION", ")", "{", "_graphContext", ".", "getJobGraph", "(", ")", ".", "refresh", "(", ")", ";", "return", "false", ";", "}", "}", "}", "return", "true", ";", "}" ]
This will check if components are in a different scope, and ask the user for permission to change the scope of the target component @return true if permitted or irrelevant, false if user refused a necessary scope change.
[ "This", "will", "check", "if", "components", "are", "in", "a", "different", "scope", "and", "ask", "the", "user", "for", "permission", "to", "change", "the", "scope", "of", "the", "target", "component" ]
9aa01fdac3560cef51c55df3cb2ac5c690b57639
https://github.com/datacleaner/DataCleaner/blob/9aa01fdac3560cef51c55df3cb2ac5c690b57639/desktop/ui/src/main/java/org/datacleaner/widgets/visualization/JobGraphLinkPainter.java#L344-L362
26,383
datacleaner/DataCleaner
desktop/api/src/main/java/org/datacleaner/util/WidgetUtils.java
WidgetUtils.colorBetween
public static Color colorBetween(final Color c1, final Color c2) { final int red = (c1.getRed() + c2.getRed()) / 2; final int green = (c1.getGreen() + c2.getGreen()) / 2; final int blue = (c1.getBlue() + c2.getBlue()) / 2; return new Color(red, green, blue); }
java
public static Color colorBetween(final Color c1, final Color c2) { final int red = (c1.getRed() + c2.getRed()) / 2; final int green = (c1.getGreen() + c2.getGreen()) / 2; final int blue = (c1.getBlue() + c2.getBlue()) / 2; return new Color(red, green, blue); }
[ "public", "static", "Color", "colorBetween", "(", "final", "Color", "c1", ",", "final", "Color", "c2", ")", "{", "final", "int", "red", "=", "(", "c1", ".", "getRed", "(", ")", "+", "c2", ".", "getRed", "(", ")", ")", "/", "2", ";", "final", "int", "green", "=", "(", "c1", ".", "getGreen", "(", ")", "+", "c2", ".", "getGreen", "(", ")", ")", "/", "2", ";", "final", "int", "blue", "=", "(", "c1", ".", "getBlue", "(", ")", "+", "c2", ".", "getBlue", "(", ")", ")", "/", "2", ";", "return", "new", "Color", "(", "red", ",", "green", ",", "blue", ")", ";", "}" ]
Creates a color that is in between two colors, in terms of RGB balance. @param c1 @param c2 @return
[ "Creates", "a", "color", "that", "is", "in", "between", "two", "colors", "in", "terms", "of", "RGB", "balance", "." ]
9aa01fdac3560cef51c55df3cb2ac5c690b57639
https://github.com/datacleaner/DataCleaner/blob/9aa01fdac3560cef51c55df3cb2ac5c690b57639/desktop/api/src/main/java/org/datacleaner/util/WidgetUtils.java#L516-L521
26,384
datacleaner/DataCleaner
desktop/api/src/main/java/org/datacleaner/util/WidgetUtils.java
WidgetUtils.decorateWithShadow
public static DCPanel decorateWithShadow(final JComponent comp, final boolean outline, final int margin) { final DCPanel panel = new DCPanel(); panel.setLayout(new BorderLayout()); Border border = BORDER_SHADOW; if (outline) { border = new CompoundBorder(border, BORDER_THIN); } if (margin > 0) { border = new CompoundBorder(new EmptyBorder(margin, margin, margin, margin), border); } panel.setBorder(border); panel.add(comp, BorderLayout.CENTER); return panel; }
java
public static DCPanel decorateWithShadow(final JComponent comp, final boolean outline, final int margin) { final DCPanel panel = new DCPanel(); panel.setLayout(new BorderLayout()); Border border = BORDER_SHADOW; if (outline) { border = new CompoundBorder(border, BORDER_THIN); } if (margin > 0) { border = new CompoundBorder(new EmptyBorder(margin, margin, margin, margin), border); } panel.setBorder(border); panel.add(comp, BorderLayout.CENTER); return panel; }
[ "public", "static", "DCPanel", "decorateWithShadow", "(", "final", "JComponent", "comp", ",", "final", "boolean", "outline", ",", "final", "int", "margin", ")", "{", "final", "DCPanel", "panel", "=", "new", "DCPanel", "(", ")", ";", "panel", ".", "setLayout", "(", "new", "BorderLayout", "(", ")", ")", ";", "Border", "border", "=", "BORDER_SHADOW", ";", "if", "(", "outline", ")", "{", "border", "=", "new", "CompoundBorder", "(", "border", ",", "BORDER_THIN", ")", ";", "}", "if", "(", "margin", ">", "0", ")", "{", "border", "=", "new", "CompoundBorder", "(", "new", "EmptyBorder", "(", "margin", ",", "margin", ",", "margin", ",", "margin", ")", ",", "border", ")", ";", "}", "panel", ".", "setBorder", "(", "border", ")", ";", "panel", ".", "add", "(", "comp", ",", "BorderLayout", ".", "CENTER", ")", ";", "return", "panel", ";", "}" ]
Decorates a JComponent with a nice shadow border. Since not all JComponents handle opacity correctly, they will be wrapped inside a DCPanel, which actually has the border. @param comp @param outline @param margin @return
[ "Decorates", "a", "JComponent", "with", "a", "nice", "shadow", "border", ".", "Since", "not", "all", "JComponents", "handle", "opacity", "correctly", "they", "will", "be", "wrapped", "inside", "a", "DCPanel", "which", "actually", "has", "the", "border", "." ]
9aa01fdac3560cef51c55df3cb2ac5c690b57639
https://github.com/datacleaner/DataCleaner/blob/9aa01fdac3560cef51c55df3cb2ac5c690b57639/desktop/api/src/main/java/org/datacleaner/util/WidgetUtils.java#L615-L628
26,385
datacleaner/DataCleaner
desktop/api/src/main/java/org/datacleaner/util/WidgetUtils.java
WidgetUtils.findCompatibleFont
public static Font findCompatibleFont(final String text, final Font fallbackFont) { final String[] searchFonts = new String[] { Font.SANS_SERIF, Font.SERIF, "Verdana", "Arial Unicode MS", "MS UI Gothic", "MS Mincho", "MS Gothic", "Osaka" }; for (final String fontName : searchFonts) { Font font = fonts.get(fontName); if (font == null) { font = new Font(fontName, fallbackFont.getStyle(), fallbackFont.getSize()); } if (font.canDisplayUpTo(text) == -1) { logger.info("Font '{}' was capable, returning", fontName); font = font.deriveFont(fallbackFont.getSize2D()); return font; } } logger.warn("Didn't find any capable fonts for text '{}'", text); return fallbackFont; }
java
public static Font findCompatibleFont(final String text, final Font fallbackFont) { final String[] searchFonts = new String[] { Font.SANS_SERIF, Font.SERIF, "Verdana", "Arial Unicode MS", "MS UI Gothic", "MS Mincho", "MS Gothic", "Osaka" }; for (final String fontName : searchFonts) { Font font = fonts.get(fontName); if (font == null) { font = new Font(fontName, fallbackFont.getStyle(), fallbackFont.getSize()); } if (font.canDisplayUpTo(text) == -1) { logger.info("Font '{}' was capable, returning", fontName); font = font.deriveFont(fallbackFont.getSize2D()); return font; } } logger.warn("Didn't find any capable fonts for text '{}'", text); return fallbackFont; }
[ "public", "static", "Font", "findCompatibleFont", "(", "final", "String", "text", ",", "final", "Font", "fallbackFont", ")", "{", "final", "String", "[", "]", "searchFonts", "=", "new", "String", "[", "]", "{", "Font", ".", "SANS_SERIF", ",", "Font", ".", "SERIF", ",", "\"Verdana\"", ",", "\"Arial Unicode MS\"", ",", "\"MS UI Gothic\"", ",", "\"MS Mincho\"", ",", "\"MS Gothic\"", ",", "\"Osaka\"", "}", ";", "for", "(", "final", "String", "fontName", ":", "searchFonts", ")", "{", "Font", "font", "=", "fonts", ".", "get", "(", "fontName", ")", ";", "if", "(", "font", "==", "null", ")", "{", "font", "=", "new", "Font", "(", "fontName", ",", "fallbackFont", ".", "getStyle", "(", ")", ",", "fallbackFont", ".", "getSize", "(", ")", ")", ";", "}", "if", "(", "font", ".", "canDisplayUpTo", "(", "text", ")", "==", "-", "1", ")", "{", "logger", ".", "info", "(", "\"Font '{}' was capable, returning\"", ",", "fontName", ")", ";", "font", "=", "font", ".", "deriveFont", "(", "fallbackFont", ".", "getSize2D", "(", ")", ")", ";", "return", "font", ";", "}", "}", "logger", ".", "warn", "(", "\"Didn't find any capable fonts for text '{}'\"", ",", "text", ")", ";", "return", "fallbackFont", ";", "}" ]
Finds a font that is capable of displaying the provided text. @param text the text to display. @param fallbackFont the font to fall back to in case no capable font was found @return a font suitable for displaying the text
[ "Finds", "a", "font", "that", "is", "capable", "of", "displaying", "the", "provided", "text", "." ]
9aa01fdac3560cef51c55df3cb2ac5c690b57639
https://github.com/datacleaner/DataCleaner/blob/9aa01fdac3560cef51c55df3cb2ac5c690b57639/desktop/api/src/main/java/org/datacleaner/util/WidgetUtils.java#L637-L655
26,386
datacleaner/DataCleaner
engine/env/cluster/src/main/java/org/datacleaner/cluster/DistributedAnalysisRunner.java
DistributedAnalysisRunner.findOrderByColumn
private InputColumn<?> findOrderByColumn(final AnalysisJobBuilder jobBuilder) { final Table sourceTable = jobBuilder.getSourceTables().get(0); // preferred strategy: Use the primary key final List<Column> primaryKeys = sourceTable.getPrimaryKeys(); if (primaryKeys.size() == 1) { final Column primaryKey = primaryKeys.get(0); final InputColumn<?> sourceColumn = jobBuilder.getSourceColumnByName(primaryKey.getName()); if (sourceColumn == null) { jobBuilder.addSourceColumn(primaryKey); logger.info("Added PK source column for ORDER BY clause on slave jobs: {}", sourceColumn); return jobBuilder.getSourceColumnByName(primaryKey.getName()); } else { logger.info("Using existing PK source column for ORDER BY clause on slave jobs: {}", sourceColumn); return sourceColumn; } } else { if (logger.isDebugEnabled()) { logger.debug("Found {} primary keys, cannot select a single for ORDER BY clause on slave jobs: {}", primaryKeys.size(), primaryKeys.size()); } } // secondary strategy: See if there's a source column called something // like 'ID' or so, and use that. final List<MetaModelInputColumn> sourceColumns = jobBuilder.getSourceColumns(); final String tableName = sourceTable.getName().toLowerCase(); for (final MetaModelInputColumn sourceColumn : sourceColumns) { String name = sourceColumn.getName(); if (name != null) { name = StringUtils.replaceWhitespaces(name, ""); name = StringUtils.replaceAll(name, "_", ""); name = StringUtils.replaceAll(name, "-", ""); name = name.toLowerCase(); if ("id".equals(name) || (tableName + "id").equals(name) || (tableName + "number").equals(name) || ( tableName + "key").equals(name)) { logger.info("Using existing source column for ORDER BY clause on slave jobs: {}", sourceColumn); return sourceColumn; } } } // last resort: Pick any source column and sort on that (might not work // if the column contains a lot of repeated values) final MetaModelInputColumn sourceColumn = sourceColumns.get(0); logger.warn( "Couldn't pick a good source column for ORDER BY clause on slave jobs. Picking the first column: {}", sourceColumn); return sourceColumn; }
java
private InputColumn<?> findOrderByColumn(final AnalysisJobBuilder jobBuilder) { final Table sourceTable = jobBuilder.getSourceTables().get(0); // preferred strategy: Use the primary key final List<Column> primaryKeys = sourceTable.getPrimaryKeys(); if (primaryKeys.size() == 1) { final Column primaryKey = primaryKeys.get(0); final InputColumn<?> sourceColumn = jobBuilder.getSourceColumnByName(primaryKey.getName()); if (sourceColumn == null) { jobBuilder.addSourceColumn(primaryKey); logger.info("Added PK source column for ORDER BY clause on slave jobs: {}", sourceColumn); return jobBuilder.getSourceColumnByName(primaryKey.getName()); } else { logger.info("Using existing PK source column for ORDER BY clause on slave jobs: {}", sourceColumn); return sourceColumn; } } else { if (logger.isDebugEnabled()) { logger.debug("Found {} primary keys, cannot select a single for ORDER BY clause on slave jobs: {}", primaryKeys.size(), primaryKeys.size()); } } // secondary strategy: See if there's a source column called something // like 'ID' or so, and use that. final List<MetaModelInputColumn> sourceColumns = jobBuilder.getSourceColumns(); final String tableName = sourceTable.getName().toLowerCase(); for (final MetaModelInputColumn sourceColumn : sourceColumns) { String name = sourceColumn.getName(); if (name != null) { name = StringUtils.replaceWhitespaces(name, ""); name = StringUtils.replaceAll(name, "_", ""); name = StringUtils.replaceAll(name, "-", ""); name = name.toLowerCase(); if ("id".equals(name) || (tableName + "id").equals(name) || (tableName + "number").equals(name) || ( tableName + "key").equals(name)) { logger.info("Using existing source column for ORDER BY clause on slave jobs: {}", sourceColumn); return sourceColumn; } } } // last resort: Pick any source column and sort on that (might not work // if the column contains a lot of repeated values) final MetaModelInputColumn sourceColumn = sourceColumns.get(0); logger.warn( "Couldn't pick a good source column for ORDER BY clause on slave jobs. Picking the first column: {}", sourceColumn); return sourceColumn; }
[ "private", "InputColumn", "<", "?", ">", "findOrderByColumn", "(", "final", "AnalysisJobBuilder", "jobBuilder", ")", "{", "final", "Table", "sourceTable", "=", "jobBuilder", ".", "getSourceTables", "(", ")", ".", "get", "(", "0", ")", ";", "// preferred strategy: Use the primary key", "final", "List", "<", "Column", ">", "primaryKeys", "=", "sourceTable", ".", "getPrimaryKeys", "(", ")", ";", "if", "(", "primaryKeys", ".", "size", "(", ")", "==", "1", ")", "{", "final", "Column", "primaryKey", "=", "primaryKeys", ".", "get", "(", "0", ")", ";", "final", "InputColumn", "<", "?", ">", "sourceColumn", "=", "jobBuilder", ".", "getSourceColumnByName", "(", "primaryKey", ".", "getName", "(", ")", ")", ";", "if", "(", "sourceColumn", "==", "null", ")", "{", "jobBuilder", ".", "addSourceColumn", "(", "primaryKey", ")", ";", "logger", ".", "info", "(", "\"Added PK source column for ORDER BY clause on slave jobs: {}\"", ",", "sourceColumn", ")", ";", "return", "jobBuilder", ".", "getSourceColumnByName", "(", "primaryKey", ".", "getName", "(", ")", ")", ";", "}", "else", "{", "logger", ".", "info", "(", "\"Using existing PK source column for ORDER BY clause on slave jobs: {}\"", ",", "sourceColumn", ")", ";", "return", "sourceColumn", ";", "}", "}", "else", "{", "if", "(", "logger", ".", "isDebugEnabled", "(", ")", ")", "{", "logger", ".", "debug", "(", "\"Found {} primary keys, cannot select a single for ORDER BY clause on slave jobs: {}\"", ",", "primaryKeys", ".", "size", "(", ")", ",", "primaryKeys", ".", "size", "(", ")", ")", ";", "}", "}", "// secondary strategy: See if there's a source column called something", "// like 'ID' or so, and use that.", "final", "List", "<", "MetaModelInputColumn", ">", "sourceColumns", "=", "jobBuilder", ".", "getSourceColumns", "(", ")", ";", "final", "String", "tableName", "=", "sourceTable", ".", "getName", "(", ")", ".", "toLowerCase", "(", ")", ";", "for", "(", "final", "MetaModelInputColumn", "sourceColumn", ":", "sourceColumns", ")", "{", "String", "name", "=", "sourceColumn", ".", "getName", "(", ")", ";", "if", "(", "name", "!=", "null", ")", "{", "name", "=", "StringUtils", ".", "replaceWhitespaces", "(", "name", ",", "\"\"", ")", ";", "name", "=", "StringUtils", ".", "replaceAll", "(", "name", ",", "\"_\"", ",", "\"\"", ")", ";", "name", "=", "StringUtils", ".", "replaceAll", "(", "name", ",", "\"-\"", ",", "\"\"", ")", ";", "name", "=", "name", ".", "toLowerCase", "(", ")", ";", "if", "(", "\"id\"", ".", "equals", "(", "name", ")", "||", "(", "tableName", "+", "\"id\"", ")", ".", "equals", "(", "name", ")", "||", "(", "tableName", "+", "\"number\"", ")", ".", "equals", "(", "name", ")", "||", "(", "tableName", "+", "\"key\"", ")", ".", "equals", "(", "name", ")", ")", "{", "logger", ".", "info", "(", "\"Using existing source column for ORDER BY clause on slave jobs: {}\"", ",", "sourceColumn", ")", ";", "return", "sourceColumn", ";", "}", "}", "}", "// last resort: Pick any source column and sort on that (might not work", "// if the column contains a lot of repeated values)", "final", "MetaModelInputColumn", "sourceColumn", "=", "sourceColumns", ".", "get", "(", "0", ")", ";", "logger", ".", "warn", "(", "\"Couldn't pick a good source column for ORDER BY clause on slave jobs. Picking the first column: {}\"", ",", "sourceColumn", ")", ";", "return", "sourceColumn", ";", "}" ]
Finds a source column which is appropriate for an ORDER BY clause in the generated paginated queries @param jobBuilder @return
[ "Finds", "a", "source", "column", "which", "is", "appropriate", "for", "an", "ORDER", "BY", "clause", "in", "the", "generated", "paginated", "queries" ]
9aa01fdac3560cef51c55df3cb2ac5c690b57639
https://github.com/datacleaner/DataCleaner/blob/9aa01fdac3560cef51c55df3cb2ac5c690b57639/engine/env/cluster/src/main/java/org/datacleaner/cluster/DistributedAnalysisRunner.java#L276-L325
26,387
datacleaner/DataCleaner
components/html-rendering/src/main/java/org/datacleaner/result/renderer/TableBodyElement.java
TableBodyElement.getCellValue
protected String getCellValue(final HtmlRenderingContext context, final int row, final int col, final Object value) { final String stringValue = LabelUtils.getValueLabel(value); return context.escapeHtml(stringValue); }
java
protected String getCellValue(final HtmlRenderingContext context, final int row, final int col, final Object value) { final String stringValue = LabelUtils.getValueLabel(value); return context.escapeHtml(stringValue); }
[ "protected", "String", "getCellValue", "(", "final", "HtmlRenderingContext", "context", ",", "final", "int", "row", ",", "final", "int", "col", ",", "final", "Object", "value", ")", "{", "final", "String", "stringValue", "=", "LabelUtils", ".", "getValueLabel", "(", "value", ")", ";", "return", "context", ".", "escapeHtml", "(", "stringValue", ")", ";", "}" ]
Overrideable method for defining a cell's literal HTML value in the table @param context @param row @param col @param value @return
[ "Overrideable", "method", "for", "defining", "a", "cell", "s", "literal", "HTML", "value", "in", "the", "table" ]
9aa01fdac3560cef51c55df3cb2ac5c690b57639
https://github.com/datacleaner/DataCleaner/blob/9aa01fdac3560cef51c55df3cb2ac5c690b57639/components/html-rendering/src/main/java/org/datacleaner/result/renderer/TableBodyElement.java#L151-L155
26,388
datacleaner/DataCleaner
desktop/ui/src/main/java/org/datacleaner/actions/OpenAnalysisJobActionListener.java
OpenAnalysisJobActionListener.openAnalysisJob
public Injector openAnalysisJob(final FileObject file) { final JaxbJobReader reader = new JaxbJobReader(_configuration); try { final AnalysisJobBuilder ajb = reader.create(file); return openAnalysisJob(file, ajb); } catch (final NoSuchComponentException e) { final String message; if (Version.EDITION_COMMUNITY.equals(Version.getEdition())) { message = "<html><p>Failed to open job because of a missing component:</p><pre>" + e.getMessage() + "</pre><p>This may happen if the job requires a " + "<a href=\"https://www.quadient.com/products/quadient-datacleaner#get-started-today\">" + "Commercial Edition of DataCleaner</a>, or an extension that you do not have installed.</p>" + "</html>"; } else { message = "<html>Failed to open job because of a missing component: " + e.getMessage() + "<br/><br/>" + "This may happen if the job requires an extension that you do not have installed.</html>"; } WidgetUtils.showErrorMessage("Cannot open job", message); return null; } catch (final NoSuchDatastoreException e) { if (_windowContext == null) { // This can happen in case of single-datastore + job file // bootstrapping of DC throw e; } final AnalysisJobMetadata metadata = reader.readMetadata(file); final int result = JOptionPane .showConfirmDialog(null, e.getMessage() + "\n\nDo you wish to open this job as a template?", "Error: " + e.getMessage(), JOptionPane.OK_CANCEL_OPTION, JOptionPane.ERROR_MESSAGE); if (result == JOptionPane.OK_OPTION) { final OpenAnalysisJobAsTemplateDialog dialog = new OpenAnalysisJobAsTemplateDialog(_windowContext, _configuration, file, metadata, Providers.of(this)); dialog.setVisible(true); } return null; } catch (final ComponentConfigurationException e) { final String message; final Throwable cause = e.getCause(); if (cause != null) { // check for causes of the mis-configuration. If there's a cause // with a message, then show the message first and foremost // (usually a validation error). if (!Strings.isNullOrEmpty(cause.getMessage())) { message = cause.getMessage(); } else { message = e.getMessage(); } } else { message = e.getMessage(); } WidgetUtils.showErrorMessage("Failed to validate job configuration", message, e); return null; } catch (final RuntimeException e) { logger.error("Unexpected failure when opening job: {}", file, e); throw e; } }
java
public Injector openAnalysisJob(final FileObject file) { final JaxbJobReader reader = new JaxbJobReader(_configuration); try { final AnalysisJobBuilder ajb = reader.create(file); return openAnalysisJob(file, ajb); } catch (final NoSuchComponentException e) { final String message; if (Version.EDITION_COMMUNITY.equals(Version.getEdition())) { message = "<html><p>Failed to open job because of a missing component:</p><pre>" + e.getMessage() + "</pre><p>This may happen if the job requires a " + "<a href=\"https://www.quadient.com/products/quadient-datacleaner#get-started-today\">" + "Commercial Edition of DataCleaner</a>, or an extension that you do not have installed.</p>" + "</html>"; } else { message = "<html>Failed to open job because of a missing component: " + e.getMessage() + "<br/><br/>" + "This may happen if the job requires an extension that you do not have installed.</html>"; } WidgetUtils.showErrorMessage("Cannot open job", message); return null; } catch (final NoSuchDatastoreException e) { if (_windowContext == null) { // This can happen in case of single-datastore + job file // bootstrapping of DC throw e; } final AnalysisJobMetadata metadata = reader.readMetadata(file); final int result = JOptionPane .showConfirmDialog(null, e.getMessage() + "\n\nDo you wish to open this job as a template?", "Error: " + e.getMessage(), JOptionPane.OK_CANCEL_OPTION, JOptionPane.ERROR_MESSAGE); if (result == JOptionPane.OK_OPTION) { final OpenAnalysisJobAsTemplateDialog dialog = new OpenAnalysisJobAsTemplateDialog(_windowContext, _configuration, file, metadata, Providers.of(this)); dialog.setVisible(true); } return null; } catch (final ComponentConfigurationException e) { final String message; final Throwable cause = e.getCause(); if (cause != null) { // check for causes of the mis-configuration. If there's a cause // with a message, then show the message first and foremost // (usually a validation error). if (!Strings.isNullOrEmpty(cause.getMessage())) { message = cause.getMessage(); } else { message = e.getMessage(); } } else { message = e.getMessage(); } WidgetUtils.showErrorMessage("Failed to validate job configuration", message, e); return null; } catch (final RuntimeException e) { logger.error("Unexpected failure when opening job: {}", file, e); throw e; } }
[ "public", "Injector", "openAnalysisJob", "(", "final", "FileObject", "file", ")", "{", "final", "JaxbJobReader", "reader", "=", "new", "JaxbJobReader", "(", "_configuration", ")", ";", "try", "{", "final", "AnalysisJobBuilder", "ajb", "=", "reader", ".", "create", "(", "file", ")", ";", "return", "openAnalysisJob", "(", "file", ",", "ajb", ")", ";", "}", "catch", "(", "final", "NoSuchComponentException", "e", ")", "{", "final", "String", "message", ";", "if", "(", "Version", ".", "EDITION_COMMUNITY", ".", "equals", "(", "Version", ".", "getEdition", "(", ")", ")", ")", "{", "message", "=", "\"<html><p>Failed to open job because of a missing component:</p><pre>\"", "+", "e", ".", "getMessage", "(", ")", "+", "\"</pre><p>This may happen if the job requires a \"", "+", "\"<a href=\\\"https://www.quadient.com/products/quadient-datacleaner#get-started-today\\\">\"", "+", "\"Commercial Edition of DataCleaner</a>, or an extension that you do not have installed.</p>\"", "+", "\"</html>\"", ";", "}", "else", "{", "message", "=", "\"<html>Failed to open job because of a missing component: \"", "+", "e", ".", "getMessage", "(", ")", "+", "\"<br/><br/>\"", "+", "\"This may happen if the job requires an extension that you do not have installed.</html>\"", ";", "}", "WidgetUtils", ".", "showErrorMessage", "(", "\"Cannot open job\"", ",", "message", ")", ";", "return", "null", ";", "}", "catch", "(", "final", "NoSuchDatastoreException", "e", ")", "{", "if", "(", "_windowContext", "==", "null", ")", "{", "// This can happen in case of single-datastore + job file", "// bootstrapping of DC", "throw", "e", ";", "}", "final", "AnalysisJobMetadata", "metadata", "=", "reader", ".", "readMetadata", "(", "file", ")", ";", "final", "int", "result", "=", "JOptionPane", ".", "showConfirmDialog", "(", "null", ",", "e", ".", "getMessage", "(", ")", "+", "\"\\n\\nDo you wish to open this job as a template?\"", ",", "\"Error: \"", "+", "e", ".", "getMessage", "(", ")", ",", "JOptionPane", ".", "OK_CANCEL_OPTION", ",", "JOptionPane", ".", "ERROR_MESSAGE", ")", ";", "if", "(", "result", "==", "JOptionPane", ".", "OK_OPTION", ")", "{", "final", "OpenAnalysisJobAsTemplateDialog", "dialog", "=", "new", "OpenAnalysisJobAsTemplateDialog", "(", "_windowContext", ",", "_configuration", ",", "file", ",", "metadata", ",", "Providers", ".", "of", "(", "this", ")", ")", ";", "dialog", ".", "setVisible", "(", "true", ")", ";", "}", "return", "null", ";", "}", "catch", "(", "final", "ComponentConfigurationException", "e", ")", "{", "final", "String", "message", ";", "final", "Throwable", "cause", "=", "e", ".", "getCause", "(", ")", ";", "if", "(", "cause", "!=", "null", ")", "{", "// check for causes of the mis-configuration. If there's a cause", "// with a message, then show the message first and foremost", "// (usually a validation error).", "if", "(", "!", "Strings", ".", "isNullOrEmpty", "(", "cause", ".", "getMessage", "(", ")", ")", ")", "{", "message", "=", "cause", ".", "getMessage", "(", ")", ";", "}", "else", "{", "message", "=", "e", ".", "getMessage", "(", ")", ";", "}", "}", "else", "{", "message", "=", "e", ".", "getMessage", "(", ")", ";", "}", "WidgetUtils", ".", "showErrorMessage", "(", "\"Failed to validate job configuration\"", ",", "message", ",", "e", ")", ";", "return", "null", ";", "}", "catch", "(", "final", "RuntimeException", "e", ")", "{", "logger", ".", "error", "(", "\"Unexpected failure when opening job: {}\"", ",", "file", ",", "e", ")", ";", "throw", "e", ";", "}", "}" ]
Opens a job file @param file @return
[ "Opens", "a", "job", "file" ]
9aa01fdac3560cef51c55df3cb2ac5c690b57639
https://github.com/datacleaner/DataCleaner/blob/9aa01fdac3560cef51c55df3cb2ac5c690b57639/desktop/ui/src/main/java/org/datacleaner/actions/OpenAnalysisJobActionListener.java#L189-L250
26,389
datacleaner/DataCleaner
desktop/ui/src/main/java/org/datacleaner/actions/OpenAnalysisJobActionListener.java
OpenAnalysisJobActionListener.openAnalysisJob
public Injector openAnalysisJob(final FileObject fileObject, final AnalysisJobBuilder ajb) { final File file = VFSUtils.toFile(fileObject); if (file != null) { _userPreferences.setAnalysisJobDirectory(file.getParentFile()); _userPreferences.addRecentJobFile(fileObject); } return Guice.createInjector(new DCModuleImpl(_parentModule, ajb) { public FileObject getJobFilename() { return fileObject; } }); }
java
public Injector openAnalysisJob(final FileObject fileObject, final AnalysisJobBuilder ajb) { final File file = VFSUtils.toFile(fileObject); if (file != null) { _userPreferences.setAnalysisJobDirectory(file.getParentFile()); _userPreferences.addRecentJobFile(fileObject); } return Guice.createInjector(new DCModuleImpl(_parentModule, ajb) { public FileObject getJobFilename() { return fileObject; } }); }
[ "public", "Injector", "openAnalysisJob", "(", "final", "FileObject", "fileObject", ",", "final", "AnalysisJobBuilder", "ajb", ")", "{", "final", "File", "file", "=", "VFSUtils", ".", "toFile", "(", "fileObject", ")", ";", "if", "(", "file", "!=", "null", ")", "{", "_userPreferences", ".", "setAnalysisJobDirectory", "(", "file", ".", "getParentFile", "(", ")", ")", ";", "_userPreferences", ".", "addRecentJobFile", "(", "fileObject", ")", ";", "}", "return", "Guice", ".", "createInjector", "(", "new", "DCModuleImpl", "(", "_parentModule", ",", "ajb", ")", "{", "public", "FileObject", "getJobFilename", "(", ")", "{", "return", "fileObject", ";", "}", "}", ")", ";", "}" ]
Opens a job builder @param fileObject @param ajb @return
[ "Opens", "a", "job", "builder" ]
9aa01fdac3560cef51c55df3cb2ac5c690b57639
https://github.com/datacleaner/DataCleaner/blob/9aa01fdac3560cef51c55df3cb2ac5c690b57639/desktop/ui/src/main/java/org/datacleaner/actions/OpenAnalysisJobActionListener.java#L259-L273
26,390
datacleaner/DataCleaner
engine/core/src/main/java/org/datacleaner/util/VFSUtils.java
VFSUtils.getFileSystemManager
public static FileSystemManager getFileSystemManager() { try { final FileSystemManager manager = VFS.getManager(); if (manager.getBaseFile() == null) { // if no base file exists, set the working directory to base // dir. ((DefaultFileSystemManager) manager).setBaseFile(new File(".")); } return manager; } catch (final FileSystemException e) { throw new IllegalStateException(e); } }
java
public static FileSystemManager getFileSystemManager() { try { final FileSystemManager manager = VFS.getManager(); if (manager.getBaseFile() == null) { // if no base file exists, set the working directory to base // dir. ((DefaultFileSystemManager) manager).setBaseFile(new File(".")); } return manager; } catch (final FileSystemException e) { throw new IllegalStateException(e); } }
[ "public", "static", "FileSystemManager", "getFileSystemManager", "(", ")", "{", "try", "{", "final", "FileSystemManager", "manager", "=", "VFS", ".", "getManager", "(", ")", ";", "if", "(", "manager", ".", "getBaseFile", "(", ")", "==", "null", ")", "{", "// if no base file exists, set the working directory to base", "// dir.", "(", "(", "DefaultFileSystemManager", ")", "manager", ")", ".", "setBaseFile", "(", "new", "File", "(", "\".\"", ")", ")", ";", "}", "return", "manager", ";", "}", "catch", "(", "final", "FileSystemException", "e", ")", "{", "throw", "new", "IllegalStateException", "(", "e", ")", ";", "}", "}" ]
Gets the file system manager to use in typical scenarios. @return
[ "Gets", "the", "file", "system", "manager", "to", "use", "in", "typical", "scenarios", "." ]
9aa01fdac3560cef51c55df3cb2ac5c690b57639
https://github.com/datacleaner/DataCleaner/blob/9aa01fdac3560cef51c55df3cb2ac5c690b57639/engine/core/src/main/java/org/datacleaner/util/VFSUtils.java#L44-L56
26,391
datacleaner/DataCleaner
engine/xml-config/src/main/java/org/datacleaner/configuration/JaxbConfigurationReader.java
JaxbConfigurationReader.createCustomElement
private <E> E createCustomElement(final CustomElementType customElementType, final Class<E> expectedClazz, final DataCleanerConfiguration configuration, final boolean initialize) { final InjectionManager injectionManager = configuration.getEnvironment().getInjectionManagerFactory().getInjectionManager(configuration); return createCustomElementInternal(customElementType, expectedClazz, injectionManager, initialize); }
java
private <E> E createCustomElement(final CustomElementType customElementType, final Class<E> expectedClazz, final DataCleanerConfiguration configuration, final boolean initialize) { final InjectionManager injectionManager = configuration.getEnvironment().getInjectionManagerFactory().getInjectionManager(configuration); return createCustomElementInternal(customElementType, expectedClazz, injectionManager, initialize); }
[ "private", "<", "E", ">", "E", "createCustomElement", "(", "final", "CustomElementType", "customElementType", ",", "final", "Class", "<", "E", ">", "expectedClazz", ",", "final", "DataCleanerConfiguration", "configuration", ",", "final", "boolean", "initialize", ")", "{", "final", "InjectionManager", "injectionManager", "=", "configuration", ".", "getEnvironment", "(", ")", ".", "getInjectionManagerFactory", "(", ")", ".", "getInjectionManager", "(", "configuration", ")", ";", "return", "createCustomElementInternal", "(", "customElementType", ",", "expectedClazz", ",", "injectionManager", ",", "initialize", ")", ";", "}" ]
Creates a custom component based on an element which specified just a class name and an optional set of properties. @param <E> @param customElementType the JAXB custom element type @param expectedClazz an expected class or interface that the component should honor @param configuration the DataCleaner configuration (may be temporary) in use @param initialize whether or not to call any initialize methods on the component (reference data should not be initialized, while eg. custom task runners support this. @return the custom component
[ "Creates", "a", "custom", "component", "based", "on", "an", "element", "which", "specified", "just", "a", "class", "name", "and", "an", "optional", "set", "of", "properties", "." ]
9aa01fdac3560cef51c55df3cb2ac5c690b57639
https://github.com/datacleaner/DataCleaner/blob/9aa01fdac3560cef51c55df3cb2ac5c690b57639/engine/xml-config/src/main/java/org/datacleaner/configuration/JaxbConfigurationReader.java#L1563-L1568
26,392
spring-projects/spring-loaded
springloaded/src/main/java/org/springsource/loaded/RTH.java
RTH.collapse
public static Object[] collapse(String aString, int anInt) { return new Object[] { aString, Integer.valueOf(anInt) }; }
java
public static Object[] collapse(String aString, int anInt) { return new Object[] { aString, Integer.valueOf(anInt) }; }
[ "public", "static", "Object", "[", "]", "collapse", "(", "String", "aString", ",", "int", "anInt", ")", "{", "return", "new", "Object", "[", "]", "{", "aString", ",", "Integer", ".", "valueOf", "(", "anInt", ")", "}", ";", "}" ]
Collapse a String and int into an array @param aString some string @param anInt some int @return the collapsed array
[ "Collapse", "a", "String", "and", "int", "into", "an", "array" ]
59b32f957a05c6d9f149148158053605e2a6205a
https://github.com/spring-projects/spring-loaded/blob/59b32f957a05c6d9f149148158053605e2a6205a/springloaded/src/main/java/org/springsource/loaded/RTH.java#L40-L42
26,393
spring-projects/spring-loaded
springloaded/src/main/java/org/springsource/loaded/ri/ReloadedTypeInvoker.java
ReloadedTypeInvoker.createJavaMethod
@Override public Method createJavaMethod() { Class<?> clazz = rtype.getClazz(); String name = methodMember.getName(); String methodDescriptor = methodMember.getDescriptor(); ClassLoader classLoader = rtype.getTypeRegistry().getClassLoader(); try { Class<?>[] params = Utils.toParamClasses(methodDescriptor, classLoader); Class<?> returnType = Utils.toClass(Type.getReturnType(methodDescriptor), classLoader); Class<?>[] exceptions = Utils.slashedNamesToClasses(methodMember.getExceptions(), classLoader); return JVM.newMethod(clazz, name, params, returnType, exceptions, methodMember.getModifiers(), methodMember.getGenericSignature()); } catch (ClassNotFoundException e) { throw new IllegalStateException("Couldn't create j.l.r.Method for " + clazz.getName() + "." + methodDescriptor, e); } }
java
@Override public Method createJavaMethod() { Class<?> clazz = rtype.getClazz(); String name = methodMember.getName(); String methodDescriptor = methodMember.getDescriptor(); ClassLoader classLoader = rtype.getTypeRegistry().getClassLoader(); try { Class<?>[] params = Utils.toParamClasses(methodDescriptor, classLoader); Class<?> returnType = Utils.toClass(Type.getReturnType(methodDescriptor), classLoader); Class<?>[] exceptions = Utils.slashedNamesToClasses(methodMember.getExceptions(), classLoader); return JVM.newMethod(clazz, name, params, returnType, exceptions, methodMember.getModifiers(), methodMember.getGenericSignature()); } catch (ClassNotFoundException e) { throw new IllegalStateException("Couldn't create j.l.r.Method for " + clazz.getName() + "." + methodDescriptor, e); } }
[ "@", "Override", "public", "Method", "createJavaMethod", "(", ")", "{", "Class", "<", "?", ">", "clazz", "=", "rtype", ".", "getClazz", "(", ")", ";", "String", "name", "=", "methodMember", ".", "getName", "(", ")", ";", "String", "methodDescriptor", "=", "methodMember", ".", "getDescriptor", "(", ")", ";", "ClassLoader", "classLoader", "=", "rtype", ".", "getTypeRegistry", "(", ")", ".", "getClassLoader", "(", ")", ";", "try", "{", "Class", "<", "?", ">", "[", "]", "params", "=", "Utils", ".", "toParamClasses", "(", "methodDescriptor", ",", "classLoader", ")", ";", "Class", "<", "?", ">", "returnType", "=", "Utils", ".", "toClass", "(", "Type", ".", "getReturnType", "(", "methodDescriptor", ")", ",", "classLoader", ")", ";", "Class", "<", "?", ">", "[", "]", "exceptions", "=", "Utils", ".", "slashedNamesToClasses", "(", "methodMember", ".", "getExceptions", "(", ")", ",", "classLoader", ")", ";", "return", "JVM", ".", "newMethod", "(", "clazz", ",", "name", ",", "params", ",", "returnType", ",", "exceptions", ",", "methodMember", ".", "getModifiers", "(", ")", ",", "methodMember", ".", "getGenericSignature", "(", ")", ")", ";", "}", "catch", "(", "ClassNotFoundException", "e", ")", "{", "throw", "new", "IllegalStateException", "(", "\"Couldn't create j.l.r.Method for \"", "+", "clazz", ".", "getName", "(", ")", "+", "\".\"", "+", "methodDescriptor", ",", "e", ")", ";", "}", "}" ]
Create a 'mock' Java Method which is dependent on ReflectiveInterceptor to catch calls to invoke.
[ "Create", "a", "mock", "Java", "Method", "which", "is", "dependent", "on", "ReflectiveInterceptor", "to", "catch", "calls", "to", "invoke", "." ]
59b32f957a05c6d9f149148158053605e2a6205a
https://github.com/spring-projects/spring-loaded/blob/59b32f957a05c6d9f149148158053605e2a6205a/springloaded/src/main/java/org/springsource/loaded/ri/ReloadedTypeInvoker.java#L61-L79
26,394
spring-projects/spring-loaded
springloaded/src/main/java/org/springsource/loaded/ISMgr.java
ISMgr.setValue
public void setValue(ReloadableType rtype, Object instance, Object value, String name) throws IllegalAccessException { // System.err.println(">setValue(rtype=" + rtype + ",instance=" + instance + ",value=" + value + ",name=" + name + ")"); // Look up through our reloadable hierarchy to find it FieldMember fieldmember = rtype.findInstanceField(name); if (fieldmember == null) { // If the field is null, there are two possible reasons: // 1. The field does not exist in the hierarchy at all // 2. The field is on a type just above our topmost reloadable type FieldReaderWriter frw = rtype.locateField(name); if (frw == null) { // bad code redeployed? log.info("Unexpectedly unable to locate instance field " + name + " starting from type " + rtype.dottedtypename + ": clinit running late?"); return; } frw.setValue(instance, value, this); } else { if (fieldmember.isStatic()) { throw new IncompatibleClassChangeError("Expected non-static field " + rtype.dottedtypename + "." + fieldmember.getName()); } Map<String, Object> typeValues = values.get(fieldmember.getDeclaringTypeName()); if (typeValues == null) { typeValues = new HashMap<String, Object>(); values.put(fieldmember.getDeclaringTypeName(), typeValues); } typeValues.put(name, value); } }
java
public void setValue(ReloadableType rtype, Object instance, Object value, String name) throws IllegalAccessException { // System.err.println(">setValue(rtype=" + rtype + ",instance=" + instance + ",value=" + value + ",name=" + name + ")"); // Look up through our reloadable hierarchy to find it FieldMember fieldmember = rtype.findInstanceField(name); if (fieldmember == null) { // If the field is null, there are two possible reasons: // 1. The field does not exist in the hierarchy at all // 2. The field is on a type just above our topmost reloadable type FieldReaderWriter frw = rtype.locateField(name); if (frw == null) { // bad code redeployed? log.info("Unexpectedly unable to locate instance field " + name + " starting from type " + rtype.dottedtypename + ": clinit running late?"); return; } frw.setValue(instance, value, this); } else { if (fieldmember.isStatic()) { throw new IncompatibleClassChangeError("Expected non-static field " + rtype.dottedtypename + "." + fieldmember.getName()); } Map<String, Object> typeValues = values.get(fieldmember.getDeclaringTypeName()); if (typeValues == null) { typeValues = new HashMap<String, Object>(); values.put(fieldmember.getDeclaringTypeName(), typeValues); } typeValues.put(name, value); } }
[ "public", "void", "setValue", "(", "ReloadableType", "rtype", ",", "Object", "instance", ",", "Object", "value", ",", "String", "name", ")", "throws", "IllegalAccessException", "{", "//\t\tSystem.err.println(\">setValue(rtype=\" + rtype + \",instance=\" + instance + \",value=\" + value + \",name=\" + name + \")\");", "// Look up through our reloadable hierarchy to find it", "FieldMember", "fieldmember", "=", "rtype", ".", "findInstanceField", "(", "name", ")", ";", "if", "(", "fieldmember", "==", "null", ")", "{", "// If the field is null, there are two possible reasons:", "// 1. The field does not exist in the hierarchy at all", "// 2. The field is on a type just above our topmost reloadable type", "FieldReaderWriter", "frw", "=", "rtype", ".", "locateField", "(", "name", ")", ";", "if", "(", "frw", "==", "null", ")", "{", "// bad code redeployed?", "log", ".", "info", "(", "\"Unexpectedly unable to locate instance field \"", "+", "name", "+", "\" starting from type \"", "+", "rtype", ".", "dottedtypename", "+", "\": clinit running late?\"", ")", ";", "return", ";", "}", "frw", ".", "setValue", "(", "instance", ",", "value", ",", "this", ")", ";", "}", "else", "{", "if", "(", "fieldmember", ".", "isStatic", "(", ")", ")", "{", "throw", "new", "IncompatibleClassChangeError", "(", "\"Expected non-static field \"", "+", "rtype", ".", "dottedtypename", "+", "\".\"", "+", "fieldmember", ".", "getName", "(", ")", ")", ";", "}", "Map", "<", "String", ",", "Object", ">", "typeValues", "=", "values", ".", "get", "(", "fieldmember", ".", "getDeclaringTypeName", "(", ")", ")", ";", "if", "(", "typeValues", "==", "null", ")", "{", "typeValues", "=", "new", "HashMap", "<", "String", ",", "Object", ">", "(", ")", ";", "values", ".", "put", "(", "fieldmember", ".", "getDeclaringTypeName", "(", ")", ",", "typeValues", ")", ";", "}", "typeValues", ".", "put", "(", "name", ",", "value", ")", ";", "}", "}" ]
Set the value of a field. @param rtype the reloadabletype @param instance the instance upon which to set the field @param value the value to put into the field @param name the name of the field @throws IllegalAccessException if there is a problem setting the field value
[ "Set", "the", "value", "of", "a", "field", "." ]
59b32f957a05c6d9f149148158053605e2a6205a
https://github.com/spring-projects/spring-loaded/blob/59b32f957a05c6d9f149148158053605e2a6205a/springloaded/src/main/java/org/springsource/loaded/ISMgr.java#L168-L201
26,395
spring-projects/spring-loaded
springloaded/src/main/java/org/springsource/loaded/ri/GetMethodsLookup.java
GetMethodsLookup.collectAll
private void collectAll(MethodProvider methodProvider, Map<String, Invoker> found) { // We do this in inverse order as in 'GetMethodLookup'. This is because GetMethodLookup // is lazy and wants to stop when a method is found, but here we instead collect // everything bottom up and 'overwrite' earlier results so the last one found is the // one kept. // First interfaces in inverse order... MethodProvider[] itfs = methodProvider.getInterfaces(); for (int i = itfs.length - 1; i >= 0; i--) { // inverse order collectAll(itfs[i], found); } // Then the superclass(es), but only if we're not an interface (interfaces do not report // the methods of Object! MethodProvider supr = methodProvider.getSuper(); if (supr != null && !methodProvider.isInterface()) { collectAll(supr, found); } // Finally all our own public methods for (Invoker method : methodProvider.getDeclaredMethods()) { if (Modifier.isPublic(method.getModifiers())) { found.put(method.getName() + method.getMethodDescriptor(), method); } } }
java
private void collectAll(MethodProvider methodProvider, Map<String, Invoker> found) { // We do this in inverse order as in 'GetMethodLookup'. This is because GetMethodLookup // is lazy and wants to stop when a method is found, but here we instead collect // everything bottom up and 'overwrite' earlier results so the last one found is the // one kept. // First interfaces in inverse order... MethodProvider[] itfs = methodProvider.getInterfaces(); for (int i = itfs.length - 1; i >= 0; i--) { // inverse order collectAll(itfs[i], found); } // Then the superclass(es), but only if we're not an interface (interfaces do not report // the methods of Object! MethodProvider supr = methodProvider.getSuper(); if (supr != null && !methodProvider.isInterface()) { collectAll(supr, found); } // Finally all our own public methods for (Invoker method : methodProvider.getDeclaredMethods()) { if (Modifier.isPublic(method.getModifiers())) { found.put(method.getName() + method.getMethodDescriptor(), method); } } }
[ "private", "void", "collectAll", "(", "MethodProvider", "methodProvider", ",", "Map", "<", "String", ",", "Invoker", ">", "found", ")", "{", "// We do this in inverse order as in 'GetMethodLookup'. This is because GetMethodLookup", "// is lazy and wants to stop when a method is found, but here we instead collect", "// everything bottom up and 'overwrite' earlier results so the last one found is the", "// one kept.", "// First interfaces in inverse order...", "MethodProvider", "[", "]", "itfs", "=", "methodProvider", ".", "getInterfaces", "(", ")", ";", "for", "(", "int", "i", "=", "itfs", ".", "length", "-", "1", ";", "i", ">=", "0", ";", "i", "--", ")", "{", "// inverse order", "collectAll", "(", "itfs", "[", "i", "]", ",", "found", ")", ";", "}", "// Then the superclass(es), but only if we're not an interface (interfaces do not report", "// the methods of Object!", "MethodProvider", "supr", "=", "methodProvider", ".", "getSuper", "(", ")", ";", "if", "(", "supr", "!=", "null", "&&", "!", "methodProvider", ".", "isInterface", "(", ")", ")", "{", "collectAll", "(", "supr", ",", "found", ")", ";", "}", "// Finally all our own public methods", "for", "(", "Invoker", "method", ":", "methodProvider", ".", "getDeclaredMethods", "(", ")", ")", "{", "if", "(", "Modifier", ".", "isPublic", "(", "method", ".", "getModifiers", "(", ")", ")", ")", "{", "found", ".", "put", "(", "method", ".", "getName", "(", ")", "+", "method", ".", "getMethodDescriptor", "(", ")", ",", "method", ")", ";", "}", "}", "}" ]
Collect all public methods from methodProvider and its supertypes into the 'found' hasmap, indexed by "name+descriptor".
[ "Collect", "all", "public", "methods", "from", "methodProvider", "and", "its", "supertypes", "into", "the", "found", "hasmap", "indexed", "by", "name", "+", "descriptor", "." ]
59b32f957a05c6d9f149148158053605e2a6205a
https://github.com/spring-projects/spring-loaded/blob/59b32f957a05c6d9f149148158053605e2a6205a/springloaded/src/main/java/org/springsource/loaded/ri/GetMethodsLookup.java#L40-L65
26,396
spring-projects/spring-loaded
springloaded/src/main/java/org/springsource/loaded/SystemClassReflectionRewriter.java
SystemClassReflectionGenerator.generateJLObjectStream_hasStaticInitializer
public static void generateJLObjectStream_hasStaticInitializer( ClassWriter cw, String classname) { FieldVisitor fv = cw.visitField(ACC_PUBLIC + ACC_STATIC, jloObjectStream_hasInitializerMethod, "Ljava/lang/reflect/Method;", null, null); fv.visitEnd(); MethodVisitor mv = cw.visitMethod(ACC_PRIVATE + ACC_STATIC, jloObjectStream_hasInitializerMethod, "(Ljava/lang/Class;)Z", null, null); mv.visitCode(); Label l0 = new Label(); Label l1 = new Label(); Label l2 = new Label(); mv.visitTryCatchBlock(l0, l1, l2, "java/lang/Exception"); mv.visitLabel(l0); mv.visitFieldInsn(GETSTATIC, classname, jloObjectStream_hasInitializerMethod, "Ljava/lang/reflect/Method;"); mv.visitInsn(ACONST_NULL); mv.visitInsn(ICONST_1); mv.visitTypeInsn(ANEWARRAY, "java/lang/Object"); mv.visitInsn(DUP); mv.visitInsn(ICONST_0); mv.visitVarInsn(ALOAD, 0); mv.visitInsn(AASTORE); mv.visitMethodInsn(INVOKEVIRTUAL, "java/lang/reflect/Method", "invoke", "(Ljava/lang/Object;[Ljava/lang/Object;)Ljava/lang/Object;", false); mv.visitTypeInsn(CHECKCAST, "java/lang/Boolean"); mv.visitMethodInsn(INVOKEVIRTUAL, "java/lang/Boolean", "booleanValue", "()Z", false); mv.visitLabel(l1); mv.visitInsn(IRETURN); mv.visitLabel(l2); // If not a reloadable type, we'll end up here (the method we called threw IllegalStateException), just make that native method call mv.visitVarInsn(ASTORE, 1); mv.visitVarInsn(ALOAD, 0); mv.visitMethodInsn(INVOKESTATIC, classname, "hasStaticInitializer", "(Ljava/lang/Class;)Z"); mv.visitInsn(IRETURN); mv.visitMaxs(3, 1); mv.visitEnd(); }
java
public static void generateJLObjectStream_hasStaticInitializer( ClassWriter cw, String classname) { FieldVisitor fv = cw.visitField(ACC_PUBLIC + ACC_STATIC, jloObjectStream_hasInitializerMethod, "Ljava/lang/reflect/Method;", null, null); fv.visitEnd(); MethodVisitor mv = cw.visitMethod(ACC_PRIVATE + ACC_STATIC, jloObjectStream_hasInitializerMethod, "(Ljava/lang/Class;)Z", null, null); mv.visitCode(); Label l0 = new Label(); Label l1 = new Label(); Label l2 = new Label(); mv.visitTryCatchBlock(l0, l1, l2, "java/lang/Exception"); mv.visitLabel(l0); mv.visitFieldInsn(GETSTATIC, classname, jloObjectStream_hasInitializerMethod, "Ljava/lang/reflect/Method;"); mv.visitInsn(ACONST_NULL); mv.visitInsn(ICONST_1); mv.visitTypeInsn(ANEWARRAY, "java/lang/Object"); mv.visitInsn(DUP); mv.visitInsn(ICONST_0); mv.visitVarInsn(ALOAD, 0); mv.visitInsn(AASTORE); mv.visitMethodInsn(INVOKEVIRTUAL, "java/lang/reflect/Method", "invoke", "(Ljava/lang/Object;[Ljava/lang/Object;)Ljava/lang/Object;", false); mv.visitTypeInsn(CHECKCAST, "java/lang/Boolean"); mv.visitMethodInsn(INVOKEVIRTUAL, "java/lang/Boolean", "booleanValue", "()Z", false); mv.visitLabel(l1); mv.visitInsn(IRETURN); mv.visitLabel(l2); // If not a reloadable type, we'll end up here (the method we called threw IllegalStateException), just make that native method call mv.visitVarInsn(ASTORE, 1); mv.visitVarInsn(ALOAD, 0); mv.visitMethodInsn(INVOKESTATIC, classname, "hasStaticInitializer", "(Ljava/lang/Class;)Z"); mv.visitInsn(IRETURN); mv.visitMaxs(3, 1); mv.visitEnd(); }
[ "public", "static", "void", "generateJLObjectStream_hasStaticInitializer", "(", "ClassWriter", "cw", ",", "String", "classname", ")", "{", "FieldVisitor", "fv", "=", "cw", ".", "visitField", "(", "ACC_PUBLIC", "+", "ACC_STATIC", ",", "jloObjectStream_hasInitializerMethod", ",", "\"Ljava/lang/reflect/Method;\"", ",", "null", ",", "null", ")", ";", "fv", ".", "visitEnd", "(", ")", ";", "MethodVisitor", "mv", "=", "cw", ".", "visitMethod", "(", "ACC_PRIVATE", "+", "ACC_STATIC", ",", "jloObjectStream_hasInitializerMethod", ",", "\"(Ljava/lang/Class;)Z\"", ",", "null", ",", "null", ")", ";", "mv", ".", "visitCode", "(", ")", ";", "Label", "l0", "=", "new", "Label", "(", ")", ";", "Label", "l1", "=", "new", "Label", "(", ")", ";", "Label", "l2", "=", "new", "Label", "(", ")", ";", "mv", ".", "visitTryCatchBlock", "(", "l0", ",", "l1", ",", "l2", ",", "\"java/lang/Exception\"", ")", ";", "mv", ".", "visitLabel", "(", "l0", ")", ";", "mv", ".", "visitFieldInsn", "(", "GETSTATIC", ",", "classname", ",", "jloObjectStream_hasInitializerMethod", ",", "\"Ljava/lang/reflect/Method;\"", ")", ";", "mv", ".", "visitInsn", "(", "ACONST_NULL", ")", ";", "mv", ".", "visitInsn", "(", "ICONST_1", ")", ";", "mv", ".", "visitTypeInsn", "(", "ANEWARRAY", ",", "\"java/lang/Object\"", ")", ";", "mv", ".", "visitInsn", "(", "DUP", ")", ";", "mv", ".", "visitInsn", "(", "ICONST_0", ")", ";", "mv", ".", "visitVarInsn", "(", "ALOAD", ",", "0", ")", ";", "mv", ".", "visitInsn", "(", "AASTORE", ")", ";", "mv", ".", "visitMethodInsn", "(", "INVOKEVIRTUAL", ",", "\"java/lang/reflect/Method\"", ",", "\"invoke\"", ",", "\"(Ljava/lang/Object;[Ljava/lang/Object;)Ljava/lang/Object;\"", ",", "false", ")", ";", "mv", ".", "visitTypeInsn", "(", "CHECKCAST", ",", "\"java/lang/Boolean\"", ")", ";", "mv", ".", "visitMethodInsn", "(", "INVOKEVIRTUAL", ",", "\"java/lang/Boolean\"", ",", "\"booleanValue\"", ",", "\"()Z\"", ",", "false", ")", ";", "mv", ".", "visitLabel", "(", "l1", ")", ";", "mv", ".", "visitInsn", "(", "IRETURN", ")", ";", "mv", ".", "visitLabel", "(", "l2", ")", ";", "// If not a reloadable type, we'll end up here (the method we called threw IllegalStateException), just make that native method call", "mv", ".", "visitVarInsn", "(", "ASTORE", ",", "1", ")", ";", "mv", ".", "visitVarInsn", "(", "ALOAD", ",", "0", ")", ";", "mv", ".", "visitMethodInsn", "(", "INVOKESTATIC", ",", "classname", ",", "\"hasStaticInitializer\"", ",", "\"(Ljava/lang/Class;)Z\"", ")", ";", "mv", ".", "visitInsn", "(", "IRETURN", ")", ";", "mv", ".", "visitMaxs", "(", "3", ",", "1", ")", ";", "mv", ".", "visitEnd", "(", ")", ";", "}" ]
Create a method that can be used to intercept the calls to hasStaticInitializer made in the ObjectStreamClass. The method will ask SpringLoaded whether the type has a static initializer. SpringLoaded will be able to answer if it is a reloadable type. If it is not a reloadable type then springloaded will throw an exception which will be caught here and the 'regular' call to hasStaticInitializer will be made. @param cw the classwriter to create the method in @param classname the name of the class being visited
[ "Create", "a", "method", "that", "can", "be", "used", "to", "intercept", "the", "calls", "to", "hasStaticInitializer", "made", "in", "the", "ObjectStreamClass", ".", "The", "method", "will", "ask", "SpringLoaded", "whether", "the", "type", "has", "a", "static", "initializer", ".", "SpringLoaded", "will", "be", "able", "to", "answer", "if", "it", "is", "a", "reloadable", "type", ".", "If", "it", "is", "not", "a", "reloadable", "type", "then", "springloaded", "will", "throw", "an", "exception", "which", "will", "be", "caught", "here", "and", "the", "regular", "call", "to", "hasStaticInitializer", "will", "be", "made", "." ]
59b32f957a05c6d9f149148158053605e2a6205a
https://github.com/spring-projects/spring-loaded/blob/59b32f957a05c6d9f149148158053605e2a6205a/springloaded/src/main/java/org/springsource/loaded/SystemClassReflectionRewriter.java#L679-L715
26,397
spring-projects/spring-loaded
springloaded/src/main/java/org/springsource/loaded/MethodInvokerRewriter.java
MethodInvokerRewriter.checkNotTheSame
@SuppressWarnings("unused") private static void checkNotTheSame(byte[] bs, byte[] bytes) { if (bs.length == bytes.length) { System.out.println("same length!"); boolean same = true; for (int i = 0; i < bs.length; i++) { if (bs[i] != bytes[i]) { same = false; break; } } if (same) { System.out.println("same data!!"); } else { System.out.println("diff data"); } } else { System.out.println("different"); } }
java
@SuppressWarnings("unused") private static void checkNotTheSame(byte[] bs, byte[] bytes) { if (bs.length == bytes.length) { System.out.println("same length!"); boolean same = true; for (int i = 0; i < bs.length; i++) { if (bs[i] != bytes[i]) { same = false; break; } } if (same) { System.out.println("same data!!"); } else { System.out.println("diff data"); } } else { System.out.println("different"); } }
[ "@", "SuppressWarnings", "(", "\"unused\"", ")", "private", "static", "void", "checkNotTheSame", "(", "byte", "[", "]", "bs", ",", "byte", "[", "]", "bytes", ")", "{", "if", "(", "bs", ".", "length", "==", "bytes", ".", "length", ")", "{", "System", ".", "out", ".", "println", "(", "\"same length!\"", ")", ";", "boolean", "same", "=", "true", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "bs", ".", "length", ";", "i", "++", ")", "{", "if", "(", "bs", "[", "i", "]", "!=", "bytes", "[", "i", "]", ")", "{", "same", "=", "false", ";", "break", ";", "}", "}", "if", "(", "same", ")", "{", "System", ".", "out", ".", "println", "(", "\"same data!!\"", ")", ";", "}", "else", "{", "System", ".", "out", ".", "println", "(", "\"diff data\"", ")", ";", "}", "}", "else", "{", "System", ".", "out", ".", "println", "(", "\"different\"", ")", ";", "}", "}" ]
method useful when debugging
[ "method", "useful", "when", "debugging" ]
59b32f957a05c6d9f149148158053605e2a6205a
https://github.com/spring-projects/spring-loaded/blob/59b32f957a05c6d9f149148158053605e2a6205a/springloaded/src/main/java/org/springsource/loaded/MethodInvokerRewriter.java#L415-L436
26,398
spring-projects/spring-loaded
springloaded/src/main/java/org/springsource/loaded/agent/SpringLoadedPreProcessor.java
SpringLoadedPreProcessor.ensurePreparedForInjection
private void ensurePreparedForInjection() { if (!prepared) { try { Class<ReflectiveInterceptor> clazz = ReflectiveInterceptor.class; method_jlcgdfs = clazz.getDeclaredMethod("jlClassGetDeclaredFields", Class.class); method_jlcgdf = clazz.getDeclaredMethod("jlClassGetDeclaredField", Class.class, String.class); method_jlcgf = clazz.getDeclaredMethod("jlClassGetField", Class.class, String.class); method_jlcgdms = clazz.getDeclaredMethod("jlClassGetDeclaredMethods", Class.class); method_jlcgdm = clazz.getDeclaredMethod("jlClassGetDeclaredMethod", Class.class, String.class, EMPTY_CLASS_ARRAY_CLAZZ); method_jlcgm = clazz.getDeclaredMethod("jlClassGetMethod", Class.class, String.class, EMPTY_CLASS_ARRAY_CLAZZ); method_jlcgdc = clazz.getDeclaredMethod("jlClassGetDeclaredConstructor", Class.class, EMPTY_CLASS_ARRAY_CLAZZ); method_jlcgc = clazz.getDeclaredMethod("jlClassGetConstructor", Class.class, EMPTY_CLASS_ARRAY_CLAZZ); method_jlcgmods = clazz.getDeclaredMethod("jlClassGetModifiers", Class.class); method_jlcgms = clazz.getDeclaredMethod("jlClassGetMethods", Class.class); method_jlcgdcs = clazz.getDeclaredMethod("jlClassGetDeclaredConstructors", Class.class); method_jlrfg = clazz.getDeclaredMethod("jlrFieldGet", Field.class, Object.class); method_jlrfgl = clazz.getDeclaredMethod("jlrFieldGetLong", Field.class, Object.class); method_jlrmi = clazz.getDeclaredMethod("jlrMethodInvoke", Method.class, Object.class, Object[].class); method_jloObjectStream_hasInitializerMethod = clazz.getDeclaredMethod("jlosHasStaticInitializer", Class.class); } catch (NoSuchMethodException nsme) { // cant happen, a-hahaha throw new Impossible(nsme); } prepared = true; } }
java
private void ensurePreparedForInjection() { if (!prepared) { try { Class<ReflectiveInterceptor> clazz = ReflectiveInterceptor.class; method_jlcgdfs = clazz.getDeclaredMethod("jlClassGetDeclaredFields", Class.class); method_jlcgdf = clazz.getDeclaredMethod("jlClassGetDeclaredField", Class.class, String.class); method_jlcgf = clazz.getDeclaredMethod("jlClassGetField", Class.class, String.class); method_jlcgdms = clazz.getDeclaredMethod("jlClassGetDeclaredMethods", Class.class); method_jlcgdm = clazz.getDeclaredMethod("jlClassGetDeclaredMethod", Class.class, String.class, EMPTY_CLASS_ARRAY_CLAZZ); method_jlcgm = clazz.getDeclaredMethod("jlClassGetMethod", Class.class, String.class, EMPTY_CLASS_ARRAY_CLAZZ); method_jlcgdc = clazz.getDeclaredMethod("jlClassGetDeclaredConstructor", Class.class, EMPTY_CLASS_ARRAY_CLAZZ); method_jlcgc = clazz.getDeclaredMethod("jlClassGetConstructor", Class.class, EMPTY_CLASS_ARRAY_CLAZZ); method_jlcgmods = clazz.getDeclaredMethod("jlClassGetModifiers", Class.class); method_jlcgms = clazz.getDeclaredMethod("jlClassGetMethods", Class.class); method_jlcgdcs = clazz.getDeclaredMethod("jlClassGetDeclaredConstructors", Class.class); method_jlrfg = clazz.getDeclaredMethod("jlrFieldGet", Field.class, Object.class); method_jlrfgl = clazz.getDeclaredMethod("jlrFieldGetLong", Field.class, Object.class); method_jlrmi = clazz.getDeclaredMethod("jlrMethodInvoke", Method.class, Object.class, Object[].class); method_jloObjectStream_hasInitializerMethod = clazz.getDeclaredMethod("jlosHasStaticInitializer", Class.class); } catch (NoSuchMethodException nsme) { // cant happen, a-hahaha throw new Impossible(nsme); } prepared = true; } }
[ "private", "void", "ensurePreparedForInjection", "(", ")", "{", "if", "(", "!", "prepared", ")", "{", "try", "{", "Class", "<", "ReflectiveInterceptor", ">", "clazz", "=", "ReflectiveInterceptor", ".", "class", ";", "method_jlcgdfs", "=", "clazz", ".", "getDeclaredMethod", "(", "\"jlClassGetDeclaredFields\"", ",", "Class", ".", "class", ")", ";", "method_jlcgdf", "=", "clazz", ".", "getDeclaredMethod", "(", "\"jlClassGetDeclaredField\"", ",", "Class", ".", "class", ",", "String", ".", "class", ")", ";", "method_jlcgf", "=", "clazz", ".", "getDeclaredMethod", "(", "\"jlClassGetField\"", ",", "Class", ".", "class", ",", "String", ".", "class", ")", ";", "method_jlcgdms", "=", "clazz", ".", "getDeclaredMethod", "(", "\"jlClassGetDeclaredMethods\"", ",", "Class", ".", "class", ")", ";", "method_jlcgdm", "=", "clazz", ".", "getDeclaredMethod", "(", "\"jlClassGetDeclaredMethod\"", ",", "Class", ".", "class", ",", "String", ".", "class", ",", "EMPTY_CLASS_ARRAY_CLAZZ", ")", ";", "method_jlcgm", "=", "clazz", ".", "getDeclaredMethod", "(", "\"jlClassGetMethod\"", ",", "Class", ".", "class", ",", "String", ".", "class", ",", "EMPTY_CLASS_ARRAY_CLAZZ", ")", ";", "method_jlcgdc", "=", "clazz", ".", "getDeclaredMethod", "(", "\"jlClassGetDeclaredConstructor\"", ",", "Class", ".", "class", ",", "EMPTY_CLASS_ARRAY_CLAZZ", ")", ";", "method_jlcgc", "=", "clazz", ".", "getDeclaredMethod", "(", "\"jlClassGetConstructor\"", ",", "Class", ".", "class", ",", "EMPTY_CLASS_ARRAY_CLAZZ", ")", ";", "method_jlcgmods", "=", "clazz", ".", "getDeclaredMethod", "(", "\"jlClassGetModifiers\"", ",", "Class", ".", "class", ")", ";", "method_jlcgms", "=", "clazz", ".", "getDeclaredMethod", "(", "\"jlClassGetMethods\"", ",", "Class", ".", "class", ")", ";", "method_jlcgdcs", "=", "clazz", ".", "getDeclaredMethod", "(", "\"jlClassGetDeclaredConstructors\"", ",", "Class", ".", "class", ")", ";", "method_jlrfg", "=", "clazz", ".", "getDeclaredMethod", "(", "\"jlrFieldGet\"", ",", "Field", ".", "class", ",", "Object", ".", "class", ")", ";", "method_jlrfgl", "=", "clazz", ".", "getDeclaredMethod", "(", "\"jlrFieldGetLong\"", ",", "Field", ".", "class", ",", "Object", ".", "class", ")", ";", "method_jlrmi", "=", "clazz", ".", "getDeclaredMethod", "(", "\"jlrMethodInvoke\"", ",", "Method", ".", "class", ",", "Object", ".", "class", ",", "Object", "[", "]", ".", "class", ")", ";", "method_jloObjectStream_hasInitializerMethod", "=", "clazz", ".", "getDeclaredMethod", "(", "\"jlosHasStaticInitializer\"", ",", "Class", ".", "class", ")", ";", "}", "catch", "(", "NoSuchMethodException", "nsme", ")", "{", "// cant happen, a-hahaha", "throw", "new", "Impossible", "(", "nsme", ")", ";", "}", "prepared", "=", "true", ";", "}", "}" ]
Cache the Method objects that will be injected.
[ "Cache", "the", "Method", "objects", "that", "will", "be", "injected", "." ]
59b32f957a05c6d9f149148158053605e2a6205a
https://github.com/spring-projects/spring-loaded/blob/59b32f957a05c6d9f149148158053605e2a6205a/springloaded/src/main/java/org/springsource/loaded/agent/SpringLoadedPreProcessor.java#L548-L579
26,399
spring-projects/spring-loaded
springloaded/src/main/java/org/springsource/loaded/agent/FileSystemWatcher.java
FileSystemWatcher.ensureWatchThreadRunning
private void ensureWatchThreadRunning() { if (!threadRunning) { thread = new Thread(watchThread); thread.setDaemon(true); thread.start(); watchThread.setThread(thread); watchThread.updateName(); threadRunning = true; } }
java
private void ensureWatchThreadRunning() { if (!threadRunning) { thread = new Thread(watchThread); thread.setDaemon(true); thread.start(); watchThread.setThread(thread); watchThread.updateName(); threadRunning = true; } }
[ "private", "void", "ensureWatchThreadRunning", "(", ")", "{", "if", "(", "!", "threadRunning", ")", "{", "thread", "=", "new", "Thread", "(", "watchThread", ")", ";", "thread", ".", "setDaemon", "(", "true", ")", ";", "thread", ".", "start", "(", ")", ";", "watchThread", ".", "setThread", "(", "thread", ")", ";", "watchThread", ".", "updateName", "(", ")", ";", "threadRunning", "=", "true", ";", "}", "}" ]
Start the thread if it isn't already started.
[ "Start", "the", "thread", "if", "it", "isn", "t", "already", "started", "." ]
59b32f957a05c6d9f149148158053605e2a6205a
https://github.com/spring-projects/spring-loaded/blob/59b32f957a05c6d9f149148158053605e2a6205a/springloaded/src/main/java/org/springsource/loaded/agent/FileSystemWatcher.java#L57-L66