repository_name
stringlengths
7
58
func_path_in_repository
stringlengths
11
218
func_name
stringlengths
4
140
whole_func_string
stringlengths
153
5.32k
language
stringclasses
1 value
func_code_string
stringlengths
72
4k
func_code_tokens
listlengths
20
832
func_documentation_string
stringlengths
61
2k
func_documentation_tokens
listlengths
1
647
split_name
stringclasses
1 value
func_code_url
stringlengths
102
339
XDean/Java-EX
src/main/java/xdean/jex/util/reflect/GenericUtil.java
GenericUtil.getGenericTypes
public static Type[] getGenericTypes(Type sourceType, Class<?> targetClass) { """ Get the actual generic types.<br> For example: <pre> <code> class IntList extends ArrayList&#60;Integer&#62;{} getGenericType(IntList.class, List.class);// {Integer.class} getGenericType(IntList.class, Collection.class);// {Integer.class} getGenericType(Integer.class, Comparable.class);// {Integer.class} </code> </pre> And nested situation <pre> <code> class A&#60;E,T&#62;{} class B&#60;E&#62; extends A&#60;E,Integer&#62;{} class C extends B&#60;B&#60;Boolean&#62;&#62;{} class D&#60;T&#62; extends B&#60;B&#60;? extends T&#62;&#62;{} class E extends D&#60;Number&#62;{} getGenericType(B.class, A.class);// {E(TypeVariable), Integer.class} getGenericType(C.class, A.class);// {B&#60;Boolean&#62;(ParameterizedType), Integer.class} getGenericType(E.class, A.class);// {B&#60;? extends Number&#62;(ParameterizedType), Integer.class} </code> </pre> @param sourceType The type to find generic type. May Class or ParameterizedType @param targetClass Find the actual generic type on this type. @return A type array. Its length equals targetClass's generic parameters' length. Its elements can be {@code Class, TypeVariable, ParameterizedType}. """ TypeVariable<?>[] targetTypeParameters = targetClass.getTypeParameters(); if (targetTypeParameters.length == 0) { return EMPTY_TYPE_ARRAY; } Map<TypeVariable<?>, Type> map = getGenericReferenceMap(sourceType); // If the sourceType is Class, there may left TypeVariable. List<TypeVariable<?>> leftTypeParameters = sourceType instanceof Class ? Arrays.asList(((Class<?>) sourceType).getTypeParameters()) : Collections.emptyList(); return Arrays.stream(targetTypeParameters) .map(tv -> { Type actualType = getActualType(map, tv); // If actualType equals tv, that means it doesn't implement the targetClass return Objects.equals(actualType, tv) && !leftTypeParameters.contains(actualType) ? null : actualType; }) .toArray(Type[]::new); }
java
public static Type[] getGenericTypes(Type sourceType, Class<?> targetClass) { TypeVariable<?>[] targetTypeParameters = targetClass.getTypeParameters(); if (targetTypeParameters.length == 0) { return EMPTY_TYPE_ARRAY; } Map<TypeVariable<?>, Type> map = getGenericReferenceMap(sourceType); // If the sourceType is Class, there may left TypeVariable. List<TypeVariable<?>> leftTypeParameters = sourceType instanceof Class ? Arrays.asList(((Class<?>) sourceType).getTypeParameters()) : Collections.emptyList(); return Arrays.stream(targetTypeParameters) .map(tv -> { Type actualType = getActualType(map, tv); // If actualType equals tv, that means it doesn't implement the targetClass return Objects.equals(actualType, tv) && !leftTypeParameters.contains(actualType) ? null : actualType; }) .toArray(Type[]::new); }
[ "public", "static", "Type", "[", "]", "getGenericTypes", "(", "Type", "sourceType", ",", "Class", "<", "?", ">", "targetClass", ")", "{", "TypeVariable", "<", "?", ">", "[", "]", "targetTypeParameters", "=", "targetClass", ".", "getTypeParameters", "(", ")",...
Get the actual generic types.<br> For example: <pre> <code> class IntList extends ArrayList&#60;Integer&#62;{} getGenericType(IntList.class, List.class);// {Integer.class} getGenericType(IntList.class, Collection.class);// {Integer.class} getGenericType(Integer.class, Comparable.class);// {Integer.class} </code> </pre> And nested situation <pre> <code> class A&#60;E,T&#62;{} class B&#60;E&#62; extends A&#60;E,Integer&#62;{} class C extends B&#60;B&#60;Boolean&#62;&#62;{} class D&#60;T&#62; extends B&#60;B&#60;? extends T&#62;&#62;{} class E extends D&#60;Number&#62;{} getGenericType(B.class, A.class);// {E(TypeVariable), Integer.class} getGenericType(C.class, A.class);// {B&#60;Boolean&#62;(ParameterizedType), Integer.class} getGenericType(E.class, A.class);// {B&#60;? extends Number&#62;(ParameterizedType), Integer.class} </code> </pre> @param sourceType The type to find generic type. May Class or ParameterizedType @param targetClass Find the actual generic type on this type. @return A type array. Its length equals targetClass's generic parameters' length. Its elements can be {@code Class, TypeVariable, ParameterizedType}.
[ "Get", "the", "actual", "generic", "types", ".", "<br", ">", "For", "example", ":" ]
train
https://github.com/XDean/Java-EX/blob/9208ba71c5b2af9f9bd979d01fab2ff5e433b3e7/src/main/java/xdean/jex/util/reflect/GenericUtil.java#L106-L123
groovy/groovy-core
src/main/org/codehaus/groovy/transform/trait/TraitComposer.java
TraitComposer.doExtendTraits
public static void doExtendTraits(final ClassNode cNode, final SourceUnit unit, final CompilationUnit cu) { """ Given a class node, if this class node implements a trait, then generate all the appropriate code which delegates calls to the trait. It is safe to call this method on a class node which does not implement a trait. @param cNode a class node @param unit the source unit """ if (cNode.isInterface()) return; boolean isItselfTrait = Traits.isTrait(cNode); SuperCallTraitTransformer superCallTransformer = new SuperCallTraitTransformer(unit); if (isItselfTrait) { checkTraitAllowed(cNode, unit); return; } if (!cNode.getNameWithoutPackage().endsWith(Traits.TRAIT_HELPER)) { List<ClassNode> traits = findTraits(cNode); for (ClassNode trait : traits) { TraitHelpersTuple helpers = Traits.findHelpers(trait); applyTrait(trait, cNode, helpers); superCallTransformer.visitClass(cNode); if (unit!=null) { ASTTransformationCollectorCodeVisitor collector = new ASTTransformationCollectorCodeVisitor(unit, cu.getTransformLoader()); collector.visitClass(cNode); } } } }
java
public static void doExtendTraits(final ClassNode cNode, final SourceUnit unit, final CompilationUnit cu) { if (cNode.isInterface()) return; boolean isItselfTrait = Traits.isTrait(cNode); SuperCallTraitTransformer superCallTransformer = new SuperCallTraitTransformer(unit); if (isItselfTrait) { checkTraitAllowed(cNode, unit); return; } if (!cNode.getNameWithoutPackage().endsWith(Traits.TRAIT_HELPER)) { List<ClassNode> traits = findTraits(cNode); for (ClassNode trait : traits) { TraitHelpersTuple helpers = Traits.findHelpers(trait); applyTrait(trait, cNode, helpers); superCallTransformer.visitClass(cNode); if (unit!=null) { ASTTransformationCollectorCodeVisitor collector = new ASTTransformationCollectorCodeVisitor(unit, cu.getTransformLoader()); collector.visitClass(cNode); } } } }
[ "public", "static", "void", "doExtendTraits", "(", "final", "ClassNode", "cNode", ",", "final", "SourceUnit", "unit", ",", "final", "CompilationUnit", "cu", ")", "{", "if", "(", "cNode", ".", "isInterface", "(", ")", ")", "return", ";", "boolean", "isItselfT...
Given a class node, if this class node implements a trait, then generate all the appropriate code which delegates calls to the trait. It is safe to call this method on a class node which does not implement a trait. @param cNode a class node @param unit the source unit
[ "Given", "a", "class", "node", "if", "this", "class", "node", "implements", "a", "trait", "then", "generate", "all", "the", "appropriate", "code", "which", "delegates", "calls", "to", "the", "trait", ".", "It", "is", "safe", "to", "call", "this", "method",...
train
https://github.com/groovy/groovy-core/blob/01309f9d4be34ddf93c4a9943b5a97843bff6181/src/main/org/codehaus/groovy/transform/trait/TraitComposer.java#L102-L122
apache/incubator-gobblin
gobblin-core/src/main/java/org/apache/gobblin/publisher/TimestampDataPublisher.java
TimestampDataPublisher.movePath
@Override protected void movePath(ParallelRunner parallelRunner, State state, Path src, Path dst, int branchId) throws IOException { """ Update destination path to put db and table name in format "dbname.tablename" using {@link #getDbTableName(String)} and include timestamp Input dst format: {finaldir}/{schemaName} Output dst format: {finaldir}/{dbname.tablename}/{currenttimestamp} """ String outputDir = dst.getParent().toString(); String schemaName = dst.getName(); Path newDst = new Path(new Path(outputDir, getDbTableName(schemaName)), timestamp); if (!this.publisherFileSystemByBranches.get(branchId).exists(newDst)) { WriterUtils.mkdirsWithRecursivePermissionWithRetry(this.publisherFileSystemByBranches.get(branchId), newDst.getParent(), this.permissions.get(branchId), this.retrierConfig); } super.movePath(parallelRunner, state, src, newDst, branchId); }
java
@Override protected void movePath(ParallelRunner parallelRunner, State state, Path src, Path dst, int branchId) throws IOException { String outputDir = dst.getParent().toString(); String schemaName = dst.getName(); Path newDst = new Path(new Path(outputDir, getDbTableName(schemaName)), timestamp); if (!this.publisherFileSystemByBranches.get(branchId).exists(newDst)) { WriterUtils.mkdirsWithRecursivePermissionWithRetry(this.publisherFileSystemByBranches.get(branchId), newDst.getParent(), this.permissions.get(branchId), this.retrierConfig); } super.movePath(parallelRunner, state, src, newDst, branchId); }
[ "@", "Override", "protected", "void", "movePath", "(", "ParallelRunner", "parallelRunner", ",", "State", "state", ",", "Path", "src", ",", "Path", "dst", ",", "int", "branchId", ")", "throws", "IOException", "{", "String", "outputDir", "=", "dst", ".", "getP...
Update destination path to put db and table name in format "dbname.tablename" using {@link #getDbTableName(String)} and include timestamp Input dst format: {finaldir}/{schemaName} Output dst format: {finaldir}/{dbname.tablename}/{currenttimestamp}
[ "Update", "destination", "path", "to", "put", "db", "and", "table", "name", "in", "format", "dbname", ".", "tablename", "using", "{", "@link", "#getDbTableName", "(", "String", ")", "}", "and", "include", "timestamp" ]
train
https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-core/src/main/java/org/apache/gobblin/publisher/TimestampDataPublisher.java#L68-L82
joniles/mpxj
src/main/java/net/sf/mpxj/phoenix/PhoenixReader.java
PhoenixReader.readProjectProperties
private void readProjectProperties(Settings phoenixSettings, Storepoint storepoint) { """ This method extracts project properties from a Phoenix file. @param phoenixSettings Phoenix settings @param storepoint Current storepoint """ ProjectProperties mpxjProperties = m_projectFile.getProjectProperties(); mpxjProperties.setName(phoenixSettings.getTitle()); mpxjProperties.setDefaultDurationUnits(phoenixSettings.getBaseunit()); mpxjProperties.setStatusDate(storepoint.getDataDate()); }
java
private void readProjectProperties(Settings phoenixSettings, Storepoint storepoint) { ProjectProperties mpxjProperties = m_projectFile.getProjectProperties(); mpxjProperties.setName(phoenixSettings.getTitle()); mpxjProperties.setDefaultDurationUnits(phoenixSettings.getBaseunit()); mpxjProperties.setStatusDate(storepoint.getDataDate()); }
[ "private", "void", "readProjectProperties", "(", "Settings", "phoenixSettings", ",", "Storepoint", "storepoint", ")", "{", "ProjectProperties", "mpxjProperties", "=", "m_projectFile", ".", "getProjectProperties", "(", ")", ";", "mpxjProperties", ".", "setName", "(", "...
This method extracts project properties from a Phoenix file. @param phoenixSettings Phoenix settings @param storepoint Current storepoint
[ "This", "method", "extracts", "project", "properties", "from", "a", "Phoenix", "file", "." ]
train
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/phoenix/PhoenixReader.java#L193-L199
lessthanoptimal/BoofCV
main/boofcv-sfm/src/main/java/boofcv/alg/sfm/structure2/GeneratePairwiseImageGraph.java
GeneratePairwiseImageGraph.createEdge
protected void createEdge( String src , String dst , FastQueue<AssociatedPair> pairs , FastQueue<AssociatedIndex> matches ) { """ Connects two views together if they meet a minimal set of geometric requirements. Determines if there is strong evidence that there is 3D information present and not just a homography @param src ID of src image @param dst ID of dst image @param pairs Associated features pixels @param matches Associated features feature indexes """ // Fitting Essential/Fundamental works when the scene is not planar and not pure rotation int countF = 0; if( ransac3D.process(pairs.toList()) ) { countF = ransac3D.getMatchSet().size(); } // Fitting homography will work when all or part of the scene is planar or motion is pure rotation int countH = 0; if( ransacH.process(pairs.toList()) ) { countH = ransacH.getMatchSet().size(); } // fail if not enough features are remaining after RANSAC if( Math.max(countF,countH) < minimumInliers ) return; // The idea here is that if the number features for F is greater than H then it's a 3D scene. // If they are similar then it might be a plane boolean is3D = countF > countH*ratio3D; PairwiseImageGraph2.Motion edge = graph.edges.grow(); edge.is3D = is3D; edge.countF = countF; edge.countH = countH; edge.index = graph.edges.size-1; edge.src = graph.lookupNode(src); edge.dst = graph.lookupNode(dst); edge.src.connections.add(edge); edge.dst.connections.add(edge); if( is3D ) { saveInlierMatches(ransac3D, matches,edge); edge.F.set(ransac3D.getModelParameters()); } else { saveInlierMatches(ransacH, matches,edge); Homography2D_F64 H = ransacH.getModelParameters(); ConvertDMatrixStruct.convert(H,edge.F); } }
java
protected void createEdge( String src , String dst , FastQueue<AssociatedPair> pairs , FastQueue<AssociatedIndex> matches ) { // Fitting Essential/Fundamental works when the scene is not planar and not pure rotation int countF = 0; if( ransac3D.process(pairs.toList()) ) { countF = ransac3D.getMatchSet().size(); } // Fitting homography will work when all or part of the scene is planar or motion is pure rotation int countH = 0; if( ransacH.process(pairs.toList()) ) { countH = ransacH.getMatchSet().size(); } // fail if not enough features are remaining after RANSAC if( Math.max(countF,countH) < minimumInliers ) return; // The idea here is that if the number features for F is greater than H then it's a 3D scene. // If they are similar then it might be a plane boolean is3D = countF > countH*ratio3D; PairwiseImageGraph2.Motion edge = graph.edges.grow(); edge.is3D = is3D; edge.countF = countF; edge.countH = countH; edge.index = graph.edges.size-1; edge.src = graph.lookupNode(src); edge.dst = graph.lookupNode(dst); edge.src.connections.add(edge); edge.dst.connections.add(edge); if( is3D ) { saveInlierMatches(ransac3D, matches,edge); edge.F.set(ransac3D.getModelParameters()); } else { saveInlierMatches(ransacH, matches,edge); Homography2D_F64 H = ransacH.getModelParameters(); ConvertDMatrixStruct.convert(H,edge.F); } }
[ "protected", "void", "createEdge", "(", "String", "src", ",", "String", "dst", ",", "FastQueue", "<", "AssociatedPair", ">", "pairs", ",", "FastQueue", "<", "AssociatedIndex", ">", "matches", ")", "{", "// Fitting Essential/Fundamental works when the scene is not planar...
Connects two views together if they meet a minimal set of geometric requirements. Determines if there is strong evidence that there is 3D information present and not just a homography @param src ID of src image @param dst ID of dst image @param pairs Associated features pixels @param matches Associated features feature indexes
[ "Connects", "two", "views", "together", "if", "they", "meet", "a", "minimal", "set", "of", "geometric", "requirements", ".", "Determines", "if", "there", "is", "strong", "evidence", "that", "there", "is", "3D", "information", "present", "and", "not", "just", ...
train
https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-sfm/src/main/java/boofcv/alg/sfm/structure2/GeneratePairwiseImageGraph.java#L155-L195
ksclarke/vertx-pairtree
src/main/java/info/freelibrary/pairtree/s3/S3Client.java
S3Client.createGetRequest
public S3ClientRequest createGetRequest(final String aBucket, final String aKey, final Handler<HttpClientResponse> aHandler) { """ Creates an S3 GET request. <p> <code>create GET -&gt; request Object</code> </p> @param aBucket An S3 bucket @param aKey An S3 key @param aHandler A response handler @return A S3 client GET request """ final HttpClientRequest httpRequest = myHTTPClient.get(PATH_SEP + aBucket + PATH_SEP + aKey, aHandler); return new S3ClientRequest("GET", aBucket, aKey, httpRequest, myAccessKey, mySecretKey, mySessionToken); }
java
public S3ClientRequest createGetRequest(final String aBucket, final String aKey, final Handler<HttpClientResponse> aHandler) { final HttpClientRequest httpRequest = myHTTPClient.get(PATH_SEP + aBucket + PATH_SEP + aKey, aHandler); return new S3ClientRequest("GET", aBucket, aKey, httpRequest, myAccessKey, mySecretKey, mySessionToken); }
[ "public", "S3ClientRequest", "createGetRequest", "(", "final", "String", "aBucket", ",", "final", "String", "aKey", ",", "final", "Handler", "<", "HttpClientResponse", ">", "aHandler", ")", "{", "final", "HttpClientRequest", "httpRequest", "=", "myHTTPClient", ".", ...
Creates an S3 GET request. <p> <code>create GET -&gt; request Object</code> </p> @param aBucket An S3 bucket @param aKey An S3 key @param aHandler A response handler @return A S3 client GET request
[ "Creates", "an", "S3", "GET", "request", ".", "<p", ">", "<code", ">", "create", "GET", "-", "&gt", ";", "request", "Object<", "/", "code", ">", "<", "/", "p", ">" ]
train
https://github.com/ksclarke/vertx-pairtree/blob/b2ea1e32057e5df262e9265540d346a732b718df/src/main/java/info/freelibrary/pairtree/s3/S3Client.java#L285-L289
alkacon/opencms-core
src-gwt/org/opencms/ade/sitemap/client/alias/CmsAliasTableController.java
CmsAliasTableController.editAliasMode
public void editAliasMode(CmsAliasTableRow row, CmsAliasMode mode) { """ This method is called after the mode of an alias has been edited.<p> @param row the edited row @param mode the new alias mode """ row.setMode(mode); row.setEdited(true); }
java
public void editAliasMode(CmsAliasTableRow row, CmsAliasMode mode) { row.setMode(mode); row.setEdited(true); }
[ "public", "void", "editAliasMode", "(", "CmsAliasTableRow", "row", ",", "CmsAliasMode", "mode", ")", "{", "row", ".", "setMode", "(", "mode", ")", ";", "row", ".", "setEdited", "(", "true", ")", ";", "}" ]
This method is called after the mode of an alias has been edited.<p> @param row the edited row @param mode the new alias mode
[ "This", "method", "is", "called", "after", "the", "mode", "of", "an", "alias", "has", "been", "edited", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/ade/sitemap/client/alias/CmsAliasTableController.java#L154-L158
line/armeria
zookeeper/src/main/java/com/linecorp/armeria/server/zookeeper/ZooKeeperUpdatingListener.java
ZooKeeperUpdatingListener.of
public static ZooKeeperUpdatingListener of(String zkConnectionStr, String zNodePath) { """ Creates a ZooKeeper server listener, which registers server into ZooKeeper. <p>If you need a fully customized {@link ZooKeeperUpdatingListener} instance, use {@link ZooKeeperUpdatingListenerBuilder} instead. @param zkConnectionStr ZooKeeper connection string @param zNodePath ZooKeeper node path(under which this server will be registered) """ return new ZooKeeperUpdatingListenerBuilder(zkConnectionStr, zNodePath).build(); }
java
public static ZooKeeperUpdatingListener of(String zkConnectionStr, String zNodePath) { return new ZooKeeperUpdatingListenerBuilder(zkConnectionStr, zNodePath).build(); }
[ "public", "static", "ZooKeeperUpdatingListener", "of", "(", "String", "zkConnectionStr", ",", "String", "zNodePath", ")", "{", "return", "new", "ZooKeeperUpdatingListenerBuilder", "(", "zkConnectionStr", ",", "zNodePath", ")", ".", "build", "(", ")", ";", "}" ]
Creates a ZooKeeper server listener, which registers server into ZooKeeper. <p>If you need a fully customized {@link ZooKeeperUpdatingListener} instance, use {@link ZooKeeperUpdatingListenerBuilder} instead. @param zkConnectionStr ZooKeeper connection string @param zNodePath ZooKeeper node path(under which this server will be registered)
[ "Creates", "a", "ZooKeeper", "server", "listener", "which", "registers", "server", "into", "ZooKeeper", "." ]
train
https://github.com/line/armeria/blob/67d29e019fd35a35f89c45cc8f9119ff9b12b44d/zookeeper/src/main/java/com/linecorp/armeria/server/zookeeper/ZooKeeperUpdatingListener.java#L48-L50
Terracotta-OSS/statistics
src/main/java/org/terracotta/context/ContextManager.java
ContextManager.nodeFor
public static TreeNode nodeFor(Object object) { """ Return the {@code TreeNode} associated with this object. <p> Returns {@code null} if the supplied object has no associated context node. @param object object to lookup node for @return {@code TreeNode} associated with this object """ TreeNode node = getTreeNode(object); return node == null ? null : new ContextAwareTreeNode(node, object); }
java
public static TreeNode nodeFor(Object object) { TreeNode node = getTreeNode(object); return node == null ? null : new ContextAwareTreeNode(node, object); }
[ "public", "static", "TreeNode", "nodeFor", "(", "Object", "object", ")", "{", "TreeNode", "node", "=", "getTreeNode", "(", "object", ")", ";", "return", "node", "==", "null", "?", "null", ":", "new", "ContextAwareTreeNode", "(", "node", ",", "object", ")",...
Return the {@code TreeNode} associated with this object. <p> Returns {@code null} if the supplied object has no associated context node. @param object object to lookup node for @return {@code TreeNode} associated with this object
[ "Return", "the", "{", "@code", "TreeNode", "}", "associated", "with", "this", "object", ".", "<p", ">", "Returns", "{", "@code", "null", "}", "if", "the", "supplied", "object", "has", "no", "associated", "context", "node", "." ]
train
https://github.com/Terracotta-OSS/statistics/blob/d24e4989b8c8dbe4f5210e49c7945d51b6585881/src/main/java/org/terracotta/context/ContextManager.java#L100-L103
google/closure-compiler
src/com/google/javascript/jscomp/PolymerClassRewriter.java
PolymerClassRewriter.makeReadOnlySetter
private Node makeReadOnlySetter(String propName, String qualifiedPath) { """ Adds the generated setter for a readonly property. @see https://www.polymer-project.org/0.8/docs/devguide/properties.html#read-only """ String setterName = "_set" + propName.substring(0, 1).toUpperCase() + propName.substring(1); Node fnNode = IR.function(IR.name(""), IR.paramList(IR.name(propName)), IR.block()); compiler.reportChangeToChangeScope(fnNode); Node exprResNode = IR.exprResult(IR.assign(NodeUtil.newQName(compiler, qualifiedPath + setterName), fnNode)); JSDocInfoBuilder info = new JSDocInfoBuilder(true); // This is overriding a generated function which was added to the interface in // {@code createExportsAndExterns}. info.recordOverride(); exprResNode.getFirstChild().setJSDocInfo(info.build()); return exprResNode; }
java
private Node makeReadOnlySetter(String propName, String qualifiedPath) { String setterName = "_set" + propName.substring(0, 1).toUpperCase() + propName.substring(1); Node fnNode = IR.function(IR.name(""), IR.paramList(IR.name(propName)), IR.block()); compiler.reportChangeToChangeScope(fnNode); Node exprResNode = IR.exprResult(IR.assign(NodeUtil.newQName(compiler, qualifiedPath + setterName), fnNode)); JSDocInfoBuilder info = new JSDocInfoBuilder(true); // This is overriding a generated function which was added to the interface in // {@code createExportsAndExterns}. info.recordOverride(); exprResNode.getFirstChild().setJSDocInfo(info.build()); return exprResNode; }
[ "private", "Node", "makeReadOnlySetter", "(", "String", "propName", ",", "String", "qualifiedPath", ")", "{", "String", "setterName", "=", "\"_set\"", "+", "propName", ".", "substring", "(", "0", ",", "1", ")", ".", "toUpperCase", "(", ")", "+", "propName", ...
Adds the generated setter for a readonly property. @see https://www.polymer-project.org/0.8/docs/devguide/properties.html#read-only
[ "Adds", "the", "generated", "setter", "for", "a", "readonly", "property", "." ]
train
https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/PolymerClassRewriter.java#L553-L567
jayantk/jklol
src/com/jayantkrish/jklol/lisp/ParametricBfgBuilder.java
ParametricBfgBuilder.addConstantFactor
public void addConstantFactor(String factorName, Factor factor) { """ Adds an unparameterized factor to the model under construction. @param factor """ if (variables.containsAll(factor.getVars())) { int factorNum = factors.size(); factors.add(factor); factorNames.add(factorName); VariableNumMap factorVars = factor.getVars(); for (Integer varNum : factorVars.getVariableNums()) { variableFactorMap.put(varNum, factorNum); factorVariableMap.put(factorNum, varNum); } } else { Preconditions.checkState(!isRoot); crossingFactors.add(factor); } }
java
public void addConstantFactor(String factorName, Factor factor) { if (variables.containsAll(factor.getVars())) { int factorNum = factors.size(); factors.add(factor); factorNames.add(factorName); VariableNumMap factorVars = factor.getVars(); for (Integer varNum : factorVars.getVariableNums()) { variableFactorMap.put(varNum, factorNum); factorVariableMap.put(factorNum, varNum); } } else { Preconditions.checkState(!isRoot); crossingFactors.add(factor); } }
[ "public", "void", "addConstantFactor", "(", "String", "factorName", ",", "Factor", "factor", ")", "{", "if", "(", "variables", ".", "containsAll", "(", "factor", ".", "getVars", "(", ")", ")", ")", "{", "int", "factorNum", "=", "factors", ".", "size", "(...
Adds an unparameterized factor to the model under construction. @param factor
[ "Adds", "an", "unparameterized", "factor", "to", "the", "model", "under", "construction", "." ]
train
https://github.com/jayantk/jklol/blob/d27532ca83e212d51066cf28f52621acc3fd44cc/src/com/jayantkrish/jklol/lisp/ParametricBfgBuilder.java#L77-L92
code4everything/util
src/main/java/com/zhazhapan/util/FileExecutor.java
FileExecutor.copyDirectories
public static void copyDirectories(File[] directories, File[] destinationDirectories) throws IOException { """ 批量复制文件夹 @param directories 文件夹数组 @param destinationDirectories 目标文件夹数组,与文件夹一一对应 @throws IOException 异常 """ int length = Integer.min(directories.length, destinationDirectories.length); for (int i = 0; i < length; i++) { copyDirectory(directories[i], destinationDirectories[i]); } }
java
public static void copyDirectories(File[] directories, File[] destinationDirectories) throws IOException { int length = Integer.min(directories.length, destinationDirectories.length); for (int i = 0; i < length; i++) { copyDirectory(directories[i], destinationDirectories[i]); } }
[ "public", "static", "void", "copyDirectories", "(", "File", "[", "]", "directories", ",", "File", "[", "]", "destinationDirectories", ")", "throws", "IOException", "{", "int", "length", "=", "Integer", ".", "min", "(", "directories", ".", "length", ",", "des...
批量复制文件夹 @param directories 文件夹数组 @param destinationDirectories 目标文件夹数组,与文件夹一一对应 @throws IOException 异常
[ "批量复制文件夹" ]
train
https://github.com/code4everything/util/blob/1fc9f0ead1108f4d7208ba7c000df4244f708418/src/main/java/com/zhazhapan/util/FileExecutor.java#L421-L426
Alexey1Gavrilov/ExpectIt
expectit-core/src/main/java/net/sf/expectit/matcher/Matchers.java
Matchers.sequence
public static Matcher<MultiResult> sequence(final Matcher<?>... matchers) { """ Matches the given matchers one by one. Every successful matches updates the internal buffer. The consequent match operation is performed after the previous match has succeeded. @param matchers the collection of matchers. @return the matcher. """ checkNotEmpty(matchers); return new Matcher<MultiResult>() { @Override public MultiResult matches(String input, boolean isEof) { int matchCount = 0; Result[] results = new Result[matchers.length]; Arrays.fill(results, failure(input, false)); int beginIndex = 0; for (int i = 0; i < matchers.length; i++) { Result result = matchers[i].matches(input.substring(beginIndex), isEof); if (result.isSuccessful()) { beginIndex += result.end(); results[i] = result; if (++matchCount == matchers.length) { String group = result.group(); Result finalResult = new SimpleResult( true, input, input.substring(0, beginIndex - group.length()), group, result.canStopMatching()); return new MultiResultImpl(finalResult, Arrays.asList(results)); } } else { break; } } final List<Result> resultList = Arrays.asList(results); boolean canStopMatching = MultiResultImpl.canStopMatching(resultList); return new MultiResultImpl(failure(input, canStopMatching), resultList); } @Override public String toString() { return String.format("sequence(%s)", MultiMatcher.matchersToString(matchers)); } }; }
java
public static Matcher<MultiResult> sequence(final Matcher<?>... matchers) { checkNotEmpty(matchers); return new Matcher<MultiResult>() { @Override public MultiResult matches(String input, boolean isEof) { int matchCount = 0; Result[] results = new Result[matchers.length]; Arrays.fill(results, failure(input, false)); int beginIndex = 0; for (int i = 0; i < matchers.length; i++) { Result result = matchers[i].matches(input.substring(beginIndex), isEof); if (result.isSuccessful()) { beginIndex += result.end(); results[i] = result; if (++matchCount == matchers.length) { String group = result.group(); Result finalResult = new SimpleResult( true, input, input.substring(0, beginIndex - group.length()), group, result.canStopMatching()); return new MultiResultImpl(finalResult, Arrays.asList(results)); } } else { break; } } final List<Result> resultList = Arrays.asList(results); boolean canStopMatching = MultiResultImpl.canStopMatching(resultList); return new MultiResultImpl(failure(input, canStopMatching), resultList); } @Override public String toString() { return String.format("sequence(%s)", MultiMatcher.matchersToString(matchers)); } }; }
[ "public", "static", "Matcher", "<", "MultiResult", ">", "sequence", "(", "final", "Matcher", "<", "?", ">", "...", "matchers", ")", "{", "checkNotEmpty", "(", "matchers", ")", ";", "return", "new", "Matcher", "<", "MultiResult", ">", "(", ")", "{", "@", ...
Matches the given matchers one by one. Every successful matches updates the internal buffer. The consequent match operation is performed after the previous match has succeeded. @param matchers the collection of matchers. @return the matcher.
[ "Matches", "the", "given", "matchers", "one", "by", "one", ".", "Every", "successful", "matches", "updates", "the", "internal", "buffer", ".", "The", "consequent", "match", "operation", "is", "performed", "after", "the", "previous", "match", "has", "succeeded", ...
train
https://github.com/Alexey1Gavrilov/ExpectIt/blob/5acbe1f8f895fe1dbd63e29bf3ab8e5bbf0873c3/expectit-core/src/main/java/net/sf/expectit/matcher/Matchers.java#L247-L285
census-instrumentation/opencensus-java
contrib/agent/src/main/java/io/opencensus/contrib/agent/bootstrap/TraceTrampoline.java
TraceTrampoline.endScope
public static void endScope(Closeable scope, @Nullable Throwable throwable) { """ Ends the current span with a status derived from the given (optional) Throwable, and closes the given scope. @param scope an object representing the scope @param throwable an optional Throwable @since 0.9 """ traceStrategy.endScope(scope, throwable); }
java
public static void endScope(Closeable scope, @Nullable Throwable throwable) { traceStrategy.endScope(scope, throwable); }
[ "public", "static", "void", "endScope", "(", "Closeable", "scope", ",", "@", "Nullable", "Throwable", "throwable", ")", "{", "traceStrategy", ".", "endScope", "(", "scope", ",", "throwable", ")", ";", "}" ]
Ends the current span with a status derived from the given (optional) Throwable, and closes the given scope. @param scope an object representing the scope @param throwable an optional Throwable @since 0.9
[ "Ends", "the", "current", "span", "with", "a", "status", "derived", "from", "the", "given", "(", "optional", ")", "Throwable", "and", "closes", "the", "given", "scope", "." ]
train
https://github.com/census-instrumentation/opencensus-java/blob/deefac9bed77e40a2297bff1ca5ec5aa48a5f755/contrib/agent/src/main/java/io/opencensus/contrib/agent/bootstrap/TraceTrampoline.java#L108-L110
camunda/camunda-bpm-platform
engine/src/main/java/org/camunda/bpm/engine/impl/bpmn/behavior/AbstractBpmnActivityBehavior.java
AbstractBpmnActivityBehavior.executeWithErrorPropagation
protected void executeWithErrorPropagation(ActivityExecution execution, Callable<Void> toExecute) throws Exception { """ Takes an {@link ActivityExecution} and an {@link Callable} and wraps the call to the Callable with the proper error propagation. This method also makes sure that exceptions not caught by following activities in the process will be thrown and not propagated. @param execution @param toExecute @throws Exception """ String activityInstanceId = execution.getActivityInstanceId(); try { toExecute.call(); } catch (Exception ex) { if (activityInstanceId.equals(execution.getActivityInstanceId())) { try { propagateException(execution, ex); } catch (ErrorPropagationException e) { LOG.errorPropagationException(activityInstanceId, e.getCause()); // re-throw the original exception so that it is logged // and set as cause of the failure throw ex; } } else { throw ex; } } }
java
protected void executeWithErrorPropagation(ActivityExecution execution, Callable<Void> toExecute) throws Exception { String activityInstanceId = execution.getActivityInstanceId(); try { toExecute.call(); } catch (Exception ex) { if (activityInstanceId.equals(execution.getActivityInstanceId())) { try { propagateException(execution, ex); } catch (ErrorPropagationException e) { LOG.errorPropagationException(activityInstanceId, e.getCause()); // re-throw the original exception so that it is logged // and set as cause of the failure throw ex; } } else { throw ex; } } }
[ "protected", "void", "executeWithErrorPropagation", "(", "ActivityExecution", "execution", ",", "Callable", "<", "Void", ">", "toExecute", ")", "throws", "Exception", "{", "String", "activityInstanceId", "=", "execution", ".", "getActivityInstanceId", "(", ")", ";", ...
Takes an {@link ActivityExecution} and an {@link Callable} and wraps the call to the Callable with the proper error propagation. This method also makes sure that exceptions not caught by following activities in the process will be thrown and not propagated. @param execution @param toExecute @throws Exception
[ "Takes", "an", "{", "@link", "ActivityExecution", "}", "and", "an", "{", "@link", "Callable", "}", "and", "wraps", "the", "call", "to", "the", "Callable", "with", "the", "proper", "error", "propagation", ".", "This", "method", "also", "makes", "sure", "tha...
train
https://github.com/camunda/camunda-bpm-platform/blob/1a464fc887ef3760e53d6f91b9e5b871a0d77cc0/engine/src/main/java/org/camunda/bpm/engine/impl/bpmn/behavior/AbstractBpmnActivityBehavior.java#L108-L130
Stratio/stratio-cassandra
src/java/org/apache/cassandra/gms/GossipDigestSynVerbHandler.java
GossipDigestSynVerbHandler.doSort
private void doSort(List<GossipDigest> gDigestList) { """ /* First construct a map whose key is the endpoint in the GossipDigest and the value is the GossipDigest itself. Then build a list of version differences i.e difference between the version in the GossipDigest and the version in the local state for a given InetAddress. Sort this list. Now loop through the sorted list and retrieve the GossipDigest corresponding to the endpoint from the map that was initially constructed. """ /* Construct a map of endpoint to GossipDigest. */ Map<InetAddress, GossipDigest> epToDigestMap = new HashMap<InetAddress, GossipDigest>(); for (GossipDigest gDigest : gDigestList) { epToDigestMap.put(gDigest.getEndpoint(), gDigest); } /* * These digests have their maxVersion set to the difference of the version * of the local EndpointState and the version found in the GossipDigest. */ List<GossipDigest> diffDigests = new ArrayList<GossipDigest>(gDigestList.size()); for (GossipDigest gDigest : gDigestList) { InetAddress ep = gDigest.getEndpoint(); EndpointState epState = Gossiper.instance.getEndpointStateForEndpoint(ep); int version = (epState != null) ? Gossiper.instance.getMaxEndpointStateVersion(epState) : 0; int diffVersion = Math.abs(version - gDigest.getMaxVersion()); diffDigests.add(new GossipDigest(ep, gDigest.getGeneration(), diffVersion)); } gDigestList.clear(); Collections.sort(diffDigests); int size = diffDigests.size(); /* * Report the digests in descending order. This takes care of the endpoints * that are far behind w.r.t this local endpoint */ for (int i = size - 1; i >= 0; --i) { gDigestList.add(epToDigestMap.get(diffDigests.get(i).getEndpoint())); } }
java
private void doSort(List<GossipDigest> gDigestList) { /* Construct a map of endpoint to GossipDigest. */ Map<InetAddress, GossipDigest> epToDigestMap = new HashMap<InetAddress, GossipDigest>(); for (GossipDigest gDigest : gDigestList) { epToDigestMap.put(gDigest.getEndpoint(), gDigest); } /* * These digests have their maxVersion set to the difference of the version * of the local EndpointState and the version found in the GossipDigest. */ List<GossipDigest> diffDigests = new ArrayList<GossipDigest>(gDigestList.size()); for (GossipDigest gDigest : gDigestList) { InetAddress ep = gDigest.getEndpoint(); EndpointState epState = Gossiper.instance.getEndpointStateForEndpoint(ep); int version = (epState != null) ? Gossiper.instance.getMaxEndpointStateVersion(epState) : 0; int diffVersion = Math.abs(version - gDigest.getMaxVersion()); diffDigests.add(new GossipDigest(ep, gDigest.getGeneration(), diffVersion)); } gDigestList.clear(); Collections.sort(diffDigests); int size = diffDigests.size(); /* * Report the digests in descending order. This takes care of the endpoints * that are far behind w.r.t this local endpoint */ for (int i = size - 1; i >= 0; --i) { gDigestList.add(epToDigestMap.get(diffDigests.get(i).getEndpoint())); } }
[ "private", "void", "doSort", "(", "List", "<", "GossipDigest", ">", "gDigestList", ")", "{", "/* Construct a map of endpoint to GossipDigest. */", "Map", "<", "InetAddress", ",", "GossipDigest", ">", "epToDigestMap", "=", "new", "HashMap", "<", "InetAddress", ",", "...
/* First construct a map whose key is the endpoint in the GossipDigest and the value is the GossipDigest itself. Then build a list of version differences i.e difference between the version in the GossipDigest and the version in the local state for a given InetAddress. Sort this list. Now loop through the sorted list and retrieve the GossipDigest corresponding to the endpoint from the map that was initially constructed.
[ "/", "*", "First", "construct", "a", "map", "whose", "key", "is", "the", "endpoint", "in", "the", "GossipDigest", "and", "the", "value", "is", "the", "GossipDigest", "itself", ".", "Then", "build", "a", "list", "of", "version", "differences", "i", ".", "...
train
https://github.com/Stratio/stratio-cassandra/blob/f6416b43ad5309083349ad56266450fa8c6a2106/src/java/org/apache/cassandra/gms/GossipDigestSynVerbHandler.java#L95-L129
jhy/jsoup
src/main/java/org/jsoup/select/Collector.java
Collector.collect
public static Elements collect (Evaluator eval, Element root) { """ Build a list of elements, by visiting root and every descendant of root, and testing it against the evaluator. @param eval Evaluator to test elements against @param root root of tree to descend @return list of matches; empty if none """ Elements elements = new Elements(); NodeTraversor.traverse(new Accumulator(root, elements, eval), root); return elements; }
java
public static Elements collect (Evaluator eval, Element root) { Elements elements = new Elements(); NodeTraversor.traverse(new Accumulator(root, elements, eval), root); return elements; }
[ "public", "static", "Elements", "collect", "(", "Evaluator", "eval", ",", "Element", "root", ")", "{", "Elements", "elements", "=", "new", "Elements", "(", ")", ";", "NodeTraversor", ".", "traverse", "(", "new", "Accumulator", "(", "root", ",", "elements", ...
Build a list of elements, by visiting root and every descendant of root, and testing it against the evaluator. @param eval Evaluator to test elements against @param root root of tree to descend @return list of matches; empty if none
[ "Build", "a", "list", "of", "elements", "by", "visiting", "root", "and", "every", "descendant", "of", "root", "and", "testing", "it", "against", "the", "evaluator", "." ]
train
https://github.com/jhy/jsoup/blob/68ff8cbe7ad847059737a09c567a501a7f1d251f/src/main/java/org/jsoup/select/Collector.java#L25-L29
j-a-w-r/jawr-main-repo
jawr/jawr-core/src/main/java/net/jawr/web/resource/bundle/generator/css/sass/ruby/JawrSassResolver.java
JawrSassResolver.findRelative
public String findRelative(String base, String uri) throws ResourceNotFoundException, IOException { """ Return the content of the resource using the base path and the relative URI @param base the base path @param uri the relative URI @return the content of the resource using the base path and the relative URI @throws ResourceNotFoundException if the resource is not found @throws IOException if an IOException occurs """ String path = getPath(base, uri); String source = resolveAndNormalize(path); if (source != null) { return source; } // Try to find partial import (_identifier.scss) path = PathNormalizer.getParentPath(path) + "_" + PathNormalizer.getPathName(path); source = resolveAndNormalize(path); if (source != null) { return source; } return resolveAndNormalize(uri); }
java
public String findRelative(String base, String uri) throws ResourceNotFoundException, IOException { String path = getPath(base, uri); String source = resolveAndNormalize(path); if (source != null) { return source; } // Try to find partial import (_identifier.scss) path = PathNormalizer.getParentPath(path) + "_" + PathNormalizer.getPathName(path); source = resolveAndNormalize(path); if (source != null) { return source; } return resolveAndNormalize(uri); }
[ "public", "String", "findRelative", "(", "String", "base", ",", "String", "uri", ")", "throws", "ResourceNotFoundException", ",", "IOException", "{", "String", "path", "=", "getPath", "(", "base", ",", "uri", ")", ";", "String", "source", "=", "resolveAndNorma...
Return the content of the resource using the base path and the relative URI @param base the base path @param uri the relative URI @return the content of the resource using the base path and the relative URI @throws ResourceNotFoundException if the resource is not found @throws IOException if an IOException occurs
[ "Return", "the", "content", "of", "the", "resource", "using", "the", "base", "path", "and", "the", "relative", "URI" ]
train
https://github.com/j-a-w-r/jawr-main-repo/blob/5381f6acf461cd2502593c67a77bd6ef9eab848d/jawr/jawr-core/src/main/java/net/jawr/web/resource/bundle/generator/css/sass/ruby/JawrSassResolver.java#L125-L146
ngageoint/geopackage-java
src/main/java/mil/nga/geopackage/io/TileProperties.java
TileProperties.getProperty
public String getProperty(String property, boolean required) { """ Get the String property @param property property @param required required flag @return string property """ if (properties == null) { throw new GeoPackageException( "Properties must be loaded before reading"); } String value = properties.getProperty(property); if (value == null && required) { throw new GeoPackageException(GEOPACKAGE_PROPERTIES_FILE + " property file missing required property: " + property); } return value; }
java
public String getProperty(String property, boolean required) { if (properties == null) { throw new GeoPackageException( "Properties must be loaded before reading"); } String value = properties.getProperty(property); if (value == null && required) { throw new GeoPackageException(GEOPACKAGE_PROPERTIES_FILE + " property file missing required property: " + property); } return value; }
[ "public", "String", "getProperty", "(", "String", "property", ",", "boolean", "required", ")", "{", "if", "(", "properties", "==", "null", ")", "{", "throw", "new", "GeoPackageException", "(", "\"Properties must be loaded before reading\"", ")", ";", "}", "String"...
Get the String property @param property property @param required required flag @return string property
[ "Get", "the", "String", "property" ]
train
https://github.com/ngageoint/geopackage-java/blob/889bffb5d18330a3f4bd89443acf7959ebe3a376/src/main/java/mil/nga/geopackage/io/TileProperties.java#L184-L197
AltBeacon/android-beacon-library
lib/src/main/java/org/altbeacon/beacon/distance/CurveFittedDistanceCalculator.java
CurveFittedDistanceCalculator.calculateDistance
@Override public double calculateDistance(int txPower, double rssi) { """ Calculated the estimated distance in meters to the beacon based on a reference rssi at 1m and the known actual rssi at the current location @param txPower @param rssi @return estimated distance """ if (rssi == 0) { return -1.0; // if we cannot determine accuracy, return -1. } LogManager.d(TAG, "calculating distance based on mRssi of %s and txPower of %s", rssi, txPower); double ratio = rssi*1.0/txPower; double distance; if (ratio < 1.0) { distance = Math.pow(ratio,10); } else { distance = (mCoefficient1)*Math.pow(ratio,mCoefficient2) + mCoefficient3; } LogManager.d(TAG, "avg mRssi: %s distance: %s", rssi, distance); return distance; }
java
@Override public double calculateDistance(int txPower, double rssi) { if (rssi == 0) { return -1.0; // if we cannot determine accuracy, return -1. } LogManager.d(TAG, "calculating distance based on mRssi of %s and txPower of %s", rssi, txPower); double ratio = rssi*1.0/txPower; double distance; if (ratio < 1.0) { distance = Math.pow(ratio,10); } else { distance = (mCoefficient1)*Math.pow(ratio,mCoefficient2) + mCoefficient3; } LogManager.d(TAG, "avg mRssi: %s distance: %s", rssi, distance); return distance; }
[ "@", "Override", "public", "double", "calculateDistance", "(", "int", "txPower", ",", "double", "rssi", ")", "{", "if", "(", "rssi", "==", "0", ")", "{", "return", "-", "1.0", ";", "// if we cannot determine accuracy, return -1.", "}", "LogManager", ".", "d", ...
Calculated the estimated distance in meters to the beacon based on a reference rssi at 1m and the known actual rssi at the current location @param txPower @param rssi @return estimated distance
[ "Calculated", "the", "estimated", "distance", "in", "meters", "to", "the", "beacon", "based", "on", "a", "reference", "rssi", "at", "1m", "and", "the", "known", "actual", "rssi", "at", "the", "current", "location" ]
train
https://github.com/AltBeacon/android-beacon-library/blob/f7f3a323ea7415d53e7bd695ff6a01f1501d5dc3/lib/src/main/java/org/altbeacon/beacon/distance/CurveFittedDistanceCalculator.java#L45-L64
eFaps/eFaps-Kernel
src/main/java/org/efaps/update/schema/program/esjp/ESJPCompiler.java
ESJPCompiler.readESJPClasses
protected void readESJPClasses() throws InstallationException { """ All stored compiled ESJP's classes in the eFaps database are stored in the mapping {@link #class2id}. If a ESJP's program is compiled and stored with {@link ESJPCompiler.StoreObject#write()}, the class is removed. After the compile, {@link ESJPCompiler#compile(String)} removes all stored classes which are not needed anymore. @throws InstallationException if read of the ESJP classes failed @see #class2id """ try { final QueryBuilder queryBldr = new QueryBuilder(this.classType); final MultiPrintQuery multi = queryBldr.getPrint(); multi.addAttribute("Name"); multi.executeWithoutAccessCheck(); while (multi.next()) { final String name = multi.<String>getAttribute("Name"); final Long id = multi.getCurrentInstance().getId(); this.class2id.put(name, id); } } catch (final EFapsException e) { throw new InstallationException("Could not fetch the information about compiled ESJP's", e); } }
java
protected void readESJPClasses() throws InstallationException { try { final QueryBuilder queryBldr = new QueryBuilder(this.classType); final MultiPrintQuery multi = queryBldr.getPrint(); multi.addAttribute("Name"); multi.executeWithoutAccessCheck(); while (multi.next()) { final String name = multi.<String>getAttribute("Name"); final Long id = multi.getCurrentInstance().getId(); this.class2id.put(name, id); } } catch (final EFapsException e) { throw new InstallationException("Could not fetch the information about compiled ESJP's", e); } }
[ "protected", "void", "readESJPClasses", "(", ")", "throws", "InstallationException", "{", "try", "{", "final", "QueryBuilder", "queryBldr", "=", "new", "QueryBuilder", "(", "this", ".", "classType", ")", ";", "final", "MultiPrintQuery", "multi", "=", "queryBldr", ...
All stored compiled ESJP's classes in the eFaps database are stored in the mapping {@link #class2id}. If a ESJP's program is compiled and stored with {@link ESJPCompiler.StoreObject#write()}, the class is removed. After the compile, {@link ESJPCompiler#compile(String)} removes all stored classes which are not needed anymore. @throws InstallationException if read of the ESJP classes failed @see #class2id
[ "All", "stored", "compiled", "ESJP", "s", "classes", "in", "the", "eFaps", "database", "are", "stored", "in", "the", "mapping", "{", "@link", "#class2id", "}", ".", "If", "a", "ESJP", "s", "program", "is", "compiled", "and", "stored", "with", "{", "@link...
train
https://github.com/eFaps/eFaps-Kernel/blob/04b96548f518c2386a93f5ec2b9349f9b9063859/src/main/java/org/efaps/update/schema/program/esjp/ESJPCompiler.java#L282-L298
gmessner/gitlab4j-api
src/main/java/org/gitlab4j/api/PipelineApi.java
PipelineApi.deletePipeline
public void deletePipeline(Object projectIdOrPath, int pipelineId) throws GitLabApiException { """ Delete a pipeline from a project. <pre><code>GitLab Endpoint: DELETE /projects/:id/pipelines/:pipeline_id</code></pre> @param projectIdOrPath the project in the form of an Integer(ID), String(path), or Project instance @param pipelineId the pipeline ID to delete @throws GitLabApiException if any exception occurs during execution """ delete(Response.Status.ACCEPTED, null, "projects", getProjectIdOrPath(projectIdOrPath), "pipelines", pipelineId); }
java
public void deletePipeline(Object projectIdOrPath, int pipelineId) throws GitLabApiException { delete(Response.Status.ACCEPTED, null, "projects", getProjectIdOrPath(projectIdOrPath), "pipelines", pipelineId); }
[ "public", "void", "deletePipeline", "(", "Object", "projectIdOrPath", ",", "int", "pipelineId", ")", "throws", "GitLabApiException", "{", "delete", "(", "Response", ".", "Status", ".", "ACCEPTED", ",", "null", ",", "\"projects\"", ",", "getProjectIdOrPath", "(", ...
Delete a pipeline from a project. <pre><code>GitLab Endpoint: DELETE /projects/:id/pipelines/:pipeline_id</code></pre> @param projectIdOrPath the project in the form of an Integer(ID), String(path), or Project instance @param pipelineId the pipeline ID to delete @throws GitLabApiException if any exception occurs during execution
[ "Delete", "a", "pipeline", "from", "a", "project", "." ]
train
https://github.com/gmessner/gitlab4j-api/blob/ab045070abac0a8f4ccbf17b5ed9bfdef5723eed/src/main/java/org/gitlab4j/api/PipelineApi.java#L261-L263
fabric8io/docker-maven-plugin
src/main/java/io/fabric8/maven/docker/BuildMojo.java
BuildMojo.processImageConfig
private void processImageConfig(ServiceHub hub, ImageConfiguration aImageConfig) throws IOException, MojoExecutionException { """ Helper method to process an ImageConfiguration. @param hub ServiceHub @param aImageConfig ImageConfiguration that would be forwarded to build and tag @throws DockerAccessException @throws MojoExecutionException """ BuildImageConfiguration buildConfig = aImageConfig.getBuildConfiguration(); if (buildConfig != null) { if(buildConfig.skip()) { log.info("%s : Skipped building", aImageConfig.getDescription()); } else { buildAndTag(hub, aImageConfig); } } }
java
private void processImageConfig(ServiceHub hub, ImageConfiguration aImageConfig) throws IOException, MojoExecutionException { BuildImageConfiguration buildConfig = aImageConfig.getBuildConfiguration(); if (buildConfig != null) { if(buildConfig.skip()) { log.info("%s : Skipped building", aImageConfig.getDescription()); } else { buildAndTag(hub, aImageConfig); } } }
[ "private", "void", "processImageConfig", "(", "ServiceHub", "hub", ",", "ImageConfiguration", "aImageConfig", ")", "throws", "IOException", ",", "MojoExecutionException", "{", "BuildImageConfiguration", "buildConfig", "=", "aImageConfig", ".", "getBuildConfiguration", "(", ...
Helper method to process an ImageConfiguration. @param hub ServiceHub @param aImageConfig ImageConfiguration that would be forwarded to build and tag @throws DockerAccessException @throws MojoExecutionException
[ "Helper", "method", "to", "process", "an", "ImageConfiguration", "." ]
train
https://github.com/fabric8io/docker-maven-plugin/blob/70ce4f56125d8efb8ddcf2ad4dbb5d6e2c7642b3/src/main/java/io/fabric8/maven/docker/BuildMojo.java#L98-L108
groves/yarrgs
src/main/java/com/bungleton/yarrgs/parser/ParseRunner.java
ParseRunner.handleOption
protected boolean handleOption (String arg, String nextArg, OptionArgument handler) throws YarrgParseException { """ Adds the value of arg and possibly nextArg to the parser for handler. @param nextArg - The argument following this one, or null if there isn't one. @return if nextArg was consumed by handling this option. """ checkState(handler != null, "No such option '" + arg + "'"); if (handler instanceof ValueOptionArgument) { checkState(nextArg != null, "'" + arg + "' requires a value following it"); parse(nextArg, handler); return true; } else if (handler instanceof HelpArgument) { throw new YarrgHelpException(_usage, _detail); } else { parse("true", handler); return false; } }
java
protected boolean handleOption (String arg, String nextArg, OptionArgument handler) throws YarrgParseException { checkState(handler != null, "No such option '" + arg + "'"); if (handler instanceof ValueOptionArgument) { checkState(nextArg != null, "'" + arg + "' requires a value following it"); parse(nextArg, handler); return true; } else if (handler instanceof HelpArgument) { throw new YarrgHelpException(_usage, _detail); } else { parse("true", handler); return false; } }
[ "protected", "boolean", "handleOption", "(", "String", "arg", ",", "String", "nextArg", ",", "OptionArgument", "handler", ")", "throws", "YarrgParseException", "{", "checkState", "(", "handler", "!=", "null", ",", "\"No such option '\"", "+", "arg", "+", "\"'\"", ...
Adds the value of arg and possibly nextArg to the parser for handler. @param nextArg - The argument following this one, or null if there isn't one. @return if nextArg was consumed by handling this option.
[ "Adds", "the", "value", "of", "arg", "and", "possibly", "nextArg", "to", "the", "parser", "for", "handler", "." ]
train
https://github.com/groves/yarrgs/blob/5599e82b63db56db3b0c2f7668d9a535cde456e1/src/main/java/com/bungleton/yarrgs/parser/ParseRunner.java#L96-L110
windup/windup
reporting/api/src/main/java/org/jboss/windup/reporting/service/ClassificationService.java
ClassificationService.attachClassification
public ClassificationModel attachClassification(GraphRewrite event, Rule rule, FileModel fileModel, String classificationText, String description) { """ Attach a {@link ClassificationModel} with the given classificationText and description to the provided {@link FileModel}. If an existing Model exists with the provided classificationText, that one will be used instead. """ return attachClassification(event, rule, fileModel, IssueCategoryRegistry.DEFAULT, classificationText, description); }
java
public ClassificationModel attachClassification(GraphRewrite event, Rule rule, FileModel fileModel, String classificationText, String description) { return attachClassification(event, rule, fileModel, IssueCategoryRegistry.DEFAULT, classificationText, description); }
[ "public", "ClassificationModel", "attachClassification", "(", "GraphRewrite", "event", ",", "Rule", "rule", ",", "FileModel", "fileModel", ",", "String", "classificationText", ",", "String", "description", ")", "{", "return", "attachClassification", "(", "event", ",",...
Attach a {@link ClassificationModel} with the given classificationText and description to the provided {@link FileModel}. If an existing Model exists with the provided classificationText, that one will be used instead.
[ "Attach", "a", "{" ]
train
https://github.com/windup/windup/blob/6668f09e7f012d24a0b4212ada8809417225b2ad/reporting/api/src/main/java/org/jboss/windup/reporting/service/ClassificationService.java#L221-L224
andriusvelykis/reflow-maven-skin
reflow-velocity-tools/src/main/java/lt/velykis/maven/skins/reflow/SkinConfigTool.java
SkinConfigTool.isValue
public boolean isValue(String property, String value) { """ A convenience method to check if the {@code property} is set to a specific value. @param property the property of interest @param value the property value to check @return {@code true} if the configuration value is set either in page or globally, and is equal to {@code value}. @see #get(String) @since 1.0 """ return value != null && value.equals(value(property)); }
java
public boolean isValue(String property, String value) { return value != null && value.equals(value(property)); }
[ "public", "boolean", "isValue", "(", "String", "property", ",", "String", "value", ")", "{", "return", "value", "!=", "null", "&&", "value", ".", "equals", "(", "value", "(", "property", ")", ")", ";", "}" ]
A convenience method to check if the {@code property} is set to a specific value. @param property the property of interest @param value the property value to check @return {@code true} if the configuration value is set either in page or globally, and is equal to {@code value}. @see #get(String) @since 1.0
[ "A", "convenience", "method", "to", "check", "if", "the", "{", "@code", "property", "}", "is", "set", "to", "a", "specific", "value", "." ]
train
https://github.com/andriusvelykis/reflow-maven-skin/blob/01170ae1426a1adfe7cc9c199e77aaa2ecb37ef2/reflow-velocity-tools/src/main/java/lt/velykis/maven/skins/reflow/SkinConfigTool.java#L341-L343
jbundle/webapp
upload/src/main/java/org/jbundle/util/webapp/upload/UploadServlet.java
UploadServlet.successfulFileUpload
public String successfulFileUpload(File file, Properties properties) { """ /* The file was uploaded successfully, return an HTML string to display. NOTE: This is supplied to provide a convenient place to override this servlet and do some processing or supply a different (or no) return string. Usually, you want to call super to get the standard string. @param properties All the form parameters. @param file The file that was uploaded. @returns HTML String to display. """ return "<p>Previous upload successful. Path: " + file.getPath() + " Filename: " + file.getName() + " received containing " + file.length() + " bytes</p>" + RETURN; }
java
public String successfulFileUpload(File file, Properties properties) { return "<p>Previous upload successful. Path: " + file.getPath() + " Filename: " + file.getName() + " received containing " + file.length() + " bytes</p>" + RETURN; }
[ "public", "String", "successfulFileUpload", "(", "File", "file", ",", "Properties", "properties", ")", "{", "return", "\"<p>Previous upload successful. Path: \"", "+", "file", ".", "getPath", "(", ")", "+", "\" Filename: \"", "+", "file", ".", "getName", "(", ")",...
/* The file was uploaded successfully, return an HTML string to display. NOTE: This is supplied to provide a convenient place to override this servlet and do some processing or supply a different (or no) return string. Usually, you want to call super to get the standard string. @param properties All the form parameters. @param file The file that was uploaded. @returns HTML String to display.
[ "/", "*", "The", "file", "was", "uploaded", "successfully", "return", "an", "HTML", "string", "to", "display", ".", "NOTE", ":", "This", "is", "supplied", "to", "provide", "a", "convenient", "place", "to", "override", "this", "servlet", "and", "do", "some"...
train
https://github.com/jbundle/webapp/blob/af2cf32bd92254073052f1f9b4bcd47c2f76ba7d/upload/src/main/java/org/jbundle/util/webapp/upload/UploadServlet.java#L217-L220
alkacon/opencms-core
src/org/opencms/xml/containerpage/CmsDynamicFunctionBean.java
CmsDynamicFunctionBean.createFormatterBean
protected CmsFormatterBean createFormatterBean(Format format, boolean isPreview) { """ Helper method to create a formatter bean from a format.<p> @param format the format bean @param isPreview if true, the formatter returned will be marked as a preview formatter @return the formatter corresponding to the format """ if (format.hasNoContainerSettings()) { return new CmsFormatterBean( CmsResourceTypeFunctionConfig.FORMATTER_PATH, m_functionFormatter.getStructureId(), m_resource.getRootPath(), isPreview); } else { CmsFormatterBean result = new CmsFormatterBean( format.getType(), CmsResourceTypeFunctionConfig.FORMATTER_PATH, format.getMinWidth(), format.getMaxWidth(), "" + isPreview, "false", m_resource.getRootPath()); result.setJspStructureId(m_functionFormatter.getStructureId()); return result; } }
java
protected CmsFormatterBean createFormatterBean(Format format, boolean isPreview) { if (format.hasNoContainerSettings()) { return new CmsFormatterBean( CmsResourceTypeFunctionConfig.FORMATTER_PATH, m_functionFormatter.getStructureId(), m_resource.getRootPath(), isPreview); } else { CmsFormatterBean result = new CmsFormatterBean( format.getType(), CmsResourceTypeFunctionConfig.FORMATTER_PATH, format.getMinWidth(), format.getMaxWidth(), "" + isPreview, "false", m_resource.getRootPath()); result.setJspStructureId(m_functionFormatter.getStructureId()); return result; } }
[ "protected", "CmsFormatterBean", "createFormatterBean", "(", "Format", "format", ",", "boolean", "isPreview", ")", "{", "if", "(", "format", ".", "hasNoContainerSettings", "(", ")", ")", "{", "return", "new", "CmsFormatterBean", "(", "CmsResourceTypeFunctionConfig", ...
Helper method to create a formatter bean from a format.<p> @param format the format bean @param isPreview if true, the formatter returned will be marked as a preview formatter @return the formatter corresponding to the format
[ "Helper", "method", "to", "create", "a", "formatter", "bean", "from", "a", "format", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/xml/containerpage/CmsDynamicFunctionBean.java#L303-L323
j256/ormlite-core
src/main/java/com/j256/ormlite/stmt/StatementExecutor.java
StatementExecutor.queryForFirst
public T queryForFirst(DatabaseConnection databaseConnection, PreparedStmt<T> preparedStmt, ObjectCache objectCache) throws SQLException { """ Return the first object that matches the {@link PreparedStmt} or null if none. """ CompiledStatement compiledStatement = preparedStmt.compile(databaseConnection, StatementType.SELECT); DatabaseResults results = null; try { compiledStatement.setMaxRows(1); results = compiledStatement.runQuery(objectCache); if (results.first()) { logger.debug("query-for-first of '{}' returned at least 1 result", preparedStmt.getStatement()); return preparedStmt.mapRow(results); } else { logger.debug("query-for-first of '{}' returned 0 results", preparedStmt.getStatement()); return null; } } finally { IOUtils.closeThrowSqlException(results, "results"); IOUtils.closeThrowSqlException(compiledStatement, "compiled statement"); } }
java
public T queryForFirst(DatabaseConnection databaseConnection, PreparedStmt<T> preparedStmt, ObjectCache objectCache) throws SQLException { CompiledStatement compiledStatement = preparedStmt.compile(databaseConnection, StatementType.SELECT); DatabaseResults results = null; try { compiledStatement.setMaxRows(1); results = compiledStatement.runQuery(objectCache); if (results.first()) { logger.debug("query-for-first of '{}' returned at least 1 result", preparedStmt.getStatement()); return preparedStmt.mapRow(results); } else { logger.debug("query-for-first of '{}' returned 0 results", preparedStmt.getStatement()); return null; } } finally { IOUtils.closeThrowSqlException(results, "results"); IOUtils.closeThrowSqlException(compiledStatement, "compiled statement"); } }
[ "public", "T", "queryForFirst", "(", "DatabaseConnection", "databaseConnection", ",", "PreparedStmt", "<", "T", ">", "preparedStmt", ",", "ObjectCache", "objectCache", ")", "throws", "SQLException", "{", "CompiledStatement", "compiledStatement", "=", "preparedStmt", "."...
Return the first object that matches the {@link PreparedStmt} or null if none.
[ "Return", "the", "first", "object", "that", "matches", "the", "{" ]
train
https://github.com/j256/ormlite-core/blob/154d85bbb9614a0ea65a012251257831fb4fba21/src/main/java/com/j256/ormlite/stmt/StatementExecutor.java#L100-L118
ksclarke/freelib-utils
src/main/java/info/freelibrary/util/I18nObject.java
I18nObject.getI18n
protected String getI18n(final String aMessageKey, final String... aDetailsArray) { """ Gets the internationalized value for the supplied message key, using a string array as additional information. @param aMessageKey A message key @param aDetailsArray Additional details for the message @return The internationalized message """ return StringUtils.normalizeWS(myBundle.get(aMessageKey, aDetailsArray)); }
java
protected String getI18n(final String aMessageKey, final String... aDetailsArray) { return StringUtils.normalizeWS(myBundle.get(aMessageKey, aDetailsArray)); }
[ "protected", "String", "getI18n", "(", "final", "String", "aMessageKey", ",", "final", "String", "...", "aDetailsArray", ")", "{", "return", "StringUtils", ".", "normalizeWS", "(", "myBundle", ".", "get", "(", "aMessageKey", ",", "aDetailsArray", ")", ")", ";"...
Gets the internationalized value for the supplied message key, using a string array as additional information. @param aMessageKey A message key @param aDetailsArray Additional details for the message @return The internationalized message
[ "Gets", "the", "internationalized", "value", "for", "the", "supplied", "message", "key", "using", "a", "string", "array", "as", "additional", "information", "." ]
train
https://github.com/ksclarke/freelib-utils/blob/54e822ae4c11b3d74793fd82a1a535ffafffaf45/src/main/java/info/freelibrary/util/I18nObject.java#L90-L92
podio/podio-java
src/main/java/com/podio/conversation/ConversationAPI.java
ConversationAPI.createConversation
public int createConversation(String subject, String text, List<Integer> participants) { """ Creates a new conversation with a list of users. Once a conversation is started, the participants cannot (yet) be changed. @param subject The subject of the conversation @param text The text of the first message in the conversation @param participants List of participants in the conversation (not including the sender) @return The id of the newly created conversation """ return createConversation(subject, text, participants, null); }
java
public int createConversation(String subject, String text, List<Integer> participants) { return createConversation(subject, text, participants, null); }
[ "public", "int", "createConversation", "(", "String", "subject", ",", "String", "text", ",", "List", "<", "Integer", ">", "participants", ")", "{", "return", "createConversation", "(", "subject", ",", "text", ",", "participants", ",", "null", ")", ";", "}" ]
Creates a new conversation with a list of users. Once a conversation is started, the participants cannot (yet) be changed. @param subject The subject of the conversation @param text The text of the first message in the conversation @param participants List of participants in the conversation (not including the sender) @return The id of the newly created conversation
[ "Creates", "a", "new", "conversation", "with", "a", "list", "of", "users", ".", "Once", "a", "conversation", "is", "started", "the", "participants", "cannot", "(", "yet", ")", "be", "changed", "." ]
train
https://github.com/podio/podio-java/blob/a520b23bac118c957ce02cdd8ff42a6c7d17b49a/src/main/java/com/podio/conversation/ConversationAPI.java#L32-L35
alkacon/opencms-core
src/org/opencms/db/CmsSubscriptionManager.java
CmsSubscriptionManager.unsubscribeResourceFor
public void unsubscribeResourceFor(CmsObject cms, CmsPrincipal principal, String resourcePath) throws CmsException { """ Unsubscribes the principal from the resource.<p> @param cms the current users context @param principal the principal that unsubscribes from the resource @param resourcePath the name of the resource to unsubscribe from @throws CmsException if something goes wrong """ CmsResource resource = cms.readResource(resourcePath, CmsResourceFilter.ALL); unsubscribeResourceFor(cms, principal, resource); }
java
public void unsubscribeResourceFor(CmsObject cms, CmsPrincipal principal, String resourcePath) throws CmsException { CmsResource resource = cms.readResource(resourcePath, CmsResourceFilter.ALL); unsubscribeResourceFor(cms, principal, resource); }
[ "public", "void", "unsubscribeResourceFor", "(", "CmsObject", "cms", ",", "CmsPrincipal", "principal", ",", "String", "resourcePath", ")", "throws", "CmsException", "{", "CmsResource", "resource", "=", "cms", ".", "readResource", "(", "resourcePath", ",", "CmsResour...
Unsubscribes the principal from the resource.<p> @param cms the current users context @param principal the principal that unsubscribes from the resource @param resourcePath the name of the resource to unsubscribe from @throws CmsException if something goes wrong
[ "Unsubscribes", "the", "principal", "from", "the", "resource", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/db/CmsSubscriptionManager.java#L461-L465
bi-geek/flink-connector-ethereum
src/main/java/com/bigeek/flink/utils/EthereumUtils.java
EthereumUtils.generateClient
public static Web3j generateClient(String clientAddress, Long timeoutSeconds) { """ Generate Ethereum client. @param clientAddress @param timeoutSeconds @return Web3j client """ if (isEmpty(clientAddress)) { throw new IllegalArgumentException("You have to define client address, use constructor or environment variable 'web3j.clientAddress'"); } Web3jService web3jService; if (clientAddress.startsWith("http")) { web3jService = new HttpService(clientAddress, createOkHttpClient(timeoutSeconds), false); } else if (clientAddress.startsWith("wss")) { try { web3jService = new WebSocketService(clientAddress, true); ((WebSocketService) web3jService).connect(); } catch (Exception ex) { throw new RuntimeException(ex); } } else if (System.getProperty("os.name").toLowerCase().startsWith("win")) { web3jService = new WindowsIpcService(clientAddress); } else { web3jService = new UnixIpcService(clientAddress); } return Web3j.build(web3jService); }
java
public static Web3j generateClient(String clientAddress, Long timeoutSeconds) { if (isEmpty(clientAddress)) { throw new IllegalArgumentException("You have to define client address, use constructor or environment variable 'web3j.clientAddress'"); } Web3jService web3jService; if (clientAddress.startsWith("http")) { web3jService = new HttpService(clientAddress, createOkHttpClient(timeoutSeconds), false); } else if (clientAddress.startsWith("wss")) { try { web3jService = new WebSocketService(clientAddress, true); ((WebSocketService) web3jService).connect(); } catch (Exception ex) { throw new RuntimeException(ex); } } else if (System.getProperty("os.name").toLowerCase().startsWith("win")) { web3jService = new WindowsIpcService(clientAddress); } else { web3jService = new UnixIpcService(clientAddress); } return Web3j.build(web3jService); }
[ "public", "static", "Web3j", "generateClient", "(", "String", "clientAddress", ",", "Long", "timeoutSeconds", ")", "{", "if", "(", "isEmpty", "(", "clientAddress", ")", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"You have to define client address, us...
Generate Ethereum client. @param clientAddress @param timeoutSeconds @return Web3j client
[ "Generate", "Ethereum", "client", "." ]
train
https://github.com/bi-geek/flink-connector-ethereum/blob/9ecedbf999fc410e50225c3f69b5041df4c61a33/src/main/java/com/bigeek/flink/utils/EthereumUtils.java#L46-L68
keenlabs/KeenClient-Java
core/src/main/java/io/keen/client/java/FileEventStore.java
FileEventStore.getFileForEvent
private File getFileForEvent(File collectionDir, Calendar timestamp) throws IOException { """ Gets the file to use for a new event in the given collection with the given timestamp. If there are multiple events with identical timestamps, this method will use a counter to create a unique file name for each. @param collectionDir The cache directory for the event collection. @param timestamp The timestamp of the event. @return The file to use for the new event. """ int counter = 0; File eventFile = getNextFileForEvent(collectionDir, timestamp, counter); while (eventFile.exists()) { eventFile = getNextFileForEvent(collectionDir, timestamp, counter); counter++; } return eventFile; }
java
private File getFileForEvent(File collectionDir, Calendar timestamp) throws IOException { int counter = 0; File eventFile = getNextFileForEvent(collectionDir, timestamp, counter); while (eventFile.exists()) { eventFile = getNextFileForEvent(collectionDir, timestamp, counter); counter++; } return eventFile; }
[ "private", "File", "getFileForEvent", "(", "File", "collectionDir", ",", "Calendar", "timestamp", ")", "throws", "IOException", "{", "int", "counter", "=", "0", ";", "File", "eventFile", "=", "getNextFileForEvent", "(", "collectionDir", ",", "timestamp", ",", "c...
Gets the file to use for a new event in the given collection with the given timestamp. If there are multiple events with identical timestamps, this method will use a counter to create a unique file name for each. @param collectionDir The cache directory for the event collection. @param timestamp The timestamp of the event. @return The file to use for the new event.
[ "Gets", "the", "file", "to", "use", "for", "a", "new", "event", "in", "the", "given", "collection", "with", "the", "given", "timestamp", ".", "If", "there", "are", "multiple", "events", "with", "identical", "timestamps", "this", "method", "will", "use", "a...
train
https://github.com/keenlabs/KeenClient-Java/blob/2ea021547b5338257c951a2596bd49749038d018/core/src/main/java/io/keen/client/java/FileEventStore.java#L318-L326
javagl/CommonUI
src/main/java/de/javagl/common/ui/tree/filtered/FilteredTreeModel.java
FilteredTreeModel.fireTreeStructureChanged
protected void fireTreeStructureChanged(Object source, Object[] path, int[] childIndices, Object[] children) { """ Fires a treeStructureChanged event @param source The source @param path The tree paths @param childIndices The child indices @param children The children """ for (TreeModelListener listener : treeModelListeners) { listener.treeStructureChanged( new TreeModelEvent(source, path, childIndices, children)); } }
java
protected void fireTreeStructureChanged(Object source, Object[] path, int[] childIndices, Object[] children) { for (TreeModelListener listener : treeModelListeners) { listener.treeStructureChanged( new TreeModelEvent(source, path, childIndices, children)); } }
[ "protected", "void", "fireTreeStructureChanged", "(", "Object", "source", ",", "Object", "[", "]", "path", ",", "int", "[", "]", "childIndices", ",", "Object", "[", "]", "children", ")", "{", "for", "(", "TreeModelListener", "listener", ":", "treeModelListener...
Fires a treeStructureChanged event @param source The source @param path The tree paths @param childIndices The child indices @param children The children
[ "Fires", "a", "treeStructureChanged", "event" ]
train
https://github.com/javagl/CommonUI/blob/b2c7a7637d4e288271392ba148dc17e4c9780255/src/main/java/de/javagl/common/ui/tree/filtered/FilteredTreeModel.java#L228-L236
j-a-w-r/jawr-main-repo
jawr/jawr-core/src/main/java/net/jawr/web/resource/bundle/factory/util/PathNormalizer.java
PathNormalizer.joinPaths
public static String joinPaths(String prefix, String path, boolean generatedPath) { """ Normalizes two paths and joins them as a single path. @param prefix @param path @return the joined path """ String result = null; if (generatedPath) { result = joinDomainToPath(prefix, path); } else { result = joinPaths(prefix, path); } return result; }
java
public static String joinPaths(String prefix, String path, boolean generatedPath) { String result = null; if (generatedPath) { result = joinDomainToPath(prefix, path); } else { result = joinPaths(prefix, path); } return result; }
[ "public", "static", "String", "joinPaths", "(", "String", "prefix", ",", "String", "path", ",", "boolean", "generatedPath", ")", "{", "String", "result", "=", "null", ";", "if", "(", "generatedPath", ")", "{", "result", "=", "joinDomainToPath", "(", "prefix"...
Normalizes two paths and joins them as a single path. @param prefix @param path @return the joined path
[ "Normalizes", "two", "paths", "and", "joins", "them", "as", "a", "single", "path", "." ]
train
https://github.com/j-a-w-r/jawr-main-repo/blob/5381f6acf461cd2502593c67a77bd6ef9eab848d/jawr/jawr-core/src/main/java/net/jawr/web/resource/bundle/factory/util/PathNormalizer.java#L294-L303
RKumsher/utils
src/main/java/com/github/rkumsher/number/RandomNumberUtils.java
RandomNumberUtils.randomLong
public static long randomLong(long startInclusive, long endExclusive) { """ Returns a random long within the specified range. @param startInclusive the earliest long that can be returned @param endExclusive the upper bound (not included) @return the random long @throws IllegalArgumentException if endExclusive is less than startInclusive """ checkArgument(startInclusive <= endExclusive, "End must be greater than or equal to start"); if (startInclusive == endExclusive) { return startInclusive; } return RANDOM.longs(1, startInclusive, endExclusive).sum(); }
java
public static long randomLong(long startInclusive, long endExclusive) { checkArgument(startInclusive <= endExclusive, "End must be greater than or equal to start"); if (startInclusive == endExclusive) { return startInclusive; } return RANDOM.longs(1, startInclusive, endExclusive).sum(); }
[ "public", "static", "long", "randomLong", "(", "long", "startInclusive", ",", "long", "endExclusive", ")", "{", "checkArgument", "(", "startInclusive", "<=", "endExclusive", ",", "\"End must be greater than or equal to start\"", ")", ";", "if", "(", "startInclusive", ...
Returns a random long within the specified range. @param startInclusive the earliest long that can be returned @param endExclusive the upper bound (not included) @return the random long @throws IllegalArgumentException if endExclusive is less than startInclusive
[ "Returns", "a", "random", "long", "within", "the", "specified", "range", "." ]
train
https://github.com/RKumsher/utils/blob/fcdb190569cd0288249bf4b46fd418f8c01d1caf/src/main/java/com/github/rkumsher/number/RandomNumberUtils.java#L123-L129
elki-project/elki
elki-index-rtree/src/main/java/de/lmu/ifi/dbs/elki/index/tree/spatial/rstarvariants/strategies/bulk/AbstractBulkSplit.java
AbstractBulkSplit.chooseBulkSplitPoint
protected int chooseBulkSplitPoint(int numEntries, int minEntries, int maxEntries) { """ Computes and returns the best split point. @param numEntries the number of entries to be split @param minEntries the number of minimum entries in the node to be split @param maxEntries number of maximum entries in the node to be split @return the best split point """ if(numEntries < minEntries) { throw new IllegalArgumentException("numEntries < minEntries!"); } if(numEntries <= maxEntries) { return numEntries; } else if(numEntries < maxEntries + minEntries) { return (numEntries - minEntries); } else { return maxEntries; } }
java
protected int chooseBulkSplitPoint(int numEntries, int minEntries, int maxEntries) { if(numEntries < minEntries) { throw new IllegalArgumentException("numEntries < minEntries!"); } if(numEntries <= maxEntries) { return numEntries; } else if(numEntries < maxEntries + minEntries) { return (numEntries - minEntries); } else { return maxEntries; } }
[ "protected", "int", "chooseBulkSplitPoint", "(", "int", "numEntries", ",", "int", "minEntries", ",", "int", "maxEntries", ")", "{", "if", "(", "numEntries", "<", "minEntries", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"numEntries < minEntries!\"",...
Computes and returns the best split point. @param numEntries the number of entries to be split @param minEntries the number of minimum entries in the node to be split @param maxEntries number of maximum entries in the node to be split @return the best split point
[ "Computes", "and", "returns", "the", "best", "split", "point", "." ]
train
https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki-index-rtree/src/main/java/de/lmu/ifi/dbs/elki/index/tree/spatial/rstarvariants/strategies/bulk/AbstractBulkSplit.java#L47-L61
alkacon/opencms-core
src/org/opencms/jsp/util/CmsJspContentLoadBean.java
CmsJspContentLoadBean.convertResourceList
public static List<CmsJspContentAccessBean> convertResourceList(CmsObject cms, List<CmsResource> resources) { """ Converts a list of {@link CmsResource} objects to a list of {@link CmsJspContentAccessBean} objects, using the current request context locale.<p> @param cms the current OpenCms user context @param resources a list of of {@link CmsResource} objects that should be converted @return a list of {@link CmsJspContentAccessBean} objects created from the given {@link CmsResource} objects """ return convertResourceList(cms, cms.getRequestContext().getLocale(), resources); }
java
public static List<CmsJspContentAccessBean> convertResourceList(CmsObject cms, List<CmsResource> resources) { return convertResourceList(cms, cms.getRequestContext().getLocale(), resources); }
[ "public", "static", "List", "<", "CmsJspContentAccessBean", ">", "convertResourceList", "(", "CmsObject", "cms", ",", "List", "<", "CmsResource", ">", "resources", ")", "{", "return", "convertResourceList", "(", "cms", ",", "cms", ".", "getRequestContext", "(", ...
Converts a list of {@link CmsResource} objects to a list of {@link CmsJspContentAccessBean} objects, using the current request context locale.<p> @param cms the current OpenCms user context @param resources a list of of {@link CmsResource} objects that should be converted @return a list of {@link CmsJspContentAccessBean} objects created from the given {@link CmsResource} objects
[ "Converts", "a", "list", "of", "{", "@link", "CmsResource", "}", "objects", "to", "a", "list", "of", "{", "@link", "CmsJspContentAccessBean", "}", "objects", "using", "the", "current", "request", "context", "locale", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/jsp/util/CmsJspContentLoadBean.java#L103-L106
m-m-m/util
cli/src/main/java/net/sf/mmm/util/cli/base/CliClassContainer.java
CliClassContainer.addMode
protected void addMode(CliModeContainer mode) { """ This method adds the given {@link CliMode}. @param mode is the {@link CliMode} to add. """ CliModeObject old = this.id2ModeMap.put(mode.getId(), mode); if (old != null) { CliStyleHandling handling = this.cliStyle.modeDuplicated(); DuplicateObjectException exception = new DuplicateObjectException(mode, mode.getMode().id()); if (handling != CliStyleHandling.OK) { handling.handle(LOG, exception); } } }
java
protected void addMode(CliModeContainer mode) { CliModeObject old = this.id2ModeMap.put(mode.getId(), mode); if (old != null) { CliStyleHandling handling = this.cliStyle.modeDuplicated(); DuplicateObjectException exception = new DuplicateObjectException(mode, mode.getMode().id()); if (handling != CliStyleHandling.OK) { handling.handle(LOG, exception); } } }
[ "protected", "void", "addMode", "(", "CliModeContainer", "mode", ")", "{", "CliModeObject", "old", "=", "this", ".", "id2ModeMap", ".", "put", "(", "mode", ".", "getId", "(", ")", ",", "mode", ")", ";", "if", "(", "old", "!=", "null", ")", "{", "CliS...
This method adds the given {@link CliMode}. @param mode is the {@link CliMode} to add.
[ "This", "method", "adds", "the", "given", "{", "@link", "CliMode", "}", "." ]
train
https://github.com/m-m-m/util/blob/f0e4e084448f8dfc83ca682a9e1618034a094ce6/cli/src/main/java/net/sf/mmm/util/cli/base/CliClassContainer.java#L169-L179
apache/flink
flink-streaming-java/src/main/java/org/apache/flink/streaming/api/environment/StreamExecutionEnvironment.java
StreamExecutionEnvironment.createRemoteEnvironment
public static StreamExecutionEnvironment createRemoteEnvironment( String host, int port, Configuration clientConfig, String... jarFiles) { """ Creates a {@link RemoteStreamEnvironment}. The remote environment sends (parts of) the program to a cluster for execution. Note that all file paths used in the program must be accessible from the cluster. The execution will use the specified parallelism. @param host The host name or address of the master (JobManager), where the program should be executed. @param port The port of the master (JobManager), where the program should be executed. @param clientConfig The configuration used by the client that connects to the remote cluster. @param jarFiles The JAR files with code that needs to be shipped to the cluster. If the program uses user-defined functions, user-defined input formats, or any libraries, those must be provided in the JAR files. @return A remote environment that executes the program on a cluster. """ return new RemoteStreamEnvironment(host, port, clientConfig, jarFiles); }
java
public static StreamExecutionEnvironment createRemoteEnvironment( String host, int port, Configuration clientConfig, String... jarFiles) { return new RemoteStreamEnvironment(host, port, clientConfig, jarFiles); }
[ "public", "static", "StreamExecutionEnvironment", "createRemoteEnvironment", "(", "String", "host", ",", "int", "port", ",", "Configuration", "clientConfig", ",", "String", "...", "jarFiles", ")", "{", "return", "new", "RemoteStreamEnvironment", "(", "host", ",", "p...
Creates a {@link RemoteStreamEnvironment}. The remote environment sends (parts of) the program to a cluster for execution. Note that all file paths used in the program must be accessible from the cluster. The execution will use the specified parallelism. @param host The host name or address of the master (JobManager), where the program should be executed. @param port The port of the master (JobManager), where the program should be executed. @param clientConfig The configuration used by the client that connects to the remote cluster. @param jarFiles The JAR files with code that needs to be shipped to the cluster. If the program uses user-defined functions, user-defined input formats, or any libraries, those must be provided in the JAR files. @return A remote environment that executes the program on a cluster.
[ "Creates", "a", "{", "@link", "RemoteStreamEnvironment", "}", ".", "The", "remote", "environment", "sends", "(", "parts", "of", ")", "the", "program", "to", "a", "cluster", "for", "execution", ".", "Note", "that", "all", "file", "paths", "used", "in", "the...
train
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/environment/StreamExecutionEnvironment.java#L1736-L1739
RestComm/media-core
stun/src/main/java/org/restcomm/media/core/stun/messages/attributes/general/MessageIntegrityAttribute.java
MessageIntegrityAttribute.calculateHmacSha1
public static byte[] calculateHmacSha1(byte[] message, int offset, int length, byte[] key) throws IllegalArgumentException { """ Encodes <tt>message</tt> using <tt>key</tt> and the HMAC-SHA1 algorithm as per RFC 2104 and returns the resulting byte array. This is a utility method that generates content for the {@link MessageIntegrityAttribute} regardless of the credentials being used (short or long term). @param message the STUN message that the resulting content will need to travel in. @param offset the index where data starts in <tt>message</tt>. @param length the length of the data in <tt>message</tt> that the method should consider. @param key the key that we should be using for the encoding (which depends on whether we are using short or long term credentials). @return the HMAC that should be used in a <tt>MessageIntegrityAttribute</tt> transported by <tt>message</tt>. @throws IllegalArgumentException if the encoding fails for some reason. """ try { // get an HMAC-SHA1 key from the raw key bytes SecretKeySpec signingKey = new SecretKeySpec(key, HMAC_SHA1_ALGORITHM); // get an HMAC-SHA1 Mac instance and initialize it with the key Mac mac = Mac.getInstance(HMAC_SHA1_ALGORITHM); mac.init(signingKey); // compute the hmac on input data bytes byte[] macInput = new byte[length]; System.arraycopy(message, offset, macInput, 0, length); return mac.doFinal(macInput); } catch (Exception exc) { throw new IllegalArgumentException("Could not create HMAC-SHA1 request encoding", exc); } }
java
public static byte[] calculateHmacSha1(byte[] message, int offset, int length, byte[] key) throws IllegalArgumentException { try { // get an HMAC-SHA1 key from the raw key bytes SecretKeySpec signingKey = new SecretKeySpec(key, HMAC_SHA1_ALGORITHM); // get an HMAC-SHA1 Mac instance and initialize it with the key Mac mac = Mac.getInstance(HMAC_SHA1_ALGORITHM); mac.init(signingKey); // compute the hmac on input data bytes byte[] macInput = new byte[length]; System.arraycopy(message, offset, macInput, 0, length); return mac.doFinal(macInput); } catch (Exception exc) { throw new IllegalArgumentException("Could not create HMAC-SHA1 request encoding", exc); } }
[ "public", "static", "byte", "[", "]", "calculateHmacSha1", "(", "byte", "[", "]", "message", ",", "int", "offset", ",", "int", "length", ",", "byte", "[", "]", "key", ")", "throws", "IllegalArgumentException", "{", "try", "{", "// get an HMAC-SHA1 key from the...
Encodes <tt>message</tt> using <tt>key</tt> and the HMAC-SHA1 algorithm as per RFC 2104 and returns the resulting byte array. This is a utility method that generates content for the {@link MessageIntegrityAttribute} regardless of the credentials being used (short or long term). @param message the STUN message that the resulting content will need to travel in. @param offset the index where data starts in <tt>message</tt>. @param length the length of the data in <tt>message</tt> that the method should consider. @param key the key that we should be using for the encoding (which depends on whether we are using short or long term credentials). @return the HMAC that should be used in a <tt>MessageIntegrityAttribute</tt> transported by <tt>message</tt>. @throws IllegalArgumentException if the encoding fails for some reason.
[ "Encodes", "<tt", ">", "message<", "/", "tt", ">", "using", "<tt", ">", "key<", "/", "tt", ">", "and", "the", "HMAC", "-", "SHA1", "algorithm", "as", "per", "RFC", "2104", "and", "returns", "the", "resulting", "byte", "array", ".", "This", "is", "a",...
train
https://github.com/RestComm/media-core/blob/07b8703343708599f60af66bae62aded77ee81b5/stun/src/main/java/org/restcomm/media/core/stun/messages/attributes/general/MessageIntegrityAttribute.java#L171-L187
Mozu/mozu-java
mozu-java-core/src/main/java/com/mozu/api/urls/commerce/checkouts/DestinationUrl.java
DestinationUrl.getDestinationUrl
public static MozuUrl getDestinationUrl(String checkoutId, String destinationId, String responseFields) { """ Get Resource Url for GetDestination @param checkoutId The unique identifier of the checkout. @param destinationId The unique identifier of the destination. @param responseFields Filtering syntax appended to an API call to increase or decrease the amount of data returned inside a JSON object. This parameter should only be used to retrieve data. Attempting to update data using this parameter may cause data loss. @return String Resource Url """ UrlFormatter formatter = new UrlFormatter("/api/commerce/checkouts/{checkoutId}/destinations/{destinationId}?responseFields={responseFields}"); formatter.formatUrl("checkoutId", checkoutId); formatter.formatUrl("destinationId", destinationId); formatter.formatUrl("responseFields", responseFields); return new MozuUrl(formatter.getResourceUrl(), MozuUrl.UrlLocation.TENANT_POD) ; }
java
public static MozuUrl getDestinationUrl(String checkoutId, String destinationId, String responseFields) { UrlFormatter formatter = new UrlFormatter("/api/commerce/checkouts/{checkoutId}/destinations/{destinationId}?responseFields={responseFields}"); formatter.formatUrl("checkoutId", checkoutId); formatter.formatUrl("destinationId", destinationId); formatter.formatUrl("responseFields", responseFields); return new MozuUrl(formatter.getResourceUrl(), MozuUrl.UrlLocation.TENANT_POD) ; }
[ "public", "static", "MozuUrl", "getDestinationUrl", "(", "String", "checkoutId", ",", "String", "destinationId", ",", "String", "responseFields", ")", "{", "UrlFormatter", "formatter", "=", "new", "UrlFormatter", "(", "\"/api/commerce/checkouts/{checkoutId}/destinations/{de...
Get Resource Url for GetDestination @param checkoutId The unique identifier of the checkout. @param destinationId The unique identifier of the destination. @param responseFields Filtering syntax appended to an API call to increase or decrease the amount of data returned inside a JSON object. This parameter should only be used to retrieve data. Attempting to update data using this parameter may cause data loss. @return String Resource Url
[ "Get", "Resource", "Url", "for", "GetDestination" ]
train
https://github.com/Mozu/mozu-java/blob/5beadde73601a859f845e3e2fc1077b39c8bea83/mozu-java-core/src/main/java/com/mozu/api/urls/commerce/checkouts/DestinationUrl.java#L35-L42
atomix/copycat
server/src/main/java/io/atomix/copycat/server/storage/SegmentManager.java
SegmentManager.replaceSegments
public synchronized void replaceSegments(Collection<Segment> segments, Segment segment) { """ Inserts a segment. @param segment The segment to insert. @throws IllegalStateException if the segment is unknown """ // Update the segment descriptor and lock the segment. segment.descriptor().update(System.currentTimeMillis()); segment.descriptor().lock(); // Iterate through old segments and remove them from the segments list. for (Segment oldSegment : segments) { if (!this.segments.containsKey(oldSegment.index())) { throw new IllegalArgumentException("unknown segment at index: " + oldSegment.index()); } this.segments.remove(oldSegment.index()); } // Put the new segment in the segments list. this.segments.put(segment.index(), segment); resetCurrentSegment(); }
java
public synchronized void replaceSegments(Collection<Segment> segments, Segment segment) { // Update the segment descriptor and lock the segment. segment.descriptor().update(System.currentTimeMillis()); segment.descriptor().lock(); // Iterate through old segments and remove them from the segments list. for (Segment oldSegment : segments) { if (!this.segments.containsKey(oldSegment.index())) { throw new IllegalArgumentException("unknown segment at index: " + oldSegment.index()); } this.segments.remove(oldSegment.index()); } // Put the new segment in the segments list. this.segments.put(segment.index(), segment); resetCurrentSegment(); }
[ "public", "synchronized", "void", "replaceSegments", "(", "Collection", "<", "Segment", ">", "segments", ",", "Segment", "segment", ")", "{", "// Update the segment descriptor and lock the segment.", "segment", ".", "descriptor", "(", ")", ".", "update", "(", "System"...
Inserts a segment. @param segment The segment to insert. @throws IllegalStateException if the segment is unknown
[ "Inserts", "a", "segment", "." ]
train
https://github.com/atomix/copycat/blob/c90b88ccd5c63d6ea0b49fb77c25e2f3272a7b10/server/src/main/java/io/atomix/copycat/server/storage/SegmentManager.java#L264-L281
Azure/azure-sdk-for-java
appservice/resource-manager/v2016_09_01/src/main/java/com/microsoft/azure/management/appservice/v2016_09_01/implementation/AppServicePlansInner.java
AppServicePlansInner.getRouteForVnet
public List<VnetRouteInner> getRouteForVnet(String resourceGroupName, String name, String vnetName, String routeName) { """ Get a Virtual Network route in an App Service plan. Get a Virtual Network route in an App Service plan. @param resourceGroupName Name of the resource group to which the resource belongs. @param name Name of the App Service plan. @param vnetName Name of the Virtual Network. @param routeName Name of the Virtual Network route. @throws IllegalArgumentException thrown if parameters fail the validation @throws CloudException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent @return the List&lt;VnetRouteInner&gt; object if successful. """ return getRouteForVnetWithServiceResponseAsync(resourceGroupName, name, vnetName, routeName).toBlocking().single().body(); }
java
public List<VnetRouteInner> getRouteForVnet(String resourceGroupName, String name, String vnetName, String routeName) { return getRouteForVnetWithServiceResponseAsync(resourceGroupName, name, vnetName, routeName).toBlocking().single().body(); }
[ "public", "List", "<", "VnetRouteInner", ">", "getRouteForVnet", "(", "String", "resourceGroupName", ",", "String", "name", ",", "String", "vnetName", ",", "String", "routeName", ")", "{", "return", "getRouteForVnetWithServiceResponseAsync", "(", "resourceGroupName", ...
Get a Virtual Network route in an App Service plan. Get a Virtual Network route in an App Service plan. @param resourceGroupName Name of the resource group to which the resource belongs. @param name Name of the App Service plan. @param vnetName Name of the Virtual Network. @param routeName Name of the Virtual Network route. @throws IllegalArgumentException thrown if parameters fail the validation @throws CloudException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent @return the List&lt;VnetRouteInner&gt; object if successful.
[ "Get", "a", "Virtual", "Network", "route", "in", "an", "App", "Service", "plan", ".", "Get", "a", "Virtual", "Network", "route", "in", "an", "App", "Service", "plan", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/appservice/resource-manager/v2016_09_01/src/main/java/com/microsoft/azure/management/appservice/v2016_09_01/implementation/AppServicePlansInner.java#L3487-L3489
looly/hutool
hutool-json/src/main/java/cn/hutool/json/JSONGetter.java
JSONGetter.getBean
public <T> T getBean(K key, Class<T> beanType) { """ 从JSON中直接获取Bean对象<br> 先获取JSONObject对象,然后转为Bean对象 @param <T> Bean类型 @param key KEY @param beanType Bean类型 @return Bean对象,如果值为null或者非JSONObject类型,返回null @since 3.1.1 """ final JSONObject obj = getJSONObject(key); return (null == obj) ? null : obj.toBean(beanType); }
java
public <T> T getBean(K key, Class<T> beanType) { final JSONObject obj = getJSONObject(key); return (null == obj) ? null : obj.toBean(beanType); }
[ "public", "<", "T", ">", "T", "getBean", "(", "K", "key", ",", "Class", "<", "T", ">", "beanType", ")", "{", "final", "JSONObject", "obj", "=", "getJSONObject", "(", "key", ")", ";", "return", "(", "null", "==", "obj", ")", "?", "null", ":", "obj...
从JSON中直接获取Bean对象<br> 先获取JSONObject对象,然后转为Bean对象 @param <T> Bean类型 @param key KEY @param beanType Bean类型 @return Bean对象,如果值为null或者非JSONObject类型,返回null @since 3.1.1
[ "从JSON中直接获取Bean对象<br", ">", "先获取JSONObject对象,然后转为Bean对象" ]
train
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-json/src/main/java/cn/hutool/json/JSONGetter.java#L95-L98
Azure/azure-sdk-for-java
network/resource-manager/v2018_07_01/src/main/java/com/microsoft/azure/management/network/v2018_07_01/implementation/VirtualWANsInner.java
VirtualWANsInner.beginDelete
public void beginDelete(String resourceGroupName, String virtualWANName) { """ Deletes a VirtualWAN. @param resourceGroupName The resource group name of the VirtualWan. @param virtualWANName The name of the VirtualWAN being deleted. @throws IllegalArgumentException thrown if parameters fail the validation @throws ErrorException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent """ beginDeleteWithServiceResponseAsync(resourceGroupName, virtualWANName).toBlocking().single().body(); }
java
public void beginDelete(String resourceGroupName, String virtualWANName) { beginDeleteWithServiceResponseAsync(resourceGroupName, virtualWANName).toBlocking().single().body(); }
[ "public", "void", "beginDelete", "(", "String", "resourceGroupName", ",", "String", "virtualWANName", ")", "{", "beginDeleteWithServiceResponseAsync", "(", "resourceGroupName", ",", "virtualWANName", ")", ".", "toBlocking", "(", ")", ".", "single", "(", ")", ".", ...
Deletes a VirtualWAN. @param resourceGroupName The resource group name of the VirtualWan. @param virtualWANName The name of the VirtualWAN being deleted. @throws IllegalArgumentException thrown if parameters fail the validation @throws ErrorException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
[ "Deletes", "a", "VirtualWAN", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/network/resource-manager/v2018_07_01/src/main/java/com/microsoft/azure/management/network/v2018_07_01/implementation/VirtualWANsInner.java#L758-L760
jronrun/benayn
benayn-ustyle/src/main/java/com/benayn/ustyle/thirdparty/Retryer.java
Retryer.randomWait
public Retryer<R> randomWait(final long minimum, final long maximum) { """ Sets the wait strategy that sleeps a random amount milliseconds before retrying @param minimum @param maximum @return """ checkArgument(minimum >= 0, "minimum must be >= 0 but is %d", minimum); checkArgument(maximum > minimum, "maximum must be > minimum but maximum is %d and minimum is", maximum, minimum); final Random random = new Random(); return withWaitStrategy(new WaitStrategy() { @Override public long computeSleepTime(int previousAttemptNumber, long delaySinceFirstAttemptInMillis) { long t = Math.abs(random.nextLong()) % (maximum - minimum); return t + minimum; } }); }
java
public Retryer<R> randomWait(final long minimum, final long maximum) { checkArgument(minimum >= 0, "minimum must be >= 0 but is %d", minimum); checkArgument(maximum > minimum, "maximum must be > minimum but maximum is %d and minimum is", maximum, minimum); final Random random = new Random(); return withWaitStrategy(new WaitStrategy() { @Override public long computeSleepTime(int previousAttemptNumber, long delaySinceFirstAttemptInMillis) { long t = Math.abs(random.nextLong()) % (maximum - minimum); return t + minimum; } }); }
[ "public", "Retryer", "<", "R", ">", "randomWait", "(", "final", "long", "minimum", ",", "final", "long", "maximum", ")", "{", "checkArgument", "(", "minimum", ">=", "0", ",", "\"minimum must be >= 0 but is %d\"", ",", "minimum", ")", ";", "checkArgument", "(",...
Sets the wait strategy that sleeps a random amount milliseconds before retrying @param minimum @param maximum @return
[ "Sets", "the", "wait", "strategy", "that", "sleeps", "a", "random", "amount", "milliseconds", "before", "retrying" ]
train
https://github.com/jronrun/benayn/blob/7585152e10e4cac07b4274c65f1c72ad7061ae69/benayn-ustyle/src/main/java/com/benayn/ustyle/thirdparty/Retryer.java#L414-L425
prolificinteractive/material-calendarview
library/src/main/java/com/prolificinteractive/materialcalendarview/MaterialCalendarView.java
MaterialCalendarView.dispatchOnDateSelected
protected void dispatchOnDateSelected(final CalendarDay day, final boolean selected) { """ Dispatch date change events to a listener, if set @param day the day that was selected @param selected true if the day is now currently selected, false otherwise """ if (listener != null) { listener.onDateSelected(MaterialCalendarView.this, day, selected); } }
java
protected void dispatchOnDateSelected(final CalendarDay day, final boolean selected) { if (listener != null) { listener.onDateSelected(MaterialCalendarView.this, day, selected); } }
[ "protected", "void", "dispatchOnDateSelected", "(", "final", "CalendarDay", "day", ",", "final", "boolean", "selected", ")", "{", "if", "(", "listener", "!=", "null", ")", "{", "listener", ".", "onDateSelected", "(", "MaterialCalendarView", ".", "this", ",", "...
Dispatch date change events to a listener, if set @param day the day that was selected @param selected true if the day is now currently selected, false otherwise
[ "Dispatch", "date", "change", "events", "to", "a", "listener", "if", "set" ]
train
https://github.com/prolificinteractive/material-calendarview/blob/04fae8175fd034d0a7131f8cb253cae883a88aa2/library/src/main/java/com/prolificinteractive/materialcalendarview/MaterialCalendarView.java#L1362-L1366
openbase/jul
processing/xml/src/main/java/org/openbase/jul/processing/xml/processing/XMLProcessor.java
XMLProcessor.existenceCheck
public void existenceCheck(final Nodes nodes, final String nodeNameForDebugging) throws XMLParsingException { """ Does nothing if nodes contains at least one node. Throws InvalidCfgDocException otherwise. @param nodes @param nodeNameForDebugging @throws XMLParsingException """ if (nodes.size() == 0) { throw new XMLParsingException("Message doesn't contain a " + nodeNameForDebugging + "node!"); } }
java
public void existenceCheck(final Nodes nodes, final String nodeNameForDebugging) throws XMLParsingException { if (nodes.size() == 0) { throw new XMLParsingException("Message doesn't contain a " + nodeNameForDebugging + "node!"); } }
[ "public", "void", "existenceCheck", "(", "final", "Nodes", "nodes", ",", "final", "String", "nodeNameForDebugging", ")", "throws", "XMLParsingException", "{", "if", "(", "nodes", ".", "size", "(", ")", "==", "0", ")", "{", "throw", "new", "XMLParsingException"...
Does nothing if nodes contains at least one node. Throws InvalidCfgDocException otherwise. @param nodes @param nodeNameForDebugging @throws XMLParsingException
[ "Does", "nothing", "if", "nodes", "contains", "at", "least", "one", "node", ".", "Throws", "InvalidCfgDocException", "otherwise", "." ]
train
https://github.com/openbase/jul/blob/662e98c3a853085e475be54c3be3deb72193c72d/processing/xml/src/main/java/org/openbase/jul/processing/xml/processing/XMLProcessor.java#L326-L330
rey5137/material
material/src/main/java/com/rey/material/app/ThemeManager.java
ThemeManager.getStyleId
public static int getStyleId(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) { """ Get the styleId from attributes. @param context @param attrs @param defStyleAttr @param defStyleRes @return The styleId. """ TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.ThemableView, defStyleAttr, defStyleRes); int styleId = a.getResourceId(R.styleable.ThemableView_v_styleId, 0); a.recycle(); return styleId; }
java
public static int getStyleId(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes){ TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.ThemableView, defStyleAttr, defStyleRes); int styleId = a.getResourceId(R.styleable.ThemableView_v_styleId, 0); a.recycle(); return styleId; }
[ "public", "static", "int", "getStyleId", "(", "Context", "context", ",", "AttributeSet", "attrs", ",", "int", "defStyleAttr", ",", "int", "defStyleRes", ")", "{", "TypedArray", "a", "=", "context", ".", "obtainStyledAttributes", "(", "attrs", ",", "R", ".", ...
Get the styleId from attributes. @param context @param attrs @param defStyleAttr @param defStyleRes @return The styleId.
[ "Get", "the", "styleId", "from", "attributes", "." ]
train
https://github.com/rey5137/material/blob/1bbcac2686a0023ef7720d3fe455bb116d115af8/material/src/main/java/com/rey/material/app/ThemeManager.java#L45-L51
geomajas/geomajas-project-client-gwt
client/src/main/java/org/geomajas/gwt/client/spatial/Bbox.java
Bbox.getCoordinates
public Coordinate[] getCoordinates() { """ Get the coordinates of the bounding box as an array. @return Returns 5 coordinates so that the array is closed. This can be useful when using this array to creating a <code>LinearRing</code>. """ Coordinate[] result = new Coordinate[5]; result[0] = new Coordinate(x, y); result[1] = new Coordinate(x + width, y); result[2] = new Coordinate(x + width, y + height); result[3] = new Coordinate(x, y + height); result[4] = new Coordinate(x, y); return result; }
java
public Coordinate[] getCoordinates() { Coordinate[] result = new Coordinate[5]; result[0] = new Coordinate(x, y); result[1] = new Coordinate(x + width, y); result[2] = new Coordinate(x + width, y + height); result[3] = new Coordinate(x, y + height); result[4] = new Coordinate(x, y); return result; }
[ "public", "Coordinate", "[", "]", "getCoordinates", "(", ")", "{", "Coordinate", "[", "]", "result", "=", "new", "Coordinate", "[", "5", "]", ";", "result", "[", "0", "]", "=", "new", "Coordinate", "(", "x", ",", "y", ")", ";", "result", "[", "1", ...
Get the coordinates of the bounding box as an array. @return Returns 5 coordinates so that the array is closed. This can be useful when using this array to creating a <code>LinearRing</code>.
[ "Get", "the", "coordinates", "of", "the", "bounding", "box", "as", "an", "array", "." ]
train
https://github.com/geomajas/geomajas-project-client-gwt/blob/1c1adc48deb192ed825265eebcc74d70bbf45670/client/src/main/java/org/geomajas/gwt/client/spatial/Bbox.java#L162-L171
PeterisP/LVTagger
src/main/java/edu/stanford/nlp/util/PropertiesUtils.java
PropertiesUtils.getInt
public static int getInt(Properties props, String key, int defaultValue) { """ Load an integer property. If the key is not present, returns defaultValue. """ String value = props.getProperty(key); if (value != null) { return Integer.parseInt(value); } else { return defaultValue; } }
java
public static int getInt(Properties props, String key, int defaultValue) { String value = props.getProperty(key); if (value != null) { return Integer.parseInt(value); } else { return defaultValue; } }
[ "public", "static", "int", "getInt", "(", "Properties", "props", ",", "String", "key", ",", "int", "defaultValue", ")", "{", "String", "value", "=", "props", ".", "getProperty", "(", "key", ")", ";", "if", "(", "value", "!=", "null", ")", "{", "return"...
Load an integer property. If the key is not present, returns defaultValue.
[ "Load", "an", "integer", "property", ".", "If", "the", "key", "is", "not", "present", "returns", "defaultValue", "." ]
train
https://github.com/PeterisP/LVTagger/blob/b3d44bab9ec07ace0d13612c448a6b7298c1f681/src/main/java/edu/stanford/nlp/util/PropertiesUtils.java#L129-L136
opendatatrentino/s-match
src/main/java/it/unitn/disi/smatch/matchers/element/gloss/BasicGlossMatcher.java
BasicGlossMatcher.getExtendedGloss
public String getExtendedGloss(ISense original, int intSource, char Rel) throws LinguisticOracleException { """ Gets extended gloss i.e. the gloss of parents or children. <br> The direction and depth is according to requirement. @param original the original gloss of input string @param intSource how much depth the gloss should be taken @param Rel for less than relation get child gloss and vice versa @return the extended gloss @throws LinguisticOracleException LinguisticOracleException """ List<ISense> children = new ArrayList<ISense>(); StringBuilder result = new StringBuilder(); if (Rel == IMappingElement.LESS_GENERAL) { children = original.getChildren(intSource); } else if (Rel == IMappingElement.MORE_GENERAL) { children = original.getParents(intSource); } for (ISense ISense : children) { String gloss = ISense.getGloss(); result.append(gloss).append("."); } return result.toString(); }
java
public String getExtendedGloss(ISense original, int intSource, char Rel) throws LinguisticOracleException { List<ISense> children = new ArrayList<ISense>(); StringBuilder result = new StringBuilder(); if (Rel == IMappingElement.LESS_GENERAL) { children = original.getChildren(intSource); } else if (Rel == IMappingElement.MORE_GENERAL) { children = original.getParents(intSource); } for (ISense ISense : children) { String gloss = ISense.getGloss(); result.append(gloss).append("."); } return result.toString(); }
[ "public", "String", "getExtendedGloss", "(", "ISense", "original", ",", "int", "intSource", ",", "char", "Rel", ")", "throws", "LinguisticOracleException", "{", "List", "<", "ISense", ">", "children", "=", "new", "ArrayList", "<", "ISense", ">", "(", ")", ";...
Gets extended gloss i.e. the gloss of parents or children. <br> The direction and depth is according to requirement. @param original the original gloss of input string @param intSource how much depth the gloss should be taken @param Rel for less than relation get child gloss and vice versa @return the extended gloss @throws LinguisticOracleException LinguisticOracleException
[ "Gets", "extended", "gloss", "i", ".", "e", ".", "the", "gloss", "of", "parents", "or", "children", ".", "<br", ">", "The", "direction", "and", "depth", "is", "according", "to", "requirement", "." ]
train
https://github.com/opendatatrentino/s-match/blob/ba5982ef406b7010c2f92592e43887a485935aa1/src/main/java/it/unitn/disi/smatch/matchers/element/gloss/BasicGlossMatcher.java#L194-L207
graknlabs/grakn
server/src/server/kb/concept/ElementFactory.java
ElementFactory.addVertexElementWithEdgeIdProperty
public VertexElement addVertexElementWithEdgeIdProperty(Schema.BaseType baseType, ConceptId conceptId) { """ Creates a new Vertex in the graph and builds a VertexElement which wraps the newly created vertex @param baseType The Schema.BaseType @param conceptId the ConceptId to set as the new ConceptId @return a new VertexElement NB: this is only called when we reify an EdgeRelation - we want to preserve the ID property of the concept """ Objects.requireNonNull(conceptId); Vertex vertex = graph.addVertex(baseType.name()); long start = System.currentTimeMillis(); vertex.property(Schema.VertexProperty.EDGE_RELATION_ID.name(), conceptId.getValue()); assignVertexIdPropertyTime += System.currentTimeMillis() - start; return new VertexElement(tx, vertex); }
java
public VertexElement addVertexElementWithEdgeIdProperty(Schema.BaseType baseType, ConceptId conceptId) { Objects.requireNonNull(conceptId); Vertex vertex = graph.addVertex(baseType.name()); long start = System.currentTimeMillis(); vertex.property(Schema.VertexProperty.EDGE_RELATION_ID.name(), conceptId.getValue()); assignVertexIdPropertyTime += System.currentTimeMillis() - start; return new VertexElement(tx, vertex); }
[ "public", "VertexElement", "addVertexElementWithEdgeIdProperty", "(", "Schema", ".", "BaseType", "baseType", ",", "ConceptId", "conceptId", ")", "{", "Objects", ".", "requireNonNull", "(", "conceptId", ")", ";", "Vertex", "vertex", "=", "graph", ".", "addVertex", ...
Creates a new Vertex in the graph and builds a VertexElement which wraps the newly created vertex @param baseType The Schema.BaseType @param conceptId the ConceptId to set as the new ConceptId @return a new VertexElement NB: this is only called when we reify an EdgeRelation - we want to preserve the ID property of the concept
[ "Creates", "a", "new", "Vertex", "in", "the", "graph", "and", "builds", "a", "VertexElement", "which", "wraps", "the", "newly", "created", "vertex", "@param", "baseType", "The", "Schema", ".", "BaseType", "@param", "conceptId", "the", "ConceptId", "to", "set",...
train
https://github.com/graknlabs/grakn/blob/6aaee75ea846202474d591f8809d62028262fac5/server/src/server/kb/concept/ElementFactory.java#L322-L329
liferay/com-liferay-commerce
commerce-service/src/main/java/com/liferay/commerce/service/persistence/impl/CommerceSubscriptionEntryPersistenceImpl.java
CommerceSubscriptionEntryPersistenceImpl.findByG_U
@Override public List<CommerceSubscriptionEntry> findByG_U(long groupId, long userId, int start, int end) { """ Returns a range of all the commerce subscription entries where groupId = &#63; and userId = &#63;. <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 CommerceSubscriptionEntryModelImpl}. 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 groupId the group ID @param userId the user ID @param start the lower bound of the range of commerce subscription entries @param end the upper bound of the range of commerce subscription entries (not inclusive) @return the range of matching commerce subscription entries """ return findByG_U(groupId, userId, start, end, null); }
java
@Override public List<CommerceSubscriptionEntry> findByG_U(long groupId, long userId, int start, int end) { return findByG_U(groupId, userId, start, end, null); }
[ "@", "Override", "public", "List", "<", "CommerceSubscriptionEntry", ">", "findByG_U", "(", "long", "groupId", ",", "long", "userId", ",", "int", "start", ",", "int", "end", ")", "{", "return", "findByG_U", "(", "groupId", ",", "userId", ",", "start", ",",...
Returns a range of all the commerce subscription entries where groupId = &#63; and userId = &#63;. <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 CommerceSubscriptionEntryModelImpl}. 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 groupId the group ID @param userId the user ID @param start the lower bound of the range of commerce subscription entries @param end the upper bound of the range of commerce subscription entries (not inclusive) @return the range of matching commerce subscription entries
[ "Returns", "a", "range", "of", "all", "the", "commerce", "subscription", "entries", "where", "groupId", "=", "&#63", ";", "and", "userId", "=", "&#63", ";", "." ]
train
https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-service/src/main/java/com/liferay/commerce/service/persistence/impl/CommerceSubscriptionEntryPersistenceImpl.java#L2598-L2602
pf4j/pf4j
pf4j/src/main/java/org/pf4j/AbstractExtensionFinder.java
AbstractExtensionFinder.getExtensionInfo
private ExtensionInfo getExtensionInfo(String className, ClassLoader classLoader) { """ Returns the parameters of an {@link Extension} annotation without loading the corresponding class into the class loader. @param className name of the class, that holds the requested {@link Extension} annotation @param classLoader class loader to access the class @return the contents of the {@link Extension} annotation or null, if the class does not have an {@link Extension} annotation """ if (extensionInfos == null) { extensionInfos = new HashMap<>(); } if (!extensionInfos.containsKey(className)) { log.trace("Load annotation for '{}' using asm", className); ExtensionInfo info = ExtensionInfo.load(className, classLoader); if (info == null) { log.warn("No extension annotation was found for '{}'", className); extensionInfos.put(className, null); } else { extensionInfos.put(className, info); } } return extensionInfos.get(className); }
java
private ExtensionInfo getExtensionInfo(String className, ClassLoader classLoader) { if (extensionInfos == null) { extensionInfos = new HashMap<>(); } if (!extensionInfos.containsKey(className)) { log.trace("Load annotation for '{}' using asm", className); ExtensionInfo info = ExtensionInfo.load(className, classLoader); if (info == null) { log.warn("No extension annotation was found for '{}'", className); extensionInfos.put(className, null); } else { extensionInfos.put(className, info); } } return extensionInfos.get(className); }
[ "private", "ExtensionInfo", "getExtensionInfo", "(", "String", "className", ",", "ClassLoader", "classLoader", ")", "{", "if", "(", "extensionInfos", "==", "null", ")", "{", "extensionInfos", "=", "new", "HashMap", "<>", "(", ")", ";", "}", "if", "(", "!", ...
Returns the parameters of an {@link Extension} annotation without loading the corresponding class into the class loader. @param className name of the class, that holds the requested {@link Extension} annotation @param classLoader class loader to access the class @return the contents of the {@link Extension} annotation or null, if the class does not have an {@link Extension} annotation
[ "Returns", "the", "parameters", "of", "an", "{", "@link", "Extension", "}", "annotation", "without", "loading", "the", "corresponding", "class", "into", "the", "class", "loader", "." ]
train
https://github.com/pf4j/pf4j/blob/6dd7a6069f0e2fbd842c81e2c8c388918b88ea81/pf4j/src/main/java/org/pf4j/AbstractExtensionFinder.java#L323-L340
apache/groovy
src/main/java/org/codehaus/groovy/runtime/ResourceGroovyMethods.java
ResourceGroovyMethods.setText
public static void setText(File file, String text, String charset) throws IOException { """ Synonym for write(text, charset) allowing: <pre> myFile.setText('some text', charset) </pre> or with some help from <code>ExpandoMetaClass</code>, you could do something like: <pre> myFile.metaClass.setText = { String s {@code ->} delegate.setText(s, 'UTF-8') } myfile.text = 'some text' </pre> @param file A File @param charset The charset used when writing to the file @param text The text to write to the File @throws IOException if an IOException occurs. @see #write(java.io.File, java.lang.String, java.lang.String) @since 1.7.3 """ write(file, text, charset); }
java
public static void setText(File file, String text, String charset) throws IOException { write(file, text, charset); }
[ "public", "static", "void", "setText", "(", "File", "file", ",", "String", "text", ",", "String", "charset", ")", "throws", "IOException", "{", "write", "(", "file", ",", "text", ",", "charset", ")", ";", "}" ]
Synonym for write(text, charset) allowing: <pre> myFile.setText('some text', charset) </pre> or with some help from <code>ExpandoMetaClass</code>, you could do something like: <pre> myFile.metaClass.setText = { String s {@code ->} delegate.setText(s, 'UTF-8') } myfile.text = 'some text' </pre> @param file A File @param charset The charset used when writing to the file @param text The text to write to the File @throws IOException if an IOException occurs. @see #write(java.io.File, java.lang.String, java.lang.String) @since 1.7.3
[ "Synonym", "for", "write", "(", "text", "charset", ")", "allowing", ":", "<pre", ">", "myFile", ".", "setText", "(", "some", "text", "charset", ")", "<", "/", "pre", ">", "or", "with", "some", "help", "from", "<code", ">", "ExpandoMetaClass<", "/", "co...
train
https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/java/org/codehaus/groovy/runtime/ResourceGroovyMethods.java#L780-L782
belaban/JGroups
src/org/jgroups/util/NonBlockingCredit.java
NonBlockingCredit.decrementIfEnoughCredits
public boolean decrementIfEnoughCredits(final Message msg, int credits, long timeout) { """ Decrements the sender's credits by the size of the message. @param msg The message @param credits The number of bytes to decrement the credits. Is {@link Message#length()}. @param timeout Ignored @return True if the message was sent, false if it was queued """ lock.lock(); try { if(queuing) return addToQueue(msg, credits); if(decrement(credits)) return true; // enough credits, message will be sent queuing=true; // not enough credits, start queuing return addToQueue(msg, credits); } finally { lock.unlock(); } }
java
public boolean decrementIfEnoughCredits(final Message msg, int credits, long timeout) { lock.lock(); try { if(queuing) return addToQueue(msg, credits); if(decrement(credits)) return true; // enough credits, message will be sent queuing=true; // not enough credits, start queuing return addToQueue(msg, credits); } finally { lock.unlock(); } }
[ "public", "boolean", "decrementIfEnoughCredits", "(", "final", "Message", "msg", ",", "int", "credits", ",", "long", "timeout", ")", "{", "lock", ".", "lock", "(", ")", ";", "try", "{", "if", "(", "queuing", ")", "return", "addToQueue", "(", "msg", ",", ...
Decrements the sender's credits by the size of the message. @param msg The message @param credits The number of bytes to decrement the credits. Is {@link Message#length()}. @param timeout Ignored @return True if the message was sent, false if it was queued
[ "Decrements", "the", "sender", "s", "credits", "by", "the", "size", "of", "the", "message", "." ]
train
https://github.com/belaban/JGroups/blob/bd3ca786aa57fed41dfbc10a94b1281e388be03b/src/org/jgroups/util/NonBlockingCredit.java#L54-L67
threerings/narya
core/src/main/java/com/threerings/crowd/server/LocationManager.java
LocationManager.moveBody
public void moveBody (BodyObject source, Place place) { """ Forcibly moves the specified body object to the new place. This is accomplished by first removing the body from their old location and then sending the client a notification, instructing it to move to the new location (which it does using the normal moveTo service). This has the benefit that the client is removed from their old place regardless of whether or not they are cooperating. If they choose to ignore the forced move request, they will remain in limbo, unable to do much of anything. """ // first remove them from their old place leaveOccupiedPlace(source); // then send a forced move notification to the body's client LocationSender.forcedMove(source.getClientObject(), place.placeOid); }
java
public void moveBody (BodyObject source, Place place) { // first remove them from their old place leaveOccupiedPlace(source); // then send a forced move notification to the body's client LocationSender.forcedMove(source.getClientObject(), place.placeOid); }
[ "public", "void", "moveBody", "(", "BodyObject", "source", ",", "Place", "place", ")", "{", "// first remove them from their old place", "leaveOccupiedPlace", "(", "source", ")", ";", "// then send a forced move notification to the body's client", "LocationSender", ".", "forc...
Forcibly moves the specified body object to the new place. This is accomplished by first removing the body from their old location and then sending the client a notification, instructing it to move to the new location (which it does using the normal moveTo service). This has the benefit that the client is removed from their old place regardless of whether or not they are cooperating. If they choose to ignore the forced move request, they will remain in limbo, unable to do much of anything.
[ "Forcibly", "moves", "the", "specified", "body", "object", "to", "the", "new", "place", ".", "This", "is", "accomplished", "by", "first", "removing", "the", "body", "from", "their", "old", "location", "and", "then", "sending", "the", "client", "a", "notifica...
train
https://github.com/threerings/narya/blob/5b01edc8850ed0c32d004b4049e1ac4a02027ede/core/src/main/java/com/threerings/crowd/server/LocationManager.java#L176-L183
amzn/ion-java
src/com/amazon/ion/Timestamp.java
Timestamp.addMonthForPrecision
private Timestamp addMonthForPrecision(int amount, Precision precision) { """ Adds the given number of months, extending (if necessary) the resulting Timestamp to the given precision. @param amount the number of months to add. @param precision the precision that the Timestamp will be extended to, if it does not already include that precision. @return a new Timestamp. """ Calendar cal = calendarValue(); cal.add(Calendar.MONTH, amount); return new Timestamp(cal, precision, _fraction, _offset); }
java
private Timestamp addMonthForPrecision(int amount, Precision precision) { Calendar cal = calendarValue(); cal.add(Calendar.MONTH, amount); return new Timestamp(cal, precision, _fraction, _offset); }
[ "private", "Timestamp", "addMonthForPrecision", "(", "int", "amount", ",", "Precision", "precision", ")", "{", "Calendar", "cal", "=", "calendarValue", "(", ")", ";", "cal", ".", "add", "(", "Calendar", ".", "MONTH", ",", "amount", ")", ";", "return", "new...
Adds the given number of months, extending (if necessary) the resulting Timestamp to the given precision. @param amount the number of months to add. @param precision the precision that the Timestamp will be extended to, if it does not already include that precision. @return a new Timestamp.
[ "Adds", "the", "given", "number", "of", "months", "extending", "(", "if", "necessary", ")", "the", "resulting", "Timestamp", "to", "the", "given", "precision", "." ]
train
https://github.com/amzn/ion-java/blob/4ce1f0f58c6a5a8e42d0425ccdb36e38be3e2270/src/com/amazon/ion/Timestamp.java#L2480-L2484
lucee/Lucee
core/src/main/java/lucee/transformer/library/function/FunctionLibFactory.java
FunctionLibFactory.loadFromFile
public static FunctionLib loadFromFile(Resource res, Identification id) throws FunctionLibException { """ Laedt eine einzelne FunctionLib. @param res FLD die geladen werden soll. @param saxParser Definition des Sax Parser mit dem die FunctionLib eingelsesen werden soll. @return FunctionLib @throws FunctionLibException """ // Read in XML FunctionLib lib = FunctionLibFactory.hashLib.get(id(res));// getHashLib(file.getAbsolutePath()); if (lib == null) { lib = new FunctionLibFactory(null, res, id, false).getLib(); FunctionLibFactory.hashLib.put(id(res), lib); } lib.setSource(res.toString()); return lib; }
java
public static FunctionLib loadFromFile(Resource res, Identification id) throws FunctionLibException { // Read in XML FunctionLib lib = FunctionLibFactory.hashLib.get(id(res));// getHashLib(file.getAbsolutePath()); if (lib == null) { lib = new FunctionLibFactory(null, res, id, false).getLib(); FunctionLibFactory.hashLib.put(id(res), lib); } lib.setSource(res.toString()); return lib; }
[ "public", "static", "FunctionLib", "loadFromFile", "(", "Resource", "res", ",", "Identification", "id", ")", "throws", "FunctionLibException", "{", "// Read in XML", "FunctionLib", "lib", "=", "FunctionLibFactory", ".", "hashLib", ".", "get", "(", "id", "(", "res"...
Laedt eine einzelne FunctionLib. @param res FLD die geladen werden soll. @param saxParser Definition des Sax Parser mit dem die FunctionLib eingelsesen werden soll. @return FunctionLib @throws FunctionLibException
[ "Laedt", "eine", "einzelne", "FunctionLib", "." ]
train
https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/transformer/library/function/FunctionLibFactory.java#L373-L383
lessthanoptimal/BoofCV
main/boofcv-geo/src/main/java/boofcv/alg/geo/PerspectiveOps.java
PerspectiveOps.createWorldToPixel
public static WorldToCameraToPixel createWorldToPixel(LensDistortionNarrowFOV distortion , Se3_F64 worldToCamera ) { """ Creates a transform from world coordinates into pixel coordinates. can handle lens distortion """ WorldToCameraToPixel alg = new WorldToCameraToPixel(); alg.configure(distortion,worldToCamera); return alg; }
java
public static WorldToCameraToPixel createWorldToPixel(LensDistortionNarrowFOV distortion , Se3_F64 worldToCamera ) { WorldToCameraToPixel alg = new WorldToCameraToPixel(); alg.configure(distortion,worldToCamera); return alg; }
[ "public", "static", "WorldToCameraToPixel", "createWorldToPixel", "(", "LensDistortionNarrowFOV", "distortion", ",", "Se3_F64", "worldToCamera", ")", "{", "WorldToCameraToPixel", "alg", "=", "new", "WorldToCameraToPixel", "(", ")", ";", "alg", ".", "configure", "(", "...
Creates a transform from world coordinates into pixel coordinates. can handle lens distortion
[ "Creates", "a", "transform", "from", "world", "coordinates", "into", "pixel", "coordinates", ".", "can", "handle", "lens", "distortion" ]
train
https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-geo/src/main/java/boofcv/alg/geo/PerspectiveOps.java#L697-L702
alkacon/opencms-core
src-gwt/org/opencms/ade/galleries/client/CmsGalleryControllerHandler.java
CmsGalleryControllerHandler.onReceiveVfsPreloadData
public void onReceiveVfsPreloadData(CmsVfsEntryBean vfsPreloadData, Set<String> folders) { """ This method is called when preloaded VFS tree state data is loaded.<p> @param vfsPreloadData the preload data @param folders the set of selected folders """ CmsVfsTab vfsTab = m_galleryDialog.getVfsTab(); if (vfsTab != null) { vfsTab.onReceiveVfsPreloadData(vfsPreloadData); if (folders != null) { vfsTab.checkFolders(folders); } } }
java
public void onReceiveVfsPreloadData(CmsVfsEntryBean vfsPreloadData, Set<String> folders) { CmsVfsTab vfsTab = m_galleryDialog.getVfsTab(); if (vfsTab != null) { vfsTab.onReceiveVfsPreloadData(vfsPreloadData); if (folders != null) { vfsTab.checkFolders(folders); } } }
[ "public", "void", "onReceiveVfsPreloadData", "(", "CmsVfsEntryBean", "vfsPreloadData", ",", "Set", "<", "String", ">", "folders", ")", "{", "CmsVfsTab", "vfsTab", "=", "m_galleryDialog", ".", "getVfsTab", "(", ")", ";", "if", "(", "vfsTab", "!=", "null", ")", ...
This method is called when preloaded VFS tree state data is loaded.<p> @param vfsPreloadData the preload data @param folders the set of selected folders
[ "This", "method", "is", "called", "when", "preloaded", "VFS", "tree", "state", "data", "is", "loaded", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/ade/galleries/client/CmsGalleryControllerHandler.java#L318-L327
alkacon/opencms-core
src-modules/org/opencms/workplace/commons/CmsPropertyAdvanced.java
CmsPropertyAdvanced.dialogButtonsOkCancelDefine
public String dialogButtonsOkCancelDefine() { """ Builds a button row with an "Ok", a "Cancel" and a "Define" button.<p> @return the button row """ if (isEditable()) { int okButton = BUTTON_OK; if ((getParamDialogmode() != null) && getParamDialogmode().startsWith(MODE_WIZARD)) { // in wizard mode, display finish button instead of ok button okButton = BUTTON_FINISH; } return dialogButtons( new int[] {okButton, BUTTON_CANCEL, BUTTON_DEFINE}, new String[] {null, null, "onclick=\"definePropertyForm();\""}); } else { return dialogButtons(new int[] {BUTTON_CLOSE}, new String[] {null}); } }
java
public String dialogButtonsOkCancelDefine() { if (isEditable()) { int okButton = BUTTON_OK; if ((getParamDialogmode() != null) && getParamDialogmode().startsWith(MODE_WIZARD)) { // in wizard mode, display finish button instead of ok button okButton = BUTTON_FINISH; } return dialogButtons( new int[] {okButton, BUTTON_CANCEL, BUTTON_DEFINE}, new String[] {null, null, "onclick=\"definePropertyForm();\""}); } else { return dialogButtons(new int[] {BUTTON_CLOSE}, new String[] {null}); } }
[ "public", "String", "dialogButtonsOkCancelDefine", "(", ")", "{", "if", "(", "isEditable", "(", ")", ")", "{", "int", "okButton", "=", "BUTTON_OK", ";", "if", "(", "(", "getParamDialogmode", "(", ")", "!=", "null", ")", "&&", "getParamDialogmode", "(", ")"...
Builds a button row with an "Ok", a "Cancel" and a "Define" button.<p> @return the button row
[ "Builds", "a", "button", "row", "with", "an", "Ok", "a", "Cancel", "and", "a", "Define", "button", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-modules/org/opencms/workplace/commons/CmsPropertyAdvanced.java#L543-L558
mgm-tp/jfunk
jfunk-common/src/main/java/com/mgmtp/jfunk/common/random/MathRandom.java
MathRandom.getInt
public int getInt(final int min, final int max) { """ Returns a random integer number in the range of [min, max]. @param min minimum value for generated number @param max maximum value for generated number """ return min(min, max) + getInt(abs(max - min)); }
java
public int getInt(final int min, final int max) { return min(min, max) + getInt(abs(max - min)); }
[ "public", "int", "getInt", "(", "final", "int", "min", ",", "final", "int", "max", ")", "{", "return", "min", "(", "min", ",", "max", ")", "+", "getInt", "(", "abs", "(", "max", "-", "min", ")", ")", ";", "}" ]
Returns a random integer number in the range of [min, max]. @param min minimum value for generated number @param max maximum value for generated number
[ "Returns", "a", "random", "integer", "number", "in", "the", "range", "of", "[", "min", "max", "]", "." ]
train
https://github.com/mgm-tp/jfunk/blob/5b9fecac5778b988bb458085ded39ea9a4c7c2ae/jfunk-common/src/main/java/com/mgmtp/jfunk/common/random/MathRandom.java#L93-L95
DataSketches/sketches-core
src/main/java/com/yahoo/sketches/cpc/CpcCompression.java
CpcCompression.compressSlidingFlavor
private static void compressSlidingFlavor(final CompressedState target, final CpcSketch source) { """ Complicated by the existence of both a left fringe and a right fringe. """ compressTheWindow(target, source); final PairTable srcPairTable = source.pairTable; final int numPairs = srcPairTable.getNumPairs(); if (numPairs > 0) { final int[] pairs = PairTable.unwrappingGetItems(srcPairTable, numPairs); // Here we apply a complicated transformation to the column indices, which // changes the implied ordering of the pairs, so we must do it before sorting. final int pseudoPhase = determinePseudoPhase(source.lgK, source.numCoupons); // NB assert (pseudoPhase < 16); final byte[] permutation = columnPermutationsForEncoding[pseudoPhase]; final int offset = source.windowOffset; assert ((offset > 0) && (offset <= 56)); for (int i = 0; i < numPairs; i++) { final int rowCol = pairs[i]; final int row = rowCol >>> 6; int col = (rowCol & 63); // first rotate the columns into a canonical configuration: // new = ((old - (offset+8)) + 64) mod 64 col = ((col + 56) - offset) & 63; assert (col >= 0) && (col < 56); // then apply the permutation col = permutation[col]; pairs[i] = (row << 6) | col; } introspectiveInsertionSort(pairs, 0, numPairs - 1); compressTheSurprisingValues(target, source, pairs, numPairs); } }
java
private static void compressSlidingFlavor(final CompressedState target, final CpcSketch source) { compressTheWindow(target, source); final PairTable srcPairTable = source.pairTable; final int numPairs = srcPairTable.getNumPairs(); if (numPairs > 0) { final int[] pairs = PairTable.unwrappingGetItems(srcPairTable, numPairs); // Here we apply a complicated transformation to the column indices, which // changes the implied ordering of the pairs, so we must do it before sorting. final int pseudoPhase = determinePseudoPhase(source.lgK, source.numCoupons); // NB assert (pseudoPhase < 16); final byte[] permutation = columnPermutationsForEncoding[pseudoPhase]; final int offset = source.windowOffset; assert ((offset > 0) && (offset <= 56)); for (int i = 0; i < numPairs; i++) { final int rowCol = pairs[i]; final int row = rowCol >>> 6; int col = (rowCol & 63); // first rotate the columns into a canonical configuration: // new = ((old - (offset+8)) + 64) mod 64 col = ((col + 56) - offset) & 63; assert (col >= 0) && (col < 56); // then apply the permutation col = permutation[col]; pairs[i] = (row << 6) | col; } introspectiveInsertionSort(pairs, 0, numPairs - 1); compressTheSurprisingValues(target, source, pairs, numPairs); } }
[ "private", "static", "void", "compressSlidingFlavor", "(", "final", "CompressedState", "target", ",", "final", "CpcSketch", "source", ")", "{", "compressTheWindow", "(", "target", ",", "source", ")", ";", "final", "PairTable", "srcPairTable", "=", "source", ".", ...
Complicated by the existence of both a left fringe and a right fringe.
[ "Complicated", "by", "the", "existence", "of", "both", "a", "left", "fringe", "and", "a", "right", "fringe", "." ]
train
https://github.com/DataSketches/sketches-core/blob/900c8c9668a1e2f1d54d453e956caad54702e540/src/main/java/com/yahoo/sketches/cpc/CpcCompression.java#L673-L709
deeplearning4j/deeplearning4j
nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/linalg/api/ops/impl/reduce/Mmul.java
Mmul.transposeShapeArray
public long[] transposeShapeArray(long[] shape) { """ For a 2D matrix of shape (M, N) we return (N, M). For a 3D matrix with leading mini-batch dimension (mb, M, N) we return (mb, N, M) @param shape input shape array @return """ if (shape.length == 2) { return ArrayUtil.reverseCopy(shape); } else if (shape.length == 3) { return new long[] {shape[0], shape[2], shape[1]}; } else { throw new IllegalArgumentException("Matrix input has to be of length 2 or 3, got: " + shape.length ); } }
java
public long[] transposeShapeArray(long[] shape) { if (shape.length == 2) { return ArrayUtil.reverseCopy(shape); } else if (shape.length == 3) { return new long[] {shape[0], shape[2], shape[1]}; } else { throw new IllegalArgumentException("Matrix input has to be of length 2 or 3, got: " + shape.length ); } }
[ "public", "long", "[", "]", "transposeShapeArray", "(", "long", "[", "]", "shape", ")", "{", "if", "(", "shape", ".", "length", "==", "2", ")", "{", "return", "ArrayUtil", ".", "reverseCopy", "(", "shape", ")", ";", "}", "else", "if", "(", "shape", ...
For a 2D matrix of shape (M, N) we return (N, M). For a 3D matrix with leading mini-batch dimension (mb, M, N) we return (mb, N, M) @param shape input shape array @return
[ "For", "a", "2D", "matrix", "of", "shape", "(", "M", "N", ")", "we", "return", "(", "N", "M", ")", ".", "For", "a", "3D", "matrix", "with", "leading", "mini", "-", "batch", "dimension", "(", "mb", "M", "N", ")", "we", "return", "(", "mb", "N", ...
train
https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/linalg/api/ops/impl/reduce/Mmul.java#L106-L115
HadoopGenomics/Hadoop-BAM
src/main/java/org/seqdoop/hadoop_bam/util/BGZFSplitGuesser.java
BGZFSplitGuesser.guessNextBGZFBlockStart
public long guessNextBGZFBlockStart(long beg, long end) throws IOException { """ / Looks in the range [beg,end). Returns end if no BAM record was found. """ // Buffer what we need to go through. Since the max size of a BGZF block // is 0xffff (64K), and we might be just one byte off from the start of // the previous one, we need 0xfffe bytes for the start, and then 0xffff // for the block we're looking for. byte[] arr = new byte[2*0xffff - 1]; this.seekableInFile.seek(beg); int totalRead = 0; for (int left = Math.min((int)(end - beg), arr.length); left > 0;) { final int r = inFile.read(arr, totalRead, left); if (r < 0) break; totalRead += r; left -= r; } arr = Arrays.copyOf(arr, totalRead); this.in = new ByteArraySeekableStream(arr); final BlockCompressedInputStream bgzf = new BlockCompressedInputStream(this.in); bgzf.setCheckCrcs(true); final int firstBGZFEnd = Math.min((int)(end - beg), 0xffff); for (int pos = 0;;) { pos = guessNextBGZFPos(pos, firstBGZFEnd); if (pos < 0) return end; try { // Seek in order to trigger decompression of the block and a CRC // check. bgzf.seek((long)pos << 16); // This has to catch Throwable, because it's possible to get an // OutOfMemoryError due to an overly large size. } catch (Throwable e) { // Guessed BGZF position incorrectly: try the next guess. ++pos; continue; } return beg + pos; } }
java
public long guessNextBGZFBlockStart(long beg, long end) throws IOException { // Buffer what we need to go through. Since the max size of a BGZF block // is 0xffff (64K), and we might be just one byte off from the start of // the previous one, we need 0xfffe bytes for the start, and then 0xffff // for the block we're looking for. byte[] arr = new byte[2*0xffff - 1]; this.seekableInFile.seek(beg); int totalRead = 0; for (int left = Math.min((int)(end - beg), arr.length); left > 0;) { final int r = inFile.read(arr, totalRead, left); if (r < 0) break; totalRead += r; left -= r; } arr = Arrays.copyOf(arr, totalRead); this.in = new ByteArraySeekableStream(arr); final BlockCompressedInputStream bgzf = new BlockCompressedInputStream(this.in); bgzf.setCheckCrcs(true); final int firstBGZFEnd = Math.min((int)(end - beg), 0xffff); for (int pos = 0;;) { pos = guessNextBGZFPos(pos, firstBGZFEnd); if (pos < 0) return end; try { // Seek in order to trigger decompression of the block and a CRC // check. bgzf.seek((long)pos << 16); // This has to catch Throwable, because it's possible to get an // OutOfMemoryError due to an overly large size. } catch (Throwable e) { // Guessed BGZF position incorrectly: try the next guess. ++pos; continue; } return beg + pos; } }
[ "public", "long", "guessNextBGZFBlockStart", "(", "long", "beg", ",", "long", "end", ")", "throws", "IOException", "{", "// Buffer what we need to go through. Since the max size of a BGZF block", "// is 0xffff (64K), and we might be just one byte off from the start of", "// the previou...
/ Looks in the range [beg,end). Returns end if no BAM record was found.
[ "/", "Looks", "in", "the", "range", "[", "beg", "end", ")", ".", "Returns", "end", "if", "no", "BAM", "record", "was", "found", "." ]
train
https://github.com/HadoopGenomics/Hadoop-BAM/blob/9f974cf635a8d72f69604021cc3d5f3469d38d2f/src/main/java/org/seqdoop/hadoop_bam/util/BGZFSplitGuesser.java#L64-L112
netscaler/nitro
src/main/java/com/citrix/netscaler/nitro/resource/config/network/linkset_channel_binding.java
linkset_channel_binding.count_filtered
public static long count_filtered(nitro_service service, String id, String filter) throws Exception { """ Use this API to count the filtered set of linkset_channel_binding resources. filter string should be in JSON format.eg: "port:80,servicetype:HTTP". """ linkset_channel_binding obj = new linkset_channel_binding(); obj.set_id(id); options option = new options(); option.set_count(true); option.set_filter(filter); linkset_channel_binding[] response = (linkset_channel_binding[]) obj.getfiltered(service, option); if (response != null) { return response[0].__count; } return 0; }
java
public static long count_filtered(nitro_service service, String id, String filter) throws Exception{ linkset_channel_binding obj = new linkset_channel_binding(); obj.set_id(id); options option = new options(); option.set_count(true); option.set_filter(filter); linkset_channel_binding[] response = (linkset_channel_binding[]) obj.getfiltered(service, option); if (response != null) { return response[0].__count; } return 0; }
[ "public", "static", "long", "count_filtered", "(", "nitro_service", "service", ",", "String", "id", ",", "String", "filter", ")", "throws", "Exception", "{", "linkset_channel_binding", "obj", "=", "new", "linkset_channel_binding", "(", ")", ";", "obj", ".", "set...
Use this API to count the filtered set of linkset_channel_binding resources. filter string should be in JSON format.eg: "port:80,servicetype:HTTP".
[ "Use", "this", "API", "to", "count", "the", "filtered", "set", "of", "linkset_channel_binding", "resources", ".", "filter", "string", "should", "be", "in", "JSON", "format", ".", "eg", ":", "port", ":", "80", "servicetype", ":", "HTTP", "." ]
train
https://github.com/netscaler/nitro/blob/2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4/src/main/java/com/citrix/netscaler/nitro/resource/config/network/linkset_channel_binding.java#L206-L217
aws/aws-sdk-java
aws-java-sdk-opsworks/src/main/java/com/amazonaws/services/opsworks/model/WeeklyAutoScalingSchedule.java
WeeklyAutoScalingSchedule.setThursday
public void setThursday(java.util.Map<String, String> thursday) { """ <p> The schedule for Thursday. </p> @param thursday The schedule for Thursday. """ this.thursday = thursday == null ? null : new com.amazonaws.internal.SdkInternalMap<String, String>(thursday); }
java
public void setThursday(java.util.Map<String, String> thursday) { this.thursday = thursday == null ? null : new com.amazonaws.internal.SdkInternalMap<String, String>(thursday); }
[ "public", "void", "setThursday", "(", "java", ".", "util", ".", "Map", "<", "String", ",", "String", ">", "thursday", ")", "{", "this", ".", "thursday", "=", "thursday", "==", "null", "?", "null", ":", "new", "com", ".", "amazonaws", ".", "internal", ...
<p> The schedule for Thursday. </p> @param thursday The schedule for Thursday.
[ "<p", ">", "The", "schedule", "for", "Thursday", ".", "<", "/", "p", ">" ]
train
https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-opsworks/src/main/java/com/amazonaws/services/opsworks/model/WeeklyAutoScalingSchedule.java#L315-L317
algolia/instantsearch-android
ui/src/main/java/com/algolia/instantsearch/ui/views/filters/TwoValuesToggle.java
TwoValuesToggle.setValueOff
public void setValueOff(String newValue, @Nullable String newName) { """ Changes the Toggle's valueOff, updating facet refinements accordingly. @param newValue valueOff's new value. @param newName an eventual new attribute name. """ if (!isChecked()) { // refining on valueOff: facetRefinement needs an update searcher.updateFacetRefinement(attribute, valueOff, false) .updateFacetRefinement(newName != null ? newName : attribute, newValue, true) .search(); } this.valueOff = newValue; applyEventualNewAttribute(newName); }
java
public void setValueOff(String newValue, @Nullable String newName) { if (!isChecked()) { // refining on valueOff: facetRefinement needs an update searcher.updateFacetRefinement(attribute, valueOff, false) .updateFacetRefinement(newName != null ? newName : attribute, newValue, true) .search(); } this.valueOff = newValue; applyEventualNewAttribute(newName); }
[ "public", "void", "setValueOff", "(", "String", "newValue", ",", "@", "Nullable", "String", "newName", ")", "{", "if", "(", "!", "isChecked", "(", ")", ")", "{", "// refining on valueOff: facetRefinement needs an update", "searcher", ".", "updateFacetRefinement", "(...
Changes the Toggle's valueOff, updating facet refinements accordingly. @param newValue valueOff's new value. @param newName an eventual new attribute name.
[ "Changes", "the", "Toggle", "s", "valueOff", "updating", "facet", "refinements", "accordingly", "." ]
train
https://github.com/algolia/instantsearch-android/blob/12092ec30140df9ffc2bf916339b433372034616/ui/src/main/java/com/algolia/instantsearch/ui/views/filters/TwoValuesToggle.java#L76-L84
gmessner/gitlab4j-api
src/main/java/org/gitlab4j/api/UserApi.java
UserApi.addSshKey
public SshKey addSshKey(Integer userId, String title, String key) throws GitLabApiException { """ Create new key owned by specified user. Available only for admin users. <pre><code>GitLab Endpoint: POST /users/:id/keys</code></pre> @param userId the ID of the user to add the SSH key for @param title the new SSH Key's title @param key the new SSH key @return an SshKey instance with info on the added SSH key @throws GitLabApiException if any exception occurs """ if (userId == null) { throw new RuntimeException("userId cannot be null"); } GitLabApiForm formData = new GitLabApiForm().withParam("title", title).withParam("key", key); Response response = post(Response.Status.CREATED, formData, "users", userId, "keys"); SshKey sshKey = response.readEntity(SshKey.class); if (sshKey != null) { sshKey.setUserId(userId); } return (sshKey); }
java
public SshKey addSshKey(Integer userId, String title, String key) throws GitLabApiException { if (userId == null) { throw new RuntimeException("userId cannot be null"); } GitLabApiForm formData = new GitLabApiForm().withParam("title", title).withParam("key", key); Response response = post(Response.Status.CREATED, formData, "users", userId, "keys"); SshKey sshKey = response.readEntity(SshKey.class); if (sshKey != null) { sshKey.setUserId(userId); } return (sshKey); }
[ "public", "SshKey", "addSshKey", "(", "Integer", "userId", ",", "String", "title", ",", "String", "key", ")", "throws", "GitLabApiException", "{", "if", "(", "userId", "==", "null", ")", "{", "throw", "new", "RuntimeException", "(", "\"userId cannot be null\"", ...
Create new key owned by specified user. Available only for admin users. <pre><code>GitLab Endpoint: POST /users/:id/keys</code></pre> @param userId the ID of the user to add the SSH key for @param title the new SSH Key's title @param key the new SSH key @return an SshKey instance with info on the added SSH key @throws GitLabApiException if any exception occurs
[ "Create", "new", "key", "owned", "by", "specified", "user", ".", "Available", "only", "for", "admin", "users", "." ]
train
https://github.com/gmessner/gitlab4j-api/blob/ab045070abac0a8f4ccbf17b5ed9bfdef5723eed/src/main/java/org/gitlab4j/api/UserApi.java#L673-L687
pip-services3-java/pip-services3-commons-java
src/org/pipservices3/commons/data/AnyValueMap.java
AnyValueMap.getAsArrayWithDefault
public AnyValueArray getAsArrayWithDefault(String key, AnyValueArray defaultValue) { """ Converts map element into an AnyValueArray or returns default value if conversion is not possible. @param key a key of element to get. @param defaultValue the default value @return AnyValueArray value of the element or default value if conversion is not supported. @see AnyValueArray @see #getAsNullableArray(String) """ AnyValueArray result = getAsNullableArray(key); return result != null ? result : defaultValue; }
java
public AnyValueArray getAsArrayWithDefault(String key, AnyValueArray defaultValue) { AnyValueArray result = getAsNullableArray(key); return result != null ? result : defaultValue; }
[ "public", "AnyValueArray", "getAsArrayWithDefault", "(", "String", "key", ",", "AnyValueArray", "defaultValue", ")", "{", "AnyValueArray", "result", "=", "getAsNullableArray", "(", "key", ")", ";", "return", "result", "!=", "null", "?", "result", ":", "defaultValu...
Converts map element into an AnyValueArray or returns default value if conversion is not possible. @param key a key of element to get. @param defaultValue the default value @return AnyValueArray value of the element or default value if conversion is not supported. @see AnyValueArray @see #getAsNullableArray(String)
[ "Converts", "map", "element", "into", "an", "AnyValueArray", "or", "returns", "default", "value", "if", "conversion", "is", "not", "possible", "." ]
train
https://github.com/pip-services3-java/pip-services3-commons-java/blob/a8a0c3e5ec58f0663c295aa855c6b3afad2af86a/src/org/pipservices3/commons/data/AnyValueMap.java#L560-L563
OpenLiberty/open-liberty
dev/com.ibm.ws.injection/src/com/ibm/ws/injectionengine/osgi/internal/IndirectJndiLookupObjectFactory.java
IndirectJndiLookupObjectFactory.createResourceWithFilter
@FFDCIgnore(PrivilegedActionException.class) private Object createResourceWithFilter(final String filter, final ResourceInfo resourceRefInfo) throws Exception { """ Try to obtain an object instance by creating a resource using a ResourceFactory with the specified filter. """ try { return AccessController.doPrivileged(new PrivilegedExceptionAction<Object>() { @Override public Object run() throws Exception { return createResourceWithFilterPrivileged(filter, resourceRefInfo); } }); } catch (PrivilegedActionException paex) { Throwable cause = paex.getCause(); if (cause instanceof Exception) { throw (Exception) cause; } throw new Error(cause); } }
java
@FFDCIgnore(PrivilegedActionException.class) private Object createResourceWithFilter(final String filter, final ResourceInfo resourceRefInfo) throws Exception { try { return AccessController.doPrivileged(new PrivilegedExceptionAction<Object>() { @Override public Object run() throws Exception { return createResourceWithFilterPrivileged(filter, resourceRefInfo); } }); } catch (PrivilegedActionException paex) { Throwable cause = paex.getCause(); if (cause instanceof Exception) { throw (Exception) cause; } throw new Error(cause); } }
[ "@", "FFDCIgnore", "(", "PrivilegedActionException", ".", "class", ")", "private", "Object", "createResourceWithFilter", "(", "final", "String", "filter", ",", "final", "ResourceInfo", "resourceRefInfo", ")", "throws", "Exception", "{", "try", "{", "return", "Access...
Try to obtain an object instance by creating a resource using a ResourceFactory with the specified filter.
[ "Try", "to", "obtain", "an", "object", "instance", "by", "creating", "a", "resource", "using", "a", "ResourceFactory", "with", "the", "specified", "filter", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.injection/src/com/ibm/ws/injectionengine/osgi/internal/IndirectJndiLookupObjectFactory.java#L359-L375
mgormley/optimize
src/main/java/edu/jhu/hlt/optimize/function/Bounds.java
Bounds.transformRangeLinearly
public double transformRangeLinearly(double l, double u, int i, double d) { """ Maps d \in [l,u] to transformed(d), such that transformed(d) \in [A[i], B[i]]. The transform is just a linear one. It does *NOT* check for +/- infinity. """ return (B[i]-A[i])/(u-l)*(d-u)+B[i]; }
java
public double transformRangeLinearly(double l, double u, int i, double d){ return (B[i]-A[i])/(u-l)*(d-u)+B[i]; }
[ "public", "double", "transformRangeLinearly", "(", "double", "l", ",", "double", "u", ",", "int", "i", ",", "double", "d", ")", "{", "return", "(", "B", "[", "i", "]", "-", "A", "[", "i", "]", ")", "/", "(", "u", "-", "l", ")", "*", "(", "d",...
Maps d \in [l,u] to transformed(d), such that transformed(d) \in [A[i], B[i]]. The transform is just a linear one. It does *NOT* check for +/- infinity.
[ "Maps", "d", "\\", "in", "[", "l", "u", "]", "to", "transformed", "(", "d", ")", "such", "that", "transformed", "(", "d", ")", "\\", "in", "[", "A", "[", "i", "]", "B", "[", "i", "]]", ".", "The", "transform", "is", "just", "a", "linear", "on...
train
https://github.com/mgormley/optimize/blob/3d1b93260b99febb8a5ecd9e8543c223e151a8d3/src/main/java/edu/jhu/hlt/optimize/function/Bounds.java#L91-L93
aol/cyclops
cyclops-futurestream/src/main/java/com/oath/cyclops/types/futurestream/EagerFutureStreamFunctions.java
EagerFutureStreamFunctions.closeOthers
static void closeOthers(final Queue active, final List<Queue> all) { """ Close all queues except the active one @param active Queue not to close @param all All queues potentially including the active queue """ all.stream() .filter(next -> next != active) .forEach(Queue::closeAndClear); }
java
static void closeOthers(final Queue active, final List<Queue> all) { all.stream() .filter(next -> next != active) .forEach(Queue::closeAndClear); }
[ "static", "void", "closeOthers", "(", "final", "Queue", "active", ",", "final", "List", "<", "Queue", ">", "all", ")", "{", "all", ".", "stream", "(", ")", ".", "filter", "(", "next", "->", "next", "!=", "active", ")", ".", "forEach", "(", "Queue", ...
Close all queues except the active one @param active Queue not to close @param all All queues potentially including the active queue
[ "Close", "all", "queues", "except", "the", "active", "one" ]
train
https://github.com/aol/cyclops/blob/59a9fde30190a4d1faeb9f6d9851d209d82b81dd/cyclops-futurestream/src/main/java/com/oath/cyclops/types/futurestream/EagerFutureStreamFunctions.java#L24-L29
pietermartin/sqlg
sqlg-core/src/main/java/org/umlg/sqlg/structure/topology/VertexLabel.java
VertexLabel.loadSqlgSchemaEdgeLabel
EdgeLabel loadSqlgSchemaEdgeLabel(String edgeLabelName, VertexLabel inVertexLabel, Map<String, PropertyType> properties) { """ Called from {@link Topology#Topology(SqlgGraph)}s constructor to preload the sqlg_schema. This can only be called for sqlg_schema. @param edgeLabelName The edge's label. @param inVertexLabel The edge's in {@link VertexLabel}. 'this' is the out {@link VertexLabel}. @param properties A map of the edge's properties. @return The {@link EdgeLabel} that been loaded. """ Preconditions.checkState(this.schema.isSqlgSchema(), "loadSqlgSchemaEdgeLabel must be called for \"%s\" found \"%s\"", SQLG_SCHEMA, this.schema.getName()); EdgeLabel edgeLabel = EdgeLabel.loadSqlgSchemaEdgeLabel(edgeLabelName, this, inVertexLabel, properties); this.outEdgeLabels.put(this.schema.getName() + "." + edgeLabel.getLabel(), edgeLabel); inVertexLabel.inEdgeLabels.put(this.schema.getName() + "." + edgeLabel.getLabel(), edgeLabel); return edgeLabel; }
java
EdgeLabel loadSqlgSchemaEdgeLabel(String edgeLabelName, VertexLabel inVertexLabel, Map<String, PropertyType> properties) { Preconditions.checkState(this.schema.isSqlgSchema(), "loadSqlgSchemaEdgeLabel must be called for \"%s\" found \"%s\"", SQLG_SCHEMA, this.schema.getName()); EdgeLabel edgeLabel = EdgeLabel.loadSqlgSchemaEdgeLabel(edgeLabelName, this, inVertexLabel, properties); this.outEdgeLabels.put(this.schema.getName() + "." + edgeLabel.getLabel(), edgeLabel); inVertexLabel.inEdgeLabels.put(this.schema.getName() + "." + edgeLabel.getLabel(), edgeLabel); return edgeLabel; }
[ "EdgeLabel", "loadSqlgSchemaEdgeLabel", "(", "String", "edgeLabelName", ",", "VertexLabel", "inVertexLabel", ",", "Map", "<", "String", ",", "PropertyType", ">", "properties", ")", "{", "Preconditions", ".", "checkState", "(", "this", ".", "schema", ".", "isSqlgSc...
Called from {@link Topology#Topology(SqlgGraph)}s constructor to preload the sqlg_schema. This can only be called for sqlg_schema. @param edgeLabelName The edge's label. @param inVertexLabel The edge's in {@link VertexLabel}. 'this' is the out {@link VertexLabel}. @param properties A map of the edge's properties. @return The {@link EdgeLabel} that been loaded.
[ "Called", "from", "{", "@link", "Topology#Topology", "(", "SqlgGraph", ")", "}", "s", "constructor", "to", "preload", "the", "sqlg_schema", ".", "This", "can", "only", "be", "called", "for", "sqlg_schema", "." ]
train
https://github.com/pietermartin/sqlg/blob/c1845a1b31328a5ffda646873b0369ee72af56a7/sqlg-core/src/main/java/org/umlg/sqlg/structure/topology/VertexLabel.java#L268-L274
banq/jdonframework
src/main/java/com/jdon/util/RequestUtil.java
RequestUtil.encodePasswordCookie
private static String encodePasswordCookie(String username, String password) { """ Builds a cookie string containing a username and password. <p> Note: with open source this is not really secure, but it prevents users from snooping the cookie file of others and by changing the XOR mask and character offsets, you can easily tweak results. @param username The username. @param password The password. @return String encoding the input parameters, an empty string if one of the arguments equals <code>null</code>. """ StringBuffer buf = new StringBuffer(); if (username != null && password != null) { byte[] bytes = (username + ENCODE_DELIMETER + password).getBytes(); int b; for (int n = 0; n < bytes.length; n++) { b = bytes[n] ^ (ENCODE_XORMASK + n); buf.append((char) (ENCODE_CHAR_OFFSET1 + (b & 0x0F))); buf.append((char) (ENCODE_CHAR_OFFSET2 + ((b >> 4) & 0x0F))); } } return buf.toString(); }
java
private static String encodePasswordCookie(String username, String password) { StringBuffer buf = new StringBuffer(); if (username != null && password != null) { byte[] bytes = (username + ENCODE_DELIMETER + password).getBytes(); int b; for (int n = 0; n < bytes.length; n++) { b = bytes[n] ^ (ENCODE_XORMASK + n); buf.append((char) (ENCODE_CHAR_OFFSET1 + (b & 0x0F))); buf.append((char) (ENCODE_CHAR_OFFSET2 + ((b >> 4) & 0x0F))); } } return buf.toString(); }
[ "private", "static", "String", "encodePasswordCookie", "(", "String", "username", ",", "String", "password", ")", "{", "StringBuffer", "buf", "=", "new", "StringBuffer", "(", ")", ";", "if", "(", "username", "!=", "null", "&&", "password", "!=", "null", ")",...
Builds a cookie string containing a username and password. <p> Note: with open source this is not really secure, but it prevents users from snooping the cookie file of others and by changing the XOR mask and character offsets, you can easily tweak results. @param username The username. @param password The password. @return String encoding the input parameters, an empty string if one of the arguments equals <code>null</code>.
[ "Builds", "a", "cookie", "string", "containing", "a", "username", "and", "password", ".", "<p", ">" ]
train
https://github.com/banq/jdonframework/blob/72b451caac04f775e57f52aaed3d8775044ead53/src/main/java/com/jdon/util/RequestUtil.java#L310-L323
gosu-lang/gosu-lang
gosu-core/src/main/java/gw/internal/gosu/parser/TypeLoaderAccess.java
TypeLoaderAccess.getByRelativeName
public IType getByRelativeName(String relativeName, ITypeUsesMap typeUses) throws ClassNotFoundException { """ Gets an intrinsic type based on a relative name. This could either be the name of an entity, like "User", the name of a typekey, like "SystemPermission", or a class name, like "java.lang.String" (relative and fully qualified class names are the same as far as this factory is concerned). Names can have [] appended to them to create arrays, and multi-dimensional arrays are supported. @param relativeName the relative name of the type @param typeUses the map of used types to use when resolving @return the corresponding IType @throws ClassNotFoundException if the specified name doesn't correspond to any type """ String relativeName1 = relativeName; IType type = FrequentUsedJavaTypeCache.instance( getExecutionEnv() ).getHighUsageType(relativeName1); if (type != null) { return type; } //## todo: consider handling requests to find a parameterized type... the following is a giant hack int i = relativeName1 == null ? -1 : relativeName1.indexOf( '<' ); if( i >= 0 ) { assert relativeName1 != null; relativeName1 = relativeName1.substring( 0, i ); } //## type = getTypeByRelativeNameIfValid_NoGenerics(relativeName1, typeUses); if( type == null ) { throw new ClassNotFoundException(relativeName1); } else { return type; } }
java
public IType getByRelativeName(String relativeName, ITypeUsesMap typeUses) throws ClassNotFoundException { String relativeName1 = relativeName; IType type = FrequentUsedJavaTypeCache.instance( getExecutionEnv() ).getHighUsageType(relativeName1); if (type != null) { return type; } //## todo: consider handling requests to find a parameterized type... the following is a giant hack int i = relativeName1 == null ? -1 : relativeName1.indexOf( '<' ); if( i >= 0 ) { assert relativeName1 != null; relativeName1 = relativeName1.substring( 0, i ); } //## type = getTypeByRelativeNameIfValid_NoGenerics(relativeName1, typeUses); if( type == null ) { throw new ClassNotFoundException(relativeName1); } else { return type; } }
[ "public", "IType", "getByRelativeName", "(", "String", "relativeName", ",", "ITypeUsesMap", "typeUses", ")", "throws", "ClassNotFoundException", "{", "String", "relativeName1", "=", "relativeName", ";", "IType", "type", "=", "FrequentUsedJavaTypeCache", ".", "instance",...
Gets an intrinsic type based on a relative name. This could either be the name of an entity, like "User", the name of a typekey, like "SystemPermission", or a class name, like "java.lang.String" (relative and fully qualified class names are the same as far as this factory is concerned). Names can have [] appended to them to create arrays, and multi-dimensional arrays are supported. @param relativeName the relative name of the type @param typeUses the map of used types to use when resolving @return the corresponding IType @throws ClassNotFoundException if the specified name doesn't correspond to any type
[ "Gets", "an", "intrinsic", "type", "based", "on", "a", "relative", "name", ".", "This", "could", "either", "be", "the", "name", "of", "an", "entity", "like", "User", "the", "name", "of", "a", "typekey", "like", "SystemPermission", "or", "a", "class", "na...
train
https://github.com/gosu-lang/gosu-lang/blob/d6e9261b137ce66fef3726cabe7826d4a1f946b7/gosu-core/src/main/java/gw/internal/gosu/parser/TypeLoaderAccess.java#L392-L415
h2oai/h2o-2
src/main/java/water/TimeLine.java
TimeLine.record_IOclose
public static void record_IOclose( AutoBuffer b, int flavor ) { """ Record a completed I/O event. The nanosecond time slot is actually nano's-blocked-on-io """ H2ONode h2o = b._h2o==null ? H2O.SELF : b._h2o; // First long word going out has sender-port and a 'bad' control packet long b0 = UDP.udp.i_o.ordinal(); // Special flag to indicate io-record and not a rpc-record b0 |= H2O.SELF._key.udp_port()<<8; b0 |= flavor<<24; // I/O flavor; one of the Value.persist backends long iotime = b._time_start_ms > 0 ? (b._time_close_ms - b._time_start_ms) : 0; b0 |= iotime<<32; // msec from start-to-finish, including non-i/o overheads long b8 = b._size; // byte's transfered in this I/O long ns = b._time_io_ns; // nano's blocked doing I/O record2(h2o,ns,true,b.readMode()?1:0,0,b0,b8); }
java
public static void record_IOclose( AutoBuffer b, int flavor ) { H2ONode h2o = b._h2o==null ? H2O.SELF : b._h2o; // First long word going out has sender-port and a 'bad' control packet long b0 = UDP.udp.i_o.ordinal(); // Special flag to indicate io-record and not a rpc-record b0 |= H2O.SELF._key.udp_port()<<8; b0 |= flavor<<24; // I/O flavor; one of the Value.persist backends long iotime = b._time_start_ms > 0 ? (b._time_close_ms - b._time_start_ms) : 0; b0 |= iotime<<32; // msec from start-to-finish, including non-i/o overheads long b8 = b._size; // byte's transfered in this I/O long ns = b._time_io_ns; // nano's blocked doing I/O record2(h2o,ns,true,b.readMode()?1:0,0,b0,b8); }
[ "public", "static", "void", "record_IOclose", "(", "AutoBuffer", "b", ",", "int", "flavor", ")", "{", "H2ONode", "h2o", "=", "b", ".", "_h2o", "==", "null", "?", "H2O", ".", "SELF", ":", "b", ".", "_h2o", ";", "// First long word going out has sender-port an...
Record a completed I/O event. The nanosecond time slot is actually nano's-blocked-on-io
[ "Record", "a", "completed", "I", "/", "O", "event", ".", "The", "nanosecond", "time", "slot", "is", "actually", "nano", "s", "-", "blocked", "-", "on", "-", "io" ]
train
https://github.com/h2oai/h2o-2/blob/be350f3f2c2fb6f135cc07c41f83fd0e4f521ac1/src/main/java/water/TimeLine.java#L103-L114
joniles/mpxj
src/main/java/net/sf/mpxj/mpx/RelationTypeUtility.java
RelationTypeUtility.getInstance
public static RelationType getInstance(Locale locale, String type) { """ This method takes the textual version of a relation type and returns an appropriate class instance. Note that unrecognised values will cause this method to return null. @param locale target locale @param type text version of the relation type @return RelationType instance """ int index = -1; String[] relationTypes = LocaleData.getStringArray(locale, LocaleData.RELATION_TYPES); for (int loop = 0; loop < relationTypes.length; loop++) { if (relationTypes[loop].equalsIgnoreCase(type) == true) { index = loop; break; } } RelationType result = null; if (index != -1) { result = RelationType.getInstance(index); } return (result); }
java
public static RelationType getInstance(Locale locale, String type) { int index = -1; String[] relationTypes = LocaleData.getStringArray(locale, LocaleData.RELATION_TYPES); for (int loop = 0; loop < relationTypes.length; loop++) { if (relationTypes[loop].equalsIgnoreCase(type) == true) { index = loop; break; } } RelationType result = null; if (index != -1) { result = RelationType.getInstance(index); } return (result); }
[ "public", "static", "RelationType", "getInstance", "(", "Locale", "locale", ",", "String", "type", ")", "{", "int", "index", "=", "-", "1", ";", "String", "[", "]", "relationTypes", "=", "LocaleData", ".", "getStringArray", "(", "locale", ",", "LocaleData", ...
This method takes the textual version of a relation type and returns an appropriate class instance. Note that unrecognised values will cause this method to return null. @param locale target locale @param type text version of the relation type @return RelationType instance
[ "This", "method", "takes", "the", "textual", "version", "of", "a", "relation", "type", "and", "returns", "an", "appropriate", "class", "instance", ".", "Note", "that", "unrecognised", "values", "will", "cause", "this", "method", "to", "return", "null", "." ]
train
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mpx/RelationTypeUtility.java#L53-L74
Azure/azure-sdk-for-java
cognitiveservices/data-plane/vision/computervision/src/main/java/com/microsoft/azure/cognitiveservices/vision/computervision/implementation/ComputerVisionImpl.java
ComputerVisionImpl.analyzeImageByDomainAsync
public Observable<DomainModelResults> analyzeImageByDomainAsync(String model, String url, AnalyzeImageByDomainOptionalParameter analyzeImageByDomainOptionalParameter) { """ This operation recognizes content within an image by applying a domain-specific model. The list of domain-specific models that are supported by the Computer Vision API can be retrieved using the /models GET request. Currently, the API only provides a single domain-specific model: celebrities. Two input methods are supported -- (1) Uploading an image or (2) specifying an image URL. A successful response will be returned in JSON. If the request failed, the response will contain an error code and a message to help understand what went wrong. @param model The domain-specific content to recognize. @param url Publicly reachable URL of an image @param analyzeImageByDomainOptionalParameter the object representing the optional parameters to be set before calling this API @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the DomainModelResults object """ return analyzeImageByDomainWithServiceResponseAsync(model, url, analyzeImageByDomainOptionalParameter).map(new Func1<ServiceResponse<DomainModelResults>, DomainModelResults>() { @Override public DomainModelResults call(ServiceResponse<DomainModelResults> response) { return response.body(); } }); }
java
public Observable<DomainModelResults> analyzeImageByDomainAsync(String model, String url, AnalyzeImageByDomainOptionalParameter analyzeImageByDomainOptionalParameter) { return analyzeImageByDomainWithServiceResponseAsync(model, url, analyzeImageByDomainOptionalParameter).map(new Func1<ServiceResponse<DomainModelResults>, DomainModelResults>() { @Override public DomainModelResults call(ServiceResponse<DomainModelResults> response) { return response.body(); } }); }
[ "public", "Observable", "<", "DomainModelResults", ">", "analyzeImageByDomainAsync", "(", "String", "model", ",", "String", "url", ",", "AnalyzeImageByDomainOptionalParameter", "analyzeImageByDomainOptionalParameter", ")", "{", "return", "analyzeImageByDomainWithServiceResponseAs...
This operation recognizes content within an image by applying a domain-specific model. The list of domain-specific models that are supported by the Computer Vision API can be retrieved using the /models GET request. Currently, the API only provides a single domain-specific model: celebrities. Two input methods are supported -- (1) Uploading an image or (2) specifying an image URL. A successful response will be returned in JSON. If the request failed, the response will contain an error code and a message to help understand what went wrong. @param model The domain-specific content to recognize. @param url Publicly reachable URL of an image @param analyzeImageByDomainOptionalParameter the object representing the optional parameters to be set before calling this API @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the DomainModelResults object
[ "This", "operation", "recognizes", "content", "within", "an", "image", "by", "applying", "a", "domain", "-", "specific", "model", ".", "The", "list", "of", "domain", "-", "specific", "models", "that", "are", "supported", "by", "the", "Computer", "Vision", "A...
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/cognitiveservices/data-plane/vision/computervision/src/main/java/com/microsoft/azure/cognitiveservices/vision/computervision/implementation/ComputerVisionImpl.java#L1441-L1448
codeprimate-software/cp-elements
src/main/java/org/cp/elements/lang/Assert.java
Assert.holdsLock
public static void holdsLock(Object lock, String message, Object... arguments) { """ Asserts that the {@link Thread#currentThread() current Thread} holds the specified {@link Object lock}. The assertion holds if and only if the {@link Object lock} is not {@literal null} and the {@link Thread#currentThread() current Thread} holds the given {@link Object lock}. @param lock {@link Object} used as the lock, monitor or mutex in the synchronization. @param message {@link String} containing the message used in the {@link IllegalMonitorStateException} thrown if the assertion fails. @param arguments array of {@link Object arguments} used as placeholder values when formatting the {@link String message}. @throws java.lang.IllegalMonitorStateException if the {@link Thread#currentThread() current Thread} does not hold the {@link Object lock} or the {@link Object lock} is {@literal null}. @see #holdsLock(Object, RuntimeException) @see java.lang.Thread#holdsLock(Object) """ holdsLock(lock, new IllegalMonitorStateException(format(message, arguments))); }
java
public static void holdsLock(Object lock, String message, Object... arguments) { holdsLock(lock, new IllegalMonitorStateException(format(message, arguments))); }
[ "public", "static", "void", "holdsLock", "(", "Object", "lock", ",", "String", "message", ",", "Object", "...", "arguments", ")", "{", "holdsLock", "(", "lock", ",", "new", "IllegalMonitorStateException", "(", "format", "(", "message", ",", "arguments", ")", ...
Asserts that the {@link Thread#currentThread() current Thread} holds the specified {@link Object lock}. The assertion holds if and only if the {@link Object lock} is not {@literal null} and the {@link Thread#currentThread() current Thread} holds the given {@link Object lock}. @param lock {@link Object} used as the lock, monitor or mutex in the synchronization. @param message {@link String} containing the message used in the {@link IllegalMonitorStateException} thrown if the assertion fails. @param arguments array of {@link Object arguments} used as placeholder values when formatting the {@link String message}. @throws java.lang.IllegalMonitorStateException if the {@link Thread#currentThread() current Thread} does not hold the {@link Object lock} or the {@link Object lock} is {@literal null}. @see #holdsLock(Object, RuntimeException) @see java.lang.Thread#holdsLock(Object)
[ "Asserts", "that", "the", "{", "@link", "Thread#currentThread", "()", "current", "Thread", "}", "holds", "the", "specified", "{", "@link", "Object", "lock", "}", "." ]
train
https://github.com/codeprimate-software/cp-elements/blob/f2163c149fbbef05015e688132064ebcac7c49ab/src/main/java/org/cp/elements/lang/Assert.java#L449-L451
RestExpress/PluginExpress
logging/src/main/java/org/restexpress/plugin/logging/LoggingMessageObserver.java
LoggingMessageObserver.createExceptionMessage
protected String createExceptionMessage(Throwable exception, Request request, Response response) { """ Create the message to be logged when a request results in an exception. Sub-classes can override. @param exception the exception that occurred. @param request the request. @param response the response. @return a string message. """ StringBuilder sb = new StringBuilder(request.getEffectiveHttpMethod().toString()); sb.append(' '); sb.append(request.getUrl()); sb.append(" threw exception: "); sb.append(exception.getClass().getSimpleName()); return sb.toString(); }
java
protected String createExceptionMessage(Throwable exception, Request request, Response response) { StringBuilder sb = new StringBuilder(request.getEffectiveHttpMethod().toString()); sb.append(' '); sb.append(request.getUrl()); sb.append(" threw exception: "); sb.append(exception.getClass().getSimpleName()); return sb.toString(); }
[ "protected", "String", "createExceptionMessage", "(", "Throwable", "exception", ",", "Request", "request", ",", "Response", "response", ")", "{", "StringBuilder", "sb", "=", "new", "StringBuilder", "(", "request", ".", "getEffectiveHttpMethod", "(", ")", ".", "toS...
Create the message to be logged when a request results in an exception. Sub-classes can override. @param exception the exception that occurred. @param request the request. @param response the response. @return a string message.
[ "Create", "the", "message", "to", "be", "logged", "when", "a", "request", "results", "in", "an", "exception", ".", "Sub", "-", "classes", "can", "override", "." ]
train
https://github.com/RestExpress/PluginExpress/blob/aeb13907c23bf31ef2b2b17ae4c0ca4a6f5bee69/logging/src/main/java/org/restexpress/plugin/logging/LoggingMessageObserver.java#L120-L128
jamesagnew/hapi-fhir
hapi-fhir-narrativegenerator/src/main/java/ca/uhn/fhir/narrative/template/filters/Split.java
Split.apply
@Override public Object apply(Object value, Object... params) { """ /* split(input, delimiter = ' ') Split a string on a matching pattern E.g. {{ "a~b" | split:'~' | first }} #=> 'a' """ String original = super.asString(value); String delimiter = super.asString(super.get(0, params)); return original.split("(?<!^)" + Pattern.quote(delimiter)); }
java
@Override public Object apply(Object value, Object... params) { String original = super.asString(value); String delimiter = super.asString(super.get(0, params)); return original.split("(?<!^)" + Pattern.quote(delimiter)); }
[ "@", "Override", "public", "Object", "apply", "(", "Object", "value", ",", "Object", "...", "params", ")", "{", "String", "original", "=", "super", ".", "asString", "(", "value", ")", ";", "String", "delimiter", "=", "super", ".", "asString", "(", "super...
/* split(input, delimiter = ' ') Split a string on a matching pattern E.g. {{ "a~b" | split:'~' | first }} #=> 'a'
[ "/", "*", "split", "(", "input", "delimiter", "=", ")" ]
train
https://github.com/jamesagnew/hapi-fhir/blob/150a84d52fe691b7f48fcb28247c4bddb7aec352/hapi-fhir-narrativegenerator/src/main/java/ca/uhn/fhir/narrative/template/filters/Split.java#L14-L22
apache/incubator-gobblin
gobblin-utility/src/main/java/org/apache/gobblin/util/JobConfigurationUtils.java
JobConfigurationUtils.putStateIntoConfiguration
public static void putStateIntoConfiguration(State state, Configuration configuration) { """ Put all configuration properties in a given {@link State} object into a given {@link Configuration} object. @param state the given {@link State} object @param configuration the given {@link Configuration} object """ for (String key : state.getPropertyNames()) { configuration.set(key, state.getProp(key)); } }
java
public static void putStateIntoConfiguration(State state, Configuration configuration) { for (String key : state.getPropertyNames()) { configuration.set(key, state.getProp(key)); } }
[ "public", "static", "void", "putStateIntoConfiguration", "(", "State", "state", ",", "Configuration", "configuration", ")", "{", "for", "(", "String", "key", ":", "state", ".", "getPropertyNames", "(", ")", ")", "{", "configuration", ".", "set", "(", "key", ...
Put all configuration properties in a given {@link State} object into a given {@link Configuration} object. @param state the given {@link State} object @param configuration the given {@link Configuration} object
[ "Put", "all", "configuration", "properties", "in", "a", "given", "{", "@link", "State", "}", "object", "into", "a", "given", "{", "@link", "Configuration", "}", "object", "." ]
train
https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-utility/src/main/java/org/apache/gobblin/util/JobConfigurationUtils.java#L93-L97
JodaOrg/joda-time
src/main/java/org/joda/time/Period.java
Period.plusMillis
public Period plusMillis(int millis) { """ Returns a new period plus the specified number of millis added. <p> This period instance is immutable and unaffected by this method call. @param millis the amount of millis to add, may be negative @return the new period plus the increased millis @throws UnsupportedOperationException if the field is not supported """ if (millis == 0) { return this; } int[] values = getValues(); // cloned getPeriodType().addIndexedField(this, PeriodType.MILLI_INDEX, values, millis); return new Period(values, getPeriodType()); }
java
public Period plusMillis(int millis) { if (millis == 0) { return this; } int[] values = getValues(); // cloned getPeriodType().addIndexedField(this, PeriodType.MILLI_INDEX, values, millis); return new Period(values, getPeriodType()); }
[ "public", "Period", "plusMillis", "(", "int", "millis", ")", "{", "if", "(", "millis", "==", "0", ")", "{", "return", "this", ";", "}", "int", "[", "]", "values", "=", "getValues", "(", ")", ";", "// cloned", "getPeriodType", "(", ")", ".", "addIndex...
Returns a new period plus the specified number of millis added. <p> This period instance is immutable and unaffected by this method call. @param millis the amount of millis to add, may be negative @return the new period plus the increased millis @throws UnsupportedOperationException if the field is not supported
[ "Returns", "a", "new", "period", "plus", "the", "specified", "number", "of", "millis", "added", ".", "<p", ">", "This", "period", "instance", "is", "immutable", "and", "unaffected", "by", "this", "method", "call", "." ]
train
https://github.com/JodaOrg/joda-time/blob/bd79f1c4245e79b3c2c56d7b04fde2a6e191fa42/src/main/java/org/joda/time/Period.java#L1195-L1202
jamesagnew/hapi-fhir
hapi-fhir-structures-hl7org-dstu2/src/main/java/org/hl7/fhir/instance/model/BaseDateTimeType.java
BaseDateTimeType.setValue
public void setValue(Date theValue, TemporalPrecisionEnum thePrecision) throws IllegalArgumentException { """ Sets the value of this date/time using the specified level of precision using the system local time zone @param theValue The date value @param thePrecision The precision @throws IllegalArgumentException """ if (myTimeZoneZulu == false && myTimeZone == null) { myTimeZone = TimeZone.getDefault(); } myPrecision = thePrecision; super.setValue(theValue); }
java
public void setValue(Date theValue, TemporalPrecisionEnum thePrecision) throws IllegalArgumentException { if (myTimeZoneZulu == false && myTimeZone == null) { myTimeZone = TimeZone.getDefault(); } myPrecision = thePrecision; super.setValue(theValue); }
[ "public", "void", "setValue", "(", "Date", "theValue", ",", "TemporalPrecisionEnum", "thePrecision", ")", "throws", "IllegalArgumentException", "{", "if", "(", "myTimeZoneZulu", "==", "false", "&&", "myTimeZone", "==", "null", ")", "{", "myTimeZone", "=", "TimeZon...
Sets the value of this date/time using the specified level of precision using the system local time zone @param theValue The date value @param thePrecision The precision @throws IllegalArgumentException
[ "Sets", "the", "value", "of", "this", "date", "/", "time", "using", "the", "specified", "level", "of", "precision", "using", "the", "system", "local", "time", "zone" ]
train
https://github.com/jamesagnew/hapi-fhir/blob/150a84d52fe691b7f48fcb28247c4bddb7aec352/hapi-fhir-structures-hl7org-dstu2/src/main/java/org/hl7/fhir/instance/model/BaseDateTimeType.java#L425-L431
auth0/Auth0.Android
auth0/src/main/java/com/auth0/android/provider/PKCE.java
PKCE.getToken
public void getToken(String authorizationCode, @NonNull final AuthCallback callback) { """ Performs a request to the Auth0 API to get the OAuth Token and end the PKCE flow. The instance of this class must be disposed after this method is called. @param authorizationCode received in the call to /authorize with a "grant_type=code" @param callback to notify the result of this call to. """ apiClient.token(authorizationCode, redirectUri) .setCodeVerifier(codeVerifier) .start(new BaseCallback<Credentials, AuthenticationException>() { @Override public void onSuccess(Credentials payload) { callback.onSuccess(payload); } @Override public void onFailure(AuthenticationException error) { if ("Unauthorized".equals(error.getDescription())) { Log.e(TAG, "Please go to 'https://manage.auth0.com/#/applications/" + apiClient.getClientId() + "/settings' and set 'Client Type' to 'Native' to enable PKCE."); } callback.onFailure(error); } }); }
java
public void getToken(String authorizationCode, @NonNull final AuthCallback callback) { apiClient.token(authorizationCode, redirectUri) .setCodeVerifier(codeVerifier) .start(new BaseCallback<Credentials, AuthenticationException>() { @Override public void onSuccess(Credentials payload) { callback.onSuccess(payload); } @Override public void onFailure(AuthenticationException error) { if ("Unauthorized".equals(error.getDescription())) { Log.e(TAG, "Please go to 'https://manage.auth0.com/#/applications/" + apiClient.getClientId() + "/settings' and set 'Client Type' to 'Native' to enable PKCE."); } callback.onFailure(error); } }); }
[ "public", "void", "getToken", "(", "String", "authorizationCode", ",", "@", "NonNull", "final", "AuthCallback", "callback", ")", "{", "apiClient", ".", "token", "(", "authorizationCode", ",", "redirectUri", ")", ".", "setCodeVerifier", "(", "codeVerifier", ")", ...
Performs a request to the Auth0 API to get the OAuth Token and end the PKCE flow. The instance of this class must be disposed after this method is called. @param authorizationCode received in the call to /authorize with a "grant_type=code" @param callback to notify the result of this call to.
[ "Performs", "a", "request", "to", "the", "Auth0", "API", "to", "get", "the", "OAuth", "Token", "and", "end", "the", "PKCE", "flow", ".", "The", "instance", "of", "this", "class", "must", "be", "disposed", "after", "this", "method", "is", "called", "." ]
train
https://github.com/auth0/Auth0.Android/blob/ee37b7f94d989c1fbab2cb1378c87fdcaf7a8156/auth0/src/main/java/com/auth0/android/provider/PKCE.java#L84-L101
xiancloud/xian
xian-core/src/main/java/info/xiancloud/core/support/cache/api/CacheMapUtil.java
CacheMapUtil.batchRemove
@SuppressWarnings("all") public static Completable batchRemove(CacheConfigBean cacheConfigBean, Map<String, List<String>> batchRemoves) { """ batch remove the elements in the cached map @param cacheConfigBean cacheConfigBean @param batchRemoves Map(key, fields) the sub map you want to remvoe """ return SingleRxXian .call(CacheService.CACHE_SERVICE, "cacheMapBatchRemove", new JSONObject() {{ put("cacheConfig", cacheConfigBean); put("batchRemoves", batchRemoves); }}) .map(UnitResponse::throwExceptionIfNotSuccess) .toCompletable(); }
java
@SuppressWarnings("all") public static Completable batchRemove(CacheConfigBean cacheConfigBean, Map<String, List<String>> batchRemoves) { return SingleRxXian .call(CacheService.CACHE_SERVICE, "cacheMapBatchRemove", new JSONObject() {{ put("cacheConfig", cacheConfigBean); put("batchRemoves", batchRemoves); }}) .map(UnitResponse::throwExceptionIfNotSuccess) .toCompletable(); }
[ "@", "SuppressWarnings", "(", "\"all\"", ")", "public", "static", "Completable", "batchRemove", "(", "CacheConfigBean", "cacheConfigBean", ",", "Map", "<", "String", ",", "List", "<", "String", ">", ">", "batchRemoves", ")", "{", "return", "SingleRxXian", ".", ...
batch remove the elements in the cached map @param cacheConfigBean cacheConfigBean @param batchRemoves Map(key, fields) the sub map you want to remvoe
[ "batch", "remove", "the", "elements", "in", "the", "cached", "map" ]
train
https://github.com/xiancloud/xian/blob/1948e088545553d2745b2c86d8b5a64988bb850e/xian-core/src/main/java/info/xiancloud/core/support/cache/api/CacheMapUtil.java#L253-L262
aNNiMON/Lightweight-Stream-API
stream/src/main/java/com/annimon/stream/Collectors.java
Collectors.filtering
@NotNull public static <T, A, R> Collector<T, ?, R> filtering( @NotNull final Predicate<? super T> predicate, @NotNull final Collector<? super T, A, R> downstream) { """ Returns a {@code Collector} that filters input elements. @param <T> the type of the input elements @param <A> the accumulation type @param <R> the type of the output elements @param predicate a predicate used to filter elements @param downstream the collector of filtered elements @return a {@code Collector} @since 1.1.3 """ final BiConsumer<A, ? super T> accumulator = downstream.accumulator(); return new CollectorsImpl<T, A, R>( downstream.supplier(), new BiConsumer<A, T>() { @Override public void accept(A a, T t) { if (predicate.test(t)) accumulator.accept(a, t); } }, downstream.finisher() ); }
java
@NotNull public static <T, A, R> Collector<T, ?, R> filtering( @NotNull final Predicate<? super T> predicate, @NotNull final Collector<? super T, A, R> downstream) { final BiConsumer<A, ? super T> accumulator = downstream.accumulator(); return new CollectorsImpl<T, A, R>( downstream.supplier(), new BiConsumer<A, T>() { @Override public void accept(A a, T t) { if (predicate.test(t)) accumulator.accept(a, t); } }, downstream.finisher() ); }
[ "@", "NotNull", "public", "static", "<", "T", ",", "A", ",", "R", ">", "Collector", "<", "T", ",", "?", ",", "R", ">", "filtering", "(", "@", "NotNull", "final", "Predicate", "<", "?", "super", "T", ">", "predicate", ",", "@", "NotNull", "final", ...
Returns a {@code Collector} that filters input elements. @param <T> the type of the input elements @param <A> the accumulation type @param <R> the type of the output elements @param predicate a predicate used to filter elements @param downstream the collector of filtered elements @return a {@code Collector} @since 1.1.3
[ "Returns", "a", "{", "@code", "Collector", "}", "that", "filters", "input", "elements", "." ]
train
https://github.com/aNNiMON/Lightweight-Stream-API/blob/f29fd57208c20252a4549b084d55ed082c3e58f0/stream/src/main/java/com/annimon/stream/Collectors.java#L773-L792
hdbeukel/james-core
src/main/java/org/jamesframework/core/search/Search.java
Search.computeDelta
protected double computeDelta(Evaluation currentEvaluation, Evaluation previousEvaluation) { """ Computes the amount of improvement of <code>currentEvaluation</code> over <code>previousEvaluation</code>, taking into account whether evaluations are being maximized or minimized. Positive deltas indicate improvement. In case of maximization the amount of increase is returned, which is equal to <pre> currentEvaluation - previousEvaluation </pre> while the amount of decrease, equal to <pre> previousEvaluation - currentEvaluation </pre> is returned in case of minimization. @param currentEvaluation evaluation to be compared with previous evaluation @param previousEvaluation previous evaluation @return amount of improvement of current evaluation over previous evaluation """ if(problem.isMinimizing()){ // minimization: return decrease return previousEvaluation.getValue() - currentEvaluation.getValue(); } else { // maximization: return increase return currentEvaluation.getValue() - previousEvaluation.getValue(); } }
java
protected double computeDelta(Evaluation currentEvaluation, Evaluation previousEvaluation){ if(problem.isMinimizing()){ // minimization: return decrease return previousEvaluation.getValue() - currentEvaluation.getValue(); } else { // maximization: return increase return currentEvaluation.getValue() - previousEvaluation.getValue(); } }
[ "protected", "double", "computeDelta", "(", "Evaluation", "currentEvaluation", ",", "Evaluation", "previousEvaluation", ")", "{", "if", "(", "problem", ".", "isMinimizing", "(", ")", ")", "{", "// minimization: return decrease", "return", "previousEvaluation", ".", "g...
Computes the amount of improvement of <code>currentEvaluation</code> over <code>previousEvaluation</code>, taking into account whether evaluations are being maximized or minimized. Positive deltas indicate improvement. In case of maximization the amount of increase is returned, which is equal to <pre> currentEvaluation - previousEvaluation </pre> while the amount of decrease, equal to <pre> previousEvaluation - currentEvaluation </pre> is returned in case of minimization. @param currentEvaluation evaluation to be compared with previous evaluation @param previousEvaluation previous evaluation @return amount of improvement of current evaluation over previous evaluation
[ "Computes", "the", "amount", "of", "improvement", "of", "<code", ">", "currentEvaluation<", "/", "code", ">", "over", "<code", ">", "previousEvaluation<", "/", "code", ">", "taking", "into", "account", "whether", "evaluations", "are", "being", "maximized", "or",...
train
https://github.com/hdbeukel/james-core/blob/4e85c20c142902373e5b5e8b5d12a2558650f66d/src/main/java/org/jamesframework/core/search/Search.java#L1182-L1190
liferay/com-liferay-commerce
commerce-currency-api/src/main/java/com/liferay/commerce/currency/model/CommerceCurrencyWrapper.java
CommerceCurrencyWrapper.getFormatPattern
@Override public String getFormatPattern(String languageId, boolean useDefault) { """ Returns the localized format pattern of this commerce currency in the language, optionally using the default language if no localization exists for the requested language. @param languageId the ID of the language @param useDefault whether to use the default language if no localization exists for the requested language @return the localized format pattern of this commerce currency """ return _commerceCurrency.getFormatPattern(languageId, useDefault); }
java
@Override public String getFormatPattern(String languageId, boolean useDefault) { return _commerceCurrency.getFormatPattern(languageId, useDefault); }
[ "@", "Override", "public", "String", "getFormatPattern", "(", "String", "languageId", ",", "boolean", "useDefault", ")", "{", "return", "_commerceCurrency", ".", "getFormatPattern", "(", "languageId", ",", "useDefault", ")", ";", "}" ]
Returns the localized format pattern of this commerce currency in the language, optionally using the default language if no localization exists for the requested language. @param languageId the ID of the language @param useDefault whether to use the default language if no localization exists for the requested language @return the localized format pattern of this commerce currency
[ "Returns", "the", "localized", "format", "pattern", "of", "this", "commerce", "currency", "in", "the", "language", "optionally", "using", "the", "default", "language", "if", "no", "localization", "exists", "for", "the", "requested", "language", "." ]
train
https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-currency-api/src/main/java/com/liferay/commerce/currency/model/CommerceCurrencyWrapper.java#L331-L334
aws/aws-sdk-java
aws-java-sdk-core/src/main/java/com/amazonaws/auth/internal/AWS4SignerRequestParams.java
AWS4SignerRequestParams.resolveRegion
private String resolveRegion(String endpointPrefix, String serviceSigningName) { """ /* Ideally, we should be using endpoint prefix to parse the region from host. Previously we were using service signing name to parse region. It is possible that endpoint prefix is null if customers are still using older clients. So using service signing name as alternative will prevent any behavior breaking change. """ return AwsHostNameUtils.parseRegionName(request.getEndpoint().getHost(), endpointPrefix != null ? endpointPrefix : serviceSigningName); }
java
private String resolveRegion(String endpointPrefix, String serviceSigningName) { return AwsHostNameUtils.parseRegionName(request.getEndpoint().getHost(), endpointPrefix != null ? endpointPrefix : serviceSigningName); }
[ "private", "String", "resolveRegion", "(", "String", "endpointPrefix", ",", "String", "serviceSigningName", ")", "{", "return", "AwsHostNameUtils", ".", "parseRegionName", "(", "request", ".", "getEndpoint", "(", ")", ".", "getHost", "(", ")", ",", "endpointPrefix...
/* Ideally, we should be using endpoint prefix to parse the region from host. Previously we were using service signing name to parse region. It is possible that endpoint prefix is null if customers are still using older clients. So using service signing name as alternative will prevent any behavior breaking change.
[ "/", "*", "Ideally", "we", "should", "be", "using", "endpoint", "prefix", "to", "parse", "the", "region", "from", "host", "." ]
train
https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-core/src/main/java/com/amazonaws/auth/internal/AWS4SignerRequestParams.java#L119-L123
btrplace/scheduler
choco/src/main/java/org/btrplace/scheduler/choco/view/DefaultAliasedCumulatives.java
DefaultAliasedCumulatives.addDim
@Override public void addDim(int c, int[] cUse, IntVar[] dUse, int[] alias) { """ Add a constraint @param c the cumulative capacity of the aliased resources @param cUse the usage of each of the c-slices @param dUse the usage of each of the d-slices @param alias the resource identifiers that compose the alias """ capacities.add(c); cUsages.add(cUse); dUsages.add(dUse); aliases.add(alias); }
java
@Override public void addDim(int c, int[] cUse, IntVar[] dUse, int[] alias) { capacities.add(c); cUsages.add(cUse); dUsages.add(dUse); aliases.add(alias); }
[ "@", "Override", "public", "void", "addDim", "(", "int", "c", ",", "int", "[", "]", "cUse", ",", "IntVar", "[", "]", "dUse", ",", "int", "[", "]", "alias", ")", "{", "capacities", ".", "add", "(", "c", ")", ";", "cUsages", ".", "add", "(", "cUs...
Add a constraint @param c the cumulative capacity of the aliased resources @param cUse the usage of each of the c-slices @param dUse the usage of each of the d-slices @param alias the resource identifiers that compose the alias
[ "Add", "a", "constraint" ]
train
https://github.com/btrplace/scheduler/blob/611063aad0b47a016e57ebf36fa4dfdf24de09e8/choco/src/main/java/org/btrplace/scheduler/choco/view/DefaultAliasedCumulatives.java#L68-L74
bullhorn/sdk-rest
src/main/java/com/bullhornsdk/data/api/StandardBullhornData.java
StandardBullhornData.handleGetEntity
protected <T extends BullhornEntity> T handleGetEntity(Class<T> type, Integer id, Set<String> fieldSet, EntityParams params) { """ Makes the "entity" api call for getting entities. <p> <p> HTTP Method: GET @param type @param id @param fieldSet @param params optional entity parameters @return """ Map<String, String> uriVariables = restUriVariablesFactory.getUriVariablesForEntity(BullhornEntityInfo.getTypesRestEntityName(type), id, fieldSet, params); String url = restUrlFactory.assembleEntityUrl(params); String jsonString = this.performGetRequest(url, String.class, uriVariables); return restJsonConverter.jsonToEntityUnwrapRoot(jsonString, type); }
java
protected <T extends BullhornEntity> T handleGetEntity(Class<T> type, Integer id, Set<String> fieldSet, EntityParams params) { Map<String, String> uriVariables = restUriVariablesFactory.getUriVariablesForEntity(BullhornEntityInfo.getTypesRestEntityName(type), id, fieldSet, params); String url = restUrlFactory.assembleEntityUrl(params); String jsonString = this.performGetRequest(url, String.class, uriVariables); return restJsonConverter.jsonToEntityUnwrapRoot(jsonString, type); }
[ "protected", "<", "T", "extends", "BullhornEntity", ">", "T", "handleGetEntity", "(", "Class", "<", "T", ">", "type", ",", "Integer", "id", ",", "Set", "<", "String", ">", "fieldSet", ",", "EntityParams", "params", ")", "{", "Map", "<", "String", ",", ...
Makes the "entity" api call for getting entities. <p> <p> HTTP Method: GET @param type @param id @param fieldSet @param params optional entity parameters @return
[ "Makes", "the", "entity", "api", "call", "for", "getting", "entities", ".", "<p", ">", "<p", ">", "HTTP", "Method", ":", "GET" ]
train
https://github.com/bullhorn/sdk-rest/blob/0c75a141c768bb31510afc3a412c11bd101eca06/src/main/java/com/bullhornsdk/data/api/StandardBullhornData.java#L857-L865
rwl/CSparseJ
src/main/java/edu/emory/mathcs/csparsej/tdcomplex/DZcs_schol.java
DZcs_schol.cs_schol
@SuppressWarnings("unused") public static DZcss cs_schol(int order, DZcs A) { """ Ordering and symbolic analysis for a Cholesky factorization. @param order ordering option (0 or 1) @param A column-compressed matrix @return symbolic analysis for Cholesky, null on error """ int n, c[], post[], P[] ; DZcs C ; DZcss S ; if (!CS_CSC (A)) return (null); /* check inputs */ n = A.n ; S = new DZcss() ; /* allocate result S */ if (S == null) return (null) ; /* out of memory */ P = cs_amd (order, A) ; /* P = amd(A+A'), or natural */ S.pinv = cs_pinv (P, n) ; /* find inverse permutation */ P = null ; if (order != 0 && S.pinv == null) return null ; C = cs_symperm (A, S.pinv, false) ; /* C = spones(triu(A(P,P))) */ S.parent = cs_etree (C, false) ; /* find etree of C */ post = cs_post (S.parent, n) ; /* postorder the etree */ c = cs_counts (C, S.parent, post, false) ; /* find column counts of chol(C) */ post = null; C = null ; S.cp = new int [n+1] ; /* allocate result S.cp */ S.unz = S.lnz = (int) cs_cumsum (S.cp, c, n) ; /* find column pointers for L */ c = null ; return ((S.lnz >= 0) ? S : null) ; }
java
@SuppressWarnings("unused") public static DZcss cs_schol(int order, DZcs A) { int n, c[], post[], P[] ; DZcs C ; DZcss S ; if (!CS_CSC (A)) return (null); /* check inputs */ n = A.n ; S = new DZcss() ; /* allocate result S */ if (S == null) return (null) ; /* out of memory */ P = cs_amd (order, A) ; /* P = amd(A+A'), or natural */ S.pinv = cs_pinv (P, n) ; /* find inverse permutation */ P = null ; if (order != 0 && S.pinv == null) return null ; C = cs_symperm (A, S.pinv, false) ; /* C = spones(triu(A(P,P))) */ S.parent = cs_etree (C, false) ; /* find etree of C */ post = cs_post (S.parent, n) ; /* postorder the etree */ c = cs_counts (C, S.parent, post, false) ; /* find column counts of chol(C) */ post = null; C = null ; S.cp = new int [n+1] ; /* allocate result S.cp */ S.unz = S.lnz = (int) cs_cumsum (S.cp, c, n) ; /* find column pointers for L */ c = null ; return ((S.lnz >= 0) ? S : null) ; }
[ "@", "SuppressWarnings", "(", "\"unused\"", ")", "public", "static", "DZcss", "cs_schol", "(", "int", "order", ",", "DZcs", "A", ")", "{", "int", "n", ",", "c", "[", "]", ",", "post", "[", "]", ",", "P", "[", "]", ";", "DZcs", "C", ";", "DZcss", ...
Ordering and symbolic analysis for a Cholesky factorization. @param order ordering option (0 or 1) @param A column-compressed matrix @return symbolic analysis for Cholesky, null on error
[ "Ordering", "and", "symbolic", "analysis", "for", "a", "Cholesky", "factorization", "." ]
train
https://github.com/rwl/CSparseJ/blob/6a6f66bccce1558156a961494358952603b0ac84/src/main/java/edu/emory/mathcs/csparsej/tdcomplex/DZcs_schol.java#L57-L81
logic-ng/LogicNG
src/main/java/org/logicng/cardinalityconstraints/CCEncoder.java
CCEncoder.exo
private void exo(final EncodingResult result, final Variable... vars) { """ Encodes an at-most-one constraint. @param result the result @param vars the variables of the constraint """ if (vars.length == 0) { result.addClause(); return; } if (vars.length == 1) { result.addClause(vars[0]); return; } this.amo(result, vars); result.addClause((Literal[]) vars); }
java
private void exo(final EncodingResult result, final Variable... vars) { if (vars.length == 0) { result.addClause(); return; } if (vars.length == 1) { result.addClause(vars[0]); return; } this.amo(result, vars); result.addClause((Literal[]) vars); }
[ "private", "void", "exo", "(", "final", "EncodingResult", "result", ",", "final", "Variable", "...", "vars", ")", "{", "if", "(", "vars", ".", "length", "==", "0", ")", "{", "result", ".", "addClause", "(", ")", ";", "return", ";", "}", "if", "(", ...
Encodes an at-most-one constraint. @param result the result @param vars the variables of the constraint
[ "Encodes", "an", "at", "-", "most", "-", "one", "constraint", "." ]
train
https://github.com/logic-ng/LogicNG/blob/bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e/src/main/java/org/logicng/cardinalityconstraints/CCEncoder.java#L304-L315
alexruiz/fest-reflect
src/main/java/org/fest/reflect/util/Accessibles.java
Accessibles.setAccessible
public static void setAccessible(@NotNull AccessibleObject o, boolean accessible) { """ Sets the {@code accessible} flag of the given {@code AccessibleObject} to the given {@code boolean} value. @param o the given {@code AccessibleObject}. @param accessible the value to set the {@code accessible} flag to. @throws NullPointerException if the given {@code AccessibleObject} is {@code null}. @throws SecurityException if the request is denied. """ AccessController.doPrivileged(new SetAccessibleAction(o, accessible)); }
java
public static void setAccessible(@NotNull AccessibleObject o, boolean accessible) { AccessController.doPrivileged(new SetAccessibleAction(o, accessible)); }
[ "public", "static", "void", "setAccessible", "(", "@", "NotNull", "AccessibleObject", "o", ",", "boolean", "accessible", ")", "{", "AccessController", ".", "doPrivileged", "(", "new", "SetAccessibleAction", "(", "o", ",", "accessible", ")", ")", ";", "}" ]
Sets the {@code accessible} flag of the given {@code AccessibleObject} to the given {@code boolean} value. @param o the given {@code AccessibleObject}. @param accessible the value to set the {@code accessible} flag to. @throws NullPointerException if the given {@code AccessibleObject} is {@code null}. @throws SecurityException if the request is denied.
[ "Sets", "the", "{", "@code", "accessible", "}", "flag", "of", "the", "given", "{", "@code", "AccessibleObject", "}", "to", "the", "given", "{", "@code", "boolean", "}", "value", "." ]
train
https://github.com/alexruiz/fest-reflect/blob/6db30716808633ef880e439b3dc6602ecb3f1b08/src/main/java/org/fest/reflect/util/Accessibles.java#L72-L74