repository_name
stringlengths
7
54
func_path_in_repository
stringlengths
18
218
func_name
stringlengths
5
140
whole_func_string
stringlengths
79
3.99k
language
stringclasses
1 value
func_code_string
stringlengths
79
3.99k
func_code_tokens
listlengths
20
624
func_documentation_string
stringlengths
61
1.96k
func_documentation_tokens
listlengths
1
478
split_name
stringclasses
1 value
func_code_url
stringlengths
107
339
jenkinsci/artifactory-plugin
src/main/java/org/jfrog/hudson/util/publisher/PublisherFlexible.java
PublisherFlexible.isPublisherWrapped
public boolean isPublisherWrapped(AbstractProject<?, ?> project, Class<T> type) { return find(project, type) != null; }
java
public boolean isPublisherWrapped(AbstractProject<?, ?> project, Class<T> type) { return find(project, type) != null; }
[ "public", "boolean", "isPublisherWrapped", "(", "AbstractProject", "<", "?", ",", "?", ">", "project", ",", "Class", "<", "T", ">", "type", ")", "{", "return", "find", "(", "project", ",", "type", ")", "!=", "null", ";", "}" ]
Determines whether a project has the specified publisher type, wrapped by the "Flexible Publish" publisher. @param project The project @param type The type of the publisher @return true if the project contains a publisher of the specified type wrapped by the "Flexible Publish" publisher.
[ "Determines", "whether", "a", "project", "has", "the", "specified", "publisher", "type", "wrapped", "by", "the", "Flexible", "Publish", "publisher", "." ]
train
https://github.com/jenkinsci/artifactory-plugin/blob/f5fcfff6a5a50be5374813e49d1fe3aaf6422333/src/main/java/org/jfrog/hudson/util/publisher/PublisherFlexible.java#L76-L78
google/closure-templates
java/src/com/google/template/soy/jssrc/dsl/GoogRequire.java
GoogRequire.createWithAlias
public static GoogRequire createWithAlias(String symbol, String alias) { CodeChunkUtils.checkId(alias); return new AutoValue_GoogRequire( symbol, VariableDeclaration.builder(alias).setRhs(GOOG_REQUIRE.call(stringLiteral(symbol))).build(), /*isTypeRequire=*/ false); }
java
public static GoogRequire createWithAlias(String symbol, String alias) { CodeChunkUtils.checkId(alias); return new AutoValue_GoogRequire( symbol, VariableDeclaration.builder(alias).setRhs(GOOG_REQUIRE.call(stringLiteral(symbol))).build(), /*isTypeRequire=*/ false); }
[ "public", "static", "GoogRequire", "createWithAlias", "(", "String", "symbol", ",", "String", "alias", ")", "{", "CodeChunkUtils", ".", "checkId", "(", "alias", ")", ";", "return", "new", "AutoValue_GoogRequire", "(", "symbol", ",", "VariableDeclaration", ".", "...
Creates a new {@code GoogRequire} that requires the given symbol and aliases it to the given name: {@code var alias = goog.require('symbol'); }
[ "Creates", "a", "new", "{" ]
train
https://github.com/google/closure-templates/blob/cc61e1dff70ae97f24f417a57410081bc498bd56/java/src/com/google/template/soy/jssrc/dsl/GoogRequire.java#L58-L64
Azure/azure-sdk-for-java
cognitiveservices/data-plane/language/luis/authoring/src/main/java/com/microsoft/azure/cognitiveservices/language/luis/authoring/implementation/AppsImpl.java
AppsImpl.listWithServiceResponseAsync
public Observable<ServiceResponse<List<ApplicationInfoResponse>>> listWithServiceResponseAsync(ListAppsOptionalParameter listOptionalParameter) { if (this.client.endpoint() == null) { throw new IllegalArgumentException("Parameter this.client.endpoint() is required and cannot be null."); } final Integer skip = listOptionalParameter != null ? listOptionalParameter.skip() : null; final Integer take = listOptionalParameter != null ? listOptionalParameter.take() : null; return listWithServiceResponseAsync(skip, take); }
java
public Observable<ServiceResponse<List<ApplicationInfoResponse>>> listWithServiceResponseAsync(ListAppsOptionalParameter listOptionalParameter) { if (this.client.endpoint() == null) { throw new IllegalArgumentException("Parameter this.client.endpoint() is required and cannot be null."); } final Integer skip = listOptionalParameter != null ? listOptionalParameter.skip() : null; final Integer take = listOptionalParameter != null ? listOptionalParameter.take() : null; return listWithServiceResponseAsync(skip, take); }
[ "public", "Observable", "<", "ServiceResponse", "<", "List", "<", "ApplicationInfoResponse", ">", ">", ">", "listWithServiceResponseAsync", "(", "ListAppsOptionalParameter", "listOptionalParameter", ")", "{", "if", "(", "this", ".", "client", ".", "endpoint", "(", "...
Lists all of the user applications. @param listOptionalParameter 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 List&lt;ApplicationInfoResponse&gt; object
[ "Lists", "all", "of", "the", "user", "applications", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/cognitiveservices/data-plane/language/luis/authoring/src/main/java/com/microsoft/azure/cognitiveservices/language/luis/authoring/implementation/AppsImpl.java#L295-L303
BioPAX/Paxtools
pattern/src/main/java/org/biopax/paxtools/pattern/PatternBox.java
PatternBox.chemicalAffectsProteinThroughControl
public static Pattern chemicalAffectsProteinThroughControl() { Pattern p = new Pattern(SmallMoleculeReference.class, "controller SMR"); p.add(erToPE(), "controller SMR", "controller simple PE"); p.add(notGeneric(), "controller simple PE"); p.add(linkToComplex(), "controller simple PE", "controller PE"); p.add(peToControl(), "controller PE", "Control"); p.add(controlToInter(), "Control", "Interaction"); p.add(new NOT(participantER()), "Interaction", "controller SMR"); p.add(participant(), "Interaction", "affected PE"); p.add(linkToSpecific(), "affected PE", "affected simple PE"); p.add(new Type(SequenceEntity.class), "affected simple PE"); p.add(peToER(), "affected simple PE", "affected generic ER"); p.add(linkedER(false), "affected generic ER", "affected ER"); return p; }
java
public static Pattern chemicalAffectsProteinThroughControl() { Pattern p = new Pattern(SmallMoleculeReference.class, "controller SMR"); p.add(erToPE(), "controller SMR", "controller simple PE"); p.add(notGeneric(), "controller simple PE"); p.add(linkToComplex(), "controller simple PE", "controller PE"); p.add(peToControl(), "controller PE", "Control"); p.add(controlToInter(), "Control", "Interaction"); p.add(new NOT(participantER()), "Interaction", "controller SMR"); p.add(participant(), "Interaction", "affected PE"); p.add(linkToSpecific(), "affected PE", "affected simple PE"); p.add(new Type(SequenceEntity.class), "affected simple PE"); p.add(peToER(), "affected simple PE", "affected generic ER"); p.add(linkedER(false), "affected generic ER", "affected ER"); return p; }
[ "public", "static", "Pattern", "chemicalAffectsProteinThroughControl", "(", ")", "{", "Pattern", "p", "=", "new", "Pattern", "(", "SmallMoleculeReference", ".", "class", ",", "\"controller SMR\"", ")", ";", "p", ".", "add", "(", "erToPE", "(", ")", ",", "\"con...
A small molecule controls an interaction of which the protein is a participant. @return pattern
[ "A", "small", "molecule", "controls", "an", "interaction", "of", "which", "the", "protein", "is", "a", "participant", "." ]
train
https://github.com/BioPAX/Paxtools/blob/2f93afa94426bf8b5afc2e0e61cd4b269a83288d/pattern/src/main/java/org/biopax/paxtools/pattern/PatternBox.java#L548-L563
moparisthebest/beehive
beehive-netui-core/src/main/java/org/apache/beehive/netui/script/el/tokens/ExpressionToken.java
ExpressionToken.parseIndex
protected final int parseIndex(String indexString) { try { return Integer.parseInt(indexString); } catch(Exception e) { String msg = "Error converting \"" + indexString + "\" into an integer. Cause: " + e; LOGGER.error(msg, e); throw new RuntimeException(msg, e); } }
java
protected final int parseIndex(String indexString) { try { return Integer.parseInt(indexString); } catch(Exception e) { String msg = "Error converting \"" + indexString + "\" into an integer. Cause: " + e; LOGGER.error(msg, e); throw new RuntimeException(msg, e); } }
[ "protected", "final", "int", "parseIndex", "(", "String", "indexString", ")", "{", "try", "{", "return", "Integer", ".", "parseInt", "(", "indexString", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "String", "msg", "=", "\"Error converting \\\"\"...
Attempt to convert a String indexString into an integer index. @param indexString the index string @return the converted integer
[ "Attempt", "to", "convert", "a", "String", "indexString", "into", "an", "integer", "index", "." ]
train
https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-netui-core/src/main/java/org/apache/beehive/netui/script/el/tokens/ExpressionToken.java#L236-L244
smartsheet-platform/smartsheet-java-sdk
src/main/java/com/smartsheet/api/internal/oauth/OAuthFlowImpl.java
OAuthFlowImpl.newAuthorizationURL
public String newAuthorizationURL(EnumSet<AccessScope> scopes, String state) { Util.throwIfNull(scopes); if(state == null){state = "";} // Build a map of parameters for the URL HashMap<String,Object> params = new HashMap<String, Object>(); params.put("response_type", "code"); params.put("client_id", clientId); params.put("redirect_uri", redirectURL); params.put("state", state); StringBuilder scopeBuffer = new StringBuilder(); for(AccessScope scope : scopes) { scopeBuffer.append(scope.name()+","); } params.put("scope",scopeBuffer.substring(0,scopeBuffer.length()-1)); // Generate the URL with the parameters return QueryUtil.generateUrl(authorizationURL, params); }
java
public String newAuthorizationURL(EnumSet<AccessScope> scopes, String state) { Util.throwIfNull(scopes); if(state == null){state = "";} // Build a map of parameters for the URL HashMap<String,Object> params = new HashMap<String, Object>(); params.put("response_type", "code"); params.put("client_id", clientId); params.put("redirect_uri", redirectURL); params.put("state", state); StringBuilder scopeBuffer = new StringBuilder(); for(AccessScope scope : scopes) { scopeBuffer.append(scope.name()+","); } params.put("scope",scopeBuffer.substring(0,scopeBuffer.length()-1)); // Generate the URL with the parameters return QueryUtil.generateUrl(authorizationURL, params); }
[ "public", "String", "newAuthorizationURL", "(", "EnumSet", "<", "AccessScope", ">", "scopes", ",", "String", "state", ")", "{", "Util", ".", "throwIfNull", "(", "scopes", ")", ";", "if", "(", "state", "==", "null", ")", "{", "state", "=", "\"\"", ";", ...
Generate a new authorization URL. Exceptions: - IllegalArgumentException : if scopes is null/empty @param scopes the scopes @param state an arbitrary string that will be returned to your app; intended to be used by you to ensure that this redirect is indeed from an OAuth flow that you initiated @return the authorization URL @throws UnsupportedEncodingException the unsupported encoding exception
[ "Generate", "a", "new", "authorization", "URL", "." ]
train
https://github.com/smartsheet-platform/smartsheet-java-sdk/blob/f60e264412076271f83b65889ef9b891fad83df8/src/main/java/com/smartsheet/api/internal/oauth/OAuthFlowImpl.java#L136-L155
hyperledger/fabric-sdk-java
src/main/java/org/hyperledger/fabric/sdk/idemix/IdemixUtils.java
IdemixUtils.transformFromProto
static ECP2 transformFromProto(Idemix.ECP2 w) { byte[] valuexa = w.getXa().toByteArray(); byte[] valuexb = w.getXb().toByteArray(); byte[] valueya = w.getYa().toByteArray(); byte[] valueyb = w.getYb().toByteArray(); FP2 valuex = new FP2(BIG.fromBytes(valuexa), BIG.fromBytes(valuexb)); FP2 valuey = new FP2(BIG.fromBytes(valueya), BIG.fromBytes(valueyb)); return new ECP2(valuex, valuey); }
java
static ECP2 transformFromProto(Idemix.ECP2 w) { byte[] valuexa = w.getXa().toByteArray(); byte[] valuexb = w.getXb().toByteArray(); byte[] valueya = w.getYa().toByteArray(); byte[] valueyb = w.getYb().toByteArray(); FP2 valuex = new FP2(BIG.fromBytes(valuexa), BIG.fromBytes(valuexb)); FP2 valuey = new FP2(BIG.fromBytes(valueya), BIG.fromBytes(valueyb)); return new ECP2(valuex, valuey); }
[ "static", "ECP2", "transformFromProto", "(", "Idemix", ".", "ECP2", "w", ")", "{", "byte", "[", "]", "valuexa", "=", "w", ".", "getXa", "(", ")", ".", "toByteArray", "(", ")", ";", "byte", "[", "]", "valuexb", "=", "w", ".", "getXb", "(", ")", "....
Returns an amcl.BN256.ECP2 on input of an ECP2 protobuf object. @param w a protobuf object representing an ECP2 @return a ECP2 created from the protobuf object
[ "Returns", "an", "amcl", ".", "BN256", ".", "ECP2", "on", "input", "of", "an", "ECP2", "protobuf", "object", "." ]
train
https://github.com/hyperledger/fabric-sdk-java/blob/4a2d7b3408b8b0a1ed812aa36942c438159c37a0/src/main/java/org/hyperledger/fabric/sdk/idemix/IdemixUtils.java#L198-L206
xcesco/kripton
kripton-processor/src/main/java/com/abubusoft/kripton/processor/BindDataSourceSubProcessor.java
BindDataSourceSubProcessor.analyzeSecondRound
public boolean analyzeSecondRound(Set<? extends TypeElement> annotations, RoundEnvironment roundEnv) { parseBindType(roundEnv); // Put all @BindTable elements in beanElements for (Element item : roundEnv.getElementsAnnotatedWith(BindSqlType.class)) { if (item.getKind() != ElementKind.CLASS) { String msg = String.format("%s %s, only class can be annotated with @%s annotation", item.getKind(), item, BindSqlType.class.getSimpleName()); throw (new InvalidKindForAnnotationException(msg)); } globalBeanElements.put(item.toString(), (TypeElement) item); } // generate dao Set<? extends Element> generatedDaos = roundEnv.getElementsAnnotatedWith(BindGeneratedDao.class); for (Element item : generatedDaos) { String keyToReplace = AnnotationUtility.extractAsClassName(item, BindGeneratedDao.class, AnnotationAttributeType.DAO); globalDaoElements.put(keyToReplace, (TypeElement) item); globalDaoGenerated.add(keyToReplace); } return false; }
java
public boolean analyzeSecondRound(Set<? extends TypeElement> annotations, RoundEnvironment roundEnv) { parseBindType(roundEnv); // Put all @BindTable elements in beanElements for (Element item : roundEnv.getElementsAnnotatedWith(BindSqlType.class)) { if (item.getKind() != ElementKind.CLASS) { String msg = String.format("%s %s, only class can be annotated with @%s annotation", item.getKind(), item, BindSqlType.class.getSimpleName()); throw (new InvalidKindForAnnotationException(msg)); } globalBeanElements.put(item.toString(), (TypeElement) item); } // generate dao Set<? extends Element> generatedDaos = roundEnv.getElementsAnnotatedWith(BindGeneratedDao.class); for (Element item : generatedDaos) { String keyToReplace = AnnotationUtility.extractAsClassName(item, BindGeneratedDao.class, AnnotationAttributeType.DAO); globalDaoElements.put(keyToReplace, (TypeElement) item); globalDaoGenerated.add(keyToReplace); } return false; }
[ "public", "boolean", "analyzeSecondRound", "(", "Set", "<", "?", "extends", "TypeElement", ">", "annotations", ",", "RoundEnvironment", "roundEnv", ")", "{", "parseBindType", "(", "roundEnv", ")", ";", "// Put all @BindTable elements in beanElements", "for", "(", "Ele...
Analyze second round. @param annotations the annotations @param roundEnv the round env @return true, if successful
[ "Analyze", "second", "round", "." ]
train
https://github.com/xcesco/kripton/blob/90de2c0523d39b99e81b8d38aa996898762f594a/kripton-processor/src/main/java/com/abubusoft/kripton/processor/BindDataSourceSubProcessor.java#L561-L584
spotbugs/spotbugs
spotbugs/src/main/java/edu/umd/cs/findbugs/ba/CFG.java
CFG.getLocationAtEntry
public Location getLocationAtEntry() { InstructionHandle handle = getEntry().getFirstInstruction(); assert handle != null; return new Location(handle, getEntry()); }
java
public Location getLocationAtEntry() { InstructionHandle handle = getEntry().getFirstInstruction(); assert handle != null; return new Location(handle, getEntry()); }
[ "public", "Location", "getLocationAtEntry", "(", ")", "{", "InstructionHandle", "handle", "=", "getEntry", "(", ")", ".", "getFirstInstruction", "(", ")", ";", "assert", "handle", "!=", "null", ";", "return", "new", "Location", "(", "handle", ",", "getEntry", ...
Get the Location representing the entry to the CFG. Note that this is a "fake" Location, and shouldn't be relied on to yield source line information. @return Location at entry to CFG
[ "Get", "the", "Location", "representing", "the", "entry", "to", "the", "CFG", ".", "Note", "that", "this", "is", "a", "fake", "Location", "and", "shouldn", "t", "be", "relied", "on", "to", "yield", "source", "line", "information", "." ]
train
https://github.com/spotbugs/spotbugs/blob/f6365c6eea6515035bded38efa4a7c8b46ccf28c/spotbugs/src/main/java/edu/umd/cs/findbugs/ba/CFG.java#L612-L616
RestComm/jss7
m3ua/impl/src/main/java/org/restcomm/protocols/ss7/m3ua/impl/router/ServerM3UARouter.java
ServerM3UARouter.addRk
public void addRk(RoutingKey rk, AsImpl asImpl) throws Exception { int dpc = rk.getDestinationPointCodes()[0].getPointCode(); OPCList[] opcArray = rk.getOPCLists(); int[] opcIntArr = null; if (opcArray == null) { opcIntArr = new int[] { -1 }; } else { opcIntArr = opcArray[0].getPointCodes(); } ServiceIndicators[] siArray = rk.getServiceIndicators(); short[] siShortArr = null; if (siArray == null) { siShortArr = new short[] { -1 }; } else { siShortArr = siArray[0].getIndicators(); } for (FastList.Node<DPCNode> n = dpcList.head(), end = dpcList.tail(); (n = n.getNext()) != end;) { DPCNode dpcNode = n.getValue(); if (dpcNode.dpc == dpc) { this.addSi(dpcNode, opcIntArr, siShortArr, asImpl); return; } } DPCNode dpcNode = new DPCNode(dpc); this.addSi(dpcNode, opcIntArr, siShortArr, asImpl); this.dpcList.add(dpcNode); }
java
public void addRk(RoutingKey rk, AsImpl asImpl) throws Exception { int dpc = rk.getDestinationPointCodes()[0].getPointCode(); OPCList[] opcArray = rk.getOPCLists(); int[] opcIntArr = null; if (opcArray == null) { opcIntArr = new int[] { -1 }; } else { opcIntArr = opcArray[0].getPointCodes(); } ServiceIndicators[] siArray = rk.getServiceIndicators(); short[] siShortArr = null; if (siArray == null) { siShortArr = new short[] { -1 }; } else { siShortArr = siArray[0].getIndicators(); } for (FastList.Node<DPCNode> n = dpcList.head(), end = dpcList.tail(); (n = n.getNext()) != end;) { DPCNode dpcNode = n.getValue(); if (dpcNode.dpc == dpc) { this.addSi(dpcNode, opcIntArr, siShortArr, asImpl); return; } } DPCNode dpcNode = new DPCNode(dpc); this.addSi(dpcNode, opcIntArr, siShortArr, asImpl); this.dpcList.add(dpcNode); }
[ "public", "void", "addRk", "(", "RoutingKey", "rk", ",", "AsImpl", "asImpl", ")", "throws", "Exception", "{", "int", "dpc", "=", "rk", ".", "getDestinationPointCodes", "(", ")", "[", "0", "]", ".", "getPointCode", "(", ")", ";", "OPCList", "[", "]", "o...
<p> Create a Tree structure adding the reference to passed As. The Tree is created starting from {@link DPCNode} as parent node containing 'n' {@link OPCNode} leafs where 'n' is list of OPC passed. For each {@link OPCNode} there will be 'm' {@link SINode} leafs where 'm' is number of Service Indicator passed. </p> <p> DPC is mandatory while OPC and SI list are optional. If OPC or SI is not passed the wild card '-1' leaf will be added to parent node </p> @param rk @param asImpl @throws Exception
[ "<p", ">", "Create", "a", "Tree", "structure", "adding", "the", "reference", "to", "passed", "As", ".", "The", "Tree", "is", "created", "starting", "from", "{", "@link", "DPCNode", "}", "as", "parent", "node", "containing", "n", "{", "@link", "OPCNode", ...
train
https://github.com/RestComm/jss7/blob/402b4b3984e581c581e309cb5f6a858fde6dbc33/m3ua/impl/src/main/java/org/restcomm/protocols/ss7/m3ua/impl/router/ServerM3UARouter.java#L69-L100
lessthanoptimal/BoofCV
main/boofcv-recognition/src/main/java/boofcv/alg/tracker/tld/TldRegionTracker.java
TldRegionTracker.process
public boolean process(ImagePyramid<I> image , Rectangle2D_F64 targetRectangle ) { boolean success = true; updateCurrent(image); // create feature tracks spawnGrid(targetRectangle); // track features while computing forward/backward error and NCC error if( !trackFeature() ) success = false; // makes the current image into a previous image setCurrentToPrevious(); return success; }
java
public boolean process(ImagePyramid<I> image , Rectangle2D_F64 targetRectangle ) { boolean success = true; updateCurrent(image); // create feature tracks spawnGrid(targetRectangle); // track features while computing forward/backward error and NCC error if( !trackFeature() ) success = false; // makes the current image into a previous image setCurrentToPrevious(); return success; }
[ "public", "boolean", "process", "(", "ImagePyramid", "<", "I", ">", "image", ",", "Rectangle2D_F64", "targetRectangle", ")", "{", "boolean", "success", "=", "true", ";", "updateCurrent", "(", "image", ")", ";", "// create feature tracks", "spawnGrid", "(", "targ...
Creates several tracks inside the target rectangle and compuets their motion @param image Most recent video image. @param targetRectangle Location of target in previous frame. Not modified. @return true if tracking was successful or false if not
[ "Creates", "several", "tracks", "inside", "the", "target", "rectangle", "and", "compuets", "their", "motion" ]
train
https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-recognition/src/main/java/boofcv/alg/tracker/tld/TldRegionTracker.java#L176-L192
matthewhorridge/owlapi-gwt
owlapi-gwt-serialization/src/main/java/uk/ac/manchester/cs/owl/owlapi/OWLFunctionalObjectPropertyAxiomImpl_CustomFieldSerializer.java
OWLFunctionalObjectPropertyAxiomImpl_CustomFieldSerializer.deserializeInstance
@Override public void deserializeInstance(SerializationStreamReader streamReader, OWLFunctionalObjectPropertyAxiomImpl instance) throws SerializationException { deserialize(streamReader, instance); }
java
@Override public void deserializeInstance(SerializationStreamReader streamReader, OWLFunctionalObjectPropertyAxiomImpl instance) throws SerializationException { deserialize(streamReader, instance); }
[ "@", "Override", "public", "void", "deserializeInstance", "(", "SerializationStreamReader", "streamReader", ",", "OWLFunctionalObjectPropertyAxiomImpl", "instance", ")", "throws", "SerializationException", "{", "deserialize", "(", "streamReader", ",", "instance", ")", ";", ...
Deserializes the content of the object from the {@link com.google.gwt.user.client.rpc.SerializationStreamReader}. @param streamReader the {@link com.google.gwt.user.client.rpc.SerializationStreamReader} to read the object's content from @param instance the object instance to deserialize @throws com.google.gwt.user.client.rpc.SerializationException if the deserialization operation is not successful
[ "Deserializes", "the", "content", "of", "the", "object", "from", "the", "{", "@link", "com", ".", "google", ".", "gwt", ".", "user", ".", "client", ".", "rpc", ".", "SerializationStreamReader", "}", "." ]
train
https://github.com/matthewhorridge/owlapi-gwt/blob/7ab975fb6cef3c8947099983551672a3b5d4e2fd/owlapi-gwt-serialization/src/main/java/uk/ac/manchester/cs/owl/owlapi/OWLFunctionalObjectPropertyAxiomImpl_CustomFieldSerializer.java#L96-L99
infinispan/infinispan
client/hotrod-client/src/main/java/org/infinispan/client/hotrod/impl/transaction/AbstractTransactionTable.java
AbstractTransactionTable.completeTransaction
int completeTransaction(Xid xid, boolean commit) { try { TransactionOperationFactory factory = assertStartedAndReturnFactory(); CompleteTransactionOperation operation = factory.newCompleteTransactionOperation(xid, commit); return operation.execute().get(); } catch (Exception e) { getLog().debug("Exception while commit/rollback.", e); return XAException.XA_HEURRB; //heuristically rolled-back } }
java
int completeTransaction(Xid xid, boolean commit) { try { TransactionOperationFactory factory = assertStartedAndReturnFactory(); CompleteTransactionOperation operation = factory.newCompleteTransactionOperation(xid, commit); return operation.execute().get(); } catch (Exception e) { getLog().debug("Exception while commit/rollback.", e); return XAException.XA_HEURRB; //heuristically rolled-back } }
[ "int", "completeTransaction", "(", "Xid", "xid", ",", "boolean", "commit", ")", "{", "try", "{", "TransactionOperationFactory", "factory", "=", "assertStartedAndReturnFactory", "(", ")", ";", "CompleteTransactionOperation", "operation", "=", "factory", ".", "newComple...
It completes the transaction with the commit or rollback request. <p> It can be a commit or rollback request. @param xid The transaction {@link Xid}. @param commit {@code True} to commit the transaction, {@link false} to rollback. @return The server's return code.
[ "It", "completes", "the", "transaction", "with", "the", "commit", "or", "rollback", "request", ".", "<p", ">", "It", "can", "be", "a", "commit", "or", "rollback", "request", "." ]
train
https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/client/hotrod-client/src/main/java/org/infinispan/client/hotrod/impl/transaction/AbstractTransactionTable.java#L67-L76
Netflix/servo
servo-core/src/main/java/com/netflix/servo/publish/JmxMetricPoller.java
JmxMetricPoller.safelyLoadAttributes
private static List<Attribute> safelyLoadAttributes( MBeanServerConnection server, ObjectName objectName, List<String> matchingNames) { try { // first try batch loading all attributes as this is faster return batchLoadAttributes(server, objectName, matchingNames); } catch (Exception e) { // JBOSS ticket: https://issues.jboss.org/browse/AS7-4404 LOGGER.info("Error batch loading attributes for {} : {}", objectName, e.getMessage()); // some containers (jboss I am looking at you) fail the entire getAttributes request // if one is broken we can get the working attributes if we ask for them individually return individuallyLoadAttributes(server, objectName, matchingNames); } }
java
private static List<Attribute> safelyLoadAttributes( MBeanServerConnection server, ObjectName objectName, List<String> matchingNames) { try { // first try batch loading all attributes as this is faster return batchLoadAttributes(server, objectName, matchingNames); } catch (Exception e) { // JBOSS ticket: https://issues.jboss.org/browse/AS7-4404 LOGGER.info("Error batch loading attributes for {} : {}", objectName, e.getMessage()); // some containers (jboss I am looking at you) fail the entire getAttributes request // if one is broken we can get the working attributes if we ask for them individually return individuallyLoadAttributes(server, objectName, matchingNames); } }
[ "private", "static", "List", "<", "Attribute", ">", "safelyLoadAttributes", "(", "MBeanServerConnection", "server", ",", "ObjectName", "objectName", ",", "List", "<", "String", ">", "matchingNames", ")", "{", "try", "{", "// first try batch loading all attributes as thi...
There are issues loading some JMX attributes on some systems. This protects us from a single bad attribute stopping us reading any metrics (or just a random sampling) out of the system.
[ "There", "are", "issues", "loading", "some", "JMX", "attributes", "on", "some", "systems", ".", "This", "protects", "us", "from", "a", "single", "bad", "attribute", "stopping", "us", "reading", "any", "metrics", "(", "or", "just", "a", "random", "sampling", ...
train
https://github.com/Netflix/servo/blob/d67b5afce8c50bd9e9e31c288dbf4b78fb2ac815/servo-core/src/main/java/com/netflix/servo/publish/JmxMetricPoller.java#L306-L319
osmdroid/osmdroid
osmdroid-android/src/main/java/org/osmdroid/views/overlay/LinearRing.java
LinearRing.isCloseTo
boolean isCloseTo(final GeoPoint pPoint, final double tolerance, final Projection pProjection, final boolean pClosePath) { return getCloseTo(pPoint, tolerance, pProjection, pClosePath) != null; }
java
boolean isCloseTo(final GeoPoint pPoint, final double tolerance, final Projection pProjection, final boolean pClosePath) { return getCloseTo(pPoint, tolerance, pProjection, pClosePath) != null; }
[ "boolean", "isCloseTo", "(", "final", "GeoPoint", "pPoint", ",", "final", "double", "tolerance", ",", "final", "Projection", "pProjection", ",", "final", "boolean", "pClosePath", ")", "{", "return", "getCloseTo", "(", "pPoint", ",", "tolerance", ",", "pProjectio...
Detection is done in screen coordinates. @param tolerance in pixels @return true if the Polyline is close enough to the point.
[ "Detection", "is", "done", "in", "screen", "coordinates", "." ]
train
https://github.com/osmdroid/osmdroid/blob/3b178b2f078497dd88c137110e87aafe45ad2b16/osmdroid-android/src/main/java/org/osmdroid/views/overlay/LinearRing.java#L363-L366
deeplearning4j/deeplearning4j
datavec/datavec-spark/src/main/java/org/datavec/spark/transform/AnalyzeSpark.java
AnalyzeSpark.sampleInvalidFromColumn
public static List<Writable> sampleInvalidFromColumn(int numToSample, String columnName, Schema schema, JavaRDD<List<Writable>> data) { return sampleInvalidFromColumn(numToSample, columnName, schema, data, false); }
java
public static List<Writable> sampleInvalidFromColumn(int numToSample, String columnName, Schema schema, JavaRDD<List<Writable>> data) { return sampleInvalidFromColumn(numToSample, columnName, schema, data, false); }
[ "public", "static", "List", "<", "Writable", ">", "sampleInvalidFromColumn", "(", "int", "numToSample", ",", "String", "columnName", ",", "Schema", "schema", ",", "JavaRDD", "<", "List", "<", "Writable", ">", ">", "data", ")", "{", "return", "sampleInvalidFrom...
Randomly sample a set of invalid values from a specified column. Values are considered invalid according to the Schema / ColumnMetaData @param numToSample Maximum number of invalid values to sample @param columnName Same of the column from which to sample invalid values @param schema Data schema @param data Data @return List of invalid examples
[ "Randomly", "sample", "a", "set", "of", "invalid", "values", "from", "a", "specified", "column", ".", "Values", "are", "considered", "invalid", "according", "to", "the", "Schema", "/", "ColumnMetaData" ]
train
https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/datavec/datavec-spark/src/main/java/org/datavec/spark/transform/AnalyzeSpark.java#L312-L315
KyoriPowered/text
api/src/main/java/net/kyori/text/TextComponent.java
TextComponent.of
public static TextComponent of(final @NonNull String content, final @Nullable TextColor color, final TextDecoration@NonNull... decorations) { final Set<TextDecoration> activeDecorations = new HashSet<>(decorations.length); Collections.addAll(activeDecorations, decorations); return of(content, color, activeDecorations); }
java
public static TextComponent of(final @NonNull String content, final @Nullable TextColor color, final TextDecoration@NonNull... decorations) { final Set<TextDecoration> activeDecorations = new HashSet<>(decorations.length); Collections.addAll(activeDecorations, decorations); return of(content, color, activeDecorations); }
[ "public", "static", "TextComponent", "of", "(", "final", "@", "NonNull", "String", "content", ",", "final", "@", "Nullable", "TextColor", "color", ",", "final", "TextDecoration", "@", "NonNull", ".", ".", ".", "decorations", ")", "{", "final", "Set", "<", ...
Creates a text component with content, and optional color and decorations. @param content the plain text content @param color the color @param decorations the decorations @return the text component
[ "Creates", "a", "text", "component", "with", "content", "and", "optional", "color", "and", "decorations", "." ]
train
https://github.com/KyoriPowered/text/blob/4496c593bf89e8fb036dd6efe26f8ac60f7655c9/api/src/main/java/net/kyori/text/TextComponent.java#L163-L167
Jasig/uPortal
uPortal-layout/uPortal-layout-impl/src/main/java/org/apereo/portal/layout/simple/RDBMUserLayoutStore.java
RDBMUserLayoutStore.getNextStructId
protected String getNextStructId(final IPerson person, final String prefix) { final int userId = person.getID(); return nextStructTransactionOperations.execute( status -> jdbcOperations.execute( new ConnectionCallback<String>() { @Override public String doInConnection(Connection con) throws SQLException, DataAccessException { try (Statement stmt = con.createStatement()) { String sQuery = "SELECT NEXT_STRUCT_ID FROM UP_USER WHERE USER_ID=" + userId; logger.debug("getNextStructId(): {}", sQuery); int currentStructId; try (ResultSet rs = stmt.executeQuery(sQuery)) { if (rs.next()) { currentStructId = rs.getInt(1); } else { throw new SQLException( "no rows returned for query [" + sQuery + "]"); } } int nextStructId = currentStructId + 1; String sUpdate = "UPDATE UP_USER SET NEXT_STRUCT_ID=" + nextStructId + " WHERE USER_ID=" + userId + " AND NEXT_STRUCT_ID=" + currentStructId; logger.debug("getNextStructId(): {}", sUpdate); stmt.executeUpdate(sUpdate); return prefix + nextStructId; } } })); }
java
protected String getNextStructId(final IPerson person, final String prefix) { final int userId = person.getID(); return nextStructTransactionOperations.execute( status -> jdbcOperations.execute( new ConnectionCallback<String>() { @Override public String doInConnection(Connection con) throws SQLException, DataAccessException { try (Statement stmt = con.createStatement()) { String sQuery = "SELECT NEXT_STRUCT_ID FROM UP_USER WHERE USER_ID=" + userId; logger.debug("getNextStructId(): {}", sQuery); int currentStructId; try (ResultSet rs = stmt.executeQuery(sQuery)) { if (rs.next()) { currentStructId = rs.getInt(1); } else { throw new SQLException( "no rows returned for query [" + sQuery + "]"); } } int nextStructId = currentStructId + 1; String sUpdate = "UPDATE UP_USER SET NEXT_STRUCT_ID=" + nextStructId + " WHERE USER_ID=" + userId + " AND NEXT_STRUCT_ID=" + currentStructId; logger.debug("getNextStructId(): {}", sUpdate); stmt.executeUpdate(sUpdate); return prefix + nextStructId; } } })); }
[ "protected", "String", "getNextStructId", "(", "final", "IPerson", "person", ",", "final", "String", "prefix", ")", "{", "final", "int", "userId", "=", "person", ".", "getID", "(", ")", ";", "return", "nextStructTransactionOperations", ".", "execute", "(", "st...
Return the next available structure id for a user @return next free structure ID
[ "Return", "the", "next", "available", "structure", "id", "for", "a", "user" ]
train
https://github.com/Jasig/uPortal/blob/c1986542abb9acd214268f2df21c6305ad2f262b/uPortal-layout/uPortal-layout-impl/src/main/java/org/apereo/portal/layout/simple/RDBMUserLayoutStore.java#L367-L407
JM-Lab/utils-java8
src/main/java/kr/jm/utils/helper/JMResources.java
JMResources.getStringWithClasspathOrFilePath
public static String getStringWithClasspathOrFilePath( String classpathOrFilePath, String charsetName) { return getStringAsOptWithClasspath(classpathOrFilePath, charsetName) .orElseGet(() -> getStringAsOptWithFilePath (classpathOrFilePath, charsetName).orElse(null)); }
java
public static String getStringWithClasspathOrFilePath( String classpathOrFilePath, String charsetName) { return getStringAsOptWithClasspath(classpathOrFilePath, charsetName) .orElseGet(() -> getStringAsOptWithFilePath (classpathOrFilePath, charsetName).orElse(null)); }
[ "public", "static", "String", "getStringWithClasspathOrFilePath", "(", "String", "classpathOrFilePath", ",", "String", "charsetName", ")", "{", "return", "getStringAsOptWithClasspath", "(", "classpathOrFilePath", ",", "charsetName", ")", ".", "orElseGet", "(", "(", ")",...
Gets string with classpath or file path. @param classpathOrFilePath the classpath or file path @param charsetName the charset name @return the string with classpath or file path
[ "Gets", "string", "with", "classpath", "or", "file", "path", "." ]
train
https://github.com/JM-Lab/utils-java8/blob/9e407b3f28a7990418a1e877229fa8344f4d78a5/src/main/java/kr/jm/utils/helper/JMResources.java#L352-L357
raydac/java-binary-block-parser
jbbp/src/main/java/com/igormaznitsa/jbbp/utils/JBBPDslBuilder.java
JBBPDslBuilder.BitArray
public JBBPDslBuilder BitArray(final JBBPBitNumber bits, final int size) { return this.BitArray(null, bits, arraySizeToString(size)); }
java
public JBBPDslBuilder BitArray(final JBBPBitNumber bits, final int size) { return this.BitArray(null, bits, arraySizeToString(size)); }
[ "public", "JBBPDslBuilder", "BitArray", "(", "final", "JBBPBitNumber", "bits", ",", "final", "int", "size", ")", "{", "return", "this", ".", "BitArray", "(", "null", ",", "bits", ",", "arraySizeToString", "(", "size", ")", ")", ";", "}" ]
Add anonymous fixed length bit array. @param bits length of the field, must not be null @param size number of elements in array, if negative then till the end of stream @return the builder instance, must not be null
[ "Add", "anonymous", "fixed", "length", "bit", "array", "." ]
train
https://github.com/raydac/java-binary-block-parser/blob/6d98abcab01e0c72d525ebcc9e7b694f9ce49f5b/jbbp/src/main/java/com/igormaznitsa/jbbp/utils/JBBPDslBuilder.java#L664-L666
versionone/VersionOne.SDK.Java.ObjectModel
src/main/java/com/versionone/om/V1InstanceGetter.java
V1InstanceGetter.expressions
public Collection<Expression> expressions(ExpressionFilter filter) { return get(Expression.class, (filter != null) ? filter : new ExpressionFilter()); }
java
public Collection<Expression> expressions(ExpressionFilter filter) { return get(Expression.class, (filter != null) ? filter : new ExpressionFilter()); }
[ "public", "Collection", "<", "Expression", ">", "expressions", "(", "ExpressionFilter", "filter", ")", "{", "return", "get", "(", "Expression", ".", "class", ",", "(", "filter", "!=", "null", ")", "?", "filter", ":", "new", "ExpressionFilter", "(", ")", ")...
Get Expression filtered by the criteria specified in the passed filter. @param filter Limit the items returned. If null, then all items returned. @return ICollection of the items as specified in the filter.
[ "Get", "Expression", "filtered", "by", "the", "criteria", "specified", "in", "the", "passed", "filter", "." ]
train
https://github.com/versionone/VersionOne.SDK.Java.ObjectModel/blob/59d35b67c849299631bca45ee94143237eb2ae1a/src/main/java/com/versionone/om/V1InstanceGetter.java#L346-L348
Stratio/deep-spark
deep-commons/src/main/java/com/stratio/deep/commons/utils/Utils.java
Utils.findSetter
@SuppressWarnings("unchecked") public static Method findSetter(String propertyName, Class entityClass, Class valueType) { Method setter; String setterName = "set" + propertyName.substring(0, 1).toUpperCase() + propertyName.substring(1); try { setter = entityClass.getMethod(setterName, valueType); } catch (NoSuchMethodException e) { // let's try with scala setter name try { setter = entityClass.getMethod(propertyName + "_$eq", valueType); } catch (NoSuchMethodException e1) { throw new DeepIOException(e1); } } return setter; }
java
@SuppressWarnings("unchecked") public static Method findSetter(String propertyName, Class entityClass, Class valueType) { Method setter; String setterName = "set" + propertyName.substring(0, 1).toUpperCase() + propertyName.substring(1); try { setter = entityClass.getMethod(setterName, valueType); } catch (NoSuchMethodException e) { // let's try with scala setter name try { setter = entityClass.getMethod(propertyName + "_$eq", valueType); } catch (NoSuchMethodException e1) { throw new DeepIOException(e1); } } return setter; }
[ "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "public", "static", "Method", "findSetter", "(", "String", "propertyName", ",", "Class", "entityClass", ",", "Class", "valueType", ")", "{", "Method", "setter", ";", "String", "setterName", "=", "\"set\"", "+",...
Resolves the setter name for the property whose name is 'propertyName' whose type is 'valueType' in the entity bean whose class is 'entityClass'. If we don't find a setter following Java's naming conventions, before throwing an exception we try to resolve the setter following Scala's naming conventions. @param propertyName the field name of the property whose setter we want to resolve. @param entityClass the bean class object in which we want to search for the setter. @param valueType the class type of the object that we want to pass to the setter. @return the resolved setter.
[ "Resolves", "the", "setter", "name", "for", "the", "property", "whose", "name", "is", "propertyName", "whose", "type", "is", "valueType", "in", "the", "entity", "bean", "whose", "class", "is", "entityClass", ".", "If", "we", "don", "t", "find", "a", "sette...
train
https://github.com/Stratio/deep-spark/blob/b9621c9b7a6d996f80fce1d073d696a157bed095/deep-commons/src/main/java/com/stratio/deep/commons/utils/Utils.java#L214-L232
zaproxy/zaproxy
src/org/parosproxy/paros/model/SiteMap.java
SiteMap.handleEvent
private void handleEvent(SiteNode parent, SiteNode node, EventType eventType) { switch (eventType) { case ADD: publishEvent(SiteMapEventPublisher.SITE_NODE_ADDED_EVENT, node); if (parent == getRoot()) { publishEvent(SiteMapEventPublisher.SITE_ADDED_EVENT, node); } break; case REMOVE: publishEvent(SiteMapEventPublisher.SITE_NODE_REMOVED_EVENT, node); if(parent == getRoot()) { publishEvent(SiteMapEventPublisher.SITE_REMOVED_EVENT, node); } } }
java
private void handleEvent(SiteNode parent, SiteNode node, EventType eventType) { switch (eventType) { case ADD: publishEvent(SiteMapEventPublisher.SITE_NODE_ADDED_EVENT, node); if (parent == getRoot()) { publishEvent(SiteMapEventPublisher.SITE_ADDED_EVENT, node); } break; case REMOVE: publishEvent(SiteMapEventPublisher.SITE_NODE_REMOVED_EVENT, node); if(parent == getRoot()) { publishEvent(SiteMapEventPublisher.SITE_REMOVED_EVENT, node); } } }
[ "private", "void", "handleEvent", "(", "SiteNode", "parent", ",", "SiteNode", "node", ",", "EventType", "eventType", ")", "{", "switch", "(", "eventType", ")", "{", "case", "ADD", ":", "publishEvent", "(", "SiteMapEventPublisher", ".", "SITE_NODE_ADDED_EVENT", "...
Handles the publishing of the add or remove event. Node events are always published. Site events are only published when the parent of the node is the root of the tree. @param parent relevant parent node @param node the site node the action is being carried out for @param eventType the type of event occurring (ADD or REMOVE) @see EventType @since 2.5.0
[ "Handles", "the", "publishing", "of", "the", "add", "or", "remove", "event", ".", "Node", "events", "are", "always", "published", ".", "Site", "events", "are", "only", "published", "when", "the", "parent", "of", "the", "node", "is", "the", "root", "of", ...
train
https://github.com/zaproxy/zaproxy/blob/0cbe5121f2ae1ecca222513d182759210c569bec/src/org/parosproxy/paros/model/SiteMap.java#L812-L826
JodaOrg/joda-time
src/main/java/org/joda/time/Period.java
Period.withDays
public Period withDays(int days) { int[] values = getValues(); // cloned getPeriodType().setIndexedField(this, PeriodType.DAY_INDEX, values, days); return new Period(values, getPeriodType()); }
java
public Period withDays(int days) { int[] values = getValues(); // cloned getPeriodType().setIndexedField(this, PeriodType.DAY_INDEX, values, days); return new Period(values, getPeriodType()); }
[ "public", "Period", "withDays", "(", "int", "days", ")", "{", "int", "[", "]", "values", "=", "getValues", "(", ")", ";", "// cloned", "getPeriodType", "(", ")", ".", "setIndexedField", "(", "this", ",", "PeriodType", ".", "DAY_INDEX", ",", "values", ","...
Returns a new period with the specified number of days. <p> This period instance is immutable and unaffected by this method call. @param days the amount of days to add, may be negative @return the new period with the increased days @throws UnsupportedOperationException if the field is not supported
[ "Returns", "a", "new", "period", "with", "the", "specified", "number", "of", "days", ".", "<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#L959-L963
jayantk/jklol
src/com/jayantkrish/jklol/models/DiscreteVariable.java
DiscreteVariable.sequence
public static DiscreteVariable sequence(String name, int size) { List<Integer> values = null; if (sequenceCache.containsKey(size)) { values = sequenceCache.get(size); } else { values = Lists.newArrayList(); for (int i = 0; i < size; i++) { values.add(i); } values = ImmutableList.copyOf(values); sequenceCache.put(size, values); } return new DiscreteVariable(name, values); }
java
public static DiscreteVariable sequence(String name, int size) { List<Integer> values = null; if (sequenceCache.containsKey(size)) { values = sequenceCache.get(size); } else { values = Lists.newArrayList(); for (int i = 0; i < size; i++) { values.add(i); } values = ImmutableList.copyOf(values); sequenceCache.put(size, values); } return new DiscreteVariable(name, values); }
[ "public", "static", "DiscreteVariable", "sequence", "(", "String", "name", ",", "int", "size", ")", "{", "List", "<", "Integer", ">", "values", "=", "null", ";", "if", "(", "sequenceCache", ".", "containsKey", "(", "size", ")", ")", "{", "values", "=", ...
Creates a discrete variable whose values are {@code 0} to {@code size - 1}. @param maxNum @return
[ "Creates", "a", "discrete", "variable", "whose", "values", "are", "{", "@code", "0", "}", "to", "{", "@code", "size", "-", "1", "}", "." ]
train
https://github.com/jayantk/jklol/blob/d27532ca83e212d51066cf28f52621acc3fd44cc/src/com/jayantkrish/jklol/models/DiscreteVariable.java#L42-L56
greatman/craftconomy3
src/main/java/com/greatmancode/craftconomy3/currency/Currency.java
Currency.setExchangeRate
public void setExchangeRate(Currency otherCurrency, double amount) { Common.getInstance().getStorageHandler().getStorageEngine().setExchangeRate(this, otherCurrency, amount); }
java
public void setExchangeRate(Currency otherCurrency, double amount) { Common.getInstance().getStorageHandler().getStorageEngine().setExchangeRate(this, otherCurrency, amount); }
[ "public", "void", "setExchangeRate", "(", "Currency", "otherCurrency", ",", "double", "amount", ")", "{", "Common", ".", "getInstance", "(", ")", ".", "getStorageHandler", "(", ")", ".", "getStorageEngine", "(", ")", ".", "setExchangeRate", "(", "this", ",", ...
Set the exchange rate between 2 currency @param otherCurrency The other currency @param amount THe exchange rate.
[ "Set", "the", "exchange", "rate", "between", "2", "currency" ]
train
https://github.com/greatman/craftconomy3/blob/51b1b3de7d039e20c7418d1e70b8c4b02b8cf840/src/main/java/com/greatmancode/craftconomy3/currency/Currency.java#L176-L178
wildfly/wildfly-core
deployment-repository/src/main/java/org/jboss/as/repository/HashUtil.java
HashUtil.hashPath
public static byte[] hashPath(MessageDigest messageDigest, Path path) throws IOException { try (InputStream in = getRecursiveContentStream(path)) { return hashContent(messageDigest, in); } }
java
public static byte[] hashPath(MessageDigest messageDigest, Path path) throws IOException { try (InputStream in = getRecursiveContentStream(path)) { return hashContent(messageDigest, in); } }
[ "public", "static", "byte", "[", "]", "hashPath", "(", "MessageDigest", "messageDigest", ",", "Path", "path", ")", "throws", "IOException", "{", "try", "(", "InputStream", "in", "=", "getRecursiveContentStream", "(", "path", ")", ")", "{", "return", "hashConte...
Hashes a path, if the path points to a directory then hashes the contents recursively. @param messageDigest the digest used to hash. @param path the file/directory we want to hash. @return the resulting hash. @throws IOException
[ "Hashes", "a", "path", "if", "the", "path", "points", "to", "a", "directory", "then", "hashes", "the", "contents", "recursively", "." ]
train
https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/deployment-repository/src/main/java/org/jboss/as/repository/HashUtil.java#L111-L115
deeplearning4j/deeplearning4j
datavec/datavec-spark/src/main/java/org/datavec/spark/util/DataVecSparkUtil.java
DataVecSparkUtil.combineFilesForSequenceFile
public static JavaPairRDD<Text, BytesPairWritable> combineFilesForSequenceFile(JavaSparkContext sc, String path1, String path2, PathToKeyConverter converter) { return combineFilesForSequenceFile(sc, path1, path2, converter, converter); }
java
public static JavaPairRDD<Text, BytesPairWritable> combineFilesForSequenceFile(JavaSparkContext sc, String path1, String path2, PathToKeyConverter converter) { return combineFilesForSequenceFile(sc, path1, path2, converter, converter); }
[ "public", "static", "JavaPairRDD", "<", "Text", ",", "BytesPairWritable", ">", "combineFilesForSequenceFile", "(", "JavaSparkContext", "sc", ",", "String", "path1", ",", "String", "path2", ",", "PathToKeyConverter", "converter", ")", "{", "return", "combineFilesForSeq...
Same as {@link #combineFilesForSequenceFile(JavaSparkContext, String, String, PathToKeyConverter, PathToKeyConverter)} but with the PathToKeyConverter used for both file sources
[ "Same", "as", "{" ]
train
https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/datavec/datavec-spark/src/main/java/org/datavec/spark/util/DataVecSparkUtil.java#L37-L40
mapfish/mapfish-print
core/src/main/java/org/mapfish/print/servlet/job/impl/hibernate/PrintJobDao.java
PrintJobDao.updateLastCheckTime
public final void updateLastCheckTime(final String id, final long lastCheckTime) { final CriteriaBuilder builder = getSession().getCriteriaBuilder(); final CriteriaUpdate<PrintJobStatusExtImpl> update = builder.createCriteriaUpdate(PrintJobStatusExtImpl.class); final Root<PrintJobStatusExtImpl> root = update.from(PrintJobStatusExtImpl.class); update.where(builder.equal(root.get("referenceId"), id)); update.set(root.get("lastCheckTime"), lastCheckTime); getSession().createQuery(update).executeUpdate(); }
java
public final void updateLastCheckTime(final String id, final long lastCheckTime) { final CriteriaBuilder builder = getSession().getCriteriaBuilder(); final CriteriaUpdate<PrintJobStatusExtImpl> update = builder.createCriteriaUpdate(PrintJobStatusExtImpl.class); final Root<PrintJobStatusExtImpl> root = update.from(PrintJobStatusExtImpl.class); update.where(builder.equal(root.get("referenceId"), id)); update.set(root.get("lastCheckTime"), lastCheckTime); getSession().createQuery(update).executeUpdate(); }
[ "public", "final", "void", "updateLastCheckTime", "(", "final", "String", "id", ",", "final", "long", "lastCheckTime", ")", "{", "final", "CriteriaBuilder", "builder", "=", "getSession", "(", ")", ".", "getCriteriaBuilder", "(", ")", ";", "final", "CriteriaUpdat...
Update the lastCheckTime of the given record. @param id the id @param lastCheckTime the new value
[ "Update", "the", "lastCheckTime", "of", "the", "given", "record", "." ]
train
https://github.com/mapfish/mapfish-print/blob/25a452cb39f592bd8a53b20db1037703898e1e22/core/src/main/java/org/mapfish/print/servlet/job/impl/hibernate/PrintJobDao.java#L189-L197
phax/ph-pdf-layout
src/main/java/com/helger/pdflayout4/spec/FontSpec.java
FontSpec.getCloneWithDifferentColor
@Nonnull public FontSpec getCloneWithDifferentColor (@Nonnull final Color aNewColor) { ValueEnforcer.notNull (aNewColor, "NewColor"); if (aNewColor.equals (m_aColor)) return this; return new FontSpec (m_aPreloadFont, m_fFontSize, aNewColor); }
java
@Nonnull public FontSpec getCloneWithDifferentColor (@Nonnull final Color aNewColor) { ValueEnforcer.notNull (aNewColor, "NewColor"); if (aNewColor.equals (m_aColor)) return this; return new FontSpec (m_aPreloadFont, m_fFontSize, aNewColor); }
[ "@", "Nonnull", "public", "FontSpec", "getCloneWithDifferentColor", "(", "@", "Nonnull", "final", "Color", "aNewColor", ")", "{", "ValueEnforcer", ".", "notNull", "(", "aNewColor", ",", "\"NewColor\"", ")", ";", "if", "(", "aNewColor", ".", "equals", "(", "m_a...
Return a clone of this object but with a different color. @param aNewColor The new color to use. May not be <code>null</code>. @return this if the colors are equal - a new object otherwise.
[ "Return", "a", "clone", "of", "this", "object", "but", "with", "a", "different", "color", "." ]
train
https://github.com/phax/ph-pdf-layout/blob/777d9f3a131cbe8f592c0de1cf554084e541bb54/src/main/java/com/helger/pdflayout4/spec/FontSpec.java#L145-L152
Cornutum/tcases
tcases-lib/src/main/java/org/cornutum/tcases/conditions/Conditions.java
Conditions.betweenExclusiveMax
public static Between betweenExclusiveMax( String property, int minimum, int maximum) { return new Between( notLessThan( property, minimum), lessThan( property, maximum)); }
java
public static Between betweenExclusiveMax( String property, int minimum, int maximum) { return new Between( notLessThan( property, minimum), lessThan( property, maximum)); }
[ "public", "static", "Between", "betweenExclusiveMax", "(", "String", "property", ",", "int", "minimum", ",", "int", "maximum", ")", "{", "return", "new", "Between", "(", "notLessThan", "(", "property", ",", "minimum", ")", ",", "lessThan", "(", "property", "...
Returns a {@link ICondition condition} that is satisfied by a {@link org.cornutum.tcases.PropertySet} that contains between a specified minimum (inclusive) and maximum (exclusive) number of instances of a property.
[ "Returns", "a", "{" ]
train
https://github.com/Cornutum/tcases/blob/21e15cf107fa149620c40f4bda1829c1224fcfb1/tcases-lib/src/main/java/org/cornutum/tcases/conditions/Conditions.java#L163-L166
overturetool/overture
core/ast/src/main/java/org/overture/ast/factory/AstFactory.java
AstFactory.initPattern
private static void initPattern(PPattern result, ILexLocation location) { result.setLocation(location); result.setResolved(false); }
java
private static void initPattern(PPattern result, ILexLocation location) { result.setLocation(location); result.setResolved(false); }
[ "private", "static", "void", "initPattern", "(", "PPattern", "result", ",", "ILexLocation", "location", ")", "{", "result", ".", "setLocation", "(", "location", ")", ";", "result", ".", "setResolved", "(", "false", ")", ";", "}" ]
/* Init Methods - correspond to constructors of the abstract classes, e.g. Definition, Pattern, Type, etc.
[ "/", "*", "Init", "Methods", "-", "correspond", "to", "constructors", "of", "the", "abstract", "classes", "e", ".", "g", ".", "Definition", "Pattern", "Type", "etc", "." ]
train
https://github.com/overturetool/overture/blob/83175dc6c24fa171cde4fcf61ecb648eba3bdbc1/core/ast/src/main/java/org/overture/ast/factory/AstFactory.java#L249-L254
peholmst/vaadin4spring
addons/i18n/src/main/java/org/vaadin/spring/i18n/I18N.java
I18N.getWithDefault
public String getWithDefault(String code, String defaultMessage, Object... arguments) { try { return getMessage(code, null, arguments); } catch (NoSuchMessageException ex) { return defaultMessage; } }
java
public String getWithDefault(String code, String defaultMessage, Object... arguments) { try { return getMessage(code, null, arguments); } catch (NoSuchMessageException ex) { return defaultMessage; } }
[ "public", "String", "getWithDefault", "(", "String", "code", ",", "String", "defaultMessage", ",", "Object", "...", "arguments", ")", "{", "try", "{", "return", "getMessage", "(", "code", ",", "null", ",", "arguments", ")", ";", "}", "catch", "(", "NoSuchM...
Tries to resolve the specified message for the current locale. @param code the code to lookup up, such as 'calculator.noRateSet', never {@code null}. @param defaultMessage string to return if the lookup fails, never {@code null}. @param arguments Array of arguments that will be filled in for params within the message (params look like "{0}", "{1,date}", "{2,time}"), or {@code null} if none. @return the resolved message, or the {@code defaultMessage} if the lookup fails. @see #getLocale()
[ "Tries", "to", "resolve", "the", "specified", "message", "for", "the", "current", "locale", "." ]
train
https://github.com/peholmst/vaadin4spring/blob/ea896012f15d6abea6e6391def9a0001113a1f7a/addons/i18n/src/main/java/org/vaadin/spring/i18n/I18N.java#L153-L159
powermock/powermock
powermock-api/powermock-api-support/src/main/java/org/powermock/api/support/SuppressCode.java
SuppressCode.suppressMethod
public static synchronized void suppressMethod(Class<?> clazz, String[] methodNames) { for (Method method : Whitebox.getMethods(clazz, methodNames)) { MockRepository.addMethodToSuppress(method); } }
java
public static synchronized void suppressMethod(Class<?> clazz, String[] methodNames) { for (Method method : Whitebox.getMethods(clazz, methodNames)) { MockRepository.addMethodToSuppress(method); } }
[ "public", "static", "synchronized", "void", "suppressMethod", "(", "Class", "<", "?", ">", "clazz", ",", "String", "[", "]", "methodNames", ")", "{", "for", "(", "Method", "method", ":", "Whitebox", ".", "getMethods", "(", "clazz", ",", "methodNames", ")",...
Suppress multiple methods for a class. @param clazz The class whose methods will be suppressed. @param methodNames Methods to suppress in class {@code clazz}.
[ "Suppress", "multiple", "methods", "for", "a", "class", "." ]
train
https://github.com/powermock/powermock/blob/e8cd68026c284c6a7efe66959809eeebd8d1f9ad/powermock-api/powermock-api-support/src/main/java/org/powermock/api/support/SuppressCode.java#L204-L208
orbisgis/h2gis
h2gis-functions/src/main/java/org/h2gis/functions/io/kml/AltitudeMode.java
AltitudeMode.append
public static void append(int altitudeMode, StringBuilder sb) { switch (altitudeMode) { case KML_CLAMPTOGROUND: sb.append("<kml:altitudeMode>clampToGround</kml:altitudeMode>"); return; case KML_RELATIVETOGROUND: sb.append("<kml:altitudeMode>relativeToGround</kml:altitudeMode>"); return; case KML_ABSOLUTE: sb.append("<kml:altitudeMode>absolute</kml:altitudeMode>"); return; case GX_CLAMPTOSEAFLOOR: sb.append("<gx:altitudeMode>clampToSeaFloor</gx:altitudeMode>"); return; case GX_RELATIVETOSEAFLOOR: sb.append("<gx:altitudeMode>relativeToSeaFloor</gx:altitudeMode>"); return; case NONE: return; default: throw new IllegalArgumentException("Supported altitude modes are: \n" + " For KML profils: CLAMPTOGROUND = 1; RELATIVETOGROUND = 2; ABSOLUTE = 4;\n" + "For GX profils: CLAMPTOSEAFLOOR = 8; RELATIVETOSEAFLOOR = 16; \n" + " No altitude: NONE = 0"); } }
java
public static void append(int altitudeMode, StringBuilder sb) { switch (altitudeMode) { case KML_CLAMPTOGROUND: sb.append("<kml:altitudeMode>clampToGround</kml:altitudeMode>"); return; case KML_RELATIVETOGROUND: sb.append("<kml:altitudeMode>relativeToGround</kml:altitudeMode>"); return; case KML_ABSOLUTE: sb.append("<kml:altitudeMode>absolute</kml:altitudeMode>"); return; case GX_CLAMPTOSEAFLOOR: sb.append("<gx:altitudeMode>clampToSeaFloor</gx:altitudeMode>"); return; case GX_RELATIVETOSEAFLOOR: sb.append("<gx:altitudeMode>relativeToSeaFloor</gx:altitudeMode>"); return; case NONE: return; default: throw new IllegalArgumentException("Supported altitude modes are: \n" + " For KML profils: CLAMPTOGROUND = 1; RELATIVETOGROUND = 2; ABSOLUTE = 4;\n" + "For GX profils: CLAMPTOSEAFLOOR = 8; RELATIVETOSEAFLOOR = 16; \n" + " No altitude: NONE = 0"); } }
[ "public", "static", "void", "append", "(", "int", "altitudeMode", ",", "StringBuilder", "sb", ")", "{", "switch", "(", "altitudeMode", ")", "{", "case", "KML_CLAMPTOGROUND", ":", "sb", ".", "append", "(", "\"<kml:altitudeMode>clampToGround</kml:altitudeMode>\"", ")"...
Generate a string value corresponding to the altitude mode. @param altitudeMode @param sb
[ "Generate", "a", "string", "value", "corresponding", "to", "the", "altitude", "mode", "." ]
train
https://github.com/orbisgis/h2gis/blob/9cd70b447e6469cecbc2fc64b16774b59491df3b/h2gis-functions/src/main/java/org/h2gis/functions/io/kml/AltitudeMode.java#L73-L98
alrocar/POIProxy
es.alrocar.poiproxy/src/main/java/es/alrocar/poiproxy/configuration/ServiceConfigurationManager.java
ServiceConfigurationManager.getServiceAsJSON
public String getServiceAsJSON(String id) { String path = this.registeredConfigurations.get(id); if (path == null) { return null; } // cargar fichero de disco obtener el json y parsearlo File f = new File(CONFIGURATION_DIR + File.separator + path); FileInputStream fis = null; InputStream in = null; OutputStream out = null; String res = null; try { fis = new FileInputStream(f); in = new BufferedInputStream(fis, Constants.IO_BUFFER_SIZE); final ByteArrayOutputStream dataStream = new ByteArrayOutputStream(); out = new BufferedOutputStream(dataStream, Constants.IO_BUFFER_SIZE); byte[] b = new byte[8 * 1024]; int read; while ((read = in.read(b)) != -1) { out.write(b, 0, read); } out.flush(); res = new String(dataStream.toByteArray()); } catch (IOException e) { e.printStackTrace(); return null; } finally { Constants.closeStream(fis); Constants.closeStream(in); Constants.closeStream(out); } return res; }
java
public String getServiceAsJSON(String id) { String path = this.registeredConfigurations.get(id); if (path == null) { return null; } // cargar fichero de disco obtener el json y parsearlo File f = new File(CONFIGURATION_DIR + File.separator + path); FileInputStream fis = null; InputStream in = null; OutputStream out = null; String res = null; try { fis = new FileInputStream(f); in = new BufferedInputStream(fis, Constants.IO_BUFFER_SIZE); final ByteArrayOutputStream dataStream = new ByteArrayOutputStream(); out = new BufferedOutputStream(dataStream, Constants.IO_BUFFER_SIZE); byte[] b = new byte[8 * 1024]; int read; while ((read = in.read(b)) != -1) { out.write(b, 0, read); } out.flush(); res = new String(dataStream.toByteArray()); } catch (IOException e) { e.printStackTrace(); return null; } finally { Constants.closeStream(fis); Constants.closeStream(in); Constants.closeStream(out); } return res; }
[ "public", "String", "getServiceAsJSON", "(", "String", "id", ")", "{", "String", "path", "=", "this", ".", "registeredConfigurations", ".", "get", "(", "id", ")", ";", "if", "(", "path", "==", "null", ")", "{", "return", "null", ";", "}", "// cargar fich...
Returns the content of the json document describing a service given its id @param id The id of the service. Usually the name of the json document @return The content of the json document
[ "Returns", "the", "content", "of", "the", "json", "document", "describing", "a", "service", "given", "its", "id" ]
train
https://github.com/alrocar/POIProxy/blob/e1dabe738a862478b2580e90d5fc4209a2997868/es.alrocar.poiproxy/src/main/java/es/alrocar/poiproxy/configuration/ServiceConfigurationManager.java#L198-L234
mfornos/humanize
humanize-slim/src/main/java/humanize/Humanize.java
Humanize.formatDate
public static String formatDate(final Date value, final String pattern) { return new SimpleDateFormat(pattern, currentLocale()).format(value); }
java
public static String formatDate(final Date value, final String pattern) { return new SimpleDateFormat(pattern, currentLocale()).format(value); }
[ "public", "static", "String", "formatDate", "(", "final", "Date", "value", ",", "final", "String", "pattern", ")", "{", "return", "new", "SimpleDateFormat", "(", "pattern", ",", "currentLocale", "(", ")", ")", ".", "format", "(", "value", ")", ";", "}" ]
<p> Formats a date according to the given pattern. </p> @param value Date to be formatted @param pattern The pattern. @return a formatted date/time string @see #dateFormat(String)
[ "<p", ">", "Formats", "a", "date", "according", "to", "the", "given", "pattern", ".", "<", "/", "p", ">" ]
train
https://github.com/mfornos/humanize/blob/59fc103045de9d217c9e77dbcb7621f992f46c63/humanize-slim/src/main/java/humanize/Humanize.java#L986-L989
Whiley/WhileyCompiler
src/main/java/wyil/transform/VerificationConditionGenerator.java
VerificationConditionGenerator.translateBreak
private Context translateBreak(WyilFile.Stmt.Break stmt, Context context) { LoopScope enclosingLoop = context.getEnclosingLoopScope(); enclosingLoop.addBreakContext(context); return null; }
java
private Context translateBreak(WyilFile.Stmt.Break stmt, Context context) { LoopScope enclosingLoop = context.getEnclosingLoopScope(); enclosingLoop.addBreakContext(context); return null; }
[ "private", "Context", "translateBreak", "(", "WyilFile", ".", "Stmt", ".", "Break", "stmt", ",", "Context", "context", ")", "{", "LoopScope", "enclosingLoop", "=", "context", ".", "getEnclosingLoopScope", "(", ")", ";", "enclosingLoop", ".", "addBreakContext", "...
Translate a break statement. This takes the current context and pushes it into the enclosing loop scope. It will then be extracted later and used. @param stmt @param wyalFile
[ "Translate", "a", "break", "statement", ".", "This", "takes", "the", "current", "context", "and", "pushes", "it", "into", "the", "enclosing", "loop", "scope", ".", "It", "will", "then", "be", "extracted", "later", "and", "used", "." ]
train
https://github.com/Whiley/WhileyCompiler/blob/680f8a657d3fc286f8cc422755988b6d74ab3f4c/src/main/java/wyil/transform/VerificationConditionGenerator.java#L744-L748
BioPAX/Paxtools
pattern/src/main/java/org/biopax/paxtools/pattern/constraint/IDConstraint.java
IDConstraint.satisfies
@Override public boolean satisfies(Match match, int... ind) { return ids.contains(match.get(ind[0]).getUri()); }
java
@Override public boolean satisfies(Match match, int... ind) { return ids.contains(match.get(ind[0]).getUri()); }
[ "@", "Override", "public", "boolean", "satisfies", "(", "Match", "match", ",", "int", "...", "ind", ")", "{", "return", "ids", ".", "contains", "(", "match", ".", "get", "(", "ind", "[", "0", "]", ")", ".", "getUri", "(", ")", ")", ";", "}" ]
Checks if the element has one of the desired IDs. @param match current pattern match @param ind mapped indices @return true if the ID is in the list
[ "Checks", "if", "the", "element", "has", "one", "of", "the", "desired", "IDs", "." ]
train
https://github.com/BioPAX/Paxtools/blob/2f93afa94426bf8b5afc2e0e61cd4b269a83288d/pattern/src/main/java/org/biopax/paxtools/pattern/constraint/IDConstraint.java#L45-L49
d-tarasov/android-intents
library/src/com/dmitriy/tarasov/android/intents/IntentUtils.java
IntentUtils.sendSms
public static Intent sendSms(Context context, String to, String message) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) { String defaultSmsPackageName = Telephony.Sms.getDefaultSmsPackage(context); Intent intent = new Intent(Intent.ACTION_SENDTO, Uri.parse("smsto:" + to)); intent.putExtra("sms_body", message); if (defaultSmsPackageName != null) { intent.setPackage(defaultSmsPackageName); } return intent; } else { Uri smsUri = Uri.parse("tel:" + to); Intent intent = new Intent(Intent.ACTION_VIEW, smsUri); intent.putExtra("address", to); intent.putExtra("sms_body", message); intent.setType("vnd.android-dir/mms-sms"); return intent; } }
java
public static Intent sendSms(Context context, String to, String message) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) { String defaultSmsPackageName = Telephony.Sms.getDefaultSmsPackage(context); Intent intent = new Intent(Intent.ACTION_SENDTO, Uri.parse("smsto:" + to)); intent.putExtra("sms_body", message); if (defaultSmsPackageName != null) { intent.setPackage(defaultSmsPackageName); } return intent; } else { Uri smsUri = Uri.parse("tel:" + to); Intent intent = new Intent(Intent.ACTION_VIEW, smsUri); intent.putExtra("address", to); intent.putExtra("sms_body", message); intent.setType("vnd.android-dir/mms-sms"); return intent; } }
[ "public", "static", "Intent", "sendSms", "(", "Context", "context", ",", "String", "to", ",", "String", "message", ")", "{", "if", "(", "Build", ".", "VERSION", ".", "SDK_INT", ">=", "Build", ".", "VERSION_CODES", ".", "KITKAT", ")", "{", "String", "defa...
Send SMS message using built-in app @param context Application context @param to Receiver phone number @param message Text to send
[ "Send", "SMS", "message", "using", "built", "-", "in", "app" ]
train
https://github.com/d-tarasov/android-intents/blob/ac3c6e2fd88057708988a96eda6240c29efe1b9a/library/src/com/dmitriy/tarasov/android/intents/IntentUtils.java#L118-L135
OpenLiberty/open-liberty
dev/com.ibm.ws.security.wim.adapter.ldap/src/com/ibm/ws/security/wim/adapter/ldap/LdapAdapter.java
LdapAdapter.getString
@Trivial private String getString(boolean isOctet, Object ldapValue) { if (isOctet) { return LdapHelper.getOctetString((byte[]) ldapValue); } else { return ldapValue.toString(); } }
java
@Trivial private String getString(boolean isOctet, Object ldapValue) { if (isOctet) { return LdapHelper.getOctetString((byte[]) ldapValue); } else { return ldapValue.toString(); } }
[ "@", "Trivial", "private", "String", "getString", "(", "boolean", "isOctet", ",", "Object", "ldapValue", ")", "{", "if", "(", "isOctet", ")", "{", "return", "LdapHelper", ".", "getOctetString", "(", "(", "byte", "[", "]", ")", "ldapValue", ")", ";", "}",...
Convert the value into an appropriate string value. @param isOctet @param ldapValue @return
[ "Convert", "the", "value", "into", "an", "appropriate", "string", "value", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.security.wim.adapter.ldap/src/com/ibm/ws/security/wim/adapter/ldap/LdapAdapter.java#L1082-L1089
facebookarchive/hadoop-20
src/mapred/org/apache/hadoop/mapreduce/lib/output/FileOutputCommitter.java
FileOutputCommitter.markOutputDirSuccessful
private void markOutputDirSuccessful(JobContext context) throws IOException { if (outputPath != null) { FileSystem fileSys = outputPath.getFileSystem(context.getConfiguration()); if (fileSys.exists(outputPath)) { // create a file in the folder to mark it Path filePath = new Path(outputPath, SUCCEEDED_FILE_NAME); fileSys.create(filePath).close(); } } }
java
private void markOutputDirSuccessful(JobContext context) throws IOException { if (outputPath != null) { FileSystem fileSys = outputPath.getFileSystem(context.getConfiguration()); if (fileSys.exists(outputPath)) { // create a file in the folder to mark it Path filePath = new Path(outputPath, SUCCEEDED_FILE_NAME); fileSys.create(filePath).close(); } } }
[ "private", "void", "markOutputDirSuccessful", "(", "JobContext", "context", ")", "throws", "IOException", "{", "if", "(", "outputPath", "!=", "null", ")", "{", "FileSystem", "fileSys", "=", "outputPath", ".", "getFileSystem", "(", "context", ".", "getConfiguration...
Mark the output dir of the job for which the context is passed.
[ "Mark", "the", "output", "dir", "of", "the", "job", "for", "which", "the", "context", "is", "passed", "." ]
train
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/mapred/org/apache/hadoop/mapreduce/lib/output/FileOutputCommitter.java#L93-L103
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/SerializerBase.java
SerializerBase.setDoctype
public void setDoctype(String doctypeSystem, String doctypePublic) { setOutputProperty(OutputKeys.DOCTYPE_SYSTEM, doctypeSystem); setOutputProperty(OutputKeys.DOCTYPE_PUBLIC, doctypePublic); }
java
public void setDoctype(String doctypeSystem, String doctypePublic) { setOutputProperty(OutputKeys.DOCTYPE_SYSTEM, doctypeSystem); setOutputProperty(OutputKeys.DOCTYPE_PUBLIC, doctypePublic); }
[ "public", "void", "setDoctype", "(", "String", "doctypeSystem", ",", "String", "doctypePublic", ")", "{", "setOutputProperty", "(", "OutputKeys", ".", "DOCTYPE_SYSTEM", ",", "doctypeSystem", ")", ";", "setOutputProperty", "(", "OutputKeys", ".", "DOCTYPE_PUBLIC", ",...
Set the value coming from the xsl:output doctype-public and doctype-system stylesheet properties @param doctypeSystem the system identifier to be used in the DOCTYPE declaration in the output document. @param doctypePublic the public identifier to be used in the DOCTYPE declaration in the output document.
[ "Set", "the", "value", "coming", "from", "the", "xsl", ":", "output", "doctype", "-", "public", "and", "doctype", "-", "system", "stylesheet", "properties" ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/SerializerBase.java#L643-L647
heroku/heroku.jar
heroku-api/src/main/java/com/heroku/api/HerokuAPI.java
HerokuAPI.removeCollaborator
public void removeCollaborator(String appName, String collaborator) { connection.execute(new SharingRemove(appName, collaborator), apiKey); }
java
public void removeCollaborator(String appName, String collaborator) { connection.execute(new SharingRemove(appName, collaborator), apiKey); }
[ "public", "void", "removeCollaborator", "(", "String", "appName", ",", "String", "collaborator", ")", "{", "connection", ".", "execute", "(", "new", "SharingRemove", "(", "appName", ",", "collaborator", ")", ",", "apiKey", ")", ";", "}" ]
Remove a collaborator from an app. @param appName App name. See {@link #listApps} for a list of apps that can be used. @param collaborator See {@link #listCollaborators} for collaborators that can be removed from the app.
[ "Remove", "a", "collaborator", "from", "an", "app", "." ]
train
https://github.com/heroku/heroku.jar/blob/d9e52991293159498c10c498c6f91fcdd637378e/heroku-api/src/main/java/com/heroku/api/HerokuAPI.java#L320-L322
rwl/CSparseJ
src/main/java/edu/emory/mathcs/csparsej/tdcomplex/DZcs_house.java
DZcs_house.cs_house
public static double [] cs_house(DZcsa x, int x_offset, double[] beta, int n) { double[] s = cs_czero() ; int i ; if (x == null) return new double [] {-1.0, 0.0} ; /* check inputs */ /* s = norm(x) */ for (i = 0 ; i < n ; i++) // TODO: check i = 1 s = cs_cplus(s, cs_cmult(x.get(x_offset + i), cs_conj(x.get(x_offset + i)))) ; s = cs_csqrt(s) ; if (cs_cequal(s, cs_czero())) { beta [0] = 0.0 ; x.set(x_offset + 0, 1.0, 0.0) ; } else { /* s = sign(x[0]) * norm (x) ; */ if (!cs_cequal(x.get(x_offset + 0), cs_czero())) { s = cs_cmult(s, cs_cdiv(x.get(x_offset + 0), new double [] {cs_cabs(x.get(x_offset + 0)), 0.0})) ; } x.set(x_offset + 0, cs_cplus(x.get(x_offset + 0), s)) ; beta [0] = 1 / cs_creal( cs_cmult(cs_conj(s), x.get(x_offset + 0)) ) ; } return cs_cmult(s, -1) ; }
java
public static double [] cs_house(DZcsa x, int x_offset, double[] beta, int n) { double[] s = cs_czero() ; int i ; if (x == null) return new double [] {-1.0, 0.0} ; /* check inputs */ /* s = norm(x) */ for (i = 0 ; i < n ; i++) // TODO: check i = 1 s = cs_cplus(s, cs_cmult(x.get(x_offset + i), cs_conj(x.get(x_offset + i)))) ; s = cs_csqrt(s) ; if (cs_cequal(s, cs_czero())) { beta [0] = 0.0 ; x.set(x_offset + 0, 1.0, 0.0) ; } else { /* s = sign(x[0]) * norm (x) ; */ if (!cs_cequal(x.get(x_offset + 0), cs_czero())) { s = cs_cmult(s, cs_cdiv(x.get(x_offset + 0), new double [] {cs_cabs(x.get(x_offset + 0)), 0.0})) ; } x.set(x_offset + 0, cs_cplus(x.get(x_offset + 0), s)) ; beta [0] = 1 / cs_creal( cs_cmult(cs_conj(s), x.get(x_offset + 0)) ) ; } return cs_cmult(s, -1) ; }
[ "public", "static", "double", "[", "]", "cs_house", "(", "DZcsa", "x", ",", "int", "x_offset", ",", "double", "[", "]", "beta", ",", "int", "n", ")", "{", "double", "[", "]", "s", "=", "cs_czero", "(", ")", ";", "int", "i", ";", "if", "(", "x",...
Compute a Householder reflection [v,beta,s]=house(x), overwrite x with v, where (I-beta*v*v')*x = s*e1 and e1 = [1 0 ... 0]'. Note that this CXSparseJ version is different than CSparseJ. See Higham, Accuracy & Stability of Num Algorithms, 2nd ed, 2002, page 357. @param x x on output, v on input @param beta scalar beta @param n the length of x @return norm2(x), -1 on error
[ "Compute", "a", "Householder", "reflection", "[", "v", "beta", "s", "]", "=", "house", "(", "x", ")", "overwrite", "x", "with", "v", "where", "(", "I", "-", "beta", "*", "v", "*", "v", ")", "*", "x", "=", "s", "*", "e1", "and", "e1", "=", "["...
train
https://github.com/rwl/CSparseJ/blob/6a6f66bccce1558156a961494358952603b0ac84/src/main/java/edu/emory/mathcs/csparsej/tdcomplex/DZcs_house.java#L62-L87
rometools/rome
rome/src/main/java/com/rometools/rome/io/WireFeedOutput.java
WireFeedOutput.outputString
public String outputString(final WireFeed feed, final boolean prettyPrint) throws IllegalArgumentException, FeedException { final Document doc = outputJDom(feed); final String encoding = feed.getEncoding(); Format format; if (prettyPrint) { format = Format.getPrettyFormat(); } else { format = Format.getCompactFormat(); } if (encoding != null) { format.setEncoding(encoding); } final XMLOutputter outputter = new XMLOutputter(format); return outputter.outputString(doc); }
java
public String outputString(final WireFeed feed, final boolean prettyPrint) throws IllegalArgumentException, FeedException { final Document doc = outputJDom(feed); final String encoding = feed.getEncoding(); Format format; if (prettyPrint) { format = Format.getPrettyFormat(); } else { format = Format.getCompactFormat(); } if (encoding != null) { format.setEncoding(encoding); } final XMLOutputter outputter = new XMLOutputter(format); return outputter.outputString(doc); }
[ "public", "String", "outputString", "(", "final", "WireFeed", "feed", ",", "final", "boolean", "prettyPrint", ")", "throws", "IllegalArgumentException", ",", "FeedException", "{", "final", "Document", "doc", "=", "outputJDom", "(", "feed", ")", ";", "final", "St...
Creates a String with the XML representation for the given WireFeed. <p> If the feed encoding is not NULL, it will be used in the XML prolog encoding attribute. It is the responsibility of the developer to ensure that if the String is written to a character stream the stream charset is the same as the feed encoding property. <p> NOTE: This method delages to the 'Document WireFeedOutput#outputJDom(WireFeed)'. <p> @param feed Abstract feed to create XML representation from. The type of the WireFeed must match the type given to the FeedOuptut constructor. @param prettyPrint pretty-print XML (true) oder collapsed @return a String with the XML representation for the given WireFeed. @throws IllegalArgumentException thrown if the feed type of the WireFeedOutput and WireFeed don't match. @throws FeedException thrown if the XML representation for the feed could not be created.
[ "Creates", "a", "String", "with", "the", "XML", "representation", "for", "the", "given", "WireFeed", ".", "<p", ">", "If", "the", "feed", "encoding", "is", "not", "NULL", "it", "will", "be", "used", "in", "the", "XML", "prolog", "encoding", "attribute", ...
train
https://github.com/rometools/rome/blob/5fcf0b1a9a6cdedbe253a45ad9468c54a0f97010/rome/src/main/java/com/rometools/rome/io/WireFeedOutput.java#L121-L135
kiegroup/drools
kie-dmn/kie-dmn-feel/src/main/java/org/kie/dmn/feel/codegen/feel11/CompiledFEELSemanticMappings.java
CompiledFEELSemanticMappings.exists
public static Boolean exists( EvaluationContext ctx, Object tests, Object target) { if (!(tests instanceof List)) { if (tests == null) { ctx.notifyEvt(() -> new ASTEventBase(FEELEvent.Severity.ERROR, Msg.createMessage(Msg.IS_NULL, "value"), null)); return null; } return applyUnaryTest(ctx, tests, target); } for (Object test : (List) tests) { Boolean r = applyUnaryTest(ctx, test, target); if (Boolean.TRUE.equals(r)) { return true; } } return false; }
java
public static Boolean exists( EvaluationContext ctx, Object tests, Object target) { if (!(tests instanceof List)) { if (tests == null) { ctx.notifyEvt(() -> new ASTEventBase(FEELEvent.Severity.ERROR, Msg.createMessage(Msg.IS_NULL, "value"), null)); return null; } return applyUnaryTest(ctx, tests, target); } for (Object test : (List) tests) { Boolean r = applyUnaryTest(ctx, test, target); if (Boolean.TRUE.equals(r)) { return true; } } return false; }
[ "public", "static", "Boolean", "exists", "(", "EvaluationContext", "ctx", ",", "Object", "tests", ",", "Object", "target", ")", "{", "if", "(", "!", "(", "tests", "instanceof", "List", ")", ")", "{", "if", "(", "tests", "==", "null", ")", "{", "ctx", ...
Returns true when at least one of the elements of the list matches the target. The list may contain both objects (equals) and UnaryTests (apply)
[ "Returns", "true", "when", "at", "least", "one", "of", "the", "elements", "of", "the", "list", "matches", "the", "target", ".", "The", "list", "may", "contain", "both", "objects", "(", "equals", ")", "and", "UnaryTests", "(", "apply", ")" ]
train
https://github.com/kiegroup/drools/blob/22b0275d6dbe93070b8090948502cf46eda543c4/kie-dmn/kie-dmn-feel/src/main/java/org/kie/dmn/feel/codegen/feel11/CompiledFEELSemanticMappings.java#L109-L130
jillesvangurp/jsonj
src/main/java/com/github/jsonj/JsonArray.java
JsonArray.replaceObject
public boolean replaceObject(JsonObject e1, JsonObject e2, String...path) { JsonElement compareElement = e1.get(path); if(compareElement == null) { throw new IllegalArgumentException("specified path may not be null in object " + StringUtils.join(path)); } int i=0; for(JsonElement e: this) { if(e.isObject()) { JsonElement fieldValue = e.asObject().get(path); if(compareElement.equals(fieldValue)) { set(i,e2); return true; } } i++; } return false; }
java
public boolean replaceObject(JsonObject e1, JsonObject e2, String...path) { JsonElement compareElement = e1.get(path); if(compareElement == null) { throw new IllegalArgumentException("specified path may not be null in object " + StringUtils.join(path)); } int i=0; for(JsonElement e: this) { if(e.isObject()) { JsonElement fieldValue = e.asObject().get(path); if(compareElement.equals(fieldValue)) { set(i,e2); return true; } } i++; } return false; }
[ "public", "boolean", "replaceObject", "(", "JsonObject", "e1", ",", "JsonObject", "e2", ",", "String", "...", "path", ")", "{", "JsonElement", "compareElement", "=", "e1", ".", "get", "(", "path", ")", ";", "if", "(", "compareElement", "==", "null", ")", ...
Convenient replace method that allows you to replace an object based on field equality for a specified field. Useful if you have an id field in your objects. Note, the array may contain non objects as well or objects without the specified field. Those elements won't be replaced of course. @param e1 object you want replaced; must have a value at the specified path @param e2 replacement @param path path @return true if something was replaced.
[ "Convenient", "replace", "method", "that", "allows", "you", "to", "replace", "an", "object", "based", "on", "field", "equality", "for", "a", "specified", "field", ".", "Useful", "if", "you", "have", "an", "id", "field", "in", "your", "objects", ".", "Note"...
train
https://github.com/jillesvangurp/jsonj/blob/1da0c44c5bdb60c0cd806c48d2da5a8a75bf84af/src/main/java/com/github/jsonj/JsonArray.java#L603-L620
OpenLiberty/open-liberty
dev/com.ibm.ws.org.apache.cxf.cxf.rt.rs.client.3.2/src/org/apache/cxf/jaxrs/client/JAXRSClientFactoryBean.java
JAXRSClientFactoryBean.setHeaders
public void setHeaders(Map<String, String> map) { headers = new MetadataMap<String, String>(); for (Map.Entry<String, String> entry : map.entrySet()) { String[] values = entry.getValue().split(","); for (String v : values) { if (v.length() != 0) { headers.add(entry.getKey(), v); } } } }
java
public void setHeaders(Map<String, String> map) { headers = new MetadataMap<String, String>(); for (Map.Entry<String, String> entry : map.entrySet()) { String[] values = entry.getValue().split(","); for (String v : values) { if (v.length() != 0) { headers.add(entry.getKey(), v); } } } }
[ "public", "void", "setHeaders", "(", "Map", "<", "String", ",", "String", ">", "map", ")", "{", "headers", "=", "new", "MetadataMap", "<", "String", ",", "String", ">", "(", ")", ";", "for", "(", "Map", ".", "Entry", "<", "String", ",", "String", "...
Sets the headers new proxy or WebClient instances will be initialized with. @param map the headers
[ "Sets", "the", "headers", "new", "proxy", "or", "WebClient", "instances", "will", "be", "initialized", "with", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.org.apache.cxf.cxf.rt.rs.client.3.2/src/org/apache/cxf/jaxrs/client/JAXRSClientFactoryBean.java#L187-L197
nohana/Amalgam
amalgam/src/main/java/com/amalgam/os/BundleUtils.java
BundleUtils.optLong
public static long optLong(@Nullable Bundle bundle, @Nullable String key) { return optLong(bundle, key, 0L); }
java
public static long optLong(@Nullable Bundle bundle, @Nullable String key) { return optLong(bundle, key, 0L); }
[ "public", "static", "long", "optLong", "(", "@", "Nullable", "Bundle", "bundle", ",", "@", "Nullable", "String", "key", ")", "{", "return", "optLong", "(", "bundle", ",", "key", ",", "0L", ")", ";", "}" ]
Returns a optional long value. In other words, returns the value mapped by key if it exists and is a long. The bundle argument is allowed to be {@code null}. If the bundle is null, this method returns 0. @param bundle a bundle. If the bundle is null, this method will return 0. @param key a key for the value. @return a long value if exists, 0 otherwise. @see android.os.Bundle#getLong(String)
[ "Returns", "a", "optional", "long", "value", ".", "In", "other", "words", "returns", "the", "value", "mapped", "by", "key", "if", "it", "exists", "and", "is", "a", "long", ".", "The", "bundle", "argument", "is", "allowed", "to", "be", "{" ]
train
https://github.com/nohana/Amalgam/blob/57809ddbfe7897e979cf507982ce0b3aa5e0ed8a/amalgam/src/main/java/com/amalgam/os/BundleUtils.java#L631-L633
google/closure-compiler
src/com/google/javascript/refactoring/Matchers.java
Matchers.allOf
public static Matcher allOf(final Matcher... matchers) { return new Matcher() { @Override public boolean matches(Node node, NodeMetadata metadata) { for (Matcher m : matchers) { if (!m.matches(node, metadata)) { return false; } } return true; } }; }
java
public static Matcher allOf(final Matcher... matchers) { return new Matcher() { @Override public boolean matches(Node node, NodeMetadata metadata) { for (Matcher m : matchers) { if (!m.matches(node, metadata)) { return false; } } return true; } }; }
[ "public", "static", "Matcher", "allOf", "(", "final", "Matcher", "...", "matchers", ")", "{", "return", "new", "Matcher", "(", ")", "{", "@", "Override", "public", "boolean", "matches", "(", "Node", "node", ",", "NodeMetadata", "metadata", ")", "{", "for",...
Returns a Matcher that returns true only if all of the provided matchers match.
[ "Returns", "a", "Matcher", "that", "returns", "true", "only", "if", "all", "of", "the", "provided", "matchers", "match", "." ]
train
https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/refactoring/Matchers.java#L49-L60
petergeneric/stdlib
util/carbon-client/src/main/java/com/peterphi/carbon/type/mutable/CarbonSource.java
CarbonSource.buildFilterElement
static Element buildFilterElement(String filterName, String filterGUID) { Element filter = new Element(filterName); Element module = new Element("Module_0"); filter.addContent(module); module.setAttribute("PresetGUID", filterGUID); return filter; }
java
static Element buildFilterElement(String filterName, String filterGUID) { Element filter = new Element(filterName); Element module = new Element("Module_0"); filter.addContent(module); module.setAttribute("PresetGUID", filterGUID); return filter; }
[ "static", "Element", "buildFilterElement", "(", "String", "filterName", ",", "String", "filterGUID", ")", "{", "Element", "filter", "=", "new", "Element", "(", "filterName", ")", ";", "Element", "module", "=", "new", "Element", "(", "\"Module_0\"", ")", ";", ...
Builds a filter element that looks like: <p/> <pre> &lt;Filter_0> &lt;Module_0 PresetGUID="{D527E1A0-2CC7-4FE5-99F7-C62355BFBD31}" /> &lt;/Filter_0> <pre> @param filterGUID the guid to use for the PresetGUID attribute @return
[ "Builds", "a", "filter", "element", "that", "looks", "like", ":", "<p", "/", ">", "<pre", ">", "&lt", ";", "Filter_0", ">", "&lt", ";", "Module_0", "PresetGUID", "=", "{", "D527E1A0", "-", "2CC7", "-", "4FE5", "-", "99F7", "-", "C62355BFBD31", "}", "...
train
https://github.com/petergeneric/stdlib/blob/d4025d2f881bc0542b1e004c5f65a1ccaf895836/util/carbon-client/src/main/java/com/peterphi/carbon/type/mutable/CarbonSource.java#L175-L184
rhuss/jolokia
agent/core/src/main/java/org/jolokia/detector/AbstractServerDetector.java
AbstractServerDetector.getAttributeValue
protected String getAttributeValue(MBeanServerExecutor pMBeanServerExecutor, final ObjectName pMBean, final String pAttribute) { try { return pMBeanServerExecutor.call(pMBean, GET_ATTRIBUTE_HANDLER, pAttribute); } catch (IOException e) { return null; } catch (ReflectionException e) { return null; } catch (JMException e) { return null; } }
java
protected String getAttributeValue(MBeanServerExecutor pMBeanServerExecutor, final ObjectName pMBean, final String pAttribute) { try { return pMBeanServerExecutor.call(pMBean, GET_ATTRIBUTE_HANDLER, pAttribute); } catch (IOException e) { return null; } catch (ReflectionException e) { return null; } catch (JMException e) { return null; } }
[ "protected", "String", "getAttributeValue", "(", "MBeanServerExecutor", "pMBeanServerExecutor", ",", "final", "ObjectName", "pMBean", ",", "final", "String", "pAttribute", ")", "{", "try", "{", "return", "pMBeanServerExecutor", ".", "call", "(", "pMBean", ",", "GET_...
Get the string representation of an attribute @param pMBeanServerExecutor set of MBeanServers to query. The first one wins. @param pMBean name of MBean to lookup @param pAttribute attribute to lookup @return string value of attribute or <code>null</code> if the attribute could not be fetched
[ "Get", "the", "string", "representation", "of", "an", "attribute" ]
train
https://github.com/rhuss/jolokia/blob/dc95e7bef859b1829776c5a84c8f7738f5d7d9c3/agent/core/src/main/java/org/jolokia/detector/AbstractServerDetector.java#L93-L103
citrusframework/citrus
modules/citrus-http/src/main/java/com/consol/citrus/http/message/HttpMessageUtils.java
HttpMessageUtils.copy
public static void copy(HttpMessage from, HttpMessage to) { to.setName(from.getName()); to.setPayload(from.getPayload()); from.getHeaders().entrySet() .stream() .filter(entry -> !entry.getKey().equals(MessageHeaders.ID) && !entry.getKey().equals(MessageHeaders.TIMESTAMP)) .forEach(entry -> to.header(entry.getKey(), entry.getValue())); from.getHeaderData().forEach(to::addHeaderData); from.getCookies().forEach(to::cookie); }
java
public static void copy(HttpMessage from, HttpMessage to) { to.setName(from.getName()); to.setPayload(from.getPayload()); from.getHeaders().entrySet() .stream() .filter(entry -> !entry.getKey().equals(MessageHeaders.ID) && !entry.getKey().equals(MessageHeaders.TIMESTAMP)) .forEach(entry -> to.header(entry.getKey(), entry.getValue())); from.getHeaderData().forEach(to::addHeaderData); from.getCookies().forEach(to::cookie); }
[ "public", "static", "void", "copy", "(", "HttpMessage", "from", ",", "HttpMessage", "to", ")", "{", "to", ".", "setName", "(", "from", ".", "getName", "(", ")", ")", ";", "to", ".", "setPayload", "(", "from", ".", "getPayload", "(", ")", ")", ";", ...
Apply message settings to target http message. @param from @param to
[ "Apply", "message", "settings", "to", "target", "http", "message", "." ]
train
https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-http/src/main/java/com/consol/citrus/http/message/HttpMessageUtils.java#L56-L67
rzwitserloot/lombok.ast
src/main/lombok/ast/syntaxChecks/SyntacticValidityVisitorBase.java
SyntacticValidityVisitorBase.checkChildValidity
void checkChildValidity(Node node, Node child, String name, boolean mandatory, Class<?> typeAssertion) { verifyNodeRelation(node, child, name, mandatory, typeAssertion); }
java
void checkChildValidity(Node node, Node child, String name, boolean mandatory, Class<?> typeAssertion) { verifyNodeRelation(node, child, name, mandatory, typeAssertion); }
[ "void", "checkChildValidity", "(", "Node", "node", ",", "Node", "child", ",", "String", "name", ",", "boolean", "mandatory", ",", "Class", "<", "?", ">", "typeAssertion", ")", "{", "verifyNodeRelation", "(", "node", ",", "child", ",", "name", ",", "mandato...
Checks if a given child is syntactically valid; you specify exactly what is required for this to hold in the parameters. This method will recursively call {@link #checkSyntacticValidity()} on the child. @param node The node responsible for the check. @param child The actual child node object that will be checked. @param name The name of this node. For example, in a binary operation, {@code "left side"}. @param mandatory If this node not being there (being {@code null}) is a problem or acceptable. @param typeAssertion If the node exists, it must be an instance of this type.
[ "Checks", "if", "a", "given", "child", "is", "syntactically", "valid", ";", "you", "specify", "exactly", "what", "is", "required", "for", "this", "to", "hold", "in", "the", "parameters", ".", "This", "method", "will", "recursively", "call", "{", "@link", "...
train
https://github.com/rzwitserloot/lombok.ast/blob/ed83541c1a5a08952a5d4d7e316a6be9a05311fb/src/main/lombok/ast/syntaxChecks/SyntacticValidityVisitorBase.java#L69-L71
hyperledger/fabric-sdk-java
src/main/java/org/hyperledger/fabric/sdk/Channel.java
Channel.queryBlockByNumber
public BlockInfo queryBlockByNumber(Collection<Peer> peers, long blockNumber) throws InvalidArgumentException, ProposalException { return queryBlockByNumber(peers, blockNumber, client.getUserContext()); }
java
public BlockInfo queryBlockByNumber(Collection<Peer> peers, long blockNumber) throws InvalidArgumentException, ProposalException { return queryBlockByNumber(peers, blockNumber, client.getUserContext()); }
[ "public", "BlockInfo", "queryBlockByNumber", "(", "Collection", "<", "Peer", ">", "peers", ",", "long", "blockNumber", ")", "throws", "InvalidArgumentException", ",", "ProposalException", "{", "return", "queryBlockByNumber", "(", "peers", ",", "blockNumber", ",", "c...
query a peer in this channel for a Block by the blockNumber <STRONG>This method may not be thread safe if client context is changed!</STRONG> @param peers the peers to try and send the request to @param blockNumber index of the Block in the chain @return the {@link BlockInfo} with the given blockNumber @throws InvalidArgumentException @throws ProposalException
[ "query", "a", "peer", "in", "this", "channel", "for", "a", "Block", "by", "the", "blockNumber" ]
train
https://github.com/hyperledger/fabric-sdk-java/blob/4a2d7b3408b8b0a1ed812aa36942c438159c37a0/src/main/java/org/hyperledger/fabric/sdk/Channel.java#L2912-L2915
Javacord/Javacord
javacord-core/src/main/java/org/javacord/core/entity/message/MessageSetImpl.java
MessageSetImpl.getMessagesBeforeWhile
public static CompletableFuture<MessageSet> getMessagesBeforeWhile( TextChannel channel, Predicate<Message> condition, long before) { return getMessagesWhile(channel, condition, before, -1); }
java
public static CompletableFuture<MessageSet> getMessagesBeforeWhile( TextChannel channel, Predicate<Message> condition, long before) { return getMessagesWhile(channel, condition, before, -1); }
[ "public", "static", "CompletableFuture", "<", "MessageSet", ">", "getMessagesBeforeWhile", "(", "TextChannel", "channel", ",", "Predicate", "<", "Message", ">", "condition", ",", "long", "before", ")", "{", "return", "getMessagesWhile", "(", "channel", ",", "condi...
Gets messages in the given channel before a given message in any channel while they meet the given condition. If the first message does not match the condition, an empty set is returned. @param channel The channel of the messages. @param condition The condition that has to be met. @param before Get messages before the message with this id. @return The messages. @see #getMessagesBeforeAsStream(TextChannel, long)
[ "Gets", "messages", "in", "the", "given", "channel", "before", "a", "given", "message", "in", "any", "channel", "while", "they", "meet", "the", "given", "condition", ".", "If", "the", "first", "message", "does", "not", "match", "the", "condition", "an", "e...
train
https://github.com/Javacord/Javacord/blob/915aad084dc5e863284267529d0dccd625fc6886/javacord-core/src/main/java/org/javacord/core/entity/message/MessageSetImpl.java#L346-L349
sarxos/webcam-capture
webcam-capture/src/main/java/com/github/sarxos/webcam/WebcamMotionDetector.java
WebcamMotionDetector.getMotionCog
public Point getMotionCog() { Point cog = algorithm.getCog(); if (cog == null) { // detectorAlgorithm hasn't been called so far - get image center int w = webcam.getViewSize().width; int h = webcam.getViewSize().height; cog = new Point(w / 2, h / 2); } return cog; }
java
public Point getMotionCog() { Point cog = algorithm.getCog(); if (cog == null) { // detectorAlgorithm hasn't been called so far - get image center int w = webcam.getViewSize().width; int h = webcam.getViewSize().height; cog = new Point(w / 2, h / 2); } return cog; }
[ "public", "Point", "getMotionCog", "(", ")", "{", "Point", "cog", "=", "algorithm", ".", "getCog", "(", ")", ";", "if", "(", "cog", "==", "null", ")", "{", "// detectorAlgorithm hasn't been called so far - get image center\r", "int", "w", "=", "webcam", ".", "...
Get motion center of gravity. When no motion is detected this value points to the image center. @return Center of gravity point
[ "Get", "motion", "center", "of", "gravity", ".", "When", "no", "motion", "is", "detected", "this", "value", "points", "to", "the", "image", "center", "." ]
train
https://github.com/sarxos/webcam-capture/blob/efbdae04f9ba48db9ec621e94a9bcd6f031882c8/webcam-capture/src/main/java/com/github/sarxos/webcam/WebcamMotionDetector.java#L415-L424
Azure/azure-sdk-for-java
servicebus/data-plane/azure-servicebus/src/main/java/com/microsoft/azure/servicebus/management/ManagementClientAsync.java
ManagementClientAsync.createSubscriptionAsync
public CompletableFuture<SubscriptionDescription> createSubscriptionAsync(SubscriptionDescription subscriptionDescription, RuleDescription defaultRule) { subscriptionDescription.defaultRule = defaultRule; return putSubscriptionAsync(subscriptionDescription, false); }
java
public CompletableFuture<SubscriptionDescription> createSubscriptionAsync(SubscriptionDescription subscriptionDescription, RuleDescription defaultRule) { subscriptionDescription.defaultRule = defaultRule; return putSubscriptionAsync(subscriptionDescription, false); }
[ "public", "CompletableFuture", "<", "SubscriptionDescription", ">", "createSubscriptionAsync", "(", "SubscriptionDescription", "subscriptionDescription", ",", "RuleDescription", "defaultRule", ")", "{", "subscriptionDescription", ".", "defaultRule", "=", "defaultRule", ";", "...
Creates a new subscription in the service namespace with the provided default rule. See {@link SubscriptionDescription} for default values of subscription properties. @param subscriptionDescription - A {@link SubscriptionDescription} object describing the attributes with which the new subscription will be created. @param defaultRule - A {@link RuleDescription} object describing the default rule. If null, then pass-through filter will be created. @return {@link SubscriptionDescription} of the newly created subscription.
[ "Creates", "a", "new", "subscription", "in", "the", "service", "namespace", "with", "the", "provided", "default", "rule", ".", "See", "{" ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/servicebus/data-plane/azure-servicebus/src/main/java/com/microsoft/azure/servicebus/management/ManagementClientAsync.java#L650-L653
michael-rapp/AndroidMaterialValidation
library/src/main/java/de/mrapp/android/validation/Validators.java
Validators.iPv4Address
public static Validator<CharSequence> iPv4Address(@NonNull final Context context) { return new IPv4AddressValidator(context, R.string.default_error_message); }
java
public static Validator<CharSequence> iPv4Address(@NonNull final Context context) { return new IPv4AddressValidator(context, R.string.default_error_message); }
[ "public", "static", "Validator", "<", "CharSequence", ">", "iPv4Address", "(", "@", "NonNull", "final", "Context", "context", ")", "{", "return", "new", "IPv4AddressValidator", "(", "context", ",", "R", ".", "string", ".", "default_error_message", ")", ";", "}...
Creates and returns a validator, which allows to validate texts to ensure, that they represent valid IPv4 addresses. Empty texts are also accepted. @param context The context, which should be used to retrieve the error message, as an instance of the class {@link Context}. The context may not be null @return The validator, which has been created, as an instance of the type {@link Validator}
[ "Creates", "and", "returns", "a", "validator", "which", "allows", "to", "validate", "texts", "to", "ensure", "that", "they", "represent", "valid", "IPv4", "addresses", ".", "Empty", "texts", "are", "also", "accepted", "." ]
train
https://github.com/michael-rapp/AndroidMaterialValidation/blob/ac8693baeac7abddf2e38a47da4c1849d4661a8b/library/src/main/java/de/mrapp/android/validation/Validators.java#L924-L926
netplex/json-smart-v2
accessors-smart/src/main/java/net/minidev/asm/ASMUtil.java
ASMUtil.getAccessors
static public Accessor[] getAccessors(Class<?> type, FieldFilter filter) { Class<?> nextClass = type; HashMap<String, Accessor> map = new HashMap<String, Accessor>(); if (filter == null) filter = BasicFiledFilter.SINGLETON; while (nextClass != Object.class) { Field[] declaredFields = nextClass.getDeclaredFields(); for (Field field : declaredFields) { String fn = field.getName(); if (map.containsKey(fn)) continue; Accessor acc = new Accessor(nextClass, field, filter); if (!acc.isUsable()) continue; map.put(fn, acc); } nextClass = nextClass.getSuperclass(); } return map.values().toArray(new Accessor[map.size()]); }
java
static public Accessor[] getAccessors(Class<?> type, FieldFilter filter) { Class<?> nextClass = type; HashMap<String, Accessor> map = new HashMap<String, Accessor>(); if (filter == null) filter = BasicFiledFilter.SINGLETON; while (nextClass != Object.class) { Field[] declaredFields = nextClass.getDeclaredFields(); for (Field field : declaredFields) { String fn = field.getName(); if (map.containsKey(fn)) continue; Accessor acc = new Accessor(nextClass, field, filter); if (!acc.isUsable()) continue; map.put(fn, acc); } nextClass = nextClass.getSuperclass(); } return map.values().toArray(new Accessor[map.size()]); }
[ "static", "public", "Accessor", "[", "]", "getAccessors", "(", "Class", "<", "?", ">", "type", ",", "FieldFilter", "filter", ")", "{", "Class", "<", "?", ">", "nextClass", "=", "type", ";", "HashMap", "<", "String", ",", "Accessor", ">", "map", "=", ...
Extract all Accessor for the field of the given class. @param type @return all Accessor available
[ "Extract", "all", "Accessor", "for", "the", "field", "of", "the", "given", "class", "." ]
train
https://github.com/netplex/json-smart-v2/blob/bfb3daef039e22a7bbff5f76bf14ea23330cd70e/accessors-smart/src/main/java/net/minidev/asm/ASMUtil.java#L48-L68
prestodb/presto
presto-spi/src/main/java/com/facebook/presto/spi/function/Signature.java
Signature.withVariadicBound
public static TypeVariableConstraint withVariadicBound(String name, String variadicBound) { return new TypeVariableConstraint(name, false, false, variadicBound); }
java
public static TypeVariableConstraint withVariadicBound(String name, String variadicBound) { return new TypeVariableConstraint(name, false, false, variadicBound); }
[ "public", "static", "TypeVariableConstraint", "withVariadicBound", "(", "String", "name", ",", "String", "variadicBound", ")", "{", "return", "new", "TypeVariableConstraint", "(", "name", ",", "false", ",", "false", ",", "variadicBound", ")", ";", "}" ]
/* similar to T extends MyClass<?...>, if Java supported varargs wildcards
[ "/", "*", "similar", "to", "T", "extends", "MyClass<?", "...", ">", "if", "Java", "supported", "varargs", "wildcards" ]
train
https://github.com/prestodb/presto/blob/89de5e379d8f85e139d292b0add8c537a2a01a88/presto-spi/src/main/java/com/facebook/presto/spi/function/Signature.java#L161-L164
buschmais/extended-objects
impl/src/main/java/com/buschmais/xo/impl/ProxyFactory.java
ProxyFactory.createInstance
public <Instance> Instance createInstance(InvocationHandler invocationHandler, CompositeType compositeType) { Class<?>[] classes = compositeType.getClasses(); Constructor<?> constructor = classCache.getIfPresent(compositeType); if (constructor == null) { Class<?> type; try { type = Proxy.getProxyClass(classLoader, classes); } catch (IllegalArgumentException e) { throw new XOException("Cannot create proxy for " + compositeType + " of classes " + compositeType.getClasses(), e); } try { constructor = type.getConstructor(new Class<?>[] { InvocationHandler.class }); } catch (NoSuchMethodException e) { throw new XOException("Cannot find constructor for " + compositeType, e); } classCache.put(compositeType, constructor); } Instance instance; try { instance = (Instance) constructor.newInstance(invocationHandler); } catch (Exception e) { throw new XOException("Cannot create instance of " + compositeType, e); } return interceptorFactory.addInterceptor(instance, classes); }
java
public <Instance> Instance createInstance(InvocationHandler invocationHandler, CompositeType compositeType) { Class<?>[] classes = compositeType.getClasses(); Constructor<?> constructor = classCache.getIfPresent(compositeType); if (constructor == null) { Class<?> type; try { type = Proxy.getProxyClass(classLoader, classes); } catch (IllegalArgumentException e) { throw new XOException("Cannot create proxy for " + compositeType + " of classes " + compositeType.getClasses(), e); } try { constructor = type.getConstructor(new Class<?>[] { InvocationHandler.class }); } catch (NoSuchMethodException e) { throw new XOException("Cannot find constructor for " + compositeType, e); } classCache.put(compositeType, constructor); } Instance instance; try { instance = (Instance) constructor.newInstance(invocationHandler); } catch (Exception e) { throw new XOException("Cannot create instance of " + compositeType, e); } return interceptorFactory.addInterceptor(instance, classes); }
[ "public", "<", "Instance", ">", "Instance", "createInstance", "(", "InvocationHandler", "invocationHandler", ",", "CompositeType", "compositeType", ")", "{", "Class", "<", "?", ">", "[", "]", "classes", "=", "compositeType", ".", "getClasses", "(", ")", ";", "...
Creates a proxy instance. @param invocationHandler The {@link java.lang.reflect.InvocationHandler}. @param compositeType The composite type to create an instance for. @param <Instance> The instance type. @return The instance.
[ "Creates", "a", "proxy", "instance", "." ]
train
https://github.com/buschmais/extended-objects/blob/186431e81f3d8d26c511cfe1143dee59b03c2e7a/impl/src/main/java/com/buschmais/xo/impl/ProxyFactory.java#L50-L74
j256/simplejmx
src/main/java/com/j256/simplejmx/client/JmxClient.java
JmxClient.getOperationInfo
public MBeanOperationInfo getOperationInfo(ObjectName name, String oper) throws JMException { checkClientConnected(); MBeanInfo mbeanInfo; try { mbeanInfo = mbeanConn.getMBeanInfo(name); } catch (Exception e) { throw createJmException("Problems getting bean information from " + name, e); } for (MBeanOperationInfo info : mbeanInfo.getOperations()) { if (oper.equals(info.getName())) { return info; } } return null; }
java
public MBeanOperationInfo getOperationInfo(ObjectName name, String oper) throws JMException { checkClientConnected(); MBeanInfo mbeanInfo; try { mbeanInfo = mbeanConn.getMBeanInfo(name); } catch (Exception e) { throw createJmException("Problems getting bean information from " + name, e); } for (MBeanOperationInfo info : mbeanInfo.getOperations()) { if (oper.equals(info.getName())) { return info; } } return null; }
[ "public", "MBeanOperationInfo", "getOperationInfo", "(", "ObjectName", "name", ",", "String", "oper", ")", "throws", "JMException", "{", "checkClientConnected", "(", ")", ";", "MBeanInfo", "mbeanInfo", ";", "try", "{", "mbeanInfo", "=", "mbeanConn", ".", "getMBean...
Return an array of the operations associated with the bean name.
[ "Return", "an", "array", "of", "the", "operations", "associated", "with", "the", "bean", "name", "." ]
train
https://github.com/j256/simplejmx/blob/1a04f52512dfa0a711ba0cc7023c604dbc82a352/src/main/java/com/j256/simplejmx/client/JmxClient.java#L286-L300
CloudSlang/cs-actions
cs-vmware/src/main/java/io/cloudslang/content/vmware/connection/helpers/MoRefHandler.java
MoRefHandler.containerViewByType
private RetrieveResult containerViewByType(final ManagedObjectReference container, final String morefType, final RetrieveOptions retrieveOptions, final String... morefProperties ) throws RuntimeFaultFaultMsg, InvalidPropertyFaultMsg { PropertyFilterSpec[] propertyFilterSpecs = propertyFilterSpecs(container, morefType, morefProperties); return containerViewByType(retrieveOptions, propertyFilterSpecs); }
java
private RetrieveResult containerViewByType(final ManagedObjectReference container, final String morefType, final RetrieveOptions retrieveOptions, final String... morefProperties ) throws RuntimeFaultFaultMsg, InvalidPropertyFaultMsg { PropertyFilterSpec[] propertyFilterSpecs = propertyFilterSpecs(container, morefType, morefProperties); return containerViewByType(retrieveOptions, propertyFilterSpecs); }
[ "private", "RetrieveResult", "containerViewByType", "(", "final", "ManagedObjectReference", "container", ",", "final", "String", "morefType", ",", "final", "RetrieveOptions", "retrieveOptions", ",", "final", "String", "...", "morefProperties", ")", "throws", "RuntimeFault...
Returns the raw RetrieveResult object for the provided container filtered on properties list @param container - container to look in @param morefType - type to filter for @param morefProperties - properties to include @return com.vmware.vim25.RetrieveResult for this query @throws RuntimeFaultFaultMsg @throws InvalidPropertyFaultMsg
[ "Returns", "the", "raw", "RetrieveResult", "object", "for", "the", "provided", "container", "filtered", "on", "properties", "list" ]
train
https://github.com/CloudSlang/cs-actions/blob/9a1be1e99ad88286a6c153d5f2275df6ae1a57a1/cs-vmware/src/main/java/io/cloudslang/content/vmware/connection/helpers/MoRefHandler.java#L141-L149
BorderTech/wcomponents
wcomponents-examples/src/main/java/com/github/bordertech/wcomponents/examples/picker/MenuPanel.java
MenuPanel.getMatch
private ExampleData getMatch(final WComponent node, final String name, final boolean partial) { if (node instanceof WMenuItem) { ExampleData data = (ExampleData) ((WMenuItem) node).getActionObject(); Class<? extends WComponent> clazz = data.getExampleClass(); if (clazz.getName().equals(name) || data.getExampleName().equals(name) || (partial && clazz.getSimpleName().toLowerCase().contains(name.toLowerCase())) || (partial && data.getExampleName().toLowerCase().contains(name.toLowerCase()))) { return data; } } else if (node instanceof Container) { for (int i = 0; i < ((Container) node).getChildCount(); i++) { ExampleData result = getMatch(((Container) node).getChildAt(i), name, partial); if (result != null) { return result; } } } return null; }
java
private ExampleData getMatch(final WComponent node, final String name, final boolean partial) { if (node instanceof WMenuItem) { ExampleData data = (ExampleData) ((WMenuItem) node).getActionObject(); Class<? extends WComponent> clazz = data.getExampleClass(); if (clazz.getName().equals(name) || data.getExampleName().equals(name) || (partial && clazz.getSimpleName().toLowerCase().contains(name.toLowerCase())) || (partial && data.getExampleName().toLowerCase().contains(name.toLowerCase()))) { return data; } } else if (node instanceof Container) { for (int i = 0; i < ((Container) node).getChildCount(); i++) { ExampleData result = getMatch(((Container) node).getChildAt(i), name, partial); if (result != null) { return result; } } } return null; }
[ "private", "ExampleData", "getMatch", "(", "final", "WComponent", "node", ",", "final", "String", "name", ",", "final", "boolean", "partial", ")", "{", "if", "(", "node", "instanceof", "WMenuItem", ")", "{", "ExampleData", "data", "=", "(", "ExampleData", ")...
Recursively searches the menu for a match to a WComponent with the given name. @param node the current node in the menu being searched. @param name the component class name to search for. @param partial if true, perform a case-insensitive partial name search. @return the class for the given name, or null if not found.
[ "Recursively", "searches", "the", "menu", "for", "a", "match", "to", "a", "WComponent", "with", "the", "given", "name", "." ]
train
https://github.com/BorderTech/wcomponents/blob/d1a2b2243270067db030feb36ca74255aaa94436/wcomponents-examples/src/main/java/com/github/bordertech/wcomponents/examples/picker/MenuPanel.java#L172-L194
kotcrab/vis-ui
ui/src/main/java/com/kotcrab/vis/ui/widget/VisWindow.java
VisWindow.addCloseButton
public void addCloseButton () { Label titleLabel = getTitleLabel(); Table titleTable = getTitleTable(); VisImageButton closeButton = new VisImageButton("close-window"); titleTable.add(closeButton).padRight(-getPadRight() + 0.7f); closeButton.addListener(new ChangeListener() { @Override public void changed (ChangeEvent event, Actor actor) { close(); } }); closeButton.addListener(new ClickListener() { @Override public boolean touchDown (InputEvent event, float x, float y, int pointer, int button) { event.cancel(); return true; } }); if (titleLabel.getLabelAlign() == Align.center && titleTable.getChildren().size == 2) titleTable.getCell(titleLabel).padLeft(closeButton.getWidth() * 2); }
java
public void addCloseButton () { Label titleLabel = getTitleLabel(); Table titleTable = getTitleTable(); VisImageButton closeButton = new VisImageButton("close-window"); titleTable.add(closeButton).padRight(-getPadRight() + 0.7f); closeButton.addListener(new ChangeListener() { @Override public void changed (ChangeEvent event, Actor actor) { close(); } }); closeButton.addListener(new ClickListener() { @Override public boolean touchDown (InputEvent event, float x, float y, int pointer, int button) { event.cancel(); return true; } }); if (titleLabel.getLabelAlign() == Align.center && titleTable.getChildren().size == 2) titleTable.getCell(titleLabel).padLeft(closeButton.getWidth() * 2); }
[ "public", "void", "addCloseButton", "(", ")", "{", "Label", "titleLabel", "=", "getTitleLabel", "(", ")", ";", "Table", "titleTable", "=", "getTitleTable", "(", ")", ";", "VisImageButton", "closeButton", "=", "new", "VisImageButton", "(", "\"close-window\"", ")"...
Adds close button to window, next to window title. After pressing that button, {@link #close()} is called. If nothing else was added to title table, and current title alignment is center then the title will be automatically centered.
[ "Adds", "close", "button", "to", "window", "next", "to", "window", "title", ".", "After", "pressing", "that", "button", "{" ]
train
https://github.com/kotcrab/vis-ui/blob/3b68f82d94ae32bffa2a3399c63f432e0f4908e0/ui/src/main/java/com/kotcrab/vis/ui/widget/VisWindow.java#L169-L191
Azure/azure-sdk-for-java
labservices/resource-manager/v2018_10_15/src/main/java/com/microsoft/azure/management/labservices/v2018_10_15/implementation/EnvironmentsInner.java
EnvironmentsInner.update
public EnvironmentInner update(String resourceGroupName, String labAccountName, String labName, String environmentSettingName, String environmentName, EnvironmentFragment environment) { return updateWithServiceResponseAsync(resourceGroupName, labAccountName, labName, environmentSettingName, environmentName, environment).toBlocking().single().body(); }
java
public EnvironmentInner update(String resourceGroupName, String labAccountName, String labName, String environmentSettingName, String environmentName, EnvironmentFragment environment) { return updateWithServiceResponseAsync(resourceGroupName, labAccountName, labName, environmentSettingName, environmentName, environment).toBlocking().single().body(); }
[ "public", "EnvironmentInner", "update", "(", "String", "resourceGroupName", ",", "String", "labAccountName", ",", "String", "labName", ",", "String", "environmentSettingName", ",", "String", "environmentName", ",", "EnvironmentFragment", "environment", ")", "{", "return...
Modify properties of environments. @param resourceGroupName The name of the resource group. @param labAccountName The name of the lab Account. @param labName The name of the lab. @param environmentSettingName The name of the environment Setting. @param environmentName The name of the environment. @param environment Represents an environment instance @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 EnvironmentInner object if successful.
[ "Modify", "properties", "of", "environments", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/labservices/resource-manager/v2018_10_15/src/main/java/com/microsoft/azure/management/labservices/v2018_10_15/implementation/EnvironmentsInner.java#L959-L961
apache/flink
flink-table/flink-table-runtime-blink/src/main/java/org/apache/flink/table/util/SegmentsUtil.java
SegmentsUtil.copyToBytes
public static byte[] copyToBytes(MemorySegment[] segments, int offset, int numBytes) { return copyToBytes(segments, offset, new byte[numBytes], 0, numBytes); }
java
public static byte[] copyToBytes(MemorySegment[] segments, int offset, int numBytes) { return copyToBytes(segments, offset, new byte[numBytes], 0, numBytes); }
[ "public", "static", "byte", "[", "]", "copyToBytes", "(", "MemorySegment", "[", "]", "segments", ",", "int", "offset", ",", "int", "numBytes", ")", "{", "return", "copyToBytes", "(", "segments", ",", "offset", ",", "new", "byte", "[", "numBytes", "]", ",...
Copy segments to a new byte[]. @param segments Source segments. @param offset Source segments offset. @param numBytes the number bytes to copy.
[ "Copy", "segments", "to", "a", "new", "byte", "[]", "." ]
train
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-table/flink-table-runtime-blink/src/main/java/org/apache/flink/table/util/SegmentsUtil.java#L105-L107
deeplearning4j/deeplearning4j
deeplearning4j/deeplearning4j-nlp-parent/deeplearning4j-nlp/src/main/java/org/deeplearning4j/models/embeddings/loader/WordVectorSerializer.java
WordVectorSerializer.writeTsneFormat
public static void writeTsneFormat(Glove vec, INDArray tsne, File csv) throws Exception { try (BufferedWriter write = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(csv), StandardCharsets.UTF_8))) { int words = 0; InMemoryLookupCache l = (InMemoryLookupCache) vec.vocab(); for (String word : vec.vocab().words()) { if (word == null) { continue; } StringBuilder sb = new StringBuilder(); INDArray wordVector = tsne.getRow(l.wordFor(word).getIndex()); for (int j = 0; j < wordVector.length(); j++) { sb.append(wordVector.getDouble(j)); if (j < wordVector.length() - 1) { sb.append(","); } } sb.append(","); sb.append(word.replaceAll(" ", WHITESPACE_REPLACEMENT)); sb.append(" "); sb.append("\n"); write.write(sb.toString()); } log.info("Wrote " + words + " with size of " + vec.lookupTable().layerSize()); } }
java
public static void writeTsneFormat(Glove vec, INDArray tsne, File csv) throws Exception { try (BufferedWriter write = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(csv), StandardCharsets.UTF_8))) { int words = 0; InMemoryLookupCache l = (InMemoryLookupCache) vec.vocab(); for (String word : vec.vocab().words()) { if (word == null) { continue; } StringBuilder sb = new StringBuilder(); INDArray wordVector = tsne.getRow(l.wordFor(word).getIndex()); for (int j = 0; j < wordVector.length(); j++) { sb.append(wordVector.getDouble(j)); if (j < wordVector.length() - 1) { sb.append(","); } } sb.append(","); sb.append(word.replaceAll(" ", WHITESPACE_REPLACEMENT)); sb.append(" "); sb.append("\n"); write.write(sb.toString()); } log.info("Wrote " + words + " with size of " + vec.lookupTable().layerSize()); } }
[ "public", "static", "void", "writeTsneFormat", "(", "Glove", "vec", ",", "INDArray", "tsne", ",", "File", "csv", ")", "throws", "Exception", "{", "try", "(", "BufferedWriter", "write", "=", "new", "BufferedWriter", "(", "new", "OutputStreamWriter", "(", "new",...
Write the tsne format @param vec the word vectors to use for labeling @param tsne the tsne array to write @param csv the file to use @throws Exception
[ "Write", "the", "tsne", "format" ]
train
https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-nlp-parent/deeplearning4j-nlp/src/main/java/org/deeplearning4j/models/embeddings/loader/WordVectorSerializer.java#L1819-L1846
elki-project/elki
elki-core-util/src/main/java/de/lmu/ifi/dbs/elki/utilities/datastructures/BitsUtil.java
BitsUtil.previousClearBit
public static int previousClearBit(long v, int start) { if(start < 0) { return -1; } start = start < Long.SIZE ? start : Long.SIZE - 1; long cur = ~v & (LONG_ALL_BITS >>> -(start + 1)); return cur == 0 ? -1 : 63 - Long.numberOfLeadingZeros(cur); }
java
public static int previousClearBit(long v, int start) { if(start < 0) { return -1; } start = start < Long.SIZE ? start : Long.SIZE - 1; long cur = ~v & (LONG_ALL_BITS >>> -(start + 1)); return cur == 0 ? -1 : 63 - Long.numberOfLeadingZeros(cur); }
[ "public", "static", "int", "previousClearBit", "(", "long", "v", ",", "int", "start", ")", "{", "if", "(", "start", "<", "0", ")", "{", "return", "-", "1", ";", "}", "start", "=", "start", "<", "Long", ".", "SIZE", "?", "start", ":", "Long", ".",...
Find the previous clear bit. @param v Values to process @param start Start position (inclusive) @return Position of previous clear bit, or -1.
[ "Find", "the", "previous", "clear", "bit", "." ]
train
https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki-core-util/src/main/java/de/lmu/ifi/dbs/elki/utilities/datastructures/BitsUtil.java#L1262-L1269
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/javax/crypto/Cipher.java
Cipher.matchAttribute
static boolean matchAttribute(Provider.Service service, String attr, String value) { if (value == null) { return true; } final String pattern = service.getAttribute(attr); if (pattern == null) { return true; } final String valueUc = value.toUpperCase(Locale.US); return valueUc.matches(pattern.toUpperCase(Locale.US)); }
java
static boolean matchAttribute(Provider.Service service, String attr, String value) { if (value == null) { return true; } final String pattern = service.getAttribute(attr); if (pattern == null) { return true; } final String valueUc = value.toUpperCase(Locale.US); return valueUc.matches(pattern.toUpperCase(Locale.US)); }
[ "static", "boolean", "matchAttribute", "(", "Provider", ".", "Service", "service", ",", "String", "attr", ",", "String", "value", ")", "{", "if", "(", "value", "==", "null", ")", "{", "return", "true", ";", "}", "final", "String", "pattern", "=", "servic...
If the attribute listed exists, check that it matches the regular expression.
[ "If", "the", "attribute", "listed", "exists", "check", "that", "it", "matches", "the", "regular", "expression", "." ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/javax/crypto/Cipher.java#L2685-L2695
OpenLiberty/open-liberty
dev/com.ibm.ws.channelfw/src/com/ibm/ws/channelfw/internal/ChannelUtilsBase.java
ChannelUtilsBase.traceChannels
protected final void traceChannels(Object logTool, ChannelFramework cfw, String message, String prefix) { if (cfw == null) { debugTrace(logTool, prefix + " - No cfw to trace channels"); return; } List<?> lchannel; Iterator<?> ichannel; ChannelData channel; ChannelData[] channelList; // Create new String builder for list of configured channels StringBuilder traceMessage = new StringBuilder(300); // Prepend message passed as argument to our output traceMessage.append(prefix + ": Configured Channels - "); if (message != null) traceMessage.append(message); traceMessage.append(EOLN); // Get a list of all existing channels (should include XMem) channelList = cfw.getAllChannels(); // Trace all configured channels lchannel = Arrays.asList(channelList); for (ichannel = lchannel.iterator(); ichannel.hasNext();) { channel = (ChannelData) ichannel.next(); traceMessage.append(prefix + ": "); traceMessage.append(channel.getName()); traceMessage.append(" - "); traceMessage.append(channel.getFactoryType()); traceMessage.append(EOLN); } debugTrace(logTool, traceMessage.toString()); }
java
protected final void traceChannels(Object logTool, ChannelFramework cfw, String message, String prefix) { if (cfw == null) { debugTrace(logTool, prefix + " - No cfw to trace channels"); return; } List<?> lchannel; Iterator<?> ichannel; ChannelData channel; ChannelData[] channelList; // Create new String builder for list of configured channels StringBuilder traceMessage = new StringBuilder(300); // Prepend message passed as argument to our output traceMessage.append(prefix + ": Configured Channels - "); if (message != null) traceMessage.append(message); traceMessage.append(EOLN); // Get a list of all existing channels (should include XMem) channelList = cfw.getAllChannels(); // Trace all configured channels lchannel = Arrays.asList(channelList); for (ichannel = lchannel.iterator(); ichannel.hasNext();) { channel = (ChannelData) ichannel.next(); traceMessage.append(prefix + ": "); traceMessage.append(channel.getName()); traceMessage.append(" - "); traceMessage.append(channel.getFactoryType()); traceMessage.append(EOLN); } debugTrace(logTool, traceMessage.toString()); }
[ "protected", "final", "void", "traceChannels", "(", "Object", "logTool", ",", "ChannelFramework", "cfw", ",", "String", "message", ",", "String", "prefix", ")", "{", "if", "(", "cfw", "==", "null", ")", "{", "debugTrace", "(", "logTool", ",", "prefix", "+"...
Print channel configuration - for debug @param logTool Caller's LogTool (should be Logger OR TraceComponent) @param cfw Reference to channel framework service @param message Description to accompany trace, e.g. "CFW Channel Configuration" @param prefix Component-type prefix used to associate traces together, e.g. "XMEM", "ZIOP", "TCP", "SOAP"
[ "Print", "channel", "configuration", "-", "for", "debug" ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.channelfw/src/com/ibm/ws/channelfw/internal/ChannelUtilsBase.java#L205-L243
apache/incubator-gobblin
gobblin-core/src/main/java/org/apache/gobblin/source/extractor/utils/Utils.java
Utils.toDateTime
public static DateTime toDateTime(long input, String format, String timezone) { return toDateTime(Long.toString(input), format, timezone); }
java
public static DateTime toDateTime(long input, String format, String timezone) { return toDateTime(Long.toString(input), format, timezone); }
[ "public", "static", "DateTime", "toDateTime", "(", "long", "input", ",", "String", "format", ",", "String", "timezone", ")", "{", "return", "toDateTime", "(", "Long", ".", "toString", "(", "input", ")", ",", "format", ",", "timezone", ")", ";", "}" ]
Convert timestamp in a long format to joda time @param input timestamp @param format timestamp format @param timezone time zone of timestamp @return joda time
[ "Convert", "timestamp", "in", "a", "long", "format", "to", "joda", "time" ]
train
https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-core/src/main/java/org/apache/gobblin/source/extractor/utils/Utils.java#L349-L351
square/picasso
picasso/src/main/java/com/squareup/picasso3/BitmapUtils.java
BitmapUtils.decodeStream
static Bitmap decodeStream(Source source, Request request) throws IOException { ExceptionCatchingSource exceptionCatchingSource = new ExceptionCatchingSource(source); BufferedSource bufferedSource = Okio.buffer(exceptionCatchingSource); Bitmap bitmap = SDK_INT >= 28 ? decodeStreamP(request, bufferedSource) : decodeStreamPreP(request, bufferedSource); exceptionCatchingSource.throwIfCaught(); return bitmap; }
java
static Bitmap decodeStream(Source source, Request request) throws IOException { ExceptionCatchingSource exceptionCatchingSource = new ExceptionCatchingSource(source); BufferedSource bufferedSource = Okio.buffer(exceptionCatchingSource); Bitmap bitmap = SDK_INT >= 28 ? decodeStreamP(request, bufferedSource) : decodeStreamPreP(request, bufferedSource); exceptionCatchingSource.throwIfCaught(); return bitmap; }
[ "static", "Bitmap", "decodeStream", "(", "Source", "source", ",", "Request", "request", ")", "throws", "IOException", "{", "ExceptionCatchingSource", "exceptionCatchingSource", "=", "new", "ExceptionCatchingSource", "(", "source", ")", ";", "BufferedSource", "bufferedSo...
Decode a byte stream into a Bitmap. This method will take into account additional information about the supplied request in order to do the decoding efficiently (such as through leveraging {@code inSampleSize}).
[ "Decode", "a", "byte", "stream", "into", "a", "Bitmap", ".", "This", "method", "will", "take", "into", "account", "additional", "information", "about", "the", "supplied", "request", "in", "order", "to", "do", "the", "decoding", "efficiently", "(", "such", "a...
train
https://github.com/square/picasso/blob/89f55b76e3be2b65e5997b7698f782f16f8547e3/picasso/src/main/java/com/squareup/picasso3/BitmapUtils.java#L105-L113
quattor/pan
panc/src/main/java/org/quattor/pan/ttemplate/LocalVariableMap.java
LocalVariableMap.put
public Element put(String name, Element value) { assert (name != null); Element oldValue = null; if (value != null) { // Set the value and ensure that the replacement can be done. oldValue = map.put(name, value); if (oldValue != null) { oldValue.checkValidReplacement(value); } } else { // Remove the referenced variable. oldValue = map.remove(name); } return oldValue; }
java
public Element put(String name, Element value) { assert (name != null); Element oldValue = null; if (value != null) { // Set the value and ensure that the replacement can be done. oldValue = map.put(name, value); if (oldValue != null) { oldValue.checkValidReplacement(value); } } else { // Remove the referenced variable. oldValue = map.remove(name); } return oldValue; }
[ "public", "Element", "put", "(", "String", "name", ",", "Element", "value", ")", "{", "assert", "(", "name", "!=", "null", ")", ";", "Element", "oldValue", "=", "null", ";", "if", "(", "value", "!=", "null", ")", "{", "// Set the value and ensure that the ...
Assign the value to the given variable name. If the value is null, then the variable is undefined. If an old value existed, then this method will check that the new value is a valid replacement for the old one. If not, an exception will be thrown. @param name variable name to assign value to @param value Element to assign to the given variable name; variable is removed if the value is null @return old value of the named variable or null if it wasn't defined
[ "Assign", "the", "value", "to", "the", "given", "variable", "name", ".", "If", "the", "value", "is", "null", "then", "the", "variable", "is", "undefined", ".", "If", "an", "old", "value", "existed", "then", "this", "method", "will", "check", "that", "the...
train
https://github.com/quattor/pan/blob/009934a603dd0c08d3fa4bb7d9389c380a916f54/panc/src/main/java/org/quattor/pan/ttemplate/LocalVariableMap.java#L74-L95
alkacon/opencms-core
src-gwt/org/opencms/ade/upload/client/ui/CmsUploadHookDialog.java
CmsUploadHookDialog.openDialog
public static void openDialog( String title, String hookUri, List<String> uploadedFiles, final CloseHandler<PopupPanel> closeHandler) { if (hookUri.startsWith("#")) { List<CmsUUID> resourceIds = new ArrayList<CmsUUID>(); if (uploadedFiles != null) { for (String id : uploadedFiles) { resourceIds.add(new CmsUUID(id)); } } CmsEmbeddedDialogHandler handler = new CmsEmbeddedDialogHandler(new I_CmsActionHandler() { public void leavePage(String targetUri) { // TODO Auto-generated method stub } public void onSiteOrProjectChange(String sitePath, String serverLink) { // TODO Auto-generated method stub } public void refreshResource(CmsUUID structureId) { closeHandler.onClose(null); } }); String dialogId = hookUri.substring(1); handler.openDialog(dialogId, CmsGwtConstants.CONTEXT_TYPE_FILE_TABLE, resourceIds); } else { Map<String, String> parameters = new HashMap<String, String>(); parameters.put(I_CmsUploadConstants.PARAM_RESOURCES, Joiner.on(",").join(uploadedFiles)); CmsPopup popup = CmsFrameDialog.showFrameDialog( title, CmsCoreProvider.get().link(hookUri), parameters, closeHandler); popup.setHeight(DIALOG_HEIGHT); popup.setWidth(CmsPopup.DEFAULT_WIDTH); popup.center(); } }
java
public static void openDialog( String title, String hookUri, List<String> uploadedFiles, final CloseHandler<PopupPanel> closeHandler) { if (hookUri.startsWith("#")) { List<CmsUUID> resourceIds = new ArrayList<CmsUUID>(); if (uploadedFiles != null) { for (String id : uploadedFiles) { resourceIds.add(new CmsUUID(id)); } } CmsEmbeddedDialogHandler handler = new CmsEmbeddedDialogHandler(new I_CmsActionHandler() { public void leavePage(String targetUri) { // TODO Auto-generated method stub } public void onSiteOrProjectChange(String sitePath, String serverLink) { // TODO Auto-generated method stub } public void refreshResource(CmsUUID structureId) { closeHandler.onClose(null); } }); String dialogId = hookUri.substring(1); handler.openDialog(dialogId, CmsGwtConstants.CONTEXT_TYPE_FILE_TABLE, resourceIds); } else { Map<String, String> parameters = new HashMap<String, String>(); parameters.put(I_CmsUploadConstants.PARAM_RESOURCES, Joiner.on(",").join(uploadedFiles)); CmsPopup popup = CmsFrameDialog.showFrameDialog( title, CmsCoreProvider.get().link(hookUri), parameters, closeHandler); popup.setHeight(DIALOG_HEIGHT); popup.setWidth(CmsPopup.DEFAULT_WIDTH); popup.center(); } }
[ "public", "static", "void", "openDialog", "(", "String", "title", ",", "String", "hookUri", ",", "List", "<", "String", ">", "uploadedFiles", ",", "final", "CloseHandler", "<", "PopupPanel", ">", "closeHandler", ")", "{", "if", "(", "hookUri", ".", "startsWi...
Opens a new upload property dialog.<p> @param title the title for the dialog popup @param hookUri the URI of the upload hook page @param uploadedFiles the uploaded files @param closeHandler the dialog close handler
[ "Opens", "a", "new", "upload", "property", "dialog", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/ade/upload/client/ui/CmsUploadHookDialog.java#L72-L120
sawano/java-commons
src/main/java/se/sawano/java/commons/lang/validate/Validate.java
Validate.matchesPattern
public static CharSequence matchesPattern(final CharSequence input, final String pattern, final String message, final Object... values) { return INSTANCE.matchesPattern(input, pattern, message, values); }
java
public static CharSequence matchesPattern(final CharSequence input, final String pattern, final String message, final Object... values) { return INSTANCE.matchesPattern(input, pattern, message, values); }
[ "public", "static", "CharSequence", "matchesPattern", "(", "final", "CharSequence", "input", ",", "final", "String", "pattern", ",", "final", "String", "message", ",", "final", "Object", "...", "values", ")", "{", "return", "INSTANCE", ".", "matchesPattern", "("...
<p>Validate that the specified argument character sequence matches the specified regular expression pattern; otherwise throwing an exception with the specified message.</p> <pre>Validate.matchesPattern("hi", "[a-z]*", "%s does not match %s", "hi" "[a-z]*");</pre> <p>The syntax of the pattern is the one used in the {@link Pattern} class.</p> @param input the character sequence to validate, not null @param pattern the regular expression pattern, not null @param message the {@link String#format(String, Object...)} exception message if invalid, not null @param values the optional values for the formatted exception message, null array not recommended @return the input @throws IllegalArgumentValidationException if the character sequence does not match the pattern @see #matchesPattern(CharSequence, String)
[ "<p", ">", "Validate", "that", "the", "specified", "argument", "character", "sequence", "matches", "the", "specified", "regular", "expression", "pattern", ";", "otherwise", "throwing", "an", "exception", "with", "the", "specified", "message", ".", "<", "/", "p",...
train
https://github.com/sawano/java-commons/blob/6f219c9e8dec4401dbe528d17ae6ec1ef9c0d284/src/main/java/se/sawano/java/commons/lang/validate/Validate.java#L1402-L1404
emilsjolander/sprinkles
library/src/main/java/se/emilsjolander/sprinkles/Sprinkles.java
Sprinkles.getDatabase
static synchronized SQLiteDatabase getDatabase() { if(sInstance == null) { throw new SprinklesNotInitializedException(); } if(sDatabase == null) { DbOpenHelper dbOpenHelper = new DbOpenHelper(sInstance.mContext, sInstance.databaseName, sInstance.initialDatabaseVersion); sDatabase = dbOpenHelper.getWritableDatabase(); } return sDatabase; }
java
static synchronized SQLiteDatabase getDatabase() { if(sInstance == null) { throw new SprinklesNotInitializedException(); } if(sDatabase == null) { DbOpenHelper dbOpenHelper = new DbOpenHelper(sInstance.mContext, sInstance.databaseName, sInstance.initialDatabaseVersion); sDatabase = dbOpenHelper.getWritableDatabase(); } return sDatabase; }
[ "static", "synchronized", "SQLiteDatabase", "getDatabase", "(", ")", "{", "if", "(", "sInstance", "==", "null", ")", "{", "throw", "new", "SprinklesNotInitializedException", "(", ")", ";", "}", "if", "(", "sDatabase", "==", "null", ")", "{", "DbOpenHelper", ...
Throws SprinklesNotInitializedException if you try to access the database before initializing Sprinkles. @return the SQL Database used by Sprinkles.
[ "Throws", "SprinklesNotInitializedException", "if", "you", "try", "to", "access", "the", "database", "before", "initializing", "Sprinkles", "." ]
train
https://github.com/emilsjolander/sprinkles/blob/3a666f18ee5158db6fe3b4f4346b470481559606/library/src/main/java/se/emilsjolander/sprinkles/Sprinkles.java#L113-L124
intive-FDV/DynamicJasper
src/main/java/ar/com/fdvs/dj/domain/chart/dataset/XYDataset.java
XYDataset.addSerie
public void addSerie(AbstractColumn column, StringExpression labelExpression) { series.add(column); seriesLabels.put(column, labelExpression); }
java
public void addSerie(AbstractColumn column, StringExpression labelExpression) { series.add(column); seriesLabels.put(column, labelExpression); }
[ "public", "void", "addSerie", "(", "AbstractColumn", "column", ",", "StringExpression", "labelExpression", ")", "{", "series", ".", "add", "(", "column", ")", ";", "seriesLabels", ".", "put", "(", "column", ",", "labelExpression", ")", ";", "}" ]
Adds the specified serie column to the dataset with custom label expression. @param column the serie column @param labelExpression column the custom label expression
[ "Adds", "the", "specified", "serie", "column", "to", "the", "dataset", "with", "custom", "label", "expression", "." ]
train
https://github.com/intive-FDV/DynamicJasper/blob/63919574cc401ae40574d13129f628e66d1682a3/src/main/java/ar/com/fdvs/dj/domain/chart/dataset/XYDataset.java#L99-L102
google/closure-compiler
src/com/google/javascript/jscomp/Es6RewriteBlockScopedDeclaration.java
Es6RewriteBlockScopedDeclaration.createAssignNode
private Node createAssignNode(Node lhs, Node rhs) { Node assignNode = IR.assign(lhs, rhs); if (shouldAddTypesOnNewAstNodes) { assignNode.setJSType(rhs.getJSType()); } return assignNode; }
java
private Node createAssignNode(Node lhs, Node rhs) { Node assignNode = IR.assign(lhs, rhs); if (shouldAddTypesOnNewAstNodes) { assignNode.setJSType(rhs.getJSType()); } return assignNode; }
[ "private", "Node", "createAssignNode", "(", "Node", "lhs", ",", "Node", "rhs", ")", "{", "Node", "assignNode", "=", "IR", ".", "assign", "(", "lhs", ",", "rhs", ")", ";", "if", "(", "shouldAddTypesOnNewAstNodes", ")", "{", "assignNode", ".", "setJSType", ...
Creates an ASSIGN node with type information matching its RHS.
[ "Creates", "an", "ASSIGN", "node", "with", "type", "information", "matching", "its", "RHS", "." ]
train
https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/Es6RewriteBlockScopedDeclaration.java#L709-L715
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/util/ObjectIdentifier.java
ObjectIdentifier.pack7Oid
private static int pack7Oid(byte[] in, int ioffset, int ilength, byte[] out, int ooffset) { byte[] pack = pack(in, ioffset, ilength, 8, 7); int firstNonZero = pack.length-1; // paste at least one byte for (int i=pack.length-2; i>=0; i--) { if (pack[i] != 0) { firstNonZero = i; } pack[i] |= 0x80; } System.arraycopy(pack, firstNonZero, out, ooffset, pack.length-firstNonZero); return pack.length-firstNonZero; }
java
private static int pack7Oid(byte[] in, int ioffset, int ilength, byte[] out, int ooffset) { byte[] pack = pack(in, ioffset, ilength, 8, 7); int firstNonZero = pack.length-1; // paste at least one byte for (int i=pack.length-2; i>=0; i--) { if (pack[i] != 0) { firstNonZero = i; } pack[i] |= 0x80; } System.arraycopy(pack, firstNonZero, out, ooffset, pack.length-firstNonZero); return pack.length-firstNonZero; }
[ "private", "static", "int", "pack7Oid", "(", "byte", "[", "]", "in", ",", "int", "ioffset", ",", "int", "ilength", ",", "byte", "[", "]", "out", ",", "int", "ooffset", ")", "{", "byte", "[", "]", "pack", "=", "pack", "(", "in", ",", "ioffset", ",...
Repack from NUB 8 to a NUB 7 OID sub-identifier, remove all unnecessary 0 headings, set the first bit of all non-tail output bytes to 1 (as ITU-T Rec. X.690 8.19.2 says), and paste it into an existing byte array. @param out the existing array to be pasted into @param ooffset the starting position to paste @return the number of bytes pasted
[ "Repack", "from", "NUB", "8", "to", "a", "NUB", "7", "OID", "sub", "-", "identifier", "remove", "all", "unnecessary", "0", "headings", "set", "the", "first", "bit", "of", "all", "non", "-", "tail", "output", "bytes", "to", "1", "(", "as", "ITU", "-",...
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/util/ObjectIdentifier.java#L537-L548
Impetus/Kundera
src/jpa-engine/core/src/main/java/com/impetus/kundera/cache/ElementCollectionCacheManager.java
ElementCollectionCacheManager.getLastElementCollectionObjectCount
public int getLastElementCollectionObjectCount(Object rowKey) { if (getElementCollectionCache().get(rowKey) == null) { log.debug("No element collection object map found in cache for Row key " + rowKey); return -1; } else { Map<Object, String> elementCollectionMap = getElementCollectionCache().get(rowKey); Collection<String> elementCollectionObjectNames = elementCollectionMap.values(); int max = 0; for (String s : elementCollectionObjectNames) { String elementCollectionCountStr = s.substring(s.indexOf(Constants.EMBEDDED_COLUMN_NAME_DELIMITER) + 1); int elementCollectionCount = 0; try { elementCollectionCount = Integer.parseInt(elementCollectionCountStr); } catch (NumberFormatException e) { log.error("Invalid element collection Object name " + s); throw new CacheException("Invalid element collection Object name " + s,e); } if (elementCollectionCount > max) { max = elementCollectionCount; } } return max; } }
java
public int getLastElementCollectionObjectCount(Object rowKey) { if (getElementCollectionCache().get(rowKey) == null) { log.debug("No element collection object map found in cache for Row key " + rowKey); return -1; } else { Map<Object, String> elementCollectionMap = getElementCollectionCache().get(rowKey); Collection<String> elementCollectionObjectNames = elementCollectionMap.values(); int max = 0; for (String s : elementCollectionObjectNames) { String elementCollectionCountStr = s.substring(s.indexOf(Constants.EMBEDDED_COLUMN_NAME_DELIMITER) + 1); int elementCollectionCount = 0; try { elementCollectionCount = Integer.parseInt(elementCollectionCountStr); } catch (NumberFormatException e) { log.error("Invalid element collection Object name " + s); throw new CacheException("Invalid element collection Object name " + s,e); } if (elementCollectionCount > max) { max = elementCollectionCount; } } return max; } }
[ "public", "int", "getLastElementCollectionObjectCount", "(", "Object", "rowKey", ")", "{", "if", "(", "getElementCollectionCache", "(", ")", ".", "get", "(", "rowKey", ")", "==", "null", ")", "{", "log", ".", "debug", "(", "\"No element collection object map found...
Gets the last element collection object count. @param rowKey the row key @return the last element collection object count
[ "Gets", "the", "last", "element", "collection", "object", "count", "." ]
train
https://github.com/Impetus/Kundera/blob/268958ab1ec09d14ec4d9184f0c8ded7a9158908/src/jpa-engine/core/src/main/java/com/impetus/kundera/cache/ElementCollectionCacheManager.java#L174-L207
kiegroup/droolsjbpm-integration
kie-server-parent/kie-server-remote/kie-server-client/src/main/java/org/kie/server/client/KieServicesFactory.java
KieServicesFactory.newJMSConfiguration
public static KieServicesConfiguration newJMSConfiguration( ConnectionFactory connectionFactory, Queue requestQueue, Queue responseQueue) { return new KieServicesConfigurationImpl( connectionFactory, requestQueue, responseQueue ); }
java
public static KieServicesConfiguration newJMSConfiguration( ConnectionFactory connectionFactory, Queue requestQueue, Queue responseQueue) { return new KieServicesConfigurationImpl( connectionFactory, requestQueue, responseQueue ); }
[ "public", "static", "KieServicesConfiguration", "newJMSConfiguration", "(", "ConnectionFactory", "connectionFactory", ",", "Queue", "requestQueue", ",", "Queue", "responseQueue", ")", "{", "return", "new", "KieServicesConfigurationImpl", "(", "connectionFactory", ",", "requ...
Creates a new configuration object for JMS based service @param connectionFactory a JMS connection factory @param requestQueue a reference to the requests queue @param responseQueue a reference to the responses queue @return configuration instance
[ "Creates", "a", "new", "configuration", "object", "for", "JMS", "based", "service" ]
train
https://github.com/kiegroup/droolsjbpm-integration/blob/6c26200ab03855dbb92b56ca0c6363cdec0eaf2c/kie-server-parent/kie-server-remote/kie-server-client/src/main/java/org/kie/server/client/KieServicesFactory.java#L66-L68
aws/aws-sdk-java
aws-java-sdk-core/src/main/java/com/amazonaws/monitoring/internal/ClientSideMonitoringRequestHandler.java
ClientSideMonitoringRequestHandler.trimValueIfExceedsMaxLength
private String trimValueIfExceedsMaxLength(String entry, String value) { if (value == null) { return null; } String result = value; Integer maximumSize = ENTRY_TO_MAX_SIZE.get(entry); if (maximumSize != null && value.length() > maximumSize) { result = value.substring(0, maximumSize); } return result; }
java
private String trimValueIfExceedsMaxLength(String entry, String value) { if (value == null) { return null; } String result = value; Integer maximumSize = ENTRY_TO_MAX_SIZE.get(entry); if (maximumSize != null && value.length() > maximumSize) { result = value.substring(0, maximumSize); } return result; }
[ "private", "String", "trimValueIfExceedsMaxLength", "(", "String", "entry", ",", "String", "value", ")", "{", "if", "(", "value", "==", "null", ")", "{", "return", "null", ";", "}", "String", "result", "=", "value", ";", "Integer", "maximumSize", "=", "ENT...
If the entry exceeds the maximum length limit associated with the entry, its value will be trimmed to meet its limit.
[ "If", "the", "entry", "exceeds", "the", "maximum", "length", "limit", "associated", "with", "the", "entry", "its", "value", "will", "be", "trimmed", "to", "meet", "its", "limit", "." ]
train
https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-core/src/main/java/com/amazonaws/monitoring/internal/ClientSideMonitoringRequestHandler.java#L285-L296
forge/core
projects/api/src/main/java/org/jboss/forge/addon/projects/stacks/StackInspector.java
StackInspector.getAllRelatedFacets
public static <FACETTYPE extends Facet<?>> Set<Class<FACETTYPE>> getAllRelatedFacets(final Class<?> inspectedType) { Set<Class<FACETTYPE>> seen = new LinkedHashSet<Class<FACETTYPE>>(); return getAllRelatedFacets(seen, inspectedType); }
java
public static <FACETTYPE extends Facet<?>> Set<Class<FACETTYPE>> getAllRelatedFacets(final Class<?> inspectedType) { Set<Class<FACETTYPE>> seen = new LinkedHashSet<Class<FACETTYPE>>(); return getAllRelatedFacets(seen, inspectedType); }
[ "public", "static", "<", "FACETTYPE", "extends", "Facet", "<", "?", ">", ">", "Set", "<", "Class", "<", "FACETTYPE", ">", ">", "getAllRelatedFacets", "(", "final", "Class", "<", "?", ">", "inspectedType", ")", "{", "Set", "<", "Class", "<", "FACETTYPE", ...
Inspect the given {@link Class} for all {@link Facet} types from all {@link FacetConstraint} declarations. This method inspects the entire constraint tree.
[ "Inspect", "the", "given", "{" ]
train
https://github.com/forge/core/blob/e140eb03bbe2b3409478ad70c86c3edbef6d9a0c/projects/api/src/main/java/org/jboss/forge/addon/projects/stacks/StackInspector.java#L107-L111
apache/flink
flink-runtime/src/main/java/org/apache/flink/runtime/zookeeper/ZooKeeperUtilityFactory.java
ZooKeeperUtilityFactory.createSharedValue
public ZooKeeperSharedValue createSharedValue(String path, byte[] seedValue) { return new ZooKeeperSharedValue( new SharedValue( facade, path, seedValue)); }
java
public ZooKeeperSharedValue createSharedValue(String path, byte[] seedValue) { return new ZooKeeperSharedValue( new SharedValue( facade, path, seedValue)); }
[ "public", "ZooKeeperSharedValue", "createSharedValue", "(", "String", "path", ",", "byte", "[", "]", "seedValue", ")", "{", "return", "new", "ZooKeeperSharedValue", "(", "new", "SharedValue", "(", "facade", ",", "path", ",", "seedValue", ")", ")", ";", "}" ]
Creates a {@link ZooKeeperSharedValue} to store a shared value between multiple instances. @param path to the shared value in ZooKeeper @param seedValue for the shared value @return a shared value
[ "Creates", "a", "{", "@link", "ZooKeeperSharedValue", "}", "to", "store", "a", "shared", "value", "between", "multiple", "instances", "." ]
train
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/zookeeper/ZooKeeperUtilityFactory.java#L96-L102
alkacon/opencms-core
src/org/opencms/ade/configuration/CmsConfigurationReader.java
CmsConfigurationReader.parseFunctionReference
protected void parseFunctionReference(I_CmsXmlContentLocation node) { String name = node.getSubValue(N_NAME).asString(m_cms); CmsUUID functionId = node.getSubValue(N_FUNCTION).asId(m_cms); CmsUUID functionDefaultPageId = null; I_CmsXmlContentValueLocation defaultPageValue = node.getSubValue(N_FUNCTION_DEFAULT_PAGE); if (defaultPageValue != null) { functionDefaultPageId = defaultPageValue.asId(m_cms); } I_CmsXmlContentValueLocation orderNode = node.getSubValue(N_ORDER); int order = I_CmsConfigurationObject.DEFAULT_ORDER; if (orderNode != null) { String orderStr = orderNode.asString(m_cms); try { order = Integer.parseInt(orderStr); } catch (NumberFormatException e) { // noop } } m_functionReferences.add(new CmsFunctionReference(name, functionId, functionDefaultPageId, order)); }
java
protected void parseFunctionReference(I_CmsXmlContentLocation node) { String name = node.getSubValue(N_NAME).asString(m_cms); CmsUUID functionId = node.getSubValue(N_FUNCTION).asId(m_cms); CmsUUID functionDefaultPageId = null; I_CmsXmlContentValueLocation defaultPageValue = node.getSubValue(N_FUNCTION_DEFAULT_PAGE); if (defaultPageValue != null) { functionDefaultPageId = defaultPageValue.asId(m_cms); } I_CmsXmlContentValueLocation orderNode = node.getSubValue(N_ORDER); int order = I_CmsConfigurationObject.DEFAULT_ORDER; if (orderNode != null) { String orderStr = orderNode.asString(m_cms); try { order = Integer.parseInt(orderStr); } catch (NumberFormatException e) { // noop } } m_functionReferences.add(new CmsFunctionReference(name, functionId, functionDefaultPageId, order)); }
[ "protected", "void", "parseFunctionReference", "(", "I_CmsXmlContentLocation", "node", ")", "{", "String", "name", "=", "node", ".", "getSubValue", "(", "N_NAME", ")", ".", "asString", "(", "m_cms", ")", ";", "CmsUUID", "functionId", "=", "node", ".", "getSubV...
Parses a function reference node.<p> @param node the function reference node
[ "Parses", "a", "function", "reference", "node", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ade/configuration/CmsConfigurationReader.java#L879-L899
jspringbot/jspringbot
src/main/java/org/jspringbot/spring/KeywordUtils.java
KeywordUtils.getKeywordInfo
public static KeywordInfo getKeywordInfo(String keyword, ApplicationContext context, Map<String, String> beanMap) { Object bean = context.getBean(beanMap.get(keyword)); return AnnotationUtils.findAnnotation(bean.getClass(), KeywordInfo.class); }
java
public static KeywordInfo getKeywordInfo(String keyword, ApplicationContext context, Map<String, String> beanMap) { Object bean = context.getBean(beanMap.get(keyword)); return AnnotationUtils.findAnnotation(bean.getClass(), KeywordInfo.class); }
[ "public", "static", "KeywordInfo", "getKeywordInfo", "(", "String", "keyword", ",", "ApplicationContext", "context", ",", "Map", "<", "String", ",", "String", ">", "beanMap", ")", "{", "Object", "bean", "=", "context", ".", "getBean", "(", "beanMap", ".", "g...
Retrieves the KeywordInfo of the given keyword. @param keyword keyword name @param context Spring application context @param beanMap keyword name to bean name mapping @return KeywordInfo object or null if unavailable
[ "Retrieves", "the", "KeywordInfo", "of", "the", "given", "keyword", "." ]
train
https://github.com/jspringbot/jspringbot/blob/03285a7013492fb793cb0c38a4625a5f5c5750e0/src/main/java/org/jspringbot/spring/KeywordUtils.java#L135-L138
kumuluz/kumuluzee
tools/loader/src/main/java/com/kumuluz/ee/loader/EeClassLoader.java
EeClassLoader.findJarNativeEntry
private JarEntryInfo findJarNativeEntry(String libraryName) { String name = System.mapLibraryName(libraryName); for (JarFileInfo jarFileInfo : jarFiles) { JarFile jarFile = jarFileInfo.getJarFile(); Enumeration<JarEntry> entries = jarFile.entries(); while (entries.hasMoreElements()) { JarEntry jarEntry = entries.nextElement(); if (jarEntry.isDirectory()) { continue; } // Example: name is "Native.dll" String jarEntryName = jarEntry.getName(); // "Native.dll" or "abc/xyz/Native.dll" // name "Native.dll" could be found, for example // - in the path: abc/Native.dll/xyz/my.dll <-- do not load this one! // - in the partial name: abc/aNative.dll <-- do not load this one! String[] token = jarEntryName.split("/"); // the last token is library name if (token.length > 0 && token[token.length - 1].equals(name)) { debug(String.format("Loading native library '%s' found as '%s' in JAR %s", libraryName, jarEntryName, jarFileInfo.getSimpleName())); return new JarEntryInfo(jarFileInfo, jarEntry); } } } return null; }
java
private JarEntryInfo findJarNativeEntry(String libraryName) { String name = System.mapLibraryName(libraryName); for (JarFileInfo jarFileInfo : jarFiles) { JarFile jarFile = jarFileInfo.getJarFile(); Enumeration<JarEntry> entries = jarFile.entries(); while (entries.hasMoreElements()) { JarEntry jarEntry = entries.nextElement(); if (jarEntry.isDirectory()) { continue; } // Example: name is "Native.dll" String jarEntryName = jarEntry.getName(); // "Native.dll" or "abc/xyz/Native.dll" // name "Native.dll" could be found, for example // - in the path: abc/Native.dll/xyz/my.dll <-- do not load this one! // - in the partial name: abc/aNative.dll <-- do not load this one! String[] token = jarEntryName.split("/"); // the last token is library name if (token.length > 0 && token[token.length - 1].equals(name)) { debug(String.format("Loading native library '%s' found as '%s' in JAR %s", libraryName, jarEntryName, jarFileInfo.getSimpleName())); return new JarEntryInfo(jarFileInfo, jarEntry); } } } return null; }
[ "private", "JarEntryInfo", "findJarNativeEntry", "(", "String", "libraryName", ")", "{", "String", "name", "=", "System", ".", "mapLibraryName", "(", "libraryName", ")", ";", "for", "(", "JarFileInfo", "jarFileInfo", ":", "jarFiles", ")", "{", "JarFile", "jarFil...
Finds native library entry. @param libraryName Library name. For example for the library name "Native" - Windows returns entry "Native.dll" - Linux returns entry "libNative.so" - Mac returns entry "libNative.jnilib" or "libNative.dylib" (depending on Apple or Oracle JDK and/or JDK version) @return Native library entry.
[ "Finds", "native", "library", "entry", "." ]
train
https://github.com/kumuluz/kumuluzee/blob/86fbce2acc04264f20d548173d5d9f28d79cb415/tools/loader/src/main/java/com/kumuluz/ee/loader/EeClassLoader.java#L353-L379
linkedin/PalDB
paldb/src/main/java/com/linkedin/paldb/api/Configuration.java
Configuration.getDouble
public double getDouble(String key, double defaultValue) { if (containsKey(key)) { return Double.parseDouble(get(key)); } else { return defaultValue; } }
java
public double getDouble(String key, double defaultValue) { if (containsKey(key)) { return Double.parseDouble(get(key)); } else { return defaultValue; } }
[ "public", "double", "getDouble", "(", "String", "key", ",", "double", "defaultValue", ")", "{", "if", "(", "containsKey", "(", "key", ")", ")", "{", "return", "Double", ".", "parseDouble", "(", "get", "(", "key", ")", ")", ";", "}", "else", "{", "ret...
Gets the double value for <code>key</code> or <code>defaultValue</code> if not found. @param key key to get value for @param defaultValue default value if key not found @return value or <code>defaultValue</code> if not found
[ "Gets", "the", "double", "value", "for", "<code", ">", "key<", "/", "code", ">", "or", "<code", ">", "defaultValue<", "/", "code", ">", "if", "not", "found", "." ]
train
https://github.com/linkedin/PalDB/blob/d05ccdd3f67855eb2675dbd82599f19aa7a9f650/paldb/src/main/java/com/linkedin/paldb/api/Configuration.java#L288-L294
sawano/java-commons
src/main/java/se/sawano/java/commons/lang/validate/AbstractValidate.java
AbstractValidate.matchesPattern
public CharSequence matchesPattern(final CharSequence input, final String pattern) { if (!Pattern.matches(pattern, input)) { fail(String.format(DEFAULT_MATCHES_PATTERN_EX, input, pattern)); } return input; }
java
public CharSequence matchesPattern(final CharSequence input, final String pattern) { if (!Pattern.matches(pattern, input)) { fail(String.format(DEFAULT_MATCHES_PATTERN_EX, input, pattern)); } return input; }
[ "public", "CharSequence", "matchesPattern", "(", "final", "CharSequence", "input", ",", "final", "String", "pattern", ")", "{", "if", "(", "!", "Pattern", ".", "matches", "(", "pattern", ",", "input", ")", ")", "{", "fail", "(", "String", ".", "format", ...
<p>Validate that the specified argument character sequence matches the specified regular expression pattern; otherwise throwing an exception.</p> <pre>Validate.matchesPattern("hi", "[a-z]*");</pre> <p>The syntax of the pattern is the one used in the {@link java.util.regex.Pattern} class.</p> @param input the character sequence to validate, not null @param pattern the regular expression pattern, not null @return the input @throws IllegalArgumentValidationException if the character sequence does not match the pattern @see #matchesPattern(CharSequence, String, String, Object...)
[ "<p", ">", "Validate", "that", "the", "specified", "argument", "character", "sequence", "matches", "the", "specified", "regular", "expression", "pattern", ";", "otherwise", "throwing", "an", "exception", ".", "<", "/", "p", ">", "<pre", ">", "Validate", ".", ...
train
https://github.com/sawano/java-commons/blob/6f219c9e8dec4401dbe528d17ae6ec1ef9c0d284/src/main/java/se/sawano/java/commons/lang/validate/AbstractValidate.java#L1170-L1175
OpenLiberty/open-liberty
dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ws/ejbcontainer/util/ParsedScheduleExpression.java
ParsedScheduleExpression.advance
private static void advance(Calendar cal, int field, int nextField, long haystack, int needle) { long higher = higher(haystack, needle); if (higher != 0) { cal.set(field, first(higher)); } else { cal.set(field, first(haystack)); cal.add(nextField, 1); } }
java
private static void advance(Calendar cal, int field, int nextField, long haystack, int needle) { long higher = higher(haystack, needle); if (higher != 0) { cal.set(field, first(higher)); } else { cal.set(field, first(haystack)); cal.add(nextField, 1); } }
[ "private", "static", "void", "advance", "(", "Calendar", "cal", ",", "int", "field", ",", "int", "nextField", ",", "long", "haystack", ",", "int", "needle", ")", "{", "long", "higher", "=", "higher", "(", "haystack", ",", "needle", ")", ";", "if", "(",...
Moves the value of the specified field forward in time to satisfy constraints of the specified bitmask. If a position higher than needle is found in haystack, then that higher position is set as the value in field. Otherwise, the lowest value in haystack is set as the value in field, and the value in nextField is incremented. <p>For example, if field=Calendar.SECOND, haystack is {30, 40, 50}, and needle is 35, then the seconds field will be set to 40, and the minutes field will be unchanged. However, if haystack={10, 20, 30}, then the value in the seconds field will be set to 10, and the value of the minutes field will be incremented. @param cal the current time @param field a field from <tt>java.util.Calendar</tt> @param field the next coarser field after <tt>field</tt>; for example, if field=Calendar.SECOND, nextField=Calendar.MINUTE @param haystack the bitmask @param needle the current position in the bitmask; only higher
[ "Moves", "the", "value", "of", "the", "specified", "field", "forward", "in", "time", "to", "satisfy", "constraints", "of", "the", "specified", "bitmask", ".", "If", "a", "position", "higher", "than", "needle", "is", "found", "in", "haystack", "then", "that",...
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ws/ejbcontainer/util/ParsedScheduleExpression.java#L892-L904
xvik/generics-resolver
src/main/java/ru/vyarus/java/generics/resolver/error/UnknownGenericException.java
UnknownGenericException.rethrowWithType
public UnknownGenericException rethrowWithType(final Class<?> type) { final boolean sameType = contextType != null && contextType.equals(type); if (!sameType && contextType != null) { // not allow changing type if it's already set throw new IllegalStateException("Context type can't be changed"); } return sameType ? this : new UnknownGenericException(type, genericName, genericSource, this); }
java
public UnknownGenericException rethrowWithType(final Class<?> type) { final boolean sameType = contextType != null && contextType.equals(type); if (!sameType && contextType != null) { // not allow changing type if it's already set throw new IllegalStateException("Context type can't be changed"); } return sameType ? this : new UnknownGenericException(type, genericName, genericSource, this); }
[ "public", "UnknownGenericException", "rethrowWithType", "(", "final", "Class", "<", "?", ">", "type", ")", "{", "final", "boolean", "sameType", "=", "contextType", "!=", "null", "&&", "contextType", ".", "equals", "(", "type", ")", ";", "if", "(", "!", "sa...
Throw more specific exception. @param type context type @return new exception if type is different, same exception instance if type is the same
[ "Throw", "more", "specific", "exception", "." ]
train
https://github.com/xvik/generics-resolver/blob/d7d9d2783265df1178230e8f0b7cb6d853b67a7b/src/main/java/ru/vyarus/java/generics/resolver/error/UnknownGenericException.java#L75-L82
jmeetsma/Iglu-Common
src/main/java/org/ijsberg/iglu/util/xml/Node.java
Node.setAttribute
public void setAttribute(String key, String value) { /* if (!attributes.containsKey(key)) { sortedAttributes.add(key); }*/ if (nodeAttributes == null) { nodeAttributes = new Properties(); } nodeAttributes.setProperty(key, value); }
java
public void setAttribute(String key, String value) { /* if (!attributes.containsKey(key)) { sortedAttributes.add(key); }*/ if (nodeAttributes == null) { nodeAttributes = new Properties(); } nodeAttributes.setProperty(key, value); }
[ "public", "void", "setAttribute", "(", "String", "key", ",", "String", "value", ")", "{", "/*\t\tif (!attributes.containsKey(key))\r\n\t\t{\r\n\t\t\tsortedAttributes.add(key);\r\n\t\t}*/", "if", "(", "nodeAttributes", "==", "null", ")", "{", "nodeAttributes", "=", "new", ...
Sets a name-value pair that appears as attribute in the opening tag @param key @param value
[ "Sets", "a", "name", "-", "value", "pair", "that", "appears", "as", "attribute", "in", "the", "opening", "tag" ]
train
https://github.com/jmeetsma/Iglu-Common/blob/0fb0885775b576209ff1b5a0f67e3c25a99a6420/src/main/java/org/ijsberg/iglu/util/xml/Node.java#L179-L188
VoltDB/voltdb
src/frontend/org/voltdb/plannodes/WindowFunctionPlanNode.java
WindowFunctionPlanNode.loadFromJSONObject
@Override public void loadFromJSONObject(JSONObject jobj, Database db) throws JSONException { helpLoadFromJSONObject(jobj, db); JSONArray jarray = jobj.getJSONArray( Members.AGGREGATE_COLUMNS.name() ); int size = jarray.length(); for (int i = 0; i < size; i++) { // We only expect one of these for now. assert(i == 0); JSONObject tempObj = jarray.getJSONObject( i ); m_aggregateTypes.add( ExpressionType.get( tempObj.getString( Members.AGGREGATE_TYPE.name() ))); m_aggregateOutputColumns.add( tempObj.getInt( Members.AGGREGATE_OUTPUT_COLUMN.name() )); m_aggregateExpressions.add( AbstractExpression.loadFromJSONArrayChild(null, tempObj, Members.AGGREGATE_EXPRESSIONS.name(), null)); } m_partitionByExpressions = AbstractExpression.loadFromJSONArrayChild(null, jobj, Members.PARTITIONBY_EXPRESSIONS.name(), null); m_orderByExpressions = new ArrayList<>(); AbstractExpression.loadSortListFromJSONArray(m_orderByExpressions, null, jobj); }
java
@Override public void loadFromJSONObject(JSONObject jobj, Database db) throws JSONException { helpLoadFromJSONObject(jobj, db); JSONArray jarray = jobj.getJSONArray( Members.AGGREGATE_COLUMNS.name() ); int size = jarray.length(); for (int i = 0; i < size; i++) { // We only expect one of these for now. assert(i == 0); JSONObject tempObj = jarray.getJSONObject( i ); m_aggregateTypes.add( ExpressionType.get( tempObj.getString( Members.AGGREGATE_TYPE.name() ))); m_aggregateOutputColumns.add( tempObj.getInt( Members.AGGREGATE_OUTPUT_COLUMN.name() )); m_aggregateExpressions.add( AbstractExpression.loadFromJSONArrayChild(null, tempObj, Members.AGGREGATE_EXPRESSIONS.name(), null)); } m_partitionByExpressions = AbstractExpression.loadFromJSONArrayChild(null, jobj, Members.PARTITIONBY_EXPRESSIONS.name(), null); m_orderByExpressions = new ArrayList<>(); AbstractExpression.loadSortListFromJSONArray(m_orderByExpressions, null, jobj); }
[ "@", "Override", "public", "void", "loadFromJSONObject", "(", "JSONObject", "jobj", ",", "Database", "db", ")", "throws", "JSONException", "{", "helpLoadFromJSONObject", "(", "jobj", ",", "db", ")", ";", "JSONArray", "jarray", "=", "jobj", ".", "getJSONArray", ...
Deserialize a PartitionByPlanNode from JSON. Since we don't need the sort directions, and we don't serialize them in toJSONString, then we can't in general get them here.
[ "Deserialize", "a", "PartitionByPlanNode", "from", "JSON", ".", "Since", "we", "don", "t", "need", "the", "sort", "directions", "and", "we", "don", "t", "serialize", "them", "in", "toJSONString", "then", "we", "can", "t", "in", "general", "get", "them", "h...
train
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/frontend/org/voltdb/plannodes/WindowFunctionPlanNode.java#L153-L180
OpenLiberty/open-liberty
dev/com.ibm.ws.jsf.2.2/src/org/apache/myfaces/shared/renderkit/html/HtmlMenuRendererBase.java
HtmlMenuRendererBase.encodeEnd
public void encodeEnd(FacesContext facesContext, UIComponent component) throws IOException { RendererUtils.checkParamValidity(facesContext, component, null); Map<String, List<ClientBehavior>> behaviors = null; if (component instanceof ClientBehaviorHolder) { behaviors = ((ClientBehaviorHolder) component).getClientBehaviors(); if (!behaviors.isEmpty()) { ResourceUtils.renderDefaultJsfJsInlineIfNecessary( facesContext, facesContext.getResponseWriter()); } } if (component instanceof UISelectMany) { renderMenu(facesContext, (UISelectMany)component, isDisabled(facesContext, component), getConverter(facesContext, component)); } else if (component instanceof UISelectOne) { renderMenu(facesContext, (UISelectOne)component, isDisabled(facesContext, component), getConverter(facesContext, component)); } else { throw new IllegalArgumentException("Unsupported component class " + component.getClass().getName()); } }
java
public void encodeEnd(FacesContext facesContext, UIComponent component) throws IOException { RendererUtils.checkParamValidity(facesContext, component, null); Map<String, List<ClientBehavior>> behaviors = null; if (component instanceof ClientBehaviorHolder) { behaviors = ((ClientBehaviorHolder) component).getClientBehaviors(); if (!behaviors.isEmpty()) { ResourceUtils.renderDefaultJsfJsInlineIfNecessary( facesContext, facesContext.getResponseWriter()); } } if (component instanceof UISelectMany) { renderMenu(facesContext, (UISelectMany)component, isDisabled(facesContext, component), getConverter(facesContext, component)); } else if (component instanceof UISelectOne) { renderMenu(facesContext, (UISelectOne)component, isDisabled(facesContext, component), getConverter(facesContext, component)); } else { throw new IllegalArgumentException("Unsupported component class " + component.getClass().getName()); } }
[ "public", "void", "encodeEnd", "(", "FacesContext", "facesContext", ",", "UIComponent", "component", ")", "throws", "IOException", "{", "RendererUtils", ".", "checkParamValidity", "(", "facesContext", ",", "component", ",", "null", ")", ";", "Map", "<", "String", ...
private static final Log log = LogFactory.getLog(HtmlMenuRenderer.class);
[ "private", "static", "final", "Log", "log", "=", "LogFactory", ".", "getLog", "(", "HtmlMenuRenderer", ".", "class", ")", ";" ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jsf.2.2/src/org/apache/myfaces/shared/renderkit/html/HtmlMenuRendererBase.java#L47-L81
alkacon/opencms-core
src-gwt/org/opencms/gwt/client/ui/input/colorpicker/CmsColor.java
CmsColor.MIN
private float MIN(float first, float second, float third) { float min = Integer.MAX_VALUE; if (first < min) { min = first; } if (second < min) { min = second; } if (third < min) { min = third; } return min; }
java
private float MIN(float first, float second, float third) { float min = Integer.MAX_VALUE; if (first < min) { min = first; } if (second < min) { min = second; } if (third < min) { min = third; } return min; }
[ "private", "float", "MIN", "(", "float", "first", ",", "float", "second", ",", "float", "third", ")", "{", "float", "min", "=", "Integer", ".", "MAX_VALUE", ";", "if", "(", "first", "<", "min", ")", "{", "min", "=", "first", ";", "}", "if", "(", ...
Calculates the smallest value between the three inputs. @param first value @param second value @param third value @return the smallest value between the three inputs
[ "Calculates", "the", "smallest", "value", "between", "the", "three", "inputs", "." ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/gwt/client/ui/input/colorpicker/CmsColor.java#L281-L294
puniverse/capsule
capsule-util/src/main/java/co/paralleluniverse/capsule/Jar.java
Jar.setAttribute
public final Jar setAttribute(String section, String name, String value) { verifyNotSealed(); if (jos != null) throw new IllegalStateException("Manifest cannot be modified after entries are added."); Attributes attr = getManifest().getAttributes(section); if (attr == null) { attr = new Attributes(); getManifest().getEntries().put(section, attr); } attr.putValue(name, value); return this; }
java
public final Jar setAttribute(String section, String name, String value) { verifyNotSealed(); if (jos != null) throw new IllegalStateException("Manifest cannot be modified after entries are added."); Attributes attr = getManifest().getAttributes(section); if (attr == null) { attr = new Attributes(); getManifest().getEntries().put(section, attr); } attr.putValue(name, value); return this; }
[ "public", "final", "Jar", "setAttribute", "(", "String", "section", ",", "String", "name", ",", "String", "value", ")", "{", "verifyNotSealed", "(", ")", ";", "if", "(", "jos", "!=", "null", ")", "throw", "new", "IllegalStateException", "(", "\"Manifest cann...
Sets an attribute in a non-main section of the manifest. @param section the section's name @param name the attribute's name @param value the attribute's value @return {@code this} @throws IllegalStateException if entries have been added or the JAR has been written prior to calling this methods.
[ "Sets", "an", "attribute", "in", "a", "non", "-", "main", "section", "of", "the", "manifest", "." ]
train
https://github.com/puniverse/capsule/blob/291a54e501a32aaf0284707b8c1fbff6a566822b/capsule-util/src/main/java/co/paralleluniverse/capsule/Jar.java#L152-L163
Azure/azure-sdk-for-java
automation/resource-manager/v2015_10_31/src/main/java/com/microsoft/azure/management/automation/v2015_10_31/implementation/CredentialsInner.java
CredentialsInner.updateAsync
public Observable<CredentialInner> updateAsync(String resourceGroupName, String automationAccountName, String credentialName, CredentialUpdateParameters parameters) { return updateWithServiceResponseAsync(resourceGroupName, automationAccountName, credentialName, parameters).map(new Func1<ServiceResponse<CredentialInner>, CredentialInner>() { @Override public CredentialInner call(ServiceResponse<CredentialInner> response) { return response.body(); } }); }
java
public Observable<CredentialInner> updateAsync(String resourceGroupName, String automationAccountName, String credentialName, CredentialUpdateParameters parameters) { return updateWithServiceResponseAsync(resourceGroupName, automationAccountName, credentialName, parameters).map(new Func1<ServiceResponse<CredentialInner>, CredentialInner>() { @Override public CredentialInner call(ServiceResponse<CredentialInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "CredentialInner", ">", "updateAsync", "(", "String", "resourceGroupName", ",", "String", "automationAccountName", ",", "String", "credentialName", ",", "CredentialUpdateParameters", "parameters", ")", "{", "return", "updateWithServiceResponseAs...
Update a credential. @param resourceGroupName Name of an Azure Resource group. @param automationAccountName The name of the automation account. @param credentialName The parameters supplied to the Update credential operation. @param parameters The parameters supplied to the Update credential operation. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the CredentialInner object
[ "Update", "a", "credential", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/automation/resource-manager/v2015_10_31/src/main/java/com/microsoft/azure/management/automation/v2015_10_31/implementation/CredentialsInner.java#L416-L423