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
partition
stringclasses
1 value
jcuda/jnvgraph
JNvgraphJava/src/main/java/jcuda/jnvgraph/JNvgraph.java
JNvgraph.nvgraphExtractSubgraphByVertex
public static int nvgraphExtractSubgraphByVertex( nvgraphHandle handle, nvgraphGraphDescr descrG, nvgraphGraphDescr subdescrG, Pointer subvertices, long numvertices) { return checkResult(nvgraphExtractSubgraphByVertexNative(handle, descrG, subdescrG, subvertices, numvertices)); }
java
public static int nvgraphExtractSubgraphByVertex( nvgraphHandle handle, nvgraphGraphDescr descrG, nvgraphGraphDescr subdescrG, Pointer subvertices, long numvertices) { return checkResult(nvgraphExtractSubgraphByVertexNative(handle, descrG, subdescrG, subvertices, numvertices)); }
[ "public", "static", "int", "nvgraphExtractSubgraphByVertex", "(", "nvgraphHandle", "handle", ",", "nvgraphGraphDescr", "descrG", ",", "nvgraphGraphDescr", "subdescrG", ",", "Pointer", "subvertices", ",", "long", "numvertices", ")", "{", "return", "checkResult", "(", "nvgraphExtractSubgraphByVertexNative", "(", "handle", ",", "descrG", ",", "subdescrG", ",", "subvertices", ",", "numvertices", ")", ")", ";", "}" ]
create a new graph by extracting a subgraph given a list of vertices
[ "create", "a", "new", "graph", "by", "extracting", "a", "subgraph", "given", "a", "list", "of", "vertices" ]
2c6bd7c58edac181753bacf30af2cceeb1989a78
https://github.com/jcuda/jnvgraph/blob/2c6bd7c58edac181753bacf30af2cceeb1989a78/JNvgraphJava/src/main/java/jcuda/jnvgraph/JNvgraph.java#L383-L391
train
jcuda/jnvgraph
JNvgraphJava/src/main/java/jcuda/jnvgraph/JNvgraph.java
JNvgraph.nvgraphExtractSubgraphByEdge
public static int nvgraphExtractSubgraphByEdge( nvgraphHandle handle, nvgraphGraphDescr descrG, nvgraphGraphDescr subdescrG, Pointer subedges, long numedges) { return checkResult(nvgraphExtractSubgraphByEdgeNative(handle, descrG, subdescrG, subedges, numedges)); }
java
public static int nvgraphExtractSubgraphByEdge( nvgraphHandle handle, nvgraphGraphDescr descrG, nvgraphGraphDescr subdescrG, Pointer subedges, long numedges) { return checkResult(nvgraphExtractSubgraphByEdgeNative(handle, descrG, subdescrG, subedges, numedges)); }
[ "public", "static", "int", "nvgraphExtractSubgraphByEdge", "(", "nvgraphHandle", "handle", ",", "nvgraphGraphDescr", "descrG", ",", "nvgraphGraphDescr", "subdescrG", ",", "Pointer", "subedges", ",", "long", "numedges", ")", "{", "return", "checkResult", "(", "nvgraphExtractSubgraphByEdgeNative", "(", "handle", ",", "descrG", ",", "subdescrG", ",", "subedges", ",", "numedges", ")", ")", ";", "}" ]
create a new graph by extracting a subgraph given a list of edges
[ "create", "a", "new", "graph", "by", "extracting", "a", "subgraph", "given", "a", "list", "of", "edges" ]
2c6bd7c58edac181753bacf30af2cceeb1989a78
https://github.com/jcuda/jnvgraph/blob/2c6bd7c58edac181753bacf30af2cceeb1989a78/JNvgraphJava/src/main/java/jcuda/jnvgraph/JNvgraph.java#L402-L410
train
jcuda/jnvgraph
JNvgraphJava/src/main/java/jcuda/jnvgraph/JNvgraph.java
JNvgraph.nvgraphSrSpmv
public static int nvgraphSrSpmv( nvgraphHandle handle, nvgraphGraphDescr descrG, long weight_index, Pointer alpha, long x_index, Pointer beta, long y_index, int SR) { return checkResult(nvgraphSrSpmvNative(handle, descrG, weight_index, alpha, x_index, beta, y_index, SR)); }
java
public static int nvgraphSrSpmv( nvgraphHandle handle, nvgraphGraphDescr descrG, long weight_index, Pointer alpha, long x_index, Pointer beta, long y_index, int SR) { return checkResult(nvgraphSrSpmvNative(handle, descrG, weight_index, alpha, x_index, beta, y_index, SR)); }
[ "public", "static", "int", "nvgraphSrSpmv", "(", "nvgraphHandle", "handle", ",", "nvgraphGraphDescr", "descrG", ",", "long", "weight_index", ",", "Pointer", "alpha", ",", "long", "x_index", ",", "Pointer", "beta", ",", "long", "y_index", ",", "int", "SR", ")", "{", "return", "checkResult", "(", "nvgraphSrSpmvNative", "(", "handle", ",", "descrG", ",", "weight_index", ",", "alpha", ",", "x_index", ",", "beta", ",", "y_index", ",", "SR", ")", ")", ";", "}" ]
nvGRAPH Semi-ring sparse matrix vector multiplication
[ "nvGRAPH", "Semi", "-", "ring", "sparse", "matrix", "vector", "multiplication" ]
2c6bd7c58edac181753bacf30af2cceeb1989a78
https://github.com/jcuda/jnvgraph/blob/2c6bd7c58edac181753bacf30af2cceeb1989a78/JNvgraphJava/src/main/java/jcuda/jnvgraph/JNvgraph.java#L421-L432
train
jcuda/jnvgraph
JNvgraphJava/src/main/java/jcuda/jnvgraph/JNvgraph.java
JNvgraph.nvgraphWidestPath
public static int nvgraphWidestPath( nvgraphHandle handle, nvgraphGraphDescr descrG, long weight_index, Pointer source_vert, long widest_path_index) { return checkResult(nvgraphWidestPathNative(handle, descrG, weight_index, source_vert, widest_path_index)); }
java
public static int nvgraphWidestPath( nvgraphHandle handle, nvgraphGraphDescr descrG, long weight_index, Pointer source_vert, long widest_path_index) { return checkResult(nvgraphWidestPathNative(handle, descrG, weight_index, source_vert, widest_path_index)); }
[ "public", "static", "int", "nvgraphWidestPath", "(", "nvgraphHandle", "handle", ",", "nvgraphGraphDescr", "descrG", ",", "long", "weight_index", ",", "Pointer", "source_vert", ",", "long", "widest_path_index", ")", "{", "return", "checkResult", "(", "nvgraphWidestPathNative", "(", "handle", ",", "descrG", ",", "weight_index", ",", "source_vert", ",", "widest_path_index", ")", ")", ";", "}" ]
nvGRAPH WidestPath Find widest path potential from source_index to every other vertices.
[ "nvGRAPH", "WidestPath", "Find", "widest", "path", "potential", "from", "source_index", "to", "every", "other", "vertices", "." ]
2c6bd7c58edac181753bacf30af2cceeb1989a78
https://github.com/jcuda/jnvgraph/blob/2c6bd7c58edac181753bacf30af2cceeb1989a78/JNvgraphJava/src/main/java/jcuda/jnvgraph/JNvgraph.java#L625-L633
train
jcuda/jnvgraph
JNvgraphJava/src/main/java/jcuda/jnvgraph/JNvgraph.java
JNvgraph.nvgraphPagerank
public static int nvgraphPagerank( nvgraphHandle handle, nvgraphGraphDescr descrG, long weight_index, Pointer alpha, long bookmark_index, int has_guess, long pagerank_index, float tolerance, int max_iter) { return checkResult(nvgraphPagerankNative(handle, descrG, weight_index, alpha, bookmark_index, has_guess, pagerank_index, tolerance, max_iter)); }
java
public static int nvgraphPagerank( nvgraphHandle handle, nvgraphGraphDescr descrG, long weight_index, Pointer alpha, long bookmark_index, int has_guess, long pagerank_index, float tolerance, int max_iter) { return checkResult(nvgraphPagerankNative(handle, descrG, weight_index, alpha, bookmark_index, has_guess, pagerank_index, tolerance, max_iter)); }
[ "public", "static", "int", "nvgraphPagerank", "(", "nvgraphHandle", "handle", ",", "nvgraphGraphDescr", "descrG", ",", "long", "weight_index", ",", "Pointer", "alpha", ",", "long", "bookmark_index", ",", "int", "has_guess", ",", "long", "pagerank_index", ",", "float", "tolerance", ",", "int", "max_iter", ")", "{", "return", "checkResult", "(", "nvgraphPagerankNative", "(", "handle", ",", "descrG", ",", "weight_index", ",", "alpha", ",", "bookmark_index", ",", "has_guess", ",", "pagerank_index", ",", "tolerance", ",", "max_iter", ")", ")", ";", "}" ]
nvGRAPH PageRank Find PageRank for each vertex of a graph with a given transition probabilities, a bookmark vector of dangling vertices, and the damping factor.
[ "nvGRAPH", "PageRank", "Find", "PageRank", "for", "each", "vertex", "of", "a", "graph", "with", "a", "given", "transition", "probabilities", "a", "bookmark", "vector", "of", "dangling", "vertices", "and", "the", "damping", "factor", "." ]
2c6bd7c58edac181753bacf30af2cceeb1989a78
https://github.com/jcuda/jnvgraph/blob/2c6bd7c58edac181753bacf30af2cceeb1989a78/JNvgraphJava/src/main/java/jcuda/jnvgraph/JNvgraph.java#L645-L657
train
opencb/java-common-libs
bioformats/src/main/java/org/opencb/commons/bioformats/alignment/tasks/AlignmentCoverageCalculatorTask.java
AlignmentCoverageCalculatorTask.setRegionCoverageSize
public void setRegionCoverageSize(int size){ if(size < 0){ return; } int lg = (int)Math.ceil(Math.log(size)/Math.log(2)); //int lg = 31 - Integer.numberOfLeadingZeros(size); int newRegionCoverageSize = 1 << lg; int newRegionCoverageMask = newRegionCoverageSize - 1; RegionCoverage newCoverage = new RegionCoverage(newRegionCoverageSize); if(coverage != null){ for(int i = 0; i < (end-start); i++){ newCoverage.getA()[(int)((start+i)&newRegionCoverageMask)] = coverage.getA()[(int)((start+i)&regionCoverageMask)]; } } regionCoverageSize = newRegionCoverageSize; regionCoverageMask = newRegionCoverageMask; coverage = newCoverage; // System.out.println("Region Coverage Mask : " + regionCoverageMask); }
java
public void setRegionCoverageSize(int size){ if(size < 0){ return; } int lg = (int)Math.ceil(Math.log(size)/Math.log(2)); //int lg = 31 - Integer.numberOfLeadingZeros(size); int newRegionCoverageSize = 1 << lg; int newRegionCoverageMask = newRegionCoverageSize - 1; RegionCoverage newCoverage = new RegionCoverage(newRegionCoverageSize); if(coverage != null){ for(int i = 0; i < (end-start); i++){ newCoverage.getA()[(int)((start+i)&newRegionCoverageMask)] = coverage.getA()[(int)((start+i)&regionCoverageMask)]; } } regionCoverageSize = newRegionCoverageSize; regionCoverageMask = newRegionCoverageMask; coverage = newCoverage; // System.out.println("Region Coverage Mask : " + regionCoverageMask); }
[ "public", "void", "setRegionCoverageSize", "(", "int", "size", ")", "{", "if", "(", "size", "<", "0", ")", "{", "return", ";", "}", "int", "lg", "=", "(", "int", ")", "Math", ".", "ceil", "(", "Math", ".", "log", "(", "size", ")", "/", "Math", ".", "log", "(", "2", ")", ")", ";", "//int lg = 31 - Integer.numberOfLeadingZeros(size);", "int", "newRegionCoverageSize", "=", "1", "<<", "lg", ";", "int", "newRegionCoverageMask", "=", "newRegionCoverageSize", "-", "1", ";", "RegionCoverage", "newCoverage", "=", "new", "RegionCoverage", "(", "newRegionCoverageSize", ")", ";", "if", "(", "coverage", "!=", "null", ")", "{", "for", "(", "int", "i", "=", "0", ";", "i", "<", "(", "end", "-", "start", ")", ";", "i", "++", ")", "{", "newCoverage", ".", "getA", "(", ")", "[", "(", "int", ")", "(", "(", "start", "+", "i", ")", "&", "newRegionCoverageMask", ")", "]", "=", "coverage", ".", "getA", "(", ")", "[", "(", "int", ")", "(", "(", "start", "+", "i", ")", "&", "regionCoverageMask", ")", "]", ";", "}", "}", "regionCoverageSize", "=", "newRegionCoverageSize", ";", "regionCoverageMask", "=", "newRegionCoverageMask", ";", "coverage", "=", "newCoverage", ";", "// System.out.println(\"Region Coverage Mask : \" + regionCoverageMask);", "}" ]
Set size to the nearest upper 2^n number for quick modulus operation @param size
[ "Set", "size", "to", "the", "nearest", "upper", "2^n", "number", "for", "quick", "modulus", "operation" ]
5c97682530d0be55828e1e4e374ff01fceb5f198
https://github.com/opencb/java-common-libs/blob/5c97682530d0be55828e1e4e374ff01fceb5f198/bioformats/src/main/java/org/opencb/commons/bioformats/alignment/tasks/AlignmentCoverageCalculatorTask.java#L391-L411
train
padrig64/ValidationFramework
validationframework-swing/src/main/java/com/google/code/validationframework/swing/resulthandler/AbstractStickerFeedback.java
AbstractStickerFeedback.attach
public void attach(JComponent owner) { detach(); toolTipDialog = new TransparentToolTipDialog(owner, new AnchorLink(Anchor.CENTER_RIGHT, Anchor.CENTER_LEFT)); }
java
public void attach(JComponent owner) { detach(); toolTipDialog = new TransparentToolTipDialog(owner, new AnchorLink(Anchor.CENTER_RIGHT, Anchor.CENTER_LEFT)); }
[ "public", "void", "attach", "(", "JComponent", "owner", ")", "{", "detach", "(", ")", ";", "toolTipDialog", "=", "new", "TransparentToolTipDialog", "(", "owner", ",", "new", "AnchorLink", "(", "Anchor", ".", "CENTER_RIGHT", ",", "Anchor", ".", "CENTER_LEFT", ")", ")", ";", "}" ]
Attaches the tooltip sticker to the specified component. @param owner Component to attach to.
[ "Attaches", "the", "tooltip", "sticker", "to", "the", "specified", "component", "." ]
2dd3c7b3403993db366d24a927645f467ccd1dda
https://github.com/padrig64/ValidationFramework/blob/2dd3c7b3403993db366d24a927645f467ccd1dda/validationframework-swing/src/main/java/com/google/code/validationframework/swing/resulthandler/AbstractStickerFeedback.java#L62-L65
train
padrig64/ValidationFramework
validationframework-swing/src/main/java/com/google/code/validationframework/swing/resulthandler/AbstractStickerFeedback.java
AbstractStickerFeedback.getToolTipText
protected String getToolTipText() { String tip = null; if (toolTipDialog != null) { tip = toolTipDialog.getText(); } return tip; }
java
protected String getToolTipText() { String tip = null; if (toolTipDialog != null) { tip = toolTipDialog.getText(); } return tip; }
[ "protected", "String", "getToolTipText", "(", ")", "{", "String", "tip", "=", "null", ";", "if", "(", "toolTipDialog", "!=", "null", ")", "{", "tip", "=", "toolTipDialog", ".", "getText", "(", ")", ";", "}", "return", "tip", ";", "}" ]
Gets the tooltip text to be displayed. @return Text displaued as a tooltip.
[ "Gets", "the", "tooltip", "text", "to", "be", "displayed", "." ]
2dd3c7b3403993db366d24a927645f467ccd1dda
https://github.com/padrig64/ValidationFramework/blob/2dd3c7b3403993db366d24a927645f467ccd1dda/validationframework-swing/src/main/java/com/google/code/validationframework/swing/resulthandler/AbstractStickerFeedback.java#L82-L90
train
ArpNetworking/commons
src/main/java/com/arpnetworking/commons/builder/OvalBuilder.java
OvalBuilder.construct
protected T construct() { if (_targetConstructor.isPresent()) { return _targetConstructor.get().apply(this); } try { final Constructor<? extends T> constructor = _targetClass.get().getDeclaredConstructor(this.getClass()); AccessController.doPrivileged((PrivilegedAction<Object>) () -> { constructor.setAccessible(true); return null; }); return constructor.newInstance(this); } catch (final NoSuchMethodException | SecurityException | InstantiationException | IllegalAccessException | IllegalArgumentException e) { throw new UnsupportedOperationException( String.format(UNABLE_TO_CONSTRUCT_TARGET_CLASS, _targetClass), e); } catch (final InvocationTargetException e) { // If the constructor of the class threw an exception, unwrap it and // rethrow it. If the constructor throws anything other than a // RuntimeException we wrap it. final Throwable cause = e.getCause(); if (cause instanceof RuntimeException) { throw (RuntimeException) cause; } throw new UnsupportedOperationException( String.format(UNABLE_TO_CONSTRUCT_TARGET_CLASS, _targetClass), cause); } }
java
protected T construct() { if (_targetConstructor.isPresent()) { return _targetConstructor.get().apply(this); } try { final Constructor<? extends T> constructor = _targetClass.get().getDeclaredConstructor(this.getClass()); AccessController.doPrivileged((PrivilegedAction<Object>) () -> { constructor.setAccessible(true); return null; }); return constructor.newInstance(this); } catch (final NoSuchMethodException | SecurityException | InstantiationException | IllegalAccessException | IllegalArgumentException e) { throw new UnsupportedOperationException( String.format(UNABLE_TO_CONSTRUCT_TARGET_CLASS, _targetClass), e); } catch (final InvocationTargetException e) { // If the constructor of the class threw an exception, unwrap it and // rethrow it. If the constructor throws anything other than a // RuntimeException we wrap it. final Throwable cause = e.getCause(); if (cause instanceof RuntimeException) { throw (RuntimeException) cause; } throw new UnsupportedOperationException( String.format(UNABLE_TO_CONSTRUCT_TARGET_CLASS, _targetClass), cause); } }
[ "protected", "T", "construct", "(", ")", "{", "if", "(", "_targetConstructor", ".", "isPresent", "(", ")", ")", "{", "return", "_targetConstructor", ".", "get", "(", ")", ".", "apply", "(", "this", ")", ";", "}", "try", "{", "final", "Constructor", "<", "?", "extends", "T", ">", "constructor", "=", "_targetClass", ".", "get", "(", ")", ".", "getDeclaredConstructor", "(", "this", ".", "getClass", "(", ")", ")", ";", "AccessController", ".", "doPrivileged", "(", "(", "PrivilegedAction", "<", "Object", ">", ")", "(", ")", "->", "{", "constructor", ".", "setAccessible", "(", "true", ")", ";", "return", "null", ";", "}", ")", ";", "return", "constructor", ".", "newInstance", "(", "this", ")", ";", "}", "catch", "(", "final", "NoSuchMethodException", "|", "SecurityException", "|", "InstantiationException", "|", "IllegalAccessException", "|", "IllegalArgumentException", "e", ")", "{", "throw", "new", "UnsupportedOperationException", "(", "String", ".", "format", "(", "UNABLE_TO_CONSTRUCT_TARGET_CLASS", ",", "_targetClass", ")", ",", "e", ")", ";", "}", "catch", "(", "final", "InvocationTargetException", "e", ")", "{", "// If the constructor of the class threw an exception, unwrap it and", "// rethrow it. If the constructor throws anything other than a", "// RuntimeException we wrap it.", "final", "Throwable", "cause", "=", "e", ".", "getCause", "(", ")", ";", "if", "(", "cause", "instanceof", "RuntimeException", ")", "{", "throw", "(", "RuntimeException", ")", "cause", ";", "}", "throw", "new", "UnsupportedOperationException", "(", "String", ".", "format", "(", "UNABLE_TO_CONSTRUCT_TARGET_CLASS", ",", "_targetClass", ")", ",", "cause", ")", ";", "}", "}" ]
Protected method to construct the target class reflectively from the specified type by passing its constructor an instance of this builder. @return Instance of target class created from this builder.
[ "Protected", "method", "to", "construct", "the", "target", "class", "reflectively", "from", "the", "specified", "type", "by", "passing", "its", "constructor", "an", "instance", "of", "this", "builder", "." ]
36e18ee63312921551ade91dfbf769eccd04dc96
https://github.com/ArpNetworking/commons/blob/36e18ee63312921551ade91dfbf769eccd04dc96/src/main/java/com/arpnetworking/commons/builder/OvalBuilder.java#L201-L233
train
padrig64/ValidationFramework
validationframework-swing/src/main/java/com/google/code/validationframework/swing/property/JTableSelectedRowCountProperty.java
JTableSelectedRowCountProperty.updateValue
private void updateValue() { if (table != null) { int oldCount = this.count; this.count = table.getSelectedRowCount(); maybeNotifyListeners(oldCount, count); } }
java
private void updateValue() { if (table != null) { int oldCount = this.count; this.count = table.getSelectedRowCount(); maybeNotifyListeners(oldCount, count); } }
[ "private", "void", "updateValue", "(", ")", "{", "if", "(", "table", "!=", "null", ")", "{", "int", "oldCount", "=", "this", ".", "count", ";", "this", ".", "count", "=", "table", ".", "getSelectedRowCount", "(", ")", ";", "maybeNotifyListeners", "(", "oldCount", ",", "count", ")", ";", "}", "}" ]
Updates the value of this property based on the table's selection model and notify the listeners.
[ "Updates", "the", "value", "of", "this", "property", "based", "on", "the", "table", "s", "selection", "model", "and", "notify", "the", "listeners", "." ]
2dd3c7b3403993db366d24a927645f467ccd1dda
https://github.com/padrig64/ValidationFramework/blob/2dd3c7b3403993db366d24a927645f467ccd1dda/validationframework-swing/src/main/java/com/google/code/validationframework/swing/property/JTableSelectedRowCountProperty.java#L130-L136
train
riccardove/easyjasub
easyjasub-lib/src/main/java/com/github/riccardove/easyjasub/lucene/LuceneUtil.java
LuceneUtil.katakanaToRomaji
public static void katakanaToRomaji(Appendable builder, CharSequence s) throws IOException { ToStringUtil.getRomanization(builder, s); }
java
public static void katakanaToRomaji(Appendable builder, CharSequence s) throws IOException { ToStringUtil.getRomanization(builder, s); }
[ "public", "static", "void", "katakanaToRomaji", "(", "Appendable", "builder", ",", "CharSequence", "s", ")", "throws", "IOException", "{", "ToStringUtil", ".", "getRomanization", "(", "builder", ",", "s", ")", ";", "}" ]
Romanize katakana with modified hepburn @throws IOException
[ "Romanize", "katakana", "with", "modified", "hepburn" ]
58d6af66b1b1c738326c74d9ad5e4ad514120e27
https://github.com/riccardove/easyjasub/blob/58d6af66b1b1c738326c74d9ad5e4ad514120e27/easyjasub-lib/src/main/java/com/github/riccardove/easyjasub/lucene/LuceneUtil.java#L46-L49
train
checkstyle-addons/checkstyle-addons
src/main/java/com/thomasjensen/checkstyle/addons/checks/regexp/RegexpOnStringCheck.java
RegexpOnStringCheck.getExprAst
@CheckForNull private DetailAST getExprAst(@Nonnull final DetailAST pAst) { DetailAST result = null; for (DetailAST a = pAst.getFirstChild(); a != null; a = a.getNextSibling()) { if (a.getType() != TokenTypes.LPAREN && a.getType() != TokenTypes.RPAREN) { result = a; break; } } return result; }
java
@CheckForNull private DetailAST getExprAst(@Nonnull final DetailAST pAst) { DetailAST result = null; for (DetailAST a = pAst.getFirstChild(); a != null; a = a.getNextSibling()) { if (a.getType() != TokenTypes.LPAREN && a.getType() != TokenTypes.RPAREN) { result = a; break; } } return result; }
[ "@", "CheckForNull", "private", "DetailAST", "getExprAst", "(", "@", "Nonnull", "final", "DetailAST", "pAst", ")", "{", "DetailAST", "result", "=", "null", ";", "for", "(", "DetailAST", "a", "=", "pAst", ".", "getFirstChild", "(", ")", ";", "a", "!=", "null", ";", "a", "=", "a", ".", "getNextSibling", "(", ")", ")", "{", "if", "(", "a", ".", "getType", "(", ")", "!=", "TokenTypes", ".", "LPAREN", "&&", "a", ".", "getType", "(", ")", "!=", "TokenTypes", ".", "RPAREN", ")", "{", "result", "=", "a", ";", "break", ";", "}", "}", "return", "result", ";", "}" ]
Find the "meaningful" child of an EXPR AST. This is usually the only child present, but it may be surrounded by parentheses. @param pAst an EXPR AST @return the meaningful child of the EXPR, or <code>null</code> if such could not be determined
[ "Find", "the", "meaningful", "child", "of", "an", "EXPR", "AST", ".", "This", "is", "usually", "the", "only", "child", "present", "but", "it", "may", "be", "surrounded", "by", "parentheses", "." ]
fae1b4d341639c8e32c3e59ec5abdc0ffc11b865
https://github.com/checkstyle-addons/checkstyle-addons/blob/fae1b4d341639c8e32c3e59ec5abdc0ffc11b865/src/main/java/com/thomasjensen/checkstyle/addons/checks/regexp/RegexpOnStringCheck.java#L124-L135
train
opencb/java-common-libs
commons-datastore/commons-datastore-core/src/main/java/org/opencb/commons/datastore/core/QueryResponse.java
QueryResponse.first
public QueryResult<T> first() { if (response != null && response.size() > 0) { return response.get(0); } return null; }
java
public QueryResult<T> first() { if (response != null && response.size() > 0) { return response.get(0); } return null; }
[ "public", "QueryResult", "<", "T", ">", "first", "(", ")", "{", "if", "(", "response", "!=", "null", "&&", "response", ".", "size", "(", ")", ">", "0", ")", "{", "return", "response", ".", "get", "(", "0", ")", ";", "}", "return", "null", ";", "}" ]
This method just returns the first QueryResult of response, or null if response is null or empty. @return the first QueryResult in the response
[ "This", "method", "just", "returns", "the", "first", "QueryResult", "of", "response", "or", "null", "if", "response", "is", "null", "or", "empty", "." ]
5c97682530d0be55828e1e4e374ff01fceb5f198
https://github.com/opencb/java-common-libs/blob/5c97682530d0be55828e1e4e374ff01fceb5f198/commons-datastore/commons-datastore-core/src/main/java/org/opencb/commons/datastore/core/QueryResponse.java#L72-L77
train
padrig64/ValidationFramework
validationframework-swing/src/main/java/com/google/code/validationframework/swing/decoration/AbstractComponentDecoration.java
AbstractComponentDecoration.attach
private void attach(JComponent componentToBeDecorated) { detach(); decoratedComponent = componentToBeDecorated; if (decoratedComponent != null) { decoratedComponent.addComponentListener(decoratedComponentTracker); decoratedComponent.addAncestorListener(decoratedComponentTracker); decoratedComponent.addHierarchyBoundsListener(decoratedComponentTracker); decoratedComponent.addHierarchyListener(decoratedComponentTracker); decoratedComponent.addPropertyChangeListener("enabled", decoratedComponentTracker); decoratedComponent.addPropertyChangeListener("ancestor", decoratedComponentTracker); attachToLayeredPane(); } }
java
private void attach(JComponent componentToBeDecorated) { detach(); decoratedComponent = componentToBeDecorated; if (decoratedComponent != null) { decoratedComponent.addComponentListener(decoratedComponentTracker); decoratedComponent.addAncestorListener(decoratedComponentTracker); decoratedComponent.addHierarchyBoundsListener(decoratedComponentTracker); decoratedComponent.addHierarchyListener(decoratedComponentTracker); decoratedComponent.addPropertyChangeListener("enabled", decoratedComponentTracker); decoratedComponent.addPropertyChangeListener("ancestor", decoratedComponentTracker); attachToLayeredPane(); } }
[ "private", "void", "attach", "(", "JComponent", "componentToBeDecorated", ")", "{", "detach", "(", ")", ";", "decoratedComponent", "=", "componentToBeDecorated", ";", "if", "(", "decoratedComponent", "!=", "null", ")", "{", "decoratedComponent", ".", "addComponentListener", "(", "decoratedComponentTracker", ")", ";", "decoratedComponent", ".", "addAncestorListener", "(", "decoratedComponentTracker", ")", ";", "decoratedComponent", ".", "addHierarchyBoundsListener", "(", "decoratedComponentTracker", ")", ";", "decoratedComponent", ".", "addHierarchyListener", "(", "decoratedComponentTracker", ")", ";", "decoratedComponent", ".", "addPropertyChangeListener", "(", "\"enabled\"", ",", "decoratedComponentTracker", ")", ";", "decoratedComponent", ".", "addPropertyChangeListener", "(", "\"ancestor\"", ",", "decoratedComponentTracker", ")", ";", "attachToLayeredPane", "(", ")", ";", "}", "}" ]
Attaches the decoration to the specified component. @param componentToBeDecorated Component to be decorated.
[ "Attaches", "the", "decoration", "to", "the", "specified", "component", "." ]
2dd3c7b3403993db366d24a927645f467ccd1dda
https://github.com/padrig64/ValidationFramework/blob/2dd3c7b3403993db366d24a927645f467ccd1dda/validationframework-swing/src/main/java/com/google/code/validationframework/swing/decoration/AbstractComponentDecoration.java#L395-L410
train
padrig64/ValidationFramework
validationframework-swing/src/main/java/com/google/code/validationframework/swing/decoration/AbstractComponentDecoration.java
AbstractComponentDecoration.detach
private void detach() { // Do not call setVisible(false) here: that would make it invisible by default (detach() is called in attach()) if (decoratedComponent != null) { decoratedComponent.removeComponentListener(decoratedComponentTracker); decoratedComponent.removeAncestorListener(decoratedComponentTracker); decoratedComponent.removeHierarchyBoundsListener(decoratedComponentTracker); decoratedComponent.removeHierarchyListener(decoratedComponentTracker); decoratedComponent.removePropertyChangeListener("enabled", decoratedComponentTracker); decoratedComponent.removePropertyChangeListener("ancestor", decoratedComponentTracker); decoratedComponent = null; detachFromLayeredPane(); } }
java
private void detach() { // Do not call setVisible(false) here: that would make it invisible by default (detach() is called in attach()) if (decoratedComponent != null) { decoratedComponent.removeComponentListener(decoratedComponentTracker); decoratedComponent.removeAncestorListener(decoratedComponentTracker); decoratedComponent.removeHierarchyBoundsListener(decoratedComponentTracker); decoratedComponent.removeHierarchyListener(decoratedComponentTracker); decoratedComponent.removePropertyChangeListener("enabled", decoratedComponentTracker); decoratedComponent.removePropertyChangeListener("ancestor", decoratedComponentTracker); decoratedComponent = null; detachFromLayeredPane(); } }
[ "private", "void", "detach", "(", ")", "{", "// Do not call setVisible(false) here: that would make it invisible by default (detach() is called in attach())", "if", "(", "decoratedComponent", "!=", "null", ")", "{", "decoratedComponent", ".", "removeComponentListener", "(", "decoratedComponentTracker", ")", ";", "decoratedComponent", ".", "removeAncestorListener", "(", "decoratedComponentTracker", ")", ";", "decoratedComponent", ".", "removeHierarchyBoundsListener", "(", "decoratedComponentTracker", ")", ";", "decoratedComponent", ".", "removeHierarchyListener", "(", "decoratedComponentTracker", ")", ";", "decoratedComponent", ".", "removePropertyChangeListener", "(", "\"enabled\"", ",", "decoratedComponentTracker", ")", ";", "decoratedComponent", ".", "removePropertyChangeListener", "(", "\"ancestor\"", ",", "decoratedComponentTracker", ")", ";", "decoratedComponent", "=", "null", ";", "detachFromLayeredPane", "(", ")", ";", "}", "}" ]
Detaches the decoration from the decorated component.
[ "Detaches", "the", "decoration", "from", "the", "decorated", "component", "." ]
2dd3c7b3403993db366d24a927645f467ccd1dda
https://github.com/padrig64/ValidationFramework/blob/2dd3c7b3403993db366d24a927645f467ccd1dda/validationframework-swing/src/main/java/com/google/code/validationframework/swing/decoration/AbstractComponentDecoration.java#L415-L429
train
padrig64/ValidationFramework
validationframework-swing/src/main/java/com/google/code/validationframework/swing/decoration/AbstractComponentDecoration.java
AbstractComponentDecoration.attachToLayeredPane
private void attachToLayeredPane() { // Get ancestor layered pane that will get the decoration holder component Container ancestor = SwingUtilities.getAncestorOfClass(JLayeredPane.class, decoratedComponent); if (ancestor instanceof JLayeredPane) { attachedLayeredPane = (JLayeredPane) ancestor; Integer layer = getDecoratedComponentLayerInLayeredPane(attachedLayeredPane); attachedLayeredPane.remove(decorationPainter); attachedLayeredPane.add(decorationPainter, layer); } else { // Remove decoration painter from previous layered pane as this could lead to memory leak detachFromLayeredPane(); } }
java
private void attachToLayeredPane() { // Get ancestor layered pane that will get the decoration holder component Container ancestor = SwingUtilities.getAncestorOfClass(JLayeredPane.class, decoratedComponent); if (ancestor instanceof JLayeredPane) { attachedLayeredPane = (JLayeredPane) ancestor; Integer layer = getDecoratedComponentLayerInLayeredPane(attachedLayeredPane); attachedLayeredPane.remove(decorationPainter); attachedLayeredPane.add(decorationPainter, layer); } else { // Remove decoration painter from previous layered pane as this could lead to memory leak detachFromLayeredPane(); } }
[ "private", "void", "attachToLayeredPane", "(", ")", "{", "// Get ancestor layered pane that will get the decoration holder component", "Container", "ancestor", "=", "SwingUtilities", ".", "getAncestorOfClass", "(", "JLayeredPane", ".", "class", ",", "decoratedComponent", ")", ";", "if", "(", "ancestor", "instanceof", "JLayeredPane", ")", "{", "attachedLayeredPane", "=", "(", "JLayeredPane", ")", "ancestor", ";", "Integer", "layer", "=", "getDecoratedComponentLayerInLayeredPane", "(", "attachedLayeredPane", ")", ";", "attachedLayeredPane", ".", "remove", "(", "decorationPainter", ")", ";", "attachedLayeredPane", ".", "add", "(", "decorationPainter", ",", "layer", ")", ";", "}", "else", "{", "// Remove decoration painter from previous layered pane as this could lead to memory leak", "detachFromLayeredPane", "(", ")", ";", "}", "}" ]
Inserts the decoration to the layered pane right above the decorated component.
[ "Inserts", "the", "decoration", "to", "the", "layered", "pane", "right", "above", "the", "decorated", "component", "." ]
2dd3c7b3403993db366d24a927645f467ccd1dda
https://github.com/padrig64/ValidationFramework/blob/2dd3c7b3403993db366d24a927645f467ccd1dda/validationframework-swing/src/main/java/com/google/code/validationframework/swing/decoration/AbstractComponentDecoration.java#L434-L446
train
padrig64/ValidationFramework
validationframework-swing/src/main/java/com/google/code/validationframework/swing/decoration/AbstractComponentDecoration.java
AbstractComponentDecoration.getDecoratedComponentLayerInLayeredPane
private Integer getDecoratedComponentLayerInLayeredPane(JLayeredPane layeredPane) { Container ancestorInLayer = decoratedComponent; while (!layeredPane.equals(ancestorInLayer.getParent())) { ancestorInLayer = ancestorInLayer.getParent(); } return (layeredPane.getLayer(ancestorInLayer) + DECORATION_LAYER_OFFSET); }
java
private Integer getDecoratedComponentLayerInLayeredPane(JLayeredPane layeredPane) { Container ancestorInLayer = decoratedComponent; while (!layeredPane.equals(ancestorInLayer.getParent())) { ancestorInLayer = ancestorInLayer.getParent(); } return (layeredPane.getLayer(ancestorInLayer) + DECORATION_LAYER_OFFSET); }
[ "private", "Integer", "getDecoratedComponentLayerInLayeredPane", "(", "JLayeredPane", "layeredPane", ")", "{", "Container", "ancestorInLayer", "=", "decoratedComponent", ";", "while", "(", "!", "layeredPane", ".", "equals", "(", "ancestorInLayer", ".", "getParent", "(", ")", ")", ")", "{", "ancestorInLayer", "=", "ancestorInLayer", ".", "getParent", "(", ")", ";", "}", "return", "(", "layeredPane", ".", "getLayer", "(", "ancestorInLayer", ")", "+", "DECORATION_LAYER_OFFSET", ")", ";", "}" ]
Retrieves the layer index of the decorated component in the layered pane of the window. @param layeredPane Layered pane of the window. @return Index of the decorated component in the layered pane.
[ "Retrieves", "the", "layer", "index", "of", "the", "decorated", "component", "in", "the", "layered", "pane", "of", "the", "window", "." ]
2dd3c7b3403993db366d24a927645f467ccd1dda
https://github.com/padrig64/ValidationFramework/blob/2dd3c7b3403993db366d24a927645f467ccd1dda/validationframework-swing/src/main/java/com/google/code/validationframework/swing/decoration/AbstractComponentDecoration.java#L455-L462
train
padrig64/ValidationFramework
validationframework-swing/src/main/java/com/google/code/validationframework/swing/decoration/AbstractComponentDecoration.java
AbstractComponentDecoration.updateDecorationPainterVisibility
private void updateDecorationPainterVisibility() { boolean shouldBeVisible = (decoratedComponent != null) && // (paintWhenDisabled || decoratedComponent.isEnabled()) && // decoratedComponent.isShowing() && // visible; if (shouldBeVisible != decorationPainter.isVisible()) { decorationPainter.setVisible(shouldBeVisible); } }
java
private void updateDecorationPainterVisibility() { boolean shouldBeVisible = (decoratedComponent != null) && // (paintWhenDisabled || decoratedComponent.isEnabled()) && // decoratedComponent.isShowing() && // visible; if (shouldBeVisible != decorationPainter.isVisible()) { decorationPainter.setVisible(shouldBeVisible); } }
[ "private", "void", "updateDecorationPainterVisibility", "(", ")", "{", "boolean", "shouldBeVisible", "=", "(", "decoratedComponent", "!=", "null", ")", "&&", "//", "(", "paintWhenDisabled", "||", "decoratedComponent", ".", "isEnabled", "(", ")", ")", "&&", "//", "decoratedComponent", ".", "isShowing", "(", ")", "&&", "//", "visible", ";", "if", "(", "shouldBeVisible", "!=", "decorationPainter", ".", "isVisible", "(", ")", ")", "{", "decorationPainter", ".", "setVisible", "(", "shouldBeVisible", ")", ";", "}", "}" ]
Updates the visibility of the decoration painter according to the visible state set by the programmer and the state of the decorated component. @see DecorationPainter
[ "Updates", "the", "visibility", "of", "the", "decoration", "painter", "according", "to", "the", "visible", "state", "set", "by", "the", "programmer", "and", "the", "state", "of", "the", "decorated", "component", "." ]
2dd3c7b3403993db366d24a927645f467ccd1dda
https://github.com/padrig64/ValidationFramework/blob/2dd3c7b3403993db366d24a927645f467ccd1dda/validationframework-swing/src/main/java/com/google/code/validationframework/swing/decoration/AbstractComponentDecoration.java#L610-L618
train
padrig64/ValidationFramework
validationframework-swing/src/main/java/com/google/code/validationframework/swing/decoration/AbstractComponentDecoration.java
AbstractComponentDecoration.followDecoratedComponent
private void followDecoratedComponent(JLayeredPane layeredPane) { Point relativeLocationToOwner = anchorLink.getRelativeSlaveLocation(decoratedComponent.getWidth(), decoratedComponent.getHeight(), getWidth(), getHeight()); updateDecorationPainterUnclippedBounds(layeredPane, relativeLocationToOwner); updateDecorationPainterClippedBounds(layeredPane, relativeLocationToOwner); // Repaint decoration if (layeredPane != null) { decorationPainter.revalidate(); decorationPainter.repaint(); } }
java
private void followDecoratedComponent(JLayeredPane layeredPane) { Point relativeLocationToOwner = anchorLink.getRelativeSlaveLocation(decoratedComponent.getWidth(), decoratedComponent.getHeight(), getWidth(), getHeight()); updateDecorationPainterUnclippedBounds(layeredPane, relativeLocationToOwner); updateDecorationPainterClippedBounds(layeredPane, relativeLocationToOwner); // Repaint decoration if (layeredPane != null) { decorationPainter.revalidate(); decorationPainter.repaint(); } }
[ "private", "void", "followDecoratedComponent", "(", "JLayeredPane", "layeredPane", ")", "{", "Point", "relativeLocationToOwner", "=", "anchorLink", ".", "getRelativeSlaveLocation", "(", "decoratedComponent", ".", "getWidth", "(", ")", ",", "decoratedComponent", ".", "getHeight", "(", ")", ",", "getWidth", "(", ")", ",", "getHeight", "(", ")", ")", ";", "updateDecorationPainterUnclippedBounds", "(", "layeredPane", ",", "relativeLocationToOwner", ")", ";", "updateDecorationPainterClippedBounds", "(", "layeredPane", ",", "relativeLocationToOwner", ")", ";", "// Repaint decoration", "if", "(", "layeredPane", "!=", "null", ")", "{", "decorationPainter", ".", "revalidate", "(", ")", ";", "decorationPainter", ".", "repaint", "(", ")", ";", "}", "}" ]
Updates the decoration painter in the specified layered pane. @param layeredPane Layered pane containing the decoration. @see #followDecoratedComponent()
[ "Updates", "the", "decoration", "painter", "in", "the", "specified", "layered", "pane", "." ]
2dd3c7b3403993db366d24a927645f467ccd1dda
https://github.com/padrig64/ValidationFramework/blob/2dd3c7b3403993db366d24a927645f467ccd1dda/validationframework-swing/src/main/java/com/google/code/validationframework/swing/decoration/AbstractComponentDecoration.java#L645-L657
train
padrig64/ValidationFramework
validationframework-swing/src/main/java/com/google/code/validationframework/swing/decoration/AbstractComponentDecoration.java
AbstractComponentDecoration.updateDecorationPainterUnclippedBounds
private void updateDecorationPainterUnclippedBounds(JLayeredPane layeredPane, Point relativeLocationToOwner) { Rectangle decorationBoundsInLayeredPane; if (layeredPane == null) { decorationBoundsInLayeredPane = new Rectangle(); } else { // Calculate location of the decorated component in the layered pane containing the decoration painter Point decoratedComponentLocationInLayeredPane = SwingUtilities.convertPoint(decoratedComponent.getParent (), decoratedComponent.getLocation(), layeredPane); // Deduces the location of the decoration painter in the layered pane decorationBoundsInLayeredPane = new Rectangle(decoratedComponentLocationInLayeredPane.x + relativeLocationToOwner.x, decoratedComponentLocationInLayeredPane.y + relativeLocationToOwner.y, getWidth(), getHeight()); } // Update decoration painter decorationPainter.setBounds(decorationBoundsInLayeredPane); }
java
private void updateDecorationPainterUnclippedBounds(JLayeredPane layeredPane, Point relativeLocationToOwner) { Rectangle decorationBoundsInLayeredPane; if (layeredPane == null) { decorationBoundsInLayeredPane = new Rectangle(); } else { // Calculate location of the decorated component in the layered pane containing the decoration painter Point decoratedComponentLocationInLayeredPane = SwingUtilities.convertPoint(decoratedComponent.getParent (), decoratedComponent.getLocation(), layeredPane); // Deduces the location of the decoration painter in the layered pane decorationBoundsInLayeredPane = new Rectangle(decoratedComponentLocationInLayeredPane.x + relativeLocationToOwner.x, decoratedComponentLocationInLayeredPane.y + relativeLocationToOwner.y, getWidth(), getHeight()); } // Update decoration painter decorationPainter.setBounds(decorationBoundsInLayeredPane); }
[ "private", "void", "updateDecorationPainterUnclippedBounds", "(", "JLayeredPane", "layeredPane", ",", "Point", "relativeLocationToOwner", ")", "{", "Rectangle", "decorationBoundsInLayeredPane", ";", "if", "(", "layeredPane", "==", "null", ")", "{", "decorationBoundsInLayeredPane", "=", "new", "Rectangle", "(", ")", ";", "}", "else", "{", "// Calculate location of the decorated component in the layered pane containing the decoration painter", "Point", "decoratedComponentLocationInLayeredPane", "=", "SwingUtilities", ".", "convertPoint", "(", "decoratedComponent", ".", "getParent", "(", ")", ",", "decoratedComponent", ".", "getLocation", "(", ")", ",", "layeredPane", ")", ";", "// Deduces the location of the decoration painter in the layered pane", "decorationBoundsInLayeredPane", "=", "new", "Rectangle", "(", "decoratedComponentLocationInLayeredPane", ".", "x", "+", "relativeLocationToOwner", ".", "x", ",", "decoratedComponentLocationInLayeredPane", ".", "y", "+", "relativeLocationToOwner", ".", "y", ",", "getWidth", "(", ")", ",", "getHeight", "(", ")", ")", ";", "}", "// Update decoration painter", "decorationPainter", ".", "setBounds", "(", "decorationBoundsInLayeredPane", ")", ";", "}" ]
Calculates and updates the unclipped bounds of the decoration painter in layered pane coordinates. @param layeredPane Layered pane containing the decoration painter. @param relativeLocationToOwner Location of the decoration painter relatively to the decorated component.
[ "Calculates", "and", "updates", "the", "unclipped", "bounds", "of", "the", "decoration", "painter", "in", "layered", "pane", "coordinates", "." ]
2dd3c7b3403993db366d24a927645f467ccd1dda
https://github.com/padrig64/ValidationFramework/blob/2dd3c7b3403993db366d24a927645f467ccd1dda/validationframework-swing/src/main/java/com/google/code/validationframework/swing/decoration/AbstractComponentDecoration.java#L665-L683
train
padrig64/ValidationFramework
validationframework-swing/src/main/java/com/google/code/validationframework/swing/decoration/AbstractComponentDecoration.java
AbstractComponentDecoration.updateDecorationPainterClippedBounds
private void updateDecorationPainterClippedBounds(JLayeredPane layeredPane, Point relativeLocationToOwner) { if (layeredPane == null) { decorationPainter.setClipBounds(null); } else { JComponent clippingComponent = getEffectiveClippingAncestor(); if (clippingComponent == null) { LOGGER.error("No decoration clipping component can be found for decorated component: " + decoratedComponent); decorationPainter.setClipBounds(null); } else if (clippingComponent.isShowing()) { Rectangle ownerBoundsInParent = decoratedComponent.getBounds(); Rectangle decorationBoundsInParent = new Rectangle(ownerBoundsInParent.x + relativeLocationToOwner.x, ownerBoundsInParent.y + relativeLocationToOwner.y, getWidth(), getHeight()); Rectangle decorationBoundsInAncestor = SwingUtilities.convertRectangle(decoratedComponent.getParent() , decorationBoundsInParent, clippingComponent); Rectangle decorationVisibleBoundsInAncestor; Rectangle ancestorVisibleRect = clippingComponent.getVisibleRect(); decorationVisibleBoundsInAncestor = ancestorVisibleRect.intersection(decorationBoundsInAncestor); if ((decorationVisibleBoundsInAncestor.width == 0) || (decorationVisibleBoundsInAncestor.height == 0)) { // No bounds, no painting decorationPainter.setClipBounds(null); } else { Rectangle decorationVisibleBoundsInLayeredPane = SwingUtilities.convertRectangle (clippingComponent, decorationVisibleBoundsInAncestor, layeredPane); // Clip graphics context Rectangle clipBounds = SwingUtilities.convertRectangle(decorationPainter.getParent(), decorationVisibleBoundsInLayeredPane, decorationPainter); decorationPainter.setClipBounds(clipBounds); } } else { // This could happen for example when a dialog is closed, so no need to log anything decorationPainter.setClipBounds(null); } } }
java
private void updateDecorationPainterClippedBounds(JLayeredPane layeredPane, Point relativeLocationToOwner) { if (layeredPane == null) { decorationPainter.setClipBounds(null); } else { JComponent clippingComponent = getEffectiveClippingAncestor(); if (clippingComponent == null) { LOGGER.error("No decoration clipping component can be found for decorated component: " + decoratedComponent); decorationPainter.setClipBounds(null); } else if (clippingComponent.isShowing()) { Rectangle ownerBoundsInParent = decoratedComponent.getBounds(); Rectangle decorationBoundsInParent = new Rectangle(ownerBoundsInParent.x + relativeLocationToOwner.x, ownerBoundsInParent.y + relativeLocationToOwner.y, getWidth(), getHeight()); Rectangle decorationBoundsInAncestor = SwingUtilities.convertRectangle(decoratedComponent.getParent() , decorationBoundsInParent, clippingComponent); Rectangle decorationVisibleBoundsInAncestor; Rectangle ancestorVisibleRect = clippingComponent.getVisibleRect(); decorationVisibleBoundsInAncestor = ancestorVisibleRect.intersection(decorationBoundsInAncestor); if ((decorationVisibleBoundsInAncestor.width == 0) || (decorationVisibleBoundsInAncestor.height == 0)) { // No bounds, no painting decorationPainter.setClipBounds(null); } else { Rectangle decorationVisibleBoundsInLayeredPane = SwingUtilities.convertRectangle (clippingComponent, decorationVisibleBoundsInAncestor, layeredPane); // Clip graphics context Rectangle clipBounds = SwingUtilities.convertRectangle(decorationPainter.getParent(), decorationVisibleBoundsInLayeredPane, decorationPainter); decorationPainter.setClipBounds(clipBounds); } } else { // This could happen for example when a dialog is closed, so no need to log anything decorationPainter.setClipBounds(null); } } }
[ "private", "void", "updateDecorationPainterClippedBounds", "(", "JLayeredPane", "layeredPane", ",", "Point", "relativeLocationToOwner", ")", "{", "if", "(", "layeredPane", "==", "null", ")", "{", "decorationPainter", ".", "setClipBounds", "(", "null", ")", ";", "}", "else", "{", "JComponent", "clippingComponent", "=", "getEffectiveClippingAncestor", "(", ")", ";", "if", "(", "clippingComponent", "==", "null", ")", "{", "LOGGER", ".", "error", "(", "\"No decoration clipping component can be found for decorated component: \"", "+", "decoratedComponent", ")", ";", "decorationPainter", ".", "setClipBounds", "(", "null", ")", ";", "}", "else", "if", "(", "clippingComponent", ".", "isShowing", "(", ")", ")", "{", "Rectangle", "ownerBoundsInParent", "=", "decoratedComponent", ".", "getBounds", "(", ")", ";", "Rectangle", "decorationBoundsInParent", "=", "new", "Rectangle", "(", "ownerBoundsInParent", ".", "x", "+", "relativeLocationToOwner", ".", "x", ",", "ownerBoundsInParent", ".", "y", "+", "relativeLocationToOwner", ".", "y", ",", "getWidth", "(", ")", ",", "getHeight", "(", ")", ")", ";", "Rectangle", "decorationBoundsInAncestor", "=", "SwingUtilities", ".", "convertRectangle", "(", "decoratedComponent", ".", "getParent", "(", ")", ",", "decorationBoundsInParent", ",", "clippingComponent", ")", ";", "Rectangle", "decorationVisibleBoundsInAncestor", ";", "Rectangle", "ancestorVisibleRect", "=", "clippingComponent", ".", "getVisibleRect", "(", ")", ";", "decorationVisibleBoundsInAncestor", "=", "ancestorVisibleRect", ".", "intersection", "(", "decorationBoundsInAncestor", ")", ";", "if", "(", "(", "decorationVisibleBoundsInAncestor", ".", "width", "==", "0", ")", "||", "(", "decorationVisibleBoundsInAncestor", ".", "height", "==", "0", ")", ")", "{", "// No bounds, no painting", "decorationPainter", ".", "setClipBounds", "(", "null", ")", ";", "}", "else", "{", "Rectangle", "decorationVisibleBoundsInLayeredPane", "=", "SwingUtilities", ".", "convertRectangle", "(", "clippingComponent", ",", "decorationVisibleBoundsInAncestor", ",", "layeredPane", ")", ";", "// Clip graphics context", "Rectangle", "clipBounds", "=", "SwingUtilities", ".", "convertRectangle", "(", "decorationPainter", ".", "getParent", "(", ")", ",", "decorationVisibleBoundsInLayeredPane", ",", "decorationPainter", ")", ";", "decorationPainter", ".", "setClipBounds", "(", "clipBounds", ")", ";", "}", "}", "else", "{", "// This could happen for example when a dialog is closed, so no need to log anything", "decorationPainter", ".", "setClipBounds", "(", "null", ")", ";", "}", "}", "}" ]
Calculates and updates the clipped bounds of the decoration painter in layered pane coordinates. @param layeredPane Layered pane containing the decoration painter. @param relativeLocationToOwner Location of the decoration painter relatively to the decorated component.
[ "Calculates", "and", "updates", "the", "clipped", "bounds", "of", "the", "decoration", "painter", "in", "layered", "pane", "coordinates", "." ]
2dd3c7b3403993db366d24a927645f467ccd1dda
https://github.com/padrig64/ValidationFramework/blob/2dd3c7b3403993db366d24a927645f467ccd1dda/validationframework-swing/src/main/java/com/google/code/validationframework/swing/decoration/AbstractComponentDecoration.java#L691-L727
train
riccardove/easyjasub
easyjasub-lib/src/main/java/com/github/riccardove/easyjasub/cssbox/CssBoxPngRenderer.java
CssBoxPngRenderer.setDefaultFonts
private void setDefaultFonts(BrowserConfig config) { config.setDefaultFont(Font.SERIF, "Times New Roman"); config.setDefaultFont(Font.SANS_SERIF, "Arial"); config.setDefaultFont(Font.MONOSPACED, "Courier New"); }
java
private void setDefaultFonts(BrowserConfig config) { config.setDefaultFont(Font.SERIF, "Times New Roman"); config.setDefaultFont(Font.SANS_SERIF, "Arial"); config.setDefaultFont(Font.MONOSPACED, "Courier New"); }
[ "private", "void", "setDefaultFonts", "(", "BrowserConfig", "config", ")", "{", "config", ".", "setDefaultFont", "(", "Font", ".", "SERIF", ",", "\"Times New Roman\"", ")", ";", "config", ".", "setDefaultFont", "(", "Font", ".", "SANS_SERIF", ",", "\"Arial\"", ")", ";", "config", ".", "setDefaultFont", "(", "Font", ".", "MONOSPACED", ",", "\"Courier New\"", ")", ";", "}" ]
Sets some common fonts as the defaults for generic font families.
[ "Sets", "some", "common", "fonts", "as", "the", "defaults", "for", "generic", "font", "families", "." ]
58d6af66b1b1c738326c74d9ad5e4ad514120e27
https://github.com/riccardove/easyjasub/blob/58d6af66b1b1c738326c74d9ad5e4ad514120e27/easyjasub-lib/src/main/java/com/github/riccardove/easyjasub/cssbox/CssBoxPngRenderer.java#L162-L166
train
padrig64/ValidationFramework
validationframework-core/src/main/java/com/google/code/validationframework/base/validator/generalvalidator/GeneralValidator.java
GeneralValidator.addResultCollector
public void addResultCollector(ResultCollector<?, DPO> resultCollector) { if (resultCollector != null) { addTrigger(resultCollector); addDataProvider(resultCollector); } }
java
public void addResultCollector(ResultCollector<?, DPO> resultCollector) { if (resultCollector != null) { addTrigger(resultCollector); addDataProvider(resultCollector); } }
[ "public", "void", "addResultCollector", "(", "ResultCollector", "<", "?", ",", "DPO", ">", "resultCollector", ")", "{", "if", "(", "resultCollector", "!=", "null", ")", "{", "addTrigger", "(", "resultCollector", ")", ";", "addDataProvider", "(", "resultCollector", ")", ";", "}", "}" ]
Adds the specified result collector to the triggers and data providers. @param resultCollector Result collector to be added.
[ "Adds", "the", "specified", "result", "collector", "to", "the", "triggers", "and", "data", "providers", "." ]
2dd3c7b3403993db366d24a927645f467ccd1dda
https://github.com/padrig64/ValidationFramework/blob/2dd3c7b3403993db366d24a927645f467ccd1dda/validationframework-core/src/main/java/com/google/code/validationframework/base/validator/generalvalidator/GeneralValidator.java#L165-L170
train
padrig64/ValidationFramework
validationframework-core/src/main/java/com/google/code/validationframework/base/validator/generalvalidator/GeneralValidator.java
GeneralValidator.removeResultCollector
public void removeResultCollector(ResultCollector<?, DPO> resultCollector) { if (resultCollector != null) { removeTrigger(resultCollector); removeDataProvider(resultCollector); } }
java
public void removeResultCollector(ResultCollector<?, DPO> resultCollector) { if (resultCollector != null) { removeTrigger(resultCollector); removeDataProvider(resultCollector); } }
[ "public", "void", "removeResultCollector", "(", "ResultCollector", "<", "?", ",", "DPO", ">", "resultCollector", ")", "{", "if", "(", "resultCollector", "!=", "null", ")", "{", "removeTrigger", "(", "resultCollector", ")", ";", "removeDataProvider", "(", "resultCollector", ")", ";", "}", "}" ]
Removes the specified result collector from the triggers and data providers. @param resultCollector Result collector to be removed.
[ "Removes", "the", "specified", "result", "collector", "from", "the", "triggers", "and", "data", "providers", "." ]
2dd3c7b3403993db366d24a927645f467ccd1dda
https://github.com/padrig64/ValidationFramework/blob/2dd3c7b3403993db366d24a927645f467ccd1dda/validationframework-core/src/main/java/com/google/code/validationframework/base/validator/generalvalidator/GeneralValidator.java#L177-L182
train
padrig64/ValidationFramework
validationframework-core/src/main/java/com/google/code/validationframework/base/validator/generalvalidator/GeneralValidator.java
GeneralValidator.getDataProviderOutputTransformers
public Transformer[] getDataProviderOutputTransformers() { Transformer[] transformers; if (dataProviderOutputTransformers == null) { transformers = null; } else { transformers = dataProviderOutputTransformers.toArray(new Transformer[dataProviderOutputTransformers.size ()]); } return transformers; }
java
public Transformer[] getDataProviderOutputTransformers() { Transformer[] transformers; if (dataProviderOutputTransformers == null) { transformers = null; } else { transformers = dataProviderOutputTransformers.toArray(new Transformer[dataProviderOutputTransformers.size ()]); } return transformers; }
[ "public", "Transformer", "[", "]", "getDataProviderOutputTransformers", "(", ")", "{", "Transformer", "[", "]", "transformers", ";", "if", "(", "dataProviderOutputTransformers", "==", "null", ")", "{", "transformers", "=", "null", ";", "}", "else", "{", "transformers", "=", "dataProviderOutputTransformers", ".", "toArray", "(", "new", "Transformer", "[", "dataProviderOutputTransformers", ".", "size", "(", ")", "]", ")", ";", "}", "return", "transformers", ";", "}" ]
Gets the transformers transforming the output of each data provider before they are mapped to the rules. @return Data provider output transformers.
[ "Gets", "the", "transformers", "transforming", "the", "output", "of", "each", "data", "provider", "before", "they", "are", "mapped", "to", "the", "rules", "." ]
2dd3c7b3403993db366d24a927645f467ccd1dda
https://github.com/padrig64/ValidationFramework/blob/2dd3c7b3403993db366d24a927645f467ccd1dda/validationframework-core/src/main/java/com/google/code/validationframework/base/validator/generalvalidator/GeneralValidator.java#L189-L200
train
padrig64/ValidationFramework
validationframework-core/src/main/java/com/google/code/validationframework/base/validator/generalvalidator/GeneralValidator.java
GeneralValidator.processEachDataProviderWithEachRule
@SuppressWarnings("unchecked") // NOSONAR (Avoid Duplicate Literals) private void processEachDataProviderWithEachRule() { // For each data provider for (DataProvider<DPO> dataProvider : dataProviders) { // Get the data provider output Object transformedOutput = dataProvider.getData(); // Transform the data provider output if (dataProviderOutputTransformers != null) { for (Transformer transformer : dataProviderOutputTransformers) { transformedOutput = transformer.transform(transformedOutput); } } // Transform the transformed data provider output to rule input if (ruleInputTransformers != null) { for (Transformer transformer : ruleInputTransformers) { transformedOutput = transformer.transform(transformedOutput); } } RI ruleInput = (RI) transformedOutput; // Process the rule input with the rules processRules(ruleInput); } }
java
@SuppressWarnings("unchecked") // NOSONAR (Avoid Duplicate Literals) private void processEachDataProviderWithEachRule() { // For each data provider for (DataProvider<DPO> dataProvider : dataProviders) { // Get the data provider output Object transformedOutput = dataProvider.getData(); // Transform the data provider output if (dataProviderOutputTransformers != null) { for (Transformer transformer : dataProviderOutputTransformers) { transformedOutput = transformer.transform(transformedOutput); } } // Transform the transformed data provider output to rule input if (ruleInputTransformers != null) { for (Transformer transformer : ruleInputTransformers) { transformedOutput = transformer.transform(transformedOutput); } } RI ruleInput = (RI) transformedOutput; // Process the rule input with the rules processRules(ruleInput); } }
[ "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "// NOSONAR (Avoid Duplicate Literals)", "private", "void", "processEachDataProviderWithEachRule", "(", ")", "{", "// For each data provider", "for", "(", "DataProvider", "<", "DPO", ">", "dataProvider", ":", "dataProviders", ")", "{", "// Get the data provider output", "Object", "transformedOutput", "=", "dataProvider", ".", "getData", "(", ")", ";", "// Transform the data provider output", "if", "(", "dataProviderOutputTransformers", "!=", "null", ")", "{", "for", "(", "Transformer", "transformer", ":", "dataProviderOutputTransformers", ")", "{", "transformedOutput", "=", "transformer", ".", "transform", "(", "transformedOutput", ")", ";", "}", "}", "// Transform the transformed data provider output to rule input", "if", "(", "ruleInputTransformers", "!=", "null", ")", "{", "for", "(", "Transformer", "transformer", ":", "ruleInputTransformers", ")", "{", "transformedOutput", "=", "transformer", ".", "transform", "(", "transformedOutput", ")", ";", "}", "}", "RI", "ruleInput", "=", "(", "RI", ")", "transformedOutput", ";", "// Process the rule input with the rules", "processRules", "(", "ruleInput", ")", ";", "}", "}" ]
Processes the output of each data provider one by one with each rule.
[ "Processes", "the", "output", "of", "each", "data", "provider", "one", "by", "one", "with", "each", "rule", "." ]
2dd3c7b3403993db366d24a927645f467ccd1dda
https://github.com/padrig64/ValidationFramework/blob/2dd3c7b3403993db366d24a927645f467ccd1dda/validationframework-core/src/main/java/com/google/code/validationframework/base/validator/generalvalidator/GeneralValidator.java#L367-L392
train
padrig64/ValidationFramework
validationframework-core/src/main/java/com/google/code/validationframework/base/validator/generalvalidator/GeneralValidator.java
GeneralValidator.processAllDataProvidersWithEachRule
@SuppressWarnings("unchecked") // NOSONAR (Avoid Duplicate Literals) private void processAllDataProvidersWithEachRule() { // For each data provider List<Object> transformedDataProvidersOutput = new ArrayList<Object>(dataProviders.size()); for (DataProvider<DPO> dataProvider : dataProviders) { // Get the data provider output Object transformedOutput = dataProvider.getData(); // Transform the data provider output if (dataProviderOutputTransformers != null) { for (Transformer transformer : dataProviderOutputTransformers) { transformedOutput = transformer.transform(transformedOutput); } } // Put the transformed data provider output in a list transformedDataProvidersOutput.add(transformedOutput); } // Transform the list of transformed data provider output to rule input Object transformedRulesInput = transformedDataProvidersOutput; if (ruleInputTransformers != null) { for (Transformer transformer : ruleInputTransformers) { transformedRulesInput = transformer.transform(transformedRulesInput); } } RI ruleInput = (RI) transformedRulesInput; // Process the rule input with the rules processRules(ruleInput); }
java
@SuppressWarnings("unchecked") // NOSONAR (Avoid Duplicate Literals) private void processAllDataProvidersWithEachRule() { // For each data provider List<Object> transformedDataProvidersOutput = new ArrayList<Object>(dataProviders.size()); for (DataProvider<DPO> dataProvider : dataProviders) { // Get the data provider output Object transformedOutput = dataProvider.getData(); // Transform the data provider output if (dataProviderOutputTransformers != null) { for (Transformer transformer : dataProviderOutputTransformers) { transformedOutput = transformer.transform(transformedOutput); } } // Put the transformed data provider output in a list transformedDataProvidersOutput.add(transformedOutput); } // Transform the list of transformed data provider output to rule input Object transformedRulesInput = transformedDataProvidersOutput; if (ruleInputTransformers != null) { for (Transformer transformer : ruleInputTransformers) { transformedRulesInput = transformer.transform(transformedRulesInput); } } RI ruleInput = (RI) transformedRulesInput; // Process the rule input with the rules processRules(ruleInput); }
[ "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "// NOSONAR (Avoid Duplicate Literals)", "private", "void", "processAllDataProvidersWithEachRule", "(", ")", "{", "// For each data provider", "List", "<", "Object", ">", "transformedDataProvidersOutput", "=", "new", "ArrayList", "<", "Object", ">", "(", "dataProviders", ".", "size", "(", ")", ")", ";", "for", "(", "DataProvider", "<", "DPO", ">", "dataProvider", ":", "dataProviders", ")", "{", "// Get the data provider output", "Object", "transformedOutput", "=", "dataProvider", ".", "getData", "(", ")", ";", "// Transform the data provider output", "if", "(", "dataProviderOutputTransformers", "!=", "null", ")", "{", "for", "(", "Transformer", "transformer", ":", "dataProviderOutputTransformers", ")", "{", "transformedOutput", "=", "transformer", ".", "transform", "(", "transformedOutput", ")", ";", "}", "}", "// Put the transformed data provider output in a list", "transformedDataProvidersOutput", ".", "add", "(", "transformedOutput", ")", ";", "}", "// Transform the list of transformed data provider output to rule input", "Object", "transformedRulesInput", "=", "transformedDataProvidersOutput", ";", "if", "(", "ruleInputTransformers", "!=", "null", ")", "{", "for", "(", "Transformer", "transformer", ":", "ruleInputTransformers", ")", "{", "transformedRulesInput", "=", "transformer", ".", "transform", "(", "transformedRulesInput", ")", ";", "}", "}", "RI", "ruleInput", "=", "(", "RI", ")", "transformedRulesInput", ";", "// Process the rule input with the rules", "processRules", "(", "ruleInput", ")", ";", "}" ]
Processes the output of all data providers, all at once, with each rule.
[ "Processes", "the", "output", "of", "all", "data", "providers", "all", "at", "once", "with", "each", "rule", "." ]
2dd3c7b3403993db366d24a927645f467ccd1dda
https://github.com/padrig64/ValidationFramework/blob/2dd3c7b3403993db366d24a927645f467ccd1dda/validationframework-core/src/main/java/com/google/code/validationframework/base/validator/generalvalidator/GeneralValidator.java#L397-L427
train
padrig64/ValidationFramework
validationframework-core/src/main/java/com/google/code/validationframework/base/validator/generalvalidator/GeneralValidator.java
GeneralValidator.processRules
private void processRules(RI ruleInput) { switch (ruleToResultHandlerMapping) { case SPLIT: processEachRuleWithEachResultHandler(ruleInput); break; case JOIN: processAllRulesWithEachResultHandler(ruleInput); break; default: LOGGER.error("Unsupported " + MappingStrategy.class.getSimpleName() + ": " + ruleToResultHandlerMapping); } }
java
private void processRules(RI ruleInput) { switch (ruleToResultHandlerMapping) { case SPLIT: processEachRuleWithEachResultHandler(ruleInput); break; case JOIN: processAllRulesWithEachResultHandler(ruleInput); break; default: LOGGER.error("Unsupported " + MappingStrategy.class.getSimpleName() + ": " + ruleToResultHandlerMapping); } }
[ "private", "void", "processRules", "(", "RI", "ruleInput", ")", "{", "switch", "(", "ruleToResultHandlerMapping", ")", "{", "case", "SPLIT", ":", "processEachRuleWithEachResultHandler", "(", "ruleInput", ")", ";", "break", ";", "case", "JOIN", ":", "processAllRulesWithEachResultHandler", "(", "ruleInput", ")", ";", "break", ";", "default", ":", "LOGGER", ".", "error", "(", "\"Unsupported \"", "+", "MappingStrategy", ".", "class", ".", "getSimpleName", "(", ")", "+", "\": \"", "+", "ruleToResultHandlerMapping", ")", ";", "}", "}" ]
Processes the specified rule input. @param ruleInput Rule input to be validated.
[ "Processes", "the", "specified", "rule", "input", "." ]
2dd3c7b3403993db366d24a927645f467ccd1dda
https://github.com/padrig64/ValidationFramework/blob/2dd3c7b3403993db366d24a927645f467ccd1dda/validationframework-core/src/main/java/com/google/code/validationframework/base/validator/generalvalidator/GeneralValidator.java#L434-L446
train
padrig64/ValidationFramework
validationframework-core/src/main/java/com/google/code/validationframework/base/validator/generalvalidator/GeneralValidator.java
GeneralValidator.processEachRuleWithEachResultHandler
@SuppressWarnings("unchecked") // NOSONAR (Avoid Duplicate Literals) private void processEachRuleWithEachResultHandler(RI ruleInput) { // For each rule for (Rule<RI, RO> rule : rules) { // Validate the data and get the rule output Object ruleOutput = rule.validate(ruleInput); // Transform the rule output if (ruleOutputTransformers != null) { for (Transformer transformer : ruleOutputTransformers) { ruleOutput = transformer.transform(ruleOutput); } } // Transform the transformed rule output to result handler input if (resultHandlerInputTransformers != null) { for (Transformer transformer : resultHandlerInputTransformers) { ruleOutput = transformer.transform(ruleOutput); } } RHI resultHandlerInput = (RHI) ruleOutput; // Process the result handler input with the result handlers processResultHandlers(resultHandlerInput); } }
java
@SuppressWarnings("unchecked") // NOSONAR (Avoid Duplicate Literals) private void processEachRuleWithEachResultHandler(RI ruleInput) { // For each rule for (Rule<RI, RO> rule : rules) { // Validate the data and get the rule output Object ruleOutput = rule.validate(ruleInput); // Transform the rule output if (ruleOutputTransformers != null) { for (Transformer transformer : ruleOutputTransformers) { ruleOutput = transformer.transform(ruleOutput); } } // Transform the transformed rule output to result handler input if (resultHandlerInputTransformers != null) { for (Transformer transformer : resultHandlerInputTransformers) { ruleOutput = transformer.transform(ruleOutput); } } RHI resultHandlerInput = (RHI) ruleOutput; // Process the result handler input with the result handlers processResultHandlers(resultHandlerInput); } }
[ "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "// NOSONAR (Avoid Duplicate Literals)", "private", "void", "processEachRuleWithEachResultHandler", "(", "RI", "ruleInput", ")", "{", "// For each rule", "for", "(", "Rule", "<", "RI", ",", "RO", ">", "rule", ":", "rules", ")", "{", "// Validate the data and get the rule output", "Object", "ruleOutput", "=", "rule", ".", "validate", "(", "ruleInput", ")", ";", "// Transform the rule output", "if", "(", "ruleOutputTransformers", "!=", "null", ")", "{", "for", "(", "Transformer", "transformer", ":", "ruleOutputTransformers", ")", "{", "ruleOutput", "=", "transformer", ".", "transform", "(", "ruleOutput", ")", ";", "}", "}", "// Transform the transformed rule output to result handler input", "if", "(", "resultHandlerInputTransformers", "!=", "null", ")", "{", "for", "(", "Transformer", "transformer", ":", "resultHandlerInputTransformers", ")", "{", "ruleOutput", "=", "transformer", ".", "transform", "(", "ruleOutput", ")", ";", "}", "}", "RHI", "resultHandlerInput", "=", "(", "RHI", ")", "ruleOutput", ";", "// Process the result handler input with the result handlers", "processResultHandlers", "(", "resultHandlerInput", ")", ";", "}", "}" ]
Processes the specified rule input with each rule, and processes the results of each rule one by one with each result handler. @param ruleInput Rule input to be validated.
[ "Processes", "the", "specified", "rule", "input", "with", "each", "rule", "and", "processes", "the", "results", "of", "each", "rule", "one", "by", "one", "with", "each", "result", "handler", "." ]
2dd3c7b3403993db366d24a927645f467ccd1dda
https://github.com/padrig64/ValidationFramework/blob/2dd3c7b3403993db366d24a927645f467ccd1dda/validationframework-core/src/main/java/com/google/code/validationframework/base/validator/generalvalidator/GeneralValidator.java#L454-L479
train
padrig64/ValidationFramework
validationframework-core/src/main/java/com/google/code/validationframework/base/validator/generalvalidator/GeneralValidator.java
GeneralValidator.processAllRulesWithEachResultHandler
@SuppressWarnings("unchecked") // NOSONAR (Avoid Duplicate Literals) private void processAllRulesWithEachResultHandler(RI ruleInput) { // For each rule List<Object> combinedRulesOutput = new ArrayList<Object>(rules.size()); for (Rule<RI, RO> rule : rules) { // Validate the data and get the rule output Object data = rule.validate(ruleInput); // Transform the rule output if (ruleOutputTransformers != null) { for (Transformer transformer : ruleOutputTransformers) { data = transformer.transform(data); } } // Put the transformed rule output in a list combinedRulesOutput.add(data); } // Transform the list of transformed rule output to result handler input Object ruleOutput = combinedRulesOutput; if (resultHandlerInputTransformers != null) { for (Transformer transformer : resultHandlerInputTransformers) { ruleOutput = transformer.transform(ruleOutput); } } RHI resultHandlerInput = (RHI) ruleOutput; // Process the result handler input with the result handlers processResultHandlers(resultHandlerInput); }
java
@SuppressWarnings("unchecked") // NOSONAR (Avoid Duplicate Literals) private void processAllRulesWithEachResultHandler(RI ruleInput) { // For each rule List<Object> combinedRulesOutput = new ArrayList<Object>(rules.size()); for (Rule<RI, RO> rule : rules) { // Validate the data and get the rule output Object data = rule.validate(ruleInput); // Transform the rule output if (ruleOutputTransformers != null) { for (Transformer transformer : ruleOutputTransformers) { data = transformer.transform(data); } } // Put the transformed rule output in a list combinedRulesOutput.add(data); } // Transform the list of transformed rule output to result handler input Object ruleOutput = combinedRulesOutput; if (resultHandlerInputTransformers != null) { for (Transformer transformer : resultHandlerInputTransformers) { ruleOutput = transformer.transform(ruleOutput); } } RHI resultHandlerInput = (RHI) ruleOutput; // Process the result handler input with the result handlers processResultHandlers(resultHandlerInput); }
[ "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "// NOSONAR (Avoid Duplicate Literals)", "private", "void", "processAllRulesWithEachResultHandler", "(", "RI", "ruleInput", ")", "{", "// For each rule", "List", "<", "Object", ">", "combinedRulesOutput", "=", "new", "ArrayList", "<", "Object", ">", "(", "rules", ".", "size", "(", ")", ")", ";", "for", "(", "Rule", "<", "RI", ",", "RO", ">", "rule", ":", "rules", ")", "{", "// Validate the data and get the rule output", "Object", "data", "=", "rule", ".", "validate", "(", "ruleInput", ")", ";", "// Transform the rule output", "if", "(", "ruleOutputTransformers", "!=", "null", ")", "{", "for", "(", "Transformer", "transformer", ":", "ruleOutputTransformers", ")", "{", "data", "=", "transformer", ".", "transform", "(", "data", ")", ";", "}", "}", "// Put the transformed rule output in a list", "combinedRulesOutput", ".", "add", "(", "data", ")", ";", "}", "// Transform the list of transformed rule output to result handler input", "Object", "ruleOutput", "=", "combinedRulesOutput", ";", "if", "(", "resultHandlerInputTransformers", "!=", "null", ")", "{", "for", "(", "Transformer", "transformer", ":", "resultHandlerInputTransformers", ")", "{", "ruleOutput", "=", "transformer", ".", "transform", "(", "ruleOutput", ")", ";", "}", "}", "RHI", "resultHandlerInput", "=", "(", "RHI", ")", "ruleOutput", ";", "// Process the result handler input with the result handlers", "processResultHandlers", "(", "resultHandlerInput", ")", ";", "}" ]
Processes the specified rule input with each rule, and processes the result of all rules, all at once, with each result handler. @param ruleInput Rule input to be validated.
[ "Processes", "the", "specified", "rule", "input", "with", "each", "rule", "and", "processes", "the", "result", "of", "all", "rules", "all", "at", "once", "with", "each", "result", "handler", "." ]
2dd3c7b3403993db366d24a927645f467ccd1dda
https://github.com/padrig64/ValidationFramework/blob/2dd3c7b3403993db366d24a927645f467ccd1dda/validationframework-core/src/main/java/com/google/code/validationframework/base/validator/generalvalidator/GeneralValidator.java#L487-L517
train
padrig64/ValidationFramework
validationframework-core/src/main/java/com/google/code/validationframework/base/validator/generalvalidator/GeneralValidator.java
GeneralValidator.processResultHandlers
private void processResultHandlers(RHI resultHandlerInput) { for (ResultHandler<RHI> resultHandler : resultHandlers) { resultHandler.handleResult(resultHandlerInput); } }
java
private void processResultHandlers(RHI resultHandlerInput) { for (ResultHandler<RHI> resultHandler : resultHandlers) { resultHandler.handleResult(resultHandlerInput); } }
[ "private", "void", "processResultHandlers", "(", "RHI", "resultHandlerInput", ")", "{", "for", "(", "ResultHandler", "<", "RHI", ">", "resultHandler", ":", "resultHandlers", ")", "{", "resultHandler", ".", "handleResult", "(", "resultHandlerInput", ")", ";", "}", "}" ]
Processes the specified result handler input with each result handler. @param resultHandlerInput Result handler input to be handled.
[ "Processes", "the", "specified", "result", "handler", "input", "with", "each", "result", "handler", "." ]
2dd3c7b3403993db366d24a927645f467ccd1dda
https://github.com/padrig64/ValidationFramework/blob/2dd3c7b3403993db366d24a927645f467ccd1dda/validationframework-core/src/main/java/com/google/code/validationframework/base/validator/generalvalidator/GeneralValidator.java#L524-L528
train
padrig64/ValidationFramework
validationframework-core/src/main/java/com/google/code/validationframework/base/validator/generalvalidator/GeneralValidator.java
GeneralValidator.dispose
private void dispose(Collection<Transformer> elements) { if (elements != null) { for (Transformer<?, ?> element : elements) { if (element instanceof Disposable) { ((Disposable) element).dispose(); } } elements.clear(); } }
java
private void dispose(Collection<Transformer> elements) { if (elements != null) { for (Transformer<?, ?> element : elements) { if (element instanceof Disposable) { ((Disposable) element).dispose(); } } elements.clear(); } }
[ "private", "void", "dispose", "(", "Collection", "<", "Transformer", ">", "elements", ")", "{", "if", "(", "elements", "!=", "null", ")", "{", "for", "(", "Transformer", "<", "?", ",", "?", ">", "element", ":", "elements", ")", "{", "if", "(", "element", "instanceof", "Disposable", ")", "{", "(", "(", "Disposable", ")", "element", ")", ".", "dispose", "(", ")", ";", "}", "}", "elements", ".", "clear", "(", ")", ";", "}", "}" ]
Disposes the elements of the specified collection. @param elements Elements to be disposed.
[ "Disposes", "the", "elements", "of", "the", "specified", "collection", "." ]
2dd3c7b3403993db366d24a927645f467ccd1dda
https://github.com/padrig64/ValidationFramework/blob/2dd3c7b3403993db366d24a927645f467ccd1dda/validationframework-core/src/main/java/com/google/code/validationframework/base/validator/generalvalidator/GeneralValidator.java#L550-L559
train
padrig64/ValidationFramework
validationframework-swing/src/main/java/com/google/code/validationframework/swing/resulthandler/AbstractCellIconFeedback.java
AbstractCellIconFeedback.getAbsoluteAnchorLinkWithCell
private AnchorLink getAbsoluteAnchorLinkWithCell(int dragOffsetX) { AnchorLink absoluteAnchorLink; TableModel tableModel = table.getModel(); if ((0 <= modelRowIndex) && (modelRowIndex < tableModel.getRowCount()) && (0 <= modelColumnIndex) && (modelColumnIndex < tableModel.getColumnCount())) { int viewRowIndex = table.convertRowIndexToView(modelRowIndex); int viewColumnIndex = table.convertColumnIndexToView(modelColumnIndex); Rectangle cellBounds = table.getCellRect(viewRowIndex, viewColumnIndex, true); Anchor relativeCellAnchor = anchorLinkWithCell.getMasterAnchor(); Anchor absoluteCellAnchor = new Anchor(0.0f, cellBounds.x + dragOffsetX + (int) (cellBounds.width * relativeCellAnchor.getRelativeX()) + relativeCellAnchor.getOffsetX(), 0.0f, cellBounds.y + (int) (cellBounds.height * relativeCellAnchor.getRelativeY()) + relativeCellAnchor.getOffsetY()); absoluteAnchorLink = new AnchorLink(absoluteCellAnchor, anchorLinkWithCell.getSlaveAnchor()); } else { // Maybe the table has been emptied? or the row has been filtered out? or invalid row/column index? LOGGER.debug("Cell at model row and/or column indices is not visible: (" + modelRowIndex + "," + modelColumnIndex + ") for table dimensions (" + tableModel.getRowCount() + "," + tableModel.getColumnCount() + ")"); // Decoration will not be shown absoluteAnchorLink = null; } return absoluteAnchorLink; }
java
private AnchorLink getAbsoluteAnchorLinkWithCell(int dragOffsetX) { AnchorLink absoluteAnchorLink; TableModel tableModel = table.getModel(); if ((0 <= modelRowIndex) && (modelRowIndex < tableModel.getRowCount()) && (0 <= modelColumnIndex) && (modelColumnIndex < tableModel.getColumnCount())) { int viewRowIndex = table.convertRowIndexToView(modelRowIndex); int viewColumnIndex = table.convertColumnIndexToView(modelColumnIndex); Rectangle cellBounds = table.getCellRect(viewRowIndex, viewColumnIndex, true); Anchor relativeCellAnchor = anchorLinkWithCell.getMasterAnchor(); Anchor absoluteCellAnchor = new Anchor(0.0f, cellBounds.x + dragOffsetX + (int) (cellBounds.width * relativeCellAnchor.getRelativeX()) + relativeCellAnchor.getOffsetX(), 0.0f, cellBounds.y + (int) (cellBounds.height * relativeCellAnchor.getRelativeY()) + relativeCellAnchor.getOffsetY()); absoluteAnchorLink = new AnchorLink(absoluteCellAnchor, anchorLinkWithCell.getSlaveAnchor()); } else { // Maybe the table has been emptied? or the row has been filtered out? or invalid row/column index? LOGGER.debug("Cell at model row and/or column indices is not visible: (" + modelRowIndex + "," + modelColumnIndex + ") for table dimensions (" + tableModel.getRowCount() + "," + tableModel.getColumnCount() + ")"); // Decoration will not be shown absoluteAnchorLink = null; } return absoluteAnchorLink; }
[ "private", "AnchorLink", "getAbsoluteAnchorLinkWithCell", "(", "int", "dragOffsetX", ")", "{", "AnchorLink", "absoluteAnchorLink", ";", "TableModel", "tableModel", "=", "table", ".", "getModel", "(", ")", ";", "if", "(", "(", "0", "<=", "modelRowIndex", ")", "&&", "(", "modelRowIndex", "<", "tableModel", ".", "getRowCount", "(", ")", ")", "&&", "(", "0", "<=", "modelColumnIndex", ")", "&&", "(", "modelColumnIndex", "<", "tableModel", ".", "getColumnCount", "(", ")", ")", ")", "{", "int", "viewRowIndex", "=", "table", ".", "convertRowIndexToView", "(", "modelRowIndex", ")", ";", "int", "viewColumnIndex", "=", "table", ".", "convertColumnIndexToView", "(", "modelColumnIndex", ")", ";", "Rectangle", "cellBounds", "=", "table", ".", "getCellRect", "(", "viewRowIndex", ",", "viewColumnIndex", ",", "true", ")", ";", "Anchor", "relativeCellAnchor", "=", "anchorLinkWithCell", ".", "getMasterAnchor", "(", ")", ";", "Anchor", "absoluteCellAnchor", "=", "new", "Anchor", "(", "0.0f", ",", "cellBounds", ".", "x", "+", "dragOffsetX", "+", "(", "int", ")", "(", "cellBounds", ".", "width", "*", "relativeCellAnchor", ".", "getRelativeX", "(", ")", ")", "+", "relativeCellAnchor", ".", "getOffsetX", "(", ")", ",", "0.0f", ",", "cellBounds", ".", "y", "+", "(", "int", ")", "(", "cellBounds", ".", "height", "*", "relativeCellAnchor", ".", "getRelativeY", "(", ")", ")", "+", "relativeCellAnchor", ".", "getOffsetY", "(", ")", ")", ";", "absoluteAnchorLink", "=", "new", "AnchorLink", "(", "absoluteCellAnchor", ",", "anchorLinkWithCell", ".", "getSlaveAnchor", "(", ")", ")", ";", "}", "else", "{", "// Maybe the table has been emptied? or the row has been filtered out? or invalid row/column index?", "LOGGER", ".", "debug", "(", "\"Cell at model row and/or column indices is not visible: (\"", "+", "modelRowIndex", "+", "\",\"", "+", "modelColumnIndex", "+", "\") for table dimensions (\"", "+", "tableModel", ".", "getRowCount", "(", ")", "+", "\",\"", "+", "tableModel", ".", "getColumnCount", "(", ")", "+", "\")\"", ")", ";", "// Decoration will not be shown", "absoluteAnchorLink", "=", "null", ";", "}", "return", "absoluteAnchorLink", ";", "}" ]
Retrieves the absolute anchor link to attach the decoration to the cell. @param dragOffsetX Dragged distance in case the column is being dragged, 0 otherwise. @return Absolute anchor link to attach the decoration to the cell.
[ "Retrieves", "the", "absolute", "anchor", "link", "to", "attach", "the", "decoration", "to", "the", "cell", "." ]
2dd3c7b3403993db366d24a927645f467ccd1dda
https://github.com/padrig64/ValidationFramework/blob/2dd3c7b3403993db366d24a927645f467ccd1dda/validationframework-swing/src/main/java/com/google/code/validationframework/swing/resulthandler/AbstractCellIconFeedback.java#L371-L397
train
opencb/java-common-libs
commons-datastore/commons-datastore-solr/src/main/java/org/opencb/commons/datastore/solr/SolrFacetToFacetQueryResultItemConverter.java
SolrFacetToFacetQueryResultItemConverter.convert
public static List<FacetQueryResult.Field> convert(QueryResponse solrResponse, Map<String, String> alias) { // Sanity check if (solrResponse == null || solrResponse.getResponse() == null || solrResponse.getResponse().get("facets") == null) { return null; } if (alias == null) { alias = new HashMap<>(); } SimpleOrderedMap<Object> solrFacets = (SimpleOrderedMap<Object>) solrResponse.getResponse().get("facets"); List<FacetQueryResult.Field> fields = new ArrayList<>(); int count = (int) solrFacets.get("count"); for (int i = 0; i < solrFacets.size(); i++) { String name = solrFacets.getName(i); if (!"count".equals(name)) { if (solrFacets.get(name) instanceof SimpleOrderedMap) { String[] split = name.split("___"); FacetQueryResult.Field facetField = new FacetQueryResult.Field(getName(split[0], alias), getBucketCount((SimpleOrderedMap<Object>) solrFacets.get(name), count), new ArrayList<>()); if (split.length > 3) { facetField.setStart(FacetQueryParser.parseNumber(split[1])); facetField.setEnd(FacetQueryParser.parseNumber(split[2])); facetField.setStep(FacetQueryParser.parseNumber(split[3])); } parseBuckets((SimpleOrderedMap<Object>) solrFacets.get(name), facetField, alias); fields.add(facetField); } else { fields.add(parseAggregation(name, solrFacets.get(name), alias)); } } } return fields; }
java
public static List<FacetQueryResult.Field> convert(QueryResponse solrResponse, Map<String, String> alias) { // Sanity check if (solrResponse == null || solrResponse.getResponse() == null || solrResponse.getResponse().get("facets") == null) { return null; } if (alias == null) { alias = new HashMap<>(); } SimpleOrderedMap<Object> solrFacets = (SimpleOrderedMap<Object>) solrResponse.getResponse().get("facets"); List<FacetQueryResult.Field> fields = new ArrayList<>(); int count = (int) solrFacets.get("count"); for (int i = 0; i < solrFacets.size(); i++) { String name = solrFacets.getName(i); if (!"count".equals(name)) { if (solrFacets.get(name) instanceof SimpleOrderedMap) { String[] split = name.split("___"); FacetQueryResult.Field facetField = new FacetQueryResult.Field(getName(split[0], alias), getBucketCount((SimpleOrderedMap<Object>) solrFacets.get(name), count), new ArrayList<>()); if (split.length > 3) { facetField.setStart(FacetQueryParser.parseNumber(split[1])); facetField.setEnd(FacetQueryParser.parseNumber(split[2])); facetField.setStep(FacetQueryParser.parseNumber(split[3])); } parseBuckets((SimpleOrderedMap<Object>) solrFacets.get(name), facetField, alias); fields.add(facetField); } else { fields.add(parseAggregation(name, solrFacets.get(name), alias)); } } } return fields; }
[ "public", "static", "List", "<", "FacetQueryResult", ".", "Field", ">", "convert", "(", "QueryResponse", "solrResponse", ",", "Map", "<", "String", ",", "String", ">", "alias", ")", "{", "// Sanity check", "if", "(", "solrResponse", "==", "null", "||", "solrResponse", ".", "getResponse", "(", ")", "==", "null", "||", "solrResponse", ".", "getResponse", "(", ")", ".", "get", "(", "\"facets\"", ")", "==", "null", ")", "{", "return", "null", ";", "}", "if", "(", "alias", "==", "null", ")", "{", "alias", "=", "new", "HashMap", "<>", "(", ")", ";", "}", "SimpleOrderedMap", "<", "Object", ">", "solrFacets", "=", "(", "SimpleOrderedMap", "<", "Object", ">", ")", "solrResponse", ".", "getResponse", "(", ")", ".", "get", "(", "\"facets\"", ")", ";", "List", "<", "FacetQueryResult", ".", "Field", ">", "fields", "=", "new", "ArrayList", "<>", "(", ")", ";", "int", "count", "=", "(", "int", ")", "solrFacets", ".", "get", "(", "\"count\"", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "solrFacets", ".", "size", "(", ")", ";", "i", "++", ")", "{", "String", "name", "=", "solrFacets", ".", "getName", "(", "i", ")", ";", "if", "(", "!", "\"count\"", ".", "equals", "(", "name", ")", ")", "{", "if", "(", "solrFacets", ".", "get", "(", "name", ")", "instanceof", "SimpleOrderedMap", ")", "{", "String", "[", "]", "split", "=", "name", ".", "split", "(", "\"___\"", ")", ";", "FacetQueryResult", ".", "Field", "facetField", "=", "new", "FacetQueryResult", ".", "Field", "(", "getName", "(", "split", "[", "0", "]", ",", "alias", ")", ",", "getBucketCount", "(", "(", "SimpleOrderedMap", "<", "Object", ">", ")", "solrFacets", ".", "get", "(", "name", ")", ",", "count", ")", ",", "new", "ArrayList", "<>", "(", ")", ")", ";", "if", "(", "split", ".", "length", ">", "3", ")", "{", "facetField", ".", "setStart", "(", "FacetQueryParser", ".", "parseNumber", "(", "split", "[", "1", "]", ")", ")", ";", "facetField", ".", "setEnd", "(", "FacetQueryParser", ".", "parseNumber", "(", "split", "[", "2", "]", ")", ")", ";", "facetField", ".", "setStep", "(", "FacetQueryParser", ".", "parseNumber", "(", "split", "[", "3", "]", ")", ")", ";", "}", "parseBuckets", "(", "(", "SimpleOrderedMap", "<", "Object", ">", ")", "solrFacets", ".", "get", "(", "name", ")", ",", "facetField", ",", "alias", ")", ";", "fields", ".", "add", "(", "facetField", ")", ";", "}", "else", "{", "fields", ".", "add", "(", "parseAggregation", "(", "name", ",", "solrFacets", ".", "get", "(", "name", ")", ",", "alias", ")", ")", ";", "}", "}", "}", "return", "fields", ";", "}" ]
Convert a generic solrResponse into our FacetQueryResult. @param solrResponse SolrResponse. @param alias Map containing the solr keys present in the solrResponse and the key we actually want to be visible for the user. This is mainly to be able to hide private solr keys to the user and use better user-friendly keys. @return a FacetQueryResult.
[ "Convert", "a", "generic", "solrResponse", "into", "our", "FacetQueryResult", "." ]
5c97682530d0be55828e1e4e374ff01fceb5f198
https://github.com/opencb/java-common-libs/blob/5c97682530d0be55828e1e4e374ff01fceb5f198/commons-datastore/commons-datastore-solr/src/main/java/org/opencb/commons/datastore/solr/SolrFacetToFacetQueryResultItemConverter.java#L26-L61
train
opencb/java-common-libs
commons-datastore/commons-datastore-solr/src/main/java/org/opencb/commons/datastore/solr/SolrFacetToFacetQueryResultItemConverter.java
SolrFacetToFacetQueryResultItemConverter.getBucketCount
private static int getBucketCount(SimpleOrderedMap<Object> solrFacets, int defaultCount) { List<SimpleOrderedMap<Object>> solrBuckets = (List<SimpleOrderedMap<Object>>) solrFacets.get("buckets"); if (solrBuckets == null) { for (int i = 0; i < solrFacets.size(); i++) { if (solrFacets.getName(i).equals("count")) { return (int) solrFacets.getVal(i); } } } return defaultCount; }
java
private static int getBucketCount(SimpleOrderedMap<Object> solrFacets, int defaultCount) { List<SimpleOrderedMap<Object>> solrBuckets = (List<SimpleOrderedMap<Object>>) solrFacets.get("buckets"); if (solrBuckets == null) { for (int i = 0; i < solrFacets.size(); i++) { if (solrFacets.getName(i).equals("count")) { return (int) solrFacets.getVal(i); } } } return defaultCount; }
[ "private", "static", "int", "getBucketCount", "(", "SimpleOrderedMap", "<", "Object", ">", "solrFacets", ",", "int", "defaultCount", ")", "{", "List", "<", "SimpleOrderedMap", "<", "Object", ">>", "solrBuckets", "=", "(", "List", "<", "SimpleOrderedMap", "<", "Object", ">", ">", ")", "solrFacets", ".", "get", "(", "\"buckets\"", ")", ";", "if", "(", "solrBuckets", "==", "null", ")", "{", "for", "(", "int", "i", "=", "0", ";", "i", "<", "solrFacets", ".", "size", "(", ")", ";", "i", "++", ")", "{", "if", "(", "solrFacets", ".", "getName", "(", "i", ")", ".", "equals", "(", "\"count\"", ")", ")", "{", "return", "(", "int", ")", "solrFacets", ".", "getVal", "(", "i", ")", ";", "}", "}", "}", "return", "defaultCount", ";", "}" ]
In order to process type=query facets with a nested type=range. @param solrFacets Solr facet @param defaultCount Default count @return Actual count
[ "In", "order", "to", "process", "type", "=", "query", "facets", "with", "a", "nested", "type", "=", "range", "." ]
5c97682530d0be55828e1e4e374ff01fceb5f198
https://github.com/opencb/java-common-libs/blob/5c97682530d0be55828e1e4e374ff01fceb5f198/commons-datastore/commons-datastore-solr/src/main/java/org/opencb/commons/datastore/solr/SolrFacetToFacetQueryResultItemConverter.java#L70-L80
train
checkstyle-addons/checkstyle-addons
buildSrc/src/main/java/com/thomasjensen/checkstyle/addons/build/DependencyConfigs.java
DependencyConfigs.printAll
@SuppressWarnings("unused") public void printAll() { project.getLogger().lifecycle("Full contents of dependency configurations:"); project.getLogger().lifecycle("-------------------------------------------"); for (final Map.Entry<String, DependencyConfig> entry : depConfigs.entrySet()) { project.getLogger().lifecycle("- " + entry.getKey() + ":\t" + entry.getValue()); } }
java
@SuppressWarnings("unused") public void printAll() { project.getLogger().lifecycle("Full contents of dependency configurations:"); project.getLogger().lifecycle("-------------------------------------------"); for (final Map.Entry<String, DependencyConfig> entry : depConfigs.entrySet()) { project.getLogger().lifecycle("- " + entry.getKey() + ":\t" + entry.getValue()); } }
[ "@", "SuppressWarnings", "(", "\"unused\"", ")", "public", "void", "printAll", "(", ")", "{", "project", ".", "getLogger", "(", ")", ".", "lifecycle", "(", "\"Full contents of dependency configurations:\"", ")", ";", "project", ".", "getLogger", "(", ")", ".", "lifecycle", "(", "\"-------------------------------------------\"", ")", ";", "for", "(", "final", "Map", ".", "Entry", "<", "String", ",", "DependencyConfig", ">", "entry", ":", "depConfigs", ".", "entrySet", "(", ")", ")", "{", "project", ".", "getLogger", "(", ")", ".", "lifecycle", "(", "\"- \"", "+", "entry", ".", "getKey", "(", ")", "+", "\":\\t\"", "+", "entry", ".", "getValue", "(", ")", ")", ";", "}", "}" ]
Prints all dependency configurations with full contents for debugging purposes.
[ "Prints", "all", "dependency", "configurations", "with", "full", "contents", "for", "debugging", "purposes", "." ]
fae1b4d341639c8e32c3e59ec5abdc0ffc11b865
https://github.com/checkstyle-addons/checkstyle-addons/blob/fae1b4d341639c8e32c3e59ec5abdc0ffc11b865/buildSrc/src/main/java/com/thomasjensen/checkstyle/addons/build/DependencyConfigs.java#L228-L236
train
padrig64/ValidationFramework
validationframework-swing/src/main/java/com/google/code/validationframework/swing/property/JTableRolloverCellProperty.java
JTableRolloverCellProperty.updateValue
private void updateValue(Point location) { CellPosition oldValue = value; if (location == null) { value = null; } else { int row = table.rowAtPoint(location); int column = table.columnAtPoint(location); value = new CellPosition(row, column); } maybeNotifyListeners(oldValue, value); }
java
private void updateValue(Point location) { CellPosition oldValue = value; if (location == null) { value = null; } else { int row = table.rowAtPoint(location); int column = table.columnAtPoint(location); value = new CellPosition(row, column); } maybeNotifyListeners(oldValue, value); }
[ "private", "void", "updateValue", "(", "Point", "location", ")", "{", "CellPosition", "oldValue", "=", "value", ";", "if", "(", "location", "==", "null", ")", "{", "value", "=", "null", ";", "}", "else", "{", "int", "row", "=", "table", ".", "rowAtPoint", "(", "location", ")", ";", "int", "column", "=", "table", ".", "columnAtPoint", "(", "location", ")", ";", "value", "=", "new", "CellPosition", "(", "row", ",", "column", ")", ";", "}", "maybeNotifyListeners", "(", "oldValue", ",", "value", ")", ";", "}" ]
Updates the value of this property based on the location of the mouse pointer. @param location Location of the mouse in the relatively to the table.
[ "Updates", "the", "value", "of", "this", "property", "based", "on", "the", "location", "of", "the", "mouse", "pointer", "." ]
2dd3c7b3403993db366d24a927645f467ccd1dda
https://github.com/padrig64/ValidationFramework/blob/2dd3c7b3403993db366d24a927645f467ccd1dda/validationframework-swing/src/main/java/com/google/code/validationframework/swing/property/JTableRolloverCellProperty.java#L104-L114
train
hdinsight/storm-eventhubs
src/main/java/org/apache/storm/eventhubs/spout/EventHubSpout.java
EventHubSpout.preparePartitions
public void preparePartitions(Map config, int totalTasks, int taskIndex, SpoutOutputCollector collector) throws Exception { this.collector = collector; if(stateStore == null) { String zkEndpointAddress = eventHubConfig.getZkConnectionString(); if (zkEndpointAddress == null || zkEndpointAddress.length() == 0) { //use storm's zookeeper servers if not specified. @SuppressWarnings("unchecked") List<String> zkServers = (List<String>) config.get(Config.STORM_ZOOKEEPER_SERVERS); Integer zkPort = ((Number) config.get(Config.STORM_ZOOKEEPER_PORT)).intValue(); StringBuilder sb = new StringBuilder(); for (String zk : zkServers) { if (sb.length() > 0) { sb.append(','); } sb.append(zk+":"+zkPort); } zkEndpointAddress = sb.toString(); } stateStore = new ZookeeperStateStore(zkEndpointAddress, (Integer)config.get(Config.STORM_ZOOKEEPER_RETRY_TIMES), (Integer)config.get(Config.STORM_ZOOKEEPER_RETRY_INTERVAL)); } stateStore.open(); partitionCoordinator = new StaticPartitionCoordinator( eventHubConfig, taskIndex, totalTasks, stateStore, pmFactory, recvFactory); for (IPartitionManager partitionManager : partitionCoordinator.getMyPartitionManagers()) { partitionManager.open(); } }
java
public void preparePartitions(Map config, int totalTasks, int taskIndex, SpoutOutputCollector collector) throws Exception { this.collector = collector; if(stateStore == null) { String zkEndpointAddress = eventHubConfig.getZkConnectionString(); if (zkEndpointAddress == null || zkEndpointAddress.length() == 0) { //use storm's zookeeper servers if not specified. @SuppressWarnings("unchecked") List<String> zkServers = (List<String>) config.get(Config.STORM_ZOOKEEPER_SERVERS); Integer zkPort = ((Number) config.get(Config.STORM_ZOOKEEPER_PORT)).intValue(); StringBuilder sb = new StringBuilder(); for (String zk : zkServers) { if (sb.length() > 0) { sb.append(','); } sb.append(zk+":"+zkPort); } zkEndpointAddress = sb.toString(); } stateStore = new ZookeeperStateStore(zkEndpointAddress, (Integer)config.get(Config.STORM_ZOOKEEPER_RETRY_TIMES), (Integer)config.get(Config.STORM_ZOOKEEPER_RETRY_INTERVAL)); } stateStore.open(); partitionCoordinator = new StaticPartitionCoordinator( eventHubConfig, taskIndex, totalTasks, stateStore, pmFactory, recvFactory); for (IPartitionManager partitionManager : partitionCoordinator.getMyPartitionManagers()) { partitionManager.open(); } }
[ "public", "void", "preparePartitions", "(", "Map", "config", ",", "int", "totalTasks", ",", "int", "taskIndex", ",", "SpoutOutputCollector", "collector", ")", "throws", "Exception", "{", "this", ".", "collector", "=", "collector", ";", "if", "(", "stateStore", "==", "null", ")", "{", "String", "zkEndpointAddress", "=", "eventHubConfig", ".", "getZkConnectionString", "(", ")", ";", "if", "(", "zkEndpointAddress", "==", "null", "||", "zkEndpointAddress", ".", "length", "(", ")", "==", "0", ")", "{", "//use storm's zookeeper servers if not specified.", "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "List", "<", "String", ">", "zkServers", "=", "(", "List", "<", "String", ">", ")", "config", ".", "get", "(", "Config", ".", "STORM_ZOOKEEPER_SERVERS", ")", ";", "Integer", "zkPort", "=", "(", "(", "Number", ")", "config", ".", "get", "(", "Config", ".", "STORM_ZOOKEEPER_PORT", ")", ")", ".", "intValue", "(", ")", ";", "StringBuilder", "sb", "=", "new", "StringBuilder", "(", ")", ";", "for", "(", "String", "zk", ":", "zkServers", ")", "{", "if", "(", "sb", ".", "length", "(", ")", ">", "0", ")", "{", "sb", ".", "append", "(", "'", "'", ")", ";", "}", "sb", ".", "append", "(", "zk", "+", "\":\"", "+", "zkPort", ")", ";", "}", "zkEndpointAddress", "=", "sb", ".", "toString", "(", ")", ";", "}", "stateStore", "=", "new", "ZookeeperStateStore", "(", "zkEndpointAddress", ",", "(", "Integer", ")", "config", ".", "get", "(", "Config", ".", "STORM_ZOOKEEPER_RETRY_TIMES", ")", ",", "(", "Integer", ")", "config", ".", "get", "(", "Config", ".", "STORM_ZOOKEEPER_RETRY_INTERVAL", ")", ")", ";", "}", "stateStore", ".", "open", "(", ")", ";", "partitionCoordinator", "=", "new", "StaticPartitionCoordinator", "(", "eventHubConfig", ",", "taskIndex", ",", "totalTasks", ",", "stateStore", ",", "pmFactory", ",", "recvFactory", ")", ";", "for", "(", "IPartitionManager", "partitionManager", ":", "partitionCoordinator", ".", "getMyPartitionManagers", "(", ")", ")", "{", "partitionManager", ".", "open", "(", ")", ";", "}", "}" ]
This is a extracted method that is easy to test @param config @param totalTasks @param taskIndex @param collector @throws Exception
[ "This", "is", "a", "extracted", "method", "that", "is", "easy", "to", "test" ]
86c99201e6df5e1caee3f664de8843bd656c0f1c
https://github.com/hdinsight/storm-eventhubs/blob/86c99201e6df5e1caee3f664de8843bd656c0f1c/src/main/java/org/apache/storm/eventhubs/spout/EventHubSpout.java#L105-L136
train
padrig64/ValidationFramework
validationframework-core/src/main/java/com/google/code/validationframework/base/trigger/PropertyChangeTrigger.java
PropertyChangeTrigger.propertyChange
@Override public void propertyChange(PropertyChangeEvent propertyChangeEvent) { if ((triggerProperties == null) || triggerProperties.isEmpty() || triggerProperties.contains (propertyChangeEvent.getPropertyName())) { fireTriggerEvent(new TriggerEvent(propertyChangeEvent.getSource())); } }
java
@Override public void propertyChange(PropertyChangeEvent propertyChangeEvent) { if ((triggerProperties == null) || triggerProperties.isEmpty() || triggerProperties.contains (propertyChangeEvent.getPropertyName())) { fireTriggerEvent(new TriggerEvent(propertyChangeEvent.getSource())); } }
[ "@", "Override", "public", "void", "propertyChange", "(", "PropertyChangeEvent", "propertyChangeEvent", ")", "{", "if", "(", "(", "triggerProperties", "==", "null", ")", "||", "triggerProperties", ".", "isEmpty", "(", ")", "||", "triggerProperties", ".", "contains", "(", "propertyChangeEvent", ".", "getPropertyName", "(", ")", ")", ")", "{", "fireTriggerEvent", "(", "new", "TriggerEvent", "(", "propertyChangeEvent", ".", "getSource", "(", ")", ")", ")", ";", "}", "}" ]
Triggers the validation when the property change event is received. @see PropertyChangeListener#propertyChange(PropertyChangeEvent)
[ "Triggers", "the", "validation", "when", "the", "property", "change", "event", "is", "received", "." ]
2dd3c7b3403993db366d24a927645f467ccd1dda
https://github.com/padrig64/ValidationFramework/blob/2dd3c7b3403993db366d24a927645f467ccd1dda/validationframework-core/src/main/java/com/google/code/validationframework/base/trigger/PropertyChangeTrigger.java#L91-L97
train
opencb/java-common-libs
commons-datastore/commons-datastore-solr/src/main/java/org/opencb/commons/datastore/solr/SolrManager.java
SolrManager.existsCore
public boolean existsCore(String coreName) { try { CoreStatus status = CoreAdminRequest.getCoreStatus(coreName, solrClient); status.getInstanceDirectory(); } catch (Exception e) { return false; } return true; }
java
public boolean existsCore(String coreName) { try { CoreStatus status = CoreAdminRequest.getCoreStatus(coreName, solrClient); status.getInstanceDirectory(); } catch (Exception e) { return false; } return true; }
[ "public", "boolean", "existsCore", "(", "String", "coreName", ")", "{", "try", "{", "CoreStatus", "status", "=", "CoreAdminRequest", ".", "getCoreStatus", "(", "coreName", ",", "solrClient", ")", ";", "status", ".", "getInstanceDirectory", "(", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "return", "false", ";", "}", "return", "true", ";", "}" ]
Check if a given core exists. @param coreName Core name @return True or false
[ "Check", "if", "a", "given", "core", "exists", "." ]
5c97682530d0be55828e1e4e374ff01fceb5f198
https://github.com/opencb/java-common-libs/blob/5c97682530d0be55828e1e4e374ff01fceb5f198/commons-datastore/commons-datastore-solr/src/main/java/org/opencb/commons/datastore/solr/SolrManager.java#L187-L195
train
opencb/java-common-libs
commons-datastore/commons-datastore-solr/src/main/java/org/opencb/commons/datastore/solr/SolrManager.java
SolrManager.existsCollection
public boolean existsCollection(String collectionName) throws SolrException { try { List<String> collections = CollectionAdminRequest.listCollections(solrClient); for (String collection : collections) { if (collection.equals(collectionName)) { return true; } } return false; } catch (Exception e) { throw new SolrException(SolrException.ErrorCode.CONFLICT, e); } }
java
public boolean existsCollection(String collectionName) throws SolrException { try { List<String> collections = CollectionAdminRequest.listCollections(solrClient); for (String collection : collections) { if (collection.equals(collectionName)) { return true; } } return false; } catch (Exception e) { throw new SolrException(SolrException.ErrorCode.CONFLICT, e); } }
[ "public", "boolean", "existsCollection", "(", "String", "collectionName", ")", "throws", "SolrException", "{", "try", "{", "List", "<", "String", ">", "collections", "=", "CollectionAdminRequest", ".", "listCollections", "(", "solrClient", ")", ";", "for", "(", "String", "collection", ":", "collections", ")", "{", "if", "(", "collection", ".", "equals", "(", "collectionName", ")", ")", "{", "return", "true", ";", "}", "}", "return", "false", ";", "}", "catch", "(", "Exception", "e", ")", "{", "throw", "new", "SolrException", "(", "SolrException", ".", "ErrorCode", ".", "CONFLICT", ",", "e", ")", ";", "}", "}" ]
Check if a given collection exists. @param collectionName Collection name @return True or false @throws SolrException SolrException
[ "Check", "if", "a", "given", "collection", "exists", "." ]
5c97682530d0be55828e1e4e374ff01fceb5f198
https://github.com/opencb/java-common-libs/blob/5c97682530d0be55828e1e4e374ff01fceb5f198/commons-datastore/commons-datastore-solr/src/main/java/org/opencb/commons/datastore/solr/SolrManager.java#L204-L216
train
opencb/java-common-libs
commons-datastore/commons-datastore-solr/src/main/java/org/opencb/commons/datastore/solr/SolrManager.java
SolrManager.removeCollection
public void removeCollection(String collectionName) throws SolrException { try { CollectionAdminRequest request = CollectionAdminRequest.deleteCollection(collectionName); request.process(solrClient); } catch (SolrServerException | IOException e) { throw new SolrException(SolrException.ErrorCode.SERVER_ERROR, e.getMessage(), e); } }
java
public void removeCollection(String collectionName) throws SolrException { try { CollectionAdminRequest request = CollectionAdminRequest.deleteCollection(collectionName); request.process(solrClient); } catch (SolrServerException | IOException e) { throw new SolrException(SolrException.ErrorCode.SERVER_ERROR, e.getMessage(), e); } }
[ "public", "void", "removeCollection", "(", "String", "collectionName", ")", "throws", "SolrException", "{", "try", "{", "CollectionAdminRequest", "request", "=", "CollectionAdminRequest", ".", "deleteCollection", "(", "collectionName", ")", ";", "request", ".", "process", "(", "solrClient", ")", ";", "}", "catch", "(", "SolrServerException", "|", "IOException", "e", ")", "{", "throw", "new", "SolrException", "(", "SolrException", ".", "ErrorCode", ".", "SERVER_ERROR", ",", "e", ".", "getMessage", "(", ")", ",", "e", ")", ";", "}", "}" ]
Remove a collection. @param collectionName Collection name @throws SolrException SolrException
[ "Remove", "a", "collection", "." ]
5c97682530d0be55828e1e4e374ff01fceb5f198
https://github.com/opencb/java-common-libs/blob/5c97682530d0be55828e1e4e374ff01fceb5f198/commons-datastore/commons-datastore-solr/src/main/java/org/opencb/commons/datastore/solr/SolrManager.java#L238-L245
train
opencb/java-common-libs
commons-datastore/commons-datastore-solr/src/main/java/org/opencb/commons/datastore/solr/SolrManager.java
SolrManager.removeCore
public void removeCore(String coreName) throws SolrException { try { CoreAdminRequest.unloadCore(coreName, true, true, solrClient); } catch (SolrServerException | IOException e) { throw new SolrException(SolrException.ErrorCode.SERVER_ERROR, e.getMessage(), e); } }
java
public void removeCore(String coreName) throws SolrException { try { CoreAdminRequest.unloadCore(coreName, true, true, solrClient); } catch (SolrServerException | IOException e) { throw new SolrException(SolrException.ErrorCode.SERVER_ERROR, e.getMessage(), e); } }
[ "public", "void", "removeCore", "(", "String", "coreName", ")", "throws", "SolrException", "{", "try", "{", "CoreAdminRequest", ".", "unloadCore", "(", "coreName", ",", "true", ",", "true", ",", "solrClient", ")", ";", "}", "catch", "(", "SolrServerException", "|", "IOException", "e", ")", "{", "throw", "new", "SolrException", "(", "SolrException", ".", "ErrorCode", ".", "SERVER_ERROR", ",", "e", ".", "getMessage", "(", ")", ",", "e", ")", ";", "}", "}" ]
Remove a core. @param coreName Core name @throws SolrException SolrException
[ "Remove", "a", "core", "." ]
5c97682530d0be55828e1e4e374ff01fceb5f198
https://github.com/opencb/java-common-libs/blob/5c97682530d0be55828e1e4e374ff01fceb5f198/commons-datastore/commons-datastore-solr/src/main/java/org/opencb/commons/datastore/solr/SolrManager.java#L253-L259
train
detro/browsermob-proxy-client
src/main/java/com/github/detro/browsermobproxyclient/BMPCLocalLauncher.java
BMPCLocalLauncher.install
public synchronized static void install() { if (!isInstalled()) { InputStream is = BMPCLocalLauncher.class.getResourceAsStream(BMP_LOCAL_ZIP_RES); try { // Unzip BrowserMob Proxy contained in the project "/resources" unzip(is, BMPC_USER_DIR); // Set executable permissions on the BrowserMob Proxy lanching scripts new File(BMP_LOCAL_EXEC_UNIX).setExecutable(true); new File(BMP_LOCAL_EXEC_WIN).setExecutable(true); // Check there is an installed version installedVersion(); } catch (Exception e) { throw new BMPCUnexpectedErrorException("Installation failed", e); } } }
java
public synchronized static void install() { if (!isInstalled()) { InputStream is = BMPCLocalLauncher.class.getResourceAsStream(BMP_LOCAL_ZIP_RES); try { // Unzip BrowserMob Proxy contained in the project "/resources" unzip(is, BMPC_USER_DIR); // Set executable permissions on the BrowserMob Proxy lanching scripts new File(BMP_LOCAL_EXEC_UNIX).setExecutable(true); new File(BMP_LOCAL_EXEC_WIN).setExecutable(true); // Check there is an installed version installedVersion(); } catch (Exception e) { throw new BMPCUnexpectedErrorException("Installation failed", e); } } }
[ "public", "synchronized", "static", "void", "install", "(", ")", "{", "if", "(", "!", "isInstalled", "(", ")", ")", "{", "InputStream", "is", "=", "BMPCLocalLauncher", ".", "class", ".", "getResourceAsStream", "(", "BMP_LOCAL_ZIP_RES", ")", ";", "try", "{", "// Unzip BrowserMob Proxy contained in the project \"/resources\"", "unzip", "(", "is", ",", "BMPC_USER_DIR", ")", ";", "// Set executable permissions on the BrowserMob Proxy lanching scripts", "new", "File", "(", "BMP_LOCAL_EXEC_UNIX", ")", ".", "setExecutable", "(", "true", ")", ";", "new", "File", "(", "BMP_LOCAL_EXEC_WIN", ")", ".", "setExecutable", "(", "true", ")", ";", "// Check there is an installed version", "installedVersion", "(", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "throw", "new", "BMPCUnexpectedErrorException", "(", "\"Installation failed\"", ",", "e", ")", ";", "}", "}", "}" ]
Install Local BrowserMob Proxy.
[ "Install", "Local", "BrowserMob", "Proxy", "." ]
da03deff8211b7e1153e36100c5ba60acd470a4f
https://github.com/detro/browsermob-proxy-client/blob/da03deff8211b7e1153e36100c5ba60acd470a4f/src/main/java/com/github/detro/browsermobproxyclient/BMPCLocalLauncher.java#L118-L135
train
detro/browsermob-proxy-client
src/main/java/com/github/detro/browsermobproxyclient/BMPCLocalLauncher.java
BMPCLocalLauncher.installedVersion
public synchronized static String installedVersion() { BufferedReader versionReader = null; try { versionReader = new BufferedReader(new FileReader(BMP_LOCAL_VERSION_FILE)); // Read version and verify it's there String version = versionReader.readLine(); if (null == version) throw new Exception(); return version; } catch(Exception e) { throw new BMPCLocalNotInstalledException( "Version file not found: " + BMP_LOCAL_VERSION_FILE); } finally { try { if (null != versionReader) versionReader.close(); } catch (IOException e) { // Do nothing here } } }
java
public synchronized static String installedVersion() { BufferedReader versionReader = null; try { versionReader = new BufferedReader(new FileReader(BMP_LOCAL_VERSION_FILE)); // Read version and verify it's there String version = versionReader.readLine(); if (null == version) throw new Exception(); return version; } catch(Exception e) { throw new BMPCLocalNotInstalledException( "Version file not found: " + BMP_LOCAL_VERSION_FILE); } finally { try { if (null != versionReader) versionReader.close(); } catch (IOException e) { // Do nothing here } } }
[ "public", "synchronized", "static", "String", "installedVersion", "(", ")", "{", "BufferedReader", "versionReader", "=", "null", ";", "try", "{", "versionReader", "=", "new", "BufferedReader", "(", "new", "FileReader", "(", "BMP_LOCAL_VERSION_FILE", ")", ")", ";", "// Read version and verify it's there", "String", "version", "=", "versionReader", ".", "readLine", "(", ")", ";", "if", "(", "null", "==", "version", ")", "throw", "new", "Exception", "(", ")", ";", "return", "version", ";", "}", "catch", "(", "Exception", "e", ")", "{", "throw", "new", "BMPCLocalNotInstalledException", "(", "\"Version file not found: \"", "+", "BMP_LOCAL_VERSION_FILE", ")", ";", "}", "finally", "{", "try", "{", "if", "(", "null", "!=", "versionReader", ")", "versionReader", ".", "close", "(", ")", ";", "}", "catch", "(", "IOException", "e", ")", "{", "// Do nothing here", "}", "}", "}" ]
Installed version of Local BrowserMob Proxy @return Version of Local BrowserMob Proxy, if installed. Throws @see BMPCLocalLauncherNotInstallerException if not installed. Please use BMPCLocalLauncher#isInstalled() to check first.
[ "Installed", "version", "of", "Local", "BrowserMob", "Proxy" ]
da03deff8211b7e1153e36100c5ba60acd470a4f
https://github.com/detro/browsermob-proxy-client/blob/da03deff8211b7e1153e36100c5ba60acd470a4f/src/main/java/com/github/detro/browsermobproxyclient/BMPCLocalLauncher.java#L154-L174
train
detro/browsermob-proxy-client
src/main/java/com/github/detro/browsermobproxyclient/BMPCLocalLauncher.java
BMPCLocalLauncher.delete
private synchronized static void delete(File file) { // Check if file is directory if (file.isDirectory()) { // Get all files in the folder File[] files = file.listFiles(); // Delete each file in the folder for (int i = 0; i < files.length; ++i) { delete(files[i]); } // Delete the folder file.delete(); } else { // Delete the file if it is not a folder file.delete(); } }
java
private synchronized static void delete(File file) { // Check if file is directory if (file.isDirectory()) { // Get all files in the folder File[] files = file.listFiles(); // Delete each file in the folder for (int i = 0; i < files.length; ++i) { delete(files[i]); } // Delete the folder file.delete(); } else { // Delete the file if it is not a folder file.delete(); } }
[ "private", "synchronized", "static", "void", "delete", "(", "File", "file", ")", "{", "// Check if file is directory", "if", "(", "file", ".", "isDirectory", "(", ")", ")", "{", "// Get all files in the folder", "File", "[", "]", "files", "=", "file", ".", "listFiles", "(", ")", ";", "// Delete each file in the folder", "for", "(", "int", "i", "=", "0", ";", "i", "<", "files", ".", "length", ";", "++", "i", ")", "{", "delete", "(", "files", "[", "i", "]", ")", ";", "}", "// Delete the folder", "file", ".", "delete", "(", ")", ";", "}", "else", "{", "// Delete the file if it is not a folder", "file", ".", "delete", "(", ")", ";", "}", "}" ]
Delete file, recursively if needed @param file File/Directory to delete
[ "Delete", "file", "recursively", "if", "needed" ]
da03deff8211b7e1153e36100c5ba60acd470a4f
https://github.com/detro/browsermob-proxy-client/blob/da03deff8211b7e1153e36100c5ba60acd470a4f/src/main/java/com/github/detro/browsermobproxyclient/BMPCLocalLauncher.java#L234-L251
train
riccardove/easyjasub
easyjasub-lib/src/main/java/com/github/riccardove/easyjasub/lucene/LuceneParser.java
LuceneParser.parse
public List<LuceneToken> parse(String fieldName, String text) throws IOException { return readTokens(analyzer.tokenStream(fieldName, text)); }
java
public List<LuceneToken> parse(String fieldName, String text) throws IOException { return readTokens(analyzer.tokenStream(fieldName, text)); }
[ "public", "List", "<", "LuceneToken", ">", "parse", "(", "String", "fieldName", ",", "String", "text", ")", "throws", "IOException", "{", "return", "readTokens", "(", "analyzer", ".", "tokenStream", "(", "fieldName", ",", "text", ")", ")", ";", "}" ]
Parses one line of text
[ "Parses", "one", "line", "of", "text" ]
58d6af66b1b1c738326c74d9ad5e4ad514120e27
https://github.com/riccardove/easyjasub/blob/58d6af66b1b1c738326c74d9ad5e4ad514120e27/easyjasub-lib/src/main/java/com/github/riccardove/easyjasub/lucene/LuceneParser.java#L62-L65
train
padrig64/ValidationFramework
validationframework-core/src/main/java/com/google/code/validationframework/base/resulthandler/CompositeResultHandler.java
CompositeResultHandler.handleResult
@Override public void handleResult(RHI result) { for (ResultHandler<RHI> resultHandler : resultHandlers) { resultHandler.handleResult(result); } }
java
@Override public void handleResult(RHI result) { for (ResultHandler<RHI> resultHandler : resultHandlers) { resultHandler.handleResult(result); } }
[ "@", "Override", "public", "void", "handleResult", "(", "RHI", "result", ")", "{", "for", "(", "ResultHandler", "<", "RHI", ">", "resultHandler", ":", "resultHandlers", ")", "{", "resultHandler", ".", "handleResult", "(", "result", ")", ";", "}", "}" ]
Processes the specified result using all delegate result handlers. @param result Validation result to be handled. @see ResultHandler#handleResult(Object)
[ "Processes", "the", "specified", "result", "using", "all", "delegate", "result", "handlers", "." ]
2dd3c7b3403993db366d24a927645f467ccd1dda
https://github.com/padrig64/ValidationFramework/blob/2dd3c7b3403993db366d24a927645f467ccd1dda/validationframework-core/src/main/java/com/google/code/validationframework/base/resulthandler/CompositeResultHandler.java#L96-L101
train
checkstyle-addons/checkstyle-addons
buildSrc/src/main/java/com/thomasjensen/checkstyle/addons/build/tasks/CreateJarEclipseTask.java
CreateJarEclipseTask.getPublishedDependencyLibs
public static Set<File> getPublishedDependencyLibs(@Nonnull final Task pTask, @Nonnull final DependencyConfig pDepConfig) { Set<File> result = new HashSet<>(); Configuration cfg = new ClasspathBuilder(pTask.getProject()).buildMainRuntimeConfiguration(pDepConfig); for (ResolvedDependency dep : cfg.getResolvedConfiguration().getFirstLevelModuleDependencies()) { if (!isCheckstyle(dep)) { for (ResolvedArtifact artifact : dep.getAllModuleArtifacts()) { result.add(artifact.getFile()); } } } return result; }
java
public static Set<File> getPublishedDependencyLibs(@Nonnull final Task pTask, @Nonnull final DependencyConfig pDepConfig) { Set<File> result = new HashSet<>(); Configuration cfg = new ClasspathBuilder(pTask.getProject()).buildMainRuntimeConfiguration(pDepConfig); for (ResolvedDependency dep : cfg.getResolvedConfiguration().getFirstLevelModuleDependencies()) { if (!isCheckstyle(dep)) { for (ResolvedArtifact artifact : dep.getAllModuleArtifacts()) { result.add(artifact.getFile()); } } } return result; }
[ "public", "static", "Set", "<", "File", ">", "getPublishedDependencyLibs", "(", "@", "Nonnull", "final", "Task", "pTask", ",", "@", "Nonnull", "final", "DependencyConfig", "pDepConfig", ")", "{", "Set", "<", "File", ">", "result", "=", "new", "HashSet", "<>", "(", ")", ";", "Configuration", "cfg", "=", "new", "ClasspathBuilder", "(", "pTask", ".", "getProject", "(", ")", ")", ".", "buildMainRuntimeConfiguration", "(", "pDepConfig", ")", ";", "for", "(", "ResolvedDependency", "dep", ":", "cfg", ".", "getResolvedConfiguration", "(", ")", ".", "getFirstLevelModuleDependencies", "(", ")", ")", "{", "if", "(", "!", "isCheckstyle", "(", "dep", ")", ")", "{", "for", "(", "ResolvedArtifact", "artifact", ":", "dep", ".", "getAllModuleArtifacts", "(", ")", ")", "{", "result", ".", "add", "(", "artifact", ".", "getFile", "(", ")", ")", ";", "}", "}", "}", "return", "result", ";", "}" ]
Scan the dependencies of the specified configurations and return a list of File objects for each dependency. Resolves the configurations if they are still unresolved. @param pTask the calling task @param pDepConfig the current dependency configuration @return list of files
[ "Scan", "the", "dependencies", "of", "the", "specified", "configurations", "and", "return", "a", "list", "of", "File", "objects", "for", "each", "dependency", ".", "Resolves", "the", "configurations", "if", "they", "are", "still", "unresolved", "." ]
fae1b4d341639c8e32c3e59ec5abdc0ffc11b865
https://github.com/checkstyle-addons/checkstyle-addons/blob/fae1b4d341639c8e32c3e59ec5abdc0ffc11b865/buildSrc/src/main/java/com/thomasjensen/checkstyle/addons/build/tasks/CreateJarEclipseTask.java#L77-L90
train
padrig64/ValidationFramework
validationframework-core/src/main/java/com/google/code/validationframework/base/validator/DefaultMappableValidator.java
DefaultMappableValidator.processTrigger
@Override protected void processTrigger(final Trigger trigger) { // Get data providers matching the trigger final List<DataProvider<RI>> mappedDataProviders = triggersToDataProviders.get(trigger); if ((mappedDataProviders == null) || mappedDataProviders.isEmpty()) { LOGGER.warn("No matching data provider in mappable validator for trigger: " + trigger); } else { // Process all matching data providers for (final DataProvider<RI> dataProvider : mappedDataProviders) { processDataProvider(dataProvider); } } }
java
@Override protected void processTrigger(final Trigger trigger) { // Get data providers matching the trigger final List<DataProvider<RI>> mappedDataProviders = triggersToDataProviders.get(trigger); if ((mappedDataProviders == null) || mappedDataProviders.isEmpty()) { LOGGER.warn("No matching data provider in mappable validator for trigger: " + trigger); } else { // Process all matching data providers for (final DataProvider<RI> dataProvider : mappedDataProviders) { processDataProvider(dataProvider); } } }
[ "@", "Override", "protected", "void", "processTrigger", "(", "final", "Trigger", "trigger", ")", "{", "// Get data providers matching the trigger", "final", "List", "<", "DataProvider", "<", "RI", ">", ">", "mappedDataProviders", "=", "triggersToDataProviders", ".", "get", "(", "trigger", ")", ";", "if", "(", "(", "mappedDataProviders", "==", "null", ")", "||", "mappedDataProviders", ".", "isEmpty", "(", ")", ")", "{", "LOGGER", ".", "warn", "(", "\"No matching data provider in mappable validator for trigger: \"", "+", "trigger", ")", ";", "}", "else", "{", "// Process all matching data providers", "for", "(", "final", "DataProvider", "<", "RI", ">", "dataProvider", ":", "mappedDataProviders", ")", "{", "processDataProvider", "(", "dataProvider", ")", ";", "}", "}", "}" ]
Processes the specified trigger by finding all the mapped data providers, and so on. @see AbstractMappableValidator#processTrigger(Trigger)
[ "Processes", "the", "specified", "trigger", "by", "finding", "all", "the", "mapped", "data", "providers", "and", "so", "on", "." ]
2dd3c7b3403993db366d24a927645f467ccd1dda
https://github.com/padrig64/ValidationFramework/blob/2dd3c7b3403993db366d24a927645f467ccd1dda/validationframework-core/src/main/java/com/google/code/validationframework/base/validator/DefaultMappableValidator.java#L67-L79
train
padrig64/ValidationFramework
validationframework-core/src/main/java/com/google/code/validationframework/base/validator/DefaultMappableValidator.java
DefaultMappableValidator.processDataProvider
private void processDataProvider(final DataProvider<RI> dataProvider) { // Get rules matching the data provider final List<Rule<RI, RO>> mappedRules = dataProvidersToRules.get(dataProvider); if ((mappedRules == null) || mappedRules.isEmpty()) { LOGGER.warn("No matching rule in mappable validator for data provider: " + dataProvider); } else { // Get data to be validated final RI data = dataProvider.getData(); // Process all matching rules for (final Rule<RI, RO> rule : mappedRules) { processRule(rule, data); } } }
java
private void processDataProvider(final DataProvider<RI> dataProvider) { // Get rules matching the data provider final List<Rule<RI, RO>> mappedRules = dataProvidersToRules.get(dataProvider); if ((mappedRules == null) || mappedRules.isEmpty()) { LOGGER.warn("No matching rule in mappable validator for data provider: " + dataProvider); } else { // Get data to be validated final RI data = dataProvider.getData(); // Process all matching rules for (final Rule<RI, RO> rule : mappedRules) { processRule(rule, data); } } }
[ "private", "void", "processDataProvider", "(", "final", "DataProvider", "<", "RI", ">", "dataProvider", ")", "{", "// Get rules matching the data provider", "final", "List", "<", "Rule", "<", "RI", ",", "RO", ">", ">", "mappedRules", "=", "dataProvidersToRules", ".", "get", "(", "dataProvider", ")", ";", "if", "(", "(", "mappedRules", "==", "null", ")", "||", "mappedRules", ".", "isEmpty", "(", ")", ")", "{", "LOGGER", ".", "warn", "(", "\"No matching rule in mappable validator for data provider: \"", "+", "dataProvider", ")", ";", "}", "else", "{", "// Get data to be validated", "final", "RI", "data", "=", "dataProvider", ".", "getData", "(", ")", ";", "// Process all matching rules", "for", "(", "final", "Rule", "<", "RI", ",", "RO", ">", "rule", ":", "mappedRules", ")", "{", "processRule", "(", "rule", ",", "data", ")", ";", "}", "}", "}" ]
Process the specified data provider by finding all the mapped rules, and so on. @param dataProvider Data provider to be processed.
[ "Process", "the", "specified", "data", "provider", "by", "finding", "all", "the", "mapped", "rules", "and", "so", "on", "." ]
2dd3c7b3403993db366d24a927645f467ccd1dda
https://github.com/padrig64/ValidationFramework/blob/2dd3c7b3403993db366d24a927645f467ccd1dda/validationframework-core/src/main/java/com/google/code/validationframework/base/validator/DefaultMappableValidator.java#L86-L100
train
padrig64/ValidationFramework
validationframework-core/src/main/java/com/google/code/validationframework/base/validator/DefaultMappableValidator.java
DefaultMappableValidator.processRule
private void processRule(final Rule<RI, RO> rule, final RI data) { // Get result handlers matching the rule final List<ResultHandler<RO>> mappedResultHandlers = rulesToResultHandlers.get(rule); if ((mappedResultHandlers == null) || mappedResultHandlers.isEmpty()) { LOGGER.warn("No matching result handler in mappable validator for rule: " + rule); } else { // Check rule final RO result = rule.validate(data); // Process result with all matching result handlers for (final ResultHandler<RO> resultHandler : mappedResultHandlers) { processResultHandler(resultHandler, result); } } }
java
private void processRule(final Rule<RI, RO> rule, final RI data) { // Get result handlers matching the rule final List<ResultHandler<RO>> mappedResultHandlers = rulesToResultHandlers.get(rule); if ((mappedResultHandlers == null) || mappedResultHandlers.isEmpty()) { LOGGER.warn("No matching result handler in mappable validator for rule: " + rule); } else { // Check rule final RO result = rule.validate(data); // Process result with all matching result handlers for (final ResultHandler<RO> resultHandler : mappedResultHandlers) { processResultHandler(resultHandler, result); } } }
[ "private", "void", "processRule", "(", "final", "Rule", "<", "RI", ",", "RO", ">", "rule", ",", "final", "RI", "data", ")", "{", "// Get result handlers matching the rule", "final", "List", "<", "ResultHandler", "<", "RO", ">", ">", "mappedResultHandlers", "=", "rulesToResultHandlers", ".", "get", "(", "rule", ")", ";", "if", "(", "(", "mappedResultHandlers", "==", "null", ")", "||", "mappedResultHandlers", ".", "isEmpty", "(", ")", ")", "{", "LOGGER", ".", "warn", "(", "\"No matching result handler in mappable validator for rule: \"", "+", "rule", ")", ";", "}", "else", "{", "// Check rule", "final", "RO", "result", "=", "rule", ".", "validate", "(", "data", ")", ";", "// Process result with all matching result handlers", "for", "(", "final", "ResultHandler", "<", "RO", ">", "resultHandler", ":", "mappedResultHandlers", ")", "{", "processResultHandler", "(", "resultHandler", ",", "result", ")", ";", "}", "}", "}" ]
Processes the specified rule by finding all the mapped results handlers, checking the rule and processing the rule result using all found result handlers. @param rule Rule to be processed. @param data Data to be checked against the rule.
[ "Processes", "the", "specified", "rule", "by", "finding", "all", "the", "mapped", "results", "handlers", "checking", "the", "rule", "and", "processing", "the", "rule", "result", "using", "all", "found", "result", "handlers", "." ]
2dd3c7b3403993db366d24a927645f467ccd1dda
https://github.com/padrig64/ValidationFramework/blob/2dd3c7b3403993db366d24a927645f467ccd1dda/validationframework-core/src/main/java/com/google/code/validationframework/base/validator/DefaultMappableValidator.java#L110-L124
train
padrig64/ValidationFramework
validationframework-experimental/src/main/java/com/google/code/validationframework/experimental/builder/context/resultcollectorvalidator/ValidatorContext.java
ValidatorContext.handleWith
public ValidatorContext<D, O> handleWith(final ResultHandler<O>... resultHandlers) { if (resultHandlers != null) { Collections.addAll(registeredResultHandlers, resultHandlers); } return this; }
java
public ValidatorContext<D, O> handleWith(final ResultHandler<O>... resultHandlers) { if (resultHandlers != null) { Collections.addAll(registeredResultHandlers, resultHandlers); } return this; }
[ "public", "ValidatorContext", "<", "D", ",", "O", ">", "handleWith", "(", "final", "ResultHandler", "<", "O", ">", "...", "resultHandlers", ")", "{", "if", "(", "resultHandlers", "!=", "null", ")", "{", "Collections", ".", "addAll", "(", "registeredResultHandlers", ",", "resultHandlers", ")", ";", "}", "return", "this", ";", "}" ]
Adds more result handlers to the validator. @param resultHandlers Result handlers to be added. @return Same validator context.
[ "Adds", "more", "result", "handlers", "to", "the", "validator", "." ]
2dd3c7b3403993db366d24a927645f467ccd1dda
https://github.com/padrig64/ValidationFramework/blob/2dd3c7b3403993db366d24a927645f467ccd1dda/validationframework-experimental/src/main/java/com/google/code/validationframework/experimental/builder/context/resultcollectorvalidator/ValidatorContext.java#L72-L77
train
google/cloud-reporting
src/main/java/com/google/cloud/metrics/MetricsUtils.java
MetricsUtils.buildCombinedType
static String buildCombinedType(String eventType, Optional<String> objectType) { return Joiner.on("/").skipNulls().join(eventType, objectType.orNull()); }
java
static String buildCombinedType(String eventType, Optional<String> objectType) { return Joiner.on("/").skipNulls().join(eventType, objectType.orNull()); }
[ "static", "String", "buildCombinedType", "(", "String", "eventType", ",", "Optional", "<", "String", ">", "objectType", ")", "{", "return", "Joiner", ".", "on", "(", "\"/\"", ")", ".", "skipNulls", "(", ")", ".", "join", "(", "eventType", ",", "objectType", ".", "orNull", "(", ")", ")", ";", "}" ]
Combines event and object type into a single type string. @param eventType type or category of the reporting event. @param objectType optional type of the object this event applies to. @return Combined type string.
[ "Combines", "event", "and", "object", "type", "into", "a", "single", "type", "string", "." ]
af2a8ff6077a9763f7f2d405dd55c82efaead0ac
https://github.com/google/cloud-reporting/blob/af2a8ff6077a9763f7f2d405dd55c82efaead0ac/src/main/java/com/google/cloud/metrics/MetricsUtils.java#L128-L130
train
google/cloud-reporting
src/main/java/com/google/cloud/metrics/MetricsUtils.java
MetricsUtils.buildVirtualPageTitle
static String buildVirtualPageTitle(Map<String, String> metadata) { checkNotNull(metadata); List<String> escapedMetadata = new ArrayList<>(); for (Map.Entry<String, String> entry : metadata.entrySet()) { escapedMetadata.add(METADATA_ESCAPER.escape(entry.getKey()) + "=" + METADATA_ESCAPER.escape(entry.getValue())); } return Joiner.on(",").join(escapedMetadata); }
java
static String buildVirtualPageTitle(Map<String, String> metadata) { checkNotNull(metadata); List<String> escapedMetadata = new ArrayList<>(); for (Map.Entry<String, String> entry : metadata.entrySet()) { escapedMetadata.add(METADATA_ESCAPER.escape(entry.getKey()) + "=" + METADATA_ESCAPER.escape(entry.getValue())); } return Joiner.on(",").join(escapedMetadata); }
[ "static", "String", "buildVirtualPageTitle", "(", "Map", "<", "String", ",", "String", ">", "metadata", ")", "{", "checkNotNull", "(", "metadata", ")", ";", "List", "<", "String", ">", "escapedMetadata", "=", "new", "ArrayList", "<>", "(", ")", ";", "for", "(", "Map", ".", "Entry", "<", "String", ",", "String", ">", "entry", ":", "metadata", ".", "entrySet", "(", ")", ")", "{", "escapedMetadata", ".", "add", "(", "METADATA_ESCAPER", ".", "escape", "(", "entry", ".", "getKey", "(", ")", ")", "+", "\"=\"", "+", "METADATA_ESCAPER", ".", "escape", "(", "entry", ".", "getValue", "(", ")", ")", ")", ";", "}", "return", "Joiner", ".", "on", "(", "\",\"", ")", ".", "join", "(", "escapedMetadata", ")", ";", "}" ]
Creates a virtual page title from a set of metadata key-value pairs. @param metadata Metadata map. @return Virtual page title constructed from the metadata, escaped as required by the format.
[ "Creates", "a", "virtual", "page", "title", "from", "a", "set", "of", "metadata", "key", "-", "value", "pairs", "." ]
af2a8ff6077a9763f7f2d405dd55c82efaead0ac
https://github.com/google/cloud-reporting/blob/af2a8ff6077a9763f7f2d405dd55c82efaead0ac/src/main/java/com/google/cloud/metrics/MetricsUtils.java#L152-L160
train
google/cloud-reporting
src/main/java/com/google/cloud/metrics/MetricsUtils.java
MetricsUtils.buildParameters
static ImmutableList<NameValuePair> buildParameters( String analyticsId, String clientId, String virtualPageName, String virtualPageTitle, String eventType, String eventName, boolean isUserSignedIn, boolean isUserInternal, Optional<Boolean> isUserTrialEligible, Optional<String> projectNumberHash, Optional<String> billingIdHash, Optional<String> clientHostname, Random random) { checkNotNull(analyticsId); checkNotNull(clientId); checkNotNull(virtualPageTitle); checkNotNull(virtualPageName); checkNotNull(eventType); checkNotNull(eventName); checkNotNull(projectNumberHash); checkNotNull(billingIdHash); checkNotNull(clientHostname); checkNotNull(random); ImmutableList.Builder<NameValuePair> listBuilder = new ImmutableList.Builder<>(); // Analytics information // Protocol version listBuilder.add(new BasicNameValuePair(PARAM_PROTOCOL, "1")); // Analytics ID to send report to listBuilder.add(new BasicNameValuePair(PARAM_PROPERTY_ID, analyticsId)); // Always report as a pageview listBuilder.add(new BasicNameValuePair(PARAM_TYPE, VALUE_TYPE_PAGEVIEW)); // Always report as interactive listBuilder.add(new BasicNameValuePair(PARAM_IS_NON_INTERACTIVE, VALUE_FALSE)); // Add a randomly generated cache buster listBuilder.add(new BasicNameValuePair(PARAM_CACHEBUSTER, Long.toString(random.nextLong()))); // Event information listBuilder.add(new BasicNameValuePair(PARAM_EVENT_TYPE, eventType)); listBuilder.add(new BasicNameValuePair(PARAM_EVENT_NAME, eventName)); if (clientHostname.isPresent() && !clientHostname.get().isEmpty()) { listBuilder.add(new BasicNameValuePair(PARAM_HOSTNAME, clientHostname.get())); } // User information listBuilder.add(new BasicNameValuePair(PARAM_CLIENT_ID, clientId)); if (projectNumberHash.isPresent() && !projectNumberHash.get().isEmpty()) { listBuilder.add(new BasicNameValuePair(PARAM_PROJECT_NUM_HASH, projectNumberHash.get())); } if (billingIdHash.isPresent() && !billingIdHash.get().isEmpty()) { listBuilder.add(new BasicNameValuePair(PARAM_BILLING_ID_HASH, billingIdHash.get())); } listBuilder.add(new BasicNameValuePair(PARAM_USER_SIGNED_IN, toValue(isUserSignedIn))); listBuilder.add(new BasicNameValuePair(PARAM_USER_INTERNAL, toValue(isUserInternal))); if (isUserTrialEligible.isPresent()) { listBuilder.add(new BasicNameValuePair(PARAM_USER_TRIAL_ELIGIBLE, toValue(isUserTrialEligible.get()))); } // Virtual page information listBuilder.add(new BasicNameValuePair(PARAM_IS_VIRTUAL, VALUE_TRUE)); listBuilder.add(new BasicNameValuePair(PARAM_PAGE, virtualPageName)); if (!virtualPageTitle.isEmpty()) { listBuilder.add(new BasicNameValuePair(PARAM_PAGE_TITLE, virtualPageTitle)); } return listBuilder.build(); }
java
static ImmutableList<NameValuePair> buildParameters( String analyticsId, String clientId, String virtualPageName, String virtualPageTitle, String eventType, String eventName, boolean isUserSignedIn, boolean isUserInternal, Optional<Boolean> isUserTrialEligible, Optional<String> projectNumberHash, Optional<String> billingIdHash, Optional<String> clientHostname, Random random) { checkNotNull(analyticsId); checkNotNull(clientId); checkNotNull(virtualPageTitle); checkNotNull(virtualPageName); checkNotNull(eventType); checkNotNull(eventName); checkNotNull(projectNumberHash); checkNotNull(billingIdHash); checkNotNull(clientHostname); checkNotNull(random); ImmutableList.Builder<NameValuePair> listBuilder = new ImmutableList.Builder<>(); // Analytics information // Protocol version listBuilder.add(new BasicNameValuePair(PARAM_PROTOCOL, "1")); // Analytics ID to send report to listBuilder.add(new BasicNameValuePair(PARAM_PROPERTY_ID, analyticsId)); // Always report as a pageview listBuilder.add(new BasicNameValuePair(PARAM_TYPE, VALUE_TYPE_PAGEVIEW)); // Always report as interactive listBuilder.add(new BasicNameValuePair(PARAM_IS_NON_INTERACTIVE, VALUE_FALSE)); // Add a randomly generated cache buster listBuilder.add(new BasicNameValuePair(PARAM_CACHEBUSTER, Long.toString(random.nextLong()))); // Event information listBuilder.add(new BasicNameValuePair(PARAM_EVENT_TYPE, eventType)); listBuilder.add(new BasicNameValuePair(PARAM_EVENT_NAME, eventName)); if (clientHostname.isPresent() && !clientHostname.get().isEmpty()) { listBuilder.add(new BasicNameValuePair(PARAM_HOSTNAME, clientHostname.get())); } // User information listBuilder.add(new BasicNameValuePair(PARAM_CLIENT_ID, clientId)); if (projectNumberHash.isPresent() && !projectNumberHash.get().isEmpty()) { listBuilder.add(new BasicNameValuePair(PARAM_PROJECT_NUM_HASH, projectNumberHash.get())); } if (billingIdHash.isPresent() && !billingIdHash.get().isEmpty()) { listBuilder.add(new BasicNameValuePair(PARAM_BILLING_ID_HASH, billingIdHash.get())); } listBuilder.add(new BasicNameValuePair(PARAM_USER_SIGNED_IN, toValue(isUserSignedIn))); listBuilder.add(new BasicNameValuePair(PARAM_USER_INTERNAL, toValue(isUserInternal))); if (isUserTrialEligible.isPresent()) { listBuilder.add(new BasicNameValuePair(PARAM_USER_TRIAL_ELIGIBLE, toValue(isUserTrialEligible.get()))); } // Virtual page information listBuilder.add(new BasicNameValuePair(PARAM_IS_VIRTUAL, VALUE_TRUE)); listBuilder.add(new BasicNameValuePair(PARAM_PAGE, virtualPageName)); if (!virtualPageTitle.isEmpty()) { listBuilder.add(new BasicNameValuePair(PARAM_PAGE_TITLE, virtualPageTitle)); } return listBuilder.build(); }
[ "static", "ImmutableList", "<", "NameValuePair", ">", "buildParameters", "(", "String", "analyticsId", ",", "String", "clientId", ",", "String", "virtualPageName", ",", "String", "virtualPageTitle", ",", "String", "eventType", ",", "String", "eventName", ",", "boolean", "isUserSignedIn", ",", "boolean", "isUserInternal", ",", "Optional", "<", "Boolean", ">", "isUserTrialEligible", ",", "Optional", "<", "String", ">", "projectNumberHash", ",", "Optional", "<", "String", ">", "billingIdHash", ",", "Optional", "<", "String", ">", "clientHostname", ",", "Random", "random", ")", "{", "checkNotNull", "(", "analyticsId", ")", ";", "checkNotNull", "(", "clientId", ")", ";", "checkNotNull", "(", "virtualPageTitle", ")", ";", "checkNotNull", "(", "virtualPageName", ")", ";", "checkNotNull", "(", "eventType", ")", ";", "checkNotNull", "(", "eventName", ")", ";", "checkNotNull", "(", "projectNumberHash", ")", ";", "checkNotNull", "(", "billingIdHash", ")", ";", "checkNotNull", "(", "clientHostname", ")", ";", "checkNotNull", "(", "random", ")", ";", "ImmutableList", ".", "Builder", "<", "NameValuePair", ">", "listBuilder", "=", "new", "ImmutableList", ".", "Builder", "<>", "(", ")", ";", "// Analytics information", "// Protocol version", "listBuilder", ".", "add", "(", "new", "BasicNameValuePair", "(", "PARAM_PROTOCOL", ",", "\"1\"", ")", ")", ";", "// Analytics ID to send report to", "listBuilder", ".", "add", "(", "new", "BasicNameValuePair", "(", "PARAM_PROPERTY_ID", ",", "analyticsId", ")", ")", ";", "// Always report as a pageview", "listBuilder", ".", "add", "(", "new", "BasicNameValuePair", "(", "PARAM_TYPE", ",", "VALUE_TYPE_PAGEVIEW", ")", ")", ";", "// Always report as interactive", "listBuilder", ".", "add", "(", "new", "BasicNameValuePair", "(", "PARAM_IS_NON_INTERACTIVE", ",", "VALUE_FALSE", ")", ")", ";", "// Add a randomly generated cache buster", "listBuilder", ".", "add", "(", "new", "BasicNameValuePair", "(", "PARAM_CACHEBUSTER", ",", "Long", ".", "toString", "(", "random", ".", "nextLong", "(", ")", ")", ")", ")", ";", "// Event information", "listBuilder", ".", "add", "(", "new", "BasicNameValuePair", "(", "PARAM_EVENT_TYPE", ",", "eventType", ")", ")", ";", "listBuilder", ".", "add", "(", "new", "BasicNameValuePair", "(", "PARAM_EVENT_NAME", ",", "eventName", ")", ")", ";", "if", "(", "clientHostname", ".", "isPresent", "(", ")", "&&", "!", "clientHostname", ".", "get", "(", ")", ".", "isEmpty", "(", ")", ")", "{", "listBuilder", ".", "add", "(", "new", "BasicNameValuePair", "(", "PARAM_HOSTNAME", ",", "clientHostname", ".", "get", "(", ")", ")", ")", ";", "}", "// User information", "listBuilder", ".", "add", "(", "new", "BasicNameValuePair", "(", "PARAM_CLIENT_ID", ",", "clientId", ")", ")", ";", "if", "(", "projectNumberHash", ".", "isPresent", "(", ")", "&&", "!", "projectNumberHash", ".", "get", "(", ")", ".", "isEmpty", "(", ")", ")", "{", "listBuilder", ".", "add", "(", "new", "BasicNameValuePair", "(", "PARAM_PROJECT_NUM_HASH", ",", "projectNumberHash", ".", "get", "(", ")", ")", ")", ";", "}", "if", "(", "billingIdHash", ".", "isPresent", "(", ")", "&&", "!", "billingIdHash", ".", "get", "(", ")", ".", "isEmpty", "(", ")", ")", "{", "listBuilder", ".", "add", "(", "new", "BasicNameValuePair", "(", "PARAM_BILLING_ID_HASH", ",", "billingIdHash", ".", "get", "(", ")", ")", ")", ";", "}", "listBuilder", ".", "add", "(", "new", "BasicNameValuePair", "(", "PARAM_USER_SIGNED_IN", ",", "toValue", "(", "isUserSignedIn", ")", ")", ")", ";", "listBuilder", ".", "add", "(", "new", "BasicNameValuePair", "(", "PARAM_USER_INTERNAL", ",", "toValue", "(", "isUserInternal", ")", ")", ")", ";", "if", "(", "isUserTrialEligible", ".", "isPresent", "(", ")", ")", "{", "listBuilder", ".", "add", "(", "new", "BasicNameValuePair", "(", "PARAM_USER_TRIAL_ELIGIBLE", ",", "toValue", "(", "isUserTrialEligible", ".", "get", "(", ")", ")", ")", ")", ";", "}", "// Virtual page information", "listBuilder", ".", "add", "(", "new", "BasicNameValuePair", "(", "PARAM_IS_VIRTUAL", ",", "VALUE_TRUE", ")", ")", ";", "listBuilder", ".", "add", "(", "new", "BasicNameValuePair", "(", "PARAM_PAGE", ",", "virtualPageName", ")", ")", ";", "if", "(", "!", "virtualPageTitle", ".", "isEmpty", "(", ")", ")", "{", "listBuilder", ".", "add", "(", "new", "BasicNameValuePair", "(", "PARAM_PAGE_TITLE", ",", "virtualPageTitle", ")", ")", ";", "}", "return", "listBuilder", ".", "build", "(", ")", ";", "}" ]
Creates the parameters required to record the Google Analytics event. @see https://developers.google.com/analytics/devguides/collection/protocol/v1/parameters @param analyticsId Google Analytics ID to receive the report data. @param clientId Client ID - must not include PII. @param virtualPageName Full relative URL of the virtual page for the event. @param virtualPageTitle Title of the virtual page for the event. @param eventType Full event type string. @param eventName Event name. @param isUserSignedIn Whether the event involves a signed-in user. @param isUserInternal Whether the event involves an internal user. @param isUserTrialEligible Whether the event involves a user eligible for free trial. Use {@link Optional#absent()} if not known. @param projectNumberHash Hashed numeric project ID. @param billingIdHash Hashed billing ID, if applicable. @param clientHostname Hostname of the client where the event occurred, if any. @param random Random number generator to use for cache busting. @return immutable list of parameters as name-value pairs.
[ "Creates", "the", "parameters", "required", "to", "record", "the", "Google", "Analytics", "event", "." ]
af2a8ff6077a9763f7f2d405dd55c82efaead0ac
https://github.com/google/cloud-reporting/blob/af2a8ff6077a9763f7f2d405dd55c82efaead0ac/src/main/java/com/google/cloud/metrics/MetricsUtils.java#L183-L252
train
padrig64/ValidationFramework
validationframework-experimental/src/main/java/com/google/code/validationframework/experimental/builder/context/simplevalidator/RuleContext.java
RuleContext.read
public RuleContext<D> read(final DataProvider<D>... dataProviders) { if (dataProviders != null) { Collections.addAll(registeredDataProviders, dataProviders); } return this; }
java
public RuleContext<D> read(final DataProvider<D>... dataProviders) { if (dataProviders != null) { Collections.addAll(registeredDataProviders, dataProviders); } return this; }
[ "public", "RuleContext", "<", "D", ">", "read", "(", "final", "DataProvider", "<", "D", ">", "...", "dataProviders", ")", "{", "if", "(", "dataProviders", "!=", "null", ")", "{", "Collections", ".", "addAll", "(", "registeredDataProviders", ",", "dataProviders", ")", ";", "}", "return", "this", ";", "}" ]
Adds more data providers to the validator. @param dataProviders Data providers to be added. @return Same rule context.
[ "Adds", "more", "data", "providers", "to", "the", "validator", "." ]
2dd3c7b3403993db366d24a927645f467ccd1dda
https://github.com/padrig64/ValidationFramework/blob/2dd3c7b3403993db366d24a927645f467ccd1dda/validationframework-experimental/src/main/java/com/google/code/validationframework/experimental/builder/context/simplevalidator/RuleContext.java#L85-L90
train
padrig64/ValidationFramework
validationframework-core/src/main/java/com/google/code/validationframework/base/property/CompositeReadableProperty.java
CompositeReadableProperty.updateFromProperties
private void updateFromProperties() { // Get value from all properties: use a new collection so that equals() returns false List<R> newValues = new ArrayList<R>(); for (ReadableProperty<R> master : properties) { newValues.add(master.getValue()); } // Notify slaves setValue(newValues); }
java
private void updateFromProperties() { // Get value from all properties: use a new collection so that equals() returns false List<R> newValues = new ArrayList<R>(); for (ReadableProperty<R> master : properties) { newValues.add(master.getValue()); } // Notify slaves setValue(newValues); }
[ "private", "void", "updateFromProperties", "(", ")", "{", "// Get value from all properties: use a new collection so that equals() returns false", "List", "<", "R", ">", "newValues", "=", "new", "ArrayList", "<", "R", ">", "(", ")", ";", "for", "(", "ReadableProperty", "<", "R", ">", "master", ":", "properties", ")", "{", "newValues", ".", "add", "(", "master", ".", "getValue", "(", ")", ")", ";", "}", "// Notify slaves", "setValue", "(", "newValues", ")", ";", "}" ]
Updates the current collection of values from the sub-properties and notifies the listeners.
[ "Updates", "the", "current", "collection", "of", "values", "from", "the", "sub", "-", "properties", "and", "notifies", "the", "listeners", "." ]
2dd3c7b3403993db366d24a927645f467ccd1dda
https://github.com/padrig64/ValidationFramework/blob/2dd3c7b3403993db366d24a927645f467ccd1dda/validationframework-core/src/main/java/com/google/code/validationframework/base/property/CompositeReadableProperty.java#L169-L178
train
padrig64/ValidationFramework
validationframework-core/src/main/java/com/google/code/validationframework/base/validator/AbstractSimpleValidator.java
AbstractSimpleValidator.dispose
private void dispose(Collection<?> elements) { // Dispose all disposable elements for (Object element : elements) { if (element instanceof Disposable) { ((Disposable) element).dispose(); } } // Clear collection dataProviders.clear(); }
java
private void dispose(Collection<?> elements) { // Dispose all disposable elements for (Object element : elements) { if (element instanceof Disposable) { ((Disposable) element).dispose(); } } // Clear collection dataProviders.clear(); }
[ "private", "void", "dispose", "(", "Collection", "<", "?", ">", "elements", ")", "{", "// Dispose all disposable elements", "for", "(", "Object", "element", ":", "elements", ")", "{", "if", "(", "element", "instanceof", "Disposable", ")", "{", "(", "(", "Disposable", ")", "element", ")", ".", "dispose", "(", ")", ";", "}", "}", "// Clear collection", "dataProviders", ".", "clear", "(", ")", ";", "}" ]
Clears all elements from the specified collection. @param elements Collection of elements to be disposed (for instance, data providers, rules, result handlers).
[ "Clears", "all", "elements", "from", "the", "specified", "collection", "." ]
2dd3c7b3403993db366d24a927645f467ccd1dda
https://github.com/padrig64/ValidationFramework/blob/2dd3c7b3403993db366d24a927645f467ccd1dda/validationframework-core/src/main/java/com/google/code/validationframework/base/validator/AbstractSimpleValidator.java#L268-L278
train
padrig64/ValidationFramework
validationframework-core/src/main/java/com/google/code/validationframework/base/binding/SimpleBond.java
SimpleBond.init
private void init(ReadableProperty<MO> master, Transformer<MO, SI> transformer, WritableProperty<SI> slave) { this.master = master; this.transformer = transformer; this.slave = slave; master.addValueChangeListener(masterAdapter); // Slave initial values updateSlaves(master.getValue()); }
java
private void init(ReadableProperty<MO> master, Transformer<MO, SI> transformer, WritableProperty<SI> slave) { this.master = master; this.transformer = transformer; this.slave = slave; master.addValueChangeListener(masterAdapter); // Slave initial values updateSlaves(master.getValue()); }
[ "private", "void", "init", "(", "ReadableProperty", "<", "MO", ">", "master", ",", "Transformer", "<", "MO", ",", "SI", ">", "transformer", ",", "WritableProperty", "<", "SI", ">", "slave", ")", "{", "this", ".", "master", "=", "master", ";", "this", ".", "transformer", "=", "transformer", ";", "this", ".", "slave", "=", "slave", ";", "master", ".", "addValueChangeListener", "(", "masterAdapter", ")", ";", "// Slave initial values", "updateSlaves", "(", "master", ".", "getValue", "(", ")", ")", ";", "}" ]
Initializes the bond. @param master Master (possibly composite) property. @param transformer Value transformer. @param slave Slave (possibly composite) property.
[ "Initializes", "the", "bond", "." ]
2dd3c7b3403993db366d24a927645f467ccd1dda
https://github.com/padrig64/ValidationFramework/blob/2dd3c7b3403993db366d24a927645f467ccd1dda/validationframework-core/src/main/java/com/google/code/validationframework/base/binding/SimpleBond.java#L133-L142
train
padrig64/ValidationFramework
validationframework-core/src/main/java/com/google/code/validationframework/base/binding/SimpleBond.java
SimpleBond.updateSlaves
private void updateSlaves(MO masterOutputValue) { // Transform value SI slaveInputValue = transformer.transform(masterOutputValue); // Notify slave(s) slave.setValue(slaveInputValue); }
java
private void updateSlaves(MO masterOutputValue) { // Transform value SI slaveInputValue = transformer.transform(masterOutputValue); // Notify slave(s) slave.setValue(slaveInputValue); }
[ "private", "void", "updateSlaves", "(", "MO", "masterOutputValue", ")", "{", "// Transform value", "SI", "slaveInputValue", "=", "transformer", ".", "transform", "(", "masterOutputValue", ")", ";", "// Notify slave(s)", "slave", ".", "setValue", "(", "slaveInputValue", ")", ";", "}" ]
Sets the value of the slaves according the value of the master. @param masterOutputValue Master value.
[ "Sets", "the", "value", "of", "the", "slaves", "according", "the", "value", "of", "the", "master", "." ]
2dd3c7b3403993db366d24a927645f467ccd1dda
https://github.com/padrig64/ValidationFramework/blob/2dd3c7b3403993db366d24a927645f467ccd1dda/validationframework-core/src/main/java/com/google/code/validationframework/base/binding/SimpleBond.java#L149-L155
train
hdinsight/storm-eventhubs
src/main/java/org/apache/storm/eventhubs/trident/TransactionalTridentEventHubEmitter.java
TransactionalTridentEventHubEmitter.getOrCreatePartitionManager
private ITridentPartitionManager getOrCreatePartitionManager(Partition partition) { ITridentPartitionManager pm; if(!pmMap.containsKey(partition.getId())) { IEventHubReceiver receiver = recvFactory.create(spoutConfig, partition.getId()); pm = pmFactory.create(receiver); pmMap.put(partition.getId(), pm); } else { pm = pmMap.get(partition.getId()); } return pm; }
java
private ITridentPartitionManager getOrCreatePartitionManager(Partition partition) { ITridentPartitionManager pm; if(!pmMap.containsKey(partition.getId())) { IEventHubReceiver receiver = recvFactory.create(spoutConfig, partition.getId()); pm = pmFactory.create(receiver); pmMap.put(partition.getId(), pm); } else { pm = pmMap.get(partition.getId()); } return pm; }
[ "private", "ITridentPartitionManager", "getOrCreatePartitionManager", "(", "Partition", "partition", ")", "{", "ITridentPartitionManager", "pm", ";", "if", "(", "!", "pmMap", ".", "containsKey", "(", "partition", ".", "getId", "(", ")", ")", ")", "{", "IEventHubReceiver", "receiver", "=", "recvFactory", ".", "create", "(", "spoutConfig", ",", "partition", ".", "getId", "(", ")", ")", ";", "pm", "=", "pmFactory", ".", "create", "(", "receiver", ")", ";", "pmMap", ".", "put", "(", "partition", ".", "getId", "(", ")", ",", "pm", ")", ";", "}", "else", "{", "pm", "=", "pmMap", ".", "get", "(", "partition", ".", "getId", "(", ")", ")", ";", "}", "return", "pm", ";", "}" ]
Check if partition manager for a given partiton is created if not, create it. @param partition
[ "Check", "if", "partition", "manager", "for", "a", "given", "partiton", "is", "created", "if", "not", "create", "it", "." ]
86c99201e6df5e1caee3f664de8843bd656c0f1c
https://github.com/hdinsight/storm-eventhubs/blob/86c99201e6df5e1caee3f664de8843bd656c0f1c/src/main/java/org/apache/storm/eventhubs/trident/TransactionalTridentEventHubEmitter.java#L94-L105
train
padrig64/ValidationFramework
validationframework-experimental/src/main/java/com/google/code/validationframework/experimental/builder/context/simplevalidator/TriggerContext.java
TriggerContext.on
public DataProviderContext on(final Trigger... triggers) { final List<Trigger> registeredTriggers = new ArrayList<Trigger>(); if (triggers != null) { Collections.addAll(registeredTriggers, triggers); } return new DataProviderContext(registeredTriggers); }
java
public DataProviderContext on(final Trigger... triggers) { final List<Trigger> registeredTriggers = new ArrayList<Trigger>(); if (triggers != null) { Collections.addAll(registeredTriggers, triggers); } return new DataProviderContext(registeredTriggers); }
[ "public", "DataProviderContext", "on", "(", "final", "Trigger", "...", "triggers", ")", "{", "final", "List", "<", "Trigger", ">", "registeredTriggers", "=", "new", "ArrayList", "<", "Trigger", ">", "(", ")", ";", "if", "(", "triggers", "!=", "null", ")", "{", "Collections", ".", "addAll", "(", "registeredTriggers", ",", "triggers", ")", ";", "}", "return", "new", "DataProviderContext", "(", "registeredTriggers", ")", ";", "}" ]
Adds the first triggers to the validator. @param triggers Triggers to be added. @return Data provider context allowing to add triggers and data providers.
[ "Adds", "the", "first", "triggers", "to", "the", "validator", "." ]
2dd3c7b3403993db366d24a927645f467ccd1dda
https://github.com/padrig64/ValidationFramework/blob/2dd3c7b3403993db366d24a927645f467ccd1dda/validationframework-experimental/src/main/java/com/google/code/validationframework/experimental/builder/context/simplevalidator/TriggerContext.java#L73-L79
train
riccardove/easyjasub
easyjasub-lib/src/main/java/com/github/riccardove/easyjasub/jmdict/JMDictSenseLazy.java
JMDictSenseLazy.create
public static JMDictSense create() { if (index >= instances.size()) { instances.add(new JMDictSense()); } return instances.get(index++); }
java
public static JMDictSense create() { if (index >= instances.size()) { instances.add(new JMDictSense()); } return instances.get(index++); }
[ "public", "static", "JMDictSense", "create", "(", ")", "{", "if", "(", "index", ">=", "instances", ".", "size", "(", ")", ")", "{", "instances", ".", "add", "(", "new", "JMDictSense", "(", ")", ")", ";", "}", "return", "instances", ".", "get", "(", "index", "++", ")", ";", "}" ]
Returns a JMDictSense object, a new one of an existing one
[ "Returns", "a", "JMDictSense", "object", "a", "new", "one", "of", "an", "existing", "one" ]
58d6af66b1b1c738326c74d9ad5e4ad514120e27
https://github.com/riccardove/easyjasub/blob/58d6af66b1b1c738326c74d9ad5e4ad514120e27/easyjasub-lib/src/main/java/com/github/riccardove/easyjasub/jmdict/JMDictSenseLazy.java#L41-L46
train
riccardove/easyjasub
easyjasub-lib/src/main/java/com/github/riccardove/easyjasub/jmdict/JMDictSenseLazy.java
JMDictSenseLazy.clear
public static void clear() { for (int i = 0; i < index; ++i) { instances.get(i).clear(); } index = 0; }
java
public static void clear() { for (int i = 0; i < index; ++i) { instances.get(i).clear(); } index = 0; }
[ "public", "static", "void", "clear", "(", ")", "{", "for", "(", "int", "i", "=", "0", ";", "i", "<", "index", ";", "++", "i", ")", "{", "instances", ".", "get", "(", "i", ")", ".", "clear", "(", ")", ";", "}", "index", "=", "0", ";", "}" ]
Reset all created JMDictSense object so that they can be reused
[ "Reset", "all", "created", "JMDictSense", "object", "so", "that", "they", "can", "be", "reused" ]
58d6af66b1b1c738326c74d9ad5e4ad514120e27
https://github.com/riccardove/easyjasub/blob/58d6af66b1b1c738326c74d9ad5e4ad514120e27/easyjasub-lib/src/main/java/com/github/riccardove/easyjasub/jmdict/JMDictSenseLazy.java#L51-L56
train
padrig64/ValidationFramework
validationframework-swing/src/main/java/com/google/code/validationframework/swing/decoration/anchor/AnchorLink.java
AnchorLink.getRelativeSlaveLocation
public Point getRelativeSlaveLocation(final Component masterComponent, final Component slaveComponent) { return getRelativeSlaveLocation(masterComponent.getWidth(), masterComponent.getHeight(), slaveComponent.getWidth(), slaveComponent.getHeight()); }
java
public Point getRelativeSlaveLocation(final Component masterComponent, final Component slaveComponent) { return getRelativeSlaveLocation(masterComponent.getWidth(), masterComponent.getHeight(), slaveComponent.getWidth(), slaveComponent.getHeight()); }
[ "public", "Point", "getRelativeSlaveLocation", "(", "final", "Component", "masterComponent", ",", "final", "Component", "slaveComponent", ")", "{", "return", "getRelativeSlaveLocation", "(", "masterComponent", ".", "getWidth", "(", ")", ",", "masterComponent", ".", "getHeight", "(", ")", ",", "slaveComponent", ".", "getWidth", "(", ")", ",", "slaveComponent", ".", "getHeight", "(", ")", ")", ";", "}" ]
Computes the location of the specified component that is slaved to the specified master component using this anchor link. @param masterComponent Master component to which the other component is slaved. @param slaveComponent Slave component that is slaved to the master component. @return Location where the slave component should be.
[ "Computes", "the", "location", "of", "the", "specified", "component", "that", "is", "slaved", "to", "the", "specified", "master", "component", "using", "this", "anchor", "link", "." ]
2dd3c7b3403993db366d24a927645f467ccd1dda
https://github.com/padrig64/ValidationFramework/blob/2dd3c7b3403993db366d24a927645f467ccd1dda/validationframework-swing/src/main/java/com/google/code/validationframework/swing/decoration/anchor/AnchorLink.java#L113-L116
train
padrig64/ValidationFramework
validationframework-core/src/main/java/com/google/code/validationframework/base/validator/AbstractMappableValidator.java
AbstractMappableValidator.unhookFromTrigger
private void unhookFromTrigger(final T trigger) { // Unhook from trigger final TriggerListener triggerAdapter = triggersToTriggerAdapters.get(trigger); trigger.removeTriggerListener(triggerAdapter); // Check if trigger was added several times if (!triggersToTriggerAdapters.containsKey(trigger)) { // All occurrences of the same trigger have been removed triggersToTriggerAdapters.remove(trigger); } }
java
private void unhookFromTrigger(final T trigger) { // Unhook from trigger final TriggerListener triggerAdapter = triggersToTriggerAdapters.get(trigger); trigger.removeTriggerListener(triggerAdapter); // Check if trigger was added several times if (!triggersToTriggerAdapters.containsKey(trigger)) { // All occurrences of the same trigger have been removed triggersToTriggerAdapters.remove(trigger); } }
[ "private", "void", "unhookFromTrigger", "(", "final", "T", "trigger", ")", "{", "// Unhook from trigger", "final", "TriggerListener", "triggerAdapter", "=", "triggersToTriggerAdapters", ".", "get", "(", "trigger", ")", ";", "trigger", ".", "removeTriggerListener", "(", "triggerAdapter", ")", ";", "// Check if trigger was added several times", "if", "(", "!", "triggersToTriggerAdapters", ".", "containsKey", "(", "trigger", ")", ")", "{", "// All occurrences of the same trigger have been removed", "triggersToTriggerAdapters", ".", "remove", "(", "trigger", ")", ";", "}", "}" ]
De-registers the trigger listener. @param trigger Trigger to unhook from.
[ "De", "-", "registers", "the", "trigger", "listener", "." ]
2dd3c7b3403993db366d24a927645f467ccd1dda
https://github.com/padrig64/ValidationFramework/blob/2dd3c7b3403993db366d24a927645f467ccd1dda/validationframework-core/src/main/java/com/google/code/validationframework/base/validator/AbstractMappableValidator.java#L150-L160
train
padrig64/ValidationFramework
validationframework-core/src/main/java/com/google/code/validationframework/base/validator/AbstractMappableValidator.java
AbstractMappableValidator.unmapTriggerFromAllDataProviders
private void unmapTriggerFromAllDataProviders(final T trigger) { if (trigger != null) { unhookFromTrigger(trigger); triggersToDataProviders.remove(trigger); } }
java
private void unmapTriggerFromAllDataProviders(final T trigger) { if (trigger != null) { unhookFromTrigger(trigger); triggersToDataProviders.remove(trigger); } }
[ "private", "void", "unmapTriggerFromAllDataProviders", "(", "final", "T", "trigger", ")", "{", "if", "(", "trigger", "!=", "null", ")", "{", "unhookFromTrigger", "(", "trigger", ")", ";", "triggersToDataProviders", ".", "remove", "(", "trigger", ")", ";", "}", "}" ]
Disconnects the specified trigger from all data providers. @param trigger Trigger to be unmapped.
[ "Disconnects", "the", "specified", "trigger", "from", "all", "data", "providers", "." ]
2dd3c7b3403993db366d24a927645f467ccd1dda
https://github.com/padrig64/ValidationFramework/blob/2dd3c7b3403993db366d24a927645f467ccd1dda/validationframework-core/src/main/java/com/google/code/validationframework/base/validator/AbstractMappableValidator.java#L192-L197
train
padrig64/ValidationFramework
validationframework-core/src/main/java/com/google/code/validationframework/base/validator/AbstractMappableValidator.java
AbstractMappableValidator.unmapDataProviderFromAllTriggers
private void unmapDataProviderFromAllTriggers(final DP dataProvider) { if (dataProvider != null) { for (final List<DP> mappedDataProviders : triggersToDataProviders.values()) { mappedDataProviders.remove(dataProvider); } } }
java
private void unmapDataProviderFromAllTriggers(final DP dataProvider) { if (dataProvider != null) { for (final List<DP> mappedDataProviders : triggersToDataProviders.values()) { mappedDataProviders.remove(dataProvider); } } }
[ "private", "void", "unmapDataProviderFromAllTriggers", "(", "final", "DP", "dataProvider", ")", "{", "if", "(", "dataProvider", "!=", "null", ")", "{", "for", "(", "final", "List", "<", "DP", ">", "mappedDataProviders", ":", "triggersToDataProviders", ".", "values", "(", ")", ")", "{", "mappedDataProviders", ".", "remove", "(", "dataProvider", ")", ";", "}", "}", "}" ]
Disconnects the specified data providers from all triggers. @param dataProvider Data provider to be unmapped.
[ "Disconnects", "the", "specified", "data", "providers", "from", "all", "triggers", "." ]
2dd3c7b3403993db366d24a927645f467ccd1dda
https://github.com/padrig64/ValidationFramework/blob/2dd3c7b3403993db366d24a927645f467ccd1dda/validationframework-core/src/main/java/com/google/code/validationframework/base/validator/AbstractMappableValidator.java#L204-L210
train
padrig64/ValidationFramework
validationframework-core/src/main/java/com/google/code/validationframework/base/validator/AbstractMappableValidator.java
AbstractMappableValidator.unmapRuleFromAllDataProviders
private void unmapRuleFromAllDataProviders(final R rule) { if (rule != null) { for (final List<R> mappedRules : dataProvidersToRules.values()) { mappedRules.remove(rule); } } }
java
private void unmapRuleFromAllDataProviders(final R rule) { if (rule != null) { for (final List<R> mappedRules : dataProvidersToRules.values()) { mappedRules.remove(rule); } } }
[ "private", "void", "unmapRuleFromAllDataProviders", "(", "final", "R", "rule", ")", "{", "if", "(", "rule", "!=", "null", ")", "{", "for", "(", "final", "List", "<", "R", ">", "mappedRules", ":", "dataProvidersToRules", ".", "values", "(", ")", ")", "{", "mappedRules", ".", "remove", "(", "rule", ")", ";", "}", "}", "}" ]
Disconnects the specified rule from all data providers. @param rule Rule to be unmapped.
[ "Disconnects", "the", "specified", "rule", "from", "all", "data", "providers", "." ]
2dd3c7b3403993db366d24a927645f467ccd1dda
https://github.com/padrig64/ValidationFramework/blob/2dd3c7b3403993db366d24a927645f467ccd1dda/validationframework-core/src/main/java/com/google/code/validationframework/base/validator/AbstractMappableValidator.java#L249-L255
train
padrig64/ValidationFramework
validationframework-core/src/main/java/com/google/code/validationframework/base/validator/AbstractMappableValidator.java
AbstractMappableValidator.unmapResultHandlerFromAllRules
private void unmapResultHandlerFromAllRules(final RH resultHandler) { if (resultHandler != null) { for (final List<RH> mappedResultHandlers : rulesToResultHandlers.values()) { mappedResultHandlers.remove(resultHandler); } } }
java
private void unmapResultHandlerFromAllRules(final RH resultHandler) { if (resultHandler != null) { for (final List<RH> mappedResultHandlers : rulesToResultHandlers.values()) { mappedResultHandlers.remove(resultHandler); } } }
[ "private", "void", "unmapResultHandlerFromAllRules", "(", "final", "RH", "resultHandler", ")", "{", "if", "(", "resultHandler", "!=", "null", ")", "{", "for", "(", "final", "List", "<", "RH", ">", "mappedResultHandlers", ":", "rulesToResultHandlers", ".", "values", "(", ")", ")", "{", "mappedResultHandlers", ".", "remove", "(", "resultHandler", ")", ";", "}", "}", "}" ]
Disconnects the specified result handler from all rules. @param resultHandler Result handler to be unmapped.
[ "Disconnects", "the", "specified", "result", "handler", "from", "all", "rules", "." ]
2dd3c7b3403993db366d24a927645f467ccd1dda
https://github.com/padrig64/ValidationFramework/blob/2dd3c7b3403993db366d24a927645f467ccd1dda/validationframework-core/src/main/java/com/google/code/validationframework/base/validator/AbstractMappableValidator.java#L294-L300
train
padrig64/ValidationFramework
validationframework-core/src/main/java/com/google/code/validationframework/base/validator/AbstractMappableValidator.java
AbstractMappableValidator.disposeTriggersAndDataProviders
private void disposeTriggersAndDataProviders() { for (final Map.Entry<T, List<DP>> entry : triggersToDataProviders.entrySet()) { // Disconnect from trigger unhookFromTrigger(entry.getKey()); // Dispose trigger itself final T trigger = entry.getKey(); if (trigger instanceof Disposable) { ((Disposable) trigger).dispose(); } // Dispose data providers final List<DP> dataProviders = entry.getValue(); if (dataProviders != null) { for (final DP dataProvider : dataProviders) { if (dataProvider instanceof Disposable) { ((Disposable) dataProvider).dispose(); } } } } // Clears all triggers triggersToDataProviders.clear(); }
java
private void disposeTriggersAndDataProviders() { for (final Map.Entry<T, List<DP>> entry : triggersToDataProviders.entrySet()) { // Disconnect from trigger unhookFromTrigger(entry.getKey()); // Dispose trigger itself final T trigger = entry.getKey(); if (trigger instanceof Disposable) { ((Disposable) trigger).dispose(); } // Dispose data providers final List<DP> dataProviders = entry.getValue(); if (dataProviders != null) { for (final DP dataProvider : dataProviders) { if (dataProvider instanceof Disposable) { ((Disposable) dataProvider).dispose(); } } } } // Clears all triggers triggersToDataProviders.clear(); }
[ "private", "void", "disposeTriggersAndDataProviders", "(", ")", "{", "for", "(", "final", "Map", ".", "Entry", "<", "T", ",", "List", "<", "DP", ">", ">", "entry", ":", "triggersToDataProviders", ".", "entrySet", "(", ")", ")", "{", "// Disconnect from trigger", "unhookFromTrigger", "(", "entry", ".", "getKey", "(", ")", ")", ";", "// Dispose trigger itself", "final", "T", "trigger", "=", "entry", ".", "getKey", "(", ")", ";", "if", "(", "trigger", "instanceof", "Disposable", ")", "{", "(", "(", "Disposable", ")", "trigger", ")", ".", "dispose", "(", ")", ";", "}", "// Dispose data providers", "final", "List", "<", "DP", ">", "dataProviders", "=", "entry", ".", "getValue", "(", ")", ";", "if", "(", "dataProviders", "!=", "null", ")", "{", "for", "(", "final", "DP", "dataProvider", ":", "dataProviders", ")", "{", "if", "(", "dataProvider", "instanceof", "Disposable", ")", "{", "(", "(", "Disposable", ")", "dataProvider", ")", ".", "dispose", "(", ")", ";", "}", "}", "}", "}", "// Clears all triggers", "triggersToDataProviders", ".", "clear", "(", ")", ";", "}" ]
Disposes all triggers and data providers that are mapped to each other.
[ "Disposes", "all", "triggers", "and", "data", "providers", "that", "are", "mapped", "to", "each", "other", "." ]
2dd3c7b3403993db366d24a927645f467ccd1dda
https://github.com/padrig64/ValidationFramework/blob/2dd3c7b3403993db366d24a927645f467ccd1dda/validationframework-core/src/main/java/com/google/code/validationframework/base/validator/AbstractMappableValidator.java#L315-L339
train
padrig64/ValidationFramework
validationframework-core/src/main/java/com/google/code/validationframework/base/validator/AbstractMappableValidator.java
AbstractMappableValidator.disposeRulesAndResultHandlers
private void disposeRulesAndResultHandlers() { for (final Map.Entry<R, List<RH>> entry : rulesToResultHandlers.entrySet()) { // Dispose rule final R rule = entry.getKey(); if (rule instanceof Disposable) { ((Disposable) rule).dispose(); } // Dispose result handlers final List<RH> resultHandlers = entry.getValue(); if (resultHandlers != null) { for (final RH resultHandler : resultHandlers) { if (resultHandler instanceof Disposable) { ((Disposable) resultHandler).dispose(); } } } } // Clears all triggers rulesToResultHandlers.clear(); }
java
private void disposeRulesAndResultHandlers() { for (final Map.Entry<R, List<RH>> entry : rulesToResultHandlers.entrySet()) { // Dispose rule final R rule = entry.getKey(); if (rule instanceof Disposable) { ((Disposable) rule).dispose(); } // Dispose result handlers final List<RH> resultHandlers = entry.getValue(); if (resultHandlers != null) { for (final RH resultHandler : resultHandlers) { if (resultHandler instanceof Disposable) { ((Disposable) resultHandler).dispose(); } } } } // Clears all triggers rulesToResultHandlers.clear(); }
[ "private", "void", "disposeRulesAndResultHandlers", "(", ")", "{", "for", "(", "final", "Map", ".", "Entry", "<", "R", ",", "List", "<", "RH", ">", ">", "entry", ":", "rulesToResultHandlers", ".", "entrySet", "(", ")", ")", "{", "// Dispose rule", "final", "R", "rule", "=", "entry", ".", "getKey", "(", ")", ";", "if", "(", "rule", "instanceof", "Disposable", ")", "{", "(", "(", "Disposable", ")", "rule", ")", ".", "dispose", "(", ")", ";", "}", "// Dispose result handlers", "final", "List", "<", "RH", ">", "resultHandlers", "=", "entry", ".", "getValue", "(", ")", ";", "if", "(", "resultHandlers", "!=", "null", ")", "{", "for", "(", "final", "RH", "resultHandler", ":", "resultHandlers", ")", "{", "if", "(", "resultHandler", "instanceof", "Disposable", ")", "{", "(", "(", "Disposable", ")", "resultHandler", ")", ".", "dispose", "(", ")", ";", "}", "}", "}", "}", "// Clears all triggers", "rulesToResultHandlers", ".", "clear", "(", ")", ";", "}" ]
Disposes all rules and result handlers that are mapped to each other.
[ "Disposes", "all", "rules", "and", "result", "handlers", "that", "are", "mapped", "to", "each", "other", "." ]
2dd3c7b3403993db366d24a927645f467ccd1dda
https://github.com/padrig64/ValidationFramework/blob/2dd3c7b3403993db366d24a927645f467ccd1dda/validationframework-core/src/main/java/com/google/code/validationframework/base/validator/AbstractMappableValidator.java#L372-L393
train
padrig64/ValidationFramework
validationframework-swing/src/main/java/com/google/code/validationframework/swing/property/ComponentRolloverProperty.java
ComponentRolloverProperty.setValue
private void setValue(boolean rollover) { if (!ValueUtils.areEqual(this.rollover, rollover)) { boolean oldValue = this.rollover; this.rollover = rollover; maybeNotifyListeners(oldValue, rollover); } }
java
private void setValue(boolean rollover) { if (!ValueUtils.areEqual(this.rollover, rollover)) { boolean oldValue = this.rollover; this.rollover = rollover; maybeNotifyListeners(oldValue, rollover); } }
[ "private", "void", "setValue", "(", "boolean", "rollover", ")", "{", "if", "(", "!", "ValueUtils", ".", "areEqual", "(", "this", ".", "rollover", ",", "rollover", ")", ")", "{", "boolean", "oldValue", "=", "this", ".", "rollover", ";", "this", ".", "rollover", "=", "rollover", ";", "maybeNotifyListeners", "(", "oldValue", ",", "rollover", ")", ";", "}", "}" ]
Applies the specified value and notifies the value change listeners if needed. @param rollover New value.
[ "Applies", "the", "specified", "value", "and", "notifies", "the", "value", "change", "listeners", "if", "needed", "." ]
2dd3c7b3403993db366d24a927645f467ccd1dda
https://github.com/padrig64/ValidationFramework/blob/2dd3c7b3403993db366d24a927645f467ccd1dda/validationframework-swing/src/main/java/com/google/code/validationframework/swing/property/ComponentRolloverProperty.java#L114-L120
train
padrig64/ValidationFramework
validationframework-core/src/main/java/com/google/code/validationframework/base/validator/generalvalidator/dsl/ResultHandlerContext.java
ResultHandlerContext.build
private GeneralValidator<DPO, RI, RO, RHI> build() { // Create validator GeneralValidator<DPO, RI, RO, RHI> validator = new GeneralValidator<DPO, RI, RO, RHI>(); // Add triggers for (Trigger trigger : addedTriggers) { validator.addTrigger(trigger); } // Add data providers for (DataProvider<DPO> dataProvider : addedDataProviders) { validator.addDataProvider(dataProvider); } // Map data providers output to rules input validator.setDataProviderToRuleMappingStrategy(dataProviderToRuleMapping); validator.setRuleInputTransformers(addedRuleInputTransformers); // Add rules for (Rule<RI, RO> rule : addedRules) { validator.addRule(rule); } // Map rules output to result handlers input validator.setRuleToResultHandlerMappingStrategy(ruleToResultHandlerMapping); validator.setResultHandlerInputTransformers(addedResultHandlerInputTransformers); // Add result handlers for (ResultHandler<RHI> resultHandler : addedResultHandlers) { validator.addResultHandler(resultHandler); } return validator; }
java
private GeneralValidator<DPO, RI, RO, RHI> build() { // Create validator GeneralValidator<DPO, RI, RO, RHI> validator = new GeneralValidator<DPO, RI, RO, RHI>(); // Add triggers for (Trigger trigger : addedTriggers) { validator.addTrigger(trigger); } // Add data providers for (DataProvider<DPO> dataProvider : addedDataProviders) { validator.addDataProvider(dataProvider); } // Map data providers output to rules input validator.setDataProviderToRuleMappingStrategy(dataProviderToRuleMapping); validator.setRuleInputTransformers(addedRuleInputTransformers); // Add rules for (Rule<RI, RO> rule : addedRules) { validator.addRule(rule); } // Map rules output to result handlers input validator.setRuleToResultHandlerMappingStrategy(ruleToResultHandlerMapping); validator.setResultHandlerInputTransformers(addedResultHandlerInputTransformers); // Add result handlers for (ResultHandler<RHI> resultHandler : addedResultHandlers) { validator.addResultHandler(resultHandler); } return validator; }
[ "private", "GeneralValidator", "<", "DPO", ",", "RI", ",", "RO", ",", "RHI", ">", "build", "(", ")", "{", "// Create validator", "GeneralValidator", "<", "DPO", ",", "RI", ",", "RO", ",", "RHI", ">", "validator", "=", "new", "GeneralValidator", "<", "DPO", ",", "RI", ",", "RO", ",", "RHI", ">", "(", ")", ";", "// Add triggers", "for", "(", "Trigger", "trigger", ":", "addedTriggers", ")", "{", "validator", ".", "addTrigger", "(", "trigger", ")", ";", "}", "// Add data providers", "for", "(", "DataProvider", "<", "DPO", ">", "dataProvider", ":", "addedDataProviders", ")", "{", "validator", ".", "addDataProvider", "(", "dataProvider", ")", ";", "}", "// Map data providers output to rules input", "validator", ".", "setDataProviderToRuleMappingStrategy", "(", "dataProviderToRuleMapping", ")", ";", "validator", ".", "setRuleInputTransformers", "(", "addedRuleInputTransformers", ")", ";", "// Add rules", "for", "(", "Rule", "<", "RI", ",", "RO", ">", "rule", ":", "addedRules", ")", "{", "validator", ".", "addRule", "(", "rule", ")", ";", "}", "// Map rules output to result handlers input", "validator", ".", "setRuleToResultHandlerMappingStrategy", "(", "ruleToResultHandlerMapping", ")", ";", "validator", ".", "setResultHandlerInputTransformers", "(", "addedResultHandlerInputTransformers", ")", ";", "// Add result handlers", "for", "(", "ResultHandler", "<", "RHI", ">", "resultHandler", ":", "addedResultHandlers", ")", "{", "validator", ".", "addResultHandler", "(", "resultHandler", ")", ";", "}", "return", "validator", ";", "}" ]
Builds the validator. @return Fully constructed validator.
[ "Builds", "the", "validator", "." ]
2dd3c7b3403993db366d24a927645f467ccd1dda
https://github.com/padrig64/ValidationFramework/blob/2dd3c7b3403993db366d24a927645f467ccd1dda/validationframework-core/src/main/java/com/google/code/validationframework/base/validator/generalvalidator/dsl/ResultHandlerContext.java#L173-L206
train
detro/browsermob-proxy-client
src/main/java/com/github/detro/browsermobproxyclient/BMPCProxy.java
BMPCProxy.asSeleniumProxy
public Proxy asSeleniumProxy() { Proxy seleniumProxyConfig = new Proxy(); seleniumProxyConfig.setProxyType(Proxy.ProxyType.MANUAL); seleniumProxyConfig.setHttpProxy(asHostAndPort()); return seleniumProxyConfig; }
java
public Proxy asSeleniumProxy() { Proxy seleniumProxyConfig = new Proxy(); seleniumProxyConfig.setProxyType(Proxy.ProxyType.MANUAL); seleniumProxyConfig.setHttpProxy(asHostAndPort()); return seleniumProxyConfig; }
[ "public", "Proxy", "asSeleniumProxy", "(", ")", "{", "Proxy", "seleniumProxyConfig", "=", "new", "Proxy", "(", ")", ";", "seleniumProxyConfig", ".", "setProxyType", "(", "Proxy", ".", "ProxyType", ".", "MANUAL", ")", ";", "seleniumProxyConfig", ".", "setHttpProxy", "(", "asHostAndPort", "(", ")", ")", ";", "return", "seleniumProxyConfig", ";", "}" ]
Returns the Proxy this client wraps, in form of a Selenium Proxy configuration object. @return Selenium Proxy configuration object
[ "Returns", "the", "Proxy", "this", "client", "wraps", "in", "form", "of", "a", "Selenium", "Proxy", "configuration", "object", "." ]
da03deff8211b7e1153e36100c5ba60acd470a4f
https://github.com/detro/browsermob-proxy-client/blob/da03deff8211b7e1153e36100c5ba60acd470a4f/src/main/java/com/github/detro/browsermobproxyclient/BMPCProxy.java#L195-L202
train
detro/browsermob-proxy-client
src/main/java/com/github/detro/browsermobproxyclient/BMPCProxy.java
BMPCProxy.newHar
public JsonObject newHar(String initialPageRef, boolean captureHeaders, boolean captureContent, boolean captureBinaryContent) { try { // Request BMP to create a new HAR for this Proxy HttpPut request = new HttpPut(requestURIBuilder() .setPath(proxyURIPath() + "/har") .build()); // Add form parameters to the request applyFormParamsToHttpRequest(request, new BasicNameValuePair("initialPageRef", initialPageRef), new BasicNameValuePair("captureHeaders", Boolean.toString(captureHeaders)), new BasicNameValuePair("captureContent", Boolean.toString(captureContent)), new BasicNameValuePair("captureBinaryContent", Boolean.toString(captureBinaryContent))); // Execute request CloseableHttpResponse response = HTTPclient.execute(request); // Parse response into JSON JsonObject previousHar = httpResponseToJsonObject(response); // Close HTTP Response response.close(); return previousHar; } catch (Exception e) { throw new BMPCUnableToCreateHarException(e); } }
java
public JsonObject newHar(String initialPageRef, boolean captureHeaders, boolean captureContent, boolean captureBinaryContent) { try { // Request BMP to create a new HAR for this Proxy HttpPut request = new HttpPut(requestURIBuilder() .setPath(proxyURIPath() + "/har") .build()); // Add form parameters to the request applyFormParamsToHttpRequest(request, new BasicNameValuePair("initialPageRef", initialPageRef), new BasicNameValuePair("captureHeaders", Boolean.toString(captureHeaders)), new BasicNameValuePair("captureContent", Boolean.toString(captureContent)), new BasicNameValuePair("captureBinaryContent", Boolean.toString(captureBinaryContent))); // Execute request CloseableHttpResponse response = HTTPclient.execute(request); // Parse response into JSON JsonObject previousHar = httpResponseToJsonObject(response); // Close HTTP Response response.close(); return previousHar; } catch (Exception e) { throw new BMPCUnableToCreateHarException(e); } }
[ "public", "JsonObject", "newHar", "(", "String", "initialPageRef", ",", "boolean", "captureHeaders", ",", "boolean", "captureContent", ",", "boolean", "captureBinaryContent", ")", "{", "try", "{", "// Request BMP to create a new HAR for this Proxy", "HttpPut", "request", "=", "new", "HttpPut", "(", "requestURIBuilder", "(", ")", ".", "setPath", "(", "proxyURIPath", "(", ")", "+", "\"/har\"", ")", ".", "build", "(", ")", ")", ";", "// Add form parameters to the request", "applyFormParamsToHttpRequest", "(", "request", ",", "new", "BasicNameValuePair", "(", "\"initialPageRef\"", ",", "initialPageRef", ")", ",", "new", "BasicNameValuePair", "(", "\"captureHeaders\"", ",", "Boolean", ".", "toString", "(", "captureHeaders", ")", ")", ",", "new", "BasicNameValuePair", "(", "\"captureContent\"", ",", "Boolean", ".", "toString", "(", "captureContent", ")", ")", ",", "new", "BasicNameValuePair", "(", "\"captureBinaryContent\"", ",", "Boolean", ".", "toString", "(", "captureBinaryContent", ")", ")", ")", ";", "// Execute request", "CloseableHttpResponse", "response", "=", "HTTPclient", ".", "execute", "(", "request", ")", ";", "// Parse response into JSON", "JsonObject", "previousHar", "=", "httpResponseToJsonObject", "(", "response", ")", ";", "// Close HTTP Response", "response", ".", "close", "(", ")", ";", "return", "previousHar", ";", "}", "catch", "(", "Exception", "e", ")", "{", "throw", "new", "BMPCUnableToCreateHarException", "(", "e", ")", ";", "}", "}" ]
Creates a new HAR attached to the proxy. @param initialPageRef Name of the first pageRef that should be used by the HAR. If "null", default to "Page 1" @param captureHeaders Enables capturing of HTTP Headers @param captureContent Enables capturing of HTTP Response Content (body) @param captureBinaryContent Enabled capturing of HTTP Response Binary Content (in bse64 encoding) @return JsonObject HAR response if this proxy was previously collecting another HAR, effectively considering that concluded. "null" otherwise.
[ "Creates", "a", "new", "HAR", "attached", "to", "the", "proxy", "." ]
da03deff8211b7e1153e36100c5ba60acd470a4f
https://github.com/detro/browsermob-proxy-client/blob/da03deff8211b7e1153e36100c5ba60acd470a4f/src/main/java/com/github/detro/browsermobproxyclient/BMPCProxy.java#L277-L306
train
detro/browsermob-proxy-client
src/main/java/com/github/detro/browsermobproxyclient/BMPCProxy.java
BMPCProxy.newPage
public void newPage(String pageRef) { try { // Request BMP to create a new HAR for this Proxy HttpPut request = new HttpPut(requestURIBuilder() .setPath(proxyURIPath() + "/har/pageRef") .build()); // Add form parameters to the request applyFormParamsToHttpRequest(request, new BasicNameValuePair("pageRef", pageRef)); // Execute request CloseableHttpResponse response = HTTPclient.execute(request); // Check request was successful int statusCode = response.getStatusLine().getStatusCode(); if (statusCode != 200) { throw new BMPCUnableToCreatePageException( "Invalid HTTP Response when attempting to create" + "new Page in HAR: " + statusCode ); } // Close HTTP Response response.close(); } catch (Exception e) { throw new BMPCUnableToCreateHarException(e); } }
java
public void newPage(String pageRef) { try { // Request BMP to create a new HAR for this Proxy HttpPut request = new HttpPut(requestURIBuilder() .setPath(proxyURIPath() + "/har/pageRef") .build()); // Add form parameters to the request applyFormParamsToHttpRequest(request, new BasicNameValuePair("pageRef", pageRef)); // Execute request CloseableHttpResponse response = HTTPclient.execute(request); // Check request was successful int statusCode = response.getStatusLine().getStatusCode(); if (statusCode != 200) { throw new BMPCUnableToCreatePageException( "Invalid HTTP Response when attempting to create" + "new Page in HAR: " + statusCode ); } // Close HTTP Response response.close(); } catch (Exception e) { throw new BMPCUnableToCreateHarException(e); } }
[ "public", "void", "newPage", "(", "String", "pageRef", ")", "{", "try", "{", "// Request BMP to create a new HAR for this Proxy", "HttpPut", "request", "=", "new", "HttpPut", "(", "requestURIBuilder", "(", ")", ".", "setPath", "(", "proxyURIPath", "(", ")", "+", "\"/har/pageRef\"", ")", ".", "build", "(", ")", ")", ";", "// Add form parameters to the request", "applyFormParamsToHttpRequest", "(", "request", ",", "new", "BasicNameValuePair", "(", "\"pageRef\"", ",", "pageRef", ")", ")", ";", "// Execute request", "CloseableHttpResponse", "response", "=", "HTTPclient", ".", "execute", "(", "request", ")", ";", "// Check request was successful", "int", "statusCode", "=", "response", ".", "getStatusLine", "(", ")", ".", "getStatusCode", "(", ")", ";", "if", "(", "statusCode", "!=", "200", ")", "{", "throw", "new", "BMPCUnableToCreatePageException", "(", "\"Invalid HTTP Response when attempting to create\"", "+", "\"new Page in HAR: \"", "+", "statusCode", ")", ";", "}", "// Close HTTP Response", "response", ".", "close", "(", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "throw", "new", "BMPCUnableToCreateHarException", "(", "e", ")", ";", "}", "}" ]
Starts a new page on the existing HAR. All the traffic recorded in the HAR from this point on will be considered part of this new Page. @param pageRef Name of this new pageRef that should be used by the HAR. If "null" defaults to "Page N", where "N" is the number of pages so far.
[ "Starts", "a", "new", "page", "on", "the", "existing", "HAR", ".", "All", "the", "traffic", "recorded", "in", "the", "HAR", "from", "this", "point", "on", "will", "be", "considered", "part", "of", "this", "new", "Page", "." ]
da03deff8211b7e1153e36100c5ba60acd470a4f
https://github.com/detro/browsermob-proxy-client/blob/da03deff8211b7e1153e36100c5ba60acd470a4f/src/main/java/com/github/detro/browsermobproxyclient/BMPCProxy.java#L324-L354
train
detro/browsermob-proxy-client
src/main/java/com/github/detro/browsermobproxyclient/BMPCProxy.java
BMPCProxy.har
public JsonObject har() { try { // Request BMP to create a new HAR for this Proxy HttpGet request = new HttpGet(requestURIBuilder() .setPath(proxyURIPath() + "/har") .build()); // Execute request CloseableHttpResponse response = HTTPclient.execute(request); // Parse response into JSON JsonObject har = httpResponseToJsonObject(response); // Close HTTP Response response.close(); return har; } catch (Exception e) { throw new BMPCUnableToCreateHarException(e); } }
java
public JsonObject har() { try { // Request BMP to create a new HAR for this Proxy HttpGet request = new HttpGet(requestURIBuilder() .setPath(proxyURIPath() + "/har") .build()); // Execute request CloseableHttpResponse response = HTTPclient.execute(request); // Parse response into JSON JsonObject har = httpResponseToJsonObject(response); // Close HTTP Response response.close(); return har; } catch (Exception e) { throw new BMPCUnableToCreateHarException(e); } }
[ "public", "JsonObject", "har", "(", ")", "{", "try", "{", "// Request BMP to create a new HAR for this Proxy", "HttpGet", "request", "=", "new", "HttpGet", "(", "requestURIBuilder", "(", ")", ".", "setPath", "(", "proxyURIPath", "(", ")", "+", "\"/har\"", ")", ".", "build", "(", ")", ")", ";", "// Execute request", "CloseableHttpResponse", "response", "=", "HTTPclient", ".", "execute", "(", "request", ")", ";", "// Parse response into JSON", "JsonObject", "har", "=", "httpResponseToJsonObject", "(", "response", ")", ";", "// Close HTTP Response", "response", ".", "close", "(", ")", ";", "return", "har", ";", "}", "catch", "(", "Exception", "e", ")", "{", "throw", "new", "BMPCUnableToCreateHarException", "(", "e", ")", ";", "}", "}" ]
Produces the HAR so far, based on the traffic generated so far. Contains Headers, Content and so forth, based on the parameters used passed to {@link BMPCProxy#newHar(String, boolean, boolean, boolean)}. @return JsonObject in HAR format.
[ "Produces", "the", "HAR", "so", "far", "based", "on", "the", "traffic", "generated", "so", "far", "." ]
da03deff8211b7e1153e36100c5ba60acd470a4f
https://github.com/detro/browsermob-proxy-client/blob/da03deff8211b7e1153e36100c5ba60acd470a4f/src/main/java/com/github/detro/browsermobproxyclient/BMPCProxy.java#L364-L383
train
detro/browsermob-proxy-client
src/main/java/com/github/detro/browsermobproxyclient/BMPCProxy.java
BMPCProxy.harToFile
public static void harToFile(JsonObject har, String destinationDir, String destinationFile) { // Prepare HAR destination directory File harDestinationDir = new File(destinationDir); if (!harDestinationDir.exists()) harDestinationDir.mkdirs(); // Store HAR to disk PrintWriter harDestinationFileWriter = null; try { // Prepare Writer harDestinationFileWriter = new PrintWriter( destinationDir + File.separator + destinationFile); // Store HAR if any, otherwise empty file if (null != har) { harDestinationFileWriter.print(har.toString()); } else { harDestinationFileWriter.print(""); } } catch (FileNotFoundException e) { throw new BMPCUnableToSaveHarToFileException(e); } finally { if (null != harDestinationFileWriter) { harDestinationFileWriter.flush(); harDestinationFileWriter.close(); } } }
java
public static void harToFile(JsonObject har, String destinationDir, String destinationFile) { // Prepare HAR destination directory File harDestinationDir = new File(destinationDir); if (!harDestinationDir.exists()) harDestinationDir.mkdirs(); // Store HAR to disk PrintWriter harDestinationFileWriter = null; try { // Prepare Writer harDestinationFileWriter = new PrintWriter( destinationDir + File.separator + destinationFile); // Store HAR if any, otherwise empty file if (null != har) { harDestinationFileWriter.print(har.toString()); } else { harDestinationFileWriter.print(""); } } catch (FileNotFoundException e) { throw new BMPCUnableToSaveHarToFileException(e); } finally { if (null != harDestinationFileWriter) { harDestinationFileWriter.flush(); harDestinationFileWriter.close(); } } }
[ "public", "static", "void", "harToFile", "(", "JsonObject", "har", ",", "String", "destinationDir", ",", "String", "destinationFile", ")", "{", "// Prepare HAR destination directory", "File", "harDestinationDir", "=", "new", "File", "(", "destinationDir", ")", ";", "if", "(", "!", "harDestinationDir", ".", "exists", "(", ")", ")", "harDestinationDir", ".", "mkdirs", "(", ")", ";", "// Store HAR to disk", "PrintWriter", "harDestinationFileWriter", "=", "null", ";", "try", "{", "// Prepare Writer", "harDestinationFileWriter", "=", "new", "PrintWriter", "(", "destinationDir", "+", "File", ".", "separator", "+", "destinationFile", ")", ";", "// Store HAR if any, otherwise empty file", "if", "(", "null", "!=", "har", ")", "{", "harDestinationFileWriter", ".", "print", "(", "har", ".", "toString", "(", ")", ")", ";", "}", "else", "{", "harDestinationFileWriter", ".", "print", "(", "\"\"", ")", ";", "}", "}", "catch", "(", "FileNotFoundException", "e", ")", "{", "throw", "new", "BMPCUnableToSaveHarToFileException", "(", "e", ")", ";", "}", "finally", "{", "if", "(", "null", "!=", "harDestinationFileWriter", ")", "{", "harDestinationFileWriter", ".", "flush", "(", ")", ";", "harDestinationFileWriter", ".", "close", "(", ")", ";", "}", "}", "}" ]
Utility to store HAR to file. @param har JsonObject containing HAR data @param destinationDir Path to destination Directory @param destinationFile Path to destination File
[ "Utility", "to", "store", "HAR", "to", "file", "." ]
da03deff8211b7e1153e36100c5ba60acd470a4f
https://github.com/detro/browsermob-proxy-client/blob/da03deff8211b7e1153e36100c5ba60acd470a4f/src/main/java/com/github/detro/browsermobproxyclient/BMPCProxy.java#L403-L429
train
padrig64/ValidationFramework
validationframework-core/src/main/java/com/google/code/validationframework/base/validator/ResultCollectorValidator.java
ResultCollectorValidator.processResult
protected void processResult(RO result) { for (ResultHandler<RO> resultHandler : resultHandlers) { resultHandler.handleResult(result); } }
java
protected void processResult(RO result) { for (ResultHandler<RO> resultHandler : resultHandlers) { resultHandler.handleResult(result); } }
[ "protected", "void", "processResult", "(", "RO", "result", ")", "{", "for", "(", "ResultHandler", "<", "RO", ">", "resultHandler", ":", "resultHandlers", ")", "{", "resultHandler", ".", "handleResult", "(", "result", ")", ";", "}", "}" ]
Handles the specified result using all result handlers. @param result Result to be processed by all result handlers.
[ "Handles", "the", "specified", "result", "using", "all", "result", "handlers", "." ]
2dd3c7b3403993db366d24a927645f467ccd1dda
https://github.com/padrig64/ValidationFramework/blob/2dd3c7b3403993db366d24a927645f467ccd1dda/validationframework-core/src/main/java/com/google/code/validationframework/base/validator/ResultCollectorValidator.java#L127-L131
train
checkstyle-addons/checkstyle-addons
buildSrc/src/main/java/com/thomasjensen/checkstyle/addons/build/TaskCreator.java
TaskCreator.setupCrossCheckTasks
public void setupCrossCheckTasks() { final TaskContainer tasks = project.getTasks(); final Task xtest = tasks.create(XTEST_TASK_NAME); xtest.setGroup(XTEST_GROUP_NAME); xtest.setDescription("Run the unit tests against all supported Checkstyle runtimes"); tasks.getByName(JavaBasePlugin.BUILD_TASK_NAME).dependsOn(xtest); for (final DependencyConfig depConfig : buildUtil.getDepConfigs().getAll().values()) { final JavaVersion javaLevel = depConfig.getJavaLevel(); final String csBaseVersion = depConfig.getCheckstyleBaseVersion(); for (final String csRuntimeVersion : depConfig.getCompatibleCheckstyleVersions()) { if (csBaseVersion.equals(csRuntimeVersion)) { continue; } final TestTask testTask = tasks.create(TaskNames.xtest.getName(depConfig, csRuntimeVersion), TestTask.class); testTask.configureFor(depConfig, csRuntimeVersion); testTask.setGroup(XTEST_GROUP_NAME); testTask.setDescription("Run the unit tests compiled for Checkstyle " + csBaseVersion + " against a Checkstyle " + csRuntimeVersion + " runtime (Java level: " + javaLevel + ")"); testTask.getReports().getHtml().setEnabled(false); xtest.dependsOn(testTask); } } }
java
public void setupCrossCheckTasks() { final TaskContainer tasks = project.getTasks(); final Task xtest = tasks.create(XTEST_TASK_NAME); xtest.setGroup(XTEST_GROUP_NAME); xtest.setDescription("Run the unit tests against all supported Checkstyle runtimes"); tasks.getByName(JavaBasePlugin.BUILD_TASK_NAME).dependsOn(xtest); for (final DependencyConfig depConfig : buildUtil.getDepConfigs().getAll().values()) { final JavaVersion javaLevel = depConfig.getJavaLevel(); final String csBaseVersion = depConfig.getCheckstyleBaseVersion(); for (final String csRuntimeVersion : depConfig.getCompatibleCheckstyleVersions()) { if (csBaseVersion.equals(csRuntimeVersion)) { continue; } final TestTask testTask = tasks.create(TaskNames.xtest.getName(depConfig, csRuntimeVersion), TestTask.class); testTask.configureFor(depConfig, csRuntimeVersion); testTask.setGroup(XTEST_GROUP_NAME); testTask.setDescription("Run the unit tests compiled for Checkstyle " + csBaseVersion + " against a Checkstyle " + csRuntimeVersion + " runtime (Java level: " + javaLevel + ")"); testTask.getReports().getHtml().setEnabled(false); xtest.dependsOn(testTask); } } }
[ "public", "void", "setupCrossCheckTasks", "(", ")", "{", "final", "TaskContainer", "tasks", "=", "project", ".", "getTasks", "(", ")", ";", "final", "Task", "xtest", "=", "tasks", ".", "create", "(", "XTEST_TASK_NAME", ")", ";", "xtest", ".", "setGroup", "(", "XTEST_GROUP_NAME", ")", ";", "xtest", ".", "setDescription", "(", "\"Run the unit tests against all supported Checkstyle runtimes\"", ")", ";", "tasks", ".", "getByName", "(", "JavaBasePlugin", ".", "BUILD_TASK_NAME", ")", ".", "dependsOn", "(", "xtest", ")", ";", "for", "(", "final", "DependencyConfig", "depConfig", ":", "buildUtil", ".", "getDepConfigs", "(", ")", ".", "getAll", "(", ")", ".", "values", "(", ")", ")", "{", "final", "JavaVersion", "javaLevel", "=", "depConfig", ".", "getJavaLevel", "(", ")", ";", "final", "String", "csBaseVersion", "=", "depConfig", ".", "getCheckstyleBaseVersion", "(", ")", ";", "for", "(", "final", "String", "csRuntimeVersion", ":", "depConfig", ".", "getCompatibleCheckstyleVersions", "(", ")", ")", "{", "if", "(", "csBaseVersion", ".", "equals", "(", "csRuntimeVersion", ")", ")", "{", "continue", ";", "}", "final", "TestTask", "testTask", "=", "tasks", ".", "create", "(", "TaskNames", ".", "xtest", ".", "getName", "(", "depConfig", ",", "csRuntimeVersion", ")", ",", "TestTask", ".", "class", ")", ";", "testTask", ".", "configureFor", "(", "depConfig", ",", "csRuntimeVersion", ")", ";", "testTask", ".", "setGroup", "(", "XTEST_GROUP_NAME", ")", ";", "testTask", ".", "setDescription", "(", "\"Run the unit tests compiled for Checkstyle \"", "+", "csBaseVersion", "+", "\" against a Checkstyle \"", "+", "csRuntimeVersion", "+", "\" runtime (Java level: \"", "+", "javaLevel", "+", "\")\"", ")", ";", "testTask", ".", "getReports", "(", ")", ".", "getHtml", "(", ")", ".", "setEnabled", "(", "false", ")", ";", "xtest", ".", "dependsOn", "(", "testTask", ")", ";", "}", "}", "}" ]
Set up cross-check feature. We provide an 'xcheck' task which depends on a number of Test tasks that run the unit tests compiled against every Checkstyle version against all the other Checkstyle libraries. In this way, we find out which versions are compatible.
[ "Set", "up", "cross", "-", "check", "feature", ".", "We", "provide", "an", "xcheck", "task", "which", "depends", "on", "a", "number", "of", "Test", "tasks", "that", "run", "the", "unit", "tests", "compiled", "against", "every", "Checkstyle", "version", "against", "all", "the", "other", "Checkstyle", "libraries", ".", "In", "this", "way", "we", "find", "out", "which", "versions", "are", "compatible", "." ]
fae1b4d341639c8e32c3e59ec5abdc0ffc11b865
https://github.com/checkstyle-addons/checkstyle-addons/blob/fae1b4d341639c8e32c3e59ec5abdc0ffc11b865/buildSrc/src/main/java/com/thomasjensen/checkstyle/addons/build/TaskCreator.java#L185-L212
train
checkstyle-addons/checkstyle-addons
buildSrc/src/main/java/com/thomasjensen/checkstyle/addons/build/TaskCreator.java
TaskCreator.adjustTaskGroupAssignments
public void adjustTaskGroupAssignments() { final TaskContainer tasks = project.getTasks(); tasks.getByName(BasePlugin.ASSEMBLE_TASK_NAME).setGroup(ARTIFACTS_GROUP_NAME); tasks.getByName(JavaPlugin.JAR_TASK_NAME).setGroup(ARTIFACTS_GROUP_NAME); final SourceSet sqSourceSet = buildUtil.getSourceSet(BuildUtil.SONARQUBE_SOURCE_SET_NAME); tasks.getByName(JavaPlugin.COMPILE_JAVA_TASK_NAME).setGroup(BasePlugin.BUILD_GROUP); tasks.getByName(sqSourceSet.getCompileJavaTaskName()).setGroup(BasePlugin.BUILD_GROUP); tasks.getByName(JavaPlugin.COMPILE_TEST_JAVA_TASK_NAME).setGroup(BasePlugin.BUILD_GROUP); for (final SpotBugsTask sbTask : tasks.withType(SpotBugsTask.class)) { sbTask.setGroup(LifecycleBasePlugin.VERIFICATION_GROUP); } for (final Checkstyle csTask : tasks.withType(Checkstyle.class)) { csTask.setGroup(LifecycleBasePlugin.VERIFICATION_GROUP); } for (final Copy task : tasks.withType(Copy.class)) { if (task.getName().startsWith("process") && task.getName().endsWith("Resources")) { task.setGroup(LifecycleBasePlugin.BUILD_GROUP); } } }
java
public void adjustTaskGroupAssignments() { final TaskContainer tasks = project.getTasks(); tasks.getByName(BasePlugin.ASSEMBLE_TASK_NAME).setGroup(ARTIFACTS_GROUP_NAME); tasks.getByName(JavaPlugin.JAR_TASK_NAME).setGroup(ARTIFACTS_GROUP_NAME); final SourceSet sqSourceSet = buildUtil.getSourceSet(BuildUtil.SONARQUBE_SOURCE_SET_NAME); tasks.getByName(JavaPlugin.COMPILE_JAVA_TASK_NAME).setGroup(BasePlugin.BUILD_GROUP); tasks.getByName(sqSourceSet.getCompileJavaTaskName()).setGroup(BasePlugin.BUILD_GROUP); tasks.getByName(JavaPlugin.COMPILE_TEST_JAVA_TASK_NAME).setGroup(BasePlugin.BUILD_GROUP); for (final SpotBugsTask sbTask : tasks.withType(SpotBugsTask.class)) { sbTask.setGroup(LifecycleBasePlugin.VERIFICATION_GROUP); } for (final Checkstyle csTask : tasks.withType(Checkstyle.class)) { csTask.setGroup(LifecycleBasePlugin.VERIFICATION_GROUP); } for (final Copy task : tasks.withType(Copy.class)) { if (task.getName().startsWith("process") && task.getName().endsWith("Resources")) { task.setGroup(LifecycleBasePlugin.BUILD_GROUP); } } }
[ "public", "void", "adjustTaskGroupAssignments", "(", ")", "{", "final", "TaskContainer", "tasks", "=", "project", ".", "getTasks", "(", ")", ";", "tasks", ".", "getByName", "(", "BasePlugin", ".", "ASSEMBLE_TASK_NAME", ")", ".", "setGroup", "(", "ARTIFACTS_GROUP_NAME", ")", ";", "tasks", ".", "getByName", "(", "JavaPlugin", ".", "JAR_TASK_NAME", ")", ".", "setGroup", "(", "ARTIFACTS_GROUP_NAME", ")", ";", "final", "SourceSet", "sqSourceSet", "=", "buildUtil", ".", "getSourceSet", "(", "BuildUtil", ".", "SONARQUBE_SOURCE_SET_NAME", ")", ";", "tasks", ".", "getByName", "(", "JavaPlugin", ".", "COMPILE_JAVA_TASK_NAME", ")", ".", "setGroup", "(", "BasePlugin", ".", "BUILD_GROUP", ")", ";", "tasks", ".", "getByName", "(", "sqSourceSet", ".", "getCompileJavaTaskName", "(", ")", ")", ".", "setGroup", "(", "BasePlugin", ".", "BUILD_GROUP", ")", ";", "tasks", ".", "getByName", "(", "JavaPlugin", ".", "COMPILE_TEST_JAVA_TASK_NAME", ")", ".", "setGroup", "(", "BasePlugin", ".", "BUILD_GROUP", ")", ";", "for", "(", "final", "SpotBugsTask", "sbTask", ":", "tasks", ".", "withType", "(", "SpotBugsTask", ".", "class", ")", ")", "{", "sbTask", ".", "setGroup", "(", "LifecycleBasePlugin", ".", "VERIFICATION_GROUP", ")", ";", "}", "for", "(", "final", "Checkstyle", "csTask", ":", "tasks", ".", "withType", "(", "Checkstyle", ".", "class", ")", ")", "{", "csTask", ".", "setGroup", "(", "LifecycleBasePlugin", ".", "VERIFICATION_GROUP", ")", ";", "}", "for", "(", "final", "Copy", "task", ":", "tasks", ".", "withType", "(", "Copy", ".", "class", ")", ")", "{", "if", "(", "task", ".", "getName", "(", ")", ".", "startsWith", "(", "\"process\"", ")", "&&", "task", ".", "getName", "(", ")", ".", "endsWith", "(", "\"Resources\"", ")", ")", "{", "task", ".", "setGroup", "(", "LifecycleBasePlugin", ".", "BUILD_GROUP", ")", ";", "}", "}", "}" ]
Assign some standard tasks and tasks created by third-party plugins to their task groups according to the order of things for Checkstyle Addons.
[ "Assign", "some", "standard", "tasks", "and", "tasks", "created", "by", "third", "-", "party", "plugins", "to", "their", "task", "groups", "according", "to", "the", "order", "of", "things", "for", "Checkstyle", "Addons", "." ]
fae1b4d341639c8e32c3e59ec5abdc0ffc11b865
https://github.com/checkstyle-addons/checkstyle-addons/blob/fae1b4d341639c8e32c3e59ec5abdc0ffc11b865/buildSrc/src/main/java/com/thomasjensen/checkstyle/addons/build/TaskCreator.java#L310-L332
train
padrig64/ValidationFramework
validationframework-experimental/src/main/java/com/google/code/validationframework/experimental/builder/context/simplevalidator/ResultHandlerContext.java
ResultHandlerContext.check
public ResultHandlerContext<D, O> check(final Rule<D, O>... rules) { if (rules != null) { Collections.addAll(registeredRules, rules); } return this; }
java
public ResultHandlerContext<D, O> check(final Rule<D, O>... rules) { if (rules != null) { Collections.addAll(registeredRules, rules); } return this; }
[ "public", "ResultHandlerContext", "<", "D", ",", "O", ">", "check", "(", "final", "Rule", "<", "D", ",", "O", ">", "...", "rules", ")", "{", "if", "(", "rules", "!=", "null", ")", "{", "Collections", ".", "addAll", "(", "registeredRules", ",", "rules", ")", ";", "}", "return", "this", ";", "}" ]
Adds another rule to the validator. @param rules Rule to be added. @return Same result handler context.
[ "Adds", "another", "rule", "to", "the", "validator", "." ]
2dd3c7b3403993db366d24a927645f467ccd1dda
https://github.com/padrig64/ValidationFramework/blob/2dd3c7b3403993db366d24a927645f467ccd1dda/validationframework-experimental/src/main/java/com/google/code/validationframework/experimental/builder/context/simplevalidator/ResultHandlerContext.java#L91-L96
train
padrig64/ValidationFramework
validationframework-swing/src/main/java/com/google/code/validationframework/swing/decoration/utils/IconUtils.java
IconUtils.loadImageIcon
public static ImageIcon loadImageIcon(final String iconName, final Class<?> clazz) { ImageIcon icon = null; if (iconName != null) { final URL iconResource = clazz.getResource(iconName); if (iconResource == null) { LOGGER.error("Icon could not be loaded: '" + iconName); icon = null; } else { icon = new ImageIcon(iconResource); } } return icon; }
java
public static ImageIcon loadImageIcon(final String iconName, final Class<?> clazz) { ImageIcon icon = null; if (iconName != null) { final URL iconResource = clazz.getResource(iconName); if (iconResource == null) { LOGGER.error("Icon could not be loaded: '" + iconName); icon = null; } else { icon = new ImageIcon(iconResource); } } return icon; }
[ "public", "static", "ImageIcon", "loadImageIcon", "(", "final", "String", "iconName", ",", "final", "Class", "<", "?", ">", "clazz", ")", "{", "ImageIcon", "icon", "=", "null", ";", "if", "(", "iconName", "!=", "null", ")", "{", "final", "URL", "iconResource", "=", "clazz", ".", "getResource", "(", "iconName", ")", ";", "if", "(", "iconResource", "==", "null", ")", "{", "LOGGER", ".", "error", "(", "\"Icon could not be loaded: '\"", "+", "iconName", ")", ";", "icon", "=", "null", ";", "}", "else", "{", "icon", "=", "new", "ImageIcon", "(", "iconResource", ")", ";", "}", "}", "return", "icon", ";", "}" ]
Loads an image icon from a resource file. @param iconName Name of the resource file to be loaded. @param clazz Class for which the resource exists. @return Image icon if it could be loaded, null otherwise.
[ "Loads", "an", "image", "icon", "from", "a", "resource", "file", "." ]
2dd3c7b3403993db366d24a927645f467ccd1dda
https://github.com/padrig64/ValidationFramework/blob/2dd3c7b3403993db366d24a927645f467ccd1dda/validationframework-swing/src/main/java/com/google/code/validationframework/swing/decoration/utils/IconUtils.java#L68-L82
train
checkstyle-addons/checkstyle-addons
buildSrc/src/main/java/com/thomasjensen/checkstyle/addons/build/tasks/CreateJarTask.java
CreateJarTask.mfAttrStd
public static Map<String, String> mfAttrStd(final Project pProject) { Map<String, String> result = new HashMap<>(); result.put("Manifest-Version", "1.0"); result.put("Website", new BuildUtil(pProject).getExtraPropertyValue(ExtProp.Website)); result.put("Created-By", GradleVersion.current().toString()); result.put("Built-By", System.getProperty("user.name")); result.put("Build-Jdk", Jvm.current().toString()); return result; }
java
public static Map<String, String> mfAttrStd(final Project pProject) { Map<String, String> result = new HashMap<>(); result.put("Manifest-Version", "1.0"); result.put("Website", new BuildUtil(pProject).getExtraPropertyValue(ExtProp.Website)); result.put("Created-By", GradleVersion.current().toString()); result.put("Built-By", System.getProperty("user.name")); result.put("Build-Jdk", Jvm.current().toString()); return result; }
[ "public", "static", "Map", "<", "String", ",", "String", ">", "mfAttrStd", "(", "final", "Project", "pProject", ")", "{", "Map", "<", "String", ",", "String", ">", "result", "=", "new", "HashMap", "<>", "(", ")", ";", "result", ".", "put", "(", "\"Manifest-Version\"", ",", "\"1.0\"", ")", ";", "result", ".", "put", "(", "\"Website\"", ",", "new", "BuildUtil", "(", "pProject", ")", ".", "getExtraPropertyValue", "(", "ExtProp", ".", "Website", ")", ")", ";", "result", ".", "put", "(", "\"Created-By\"", ",", "GradleVersion", ".", "current", "(", ")", ".", "toString", "(", ")", ")", ";", "result", ".", "put", "(", "\"Built-By\"", ",", "System", ".", "getProperty", "(", "\"user.name\"", ")", ")", ";", "result", ".", "put", "(", "\"Build-Jdk\"", ",", "Jvm", ".", "current", "(", ")", ".", "toString", "(", ")", ")", ";", "return", "result", ";", "}" ]
Build a little map with standard manifest attributes. @param pProject Gradle project @return the map
[ "Build", "a", "little", "map", "with", "standard", "manifest", "attributes", "." ]
fae1b4d341639c8e32c3e59ec5abdc0ffc11b865
https://github.com/checkstyle-addons/checkstyle-addons/blob/fae1b4d341639c8e32c3e59ec5abdc0ffc11b865/buildSrc/src/main/java/com/thomasjensen/checkstyle/addons/build/tasks/CreateJarTask.java#L59-L68
train
padrig64/ValidationFramework
validationframework-swing/src/main/java/com/google/code/validationframework/swing/property/JTableRowCountProperty.java
JTableRowCountProperty.updateValue
private void updateValue() { if (table != null) { int oldCount = this.count; this.count = table.getRowCount(); maybeNotifyListeners(oldCount, count); } }
java
private void updateValue() { if (table != null) { int oldCount = this.count; this.count = table.getRowCount(); maybeNotifyListeners(oldCount, count); } }
[ "private", "void", "updateValue", "(", ")", "{", "if", "(", "table", "!=", "null", ")", "{", "int", "oldCount", "=", "this", ".", "count", ";", "this", ".", "count", "=", "table", ".", "getRowCount", "(", ")", ";", "maybeNotifyListeners", "(", "oldCount", ",", "count", ")", ";", "}", "}" ]
Updates the value of this property and notify the listeners.
[ "Updates", "the", "value", "of", "this", "property", "and", "notify", "the", "listeners", "." ]
2dd3c7b3403993db366d24a927645f467ccd1dda
https://github.com/padrig64/ValidationFramework/blob/2dd3c7b3403993db366d24a927645f467ccd1dda/validationframework-swing/src/main/java/com/google/code/validationframework/swing/property/JTableRowCountProperty.java#L131-L137
train
opencb/java-common-libs
commons-datastore/commons-datastore-mongodb/src/main/java/org/opencb/commons/datastore/mongodb/MongoDBQueryUtils.java
MongoDBQueryUtils.queryParamsOperatorAlwaysMatchesOperator
private static boolean queryParamsOperatorAlwaysMatchesOperator(QueryParam.Type type, List<String> queryParamList, ComparisonOperator operator) { for (String queryItem : queryParamList) { Matcher matcher = getPattern(type).matcher(queryItem); String op = ""; if (matcher.find()) { op = matcher.group(1); } if (operator != getComparisonOperator(op, type)) { return false; } } return true; }
java
private static boolean queryParamsOperatorAlwaysMatchesOperator(QueryParam.Type type, List<String> queryParamList, ComparisonOperator operator) { for (String queryItem : queryParamList) { Matcher matcher = getPattern(type).matcher(queryItem); String op = ""; if (matcher.find()) { op = matcher.group(1); } if (operator != getComparisonOperator(op, type)) { return false; } } return true; }
[ "private", "static", "boolean", "queryParamsOperatorAlwaysMatchesOperator", "(", "QueryParam", ".", "Type", "type", ",", "List", "<", "String", ">", "queryParamList", ",", "ComparisonOperator", "operator", ")", "{", "for", "(", "String", "queryItem", ":", "queryParamList", ")", "{", "Matcher", "matcher", "=", "getPattern", "(", "type", ")", ".", "matcher", "(", "queryItem", ")", ";", "String", "op", "=", "\"\"", ";", "if", "(", "matcher", ".", "find", "(", ")", ")", "{", "op", "=", "matcher", ".", "group", "(", "1", ")", ";", "}", "if", "(", "operator", "!=", "getComparisonOperator", "(", "op", ",", "type", ")", ")", "{", "return", "false", ";", "}", "}", "return", "true", ";", "}" ]
Auxiliary method to check if the operator of each of the values in the queryParamList matches the operator passed. @param type QueryParam type. @param queryParamList List of values. @param operator Operator to be checked. @return boolean indicating whether the list of values have always the same operator or not.
[ "Auxiliary", "method", "to", "check", "if", "the", "operator", "of", "each", "of", "the", "values", "in", "the", "queryParamList", "matches", "the", "operator", "passed", "." ]
5c97682530d0be55828e1e4e374ff01fceb5f198
https://github.com/opencb/java-common-libs/blob/5c97682530d0be55828e1e4e374ff01fceb5f198/commons-datastore/commons-datastore-mongodb/src/main/java/org/opencb/commons/datastore/mongodb/MongoDBQueryUtils.java#L233-L247
train
opencb/java-common-libs
commons-datastore/commons-datastore-mongodb/src/main/java/org/opencb/commons/datastore/mongodb/MongoDBQueryUtils.java
MongoDBQueryUtils.removeOperatorsFromQueryParamList
private static List<Object> removeOperatorsFromQueryParamList(QueryParam.Type type, List<String> queryParamList) { List<Object> newQueryParamList = new ArrayList<>(); for (String queryItem : queryParamList) { Matcher matcher = getPattern(type).matcher(queryItem); String queryValueString = queryItem; if (matcher.find()) { queryValueString = matcher.group(2); } switch (type) { case STRING: case TEXT: case TEXT_ARRAY: newQueryParamList.add(queryValueString); break; case LONG: case LONG_ARRAY: case INTEGER: case INTEGER_ARRAY: newQueryParamList.add(Long.parseLong(queryValueString)); break; case DOUBLE: case DECIMAL: case DECIMAL_ARRAY: newQueryParamList.add(Double.parseDouble(queryValueString)); break; case BOOLEAN: case BOOLEAN_ARRAY: newQueryParamList.add(Boolean.parseBoolean(queryValueString)); break; default: break; } } return newQueryParamList; }
java
private static List<Object> removeOperatorsFromQueryParamList(QueryParam.Type type, List<String> queryParamList) { List<Object> newQueryParamList = new ArrayList<>(); for (String queryItem : queryParamList) { Matcher matcher = getPattern(type).matcher(queryItem); String queryValueString = queryItem; if (matcher.find()) { queryValueString = matcher.group(2); } switch (type) { case STRING: case TEXT: case TEXT_ARRAY: newQueryParamList.add(queryValueString); break; case LONG: case LONG_ARRAY: case INTEGER: case INTEGER_ARRAY: newQueryParamList.add(Long.parseLong(queryValueString)); break; case DOUBLE: case DECIMAL: case DECIMAL_ARRAY: newQueryParamList.add(Double.parseDouble(queryValueString)); break; case BOOLEAN: case BOOLEAN_ARRAY: newQueryParamList.add(Boolean.parseBoolean(queryValueString)); break; default: break; } } return newQueryParamList; }
[ "private", "static", "List", "<", "Object", ">", "removeOperatorsFromQueryParamList", "(", "QueryParam", ".", "Type", "type", ",", "List", "<", "String", ">", "queryParamList", ")", "{", "List", "<", "Object", ">", "newQueryParamList", "=", "new", "ArrayList", "<>", "(", ")", ";", "for", "(", "String", "queryItem", ":", "queryParamList", ")", "{", "Matcher", "matcher", "=", "getPattern", "(", "type", ")", ".", "matcher", "(", "queryItem", ")", ";", "String", "queryValueString", "=", "queryItem", ";", "if", "(", "matcher", ".", "find", "(", ")", ")", "{", "queryValueString", "=", "matcher", ".", "group", "(", "2", ")", ";", "}", "switch", "(", "type", ")", "{", "case", "STRING", ":", "case", "TEXT", ":", "case", "TEXT_ARRAY", ":", "newQueryParamList", ".", "add", "(", "queryValueString", ")", ";", "break", ";", "case", "LONG", ":", "case", "LONG_ARRAY", ":", "case", "INTEGER", ":", "case", "INTEGER_ARRAY", ":", "newQueryParamList", ".", "add", "(", "Long", ".", "parseLong", "(", "queryValueString", ")", ")", ";", "break", ";", "case", "DOUBLE", ":", "case", "DECIMAL", ":", "case", "DECIMAL_ARRAY", ":", "newQueryParamList", ".", "add", "(", "Double", ".", "parseDouble", "(", "queryValueString", ")", ")", ";", "break", ";", "case", "BOOLEAN", ":", "case", "BOOLEAN_ARRAY", ":", "newQueryParamList", ".", "add", "(", "Boolean", ".", "parseBoolean", "(", "queryValueString", ")", ")", ";", "break", ";", "default", ":", "break", ";", "}", "}", "return", "newQueryParamList", ";", "}" ]
Removes any operators present in the queryParamList and gets a list of the values parsed to the corresponding data type. @param type QueryParam type. @param queryParamList List of values. @return a list of the values parsed to the corresponding data type.
[ "Removes", "any", "operators", "present", "in", "the", "queryParamList", "and", "gets", "a", "list", "of", "the", "values", "parsed", "to", "the", "corresponding", "data", "type", "." ]
5c97682530d0be55828e1e4e374ff01fceb5f198
https://github.com/opencb/java-common-libs/blob/5c97682530d0be55828e1e4e374ff01fceb5f198/commons-datastore/commons-datastore-mongodb/src/main/java/org/opencb/commons/datastore/mongodb/MongoDBQueryUtils.java#L256-L292
train
opencb/java-common-libs
commons-datastore/commons-datastore-mongodb/src/main/java/org/opencb/commons/datastore/mongodb/MongoDBQueryUtils.java
MongoDBQueryUtils.createDateFilter
private static Bson createDateFilter(String mongoDbField, List<String> dateValues, ComparisonOperator comparator, QueryParam.Type type) { Bson filter = null; Object date = null; if (QueryParam.Type.DATE.equals(type)) { date = convertStringToDate(dateValues.get(0)); } else if (QueryParam.Type.TIMESTAMP.equals(type)) { date = convertStringToDate(dateValues.get(0)).getTime(); } if (date != null) { switch (comparator) { case BETWEEN: if (dateValues.size() == 2) { Date to = convertStringToDate(dateValues.get(1)); if (QueryParam.Type.DATE.equals(type)) { filter = new Document(mongoDbField, new Document() .append("$gte", date) .append("$lt", to)); } else if (QueryParam.Type.TIMESTAMP.equals(type)) { filter = new Document(mongoDbField, new Document() .append("$gte", date) .append("$lt", to.getTime())); } } break; case EQUALS: filter = Filters.eq(mongoDbField, date); break; case GREATER_THAN: filter = Filters.gt(mongoDbField, date); break; case GREATER_THAN_EQUAL: filter = Filters.gte(mongoDbField, date); break; case LESS_THAN: filter = Filters.lt(mongoDbField, date); break; case LESS_THAN_EQUAL: filter = Filters.lte(mongoDbField, date); break; default: break; } } return filter; }
java
private static Bson createDateFilter(String mongoDbField, List<String> dateValues, ComparisonOperator comparator, QueryParam.Type type) { Bson filter = null; Object date = null; if (QueryParam.Type.DATE.equals(type)) { date = convertStringToDate(dateValues.get(0)); } else if (QueryParam.Type.TIMESTAMP.equals(type)) { date = convertStringToDate(dateValues.get(0)).getTime(); } if (date != null) { switch (comparator) { case BETWEEN: if (dateValues.size() == 2) { Date to = convertStringToDate(dateValues.get(1)); if (QueryParam.Type.DATE.equals(type)) { filter = new Document(mongoDbField, new Document() .append("$gte", date) .append("$lt", to)); } else if (QueryParam.Type.TIMESTAMP.equals(type)) { filter = new Document(mongoDbField, new Document() .append("$gte", date) .append("$lt", to.getTime())); } } break; case EQUALS: filter = Filters.eq(mongoDbField, date); break; case GREATER_THAN: filter = Filters.gt(mongoDbField, date); break; case GREATER_THAN_EQUAL: filter = Filters.gte(mongoDbField, date); break; case LESS_THAN: filter = Filters.lt(mongoDbField, date); break; case LESS_THAN_EQUAL: filter = Filters.lte(mongoDbField, date); break; default: break; } } return filter; }
[ "private", "static", "Bson", "createDateFilter", "(", "String", "mongoDbField", ",", "List", "<", "String", ">", "dateValues", ",", "ComparisonOperator", "comparator", ",", "QueryParam", ".", "Type", "type", ")", "{", "Bson", "filter", "=", "null", ";", "Object", "date", "=", "null", ";", "if", "(", "QueryParam", ".", "Type", ".", "DATE", ".", "equals", "(", "type", ")", ")", "{", "date", "=", "convertStringToDate", "(", "dateValues", ".", "get", "(", "0", ")", ")", ";", "}", "else", "if", "(", "QueryParam", ".", "Type", ".", "TIMESTAMP", ".", "equals", "(", "type", ")", ")", "{", "date", "=", "convertStringToDate", "(", "dateValues", ".", "get", "(", "0", ")", ")", ".", "getTime", "(", ")", ";", "}", "if", "(", "date", "!=", "null", ")", "{", "switch", "(", "comparator", ")", "{", "case", "BETWEEN", ":", "if", "(", "dateValues", ".", "size", "(", ")", "==", "2", ")", "{", "Date", "to", "=", "convertStringToDate", "(", "dateValues", ".", "get", "(", "1", ")", ")", ";", "if", "(", "QueryParam", ".", "Type", ".", "DATE", ".", "equals", "(", "type", ")", ")", "{", "filter", "=", "new", "Document", "(", "mongoDbField", ",", "new", "Document", "(", ")", ".", "append", "(", "\"$gte\"", ",", "date", ")", ".", "append", "(", "\"$lt\"", ",", "to", ")", ")", ";", "}", "else", "if", "(", "QueryParam", ".", "Type", ".", "TIMESTAMP", ".", "equals", "(", "type", ")", ")", "{", "filter", "=", "new", "Document", "(", "mongoDbField", ",", "new", "Document", "(", ")", ".", "append", "(", "\"$gte\"", ",", "date", ")", ".", "append", "(", "\"$lt\"", ",", "to", ".", "getTime", "(", ")", ")", ")", ";", "}", "}", "break", ";", "case", "EQUALS", ":", "filter", "=", "Filters", ".", "eq", "(", "mongoDbField", ",", "date", ")", ";", "break", ";", "case", "GREATER_THAN", ":", "filter", "=", "Filters", ".", "gt", "(", "mongoDbField", ",", "date", ")", ";", "break", ";", "case", "GREATER_THAN_EQUAL", ":", "filter", "=", "Filters", ".", "gte", "(", "mongoDbField", ",", "date", ")", ";", "break", ";", "case", "LESS_THAN", ":", "filter", "=", "Filters", ".", "lt", "(", "mongoDbField", ",", "date", ")", ";", "break", ";", "case", "LESS_THAN_EQUAL", ":", "filter", "=", "Filters", ".", "lte", "(", "mongoDbField", ",", "date", ")", ";", "break", ";", "default", ":", "break", ";", "}", "}", "return", "filter", ";", "}" ]
Generates a date filter. @param mongoDbField Mongo field. @param dateValues List of 1 or 2 strings (dates). Only one will be expected when something like the following is passed: =20171210, 20171210, >=20171210, >20171210, <20171210, <=20171210 When 2 strings are passed, we will expect it to be a range such as: 20171201-20171210 @param comparator Comparator value. @param type Type of parameter. Expecting one of {@link QueryParam.Type#DATE} or {@link QueryParam.Type#TIMESTAMP} @return the Bson query.
[ "Generates", "a", "date", "filter", "." ]
5c97682530d0be55828e1e4e374ff01fceb5f198
https://github.com/opencb/java-common-libs/blob/5c97682530d0be55828e1e4e374ff01fceb5f198/commons-datastore/commons-datastore-mongodb/src/main/java/org/opencb/commons/datastore/mongodb/MongoDBQueryUtils.java#L426-L475
train
opencb/java-common-libs
commons-datastore/commons-datastore-mongodb/src/main/java/org/opencb/commons/datastore/mongodb/MongoDBQueryUtils.java
MongoDBQueryUtils.checkOperator
public static LogicalOperator checkOperator(String value) throws IllegalArgumentException { boolean containsOr = value.contains(OR); boolean containsAnd = value.contains(AND); if (containsAnd && containsOr) { throw new IllegalArgumentException("Cannot merge AND and OR operators in the same query filter."); } else if (containsAnd && !containsOr) { return LogicalOperator.AND; } else if (containsOr && !containsAnd) { return LogicalOperator.OR; } else { // !containsOr && !containsAnd return null; } }
java
public static LogicalOperator checkOperator(String value) throws IllegalArgumentException { boolean containsOr = value.contains(OR); boolean containsAnd = value.contains(AND); if (containsAnd && containsOr) { throw new IllegalArgumentException("Cannot merge AND and OR operators in the same query filter."); } else if (containsAnd && !containsOr) { return LogicalOperator.AND; } else if (containsOr && !containsAnd) { return LogicalOperator.OR; } else { // !containsOr && !containsAnd return null; } }
[ "public", "static", "LogicalOperator", "checkOperator", "(", "String", "value", ")", "throws", "IllegalArgumentException", "{", "boolean", "containsOr", "=", "value", ".", "contains", "(", "OR", ")", ";", "boolean", "containsAnd", "=", "value", ".", "contains", "(", "AND", ")", ";", "if", "(", "containsAnd", "&&", "containsOr", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"Cannot merge AND and OR operators in the same query filter.\"", ")", ";", "}", "else", "if", "(", "containsAnd", "&&", "!", "containsOr", ")", "{", "return", "LogicalOperator", ".", "AND", ";", "}", "else", "if", "(", "containsOr", "&&", "!", "containsAnd", ")", "{", "return", "LogicalOperator", ".", "OR", ";", "}", "else", "{", "// !containsOr && !containsAnd", "return", "null", ";", "}", "}" ]
Checks that the filter value list contains only one type of operations. @param value List of values to check @return The used operator. Null if no operator is used. @throws IllegalArgumentException if the list contains different operators.
[ "Checks", "that", "the", "filter", "value", "list", "contains", "only", "one", "type", "of", "operations", "." ]
5c97682530d0be55828e1e4e374ff01fceb5f198
https://github.com/opencb/java-common-libs/blob/5c97682530d0be55828e1e4e374ff01fceb5f198/commons-datastore/commons-datastore-mongodb/src/main/java/org/opencb/commons/datastore/mongodb/MongoDBQueryUtils.java#L484-L496
train
riccardove/easyjasub
easyjasub-lib/src/main/java/com/github/riccardove/easyjasub/dictionary/EasyJaSubDictionary.java
EasyJaSubDictionary.getEntry
public EasyJaSubDictionaryEntry getEntry(String word) { if (word == null || word.length() == 0) { throw new RuntimeException("Invalid word"); } EasyJaSubTrie.Value<EasyJaSubDictionaryEntry> value = trie .get(new CharacterIterator(word)); if (value == null) { return null; } return value.getValue(); }
java
public EasyJaSubDictionaryEntry getEntry(String word) { if (word == null || word.length() == 0) { throw new RuntimeException("Invalid word"); } EasyJaSubTrie.Value<EasyJaSubDictionaryEntry> value = trie .get(new CharacterIterator(word)); if (value == null) { return null; } return value.getValue(); }
[ "public", "EasyJaSubDictionaryEntry", "getEntry", "(", "String", "word", ")", "{", "if", "(", "word", "==", "null", "||", "word", ".", "length", "(", ")", "==", "0", ")", "{", "throw", "new", "RuntimeException", "(", "\"Invalid word\"", ")", ";", "}", "EasyJaSubTrie", ".", "Value", "<", "EasyJaSubDictionaryEntry", ">", "value", "=", "trie", ".", "get", "(", "new", "CharacterIterator", "(", "word", ")", ")", ";", "if", "(", "value", "==", "null", ")", "{", "return", "null", ";", "}", "return", "value", ".", "getValue", "(", ")", ";", "}" ]
Returns an entry corresponding to specified word, or to a prefix of it @param word @return
[ "Returns", "an", "entry", "corresponding", "to", "specified", "word", "or", "to", "a", "prefix", "of", "it" ]
58d6af66b1b1c738326c74d9ad5e4ad514120e27
https://github.com/riccardove/easyjasub/blob/58d6af66b1b1c738326c74d9ad5e4ad514120e27/easyjasub-lib/src/main/java/com/github/riccardove/easyjasub/dictionary/EasyJaSubDictionary.java#L68-L78
train
checkstyle-addons/checkstyle-addons
buildSrc/src/main/java/com/thomasjensen/checkstyle/addons/build/BuildUtil.java
BuildUtil.getExtraPropertyValue
@SuppressWarnings("unchecked") public <T> T getExtraPropertyValue(@Nonnull final ExtProp pExtraPropName) { ExtraPropertiesExtension extraProps = project.getExtensions().getByType(ExtraPropertiesExtension.class); if (extraProps.has(pExtraPropName.getPropertyName())) { return (T) extraProps.get(pExtraPropName.getPropertyName()); } throw new GradleException( "Reference to non-existent project extra property '" + pExtraPropName.getPropertyName() + "'"); }
java
@SuppressWarnings("unchecked") public <T> T getExtraPropertyValue(@Nonnull final ExtProp pExtraPropName) { ExtraPropertiesExtension extraProps = project.getExtensions().getByType(ExtraPropertiesExtension.class); if (extraProps.has(pExtraPropName.getPropertyName())) { return (T) extraProps.get(pExtraPropName.getPropertyName()); } throw new GradleException( "Reference to non-existent project extra property '" + pExtraPropName.getPropertyName() + "'"); }
[ "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "public", "<", "T", ">", "T", "getExtraPropertyValue", "(", "@", "Nonnull", "final", "ExtProp", "pExtraPropName", ")", "{", "ExtraPropertiesExtension", "extraProps", "=", "project", ".", "getExtensions", "(", ")", ".", "getByType", "(", "ExtraPropertiesExtension", ".", "class", ")", ";", "if", "(", "extraProps", ".", "has", "(", "pExtraPropName", ".", "getPropertyName", "(", ")", ")", ")", "{", "return", "(", "T", ")", "extraProps", ".", "get", "(", "pExtraPropName", ".", "getPropertyName", "(", ")", ")", ";", "}", "throw", "new", "GradleException", "(", "\"Reference to non-existent project extra property '\"", "+", "pExtraPropName", ".", "getPropertyName", "(", ")", "+", "\"'\"", ")", ";", "}" ]
Read the value of an extra property of the project. @param pExtraPropName the reference to the extra property name @param <T> type of the property value @return the property's value
[ "Read", "the", "value", "of", "an", "extra", "property", "of", "the", "project", "." ]
fae1b4d341639c8e32c3e59ec5abdc0ffc11b865
https://github.com/checkstyle-addons/checkstyle-addons/blob/fae1b4d341639c8e32c3e59ec5abdc0ffc11b865/buildSrc/src/main/java/com/thomasjensen/checkstyle/addons/build/BuildUtil.java#L124-L133
train
checkstyle-addons/checkstyle-addons
buildSrc/src/main/java/com/thomasjensen/checkstyle/addons/build/BuildUtil.java
BuildUtil.getTask
@Nonnull public Task getTask(@Nonnull final TaskNames pTaskName, @Nonnull final DependencyConfig pDepConfig) { return project.getTasks().getByName(pTaskName.getName(pDepConfig)); }
java
@Nonnull public Task getTask(@Nonnull final TaskNames pTaskName, @Nonnull final DependencyConfig pDepConfig) { return project.getTasks().getByName(pTaskName.getName(pDepConfig)); }
[ "@", "Nonnull", "public", "Task", "getTask", "(", "@", "Nonnull", "final", "TaskNames", "pTaskName", ",", "@", "Nonnull", "final", "DependencyConfig", "pDepConfig", ")", "{", "return", "project", ".", "getTasks", "(", ")", ".", "getByName", "(", "pTaskName", ".", "getName", "(", "pDepConfig", ")", ")", ";", "}" ]
Convenience method for getting a specific task directly. @param pTaskName the task to get @param pDepConfig the dependency configuration for which the task is intended @return a task object
[ "Convenience", "method", "for", "getting", "a", "specific", "task", "directly", "." ]
fae1b4d341639c8e32c3e59ec5abdc0ffc11b865
https://github.com/checkstyle-addons/checkstyle-addons/blob/fae1b4d341639c8e32c3e59ec5abdc0ffc11b865/buildSrc/src/main/java/com/thomasjensen/checkstyle/addons/build/BuildUtil.java#L144-L148
train
checkstyle-addons/checkstyle-addons
buildSrc/src/main/java/com/thomasjensen/checkstyle/addons/build/BuildUtil.java
BuildUtil.addBuildTimestampDeferred
public void addBuildTimestampDeferred(@Nonnull final Task pTask, @Nonnull final Attributes pAttributes) { pTask.doFirst(new Closure<Void>(pTask) { @Override @SuppressWarnings("MethodDoesntCallSuperMethod") public Void call() { addBuildTimestamp(pAttributes); return null; } }); }
java
public void addBuildTimestampDeferred(@Nonnull final Task pTask, @Nonnull final Attributes pAttributes) { pTask.doFirst(new Closure<Void>(pTask) { @Override @SuppressWarnings("MethodDoesntCallSuperMethod") public Void call() { addBuildTimestamp(pAttributes); return null; } }); }
[ "public", "void", "addBuildTimestampDeferred", "(", "@", "Nonnull", "final", "Task", "pTask", ",", "@", "Nonnull", "final", "Attributes", "pAttributes", ")", "{", "pTask", ".", "doFirst", "(", "new", "Closure", "<", "Void", ">", "(", "pTask", ")", "{", "@", "Override", "@", "SuppressWarnings", "(", "\"MethodDoesntCallSuperMethod\"", ")", "public", "Void", "call", "(", ")", "{", "addBuildTimestamp", "(", "pAttributes", ")", ";", "return", "null", ";", "}", "}", ")", ";", "}" ]
Add build timestamp to some manifest attributes in the execution phase, so that it does not count for the up-to-date check. @param pTask the executing task @param pAttributes the attributes map to add to
[ "Add", "build", "timestamp", "to", "some", "manifest", "attributes", "in", "the", "execution", "phase", "so", "that", "it", "does", "not", "count", "for", "the", "up", "-", "to", "-", "date", "check", "." ]
fae1b4d341639c8e32c3e59ec5abdc0ffc11b865
https://github.com/checkstyle-addons/checkstyle-addons/blob/fae1b4d341639c8e32c3e59ec5abdc0ffc11b865/buildSrc/src/main/java/com/thomasjensen/checkstyle/addons/build/BuildUtil.java#L180-L192
train
checkstyle-addons/checkstyle-addons
buildSrc/src/main/java/com/thomasjensen/checkstyle/addons/build/BuildUtil.java
BuildUtil.inheritManifest
public void inheritManifest(@Nonnull final Jar pTask, @Nonnull final DependencyConfig pDepConfig) { pTask.doFirst(new Closure<Void>(pTask) { @Override @SuppressWarnings("MethodDoesntCallSuperMethod") public Void call() { final Jar jarTask = (Jar) getTask(TaskNames.jar, pDepConfig); pTask.setManifest(jarTask.getManifest()); addBuildTimestamp(pTask.getManifest().getAttributes()); return null; } }); }
java
public void inheritManifest(@Nonnull final Jar pTask, @Nonnull final DependencyConfig pDepConfig) { pTask.doFirst(new Closure<Void>(pTask) { @Override @SuppressWarnings("MethodDoesntCallSuperMethod") public Void call() { final Jar jarTask = (Jar) getTask(TaskNames.jar, pDepConfig); pTask.setManifest(jarTask.getManifest()); addBuildTimestamp(pTask.getManifest().getAttributes()); return null; } }); }
[ "public", "void", "inheritManifest", "(", "@", "Nonnull", "final", "Jar", "pTask", ",", "@", "Nonnull", "final", "DependencyConfig", "pDepConfig", ")", "{", "pTask", ".", "doFirst", "(", "new", "Closure", "<", "Void", ">", "(", "pTask", ")", "{", "@", "Override", "@", "SuppressWarnings", "(", "\"MethodDoesntCallSuperMethod\"", ")", "public", "Void", "call", "(", ")", "{", "final", "Jar", "jarTask", "=", "(", "Jar", ")", "getTask", "(", "TaskNames", ".", "jar", ",", "pDepConfig", ")", ";", "pTask", ".", "setManifest", "(", "jarTask", ".", "getManifest", "(", ")", ")", ";", "addBuildTimestamp", "(", "pTask", ".", "getManifest", "(", ")", ".", "getAttributes", "(", ")", ")", ";", "return", "null", ";", "}", "}", ")", ";", "}" ]
Make the given Jar task inherit its manifest from the "main" "thin" Jar task. Also set the build timestamp. @param pTask the executing task @param pDepConfig the dependency configuration for which the Jar task is intended
[ "Make", "the", "given", "Jar", "task", "inherit", "its", "manifest", "from", "the", "main", "thin", "Jar", "task", ".", "Also", "set", "the", "build", "timestamp", "." ]
fae1b4d341639c8e32c3e59ec5abdc0ffc11b865
https://github.com/checkstyle-addons/checkstyle-addons/blob/fae1b4d341639c8e32c3e59ec5abdc0ffc11b865/buildSrc/src/main/java/com/thomasjensen/checkstyle/addons/build/BuildUtil.java#L202-L216
train
padrig64/ValidationFramework
validationframework-swing/src/main/java/com/google/code/validationframework/swing/decoration/anchor/Anchor.java
Anchor.getAnchorPoint
public Point getAnchorPoint(int width, int height) { return new Point((int) (relativeX * width + offsetX), (int) (relativeY * height + offsetY)); }
java
public Point getAnchorPoint(int width, int height) { return new Point((int) (relativeX * width + offsetX), (int) (relativeY * height + offsetY)); }
[ "public", "Point", "getAnchorPoint", "(", "int", "width", ",", "int", "height", ")", "{", "return", "new", "Point", "(", "(", "int", ")", "(", "relativeX", "*", "width", "+", "offsetX", ")", ",", "(", "int", ")", "(", "relativeY", "*", "height", "+", "offsetY", ")", ")", ";", "}" ]
Retrieves a point on an object of the specified size. @param width Width of the object to get the anchor point for. @param height Height of the object to get the anchor point for. @return Anchor point. @see #getAnchorPoint(Dimension)
[ "Retrieves", "a", "point", "on", "an", "object", "of", "the", "specified", "size", "." ]
2dd3c7b3403993db366d24a927645f467ccd1dda
https://github.com/padrig64/ValidationFramework/blob/2dd3c7b3403993db366d24a927645f467ccd1dda/validationframework-swing/src/main/java/com/google/code/validationframework/swing/decoration/anchor/Anchor.java#L203-L205
train
padrig64/ValidationFramework
validationframework-core/src/main/java/com/google/code/validationframework/base/property/AbstractReadableProperty.java
AbstractReadableProperty.setInhibited
public void setInhibited(boolean inhibited) { boolean wasInhibited = this.inhibited; this.inhibited = inhibited; if (wasInhibited && !inhibited) { if (inhibitCount > 0) { maybeNotifyListeners(lastNonInhibitedValue, lastInhibitedValue); } inhibitCount = 0; } }
java
public void setInhibited(boolean inhibited) { boolean wasInhibited = this.inhibited; this.inhibited = inhibited; if (wasInhibited && !inhibited) { if (inhibitCount > 0) { maybeNotifyListeners(lastNonInhibitedValue, lastInhibitedValue); } inhibitCount = 0; } }
[ "public", "void", "setInhibited", "(", "boolean", "inhibited", ")", "{", "boolean", "wasInhibited", "=", "this", ".", "inhibited", ";", "this", ".", "inhibited", "=", "inhibited", ";", "if", "(", "wasInhibited", "&&", "!", "inhibited", ")", "{", "if", "(", "inhibitCount", ">", "0", ")", "{", "maybeNotifyListeners", "(", "lastNonInhibitedValue", ",", "lastInhibitedValue", ")", ";", "}", "inhibitCount", "=", "0", ";", "}", "}" ]
States whether this property should be inhibited. @param inhibited True if this property should be inhibited, false otherwise.
[ "States", "whether", "this", "property", "should", "be", "inhibited", "." ]
2dd3c7b3403993db366d24a927645f467ccd1dda
https://github.com/padrig64/ValidationFramework/blob/2dd3c7b3403993db366d24a927645f467ccd1dda/validationframework-core/src/main/java/com/google/code/validationframework/base/property/AbstractReadableProperty.java#L136-L146
train
padrig64/ValidationFramework
validationframework-core/src/main/java/com/google/code/validationframework/base/property/AbstractReadableProperty.java
AbstractReadableProperty.notifyListenersIfUninhibited
private void notifyListenersIfUninhibited(R oldValue, R newValue) { if (inhibited) { inhibitCount++; lastInhibitedValue = newValue; } else { lastInhibitedValue = newValue; // Just in case, even though not really necessary lastNonInhibitedValue = newValue; doNotifyListeners(oldValue, newValue); } }
java
private void notifyListenersIfUninhibited(R oldValue, R newValue) { if (inhibited) { inhibitCount++; lastInhibitedValue = newValue; } else { lastInhibitedValue = newValue; // Just in case, even though not really necessary lastNonInhibitedValue = newValue; doNotifyListeners(oldValue, newValue); } }
[ "private", "void", "notifyListenersIfUninhibited", "(", "R", "oldValue", ",", "R", "newValue", ")", "{", "if", "(", "inhibited", ")", "{", "inhibitCount", "++", ";", "lastInhibitedValue", "=", "newValue", ";", "}", "else", "{", "lastInhibitedValue", "=", "newValue", ";", "// Just in case, even though not really necessary", "lastNonInhibitedValue", "=", "newValue", ";", "doNotifyListeners", "(", "oldValue", ",", "newValue", ")", ";", "}", "}" ]
Notifies the listeners that the property value has changed, if the property is not inhibited. @param oldValue Previous value. @param newValue New value. @see #maybeNotifyListeners(Object, Object) @see #doNotifyListeners(Object, Object)
[ "Notifies", "the", "listeners", "that", "the", "property", "value", "has", "changed", "if", "the", "property", "is", "not", "inhibited", "." ]
2dd3c7b3403993db366d24a927645f467ccd1dda
https://github.com/padrig64/ValidationFramework/blob/2dd3c7b3403993db366d24a927645f467ccd1dda/validationframework-core/src/main/java/com/google/code/validationframework/base/property/AbstractReadableProperty.java#L177-L186
train
padrig64/ValidationFramework
validationframework-core/src/main/java/com/google/code/validationframework/base/property/AbstractReadableProperty.java
AbstractReadableProperty.doNotifyListeners
private void doNotifyListeners(R oldValue, R newValue) { List<ValueChangeListener<R>> listenersCopy = new ArrayList<ValueChangeListener<R>>(listeners); notifyingListeners = true; for (ValueChangeListener<R> listener : listenersCopy) { listener.valueChanged(this, oldValue, newValue); } notifyingListeners = false; }
java
private void doNotifyListeners(R oldValue, R newValue) { List<ValueChangeListener<R>> listenersCopy = new ArrayList<ValueChangeListener<R>>(listeners); notifyingListeners = true; for (ValueChangeListener<R> listener : listenersCopy) { listener.valueChanged(this, oldValue, newValue); } notifyingListeners = false; }
[ "private", "void", "doNotifyListeners", "(", "R", "oldValue", ",", "R", "newValue", ")", "{", "List", "<", "ValueChangeListener", "<", "R", ">>", "listenersCopy", "=", "new", "ArrayList", "<", "ValueChangeListener", "<", "R", ">", ">", "(", "listeners", ")", ";", "notifyingListeners", "=", "true", ";", "for", "(", "ValueChangeListener", "<", "R", ">", "listener", ":", "listenersCopy", ")", "{", "listener", ".", "valueChanged", "(", "this", ",", "oldValue", ",", "newValue", ")", ";", "}", "notifyingListeners", "=", "false", ";", "}" ]
Notifies the listeners that the property value has changed, unconditionally. @param oldValue Previous value. @param newValue New value.
[ "Notifies", "the", "listeners", "that", "the", "property", "value", "has", "changed", "unconditionally", "." ]
2dd3c7b3403993db366d24a927645f467ccd1dda
https://github.com/padrig64/ValidationFramework/blob/2dd3c7b3403993db366d24a927645f467ccd1dda/validationframework-core/src/main/java/com/google/code/validationframework/base/property/AbstractReadableProperty.java#L203-L210
train