repository_name
stringlengths
7
58
func_path_in_repository
stringlengths
18
194
func_name
stringlengths
6
111
whole_func_string
stringlengths
80
3.8k
language
stringclasses
1 value
func_code_string
stringlengths
80
3.8k
func_code_tokens
listlengths
20
697
func_documentation_string
stringlengths
61
2k
func_documentation_tokens
listlengths
1
434
split_name
stringclasses
1 value
func_code_url
stringlengths
111
308
EasyinnovaSL/Tiff-Library-4J
src/main/java/com/easyinnova/tiff/profiles/BaselineProfile.java
BaselineProfile.checkImage
public void checkImage(IFD ifd, int n, IfdTags metadata) { CheckCommonFields(ifd, n, metadata); if (!metadata.containsTagId(TiffTags.getTagId("PhotometricInterpretation"))) { validation.addErrorLoc("Missing Photometric Interpretation", "IFD" + n); } else if (metadata.get(TiffTags.getTagId("PhotometricInterpretation")).getValue().size() != 1) { validation.addErrorLoc("Invalid Photometric Interpretation", "IFD" + n); } else { photometric = (int) metadata.get(TiffTags.getTagId("PhotometricInterpretation")).getFirstNumericValue(); switch (photometric) { case 0: case 1: if (!metadata.containsTagId(TiffTags.getTagId("BitsPerSample")) || metadata.get(TiffTags.getTagId("BitsPerSample")).getFirstNumericValue() == 1) { type = ImageType.BILEVEL; CheckBilevelImage(metadata, n); } else { type = ImageType.GRAYSCALE; CheckGrayscaleImage(metadata, n); } break; case 2: type = ImageType.RGB; CheckRGBImage(metadata, n); break; case 3: type = ImageType.PALETTE; CheckPalleteImage(metadata, n); break; case 4: type = ImageType.TRANSPARENCY_MASK; CheckTransparencyMask(metadata, n); break; case 5: type = ImageType.CMYK; CheckCMYK(metadata, n); break; case 6: type = ImageType.YCbCr; CheckYCbCr(metadata, n); break; case 8: case 9: case 10: type = ImageType.CIELab; CheckCIELab(metadata, n); break; default: validation.addWarning("Unknown Photometric Interpretation", "" + photometric, "IFD" + n); break; } } }
java
public void checkImage(IFD ifd, int n, IfdTags metadata) { CheckCommonFields(ifd, n, metadata); if (!metadata.containsTagId(TiffTags.getTagId("PhotometricInterpretation"))) { validation.addErrorLoc("Missing Photometric Interpretation", "IFD" + n); } else if (metadata.get(TiffTags.getTagId("PhotometricInterpretation")).getValue().size() != 1) { validation.addErrorLoc("Invalid Photometric Interpretation", "IFD" + n); } else { photometric = (int) metadata.get(TiffTags.getTagId("PhotometricInterpretation")).getFirstNumericValue(); switch (photometric) { case 0: case 1: if (!metadata.containsTagId(TiffTags.getTagId("BitsPerSample")) || metadata.get(TiffTags.getTagId("BitsPerSample")).getFirstNumericValue() == 1) { type = ImageType.BILEVEL; CheckBilevelImage(metadata, n); } else { type = ImageType.GRAYSCALE; CheckGrayscaleImage(metadata, n); } break; case 2: type = ImageType.RGB; CheckRGBImage(metadata, n); break; case 3: type = ImageType.PALETTE; CheckPalleteImage(metadata, n); break; case 4: type = ImageType.TRANSPARENCY_MASK; CheckTransparencyMask(metadata, n); break; case 5: type = ImageType.CMYK; CheckCMYK(metadata, n); break; case 6: type = ImageType.YCbCr; CheckYCbCr(metadata, n); break; case 8: case 9: case 10: type = ImageType.CIELab; CheckCIELab(metadata, n); break; default: validation.addWarning("Unknown Photometric Interpretation", "" + photometric, "IFD" + n); break; } } }
[ "public", "void", "checkImage", "(", "IFD", "ifd", ",", "int", "n", ",", "IfdTags", "metadata", ")", "{", "CheckCommonFields", "(", "ifd", ",", "n", ",", "metadata", ")", ";", "if", "(", "!", "metadata", ".", "containsTagId", "(", "TiffTags", ".", "get...
Check if the tags that define the image are correct and consistent. @param ifd the ifd @param n the ifd number @param metadata the ifd metadata
[ "Check", "if", "the", "tags", "that", "define", "the", "image", "are", "correct", "and", "consistent", "." ]
train
https://github.com/EasyinnovaSL/Tiff-Library-4J/blob/682605d3ed207a66213278c054c98f1b909472b7/src/main/java/com/easyinnova/tiff/profiles/BaselineProfile.java#L193-L246
nguillaumin/slick2d-maven
slick2d-core/src/main/java/org/newdawn/slick/particles/ParticleSystem.java
ParticleSystem.moveAll
public void moveAll(ParticleEmitter emitter, float x, float y) { ParticlePool pool = (ParticlePool) particlesByEmitter.get(emitter); for (int i=0;i<pool.particles.length;i++) { if (pool.particles[i].inUse()) { pool.particles[i].move(x, y); } } }
java
public void moveAll(ParticleEmitter emitter, float x, float y) { ParticlePool pool = (ParticlePool) particlesByEmitter.get(emitter); for (int i=0;i<pool.particles.length;i++) { if (pool.particles[i].inUse()) { pool.particles[i].move(x, y); } } }
[ "public", "void", "moveAll", "(", "ParticleEmitter", "emitter", ",", "float", "x", ",", "float", "y", ")", "{", "ParticlePool", "pool", "=", "(", "ParticlePool", ")", "particlesByEmitter", ".", "get", "(", "emitter", ")", ";", "for", "(", "int", "i", "="...
Move all the particles owned by the specified emitter @param emitter The emitter owning the particles that should be released @param x The amount on the x axis to move the particles @param y The amount on the y axis to move the particles
[ "Move", "all", "the", "particles", "owned", "by", "the", "specified", "emitter" ]
train
https://github.com/nguillaumin/slick2d-maven/blob/8251f88a0ed6a70e726d2468842455cd1f80893f/slick2d-core/src/main/java/org/newdawn/slick/particles/ParticleSystem.java#L607-L614
bbossgroups/bboss-elasticsearch
bboss-elasticsearch-rest/src/main/java/org/frameworkset/elasticsearch/client/BuildTool.java
BuildTool.buildMeta
public static void buildMeta(Writer writer ,String indexType,String indexName, Object params,String action,ClientOptions clientOption,boolean upper7) throws IOException { if(params instanceof Map){ buildMapMeta( writer , indexType, indexName, (Map) params, action, clientOption, upper7); return; } Object id = null; Object parentId = null; Object routing = null; Object esRetryOnConflict = null; Object version = null; Object versionType = null; if(clientOption != null) { ClassUtil.ClassInfo beanClassInfo = ClassUtil.getClassInfo(params.getClass()); id = clientOption.getIdField() != null ? BuildTool.getId(params, beanClassInfo, clientOption.getIdField()) : null; parentId = clientOption.getParentIdField() != null ? BuildTool.getParentId(params, beanClassInfo, clientOption.getParentIdField()) : null; routing = clientOption.getRountField() != null ? BuildTool.getRouting(params, beanClassInfo, clientOption.getRountField()) : null; esRetryOnConflict = clientOption.getEsRetryOnConflictField() != null ? BuildTool.getEsRetryOnConflict(params, beanClassInfo, clientOption.getEsRetryOnConflictField()) : null; version = clientOption.getVersionField() != null ? BuildTool.getEsRetryOnConflict(params, beanClassInfo,clientOption.getVersionField()) : null; versionType = clientOption.getVersionTypeField() != null ? BuildTool.getEsRetryOnConflict(params, beanClassInfo,clientOption.getVersionTypeField()) : null; } buildMeta( writer , indexType, indexName, params, action, id, parentId,routing,esRetryOnConflict,version,versionType, upper7); }
java
public static void buildMeta(Writer writer ,String indexType,String indexName, Object params,String action,ClientOptions clientOption,boolean upper7) throws IOException { if(params instanceof Map){ buildMapMeta( writer , indexType, indexName, (Map) params, action, clientOption, upper7); return; } Object id = null; Object parentId = null; Object routing = null; Object esRetryOnConflict = null; Object version = null; Object versionType = null; if(clientOption != null) { ClassUtil.ClassInfo beanClassInfo = ClassUtil.getClassInfo(params.getClass()); id = clientOption.getIdField() != null ? BuildTool.getId(params, beanClassInfo, clientOption.getIdField()) : null; parentId = clientOption.getParentIdField() != null ? BuildTool.getParentId(params, beanClassInfo, clientOption.getParentIdField()) : null; routing = clientOption.getRountField() != null ? BuildTool.getRouting(params, beanClassInfo, clientOption.getRountField()) : null; esRetryOnConflict = clientOption.getEsRetryOnConflictField() != null ? BuildTool.getEsRetryOnConflict(params, beanClassInfo, clientOption.getEsRetryOnConflictField()) : null; version = clientOption.getVersionField() != null ? BuildTool.getEsRetryOnConflict(params, beanClassInfo,clientOption.getVersionField()) : null; versionType = clientOption.getVersionTypeField() != null ? BuildTool.getEsRetryOnConflict(params, beanClassInfo,clientOption.getVersionTypeField()) : null; } buildMeta( writer , indexType, indexName, params, action, id, parentId,routing,esRetryOnConflict,version,versionType, upper7); }
[ "public", "static", "void", "buildMeta", "(", "Writer", "writer", ",", "String", "indexType", ",", "String", "indexName", ",", "Object", "params", ",", "String", "action", ",", "ClientOptions", "clientOption", ",", "boolean", "upper7", ")", "throws", "IOExceptio...
String docIdKey,String parentIdKey,String routingKey @param writer @param indexType @param indexName @param params @param action @throws IOException
[ "String", "docIdKey", "String", "parentIdKey", "String", "routingKey" ]
train
https://github.com/bbossgroups/bboss-elasticsearch/blob/31717c8aa2c4c880987be53aeeb8a0cf5183c3a7/bboss-elasticsearch-rest/src/main/java/org/frameworkset/elasticsearch/client/BuildTool.java#L347-L369
sdl/odata
odata_renderer/src/main/java/com/sdl/odata/ODataRendererUtils.java
ODataRendererUtils.getContextURL
public static String getContextURL(ODataUri oDataUri, EntityDataModel entityDataModel) throws ODataRenderException { return getContextURL(oDataUri, entityDataModel, false); }
java
public static String getContextURL(ODataUri oDataUri, EntityDataModel entityDataModel) throws ODataRenderException { return getContextURL(oDataUri, entityDataModel, false); }
[ "public", "static", "String", "getContextURL", "(", "ODataUri", "oDataUri", ",", "EntityDataModel", "entityDataModel", ")", "throws", "ODataRenderException", "{", "return", "getContextURL", "(", "oDataUri", ",", "entityDataModel", ",", "false", ")", ";", "}" ]
This method returns odata context based on oDataUri. Throws ODataRenderException in case context is not defined. @param entityDataModel The entity data model. @param oDataUri is object which is the root of an abstract syntax tree that describes @return string that represents context @throws ODataRenderException if unable to get context from url
[ "This", "method", "returns", "odata", "context", "based", "on", "oDataUri", ".", "Throws", "ODataRenderException", "in", "case", "context", "is", "not", "defined", "." ]
train
https://github.com/sdl/odata/blob/eb747d73e9af0f4e59a25b82ed656e526a7e2189/odata_renderer/src/main/java/com/sdl/odata/ODataRendererUtils.java#L51-L53
facebookarchive/hadoop-20
src/core/org/apache/hadoop/io/WritableName.java
WritableName.setName
public static synchronized void setName(Class writableClass, String name) { CLASS_TO_NAME.put(writableClass, name); NAME_TO_CLASS.put(name, writableClass); }
java
public static synchronized void setName(Class writableClass, String name) { CLASS_TO_NAME.put(writableClass, name); NAME_TO_CLASS.put(name, writableClass); }
[ "public", "static", "synchronized", "void", "setName", "(", "Class", "writableClass", ",", "String", "name", ")", "{", "CLASS_TO_NAME", ".", "put", "(", "writableClass", ",", "name", ")", ";", "NAME_TO_CLASS", ".", "put", "(", "name", ",", "writableClass", "...
Set the name that a class should be known as to something other than the class name.
[ "Set", "the", "name", "that", "a", "class", "should", "be", "known", "as", "to", "something", "other", "than", "the", "class", "name", "." ]
train
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/core/org/apache/hadoop/io/WritableName.java#L46-L49
before/quality-check
modules/quality-check/src/main/java/net/sf/qualitycheck/Check.java
Check.isNumber
@ArgumentsChecked @Throws({ IllegalNullArgumentException.class, IllegalNumberArgumentException.class }) public static <T extends Number> T isNumber(@Nonnull final String value, @Nullable final String name, @Nonnull final Class<T> type) { Check.notNull(value, "value"); Check.notNull(type, "type"); final Number ret; try { ret = checkNumberInRange(value, type); } catch (final NumberFormatException nfe) { if (name == null) { throw new IllegalNumberArgumentException(value, nfe); } else { throw new IllegalNumberArgumentException(name, value, nfe); } } return type.cast(ret); }
java
@ArgumentsChecked @Throws({ IllegalNullArgumentException.class, IllegalNumberArgumentException.class }) public static <T extends Number> T isNumber(@Nonnull final String value, @Nullable final String name, @Nonnull final Class<T> type) { Check.notNull(value, "value"); Check.notNull(type, "type"); final Number ret; try { ret = checkNumberInRange(value, type); } catch (final NumberFormatException nfe) { if (name == null) { throw new IllegalNumberArgumentException(value, nfe); } else { throw new IllegalNumberArgumentException(name, value, nfe); } } return type.cast(ret); }
[ "@", "ArgumentsChecked", "@", "Throws", "(", "{", "IllegalNullArgumentException", ".", "class", ",", "IllegalNumberArgumentException", ".", "class", "}", ")", "public", "static", "<", "T", "extends", "Number", ">", "T", "isNumber", "(", "@", "Nonnull", "final", ...
Ensures that a String argument is a number. This overload supports all subclasses of {@code Number}. The number is first converted to a {@code BigDecimal} or {@code BigInteger}. Floating point types are only supported if the {@code type} is one of {@code Float, Double, BigDecimal}. <p> This method does also check against the ranges of the given datatypes. @param value value which must be a number and in the range of the given datatype. @param name (optional) name of object reference (in source code). @param type requested return value type, must be a subclass of {@code Number}, i.e. one of {@code BigDecimal, BigInteger, Byte, Double, Float, Integer, Long, Short} @return the given string argument converted to a number of the requested type @throws IllegalNumberArgumentException if the given argument {@code value} is no number
[ "Ensures", "that", "a", "String", "argument", "is", "a", "number", ".", "This", "overload", "supports", "all", "subclasses", "of", "{", "@code", "Number", "}", ".", "The", "number", "is", "first", "converted", "to", "a", "{", "@code", "BigDecimal", "}", ...
train
https://github.com/before/quality-check/blob/a75c32c39434ddb1f89bece57acae0536724c15a/modules/quality-check/src/main/java/net/sf/qualitycheck/Check.java#L1294-L1312
lessthanoptimal/ejml
main/ejml-ddense/src/org/ejml/dense/row/decomposition/eig/watched/WatchedDoubleStepQREigen_DDRM.java
WatchedDoubleStepQREigen_DDRM.exceptionalShift
public void exceptionalShift( int x1 , int x2) { if( printHumps ) System.out.println("Performing exceptional implicit double step"); // perform a random shift that is of the same magnitude as the matrix double val = Math.abs(A.get(x2,x2)); if( val == 0 ) val = 1; numExceptional++; // the closer the value is the better it handles identical eigenvalues cases double p = 1.0 - Math.pow(0.1,numExceptional); val *= p+2.0*(1.0-p)*(rand.nextDouble()-0.5); if( rand.nextBoolean() ) val = -val; performImplicitSingleStep(x1,x2,val); lastExceptional = steps; }
java
public void exceptionalShift( int x1 , int x2) { if( printHumps ) System.out.println("Performing exceptional implicit double step"); // perform a random shift that is of the same magnitude as the matrix double val = Math.abs(A.get(x2,x2)); if( val == 0 ) val = 1; numExceptional++; // the closer the value is the better it handles identical eigenvalues cases double p = 1.0 - Math.pow(0.1,numExceptional); val *= p+2.0*(1.0-p)*(rand.nextDouble()-0.5); if( rand.nextBoolean() ) val = -val; performImplicitSingleStep(x1,x2,val); lastExceptional = steps; }
[ "public", "void", "exceptionalShift", "(", "int", "x1", ",", "int", "x2", ")", "{", "if", "(", "printHumps", ")", "System", ".", "out", ".", "println", "(", "\"Performing exceptional implicit double step\"", ")", ";", "// perform a random shift that is of the same mag...
Perform a shift in a random direction that is of the same magnitude as the elements in the matrix.
[ "Perform", "a", "shift", "in", "a", "random", "direction", "that", "is", "of", "the", "same", "magnitude", "as", "the", "elements", "in", "the", "matrix", "." ]
train
https://github.com/lessthanoptimal/ejml/blob/1444680cc487af5e866730e62f48f5f9636850d9/main/ejml-ddense/src/org/ejml/dense/row/decomposition/eig/watched/WatchedDoubleStepQREigen_DDRM.java#L166-L187
transloadit/java-sdk
src/main/java/com/transloadit/sdk/OptionsBuilder.java
OptionsBuilder.addStep
public void addStep(String name, String robot, Map<String, Object> options){ steps.addStep(name, robot, options); }
java
public void addStep(String name, String robot, Map<String, Object> options){ steps.addStep(name, robot, options); }
[ "public", "void", "addStep", "(", "String", "name", ",", "String", "robot", ",", "Map", "<", "String", ",", "Object", ">", "options", ")", "{", "steps", ".", "addStep", "(", "name", ",", "robot", ",", "options", ")", ";", "}" ]
Adds a step to the steps. @param name {@link String} name of the step @param robot {@link String} name of the robot used by the step. @param options {@link Map} extra options required for the step.
[ "Adds", "a", "step", "to", "the", "steps", "." ]
train
https://github.com/transloadit/java-sdk/blob/9326c540a66f77b3d907d0b2c05bff1145ca14f7/src/main/java/com/transloadit/sdk/OptionsBuilder.java#L20-L22
Azure/autorest-clientruntime-for-java
azure-arm-client-runtime/src/main/java/com/microsoft/azure/arm/utils/Utils.java
Utils.createOdataFilterForTags
public static String createOdataFilterForTags(String tagName, String tagValue) { if (tagName == null) { return null; } else if (tagValue == null) { return String.format("tagname eq '%s'", tagName); } else { return String.format("tagname eq '%s' and tagvalue eq '%s'", tagName, tagValue); } }
java
public static String createOdataFilterForTags(String tagName, String tagValue) { if (tagName == null) { return null; } else if (tagValue == null) { return String.format("tagname eq '%s'", tagName); } else { return String.format("tagname eq '%s' and tagvalue eq '%s'", tagName, tagValue); } }
[ "public", "static", "String", "createOdataFilterForTags", "(", "String", "tagName", ",", "String", "tagValue", ")", "{", "if", "(", "tagName", "==", "null", ")", "{", "return", "null", ";", "}", "else", "if", "(", "tagValue", "==", "null", ")", "{", "ret...
Creates an Odata filter string that can be used for filtering list results by tags. @param tagName the name of the tag. If not provided, all resources will be returned. @param tagValue the value of the tag. If not provided, only tag name will be filtered. @return the Odata filter to pass into list methods
[ "Creates", "an", "Odata", "filter", "string", "that", "can", "be", "used", "for", "filtering", "list", "results", "by", "tags", "." ]
train
https://github.com/Azure/autorest-clientruntime-for-java/blob/04621e07dbb0456dd5459dd641f06a9fd4f3abad/azure-arm-client-runtime/src/main/java/com/microsoft/azure/arm/utils/Utils.java#L90-L98
alkacon/opencms-core
src-gwt/org/opencms/ade/galleries/client/CmsVfsTabHandler.java
CmsVfsTabHandler.getSubFolders
public void getSubFolders(String path, AsyncCallback<List<CmsVfsEntryBean>> callback) { m_controller.getSubFolders(path, callback); }
java
public void getSubFolders(String path, AsyncCallback<List<CmsVfsEntryBean>> callback) { m_controller.getSubFolders(path, callback); }
[ "public", "void", "getSubFolders", "(", "String", "path", ",", "AsyncCallback", "<", "List", "<", "CmsVfsEntryBean", ">", ">", "callback", ")", "{", "m_controller", ".", "getSubFolders", "(", "path", ",", "callback", ")", ";", "}" ]
Gets the sub-folders of a given folder.<p> @param path the path of the folder whose subfolders should be retrieved @param callback the callback for processing the subfolders
[ "Gets", "the", "sub", "-", "folders", "of", "a", "given", "folder", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/ade/galleries/client/CmsVfsTabHandler.java#L123-L126
looly/hutool
hutool-core/src/main/java/cn/hutool/core/codec/Rot.java
Rot.encodeChar
private static char encodeChar(char c, int offset, boolean isDecodeNumber) { if (isDecodeNumber) { if (c >= CHAR0 && c <= CHAR9) { c -= CHAR0; c = (char) ((c + offset) % 10); c += CHAR0; } } // A == 65, Z == 90 if (c >= ACHAR && c <= ZCHAR) { c -= ACHAR; c = (char) ((c + offset) % 26); c += ACHAR; } // a == 97, z == 122. else if (c >= aCHAR && c <= zCHAR) { c -= aCHAR; c = (char) ((c + offset) % 26); c += aCHAR; } return c; }
java
private static char encodeChar(char c, int offset, boolean isDecodeNumber) { if (isDecodeNumber) { if (c >= CHAR0 && c <= CHAR9) { c -= CHAR0; c = (char) ((c + offset) % 10); c += CHAR0; } } // A == 65, Z == 90 if (c >= ACHAR && c <= ZCHAR) { c -= ACHAR; c = (char) ((c + offset) % 26); c += ACHAR; } // a == 97, z == 122. else if (c >= aCHAR && c <= zCHAR) { c -= aCHAR; c = (char) ((c + offset) % 26); c += aCHAR; } return c; }
[ "private", "static", "char", "encodeChar", "(", "char", "c", ",", "int", "offset", ",", "boolean", "isDecodeNumber", ")", "{", "if", "(", "isDecodeNumber", ")", "{", "if", "(", "c", ">=", "CHAR0", "&&", "c", "<=", "CHAR9", ")", "{", "c", "-=", "CHAR0...
解码字符 @param c 字符 @param offset 位移 @param isDecodeNumber 是否解码数字 @return 解码后的字符串
[ "解码字符" ]
train
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/codec/Rot.java#L106-L128
google/error-prone-javac
src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/PropertyBuilder.java
PropertyBuilder.buildSignature
public void buildSignature(XMLNode node, Content propertyDocTree) { propertyDocTree.addContent(writer.getSignature(currentProperty)); }
java
public void buildSignature(XMLNode node, Content propertyDocTree) { propertyDocTree.addContent(writer.getSignature(currentProperty)); }
[ "public", "void", "buildSignature", "(", "XMLNode", "node", ",", "Content", "propertyDocTree", ")", "{", "propertyDocTree", ".", "addContent", "(", "writer", ".", "getSignature", "(", "currentProperty", ")", ")", ";", "}" ]
Build the signature. @param node the XML element that specifies which components to document @param propertyDocTree the content tree to which the documentation will be added
[ "Build", "the", "signature", "." ]
train
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/PropertyBuilder.java#L164-L166
cubedtear/aritzh
aritzh-gameEngine/src/main/java/io/github/aritzhack/aritzh/awt/util/SpriteUtil.java
SpriteUtil.rotate90
public static Sprite rotate90(Sprite original, Rotation angle) { int newWidth = angle == Rotation._180 ? original.getWidth() : original.getHeight(); int newHeight = angle == Rotation._180 ? original.getHeight() : original.getWidth(); int[] newPix = new int[original.getPixels().length]; for (int x = 0; x < original.getWidth(); x++) { for (int y = 0; y < original.getHeight(); y++) { int newY = angle == Rotation._90 ? x : angle == Rotation._180 ? original.getHeight() - y - 1 : original.getWidth() - x - 1; int newX = angle == Rotation._90 ? original.getHeight() - y - 1 : angle == Rotation._180 ? original.getWidth() - x - 1 : y; newPix[newX + newY * newWidth] = original.getPixels()[x + y * original.getWidth()]; } } return new Sprite(newWidth, newHeight, newPix); }
java
public static Sprite rotate90(Sprite original, Rotation angle) { int newWidth = angle == Rotation._180 ? original.getWidth() : original.getHeight(); int newHeight = angle == Rotation._180 ? original.getHeight() : original.getWidth(); int[] newPix = new int[original.getPixels().length]; for (int x = 0; x < original.getWidth(); x++) { for (int y = 0; y < original.getHeight(); y++) { int newY = angle == Rotation._90 ? x : angle == Rotation._180 ? original.getHeight() - y - 1 : original.getWidth() - x - 1; int newX = angle == Rotation._90 ? original.getHeight() - y - 1 : angle == Rotation._180 ? original.getWidth() - x - 1 : y; newPix[newX + newY * newWidth] = original.getPixels()[x + y * original.getWidth()]; } } return new Sprite(newWidth, newHeight, newPix); }
[ "public", "static", "Sprite", "rotate90", "(", "Sprite", "original", ",", "Rotation", "angle", ")", "{", "int", "newWidth", "=", "angle", "==", "Rotation", ".", "_180", "?", "original", ".", "getWidth", "(", ")", ":", "original", ".", "getHeight", "(", "...
Rotates an image by multiples of 90 degrees This is a much faster version of {@link io.github.aritzhack.aritzh.awt.util.SpriteUtil#rotate(io.github.aritzhack.aritzh.awt.render.Sprite, double) SpriteUtil.rotate(Sprite, double)} @param original The sprite to rotate @param angle The rotation angle @return The rotated sprite
[ "Rotates", "an", "image", "by", "multiples", "of", "90", "degrees", "This", "is", "a", "much", "faster", "version", "of", "{", "@link", "io", ".", "github", ".", "aritzhack", ".", "aritzh", ".", "awt", ".", "util", ".", "SpriteUtil#rotate", "(", "io", ...
train
https://github.com/cubedtear/aritzh/blob/bc7493447a1a6088c4a7306ca4d0f0c20278364f/aritzh-gameEngine/src/main/java/io/github/aritzhack/aritzh/awt/util/SpriteUtil.java#L367-L381
tvesalainen/util
security/src/main/java/org/vesalainen/net/ssl/SSLServerSocketChannel.java
SSLServerSocketChannel.open
public static SSLServerSocketChannel open(int port, SSLContext sslContext) throws IOException { return open(new InetSocketAddress(port), sslContext); }
java
public static SSLServerSocketChannel open(int port, SSLContext sslContext) throws IOException { return open(new InetSocketAddress(port), sslContext); }
[ "public", "static", "SSLServerSocketChannel", "open", "(", "int", "port", ",", "SSLContext", "sslContext", ")", "throws", "IOException", "{", "return", "open", "(", "new", "InetSocketAddress", "(", "port", ")", ",", "sslContext", ")", ";", "}" ]
Creates and binds SSLServerSocketChannel using given SSLContext. @param port @param sslContext @return @throws IOException
[ "Creates", "and", "binds", "SSLServerSocketChannel", "using", "given", "SSLContext", "." ]
train
https://github.com/tvesalainen/util/blob/bba7a44689f638ffabc8be40a75bdc9a33676433/security/src/main/java/org/vesalainen/net/ssl/SSLServerSocketChannel.java#L94-L97
Stratio/stratio-cassandra
src/java/org/apache/cassandra/db/DataTracker.java
DataTracker.markCompactedSSTablesReplaced
public void markCompactedSSTablesReplaced(Collection<SSTableReader> oldSSTables, Collection<SSTableReader> allReplacements, OperationType compactionType) { removeSSTablesFromTracker(oldSSTables); releaseReferences(oldSSTables, false); notifySSTablesChanged(oldSSTables, allReplacements, compactionType); addNewSSTablesSize(allReplacements); }
java
public void markCompactedSSTablesReplaced(Collection<SSTableReader> oldSSTables, Collection<SSTableReader> allReplacements, OperationType compactionType) { removeSSTablesFromTracker(oldSSTables); releaseReferences(oldSSTables, false); notifySSTablesChanged(oldSSTables, allReplacements, compactionType); addNewSSTablesSize(allReplacements); }
[ "public", "void", "markCompactedSSTablesReplaced", "(", "Collection", "<", "SSTableReader", ">", "oldSSTables", ",", "Collection", "<", "SSTableReader", ">", "allReplacements", ",", "OperationType", "compactionType", ")", "{", "removeSSTablesFromTracker", "(", "oldSSTable...
that they have been replaced by the provided sstables, which must have been performed by an earlier replaceReaders() call
[ "that", "they", "have", "been", "replaced", "by", "the", "provided", "sstables", "which", "must", "have", "been", "performed", "by", "an", "earlier", "replaceReaders", "()", "call" ]
train
https://github.com/Stratio/stratio-cassandra/blob/f6416b43ad5309083349ad56266450fa8c6a2106/src/java/org/apache/cassandra/db/DataTracker.java#L275-L281
apache/fluo
modules/api/src/main/java/org/apache/fluo/api/data/Bytes.java
Bytes.compareTo
public int compareTo(byte[] bytes, int offset, int len) { Preconditions.checkArgument(offset >= 0 && len >= 0 && offset + len <= bytes.length); return compareToUnchecked(bytes, offset, len); }
java
public int compareTo(byte[] bytes, int offset, int len) { Preconditions.checkArgument(offset >= 0 && len >= 0 && offset + len <= bytes.length); return compareToUnchecked(bytes, offset, len); }
[ "public", "int", "compareTo", "(", "byte", "[", "]", "bytes", ",", "int", "offset", ",", "int", "len", ")", "{", "Preconditions", ".", "checkArgument", "(", "offset", ">=", "0", "&&", "len", ">=", "0", "&&", "offset", "+", "len", "<=", "bytes", ".", ...
Compares this to the passed bytes, byte by byte, returning a negative, zero, or positive result if the first sequence is less than, equal to, or greater than the second. The comparison is performed starting with the first byte of each sequence, and proceeds until a pair of bytes differs, or one sequence runs out of byte (is shorter). A shorter sequence is considered less than a longer one. This method checks the arguments passed to it. @since 1.2.0 @return comparison result
[ "Compares", "this", "to", "the", "passed", "bytes", "byte", "by", "byte", "returning", "a", "negative", "zero", "or", "positive", "result", "if", "the", "first", "sequence", "is", "less", "than", "equal", "to", "or", "greater", "than", "the", "second", "."...
train
https://github.com/apache/fluo/blob/8e06204d4167651e2d3b5219b8c1397644e6ba6e/modules/api/src/main/java/org/apache/fluo/api/data/Bytes.java#L233-L236
BorderTech/wcomponents
wcomponents-core/src/main/java/com/github/bordertech/wcomponents/util/Base64Util.java
Base64Util.encodeString
public static String encodeString(final String string, final String encoding) throws UnsupportedEncodingException { byte[] stringBytes = string.getBytes(encoding); return encode(stringBytes); }
java
public static String encodeString(final String string, final String encoding) throws UnsupportedEncodingException { byte[] stringBytes = string.getBytes(encoding); return encode(stringBytes); }
[ "public", "static", "String", "encodeString", "(", "final", "String", "string", ",", "final", "String", "encoding", ")", "throws", "UnsupportedEncodingException", "{", "byte", "[", "]", "stringBytes", "=", "string", ".", "getBytes", "(", "encoding", ")", ";", ...
Encodes a string into Base64 format. No blanks or line breaks are inserted. @param string a String to be encoded. @param encoding The character encoding of the string. @return A String with the Base64 encoded data. @throws UnsupportedEncodingException if the java runtime does not support <code>encoding</code>.
[ "Encodes", "a", "string", "into", "Base64", "format", ".", "No", "blanks", "or", "line", "breaks", "are", "inserted", "." ]
train
https://github.com/BorderTech/wcomponents/blob/d1a2b2243270067db030feb36ca74255aaa94436/wcomponents-core/src/main/java/com/github/bordertech/wcomponents/util/Base64Util.java#L102-L106
nextreports/nextreports-engine
src/ro/nextreports/engine/util/DateUtil.java
DateUtil.addHours
public static Date addHours(Date d, int hours) { Calendar cal = Calendar.getInstance(); cal.setTime(d); cal.add(Calendar.HOUR_OF_DAY, hours); return cal.getTime(); }
java
public static Date addHours(Date d, int hours) { Calendar cal = Calendar.getInstance(); cal.setTime(d); cal.add(Calendar.HOUR_OF_DAY, hours); return cal.getTime(); }
[ "public", "static", "Date", "addHours", "(", "Date", "d", ",", "int", "hours", ")", "{", "Calendar", "cal", "=", "Calendar", ".", "getInstance", "(", ")", ";", "cal", ".", "setTime", "(", "d", ")", ";", "cal", ".", "add", "(", "Calendar", ".", "HOU...
Add hours to a date @param d date @param hours hours @return new date
[ "Add", "hours", "to", "a", "date" ]
train
https://github.com/nextreports/nextreports-engine/blob/a847575a9298b5fce63b88961190c5b83ddccc44/src/ro/nextreports/engine/util/DateUtil.java#L457-L462
qspin/qtaste
plugins_src/javagui/src/main/java/com/qspin/qtaste/javagui/server/TabGetter.java
TabGetter.executeCommand
@Override public String executeCommand(int timeout, String componentName, Object... data) throws QTasteException { Component component = getComponentByName(componentName); // sanity checks if (component == null) { throw new QTasteTestFailException("Unable to find the component named '" + componentName + "'"); } if (!(component instanceof JTabbedPane)) { throw new QTasteTestFailException("The component named '" + componentName + "' is not a JTabbedPane"); } // get the requested value JTabbedPane tabbedPane = (JTabbedPane) component; int currentIndex = tabbedPane.getSelectedIndex(); String result = null; switch (mInfoSelector) { case GET_INDEX: result = String.valueOf(currentIndex); break; case GET_TITLE: if (currentIndex >= 0) { result = tabbedPane.getTitleAt(currentIndex); } break; case GET_COMPONENT_ID: if (currentIndex >= 0) { result = tabbedPane.getComponentAt(currentIndex).getName(); } break; default: throw new QTasteTestFailException("Bad selector identifier"); } return result; }
java
@Override public String executeCommand(int timeout, String componentName, Object... data) throws QTasteException { Component component = getComponentByName(componentName); // sanity checks if (component == null) { throw new QTasteTestFailException("Unable to find the component named '" + componentName + "'"); } if (!(component instanceof JTabbedPane)) { throw new QTasteTestFailException("The component named '" + componentName + "' is not a JTabbedPane"); } // get the requested value JTabbedPane tabbedPane = (JTabbedPane) component; int currentIndex = tabbedPane.getSelectedIndex(); String result = null; switch (mInfoSelector) { case GET_INDEX: result = String.valueOf(currentIndex); break; case GET_TITLE: if (currentIndex >= 0) { result = tabbedPane.getTitleAt(currentIndex); } break; case GET_COMPONENT_ID: if (currentIndex >= 0) { result = tabbedPane.getComponentAt(currentIndex).getName(); } break; default: throw new QTasteTestFailException("Bad selector identifier"); } return result; }
[ "@", "Override", "public", "String", "executeCommand", "(", "int", "timeout", ",", "String", "componentName", ",", "Object", "...", "data", ")", "throws", "QTasteException", "{", "Component", "component", "=", "getComponentByName", "(", "componentName", ")", ";", ...
Executes the a command on a component. @param timeout a timeout for the command execution (not used here) @param componentName name of the component to execute the command on. @param data additional data (not used here) @return the selected tab index, title or id, according to the specified info selector. @throws QTasteException
[ "Executes", "the", "a", "command", "on", "a", "component", "." ]
train
https://github.com/qspin/qtaste/blob/ba45d4d86eb29b92f157c6e98536dee2002ddfdc/plugins_src/javagui/src/main/java/com/qspin/qtaste/javagui/server/TabGetter.java#L61-L102
Javacord/Javacord
javacord-core/src/main/java/org/javacord/core/entity/message/MessageSetImpl.java
MessageSetImpl.requestAsMessages
private static MessageSet requestAsMessages(TextChannel channel, int limit, long before, long after) { DiscordApiImpl api = (DiscordApiImpl) channel.getApi(); return new MessageSetImpl( requestAsJsonNodes(channel, limit, before, after).stream() .map(jsonNode -> api.getOrCreateMessage(channel, jsonNode)) .collect(Collectors.toList())); }
java
private static MessageSet requestAsMessages(TextChannel channel, int limit, long before, long after) { DiscordApiImpl api = (DiscordApiImpl) channel.getApi(); return new MessageSetImpl( requestAsJsonNodes(channel, limit, before, after).stream() .map(jsonNode -> api.getOrCreateMessage(channel, jsonNode)) .collect(Collectors.toList())); }
[ "private", "static", "MessageSet", "requestAsMessages", "(", "TextChannel", "channel", ",", "int", "limit", ",", "long", "before", ",", "long", "after", ")", "{", "DiscordApiImpl", "api", "=", "(", "DiscordApiImpl", ")", "channel", ".", "getApi", "(", ")", "...
Requests the messages from Discord. @param channel The channel of which to get messages from. @param limit The limit of messages to get. @param before Get messages before the message with this id. @param after Get messages after the message with this id. @return The messages.
[ "Requests", "the", "messages", "from", "Discord", "." ]
train
https://github.com/Javacord/Javacord/blob/915aad084dc5e863284267529d0dccd625fc6886/javacord-core/src/main/java/org/javacord/core/entity/message/MessageSetImpl.java#L757-L763
khuxtable/seaglass
src/main/java/com/seaglasslookandfeel/painter/util/ShapeGenerator.java
ShapeGenerator.createEllipseInternal
private Shape createEllipseInternal(int x, int y, int w, int h) { ellipse.setFrame(x, y, w, h); return ellipse; }
java
private Shape createEllipseInternal(int x, int y, int w, int h) { ellipse.setFrame(x, y, w, h); return ellipse; }
[ "private", "Shape", "createEllipseInternal", "(", "int", "x", ",", "int", "y", ",", "int", "w", ",", "int", "h", ")", "{", "ellipse", ".", "setFrame", "(", "x", ",", "y", ",", "w", ",", "h", ")", ";", "return", "ellipse", ";", "}" ]
Return a path for an ellipse. @param x the X coordinate of the upper-left corner of the ellipse @param y the Y coordinate of the upper-left corner of the ellipse @param w the width of the ellipse @param h the height of the ellipse @return a path representing the shape.
[ "Return", "a", "path", "for", "an", "ellipse", "." ]
train
https://github.com/khuxtable/seaglass/blob/f25ecba622923d7b29b64cb7d6068dd8005989b3/src/main/java/com/seaglasslookandfeel/painter/util/ShapeGenerator.java#L749-L753
Stratio/stratio-cassandra
src/java/org/apache/cassandra/hadoop/ConfigHelper.java
ConfigHelper.setInputRange
public static void setInputRange(Configuration conf, String startToken, String endToken, List<IndexExpression> filter) { KeyRange range = new KeyRange().setStart_token(startToken).setEnd_token(endToken).setRow_filter(filter); conf.set(INPUT_KEYRANGE_CONFIG, thriftToString(range)); }
java
public static void setInputRange(Configuration conf, String startToken, String endToken, List<IndexExpression> filter) { KeyRange range = new KeyRange().setStart_token(startToken).setEnd_token(endToken).setRow_filter(filter); conf.set(INPUT_KEYRANGE_CONFIG, thriftToString(range)); }
[ "public", "static", "void", "setInputRange", "(", "Configuration", "conf", ",", "String", "startToken", ",", "String", "endToken", ",", "List", "<", "IndexExpression", ">", "filter", ")", "{", "KeyRange", "range", "=", "new", "KeyRange", "(", ")", ".", "setS...
Set the KeyRange to limit the rows. @param conf Job configuration you are about to run
[ "Set", "the", "KeyRange", "to", "limit", "the", "rows", "." ]
train
https://github.com/Stratio/stratio-cassandra/blob/f6416b43ad5309083349ad56266450fa8c6a2106/src/java/org/apache/cassandra/hadoop/ConfigHelper.java#L254-L258
adyliu/jafka
src/main/java/io/jafka/server/ServerRegister.java
ServerRegister.registerBrokerInZk
public void registerBrokerInZk() { logger.info("Registering broker " + brokerIdPath); String hostname = config.getHostName(); if (hostname == null) { try { hostname = InetAddress.getLocalHost().getHostName(); } catch (UnknownHostException e) { throw new RuntimeException("cannot get local host, setting 'hostname' in configuration"); } } // final String creatorId = hostname + "-" + System.currentTimeMillis(); final Broker broker = new Broker(config.getBrokerId(), creatorId, hostname, config.getPort(),config.isTopicAutoCreated()); try { ZkUtils.createEphemeralPathExpectConflict(zkClient, brokerIdPath, broker.getZKString()); } catch (ZkNodeExistsException e) { String oldServerInfo = ZkUtils.readDataMaybeNull(zkClient, brokerIdPath); String message = "A broker (%s) is already registered on the path %s." // + " This probably indicates that you either have configured a brokerid that is already in use, or "// + "else you have shutdown this broker and restarted it faster than the zookeeper " /// + "timeout so it appears to be re-registering."; message = String.format(message, oldServerInfo, brokerIdPath); throw new RuntimeException(message); } // logger.info("Registering broker " + brokerIdPath + " succeeded with " + broker); }
java
public void registerBrokerInZk() { logger.info("Registering broker " + brokerIdPath); String hostname = config.getHostName(); if (hostname == null) { try { hostname = InetAddress.getLocalHost().getHostName(); } catch (UnknownHostException e) { throw new RuntimeException("cannot get local host, setting 'hostname' in configuration"); } } // final String creatorId = hostname + "-" + System.currentTimeMillis(); final Broker broker = new Broker(config.getBrokerId(), creatorId, hostname, config.getPort(),config.isTopicAutoCreated()); try { ZkUtils.createEphemeralPathExpectConflict(zkClient, brokerIdPath, broker.getZKString()); } catch (ZkNodeExistsException e) { String oldServerInfo = ZkUtils.readDataMaybeNull(zkClient, brokerIdPath); String message = "A broker (%s) is already registered on the path %s." // + " This probably indicates that you either have configured a brokerid that is already in use, or "// + "else you have shutdown this broker and restarted it faster than the zookeeper " /// + "timeout so it appears to be re-registering."; message = String.format(message, oldServerInfo, brokerIdPath); throw new RuntimeException(message); } // logger.info("Registering broker " + brokerIdPath + " succeeded with " + broker); }
[ "public", "void", "registerBrokerInZk", "(", ")", "{", "logger", ".", "info", "(", "\"Registering broker \"", "+", "brokerIdPath", ")", ";", "String", "hostname", "=", "config", ".", "getHostName", "(", ")", ";", "if", "(", "hostname", "==", "null", ")", "...
register broker in the zookeeper <p> path: /brokers/ids/&lt;id&gt; <br> data: creator:host:port
[ "register", "broker", "in", "the", "zookeeper", "<p", ">", "path", ":", "/", "brokers", "/", "ids", "/", "&lt", ";", "id&gt", ";", "<br", ">", "data", ":", "creator", ":", "host", ":", "port" ]
train
https://github.com/adyliu/jafka/blob/cc14d2ed60c039b12d7b106bb5269ef21d0add7e/src/main/java/io/jafka/server/ServerRegister.java#L119-L145
Azure/azure-sdk-for-java
cognitiveservices/data-plane/language/luis/authoring/src/main/java/com/microsoft/azure/cognitiveservices/language/luis/authoring/implementation/ModelsImpl.java
ModelsImpl.listHierarchicalEntities
public List<HierarchicalEntityExtractor> listHierarchicalEntities(UUID appId, String versionId, ListHierarchicalEntitiesOptionalParameter listHierarchicalEntitiesOptionalParameter) { return listHierarchicalEntitiesWithServiceResponseAsync(appId, versionId, listHierarchicalEntitiesOptionalParameter).toBlocking().single().body(); }
java
public List<HierarchicalEntityExtractor> listHierarchicalEntities(UUID appId, String versionId, ListHierarchicalEntitiesOptionalParameter listHierarchicalEntitiesOptionalParameter) { return listHierarchicalEntitiesWithServiceResponseAsync(appId, versionId, listHierarchicalEntitiesOptionalParameter).toBlocking().single().body(); }
[ "public", "List", "<", "HierarchicalEntityExtractor", ">", "listHierarchicalEntities", "(", "UUID", "appId", ",", "String", "versionId", ",", "ListHierarchicalEntitiesOptionalParameter", "listHierarchicalEntitiesOptionalParameter", ")", "{", "return", "listHierarchicalEntitiesWit...
Gets information about the hierarchical entity models. @param appId The application ID. @param versionId The version ID. @param listHierarchicalEntitiesOptionalParameter the object representing the optional parameters to be set before calling this API @throws IllegalArgumentException thrown if parameters fail the validation @throws ErrorResponseException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent @return the List&lt;HierarchicalEntityExtractor&gt; object if successful.
[ "Gets", "information", "about", "the", "hierarchical", "entity", "models", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/cognitiveservices/data-plane/language/luis/authoring/src/main/java/com/microsoft/azure/cognitiveservices/language/luis/authoring/implementation/ModelsImpl.java#L1373-L1375
azkaban/azkaban
az-core/src/main/java/azkaban/utils/PropsUtils.java
PropsUtils.fromHierarchicalMap
public static Props fromHierarchicalMap(final Map<String, Object> propsMap) { if (propsMap == null) { return null; } final String source = (String) propsMap.get("source"); final Map<String, String> propsParams = (Map<String, String>) propsMap.get("props"); final Map<String, Object> parent = (Map<String, Object>) propsMap.get("parent"); final Props parentProps = fromHierarchicalMap(parent); final Props props = new Props(parentProps, propsParams); props.setSource(source); return props; }
java
public static Props fromHierarchicalMap(final Map<String, Object> propsMap) { if (propsMap == null) { return null; } final String source = (String) propsMap.get("source"); final Map<String, String> propsParams = (Map<String, String>) propsMap.get("props"); final Map<String, Object> parent = (Map<String, Object>) propsMap.get("parent"); final Props parentProps = fromHierarchicalMap(parent); final Props props = new Props(parentProps, propsParams); props.setSource(source); return props; }
[ "public", "static", "Props", "fromHierarchicalMap", "(", "final", "Map", "<", "String", ",", "Object", ">", "propsMap", ")", "{", "if", "(", "propsMap", "==", "null", ")", "{", "return", "null", ";", "}", "final", "String", "source", "=", "(", "String", ...
Convert a hierarchical Map to Prop Object @param propsMap a hierarchical Map @return a new constructed Props Object
[ "Convert", "a", "hierarchical", "Map", "to", "Prop", "Object" ]
train
https://github.com/azkaban/azkaban/blob/d258ea7d6e66807c6eff79c5325d6d3443618dff/az-core/src/main/java/azkaban/utils/PropsUtils.java#L399-L414
camunda/camunda-bpm-platform
engine/src/main/java/org/camunda/bpm/engine/impl/util/CompareUtil.java
CompareUtil.elementIsNotContainedInArray
public static <T> boolean elementIsNotContainedInArray(T element, T... values) { if (element != null && values != null) { return elementIsNotContainedInList(element, Arrays.asList(values)); } else { return false; } }
java
public static <T> boolean elementIsNotContainedInArray(T element, T... values) { if (element != null && values != null) { return elementIsNotContainedInList(element, Arrays.asList(values)); } else { return false; } }
[ "public", "static", "<", "T", ">", "boolean", "elementIsNotContainedInArray", "(", "T", "element", ",", "T", "...", "values", ")", "{", "if", "(", "element", "!=", "null", "&&", "values", "!=", "null", ")", "{", "return", "elementIsNotContainedInList", "(", ...
Checks if the element is contained within the list of values. If the element, or the list are null then true is returned. @param element to check @param values to check in @param <T> the type of the element @return {@code true} if the element and values are not {@code null} and the values does not contain the element, {@code false} otherwise
[ "Checks", "if", "the", "element", "is", "contained", "within", "the", "list", "of", "values", ".", "If", "the", "element", "or", "the", "list", "are", "null", "then", "true", "is", "returned", "." ]
train
https://github.com/camunda/camunda-bpm-platform/blob/1a464fc887ef3760e53d6f91b9e5b871a0d77cc0/engine/src/main/java/org/camunda/bpm/engine/impl/util/CompareUtil.java#L103-L110
wisdom-framework/wisdom
core/wisdom-maven-plugin/src/main/java/org/wisdom/maven/osgi/Instructions.java
Instructions.mergeAndOverrideExisting
public static Properties mergeAndOverrideExisting(Properties props1, Properties props2) { Properties properties = new Properties(); properties.putAll(props1); properties.putAll(props2); return properties; }
java
public static Properties mergeAndOverrideExisting(Properties props1, Properties props2) { Properties properties = new Properties(); properties.putAll(props1); properties.putAll(props2); return properties; }
[ "public", "static", "Properties", "mergeAndOverrideExisting", "(", "Properties", "props1", ",", "Properties", "props2", ")", "{", "Properties", "properties", "=", "new", "Properties", "(", ")", ";", "properties", ".", "putAll", "(", "props1", ")", ";", "properti...
Utility method to merge instructions from {@code props2} into the {@code props1}. The instructions from {@code props2} override the instructions from {@code props1} (when both contain the same instruction) @param props1 the first set of instructions @param props2 the second set of instructions @return the new set of instructions containing the instructions from {@code props2} merged into {@code props1}.
[ "Utility", "method", "to", "merge", "instructions", "from", "{", "@code", "props2", "}", "into", "the", "{", "@code", "props1", "}", ".", "The", "instructions", "from", "{", "@code", "props2", "}", "override", "the", "instructions", "from", "{", "@code", "...
train
https://github.com/wisdom-framework/wisdom/blob/a35b6431200fec56b178c0ff60837ed73fd7874d/core/wisdom-maven-plugin/src/main/java/org/wisdom/maven/osgi/Instructions.java#L64-L69
mcdiae/kludje
kludje-core/src/main/java/uk/kludje/MetaConfig.java
MetaConfig.withObjectEqualsChecks
public MetaConfig withObjectEqualsChecks(ObjectEqualsPolicy equalsPolicy, ObjectHashCodePolicy hashCodePolicy) { Ensure.that(equalsPolicy != null, "equalsPolicy != null"); Ensure.that(hashCodePolicy != null, "hashCodePolicy != null"); return new MetaConfigBuilder(this) .setObjectEqualsPolicy(equalsPolicy) .setObjectHashCodePolicy(hashCodePolicy) .build(); }
java
public MetaConfig withObjectEqualsChecks(ObjectEqualsPolicy equalsPolicy, ObjectHashCodePolicy hashCodePolicy) { Ensure.that(equalsPolicy != null, "equalsPolicy != null"); Ensure.that(hashCodePolicy != null, "hashCodePolicy != null"); return new MetaConfigBuilder(this) .setObjectEqualsPolicy(equalsPolicy) .setObjectHashCodePolicy(hashCodePolicy) .build(); }
[ "public", "MetaConfig", "withObjectEqualsChecks", "(", "ObjectEqualsPolicy", "equalsPolicy", ",", "ObjectHashCodePolicy", "hashCodePolicy", ")", "{", "Ensure", ".", "that", "(", "equalsPolicy", "!=", "null", ",", "\"equalsPolicy != null\"", ")", ";", "Ensure", ".", "t...
Allows consumers to set special handling for {@link Getter#get(Object)} responses for {@link Meta#equals(Object, Object)}, {@link Meta#hashCode(Object)}. @param equalsPolicy a non-null equals policy @param hashCodePolicy a non-null hash policy @return the new config @see #withShallowArraySupport()
[ "Allows", "consumers", "to", "set", "special", "handling", "for", "{", "@link", "Getter#get", "(", "Object", ")", "}", "responses", "for", "{", "@link", "Meta#equals", "(", "Object", "Object", ")", "}", "{", "@link", "Meta#hashCode", "(", "Object", ")", "}...
train
https://github.com/mcdiae/kludje/blob/9ed80cd183ebf162708d5922d784f79ac3841dfc/kludje-core/src/main/java/uk/kludje/MetaConfig.java#L168-L176
Azure/azure-sdk-for-java
compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/implementation/DisksInner.java
DisksInner.beginDeleteAsync
public Observable<OperationStatusResponseInner> beginDeleteAsync(String resourceGroupName, String diskName) { return beginDeleteWithServiceResponseAsync(resourceGroupName, diskName).map(new Func1<ServiceResponse<OperationStatusResponseInner>, OperationStatusResponseInner>() { @Override public OperationStatusResponseInner call(ServiceResponse<OperationStatusResponseInner> response) { return response.body(); } }); }
java
public Observable<OperationStatusResponseInner> beginDeleteAsync(String resourceGroupName, String diskName) { return beginDeleteWithServiceResponseAsync(resourceGroupName, diskName).map(new Func1<ServiceResponse<OperationStatusResponseInner>, OperationStatusResponseInner>() { @Override public OperationStatusResponseInner call(ServiceResponse<OperationStatusResponseInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "OperationStatusResponseInner", ">", "beginDeleteAsync", "(", "String", "resourceGroupName", ",", "String", "diskName", ")", "{", "return", "beginDeleteWithServiceResponseAsync", "(", "resourceGroupName", ",", "diskName", ")", ".", "map", "(...
Deletes a disk. @param resourceGroupName The name of the resource group. @param diskName The name of the managed disk that is being created. The name can't be changed after the disk is created. Supported characters for the name are a-z, A-Z, 0-9 and _. The maximum name length is 80 characters. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the OperationStatusResponseInner object
[ "Deletes", "a", "disk", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/implementation/DisksInner.java#L667-L674
googleads/googleads-java-lib
modules/dfp_axis/src/main/java/com/google/api/ads/admanager/axis/utils/v201811/Pql.java
Pql.resultSetToStringArrayList
public static List<String[]> resultSetToStringArrayList(ResultSet resultSet) { List<String[]> stringArrayList = Lists.newArrayList(); stringArrayList.add(getColumnLabels(resultSet).toArray(new String[] {})); if (resultSet.getRows() != null) { for (Row row : resultSet.getRows()) { try { stringArrayList.add(getRowStringValues(row).toArray(new String[] {})); } catch (IllegalArgumentException e) { throw new IllegalStateException("Cannot convert result set to string array list", e); } } } return stringArrayList; }
java
public static List<String[]> resultSetToStringArrayList(ResultSet resultSet) { List<String[]> stringArrayList = Lists.newArrayList(); stringArrayList.add(getColumnLabels(resultSet).toArray(new String[] {})); if (resultSet.getRows() != null) { for (Row row : resultSet.getRows()) { try { stringArrayList.add(getRowStringValues(row).toArray(new String[] {})); } catch (IllegalArgumentException e) { throw new IllegalStateException("Cannot convert result set to string array list", e); } } } return stringArrayList; }
[ "public", "static", "List", "<", "String", "[", "]", ">", "resultSetToStringArrayList", "(", "ResultSet", "resultSet", ")", "{", "List", "<", "String", "[", "]", ">", "stringArrayList", "=", "Lists", ".", "newArrayList", "(", ")", ";", "stringArrayList", "."...
Gets the result set as list of string arrays, which can be transformed to a CSV using {@code CsvFiles} such as <pre> <code> ResultSet combinedResultSet = Pql.combineResultSet(resultSet1, resultSet2); //... combinedResultSet = Pql.combineResultSet(combinedResultSet, resultSet3); CsvFiles.writeCsv(Pql.resultSetToStringArrayList(combinedResultSet), filePath); </code> </pre> @param resultSet the result set to convert to a CSV compatible format @return a list of string arrays representing the result set
[ "Gets", "the", "result", "set", "as", "list", "of", "string", "arrays", "which", "can", "be", "transformed", "to", "a", "CSV", "using", "{", "@code", "CsvFiles", "}", "such", "as" ]
train
https://github.com/googleads/googleads-java-lib/blob/967957cc4f6076514e3a7926fe653e4f1f7cc9c9/modules/dfp_axis/src/main/java/com/google/api/ads/admanager/axis/utils/v201811/Pql.java#L313-L326
bazaarvoice/emodb
mapreduce/sor-hadoop/src/main/java/com/bazaarvoice/emodb/hadoop/io/FileSystemUtil.java
FileSystemUtil.qualified
private static Path qualified(Path rootPath, Path path) { URI rootUri = rootPath.toUri(); return path.makeQualified(rootUri, new Path(rootUri.getPath())); }
java
private static Path qualified(Path rootPath, Path path) { URI rootUri = rootPath.toUri(); return path.makeQualified(rootUri, new Path(rootUri.getPath())); }
[ "private", "static", "Path", "qualified", "(", "Path", "rootPath", ",", "Path", "path", ")", "{", "URI", "rootUri", "=", "rootPath", ".", "toUri", "(", ")", ";", "return", "path", ".", "makeQualified", "(", "rootUri", ",", "new", "Path", "(", "rootUri", ...
Qualifies a path so it includes the schema and authority from the root path.
[ "Qualifies", "a", "path", "so", "it", "includes", "the", "schema", "and", "authority", "from", "the", "root", "path", "." ]
train
https://github.com/bazaarvoice/emodb/blob/97ec7671bc78b47fc2a1c11298c0c872bd5ec7fb/mapreduce/sor-hadoop/src/main/java/com/bazaarvoice/emodb/hadoop/io/FileSystemUtil.java#L110-L113
Azure/azure-sdk-for-java
network/resource-manager/v2017_10_01/src/main/java/com/microsoft/azure/management/network/v2017_10_01/implementation/VirtualNetworkGatewayConnectionsInner.java
VirtualNetworkGatewayConnectionsInner.setSharedKeyAsync
public Observable<ConnectionSharedKeyInner> setSharedKeyAsync(String resourceGroupName, String virtualNetworkGatewayConnectionName, String value) { return setSharedKeyWithServiceResponseAsync(resourceGroupName, virtualNetworkGatewayConnectionName, value).map(new Func1<ServiceResponse<ConnectionSharedKeyInner>, ConnectionSharedKeyInner>() { @Override public ConnectionSharedKeyInner call(ServiceResponse<ConnectionSharedKeyInner> response) { return response.body(); } }); }
java
public Observable<ConnectionSharedKeyInner> setSharedKeyAsync(String resourceGroupName, String virtualNetworkGatewayConnectionName, String value) { return setSharedKeyWithServiceResponseAsync(resourceGroupName, virtualNetworkGatewayConnectionName, value).map(new Func1<ServiceResponse<ConnectionSharedKeyInner>, ConnectionSharedKeyInner>() { @Override public ConnectionSharedKeyInner call(ServiceResponse<ConnectionSharedKeyInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "ConnectionSharedKeyInner", ">", "setSharedKeyAsync", "(", "String", "resourceGroupName", ",", "String", "virtualNetworkGatewayConnectionName", ",", "String", "value", ")", "{", "return", "setSharedKeyWithServiceResponseAsync", "(", "resourceGroup...
The Put VirtualNetworkGatewayConnectionSharedKey operation sets the virtual network gateway connection shared key for passed virtual network gateway connection in the specified resource group through Network resource provider. @param resourceGroupName The name of the resource group. @param virtualNetworkGatewayConnectionName The virtual network gateway connection name. @param value The virtual network connection shared key value. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable for the request
[ "The", "Put", "VirtualNetworkGatewayConnectionSharedKey", "operation", "sets", "the", "virtual", "network", "gateway", "connection", "shared", "key", "for", "passed", "virtual", "network", "gateway", "connection", "in", "the", "specified", "resource", "group", "through"...
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/network/resource-manager/v2017_10_01/src/main/java/com/microsoft/azure/management/network/v2017_10_01/implementation/VirtualNetworkGatewayConnectionsInner.java#L883-L890
infinispan/infinispan
core/src/main/java/org/infinispan/io/GridFilesystem.java
GridFilesystem.getWritableChannel
public WritableGridFileChannel getWritableChannel(String pathname, boolean append, int chunkSize) throws IOException { GridFile file = (GridFile) getFile(pathname, chunkSize); checkIsNotDirectory(file); createIfNeeded(file); return new WritableGridFileChannel(file, data, append); }
java
public WritableGridFileChannel getWritableChannel(String pathname, boolean append, int chunkSize) throws IOException { GridFile file = (GridFile) getFile(pathname, chunkSize); checkIsNotDirectory(file); createIfNeeded(file); return new WritableGridFileChannel(file, data, append); }
[ "public", "WritableGridFileChannel", "getWritableChannel", "(", "String", "pathname", ",", "boolean", "append", ",", "int", "chunkSize", ")", "throws", "IOException", "{", "GridFile", "file", "=", "(", "GridFile", ")", "getFile", "(", "pathname", ",", "chunkSize",...
Opens a WritableGridFileChannel for writing to the file denoted by pathname. @param pathname the file to write to @param append if true, the bytes written to the channel will be appended to the end of the file @param chunkSize the size of the file's chunks. This parameter is honored only when the file at pathname does not yet exist. If the file already exists, the file's own chunkSize has precedence. @return a WritableGridFileChannel for writing to the file @throws IOException if the file is a directory, cannot be created or some other error occurs
[ "Opens", "a", "WritableGridFileChannel", "for", "writing", "to", "the", "file", "denoted", "by", "pathname", "." ]
train
https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/core/src/main/java/org/infinispan/io/GridFilesystem.java#L228-L233
jtrfp/jfdt
src/main/java/org/jtrfp/jfdt/Parser.java
Parser.writeBean
public void writeBean(ThirdPartyParseable bean,OutputStream os){ writeBean(bean,new EndianAwareDataOutputStream(new DataOutputStream(os))); }
java
public void writeBean(ThirdPartyParseable bean,OutputStream os){ writeBean(bean,new EndianAwareDataOutputStream(new DataOutputStream(os))); }
[ "public", "void", "writeBean", "(", "ThirdPartyParseable", "bean", ",", "OutputStream", "os", ")", "{", "writeBean", "(", "bean", ",", "new", "EndianAwareDataOutputStream", "(", "new", "DataOutputStream", "(", "os", ")", ")", ")", ";", "}" ]
Write ThirdPartyParseable bean to the given OutputStream. @param bean @param os @since Sep 17, 2012
[ "Write", "ThirdPartyParseable", "bean", "to", "the", "given", "OutputStream", "." ]
train
https://github.com/jtrfp/jfdt/blob/64e665669b5fcbfe96736346b4e7893e466dd8a0/src/main/java/org/jtrfp/jfdt/Parser.java#L175-L177
gallandarakhneorg/afc
core/inputoutput/src/main/java/org/arakhne/afc/inputoutput/xml/XMLUtil.java
XMLUtil.getAttributeUUIDWithDefault
@Pure public static UUID getAttributeUUIDWithDefault(Node document, boolean caseSensitive, UUID defaultValue, String... path) { assert document != null : AssertMessages.notNullParameter(0); final String v = getAttributeValue(document, caseSensitive, 0, path); if (v != null && !v.isEmpty()) { try { final UUID id = UUID.fromString(v); if (id != null) { return id; } } catch (Exception e) { // } } return defaultValue; }
java
@Pure public static UUID getAttributeUUIDWithDefault(Node document, boolean caseSensitive, UUID defaultValue, String... path) { assert document != null : AssertMessages.notNullParameter(0); final String v = getAttributeValue(document, caseSensitive, 0, path); if (v != null && !v.isEmpty()) { try { final UUID id = UUID.fromString(v); if (id != null) { return id; } } catch (Exception e) { // } } return defaultValue; }
[ "@", "Pure", "public", "static", "UUID", "getAttributeUUIDWithDefault", "(", "Node", "document", ",", "boolean", "caseSensitive", ",", "UUID", "defaultValue", ",", "String", "...", "path", ")", "{", "assert", "document", "!=", "null", ":", "AssertMessages", ".",...
Replies the UUID that corresponds to the specified attribute's path. <p>The path is an ordered list of tag's names and ended by the name of the attribute. @param document is the XML document to explore. @param caseSensitive indicates of the {@code path}'s components are case sensitive. @param defaultValue is the default value to reply. @param path is the list of and ended by the attribute's name. @return the UUID in the specified attribute or <code>null</code> if it was node found in the document
[ "Replies", "the", "UUID", "that", "corresponds", "to", "the", "specified", "attribute", "s", "path", "." ]
train
https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/core/inputoutput/src/main/java/org/arakhne/afc/inputoutput/xml/XMLUtil.java#L1117-L1132
looly/hutool
hutool-core/src/main/java/cn/hutool/core/lang/JarClassLoader.java
JarClassLoader.loadJar
public static void loadJar(URLClassLoader loader, File jarFile) throws UtilException { try { final Method method = ClassUtil.getDeclaredMethod(URLClassLoader.class, "addURL", URL.class); if (null != method) { method.setAccessible(true); final List<File> jars = loopJar(jarFile); for (File jar : jars) { ReflectUtil.invoke(loader, method, new Object[] { jar.toURI().toURL() }); } } } catch (IOException e) { throw new UtilException(e); } }
java
public static void loadJar(URLClassLoader loader, File jarFile) throws UtilException { try { final Method method = ClassUtil.getDeclaredMethod(URLClassLoader.class, "addURL", URL.class); if (null != method) { method.setAccessible(true); final List<File> jars = loopJar(jarFile); for (File jar : jars) { ReflectUtil.invoke(loader, method, new Object[] { jar.toURI().toURL() }); } } } catch (IOException e) { throw new UtilException(e); } }
[ "public", "static", "void", "loadJar", "(", "URLClassLoader", "loader", ",", "File", "jarFile", ")", "throws", "UtilException", "{", "try", "{", "final", "Method", "method", "=", "ClassUtil", ".", "getDeclaredMethod", "(", "URLClassLoader", ".", "class", ",", ...
加载Jar文件到指定loader中 @param loader {@link URLClassLoader} @param jarFile 被加载的jar @throws UtilException IO异常包装和执行异常
[ "加载Jar文件到指定loader中" ]
train
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/lang/JarClassLoader.java#L57-L70
nohana/Amalgam
amalgam/src/main/java/com/amalgam/content/pm/PackageManagerUtils.java
PackageManagerUtils.isPackageInstalled
public static boolean isPackageInstalled(Context context, String targetPackage) { PackageManager manager = context.getPackageManager(); Intent intent = new Intent(); intent.setPackage(targetPackage); return manager.resolveActivity(intent, 0) != null; }
java
public static boolean isPackageInstalled(Context context, String targetPackage) { PackageManager manager = context.getPackageManager(); Intent intent = new Intent(); intent.setPackage(targetPackage); return manager.resolveActivity(intent, 0) != null; }
[ "public", "static", "boolean", "isPackageInstalled", "(", "Context", "context", ",", "String", "targetPackage", ")", "{", "PackageManager", "manager", "=", "context", ".", "getPackageManager", "(", ")", ";", "Intent", "intent", "=", "new", "Intent", "(", ")", ...
Checks if the target package is installed on this device. @param context the context. @param targetPackage the target package name. @return {@code true} if installed, false otherwise.
[ "Checks", "if", "the", "target", "package", "is", "installed", "on", "this", "device", "." ]
train
https://github.com/nohana/Amalgam/blob/57809ddbfe7897e979cf507982ce0b3aa5e0ed8a/amalgam/src/main/java/com/amalgam/content/pm/PackageManagerUtils.java#L87-L92
DDTH/ddth-commons
ddth-commons-core/src/main/java/com/github/ddth/commons/utils/DPathUtils.java
DPathUtils.setValue
public static void setValue(Object target, String dPath, Object value) { setValue(target, dPath, value, false); }
java
public static void setValue(Object target, String dPath, Object value) { setValue(target, dPath, value, false); }
[ "public", "static", "void", "setValue", "(", "Object", "target", ",", "String", "dPath", ",", "Object", "value", ")", "{", "setValue", "(", "target", ",", "dPath", ",", "value", ",", "false", ")", ";", "}" ]
Set a value to the target object specified by DPath expression. <p> Note: intermediated nodes will NOT be created. </p> <p> Note: if {@code value} is {@code null}: <ul> <li>If the specified item's parent is a list or array, the item (specified by {@code dPath}) will be set to {@code null}.</li> <li>If the specified item's parent is a map, the item (specified by {@code dPath}) will be removed.</li> </ul> </p> @param target @param dPath @param value
[ "Set", "a", "value", "to", "the", "target", "object", "specified", "by", "DPath", "expression", "." ]
train
https://github.com/DDTH/ddth-commons/blob/734f0e77321d41eeca78a557be9884df9874e46e/ddth-commons-core/src/main/java/com/github/ddth/commons/utils/DPathUtils.java#L607-L609
facebookarchive/hadoop-20
src/contrib/mumak/src/java/org/apache/hadoop/mapred/SimulatorTaskTracker.java
SimulatorTaskTracker.createTaskAttemptCompletionEvent
private TaskAttemptCompletionEvent createTaskAttemptCompletionEvent( SimulatorTaskInProgress tip, long now) { // We need to clone() status as we modify and it goes into an Event TaskStatus status = (TaskStatus)tip.getTaskStatus().clone(); long delta = tip.getUserSpaceRunTime(); assert delta >= 0 : "TaskAttempt " + tip.getTaskStatus().getTaskID() + " has negative UserSpaceRunTime = " + delta; long finishTime = now + delta; status.setFinishTime(finishTime); status.setProgress(1.0f); status.setRunState(tip.getFinalRunState()); TaskAttemptCompletionEvent event = new TaskAttemptCompletionEvent(this, status); if (LOG.isDebugEnabled()) { LOG.debug("Created task attempt completion event " + event); } return event; }
java
private TaskAttemptCompletionEvent createTaskAttemptCompletionEvent( SimulatorTaskInProgress tip, long now) { // We need to clone() status as we modify and it goes into an Event TaskStatus status = (TaskStatus)tip.getTaskStatus().clone(); long delta = tip.getUserSpaceRunTime(); assert delta >= 0 : "TaskAttempt " + tip.getTaskStatus().getTaskID() + " has negative UserSpaceRunTime = " + delta; long finishTime = now + delta; status.setFinishTime(finishTime); status.setProgress(1.0f); status.setRunState(tip.getFinalRunState()); TaskAttemptCompletionEvent event = new TaskAttemptCompletionEvent(this, status); if (LOG.isDebugEnabled()) { LOG.debug("Created task attempt completion event " + event); } return event; }
[ "private", "TaskAttemptCompletionEvent", "createTaskAttemptCompletionEvent", "(", "SimulatorTaskInProgress", "tip", ",", "long", "now", ")", "{", "// We need to clone() status as we modify and it goes into an Event", "TaskStatus", "status", "=", "(", "TaskStatus", ")", "tip", "...
Creates a signal for itself marking the completion of a task attempt. It assumes that the task attempt hasn't made any progress in the user space code so far, i.e. it is called right at launch for map tasks and immediately after all maps completed for reduce tasks. @param tip the simulator task in progress @param now the current simulation time @return the TaskAttemptCompletionEvent we are sending to ourselves
[ "Creates", "a", "signal", "for", "itself", "marking", "the", "completion", "of", "a", "task", "attempt", ".", "It", "assumes", "that", "the", "task", "attempt", "hasn", "t", "made", "any", "progress", "in", "the", "user", "space", "code", "so", "far", "i...
train
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/contrib/mumak/src/java/org/apache/hadoop/mapred/SimulatorTaskTracker.java#L274-L291
QSFT/Doradus
doradus-server/src/main/java/com/dell/doradus/core/DoradusServer.java
DoradusServer.initEmbedded
private void initEmbedded(String[] args, String[] services) { if (m_bInitialized) { m_logger.warn("initEmbedded: Already initialized -- ignoring"); return; } m_logger.info("Initializing embedded mode"); initConfig(args); initEmbeddedServices(services); RESTService.instance().registerCommands(CMD_CLASSES); m_bInitialized = true; }
java
private void initEmbedded(String[] args, String[] services) { if (m_bInitialized) { m_logger.warn("initEmbedded: Already initialized -- ignoring"); return; } m_logger.info("Initializing embedded mode"); initConfig(args); initEmbeddedServices(services); RESTService.instance().registerCommands(CMD_CLASSES); m_bInitialized = true; }
[ "private", "void", "initEmbedded", "(", "String", "[", "]", "args", ",", "String", "[", "]", "services", ")", "{", "if", "(", "m_bInitialized", ")", "{", "m_logger", ".", "warn", "(", "\"initEmbedded: Already initialized -- ignoring\"", ")", ";", "return", ";"...
Initialize server configuration and given+required services for embedded running.
[ "Initialize", "server", "configuration", "and", "given", "+", "required", "services", "for", "embedded", "running", "." ]
train
https://github.com/QSFT/Doradus/blob/ad64d3c37922eefda68ec8869ef089c1ca604b70/doradus-server/src/main/java/com/dell/doradus/core/DoradusServer.java#L305-L315
amzn/ion-java
src/com/amazon/ion/Timestamp.java
Timestamp.addMillis
public final Timestamp addMillis(long amount) { if (amount == 0 && _precision.includes(Precision.SECOND) && _fraction != null && _fraction.scale() >= 3) { // Zero milliseconds are to be added, and the precision does not need to be increased. return this; } return addMillisForPrecision(amount, Precision.SECOND, true); }
java
public final Timestamp addMillis(long amount) { if (amount == 0 && _precision.includes(Precision.SECOND) && _fraction != null && _fraction.scale() >= 3) { // Zero milliseconds are to be added, and the precision does not need to be increased. return this; } return addMillisForPrecision(amount, Precision.SECOND, true); }
[ "public", "final", "Timestamp", "addMillis", "(", "long", "amount", ")", "{", "if", "(", "amount", "==", "0", "&&", "_precision", ".", "includes", "(", "Precision", ".", "SECOND", ")", "&&", "_fraction", "!=", "null", "&&", "_fraction", ".", "scale", "("...
Returns a timestamp relative to this one by the given number of milliseconds. <p> This method always returns a Timestamp with SECOND precision and a seconds value precise at least to the millisecond. For example, adding one millisecond to {@code 2011T} results in {@code 2011-01-01T00:00:00.001-00:00}. To receive a Timestamp that always maintains the same precision as the original, use {@link #adjustMillis(long)}. milliseconds. @param amount a number of milliseconds.
[ "Returns", "a", "timestamp", "relative", "to", "this", "one", "by", "the", "given", "number", "of", "milliseconds", ".", "<p", ">", "This", "method", "always", "returns", "a", "Timestamp", "with", "SECOND", "precision", "and", "a", "seconds", "value", "preci...
train
https://github.com/amzn/ion-java/blob/4ce1f0f58c6a5a8e42d0425ccdb36e38be3e2270/src/com/amazon/ion/Timestamp.java#L2250-L2257
xhsun/gw2wrapper
src/main/java/me/xhsun/guildwars2wrapper/AsynchronousRequest.java
AsynchronousRequest.getCharacter
public void getCharacter(String API, String name, Callback<Character> callback) throws GuildWars2Exception, NullPointerException { isParamValid(new ParamChecker(ParamType.API, API), new ParamChecker(ParamType.CHAR, name)); gw2API.getCharacter(name, API).enqueue(callback); }
java
public void getCharacter(String API, String name, Callback<Character> callback) throws GuildWars2Exception, NullPointerException { isParamValid(new ParamChecker(ParamType.API, API), new ParamChecker(ParamType.CHAR, name)); gw2API.getCharacter(name, API).enqueue(callback); }
[ "public", "void", "getCharacter", "(", "String", "API", ",", "String", "name", ",", "Callback", "<", "Character", ">", "callback", ")", "throws", "GuildWars2Exception", ",", "NullPointerException", "{", "isParamValid", "(", "new", "ParamChecker", "(", "ParamType",...
For more info on character overview API go <a href="https://wiki.guildwars2.com/wiki/API:2/characters">here</a><br/> Get character information for the given character name that is linked to given API key @param API API key @param name name of character @param callback callback that is going to be used for {@link Call#enqueue(Callback)} @throws GuildWars2Exception invalid API key | empty character name @throws NullPointerException if given {@link Callback} is empty @see Character character info
[ "For", "more", "info", "on", "character", "overview", "API", "go", "<a", "href", "=", "https", ":", "//", "wiki", ".", "guildwars2", ".", "com", "/", "wiki", "/", "API", ":", "2", "/", "characters", ">", "here<", "/", "a", ">", "<br", "/", ">", "...
train
https://github.com/xhsun/gw2wrapper/blob/c8a43b51f363b032074fb152ee6efe657e33e525/src/main/java/me/xhsun/guildwars2wrapper/AsynchronousRequest.java#L690-L693
SvenEwald/xmlbeam
src/main/java/org/xmlbeam/util/IOHelper.java
IOHelper.addRequestProperties
private static void addRequestProperties(final Map<String, String> requestProperties, final HttpURLConnection connection) { if (requestProperties != null) { for (Entry<String, String> entry : requestProperties.entrySet()) { connection.addRequestProperty(entry.getKey(), entry.getValue()); } } }
java
private static void addRequestProperties(final Map<String, String> requestProperties, final HttpURLConnection connection) { if (requestProperties != null) { for (Entry<String, String> entry : requestProperties.entrySet()) { connection.addRequestProperty(entry.getKey(), entry.getValue()); } } }
[ "private", "static", "void", "addRequestProperties", "(", "final", "Map", "<", "String", ",", "String", ">", "requestProperties", ",", "final", "HttpURLConnection", "connection", ")", "{", "if", "(", "requestProperties", "!=", "null", ")", "{", "for", "(", "En...
Copies request properties to a connection. @param requestProperties (if null, connection will not be changed) @param connection
[ "Copies", "request", "properties", "to", "a", "connection", "." ]
train
https://github.com/SvenEwald/xmlbeam/blob/acaac1b8fa28d246f17187f5e3c6696458a0b447/src/main/java/org/xmlbeam/util/IOHelper.java#L59-L65
jpush/jmessage-api-java-client
src/main/java/cn/jmessage/api/JMessageClient.java
JMessageClient.setCrossNoDisturb
public ResponseWrapper setCrossNoDisturb(String username, CrossNoDisturb[] array) throws APIConnectionException, APIRequestException { return _crossAppClient.setCrossNoDisturb(username, array); }
java
public ResponseWrapper setCrossNoDisturb(String username, CrossNoDisturb[] array) throws APIConnectionException, APIRequestException { return _crossAppClient.setCrossNoDisturb(username, array); }
[ "public", "ResponseWrapper", "setCrossNoDisturb", "(", "String", "username", ",", "CrossNoDisturb", "[", "]", "array", ")", "throws", "APIConnectionException", ",", "APIRequestException", "{", "return", "_crossAppClient", ".", "setCrossNoDisturb", "(", "username", ",", ...
Set cross app no disturb https://docs.jiguang.cn/jmessage/server/rest_api_im/#api_1 @param username Necessary @param array CrossNoDisturb array @return No content @throws APIConnectionException connect exception @throws APIRequestException request exception
[ "Set", "cross", "app", "no", "disturb", "https", ":", "//", "docs", ".", "jiguang", ".", "cn", "/", "jmessage", "/", "server", "/", "rest_api_im", "/", "#api_1" ]
train
https://github.com/jpush/jmessage-api-java-client/blob/767f5fb15e9fe5a546c00f6e68b64f6dd53c617c/src/main/java/cn/jmessage/api/JMessageClient.java#L658-L661
apache/flink
flink-runtime/src/main/java/org/apache/flink/runtime/instance/Instance.java
Instance.allocateSimpleSlot
public SimpleSlot allocateSimpleSlot() throws InstanceDiedException { synchronized (instanceLock) { if (isDead) { throw new InstanceDiedException(this); } Integer nextSlot = availableSlots.poll(); if (nextSlot == null) { return null; } else { SimpleSlot slot = new SimpleSlot(this, location, nextSlot, taskManagerGateway); allocatedSlots.add(slot); return slot; } } }
java
public SimpleSlot allocateSimpleSlot() throws InstanceDiedException { synchronized (instanceLock) { if (isDead) { throw new InstanceDiedException(this); } Integer nextSlot = availableSlots.poll(); if (nextSlot == null) { return null; } else { SimpleSlot slot = new SimpleSlot(this, location, nextSlot, taskManagerGateway); allocatedSlots.add(slot); return slot; } } }
[ "public", "SimpleSlot", "allocateSimpleSlot", "(", ")", "throws", "InstanceDiedException", "{", "synchronized", "(", "instanceLock", ")", "{", "if", "(", "isDead", ")", "{", "throw", "new", "InstanceDiedException", "(", "this", ")", ";", "}", "Integer", "nextSlo...
Allocates a simple slot on this TaskManager instance. This method returns {@code null}, if no slot is available at the moment. @return A simple slot that represents a task slot on this TaskManager instance, or null, if the TaskManager instance has no more slots available. @throws InstanceDiedException Thrown if the instance is no longer alive by the time the slot is allocated.
[ "Allocates", "a", "simple", "slot", "on", "this", "TaskManager", "instance", ".", "This", "method", "returns", "{", "@code", "null", "}", "if", "no", "slot", "is", "available", "at", "the", "moment", "." ]
train
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/instance/Instance.java#L220-L236
OpenLiberty/open-liberty
dev/com.ibm.ws.security.csiv2/src/com/ibm/ws/security/csiv2/server/config/tss/ServerConfigHelper.java
ServerConfigHelper.getTSSConfig
public TSSConfig getTSSConfig(Map<String, Object> properties, Map<String, List<TransportAddress>> addrMap) throws Exception { TSSConfig tssConfig = new TSSConfig(); printTrace("IIOP Server Policy", null, 0); PolicyData policyData = extractPolicyData(properties, KEY_POLICY, TYPE); if (policyData != null) { printTrace("CSIV2", null, 1); TSSCompoundSecMechListConfig mechListConfig = tssConfig.getMechListConfig(); mechListConfig.setStateful(policyData.stateful); printTrace("Stateful", mechListConfig.isStateful(), 2); populateSecMechList(mechListConfig, policyData.layersData, addrMap); } return tssConfig; }
java
public TSSConfig getTSSConfig(Map<String, Object> properties, Map<String, List<TransportAddress>> addrMap) throws Exception { TSSConfig tssConfig = new TSSConfig(); printTrace("IIOP Server Policy", null, 0); PolicyData policyData = extractPolicyData(properties, KEY_POLICY, TYPE); if (policyData != null) { printTrace("CSIV2", null, 1); TSSCompoundSecMechListConfig mechListConfig = tssConfig.getMechListConfig(); mechListConfig.setStateful(policyData.stateful); printTrace("Stateful", mechListConfig.isStateful(), 2); populateSecMechList(mechListConfig, policyData.layersData, addrMap); } return tssConfig; }
[ "public", "TSSConfig", "getTSSConfig", "(", "Map", "<", "String", ",", "Object", ">", "properties", ",", "Map", "<", "String", ",", "List", "<", "TransportAddress", ">", ">", "addrMap", ")", "throws", "Exception", "{", "TSSConfig", "tssConfig", "=", "new", ...
/* The TSSConfig object is the modal representation of <iiopServerPolicy> configuration, the user specify in server.xml. An example of <iiopServerPolicy> entry is shown here for quick reference. <iiopServerPolicy id="jaykay"> --<csiv2 stateful="false"> ----<layers> ------<attributeLayer identityAssertionEnabled="true" trustedIdentities="MyHost"/> ------<authenticationLayer establishTrustInClient="Supported" mechanisms="GSSUP,LTPA"/> ------<transportLayer establishTrustInClient="Supported"/> ----</layers> --</csiv2> --<iiopEnpoint host="localhost" iiopPort="123" iiopsPort="321"> ----<sslOptions sessionTimeout="1"></sslOptions> --</iiopEnpoint> </iiopServerPolicy>
[ "/", "*", "The", "TSSConfig", "object", "is", "the", "modal", "representation", "of", "<iiopServerPolicy", ">", "configuration", "the", "user", "specify", "in", "server", ".", "xml", ".", "An", "example", "of", "<iiopServerPolicy", ">", "entry", "is", "shown",...
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.security.csiv2/src/com/ibm/ws/security/csiv2/server/config/tss/ServerConfigHelper.java#L98-L114
Harium/keel
src/main/java/com/harium/keel/catalano/math/ComplexNumber.java
ComplexNumber.Add
public static ComplexNumber Add(ComplexNumber z1, ComplexNumber z2) { return new ComplexNumber(z1.real + z2.real, z1.imaginary + z2.imaginary); }
java
public static ComplexNumber Add(ComplexNumber z1, ComplexNumber z2) { return new ComplexNumber(z1.real + z2.real, z1.imaginary + z2.imaginary); }
[ "public", "static", "ComplexNumber", "Add", "(", "ComplexNumber", "z1", ",", "ComplexNumber", "z2", ")", "{", "return", "new", "ComplexNumber", "(", "z1", ".", "real", "+", "z2", ".", "real", ",", "z1", ".", "imaginary", "+", "z2", ".", "imaginary", ")",...
Adds two complex numbers. @param z1 Complex Number. @param z2 Complex Number. @return Returns new ComplexNumber instance containing the sum of specified complex numbers.
[ "Adds", "two", "complex", "numbers", "." ]
train
https://github.com/Harium/keel/blob/0369ae674f9e664bccc5f9e161ae7e7a3b949a1e/src/main/java/com/harium/keel/catalano/math/ComplexNumber.java#L241-L243
jayantk/jklol
src/com/jayantkrish/jklol/ccg/HeadedSyntacticCategory.java
HeadedSyntacticCategory.getArgumentType
public HeadedSyntacticCategory getArgumentType() { SyntacticCategory argumentSyntax = syntacticCategory.getArgument(); int[] argumentSemantics = ArrayUtils.copyOfRange(semanticVariables, rootIndex + 1, semanticVariables.length); int argumentRoot = argumentSyntax.getNumReturnSubcategories(); return new HeadedSyntacticCategory(argumentSyntax, argumentSemantics, argumentRoot); }
java
public HeadedSyntacticCategory getArgumentType() { SyntacticCategory argumentSyntax = syntacticCategory.getArgument(); int[] argumentSemantics = ArrayUtils.copyOfRange(semanticVariables, rootIndex + 1, semanticVariables.length); int argumentRoot = argumentSyntax.getNumReturnSubcategories(); return new HeadedSyntacticCategory(argumentSyntax, argumentSemantics, argumentRoot); }
[ "public", "HeadedSyntacticCategory", "getArgumentType", "(", ")", "{", "SyntacticCategory", "argumentSyntax", "=", "syntacticCategory", ".", "getArgument", "(", ")", ";", "int", "[", "]", "argumentSemantics", "=", "ArrayUtils", ".", "copyOfRange", "(", "semanticVariab...
Gets the syntactic type and semantic variable assignments to the argument type of this category. @return
[ "Gets", "the", "syntactic", "type", "and", "semantic", "variable", "assignments", "to", "the", "argument", "type", "of", "this", "category", "." ]
train
https://github.com/jayantk/jklol/blob/d27532ca83e212d51066cf28f52621acc3fd44cc/src/com/jayantkrish/jklol/ccg/HeadedSyntacticCategory.java#L247-L252
aws/aws-sdk-java
aws-java-sdk-kinesisanalyticsv2/src/main/java/com/amazonaws/services/kinesisanalyticsv2/model/PropertyGroup.java
PropertyGroup.withPropertyMap
public PropertyGroup withPropertyMap(java.util.Map<String, String> propertyMap) { setPropertyMap(propertyMap); return this; }
java
public PropertyGroup withPropertyMap(java.util.Map<String, String> propertyMap) { setPropertyMap(propertyMap); return this; }
[ "public", "PropertyGroup", "withPropertyMap", "(", "java", ".", "util", ".", "Map", "<", "String", ",", "String", ">", "propertyMap", ")", "{", "setPropertyMap", "(", "propertyMap", ")", ";", "return", "this", ";", "}" ]
<p> Describes the value of an application execution property key-value pair. </p> @param propertyMap Describes the value of an application execution property key-value pair. @return Returns a reference to this object so that method calls can be chained together.
[ "<p", ">", "Describes", "the", "value", "of", "an", "application", "execution", "property", "key", "-", "value", "pair", ".", "<", "/", "p", ">" ]
train
https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-kinesisanalyticsv2/src/main/java/com/amazonaws/services/kinesisanalyticsv2/model/PropertyGroup.java#L119-L122
google/error-prone-javac
src/jdk.compiler/share/classes/com/sun/tools/javac/comp/DeferredAttr.java
DeferredAttr.attribSpeculative
JCTree attribSpeculative(JCTree tree, Env<AttrContext> env, ResultInfo resultInfo) { return attribSpeculative(tree, env, resultInfo, treeCopier, (newTree)->new DeferredAttrDiagHandler(log, newTree), null); }
java
JCTree attribSpeculative(JCTree tree, Env<AttrContext> env, ResultInfo resultInfo) { return attribSpeculative(tree, env, resultInfo, treeCopier, (newTree)->new DeferredAttrDiagHandler(log, newTree), null); }
[ "JCTree", "attribSpeculative", "(", "JCTree", "tree", ",", "Env", "<", "AttrContext", ">", "env", ",", "ResultInfo", "resultInfo", ")", "{", "return", "attribSpeculative", "(", "tree", ",", "env", ",", "resultInfo", ",", "treeCopier", ",", "(", "newTree", ")...
Routine that performs speculative type-checking; the input AST node is cloned (to avoid side-effects cause by Attr) and compiler state is restored after type-checking. All diagnostics (but critical ones) are disabled during speculative type-checking.
[ "Routine", "that", "performs", "speculative", "type", "-", "checking", ";", "the", "input", "AST", "node", "is", "cloned", "(", "to", "avoid", "side", "-", "effects", "cause", "by", "Attr", ")", "and", "compiler", "state", "is", "restored", "after", "type"...
train
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/DeferredAttr.java#L471-L474
upwork/java-upwork
src/com/Upwork/api/Routers/Reports/Time.java
Time.getByTeamFull
public JSONObject getByTeamFull(String company, String team, HashMap<String, String> params) throws JSONException { return _getByType(company, team, null, params, false); }
java
public JSONObject getByTeamFull(String company, String team, HashMap<String, String> params) throws JSONException { return _getByType(company, team, null, params, false); }
[ "public", "JSONObject", "getByTeamFull", "(", "String", "company", ",", "String", "team", ",", "HashMap", "<", "String", ",", "String", ">", "params", ")", "throws", "JSONException", "{", "return", "_getByType", "(", "company", ",", "team", ",", "null", ",",...
Generate Time Reports for a Specific Team (with financial info) @param company Company ID @param team Team ID @param params Parameters @throws JSONException If error occurred @return {@link JSONObject}
[ "Generate", "Time", "Reports", "for", "a", "Specific", "Team", "(", "with", "financial", "info", ")" ]
train
https://github.com/upwork/java-upwork/blob/342297161503a74e9e0bddbd381ab5eebf4dc454/src/com/Upwork/api/Routers/Reports/Time.java#L80-L82
stephenc/java-iso-tools
iso9660-writer/src/main/java/com/github/stephenc/javaisotools/iso9660/ISO9660Directory.java
ISO9660Directory.sortedIterator
public Iterator<ISO9660Directory> sortedIterator() { if (sortedIterator == null) { sortedIterator = new ISO9660DirectoryIterator(this, true); } sortedIterator.reset(); return sortedIterator; }
java
public Iterator<ISO9660Directory> sortedIterator() { if (sortedIterator == null) { sortedIterator = new ISO9660DirectoryIterator(this, true); } sortedIterator.reset(); return sortedIterator; }
[ "public", "Iterator", "<", "ISO9660Directory", ">", "sortedIterator", "(", ")", "{", "if", "(", "sortedIterator", "==", "null", ")", "{", "sortedIterator", "=", "new", "ISO9660DirectoryIterator", "(", "this", ",", "true", ")", ";", "}", "sortedIterator", ".", ...
Returns a directory iterator to traverse the directory hierarchy according to the needs of ISO 9660 (sort order of Path Tables and Directory Records) @return Iterator
[ "Returns", "a", "directory", "iterator", "to", "traverse", "the", "directory", "hierarchy", "according", "to", "the", "needs", "of", "ISO", "9660", "(", "sort", "order", "of", "Path", "Tables", "and", "Directory", "Records", ")" ]
train
https://github.com/stephenc/java-iso-tools/blob/828c50b02eb311a14dde0dab43462a0d0c9dfb06/iso9660-writer/src/main/java/com/github/stephenc/javaisotools/iso9660/ISO9660Directory.java#L519-L525
haraldk/TwelveMonkeys
common/common-lang/src/main/java/com/twelvemonkeys/lang/DateUtil.java
DateUtil.roundToHour
public static long roundToHour(final long pTime, final TimeZone pTimeZone) { int offset = pTimeZone.getOffset(pTime); return ((pTime / HOUR) * HOUR) - offset; }
java
public static long roundToHour(final long pTime, final TimeZone pTimeZone) { int offset = pTimeZone.getOffset(pTime); return ((pTime / HOUR) * HOUR) - offset; }
[ "public", "static", "long", "roundToHour", "(", "final", "long", "pTime", ",", "final", "TimeZone", "pTimeZone", ")", "{", "int", "offset", "=", "pTimeZone", ".", "getOffset", "(", "pTime", ")", ";", "return", "(", "(", "pTime", "/", "HOUR", ")", "*", ...
Rounds the given time down to the closest hour, using the given timezone. @param pTime time @param pTimeZone the timezone to use when rounding @return the time rounded to the closest hour.
[ "Rounds", "the", "given", "time", "down", "to", "the", "closest", "hour", "using", "the", "given", "timezone", "." ]
train
https://github.com/haraldk/TwelveMonkeys/blob/7fad4d5cd8cb3a6728c7fd3f28a7b84d8ce0101d/common/common-lang/src/main/java/com/twelvemonkeys/lang/DateUtil.java#L178-L181
EMCECS/nfs-client-java
src/main/java/com/emc/ecs/nfsclient/nfs/NfsResponseBase.java
NfsResponseBase.makeNfsGetAttributes
protected static NfsGetAttributes makeNfsGetAttributes(Xdr xdr, boolean force) { NfsGetAttributes attributes = null; if (force || xdr.getBoolean()) { attributes = new NfsGetAttributes(); attributes.unmarshalling(xdr); } return attributes; }
java
protected static NfsGetAttributes makeNfsGetAttributes(Xdr xdr, boolean force) { NfsGetAttributes attributes = null; if (force || xdr.getBoolean()) { attributes = new NfsGetAttributes(); attributes.unmarshalling(xdr); } return attributes; }
[ "protected", "static", "NfsGetAttributes", "makeNfsGetAttributes", "(", "Xdr", "xdr", ",", "boolean", "force", ")", "{", "NfsGetAttributes", "attributes", "=", "null", ";", "if", "(", "force", "||", "xdr", ".", "getBoolean", "(", ")", ")", "{", "attributes", ...
Create the object if it is there, or skip the existence check if <code>force</code> is <code>true</code>. Convenience method for use in subclasses. @param xdr @param force do not check whether it is there @return the created object
[ "Create", "the", "object", "if", "it", "is", "there", "or", "skip", "the", "existence", "check", "if", "<code", ">", "force<", "/", "code", ">", "is", "<code", ">", "true<", "/", "code", ">", ".", "Convenience", "method", "for", "use", "in", "subclasse...
train
https://github.com/EMCECS/nfs-client-java/blob/7ba25bad5052b95cd286052745327729288b2843/src/main/java/com/emc/ecs/nfsclient/nfs/NfsResponseBase.java#L190-L197
mojohaus/jaxb2-maven-plugin
src/main/java/org/codehaus/mojo/jaxb2/shared/environment/classloading/ThreadContextClassLoaderBuilder.java
ThreadContextClassLoaderBuilder.addPath
public ThreadContextClassLoaderBuilder addPath(final String path) { // Check sanity Validate.notEmpty(path, "path"); // Convert to an URL, and delegate. final URL anUrl; try { anUrl = new File(path).toURI().toURL(); } catch (MalformedURLException e) { throw new IllegalArgumentException("Could not convert path [" + path + "] to an URL.", e); } // Delegate return addURL(anUrl); }
java
public ThreadContextClassLoaderBuilder addPath(final String path) { // Check sanity Validate.notEmpty(path, "path"); // Convert to an URL, and delegate. final URL anUrl; try { anUrl = new File(path).toURI().toURL(); } catch (MalformedURLException e) { throw new IllegalArgumentException("Could not convert path [" + path + "] to an URL.", e); } // Delegate return addURL(anUrl); }
[ "public", "ThreadContextClassLoaderBuilder", "addPath", "(", "final", "String", "path", ")", "{", "// Check sanity", "Validate", ".", "notEmpty", "(", "path", ",", "\"path\"", ")", ";", "// Convert to an URL, and delegate.", "final", "URL", "anUrl", ";", "try", "{",...
Converts the supplied path to an URL and adds it to this ThreadContextClassLoaderBuilder. @param path A path to convert to an URL and add. @return This ThreadContextClassLoaderBuilder, for builder pattern chaining. @see #addURL(java.net.URL)
[ "Converts", "the", "supplied", "path", "to", "an", "URL", "and", "adds", "it", "to", "this", "ThreadContextClassLoaderBuilder", "." ]
train
https://github.com/mojohaus/jaxb2-maven-plugin/blob/e3c4e47943b15282e5a6e850bbfb1588d8452a0a/src/main/java/org/codehaus/mojo/jaxb2/shared/environment/classloading/ThreadContextClassLoaderBuilder.java#L157-L172
janvanbesien/java-ipv6
src/main/java/com/googlecode/ipv6/IPv6AddressPool.java
IPv6AddressPool.deAllocate
public IPv6AddressPool deAllocate(final IPv6Network toDeAllocate) { if (!contains(toDeAllocate)) { throw new IllegalArgumentException( "Network to de-allocate[" + toDeAllocate + "] is not contained in this allocatable range [" + this + "]"); } // find ranges just in front or after the network to deallocate. These are the ranges to merge with to prevent fragmentation. final IPv6AddressRange freeRangeBeforeNetwork = findFreeRangeBefore(toDeAllocate); final IPv6AddressRange freeRangeAfterNetwork = findFreeRangeAfter(toDeAllocate); final TreeSet<IPv6AddressRange> newFreeRanges = new TreeSet<IPv6AddressRange>(this.freeRanges); if ((freeRangeBeforeNetwork == null) && (freeRangeAfterNetwork == null)) { // nothing to "defragment" newFreeRanges.add(toDeAllocate); } else { if ((freeRangeBeforeNetwork != null) && (freeRangeAfterNetwork != null)) { // merge two existing ranges newFreeRanges.remove(freeRangeBeforeNetwork); newFreeRanges.remove(freeRangeAfterNetwork); newFreeRanges.add(IPv6AddressRange .fromFirstAndLast(freeRangeBeforeNetwork.getFirst(), freeRangeAfterNetwork.getLast())); } else if (freeRangeBeforeNetwork != null) { // append newFreeRanges.remove(freeRangeBeforeNetwork); newFreeRanges.add(IPv6AddressRange.fromFirstAndLast(freeRangeBeforeNetwork.getFirst(), toDeAllocate.getLast())); } else /*if (freeRangeAfterNetwork != null)*/ { // prepend newFreeRanges.remove(freeRangeAfterNetwork); newFreeRanges.add(IPv6AddressRange.fromFirstAndLast(toDeAllocate.getFirst(), freeRangeAfterNetwork.getLast())); } } return new IPv6AddressPool(underlyingRange, allocationSubnetSize, newFreeRanges, getLastAllocated()); }
java
public IPv6AddressPool deAllocate(final IPv6Network toDeAllocate) { if (!contains(toDeAllocate)) { throw new IllegalArgumentException( "Network to de-allocate[" + toDeAllocate + "] is not contained in this allocatable range [" + this + "]"); } // find ranges just in front or after the network to deallocate. These are the ranges to merge with to prevent fragmentation. final IPv6AddressRange freeRangeBeforeNetwork = findFreeRangeBefore(toDeAllocate); final IPv6AddressRange freeRangeAfterNetwork = findFreeRangeAfter(toDeAllocate); final TreeSet<IPv6AddressRange> newFreeRanges = new TreeSet<IPv6AddressRange>(this.freeRanges); if ((freeRangeBeforeNetwork == null) && (freeRangeAfterNetwork == null)) { // nothing to "defragment" newFreeRanges.add(toDeAllocate); } else { if ((freeRangeBeforeNetwork != null) && (freeRangeAfterNetwork != null)) { // merge two existing ranges newFreeRanges.remove(freeRangeBeforeNetwork); newFreeRanges.remove(freeRangeAfterNetwork); newFreeRanges.add(IPv6AddressRange .fromFirstAndLast(freeRangeBeforeNetwork.getFirst(), freeRangeAfterNetwork.getLast())); } else if (freeRangeBeforeNetwork != null) { // append newFreeRanges.remove(freeRangeBeforeNetwork); newFreeRanges.add(IPv6AddressRange.fromFirstAndLast(freeRangeBeforeNetwork.getFirst(), toDeAllocate.getLast())); } else /*if (freeRangeAfterNetwork != null)*/ { // prepend newFreeRanges.remove(freeRangeAfterNetwork); newFreeRanges.add(IPv6AddressRange.fromFirstAndLast(toDeAllocate.getFirst(), freeRangeAfterNetwork.getLast())); } } return new IPv6AddressPool(underlyingRange, allocationSubnetSize, newFreeRanges, getLastAllocated()); }
[ "public", "IPv6AddressPool", "deAllocate", "(", "final", "IPv6Network", "toDeAllocate", ")", "{", "if", "(", "!", "contains", "(", "toDeAllocate", ")", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"Network to de-allocate[\"", "+", "toDeAllocate", "+"...
Give a network back to the pool (de-allocate). @param toDeAllocate network to de-allocate
[ "Give", "a", "network", "back", "to", "the", "pool", "(", "de", "-", "allocate", ")", "." ]
train
https://github.com/janvanbesien/java-ipv6/blob/9af15b4a6c0074f9fa23dfa030027c631b9c2f78/src/main/java/com/googlecode/ipv6/IPv6AddressPool.java#L230-L274
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/x509/URIName.java
URIName.nameConstraint
public static URIName nameConstraint(DerValue value) throws IOException { URI uri; String name = value.getIA5String(); try { uri = new URI(name); } catch (URISyntaxException use) { throw new IOException("invalid URI name constraint:" + name, use); } if (uri.getScheme() == null) { String host = uri.getSchemeSpecificPart(); try { DNSName hostDNS; if (host.charAt(0) == '.') { hostDNS = new DNSName(host.substring(1)); } else { hostDNS = new DNSName(host); } return new URIName(uri, host, hostDNS); } catch (IOException ioe) { throw new IOException("invalid URI name constraint:" + name, ioe); } } else { throw new IOException("invalid URI name constraint (should not " + "include scheme):" + name); } }
java
public static URIName nameConstraint(DerValue value) throws IOException { URI uri; String name = value.getIA5String(); try { uri = new URI(name); } catch (URISyntaxException use) { throw new IOException("invalid URI name constraint:" + name, use); } if (uri.getScheme() == null) { String host = uri.getSchemeSpecificPart(); try { DNSName hostDNS; if (host.charAt(0) == '.') { hostDNS = new DNSName(host.substring(1)); } else { hostDNS = new DNSName(host); } return new URIName(uri, host, hostDNS); } catch (IOException ioe) { throw new IOException("invalid URI name constraint:" + name, ioe); } } else { throw new IOException("invalid URI name constraint (should not " + "include scheme):" + name); } }
[ "public", "static", "URIName", "nameConstraint", "(", "DerValue", "value", ")", "throws", "IOException", "{", "URI", "uri", ";", "String", "name", "=", "value", ".", "getIA5String", "(", ")", ";", "try", "{", "uri", "=", "new", "URI", "(", "name", ")", ...
Create the URIName object with the specified name constraint. URI name constraints syntax is different than SubjectAltNames, etc. See 4.2.1.11 of RFC 3280. @param value the URI name constraint @throws IOException if name is not a proper URI name constraint
[ "Create", "the", "URIName", "object", "with", "the", "specified", "name", "constraint", ".", "URI", "name", "constraints", "syntax", "is", "different", "than", "SubjectAltNames", "etc", ".", "See", "4", ".", "2", ".", "1", ".", "11", "of", "RFC", "3280", ...
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/x509/URIName.java#L156-L181
jeffreyning/nh-micro
nh-micro-template/src/main/java/com/nh/micro/template/MicroServiceTemplateSupport.java
MicroServiceTemplateSupport.updateInfoByIdService
public Integer updateInfoByIdService(String id,Map requestParamMap,String tableName,String cusCondition,String cusSetStr) throws Exception{ return updateInfoServiceInner(id,requestParamMap,tableName,cusCondition,cusSetStr,null); }
java
public Integer updateInfoByIdService(String id,Map requestParamMap,String tableName,String cusCondition,String cusSetStr) throws Exception{ return updateInfoServiceInner(id,requestParamMap,tableName,cusCondition,cusSetStr,null); }
[ "public", "Integer", "updateInfoByIdService", "(", "String", "id", ",", "Map", "requestParamMap", ",", "String", "tableName", ",", "String", "cusCondition", ",", "String", "cusSetStr", ")", "throws", "Exception", "{", "return", "updateInfoServiceInner", "(", "id", ...
���id������ݼ�¼ @param id �������� @param requestParamMap �ύ���� @param tableName ����� @param cusCondition ���������ַ� @param cusSetStr ����set�ַ� @param modelName ģ����� @return @throws Exception
[ "���id������ݼ�¼" ]
train
https://github.com/jeffreyning/nh-micro/blob/f1cb420a092f8ba94317519ede739974decb5617/nh-micro-template/src/main/java/com/nh/micro/template/MicroServiceTemplateSupport.java#L1688-L1690
line/armeria
thrift/src/main/java/com/linecorp/armeria/common/thrift/text/TTextProtocol.java
TTextProtocol.writeNameOrValue
private <T> void writeNameOrValue(TypedParser<T> helper, T val) throws TException { getCurrentContext().write(); try { if (getCurrentContext().isMapKey()) { getCurrentWriter().writeFieldName(val.toString()); } else { helper.writeValue(getCurrentWriter(), val); } } catch (IOException ex) { throw new TException(ex); } }
java
private <T> void writeNameOrValue(TypedParser<T> helper, T val) throws TException { getCurrentContext().write(); try { if (getCurrentContext().isMapKey()) { getCurrentWriter().writeFieldName(val.toString()); } else { helper.writeValue(getCurrentWriter(), val); } } catch (IOException ex) { throw new TException(ex); } }
[ "private", "<", "T", ">", "void", "writeNameOrValue", "(", "TypedParser", "<", "T", ">", "helper", ",", "T", "val", ")", "throws", "TException", "{", "getCurrentContext", "(", ")", ".", "write", "(", ")", ";", "try", "{", "if", "(", "getCurrentContext", ...
Write out the given value, either as a JSON name (meaning it's escaped by quotes), or a value. The TypedParser knows how to handle the writing.
[ "Write", "out", "the", "given", "value", "either", "as", "a", "JSON", "name", "(", "meaning", "it", "s", "escaped", "by", "quotes", ")", "or", "a", "value", ".", "The", "TypedParser", "knows", "how", "to", "handle", "the", "writing", "." ]
train
https://github.com/line/armeria/blob/67d29e019fd35a35f89c45cc8f9119ff9b12b44d/thrift/src/main/java/com/linecorp/armeria/common/thrift/text/TTextProtocol.java#L367-L379
lessthanoptimal/BoofCV
main/boofcv-geo/src/main/java/boofcv/alg/geo/MultiViewOps.java
MultiViewOps.createProjectiveToMetric
public static DMatrixRMaj createProjectiveToMetric( DMatrixRMaj K , double v1 , double v2 , double v3 , double lambda, @Nullable DMatrixRMaj H ) { if( H == null ) H = new DMatrixRMaj(4,4); else H.reshape(4,4); CommonOps_DDRM.insert(K,H,0,0); H.set(0,3,0); H.set(1,3,0); H.set(2,3,0); H.set(3,0,v1); H.set(3,1,v2); H.set(3,2,v3); H.set(3,3,lambda); return H; }
java
public static DMatrixRMaj createProjectiveToMetric( DMatrixRMaj K , double v1 , double v2 , double v3 , double lambda, @Nullable DMatrixRMaj H ) { if( H == null ) H = new DMatrixRMaj(4,4); else H.reshape(4,4); CommonOps_DDRM.insert(K,H,0,0); H.set(0,3,0); H.set(1,3,0); H.set(2,3,0); H.set(3,0,v1); H.set(3,1,v2); H.set(3,2,v3); H.set(3,3,lambda); return H; }
[ "public", "static", "DMatrixRMaj", "createProjectiveToMetric", "(", "DMatrixRMaj", "K", ",", "double", "v1", ",", "double", "v2", ",", "double", "v3", ",", "double", "lambda", ",", "@", "Nullable", "DMatrixRMaj", "H", ")", "{", "if", "(", "H", "==", "null"...
Given the calibration matrix for the first view, plane at infinity, and lambda (scaling factor) compute the rectifying homography for changing a projective camera matrix into a metric one. <p>H = [K 0;v' &lambda]</p> @param K 3x3 calibration matrix for view 1 @param v1 plane at infinity @param v2 plane at infinity @param v3 plane at infinity @param lambda scaling factor @param H (Optional) Storage for 4x4 matrix @return The homography
[ "Given", "the", "calibration", "matrix", "for", "the", "first", "view", "plane", "at", "infinity", "and", "lambda", "(", "scaling", "factor", ")", "compute", "the", "rectifying", "homography", "for", "changing", "a", "projective", "camera", "matrix", "into", "...
train
https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-geo/src/main/java/boofcv/alg/geo/MultiViewOps.java#L1577-L1597
pac4j/pac4j
pac4j-core/src/main/java/org/pac4j/core/util/CommonHelper.java
CommonHelper.assertNotBlank
public static void assertNotBlank(final String name, final String value, final String msg) { assertTrue(!isBlank(value), name + " cannot be blank" + (msg != null ? ": " + msg : "")); }
java
public static void assertNotBlank(final String name, final String value, final String msg) { assertTrue(!isBlank(value), name + " cannot be blank" + (msg != null ? ": " + msg : "")); }
[ "public", "static", "void", "assertNotBlank", "(", "final", "String", "name", ",", "final", "String", "value", ",", "final", "String", "msg", ")", "{", "assertTrue", "(", "!", "isBlank", "(", "value", ")", ",", "name", "+", "\" cannot be blank\"", "+", "("...
Verify that a String is not blank otherwise throw a {@link TechnicalException}. @param name name if the string @param value value of the string @param msg an expanatory message
[ "Verify", "that", "a", "String", "is", "not", "blank", "otherwise", "throw", "a", "{", "@link", "TechnicalException", "}", "." ]
train
https://github.com/pac4j/pac4j/blob/d9cd029f8783792b31dd48bf1e32f80628f2c4a3/pac4j-core/src/main/java/org/pac4j/core/util/CommonHelper.java#L123-L125
cloudendpoints/endpoints-management-java
endpoints-control/src/main/java/com/google/api/control/model/PathTemplate.java
PathTemplate.validatedMatch
public ImmutableMap<String, String> validatedMatch(String path, String exceptionMessagePrefix) { ImmutableMap<String, String> matchMap = match(path); if (matchMap == null) { throw new ValidationException( String.format( "%s: Parameter \"%s\" must be in the form \"%s\"", exceptionMessagePrefix, path, this.toString())); } return matchMap; }
java
public ImmutableMap<String, String> validatedMatch(String path, String exceptionMessagePrefix) { ImmutableMap<String, String> matchMap = match(path); if (matchMap == null) { throw new ValidationException( String.format( "%s: Parameter \"%s\" must be in the form \"%s\"", exceptionMessagePrefix, path, this.toString())); } return matchMap; }
[ "public", "ImmutableMap", "<", "String", ",", "String", ">", "validatedMatch", "(", "String", "path", ",", "String", "exceptionMessagePrefix", ")", "{", "ImmutableMap", "<", "String", ",", "String", ">", "matchMap", "=", "match", "(", "path", ")", ";", "if",...
Matches the path, returning a map from variable names to matched values. All matched values will be properly unescaped using URL encoding rules. If the path does not match the template, throws a ValidationException. The exceptionMessagePrefix parameter will be prepended to the ValidationException message. <p>If the path starts with '//', the first segment will be interpreted as a host name and stored in the variable {@link #HOSTNAME_VAR}. <p>See the {@link PathTemplate} class documentation for examples. <p>For free wildcards in the template, the matching process creates variables named '$n', where 'n' is the wildcard's position in the template (starting at n=0). For example: <pre> PathTemplate template = PathTemplate.create("shelves/*&#47;books/*"); assert template.validatedMatch("shelves/s1/books/b2", "User exception string") .equals(ImmutableMap.of("$0", "s1", "$1", "b1")); assert template.validatedMatch("//somewhere.io/shelves/s1/books/b2", "User exception string") .equals(ImmutableMap.of(HOSTNAME_VAR, "//somewhere.io", "$0", "s1", "$1", "b1")); </pre> All matched values will be properly unescaped using URL encoding rules (so long as URL encoding has not been disabled by the {@link #createWithoutUrlEncoding} method).
[ "Matches", "the", "path", "returning", "a", "map", "from", "variable", "names", "to", "matched", "values", ".", "All", "matched", "values", "will", "be", "properly", "unescaped", "using", "URL", "encoding", "rules", ".", "If", "the", "path", "does", "not", ...
train
https://github.com/cloudendpoints/endpoints-management-java/blob/5bbf20ddadbbd51b890049e3c338c28abe2c9f94/endpoints-control/src/main/java/com/google/api/control/model/PathTemplate.java#L407-L416
twilio/twilio-java
src/main/java/com/twilio/rest/video/v1/room/participant/SubscribedTrackReader.java
SubscribedTrackReader.previousPage
@Override public Page<SubscribedTrack> previousPage(final Page<SubscribedTrack> page, final TwilioRestClient client) { Request request = new Request( HttpMethod.GET, page.getPreviousPageUrl( Domains.VIDEO.toString(), client.getRegion() ) ); return pageForRequest(client, request); }
java
@Override public Page<SubscribedTrack> previousPage(final Page<SubscribedTrack> page, final TwilioRestClient client) { Request request = new Request( HttpMethod.GET, page.getPreviousPageUrl( Domains.VIDEO.toString(), client.getRegion() ) ); return pageForRequest(client, request); }
[ "@", "Override", "public", "Page", "<", "SubscribedTrack", ">", "previousPage", "(", "final", "Page", "<", "SubscribedTrack", ">", "page", ",", "final", "TwilioRestClient", "client", ")", "{", "Request", "request", "=", "new", "Request", "(", "HttpMethod", "."...
Retrieve the previous page from the Twilio API. @param page current page @param client TwilioRestClient with which to make the request @return Previous Page
[ "Retrieve", "the", "previous", "page", "from", "the", "Twilio", "API", "." ]
train
https://github.com/twilio/twilio-java/blob/0318974c0a6a152994af167d430255684d5e9b9f/src/main/java/com/twilio/rest/video/v1/room/participant/SubscribedTrackReader.java#L176-L187
haraldk/TwelveMonkeys
imageio/imageio-core/src/main/java/com/twelvemonkeys/imageio/color/KCMSSanitizerStrategy.java
KCMSSanitizerStrategy.fixProfileXYZTag
private static boolean fixProfileXYZTag(final ICC_Profile profile, final int tagSignature) { byte[] data = profile.getData(tagSignature); // The CMM expects 0x64 65 73 63 ('XYZ ') but is 0x17 A5 05 B8..? if (data != null && intFromBigEndian(data, 0) == CORBIS_RGB_ALTERNATE_XYZ) { intToBigEndian(ICC_Profile.icSigXYZData, data, 0); profile.setData(tagSignature, data); return true; } return false; }
java
private static boolean fixProfileXYZTag(final ICC_Profile profile, final int tagSignature) { byte[] data = profile.getData(tagSignature); // The CMM expects 0x64 65 73 63 ('XYZ ') but is 0x17 A5 05 B8..? if (data != null && intFromBigEndian(data, 0) == CORBIS_RGB_ALTERNATE_XYZ) { intToBigEndian(ICC_Profile.icSigXYZData, data, 0); profile.setData(tagSignature, data); return true; } return false; }
[ "private", "static", "boolean", "fixProfileXYZTag", "(", "final", "ICC_Profile", "profile", ",", "final", "int", "tagSignature", ")", "{", "byte", "[", "]", "data", "=", "profile", ".", "getData", "(", "tagSignature", ")", ";", "// The CMM expects 0x64 65 73 63 ('...
Fixes problematic 'XYZ ' tags in Corbis RGB profile. @return {@code true} if found and fixed, otherwise {@code false} for short-circuiting to avoid unnecessary array copying.
[ "Fixes", "problematic", "XYZ", "tags", "in", "Corbis", "RGB", "profile", "." ]
train
https://github.com/haraldk/TwelveMonkeys/blob/7fad4d5cd8cb3a6728c7fd3f28a7b84d8ce0101d/imageio/imageio-core/src/main/java/com/twelvemonkeys/imageio/color/KCMSSanitizerStrategy.java#L81-L93
thorntail/thorntail
fractions/microprofile/microprofile-jwt/src/main/java/org/wildfly/swarm/microprofile/jwtauth/deployment/auth/cdi/MPJWTExtension.java
MPJWTExtension.observesAfterBeanDiscovery
void observesAfterBeanDiscovery(@Observes final AfterBeanDiscovery event, final BeanManager beanManager) { log.debugf("observesAfterBeanDiscovery, %s", claims); installClaimValueProducerMethodsViaSyntheticBeans(event, beanManager); }
java
void observesAfterBeanDiscovery(@Observes final AfterBeanDiscovery event, final BeanManager beanManager) { log.debugf("observesAfterBeanDiscovery, %s", claims); installClaimValueProducerMethodsViaSyntheticBeans(event, beanManager); }
[ "void", "observesAfterBeanDiscovery", "(", "@", "Observes", "final", "AfterBeanDiscovery", "event", ",", "final", "BeanManager", "beanManager", ")", "{", "log", ".", "debugf", "(", "\"observesAfterBeanDiscovery, %s\"", ",", "claims", ")", ";", "installClaimValueProducer...
Create producer methods for each ClaimValue injection site @param event - AfterBeanDiscovery @param beanManager - CDI bean manager
[ "Create", "producer", "methods", "for", "each", "ClaimValue", "injection", "site" ]
train
https://github.com/thorntail/thorntail/blob/4a391b68ffae98c6e66d30a3bfb99dadc9509f14/fractions/microprofile/microprofile-jwt/src/main/java/org/wildfly/swarm/microprofile/jwtauth/deployment/auth/cdi/MPJWTExtension.java#L216-L219
infinispan/infinispan
core/src/main/java/org/infinispan/interceptors/impl/EntryWrappingInterceptor.java
EntryWrappingInterceptor.shouldCommitDuringPrepare
protected boolean shouldCommitDuringPrepare(PrepareCommand command, TxInvocationContext ctx) { return totalOrder ? command.isOnePhaseCommit() && (!ctx.isOriginLocal() || !command.hasModifications()) : command.isOnePhaseCommit(); }
java
protected boolean shouldCommitDuringPrepare(PrepareCommand command, TxInvocationContext ctx) { return totalOrder ? command.isOnePhaseCommit() && (!ctx.isOriginLocal() || !command.hasModifications()) : command.isOnePhaseCommit(); }
[ "protected", "boolean", "shouldCommitDuringPrepare", "(", "PrepareCommand", "command", ",", "TxInvocationContext", "ctx", ")", "{", "return", "totalOrder", "?", "command", ".", "isOnePhaseCommit", "(", ")", "&&", "(", "!", "ctx", ".", "isOriginLocal", "(", ")", ...
total order condition: only commits when it is remote context and the prepare has the flag 1PC set @param command the prepare command @param ctx the invocation context @return true if the modification should be committed, false otherwise
[ "total", "order", "condition", ":", "only", "commits", "when", "it", "is", "remote", "context", "and", "the", "prepare", "has", "the", "flag", "1PC", "set" ]
train
https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/core/src/main/java/org/infinispan/interceptors/impl/EntryWrappingInterceptor.java#L847-L851
oehf/ipf-oht-atna
auditor/src/main/java/org/openhealthtools/ihe/atna/auditor/events/dicom/NetworkEntryEvent.java
NetworkEntryEvent.addNodeActiveParticipant
public void addNodeActiveParticipant(String userId, String altUserId, String userName, String networkId) { addActiveParticipant( userId, altUserId, userName, false, null, networkId); }
java
public void addNodeActiveParticipant(String userId, String altUserId, String userName, String networkId) { addActiveParticipant( userId, altUserId, userName, false, null, networkId); }
[ "public", "void", "addNodeActiveParticipant", "(", "String", "userId", ",", "String", "altUserId", ",", "String", "userName", ",", "String", "networkId", ")", "{", "addActiveParticipant", "(", "userId", ",", "altUserId", ",", "userName", ",", "false", ",", "null...
Add an Active Participant to this message representing the node doing the network entry @param userId The Active Participant's User ID @param altUserId The Active Participant's Alternate UserID @param userName The Active Participant's UserName @param networkId The Active Participant's Network Access Point ID
[ "Add", "an", "Active", "Participant", "to", "this", "message", "representing", "the", "node", "doing", "the", "network", "entry" ]
train
https://github.com/oehf/ipf-oht-atna/blob/25ed1e926825169c94923a2c89a4618f60478ae8/auditor/src/main/java/org/openhealthtools/ihe/atna/auditor/events/dicom/NetworkEntryEvent.java#L52-L61
Azure/azure-sdk-for-java
sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/DatabaseAdvisorsInner.java
DatabaseAdvisorsInner.getAsync
public Observable<AdvisorInner> getAsync(String resourceGroupName, String serverName, String databaseName, String advisorName) { return getWithServiceResponseAsync(resourceGroupName, serverName, databaseName, advisorName).map(new Func1<ServiceResponse<AdvisorInner>, AdvisorInner>() { @Override public AdvisorInner call(ServiceResponse<AdvisorInner> response) { return response.body(); } }); }
java
public Observable<AdvisorInner> getAsync(String resourceGroupName, String serverName, String databaseName, String advisorName) { return getWithServiceResponseAsync(resourceGroupName, serverName, databaseName, advisorName).map(new Func1<ServiceResponse<AdvisorInner>, AdvisorInner>() { @Override public AdvisorInner call(ServiceResponse<AdvisorInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "AdvisorInner", ">", "getAsync", "(", "String", "resourceGroupName", ",", "String", "serverName", ",", "String", "databaseName", ",", "String", "advisorName", ")", "{", "return", "getWithServiceResponseAsync", "(", "resourceGroupName", ","...
Returns details of a Database Advisor. @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 databaseName The name of the database. @param advisorName The name of the Database Advisor. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the AdvisorInner object
[ "Returns", "details", "of", "a", "Database", "Advisor", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/DatabaseAdvisorsInner.java#L205-L212
jwtk/jjwt
api/src/main/java/io/jsonwebtoken/lang/Strings.java
Strings.startsWithIgnoreCase
public static boolean startsWithIgnoreCase(String str, String prefix) { if (str == null || prefix == null) { return false; } if (str.startsWith(prefix)) { return true; } if (str.length() < prefix.length()) { return false; } String lcStr = str.substring(0, prefix.length()).toLowerCase(); String lcPrefix = prefix.toLowerCase(); return lcStr.equals(lcPrefix); }
java
public static boolean startsWithIgnoreCase(String str, String prefix) { if (str == null || prefix == null) { return false; } if (str.startsWith(prefix)) { return true; } if (str.length() < prefix.length()) { return false; } String lcStr = str.substring(0, prefix.length()).toLowerCase(); String lcPrefix = prefix.toLowerCase(); return lcStr.equals(lcPrefix); }
[ "public", "static", "boolean", "startsWithIgnoreCase", "(", "String", "str", ",", "String", "prefix", ")", "{", "if", "(", "str", "==", "null", "||", "prefix", "==", "null", ")", "{", "return", "false", ";", "}", "if", "(", "str", ".", "startsWith", "(...
Test if the given String starts with the specified prefix, ignoring upper/lower case. @param str the String to check @param prefix the prefix to look for @see java.lang.String#startsWith
[ "Test", "if", "the", "given", "String", "starts", "with", "the", "specified", "prefix", "ignoring", "upper", "/", "lower", "case", "." ]
train
https://github.com/jwtk/jjwt/blob/86b6096946752cffcfbc9b0a5503f1ea195cc140/api/src/main/java/io/jsonwebtoken/lang/Strings.java#L297-L310
zaproxy/zaproxy
src/org/apache/commons/httpclient/URI.java
URI.prevalidate
protected boolean prevalidate(String component, BitSet disallowed) { // prevalidate the given component by disallowed characters if (component == null) { return false; // undefined } char[] target = component.toCharArray(); for (int i = 0; i < target.length; i++) { if (disallowed.get(target[i])) { return false; } } return true; }
java
protected boolean prevalidate(String component, BitSet disallowed) { // prevalidate the given component by disallowed characters if (component == null) { return false; // undefined } char[] target = component.toCharArray(); for (int i = 0; i < target.length; i++) { if (disallowed.get(target[i])) { return false; } } return true; }
[ "protected", "boolean", "prevalidate", "(", "String", "component", ",", "BitSet", "disallowed", ")", "{", "// prevalidate the given component by disallowed characters", "if", "(", "component", "==", "null", ")", "{", "return", "false", ";", "// undefined", "}", "char"...
Pre-validate the unescaped URI string within a specific component. @param component the component string within the component @param disallowed those characters disallowed within the component @return if true, it doesn't have the disallowed characters if false, the component is undefined or an incorrect one
[ "Pre", "-", "validate", "the", "unescaped", "URI", "string", "within", "a", "specific", "component", "." ]
train
https://github.com/zaproxy/zaproxy/blob/0cbe5121f2ae1ecca222513d182759210c569bec/src/org/apache/commons/httpclient/URI.java#L1808-L1820
bitcoinj/bitcoinj
core/src/main/java/org/bitcoinj/protocols/payments/PaymentSession.java
PaymentSession.createFromUrl
public static ListenableFuture<PaymentSession> createFromUrl(final String url, final boolean verifyPki) throws PaymentProtocolException { return createFromUrl(url, verifyPki, null); }
java
public static ListenableFuture<PaymentSession> createFromUrl(final String url, final boolean verifyPki) throws PaymentProtocolException { return createFromUrl(url, verifyPki, null); }
[ "public", "static", "ListenableFuture", "<", "PaymentSession", ">", "createFromUrl", "(", "final", "String", "url", ",", "final", "boolean", "verifyPki", ")", "throws", "PaymentProtocolException", "{", "return", "createFromUrl", "(", "url", ",", "verifyPki", ",", ...
Returns a future that will be notified with a PaymentSession object after it is fetched using the provided url. url is an address where the {@link Protos.PaymentRequest} object may be fetched. If the payment request object specifies a PKI method, then the system trust store will be used to verify the signature provided by the payment request. An exception is thrown by the future if the signature cannot be verified.
[ "Returns", "a", "future", "that", "will", "be", "notified", "with", "a", "PaymentSession", "object", "after", "it", "is", "fetched", "using", "the", "provided", "url", ".", "url", "is", "an", "address", "where", "the", "{" ]
train
https://github.com/bitcoinj/bitcoinj/blob/9cf13d29315014ed59cf4fc5944e5f227e8df9a6/core/src/main/java/org/bitcoinj/protocols/payments/PaymentSession.java#L149-L152
lightoze/gwt-i18n-server
src/main/java/net/lightoze/gwt/i18n/client/LocaleFactory.java
LocaleFactory.put
public static <T extends LocalizableResource> void put(Class<T> cls, T m) { put(cls, null, m); }
java
public static <T extends LocalizableResource> void put(Class<T> cls, T m) { put(cls, null, m); }
[ "public", "static", "<", "T", "extends", "LocalizableResource", ">", "void", "put", "(", "Class", "<", "T", ">", "cls", ",", "T", "m", ")", "{", "put", "(", "cls", ",", "null", ",", "m", ")", ";", "}" ]
Populate localization object cache for <em>current</em> locale. @param cls localization interface class @param m localization object @param <T> localization interface class
[ "Populate", "localization", "object", "cache", "for", "<em", ">", "current<", "/", "em", ">", "locale", "." ]
train
https://github.com/lightoze/gwt-i18n-server/blob/96de53288e9bf31721d7b0e2a1d9f7b6ce1a7e83/src/main/java/net/lightoze/gwt/i18n/client/LocaleFactory.java#L83-L85
recommenders/rival
rival-evaluate/src/main/java/net/recommenders/rival/evaluation/strategy/StrategyIO.java
StrategyIO.readLine
public static void readLine(final String line, final Map<Long, List<Pair<Long, Double>>> mapUserRecommendations) { String[] toks = line.split("\t"); // mymedialite format: user \t [item:score,item:score,...] if (line.contains(":") && line.contains(",")) { Long user = Long.parseLong(toks[0]); String items = toks[1].replace("[", "").replace("]", ""); for (String pair : items.split(",")) { String[] pairToks = pair.split(":"); Long item = Long.parseLong(pairToks[0]); Double score = Double.parseDouble(pairToks[1]); List<Pair<Long, Double>> userRec = mapUserRecommendations.get(user); if (userRec == null) { userRec = new ArrayList<Pair<Long, Double>>(); mapUserRecommendations.put(user, userRec); } userRec.add(new Pair<Long, Double>(item, score)); } } else { Long user = Long.parseLong(toks[0]); Long item = Long.parseLong(toks[1]); Double score = Double.parseDouble(toks[2]); List<Pair<Long, Double>> userRec = mapUserRecommendations.get(user); if (userRec == null) { userRec = new ArrayList<Pair<Long, Double>>(); mapUserRecommendations.put(user, userRec); } userRec.add(new Pair<Long, Double>(item, score)); } }
java
public static void readLine(final String line, final Map<Long, List<Pair<Long, Double>>> mapUserRecommendations) { String[] toks = line.split("\t"); // mymedialite format: user \t [item:score,item:score,...] if (line.contains(":") && line.contains(",")) { Long user = Long.parseLong(toks[0]); String items = toks[1].replace("[", "").replace("]", ""); for (String pair : items.split(",")) { String[] pairToks = pair.split(":"); Long item = Long.parseLong(pairToks[0]); Double score = Double.parseDouble(pairToks[1]); List<Pair<Long, Double>> userRec = mapUserRecommendations.get(user); if (userRec == null) { userRec = new ArrayList<Pair<Long, Double>>(); mapUserRecommendations.put(user, userRec); } userRec.add(new Pair<Long, Double>(item, score)); } } else { Long user = Long.parseLong(toks[0]); Long item = Long.parseLong(toks[1]); Double score = Double.parseDouble(toks[2]); List<Pair<Long, Double>> userRec = mapUserRecommendations.get(user); if (userRec == null) { userRec = new ArrayList<Pair<Long, Double>>(); mapUserRecommendations.put(user, userRec); } userRec.add(new Pair<Long, Double>(item, score)); } }
[ "public", "static", "void", "readLine", "(", "final", "String", "line", ",", "final", "Map", "<", "Long", ",", "List", "<", "Pair", "<", "Long", ",", "Double", ">", ">", ">", "mapUserRecommendations", ")", "{", "String", "[", "]", "toks", "=", "line", ...
Read a file from the recommended items file. @param line The line. @param mapUserRecommendations The recommendations for the users where information will be stored into.
[ "Read", "a", "file", "from", "the", "recommended", "items", "file", "." ]
train
https://github.com/recommenders/rival/blob/6ee8223e91810ae1c6052899595af3906e0c34c6/rival-evaluate/src/main/java/net/recommenders/rival/evaluation/strategy/StrategyIO.java#L43-L71
jblas-project/jblas
src/main/java/org/jblas/Eigen.java
Eigen.symmetricGeneralizedEigenvalues
public static FloatMatrix symmetricGeneralizedEigenvalues(FloatMatrix A, FloatMatrix B) { A.assertSquare(); B.assertSquare(); FloatMatrix W = new FloatMatrix(A.rows); SimpleBlas.sygvd(1, 'N', 'U', A.dup(), B.dup(), W); return W; }
java
public static FloatMatrix symmetricGeneralizedEigenvalues(FloatMatrix A, FloatMatrix B) { A.assertSquare(); B.assertSquare(); FloatMatrix W = new FloatMatrix(A.rows); SimpleBlas.sygvd(1, 'N', 'U', A.dup(), B.dup(), W); return W; }
[ "public", "static", "FloatMatrix", "symmetricGeneralizedEigenvalues", "(", "FloatMatrix", "A", ",", "FloatMatrix", "B", ")", "{", "A", ".", "assertSquare", "(", ")", ";", "B", ".", "assertSquare", "(", ")", ";", "FloatMatrix", "W", "=", "new", "FloatMatrix", ...
Compute generalized eigenvalues of the problem A x = L B x. @param A symmetric Matrix A. Only the upper triangle will be considered. @param B symmetric Matrix B. Only the upper triangle will be considered. @return a vector of eigenvalues L.
[ "Compute", "generalized", "eigenvalues", "of", "the", "problem", "A", "x", "=", "L", "B", "x", "." ]
train
https://github.com/jblas-project/jblas/blob/2818f231228e655cda80dfd8e0b87709fdfd8a70/src/main/java/org/jblas/Eigen.java#L393-L399
googlemaps/google-maps-services-java
src/main/java/com/google/maps/StaticMapsApi.java
StaticMapsApi.newRequest
public static StaticMapsRequest newRequest(GeoApiContext context, Size size) { return new StaticMapsRequest(context).size(size); }
java
public static StaticMapsRequest newRequest(GeoApiContext context, Size size) { return new StaticMapsRequest(context).size(size); }
[ "public", "static", "StaticMapsRequest", "newRequest", "(", "GeoApiContext", "context", ",", "Size", "size", ")", "{", "return", "new", "StaticMapsRequest", "(", "context", ")", ".", "size", "(", "size", ")", ";", "}" ]
Create a new {@code StaticMapRequest}. @param context The {@code GeoApiContext} to make this request through. @param size The size of the static map. @return Returns a new {@code StaticMapRequest} with configured size.
[ "Create", "a", "new", "{", "@code", "StaticMapRequest", "}", "." ]
train
https://github.com/googlemaps/google-maps-services-java/blob/23d20d1930f80e310d856d2da51d72ee0db4476b/src/main/java/com/google/maps/StaticMapsApi.java#L31-L33
Azure/azure-sdk-for-java
keyvault/data-plane/azure-keyvault/src/main/java/com/microsoft/azure/keyvault/implementation/KeyVaultClientBaseImpl.java
KeyVaultClientBaseImpl.wrapKey
public KeyOperationResult wrapKey(String vaultBaseUrl, String keyName, String keyVersion, JsonWebKeyEncryptionAlgorithm algorithm, byte[] value) { return wrapKeyWithServiceResponseAsync(vaultBaseUrl, keyName, keyVersion, algorithm, value).toBlocking().single().body(); }
java
public KeyOperationResult wrapKey(String vaultBaseUrl, String keyName, String keyVersion, JsonWebKeyEncryptionAlgorithm algorithm, byte[] value) { return wrapKeyWithServiceResponseAsync(vaultBaseUrl, keyName, keyVersion, algorithm, value).toBlocking().single().body(); }
[ "public", "KeyOperationResult", "wrapKey", "(", "String", "vaultBaseUrl", ",", "String", "keyName", ",", "String", "keyVersion", ",", "JsonWebKeyEncryptionAlgorithm", "algorithm", ",", "byte", "[", "]", "value", ")", "{", "return", "wrapKeyWithServiceResponseAsync", "...
Wraps a symmetric key using a specified key. The WRAP operation supports encryption of a symmetric key using a key encryption key that has previously been stored in an Azure Key Vault. The WRAP operation is only strictly necessary for symmetric keys stored in Azure Key Vault since protection with an asymmetric key can be performed using the public portion of the key. This operation is supported for asymmetric keys as a convenience for callers that have a key-reference but do not have access to the public key material. This operation requires the keys/wrapKey permission. @param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net. @param keyName The name of the key. @param keyVersion The version of the key. @param algorithm algorithm identifier. Possible values include: 'RSA-OAEP', 'RSA-OAEP-256', 'RSA1_5' @param value the Base64Url value @throws IllegalArgumentException thrown if parameters fail the validation @throws KeyVaultErrorException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent @return the KeyOperationResult object if successful.
[ "Wraps", "a", "symmetric", "key", "using", "a", "specified", "key", ".", "The", "WRAP", "operation", "supports", "encryption", "of", "a", "symmetric", "key", "using", "a", "key", "encryption", "key", "that", "has", "previously", "been", "stored", "in", "an",...
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/keyvault/data-plane/azure-keyvault/src/main/java/com/microsoft/azure/keyvault/implementation/KeyVaultClientBaseImpl.java#L2602-L2604
landawn/AbacusUtil
src/com/landawn/abacus/util/DateUtil.java
DateUtil.setHours
public static <T extends java.util.Date> T setHours(final T date, final int amount) { return set(date, Calendar.HOUR_OF_DAY, amount); }
java
public static <T extends java.util.Date> T setHours(final T date, final int amount) { return set(date, Calendar.HOUR_OF_DAY, amount); }
[ "public", "static", "<", "T", "extends", "java", ".", "util", ".", "Date", ">", "T", "setHours", "(", "final", "T", "date", ",", "final", "int", "amount", ")", "{", "return", "set", "(", "date", ",", "Calendar", ".", "HOUR_OF_DAY", ",", "amount", ")"...
Copied from Apache Commons Lang under Apache License v2. <br /> Sets the hours field to a date returning a new object. Hours range from 0-23. The original {@code Date} is unchanged. @param date the date, not null @param amount the amount to set @return a new {@code Date} set with the specified value @throws IllegalArgumentException if the date is null @since 2.4
[ "Copied", "from", "Apache", "Commons", "Lang", "under", "Apache", "License", "v2", ".", "<br", "/", ">" ]
train
https://github.com/landawn/AbacusUtil/blob/544b7720175d15e9329f83dd22a8cc5fa4515e12/src/com/landawn/abacus/util/DateUtil.java#L751-L753
hazelcast/hazelcast
hazelcast/src/main/java/com/hazelcast/internal/partition/impl/PartitionReplicaManager.java
PartitionReplicaManager.checkAndGetPrimaryReplicaOwner
PartitionReplica checkAndGetPrimaryReplicaOwner(int partitionId, int replicaIndex) { InternalPartitionImpl partition = partitionStateManager.getPartitionImpl(partitionId); PartitionReplica owner = partition.getOwnerReplicaOrNull(); if (owner == null) { logger.info("Sync replica target is null, no need to sync -> partitionId=" + partitionId + ", replicaIndex=" + replicaIndex); return null; } PartitionReplica localReplica = PartitionReplica.from(nodeEngine.getLocalMember()); if (owner.equals(localReplica)) { if (logger.isFinestEnabled()) { logger.finest("This node is now owner of partition, cannot sync replica -> partitionId=" + partitionId + ", replicaIndex=" + replicaIndex + ", partition-info=" + partitionStateManager.getPartitionImpl(partitionId)); } return null; } if (!partition.isOwnerOrBackup(localReplica)) { if (logger.isFinestEnabled()) { logger.finest("This node is not backup replica of partitionId=" + partitionId + ", replicaIndex=" + replicaIndex + " anymore."); } return null; } return owner; }
java
PartitionReplica checkAndGetPrimaryReplicaOwner(int partitionId, int replicaIndex) { InternalPartitionImpl partition = partitionStateManager.getPartitionImpl(partitionId); PartitionReplica owner = partition.getOwnerReplicaOrNull(); if (owner == null) { logger.info("Sync replica target is null, no need to sync -> partitionId=" + partitionId + ", replicaIndex=" + replicaIndex); return null; } PartitionReplica localReplica = PartitionReplica.from(nodeEngine.getLocalMember()); if (owner.equals(localReplica)) { if (logger.isFinestEnabled()) { logger.finest("This node is now owner of partition, cannot sync replica -> partitionId=" + partitionId + ", replicaIndex=" + replicaIndex + ", partition-info=" + partitionStateManager.getPartitionImpl(partitionId)); } return null; } if (!partition.isOwnerOrBackup(localReplica)) { if (logger.isFinestEnabled()) { logger.finest("This node is not backup replica of partitionId=" + partitionId + ", replicaIndex=" + replicaIndex + " anymore."); } return null; } return owner; }
[ "PartitionReplica", "checkAndGetPrimaryReplicaOwner", "(", "int", "partitionId", ",", "int", "replicaIndex", ")", "{", "InternalPartitionImpl", "partition", "=", "partitionStateManager", ".", "getPartitionImpl", "(", "partitionId", ")", ";", "PartitionReplica", "owner", "...
Checks preconditions for replica sync - if we don't know the owner yet, if this node is the owner or not a replica
[ "Checks", "preconditions", "for", "replica", "sync", "-", "if", "we", "don", "t", "know", "the", "owner", "yet", "if", "this", "node", "is", "the", "owner", "or", "not", "a", "replica" ]
train
https://github.com/hazelcast/hazelcast/blob/8c4bc10515dbbfb41a33e0302c0caedf3cda1baf/hazelcast/src/main/java/com/hazelcast/internal/partition/impl/PartitionReplicaManager.java#L160-L187
OpenLiberty/open-liberty
dev/com.ibm.ws.security.authentication.builtin/src/com/ibm/ws/security/authentication/internal/jaas/modules/ServerCommonLoginModule.java
ServerCommonLoginModule.setCredentials
protected void setCredentials(Subject subject, String securityName, String urAuthenticatedId) throws Exception { // Principal principal = new WSPrincipal(securityName, accessId, authMethod); if (urAuthenticatedId != null && !urAuthenticatedId.equals(securityName)) { Hashtable<String, String> subjectHash = new Hashtable<String, String>(); subjectHash.put(AuthenticationConstants.UR_AUTHENTICATED_USERID_KEY, urAuthenticatedId); subject.getPrivateCredentials().add(subjectHash); } CredentialsService credentialsService = getCredentialsService(); credentialsService.setCredentials(subject); }
java
protected void setCredentials(Subject subject, String securityName, String urAuthenticatedId) throws Exception { // Principal principal = new WSPrincipal(securityName, accessId, authMethod); if (urAuthenticatedId != null && !urAuthenticatedId.equals(securityName)) { Hashtable<String, String> subjectHash = new Hashtable<String, String>(); subjectHash.put(AuthenticationConstants.UR_AUTHENTICATED_USERID_KEY, urAuthenticatedId); subject.getPrivateCredentials().add(subjectHash); } CredentialsService credentialsService = getCredentialsService(); credentialsService.setCredentials(subject); }
[ "protected", "void", "setCredentials", "(", "Subject", "subject", ",", "String", "securityName", ",", "String", "urAuthenticatedId", ")", "throws", "Exception", "{", "// Principal principal = new WSPrincipal(securityName, accessId, authMethod);", "if", "(", "urAuthentica...
Set the relevant Credentials for this login module into the Subject, and set the credentials for the determined accessId. @throws Exception
[ "Set", "the", "relevant", "Credentials", "for", "this", "login", "module", "into", "the", "Subject", "and", "set", "the", "credentials", "for", "the", "determined", "accessId", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.security.authentication.builtin/src/com/ibm/ws/security/authentication/internal/jaas/modules/ServerCommonLoginModule.java#L137-L149
ManfredTremmel/gwt-commons-lang3
src/main/java/org/apache/commons/lang3/builder/HashCodeBuilder.java
HashCodeBuilder.reflectionHashCode
@GwtIncompatible("incompatible method") public static int reflectionHashCode(final int initialNonZeroOddNumber, final int multiplierNonZeroOddNumber, final Object object, final boolean testTransients) { return reflectionHashCode(initialNonZeroOddNumber, multiplierNonZeroOddNumber, object, testTransients, null); }
java
@GwtIncompatible("incompatible method") public static int reflectionHashCode(final int initialNonZeroOddNumber, final int multiplierNonZeroOddNumber, final Object object, final boolean testTransients) { return reflectionHashCode(initialNonZeroOddNumber, multiplierNonZeroOddNumber, object, testTransients, null); }
[ "@", "GwtIncompatible", "(", "\"incompatible method\"", ")", "public", "static", "int", "reflectionHashCode", "(", "final", "int", "initialNonZeroOddNumber", ",", "final", "int", "multiplierNonZeroOddNumber", ",", "final", "Object", "object", ",", "final", "boolean", ...
<p> Uses reflection to build a valid hash code from the fields of {@code object}. </p> <p> It uses <code>AccessibleObject.setAccessible</code> to gain access to private fields. This means that it will throw a security exception if run under a security manager, if the permissions are not set up correctly. It is also not as efficient as testing explicitly. </p> <p> If the TestTransients parameter is set to <code>true</code>, transient members will be tested, otherwise they are ignored, as they are likely derived fields, and not part of the value of the <code>Object</code>. </p> <p> Static fields will not be tested. Superclass fields will be included. </p> <p> Two randomly chosen, non-zero, odd numbers must be passed in. Ideally these should be different for each class, however this is not vital. Prime numbers are preferred, especially for the multiplier. </p> @param initialNonZeroOddNumber a non-zero, odd number used as the initial value. This will be the returned value if no fields are found to include in the hash code @param multiplierNonZeroOddNumber a non-zero, odd number used as the multiplier @param object the Object to create a <code>hashCode</code> for @param testTransients whether to include transient fields @return int hash code @throws IllegalArgumentException if the Object is <code>null</code> @throws IllegalArgumentException if the number is zero or even @see HashCodeExclude
[ "<p", ">", "Uses", "reflection", "to", "build", "a", "valid", "hash", "code", "from", "the", "fields", "of", "{", "@code", "object", "}", ".", "<", "/", "p", ">" ]
train
https://github.com/ManfredTremmel/gwt-commons-lang3/blob/9e2dfbbda3668cfa5d935fe76479d1426c294504/src/main/java/org/apache/commons/lang3/builder/HashCodeBuilder.java#L307-L311
UrielCh/ovh-java-sdk
ovh-java-sdk-ipLoadbalancing/src/main/java/net/minidev/ovh/api/ApiOvhIpLoadbalancing.java
ApiOvhIpLoadbalancing.serviceName_http_route_POST
public OvhRouteHttp serviceName_http_route_POST(String serviceName, OvhRouteHttpAction action, String displayName, Long frontendId, Long weight) throws IOException { String qPath = "/ipLoadbalancing/{serviceName}/http/route"; StringBuilder sb = path(qPath, serviceName); HashMap<String, Object>o = new HashMap<String, Object>(); addBody(o, "action", action); addBody(o, "displayName", displayName); addBody(o, "frontendId", frontendId); addBody(o, "weight", weight); String resp = exec(qPath, "POST", sb.toString(), o); return convertTo(resp, OvhRouteHttp.class); }
java
public OvhRouteHttp serviceName_http_route_POST(String serviceName, OvhRouteHttpAction action, String displayName, Long frontendId, Long weight) throws IOException { String qPath = "/ipLoadbalancing/{serviceName}/http/route"; StringBuilder sb = path(qPath, serviceName); HashMap<String, Object>o = new HashMap<String, Object>(); addBody(o, "action", action); addBody(o, "displayName", displayName); addBody(o, "frontendId", frontendId); addBody(o, "weight", weight); String resp = exec(qPath, "POST", sb.toString(), o); return convertTo(resp, OvhRouteHttp.class); }
[ "public", "OvhRouteHttp", "serviceName_http_route_POST", "(", "String", "serviceName", ",", "OvhRouteHttpAction", "action", ",", "String", "displayName", ",", "Long", "frontendId", ",", "Long", "weight", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"...
Add a new HTTP route to your frontend REST: POST /ipLoadbalancing/{serviceName}/http/route @param weight [required] Route priority ([0..255]). 0 if null. Highest priority routes are evaluated last. Only the first matching route will trigger an action @param frontendId [required] Route traffic for this frontend @param action [required] Action triggered when all rules match @param displayName [required] Human readable name for your route, this field is for you @param serviceName [required] The internal name of your IP load balancing
[ "Add", "a", "new", "HTTP", "route", "to", "your", "frontend" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-ipLoadbalancing/src/main/java/net/minidev/ovh/api/ApiOvhIpLoadbalancing.java#L121-L131
foundation-runtime/service-directory
2.0/sd-api/src/main/java/com/cisco/oss/foundation/directory/connect/DirectoryConnection.java
DirectoryConnection.sendConnectProtocol
private ErrorCode sendConnectProtocol(long to) { String sessId = session.id; ErrorCode ec = ErrorCode.OK; ConnectProtocol conReq = new ConnectProtocol(0, lastDxid, session.timeOut, sessId, session.password, authData.userName, authData.secret, authData.obfuscated); ServiceDirectoryFuture future = submitAsyncRequest(new ProtocolHeader(0, ProtocolType.CreateSession), conReq, null); try { ConnectResponse resp = null; if (future.isDone()) { resp = (ConnectResponse) future.get(); } else { resp = (ConnectResponse) future.get(to, TimeUnit.MILLISECONDS); } onConnected(resp.getTimeOut(), resp.getSessionId(), resp.getPasswd(), resp.getServerId()); return ec; } catch (ExecutionException e) { // ConnectResponse failed, renew session. ServiceException se = (ServiceException) e.getCause(); ec = se.getServiceDirectoryError().getExceptionCode(); } catch (Exception e) { ec = ErrorCode.GENERAL_ERROR; } future.cancel(false); return ec; }
java
private ErrorCode sendConnectProtocol(long to) { String sessId = session.id; ErrorCode ec = ErrorCode.OK; ConnectProtocol conReq = new ConnectProtocol(0, lastDxid, session.timeOut, sessId, session.password, authData.userName, authData.secret, authData.obfuscated); ServiceDirectoryFuture future = submitAsyncRequest(new ProtocolHeader(0, ProtocolType.CreateSession), conReq, null); try { ConnectResponse resp = null; if (future.isDone()) { resp = (ConnectResponse) future.get(); } else { resp = (ConnectResponse) future.get(to, TimeUnit.MILLISECONDS); } onConnected(resp.getTimeOut(), resp.getSessionId(), resp.getPasswd(), resp.getServerId()); return ec; } catch (ExecutionException e) { // ConnectResponse failed, renew session. ServiceException se = (ServiceException) e.getCause(); ec = se.getServiceDirectoryError().getExceptionCode(); } catch (Exception e) { ec = ErrorCode.GENERAL_ERROR; } future.cancel(false); return ec; }
[ "private", "ErrorCode", "sendConnectProtocol", "(", "long", "to", ")", "{", "String", "sessId", "=", "session", ".", "id", ";", "ErrorCode", "ec", "=", "ErrorCode", ".", "OK", ";", "ConnectProtocol", "conReq", "=", "new", "ConnectProtocol", "(", "0", ",", ...
Send the Connect Protocol to the remote Directory Server. @param to the connection timeout. @return the ErrorCode of the request, OK for success.
[ "Send", "the", "Connect", "Protocol", "to", "the", "remote", "Directory", "Server", "." ]
train
https://github.com/foundation-runtime/service-directory/blob/a7bdefe173dc99e75eff4a24e07e6407e62f2ed4/2.0/sd-api/src/main/java/com/cisco/oss/foundation/directory/connect/DirectoryConnection.java#L748-L775
liferay/com-liferay-commerce
commerce-service/src/main/java/com/liferay/commerce/service/persistence/impl/CommerceCountryPersistenceImpl.java
CommerceCountryPersistenceImpl.findAll
@Override public List<CommerceCountry> findAll(int start, int end) { return findAll(start, end, null); }
java
@Override public List<CommerceCountry> findAll(int start, int end) { return findAll(start, end, null); }
[ "@", "Override", "public", "List", "<", "CommerceCountry", ">", "findAll", "(", "int", "start", ",", "int", "end", ")", "{", "return", "findAll", "(", "start", ",", "end", ",", "null", ")", ";", "}" ]
Returns a range of all the commerce countries. <p> Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link QueryUtil#ALL_POS} will return the full result set. If <code>orderByComparator</code> is specified, then the query will include the given ORDER BY logic. If <code>orderByComparator</code> is absent and pagination is required (<code>start</code> and <code>end</code> are not {@link QueryUtil#ALL_POS}), then the query will include the default ORDER BY logic from {@link CommerceCountryModelImpl}. If both <code>orderByComparator</code> and pagination are absent, for performance reasons, the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order. </p> @param start the lower bound of the range of commerce countries @param end the upper bound of the range of commerce countries (not inclusive) @return the range of commerce countries
[ "Returns", "a", "range", "of", "all", "the", "commerce", "countries", "." ]
train
https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-service/src/main/java/com/liferay/commerce/service/persistence/impl/CommerceCountryPersistenceImpl.java#L4996-L4999
googleapis/google-cloud-java
google-cloud-clients/google-cloud-trace/src/main/java/com/google/cloud/trace/v2/TraceServiceClient.java
TraceServiceClient.batchWriteSpans
public final void batchWriteSpans(String name, List<Span> spans) { BatchWriteSpansRequest request = BatchWriteSpansRequest.newBuilder().setName(name).addAllSpans(spans).build(); batchWriteSpans(request); }
java
public final void batchWriteSpans(String name, List<Span> spans) { BatchWriteSpansRequest request = BatchWriteSpansRequest.newBuilder().setName(name).addAllSpans(spans).build(); batchWriteSpans(request); }
[ "public", "final", "void", "batchWriteSpans", "(", "String", "name", ",", "List", "<", "Span", ">", "spans", ")", "{", "BatchWriteSpansRequest", "request", "=", "BatchWriteSpansRequest", ".", "newBuilder", "(", ")", ".", "setName", "(", "name", ")", ".", "ad...
Sends new spans to new or existing traces. You cannot update existing spans. <p>Sample code: <pre><code> try (TraceServiceClient traceServiceClient = TraceServiceClient.create()) { ProjectName name = ProjectName.of("[PROJECT]"); List&lt;Span&gt; spans = new ArrayList&lt;&gt;(); traceServiceClient.batchWriteSpans(name.toString(), spans); } </code></pre> @param name Required. The name of the project where the spans belong. The format is `projects/[PROJECT_ID]`. @param spans A list of new spans. The span names must not match existing spans, or the results are undefined. @throws com.google.api.gax.rpc.ApiException if the remote call fails
[ "Sends", "new", "spans", "to", "new", "or", "existing", "traces", ".", "You", "cannot", "update", "existing", "spans", "." ]
train
https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-trace/src/main/java/com/google/cloud/trace/v2/TraceServiceClient.java#L205-L210
diffplug/JMatIO
src/main/java/ca/mjdsystems/jmatio/types/MLStructure.java
MLStructure.getField
public MLArray getField(String name, int m, int n) { return getField(name, getIndex(m,n) ); }
java
public MLArray getField(String name, int m, int n) { return getField(name, getIndex(m,n) ); }
[ "public", "MLArray", "getField", "(", "String", "name", ",", "int", "m", ",", "int", "n", ")", "{", "return", "getField", "(", "name", ",", "getIndex", "(", "m", ",", "n", ")", ")", ";", "}" ]
Gets a value of the field described by name from (m,n)'th struct in struct array or null if the field doesn't exist. @param name @param m @param n @return
[ "Gets", "a", "value", "of", "the", "field", "described", "by", "name", "from", "(", "m", "n", ")", "th", "struct", "in", "struct", "array", "or", "null", "if", "the", "field", "doesn", "t", "exist", "." ]
train
https://github.com/diffplug/JMatIO/blob/dab8a54fa21a8faeaa81537cdc45323c5c4e6ca6/src/main/java/ca/mjdsystems/jmatio/types/MLStructure.java#L186-L189
wcm-io-caravan/caravan-hal
docs-maven-plugin/src/main/java/io/wcm/caravan/maven/plugins/haldocs/GenerateHalDocsJsonMojo.java
GenerateHalDocsJsonMojo.hasJsonSchemaFile
private boolean hasJsonSchemaFile(ZipFile jarFile, Class<?> modelClass) throws IOException { String path = JsonSchemaBundleTracker.SCHEMA_CLASSPATH_PREFIX + "/" + modelClass.getName() + ".json"; return jarFile.getEntry(path) != null; }
java
private boolean hasJsonSchemaFile(ZipFile jarFile, Class<?> modelClass) throws IOException { String path = JsonSchemaBundleTracker.SCHEMA_CLASSPATH_PREFIX + "/" + modelClass.getName() + ".json"; return jarFile.getEntry(path) != null; }
[ "private", "boolean", "hasJsonSchemaFile", "(", "ZipFile", "jarFile", ",", "Class", "<", "?", ">", "modelClass", ")", "throws", "IOException", "{", "String", "path", "=", "JsonSchemaBundleTracker", ".", "SCHEMA_CLASSPATH_PREFIX", "+", "\"/\"", "+", "modelClass", "...
Gets bundle header/mainfest entry Caravan-HalDocs-DomainPath from given JAR file. @param jarFile JAR file @return Header value or null @throws IOException
[ "Gets", "bundle", "header", "/", "mainfest", "entry", "Caravan", "-", "HalDocs", "-", "DomainPath", "from", "given", "JAR", "file", "." ]
train
https://github.com/wcm-io-caravan/caravan-hal/blob/25d58756b58c70c8c48a17fe781e673dd93d5085/docs-maven-plugin/src/main/java/io/wcm/caravan/maven/plugins/haldocs/GenerateHalDocsJsonMojo.java#L304-L307
chemouna/Decor
decor/src/main/java/com/mounacheikhna/decor/DecorLayoutInflater.java
DecorLayoutInflater.onCreateView
@Override protected View onCreateView(String name, AttributeSet attrs) throws ClassNotFoundException { // This mimics the {@code PhoneLayoutInflater} in the way it tries to inflate the base // classes, if this fails its pretty certain the app will fail at this point. View view = null; for (String prefix : CLASS_PREFIX_LIST) { try { view = createView(name, prefix, attrs); } catch (ClassNotFoundException ignored) { } } // In this case we want to let the base class take a crack // at it. if (view == null) view = super.onCreateView(name, attrs); return mDecorFactory.onViewCreated(view, name, null, view.getContext(), attrs); }
java
@Override protected View onCreateView(String name, AttributeSet attrs) throws ClassNotFoundException { // This mimics the {@code PhoneLayoutInflater} in the way it tries to inflate the base // classes, if this fails its pretty certain the app will fail at this point. View view = null; for (String prefix : CLASS_PREFIX_LIST) { try { view = createView(name, prefix, attrs); } catch (ClassNotFoundException ignored) { } } // In this case we want to let the base class take a crack // at it. if (view == null) view = super.onCreateView(name, attrs); return mDecorFactory.onViewCreated(view, name, null, view.getContext(), attrs); }
[ "@", "Override", "protected", "View", "onCreateView", "(", "String", "name", ",", "AttributeSet", "attrs", ")", "throws", "ClassNotFoundException", "{", "// This mimics the {@code PhoneLayoutInflater} in the way it tries to inflate the base", "// classes, if this fails its pretty cer...
The LayoutInflater onCreateView is the fourth port of call for LayoutInflation. BUT only for none CustomViews. Basically if this method doesn't inflate the View nothing probably will.
[ "The", "LayoutInflater", "onCreateView", "is", "the", "fourth", "port", "of", "call", "for", "LayoutInflation", ".", "BUT", "only", "for", "none", "CustomViews", ".", "Basically", "if", "this", "method", "doesn", "t", "inflate", "the", "View", "nothing", "prob...
train
https://github.com/chemouna/Decor/blob/82b1c1be3c7769e0b63c6eb16f0c01055fb3e4ca/decor/src/main/java/com/mounacheikhna/decor/DecorLayoutInflater.java#L130-L146
acromusashi/acromusashi-stream
src/main/java/acromusashi/stream/spout/AmBaseSpout.java
AmBaseSpout.emitWithNoKeyIdAndGrouping
protected void emitWithNoKeyIdAndGrouping(StreamMessage message, String groupingKey) { this.getCollector().emit(new Values(groupingKey, message)); }
java
protected void emitWithNoKeyIdAndGrouping(StreamMessage message, String groupingKey) { this.getCollector().emit(new Values(groupingKey, message)); }
[ "protected", "void", "emitWithNoKeyIdAndGrouping", "(", "StreamMessage", "message", ",", "String", "groupingKey", ")", "{", "this", ".", "getCollector", "(", ")", ".", "emit", "(", "new", "Values", "(", "groupingKey", ",", "message", ")", ")", ";", "}" ]
Not use this class's key history function, and not use MessageId(Id identify by storm).<br> Send message to downstream component with grouping key.<br> Use following situation. <ol> <li>Not use this class's key history function.</li> <li>Not use storm's fault detect function.</li> </ol> @param message sending message @param groupingKey grouping key
[ "Not", "use", "this", "class", "s", "key", "history", "function", "and", "not", "use", "MessageId", "(", "Id", "identify", "by", "storm", ")", ".", "<br", ">", "Send", "message", "to", "downstream", "component", "with", "grouping", "key", ".", "<br", ">"...
train
https://github.com/acromusashi/acromusashi-stream/blob/65b1f335d771d657c5640a2056ab5c8546eddec9/src/main/java/acromusashi/stream/spout/AmBaseSpout.java#L372-L375
deeplearning4j/deeplearning4j
deeplearning4j/deeplearning4j-scaleout/spark/dl4j-spark/src/main/java/org/deeplearning4j/spark/impl/graph/SparkComputationGraph.java
SparkComputationGraph.scoreExamplesMultiDataSet
public JavaDoubleRDD scoreExamplesMultiDataSet(JavaRDD<MultiDataSet> data, boolean includeRegularizationTerms) { return scoreExamplesMultiDataSet(data, includeRegularizationTerms, DEFAULT_EVAL_SCORE_BATCH_SIZE); }
java
public JavaDoubleRDD scoreExamplesMultiDataSet(JavaRDD<MultiDataSet> data, boolean includeRegularizationTerms) { return scoreExamplesMultiDataSet(data, includeRegularizationTerms, DEFAULT_EVAL_SCORE_BATCH_SIZE); }
[ "public", "JavaDoubleRDD", "scoreExamplesMultiDataSet", "(", "JavaRDD", "<", "MultiDataSet", ">", "data", ",", "boolean", "includeRegularizationTerms", ")", "{", "return", "scoreExamplesMultiDataSet", "(", "data", ",", "includeRegularizationTerms", ",", "DEFAULT_EVAL_SCORE_...
Score the examples individually, using the default batch size {@link #DEFAULT_EVAL_SCORE_BATCH_SIZE}. Unlike {@link #calculateScore(JavaRDD, boolean)}, this method returns a score for each example separately. If scoring is needed for specific examples use either {@link #scoreExamples(JavaPairRDD, boolean)} or {@link #scoreExamples(JavaPairRDD, boolean, int)} which can have a key for each example. @param data Data to score @param includeRegularizationTerms If true: include the l1/l2 regularization terms with the score (if any) @return A JavaDoubleRDD containing the scores of each example @see ComputationGraph#scoreExamples(MultiDataSet, boolean)
[ "Score", "the", "examples", "individually", "using", "the", "default", "batch", "size", "{", "@link", "#DEFAULT_EVAL_SCORE_BATCH_SIZE", "}", ".", "Unlike", "{", "@link", "#calculateScore", "(", "JavaRDD", "boolean", ")", "}", "this", "method", "returns", "a", "s...
train
https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-scaleout/spark/dl4j-spark/src/main/java/org/deeplearning4j/spark/impl/graph/SparkComputationGraph.java#L466-L468
UrielCh/ovh-java-sdk
ovh-java-sdk-price/src/main/java/net/minidev/ovh/api/ApiOvhPrice.java
ApiOvhPrice.dedicated_server_firewall_firewallModel_GET
public OvhPrice dedicated_server_firewall_firewallModel_GET(net.minidev.ovh.api.price.dedicated.server.OvhFirewallEnum firewallModel) throws IOException { String qPath = "/price/dedicated/server/firewall/{firewallModel}"; StringBuilder sb = path(qPath, firewallModel); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, OvhPrice.class); }
java
public OvhPrice dedicated_server_firewall_firewallModel_GET(net.minidev.ovh.api.price.dedicated.server.OvhFirewallEnum firewallModel) throws IOException { String qPath = "/price/dedicated/server/firewall/{firewallModel}"; StringBuilder sb = path(qPath, firewallModel); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, OvhPrice.class); }
[ "public", "OvhPrice", "dedicated_server_firewall_firewallModel_GET", "(", "net", ".", "minidev", ".", "ovh", ".", "api", ".", "price", ".", "dedicated", ".", "server", ".", "OvhFirewallEnum", "firewallModel", ")", "throws", "IOException", "{", "String", "qPath", "...
Get price of available firewall models REST: GET /price/dedicated/server/firewall/{firewallModel} @param firewallModel [required] Model of firewall
[ "Get", "price", "of", "available", "firewall", "models" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-price/src/main/java/net/minidev/ovh/api/ApiOvhPrice.java#L115-L120
nyla-solutions/nyla
nyla.solutions.core/src/main/java/nyla/solutions/core/ds/ActiveDirectory.java
ActiveDirectory.setupBasicProperties
private Hashtable<?,?> setupBasicProperties(Hashtable<String,Object> env) throws NamingException { return setupBasicProperties(env,this.fullUrl); }
java
private Hashtable<?,?> setupBasicProperties(Hashtable<String,Object> env) throws NamingException { return setupBasicProperties(env,this.fullUrl); }
[ "private", "Hashtable", "<", "?", ",", "?", ">", "setupBasicProperties", "(", "Hashtable", "<", "String", ",", "Object", ">", "env", ")", "throws", "NamingException", "{", "return", "setupBasicProperties", "(", "env", ",", "this", ".", "fullUrl", ")", ";", ...
Sets basic LDAP connection properties in env. @param env The LDAP security environment @param url The LDAP URL @param tracing LDAP tracing level. Output to System.err @param referralType Referral type: follow, ignore, or throw @param aliasType Alias type: finding, searching, etc. @throws NamingException Thrown if the passed in values are invalid
[ "Sets", "basic", "LDAP", "connection", "properties", "in", "env", "." ]
train
https://github.com/nyla-solutions/nyla/blob/38d5b843c76eae9762bbca20453ed0f0ad8412a9/nyla.solutions.core/src/main/java/nyla/solutions/core/ds/ActiveDirectory.java#L200-L204
PeterisP/LVTagger
src/main/java/edu/stanford/nlp/classify/PRCurve.java
PRCurve.fmeasure
public double fmeasure(int numleft, int numright) { int tp = 0, fp = 0, fn = 0; tp = numpositive[numright]; fp = numright - tp; fn = numleft - numnegative[numleft]; return f1(tp, fp, fn); }
java
public double fmeasure(int numleft, int numright) { int tp = 0, fp = 0, fn = 0; tp = numpositive[numright]; fp = numright - tp; fn = numleft - numnegative[numleft]; return f1(tp, fp, fn); }
[ "public", "double", "fmeasure", "(", "int", "numleft", ",", "int", "numright", ")", "{", "int", "tp", "=", "0", ",", "fp", "=", "0", ",", "fn", "=", "0", ";", "tp", "=", "numpositive", "[", "numright", "]", ";", "fp", "=", "numright", "-", "tp", ...
the f-measure if we just guess as negativ the first numleft and guess as poitive the last numright
[ "the", "f", "-", "measure", "if", "we", "just", "guess", "as", "negativ", "the", "first", "numleft", "and", "guess", "as", "poitive", "the", "last", "numright" ]
train
https://github.com/PeterisP/LVTagger/blob/b3d44bab9ec07ace0d13612c448a6b7298c1f681/src/main/java/edu/stanford/nlp/classify/PRCurve.java#L181-L187
JoeKerouac/utils
src/main/java/com/joe/utils/secure/impl/AsymmetricCipher.java
AsymmetricCipher.buildInstance
public static CipherUtil buildInstance(byte[] privateKey, byte[] publicKey) { PrivateKey priKey = KeyTools.getPrivateKeyFromPKCS8(Algorithms.RSA.name(), new ByteArrayInputStream(privateKey)); PublicKey pubKey = KeyTools.getPublicKeyFromX509(Algorithms.RSA.name(), new ByteArrayInputStream(publicKey)); return buildInstance(priKey, pubKey); }
java
public static CipherUtil buildInstance(byte[] privateKey, byte[] publicKey) { PrivateKey priKey = KeyTools.getPrivateKeyFromPKCS8(Algorithms.RSA.name(), new ByteArrayInputStream(privateKey)); PublicKey pubKey = KeyTools.getPublicKeyFromX509(Algorithms.RSA.name(), new ByteArrayInputStream(publicKey)); return buildInstance(priKey, pubKey); }
[ "public", "static", "CipherUtil", "buildInstance", "(", "byte", "[", "]", "privateKey", ",", "byte", "[", "]", "publicKey", ")", "{", "PrivateKey", "priKey", "=", "KeyTools", ".", "getPrivateKeyFromPKCS8", "(", "Algorithms", ".", "RSA", ".", "name", "(", ")"...
非对称加密构造器 @param privateKey PKCS8格式的私钥(BASE64 encode过的) @param publicKey X509格式的公钥(BASE64 encode过的) @return AsymmetricCipher
[ "非对称加密构造器" ]
train
https://github.com/JoeKerouac/utils/blob/45e1b2dc4d736956674fc4dcbe6cf84eaee69278/src/main/java/com/joe/utils/secure/impl/AsymmetricCipher.java#L54-L60
cloudant/java-cloudant
cloudant-client/src/main/java/com/cloudant/client/api/CloudantClient.java
CloudantClient.getActiveTasks
public List<Task> getActiveTasks() { InputStream response = null; URI uri = new URIBase(getBaseUri()).path("_active_tasks").build(); try { response = couchDbClient.get(uri); return getResponseList(response, couchDbClient.getGson(), DeserializationTypes.TASKS); } finally { close(response); } }
java
public List<Task> getActiveTasks() { InputStream response = null; URI uri = new URIBase(getBaseUri()).path("_active_tasks").build(); try { response = couchDbClient.get(uri); return getResponseList(response, couchDbClient.getGson(), DeserializationTypes.TASKS); } finally { close(response); } }
[ "public", "List", "<", "Task", ">", "getActiveTasks", "(", ")", "{", "InputStream", "response", "=", "null", ";", "URI", "uri", "=", "new", "URIBase", "(", "getBaseUri", "(", ")", ")", ".", "path", "(", "\"_active_tasks\"", ")", ".", "build", "(", ")",...
Get the list of active tasks from the server. @return List of tasks @see <a href="https://console.bluemix.net/docs/services/Cloudant/api/active_tasks.html"> Active tasks</a>
[ "Get", "the", "list", "of", "active", "tasks", "from", "the", "server", "." ]
train
https://github.com/cloudant/java-cloudant/blob/42c438654945361bded2cc0827afc046d535b31b/cloudant-client/src/main/java/com/cloudant/client/api/CloudantClient.java#L180-L189
Azure/azure-sdk-for-java
eventgrid/resource-manager/v2018_09_15_preview/src/main/java/com/microsoft/azure/management/eventgrid/v2018_09_15_preview/implementation/DomainsInner.java
DomainsInner.getByResourceGroupAsync
public Observable<DomainInner> getByResourceGroupAsync(String resourceGroupName, String domainName) { return getByResourceGroupWithServiceResponseAsync(resourceGroupName, domainName).map(new Func1<ServiceResponse<DomainInner>, DomainInner>() { @Override public DomainInner call(ServiceResponse<DomainInner> response) { return response.body(); } }); }
java
public Observable<DomainInner> getByResourceGroupAsync(String resourceGroupName, String domainName) { return getByResourceGroupWithServiceResponseAsync(resourceGroupName, domainName).map(new Func1<ServiceResponse<DomainInner>, DomainInner>() { @Override public DomainInner call(ServiceResponse<DomainInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "DomainInner", ">", "getByResourceGroupAsync", "(", "String", "resourceGroupName", ",", "String", "domainName", ")", "{", "return", "getByResourceGroupWithServiceResponseAsync", "(", "resourceGroupName", ",", "domainName", ")", ".", "map", "...
Get a domain. Get properties of a domain. @param resourceGroupName The name of the resource group within the user's subscription. @param domainName Name of the domain @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the DomainInner object
[ "Get", "a", "domain", ".", "Get", "properties", "of", "a", "domain", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/eventgrid/resource-manager/v2018_09_15_preview/src/main/java/com/microsoft/azure/management/eventgrid/v2018_09_15_preview/implementation/DomainsInner.java#L153-L160
UrielCh/ovh-java-sdk
ovh-java-sdk-emailexchange/src/main/java/net/minidev/ovh/api/ApiOvhEmailexchange.java
ApiOvhEmailexchange.organizationName_service_exchangeService_serviceInfos_PUT
public void organizationName_service_exchangeService_serviceInfos_PUT(String organizationName, String exchangeService, OvhService body) throws IOException { String qPath = "/email/exchange/{organizationName}/service/{exchangeService}/serviceInfos"; StringBuilder sb = path(qPath, organizationName, exchangeService); exec(qPath, "PUT", sb.toString(), body); }
java
public void organizationName_service_exchangeService_serviceInfos_PUT(String organizationName, String exchangeService, OvhService body) throws IOException { String qPath = "/email/exchange/{organizationName}/service/{exchangeService}/serviceInfos"; StringBuilder sb = path(qPath, organizationName, exchangeService); exec(qPath, "PUT", sb.toString(), body); }
[ "public", "void", "organizationName_service_exchangeService_serviceInfos_PUT", "(", "String", "organizationName", ",", "String", "exchangeService", ",", "OvhService", "body", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/email/exchange/{organizationName}/servic...
Alter this object properties REST: PUT /email/exchange/{organizationName}/service/{exchangeService}/serviceInfos @param body [required] New object properties @param organizationName [required] The internal name of your exchange organization @param exchangeService [required] The internal name of your exchange service
[ "Alter", "this", "object", "properties" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-emailexchange/src/main/java/net/minidev/ovh/api/ApiOvhEmailexchange.java#L351-L355
Azure/azure-sdk-for-java
containerregistry/resource-manager/v2017_10_01/src/main/java/com/microsoft/azure/management/containerregistry/v2017_10_01/implementation/RegistriesInner.java
RegistriesInner.beginUpdatePoliciesAsync
public Observable<RegistryPoliciesInner> beginUpdatePoliciesAsync(String resourceGroupName, String registryName, RegistryPoliciesInner registryPoliciesUpdateParameters) { return beginUpdatePoliciesWithServiceResponseAsync(resourceGroupName, registryName, registryPoliciesUpdateParameters).map(new Func1<ServiceResponse<RegistryPoliciesInner>, RegistryPoliciesInner>() { @Override public RegistryPoliciesInner call(ServiceResponse<RegistryPoliciesInner> response) { return response.body(); } }); }
java
public Observable<RegistryPoliciesInner> beginUpdatePoliciesAsync(String resourceGroupName, String registryName, RegistryPoliciesInner registryPoliciesUpdateParameters) { return beginUpdatePoliciesWithServiceResponseAsync(resourceGroupName, registryName, registryPoliciesUpdateParameters).map(new Func1<ServiceResponse<RegistryPoliciesInner>, RegistryPoliciesInner>() { @Override public RegistryPoliciesInner call(ServiceResponse<RegistryPoliciesInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "RegistryPoliciesInner", ">", "beginUpdatePoliciesAsync", "(", "String", "resourceGroupName", ",", "String", "registryName", ",", "RegistryPoliciesInner", "registryPoliciesUpdateParameters", ")", "{", "return", "beginUpdatePoliciesWithServiceResponseA...
Updates the policies for the specified container registry. @param resourceGroupName The name of the resource group to which the container registry belongs. @param registryName The name of the container registry. @param registryPoliciesUpdateParameters The parameters for updating policies of a container registry. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the RegistryPoliciesInner object
[ "Updates", "the", "policies", "for", "the", "specified", "container", "registry", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/containerregistry/resource-manager/v2017_10_01/src/main/java/com/microsoft/azure/management/containerregistry/v2017_10_01/implementation/RegistriesInner.java#L1682-L1689
rnorth/visible-assertions
src/main/java/org/rnorth/visibleassertions/VisibleAssertions.java
VisibleAssertions.assertSame
public static void assertSame(String message, Object expected, Object actual) { String expectedInQuotes = inQuotesIfNotNull(expected); String actualInQuotes = inQuotesIfNotNull(actual); if (expected == actual) { pass(message); } else { fail(message, actualInQuotes + " is not the same (!=) as expected " + expectedInQuotes); } }
java
public static void assertSame(String message, Object expected, Object actual) { String expectedInQuotes = inQuotesIfNotNull(expected); String actualInQuotes = inQuotesIfNotNull(actual); if (expected == actual) { pass(message); } else { fail(message, actualInQuotes + " is not the same (!=) as expected " + expectedInQuotes); } }
[ "public", "static", "void", "assertSame", "(", "String", "message", ",", "Object", "expected", ",", "Object", "actual", ")", "{", "String", "expectedInQuotes", "=", "inQuotesIfNotNull", "(", "expected", ")", ";", "String", "actualInQuotes", "=", "inQuotesIfNotNull...
Assert that an actual value is the same object as an expected value. <p> Sameness is tested with the == operator. <p> If the assertion passes, a green tick will be shown. If the assertion fails, a red cross will be shown. @param message message to display alongside the assertion outcome @param expected the expected value @param actual the actual value
[ "Assert", "that", "an", "actual", "value", "is", "the", "same", "object", "as", "an", "expected", "value", ".", "<p", ">", "Sameness", "is", "tested", "with", "the", "==", "operator", ".", "<p", ">", "If", "the", "assertion", "passes", "a", "green", "t...
train
https://github.com/rnorth/visible-assertions/blob/6d7a7724db40ac0e9f87279553f814b790310b3b/src/main/java/org/rnorth/visibleassertions/VisibleAssertions.java#L314-L324
chhh/MSFTBX
MSFileToolbox/src/main/java/umich/ms/util/SpectrumUtils.java
SpectrumUtils.isWithinPpm
public static boolean isWithinPpm(double mz1, double mz2, double ppm) { return Math.abs(amu2ppm(mz1, mz1 - mz2)) <= ppm; }
java
public static boolean isWithinPpm(double mz1, double mz2, double ppm) { return Math.abs(amu2ppm(mz1, mz1 - mz2)) <= ppm; }
[ "public", "static", "boolean", "isWithinPpm", "(", "double", "mz1", ",", "double", "mz2", ",", "double", "ppm", ")", "{", "return", "Math", ".", "abs", "(", "amu2ppm", "(", "mz1", ",", "mz1", "-", "mz2", ")", ")", "<=", "ppm", ";", "}" ]
Check if the 2nd m/z value is within some PPM distance from the 1st one. PPM will be calculated based on the 1st m/z value. @param mz1 PPM tolerance will be calculated relative to this value @param mz2 the value to check for being within some PPM range
[ "Check", "if", "the", "2nd", "m", "/", "z", "value", "is", "within", "some", "PPM", "distance", "from", "the", "1st", "one", ".", "PPM", "will", "be", "calculated", "based", "on", "the", "1st", "m", "/", "z", "value", "." ]
train
https://github.com/chhh/MSFTBX/blob/e53ae6be982e2de3123292be7d5297715bec70bb/MSFileToolbox/src/main/java/umich/ms/util/SpectrumUtils.java#L57-L59
UrielCh/ovh-java-sdk
ovh-java-sdk-order/src/main/java/net/minidev/ovh/api/ApiOvhOrder.java
ApiOvhOrder.license_sqlserver_serviceName_upgrade_duration_GET
public OvhOrder license_sqlserver_serviceName_upgrade_duration_GET(String serviceName, String duration, OvhSqlServerVersionEnum version) throws IOException { String qPath = "/order/license/sqlserver/{serviceName}/upgrade/{duration}"; StringBuilder sb = path(qPath, serviceName, duration); query(sb, "version", version); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, OvhOrder.class); }
java
public OvhOrder license_sqlserver_serviceName_upgrade_duration_GET(String serviceName, String duration, OvhSqlServerVersionEnum version) throws IOException { String qPath = "/order/license/sqlserver/{serviceName}/upgrade/{duration}"; StringBuilder sb = path(qPath, serviceName, duration); query(sb, "version", version); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, OvhOrder.class); }
[ "public", "OvhOrder", "license_sqlserver_serviceName_upgrade_duration_GET", "(", "String", "serviceName", ",", "String", "duration", ",", "OvhSqlServerVersionEnum", "version", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/order/license/sqlserver/{serviceName}/u...
Get prices and contracts information REST: GET /order/license/sqlserver/{serviceName}/upgrade/{duration} @param version [required] This license version @param serviceName [required] The name of your SQL Server license @param duration [required] Duration
[ "Get", "prices", "and", "contracts", "information" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-order/src/main/java/net/minidev/ovh/api/ApiOvhOrder.java#L1411-L1417