repository_name
stringlengths
7
58
func_path_in_repository
stringlengths
11
204
func_name
stringlengths
5
103
whole_func_string
stringlengths
87
3.44k
language
stringclasses
1 value
func_code_string
stringlengths
87
3.44k
func_code_tokens
listlengths
21
714
func_documentation_string
stringlengths
61
1.95k
func_documentation_tokens
listlengths
1
482
split_name
stringclasses
1 value
func_code_url
stringlengths
102
309
jayantk/jklol
src/com/jayantkrish/jklol/models/FactorGraph.java
FactorGraph.createFromFactors
public static FactorGraph createFromFactors(List<Factor> factors) { VariableNumMap allVars = VariableNumMap.EMPTY; for (int i = 0; i < factors.size(); i++) { allVars = allVars.union(factors.get(i).getVars()); } String[] factorNames = new String[factors.size()]; for (int i = 0; i < factors.size(); i++) { factorNames[i] = "factor-" + i; } return new FactorGraph(allVars, factors.toArray(new Factor[factors.size()]), factorNames, VariableNumMap.EMPTY, Assignment.EMPTY, null); }
java
public static FactorGraph createFromFactors(List<Factor> factors) { VariableNumMap allVars = VariableNumMap.EMPTY; for (int i = 0; i < factors.size(); i++) { allVars = allVars.union(factors.get(i).getVars()); } String[] factorNames = new String[factors.size()]; for (int i = 0; i < factors.size(); i++) { factorNames[i] = "factor-" + i; } return new FactorGraph(allVars, factors.toArray(new Factor[factors.size()]), factorNames, VariableNumMap.EMPTY, Assignment.EMPTY, null); }
[ "public", "static", "FactorGraph", "createFromFactors", "(", "List", "<", "Factor", ">", "factors", ")", "{", "VariableNumMap", "allVars", "=", "VariableNumMap", ".", "EMPTY", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "factors", ".", "size", ...
Constructs a {@code FactorGraph} directly from a list of factors. The variables and variable numbers in the graph are determined by the factors, and their names are unspecified. @param factors
[ "Constructs", "a", "{", "@code", "FactorGraph", "}", "directly", "from", "a", "list", "of", "factors", ".", "The", "variables", "and", "variable", "numbers", "in", "the", "graph", "are", "determined", "by", "the", "factors", "and", "their", "names", "are", ...
train
https://github.com/jayantk/jklol/blob/d27532ca83e212d51066cf28f52621acc3fd44cc/src/com/jayantkrish/jklol/models/FactorGraph.java#L145-L157
Azure/azure-sdk-for-java
policy/resource-manager/v2016_12_01/src/main/java/com/microsoft/azure/management/policy/v2016_12_01/implementation/PolicyAssignmentsInner.java
PolicyAssignmentsInner.createByIdAsync
public Observable<PolicyAssignmentInner> createByIdAsync(String policyAssignmentId, PolicyAssignmentInner parameters) { return createByIdWithServiceResponseAsync(policyAssignmentId, parameters).map(new Func1<ServiceResponse<PolicyAssignmentInner>, PolicyAssignmentInner>() { @Override public PolicyAssignmentInner call(ServiceResponse<PolicyAssignmentInner> response) { return response.body(); } }); }
java
public Observable<PolicyAssignmentInner> createByIdAsync(String policyAssignmentId, PolicyAssignmentInner parameters) { return createByIdWithServiceResponseAsync(policyAssignmentId, parameters).map(new Func1<ServiceResponse<PolicyAssignmentInner>, PolicyAssignmentInner>() { @Override public PolicyAssignmentInner call(ServiceResponse<PolicyAssignmentInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "PolicyAssignmentInner", ">", "createByIdAsync", "(", "String", "policyAssignmentId", ",", "PolicyAssignmentInner", "parameters", ")", "{", "return", "createByIdWithServiceResponseAsync", "(", "policyAssignmentId", ",", "parameters", ")", ".", ...
Creates a policy assignment by ID. Policy assignments are inherited by child resources. For example, when you apply a policy to a resource group that policy is assigned to all resources in the group. When providing a scope for the assigment, use '/subscriptions/{subscription-id}/' for subscriptions, '/subscriptions/{subscription-id}/resourceGroups/{resource-group-name}' for resource groups, and '/subscriptions/{subscription-id}/resourceGroups/{resource-group-name}/providers/{resource-provider-namespace}/{resource-type}/{resource-name}' for resources. @param policyAssignmentId The ID of the policy assignment to create. Use the format '/{scope}/providers/Microsoft.Authorization/policyAssignments/{policy-assignment-name}'. @param parameters Parameters for policy assignment. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the PolicyAssignmentInner object
[ "Creates", "a", "policy", "assignment", "by", "ID", ".", "Policy", "assignments", "are", "inherited", "by", "child", "resources", ".", "For", "example", "when", "you", "apply", "a", "policy", "to", "a", "resource", "group", "that", "policy", "is", "assigned"...
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/policy/resource-manager/v2016_12_01/src/main/java/com/microsoft/azure/management/policy/v2016_12_01/implementation/PolicyAssignmentsInner.java#L1231-L1238
GoogleCloudPlatform/bigdata-interop
gcsio/src/main/java/com/google/cloud/hadoop/gcsio/StorageResourceId.java
StorageResourceId.fromObjectName
public static StorageResourceId fromObjectName(String objectName, long generationId) { Matcher matcher = OBJECT_NAME_IN_GCS_PATTERN.matcher(objectName); checkArgument(matcher.matches(), "'%s' is not a valid GCS object name.", objectName); String bucketName = matcher.group(2); String relativePath = matcher.group(4); if (bucketName == null) { checkArgument(generationId == UNKNOWN_GENERATION_ID, "Cannot specify generationId '%s' for root object '%s'", generationId, objectName); return ROOT; } else if (relativePath != null) { return new StorageResourceId(bucketName, relativePath, generationId); } checkArgument(generationId == UNKNOWN_GENERATION_ID, "Cannot specify generationId '%s' for bucket '%s'", generationId, objectName); return new StorageResourceId(bucketName); }
java
public static StorageResourceId fromObjectName(String objectName, long generationId) { Matcher matcher = OBJECT_NAME_IN_GCS_PATTERN.matcher(objectName); checkArgument(matcher.matches(), "'%s' is not a valid GCS object name.", objectName); String bucketName = matcher.group(2); String relativePath = matcher.group(4); if (bucketName == null) { checkArgument(generationId == UNKNOWN_GENERATION_ID, "Cannot specify generationId '%s' for root object '%s'", generationId, objectName); return ROOT; } else if (relativePath != null) { return new StorageResourceId(bucketName, relativePath, generationId); } checkArgument(generationId == UNKNOWN_GENERATION_ID, "Cannot specify generationId '%s' for bucket '%s'", generationId, objectName); return new StorageResourceId(bucketName); }
[ "public", "static", "StorageResourceId", "fromObjectName", "(", "String", "objectName", ",", "long", "generationId", ")", "{", "Matcher", "matcher", "=", "OBJECT_NAME_IN_GCS_PATTERN", ".", "matcher", "(", "objectName", ")", ";", "checkArgument", "(", "matcher", ".",...
Parses {@link StorageResourceId} from specified string and generationId.
[ "Parses", "{" ]
train
https://github.com/GoogleCloudPlatform/bigdata-interop/blob/918d91c80a63e36046edb28972a5c65d3326a858/gcsio/src/main/java/com/google/cloud/hadoop/gcsio/StorageResourceId.java#L280-L296
apache/groovy
subprojects/groovy-nio/src/main/java/org/codehaus/groovy/runtime/NioGroovyMethods.java
NioGroovyMethods.eachByte
public static void eachByte(Path self, int bufferLen, @ClosureParams(value = FromString.class, options = "byte[],Integer") Closure closure) throws IOException { BufferedInputStream is = newInputStream(self); IOGroovyMethods.eachByte(is, bufferLen, closure); }
java
public static void eachByte(Path self, int bufferLen, @ClosureParams(value = FromString.class, options = "byte[],Integer") Closure closure) throws IOException { BufferedInputStream is = newInputStream(self); IOGroovyMethods.eachByte(is, bufferLen, closure); }
[ "public", "static", "void", "eachByte", "(", "Path", "self", ",", "int", "bufferLen", ",", "@", "ClosureParams", "(", "value", "=", "FromString", ".", "class", ",", "options", "=", "\"byte[],Integer\"", ")", "Closure", "closure", ")", "throws", "IOException", ...
Traverse through the bytes of this Path, bufferLen bytes at a time. @param self a Path @param bufferLen the length of the buffer to use. @param closure a 2 parameter closure which is passed the byte[] and a number of bytes successfully read. @throws java.io.IOException if an IOException occurs. @see org.codehaus.groovy.runtime.IOGroovyMethods#eachByte(java.io.InputStream, int, groovy.lang.Closure) @since 2.3.0
[ "Traverse", "through", "the", "bytes", "of", "this", "Path", "bufferLen", "bytes", "at", "a", "time", "." ]
train
https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/subprojects/groovy-nio/src/main/java/org/codehaus/groovy/runtime/NioGroovyMethods.java#L1830-L1833
nguyenq/tess4j
src/main/java/net/sourceforge/tess4j/util/ImageIOHelper.java
ImageIOHelper.mergeTiff
public static void mergeTiff(List<IIOImage> imageList, File outputTiff) throws IOException { mergeTiff(imageList, outputTiff, null); }
java
public static void mergeTiff(List<IIOImage> imageList, File outputTiff) throws IOException { mergeTiff(imageList, outputTiff, null); }
[ "public", "static", "void", "mergeTiff", "(", "List", "<", "IIOImage", ">", "imageList", ",", "File", "outputTiff", ")", "throws", "IOException", "{", "mergeTiff", "(", "imageList", ",", "outputTiff", ",", "null", ")", ";", "}" ]
Merges multiple images into one multi-page TIFF image. @param imageList a list of <code>IIOImage</code> objects @param outputTiff the output TIFF file @throws IOException
[ "Merges", "multiple", "images", "into", "one", "multi", "-", "page", "TIFF", "image", "." ]
train
https://github.com/nguyenq/tess4j/blob/cfcd4a8a44042f150b4aaf7bdf5ffc485a2236e1/src/main/java/net/sourceforge/tess4j/util/ImageIOHelper.java#L534-L536
b3dgs/lionengine
lionengine-core-awt/src/main/java/com/b3dgs/lionengine/awt/graphic/ToolsAwt.java
ToolsAwt.createHiddenCursor
public static Cursor createHiddenCursor() { final Toolkit toolkit = Toolkit.getDefaultToolkit(); final Dimension dim = toolkit.getBestCursorSize(1, 1); final BufferedImage c = createImage(Math.max(1, dim.width), Math.max(1, dim.height), java.awt.Transparency.BITMASK); final BufferedImage buffer = applyMask(c, Color.BLACK.getRGB()); return toolkit.createCustomCursor(buffer, new Point(0, 0), "hiddenCursor"); }
java
public static Cursor createHiddenCursor() { final Toolkit toolkit = Toolkit.getDefaultToolkit(); final Dimension dim = toolkit.getBestCursorSize(1, 1); final BufferedImage c = createImage(Math.max(1, dim.width), Math.max(1, dim.height), java.awt.Transparency.BITMASK); final BufferedImage buffer = applyMask(c, Color.BLACK.getRGB()); return toolkit.createCustomCursor(buffer, new Point(0, 0), "hiddenCursor"); }
[ "public", "static", "Cursor", "createHiddenCursor", "(", ")", "{", "final", "Toolkit", "toolkit", "=", "Toolkit", ".", "getDefaultToolkit", "(", ")", ";", "final", "Dimension", "dim", "=", "toolkit", ".", "getBestCursorSize", "(", "1", ",", "1", ")", ";", ...
Create a hidden cursor. @return Hidden cursor, or default cursor if not able to create it.
[ "Create", "a", "hidden", "cursor", "." ]
train
https://github.com/b3dgs/lionengine/blob/cac3d5578532cf11724a737b9f09e71bf9995ab2/lionengine-core-awt/src/main/java/com/b3dgs/lionengine/awt/graphic/ToolsAwt.java#L364-L373
BioPAX/Paxtools
pattern/src/main/java/org/biopax/paxtools/pattern/constraint/ModificationChangeConstraint.java
ModificationChangeConstraint.satisfies
@Override public boolean satisfies(Match match, int... ind) { PhysicalEntity pe1 = (PhysicalEntity) match.get(ind[0]); PhysicalEntity pe2 = (PhysicalEntity) match.get(ind[1]); Set<ModificationFeature>[] mods = DifferentialModificationUtil.getChangedModifications(pe1, pe2); Set<String> terms; if (type == Type.GAIN) terms = collectTerms(mods[0]); else if (type == Type.LOSS) terms = collectTerms(mods[1]); else terms = collectTerms(mods); return termsContainDesired(terms); }
java
@Override public boolean satisfies(Match match, int... ind) { PhysicalEntity pe1 = (PhysicalEntity) match.get(ind[0]); PhysicalEntity pe2 = (PhysicalEntity) match.get(ind[1]); Set<ModificationFeature>[] mods = DifferentialModificationUtil.getChangedModifications(pe1, pe2); Set<String> terms; if (type == Type.GAIN) terms = collectTerms(mods[0]); else if (type == Type.LOSS) terms = collectTerms(mods[1]); else terms = collectTerms(mods); return termsContainDesired(terms); }
[ "@", "Override", "public", "boolean", "satisfies", "(", "Match", "match", ",", "int", "...", "ind", ")", "{", "PhysicalEntity", "pe1", "=", "(", "PhysicalEntity", ")", "match", ".", "get", "(", "ind", "[", "0", "]", ")", ";", "PhysicalEntity", "pe2", "...
Checks the any of the changed modifications match to any of the desired modifications. @param match current pattern match @param ind mapped indices @return true if a modification change is among desired modifications
[ "Checks", "the", "any", "of", "the", "changed", "modifications", "match", "to", "any", "of", "the", "desired", "modifications", "." ]
train
https://github.com/BioPAX/Paxtools/blob/2f93afa94426bf8b5afc2e0e61cd4b269a83288d/pattern/src/main/java/org/biopax/paxtools/pattern/constraint/ModificationChangeConstraint.java#L59-L75
TheHortonMachine/hortonmachine
gears/src/main/java/oms3/io/DataIO.java
DataIO.getProperties
public static AbstractTableModel getProperties(final CSProperties p) { return new AbstractTableModel() { @Override public int getRowCount() { return p.keySet().size(); } @Override public int getColumnCount() { return 2; } @Override public Object getValueAt(int rowIndex, int columnIndex) { if (columnIndex == 0) { return " " + p.keySet().toArray()[rowIndex]; } else { return p.values().toArray()[rowIndex]; } } @Override public boolean isCellEditable(int rowIndex, int columnIndex) { return columnIndex == 1; } @Override public void setValueAt(Object aValue, int rowIndex, int columnIndex) { if (columnIndex == 1) { String[] keys = p.keySet().toArray(new String[0]); p.put(keys[rowIndex], aValue.toString()); } } @Override public String getColumnName(int column) { return column == 0 ? "Name" : "Value"; } @Override public Class<?> getColumnClass(int columnIndex) { return String.class; } }; }
java
public static AbstractTableModel getProperties(final CSProperties p) { return new AbstractTableModel() { @Override public int getRowCount() { return p.keySet().size(); } @Override public int getColumnCount() { return 2; } @Override public Object getValueAt(int rowIndex, int columnIndex) { if (columnIndex == 0) { return " " + p.keySet().toArray()[rowIndex]; } else { return p.values().toArray()[rowIndex]; } } @Override public boolean isCellEditable(int rowIndex, int columnIndex) { return columnIndex == 1; } @Override public void setValueAt(Object aValue, int rowIndex, int columnIndex) { if (columnIndex == 1) { String[] keys = p.keySet().toArray(new String[0]); p.put(keys[rowIndex], aValue.toString()); } } @Override public String getColumnName(int column) { return column == 0 ? "Name" : "Value"; } @Override public Class<?> getColumnClass(int columnIndex) { return String.class; } }; }
[ "public", "static", "AbstractTableModel", "getProperties", "(", "final", "CSProperties", "p", ")", "{", "return", "new", "AbstractTableModel", "(", ")", "{", "@", "Override", "public", "int", "getRowCount", "(", ")", "{", "return", "p", ".", "keySet", "(", "...
Get the KVP as table. @param p @return an AbstractTableModel for properties (KVP)
[ "Get", "the", "KVP", "as", "table", "." ]
train
https://github.com/TheHortonMachine/hortonmachine/blob/d2b436bbdf951dc1fda56096a42dbc0eae4d35a5/gears/src/main/java/oms3/io/DataIO.java#L555-L601
biojava/biojava
biojava-structure/src/main/java/org/biojava/nbio/structure/geometry/UnitQuaternions.java
UnitQuaternions.relativeOrientation
public static Quat4d relativeOrientation(Point3d[] fixed, Point3d[] moved) { Matrix m = CalcPoint.formMatrix(moved, fixed); // inverse EigenvalueDecomposition eig = m.eig(); double[][] v = eig.getV().getArray(); Quat4d q = new Quat4d(v[1][3], v[2][3], v[3][3], v[0][3]); q.normalize(); q.conjugate(); return q; }
java
public static Quat4d relativeOrientation(Point3d[] fixed, Point3d[] moved) { Matrix m = CalcPoint.formMatrix(moved, fixed); // inverse EigenvalueDecomposition eig = m.eig(); double[][] v = eig.getV().getArray(); Quat4d q = new Quat4d(v[1][3], v[2][3], v[3][3], v[0][3]); q.normalize(); q.conjugate(); return q; }
[ "public", "static", "Quat4d", "relativeOrientation", "(", "Point3d", "[", "]", "fixed", ",", "Point3d", "[", "]", "moved", ")", "{", "Matrix", "m", "=", "CalcPoint", ".", "formMatrix", "(", "moved", ",", "fixed", ")", ";", "// inverse", "EigenvalueDecomposit...
Calculate the relative quaternion orientation of two arrays of points. @param fixed point array, coordinates will not be modified @param moved point array, coordinates will not be modified @return a unit quaternion representing the relative orientation, to rotate moved to bring it to the same orientation as fixed.
[ "Calculate", "the", "relative", "quaternion", "orientation", "of", "two", "arrays", "of", "points", "." ]
train
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure/src/main/java/org/biojava/nbio/structure/geometry/UnitQuaternions.java#L199-L207
deeplearning4j/deeplearning4j
nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/autodiff/samediff/ops/SDMath.java
SDMath.jaccardDistance
public SDVariable jaccardDistance(SDVariable x, SDVariable y, int... dimensions) { return jaccardDistance(null, x, y, dimensions); }
java
public SDVariable jaccardDistance(SDVariable x, SDVariable y, int... dimensions) { return jaccardDistance(null, x, y, dimensions); }
[ "public", "SDVariable", "jaccardDistance", "(", "SDVariable", "x", ",", "SDVariable", "y", ",", "int", "...", "dimensions", ")", "{", "return", "jaccardDistance", "(", "null", ",", "x", ",", "y", ",", "dimensions", ")", ";", "}" ]
Jaccard similarity reduction operation. The output contains the Jaccard distance for each tensor along the specified dimensions. @param x Input variable x @param y Input variable y @param dimensions Dimensions to calculate Jaccard similarity over @return Output variable
[ "Jaccard", "similarity", "reduction", "operation", ".", "The", "output", "contains", "the", "Jaccard", "distance", "for", "each", "tensor", "along", "the", "specified", "dimensions", "." ]
train
https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/autodiff/samediff/ops/SDMath.java#L1446-L1448
craftercms/deployer
src/main/java/org/craftercms/deployer/utils/ConfigUtils.java
ConfigUtils.getLongProperty
public static Long getLongProperty(Configuration config, String key, Long defaultValue) throws DeployerConfigurationException { try { return config.getLong(key, defaultValue); } catch (Exception e) { throw new DeployerConfigurationException("Failed to retrieve property '" + key + "'", e); } }
java
public static Long getLongProperty(Configuration config, String key, Long defaultValue) throws DeployerConfigurationException { try { return config.getLong(key, defaultValue); } catch (Exception e) { throw new DeployerConfigurationException("Failed to retrieve property '" + key + "'", e); } }
[ "public", "static", "Long", "getLongProperty", "(", "Configuration", "config", ",", "String", "key", ",", "Long", "defaultValue", ")", "throws", "DeployerConfigurationException", "{", "try", "{", "return", "config", ".", "getLong", "(", "key", ",", "defaultValue",...
Returns the specified Long property from the configuration @param config the configuration @param key the key of the property @param defaultValue the default value if the property is not found @return the Long value of the property, or the default value if not found @throws DeployerConfigurationException if an error occurred
[ "Returns", "the", "specified", "Long", "property", "from", "the", "configuration" ]
train
https://github.com/craftercms/deployer/blob/3ed446e3cc8af1055de2de6f871907f90ef27f63/src/main/java/org/craftercms/deployer/utils/ConfigUtils.java#L213-L220
BorderTech/wcomponents
wcomponents-core/src/main/java/com/github/bordertech/wcomponents/SelectListUtil.java
SelectListUtil.isEqualWithMatching
private static boolean isEqualWithMatching(final Object option, final Object data) { return Util.equals(option, data) || isOptionCodeMatch(option, data) || isLegacyMatch(option, data); }
java
private static boolean isEqualWithMatching(final Object option, final Object data) { return Util.equals(option, data) || isOptionCodeMatch(option, data) || isLegacyMatch(option, data); }
[ "private", "static", "boolean", "isEqualWithMatching", "(", "final", "Object", "option", ",", "final", "Object", "data", ")", "{", "return", "Util", ".", "equals", "(", "option", ",", "data", ")", "||", "isOptionCodeMatch", "(", "option", ",", "data", ")", ...
Check for a valid option. Allowing for option/code and legacy matching. @param option the option to test for a match @param data the test data value @return true if the option and data are a match
[ "Check", "for", "a", "valid", "option", ".", "Allowing", "for", "option", "/", "code", "and", "legacy", "matching", "." ]
train
https://github.com/BorderTech/wcomponents/blob/d1a2b2243270067db030feb36ca74255aaa94436/wcomponents-core/src/main/java/com/github/bordertech/wcomponents/SelectListUtil.java#L162-L165
taimos/RESTUtils
src/main/java/de/taimos/restutils/RESTAssert.java
RESTAssert.assertInt
public static void assertInt(final String string, final StatusType status) { RESTAssert.assertNotEmpty(string); RESTAssert.assertPattern(string, "[+-]?[0-9]*", status); }
java
public static void assertInt(final String string, final StatusType status) { RESTAssert.assertNotEmpty(string); RESTAssert.assertPattern(string, "[+-]?[0-9]*", status); }
[ "public", "static", "void", "assertInt", "(", "final", "String", "string", ",", "final", "StatusType", "status", ")", "{", "RESTAssert", ".", "assertNotEmpty", "(", "string", ")", ";", "RESTAssert", ".", "assertPattern", "(", "string", ",", "\"[+-]?[0-9]*\"", ...
assert that string matches [+-]?[0-9]* @param string the string to check @param status the status code to throw @throws WebApplicationException with given status code
[ "assert", "that", "string", "matches", "[", "+", "-", "]", "?", "[", "0", "-", "9", "]", "*" ]
train
https://github.com/taimos/RESTUtils/blob/bdb1bf9a2eb13ede0eec6f071c10cb2698313501/src/main/java/de/taimos/restutils/RESTAssert.java#L277-L280
VoltDB/voltdb
examples/json-sessions/client/jsonsessions/JSONClient.java
JSONClient.runQuery
private VoltTable runQuery(String description, String SQL) throws Exception { System.out.println(description); ClientResponse resp = client.callProcedure("@AdHoc", SQL); System.out.println("SQL query: " + SQL); System.out.println(); VoltTable table = resp.getResults()[0]; System.out.println(table.toFormattedString()); System.out.println(); return table; }
java
private VoltTable runQuery(String description, String SQL) throws Exception { System.out.println(description); ClientResponse resp = client.callProcedure("@AdHoc", SQL); System.out.println("SQL query: " + SQL); System.out.println(); VoltTable table = resp.getResults()[0]; System.out.println(table.toFormattedString()); System.out.println(); return table; }
[ "private", "VoltTable", "runQuery", "(", "String", "description", ",", "String", "SQL", ")", "throws", "Exception", "{", "System", ".", "out", ".", "println", "(", "description", ")", ";", "ClientResponse", "resp", "=", "client", ".", "callProcedure", "(", "...
Demonstrates various JSON/flexible schema queries. @throws Exception if anything unexpected happens.
[ "Demonstrates", "various", "JSON", "/", "flexible", "schema", "queries", "." ]
train
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/examples/json-sessions/client/jsonsessions/JSONClient.java#L370-L379
GoogleCloudPlatform/bigdata-interop
gcsio/src/main/java/com/google/cloud/hadoop/gcsio/GoogleCloudStorageImpl.java
GoogleCloudStorageImpl.createItemInfoForStorageObject
public static GoogleCloudStorageItemInfo createItemInfoForStorageObject( StorageResourceId resourceId, StorageObject object) { Preconditions.checkArgument(resourceId != null, "resourceId must not be null"); Preconditions.checkArgument(object != null, "object must not be null"); Preconditions.checkArgument( resourceId.isStorageObject(), "resourceId must be a StorageObject. resourceId: %s", resourceId); Preconditions.checkArgument( resourceId.getBucketName().equals(object.getBucket()), "resourceId.getBucketName() must equal object.getBucket(): '%s' vs '%s'", resourceId.getBucketName(), object.getBucket()); Preconditions.checkArgument( resourceId.getObjectName().equals(object.getName()), "resourceId.getObjectName() must equal object.getName(): '%s' vs '%s'", resourceId.getObjectName(), object.getName()); Map<String, byte[]> decodedMetadata = object.getMetadata() == null ? null : decodeMetadata(object.getMetadata()); byte[] md5Hash = null; byte[] crc32c = null; if (!Strings.isNullOrEmpty(object.getCrc32c())) { crc32c = BaseEncoding.base64().decode(object.getCrc32c()); } if (!Strings.isNullOrEmpty(object.getMd5Hash())) { md5Hash = BaseEncoding.base64().decode(object.getMd5Hash()); } // GCS API does not make available location and storage class at object level at present // (it is same for all objects in a bucket). Further, we do not use the values for objects. // The GoogleCloudStorageItemInfo thus has 'null' for location and storage class. return new GoogleCloudStorageItemInfo( resourceId, object.getUpdated().getValue(), object.getSize().longValue(), /* location= */ null, /* storageClass= */ null, object.getContentType(), object.getContentEncoding(), decodedMetadata, object.getGeneration(), object.getMetageneration(), new VerificationAttributes(md5Hash, crc32c)); }
java
public static GoogleCloudStorageItemInfo createItemInfoForStorageObject( StorageResourceId resourceId, StorageObject object) { Preconditions.checkArgument(resourceId != null, "resourceId must not be null"); Preconditions.checkArgument(object != null, "object must not be null"); Preconditions.checkArgument( resourceId.isStorageObject(), "resourceId must be a StorageObject. resourceId: %s", resourceId); Preconditions.checkArgument( resourceId.getBucketName().equals(object.getBucket()), "resourceId.getBucketName() must equal object.getBucket(): '%s' vs '%s'", resourceId.getBucketName(), object.getBucket()); Preconditions.checkArgument( resourceId.getObjectName().equals(object.getName()), "resourceId.getObjectName() must equal object.getName(): '%s' vs '%s'", resourceId.getObjectName(), object.getName()); Map<String, byte[]> decodedMetadata = object.getMetadata() == null ? null : decodeMetadata(object.getMetadata()); byte[] md5Hash = null; byte[] crc32c = null; if (!Strings.isNullOrEmpty(object.getCrc32c())) { crc32c = BaseEncoding.base64().decode(object.getCrc32c()); } if (!Strings.isNullOrEmpty(object.getMd5Hash())) { md5Hash = BaseEncoding.base64().decode(object.getMd5Hash()); } // GCS API does not make available location and storage class at object level at present // (it is same for all objects in a bucket). Further, we do not use the values for objects. // The GoogleCloudStorageItemInfo thus has 'null' for location and storage class. return new GoogleCloudStorageItemInfo( resourceId, object.getUpdated().getValue(), object.getSize().longValue(), /* location= */ null, /* storageClass= */ null, object.getContentType(), object.getContentEncoding(), decodedMetadata, object.getGeneration(), object.getMetageneration(), new VerificationAttributes(md5Hash, crc32c)); }
[ "public", "static", "GoogleCloudStorageItemInfo", "createItemInfoForStorageObject", "(", "StorageResourceId", "resourceId", ",", "StorageObject", "object", ")", "{", "Preconditions", ".", "checkArgument", "(", "resourceId", "!=", "null", ",", "\"resourceId must not be null\""...
Helper for converting a StorageResourceId + StorageObject into a GoogleCloudStorageItemInfo.
[ "Helper", "for", "converting", "a", "StorageResourceId", "+", "StorageObject", "into", "a", "GoogleCloudStorageItemInfo", "." ]
train
https://github.com/GoogleCloudPlatform/bigdata-interop/blob/918d91c80a63e36046edb28972a5c65d3326a858/gcsio/src/main/java/com/google/cloud/hadoop/gcsio/GoogleCloudStorageImpl.java#L1470-L1515
cogroo/cogroo4
cogroo-ruta/src/main/java/org/cogroo/ruta/uima/AnnotatorUtil.java
AnnotatorUtil.getType
public static Type getType(TypeSystem typeSystem, String name) throws AnalysisEngineProcessException { Type type = typeSystem.getType(name); if (type == null) { throw new OpenNlpAnnotatorProcessException( ExceptionMessages.TYPE_NOT_FOUND, new Object[] {name}); } return type; }
java
public static Type getType(TypeSystem typeSystem, String name) throws AnalysisEngineProcessException { Type type = typeSystem.getType(name); if (type == null) { throw new OpenNlpAnnotatorProcessException( ExceptionMessages.TYPE_NOT_FOUND, new Object[] {name}); } return type; }
[ "public", "static", "Type", "getType", "(", "TypeSystem", "typeSystem", ",", "String", "name", ")", "throws", "AnalysisEngineProcessException", "{", "Type", "type", "=", "typeSystem", ".", "getType", "(", "name", ")", ";", "if", "(", "type", "==", "null", ")...
Retrieves a type of the given name from the given type system. @param typeSystem @param name @return the type @throws AnalysisEngineProcessException
[ "Retrieves", "a", "type", "of", "the", "given", "name", "from", "the", "given", "type", "system", "." ]
train
https://github.com/cogroo/cogroo4/blob/b6228900c20c6b37eac10a03708a9669dd562f52/cogroo-ruta/src/main/java/org/cogroo/ruta/uima/AnnotatorUtil.java#L50-L61
facebookarchive/hadoop-20
src/mapred/org/apache/hadoop/mapred/SequenceFileInputFilter.java
SequenceFileInputFilter.setFilterClass
public static void setFilterClass(Configuration conf, Class filterClass) { conf.set(FILTER_CLASS, filterClass.getName()); }
java
public static void setFilterClass(Configuration conf, Class filterClass) { conf.set(FILTER_CLASS, filterClass.getName()); }
[ "public", "static", "void", "setFilterClass", "(", "Configuration", "conf", ",", "Class", "filterClass", ")", "{", "conf", ".", "set", "(", "FILTER_CLASS", ",", "filterClass", ".", "getName", "(", ")", ")", ";", "}" ]
set the filter class @param conf application configuration @param filterClass filter class
[ "set", "the", "filter", "class" ]
train
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/mapred/org/apache/hadoop/mapred/SequenceFileInputFilter.java#L73-L75
datasalt/pangool
core/src/main/java/com/datasalt/pangool/tuplemr/MapOnlyJobBuilder.java
MapOnlyJobBuilder.setDefaultNamedOutput
public void setDefaultNamedOutput(OutputFormat outputFormat, Class keyClass, Class valueClass) throws TupleMRException { setDefaultNamedOutput(outputFormat, keyClass, valueClass, null); }
java
public void setDefaultNamedOutput(OutputFormat outputFormat, Class keyClass, Class valueClass) throws TupleMRException { setDefaultNamedOutput(outputFormat, keyClass, valueClass, null); }
[ "public", "void", "setDefaultNamedOutput", "(", "OutputFormat", "outputFormat", ",", "Class", "keyClass", ",", "Class", "valueClass", ")", "throws", "TupleMRException", "{", "setDefaultNamedOutput", "(", "outputFormat", ",", "keyClass", ",", "valueClass", ",", "null",...
Sets the default named output specs. By using this method one can use an arbitrary number of named outputs without pre-defining them beforehand.
[ "Sets", "the", "default", "named", "output", "specs", ".", "By", "using", "this", "method", "one", "can", "use", "an", "arbitrary", "number", "of", "named", "outputs", "without", "pre", "-", "defining", "them", "beforehand", "." ]
train
https://github.com/datasalt/pangool/blob/bfd312dd78cba03febaf7988ae96a3d4bc585408/core/src/main/java/com/datasalt/pangool/tuplemr/MapOnlyJobBuilder.java#L103-L105
lessthanoptimal/BoofCV
main/boofcv-recognition/src/main/java/boofcv/alg/tracker/tld/TldFernClassifier.java
TldFernClassifier.computeFernValue
protected int computeFernValue(float c_x, float c_y, float rectWidth , float rectHeight , TldFernDescription fern ) { rectWidth -= 1; rectHeight -= 1; int desc = 0; for( int i = 0; i < fern.pairs.length; i++ ) { Point2D_F32 p_a = fern.pairs[i].a; Point2D_F32 p_b = fern.pairs[i].b; float valA = interpolate.get_fast(c_x + p_a.x * rectWidth, c_y + p_a.y * rectHeight); float valB = interpolate.get_fast(c_x + p_b.x * rectWidth, c_y + p_b.y * rectHeight); desc *= 2; if( valA < valB ) { desc += 1; } } return desc; }
java
protected int computeFernValue(float c_x, float c_y, float rectWidth , float rectHeight , TldFernDescription fern ) { rectWidth -= 1; rectHeight -= 1; int desc = 0; for( int i = 0; i < fern.pairs.length; i++ ) { Point2D_F32 p_a = fern.pairs[i].a; Point2D_F32 p_b = fern.pairs[i].b; float valA = interpolate.get_fast(c_x + p_a.x * rectWidth, c_y + p_a.y * rectHeight); float valB = interpolate.get_fast(c_x + p_b.x * rectWidth, c_y + p_b.y * rectHeight); desc *= 2; if( valA < valB ) { desc += 1; } } return desc; }
[ "protected", "int", "computeFernValue", "(", "float", "c_x", ",", "float", "c_y", ",", "float", "rectWidth", ",", "float", "rectHeight", ",", "TldFernDescription", "fern", ")", "{", "rectWidth", "-=", "1", ";", "rectHeight", "-=", "1", ";", "int", "desc", ...
Computes the value of the specified fern at the specified location in the image.
[ "Computes", "the", "value", "of", "the", "specified", "fern", "at", "the", "specified", "location", "in", "the", "image", "." ]
train
https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-recognition/src/main/java/boofcv/alg/tracker/tld/TldFernClassifier.java#L206-L227
taimos/dvalin
cloud/aws/src/main/java/de/taimos/dvalin/cloud/aws/CloudFormation.java
CloudFormation.signalReady
public void signalReady(String stackName, String resourceName) { Preconditions.checkArgument(stackName != null && !stackName.isEmpty()); Preconditions.checkArgument(resourceName != null && !resourceName.isEmpty()); SignalResourceRequest req = new SignalResourceRequest(); req.setLogicalResourceId(resourceName); req.setStackName(stackName); req.setStatus(ResourceSignalStatus.SUCCESS); req.setUniqueId(this.ec2Context.getInstanceId()); this.cloudFormationClient.signalResource(req); }
java
public void signalReady(String stackName, String resourceName) { Preconditions.checkArgument(stackName != null && !stackName.isEmpty()); Preconditions.checkArgument(resourceName != null && !resourceName.isEmpty()); SignalResourceRequest req = new SignalResourceRequest(); req.setLogicalResourceId(resourceName); req.setStackName(stackName); req.setStatus(ResourceSignalStatus.SUCCESS); req.setUniqueId(this.ec2Context.getInstanceId()); this.cloudFormationClient.signalResource(req); }
[ "public", "void", "signalReady", "(", "String", "stackName", ",", "String", "resourceName", ")", "{", "Preconditions", ".", "checkArgument", "(", "stackName", "!=", "null", "&&", "!", "stackName", ".", "isEmpty", "(", ")", ")", ";", "Preconditions", ".", "ch...
signal success to the given CloudFormation stack.<br> <br> Needed AWS actions: <ul> <li>cloudformation:SignalResource</li> </ul>
[ "signal", "success", "to", "the", "given", "CloudFormation", "stack", ".", "<br", ">", "<br", ">", "Needed", "AWS", "actions", ":", "<ul", ">", "<li", ">", "cloudformation", ":", "SignalResource<", "/", "li", ">", "<", "/", "ul", ">" ]
train
https://github.com/taimos/dvalin/blob/ff8f1bf594e43d7e8ca8de0b4da9f923b66a1a47/cloud/aws/src/main/java/de/taimos/dvalin/cloud/aws/CloudFormation.java#L53-L62
Baidu-AIP/java-sdk
src/main/java/com/baidu/aip/bodyanalysis/AipBodyAnalysis.java
AipBodyAnalysis.bodyAnalysis
public JSONObject bodyAnalysis(byte[] image, HashMap<String, String> options) { AipRequest request = new AipRequest(); preOperation(request); String base64Content = Base64Util.encode(image); request.addBody("image", base64Content); if (options != null) { request.addBody(options); } request.setUri(BodyAnalysisConsts.BODY_ANALYSIS); postOperation(request); return requestServer(request); }
java
public JSONObject bodyAnalysis(byte[] image, HashMap<String, String> options) { AipRequest request = new AipRequest(); preOperation(request); String base64Content = Base64Util.encode(image); request.addBody("image", base64Content); if (options != null) { request.addBody(options); } request.setUri(BodyAnalysisConsts.BODY_ANALYSIS); postOperation(request); return requestServer(request); }
[ "public", "JSONObject", "bodyAnalysis", "(", "byte", "[", "]", "image", ",", "HashMap", "<", "String", ",", "String", ">", "options", ")", "{", "AipRequest", "request", "=", "new", "AipRequest", "(", ")", ";", "preOperation", "(", "request", ")", ";", "S...
人体关键点识别接口 对于输入的一张图片(可正常解码,且长宽比适宜),**检测图片中的所有人体,输出每个人体的14个主要关键点,包含四肢、脖颈、鼻子等部位,以及人体的坐标信息和数量**。 @param image - 二进制图像数据 @param options - 可选参数对象,key: value都为string类型 options - options列表: @return JSONObject
[ "人体关键点识别接口", "对于输入的一张图片(可正常解码,且长宽比适宜),", "**", "检测图片中的所有人体,输出每个人体的14个主要关键点,包含四肢、脖颈、鼻子等部位,以及人体的坐标信息和数量", "**", "。" ]
train
https://github.com/Baidu-AIP/java-sdk/blob/16bb8b7bb8f9bbcb7c8af62d0a67a1e79eecad90/src/main/java/com/baidu/aip/bodyanalysis/AipBodyAnalysis.java#L48-L60
Ordinastie/MalisisCore
src/main/java/net/malisis/core/block/component/WallComponent.java
WallComponent.isCorner
public static boolean isCorner(IBlockAccess world, BlockPos pos) { return world != null && pos != null ? isCorner(world.getBlockState(pos)) : false; }
java
public static boolean isCorner(IBlockAccess world, BlockPos pos) { return world != null && pos != null ? isCorner(world.getBlockState(pos)) : false; }
[ "public", "static", "boolean", "isCorner", "(", "IBlockAccess", "world", ",", "BlockPos", "pos", ")", "{", "return", "world", "!=", "null", "&&", "pos", "!=", "null", "?", "isCorner", "(", "world", ".", "getBlockState", "(", "pos", ")", ")", ":", "false"...
Gets whether the wall is a corner or not. @param world the world @param pos the pos @return the EnumFacing, null if the block is not {@link DirectionalComponent}
[ "Gets", "whether", "the", "wall", "is", "a", "corner", "or", "not", "." ]
train
https://github.com/Ordinastie/MalisisCore/blob/4f8e1fa462d5c372fc23414482ba9f429881cc54/src/main/java/net/malisis/core/block/component/WallComponent.java#L264-L267
lessthanoptimal/BoofCV
main/boofcv-sfm/src/main/java/boofcv/alg/feature/associate/StereoConsistencyCheck.java
StereoConsistencyCheck.checkRectified
public boolean checkRectified( Point2D_F64 left , Point2D_F64 right ) { // rectifications should make them appear along the same y-coordinate/epipolar line if( Math.abs(left.y - right.y) > toleranceY ) return false; // features in the right camera should appear left of features in the image image return right.x <= left.x + toleranceX; }
java
public boolean checkRectified( Point2D_F64 left , Point2D_F64 right ) { // rectifications should make them appear along the same y-coordinate/epipolar line if( Math.abs(left.y - right.y) > toleranceY ) return false; // features in the right camera should appear left of features in the image image return right.x <= left.x + toleranceX; }
[ "public", "boolean", "checkRectified", "(", "Point2D_F64", "left", ",", "Point2D_F64", "right", ")", "{", "// rectifications should make them appear along the same y-coordinate/epipolar line", "if", "(", "Math", ".", "abs", "(", "left", ".", "y", "-", "right", ".", "y...
Checks to see if the observations from the left and right camera are consistent. Observations are assumed to be in the rectified image pixel coordinates. @param left Left camera observation in rectified pixels @param right Right camera observation in rectified pixels @return true for consistent
[ "Checks", "to", "see", "if", "the", "observations", "from", "the", "left", "and", "right", "camera", "are", "consistent", ".", "Observations", "are", "assumed", "to", "be", "in", "the", "rectified", "image", "pixel", "coordinates", "." ]
train
https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-sfm/src/main/java/boofcv/alg/feature/associate/StereoConsistencyCheck.java#L102-L109
liferay/com-liferay-commerce
commerce-product-service/src/main/java/com/liferay/commerce/product/service/persistence/impl/CPInstancePersistenceImpl.java
CPInstancePersistenceImpl.findByUUID_G
@Override public CPInstance findByUUID_G(String uuid, long groupId) throws NoSuchCPInstanceException { CPInstance cpInstance = fetchByUUID_G(uuid, groupId); if (cpInstance == null) { StringBundler msg = new StringBundler(6); msg.append(_NO_SUCH_ENTITY_WITH_KEY); msg.append("uuid="); msg.append(uuid); msg.append(", groupId="); msg.append(groupId); msg.append("}"); if (_log.isDebugEnabled()) { _log.debug(msg.toString()); } throw new NoSuchCPInstanceException(msg.toString()); } return cpInstance; }
java
@Override public CPInstance findByUUID_G(String uuid, long groupId) throws NoSuchCPInstanceException { CPInstance cpInstance = fetchByUUID_G(uuid, groupId); if (cpInstance == null) { StringBundler msg = new StringBundler(6); msg.append(_NO_SUCH_ENTITY_WITH_KEY); msg.append("uuid="); msg.append(uuid); msg.append(", groupId="); msg.append(groupId); msg.append("}"); if (_log.isDebugEnabled()) { _log.debug(msg.toString()); } throw new NoSuchCPInstanceException(msg.toString()); } return cpInstance; }
[ "@", "Override", "public", "CPInstance", "findByUUID_G", "(", "String", "uuid", ",", "long", "groupId", ")", "throws", "NoSuchCPInstanceException", "{", "CPInstance", "cpInstance", "=", "fetchByUUID_G", "(", "uuid", ",", "groupId", ")", ";", "if", "(", "cpInstan...
Returns the cp instance where uuid = &#63; and groupId = &#63; or throws a {@link NoSuchCPInstanceException} if it could not be found. @param uuid the uuid @param groupId the group ID @return the matching cp instance @throws NoSuchCPInstanceException if a matching cp instance could not be found
[ "Returns", "the", "cp", "instance", "where", "uuid", "=", "&#63", ";", "and", "groupId", "=", "&#63", ";", "or", "throws", "a", "{", "@link", "NoSuchCPInstanceException", "}", "if", "it", "could", "not", "be", "found", "." ]
train
https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-product-service/src/main/java/com/liferay/commerce/product/service/persistence/impl/CPInstancePersistenceImpl.java#L663-L689
undertow-io/undertow
core/src/main/java/io/undertow/predicate/PredicatesHandler.java
PredicatesHandler.addPredicatedHandler
public PredicatesHandler addPredicatedHandler(final Predicate predicate, final HandlerWrapper handlerWrapper) { this.addPredicatedHandler(predicate, handlerWrapper, null); return this; }
java
public PredicatesHandler addPredicatedHandler(final Predicate predicate, final HandlerWrapper handlerWrapper) { this.addPredicatedHandler(predicate, handlerWrapper, null); return this; }
[ "public", "PredicatesHandler", "addPredicatedHandler", "(", "final", "Predicate", "predicate", ",", "final", "HandlerWrapper", "handlerWrapper", ")", "{", "this", ".", "addPredicatedHandler", "(", "predicate", ",", "handlerWrapper", ",", "null", ")", ";", "return", ...
Adds a new predicated handler. <p> @param predicate @param handlerWrapper
[ "Adds", "a", "new", "predicated", "handler", ".", "<p", ">" ]
train
https://github.com/undertow-io/undertow/blob/87de0b856a7a4ba8faf5b659537b9af07b763263/core/src/main/java/io/undertow/predicate/PredicatesHandler.java#L142-L145
stackify/stackify-api-java
src/main/java/com/stackify/api/common/AppIdentityService.java
AppIdentityService.identifyApp
private AppIdentity identifyApp(ApiConfiguration apiConfig) throws IOException, HttpException { // convert to json bytes byte[] jsonBytes = objectMapper.writer().writeValueAsBytes(apiConfig.getEnvDetail()); if (LOGGER.isDebugEnabled()) { LOGGER.debug("IdentifyApp Request: {}", new String(jsonBytes, "UTF-8")); } // post to stackify final HttpClient httpClient = new HttpClient(apiConfig); final String responseString = httpClient.post("/Metrics/IdentifyApp", jsonBytes); LOGGER.debug("IdentifyApp Response: {}", responseString); // deserialize the response and return the app identity ObjectReader jsonReader = objectMapper.reader(new TypeReference<AppIdentity>(){}); AppIdentity identity = jsonReader.readValue(responseString); // make sure it has a valid DeviceAppID before accepting it if (deviceAppIdRequired) { if (identity.getDeviceAppId() == null) { throw new NullPointerException("DeviceAppId is null"); } } // done return identity; }
java
private AppIdentity identifyApp(ApiConfiguration apiConfig) throws IOException, HttpException { // convert to json bytes byte[] jsonBytes = objectMapper.writer().writeValueAsBytes(apiConfig.getEnvDetail()); if (LOGGER.isDebugEnabled()) { LOGGER.debug("IdentifyApp Request: {}", new String(jsonBytes, "UTF-8")); } // post to stackify final HttpClient httpClient = new HttpClient(apiConfig); final String responseString = httpClient.post("/Metrics/IdentifyApp", jsonBytes); LOGGER.debug("IdentifyApp Response: {}", responseString); // deserialize the response and return the app identity ObjectReader jsonReader = objectMapper.reader(new TypeReference<AppIdentity>(){}); AppIdentity identity = jsonReader.readValue(responseString); // make sure it has a valid DeviceAppID before accepting it if (deviceAppIdRequired) { if (identity.getDeviceAppId() == null) { throw new NullPointerException("DeviceAppId is null"); } } // done return identity; }
[ "private", "AppIdentity", "identifyApp", "(", "ApiConfiguration", "apiConfig", ")", "throws", "IOException", ",", "HttpException", "{", "// convert to json bytes", "byte", "[", "]", "jsonBytes", "=", "objectMapper", ".", "writer", "(", ")", ".", "writeValueAsBytes", ...
Retrieves the application identity given the environment details @return The application identity @throws IOException @throws HttpException
[ "Retrieves", "the", "application", "identity", "given", "the", "environment", "details" ]
train
https://github.com/stackify/stackify-api-java/blob/d3000b7c87ed53a88b302939b0c88405d63d7b67/src/main/java/com/stackify/api/common/AppIdentityService.java#L174-L206
elki-project/elki
elki-core-math/src/main/java/de/lmu/ifi/dbs/elki/math/statistics/distribution/GumbelDistribution.java
GumbelDistribution.logpdf
public static double logpdf(double x, double mu, double beta) { if(x == Double.NEGATIVE_INFINITY) { return Double.NEGATIVE_INFINITY; } final double z = (x - mu) / beta; return -z - FastMath.exp(-z) - FastMath.log(beta); }
java
public static double logpdf(double x, double mu, double beta) { if(x == Double.NEGATIVE_INFINITY) { return Double.NEGATIVE_INFINITY; } final double z = (x - mu) / beta; return -z - FastMath.exp(-z) - FastMath.log(beta); }
[ "public", "static", "double", "logpdf", "(", "double", "x", ",", "double", "mu", ",", "double", "beta", ")", "{", "if", "(", "x", "==", "Double", ".", "NEGATIVE_INFINITY", ")", "{", "return", "Double", ".", "NEGATIVE_INFINITY", ";", "}", "final", "double...
log PDF of Gumbel distribution @param x Value @param mu Mode @param beta Shape @return PDF at position x.
[ "log", "PDF", "of", "Gumbel", "distribution" ]
train
https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki-core-math/src/main/java/de/lmu/ifi/dbs/elki/math/statistics/distribution/GumbelDistribution.java#L130-L136
algolia/instantsearch-android
core/src/main/java/com/algolia/instantsearch/core/helpers/Searcher.java
Searcher.addFacetRefinement
@NonNull @SuppressWarnings({"WeakerAccess", "unused"}) // For library users public Searcher addFacetRefinement(@NonNull String attribute, @NonNull String value) { return addFacetRefinement(attribute, Collections.singletonList(value), disjunctiveFacets.contains(attribute)); }
java
@NonNull @SuppressWarnings({"WeakerAccess", "unused"}) // For library users public Searcher addFacetRefinement(@NonNull String attribute, @NonNull String value) { return addFacetRefinement(attribute, Collections.singletonList(value), disjunctiveFacets.contains(attribute)); }
[ "@", "NonNull", "@", "SuppressWarnings", "(", "{", "\"WeakerAccess\"", ",", "\"unused\"", "}", ")", "// For library users", "public", "Searcher", "addFacetRefinement", "(", "@", "NonNull", "String", "attribute", ",", "@", "NonNull", "String", "value", ")", "{", ...
Adds a facet refinement for the next queries. <p> <b>This method resets the current page to 0.</b> @param attribute the attribute to refine on. @param value the facet's value to refine with. @return this {@link Searcher} for chaining.
[ "Adds", "a", "facet", "refinement", "for", "the", "next", "queries", ".", "<p", ">", "<b", ">", "This", "method", "resets", "the", "current", "page", "to", "0", ".", "<", "/", "b", ">" ]
train
https://github.com/algolia/instantsearch-android/blob/12092ec30140df9ffc2bf916339b433372034616/core/src/main/java/com/algolia/instantsearch/core/helpers/Searcher.java#L547-L551
carewebframework/carewebframework-vista
org.carewebframework.vista.mbroker/src/main/java/org/carewebframework/vista/mbroker/PollingThread.java
PollingThread.getRequest
private Request getRequest(Action action, BrokerSession session) { switch (action) { case QUERY: if (query == null) { query = new Request(action); query.addParameter("UID", session.getId()); } return query; case PING: if (ping == null) { ping = new Request(action); } return ping; default: return null; } }
java
private Request getRequest(Action action, BrokerSession session) { switch (action) { case QUERY: if (query == null) { query = new Request(action); query.addParameter("UID", session.getId()); } return query; case PING: if (ping == null) { ping = new Request(action); } return ping; default: return null; } }
[ "private", "Request", "getRequest", "(", "Action", "action", ",", "BrokerSession", "session", ")", "{", "switch", "(", "action", ")", "{", "case", "QUERY", ":", "if", "(", "query", "==", "null", ")", "{", "query", "=", "new", "Request", "(", "action", ...
Creates a request packet for the specified action. @param action Action to perform. @param session Session receiving the request. @return The fully formed request.
[ "Creates", "a", "request", "packet", "for", "the", "specified", "action", "." ]
train
https://github.com/carewebframework/carewebframework-vista/blob/883b2cbe395d9e8a21cd19db820f0876bda6b1c6/org.carewebframework.vista.mbroker/src/main/java/org/carewebframework/vista/mbroker/PollingThread.java#L129-L149
ModeShape/modeshape
modeshape-jcr/src/main/java/org/modeshape/jcr/spi/index/provider/IndexChangeAdapters.java
IndexChangeAdapters.forNodeLocalName
public static IndexChangeAdapter forNodeLocalName( ExecutionContext context, NodeTypePredicate matcher, String workspaceName, ProvidedIndex<?> index ) { return new NodeLocalNameChangeAdapter(context, matcher, workspaceName, index); }
java
public static IndexChangeAdapter forNodeLocalName( ExecutionContext context, NodeTypePredicate matcher, String workspaceName, ProvidedIndex<?> index ) { return new NodeLocalNameChangeAdapter(context, matcher, workspaceName, index); }
[ "public", "static", "IndexChangeAdapter", "forNodeLocalName", "(", "ExecutionContext", "context", ",", "NodeTypePredicate", "matcher", ",", "String", "workspaceName", ",", "ProvidedIndex", "<", "?", ">", "index", ")", "{", "return", "new", "NodeLocalNameChangeAdapter", ...
Create an {@link IndexChangeAdapter} implementation that handles the "mode:localName" property. @param context the execution context; may not be null @param matcher the node type matcher used to determine which nodes should be included in the index; may not be null @param workspaceName the name of the workspace; may not be null @param index the local index that should be used; may not be null @return the new {@link IndexChangeAdapter}; never null
[ "Create", "an", "{", "@link", "IndexChangeAdapter", "}", "implementation", "that", "handles", "the", "mode", ":", "localName", "property", "." ]
train
https://github.com/ModeShape/modeshape/blob/794cfdabb67a90f24629c4fff0424a6125f8f95b/modeshape-jcr/src/main/java/org/modeshape/jcr/spi/index/provider/IndexChangeAdapters.java#L112-L117
UrielCh/ovh-java-sdk
ovh-java-sdk-cloud/src/main/java/net/minidev/ovh/api/ApiOvhCloud.java
ApiOvhCloud.project_serviceName_consumption_GET
public OvhProjectUsage project_serviceName_consumption_GET(String serviceName, Date from, Date to) throws IOException { String qPath = "/cloud/project/{serviceName}/consumption"; StringBuilder sb = path(qPath, serviceName); query(sb, "from", from); query(sb, "to", to); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, OvhProjectUsage.class); }
java
public OvhProjectUsage project_serviceName_consumption_GET(String serviceName, Date from, Date to) throws IOException { String qPath = "/cloud/project/{serviceName}/consumption"; StringBuilder sb = path(qPath, serviceName); query(sb, "from", from); query(sb, "to", to); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, OvhProjectUsage.class); }
[ "public", "OvhProjectUsage", "project_serviceName_consumption_GET", "(", "String", "serviceName", ",", "Date", "from", ",", "Date", "to", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/cloud/project/{serviceName}/consumption\"", ";", "StringBuilder", "sb",...
Get your project consumption REST: GET /cloud/project/{serviceName}/consumption @param to [required] Get usage to @param from [required] Get usage from @param serviceName [required] The project id
[ "Get", "your", "project", "consumption" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-cloud/src/main/java/net/minidev/ovh/api/ApiOvhCloud.java#L946-L953
hibernate/hibernate-ogm
core/src/main/java/org/hibernate/ogm/model/spi/Association.java
Association.put
public void put(RowKey key, Tuple value) { // instead of setting it to null, core must use remove Contracts.assertNotNull( value, "association.put value" ); currentState.put( key, new AssociationOperation( key, value, PUT ) ); }
java
public void put(RowKey key, Tuple value) { // instead of setting it to null, core must use remove Contracts.assertNotNull( value, "association.put value" ); currentState.put( key, new AssociationOperation( key, value, PUT ) ); }
[ "public", "void", "put", "(", "RowKey", "key", ",", "Tuple", "value", ")", "{", "// instead of setting it to null, core must use remove", "Contracts", ".", "assertNotNull", "(", "value", ",", "\"association.put value\"", ")", ";", "currentState", ".", "put", "(", "k...
Adds the given row to this association, using the given row key. The row must not be null, use the {@link org.hibernate.ogm.model.spi.Association#remove(org.hibernate.ogm.model.key.spi.RowKey)} operation instead. @param key the key to store the row under @param value the association row to store
[ "Adds", "the", "given", "row", "to", "this", "association", "using", "the", "given", "row", "key", ".", "The", "row", "must", "not", "be", "null", "use", "the", "{", "@link", "org", ".", "hibernate", ".", "ogm", ".", "model", ".", "spi", ".", "Associ...
train
https://github.com/hibernate/hibernate-ogm/blob/9ea971df7c27277029006a6f748d8272fb1d69d2/core/src/main/java/org/hibernate/ogm/model/spi/Association.java#L85-L89
optimaize/anythingworks
client/common/src/main/java/com/optimaize/anythingworks/client/common/host/PriorityHostProvider.java
PriorityHostProvider.addHost
public synchronized boolean addHost(@NotNull Host host, int priority) throws UnsupportedOperationException { ProviderWithPrio provider = getProviderContainingHost(host); if (provider!=null) { if (provider.prio == priority) { return false; //already have it } else { removeHost(host); } } IteratingHostProvider iteratingHostProvider = hosts.get(priority); if (iteratingHostProvider==null) { iteratingHostProvider = new IteratingHostProvider(); hosts.put(priority, iteratingHostProvider); priorities.add(priority); } iteratingHostProvider.addHost(host); return true; }
java
public synchronized boolean addHost(@NotNull Host host, int priority) throws UnsupportedOperationException { ProviderWithPrio provider = getProviderContainingHost(host); if (provider!=null) { if (provider.prio == priority) { return false; //already have it } else { removeHost(host); } } IteratingHostProvider iteratingHostProvider = hosts.get(priority); if (iteratingHostProvider==null) { iteratingHostProvider = new IteratingHostProvider(); hosts.put(priority, iteratingHostProvider); priorities.add(priority); } iteratingHostProvider.addHost(host); return true; }
[ "public", "synchronized", "boolean", "addHost", "(", "@", "NotNull", "Host", "host", ",", "int", "priority", ")", "throws", "UnsupportedOperationException", "{", "ProviderWithPrio", "provider", "=", "getProviderContainingHost", "(", "host", ")", ";", "if", "(", "p...
Adds the host with the given priority. <p>If the host is here already but with another priority then the prio will be changed, and true is returned.</p> <p>Multiple hosts may have the same priority, and are used alternately.</p> @param priority The higher the more important.
[ "Adds", "the", "host", "with", "the", "given", "priority", ".", "<p", ">", "If", "the", "host", "is", "here", "already", "but", "with", "another", "priority", "then", "the", "prio", "will", "be", "changed", "and", "true", "is", "returned", ".", "<", "/...
train
https://github.com/optimaize/anythingworks/blob/23e5f1c63cd56d935afaac4ad033c7996b32a1f2/client/common/src/main/java/com/optimaize/anythingworks/client/common/host/PriorityHostProvider.java#L91-L108
apollographql/apollo-android
apollo-api/src/main/java/com/apollographql/apollo/api/ResponseField.java
ResponseField.forFragment
public static ResponseField forFragment(String responseName, String fieldName, List<String> typeConditions) { List<Condition> conditions = new ArrayList<>(typeConditions.size()); for (String typeCondition : typeConditions) { conditions.add(Condition.typeCondition(typeCondition)); } return new ResponseField(Type.FRAGMENT, responseName, fieldName, Collections.<String, Object>emptyMap(), false, conditions); }
java
public static ResponseField forFragment(String responseName, String fieldName, List<String> typeConditions) { List<Condition> conditions = new ArrayList<>(typeConditions.size()); for (String typeCondition : typeConditions) { conditions.add(Condition.typeCondition(typeCondition)); } return new ResponseField(Type.FRAGMENT, responseName, fieldName, Collections.<String, Object>emptyMap(), false, conditions); }
[ "public", "static", "ResponseField", "forFragment", "(", "String", "responseName", ",", "String", "fieldName", ",", "List", "<", "String", ">", "typeConditions", ")", "{", "List", "<", "Condition", ">", "conditions", "=", "new", "ArrayList", "<>", "(", "typeCo...
Factory method for creating a Field instance representing {@link Type#FRAGMENT}. @param responseName alias for the result of a field @param fieldName name of the field in the GraphQL operation @param typeConditions conditional GraphQL types @return Field instance representing {@link Type#FRAGMENT}
[ "Factory", "method", "for", "creating", "a", "Field", "instance", "representing", "{", "@link", "Type#FRAGMENT", "}", "." ]
train
https://github.com/apollographql/apollo-android/blob/a78869a76e17f77e42c7a88f0099914fe7ffa5b6/apollo-api/src/main/java/com/apollographql/apollo/api/ResponseField.java#L174-L181
dain/leveldb
leveldb/src/main/java/org/iq80/leveldb/util/Slice.java
Slice.setInt
public void setInt(int index, int value) { checkPositionIndexes(index, index + SIZE_OF_INT, this.length); index += offset; data[index] = (byte) (value); data[index + 1] = (byte) (value >>> 8); data[index + 2] = (byte) (value >>> 16); data[index + 3] = (byte) (value >>> 24); }
java
public void setInt(int index, int value) { checkPositionIndexes(index, index + SIZE_OF_INT, this.length); index += offset; data[index] = (byte) (value); data[index + 1] = (byte) (value >>> 8); data[index + 2] = (byte) (value >>> 16); data[index + 3] = (byte) (value >>> 24); }
[ "public", "void", "setInt", "(", "int", "index", ",", "int", "value", ")", "{", "checkPositionIndexes", "(", "index", ",", "index", "+", "SIZE_OF_INT", ",", "this", ".", "length", ")", ";", "index", "+=", "offset", ";", "data", "[", "index", "]", "=", ...
Sets the specified 32-bit integer at the specified absolute {@code index} in this buffer. @throws IndexOutOfBoundsException if the specified {@code index} is less than {@code 0} or {@code index + 4} is greater than {@code this.capacity}
[ "Sets", "the", "specified", "32", "-", "bit", "integer", "at", "the", "specified", "absolute", "{", "@code", "index", "}", "in", "this", "buffer", "." ]
train
https://github.com/dain/leveldb/blob/7994065b48eada2ef29e7fefd172c2ad1e0110eb/leveldb/src/main/java/org/iq80/leveldb/util/Slice.java#L309-L317
Swagger2Markup/swagger2markup
src/main/java/io/github/swagger2markup/internal/component/PathOperationComponent.java
PathOperationComponent.addInlineDefinitionTitle
private void addInlineDefinitionTitle(MarkupDocBuilder markupDocBuilder, String title, String anchor) { markupDocBuilder.anchor(anchor); markupDocBuilder.newLine(); markupDocBuilder.boldTextLine(title); }
java
private void addInlineDefinitionTitle(MarkupDocBuilder markupDocBuilder, String title, String anchor) { markupDocBuilder.anchor(anchor); markupDocBuilder.newLine(); markupDocBuilder.boldTextLine(title); }
[ "private", "void", "addInlineDefinitionTitle", "(", "MarkupDocBuilder", "markupDocBuilder", ",", "String", "title", ",", "String", "anchor", ")", "{", "markupDocBuilder", ".", "anchor", "(", "anchor", ")", ";", "markupDocBuilder", ".", "newLine", "(", ")", ";", ...
Builds the title of an inline schema. Inline definitions should never been referenced in TOC because they have no real existence, so they are just text. @param title inline schema title @param anchor inline schema anchor
[ "Builds", "the", "title", "of", "an", "inline", "schema", ".", "Inline", "definitions", "should", "never", "been", "referenced", "in", "TOC", "because", "they", "have", "no", "real", "existence", "so", "they", "are", "just", "text", "." ]
train
https://github.com/Swagger2Markup/swagger2markup/blob/da83465f19a2f8a0f1fba873b5762bca8587896b/src/main/java/io/github/swagger2markup/internal/component/PathOperationComponent.java#L257-L261
Azure/azure-sdk-for-java
appservice/resource-manager/v2016_03_01/src/main/java/com/microsoft/azure/management/appservice/v2016_03_01/implementation/DiagnosticsInner.java
DiagnosticsInner.getSiteDetectorResponseSlot
public DetectorResponseInner getSiteDetectorResponseSlot(String resourceGroupName, String siteName, String detectorName, String slot) { return getSiteDetectorResponseSlotWithServiceResponseAsync(resourceGroupName, siteName, detectorName, slot).toBlocking().single().body(); }
java
public DetectorResponseInner getSiteDetectorResponseSlot(String resourceGroupName, String siteName, String detectorName, String slot) { return getSiteDetectorResponseSlotWithServiceResponseAsync(resourceGroupName, siteName, detectorName, slot).toBlocking().single().body(); }
[ "public", "DetectorResponseInner", "getSiteDetectorResponseSlot", "(", "String", "resourceGroupName", ",", "String", "siteName", ",", "String", "detectorName", ",", "String", "slot", ")", "{", "return", "getSiteDetectorResponseSlotWithServiceResponseAsync", "(", "resourceGrou...
Get site detector response. Get site detector response. @param resourceGroupName Name of the resource group to which the resource belongs. @param siteName Site Name @param detectorName Detector Resource Name @param slot Slot Name @throws IllegalArgumentException thrown if parameters fail the validation @throws CloudException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent @return the DetectorResponseInner object if successful.
[ "Get", "site", "detector", "response", ".", "Get", "site", "detector", "response", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/appservice/resource-manager/v2016_03_01/src/main/java/com/microsoft/azure/management/appservice/v2016_03_01/implementation/DiagnosticsInner.java#L2182-L2184
lessthanoptimal/ejml
main/ejml-ddense/src/org/ejml/dense/row/CommonOps_DDRM.java
CommonOps_DDRM.multAdd
public static void multAdd(double alpha , DMatrix1Row a , DMatrix1Row b , DMatrix1Row c ) { // TODO add a matrix vectory multiply here if( b.numCols >= EjmlParameters.MULT_COLUMN_SWITCH ) { MatrixMatrixMult_DDRM.multAdd_reorder(alpha, a, b, c); } else { MatrixMatrixMult_DDRM.multAdd_small(alpha,a,b,c); } }
java
public static void multAdd(double alpha , DMatrix1Row a , DMatrix1Row b , DMatrix1Row c ) { // TODO add a matrix vectory multiply here if( b.numCols >= EjmlParameters.MULT_COLUMN_SWITCH ) { MatrixMatrixMult_DDRM.multAdd_reorder(alpha, a, b, c); } else { MatrixMatrixMult_DDRM.multAdd_small(alpha,a,b,c); } }
[ "public", "static", "void", "multAdd", "(", "double", "alpha", ",", "DMatrix1Row", "a", ",", "DMatrix1Row", "b", ",", "DMatrix1Row", "c", ")", "{", "// TODO add a matrix vectory multiply here", "if", "(", "b", ".", "numCols", ">=", "EjmlParameters", ".", "MULT_C...
<p> Performs the following operation:<br> <br> c = c + &alpha; * a * b<br> c<sub>ij</sub> = c<sub>ij</sub> + &alpha; * &sum;<sub>k=1:n</sub> { a<sub>ik</sub> * b<sub>kj</sub>} </p> @param alpha scaling factor. @param a The left matrix in the multiplication operation. Not modified. @param b The right matrix in the multiplication operation. Not modified. @param c Where the results of the operation are stored. Modified.
[ "<p", ">", "Performs", "the", "following", "operation", ":", "<br", ">", "<br", ">", "c", "=", "c", "+", "&alpha", ";", "*", "a", "*", "b<br", ">", "c<sub", ">", "ij<", "/", "sub", ">", "=", "c<sub", ">", "ij<", "/", "sub", ">", "+", "&alpha", ...
train
https://github.com/lessthanoptimal/ejml/blob/1444680cc487af5e866730e62f48f5f9636850d9/main/ejml-ddense/src/org/ejml/dense/row/CommonOps_DDRM.java#L359-L367
zeroturnaround/zt-zip
src/main/java/org/zeroturnaround/zip/ZipUtil.java
ZipUtil.replaceEntry
public static boolean replaceEntry(final File zip, final String path, final File file) { return operateInPlace(zip, new InPlaceAction() { public boolean act(File tmpFile) { return replaceEntry(zip, new FileSource(path, file), tmpFile); } }); }
java
public static boolean replaceEntry(final File zip, final String path, final File file) { return operateInPlace(zip, new InPlaceAction() { public boolean act(File tmpFile) { return replaceEntry(zip, new FileSource(path, file), tmpFile); } }); }
[ "public", "static", "boolean", "replaceEntry", "(", "final", "File", "zip", ",", "final", "String", "path", ",", "final", "File", "file", ")", "{", "return", "operateInPlace", "(", "zip", ",", "new", "InPlaceAction", "(", ")", "{", "public", "boolean", "ac...
Changes an existing ZIP file: replaces a given entry in it. @param zip an existing ZIP file. @param path new ZIP entry path. @param file new entry. @return <code>true</code> if the entry was replaced.
[ "Changes", "an", "existing", "ZIP", "file", ":", "replaces", "a", "given", "entry", "in", "it", "." ]
train
https://github.com/zeroturnaround/zt-zip/blob/abb4dc43583e4d19339c0c021035019798970a13/src/main/java/org/zeroturnaround/zip/ZipUtil.java#L2517-L2523
lightblueseas/jcommons-lang
src/main/java/de/alpharogroup/lang/thread/ThreadExtensions.java
ThreadExtensions.runAsyncSupplierWithCpuCores
public static <T> T runAsyncSupplierWithCpuCores(Supplier<T> supplier, int cpuCores) throws ExecutionException, InterruptedException { ForkJoinPool forkJoinPool = new ForkJoinPool(cpuCores); CompletableFuture<T> future = CompletableFuture.supplyAsync(supplier, forkJoinPool); return future.get(); }
java
public static <T> T runAsyncSupplierWithCpuCores(Supplier<T> supplier, int cpuCores) throws ExecutionException, InterruptedException { ForkJoinPool forkJoinPool = new ForkJoinPool(cpuCores); CompletableFuture<T> future = CompletableFuture.supplyAsync(supplier, forkJoinPool); return future.get(); }
[ "public", "static", "<", "T", ">", "T", "runAsyncSupplierWithCpuCores", "(", "Supplier", "<", "T", ">", "supplier", ",", "int", "cpuCores", ")", "throws", "ExecutionException", ",", "InterruptedException", "{", "ForkJoinPool", "forkJoinPool", "=", "new", "ForkJoin...
Creates a custom thread pool that are executed in parallel processes with the will run with the given number of the cpu cores @param supplier the {@link Supplier} task to execute @param cpuCores the number of the cpu cores to run with @param <T> the generic type of the result @return the result of the given task @throws ExecutionException if the computation threw an exception @throws InterruptedException if the current thread is not a member of a ForkJoinPool and was interrupted while waiting
[ "Creates", "a", "custom", "thread", "pool", "that", "are", "executed", "in", "parallel", "processes", "with", "the", "will", "run", "with", "the", "given", "number", "of", "the", "cpu", "cores" ]
train
https://github.com/lightblueseas/jcommons-lang/blob/000e1f198e949ec3e721fd0fc3f5946e945232a3/src/main/java/de/alpharogroup/lang/thread/ThreadExtensions.java#L86-L92
joniles/mpxj
src/main/java/net/sf/mpxj/json/JsonWriter.java
JsonWriter.writeFields
private void writeFields(String objectName, FieldContainer container, FieldType[] fields) throws IOException { m_writer.writeStartObject(objectName); for (FieldType field : fields) { Object value = container.getCurrentValue(field); if (value != null) { writeField(field, value); } } m_writer.writeEndObject(); }
java
private void writeFields(String objectName, FieldContainer container, FieldType[] fields) throws IOException { m_writer.writeStartObject(objectName); for (FieldType field : fields) { Object value = container.getCurrentValue(field); if (value != null) { writeField(field, value); } } m_writer.writeEndObject(); }
[ "private", "void", "writeFields", "(", "String", "objectName", ",", "FieldContainer", "container", ",", "FieldType", "[", "]", "fields", ")", "throws", "IOException", "{", "m_writer", ".", "writeStartObject", "(", "objectName", ")", ";", "for", "(", "FieldType",...
Write a set of fields from a field container to a JSON file. @param objectName name of the object, or null if no name required @param container field container @param fields fields to write
[ "Write", "a", "set", "of", "fields", "from", "a", "field", "container", "to", "a", "JSON", "file", "." ]
train
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/json/JsonWriter.java#L255-L267
lessthanoptimal/BoofCV
main/boofcv-feature/src/main/java/boofcv/alg/flow/HornSchunckPyramid.java
HornSchunckPyramid.interpolateFlowScale
protected void interpolateFlowScale(GrayF32 prev, GrayF32 curr) { interp.setImage(prev); float scaleX = (float)(prev.width-1)/(float)(curr.width-1)*0.999f; float scaleY = (float)(prev.height-1)/(float)(curr.height-1)*0.999f; float scale = (float)prev.width/(float)curr.width; int indexCurr = 0; for( int y = 0; y < curr.height; y++ ) { for( int x = 0; x < curr.width; x++ ) { curr.data[indexCurr++] = interp.get(x*scaleX,y*scaleY)/scale; } } }
java
protected void interpolateFlowScale(GrayF32 prev, GrayF32 curr) { interp.setImage(prev); float scaleX = (float)(prev.width-1)/(float)(curr.width-1)*0.999f; float scaleY = (float)(prev.height-1)/(float)(curr.height-1)*0.999f; float scale = (float)prev.width/(float)curr.width; int indexCurr = 0; for( int y = 0; y < curr.height; y++ ) { for( int x = 0; x < curr.width; x++ ) { curr.data[indexCurr++] = interp.get(x*scaleX,y*scaleY)/scale; } } }
[ "protected", "void", "interpolateFlowScale", "(", "GrayF32", "prev", ",", "GrayF32", "curr", ")", "{", "interp", ".", "setImage", "(", "prev", ")", ";", "float", "scaleX", "=", "(", "float", ")", "(", "prev", ".", "width", "-", "1", ")", "/", "(", "f...
Takes the flow from the previous lower resolution layer and uses it to initialize the flow in the current layer. Adjusts for change in image scale.
[ "Takes", "the", "flow", "from", "the", "previous", "lower", "resolution", "layer", "and", "uses", "it", "to", "initialize", "the", "flow", "in", "the", "current", "layer", ".", "Adjusts", "for", "change", "in", "image", "scale", "." ]
train
https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-feature/src/main/java/boofcv/alg/flow/HornSchunckPyramid.java#L175-L189
googleapis/google-cloud-java
google-cloud-clients/google-cloud-firestore/src/main/java/com/google/cloud/firestore/Order.java
Order.compare
public int compare(@Nonnull Value left, @Nonnull Value right) { // First compare the types. TypeOrder leftType = TypeOrder.fromValue(left); TypeOrder rightType = TypeOrder.fromValue(right); int typeComparison = leftType.compareTo(rightType); if (typeComparison != 0) { return typeComparison; } // So they are the same type. switch (leftType) { case NULL: return 0; // Nulls are all equal. case BOOLEAN: return Boolean.compare(left.getBooleanValue(), right.getBooleanValue()); case NUMBER: return compareNumbers(left, right); case TIMESTAMP: return compareTimestamps(left, right); case STRING: return compareStrings(left, right); case BLOB: return compareBlobs(left, right); case REF: return compareResourcePaths(left, right); case GEO_POINT: return compareGeoPoints(left, right); case ARRAY: return compareArrays(left, right); case OBJECT: return compareObjects(left, right); default: throw new IllegalArgumentException("Cannot compare " + leftType); } }
java
public int compare(@Nonnull Value left, @Nonnull Value right) { // First compare the types. TypeOrder leftType = TypeOrder.fromValue(left); TypeOrder rightType = TypeOrder.fromValue(right); int typeComparison = leftType.compareTo(rightType); if (typeComparison != 0) { return typeComparison; } // So they are the same type. switch (leftType) { case NULL: return 0; // Nulls are all equal. case BOOLEAN: return Boolean.compare(left.getBooleanValue(), right.getBooleanValue()); case NUMBER: return compareNumbers(left, right); case TIMESTAMP: return compareTimestamps(left, right); case STRING: return compareStrings(left, right); case BLOB: return compareBlobs(left, right); case REF: return compareResourcePaths(left, right); case GEO_POINT: return compareGeoPoints(left, right); case ARRAY: return compareArrays(left, right); case OBJECT: return compareObjects(left, right); default: throw new IllegalArgumentException("Cannot compare " + leftType); } }
[ "public", "int", "compare", "(", "@", "Nonnull", "Value", "left", ",", "@", "Nonnull", "Value", "right", ")", "{", "// First compare the types.", "TypeOrder", "leftType", "=", "TypeOrder", ".", "fromValue", "(", "left", ")", ";", "TypeOrder", "rightType", "=",...
Main comparison function for all Firestore types. @return -1 is left < right, 0 if left == right, otherwise 1
[ "Main", "comparison", "function", "for", "all", "Firestore", "types", "." ]
train
https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-firestore/src/main/java/com/google/cloud/firestore/Order.java#L84-L118
jbundle/jbundle
base/screen/model/src/main/java/org/jbundle/base/screen/view/zml/ZScreenField.java
ZScreenField.printZmlToolbarControls
public boolean printZmlToolbarControls(PrintWriter out, int iHtmlOptions) { boolean bFieldsFound = false; int iNumCols = ((BasePanel)this.getScreenField()).getSFieldCount(); for (int iIndex = 0; iIndex < iNumCols; iIndex++) { ScreenField sField = ((BasePanel)this.getScreenField()).getSField(iIndex); if (sField.isToolbar()) { if (sField.printControl(out, iHtmlOptions | HtmlConstants.HTML_INPUT | HtmlConstants.HTML_ADD_DESC_COLUMN)) bFieldsFound = true; } } return bFieldsFound; }
java
public boolean printZmlToolbarControls(PrintWriter out, int iHtmlOptions) { boolean bFieldsFound = false; int iNumCols = ((BasePanel)this.getScreenField()).getSFieldCount(); for (int iIndex = 0; iIndex < iNumCols; iIndex++) { ScreenField sField = ((BasePanel)this.getScreenField()).getSField(iIndex); if (sField.isToolbar()) { if (sField.printControl(out, iHtmlOptions | HtmlConstants.HTML_INPUT | HtmlConstants.HTML_ADD_DESC_COLUMN)) bFieldsFound = true; } } return bFieldsFound; }
[ "public", "boolean", "printZmlToolbarControls", "(", "PrintWriter", "out", ",", "int", "iHtmlOptions", ")", "{", "boolean", "bFieldsFound", "=", "false", ";", "int", "iNumCols", "=", "(", "(", "BasePanel", ")", "this", ".", "getScreenField", "(", ")", ")", "...
Display this screen's toolbars in html input format. @param out The html out stream. @return true if default params were found for this form. @exception DBException File exception.
[ "Display", "this", "screen", "s", "toolbars", "in", "html", "input", "format", "." ]
train
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/screen/model/src/main/java/org/jbundle/base/screen/view/zml/ZScreenField.java#L192-L206
powermock/powermock
powermock-reflect/src/main/java/org/powermock/reflect/internal/WhiteboxImpl.java
WhiteboxImpl.newInstance
@SuppressWarnings("unchecked") public static <T> T newInstance(Class<T> classToInstantiate) { int modifiers = classToInstantiate.getModifiers(); final Object object; if (Modifier.isInterface(modifiers)) { object = Proxy.newProxyInstance(WhiteboxImpl.class.getClassLoader(), new Class<?>[]{classToInstantiate}, new InvocationHandler() { @Override public Object invoke(Object proxy, Method method, Object[] args) throws Throwable { return TypeUtils.getDefaultValue(method.getReturnType()); } }); } else if (classToInstantiate.isArray()) { object = Array.newInstance(classToInstantiate.getComponentType(), 0); } else if (Modifier.isAbstract(modifiers)) { throw new IllegalArgumentException( "Cannot instantiate an abstract class. Please use the ConcreteClassGenerator in PowerMock support to generate a concrete class first."); } else { Objenesis objenesis = new ObjenesisStd(); ObjectInstantiator thingyInstantiator = objenesis.getInstantiatorOf(classToInstantiate); object = thingyInstantiator.newInstance(); } return (T) object; }
java
@SuppressWarnings("unchecked") public static <T> T newInstance(Class<T> classToInstantiate) { int modifiers = classToInstantiate.getModifiers(); final Object object; if (Modifier.isInterface(modifiers)) { object = Proxy.newProxyInstance(WhiteboxImpl.class.getClassLoader(), new Class<?>[]{classToInstantiate}, new InvocationHandler() { @Override public Object invoke(Object proxy, Method method, Object[] args) throws Throwable { return TypeUtils.getDefaultValue(method.getReturnType()); } }); } else if (classToInstantiate.isArray()) { object = Array.newInstance(classToInstantiate.getComponentType(), 0); } else if (Modifier.isAbstract(modifiers)) { throw new IllegalArgumentException( "Cannot instantiate an abstract class. Please use the ConcreteClassGenerator in PowerMock support to generate a concrete class first."); } else { Objenesis objenesis = new ObjenesisStd(); ObjectInstantiator thingyInstantiator = objenesis.getInstantiatorOf(classToInstantiate); object = thingyInstantiator.newInstance(); } return (T) object; }
[ "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "public", "static", "<", "T", ">", "T", "newInstance", "(", "Class", "<", "T", ">", "classToInstantiate", ")", "{", "int", "modifiers", "=", "classToInstantiate", ".", "getModifiers", "(", ")", ";", "final"...
Create a new instance of a class without invoking its constructor. No byte-code manipulation is needed to perform this operation and thus it's not necessary use the {@code PowerMockRunner} or {@code PrepareForTest} annotation to use this functionality. @param <T> The type of the instance to create. @param classToInstantiate The type of the instance to create. @return A new instance of type T, created without invoking the constructor.
[ "Create", "a", "new", "instance", "of", "a", "class", "without", "invoking", "its", "constructor", "." ]
train
https://github.com/powermock/powermock/blob/e8cd68026c284c6a7efe66959809eeebd8d1f9ad/powermock-reflect/src/main/java/org/powermock/reflect/internal/WhiteboxImpl.java#L239-L263
alibaba/otter
node/etl/src/main/java/com/alibaba/otter/node/etl/common/db/dialect/AbstractSqlTemplate.java
AbstractSqlTemplate.appendExcludeSingleShardColumnEquals
protected void appendExcludeSingleShardColumnEquals(StringBuilder sql, String[] columns, String separator, boolean updatePks, String excludeShardColumn) { int size = columns.length; for (int i = 0; i < size; i++) { // 如果是DRDS数据库, 并且存在拆分键 且 等于当前循环列, 跳过 if(!updatePks && excludeShardColumn != null && columns[i].equals(excludeShardColumn)){ continue; } sql.append(" ").append(appendEscape(columns[i])).append(" = ").append("? "); if (i != size - 1) { sql.append(separator); } } }
java
protected void appendExcludeSingleShardColumnEquals(StringBuilder sql, String[] columns, String separator, boolean updatePks, String excludeShardColumn) { int size = columns.length; for (int i = 0; i < size; i++) { // 如果是DRDS数据库, 并且存在拆分键 且 等于当前循环列, 跳过 if(!updatePks && excludeShardColumn != null && columns[i].equals(excludeShardColumn)){ continue; } sql.append(" ").append(appendEscape(columns[i])).append(" = ").append("? "); if (i != size - 1) { sql.append(separator); } } }
[ "protected", "void", "appendExcludeSingleShardColumnEquals", "(", "StringBuilder", "sql", ",", "String", "[", "]", "columns", ",", "String", "separator", ",", "boolean", "updatePks", ",", "String", "excludeShardColumn", ")", "{", "int", "size", "=", "columns", "."...
针对DRDS改造, 在 update set 集合中, 排除 单个拆分键 的赋值操作 @param sql @param columns @param separator @param excludeShardColumn 需要排除的 拆分列
[ "针对DRDS改造", "在", "update", "set", "集合中", "排除", "单个拆分键", "的赋值操作" ]
train
https://github.com/alibaba/otter/blob/c7b5f94a0dd162e01ddffaf3a63cade7d23fca55/node/etl/src/main/java/com/alibaba/otter/node/etl/common/db/dialect/AbstractSqlTemplate.java#L113-L125
Harium/keel
src/main/java/com/harium/keel/catalano/math/Tools.java
Tools.Mod
public static int Mod(int x, int m) { if (m < 0) m = -m; int r = x % m; return r < 0 ? r + m : r; }
java
public static int Mod(int x, int m) { if (m < 0) m = -m; int r = x % m; return r < 0 ? r + m : r; }
[ "public", "static", "int", "Mod", "(", "int", "x", ",", "int", "m", ")", "{", "if", "(", "m", "<", "0", ")", "m", "=", "-", "m", ";", "int", "r", "=", "x", "%", "m", ";", "return", "r", "<", "0", "?", "r", "+", "m", ":", "r", ";", "}"...
Gets the proper modulus operation. @param x Integer. @param m Modulo. @return Modulus.
[ "Gets", "the", "proper", "modulus", "operation", "." ]
train
https://github.com/Harium/keel/blob/0369ae674f9e664bccc5f9e161ae7e7a3b949a1e/src/main/java/com/harium/keel/catalano/math/Tools.java#L349-L353
hankcs/HanLP
src/main/java/com/hankcs/hanlp/algorithm/ahocorasick/trie/Trie.java
Trie.storeEmits
private static void storeEmits(int position, State currentState, List<Emit> collectedEmits) { Collection<String> emits = currentState.emit(); if (emits != null && !emits.isEmpty()) { for (String emit : emits) { collectedEmits.add(new Emit(position - emit.length() + 1, position, emit)); } } }
java
private static void storeEmits(int position, State currentState, List<Emit> collectedEmits) { Collection<String> emits = currentState.emit(); if (emits != null && !emits.isEmpty()) { for (String emit : emits) { collectedEmits.add(new Emit(position - emit.length() + 1, position, emit)); } } }
[ "private", "static", "void", "storeEmits", "(", "int", "position", ",", "State", "currentState", ",", "List", "<", "Emit", ">", "collectedEmits", ")", "{", "Collection", "<", "String", ">", "emits", "=", "currentState", ".", "emit", "(", ")", ";", "if", ...
保存匹配结果 @param position 当前位置,也就是匹配到的模式串的结束位置+1 @param currentState 当前状态 @param collectedEmits 保存位置
[ "保存匹配结果" ]
train
https://github.com/hankcs/HanLP/blob/a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce/src/main/java/com/hankcs/hanlp/algorithm/ahocorasick/trie/Trie.java#L301-L311
alkacon/opencms-core
src/org/opencms/workplace/CmsWorkplace.java
CmsWorkplace.getStaticResourceUri
public static String getStaticResourceUri(String resourceName, String versionInfo) { resourceName = CmsStaticResourceHandler.removeStaticResourcePrefix(resourceName); String uri = CmsStringUtil.joinPaths(OpenCms.getSystemInfo().getStaticResourceContext(), resourceName); if (versionInfo != null) { uri += "?v=" + versionInfo; } return uri; }
java
public static String getStaticResourceUri(String resourceName, String versionInfo) { resourceName = CmsStaticResourceHandler.removeStaticResourcePrefix(resourceName); String uri = CmsStringUtil.joinPaths(OpenCms.getSystemInfo().getStaticResourceContext(), resourceName); if (versionInfo != null) { uri += "?v=" + versionInfo; } return uri; }
[ "public", "static", "String", "getStaticResourceUri", "(", "String", "resourceName", ",", "String", "versionInfo", ")", "{", "resourceName", "=", "CmsStaticResourceHandler", ".", "removeStaticResourcePrefix", "(", "resourceName", ")", ";", "String", "uri", "=", "CmsSt...
Returns the URI to static resources served from the class path.<p> @param resourceName the resource name @param versionInfo add an additional version info parameter to avoid browser caching issues @return the URI
[ "Returns", "the", "URI", "to", "static", "resources", "served", "from", "the", "class", "path", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/workplace/CmsWorkplace.java#L654-L662
BrunoEberhard/minimal-j
src/main/java/org/minimalj/util/CloneHelper.java
CloneHelper.deepCopy
public static void deepCopy(Object from, Object to) { if (from == null) throw new IllegalArgumentException("from must not be null"); if (to == null) throw new IllegalArgumentException("to must not be null"); if (from.getClass() != to.getClass()) throw new IllegalArgumentException("from and to must have exactly same class, from has " + from.getClass() + " to has " + to.getClass()); try { _deepCopy(from, to, new ArrayList(), new ArrayList()); } catch (IllegalAccessException | IllegalArgumentException x) { throw new RuntimeException(x); } }
java
public static void deepCopy(Object from, Object to) { if (from == null) throw new IllegalArgumentException("from must not be null"); if (to == null) throw new IllegalArgumentException("to must not be null"); if (from.getClass() != to.getClass()) throw new IllegalArgumentException("from and to must have exactly same class, from has " + from.getClass() + " to has " + to.getClass()); try { _deepCopy(from, to, new ArrayList(), new ArrayList()); } catch (IllegalAccessException | IllegalArgumentException x) { throw new RuntimeException(x); } }
[ "public", "static", "void", "deepCopy", "(", "Object", "from", ",", "Object", "to", ")", "{", "if", "(", "from", "==", "null", ")", "throw", "new", "IllegalArgumentException", "(", "\"from must not be null\"", ")", ";", "if", "(", "to", "==", "null", ")", ...
note: deepCopy works only with special classes validatable through ModelTest . @param from the original object @param to an empty object to be filled
[ "note", ":", "deepCopy", "works", "only", "with", "special", "classes", "validatable", "through", "ModelTest", "." ]
train
https://github.com/BrunoEberhard/minimal-j/blob/f7c5461b2b47a10b383aee1e2f1f150f6773703b/src/main/java/org/minimalj/util/CloneHelper.java#L62-L72
lotaris/minirox-client-java
src/main/java/com/lotaris/minirox/client/MiniRoxConnector.java
MiniRoxConnector.notifyStart
public void notifyStart(String projectName, String projectVersion, String category) { try { if (isStarted()) { JSONObject startNotification = new JSONObject(). put("project", new JSONObject(). put("name", projectName). put("version", projectVersion) ). put("category", category); socket.emit("run:start", startNotification); } else { LOGGER.warn("Minirox is not available to send the start notification"); } } catch (Exception e) { LOGGER.info("Unable to send the start notification to MINI ROX. Cause: {}", e.getMessage()); if (LOGGER.isDebugEnabled()) { LOGGER.debug("Exception: ", e); } } }
java
public void notifyStart(String projectName, String projectVersion, String category) { try { if (isStarted()) { JSONObject startNotification = new JSONObject(). put("project", new JSONObject(). put("name", projectName). put("version", projectVersion) ). put("category", category); socket.emit("run:start", startNotification); } else { LOGGER.warn("Minirox is not available to send the start notification"); } } catch (Exception e) { LOGGER.info("Unable to send the start notification to MINI ROX. Cause: {}", e.getMessage()); if (LOGGER.isDebugEnabled()) { LOGGER.debug("Exception: ", e); } } }
[ "public", "void", "notifyStart", "(", "String", "projectName", ",", "String", "projectVersion", ",", "String", "category", ")", "{", "try", "{", "if", "(", "isStarted", "(", ")", ")", "{", "JSONObject", "startNotification", "=", "new", "JSONObject", "(", ")"...
Send a starting notification to Mini ROX @param projectName The project name @param projectVersion The project version @param category The category
[ "Send", "a", "starting", "notification", "to", "Mini", "ROX" ]
train
https://github.com/lotaris/minirox-client-java/blob/56fc0e22210d4fbaaa2b47aa9f8c504379b57dad/src/main/java/com/lotaris/minirox/client/MiniRoxConnector.java#L61-L84
Azure/azure-sdk-for-java
sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/JobCredentialsInner.java
JobCredentialsInner.createOrUpdateAsync
public Observable<JobCredentialInner> createOrUpdateAsync(String resourceGroupName, String serverName, String jobAgentName, String credentialName, JobCredentialInner parameters) { return createOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, jobAgentName, credentialName, parameters).map(new Func1<ServiceResponse<JobCredentialInner>, JobCredentialInner>() { @Override public JobCredentialInner call(ServiceResponse<JobCredentialInner> response) { return response.body(); } }); }
java
public Observable<JobCredentialInner> createOrUpdateAsync(String resourceGroupName, String serverName, String jobAgentName, String credentialName, JobCredentialInner parameters) { return createOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, jobAgentName, credentialName, parameters).map(new Func1<ServiceResponse<JobCredentialInner>, JobCredentialInner>() { @Override public JobCredentialInner call(ServiceResponse<JobCredentialInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "JobCredentialInner", ">", "createOrUpdateAsync", "(", "String", "resourceGroupName", ",", "String", "serverName", ",", "String", "jobAgentName", ",", "String", "credentialName", ",", "JobCredentialInner", "parameters", ")", "{", "return", ...
Creates or updates a job credential. @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. @param serverName The name of the server. @param jobAgentName The name of the job agent. @param credentialName The name of the credential. @param parameters The requested job credential state. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the JobCredentialInner object
[ "Creates", "or", "updates", "a", "job", "credential", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/JobCredentialsInner.java#L361-L368
jenkinsci/jenkins
cli/src/main/java/hudson/cli/Connection.java
Connection.encryptConnection
public Connection encryptConnection(SecretKey sessionKey, String algorithm) throws IOException, GeneralSecurityException { Cipher cout = Cipher.getInstance(algorithm); cout.init(Cipher.ENCRYPT_MODE, sessionKey, new IvParameterSpec(sessionKey.getEncoded())); CipherOutputStream o = new CipherOutputStream(out, cout); Cipher cin = Cipher.getInstance(algorithm); cin.init(Cipher.DECRYPT_MODE, sessionKey, new IvParameterSpec(sessionKey.getEncoded())); CipherInputStream i = new CipherInputStream(in, cin); return new Connection(i,o); }
java
public Connection encryptConnection(SecretKey sessionKey, String algorithm) throws IOException, GeneralSecurityException { Cipher cout = Cipher.getInstance(algorithm); cout.init(Cipher.ENCRYPT_MODE, sessionKey, new IvParameterSpec(sessionKey.getEncoded())); CipherOutputStream o = new CipherOutputStream(out, cout); Cipher cin = Cipher.getInstance(algorithm); cin.init(Cipher.DECRYPT_MODE, sessionKey, new IvParameterSpec(sessionKey.getEncoded())); CipherInputStream i = new CipherInputStream(in, cin); return new Connection(i,o); }
[ "public", "Connection", "encryptConnection", "(", "SecretKey", "sessionKey", ",", "String", "algorithm", ")", "throws", "IOException", ",", "GeneralSecurityException", "{", "Cipher", "cout", "=", "Cipher", ".", "getInstance", "(", "algorithm", ")", ";", "cout", "....
Upgrades a connection with transport encryption by the specified symmetric cipher. @return A new {@link Connection} object that includes the transport encryption.
[ "Upgrades", "a", "connection", "with", "transport", "encryption", "by", "the", "specified", "symmetric", "cipher", "." ]
train
https://github.com/jenkinsci/jenkins/blob/44c4d3989232082c254d27ae360aa810669f44b7/cli/src/main/java/hudson/cli/Connection.java#L195-L205
googolmo/OkVolley
okvolley/src/main/java/im/amomo/volley/OkRequest.java
OkRequest.writePartHeader
protected OkRequest<T> writePartHeader(final String name, final String filename) throws IOException { return writePartHeader(name, filename, null); }
java
protected OkRequest<T> writePartHeader(final String name, final String filename) throws IOException { return writePartHeader(name, filename, null); }
[ "protected", "OkRequest", "<", "T", ">", "writePartHeader", "(", "final", "String", "name", ",", "final", "String", "filename", ")", "throws", "IOException", "{", "return", "writePartHeader", "(", "name", ",", "filename", ",", "null", ")", ";", "}" ]
Write part header @param name @param filename @return this request @throws java.io.IOException
[ "Write", "part", "header" ]
train
https://github.com/googolmo/OkVolley/blob/5c41df7cf1a8156c85e179a3c4af8a1c1485ffec/okvolley/src/main/java/im/amomo/volley/OkRequest.java#L206-L209
cdapio/tigon
tigon-queue/src/main/java/co/cask/tigon/data/transaction/queue/AbstractQueueConsumer.java
AbstractQueueConsumer.getEntries
private boolean getEntries(SortedMap<byte[], SimpleQueueEntry> entries, int maxBatchSize) throws IOException { boolean hasEntry = fetchFromCache(entries, maxBatchSize); // If not enough entries from the cache, try to get more. // ANDREAS: I think this is wrong. If the batch=10, and the cache has 5 entries, but populateCache cannot // fetch more entries, then we have 5 and should return true. But this code will return false. // TERENCE: If there are 5 entries in the cache, the first call to fetchFromCache will return true, // the second call to fetchFromCache from call to populateCache will return false, but // hasEntry = false || true => true, hence returning true. if (entries.size() < maxBatchSize) { populateRowCache(entries.keySet(), maxBatchSize); hasEntry = fetchFromCache(entries, maxBatchSize) || hasEntry; } return hasEntry; }
java
private boolean getEntries(SortedMap<byte[], SimpleQueueEntry> entries, int maxBatchSize) throws IOException { boolean hasEntry = fetchFromCache(entries, maxBatchSize); // If not enough entries from the cache, try to get more. // ANDREAS: I think this is wrong. If the batch=10, and the cache has 5 entries, but populateCache cannot // fetch more entries, then we have 5 and should return true. But this code will return false. // TERENCE: If there are 5 entries in the cache, the first call to fetchFromCache will return true, // the second call to fetchFromCache from call to populateCache will return false, but // hasEntry = false || true => true, hence returning true. if (entries.size() < maxBatchSize) { populateRowCache(entries.keySet(), maxBatchSize); hasEntry = fetchFromCache(entries, maxBatchSize) || hasEntry; } return hasEntry; }
[ "private", "boolean", "getEntries", "(", "SortedMap", "<", "byte", "[", "]", ",", "SimpleQueueEntry", ">", "entries", ",", "int", "maxBatchSize", ")", "throws", "IOException", "{", "boolean", "hasEntry", "=", "fetchFromCache", "(", "entries", ",", "maxBatchSize"...
Try to dequeue (claim) entries up to a maximum size. @param entries For claimed entries to fill in. @param maxBatchSize Maximum number of entries to claim. @return The entries instance. @throws java.io.IOException
[ "Try", "to", "dequeue", "(", "claim", ")", "entries", "up", "to", "a", "maximum", "size", "." ]
train
https://github.com/cdapio/tigon/blob/5be6dffd7c79519d1211bb08f75be7dcfbbad392/tigon-queue/src/main/java/co/cask/tigon/data/transaction/queue/AbstractQueueConsumer.java#L233-L248
soi-toolkit/soi-toolkit-mule
tools/soitoolkit-generator/soitoolkit-generator/src/main/java/org/soitoolkit/tools/generator/cli/util/OptionSet.java
OptionSet.addOption
OptionSet addOption(String key, boolean details, Options.Separator separator, boolean value, Options.Multiplicity multiplicity) { if (key == null) throw new IllegalArgumentException(CLASS + ": key may not be null"); if (multiplicity == null) throw new IllegalArgumentException(CLASS + ": multiplicity may not be null"); if (separator == null) throw new IllegalArgumentException(CLASS + ": separator may not be null"); if (keys.containsKey(key)) throw new IllegalArgumentException(CLASS + ": the key " + key + " has already been defined for this OptionSet"); OptionData od = new OptionData(prefix, key, details, separator, value, multiplicity); options.add(od); keys.put(key, od); return this; }
java
OptionSet addOption(String key, boolean details, Options.Separator separator, boolean value, Options.Multiplicity multiplicity) { if (key == null) throw new IllegalArgumentException(CLASS + ": key may not be null"); if (multiplicity == null) throw new IllegalArgumentException(CLASS + ": multiplicity may not be null"); if (separator == null) throw new IllegalArgumentException(CLASS + ": separator may not be null"); if (keys.containsKey(key)) throw new IllegalArgumentException(CLASS + ": the key " + key + " has already been defined for this OptionSet"); OptionData od = new OptionData(prefix, key, details, separator, value, multiplicity); options.add(od); keys.put(key, od); return this; }
[ "OptionSet", "addOption", "(", "String", "key", ",", "boolean", "details", ",", "Options", ".", "Separator", "separator", ",", "boolean", "value", ",", "Options", ".", "Multiplicity", "multiplicity", ")", "{", "if", "(", "key", "==", "null", ")", "throw", ...
The master method to add an option. Since there are combinations which are not acceptable (like a NONE separator and a true value), this method is not public. Internally, we only supply acceptable combinations.
[ "The", "master", "method", "to", "add", "an", "option", ".", "Since", "there", "are", "combinations", "which", "are", "not", "acceptable", "(", "like", "a", "NONE", "separator", "and", "a", "true", "value", ")", "this", "method", "is", "not", "public", "...
train
https://github.com/soi-toolkit/soi-toolkit-mule/blob/e891350dbf55e6307be94d193d056bdb785b37d3/tools/soitoolkit-generator/soitoolkit-generator/src/main/java/org/soitoolkit/tools/generator/cli/util/OptionSet.java#L271-L289
livetribe/livetribe-slp
core/src/main/java/org/livetribe/slp/spi/msg/BytesBlock.java
BytesBlock.writeInt
protected static void writeInt(int value, byte[] bytes, int offset, int length) { for (int i = length - 1; i >= 0; --i) { bytes[offset + i] = (byte)(value & 0xFF); value >>= 8; } }
java
protected static void writeInt(int value, byte[] bytes, int offset, int length) { for (int i = length - 1; i >= 0; --i) { bytes[offset + i] = (byte)(value & 0xFF); value >>= 8; } }
[ "protected", "static", "void", "writeInt", "(", "int", "value", ",", "byte", "[", "]", "bytes", ",", "int", "offset", ",", "int", "length", ")", "{", "for", "(", "int", "i", "=", "length", "-", "1", ";", "i", ">=", "0", ";", "--", "i", ")", "{"...
Writes an integer value to <code>bytes</code> in network byte order @param value The integer value to write @param bytes The bytes where the integer value is written to @param offset The offset in <code>bytes</code>from where to start writing the integer @param length The number of bytes to write
[ "Writes", "an", "integer", "value", "to", "<code", ">", "bytes<", "/", "code", ">", "in", "network", "byte", "order" ]
train
https://github.com/livetribe/livetribe-slp/blob/6cc13dbe81feab133fe3dd291ca081cbc6e1f591/core/src/main/java/org/livetribe/slp/spi/msg/BytesBlock.java#L80-L87
carewebframework/carewebframework-core
org.carewebframework.shell/src/main/java/org/carewebframework/shell/layout/LayoutParser.java
LayoutParser.parseCondition
private void parseCondition(Element node, LayoutTrigger parent) { new LayoutTriggerCondition(parent, getDefinition(null, node)); }
java
private void parseCondition(Element node, LayoutTrigger parent) { new LayoutTriggerCondition(parent, getDefinition(null, node)); }
[ "private", "void", "parseCondition", "(", "Element", "node", ",", "LayoutTrigger", "parent", ")", "{", "new", "LayoutTriggerCondition", "(", "parent", ",", "getDefinition", "(", "null", ",", "node", ")", ")", ";", "}" ]
Parse a trigger condition node. @param node The DOM node. @param parent The parent layout trigger.
[ "Parse", "a", "trigger", "condition", "node", "." ]
train
https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.shell/src/main/java/org/carewebframework/shell/layout/LayoutParser.java#L314-L316
OpenLiberty/open-liberty
dev/com.ibm.ws.messaging.utils/src/com/ibm/ws/sib/utils/collections/linkedlist/LinkedList.java
LinkedList.insertLinkBefore
public final synchronized void insertLinkBefore(Link insertLink, Link followingLink) { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) { SibTr.entry( this, tc, "insertLinkBefore", new long[] { insertLink.getSequence(), followingLink.getSequence()}); } Link prev = followingLink._getPreviousLink(); insertLink._link(prev, followingLink, this); prev._setNextLink(insertLink); followingLink._setPreviousLink(insertLink); if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) { SibTr.exit(this, tc, "insertLinkBefore", _debugString()); } }
java
public final synchronized void insertLinkBefore(Link insertLink, Link followingLink) { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) { SibTr.entry( this, tc, "insertLinkBefore", new long[] { insertLink.getSequence(), followingLink.getSequence()}); } Link prev = followingLink._getPreviousLink(); insertLink._link(prev, followingLink, this); prev._setNextLink(insertLink); followingLink._setPreviousLink(insertLink); if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) { SibTr.exit(this, tc, "insertLinkBefore", _debugString()); } }
[ "public", "final", "synchronized", "void", "insertLinkBefore", "(", "Link", "insertLink", ",", "Link", "followingLink", ")", "{", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "{", "SibTr",...
Insert the specified link into the list. @param insertLink link to be inserted @param followingLink link before which the insertLink is inserted.
[ "Insert", "the", "specified", "link", "into", "the", "list", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.utils/src/com/ibm/ws/sib/utils/collections/linkedlist/LinkedList.java#L139-L154
RestComm/sip-servlets
sip-servlets-examples/chatserver/src/main/java/org/mobicents/servlet/sip/example/ChatroomSipServlet.java
ChatroomSipServlet.doMessage
protected void doMessage(SipServletRequest request) throws ServletException, IOException { request.createResponse(SipServletResponse.SC_OK).send(); Object message = request.getContent(); String from = request.getFrom().getURI().toString(); logger.info("from is "+ from); //A user asked to quit. if(message.toString().equalsIgnoreCase("/quit")) { sendToUser(from, "Bye"); removeUser(from); return; } //Add user to the list if(!containsUser(from)) { sendToUser(from, "Welcome to chatroom " + serverAddress + ". Type '/quit' to exit."); addUser(from); } if(message.toString().equalsIgnoreCase("/who")) { String users = "List of users:\n"; List<String> list = (List<String>)getServletContext().getAttribute(USER_LIST); for (String user : list) { users += user + "\n"; } sendToUser(from, users); // removeUser(from); return; } //If the user is joining the chatroom silently, no message //to broadcast, return. if(message.toString().equalsIgnoreCase("/join")) { return; } //We could implement more IRC commands here, //see http://www.mirc.com/cmds.html sendToAll(from, message, request.getHeader("Content-Type")); }
java
protected void doMessage(SipServletRequest request) throws ServletException, IOException { request.createResponse(SipServletResponse.SC_OK).send(); Object message = request.getContent(); String from = request.getFrom().getURI().toString(); logger.info("from is "+ from); //A user asked to quit. if(message.toString().equalsIgnoreCase("/quit")) { sendToUser(from, "Bye"); removeUser(from); return; } //Add user to the list if(!containsUser(from)) { sendToUser(from, "Welcome to chatroom " + serverAddress + ". Type '/quit' to exit."); addUser(from); } if(message.toString().equalsIgnoreCase("/who")) { String users = "List of users:\n"; List<String> list = (List<String>)getServletContext().getAttribute(USER_LIST); for (String user : list) { users += user + "\n"; } sendToUser(from, users); // removeUser(from); return; } //If the user is joining the chatroom silently, no message //to broadcast, return. if(message.toString().equalsIgnoreCase("/join")) { return; } //We could implement more IRC commands here, //see http://www.mirc.com/cmds.html sendToAll(from, message, request.getHeader("Content-Type")); }
[ "protected", "void", "doMessage", "(", "SipServletRequest", "request", ")", "throws", "ServletException", ",", "IOException", "{", "request", ".", "createResponse", "(", "SipServletResponse", ".", "SC_OK", ")", ".", "send", "(", ")", ";", "Object", "message", "=...
This is called by the container when a MESSAGE message arrives.
[ "This", "is", "called", "by", "the", "container", "when", "a", "MESSAGE", "message", "arrives", "." ]
train
https://github.com/RestComm/sip-servlets/blob/fd7011d2803ab1d205b140768a760c8c69e0c997/sip-servlets-examples/chatserver/src/main/java/org/mobicents/servlet/sip/example/ChatroomSipServlet.java#L92-L136
groupon/odo
proxylib/src/main/java/com/groupon/odo/proxylib/PathOverrideService.java
PathOverrideService.AddGroupByNumber
public void AddGroupByNumber(int profileId, int pathId, int groupNum) { logger.info("adding group_id={}, to pathId={}", groupNum, pathId); String oldGroups = getGroupIdsInPathProfile(profileId, pathId); // make sure the old groups does not contain the current group we want // to add if (!intArrayContains(Utils.arrayFromStringOfIntegers(oldGroups), groupNum)) { if (!oldGroups.endsWith(",") && !oldGroups.isEmpty()) { oldGroups += ","; } String newGroups = (oldGroups + groupNum); EditService.updatePathTable(Constants.PATH_PROFILE_GROUP_IDS, newGroups, pathId); } else { logger.info("that group is already contained in for this uuid/path"); } }
java
public void AddGroupByNumber(int profileId, int pathId, int groupNum) { logger.info("adding group_id={}, to pathId={}", groupNum, pathId); String oldGroups = getGroupIdsInPathProfile(profileId, pathId); // make sure the old groups does not contain the current group we want // to add if (!intArrayContains(Utils.arrayFromStringOfIntegers(oldGroups), groupNum)) { if (!oldGroups.endsWith(",") && !oldGroups.isEmpty()) { oldGroups += ","; } String newGroups = (oldGroups + groupNum); EditService.updatePathTable(Constants.PATH_PROFILE_GROUP_IDS, newGroups, pathId); } else { logger.info("that group is already contained in for this uuid/path"); } }
[ "public", "void", "AddGroupByNumber", "(", "int", "profileId", ",", "int", "pathId", ",", "int", "groupNum", ")", "{", "logger", ".", "info", "(", "\"adding group_id={}, to pathId={}\"", ",", "groupNum", ",", "pathId", ")", ";", "String", "oldGroups", "=", "ge...
Called right now when we add an entry to the path_profile table Then we update the table to add a new string that contains the old groups and the new group (followed by a comma) @param profileId ID of profile @param pathId ID of path @param groupNum Group to add
[ "Called", "right", "now", "when", "we", "add", "an", "entry", "to", "the", "path_profile", "table", "Then", "we", "update", "the", "table", "to", "add", "a", "new", "string", "that", "contains", "the", "old", "groups", "and", "the", "new", "group", "(", ...
train
https://github.com/groupon/odo/blob/3bae43d5eca8ace036775e5b2d3ed9af1a9ff9b1/proxylib/src/main/java/com/groupon/odo/proxylib/PathOverrideService.java#L273-L287
lucee/Lucee
loader/src/main/java/lucee/loader/engine/CFMLEngineWrapper.java
CFMLEngineWrapper.equalTo
public boolean equalTo(CFMLEngine other, final boolean checkReferenceEqualityOnly) { while (other instanceof CFMLEngineWrapper) other = ((CFMLEngineWrapper) other).engine; if (checkReferenceEqualityOnly) return engine == other; return engine.equals(other); }
java
public boolean equalTo(CFMLEngine other, final boolean checkReferenceEqualityOnly) { while (other instanceof CFMLEngineWrapper) other = ((CFMLEngineWrapper) other).engine; if (checkReferenceEqualityOnly) return engine == other; return engine.equals(other); }
[ "public", "boolean", "equalTo", "(", "CFMLEngine", "other", ",", "final", "boolean", "checkReferenceEqualityOnly", ")", "{", "while", "(", "other", "instanceof", "CFMLEngineWrapper", ")", "other", "=", "(", "(", "CFMLEngineWrapper", ")", "other", ")", ".", "engi...
this interface is new to this class and not officially part of Lucee 3.x, do not use outside the loader @param other @param checkReferenceEqualityOnly @return is equal to given engine
[ "this", "interface", "is", "new", "to", "this", "class", "and", "not", "officially", "part", "of", "Lucee", "3", ".", "x", "do", "not", "use", "outside", "the", "loader" ]
train
https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/loader/src/main/java/lucee/loader/engine/CFMLEngineWrapper.java#L259-L264
cloudant/sync-android
cloudant-sync-datastore-core/src/main/java/com/cloudant/sync/internal/query/UnindexedMatcher.java
UnindexedMatcher.matcherWithSelector
public static UnindexedMatcher matcherWithSelector(Map<String, Object> selector) { ChildrenQueryNode root = buildExecutionTreeForSelector(selector); if (root == null) { return null; } UnindexedMatcher matcher = new UnindexedMatcher(); matcher.root = root; return matcher; }
java
public static UnindexedMatcher matcherWithSelector(Map<String, Object> selector) { ChildrenQueryNode root = buildExecutionTreeForSelector(selector); if (root == null) { return null; } UnindexedMatcher matcher = new UnindexedMatcher(); matcher.root = root; return matcher; }
[ "public", "static", "UnindexedMatcher", "matcherWithSelector", "(", "Map", "<", "String", ",", "Object", ">", "selector", ")", "{", "ChildrenQueryNode", "root", "=", "buildExecutionTreeForSelector", "(", "selector", ")", ";", "if", "(", "root", "==", "null", ")"...
Return a new initialised matcher. Assumes selector is valid as we're calling this late in the query processing.
[ "Return", "a", "new", "initialised", "matcher", "." ]
train
https://github.com/cloudant/sync-android/blob/5f1416ed1bd9ab05d7a4b8736480c8ae68bd7383/cloudant-sync-datastore-core/src/main/java/com/cloudant/sync/internal/query/UnindexedMatcher.java#L99-L110
looly/hutool
hutool-core/src/main/java/cn/hutool/core/img/ImgUtil.java
ImgUtil.scale
public static void scale(File srcImageFile, File destImageFile, int width, int height, Color fixedColor) throws IORuntimeException { write(scale(read(srcImageFile), width, height, fixedColor), destImageFile); }
java
public static void scale(File srcImageFile, File destImageFile, int width, int height, Color fixedColor) throws IORuntimeException { write(scale(read(srcImageFile), width, height, fixedColor), destImageFile); }
[ "public", "static", "void", "scale", "(", "File", "srcImageFile", ",", "File", "destImageFile", ",", "int", "width", ",", "int", "height", ",", "Color", "fixedColor", ")", "throws", "IORuntimeException", "{", "write", "(", "scale", "(", "read", "(", "srcImag...
缩放图像(按高度和宽度缩放)<br> 缩放后默认为jpeg格式 @param srcImageFile 源图像文件地址 @param destImageFile 缩放后的图像地址 @param width 缩放后的宽度 @param height 缩放后的高度 @param fixedColor 比例不对时补充的颜色,不补充为<code>null</code> @throws IORuntimeException IO异常
[ "缩放图像(按高度和宽度缩放)<br", ">", "缩放后默认为jpeg格式" ]
train
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/img/ImgUtil.java#L184-L186
Alluxio/alluxio
job/server/src/main/java/alluxio/master/job/command/CommandManager.java
CommandManager.submitCancelTaskCommand
public synchronized void submitCancelTaskCommand(long jobId, int taskId, long workerId) { CancelTaskCommand.Builder cancelTaskCommand = CancelTaskCommand.newBuilder(); cancelTaskCommand.setJobId(jobId); cancelTaskCommand.setTaskId(taskId); JobCommand.Builder command = JobCommand.newBuilder(); command.setCancelTaskCommand(cancelTaskCommand); if (!mWorkerIdToPendingCommands.containsKey(workerId)) { mWorkerIdToPendingCommands.put(workerId, Lists.<JobCommand>newArrayList()); } mWorkerIdToPendingCommands.get(workerId).add(command.build()); }
java
public synchronized void submitCancelTaskCommand(long jobId, int taskId, long workerId) { CancelTaskCommand.Builder cancelTaskCommand = CancelTaskCommand.newBuilder(); cancelTaskCommand.setJobId(jobId); cancelTaskCommand.setTaskId(taskId); JobCommand.Builder command = JobCommand.newBuilder(); command.setCancelTaskCommand(cancelTaskCommand); if (!mWorkerIdToPendingCommands.containsKey(workerId)) { mWorkerIdToPendingCommands.put(workerId, Lists.<JobCommand>newArrayList()); } mWorkerIdToPendingCommands.get(workerId).add(command.build()); }
[ "public", "synchronized", "void", "submitCancelTaskCommand", "(", "long", "jobId", ",", "int", "taskId", ",", "long", "workerId", ")", "{", "CancelTaskCommand", ".", "Builder", "cancelTaskCommand", "=", "CancelTaskCommand", ".", "newBuilder", "(", ")", ";", "cance...
Submits a cancel-task command to a specified worker. @param jobId the job id @param taskId the task id @param workerId the worker id
[ "Submits", "a", "cancel", "-", "task", "command", "to", "a", "specified", "worker", "." ]
train
https://github.com/Alluxio/alluxio/blob/af38cf3ab44613355b18217a3a4d961f8fec3a10/job/server/src/main/java/alluxio/master/job/command/CommandManager.java#L87-L97
lievendoclo/Valkyrie-RCP
valkyrie-rcp-core/src/main/java/org/valkyriercp/form/builder/FormLayoutFormBuilder.java
FormLayoutFormBuilder.addBinding
public JComponent addBinding(Binding binding, int column, int row, int widthSpan, int heightSpan) { ((SwingBindingFactory) getBindingFactory()).interceptBinding(binding); JComponent component = binding.getControl(); addComponent(component, column, row, widthSpan, heightSpan); return component; }
java
public JComponent addBinding(Binding binding, int column, int row, int widthSpan, int heightSpan) { ((SwingBindingFactory) getBindingFactory()).interceptBinding(binding); JComponent component = binding.getControl(); addComponent(component, column, row, widthSpan, heightSpan); return component; }
[ "public", "JComponent", "addBinding", "(", "Binding", "binding", ",", "int", "column", ",", "int", "row", ",", "int", "widthSpan", ",", "int", "heightSpan", ")", "{", "(", "(", "SwingBindingFactory", ")", "getBindingFactory", "(", ")", ")", ".", "interceptBi...
Add a binder to a column and a row with width and height spanning.
[ "Add", "a", "binder", "to", "a", "column", "and", "a", "row", "with", "width", "and", "height", "spanning", "." ]
train
https://github.com/lievendoclo/Valkyrie-RCP/blob/6aad6e640b348cda8f3b0841f6e42025233f1eb8/valkyrie-rcp-core/src/main/java/org/valkyriercp/form/builder/FormLayoutFormBuilder.java#L271-L277
khuxtable/seaglass
src/main/java/com/seaglasslookandfeel/painter/util/ShapeGenerator.java
ShapeGenerator.createRoundRectangle
public Shape createRoundRectangle(final int x, final int y, final int w, final int h, final CornerSize size) { return createRoundRectangle(x, y, w, h, size, CornerStyle.ROUNDED, CornerStyle.ROUNDED, CornerStyle.ROUNDED, CornerStyle.ROUNDED); }
java
public Shape createRoundRectangle(final int x, final int y, final int w, final int h, final CornerSize size) { return createRoundRectangle(x, y, w, h, size, CornerStyle.ROUNDED, CornerStyle.ROUNDED, CornerStyle.ROUNDED, CornerStyle.ROUNDED); }
[ "public", "Shape", "createRoundRectangle", "(", "final", "int", "x", ",", "final", "int", "y", ",", "final", "int", "w", ",", "final", "int", "h", ",", "final", "CornerSize", "size", ")", "{", "return", "createRoundRectangle", "(", "x", ",", "y", ",", ...
Return a path for a rectangle with rounded corners. @param x the X coordinate of the upper-left corner of the rectangle @param y the Y coordinate of the upper-left corner of the rectangle @param w the width of the rectangle @param h the height of the rectangle @param size the CornerSize value representing the amount of rounding @return a path representing the shape.
[ "Return", "a", "path", "for", "a", "rectangle", "with", "rounded", "corners", "." ]
train
https://github.com/khuxtable/seaglass/blob/f25ecba622923d7b29b64cb7d6068dd8005989b3/src/main/java/com/seaglasslookandfeel/painter/util/ShapeGenerator.java#L209-L211
twitter/hraven
hraven-core/src/main/java/com/twitter/hraven/datasource/JobHistoryService.java
JobHistoryService.createFlowScan
private Scan createFlowScan(byte[] rowPrefix, int limit, String version) { Scan scan = new Scan(); scan.setStartRow(rowPrefix); // using a large scanner caching value with a small limit can mean we scan a // lot more data than necessary, so lower the caching for low limits scan.setCaching(Math.min(limit, defaultScannerCaching)); // require that all rows match the prefix we're looking for Filter prefixFilter = new WhileMatchFilter(new PrefixFilter(rowPrefix)); // if version is passed, restrict the rows returned to that version if (version != null && version.length() > 0) { FilterList filters = new FilterList(FilterList.Operator.MUST_PASS_ALL); filters.addFilter(prefixFilter); filters.addFilter(new SingleColumnValueFilter(Constants.INFO_FAM_BYTES, Constants.VERSION_COLUMN_BYTES, CompareFilter.CompareOp.EQUAL, Bytes.toBytes(version))); scan.setFilter(filters); } else { scan.setFilter(prefixFilter); } return scan; }
java
private Scan createFlowScan(byte[] rowPrefix, int limit, String version) { Scan scan = new Scan(); scan.setStartRow(rowPrefix); // using a large scanner caching value with a small limit can mean we scan a // lot more data than necessary, so lower the caching for low limits scan.setCaching(Math.min(limit, defaultScannerCaching)); // require that all rows match the prefix we're looking for Filter prefixFilter = new WhileMatchFilter(new PrefixFilter(rowPrefix)); // if version is passed, restrict the rows returned to that version if (version != null && version.length() > 0) { FilterList filters = new FilterList(FilterList.Operator.MUST_PASS_ALL); filters.addFilter(prefixFilter); filters.addFilter(new SingleColumnValueFilter(Constants.INFO_FAM_BYTES, Constants.VERSION_COLUMN_BYTES, CompareFilter.CompareOp.EQUAL, Bytes.toBytes(version))); scan.setFilter(filters); } else { scan.setFilter(prefixFilter); } return scan; }
[ "private", "Scan", "createFlowScan", "(", "byte", "[", "]", "rowPrefix", ",", "int", "limit", ",", "String", "version", ")", "{", "Scan", "scan", "=", "new", "Scan", "(", ")", ";", "scan", ".", "setStartRow", "(", "rowPrefix", ")", ";", "// using a large...
creates a scan for flow data @param rowPrefix - start row prefix @param limit - limit on scanned results @param version - version to match @return Scan
[ "creates", "a", "scan", "for", "flow", "data" ]
train
https://github.com/twitter/hraven/blob/e35996b6e2f016bcd18db0bad320be7c93d95208/hraven-core/src/main/java/com/twitter/hraven/datasource/JobHistoryService.java#L225-L246
deeplearning4j/deeplearning4j
datavec/datavec-api/src/main/java/org/datavec/api/conf/Configuration.java
Configuration.getInt
public int getInt(String name, int defaultValue) { String valueString = get(name); if (valueString == null) return defaultValue; try { String hexString = getHexDigits(valueString); if (hexString != null) { return Integer.parseInt(hexString, 16); } return Integer.parseInt(valueString); } catch (NumberFormatException e) { return defaultValue; } }
java
public int getInt(String name, int defaultValue) { String valueString = get(name); if (valueString == null) return defaultValue; try { String hexString = getHexDigits(valueString); if (hexString != null) { return Integer.parseInt(hexString, 16); } return Integer.parseInt(valueString); } catch (NumberFormatException e) { return defaultValue; } }
[ "public", "int", "getInt", "(", "String", "name", ",", "int", "defaultValue", ")", "{", "String", "valueString", "=", "get", "(", "name", ")", ";", "if", "(", "valueString", "==", "null", ")", "return", "defaultValue", ";", "try", "{", "String", "hexStri...
Get the value of the <code>name</code> property as an <code>int</code>. If no such property exists, or if the specified value is not a valid <code>int</code>, then <code>defaultValue</code> is returned. @param name property name. @param defaultValue default value. @return property value as an <code>int</code>, or <code>defaultValue</code>.
[ "Get", "the", "value", "of", "the", "<code", ">", "name<", "/", "code", ">", "property", "as", "an", "<code", ">", "int<", "/", "code", ">", "." ]
train
https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/datavec/datavec-api/src/main/java/org/datavec/api/conf/Configuration.java#L474-L487
dmak/jaxb-xew-plugin
src/main/java/com/sun/tools/xjc/addon/xew/CommonUtils.java
CommonUtils.setPrivateField
public static void setPrivateField(Object obj, String fieldName, Object newValue) { try { FieldUtils.writeField(obj, fieldName, newValue, true); } catch (IllegalAccessException e) { throw new RuntimeException(e); } }
java
public static void setPrivateField(Object obj, String fieldName, Object newValue) { try { FieldUtils.writeField(obj, fieldName, newValue, true); } catch (IllegalAccessException e) { throw new RuntimeException(e); } }
[ "public", "static", "void", "setPrivateField", "(", "Object", "obj", ",", "String", "fieldName", ",", "Object", "newValue", ")", "{", "try", "{", "FieldUtils", ".", "writeField", "(", "obj", ",", "fieldName", ",", "newValue", ",", "true", ")", ";", "}", ...
Set the {@code newValue} to private field {@code fieldName} of given object {@code obj}. @throws IllegalArgumentException if given field was not found
[ "Set", "the", "{", "@code", "newValue", "}", "to", "private", "field", "{", "@code", "fieldName", "}", "of", "given", "object", "{", "@code", "obj", "}", "." ]
train
https://github.com/dmak/jaxb-xew-plugin/blob/d564d6bf8e50c46b056cdb4b46d1d4bee4adfbe3/src/main/java/com/sun/tools/xjc/addon/xew/CommonUtils.java#L180-L187
diirt/util
src/main/java/org/epics/util/array/ListMath.java
ListMath.limit
public static ListLong limit(final ListLong data, final int start, final int end) { return new ListLong() { @Override public long getLong(int index) { return data.getLong(index + start); } @Override public int size() { return end - start; } }; }
java
public static ListLong limit(final ListLong data, final int start, final int end) { return new ListLong() { @Override public long getLong(int index) { return data.getLong(index + start); } @Override public int size() { return end - start; } }; }
[ "public", "static", "ListLong", "limit", "(", "final", "ListLong", "data", ",", "final", "int", "start", ",", "final", "int", "end", ")", "{", "return", "new", "ListLong", "(", ")", "{", "@", "Override", "public", "long", "getLong", "(", "int", "index", ...
Returns a sublist of the given data. @param data a list @param start start point for the sublist @param end end point (exclusive) for the sublist @return the sublist
[ "Returns", "a", "sublist", "of", "the", "given", "data", "." ]
train
https://github.com/diirt/util/blob/24aca0a173a635aaf0b78d213a3fee8d4f91c077/src/main/java/org/epics/util/array/ListMath.java#L77-L90
apache/incubator-druid
indexing-service/src/main/java/org/apache/druid/indexing/overlord/TaskLockbox.java
TaskLockbox.createNewTaskLockPosse
private TaskLockPosse createNewTaskLockPosse( TaskLockType lockType, String groupId, String dataSource, Interval interval, @Nullable String preferredVersion, int priority, boolean revoked ) { giant.lock(); try { // Create new TaskLock and assign it a version. // Assumption: We'll choose a version that is greater than any previously-chosen version for our interval. (This // may not always be true, unfortunately. See below.) final String version; if (preferredVersion != null) { // We have a preferred version. We'll trust our caller to not break our ordering assumptions and just use it. version = preferredVersion; } else { // We are running under an interval lock right now, so just using the current time works as long as we can // trustour clock to be monotonic and have enough resolution since the last time we created a TaskLock for // the same interval. This may not always be true; to assure it we would need to use some method of // timekeeping other than the wall clock. version = DateTimes.nowUtc().toString(); } final TaskLockPosse posseToUse = new TaskLockPosse( new TaskLock(lockType, groupId, dataSource, interval, version, priority, revoked) ); running.computeIfAbsent(dataSource, k -> new TreeMap<>()) .computeIfAbsent(interval.getStart(), k -> new TreeMap<>(Comparators.intervalsByStartThenEnd())) .computeIfAbsent(interval, k -> new ArrayList<>()) .add(posseToUse); return posseToUse; } finally { giant.unlock(); } }
java
private TaskLockPosse createNewTaskLockPosse( TaskLockType lockType, String groupId, String dataSource, Interval interval, @Nullable String preferredVersion, int priority, boolean revoked ) { giant.lock(); try { // Create new TaskLock and assign it a version. // Assumption: We'll choose a version that is greater than any previously-chosen version for our interval. (This // may not always be true, unfortunately. See below.) final String version; if (preferredVersion != null) { // We have a preferred version. We'll trust our caller to not break our ordering assumptions and just use it. version = preferredVersion; } else { // We are running under an interval lock right now, so just using the current time works as long as we can // trustour clock to be monotonic and have enough resolution since the last time we created a TaskLock for // the same interval. This may not always be true; to assure it we would need to use some method of // timekeeping other than the wall clock. version = DateTimes.nowUtc().toString(); } final TaskLockPosse posseToUse = new TaskLockPosse( new TaskLock(lockType, groupId, dataSource, interval, version, priority, revoked) ); running.computeIfAbsent(dataSource, k -> new TreeMap<>()) .computeIfAbsent(interval.getStart(), k -> new TreeMap<>(Comparators.intervalsByStartThenEnd())) .computeIfAbsent(interval, k -> new ArrayList<>()) .add(posseToUse); return posseToUse; } finally { giant.unlock(); } }
[ "private", "TaskLockPosse", "createNewTaskLockPosse", "(", "TaskLockType", "lockType", ",", "String", "groupId", ",", "String", "dataSource", ",", "Interval", "interval", ",", "@", "Nullable", "String", "preferredVersion", ",", "int", "priority", ",", "boolean", "re...
Create a new {@link TaskLockPosse} for a new {@link TaskLock}. This method will attempt to assign version strings that obey the invariant that every version string is lexicographically greater than any other version string previously assigned to the same interval. This invariant is only mostly guaranteed, however; we assume clock monotonicity and that callers specifying {@code preferredVersion} are doing the right thing. @param lockType lock type @param groupId group id of task @param dataSource data source of task @param interval interval to be locked @param preferredVersion preferred version string @param priority lock priority @param revoked indicate the lock is revoked @return a new {@link TaskLockPosse}
[ "Create", "a", "new", "{", "@link", "TaskLockPosse", "}", "for", "a", "new", "{", "@link", "TaskLock", "}", ".", "This", "method", "will", "attempt", "to", "assign", "version", "strings", "that", "obey", "the", "invariant", "that", "every", "version", "str...
train
https://github.com/apache/incubator-druid/blob/f776b9408962b9006cfcfe4d6c1794751972cc8e/indexing-service/src/main/java/org/apache/druid/indexing/overlord/TaskLockbox.java#L567-L609
baidubce/bce-sdk-java
src/main/java/com/baidubce/services/doc/DocClient.java
DocClient.disableReadToken
public DisableReadTokenResponse disableReadToken(String documentId, String token) { DisableReadTokenRequest request = new DisableReadTokenRequest(); request.setDocumentId(documentId); request.setToken(token); return this.disableReadToken(request); }
java
public DisableReadTokenResponse disableReadToken(String documentId, String token) { DisableReadTokenRequest request = new DisableReadTokenRequest(); request.setDocumentId(documentId); request.setToken(token); return this.disableReadToken(request); }
[ "public", "DisableReadTokenResponse", "disableReadToken", "(", "String", "documentId", ",", "String", "token", ")", "{", "DisableReadTokenRequest", "request", "=", "new", "DisableReadTokenRequest", "(", ")", ";", "request", ".", "setDocumentId", "(", "documentId", ")"...
Disable read token. @param documentId The document id. @param token The token need to disable @return A DisableReadTokenResponse object.
[ "Disable", "read", "token", "." ]
train
https://github.com/baidubce/bce-sdk-java/blob/f7140f28dd82121515c88ded7bfe769a37d0ec4a/src/main/java/com/baidubce/services/doc/DocClient.java#L776-L781
VoltDB/voltdb
src/frontend/org/voltdb/expressions/AbstractExpression.java
AbstractExpression.validateExprsForIndexesAndMVs
public static boolean validateExprsForIndexesAndMVs(List<AbstractExpression> checkList, StringBuffer msg, boolean isMV) { for (AbstractExpression expr : checkList) { if (!expr.isValidExprForIndexesAndMVs(msg, isMV)) { return false; } } return true; }
java
public static boolean validateExprsForIndexesAndMVs(List<AbstractExpression> checkList, StringBuffer msg, boolean isMV) { for (AbstractExpression expr : checkList) { if (!expr.isValidExprForIndexesAndMVs(msg, isMV)) { return false; } } return true; }
[ "public", "static", "boolean", "validateExprsForIndexesAndMVs", "(", "List", "<", "AbstractExpression", ">", "checkList", ",", "StringBuffer", "msg", ",", "boolean", "isMV", ")", "{", "for", "(", "AbstractExpression", "expr", ":", "checkList", ")", "{", "if", "(...
Return true if the all of the expressions in the list can be part of an index expression or in group by and where clause of MV. As with validateExprForIndexesAndMVs for individual expression, the StringBuffer parameter, msg, contains the name of the index. Error messages should be appended to it. @param checkList @param msg @return
[ "Return", "true", "if", "the", "all", "of", "the", "expressions", "in", "the", "list", "can", "be", "part", "of", "an", "index", "expression", "or", "in", "group", "by", "and", "where", "clause", "of", "MV", ".", "As", "with", "validateExprForIndexesAndMVs...
train
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/frontend/org/voltdb/expressions/AbstractExpression.java#L1390-L1397
opsmatters/opsmatters-core
src/main/java/com/opsmatters/core/util/StringUtilities.java
StringUtilities.endsWith
public static boolean endsWith(StringBuffer buffer, String suffix) { if (suffix.length() > buffer.length()) return false; int endIndex = suffix.length() - 1; int bufferIndex = buffer.length() - 1; while (endIndex >= 0) { if (buffer.charAt(bufferIndex) != suffix.charAt(endIndex)) return false; bufferIndex--; endIndex--; } return true; }
java
public static boolean endsWith(StringBuffer buffer, String suffix) { if (suffix.length() > buffer.length()) return false; int endIndex = suffix.length() - 1; int bufferIndex = buffer.length() - 1; while (endIndex >= 0) { if (buffer.charAt(bufferIndex) != suffix.charAt(endIndex)) return false; bufferIndex--; endIndex--; } return true; }
[ "public", "static", "boolean", "endsWith", "(", "StringBuffer", "buffer", ",", "String", "suffix", ")", "{", "if", "(", "suffix", ".", "length", "(", ")", ">", "buffer", ".", "length", "(", ")", ")", "return", "false", ";", "int", "endIndex", "=", "suf...
Checks that a string buffer ends up with a given string. @param buffer The buffer to perform the check on @param suffix The suffix @return <code>true</code> if the character sequence represented by the argument is a suffix of the character sequence represented by the StringBuffer object; <code>false</code> otherwise. Note that the result will be <code>true</code> if the argument is the empty string.
[ "Checks", "that", "a", "string", "buffer", "ends", "up", "with", "a", "given", "string", "." ]
train
https://github.com/opsmatters/opsmatters-core/blob/c48904f7e8d029fd45357811ec38a735e261e3fd/src/main/java/com/opsmatters/core/util/StringUtilities.java#L371-L385
filosganga/geogson
core/src/main/java/com/github/filosganga/geogson/model/Polygon.java
Polygon.of
public static Polygon of(LinearRing perimeter, LinearRing... holes) { return Polygon.of(perimeter, Arrays.asList(holes)); }
java
public static Polygon of(LinearRing perimeter, LinearRing... holes) { return Polygon.of(perimeter, Arrays.asList(holes)); }
[ "public", "static", "Polygon", "of", "(", "LinearRing", "perimeter", ",", "LinearRing", "...", "holes", ")", "{", "return", "Polygon", ".", "of", "(", "perimeter", ",", "Arrays", ".", "asList", "(", "holes", ")", ")", ";", "}" ]
Creates a Polygon from the given perimeter and holes. @param perimeter The perimeter {@link LinearRing}. @param holes The holes {@link LinearRing} sequence. @return Polygon
[ "Creates", "a", "Polygon", "from", "the", "given", "perimeter", "and", "holes", "." ]
train
https://github.com/filosganga/geogson/blob/f0c7b0adfecc174caa8a03a6c19d301c7a47d4a0/core/src/main/java/com/github/filosganga/geogson/model/Polygon.java#L52-L54
ModeShape/modeshape
modeshape-common/src/main/java/org/modeshape/common/util/CheckArg.java
CheckArg.isNegative
public static void isNegative( int argument, String name ) { if (argument >= 0) { throw new IllegalArgumentException(CommonI18n.argumentMustBeNegative.text(name, argument)); } }
java
public static void isNegative( int argument, String name ) { if (argument >= 0) { throw new IllegalArgumentException(CommonI18n.argumentMustBeNegative.text(name, argument)); } }
[ "public", "static", "void", "isNegative", "(", "int", "argument", ",", "String", "name", ")", "{", "if", "(", "argument", ">=", "0", ")", "{", "throw", "new", "IllegalArgumentException", "(", "CommonI18n", ".", "argumentMustBeNegative", ".", "text", "(", "na...
Check that the argument is negative (<0). @param argument The argument @param name The name of the argument @throws IllegalArgumentException If argument is non-negative (>=0)
[ "Check", "that", "the", "argument", "is", "negative", "(", "<0", ")", "." ]
train
https://github.com/ModeShape/modeshape/blob/794cfdabb67a90f24629c4fff0424a6125f8f95b/modeshape-common/src/main/java/org/modeshape/common/util/CheckArg.java#L182-L187
CloudSlang/cs-actions
cs-database/src/main/java/io/cloudslang/content/database/services/dbconnection/DBConnectionManager.java
DBConnectionManager.getPropBooleanValue
protected boolean getPropBooleanValue(String aPropName, String aDefaultValue) { boolean retValue; String temp = dbPoolingProperties.getProperty(aPropName, aDefaultValue); retValue = Boolean.valueOf(temp); return retValue; }
java
protected boolean getPropBooleanValue(String aPropName, String aDefaultValue) { boolean retValue; String temp = dbPoolingProperties.getProperty(aPropName, aDefaultValue); retValue = Boolean.valueOf(temp); return retValue; }
[ "protected", "boolean", "getPropBooleanValue", "(", "String", "aPropName", ",", "String", "aDefaultValue", ")", "{", "boolean", "retValue", ";", "String", "temp", "=", "dbPoolingProperties", ".", "getProperty", "(", "aPropName", ",", "aDefaultValue", ")", ";", "re...
get boolean value based on the property name from property file the property file is databasePooling.properties @param aPropName a property name @param aDefaultValue a default value for that property, if the property is not there. @return boolean value of that property
[ "get", "boolean", "value", "based", "on", "the", "property", "name", "from", "property", "file", "the", "property", "file", "is", "databasePooling", ".", "properties" ]
train
https://github.com/CloudSlang/cs-actions/blob/9a1be1e99ad88286a6c153d5f2275df6ae1a57a1/cs-database/src/main/java/io/cloudslang/content/database/services/dbconnection/DBConnectionManager.java#L341-L348
cdk/cdk
tool/formula/src/main/java/org/openscience/cdk/tools/manipulator/MolecularFormulaManipulator.java
MolecularFormulaManipulator.getHTML
public static String getHTML(IMolecularFormula formula, boolean chargeB, boolean isotopeB) { String[] orderElements; if (containsElement(formula, formula.getBuilder().newInstance(IElement.class, "C"))) orderElements = generateOrderEle_Hill_WithCarbons(); else orderElements = generateOrderEle_Hill_NoCarbons(); return getHTML(formula, orderElements, chargeB, isotopeB); }
java
public static String getHTML(IMolecularFormula formula, boolean chargeB, boolean isotopeB) { String[] orderElements; if (containsElement(formula, formula.getBuilder().newInstance(IElement.class, "C"))) orderElements = generateOrderEle_Hill_WithCarbons(); else orderElements = generateOrderEle_Hill_NoCarbons(); return getHTML(formula, orderElements, chargeB, isotopeB); }
[ "public", "static", "String", "getHTML", "(", "IMolecularFormula", "formula", ",", "boolean", "chargeB", ",", "boolean", "isotopeB", ")", "{", "String", "[", "]", "orderElements", ";", "if", "(", "containsElement", "(", "formula", ",", "formula", ".", "getBuil...
Returns the string representation of the molecular formula based on Hill System with numbers wrapped in &lt;sub&gt;&lt;/sub&gt; tags and the isotope of each Element in &lt;sup&gt;&lt;/sup&gt; tags and the total charge of IMolecularFormula in &lt;sup&gt;&lt;/sup&gt; tags. Useful for displaying formulae in Swing components or on the web. @param formula The IMolecularFormula object @param chargeB True, If it has to show the charge @param isotopeB True, If it has to show the Isotope mass @return A HTML representation of the molecular formula @see #getHTML(IMolecularFormula)
[ "Returns", "the", "string", "representation", "of", "the", "molecular", "formula", "based", "on", "Hill", "System", "with", "numbers", "wrapped", "in", "&lt", ";", "sub&gt", ";", "&lt", ";", "/", "sub&gt", ";", "tags", "and", "the", "isotope", "of", "each"...
train
https://github.com/cdk/cdk/blob/c3d0f16502bf08df50365fee392e11d7c9856657/tool/formula/src/main/java/org/openscience/cdk/tools/manipulator/MolecularFormulaManipulator.java#L496-L503
codeprimate-software/cp-elements
src/main/java/org/cp/elements/lang/ObjectUtils.java
ObjectUtils.returnValueOrDefaultIfNull
public static <T> T returnValueOrDefaultIfNull(T value, T defaultValue) { return returnValueOrDefaultIfNull(value, () -> defaultValue); }
java
public static <T> T returnValueOrDefaultIfNull(T value, T defaultValue) { return returnValueOrDefaultIfNull(value, () -> defaultValue); }
[ "public", "static", "<", "T", ">", "T", "returnValueOrDefaultIfNull", "(", "T", "value", ",", "T", "defaultValue", ")", "{", "return", "returnValueOrDefaultIfNull", "(", "value", ",", "(", ")", "->", "defaultValue", ")", ";", "}" ]
Returns the given {@code value} if not {@literal null} or returns the {@code defaultValue}. @param <T> {@link Class} type of the {@code value} and {@code defaultValue}. @param value {@link Object} to evaluate for {@literal null}. @param defaultValue {@link Object} value to return if {@code value} is {@literal null}. @return the given {@code value} if not {@literal null} or returns the {@code defaultValue}. @see #returnValueOrDefaultIfNull(Object, Supplier)
[ "Returns", "the", "given", "{", "@code", "value", "}", "if", "not", "{", "@literal", "null", "}", "or", "returns", "the", "{", "@code", "defaultValue", "}", "." ]
train
https://github.com/codeprimate-software/cp-elements/blob/f2163c149fbbef05015e688132064ebcac7c49ab/src/main/java/org/cp/elements/lang/ObjectUtils.java#L190-L192
actorapp/actor-platform
actor-sdk/sdk-core-android/android-sdk/src/main/java/im/actor/sdk/ActorSDK.java
ActorSDK.startSettingActivity
public void startSettingActivity(Context context, Bundle extras) { if (!startDelegateActivity(context, delegate.getSettingsIntent(), extras)) { startActivity(context, extras, MyProfileActivity.class); } }
java
public void startSettingActivity(Context context, Bundle extras) { if (!startDelegateActivity(context, delegate.getSettingsIntent(), extras)) { startActivity(context, extras, MyProfileActivity.class); } }
[ "public", "void", "startSettingActivity", "(", "Context", "context", ",", "Bundle", "extras", ")", "{", "if", "(", "!", "startDelegateActivity", "(", "context", ",", "delegate", ".", "getSettingsIntent", "(", ")", ",", "extras", ")", ")", "{", "startActivity",...
Method is used internally for starting default activity or activity added in delegate @param context current context @param extras activity extras
[ "Method", "is", "used", "internally", "for", "starting", "default", "activity", "or", "activity", "added", "in", "delegate" ]
train
https://github.com/actorapp/actor-platform/blob/5123c1584757c6eeea0ed2a0e7e043629871a0c6/actor-sdk/sdk-core-android/android-sdk/src/main/java/im/actor/sdk/ActorSDK.java#L954-L958
aws/aws-sdk-java
aws-java-sdk-opsworks/src/main/java/com/amazonaws/services/opsworks/model/ListTagsResult.java
ListTagsResult.withTags
public ListTagsResult withTags(java.util.Map<String, String> tags) { setTags(tags); return this; }
java
public ListTagsResult withTags(java.util.Map<String, String> tags) { setTags(tags); return this; }
[ "public", "ListTagsResult", "withTags", "(", "java", ".", "util", ".", "Map", "<", "String", ",", "String", ">", "tags", ")", "{", "setTags", "(", "tags", ")", ";", "return", "this", ";", "}" ]
<p> A set of key-value pairs that contain tag keys and tag values that are attached to a stack or layer. </p> @param tags A set of key-value pairs that contain tag keys and tag values that are attached to a stack or layer. @return Returns a reference to this object so that method calls can be chained together.
[ "<p", ">", "A", "set", "of", "key", "-", "value", "pairs", "that", "contain", "tag", "keys", "and", "tag", "values", "that", "are", "attached", "to", "a", "stack", "or", "layer", ".", "<", "/", "p", ">" ]
train
https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-opsworks/src/main/java/com/amazonaws/services/opsworks/model/ListTagsResult.java#L82-L85
Samsung/GearVRf
GVRf/Extensions/3DCursor/3DCursorLibrary/src/main/java/org/gearvrf/io/cursor3d/CursorManager.java
CursorManager.makeSceneSelectable
public void makeSceneSelectable(GVRScene scene) { if (this.scene == scene) { //do nothing return return; } //cleanup on the currently set scene if there is one if (this.scene != null) { //false to remove updateCursorsInScene(this.scene, false); } this.scene = scene; if (scene == null) { return; } // process the new scene for (GVRSceneObject object : scene.getSceneObjects()) { addSelectableObject(object); } //true to add updateCursorsInScene(scene, true); }
java
public void makeSceneSelectable(GVRScene scene) { if (this.scene == scene) { //do nothing return return; } //cleanup on the currently set scene if there is one if (this.scene != null) { //false to remove updateCursorsInScene(this.scene, false); } this.scene = scene; if (scene == null) { return; } // process the new scene for (GVRSceneObject object : scene.getSceneObjects()) { addSelectableObject(object); } //true to add updateCursorsInScene(scene, true); }
[ "public", "void", "makeSceneSelectable", "(", "GVRScene", "scene", ")", "{", "if", "(", "this", ".", "scene", "==", "scene", ")", "{", "//do nothing return", "return", ";", "}", "//cleanup on the currently set scene if there is one", "if", "(", "this", ".", "scene...
Use this call to make all the {@link GVRSceneObject}s in the provided GVRScene to be selectable. <p/> In order to have more control over objects that can be made selectable make use of the {@link #addSelectableObject(GVRSceneObject)} method. <p/> Note that this call will set the current scene as the provided scene. If the provided scene is same the currently set scene then this method will have no effect. Passing null will remove any objects that are selectable and set the scene to null @param scene the {@link GVRScene} to be made selectable or <code>null</code>.
[ "Use", "this", "call", "to", "make", "all", "the", "{", "@link", "GVRSceneObject", "}", "s", "in", "the", "provided", "GVRScene", "to", "be", "selectable", ".", "<p", "/", ">", "In", "order", "to", "have", "more", "control", "over", "objects", "that", ...
train
https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Extensions/3DCursor/3DCursorLibrary/src/main/java/org/gearvrf/io/cursor3d/CursorManager.java#L534-L557
Erudika/para
para-server/src/main/java/com/erudika/para/rest/RestUtils.java
RestUtils.deleteLinksHandler
public static Response deleteLinksHandler(ParaObject pobj, String id2, String type2, boolean childrenOnly) { try (final Metrics.Context context = Metrics.time(null, RestUtils.class, "links", "delete")) { if (type2 == null && id2 == null) { pobj.unlinkAll(); } else if (type2 != null) { if (id2 != null) { pobj.unlink(type2, id2); } else if (childrenOnly) { pobj.deleteChildren(type2); } } return Response.ok().build(); } }
java
public static Response deleteLinksHandler(ParaObject pobj, String id2, String type2, boolean childrenOnly) { try (final Metrics.Context context = Metrics.time(null, RestUtils.class, "links", "delete")) { if (type2 == null && id2 == null) { pobj.unlinkAll(); } else if (type2 != null) { if (id2 != null) { pobj.unlink(type2, id2); } else if (childrenOnly) { pobj.deleteChildren(type2); } } return Response.ok().build(); } }
[ "public", "static", "Response", "deleteLinksHandler", "(", "ParaObject", "pobj", ",", "String", "id2", ",", "String", "type2", ",", "boolean", "childrenOnly", ")", "{", "try", "(", "final", "Metrics", ".", "Context", "context", "=", "Metrics", ".", "time", "...
Handles requests to delete linked objects. @param pobj the object to operate on @param id2 the id of the second object (optional) @param type2 the type of the second object @param childrenOnly find only directly linked objects in 1-to-many relationship @return a Response
[ "Handles", "requests", "to", "delete", "linked", "objects", "." ]
train
https://github.com/Erudika/para/blob/5ba096c477042ea7b18e9a0e8b5b1ee0f5bd6ce9/para-server/src/main/java/com/erudika/para/rest/RestUtils.java#L681-L694
Azure/azure-sdk-for-java
applicationinsights/data-plane/src/main/java/com/microsoft/azure/applicationinsights/query/implementation/MetricsImpl.java
MetricsImpl.getAsync
public Observable<MetricsResult> getAsync(String appId, MetricId metricId) { return getWithServiceResponseAsync(appId, metricId).map(new Func1<ServiceResponse<MetricsResult>, MetricsResult>() { @Override public MetricsResult call(ServiceResponse<MetricsResult> response) { return response.body(); } }); }
java
public Observable<MetricsResult> getAsync(String appId, MetricId metricId) { return getWithServiceResponseAsync(appId, metricId).map(new Func1<ServiceResponse<MetricsResult>, MetricsResult>() { @Override public MetricsResult call(ServiceResponse<MetricsResult> response) { return response.body(); } }); }
[ "public", "Observable", "<", "MetricsResult", ">", "getAsync", "(", "String", "appId", ",", "MetricId", "metricId", ")", "{", "return", "getWithServiceResponseAsync", "(", "appId", ",", "metricId", ")", ".", "map", "(", "new", "Func1", "<", "ServiceResponse", ...
Retrieve metric data. Gets metric values for a single metric. @param appId ID of the application. This is Application ID from the API Access settings blade in the Azure portal. @param metricId ID of the metric. This is either a standard AI metric, or an application-specific custom metric. Possible values include: 'requests/count', 'requests/duration', 'requests/failed', 'users/count', 'users/authenticated', 'pageViews/count', 'pageViews/duration', 'client/processingDuration', 'client/receiveDuration', 'client/networkDuration', 'client/sendDuration', 'client/totalDuration', 'dependencies/count', 'dependencies/failed', 'dependencies/duration', 'exceptions/count', 'exceptions/browser', 'exceptions/server', 'sessions/count', 'performanceCounters/requestExecutionTime', 'performanceCounters/requestsPerSecond', 'performanceCounters/requestsInQueue', 'performanceCounters/memoryAvailableBytes', 'performanceCounters/exceptionsPerSecond', 'performanceCounters/processCpuPercentage', 'performanceCounters/processIOBytesPerSecond', 'performanceCounters/processPrivateBytes', 'performanceCounters/processorCpuPercentage', 'availabilityResults/availabilityPercentage', 'availabilityResults/duration', 'billing/telemetryCount', 'customEvents/count' @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the MetricsResult object
[ "Retrieve", "metric", "data", ".", "Gets", "metric", "values", "for", "a", "single", "metric", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/applicationinsights/data-plane/src/main/java/com/microsoft/azure/applicationinsights/query/implementation/MetricsImpl.java#L119-L126
reinert/requestor
requestor/core/requestor-api/src/main/java/io/reinert/requestor/SerdesManagerImpl.java
SerdesManagerImpl.getSerializer
@SuppressWarnings("unchecked") public <T> Serializer<T> getSerializer(Class<T> type, String mediaType) throws SerializationException { checkNotNull(type, "Type (Class<T>) cannot be null."); checkNotNull(mediaType, "Media-Type cannot be null."); final String typeName = getClassName(type); final Key key = new Key(typeName, mediaType); logger.log(Level.FINE, "Querying for Serializer of type '" + typeName + "' and " + "media-type '" + mediaType + "'."); ArrayList<SerializerHolder> holders = serializers.get(typeName); if (holders != null) { for (SerializerHolder holder : holders) { if (holder.key.matches(key)) { logger.log(Level.FINE, "Serializer for type '" + holder.serializer.handledType() + "' and " + "media-type '" + Arrays.toString(holder.serializer.mediaType()) + "' matched: " + holder.serializer.getClass().getName()); return (Serializer<T>) holder.serializer; } } } logger.log(Level.WARNING, "There is no Serializer registered for type " + type.getName() + " and media-type " + mediaType + ". If you're relying on auto-generated serializers," + " please make sure you imported the correct GWT Module."); return null; }
java
@SuppressWarnings("unchecked") public <T> Serializer<T> getSerializer(Class<T> type, String mediaType) throws SerializationException { checkNotNull(type, "Type (Class<T>) cannot be null."); checkNotNull(mediaType, "Media-Type cannot be null."); final String typeName = getClassName(type); final Key key = new Key(typeName, mediaType); logger.log(Level.FINE, "Querying for Serializer of type '" + typeName + "' and " + "media-type '" + mediaType + "'."); ArrayList<SerializerHolder> holders = serializers.get(typeName); if (holders != null) { for (SerializerHolder holder : holders) { if (holder.key.matches(key)) { logger.log(Level.FINE, "Serializer for type '" + holder.serializer.handledType() + "' and " + "media-type '" + Arrays.toString(holder.serializer.mediaType()) + "' matched: " + holder.serializer.getClass().getName()); return (Serializer<T>) holder.serializer; } } } logger.log(Level.WARNING, "There is no Serializer registered for type " + type.getName() + " and media-type " + mediaType + ". If you're relying on auto-generated serializers," + " please make sure you imported the correct GWT Module."); return null; }
[ "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "public", "<", "T", ">", "Serializer", "<", "T", ">", "getSerializer", "(", "Class", "<", "T", ">", "type", ",", "String", "mediaType", ")", "throws", "SerializationException", "{", "checkNotNull", "(", "ty...
Retrieve Serializer from manager. @param type The type class of the serializer. @param <T> The type of the serializer. @return The serializer of the specified type. @throws SerializationException if no serializer was registered for the class.
[ "Retrieve", "Serializer", "from", "manager", "." ]
train
https://github.com/reinert/requestor/blob/40163a75cd17815d5089935d0dd97b8d652ad6d4/requestor/core/requestor-api/src/main/java/io/reinert/requestor/SerdesManagerImpl.java#L190-L218
wildfly/wildfly-core
cli/src/main/java/org/jboss/as/cli/parsing/StateParser.java
StateParser.parseLine
public static SubstitutedLine parseLine(String str, ParsingStateCallbackHandler callbackHandler, ParsingState initialState) throws CommandFormatException { return parseLine(str, callbackHandler, initialState, true); }
java
public static SubstitutedLine parseLine(String str, ParsingStateCallbackHandler callbackHandler, ParsingState initialState) throws CommandFormatException { return parseLine(str, callbackHandler, initialState, true); }
[ "public", "static", "SubstitutedLine", "parseLine", "(", "String", "str", ",", "ParsingStateCallbackHandler", "callbackHandler", ",", "ParsingState", "initialState", ")", "throws", "CommandFormatException", "{", "return", "parseLine", "(", "str", ",", "callbackHandler", ...
Returns the string which was actually parsed with all the substitutions performed. NB: No CommandContext being provided, variables can't be resolved. variables should be already resolved when calling this parse method.
[ "Returns", "the", "string", "which", "was", "actually", "parsed", "with", "all", "the", "substitutions", "performed", ".", "NB", ":", "No", "CommandContext", "being", "provided", "variables", "can", "t", "be", "resolved", ".", "variables", "should", "be", "alr...
train
https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/cli/src/main/java/org/jboss/as/cli/parsing/StateParser.java#L74-L76
cdk/cdk
display/renderbasic/src/main/java/org/openscience/cdk/renderer/generators/standard/StandardAtomGenerator.java
StandardAtomGenerator.isMajorIsotope
private boolean isMajorIsotope(int number, int mass) { try { IIsotope isotope = Isotopes.getInstance().getMajorIsotope(number); return isotope != null && isotope.getMassNumber().equals(mass); } catch (IOException e) { return false; } }
java
private boolean isMajorIsotope(int number, int mass) { try { IIsotope isotope = Isotopes.getInstance().getMajorIsotope(number); return isotope != null && isotope.getMassNumber().equals(mass); } catch (IOException e) { return false; } }
[ "private", "boolean", "isMajorIsotope", "(", "int", "number", ",", "int", "mass", ")", "{", "try", "{", "IIsotope", "isotope", "=", "Isotopes", ".", "getInstance", "(", ")", ".", "getMajorIsotope", "(", "number", ")", ";", "return", "isotope", "!=", "null"...
Utility to determine if the specified mass is the major isotope for the given atomic number. @param number atomic number @param mass atomic mass @return the mass is the major mass for the atomic number
[ "Utility", "to", "determine", "if", "the", "specified", "mass", "is", "the", "major", "isotope", "for", "the", "given", "atomic", "number", "." ]
train
https://github.com/cdk/cdk/blob/c3d0f16502bf08df50365fee392e11d7c9856657/display/renderbasic/src/main/java/org/openscience/cdk/renderer/generators/standard/StandardAtomGenerator.java#L547-L554
phax/ph-commons
ph-commons/src/main/java/com/helger/commons/lang/ClassHelper.java
ClassHelper.getResource
@Nullable public static URL getResource (@Nonnull final Class <?> aClass, @Nonnull @Nonempty final String sPath) { ValueEnforcer.notNull (aClass, "Class"); ValueEnforcer.notEmpty (sPath, "Path"); // Ensure the path does start with a "/" final String sPathWithSlash = _getPathWithLeadingSlash (sPath); // returns null if not found return aClass.getResource (sPathWithSlash); }
java
@Nullable public static URL getResource (@Nonnull final Class <?> aClass, @Nonnull @Nonempty final String sPath) { ValueEnforcer.notNull (aClass, "Class"); ValueEnforcer.notEmpty (sPath, "Path"); // Ensure the path does start with a "/" final String sPathWithSlash = _getPathWithLeadingSlash (sPath); // returns null if not found return aClass.getResource (sPathWithSlash); }
[ "@", "Nullable", "public", "static", "URL", "getResource", "(", "@", "Nonnull", "final", "Class", "<", "?", ">", "aClass", ",", "@", "Nonnull", "@", "Nonempty", "final", "String", "sPath", ")", "{", "ValueEnforcer", ".", "notNull", "(", "aClass", ",", "\...
Get the URL of the passed resource using the class loader of the specified class only. This is a sanity wrapper around <code>class.getResource (sPath)</code>. @param aClass The class to be used. May not be <code>null</code>. @param sPath The path to be resolved. May neither be <code>null</code> nor empty. Internally it is ensured that the provided path does start with a slash. @return <code>null</code> if the path could not be resolved using the specified class loader.
[ "Get", "the", "URL", "of", "the", "passed", "resource", "using", "the", "class", "loader", "of", "the", "specified", "class", "only", ".", "This", "is", "a", "sanity", "wrapper", "around", "<code", ">", "class", ".", "getResource", "(", "sPath", ")", "<"...
train
https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-commons/src/main/java/com/helger/commons/lang/ClassHelper.java#L558-L569
hal/core
gui/src/main/java/org/jboss/as/console/client/core/CircuitPresenter.java
CircuitPresenter.onError
protected void onError(Action action, Throwable t) { Console.error(Console.CONSTANTS.lastActionError(), t.getMessage()); }
java
protected void onError(Action action, Throwable t) { Console.error(Console.CONSTANTS.lastActionError(), t.getMessage()); }
[ "protected", "void", "onError", "(", "Action", "action", ",", "Throwable", "t", ")", "{", "Console", ".", "error", "(", "Console", ".", "CONSTANTS", ".", "lastActionError", "(", ")", ",", "t", ".", "getMessage", "(", ")", ")", ";", "}" ]
When this method is called it's guaranteed that the presenter is visible.
[ "When", "this", "method", "is", "called", "it", "s", "guaranteed", "that", "the", "presenter", "is", "visible", "." ]
train
https://github.com/hal/core/blob/d6d03f0bb128dc0470f5dc75fdb1ea1014400602/gui/src/main/java/org/jboss/as/console/client/core/CircuitPresenter.java#L116-L118
pip-services3-java/pip-services3-commons-java
src/org/pipservices3/commons/random/RandomDateTime.java
RandomDateTime.updateDateTime
public static ZonedDateTime updateDateTime(ZonedDateTime value, float range) { range = range != 0 ? range : 10; if (range < 0) return value; float days = RandomFloat.nextFloat(-range, range); return value.plusDays((int) days); }
java
public static ZonedDateTime updateDateTime(ZonedDateTime value, float range) { range = range != 0 ? range : 10; if (range < 0) return value; float days = RandomFloat.nextFloat(-range, range); return value.plusDays((int) days); }
[ "public", "static", "ZonedDateTime", "updateDateTime", "(", "ZonedDateTime", "value", ",", "float", "range", ")", "{", "range", "=", "range", "!=", "0", "?", "range", ":", "10", ";", "if", "(", "range", "<", "0", ")", "return", "value", ";", "float", "...
Updates (drifts) a ZonedDateTime value within specified range defined @param value a ZonedDateTime value to drift. @param range (optional) a range in milliseconds. Default: 10 days @return an updated ZonedDateTime and time value.
[ "Updates", "(", "drifts", ")", "a", "ZonedDateTime", "value", "within", "specified", "range", "defined" ]
train
https://github.com/pip-services3-java/pip-services3-commons-java/blob/a8a0c3e5ec58f0663c295aa855c6b3afad2af86a/src/org/pipservices3/commons/random/RandomDateTime.java#L94-L101
nextreports/nextreports-engine
src/ro/nextreports/engine/util/ParameterUtil.java
ParameterUtil.getParameterValueFromString
public static Object getParameterValueFromString(String parameterClass, String value) throws Exception { return getParameterValueFromString(parameterClass, value, null); }
java
public static Object getParameterValueFromString(String parameterClass, String value) throws Exception { return getParameterValueFromString(parameterClass, value, null); }
[ "public", "static", "Object", "getParameterValueFromString", "(", "String", "parameterClass", ",", "String", "value", ")", "throws", "Exception", "{", "return", "getParameterValueFromString", "(", "parameterClass", ",", "value", ",", "null", ")", ";", "}" ]
Get parameter value from a string represenation @param parameterClass parameter class @param value string value representation @return parameter value from string representation @throws Exception if string value cannot be parse
[ "Get", "parameter", "value", "from", "a", "string", "represenation" ]
train
https://github.com/nextreports/nextreports-engine/blob/a847575a9298b5fce63b88961190c5b83ddccc44/src/ro/nextreports/engine/util/ParameterUtil.java#L1055-L1057
google/error-prone-javac
src/jdk.compiler/share/classes/com/sun/tools/javac/util/StringUtils.java
StringUtils.indexOfIgnoreCase
public static int indexOfIgnoreCase(String text, String str, int startIndex) { Matcher m = Pattern.compile(Pattern.quote(str), Pattern.CASE_INSENSITIVE).matcher(text); return m.find(startIndex) ? m.start() : -1; }
java
public static int indexOfIgnoreCase(String text, String str, int startIndex) { Matcher m = Pattern.compile(Pattern.quote(str), Pattern.CASE_INSENSITIVE).matcher(text); return m.find(startIndex) ? m.start() : -1; }
[ "public", "static", "int", "indexOfIgnoreCase", "(", "String", "text", ",", "String", "str", ",", "int", "startIndex", ")", "{", "Matcher", "m", "=", "Pattern", ".", "compile", "(", "Pattern", ".", "quote", "(", "str", ")", ",", "Pattern", ".", "CASE_INS...
Case insensitive version of {@link String#indexOf(java.lang.String, int)}. Equivalent to {@code text.indexOf(str, startIndex)}, except the matching is case insensitive.
[ "Case", "insensitive", "version", "of", "{" ]
train
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/util/StringUtils.java#L65-L68
innoq/LiQID
ldap-connector/src/main/java/com/innoq/ldap/connector/LdapHelper.java
LdapHelper.getGroup
@Override public Node getGroup(final String cn) { try { String query = "(&(objectClass=" + groupObjectClass + ")(" + groupIdentifyer + "=" + cn + "))"; SearchResult searchResult; Attributes attributes; SearchControls controls = new SearchControls(); controls.setReturningAttributes(new String[]{LdapKeys.ASTERISK, LdapKeys.MODIFY_TIMESTAMP, LdapKeys.MODIFIERS_NAME, LdapKeys.ENTRY_UUID}); controls.setSearchScope(SearchControls.SUBTREE_SCOPE); NamingEnumeration<SearchResult> results = ctx.search("", query, controls); queryCount++; if (results.hasMore()) { LdapGroup group = new LdapGroup(cn, this); searchResult = results.next(); group.setDn(searchResult.getNameInNamespace()); attributes = searchResult.getAttributes(); group = fillAttributesInGroup((LdapGroup) group, attributes); return group; } } catch (NamingException ex) { handleNamingException(instanceName + ":" + cn, ex); } return new LdapGroup(); }
java
@Override public Node getGroup(final String cn) { try { String query = "(&(objectClass=" + groupObjectClass + ")(" + groupIdentifyer + "=" + cn + "))"; SearchResult searchResult; Attributes attributes; SearchControls controls = new SearchControls(); controls.setReturningAttributes(new String[]{LdapKeys.ASTERISK, LdapKeys.MODIFY_TIMESTAMP, LdapKeys.MODIFIERS_NAME, LdapKeys.ENTRY_UUID}); controls.setSearchScope(SearchControls.SUBTREE_SCOPE); NamingEnumeration<SearchResult> results = ctx.search("", query, controls); queryCount++; if (results.hasMore()) { LdapGroup group = new LdapGroup(cn, this); searchResult = results.next(); group.setDn(searchResult.getNameInNamespace()); attributes = searchResult.getAttributes(); group = fillAttributesInGroup((LdapGroup) group, attributes); return group; } } catch (NamingException ex) { handleNamingException(instanceName + ":" + cn, ex); } return new LdapGroup(); }
[ "@", "Override", "public", "Node", "getGroup", "(", "final", "String", "cn", ")", "{", "try", "{", "String", "query", "=", "\"(&(objectClass=\"", "+", "groupObjectClass", "+", "\")(\"", "+", "groupIdentifyer", "+", "\"=\"", "+", "cn", "+", "\"))\"", ";", "...
Returns a LDAP-Group. @param cn the cn of that Group. @see com.innoq.liqid.model.Node#getName() @return the Node of that Group, either filled (if Group was found), or empty.
[ "Returns", "a", "LDAP", "-", "Group", "." ]
train
https://github.com/innoq/LiQID/blob/ae3de2c1fd78c40219780d510eba57c931901279/ldap-connector/src/main/java/com/innoq/ldap/connector/LdapHelper.java#L368-L391
census-instrumentation/opencensus-java
impl_core/src/main/java/io/opencensus/implcore/tags/propagation/CorrelationContextFormat.java
CorrelationContextFormat.encodeTag
private static int encodeTag(Tag tag, StringBuilder stringBuilder) { String key = tag.getKey().getName(); String value = tag.getValue().asString(); int charsOfTag = key.length() + value.length(); // This should never happen with our current constraints (<= 255 chars) on tags. checkArgument( charsOfTag <= TAG_SERIALIZED_SIZE_LIMIT, "Serialized size of tag " + tag + " exceeds limit " + TAG_SERIALIZED_SIZE_LIMIT); // TODO(songy23): do we want to encode TagMetadata? stringBuilder.append(key).append(TAG_KEY_VALUE_DELIMITER).append(value); return charsOfTag; }
java
private static int encodeTag(Tag tag, StringBuilder stringBuilder) { String key = tag.getKey().getName(); String value = tag.getValue().asString(); int charsOfTag = key.length() + value.length(); // This should never happen with our current constraints (<= 255 chars) on tags. checkArgument( charsOfTag <= TAG_SERIALIZED_SIZE_LIMIT, "Serialized size of tag " + tag + " exceeds limit " + TAG_SERIALIZED_SIZE_LIMIT); // TODO(songy23): do we want to encode TagMetadata? stringBuilder.append(key).append(TAG_KEY_VALUE_DELIMITER).append(value); return charsOfTag; }
[ "private", "static", "int", "encodeTag", "(", "Tag", "tag", ",", "StringBuilder", "stringBuilder", ")", "{", "String", "key", "=", "tag", ".", "getKey", "(", ")", ".", "getName", "(", ")", ";", "String", "value", "=", "tag", ".", "getValue", "(", ")", ...
Encodes the tag to the given string builder, and returns the length of encoded key-value pair.
[ "Encodes", "the", "tag", "to", "the", "given", "string", "builder", "and", "returns", "the", "length", "of", "encoded", "key", "-", "value", "pair", "." ]
train
https://github.com/census-instrumentation/opencensus-java/blob/deefac9bed77e40a2297bff1ca5ec5aa48a5f755/impl_core/src/main/java/io/opencensus/implcore/tags/propagation/CorrelationContextFormat.java#L127-L139
kuali/ojb-1.0.4
src/java/org/apache/ojb/broker/util/dbhandling/DBHandlingTask.java
DBHandlingTask.addIncludes
private void addIncludes(DBHandling handling, FileSet fileSet) throws BuildException { DirectoryScanner scanner = fileSet.getDirectoryScanner(getProject()); String[] files = scanner.getIncludedFiles(); StringBuffer includes = new StringBuffer(); for (int idx = 0; idx < files.length; idx++) { if (idx > 0) { includes.append(","); } includes.append(files[idx]); } try { handling.addDBDefinitionFiles(fileSet.getDir(getProject()).getAbsolutePath(), includes.toString()); } catch (IOException ex) { throw new BuildException(ex); } }
java
private void addIncludes(DBHandling handling, FileSet fileSet) throws BuildException { DirectoryScanner scanner = fileSet.getDirectoryScanner(getProject()); String[] files = scanner.getIncludedFiles(); StringBuffer includes = new StringBuffer(); for (int idx = 0; idx < files.length; idx++) { if (idx > 0) { includes.append(","); } includes.append(files[idx]); } try { handling.addDBDefinitionFiles(fileSet.getDir(getProject()).getAbsolutePath(), includes.toString()); } catch (IOException ex) { throw new BuildException(ex); } }
[ "private", "void", "addIncludes", "(", "DBHandling", "handling", ",", "FileSet", "fileSet", ")", "throws", "BuildException", "{", "DirectoryScanner", "scanner", "=", "fileSet", ".", "getDirectoryScanner", "(", "getProject", "(", ")", ")", ";", "String", "[", "]"...
Adds the includes of the fileset to the handling. @param handling The handling @param fileSet The fileset
[ "Adds", "the", "includes", "of", "the", "fileset", "to", "the", "handling", "." ]
train
https://github.com/kuali/ojb-1.0.4/blob/9a544372f67ce965f662cdc71609dd03683c8f04/src/java/org/apache/ojb/broker/util/dbhandling/DBHandlingTask.java#L271-L293
VoltDB/voltdb
src/frontend/org/voltdb/sysprocs/saverestore/SnapshotUtil.java
SnapshotUtil.writeSnapshotCatalog
public static Runnable writeSnapshotCatalog(String path, String nonce, boolean isTruncationSnapshot) throws IOException { String filename = SnapshotUtil.constructCatalogFilenameForNonce(nonce); try { return VoltDB.instance().getCatalogContext().writeCatalogJarToFile(path, filename, CatalogJarWriteMode.RECOVER); } catch (IOException ioe) { if (isTruncationSnapshot) { VoltDB.crashLocalVoltDB("Unexpected exception while attempting to create Catalog file for truncation snapshot", true, ioe); } throw new IOException("Unable to write snapshot catalog to file: " + path + File.separator + filename, ioe); } }
java
public static Runnable writeSnapshotCatalog(String path, String nonce, boolean isTruncationSnapshot) throws IOException { String filename = SnapshotUtil.constructCatalogFilenameForNonce(nonce); try { return VoltDB.instance().getCatalogContext().writeCatalogJarToFile(path, filename, CatalogJarWriteMode.RECOVER); } catch (IOException ioe) { if (isTruncationSnapshot) { VoltDB.crashLocalVoltDB("Unexpected exception while attempting to create Catalog file for truncation snapshot", true, ioe); } throw new IOException("Unable to write snapshot catalog to file: " + path + File.separator + filename, ioe); } }
[ "public", "static", "Runnable", "writeSnapshotCatalog", "(", "String", "path", ",", "String", "nonce", ",", "boolean", "isTruncationSnapshot", ")", "throws", "IOException", "{", "String", "filename", "=", "SnapshotUtil", ".", "constructCatalogFilenameForNonce", "(", "...
Write the current catalog associated with the database snapshot to the snapshot location
[ "Write", "the", "current", "catalog", "associated", "with", "the", "database", "snapshot", "to", "the", "snapshot", "location" ]
train
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/frontend/org/voltdb/sysprocs/saverestore/SnapshotUtil.java#L456-L474
timehop/sticky-headers-recyclerview
library/src/main/java/com/timehop/stickyheadersrecyclerview/HeaderPositionCalculator.java
HeaderPositionCalculator.itemIsObscuredByHeader
private boolean itemIsObscuredByHeader(RecyclerView parent, View item, View header, int orientation) { RecyclerView.LayoutParams layoutParams = (RecyclerView.LayoutParams) item.getLayoutParams(); mDimensionCalculator.initMargins(mTempRect1, header); int adapterPosition = parent.getChildAdapterPosition(item); if (adapterPosition == RecyclerView.NO_POSITION || mHeaderProvider.getHeader(parent, adapterPosition) != header) { // Resolves https://github.com/timehop/sticky-headers-recyclerview/issues/36 // Handles an edge case where a trailing header is smaller than the current sticky header. return false; } if (orientation == LinearLayoutManager.VERTICAL) { int itemTop = item.getTop() - layoutParams.topMargin; int headerBottom = getListTop(parent) + header.getBottom() + mTempRect1.bottom + mTempRect1.top; if (itemTop >= headerBottom) { return false; } } else { int itemLeft = item.getLeft() - layoutParams.leftMargin; int headerRight = getListLeft(parent) + header.getRight() + mTempRect1.right + mTempRect1.left; if (itemLeft >= headerRight) { return false; } } return true; }
java
private boolean itemIsObscuredByHeader(RecyclerView parent, View item, View header, int orientation) { RecyclerView.LayoutParams layoutParams = (RecyclerView.LayoutParams) item.getLayoutParams(); mDimensionCalculator.initMargins(mTempRect1, header); int adapterPosition = parent.getChildAdapterPosition(item); if (adapterPosition == RecyclerView.NO_POSITION || mHeaderProvider.getHeader(parent, adapterPosition) != header) { // Resolves https://github.com/timehop/sticky-headers-recyclerview/issues/36 // Handles an edge case where a trailing header is smaller than the current sticky header. return false; } if (orientation == LinearLayoutManager.VERTICAL) { int itemTop = item.getTop() - layoutParams.topMargin; int headerBottom = getListTop(parent) + header.getBottom() + mTempRect1.bottom + mTempRect1.top; if (itemTop >= headerBottom) { return false; } } else { int itemLeft = item.getLeft() - layoutParams.leftMargin; int headerRight = getListLeft(parent) + header.getRight() + mTempRect1.right + mTempRect1.left; if (itemLeft >= headerRight) { return false; } } return true; }
[ "private", "boolean", "itemIsObscuredByHeader", "(", "RecyclerView", "parent", ",", "View", "item", ",", "View", "header", ",", "int", "orientation", ")", "{", "RecyclerView", ".", "LayoutParams", "layoutParams", "=", "(", "RecyclerView", ".", "LayoutParams", ")",...
Determines if an item is obscured by a header @param parent @param item to determine if obscured by header @param header that might be obscuring the item @param orientation of the {@link RecyclerView} @return true if the item view is obscured by the header view
[ "Determines", "if", "an", "item", "is", "obscured", "by", "a", "header" ]
train
https://github.com/timehop/sticky-headers-recyclerview/blob/f5a9e9b8f5d96734e20439b0a41381865fa52fb7/library/src/main/java/com/timehop/stickyheadersrecyclerview/HeaderPositionCalculator.java#L218-L244
cdk/cdk
descriptor/qsar/src/main/java/org/openscience/cdk/qsar/AbstractBondDescriptor.java
AbstractBondDescriptor.cacheDescriptorValue
public void cacheDescriptorValue(IBond bond, IAtomContainer container, IDescriptorResult doubleResult) { if (cachedDescriptorValues == null) { cachedDescriptorValues = new HashMap(); cachedDescriptorValues.put(PREVIOUS_ATOMCONTAINER, container); } else if (cachedDescriptorValues.get(PREVIOUS_ATOMCONTAINER) != container) { cachedDescriptorValues.clear(); cachedDescriptorValues.put(PREVIOUS_ATOMCONTAINER, container); } cachedDescriptorValues.put(bond, doubleResult); }
java
public void cacheDescriptorValue(IBond bond, IAtomContainer container, IDescriptorResult doubleResult) { if (cachedDescriptorValues == null) { cachedDescriptorValues = new HashMap(); cachedDescriptorValues.put(PREVIOUS_ATOMCONTAINER, container); } else if (cachedDescriptorValues.get(PREVIOUS_ATOMCONTAINER) != container) { cachedDescriptorValues.clear(); cachedDescriptorValues.put(PREVIOUS_ATOMCONTAINER, container); } cachedDescriptorValues.put(bond, doubleResult); }
[ "public", "void", "cacheDescriptorValue", "(", "IBond", "bond", ",", "IAtomContainer", "container", ",", "IDescriptorResult", "doubleResult", ")", "{", "if", "(", "cachedDescriptorValues", "==", "null", ")", "{", "cachedDescriptorValues", "=", "new", "HashMap", "(",...
Caches a DescriptorValue for a given IBond. This method may only be called after setNewContainer() is called. @param bond IBond to cache the value for @param doubleResult DescriptorValue for the given IBond
[ "Caches", "a", "DescriptorValue", "for", "a", "given", "IBond", ".", "This", "method", "may", "only", "be", "called", "after", "setNewContainer", "()", "is", "called", "." ]
train
https://github.com/cdk/cdk/blob/c3d0f16502bf08df50365fee392e11d7c9856657/descriptor/qsar/src/main/java/org/openscience/cdk/qsar/AbstractBondDescriptor.java#L72-L81
PeterisP/LVTagger
src/main/java/edu/stanford/nlp/ie/EntityCachingAbstractSequencePrior.java
EntityCachingAbstractSequencePrior.extractEntity
public Entity extractEntity(int[] sequence, int position) { Entity entity = new Entity(); entity.type = sequence[position]; entity.startPosition = position; entity.words = new ArrayList<String>(); for ( ; position < sequence.length; position++) { if (sequence[position] == entity.type) { String word = doc.get(position).get(CoreAnnotations.TextAnnotation.class); entity.words.add(word); if (position == sequence.length - 1) { entity.otherOccurrences = otherOccurrences(entity); } } else { entity.otherOccurrences = otherOccurrences(entity); break; } } return entity; }
java
public Entity extractEntity(int[] sequence, int position) { Entity entity = new Entity(); entity.type = sequence[position]; entity.startPosition = position; entity.words = new ArrayList<String>(); for ( ; position < sequence.length; position++) { if (sequence[position] == entity.type) { String word = doc.get(position).get(CoreAnnotations.TextAnnotation.class); entity.words.add(word); if (position == sequence.length - 1) { entity.otherOccurrences = otherOccurrences(entity); } } else { entity.otherOccurrences = otherOccurrences(entity); break; } } return entity; }
[ "public", "Entity", "extractEntity", "(", "int", "[", "]", "sequence", ",", "int", "position", ")", "{", "Entity", "entity", "=", "new", "Entity", "(", ")", ";", "entity", ".", "type", "=", "sequence", "[", "position", "]", ";", "entity", ".", "startPo...
extracts the entity starting at the given position and adds it to the entity list. returns the index of the last element in the entity (<B>not</b> index+1)
[ "extracts", "the", "entity", "starting", "at", "the", "given", "position", "and", "adds", "it", "to", "the", "entity", "list", ".", "returns", "the", "index", "of", "the", "last", "element", "in", "the", "entity", "(", "<B", ">", "not<", "/", "b", ">",...
train
https://github.com/PeterisP/LVTagger/blob/b3d44bab9ec07ace0d13612c448a6b7298c1f681/src/main/java/edu/stanford/nlp/ie/EntityCachingAbstractSequencePrior.java#L122-L140