repository_name
stringlengths
7
54
func_path_in_repository
stringlengths
18
196
func_name
stringlengths
7
107
whole_func_string
stringlengths
76
3.82k
language
stringclasses
1 value
func_code_string
stringlengths
76
3.82k
func_code_tokens
listlengths
22
717
func_documentation_string
stringlengths
61
1.98k
func_documentation_tokens
listlengths
1
508
split_name
stringclasses
1 value
func_code_url
stringlengths
111
310
gitblit/fathom
fathom-x509/src/main/java/fathom/x509/X509Utils.java
X509Utils.prepareX509Infrastructure
public static void prepareX509Infrastructure(X509Metadata metadata, File serverKeyStore, File serverTrustStore, X509Log x509log) { // make the specified folder, if necessary File folder = serverKeyStore.getParentFile(); folder.mkdirs(); // Fathom CA certificate File caKeyStore = new File(folder, CA_KEY_STORE); if (!caKeyStore.exists()) { logger.info(MessageFormat.format("Generating {0} ({1})", CA_CN, caKeyStore.getAbsolutePath())); X509Certificate caCert = newCertificateAuthority(metadata, caKeyStore, x509log); saveCertificate(caCert, new File(caKeyStore.getParentFile(), "ca.cer")); } // Fathom CRL File caRevocationList = new File(folder, CA_REVOCATION_LIST); if (!caRevocationList.exists()) { logger.info(MessageFormat.format("Generating {0} CRL ({1})", CA_CN, caRevocationList.getAbsolutePath())); newCertificateRevocationList(caRevocationList, caKeyStore, metadata.password); x509log.log("new certificate revocation list created"); } // create web SSL certificate signed by CA if (!serverKeyStore.exists()) { logger.info(MessageFormat.format("Generating SSL certificate for {0} signed by {1} ({2})", metadata.commonName, CA_CN, serverKeyStore.getAbsolutePath())); PrivateKey caPrivateKey = getPrivateKey(CA_ALIAS, caKeyStore, metadata.password); X509Certificate caCert = getCertificate(CA_ALIAS, caKeyStore, metadata.password); newSSLCertificate(metadata, caPrivateKey, caCert, serverKeyStore, x509log); } // server certificate trust store holds trusted public certificates if (!serverTrustStore.exists()) { logger.info(MessageFormat.format("Importing {0} into trust store ({1})", CA_ALIAS, serverTrustStore.getAbsolutePath())); X509Certificate caCert = getCertificate(CA_ALIAS, caKeyStore, metadata.password); addTrustedCertificate(CA_ALIAS, caCert, serverTrustStore, metadata.password); } }
java
public static void prepareX509Infrastructure(X509Metadata metadata, File serverKeyStore, File serverTrustStore, X509Log x509log) { // make the specified folder, if necessary File folder = serverKeyStore.getParentFile(); folder.mkdirs(); // Fathom CA certificate File caKeyStore = new File(folder, CA_KEY_STORE); if (!caKeyStore.exists()) { logger.info(MessageFormat.format("Generating {0} ({1})", CA_CN, caKeyStore.getAbsolutePath())); X509Certificate caCert = newCertificateAuthority(metadata, caKeyStore, x509log); saveCertificate(caCert, new File(caKeyStore.getParentFile(), "ca.cer")); } // Fathom CRL File caRevocationList = new File(folder, CA_REVOCATION_LIST); if (!caRevocationList.exists()) { logger.info(MessageFormat.format("Generating {0} CRL ({1})", CA_CN, caRevocationList.getAbsolutePath())); newCertificateRevocationList(caRevocationList, caKeyStore, metadata.password); x509log.log("new certificate revocation list created"); } // create web SSL certificate signed by CA if (!serverKeyStore.exists()) { logger.info(MessageFormat.format("Generating SSL certificate for {0} signed by {1} ({2})", metadata.commonName, CA_CN, serverKeyStore.getAbsolutePath())); PrivateKey caPrivateKey = getPrivateKey(CA_ALIAS, caKeyStore, metadata.password); X509Certificate caCert = getCertificate(CA_ALIAS, caKeyStore, metadata.password); newSSLCertificate(metadata, caPrivateKey, caCert, serverKeyStore, x509log); } // server certificate trust store holds trusted public certificates if (!serverTrustStore.exists()) { logger.info(MessageFormat.format("Importing {0} into trust store ({1})", CA_ALIAS, serverTrustStore.getAbsolutePath())); X509Certificate caCert = getCertificate(CA_ALIAS, caKeyStore, metadata.password); addTrustedCertificate(CA_ALIAS, caCert, serverTrustStore, metadata.password); } }
[ "public", "static", "void", "prepareX509Infrastructure", "(", "X509Metadata", "metadata", ",", "File", "serverKeyStore", ",", "File", "serverTrustStore", ",", "X509Log", "x509log", ")", "{", "// make the specified folder, if necessary", "File", "folder", "=", "serverKeySt...
Prepare all the certificates and stores necessary for a Fathom server. @param metadata @param serverKeyStore @param serverTrustStore @param x509log
[ "Prepare", "all", "the", "certificates", "and", "stores", "necessary", "for", "a", "Fathom", "server", "." ]
train
https://github.com/gitblit/fathom/blob/f2f820eb16e9fea1e36ad4eda4ed51b35f056538/fathom-x509/src/main/java/fathom/x509/X509Utils.java#L260-L295
google/error-prone-javac
src/java.compiler/share/classes/javax/lang/model/util/ElementFilter.java
ElementFilter.constructorsIn
public static List<ExecutableElement> constructorsIn(Iterable<? extends Element> elements) { return listFilter(elements, CONSTRUCTOR_KIND, ExecutableElement.class); }
java
public static List<ExecutableElement> constructorsIn(Iterable<? extends Element> elements) { return listFilter(elements, CONSTRUCTOR_KIND, ExecutableElement.class); }
[ "public", "static", "List", "<", "ExecutableElement", ">", "constructorsIn", "(", "Iterable", "<", "?", "extends", "Element", ">", "elements", ")", "{", "return", "listFilter", "(", "elements", ",", "CONSTRUCTOR_KIND", ",", "ExecutableElement", ".", "class", ")"...
Returns a list of constructors in {@code elements}. @return a list of constructors in {@code elements} @param elements the elements to filter
[ "Returns", "a", "list", "of", "constructors", "in", "{" ]
train
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/java.compiler/share/classes/javax/lang/model/util/ElementFilter.java#L112-L115
looly/hutool
hutool-core/src/main/java/cn/hutool/core/builder/HashCodeBuilder.java
HashCodeBuilder.reflectionHashCode
public static int reflectionHashCode(final Object object, final Collection<String> excludeFields) { return reflectionHashCode(object, ArrayUtil.toArray(excludeFields, String.class)); }
java
public static int reflectionHashCode(final Object object, final Collection<String> excludeFields) { return reflectionHashCode(object, ArrayUtil.toArray(excludeFields, String.class)); }
[ "public", "static", "int", "reflectionHashCode", "(", "final", "Object", "object", ",", "final", "Collection", "<", "String", ">", "excludeFields", ")", "{", "return", "reflectionHashCode", "(", "object", ",", "ArrayUtil", ".", "toArray", "(", "excludeFields", "...
<p> Uses reflection to build a valid hash code from the fields of {@code object}. </p> <p> This constructor uses two hard coded choices for the constants needed to build a hash code. </p> <p> It uses <code>AccessibleObject.setAccessible</code> to gain access to private fields. This means that it will throw a security exception if run under a security manager, if the permissions are not set up correctly. It is also not as efficient as testing explicitly. </p> <p> Transient members will be not be used, as they are likely derived fields, and not part of the value of the <code>Object</code>. </p> <p> Static fields will not be tested. Superclass fields will be included. If no fields are found to include in the hash code, the result of this method will be constant. </p> @param object the Object to create a <code>hashCode</code> for @param excludeFields Collection of String field names to exclude from use in calculation of hash code @return int hash code @throws IllegalArgumentException if the object is <code>null</code>
[ "<p", ">", "Uses", "reflection", "to", "build", "a", "valid", "hash", "code", "from", "the", "fields", "of", "{", "@code", "object", "}", ".", "<", "/", "p", ">" ]
train
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/builder/HashCodeBuilder.java#L418-L420
julienledem/brennus
brennus-asm/src/main/java/brennus/asm/specializer/Specializer.java
Specializer.specializeInstance
private Object specializeInstance(ClassDescriptor specializedClass, Object t) { try (Logger l = new Logger("specializeInstance(" + specializedClass.getSpecializedClass().getSimpleName() + " , " + t + ")")) { if (!specializedClass.isSpecialized()) { l.log("value unchanged"); return t; } l.log("Creating new instance"); Object newInstance = specializedClass.getSpecializedClass().newInstance(); l.log("setting field values:"); Class<?> c = t.getClass(); l.log("from class " + c.getSimpleName() + " to class " + specializedClass.getSpecializedClass().getSimpleName()); while (c != null && specializedClass != null) { for (Field field : c.getDeclaredFields()) { field.setAccessible(true); Object value = field.get(t); FieldDescriptor fieldDescriptor = specializedClass.getFields().get(field.getName()); if (fieldDescriptor != null && fieldDescriptor.getSpecializedClass().isSpecialized()) { value = specializeInstance(fieldDescriptor.getSpecializedClass(), value); l.log("- specialized " + newInstance.getClass().getSimpleName() + "." + field.getName() + " = " + value); } else { l.log("- copied " + newInstance.getClass().getSimpleName() + "." + field.getName() + " = " + value); } Field newField = newInstance.getClass().getField(field.getName()); newField.set(newInstance, value); } c = c.getSuperclass(); specializedClass = specializedClass.getParent(); } return newInstance; } catch (InstantiationException | IllegalAccessException | NoSuchFieldException | SecurityException e) { throw new SpecializationException("Could not create instance of the specialized class " + specializedClass.specializedClass.getSimpleName(), e); } }
java
private Object specializeInstance(ClassDescriptor specializedClass, Object t) { try (Logger l = new Logger("specializeInstance(" + specializedClass.getSpecializedClass().getSimpleName() + " , " + t + ")")) { if (!specializedClass.isSpecialized()) { l.log("value unchanged"); return t; } l.log("Creating new instance"); Object newInstance = specializedClass.getSpecializedClass().newInstance(); l.log("setting field values:"); Class<?> c = t.getClass(); l.log("from class " + c.getSimpleName() + " to class " + specializedClass.getSpecializedClass().getSimpleName()); while (c != null && specializedClass != null) { for (Field field : c.getDeclaredFields()) { field.setAccessible(true); Object value = field.get(t); FieldDescriptor fieldDescriptor = specializedClass.getFields().get(field.getName()); if (fieldDescriptor != null && fieldDescriptor.getSpecializedClass().isSpecialized()) { value = specializeInstance(fieldDescriptor.getSpecializedClass(), value); l.log("- specialized " + newInstance.getClass().getSimpleName() + "." + field.getName() + " = " + value); } else { l.log("- copied " + newInstance.getClass().getSimpleName() + "." + field.getName() + " = " + value); } Field newField = newInstance.getClass().getField(field.getName()); newField.set(newInstance, value); } c = c.getSuperclass(); specializedClass = specializedClass.getParent(); } return newInstance; } catch (InstantiationException | IllegalAccessException | NoSuchFieldException | SecurityException e) { throw new SpecializationException("Could not create instance of the specialized class " + specializedClass.specializedClass.getSimpleName(), e); } }
[ "private", "Object", "specializeInstance", "(", "ClassDescriptor", "specializedClass", ",", "Object", "t", ")", "{", "try", "(", "Logger", "l", "=", "new", "Logger", "(", "\"specializeInstance(\"", "+", "specializedClass", ".", "getSpecializedClass", "(", ")", "."...
creates a specialized copy of the given instance @param specializedClass target specialized class to create an instance of @param t the object to copy and specialize @return the specialized instance. Should be functionally equivalent to t
[ "creates", "a", "specialized", "copy", "of", "the", "given", "instance" ]
train
https://github.com/julienledem/brennus/blob/0798fb565d95af19ddc5accd084e58c4e882dbd0/brennus-asm/src/main/java/brennus/asm/specializer/Specializer.java#L79-L111
VoltDB/voltdb
src/frontend/org/voltdb/compiler/VoltDDLElementTracker.java
VoltDDLElementTracker.addPartition
void addPartition(String tableName, String colName) { if (m_partitionMap.containsKey(tableName.toLowerCase())) { m_compiler.addInfo(String.format("Replacing partition column %s on table %s with column %s\n", m_partitionMap.get(tableName.toLowerCase()), tableName, colName)); } m_partitionMap.put(tableName.toLowerCase(), colName.toLowerCase()); }
java
void addPartition(String tableName, String colName) { if (m_partitionMap.containsKey(tableName.toLowerCase())) { m_compiler.addInfo(String.format("Replacing partition column %s on table %s with column %s\n", m_partitionMap.get(tableName.toLowerCase()), tableName, colName)); } m_partitionMap.put(tableName.toLowerCase(), colName.toLowerCase()); }
[ "void", "addPartition", "(", "String", "tableName", ",", "String", "colName", ")", "{", "if", "(", "m_partitionMap", ".", "containsKey", "(", "tableName", ".", "toLowerCase", "(", ")", ")", ")", "{", "m_compiler", ".", "addInfo", "(", "String", ".", "forma...
Add a table/column partition mapping for a PARTITION/REPLICATE statements. Validate input data and reject duplicates. @param tableName table name @param colName column name
[ "Add", "a", "table", "/", "column", "partition", "mapping", "for", "a", "PARTITION", "/", "REPLICATE", "statements", ".", "Validate", "input", "data", "and", "reject", "duplicates", "." ]
train
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/frontend/org/voltdb/compiler/VoltDDLElementTracker.java#L76-L85
aehrc/snorocket
snorocket-core/src/main/java/au/csiro/snorocket/core/axioms/GCI.java
GCI.rule5
boolean rule5(final IFactory factory, final Inclusion[] gcis) { boolean result = false; if (!(lhs instanceof Concept) && !(rhs instanceof Concept)) { result = true; Concept a = getA(factory, lhs); gcis[0] = new GCI(lhs, a); gcis[1] = new GCI(a, rhs); } return result; }
java
boolean rule5(final IFactory factory, final Inclusion[] gcis) { boolean result = false; if (!(lhs instanceof Concept) && !(rhs instanceof Concept)) { result = true; Concept a = getA(factory, lhs); gcis[0] = new GCI(lhs, a); gcis[1] = new GCI(a, rhs); } return result; }
[ "boolean", "rule5", "(", "final", "IFactory", "factory", ",", "final", "Inclusion", "[", "]", "gcis", ")", "{", "boolean", "result", "=", "false", ";", "if", "(", "!", "(", "lhs", "instanceof", "Concept", ")", "&&", "!", "(", "rhs", "instanceof", "Conc...
C' &#8849; D' &rarr; {C' &#8849; A, A &#8849; D'} @param gcis @return
[ "C", "&#8849", ";", "D", "&rarr", ";", "{", "C", "&#8849", ";", "A", "A", "&#8849", ";", "D", "}" ]
train
https://github.com/aehrc/snorocket/blob/e33c1e216f8a66d6502e3a14e80876811feedd8b/snorocket-core/src/main/java/au/csiro/snorocket/core/axioms/GCI.java#L228-L239
oehf/ipf-oht-atna
auditor/src/main/java/org/openhealthtools/ihe/atna/auditor/PIXAuditor.java
PIXAuditor.auditPatientRecordEvent
protected void auditPatientRecordEvent(boolean systemIsSource, IHETransactionEventTypeCodes transaction, RFC3881EventOutcomeCodes eventOutcome, RFC3881EventActionCodes eventActionCode, String sourceFacility, String sourceApp, String sourceAltUserId, String sourceNetworkId, String destinationFacility, String destinationApp, String destinationAltUserId, String destinationNetworkId, String humanRequestor, String hl7MessageId, String patientIds[], List<CodedValueType> purposesOfUse, List<CodedValueType> userRoles) { // Create Patient Record event PatientRecordEvent patientEvent = new PatientRecordEvent(systemIsSource, eventOutcome, eventActionCode, transaction, purposesOfUse); patientEvent.setAuditSourceId(getAuditSourceId(), getAuditEnterpriseSiteId()); // Set the source active participant patientEvent.addSourceActiveParticipant(EventUtils.concatHL7FacilityApplication(sourceFacility,sourceApp), sourceAltUserId, null, sourceNetworkId, true); // Set the human requestor active participant if (!EventUtils.isEmptyOrNull(humanRequestor)) { patientEvent.addHumanRequestorActiveParticipant(humanRequestor, null, null, userRoles); } // Set the destination active participant patientEvent.addDestinationActiveParticipant(EventUtils.concatHL7FacilityApplication(destinationFacility,destinationApp), destinationAltUserId, null, destinationNetworkId, false); // Add a patient participant object for each patient id if (!EventUtils.isEmptyOrNull(patientIds)) { for (int i=0; i<patientIds.length; i++) { patientEvent.addPatientParticipantObject(patientIds[i], hl7MessageId.getBytes(), transaction); } } audit(patientEvent); }
java
protected void auditPatientRecordEvent(boolean systemIsSource, IHETransactionEventTypeCodes transaction, RFC3881EventOutcomeCodes eventOutcome, RFC3881EventActionCodes eventActionCode, String sourceFacility, String sourceApp, String sourceAltUserId, String sourceNetworkId, String destinationFacility, String destinationApp, String destinationAltUserId, String destinationNetworkId, String humanRequestor, String hl7MessageId, String patientIds[], List<CodedValueType> purposesOfUse, List<CodedValueType> userRoles) { // Create Patient Record event PatientRecordEvent patientEvent = new PatientRecordEvent(systemIsSource, eventOutcome, eventActionCode, transaction, purposesOfUse); patientEvent.setAuditSourceId(getAuditSourceId(), getAuditEnterpriseSiteId()); // Set the source active participant patientEvent.addSourceActiveParticipant(EventUtils.concatHL7FacilityApplication(sourceFacility,sourceApp), sourceAltUserId, null, sourceNetworkId, true); // Set the human requestor active participant if (!EventUtils.isEmptyOrNull(humanRequestor)) { patientEvent.addHumanRequestorActiveParticipant(humanRequestor, null, null, userRoles); } // Set the destination active participant patientEvent.addDestinationActiveParticipant(EventUtils.concatHL7FacilityApplication(destinationFacility,destinationApp), destinationAltUserId, null, destinationNetworkId, false); // Add a patient participant object for each patient id if (!EventUtils.isEmptyOrNull(patientIds)) { for (int i=0; i<patientIds.length; i++) { patientEvent.addPatientParticipantObject(patientIds[i], hl7MessageId.getBytes(), transaction); } } audit(patientEvent); }
[ "protected", "void", "auditPatientRecordEvent", "(", "boolean", "systemIsSource", ",", "IHETransactionEventTypeCodes", "transaction", ",", "RFC3881EventOutcomeCodes", "eventOutcome", ",", "RFC3881EventActionCodes", "eventActionCode", ",", "String", "sourceFacility", ",", "Strin...
Audit a PATIENT RECORD event for Patient Identity Source transactions. Variable on the event action (Create, Update, Delete) audit patient identity feeds (create, update, merge [update/delete]) for both PIX Source and PIX Managers actors. @param systemIsSource Whether the system sending the message is the source active participant @param transaction IHE Transaction sending the message @param eventOutcome The event outcome indicator @param eventActionCode Code for the event action ("C" = create, "U" = update, "D" = delete") @param sourceFacility Source (sending/receiving) facility, from the MSH segment @param sourceApp Source (sending/receiving) application, from the MSH segment @param sourceAltUserId Source Active Participant Alternate User ID @param sourceNetworkId Source Active Participant Network ID @param destinationFacility Destination (sending/receiving) facility, from the MSH segment @param destinationApp Destination (sending/receiving) application, from the MSH segment @param destinationAltUserId Destination Active Participant Alternate User ID @param destinationNetworkId Destination Active Participant Network ID @param humanRequestor Identity of the human that initiated the transaction (if known) @param hl7MessageId The HL7 Message ID (v2 from the MSH segment field 10, v3 from message.Id) @param patientIds List of patient IDs that were seen in this transaction @param purposesOfUse purpose of use codes (may be taken from XUA token) @param userRoles roles of the human user (may be taken from XUA token)
[ "Audit", "a", "PATIENT", "RECORD", "event", "for", "Patient", "Identity", "Source", "transactions", ".", "Variable", "on", "the", "event", "action", "(", "Create", "Update", "Delete", ")", "audit", "patient", "identity", "feeds", "(", "create", "update", "merg...
train
https://github.com/oehf/ipf-oht-atna/blob/25ed1e926825169c94923a2c89a4618f60478ae8/auditor/src/main/java/org/openhealthtools/ihe/atna/auditor/PIXAuditor.java#L120-L149
kefirfromperm/kefirbb
src/org/kefirsf/bb/DomConfigurationFactory.java
DomConfigurationFactory.parseFix
private Template parseFix(Document dc, String tagname) { Template fix; NodeList prefixElementList = dc.getElementsByTagNameNS(SCHEMA_LOCATION, tagname); if (prefixElementList.getLength() > 0) { fix = parseTemplate(prefixElementList.item(0)); } else { fix = new Template(); } return fix; }
java
private Template parseFix(Document dc, String tagname) { Template fix; NodeList prefixElementList = dc.getElementsByTagNameNS(SCHEMA_LOCATION, tagname); if (prefixElementList.getLength() > 0) { fix = parseTemplate(prefixElementList.item(0)); } else { fix = new Template(); } return fix; }
[ "private", "Template", "parseFix", "(", "Document", "dc", ",", "String", "tagname", ")", "{", "Template", "fix", ";", "NodeList", "prefixElementList", "=", "dc", ".", "getElementsByTagNameNS", "(", "SCHEMA_LOCATION", ",", "tagname", ")", ";", "if", "(", "prefi...
Parse prefix or suffix. @param dc DOM-document. @param tagname tag name. @return template.
[ "Parse", "prefix", "or", "suffix", "." ]
train
https://github.com/kefirfromperm/kefirbb/blob/8c36fc3d3dc27459b0cdc179b87582df30420856/src/org/kefirsf/bb/DomConfigurationFactory.java#L194-L203
ocelotds/ocelot
ocelot-web/src/main/java/org/ocelotds/core/mtc/MessageToClientManager.java
MessageToClientManager._createMessageToClient
MessageToClient _createMessageToClient(MessageFromClient message, T session) { MessageToClient messageToClient = new MessageToClient(); messageToClient.setId(message.getId()); try { Class cls = Class.forName(message.getDataService()); Object dataService = this.getDataService(session, cls); logger.debug("Process message {}", message); List<Object> arguments = getArrayList(); Method method = methodServices.getMethodFromDataService(cls, message, arguments); injectSession(method.getParameterTypes(), arguments, session); messageToClient.setResult(method.invoke(dataService, arguments.toArray())); if (method.isAnnotationPresent(JsonMarshaller.class)) { messageToClient.setJson(argumentServices.getJsonResultFromSpecificMarshaller(method.getAnnotation(JsonMarshaller.class), messageToClient.getResponse())); } try { Method nonProxiedMethod = methodServices.getNonProxiedMethod(cls, method.getName(), method.getParameterTypes()); messageToClient.setDeadline(cacheManager.processCacheAnnotations(nonProxiedMethod, message.getParameters())); } catch (NoSuchMethodException ex) { logger.error("Fail to process extra annotations (JsCacheResult, JsCacheRemove) for method : " + method.getName(), ex); } logger.debug("Method {} proceed messageToClient : {}.", method.getName(), messageToClient); } catch (InvocationTargetException ex) { Throwable cause = ex.getCause(); if (ConstraintViolationException.class.isInstance(cause)) { messageToClient.setConstraints(constraintServices.extractViolations((ConstraintViolationException) cause)); } else { messageToClient.setFault(faultServices.buildFault(cause)); } } catch (Throwable ex) { messageToClient.setFault(faultServices.buildFault(ex)); } return messageToClient; }
java
MessageToClient _createMessageToClient(MessageFromClient message, T session) { MessageToClient messageToClient = new MessageToClient(); messageToClient.setId(message.getId()); try { Class cls = Class.forName(message.getDataService()); Object dataService = this.getDataService(session, cls); logger.debug("Process message {}", message); List<Object> arguments = getArrayList(); Method method = methodServices.getMethodFromDataService(cls, message, arguments); injectSession(method.getParameterTypes(), arguments, session); messageToClient.setResult(method.invoke(dataService, arguments.toArray())); if (method.isAnnotationPresent(JsonMarshaller.class)) { messageToClient.setJson(argumentServices.getJsonResultFromSpecificMarshaller(method.getAnnotation(JsonMarshaller.class), messageToClient.getResponse())); } try { Method nonProxiedMethod = methodServices.getNonProxiedMethod(cls, method.getName(), method.getParameterTypes()); messageToClient.setDeadline(cacheManager.processCacheAnnotations(nonProxiedMethod, message.getParameters())); } catch (NoSuchMethodException ex) { logger.error("Fail to process extra annotations (JsCacheResult, JsCacheRemove) for method : " + method.getName(), ex); } logger.debug("Method {} proceed messageToClient : {}.", method.getName(), messageToClient); } catch (InvocationTargetException ex) { Throwable cause = ex.getCause(); if (ConstraintViolationException.class.isInstance(cause)) { messageToClient.setConstraints(constraintServices.extractViolations((ConstraintViolationException) cause)); } else { messageToClient.setFault(faultServices.buildFault(cause)); } } catch (Throwable ex) { messageToClient.setFault(faultServices.buildFault(ex)); } return messageToClient; }
[ "MessageToClient", "_createMessageToClient", "(", "MessageFromClient", "message", ",", "T", "session", ")", "{", "MessageToClient", "messageToClient", "=", "new", "MessageToClient", "(", ")", ";", "messageToClient", ".", "setId", "(", "message", ".", "getId", "(", ...
Create a MessageToClient from MessageFromClient for session Only for available test use case @param message @param session @return
[ "Create", "a", "MessageToClient", "from", "MessageFromClient", "for", "session", "Only", "for", "available", "test", "use", "case" ]
train
https://github.com/ocelotds/ocelot/blob/5f0ac37afd8fa4dc9f7234a2aac8abbb522128e7/ocelot-web/src/main/java/org/ocelotds/core/mtc/MessageToClientManager.java#L133-L165
elki-project/elki
elki-index-mtree/src/main/java/de/lmu/ifi/dbs/elki/index/tree/metrical/mtreevariants/mktrees/mkapp/MkAppTreeIndex.java
MkAppTreeIndex.createNewLeafEntry
protected MkAppEntry createNewLeafEntry(DBID id, O object, double parentDistance) { return new MkAppLeafEntry(id, parentDistance, null); }
java
protected MkAppEntry createNewLeafEntry(DBID id, O object, double parentDistance) { return new MkAppLeafEntry(id, parentDistance, null); }
[ "protected", "MkAppEntry", "createNewLeafEntry", "(", "DBID", "id", ",", "O", "object", ",", "double", "parentDistance", ")", "{", "return", "new", "MkAppLeafEntry", "(", "id", ",", "parentDistance", ",", "null", ")", ";", "}" ]
Creates a new leaf entry representing the specified data object in the specified subtree. @param object the data object to be represented by the new entry @param parentDistance the distance from the object to the routing object of the parent node
[ "Creates", "a", "new", "leaf", "entry", "representing", "the", "specified", "data", "object", "in", "the", "specified", "subtree", "." ]
train
https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki-index-mtree/src/main/java/de/lmu/ifi/dbs/elki/index/tree/metrical/mtreevariants/mktrees/mkapp/MkAppTreeIndex.java#L77-L79
groovy/groovy-core
src/main/org/codehaus/groovy/runtime/StringGroovyMethods.java
StringGroovyMethods.takeWhile
public static String takeWhile(GString self, @ClosureParams(value=SimpleType.class, options="char") Closure condition) { return (String) takeWhile(self.toString(), condition); }
java
public static String takeWhile(GString self, @ClosureParams(value=SimpleType.class, options="char") Closure condition) { return (String) takeWhile(self.toString(), condition); }
[ "public", "static", "String", "takeWhile", "(", "GString", "self", ",", "@", "ClosureParams", "(", "value", "=", "SimpleType", ".", "class", ",", "options", "=", "\"char\"", ")", "Closure", "condition", ")", "{", "return", "(", "String", ")", "takeWhile", ...
A GString variant of the equivalent GString method. @param self the original GString @param condition the closure that must evaluate to true to continue taking elements @return a prefix of elements in the GString where each element passed to the given closure evaluates to true @since 2.3.7
[ "A", "GString", "variant", "of", "the", "equivalent", "GString", "method", "." ]
train
https://github.com/groovy/groovy-core/blob/01309f9d4be34ddf93c4a9943b5a97843bff6181/src/main/org/codehaus/groovy/runtime/StringGroovyMethods.java#L3206-L3208
Azure/azure-sdk-for-java
mediaservices/data-plane/src/main/java/com/microsoft/windowsazure/services/queue/models/CreateQueueOptions.java
CreateQueueOptions.addMetadata
public CreateQueueOptions addMetadata(String key, String value) { this.metadata.put(key, value); return this; }
java
public CreateQueueOptions addMetadata(String key, String value) { this.metadata.put(key, value); return this; }
[ "public", "CreateQueueOptions", "addMetadata", "(", "String", "key", ",", "String", "value", ")", "{", "this", ".", "metadata", ".", "put", "(", "key", ",", "value", ")", ";", "return", "this", ";", "}" ]
Adds a key-value pair of {@link String} to the metadata collection to set on a queue when the queue is created. Queue metadata is a user-defined collection of key-value pairs that is opaque to the server. If the key already exists in the metadata collection, the value parameter will overwrite the existing value paired with that key without notification. <p> The updated metadata is only added to a newly created queue where this {@link CreateQueueOptions} instance is passed as a parameter. @param key A {@link String} containing the key part of the key-value pair to add to the metadata. @param value A {@link String} containing the value part of the key-value pair to add to the metadata. @return A reference to this {@link CreateQueueOptions} instance.
[ "Adds", "a", "key", "-", "value", "pair", "of", "{", "@link", "String", "}", "to", "the", "metadata", "collection", "to", "set", "on", "a", "queue", "when", "the", "queue", "is", "created", ".", "Queue", "metadata", "is", "a", "user", "-", "defined", ...
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/mediaservices/data-plane/src/main/java/com/microsoft/windowsazure/services/queue/models/CreateQueueOptions.java#L92-L95
google/j2objc
jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/UTF16.java
UTF16.compareCodePoint
public static int compareCodePoint(int codePoint, CharSequence s) { if (s == null) { return 1; } final int strLen = s.length(); if (strLen == 0) { return 1; } int second = Character.codePointAt(s, 0); int diff = codePoint - second; if (diff != 0) { return diff; } return strLen == Character.charCount(codePoint) ? 0 : -1; }
java
public static int compareCodePoint(int codePoint, CharSequence s) { if (s == null) { return 1; } final int strLen = s.length(); if (strLen == 0) { return 1; } int second = Character.codePointAt(s, 0); int diff = codePoint - second; if (diff != 0) { return diff; } return strLen == Character.charCount(codePoint) ? 0 : -1; }
[ "public", "static", "int", "compareCodePoint", "(", "int", "codePoint", ",", "CharSequence", "s", ")", "{", "if", "(", "s", "==", "null", ")", "{", "return", "1", ";", "}", "final", "int", "strLen", "=", "s", ".", "length", "(", ")", ";", "if", "("...
Utility for comparing a code point to a string without having to create a new string. Returns the same results as a code point comparison of UTF16.valueOf(codePoint) and s.toString(). More specifically, if <pre> sc = new StringComparator(true,false,0); fast = UTF16.compareCodePoint(codePoint, charSequence) slower = sc.compare(UTF16.valueOf(codePoint), charSequence == null ? "" : charSequence.toString()) </pre> then <pre> Integer.signum(fast) == Integer.signum(slower) </pre> @param codePoint to test @param s to test @return equivalent of code point comparator comparing two strings.
[ "Utility", "for", "comparing", "a", "code", "point", "to", "a", "string", "without", "having", "to", "create", "a", "new", "string", ".", "Returns", "the", "same", "results", "as", "a", "code", "point", "comparison", "of", "UTF16", ".", "valueOf", "(", "...
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/UTF16.java#L2561-L2575
twilio/twilio-java
src/main/java/com/twilio/base/Page.java
Page.getUrl
public String getUrl(String domain, String region) { if (url != null) { return url; } return urlFromUri(domain, region, uri); }
java
public String getUrl(String domain, String region) { if (url != null) { return url; } return urlFromUri(domain, region, uri); }
[ "public", "String", "getUrl", "(", "String", "domain", ",", "String", "region", ")", "{", "if", "(", "url", "!=", "null", ")", "{", "return", "url", ";", "}", "return", "urlFromUri", "(", "domain", ",", "region", ",", "uri", ")", ";", "}" ]
Generate page url for a list result. @param domain domain to use @param region region to use @return the page url
[ "Generate", "page", "url", "for", "a", "list", "result", "." ]
train
https://github.com/twilio/twilio-java/blob/0318974c0a6a152994af167d430255684d5e9b9f/src/main/java/com/twilio/base/Page.java#L102-L108
yatechorg/jedis-utils
src/main/java/org/yatech/jedis/utils/lua/LuaScriptBuilder.java
LuaScriptBuilder.endPreparedScriptReturn
public LuaPreparedScript endPreparedScriptReturn(LuaValue value, LuaScriptConfig config) { add(new LuaAstReturnStatement(argument(value))); return endPreparedScript(config); }
java
public LuaPreparedScript endPreparedScriptReturn(LuaValue value, LuaScriptConfig config) { add(new LuaAstReturnStatement(argument(value))); return endPreparedScript(config); }
[ "public", "LuaPreparedScript", "endPreparedScriptReturn", "(", "LuaValue", "value", ",", "LuaScriptConfig", "config", ")", "{", "add", "(", "new", "LuaAstReturnStatement", "(", "argument", "(", "value", ")", ")", ")", ";", "return", "endPreparedScript", "(", "conf...
End building the prepared script, adding a return value statement @param value the value to return @param config the configuration for the script to build @return the new {@link LuaPreparedScript} instance
[ "End", "building", "the", "prepared", "script", "adding", "a", "return", "value", "statement" ]
train
https://github.com/yatechorg/jedis-utils/blob/1951609fa6697df4f69be76e7d66b9284924bd97/src/main/java/org/yatech/jedis/utils/lua/LuaScriptBuilder.java#L153-L156
undertow-io/undertow
core/src/main/java/io/undertow/websockets/core/WebSockets.java
WebSockets.sendText
public static void sendText(final PooledByteBuffer pooledData, final WebSocketChannel wsChannel, final WebSocketCallback<Void> callback) { sendInternal(pooledData, WebSocketFrameType.TEXT, wsChannel, callback, null, -1); }
java
public static void sendText(final PooledByteBuffer pooledData, final WebSocketChannel wsChannel, final WebSocketCallback<Void> callback) { sendInternal(pooledData, WebSocketFrameType.TEXT, wsChannel, callback, null, -1); }
[ "public", "static", "void", "sendText", "(", "final", "PooledByteBuffer", "pooledData", ",", "final", "WebSocketChannel", "wsChannel", ",", "final", "WebSocketCallback", "<", "Void", ">", "callback", ")", "{", "sendInternal", "(", "pooledData", ",", "WebSocketFrameT...
Sends a complete text message, invoking the callback when complete Automatically frees the pooled byte buffer when done. @param pooledData The data to send, it will be freed when done @param wsChannel The web socket channel @param callback The callback to invoke on completion
[ "Sends", "a", "complete", "text", "message", "invoking", "the", "callback", "when", "complete", "Automatically", "frees", "the", "pooled", "byte", "buffer", "when", "done", "." ]
train
https://github.com/undertow-io/undertow/blob/87de0b856a7a4ba8faf5b659537b9af07b763263/core/src/main/java/io/undertow/websockets/core/WebSockets.java#L148-L150
facebookarchive/hadoop-20
src/mapred/org/apache/hadoop/mapred/JobTracker.java
JobTracker.setJobPriority
synchronized void setJobPriority(JobID jobId, JobPriority priority) { JobInProgress job = jobs.get(jobId); if (job != null) { synchronized (taskScheduler) { JobStatus oldStatus = (JobStatus)job.getStatus().clone(); job.setPriority(priority); JobStatus newStatus = (JobStatus)job.getStatus().clone(); JobStatusChangeEvent event = new JobStatusChangeEvent(job, EventType.PRIORITY_CHANGED, oldStatus, newStatus); updateJobInProgressListeners(event); } } else { LOG.warn("Trying to change the priority of an unknown job: " + jobId); } }
java
synchronized void setJobPriority(JobID jobId, JobPriority priority) { JobInProgress job = jobs.get(jobId); if (job != null) { synchronized (taskScheduler) { JobStatus oldStatus = (JobStatus)job.getStatus().clone(); job.setPriority(priority); JobStatus newStatus = (JobStatus)job.getStatus().clone(); JobStatusChangeEvent event = new JobStatusChangeEvent(job, EventType.PRIORITY_CHANGED, oldStatus, newStatus); updateJobInProgressListeners(event); } } else { LOG.warn("Trying to change the priority of an unknown job: " + jobId); } }
[ "synchronized", "void", "setJobPriority", "(", "JobID", "jobId", ",", "JobPriority", "priority", ")", "{", "JobInProgress", "job", "=", "jobs", ".", "get", "(", "jobId", ")", ";", "if", "(", "job", "!=", "null", ")", "{", "synchronized", "(", "taskSchedule...
Change the run-time priority of the given job. @param jobId job id @param priority new {@link JobPriority} for the job
[ "Change", "the", "run", "-", "time", "priority", "of", "the", "given", "job", "." ]
train
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/mapred/org/apache/hadoop/mapred/JobTracker.java#L3643-L3658
alibaba/vlayout
vlayout/src/main/java/com/alibaba/android/vlayout/layout/MarginLayoutHelper.java
MarginLayoutHelper.setMargin
public void setMargin(int leftMargin, int topMargin, int rightMargin, int bottomMargin) { this.mMarginLeft = leftMargin; this.mMarginTop = topMargin; this.mMarginRight = rightMargin; this.mMarginBottom = bottomMargin; }
java
public void setMargin(int leftMargin, int topMargin, int rightMargin, int bottomMargin) { this.mMarginLeft = leftMargin; this.mMarginTop = topMargin; this.mMarginRight = rightMargin; this.mMarginBottom = bottomMargin; }
[ "public", "void", "setMargin", "(", "int", "leftMargin", ",", "int", "topMargin", ",", "int", "rightMargin", ",", "int", "bottomMargin", ")", "{", "this", ".", "mMarginLeft", "=", "leftMargin", ";", "this", ".", "mMarginTop", "=", "topMargin", ";", "this", ...
Set margins for this layoutHelper @param leftMargin left margin @param topMargin top margin @param rightMargin right margin @param bottomMargin bottom margin
[ "Set", "margins", "for", "this", "layoutHelper" ]
train
https://github.com/alibaba/vlayout/blob/8a5a51d9d2eeb91fed2ee331a4cf3496282452ce/vlayout/src/main/java/com/alibaba/android/vlayout/layout/MarginLayoutHelper.java#L70-L75
GenesysPureEngage/provisioning-client-java
src/main/java/com/genesys/internal/provisioning/api/OperationsApi.java
OperationsApi.getUsersAsyncWithHttpInfo
public ApiResponse<ApiAsyncSuccessResponse> getUsersAsyncWithHttpInfo(String aioId, Integer limit, Integer offset, String order, String sortBy, String filterName, String filterParameters, String roles, String skills, Boolean userEnabled, String userValid) throws ApiException { com.squareup.okhttp.Call call = getUsersAsyncValidateBeforeCall(aioId, limit, offset, order, sortBy, filterName, filterParameters, roles, skills, userEnabled, userValid, null, null); Type localVarReturnType = new TypeToken<ApiAsyncSuccessResponse>(){}.getType(); return apiClient.execute(call, localVarReturnType); }
java
public ApiResponse<ApiAsyncSuccessResponse> getUsersAsyncWithHttpInfo(String aioId, Integer limit, Integer offset, String order, String sortBy, String filterName, String filterParameters, String roles, String skills, Boolean userEnabled, String userValid) throws ApiException { com.squareup.okhttp.Call call = getUsersAsyncValidateBeforeCall(aioId, limit, offset, order, sortBy, filterName, filterParameters, roles, skills, userEnabled, userValid, null, null); Type localVarReturnType = new TypeToken<ApiAsyncSuccessResponse>(){}.getType(); return apiClient.execute(call, localVarReturnType); }
[ "public", "ApiResponse", "<", "ApiAsyncSuccessResponse", ">", "getUsersAsyncWithHttpInfo", "(", "String", "aioId", ",", "Integer", "limit", ",", "Integer", "offset", ",", "String", "order", ",", "String", "sortBy", ",", "String", "filterName", ",", "String", "filt...
Get users. Get [CfgPerson](https://docs.genesys.com/Documentation/PSDK/latest/ConfigLayerRef/CfgPerson) objects based on the specified filters. @param aioId A unique ID generated on the client (browser) when sending an API request that returns an asynchronous response. (required) @param limit Limit the number of users the Provisioning API should return. (optional) @param offset The number of matches the Provisioning API should skip in the returned users. (optional) @param order The sort order. (optional) @param sortBy A comma-separated list of fields to sort on. Possible values are firstName, lastName, and userName. (optional) @param filterName The name of a filter to use on the results. (optional) @param filterParameters A part of the users first or last name, if you use the FirstNameOrLastNameMatches filter. (optional) @param roles Return only return users who have these Workspace Web Edition roles. The roles can be specified in a comma-separated list. Possible values are ROLE_AGENT and ROLE_ADMIN,ROLE_SUPERVISOR. (optional) @param skills Return only users who have these skills. The skills can be specified in a comma-separated list. (optional) @param userEnabled Return only enabled or disabled users. (optional) @param userValid Return only valid or invalid users. (optional) @return ApiResponse&lt;ApiAsyncSuccessResponse&gt; @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
[ "Get", "users", ".", "Get", "[", "CfgPerson", "]", "(", "https", ":", "//", "docs", ".", "genesys", ".", "com", "/", "Documentation", "/", "PSDK", "/", "latest", "/", "ConfigLayerRef", "/", "CfgPerson", ")", "objects", "based", "on", "the", "specified", ...
train
https://github.com/GenesysPureEngage/provisioning-client-java/blob/1ad594c3767cec83052168e350994f922a26f75e/src/main/java/com/genesys/internal/provisioning/api/OperationsApi.java#L673-L677
knowm/XChange
xchange-quadrigacx/src/main/java/org/knowm/xchange/quadrigacx/QuadrigaCxUtils.java
QuadrigaCxUtils.parseDate
public static Date parseDate(String dateString) { try { return DATE_FORMAT.parse(dateString); } catch (ParseException e) { throw new ExchangeException("Illegal date/time format", e); } }
java
public static Date parseDate(String dateString) { try { return DATE_FORMAT.parse(dateString); } catch (ParseException e) { throw new ExchangeException("Illegal date/time format", e); } }
[ "public", "static", "Date", "parseDate", "(", "String", "dateString", ")", "{", "try", "{", "return", "DATE_FORMAT", ".", "parse", "(", "dateString", ")", ";", "}", "catch", "(", "ParseException", "e", ")", "{", "throw", "new", "ExchangeException", "(", "\...
Format a date String for QuadrigaCx @param dateString @return
[ "Format", "a", "date", "String", "for", "QuadrigaCx" ]
train
https://github.com/knowm/XChange/blob/e45f437ac8e0b89cd66cdcb3258bdb1bf3d88186/xchange-quadrigacx/src/main/java/org/knowm/xchange/quadrigacx/QuadrigaCxUtils.java#L27-L33
Azure/azure-sdk-for-java
cognitiveservices/data-plane/vision/computervision/src/main/java/com/microsoft/azure/cognitiveservices/vision/computervision/implementation/ComputerVisionImpl.java
ComputerVisionImpl.recognizeTextInStream
public void recognizeTextInStream(byte[] image, TextRecognitionMode mode) { recognizeTextInStreamWithServiceResponseAsync(image, mode).toBlocking().single().body(); }
java
public void recognizeTextInStream(byte[] image, TextRecognitionMode mode) { recognizeTextInStreamWithServiceResponseAsync(image, mode).toBlocking().single().body(); }
[ "public", "void", "recognizeTextInStream", "(", "byte", "[", "]", "image", ",", "TextRecognitionMode", "mode", ")", "{", "recognizeTextInStreamWithServiceResponseAsync", "(", "image", ",", "mode", ")", ".", "toBlocking", "(", ")", ".", "single", "(", ")", ".", ...
Recognize Text operation. When you use the Recognize Text interface, the response contains a field called 'Operation-Location'. The 'Operation-Location' field contains the URL that you must use for your Get Recognize Text Operation Result operation. @param image An image stream. @param mode Type of text to recognize. Possible values include: 'Handwritten', 'Printed' @throws IllegalArgumentException thrown if parameters fail the validation @throws ComputerVisionErrorException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
[ "Recognize", "Text", "operation", ".", "When", "you", "use", "the", "Recognize", "Text", "interface", "the", "response", "contains", "a", "field", "called", "Operation", "-", "Location", ".", "The", "Operation", "-", "Location", "field", "contains", "the", "UR...
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/cognitiveservices/data-plane/vision/computervision/src/main/java/com/microsoft/azure/cognitiveservices/vision/computervision/implementation/ComputerVisionImpl.java#L170-L172
stephanenicolas/robospice
robospice-core-parent/robospice/src/main/java/com/octo/android/robospice/SpiceManager.java
SpiceManager.getDateOfDataInCache
public Future<Date> getDateOfDataInCache(Class<?> clazz, final Object cacheKey) throws CacheCreationException { return executeCommand(new GetDateOfDataInCacheCommand(this, clazz, cacheKey)); }
java
public Future<Date> getDateOfDataInCache(Class<?> clazz, final Object cacheKey) throws CacheCreationException { return executeCommand(new GetDateOfDataInCacheCommand(this, clazz, cacheKey)); }
[ "public", "Future", "<", "Date", ">", "getDateOfDataInCache", "(", "Class", "<", "?", ">", "clazz", ",", "final", "Object", "cacheKey", ")", "throws", "CacheCreationException", "{", "return", "executeCommand", "(", "new", "GetDateOfDataInCacheCommand", "(", "this"...
Returns the last date of storage of a given data into the cache. @param clazz the class of the result to retrieve from cache. @param cacheKey the key used to store and retrieve the result of the request in the cache @return the date at which data has been stored in cache. Null if no such data is in Cache. @throws CacheLoadingException Exception thrown when a problem occurs while loading data from cache.
[ "Returns", "the", "last", "date", "of", "storage", "of", "a", "given", "data", "into", "the", "cache", "." ]
train
https://github.com/stephanenicolas/robospice/blob/8bffde88b3534a961a13cab72a8f07a755f0a0fe/robospice-core-parent/robospice/src/main/java/com/octo/android/robospice/SpiceManager.java#L965-L967
openengsb/openengsb
components/services/src/main/java/org/openengsb/core/services/internal/security/ldap/LdapUtils.java
LdapUtils.extractAttributeEmptyCheck
public static String extractAttributeEmptyCheck(Entry entry, String attributeType) { Attribute attribute = entry.get(attributeType); Attribute emptyFlagAttribute = entry.get(SchemaConstants.EMPTY_FLAG_ATTRIBUTE); boolean empty = false; try { if (attribute != null) { return attribute.getString(); } else if (emptyFlagAttribute != null) { empty = Boolean.valueOf(emptyFlagAttribute.getString()); } } catch (LdapInvalidAttributeValueException e) { throw new ObjectClassViolationException(e); } return empty ? new String() : null; }
java
public static String extractAttributeEmptyCheck(Entry entry, String attributeType) { Attribute attribute = entry.get(attributeType); Attribute emptyFlagAttribute = entry.get(SchemaConstants.EMPTY_FLAG_ATTRIBUTE); boolean empty = false; try { if (attribute != null) { return attribute.getString(); } else if (emptyFlagAttribute != null) { empty = Boolean.valueOf(emptyFlagAttribute.getString()); } } catch (LdapInvalidAttributeValueException e) { throw new ObjectClassViolationException(e); } return empty ? new String() : null; }
[ "public", "static", "String", "extractAttributeEmptyCheck", "(", "Entry", "entry", ",", "String", "attributeType", ")", "{", "Attribute", "attribute", "=", "entry", ".", "get", "(", "attributeType", ")", ";", "Attribute", "emptyFlagAttribute", "=", "entry", ".", ...
Returns the value of the first occurence of attributeType from entry.
[ "Returns", "the", "value", "of", "the", "first", "occurence", "of", "attributeType", "from", "entry", "." ]
train
https://github.com/openengsb/openengsb/blob/d39058000707f617cd405629f9bc7f17da7b414a/components/services/src/main/java/org/openengsb/core/services/internal/security/ldap/LdapUtils.java#L70-L84
imsweb/naaccr-xml
src/main/java/com/imsweb/naaccrxml/NaaccrXmlUtils.java
NaaccrXmlUtils.writeXmlFile
public static void writeXmlFile(NaaccrData data, File xmlFile, NaaccrOptions options, List<NaaccrDictionary> userDictionaries, NaaccrObserver observer) throws NaaccrIOException { if (data == null) throw new NaaccrIOException("Data is required"); if (!xmlFile.getParentFile().exists()) throw new NaaccrIOException("Target folder must exist"); try (PatientXmlWriter writer = new PatientXmlWriter(createWriter(xmlFile), data, options, userDictionaries)) { for (Patient patient : data.getPatients()) { writer.writePatient(patient); if (observer != null) observer.patientWritten(patient); if (Thread.currentThread().isInterrupted()) break; } } }
java
public static void writeXmlFile(NaaccrData data, File xmlFile, NaaccrOptions options, List<NaaccrDictionary> userDictionaries, NaaccrObserver observer) throws NaaccrIOException { if (data == null) throw new NaaccrIOException("Data is required"); if (!xmlFile.getParentFile().exists()) throw new NaaccrIOException("Target folder must exist"); try (PatientXmlWriter writer = new PatientXmlWriter(createWriter(xmlFile), data, options, userDictionaries)) { for (Patient patient : data.getPatients()) { writer.writePatient(patient); if (observer != null) observer.patientWritten(patient); if (Thread.currentThread().isInterrupted()) break; } } }
[ "public", "static", "void", "writeXmlFile", "(", "NaaccrData", "data", ",", "File", "xmlFile", ",", "NaaccrOptions", "options", ",", "List", "<", "NaaccrDictionary", ">", "userDictionaries", ",", "NaaccrObserver", "observer", ")", "throws", "NaaccrIOException", "{",...
Writes the provided data to the requested XML file. <br/> ATTENTION: THIS METHOD REQUIRES THE ENTIRE DATA OBJECT TO BE IN MEMORY; CONSIDER USING A STREAM INSTEAD. @param data a <code>NaaccrData</code> object, cannot be null @param xmlFile target XML data file @param options optional validating options @param userDictionaries optional user-defined dictionaries (will be merged with the base dictionary) @param observer an optional observer, useful to keep track of the progress @throws NaaccrIOException if there is problem reading/writing the file
[ "Writes", "the", "provided", "data", "to", "the", "requested", "XML", "file", ".", "<br", "/", ">", "ATTENTION", ":", "THIS", "METHOD", "REQUIRES", "THE", "ENTIRE", "DATA", "OBJECT", "TO", "BE", "IN", "MEMORY", ";", "CONSIDER", "USING", "A", "STREAM", "I...
train
https://github.com/imsweb/naaccr-xml/blob/a3a501faa2a0c3411dd5248b2c1379f279131696/src/main/java/com/imsweb/naaccrxml/NaaccrXmlUtils.java#L175-L190
walkmod/walkmod-core
src/main/java/org/walkmod/WalkModFacade.java
WalkModFacade.addConfigurationParameter
public void addConfigurationParameter(String param, String value, String type, String category, String name, String chain, boolean recursive) throws Exception { long startTime = System.currentTimeMillis(); Exception exception = null; if (cfg.exists()) { userDir = new File(System.getProperty("user.dir")).getAbsolutePath(); System.setProperty("user.dir", options.getExecutionDirectory().getAbsolutePath()); try { ConfigurationManager manager = new ConfigurationManager(cfg, false); manager.getProjectConfigurationProvider().addConfigurationParameter(param, value, type, category, name, chain, recursive); } catch (Exception e) { exception = e; } finally { System.setProperty("user.dir", userDir); updateMsg(startTime, exception); } } }
java
public void addConfigurationParameter(String param, String value, String type, String category, String name, String chain, boolean recursive) throws Exception { long startTime = System.currentTimeMillis(); Exception exception = null; if (cfg.exists()) { userDir = new File(System.getProperty("user.dir")).getAbsolutePath(); System.setProperty("user.dir", options.getExecutionDirectory().getAbsolutePath()); try { ConfigurationManager manager = new ConfigurationManager(cfg, false); manager.getProjectConfigurationProvider().addConfigurationParameter(param, value, type, category, name, chain, recursive); } catch (Exception e) { exception = e; } finally { System.setProperty("user.dir", userDir); updateMsg(startTime, exception); } } }
[ "public", "void", "addConfigurationParameter", "(", "String", "param", ",", "String", "value", ",", "String", "type", ",", "String", "category", ",", "String", "name", ",", "String", "chain", ",", "boolean", "recursive", ")", "throws", "Exception", "{", "long"...
Sets an specific parameter value into a bean. @param param Parameter name @param value Parameter value @param type Bean type to set the parameter @param category Bean category to set the parameter (walker, reader, transformation, writer) @param name Bean name/alias to set the parameter @param chain Bean chain to filter the beans to take into account @param recursive If it necessary to set the parameter to all the submodules. @throws Exception If the walkmod configuration file can't be read.
[ "Sets", "an", "specific", "parameter", "value", "into", "a", "bean", "." ]
train
https://github.com/walkmod/walkmod-core/blob/fa79b836894fa00ca4b3e2bd26326a44b778f46f/src/main/java/org/walkmod/WalkModFacade.java#L1013-L1033
fozziethebeat/S-Space
opt/src/main/java/edu/ucla/sspace/lra/LatentRelationalAnalysis.java
LatentRelationalAnalysis.countWildcardPhraseFrequencies
private static int countWildcardPhraseFrequencies(File dir, String pattern) throws Exception { File[] files = dir.listFiles(); int total = 0; for (int i = 0; i < files.length; i++) { File f = files[i]; if (f.isDirectory()) { total += countWildcardPhraseFrequencies(f, pattern); } else if (f.getName().endsWith(".txt")) { Scanner sc = new Scanner(f); while (sc.hasNext()) { String line = sc.nextLine(); if (line.matches(pattern)) { total++; } } } } return total; }
java
private static int countWildcardPhraseFrequencies(File dir, String pattern) throws Exception { File[] files = dir.listFiles(); int total = 0; for (int i = 0; i < files.length; i++) { File f = files[i]; if (f.isDirectory()) { total += countWildcardPhraseFrequencies(f, pattern); } else if (f.getName().endsWith(".txt")) { Scanner sc = new Scanner(f); while (sc.hasNext()) { String line = sc.nextLine(); if (line.matches(pattern)) { total++; } } } } return total; }
[ "private", "static", "int", "countWildcardPhraseFrequencies", "(", "File", "dir", ",", "String", "pattern", ")", "throws", "Exception", "{", "File", "[", "]", "files", "=", "dir", ".", "listFiles", "(", ")", ";", "int", "total", "=", "0", ";", "for", "("...
Searches through all the .txt files in a directory and returns the total number of occurrences of a pattern.
[ "Searches", "through", "all", "the", ".", "txt", "files", "in", "a", "directory", "and", "returns", "the", "total", "number", "of", "occurrences", "of", "a", "pattern", "." ]
train
https://github.com/fozziethebeat/S-Space/blob/a608102737dfd3d59038a9ead33fe60356bc6029/opt/src/main/java/edu/ucla/sspace/lra/LatentRelationalAnalysis.java#L629-L651
OpenLiberty/open-liberty
dev/com.ibm.ws.monitor/src/com/ibm/ws/monitor/internal/ProbeManagerImpl.java
ProbeManagerImpl.addListenerByProbe
void addListenerByProbe(ProbeImpl probe, ProbeListener listener) { Set<ProbeListener> listeners = listenersByProbe.get(probe); if (listeners == null) { listeners = new CopyOnWriteArraySet<ProbeListener>(); listenersByProbe.putIfAbsent(probe, listeners); listeners = listenersByProbe.get(probe); } listeners.add(listener); }
java
void addListenerByProbe(ProbeImpl probe, ProbeListener listener) { Set<ProbeListener> listeners = listenersByProbe.get(probe); if (listeners == null) { listeners = new CopyOnWriteArraySet<ProbeListener>(); listenersByProbe.putIfAbsent(probe, listeners); listeners = listenersByProbe.get(probe); } listeners.add(listener); }
[ "void", "addListenerByProbe", "(", "ProbeImpl", "probe", ",", "ProbeListener", "listener", ")", "{", "Set", "<", "ProbeListener", ">", "listeners", "=", "listenersByProbe", ".", "get", "(", "probe", ")", ";", "if", "(", "listeners", "==", "null", ")", "{", ...
Add the specified listener to the collection of listeners associated with the specified probe. @param probe the probe that fires for the listener @param listener the listener that's driven by the probe
[ "Add", "the", "specified", "listener", "to", "the", "collection", "of", "listeners", "associated", "with", "the", "specified", "probe", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.monitor/src/com/ibm/ws/monitor/internal/ProbeManagerImpl.java#L691-L699
ngageoint/geopackage-java
src/main/java/mil/nga/geopackage/extension/style/Styles.java
Styles.setStyle
public void setStyle(StyleRow styleRow, GeometryType geometryType) { if (geometryType != null) { if (styleRow != null) { styles.put(geometryType, styleRow); } else { styles.remove(geometryType); } } else { defaultStyle = styleRow; } }
java
public void setStyle(StyleRow styleRow, GeometryType geometryType) { if (geometryType != null) { if (styleRow != null) { styles.put(geometryType, styleRow); } else { styles.remove(geometryType); } } else { defaultStyle = styleRow; } }
[ "public", "void", "setStyle", "(", "StyleRow", "styleRow", ",", "GeometryType", "geometryType", ")", "{", "if", "(", "geometryType", "!=", "null", ")", "{", "if", "(", "styleRow", "!=", "null", ")", "{", "styles", ".", "put", "(", "geometryType", ",", "s...
Set the style for the geometry type @param styleRow style row @param geometryType geometry type
[ "Set", "the", "style", "for", "the", "geometry", "type" ]
train
https://github.com/ngageoint/geopackage-java/blob/889bffb5d18330a3f4bd89443acf7959ebe3a376/src/main/java/mil/nga/geopackage/extension/style/Styles.java#L47-L57
GerdHolz/TOVAL
src/de/invation/code/toval/file/LineBasedFileTransformer.java
LineBasedFileTransformer.initialize
protected synchronized void initialize(String fileName) throws IOException, ParameterException { Validate.notNull(fileName, "File Name must not be null"); input = new FileReader(fileName, inputCharset); String inputName = input.getFile().getAbsolutePath(); String outputFileName = inputName.substring(0, inputName.indexOf('.'))+"_output"; output = new FileWriter(outputFileName, outputCharset); if(fileExtension != null){ output.setFileExtension(getFileExtension()); } }
java
protected synchronized void initialize(String fileName) throws IOException, ParameterException { Validate.notNull(fileName, "File Name must not be null"); input = new FileReader(fileName, inputCharset); String inputName = input.getFile().getAbsolutePath(); String outputFileName = inputName.substring(0, inputName.indexOf('.'))+"_output"; output = new FileWriter(outputFileName, outputCharset); if(fileExtension != null){ output.setFileExtension(getFileExtension()); } }
[ "protected", "synchronized", "void", "initialize", "(", "String", "fileName", ")", "throws", "IOException", ",", "ParameterException", "{", "Validate", ".", "notNull", "(", "fileName", ",", "\"File Name must not be null\"", ")", ";", "input", "=", "new", "FileReader...
------- Methods for setting up the parser ----------------------------------------------
[ "-------", "Methods", "for", "setting", "up", "the", "parser", "----------------------------------------------" ]
train
https://github.com/GerdHolz/TOVAL/blob/036922cdfd710fa53b18e5dbe1e07f226f731fde/src/de/invation/code/toval/file/LineBasedFileTransformer.java#L85-L94
xhsun/gw2wrapper
src/main/java/me/xhsun/guildwars2wrapper/AsynchronousRequest.java
AsynchronousRequest.getAllPvPGameID
public void getAllPvPGameID(String api, Callback<List<String>> callback) throws GuildWars2Exception, NullPointerException { isParamValid(new ParamChecker(ParamType.API, api)); gw2API.getAllPvPGameIDs(api).enqueue(callback); }
java
public void getAllPvPGameID(String api, Callback<List<String>> callback) throws GuildWars2Exception, NullPointerException { isParamValid(new ParamChecker(ParamType.API, api)); gw2API.getAllPvPGameIDs(api).enqueue(callback); }
[ "public", "void", "getAllPvPGameID", "(", "String", "api", ",", "Callback", "<", "List", "<", "String", ">", ">", "callback", ")", "throws", "GuildWars2Exception", ",", "NullPointerException", "{", "isParamValid", "(", "new", "ParamChecker", "(", "ParamType", "....
For more info on pvp games API go <a href="https://wiki.guildwars2.com/wiki/API:2/pvp/games">here</a><br/> Give user the access to {@link Callback#onResponse(Call, Response)} and {@link Callback#onFailure(Call, Throwable)} methods for custom interactions @param api Guild Wars 2 API key @param callback callback that is going to be used for {@link Call#enqueue(Callback)} @throws NullPointerException if given {@link Callback} is empty @throws GuildWars2Exception invalid API key @see PvPGame pvp game info
[ "For", "more", "info", "on", "pvp", "games", "API", "go", "<a", "href", "=", "https", ":", "//", "wiki", ".", "guildwars2", ".", "com", "/", "wiki", "/", "API", ":", "2", "/", "pvp", "/", "games", ">", "here<", "/", "a", ">", "<br", "/", ">", ...
train
https://github.com/xhsun/gw2wrapper/blob/c8a43b51f363b032074fb152ee6efe657e33e525/src/main/java/me/xhsun/guildwars2wrapper/AsynchronousRequest.java#L2038-L2041
classgraph/classgraph
src/main/java/io/github/classgraph/Classfile.java
Classfile.getConstantPoolString
private String getConstantPoolString(final int cpIdx, final int subFieldIdx) throws ClassfileFormatException, IOException { final int constantPoolStringOffset = getConstantPoolStringOffset(cpIdx, subFieldIdx); return constantPoolStringOffset == 0 ? null : intern(inputStreamOrByteBuffer.readString(constantPoolStringOffset, /* replaceSlashWithDot = */ false, /* stripLSemicolon = */ false)); }
java
private String getConstantPoolString(final int cpIdx, final int subFieldIdx) throws ClassfileFormatException, IOException { final int constantPoolStringOffset = getConstantPoolStringOffset(cpIdx, subFieldIdx); return constantPoolStringOffset == 0 ? null : intern(inputStreamOrByteBuffer.readString(constantPoolStringOffset, /* replaceSlashWithDot = */ false, /* stripLSemicolon = */ false)); }
[ "private", "String", "getConstantPoolString", "(", "final", "int", "cpIdx", ",", "final", "int", "subFieldIdx", ")", "throws", "ClassfileFormatException", ",", "IOException", "{", "final", "int", "constantPoolStringOffset", "=", "getConstantPoolStringOffset", "(", "cpId...
Get a string from the constant pool. @param cpIdx the constant pool index @param subFieldIdx should be 0 for CONSTANT_Utf8, CONSTANT_Class and CONSTANT_String, and for CONSTANT_NameAndType_info, fetches the name for value 0, or the type descriptor for value 1. @return the constant pool string @throws ClassfileFormatException If a problem occurs. @throws IOException If an IO exception occurs.
[ "Get", "a", "string", "from", "the", "constant", "pool", "." ]
train
https://github.com/classgraph/classgraph/blob/c8c8b2ca1eb76339f69193fdac33d735c864215c/src/main/java/io/github/classgraph/Classfile.java#L569-L575
codelibs/fess
src/main/java/org/codelibs/fess/mylasta/action/FessMessages.java
FessMessages.addErrorsInvalidQueryUnsupportedSortField
public FessMessages addErrorsInvalidQueryUnsupportedSortField(String property, String arg0) { assertPropertyNotNull(property); add(property, new UserMessage(ERRORS_invalid_query_unsupported_sort_field, arg0)); return this; }
java
public FessMessages addErrorsInvalidQueryUnsupportedSortField(String property, String arg0) { assertPropertyNotNull(property); add(property, new UserMessage(ERRORS_invalid_query_unsupported_sort_field, arg0)); return this; }
[ "public", "FessMessages", "addErrorsInvalidQueryUnsupportedSortField", "(", "String", "property", ",", "String", "arg0", ")", "{", "assertPropertyNotNull", "(", "property", ")", ";", "add", "(", "property", ",", "new", "UserMessage", "(", "ERRORS_invalid_query_unsupport...
Add the created action message for the key 'errors.invalid_query_unsupported_sort_field' with parameters. <pre> message: The given sort ({0}) is not supported. </pre> @param property The property name for the message. (NotNull) @param arg0 The parameter arg0 for message. (NotNull) @return this. (NotNull)
[ "Add", "the", "created", "action", "message", "for", "the", "key", "errors", ".", "invalid_query_unsupported_sort_field", "with", "parameters", ".", "<pre", ">", "message", ":", "The", "given", "sort", "(", "{", "0", "}", ")", "is", "not", "supported", ".", ...
train
https://github.com/codelibs/fess/blob/e5e4b722549d32a4958dfd94965b21937bfe64cf/src/main/java/org/codelibs/fess/mylasta/action/FessMessages.java#L2065-L2069
netscaler/sdx_nitro
src/main/java/com/citrix/sdx/nitro/resource/config/mps/mps_network_config.java
mps_network_config.update
public static mps_network_config update(nitro_service client, mps_network_config resource) throws Exception { resource.validate("modify"); return ((mps_network_config[]) resource.update_resource(client))[0]; }
java
public static mps_network_config update(nitro_service client, mps_network_config resource) throws Exception { resource.validate("modify"); return ((mps_network_config[]) resource.update_resource(client))[0]; }
[ "public", "static", "mps_network_config", "update", "(", "nitro_service", "client", ",", "mps_network_config", "resource", ")", "throws", "Exception", "{", "resource", ".", "validate", "(", "\"modify\"", ")", ";", "return", "(", "(", "mps_network_config", "[", "]"...
<pre> Use this operation to modify MPS network configuration. </pre>
[ "<pre", ">", "Use", "this", "operation", "to", "modify", "MPS", "network", "configuration", ".", "<", "/", "pre", ">" ]
train
https://github.com/netscaler/sdx_nitro/blob/c840919f1a8f7c0a5634c0f23d34fa14d1765ff1/src/main/java/com/citrix/sdx/nitro/resource/config/mps/mps_network_config.java#L137-L141
katjahahn/PortEx
src/main/java/com/github/katjahahn/parser/sections/SectionLoader.java
SectionLoader.loadSectionFrom
public PESection loadSectionFrom(SectionHeader header) { long size = getReadSize(header); long offset = header.getAlignedPointerToRaw(); return new PESection(size, offset, header, file); }
java
public PESection loadSectionFrom(SectionHeader header) { long size = getReadSize(header); long offset = header.getAlignedPointerToRaw(); return new PESection(size, offset, header, file); }
[ "public", "PESection", "loadSectionFrom", "(", "SectionHeader", "header", ")", "{", "long", "size", "=", "getReadSize", "(", "header", ")", ";", "long", "offset", "=", "header", ".", "getAlignedPointerToRaw", "(", ")", ";", "return", "new", "PESection", "(", ...
Loads the section that belongs to the header. <p> This does not instantiate special sections. Use methods like {@link #loadImportSection()} or {@link #loadResourceSection()} instead. @param header the section's header @return {@link PESection} that belongs to the header
[ "Loads", "the", "section", "that", "belongs", "to", "the", "header", ".", "<p", ">", "This", "does", "not", "instantiate", "special", "sections", ".", "Use", "methods", "like", "{", "@link", "#loadImportSection", "()", "}", "or", "{", "@link", "#loadResource...
train
https://github.com/katjahahn/PortEx/blob/319f08560aa58e3d5d7abe346ffdf623d6dc6990/src/main/java/com/github/katjahahn/parser/sections/SectionLoader.java#L158-L162
querydsl/querydsl
querydsl-core/src/main/java/com/querydsl/core/types/dsl/Expressions.java
Expressions.dateTemplate
@Deprecated public static <T extends Comparable<?>> DateTemplate<T> dateTemplate(Class<? extends T> cl, String template, ImmutableList<?> args) { return dateTemplate(cl, createTemplate(template), args); }
java
@Deprecated public static <T extends Comparable<?>> DateTemplate<T> dateTemplate(Class<? extends T> cl, String template, ImmutableList<?> args) { return dateTemplate(cl, createTemplate(template), args); }
[ "@", "Deprecated", "public", "static", "<", "T", "extends", "Comparable", "<", "?", ">", ">", "DateTemplate", "<", "T", ">", "dateTemplate", "(", "Class", "<", "?", "extends", "T", ">", "cl", ",", "String", "template", ",", "ImmutableList", "<", "?", "...
Create a new Template expression @deprecated Use {@link #dateTemplate(Class, String, List)} instead. @param cl type of expression @param template template @param args template parameters @return template expression
[ "Create", "a", "new", "Template", "expression" ]
train
https://github.com/querydsl/querydsl/blob/2bf234caf78549813a1e0f44d9c30ecc5ef734e3/querydsl-core/src/main/java/com/querydsl/core/types/dsl/Expressions.java#L495-L499
aspectran/aspectran
core/src/main/java/com/aspectran/core/util/MethodUtils.java
MethodUtils.invokeMethod
public static Object invokeMethod(Object object, String methodName, Object arg) throws NoSuchMethodException, IllegalAccessException, InvocationTargetException { Object[] args = { arg }; return invokeMethod(object, methodName, args); }
java
public static Object invokeMethod(Object object, String methodName, Object arg) throws NoSuchMethodException, IllegalAccessException, InvocationTargetException { Object[] args = { arg }; return invokeMethod(object, methodName, args); }
[ "public", "static", "Object", "invokeMethod", "(", "Object", "object", ",", "String", "methodName", ",", "Object", "arg", ")", "throws", "NoSuchMethodException", ",", "IllegalAccessException", ",", "InvocationTargetException", "{", "Object", "[", "]", "args", "=", ...
<p>Invoke a named method whose parameter type matches the object type.</p> <p>The behaviour of this method is less deterministic than {@code invokeExactMethod()}. It loops through all methods with names that match and then executes the first it finds with compatible parameters.</p> <p>This method supports calls to methods taking primitive parameters via passing in wrapping classes. So, for example, a {@code Boolean} class would match a {@code boolean} primitive.</p> <p> This is a convenient wrapper for {@link #invokeMethod(Object object,String methodName,Object[] args)}. </p> @param object invoke method on this object @param methodName get method with this name @param arg use this argument @return the value returned by the invoked method @throws NoSuchMethodException if there is no such accessible method @throws InvocationTargetException wraps an exception thrown by the method invoked @throws IllegalAccessException if the requested method is not accessible via reflection
[ "<p", ">", "Invoke", "a", "named", "method", "whose", "parameter", "type", "matches", "the", "object", "type", ".", "<", "/", "p", ">" ]
train
https://github.com/aspectran/aspectran/blob/2d758a2a28b71ee85b42823c12dc44674d7f2c70/core/src/main/java/com/aspectran/core/util/MethodUtils.java#L181-L185
fabric8io/fabric8-forge
addons/utils/src/main/java/io/fabric8/forge/addon/utils/MavenHelpers.java
MavenHelpers.findPlugin
public static Plugin findPlugin(List<Plugin> plugins, String artifactId) { if (plugins != null) { for (Plugin plugin : plugins) { String groupId = plugin.getGroupId(); if (Strings.isNullOrBlank(groupId) || Objects.equal(groupId, mavenPluginsGroupId)) { if (Objects.equal(artifactId, plugin.getArtifactId())) { return plugin; } } } } return null; }
java
public static Plugin findPlugin(List<Plugin> plugins, String artifactId) { if (plugins != null) { for (Plugin plugin : plugins) { String groupId = plugin.getGroupId(); if (Strings.isNullOrBlank(groupId) || Objects.equal(groupId, mavenPluginsGroupId)) { if (Objects.equal(artifactId, plugin.getArtifactId())) { return plugin; } } } } return null; }
[ "public", "static", "Plugin", "findPlugin", "(", "List", "<", "Plugin", ">", "plugins", ",", "String", "artifactId", ")", "{", "if", "(", "plugins", "!=", "null", ")", "{", "for", "(", "Plugin", "plugin", ":", "plugins", ")", "{", "String", "groupId", ...
Returns the maven plugin for the given artifact id or returns null if it cannot be found
[ "Returns", "the", "maven", "plugin", "for", "the", "given", "artifact", "id", "or", "returns", "null", "if", "it", "cannot", "be", "found" ]
train
https://github.com/fabric8io/fabric8-forge/blob/a59871bae4d5c5d3ece10f1e8758e73663087f19/addons/utils/src/main/java/io/fabric8/forge/addon/utils/MavenHelpers.java#L64-L76
OpenHFT/Chronicle-Map
src/main/java/net/openhft/chronicle/hash/impl/BigSegmentHeader.java
BigSegmentHeader.tryReadLockMillis
private static boolean tryReadLockMillis(long address, long timeInMillis, boolean interruptible) throws InterruptedException { long lastTime = System.currentTimeMillis(); do { if (LOCK.tryReadLock(A, null, address + LOCK_OFFSET)) return true; checkInterrupted(interruptible); ThreadHints.onSpinWait(); long now = System.currentTimeMillis(); if (now != lastTime) { lastTime = now; timeInMillis--; } } while (timeInMillis >= 0); return false; }
java
private static boolean tryReadLockMillis(long address, long timeInMillis, boolean interruptible) throws InterruptedException { long lastTime = System.currentTimeMillis(); do { if (LOCK.tryReadLock(A, null, address + LOCK_OFFSET)) return true; checkInterrupted(interruptible); ThreadHints.onSpinWait(); long now = System.currentTimeMillis(); if (now != lastTime) { lastTime = now; timeInMillis--; } } while (timeInMillis >= 0); return false; }
[ "private", "static", "boolean", "tryReadLockMillis", "(", "long", "address", ",", "long", "timeInMillis", ",", "boolean", "interruptible", ")", "throws", "InterruptedException", "{", "long", "lastTime", "=", "System", ".", "currentTimeMillis", "(", ")", ";", "do",...
Use a timer which is more insensitive to jumps in time like GCs and context switches.
[ "Use", "a", "timer", "which", "is", "more", "insensitive", "to", "jumps", "in", "time", "like", "GCs", "and", "context", "switches", "." ]
train
https://github.com/OpenHFT/Chronicle-Map/blob/0b09733cc96302f96be4394a261699eeb021fe37/src/main/java/net/openhft/chronicle/hash/impl/BigSegmentHeader.java#L133-L148
mgormley/pacaya
src/main/java/edu/jhu/pacaya/hypergraph/Hyperalgo.java
Hyperalgo.weightAdjoint
private static void weightAdjoint(final Hypergraph graph, final Hyperpotential w, final Algebra s, final Scores scores, boolean backOutside) { final double[] weightAdj = new double[graph.getNumEdges()]; HyperedgeDoubleFn lambda = new HyperedgeDoubleFn() { public void apply(Hyperedge e, double val) { weightAdj[e.getId()] = val; } }; weightAdjoint(graph, w, s, scores, lambda, backOutside); scores.weightAdj = weightAdj; }
java
private static void weightAdjoint(final Hypergraph graph, final Hyperpotential w, final Algebra s, final Scores scores, boolean backOutside) { final double[] weightAdj = new double[graph.getNumEdges()]; HyperedgeDoubleFn lambda = new HyperedgeDoubleFn() { public void apply(Hyperedge e, double val) { weightAdj[e.getId()] = val; } }; weightAdjoint(graph, w, s, scores, lambda, backOutside); scores.weightAdj = weightAdj; }
[ "private", "static", "void", "weightAdjoint", "(", "final", "Hypergraph", "graph", ",", "final", "Hyperpotential", "w", ",", "final", "Algebra", "s", ",", "final", "Scores", "scores", ",", "boolean", "backOutside", ")", "{", "final", "double", "[", "]", "wei...
Computes the adjoints of the hyperedge weights. INPUT: scores.alpha, scores.beta, scores.alphaAdj, scores.betaAdj. OUTPUT: scores.weightsAdj. @param graph The hypergraph @param w The potential function. @param s The semiring. @param scores Input and output struct.
[ "Computes", "the", "adjoints", "of", "the", "hyperedge", "weights", "." ]
train
https://github.com/mgormley/pacaya/blob/786294cbac7cc65dbc32210c10acc32ed0c69233/src/main/java/edu/jhu/pacaya/hypergraph/Hyperalgo.java#L494-L504
googleapis/google-cloud-java
google-cloud-clients/google-cloud-contrib/google-cloud-nio/src/main/java/com/google/cloud/storage/contrib/nio/UnixPath.java
UnixPath.getFileName
@Nullable public UnixPath getFileName() { if (path.isEmpty()) { return EMPTY_PATH; } else if (isRoot()) { return null; } else { List<String> parts = getParts(); String last = parts.get(parts.size() - 1); return parts.size() == 1 && path.equals(last) ? this : new UnixPath(permitEmptyComponents, last); } }
java
@Nullable public UnixPath getFileName() { if (path.isEmpty()) { return EMPTY_PATH; } else if (isRoot()) { return null; } else { List<String> parts = getParts(); String last = parts.get(parts.size() - 1); return parts.size() == 1 && path.equals(last) ? this : new UnixPath(permitEmptyComponents, last); } }
[ "@", "Nullable", "public", "UnixPath", "getFileName", "(", ")", "{", "if", "(", "path", ".", "isEmpty", "(", ")", ")", "{", "return", "EMPTY_PATH", ";", "}", "else", "if", "(", "isRoot", "(", ")", ")", "{", "return", "null", ";", "}", "else", "{", ...
Returns last component in {@code path}. @see java.nio.file.Path#getFileName()
[ "Returns", "last", "component", "in", "{", "@code", "path", "}", "." ]
train
https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-contrib/google-cloud-nio/src/main/java/com/google/cloud/storage/contrib/nio/UnixPath.java#L157-L170
deeplearning4j/deeplearning4j
deeplearning4j/deeplearning4j-nn/src/main/java/org/deeplearning4j/nn/layers/training/CenterLossOutputLayer.java
CenterLossOutputLayer.computeScoreForExamples
@Override public INDArray computeScoreForExamples(double fullNetRegTerm, LayerWorkspaceMgr workspaceMgr) { if (input == null || labels == null) throw new IllegalStateException("Cannot calculate score without input and labels " + layerId()); INDArray preOut = preOutput2d(false, workspaceMgr); // calculate the intra-class score component INDArray centers = params.get(CenterLossParamInitializer.CENTER_KEY); INDArray centersForExamples = labels.mmul(centers); INDArray intraClassScoreArray = input.sub(centersForExamples); // calculate the inter-class score component ILossFunction interClassLoss = layerConf().getLossFn(); INDArray scoreArray = interClassLoss.computeScoreArray(getLabels2d(workspaceMgr, ArrayType.FF_WORKING_MEM), preOut, layerConf().getActivationFn(), maskArray); scoreArray.addi(intraClassScoreArray.muli(layerConf().getLambda() / 2)); if (fullNetRegTerm != 0.0) { scoreArray.addi(fullNetRegTerm); } return workspaceMgr.leverageTo(ArrayType.ACTIVATIONS, scoreArray); }
java
@Override public INDArray computeScoreForExamples(double fullNetRegTerm, LayerWorkspaceMgr workspaceMgr) { if (input == null || labels == null) throw new IllegalStateException("Cannot calculate score without input and labels " + layerId()); INDArray preOut = preOutput2d(false, workspaceMgr); // calculate the intra-class score component INDArray centers = params.get(CenterLossParamInitializer.CENTER_KEY); INDArray centersForExamples = labels.mmul(centers); INDArray intraClassScoreArray = input.sub(centersForExamples); // calculate the inter-class score component ILossFunction interClassLoss = layerConf().getLossFn(); INDArray scoreArray = interClassLoss.computeScoreArray(getLabels2d(workspaceMgr, ArrayType.FF_WORKING_MEM), preOut, layerConf().getActivationFn(), maskArray); scoreArray.addi(intraClassScoreArray.muli(layerConf().getLambda() / 2)); if (fullNetRegTerm != 0.0) { scoreArray.addi(fullNetRegTerm); } return workspaceMgr.leverageTo(ArrayType.ACTIVATIONS, scoreArray); }
[ "@", "Override", "public", "INDArray", "computeScoreForExamples", "(", "double", "fullNetRegTerm", ",", "LayerWorkspaceMgr", "workspaceMgr", ")", "{", "if", "(", "input", "==", "null", "||", "labels", "==", "null", ")", "throw", "new", "IllegalStateException", "("...
Compute the score for each example individually, after labels and input have been set. @param fullNetRegTerm Regularization term for the entire network (or, 0.0 to not include regularization) @return A column INDArray of shape [numExamples,1], where entry i is the score of the ith example
[ "Compute", "the", "score", "for", "each", "example", "individually", "after", "labels", "and", "input", "have", "been", "set", "." ]
train
https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-nn/src/main/java/org/deeplearning4j/nn/layers/training/CenterLossOutputLayer.java#L103-L124
jbundle/jbundle
base/base/src/main/java/org/jbundle/base/field/convert/RadioConverter.java
RadioConverter.init
public void init(Converter converter, Object objTarget, boolean bTrueIfMatch) { super.init(converter, null, null); m_objTarget = objTarget; m_bTrueIfMatch = bTrueIfMatch; }
java
public void init(Converter converter, Object objTarget, boolean bTrueIfMatch) { super.init(converter, null, null); m_objTarget = objTarget; m_bTrueIfMatch = bTrueIfMatch; }
[ "public", "void", "init", "(", "Converter", "converter", ",", "Object", "objTarget", ",", "boolean", "bTrueIfMatch", ")", "{", "super", ".", "init", "(", "converter", ",", "null", ",", "null", ")", ";", "m_objTarget", "=", "objTarget", ";", "m_bTrueIfMatch",...
Constructor. @param converter The next converter in the converter chain. @param strTarget If the radio button is set, set this converter to this target string. @param bTrueIfMatch If true, sets value on setState(true), otherwise sets it to blank.
[ "Constructor", "." ]
train
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/field/convert/RadioConverter.java#L60-L65
zaproxy/zaproxy
src/org/parosproxy/paros/view/WorkbenchPanel.java
WorkbenchPanel.getTabbedSelect
public TabbedPanel2 getTabbedSelect() { if (tabbedSelect == null) { tabbedSelect = new TabbedPanel2(); tabbedSelect.setPreferredSize(new Dimension(200, 400)); tabbedSelect.setName("tabbedSelect"); tabbedSelect.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0)); } return tabbedSelect; }
java
public TabbedPanel2 getTabbedSelect() { if (tabbedSelect == null) { tabbedSelect = new TabbedPanel2(); tabbedSelect.setPreferredSize(new Dimension(200, 400)); tabbedSelect.setName("tabbedSelect"); tabbedSelect.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0)); } return tabbedSelect; }
[ "public", "TabbedPanel2", "getTabbedSelect", "(", ")", "{", "if", "(", "tabbedSelect", "==", "null", ")", "{", "tabbedSelect", "=", "new", "TabbedPanel2", "(", ")", ";", "tabbedSelect", ".", "setPreferredSize", "(", "new", "Dimension", "(", "200", ",", "400"...
Gets the tabbed panel that has the {@link PanelType#SELECT SELECT} panels. <p> Direct access/manipulation of the tabbed panel is discouraged, the changes done to it might be lost while changing layouts. @return the tabbed panel of the {@code work} panels, never {@code null} @see #addPanel(AbstractPanel, PanelType)
[ "Gets", "the", "tabbed", "panel", "that", "has", "the", "{", "@link", "PanelType#SELECT", "SELECT", "}", "panels", ".", "<p", ">", "Direct", "access", "/", "manipulation", "of", "the", "tabbed", "panel", "is", "discouraged", "the", "changes", "done", "to", ...
train
https://github.com/zaproxy/zaproxy/blob/0cbe5121f2ae1ecca222513d182759210c569bec/src/org/parosproxy/paros/view/WorkbenchPanel.java#L814-L823
jbundle/jbundle
thin/base/thread/src/main/java/org/jbundle/thin/base/thread/PrivateTaskScheduler.java
PrivateTaskScheduler.sameJob
public boolean sameJob(AutoTask jobAtIndex, AutoTask jobToAdd) { Map<String, Object> propJobAtIndex = jobAtIndex.getProperties(); Map<String, Object> propJobToAdd = jobToAdd.getProperties(); if (propJobAtIndex.size() != propJobToAdd.size()) return false; boolean bSameJob = false; // They are equal if every property (except time) match for (String strNewKey : propJobToAdd.keySet()) { if (!strNewKey.equalsIgnoreCase(TIME_TO_RUN)) { if (propJobAtIndex.get(strNewKey).equals(propJobToAdd.get(strNewKey))) bSameJob = true; // Okay, this is a potential match else return false; // This property doesn't match, stop compare } } return bSameJob; }
java
public boolean sameJob(AutoTask jobAtIndex, AutoTask jobToAdd) { Map<String, Object> propJobAtIndex = jobAtIndex.getProperties(); Map<String, Object> propJobToAdd = jobToAdd.getProperties(); if (propJobAtIndex.size() != propJobToAdd.size()) return false; boolean bSameJob = false; // They are equal if every property (except time) match for (String strNewKey : propJobToAdd.keySet()) { if (!strNewKey.equalsIgnoreCase(TIME_TO_RUN)) { if (propJobAtIndex.get(strNewKey).equals(propJobToAdd.get(strNewKey))) bSameJob = true; // Okay, this is a potential match else return false; // This property doesn't match, stop compare } } return bSameJob; }
[ "public", "boolean", "sameJob", "(", "AutoTask", "jobAtIndex", ",", "AutoTask", "jobToAdd", ")", "{", "Map", "<", "String", ",", "Object", ">", "propJobAtIndex", "=", "jobAtIndex", ".", "getProperties", "(", ")", ";", "Map", "<", "String", ",", "Object", "...
Do these two jobs match? @param propJobAtIndex @param propJobToAdd @return
[ "Do", "these", "two", "jobs", "match?" ]
train
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/thin/base/thread/src/main/java/org/jbundle/thin/base/thread/PrivateTaskScheduler.java#L235-L255
EdwardRaff/JSAT
JSAT/src/jsat/classifiers/trees/DecisionStump.java
DecisionStump.trainC
public List<ClassificationDataSet> trainC(ClassificationDataSet dataPoints, Set<Integer> options) { return trainC(dataPoints, options, false); }
java
public List<ClassificationDataSet> trainC(ClassificationDataSet dataPoints, Set<Integer> options) { return trainC(dataPoints, options, false); }
[ "public", "List", "<", "ClassificationDataSet", ">", "trainC", "(", "ClassificationDataSet", "dataPoints", ",", "Set", "<", "Integer", ">", "options", ")", "{", "return", "trainC", "(", "dataPoints", ",", "options", ",", "false", ")", ";", "}" ]
This is a helper function that does the work of training this stump. It may be called directly by other classes that are creating decision trees to avoid redundant repackaging of lists. @param dataPoints the lists of datapoint to train on, paired with the true category of each training point @param options the set of attributes that this classifier may choose from. The attribute it does choose will be removed from the set. @return the a list of lists, containing all the datapoints that would have followed each path. Useful for training a decision tree
[ "This", "is", "a", "helper", "function", "that", "does", "the", "work", "of", "training", "this", "stump", ".", "It", "may", "be", "called", "directly", "by", "other", "classes", "that", "are", "creating", "decision", "trees", "to", "avoid", "redundant", "...
train
https://github.com/EdwardRaff/JSAT/blob/0ff53b7b39684b2379cc1da522f5b3a954b15cfb/JSAT/src/jsat/classifiers/trees/DecisionStump.java#L373-L376
aws/aws-sdk-java
aws-java-sdk-core/src/main/java/com/amazonaws/auth/QueryStringSigner.java
QueryStringSigner.calculateStringToSignV1
private String calculateStringToSignV1(Map<String, List<String>> parameters) { StringBuilder data = new StringBuilder(); SortedMap<String, List<String>> sorted = new TreeMap<String, List<String>>(String.CASE_INSENSITIVE_ORDER); sorted.putAll(parameters); for (Map.Entry<String, List<String>> entry : sorted.entrySet()) { for (String value : entry.getValue()) { data.append(entry.getKey()) .append(value); } } return data.toString(); }
java
private String calculateStringToSignV1(Map<String, List<String>> parameters) { StringBuilder data = new StringBuilder(); SortedMap<String, List<String>> sorted = new TreeMap<String, List<String>>(String.CASE_INSENSITIVE_ORDER); sorted.putAll(parameters); for (Map.Entry<String, List<String>> entry : sorted.entrySet()) { for (String value : entry.getValue()) { data.append(entry.getKey()) .append(value); } } return data.toString(); }
[ "private", "String", "calculateStringToSignV1", "(", "Map", "<", "String", ",", "List", "<", "String", ">", ">", "parameters", ")", "{", "StringBuilder", "data", "=", "new", "StringBuilder", "(", ")", ";", "SortedMap", "<", "String", ",", "List", "<", "Str...
Calculates string to sign for signature version 1. @param parameters request parameters @return String to sign
[ "Calculates", "string", "to", "sign", "for", "signature", "version", "1", "." ]
train
https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-core/src/main/java/com/amazonaws/auth/QueryStringSigner.java#L109-L123
ahome-it/lienzo-core
src/main/java/com/ait/lienzo/client/core/shape/wires/handlers/impl/WiresDockingControlImpl.java
WiresDockingControlImpl.getCloserMagnet
private WiresMagnet getCloserMagnet(final WiresShape shape, final WiresContainer parent, final boolean allowOverlap) { final WiresShape parentShape = (WiresShape) parent; final MagnetManager.Magnets magnets = parentShape.getMagnets(); final Point2D shapeLocation = shape.getComputedLocation(); final Point2D shapeCenter = Geometry.findCenter(shape.getPath().getBoundingBox()); final double shapeX = shapeCenter.getX() + shapeLocation.getX(); final double shapeY = shapeCenter.getX() + shapeLocation.getY(); int magnetIndex = -1; Double minDistance = null; //not considering the zero magnet, that is the center. for (int i = 1; i < magnets.size(); i++) { final WiresMagnet magnet = magnets.getMagnet(i); //skip magnet that has shape over it if (allowOverlap || !hasShapeOnMagnet(magnet, parentShape)) { final double magnetX = magnet.getControl().getLocation().getX(); final double magnetY = magnet.getControl().getLocation().getY(); final double distance = Geometry.distance(magnetX, magnetY, shapeX, shapeY); //getting shorter distance if ((minDistance == null) || (distance < minDistance)) { minDistance = distance; magnetIndex = i; } } } return (magnetIndex > 0 ? magnets.getMagnet(magnetIndex) : null); }
java
private WiresMagnet getCloserMagnet(final WiresShape shape, final WiresContainer parent, final boolean allowOverlap) { final WiresShape parentShape = (WiresShape) parent; final MagnetManager.Magnets magnets = parentShape.getMagnets(); final Point2D shapeLocation = shape.getComputedLocation(); final Point2D shapeCenter = Geometry.findCenter(shape.getPath().getBoundingBox()); final double shapeX = shapeCenter.getX() + shapeLocation.getX(); final double shapeY = shapeCenter.getX() + shapeLocation.getY(); int magnetIndex = -1; Double minDistance = null; //not considering the zero magnet, that is the center. for (int i = 1; i < magnets.size(); i++) { final WiresMagnet magnet = magnets.getMagnet(i); //skip magnet that has shape over it if (allowOverlap || !hasShapeOnMagnet(magnet, parentShape)) { final double magnetX = magnet.getControl().getLocation().getX(); final double magnetY = magnet.getControl().getLocation().getY(); final double distance = Geometry.distance(magnetX, magnetY, shapeX, shapeY); //getting shorter distance if ((minDistance == null) || (distance < minDistance)) { minDistance = distance; magnetIndex = i; } } } return (magnetIndex > 0 ? magnets.getMagnet(magnetIndex) : null); }
[ "private", "WiresMagnet", "getCloserMagnet", "(", "final", "WiresShape", "shape", ",", "final", "WiresContainer", "parent", ",", "final", "boolean", "allowOverlap", ")", "{", "final", "WiresShape", "parentShape", "=", "(", "WiresShape", ")", "parent", ";", "final"...
Reurn the closer magnet @param shape @param parent @param allowOverlap should allow overlapping docked shape or not @return closer magnet or null if none are available
[ "Reurn", "the", "closer", "magnet" ]
train
https://github.com/ahome-it/lienzo-core/blob/8e03723700dec366f77064d12fb8676d8cd6be99/src/main/java/com/ait/lienzo/client/core/shape/wires/handlers/impl/WiresDockingControlImpl.java#L215-L245
apereo/cas
support/cas-server-support-ldap-core/src/main/java/org/apereo/cas/authentication/support/DefaultLdapAccountStateHandler.java
DefaultLdapAccountStateHandler.handleWarning
protected void handleWarning(final AccountState.Warning warning, final AuthenticationResponse response, final PasswordPolicyConfiguration configuration, final List<MessageDescriptor> messages) { LOGGER.debug("Handling account state warning [{}]", warning); if (warning == null) { LOGGER.debug("Account state warning not defined"); return; } if (warning.getExpiration() != null) { val expDate = DateTimeUtils.zonedDateTimeOf(warning.getExpiration()); val ttl = ZonedDateTime.now(ZoneOffset.UTC).until(expDate, ChronoUnit.DAYS); LOGGER.debug( "Password expires in [{}] days. Expiration warning threshold is [{}] days.", ttl, configuration.getPasswordWarningNumberOfDays()); if (configuration.isAlwaysDisplayPasswordExpirationWarning() || ttl < configuration.getPasswordWarningNumberOfDays()) { messages.add(new PasswordExpiringWarningMessageDescriptor("Password expires in {0} days.", ttl)); } } else { LOGGER.debug("No account expiration warning was provided as part of the account state"); } if (warning.getLoginsRemaining() > 0) { messages.add(new DefaultMessageDescriptor( "password.expiration.loginsRemaining", "You have {0} logins remaining before you MUST change your password.", new Serializable[]{warning.getLoginsRemaining()})); } }
java
protected void handleWarning(final AccountState.Warning warning, final AuthenticationResponse response, final PasswordPolicyConfiguration configuration, final List<MessageDescriptor> messages) { LOGGER.debug("Handling account state warning [{}]", warning); if (warning == null) { LOGGER.debug("Account state warning not defined"); return; } if (warning.getExpiration() != null) { val expDate = DateTimeUtils.zonedDateTimeOf(warning.getExpiration()); val ttl = ZonedDateTime.now(ZoneOffset.UTC).until(expDate, ChronoUnit.DAYS); LOGGER.debug( "Password expires in [{}] days. Expiration warning threshold is [{}] days.", ttl, configuration.getPasswordWarningNumberOfDays()); if (configuration.isAlwaysDisplayPasswordExpirationWarning() || ttl < configuration.getPasswordWarningNumberOfDays()) { messages.add(new PasswordExpiringWarningMessageDescriptor("Password expires in {0} days.", ttl)); } } else { LOGGER.debug("No account expiration warning was provided as part of the account state"); } if (warning.getLoginsRemaining() > 0) { messages.add(new DefaultMessageDescriptor( "password.expiration.loginsRemaining", "You have {0} logins remaining before you MUST change your password.", new Serializable[]{warning.getLoginsRemaining()})); } }
[ "protected", "void", "handleWarning", "(", "final", "AccountState", ".", "Warning", "warning", ",", "final", "AuthenticationResponse", "response", ",", "final", "PasswordPolicyConfiguration", "configuration", ",", "final", "List", "<", "MessageDescriptor", ">", "message...
Handle an account state warning produced by ldaptive account state machinery. <p> Override this method to provide custom warning message handling. @param warning the account state warning messages. @param response Ldaptive authentication response. @param configuration Password policy configuration. @param messages Container for messages produced by account state warning handling.
[ "Handle", "an", "account", "state", "warning", "produced", "by", "ldaptive", "account", "state", "machinery", ".", "<p", ">", "Override", "this", "method", "to", "provide", "custom", "warning", "message", "handling", "." ]
train
https://github.com/apereo/cas/blob/b4b306433a8782cef803a39bea5b1f96740e0e9b/support/cas-server-support-ldap-core/src/main/java/org/apereo/cas/authentication/support/DefaultLdapAccountStateHandler.java#L144-L175
deeplearning4j/deeplearning4j
nd4j/nd4j-common/src/main/java/org/nd4j/linalg/util/Rational.java
Rational.Pochhammer
public Rational Pochhammer(final BigInteger n) { if (n.compareTo(BigInteger.ZERO) < 0) { return null; } else if (n.compareTo(BigInteger.ZERO) == 0) { return Rational.ONE; } else { /* initialize results with the current value */ Rational res = new Rational(a, b); BigInteger i = BigInteger.ONE; for (; i.compareTo(n) < 0; i = i.add(BigInteger.ONE)) { res = res.multiply(add(i)); } return res; } }
java
public Rational Pochhammer(final BigInteger n) { if (n.compareTo(BigInteger.ZERO) < 0) { return null; } else if (n.compareTo(BigInteger.ZERO) == 0) { return Rational.ONE; } else { /* initialize results with the current value */ Rational res = new Rational(a, b); BigInteger i = BigInteger.ONE; for (; i.compareTo(n) < 0; i = i.add(BigInteger.ONE)) { res = res.multiply(add(i)); } return res; } }
[ "public", "Rational", "Pochhammer", "(", "final", "BigInteger", "n", ")", "{", "if", "(", "n", ".", "compareTo", "(", "BigInteger", ".", "ZERO", ")", "<", "0", ")", "{", "return", "null", ";", "}", "else", "if", "(", "n", ".", "compareTo", "(", "Bi...
Compute Pochhammer's symbol (this)_n. @param n The number of product terms in the evaluation. @return Gamma(this+n)/Gamma(this) = this*(this+1)*...*(this+n-1).
[ "Compute", "Pochhammer", "s", "symbol", "(", "this", ")", "_n", "." ]
train
https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-common/src/main/java/org/nd4j/linalg/util/Rational.java#L557-L572
Azure/azure-sdk-for-java
hdinsight/resource-manager/v2018_06_01_preview/src/main/java/com/microsoft/azure/management/hdinsight/v2018_06_01_preview/implementation/ClustersInner.java
ClustersInner.getByResourceGroupAsync
public Observable<ClusterInner> getByResourceGroupAsync(String resourceGroupName, String clusterName) { return getByResourceGroupWithServiceResponseAsync(resourceGroupName, clusterName).map(new Func1<ServiceResponse<ClusterInner>, ClusterInner>() { @Override public ClusterInner call(ServiceResponse<ClusterInner> response) { return response.body(); } }); }
java
public Observable<ClusterInner> getByResourceGroupAsync(String resourceGroupName, String clusterName) { return getByResourceGroupWithServiceResponseAsync(resourceGroupName, clusterName).map(new Func1<ServiceResponse<ClusterInner>, ClusterInner>() { @Override public ClusterInner call(ServiceResponse<ClusterInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "ClusterInner", ">", "getByResourceGroupAsync", "(", "String", "resourceGroupName", ",", "String", "clusterName", ")", "{", "return", "getByResourceGroupWithServiceResponseAsync", "(", "resourceGroupName", ",", "clusterName", ")", ".", "map", ...
Gets the specified cluster. @param resourceGroupName The name of the resource group. @param clusterName The name of the cluster. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the ClusterInner object
[ "Gets", "the", "specified", "cluster", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/hdinsight/resource-manager/v2018_06_01_preview/src/main/java/com/microsoft/azure/management/hdinsight/v2018_06_01_preview/implementation/ClustersInner.java#L689-L696
osiam/connector4java
src/main/java/org/osiam/client/OsiamConnector.java
OsiamConnector.getUser
public User getUser(String id, AccessToken accessToken, String... attributes) { return getUserService().getUser(id, accessToken, attributes); }
java
public User getUser(String id, AccessToken accessToken, String... attributes) { return getUserService().getUser(id, accessToken, attributes); }
[ "public", "User", "getUser", "(", "String", "id", ",", "AccessToken", "accessToken", ",", "String", "...", "attributes", ")", "{", "return", "getUserService", "(", ")", ".", "getUser", "(", "id", ",", "accessToken", ",", "attributes", ")", ";", "}" ]
Retrieve a single User with the given id. If no user for the given id can be found a {@link NoResultException} is thrown. @param id the id of the wanted user @param accessToken the OSIAM access token from for the current session @param attributes the attributes that should be returned in the response. If none are given, all are returned @return the user with the given id @throws UnauthorizedException if the request could not be authorized. @throws NoResultException if no user with the given id can be found @throws ForbiddenException if the scope doesn't allow this request @throws ConnectionInitializationException if the connection to the given OSIAM service could not be initialized @throws IllegalStateException if OSIAM's endpoint(s) are not properly configured
[ "Retrieve", "a", "single", "User", "with", "the", "given", "id", ".", "If", "no", "user", "for", "the", "given", "id", "can", "be", "found", "a", "{", "@link", "NoResultException", "}", "is", "thrown", "." ]
train
https://github.com/osiam/connector4java/blob/a5e6ae1e706f4889d662a069fe2f3bf8e3848d12/src/main/java/org/osiam/client/OsiamConnector.java#L225-L227
hsiafan/apk-parser
src/main/java/net/dongliu/apk/parser/cert/asn1/Asn1BerParser.java
Asn1BerParser.parseImplicitSetOf
public static <T> List<T> parseImplicitSetOf(ByteBuffer encoded, Class<T> elementClass) throws Asn1DecodingException { BerDataValue containerDataValue; try { containerDataValue = new ByteBufferBerDataValueReader(encoded).readDataValue(); } catch (BerDataValueFormatException e) { throw new Asn1DecodingException("Failed to decode top-level data value", e); } if (containerDataValue == null) { throw new Asn1DecodingException("Empty input"); } return parseSetOf(containerDataValue, elementClass); }
java
public static <T> List<T> parseImplicitSetOf(ByteBuffer encoded, Class<T> elementClass) throws Asn1DecodingException { BerDataValue containerDataValue; try { containerDataValue = new ByteBufferBerDataValueReader(encoded).readDataValue(); } catch (BerDataValueFormatException e) { throw new Asn1DecodingException("Failed to decode top-level data value", e); } if (containerDataValue == null) { throw new Asn1DecodingException("Empty input"); } return parseSetOf(containerDataValue, elementClass); }
[ "public", "static", "<", "T", ">", "List", "<", "T", ">", "parseImplicitSetOf", "(", "ByteBuffer", "encoded", ",", "Class", "<", "T", ">", "elementClass", ")", "throws", "Asn1DecodingException", "{", "BerDataValue", "containerDataValue", ";", "try", "{", "cont...
Returns the implicit {@code SET OF} contained in the provided ASN.1 BER input. Implicit means that this method does not care whether the tag number of this data structure is {@code SET OF} and whether the tag class is {@code UNIVERSAL}. <p> <p>Note: The returned type is {@link List} rather than {@link java.util.Set} because ASN.1 SET may contain duplicate elements. @param encoded encoded input. If the decoding operation succeeds, the position of this buffer is advanced to the first position following the end of the consumed structure. @param elementClass class describing the structure of the values/elements contained in this container. The class must meet the following requirements: <ul> <li>The class must be annotated with {@link Asn1Class}.</li> <li>The class must expose a public no-arg constructor.</li> <li>Member fields of the class which are populated with parsed input must be annotated with {@link Asn1Field} and be public and non-final.</li> </ul> @throws Asn1DecodingException if the input could not be decoded into the specified Java object
[ "Returns", "the", "implicit", "{", "@code", "SET", "OF", "}", "contained", "in", "the", "provided", "ASN", ".", "1", "BER", "input", ".", "Implicit", "means", "that", "this", "method", "does", "not", "care", "whether", "the", "tag", "number", "of", "this...
train
https://github.com/hsiafan/apk-parser/blob/8993ddd52017b37b8f2e784ae0a15417d9ede932/src/main/java/net/dongliu/apk/parser/cert/asn1/Asn1BerParser.java#L92-L104
paypal/SeLion
dataproviders/src/main/java/com/paypal/selion/platform/dataprovider/impl/ReflectionUtils.java
ReflectionUtils.instantiateWrapperArray
public static Object instantiateWrapperArray(Class<?> type, String[] values) { logger.entering(new Object[] { type, values }); validateParams(type, values); boolean condition = (isWrapperArray(type) || hasOneArgStringConstructor(type.getComponentType())); checkArgument(condition, type.getName() + " is neither awrapper type nor has a 1 arg String constructor defined."); Class<?> componentType = type.getComponentType(); Object arrayToReturn = Array.newInstance(componentType, values.length); for (int i = 0; i < values.length; i++) { try { Array.set(arrayToReturn, i, componentType.getConstructor(String.class).newInstance(values[i])); } catch (ArrayIndexOutOfBoundsException | IllegalArgumentException | InstantiationException | IllegalAccessException | InvocationTargetException | NoSuchMethodException | SecurityException e) { throw new ReflectionException(e); } } logger.exiting(arrayToReturn); return arrayToReturn; }
java
public static Object instantiateWrapperArray(Class<?> type, String[] values) { logger.entering(new Object[] { type, values }); validateParams(type, values); boolean condition = (isWrapperArray(type) || hasOneArgStringConstructor(type.getComponentType())); checkArgument(condition, type.getName() + " is neither awrapper type nor has a 1 arg String constructor defined."); Class<?> componentType = type.getComponentType(); Object arrayToReturn = Array.newInstance(componentType, values.length); for (int i = 0; i < values.length; i++) { try { Array.set(arrayToReturn, i, componentType.getConstructor(String.class).newInstance(values[i])); } catch (ArrayIndexOutOfBoundsException | IllegalArgumentException | InstantiationException | IllegalAccessException | InvocationTargetException | NoSuchMethodException | SecurityException e) { throw new ReflectionException(e); } } logger.exiting(arrayToReturn); return arrayToReturn; }
[ "public", "static", "Object", "instantiateWrapperArray", "(", "Class", "<", "?", ">", "type", ",", "String", "[", "]", "values", ")", "{", "logger", ".", "entering", "(", "new", "Object", "[", "]", "{", "type", ",", "values", "}", ")", ";", "validatePa...
This helper method facilitates creation of wrapper arrays and pre-populates them with the set of String values provided. E.g., of wrapper arrays include Integer[], Character[], Boolean[] and so on. This method can also be used to create arrays of types which has a 1 argument String constructor defined. @param type The type of the desired array. @param values A {@link String} array that represents the set of values that should be used to pre-populate the newly constructed array. @return An array of the type that was specified.
[ "This", "helper", "method", "facilitates", "creation", "of", "wrapper", "arrays", "and", "pre", "-", "populates", "them", "with", "the", "set", "of", "String", "values", "provided", ".", "E", ".", "g", ".", "of", "wrapper", "arrays", "include", "Integer", ...
train
https://github.com/paypal/SeLion/blob/694d12d0df76db48d0360b16192770c6a4fbdfd2/dataproviders/src/main/java/com/paypal/selion/platform/dataprovider/impl/ReflectionUtils.java#L222-L240
apache/spark
sql/hive-thriftserver/src/main/java/org/apache/hive/service/cli/operation/MetadataOperation.java
MetadataOperation.convertIdentifierPattern
protected String convertIdentifierPattern(final String pattern, boolean datanucleusFormat) { if (pattern == null) { return convertPattern("%", true); } else { return convertPattern(pattern, datanucleusFormat); } }
java
protected String convertIdentifierPattern(final String pattern, boolean datanucleusFormat) { if (pattern == null) { return convertPattern("%", true); } else { return convertPattern(pattern, datanucleusFormat); } }
[ "protected", "String", "convertIdentifierPattern", "(", "final", "String", "pattern", ",", "boolean", "datanucleusFormat", ")", "{", "if", "(", "pattern", "==", "null", ")", "{", "return", "convertPattern", "(", "\"%\"", ",", "true", ")", ";", "}", "else", "...
Convert wildchars and escape sequence from JDBC format to datanucleous/regex
[ "Convert", "wildchars", "and", "escape", "sequence", "from", "JDBC", "format", "to", "datanucleous", "/", "regex" ]
train
https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/sql/hive-thriftserver/src/main/java/org/apache/hive/service/cli/operation/MetadataOperation.java#L64-L70
sdl/odata
odata_renderer/src/main/java/com/sdl/odata/unmarshaller/json/core/JsonPropertyExpander.java
JsonPropertyExpander.loadEntity
public Object loadEntity(String entityName) throws ODataUnmarshallingException { Object entity = null; if (entityName != null) { try { StructuredType entityType = JsonParserUtils.getStructuredType(entityName, entityDataModel); if (entityType != null) { entity = entityType.getJavaType().newInstance(); } else { LOG.warn("Given entity '{}' is not found in entity data model", entityName); throw new ODataUnmarshallingException("Couldn't initiate entity because given entity [" + entityName + "] is not found in entity data model."); } } catch (InstantiationException | IllegalAccessException e) { throw new ODataUnmarshallingException("Cannot instantiate entity", e); } } return entity; }
java
public Object loadEntity(String entityName) throws ODataUnmarshallingException { Object entity = null; if (entityName != null) { try { StructuredType entityType = JsonParserUtils.getStructuredType(entityName, entityDataModel); if (entityType != null) { entity = entityType.getJavaType().newInstance(); } else { LOG.warn("Given entity '{}' is not found in entity data model", entityName); throw new ODataUnmarshallingException("Couldn't initiate entity because given entity [" + entityName + "] is not found in entity data model."); } } catch (InstantiationException | IllegalAccessException e) { throw new ODataUnmarshallingException("Cannot instantiate entity", e); } } return entity; }
[ "public", "Object", "loadEntity", "(", "String", "entityName", ")", "throws", "ODataUnmarshallingException", "{", "Object", "entity", "=", "null", ";", "if", "(", "entityName", "!=", "null", ")", "{", "try", "{", "StructuredType", "entityType", "=", "JsonParserU...
Creates the an entity based on its name. @param entityName The name of the entity @return the entity object @throws ODataUnmarshallingException If unable to load entity
[ "Creates", "the", "an", "entity", "based", "on", "its", "name", "." ]
train
https://github.com/sdl/odata/blob/eb747d73e9af0f4e59a25b82ed656e526a7e2189/odata_renderer/src/main/java/com/sdl/odata/unmarshaller/json/core/JsonPropertyExpander.java#L261-L278
xcesco/kripton
kripton-orm/src/main/java/com/abubusoft/kripton/android/sqlite/SQLiteUpdateTaskHelper.java
SQLiteUpdateTaskHelper.renameTablesWithPrefix
public static void renameTablesWithPrefix(SQLiteDatabase db, final String prefix) { Logger.info("MASSIVE TABLE RENAME OPERATION: ADD PREFIX " + prefix); query(db, null, QueryType.TABLE, new OnResultListener() { @Override public void onRow(SQLiteDatabase db, String name, String sql) { sql = String.format("ALTER TABLE %s RENAME TO %s%s;", name, prefix, name); Logger.info(sql); db.execSQL(sql); } }); }
java
public static void renameTablesWithPrefix(SQLiteDatabase db, final String prefix) { Logger.info("MASSIVE TABLE RENAME OPERATION: ADD PREFIX " + prefix); query(db, null, QueryType.TABLE, new OnResultListener() { @Override public void onRow(SQLiteDatabase db, String name, String sql) { sql = String.format("ALTER TABLE %s RENAME TO %s%s;", name, prefix, name); Logger.info(sql); db.execSQL(sql); } }); }
[ "public", "static", "void", "renameTablesWithPrefix", "(", "SQLiteDatabase", "db", ",", "final", "String", "prefix", ")", "{", "Logger", ".", "info", "(", "\"MASSIVE TABLE RENAME OPERATION: ADD PREFIX \"", "+", "prefix", ")", ";", "query", "(", "db", ",", "null", ...
Add to all table a specifix prefix. @param db the db @param prefix the prefix
[ "Add", "to", "all", "table", "a", "specifix", "prefix", "." ]
train
https://github.com/xcesco/kripton/blob/90de2c0523d39b99e81b8d38aa996898762f594a/kripton-orm/src/main/java/com/abubusoft/kripton/android/sqlite/SQLiteUpdateTaskHelper.java#L161-L173
pinterest/secor
src/main/java/com/pinterest/secor/util/ReflectionUtil.java
ReflectionUtil.createFileWriter
public static FileWriter createFileWriter(String className, LogFilePath logFilePath, CompressionCodec codec, SecorConfig config) throws Exception { return createFileReaderWriterFactory(className, config).BuildFileWriter(logFilePath, codec); }
java
public static FileWriter createFileWriter(String className, LogFilePath logFilePath, CompressionCodec codec, SecorConfig config) throws Exception { return createFileReaderWriterFactory(className, config).BuildFileWriter(logFilePath, codec); }
[ "public", "static", "FileWriter", "createFileWriter", "(", "String", "className", ",", "LogFilePath", "logFilePath", ",", "CompressionCodec", "codec", ",", "SecorConfig", "config", ")", "throws", "Exception", "{", "return", "createFileReaderWriterFactory", "(", "classNa...
Use the FileReaderWriterFactory specified by className to build a FileWriter @param className the class name of a subclass of FileReaderWriterFactory to create a FileWriter from @param logFilePath the LogFilePath that the returned FileWriter should write to @param codec an instance CompressionCodec to compress the file written with, or null for no compression @param config The SecorCondig to initialize the FileWriter with @return a FileWriter specialised to write the type of files supported by the FileReaderWriterFactory @throws Exception on error
[ "Use", "the", "FileReaderWriterFactory", "specified", "by", "className", "to", "build", "a", "FileWriter" ]
train
https://github.com/pinterest/secor/blob/4099ff061db392f11044e57dedf46c1617895278/src/main/java/com/pinterest/secor/util/ReflectionUtil.java#L152-L157
google/jimfs
jimfs/src/main/java/com/google/common/jimfs/FileSystemView.java
FileSystemView.getFileAttributeView
@Nullable public <V extends FileAttributeView> V getFileAttributeView(FileLookup lookup, Class<V> type) { return store.getFileAttributeView(lookup, type); }
java
@Nullable public <V extends FileAttributeView> V getFileAttributeView(FileLookup lookup, Class<V> type) { return store.getFileAttributeView(lookup, type); }
[ "@", "Nullable", "public", "<", "V", "extends", "FileAttributeView", ">", "V", "getFileAttributeView", "(", "FileLookup", "lookup", ",", "Class", "<", "V", ">", "type", ")", "{", "return", "store", ".", "getFileAttributeView", "(", "lookup", ",", "type", ")"...
Returns a file attribute view using the given lookup callback.
[ "Returns", "a", "file", "attribute", "view", "using", "the", "given", "lookup", "callback", "." ]
train
https://github.com/google/jimfs/blob/3eadff747a3afa7b498030f420d2d04ce700534a/jimfs/src/main/java/com/google/common/jimfs/FileSystemView.java#L695-L698
apache/incubator-shardingsphere
sharding-core/sharding-core-merge/src/main/java/org/apache/shardingsphere/core/merge/MergeEngineFactory.java
MergeEngineFactory.newInstance
public static MergeEngine newInstance(final DatabaseType databaseType, final ShardingRule shardingRule, final SQLRouteResult routeResult, final ShardingTableMetaData shardingTableMetaData, final List<QueryResult> queryResults) throws SQLException { if (routeResult.getSqlStatement() instanceof SelectStatement) { return new DQLMergeEngine(databaseType, routeResult, queryResults); } if (routeResult.getSqlStatement() instanceof DALStatement) { return new DALMergeEngine(shardingRule, queryResults, (DALStatement) routeResult.getSqlStatement(), shardingTableMetaData); } throw new UnsupportedOperationException(String.format("Cannot support type '%s'", routeResult.getSqlStatement().getType())); }
java
public static MergeEngine newInstance(final DatabaseType databaseType, final ShardingRule shardingRule, final SQLRouteResult routeResult, final ShardingTableMetaData shardingTableMetaData, final List<QueryResult> queryResults) throws SQLException { if (routeResult.getSqlStatement() instanceof SelectStatement) { return new DQLMergeEngine(databaseType, routeResult, queryResults); } if (routeResult.getSqlStatement() instanceof DALStatement) { return new DALMergeEngine(shardingRule, queryResults, (DALStatement) routeResult.getSqlStatement(), shardingTableMetaData); } throw new UnsupportedOperationException(String.format("Cannot support type '%s'", routeResult.getSqlStatement().getType())); }
[ "public", "static", "MergeEngine", "newInstance", "(", "final", "DatabaseType", "databaseType", ",", "final", "ShardingRule", "shardingRule", ",", "final", "SQLRouteResult", "routeResult", ",", "final", "ShardingTableMetaData", "shardingTableMetaData", ",", "final", "List...
Create merge engine instance. @param databaseType database type @param shardingRule sharding rule @param routeResult SQL route result @param shardingTableMetaData sharding table meta Data @param queryResults query results @return merge engine instance @throws SQLException SQL exception
[ "Create", "merge", "engine", "instance", "." ]
train
https://github.com/apache/incubator-shardingsphere/blob/f88fd29fc345dfb31fdce12e9e96cbfa0fd2402d/sharding-core/sharding-core-merge/src/main/java/org/apache/shardingsphere/core/merge/MergeEngineFactory.java#L55-L64
aol/cyclops
cyclops-pure/src/main/java/cyclops/hkt/Active.java
Active.concreteConversion
public <S,R> Converter<S> concreteConversion(Function<? super Higher<W, T>,? extends S> narrow){ return new Converter<S>(){ @Override public <R> R to(Function<S, R> fn) { return fn.apply(narrow.apply(single)); } }; }
java
public <S,R> Converter<S> concreteConversion(Function<? super Higher<W, T>,? extends S> narrow){ return new Converter<S>(){ @Override public <R> R to(Function<S, R> fn) { return fn.apply(narrow.apply(single)); } }; }
[ "public", "<", "S", ",", "R", ">", "Converter", "<", "S", ">", "concreteConversion", "(", "Function", "<", "?", "super", "Higher", "<", "W", ",", "T", ">", ",", "?", "extends", "S", ">", "narrow", ")", "{", "return", "new", "Converter", "<", "S", ...
Convert this Active to a new type via the underlying concrete type e.g. Given an Active List <pre> {@code Active<list,Integer> active = Active.of(ListX.of(1,2,3), ListX.Instances.definitions()); } </pre> We can convert it to a set via concreteConversion <pre> {@code SetX<Integer> set = active.concreteConversion(ListX.<Integer>kindCokleisli()) .to(ListX::toSetX()); } </pre> Most cyclops-react types provide kindCokleisli implementations that convert a Higher Kinded encoding of the type back to the concrete type @param narrow Narrowing function (Cokleisli) to a concrete type @param <S> Concrete type @param <R> Return type @return Converter that works on the concrete type
[ "Convert", "this", "Active", "to", "a", "new", "type", "via", "the", "underlying", "concrete", "type", "e", ".", "g", ".", "Given", "an", "Active", "List", "<pre", ">", "{", "@code", "Active<list", "Integer", ">", "active", "=", "Active", ".", "of", "(...
train
https://github.com/aol/cyclops/blob/59a9fde30190a4d1faeb9f6d9851d209d82b81dd/cyclops-pure/src/main/java/cyclops/hkt/Active.java#L119-L128
alkacon/opencms-core
src/org/opencms/ui/login/CmsPasswordForm.java
CmsPasswordForm.setErrorPassword2
public void setErrorPassword2(UserError error, String style) { m_passwordField2.setComponentError(error); m_password2Style.setStyle(style); }
java
public void setErrorPassword2(UserError error, String style) { m_passwordField2.setComponentError(error); m_password2Style.setStyle(style); }
[ "public", "void", "setErrorPassword2", "(", "UserError", "error", ",", "String", "style", ")", "{", "m_passwordField2", ".", "setComponentError", "(", "error", ")", ";", "m_password2Style", ".", "setStyle", "(", "style", ")", ";", "}" ]
Sets the password 2 error.<p> @param error the error @param style the style class
[ "Sets", "the", "password", "2", "error", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ui/login/CmsPasswordForm.java#L230-L234
QSFT/Doradus
doradus-client/src/main/java/com/dell/doradus/client/utils/CSVDumper.java
CSVDumper.loadSchema
private void loadSchema() { m_logger.info("Loading schema for application: {}", m_config.app); m_client = new Client(m_config.host, m_config.port, m_config.getTLSParams()); m_client.setCredentials(m_config.getCredentials()); m_session = m_client.openApplication(m_config.app); // throws if unknown app m_appDef = m_session.getAppDef(); if (m_config.optimize) { computeLinkFanouts(); } }
java
private void loadSchema() { m_logger.info("Loading schema for application: {}", m_config.app); m_client = new Client(m_config.host, m_config.port, m_config.getTLSParams()); m_client.setCredentials(m_config.getCredentials()); m_session = m_client.openApplication(m_config.app); // throws if unknown app m_appDef = m_session.getAppDef(); if (m_config.optimize) { computeLinkFanouts(); } }
[ "private", "void", "loadSchema", "(", ")", "{", "m_logger", ".", "info", "(", "\"Loading schema for application: {}\"", ",", "m_config", ".", "app", ")", ";", "m_client", "=", "new", "Client", "(", "m_config", ".", "host", ",", "m_config", ".", "port", ",", ...
Connect to the Doradus server and download the requested application's schema.
[ "Connect", "to", "the", "Doradus", "server", "and", "download", "the", "requested", "application", "s", "schema", "." ]
train
https://github.com/QSFT/Doradus/blob/ad64d3c37922eefda68ec8869ef089c1ca604b70/doradus-client/src/main/java/com/dell/doradus/client/utils/CSVDumper.java#L247-L256
nguillaumin/slick2d-maven
slick2d-hiero/src/main/java/org/newdawn/slick/tools/hiero/DataSet.java
DataSet.addCharacter
public void addCharacter(int code, int xadvance, int x, int y, int width, int height,int yoffset) { chars.add(new CharData(code, xadvance, x, y, width, height,size + yoffset)); }
java
public void addCharacter(int code, int xadvance, int x, int y, int width, int height,int yoffset) { chars.add(new CharData(code, xadvance, x, y, width, height,size + yoffset)); }
[ "public", "void", "addCharacter", "(", "int", "code", ",", "int", "xadvance", ",", "int", "x", ",", "int", "y", ",", "int", "width", ",", "int", "height", ",", "int", "yoffset", ")", "{", "chars", ".", "add", "(", "new", "CharData", "(", "code", ",...
Add a character to the data set @param code The character code @param xadvance The advance on the x axis after writing this character @param x The x position on the sheet of the character @param y The y position on the sheet of the character @param width The width of the character on the sheet @param height The height of the character on the sheet @param yoffset The offset on the y axis when drawing the character
[ "Add", "a", "character", "to", "the", "data", "set" ]
train
https://github.com/nguillaumin/slick2d-maven/blob/8251f88a0ed6a70e726d2468842455cd1f80893f/slick2d-hiero/src/main/java/org/newdawn/slick/tools/hiero/DataSet.java#L214-L216
UrielCh/ovh-java-sdk
ovh-java-sdk-emaildomain/src/main/java/net/minidev/ovh/api/ApiOvhEmaildomain.java
ApiOvhEmaildomain.domain_account_accountName_usage_GET
public OvhDomainUsageAccountStruct domain_account_accountName_usage_GET(String domain, String accountName) throws IOException { String qPath = "/email/domain/{domain}/account/{accountName}/usage"; StringBuilder sb = path(qPath, domain, accountName); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, OvhDomainUsageAccountStruct.class); }
java
public OvhDomainUsageAccountStruct domain_account_accountName_usage_GET(String domain, String accountName) throws IOException { String qPath = "/email/domain/{domain}/account/{accountName}/usage"; StringBuilder sb = path(qPath, domain, accountName); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, OvhDomainUsageAccountStruct.class); }
[ "public", "OvhDomainUsageAccountStruct", "domain_account_accountName_usage_GET", "(", "String", "domain", ",", "String", "accountName", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/email/domain/{domain}/account/{accountName}/usage\"", ";", "StringBuilder", "sb...
usage of account REST: GET /email/domain/{domain}/account/{accountName}/usage @param domain [required] Name of your domain name @param accountName [required] Name of account
[ "usage", "of", "account" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-emaildomain/src/main/java/net/minidev/ovh/api/ApiOvhEmaildomain.java#L432-L437
artikcloud/artikcloud-java
src/main/java/cloud/artik/api/SubscriptionsApi.java
SubscriptionsApi.createSubscriptionAsync
public com.squareup.okhttp.Call createSubscriptionAsync(SubscriptionInfo subscriptionInfo, final ApiCallback<SubscriptionEnvelope> callback) throws ApiException { ProgressResponseBody.ProgressListener progressListener = null; ProgressRequestBody.ProgressRequestListener progressRequestListener = null; if (callback != null) { progressListener = new ProgressResponseBody.ProgressListener() { @Override public void update(long bytesRead, long contentLength, boolean done) { callback.onDownloadProgress(bytesRead, contentLength, done); } }; progressRequestListener = new ProgressRequestBody.ProgressRequestListener() { @Override public void onRequestProgress(long bytesWritten, long contentLength, boolean done) { callback.onUploadProgress(bytesWritten, contentLength, done); } }; } com.squareup.okhttp.Call call = createSubscriptionValidateBeforeCall(subscriptionInfo, progressListener, progressRequestListener); Type localVarReturnType = new TypeToken<SubscriptionEnvelope>(){}.getType(); apiClient.executeAsync(call, localVarReturnType, callback); return call; }
java
public com.squareup.okhttp.Call createSubscriptionAsync(SubscriptionInfo subscriptionInfo, final ApiCallback<SubscriptionEnvelope> callback) throws ApiException { ProgressResponseBody.ProgressListener progressListener = null; ProgressRequestBody.ProgressRequestListener progressRequestListener = null; if (callback != null) { progressListener = new ProgressResponseBody.ProgressListener() { @Override public void update(long bytesRead, long contentLength, boolean done) { callback.onDownloadProgress(bytesRead, contentLength, done); } }; progressRequestListener = new ProgressRequestBody.ProgressRequestListener() { @Override public void onRequestProgress(long bytesWritten, long contentLength, boolean done) { callback.onUploadProgress(bytesWritten, contentLength, done); } }; } com.squareup.okhttp.Call call = createSubscriptionValidateBeforeCall(subscriptionInfo, progressListener, progressRequestListener); Type localVarReturnType = new TypeToken<SubscriptionEnvelope>(){}.getType(); apiClient.executeAsync(call, localVarReturnType, callback); return call; }
[ "public", "com", ".", "squareup", ".", "okhttp", ".", "Call", "createSubscriptionAsync", "(", "SubscriptionInfo", "subscriptionInfo", ",", "final", "ApiCallback", "<", "SubscriptionEnvelope", ">", "callback", ")", "throws", "ApiException", "{", "ProgressResponseBody", ...
Create Subscription (asynchronously) Create Subscription @param subscriptionInfo Subscription details (required) @param callback The callback to be executed when the API call finishes @return The request call @throws ApiException If fail to process the API call, e.g. serializing the request body object
[ "Create", "Subscription", "(", "asynchronously", ")", "Create", "Subscription" ]
train
https://github.com/artikcloud/artikcloud-java/blob/412f447573e7796ab4f685c0bdd5eb76185a365c/src/main/java/cloud/artik/api/SubscriptionsApi.java#L153-L178
b3dgs/lionengine
lionengine-game/src/main/java/com/b3dgs/lionengine/game/feature/tile/map/collision/MapTileCollisionComputer.java
MapTileCollisionComputer.computeCollision
public CollisionResult computeCollision(Transformable transformable, CollisionCategory category) { // Distance calculation final double sh = transformable.getOldX() + category.getOffsetX(); final double sv = transformable.getOldY() + category.getOffsetY(); final double dh = transformable.getX() + category.getOffsetX() - sh; final double dv = transformable.getY() + category.getOffsetY() - sv; final double nh = Math.abs(dh); final double nv = Math.abs(dv); final int max = (int) Math.ceil(Math.max(nh, nv)); final double sx; final double sy; if (Double.compare(nh, 1.0) >= 0 || Double.compare(nv, 1.0) >= 0) { sx = dh / max; sy = dv / max; } else { sx = dh; sy = dv; } return computeCollision(category, sh, sv, sx, sy, max); }
java
public CollisionResult computeCollision(Transformable transformable, CollisionCategory category) { // Distance calculation final double sh = transformable.getOldX() + category.getOffsetX(); final double sv = transformable.getOldY() + category.getOffsetY(); final double dh = transformable.getX() + category.getOffsetX() - sh; final double dv = transformable.getY() + category.getOffsetY() - sv; final double nh = Math.abs(dh); final double nv = Math.abs(dv); final int max = (int) Math.ceil(Math.max(nh, nv)); final double sx; final double sy; if (Double.compare(nh, 1.0) >= 0 || Double.compare(nv, 1.0) >= 0) { sx = dh / max; sy = dv / max; } else { sx = dh; sy = dv; } return computeCollision(category, sh, sv, sx, sy, max); }
[ "public", "CollisionResult", "computeCollision", "(", "Transformable", "transformable", ",", "CollisionCategory", "category", ")", "{", "// Distance calculation\r", "final", "double", "sh", "=", "transformable", ".", "getOldX", "(", ")", "+", "category", ".", "getOffs...
Search first tile hit by the transformable that contains collision, applying a ray tracing from its old location to its current. This way, the transformable can not pass through a collidable tile. @param transformable The transformable reference. @param category The collisions category to search in. @return The collision result, <code>null</code> if nothing found.
[ "Search", "first", "tile", "hit", "by", "the", "transformable", "that", "contains", "collision", "applying", "a", "ray", "tracing", "from", "its", "old", "location", "to", "its", "current", ".", "This", "way", "the", "transformable", "can", "not", "pass", "t...
train
https://github.com/b3dgs/lionengine/blob/cac3d5578532cf11724a737b9f09e71bf9995ab2/lionengine-game/src/main/java/com/b3dgs/lionengine/game/feature/tile/map/collision/MapTileCollisionComputer.java#L128-L156
baidubce/bce-sdk-java
src/main/java/com/baidubce/services/bmr/BmrClient.java
BmrClient.modifyInstanceGroups
public void modifyInstanceGroups(ModifyInstanceGroupsRequest request) { checkNotNull(request, "request should not be null."); checkStringNotEmpty(request.getClusterId(), "The clusterId should not be null or empty string."); checkNotNull(request.getInstanceGroups(), "The instanceGroups should not be null."); StringWriter writer = new StringWriter(); try { JsonGenerator jsonGenerator = JsonUtils.jsonGeneratorOf(writer); jsonGenerator.writeStartObject(); jsonGenerator.writeArrayFieldStart("instanceGroups"); for (ModifyInstanceGroupConfig instanceGroup : request.getInstanceGroups()) { checkStringNotEmpty(instanceGroup.getId(), "The instanceGroupId should not be null or empty string."); jsonGenerator.writeStartObject(); jsonGenerator.writeStringField("id", instanceGroup.getId()); jsonGenerator.writeNumberField("instanceCount", instanceGroup.getInstanceCount()); jsonGenerator.writeEndObject(); } jsonGenerator.writeEndArray(); jsonGenerator.writeEndObject(); jsonGenerator.close(); } catch (IOException e) { throw new BceClientException("Fail to generate json", e); } byte[] json = null; try { json = writer.toString().getBytes(DEFAULT_ENCODING); } catch (UnsupportedEncodingException e) { throw new BceClientException("Fail to get UTF-8 bytes", e); } InternalRequest internalRequest = this.createRequest(request, HttpMethodName.PUT, CLUSTER, request.getClusterId(), INSTANCE_GROUP); internalRequest.addHeader(Headers.CONTENT_LENGTH, String.valueOf(json.length)); internalRequest.addHeader(Headers.CONTENT_TYPE, "application/json"); internalRequest.setContent(RestartableInputStream.wrap(json)); if (request.getClientToken() != null) { internalRequest.addParameter("clientToken", request.getClientToken()); } this.invokeHttpClient(internalRequest, AbstractBceResponse.class); }
java
public void modifyInstanceGroups(ModifyInstanceGroupsRequest request) { checkNotNull(request, "request should not be null."); checkStringNotEmpty(request.getClusterId(), "The clusterId should not be null or empty string."); checkNotNull(request.getInstanceGroups(), "The instanceGroups should not be null."); StringWriter writer = new StringWriter(); try { JsonGenerator jsonGenerator = JsonUtils.jsonGeneratorOf(writer); jsonGenerator.writeStartObject(); jsonGenerator.writeArrayFieldStart("instanceGroups"); for (ModifyInstanceGroupConfig instanceGroup : request.getInstanceGroups()) { checkStringNotEmpty(instanceGroup.getId(), "The instanceGroupId should not be null or empty string."); jsonGenerator.writeStartObject(); jsonGenerator.writeStringField("id", instanceGroup.getId()); jsonGenerator.writeNumberField("instanceCount", instanceGroup.getInstanceCount()); jsonGenerator.writeEndObject(); } jsonGenerator.writeEndArray(); jsonGenerator.writeEndObject(); jsonGenerator.close(); } catch (IOException e) { throw new BceClientException("Fail to generate json", e); } byte[] json = null; try { json = writer.toString().getBytes(DEFAULT_ENCODING); } catch (UnsupportedEncodingException e) { throw new BceClientException("Fail to get UTF-8 bytes", e); } InternalRequest internalRequest = this.createRequest(request, HttpMethodName.PUT, CLUSTER, request.getClusterId(), INSTANCE_GROUP); internalRequest.addHeader(Headers.CONTENT_LENGTH, String.valueOf(json.length)); internalRequest.addHeader(Headers.CONTENT_TYPE, "application/json"); internalRequest.setContent(RestartableInputStream.wrap(json)); if (request.getClientToken() != null) { internalRequest.addParameter("clientToken", request.getClientToken()); } this.invokeHttpClient(internalRequest, AbstractBceResponse.class); }
[ "public", "void", "modifyInstanceGroups", "(", "ModifyInstanceGroupsRequest", "request", ")", "{", "checkNotNull", "(", "request", ",", "\"request should not be null.\"", ")", ";", "checkStringNotEmpty", "(", "request", ".", "getClusterId", "(", ")", ",", "\"The cluster...
Modify the instance groups of the target cluster. @param request The request containing the ID of BMR cluster and the instance groups to be modified.
[ "Modify", "the", "instance", "groups", "of", "the", "target", "cluster", "." ]
train
https://github.com/baidubce/bce-sdk-java/blob/f7140f28dd82121515c88ded7bfe769a37d0ec4a/src/main/java/com/baidubce/services/bmr/BmrClient.java#L292-L332
facebookarchive/hadoop-20
src/core/org/apache/hadoop/net/DNS.java
DNS.getDefaultHost
@Deprecated public static String getDefaultHost(String strInterface, String nameserver) throws UnknownHostException { if (strInterface.equals("default")) return InetAddress.getLocalHost().getCanonicalHostName(); if (nameserver != null && nameserver.equals("default")) return getDefaultHost(strInterface); String[] hosts = getHosts(strInterface, nameserver); return hosts[0]; }
java
@Deprecated public static String getDefaultHost(String strInterface, String nameserver) throws UnknownHostException { if (strInterface.equals("default")) return InetAddress.getLocalHost().getCanonicalHostName(); if (nameserver != null && nameserver.equals("default")) return getDefaultHost(strInterface); String[] hosts = getHosts(strInterface, nameserver); return hosts[0]; }
[ "@", "Deprecated", "public", "static", "String", "getDefaultHost", "(", "String", "strInterface", ",", "String", "nameserver", ")", "throws", "UnknownHostException", "{", "if", "(", "strInterface", ".", "equals", "(", "\"default\"", ")", ")", "return", "InetAddres...
Returns the default (first) host name associated by the provided nameserver with the address bound to the specified network interface @param strInterface The name of the network interface to query (e.g. eth0) @param nameserver The DNS host name @return The default host names associated with IPs bound to the network interface @throws UnknownHostException If one is encountered while querying the deault interface
[ "Returns", "the", "default", "(", "first", ")", "host", "name", "associated", "by", "the", "provided", "nameserver", "with", "the", "address", "bound", "to", "the", "specified", "network", "interface" ]
train
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/core/org/apache/hadoop/net/DNS.java#L199-L210
bbossgroups/bboss-elasticsearch
bboss-elasticsearch-rest/src/main/java/org/frameworkset/elasticsearch/client/RestClientUtil.java
RestClientUtil.addDocumentWithParentId
public String addDocumentWithParentId(String indexName, Object bean, Object parentId) throws ElasticSearchException{ return addDocumentWithParentId( indexName, _doc,bean, parentId); }
java
public String addDocumentWithParentId(String indexName, Object bean, Object parentId) throws ElasticSearchException{ return addDocumentWithParentId( indexName, _doc,bean, parentId); }
[ "public", "String", "addDocumentWithParentId", "(", "String", "indexName", ",", "Object", "bean", ",", "Object", "parentId", ")", "throws", "ElasticSearchException", "{", "return", "addDocumentWithParentId", "(", "indexName", ",", "_doc", ",", "bean", ",", "parentId...
创建索引文档,根据elasticsearch.xml中指定的日期时间格式,生成对应时间段的索引表名称 For Elasticsearch 7 and 7+ @param indexName @param bean @return @throws ElasticSearchException
[ "创建索引文档,根据elasticsearch", ".", "xml中指定的日期时间格式,生成对应时间段的索引表名称", "For", "Elasticsearch", "7", "and", "7", "+" ]
train
https://github.com/bbossgroups/bboss-elasticsearch/blob/31717c8aa2c4c880987be53aeeb8a0cf5183c3a7/bboss-elasticsearch-rest/src/main/java/org/frameworkset/elasticsearch/client/RestClientUtil.java#L4110-L4112
logic-ng/LogicNG
src/main/java/org/logicng/solvers/MiniSat.java
MiniSat.generateBlockingClause
private LNGIntVector generateBlockingClause(final LNGBooleanVector modelFromSolver, final LNGIntVector relevantVars) { final LNGIntVector blockingClause; if (relevantVars != null) { blockingClause = new LNGIntVector(relevantVars.size()); for (int i = 0; i < relevantVars.size(); i++) { final int varIndex = relevantVars.get(i); if (varIndex != -1) { final boolean varAssignment = modelFromSolver.get(varIndex); blockingClause.push(varAssignment ? (varIndex * 2) ^ 1 : varIndex * 2); } } } else { blockingClause = new LNGIntVector(modelFromSolver.size()); for (int i = 0; i < modelFromSolver.size(); i++) { final boolean varAssignment = modelFromSolver.get(i); blockingClause.push(varAssignment ? (i * 2) ^ 1 : i * 2); } } return blockingClause; }
java
private LNGIntVector generateBlockingClause(final LNGBooleanVector modelFromSolver, final LNGIntVector relevantVars) { final LNGIntVector blockingClause; if (relevantVars != null) { blockingClause = new LNGIntVector(relevantVars.size()); for (int i = 0; i < relevantVars.size(); i++) { final int varIndex = relevantVars.get(i); if (varIndex != -1) { final boolean varAssignment = modelFromSolver.get(varIndex); blockingClause.push(varAssignment ? (varIndex * 2) ^ 1 : varIndex * 2); } } } else { blockingClause = new LNGIntVector(modelFromSolver.size()); for (int i = 0; i < modelFromSolver.size(); i++) { final boolean varAssignment = modelFromSolver.get(i); blockingClause.push(varAssignment ? (i * 2) ^ 1 : i * 2); } } return blockingClause; }
[ "private", "LNGIntVector", "generateBlockingClause", "(", "final", "LNGBooleanVector", "modelFromSolver", ",", "final", "LNGIntVector", "relevantVars", ")", "{", "final", "LNGIntVector", "blockingClause", ";", "if", "(", "relevantVars", "!=", "null", ")", "{", "blocki...
Generates a blocking clause from a given model and a set of relevant variables. @param modelFromSolver the current model for which the blocking clause should be generated @param relevantVars the indices of the relevant variables. If {@code null} all variables are relevant. @return the blocking clause for the given model and relevant variables
[ "Generates", "a", "blocking", "clause", "from", "a", "given", "model", "and", "a", "set", "of", "relevant", "variables", "." ]
train
https://github.com/logic-ng/LogicNG/blob/bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e/src/main/java/org/logicng/solvers/MiniSat.java#L371-L390
stevespringett/Alpine
alpine/src/main/java/alpine/persistence/AlpineQueryManager.java
AlpineQueryManager.createLdapUser
public LdapUser createLdapUser(final String username) { pm.currentTransaction().begin(); final LdapUser user = new LdapUser(); user.setUsername(username); user.setDN("Syncing..."); pm.makePersistent(user); pm.currentTransaction().commit(); EventService.getInstance().publish(new LdapSyncEvent(user.getUsername())); return getObjectById(LdapUser.class, user.getId()); }
java
public LdapUser createLdapUser(final String username) { pm.currentTransaction().begin(); final LdapUser user = new LdapUser(); user.setUsername(username); user.setDN("Syncing..."); pm.makePersistent(user); pm.currentTransaction().commit(); EventService.getInstance().publish(new LdapSyncEvent(user.getUsername())); return getObjectById(LdapUser.class, user.getId()); }
[ "public", "LdapUser", "createLdapUser", "(", "final", "String", "username", ")", "{", "pm", ".", "currentTransaction", "(", ")", ".", "begin", "(", ")", ";", "final", "LdapUser", "user", "=", "new", "LdapUser", "(", ")", ";", "user", ".", "setUsername", ...
Creates a new LdapUser object with the specified username. @param username The username of the new LdapUser. This must reference an existing username in the directory service @return an LdapUser @since 1.0.0
[ "Creates", "a", "new", "LdapUser", "object", "with", "the", "specified", "username", "." ]
train
https://github.com/stevespringett/Alpine/blob/6c5ef5e1ba4f38922096f1307d3950c09edb3093/alpine/src/main/java/alpine/persistence/AlpineQueryManager.java#L157-L166
apache/groovy
src/main/java/org/codehaus/groovy/runtime/DefaultGroovyMethods.java
DefaultGroovyMethods.findResult
@Deprecated public static <S, T, U extends T, V extends T> T findResult(Collection<S> self, U defaultResult, @ClosureParams(FirstParam.FirstGenericType.class) Closure<V> condition) { return findResult((Iterable<S>) self, defaultResult, condition); }
java
@Deprecated public static <S, T, U extends T, V extends T> T findResult(Collection<S> self, U defaultResult, @ClosureParams(FirstParam.FirstGenericType.class) Closure<V> condition) { return findResult((Iterable<S>) self, defaultResult, condition); }
[ "@", "Deprecated", "public", "static", "<", "S", ",", "T", ",", "U", "extends", "T", ",", "V", "extends", "T", ">", "T", "findResult", "(", "Collection", "<", "S", ">", "self", ",", "U", "defaultResult", ",", "@", "ClosureParams", "(", "FirstParam", ...
Iterates through the collection calling the given closure for each item but stopping once the first non-null result is found and returning that result. If all are null, the defaultResult is returned. @param self a Collection @param defaultResult an Object that should be returned if all closure results are null @param condition a closure that returns a non-null value to indicate that processing should stop and the value should be returned @return the first non-null result from calling the closure, or the defaultValue @since 1.7.5 @deprecated use the Iterable version instead
[ "Iterates", "through", "the", "collection", "calling", "the", "given", "closure", "for", "each", "item", "but", "stopping", "once", "the", "first", "non", "-", "null", "result", "is", "found", "and", "returning", "that", "result", ".", "If", "all", "are", ...
train
https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/java/org/codehaus/groovy/runtime/DefaultGroovyMethods.java#L4452-L4455
biojava/biojava
biojava-genome/src/main/java/org/biojava/nbio/genome/parsers/gff/FeatureList.java
FeatureList.selectByAttribute
public FeatureList selectByAttribute(String key, String value) { if (featindex.containsKey(key)){ Map<String,List<FeatureI>> featuresmap = featindex.get(key); if (featuresmap==null) return new FeatureList(); List<FeatureI> list = featuresmap.get(value); if (list == null){ return new FeatureList(); } return new FeatureList(list); } FeatureList list = new FeatureList(); for (FeatureI f : this) { if (f.hasAttribute(key, value)) { list.add(f); } } return list; }
java
public FeatureList selectByAttribute(String key, String value) { if (featindex.containsKey(key)){ Map<String,List<FeatureI>> featuresmap = featindex.get(key); if (featuresmap==null) return new FeatureList(); List<FeatureI> list = featuresmap.get(value); if (list == null){ return new FeatureList(); } return new FeatureList(list); } FeatureList list = new FeatureList(); for (FeatureI f : this) { if (f.hasAttribute(key, value)) { list.add(f); } } return list; }
[ "public", "FeatureList", "selectByAttribute", "(", "String", "key", ",", "String", "value", ")", "{", "if", "(", "featindex", ".", "containsKey", "(", "key", ")", ")", "{", "Map", "<", "String", ",", "List", "<", "FeatureI", ">", ">", "featuresmap", "=",...
Create a list of all features that include the specified attribute key/value pair. This method now properly supports adding the index before or after adding the features. Adding features, then then index, then more features is still not supported. @param key The key to consider. @param value The value to consider. @return A list of features that include the key/value pair.
[ "Create", "a", "list", "of", "all", "features", "that", "include", "the", "specified", "attribute", "key", "/", "value", "pair", ".", "This", "method", "now", "properly", "supports", "adding", "the", "index", "before", "or", "after", "adding", "the", "featur...
train
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-genome/src/main/java/org/biojava/nbio/genome/parsers/gff/FeatureList.java#L268-L285
ops4j/org.ops4j.pax.swissbox
pax-swissbox-tracker/src/main/java/org/ops4j/pax/swissbox/tracker/ServiceLookup.java
ServiceLookup.getService
public static <T> T getService( BundleContext bc, String className ) { return ServiceLookup.<T> getService( bc, className, DEFAULT_TIMEOUT, "" ); }
java
public static <T> T getService( BundleContext bc, String className ) { return ServiceLookup.<T> getService( bc, className, DEFAULT_TIMEOUT, "" ); }
[ "public", "static", "<", "T", ">", "T", "getService", "(", "BundleContext", "bc", ",", "String", "className", ")", "{", "return", "ServiceLookup", ".", "<", "T", ">", "getService", "(", "bc", ",", "className", ",", "DEFAULT_TIMEOUT", ",", "\"\"", ")", ";...
Returns a service matching the given criteria. @param <T> class implemented or extended by the service @param bc bundle context for accessing the OSGi registry @param className name of class implemented or extended by the service @return matching service (not null) @throws ServiceLookupException when no matching service has been found after the timeout
[ "Returns", "a", "service", "matching", "the", "given", "criteria", "." ]
train
https://github.com/ops4j/org.ops4j.pax.swissbox/blob/00b0ee16cdbe8017984a4d7ba808b10d985c5b5c/pax-swissbox-tracker/src/main/java/org/ops4j/pax/swissbox/tracker/ServiceLookup.java#L56-L59
liferay/com-liferay-commerce
commerce-product-service/src/main/java/com/liferay/commerce/product/service/persistence/impl/CPAttachmentFileEntryPersistenceImpl.java
CPAttachmentFileEntryPersistenceImpl.fetchByC_C_F
@Override public CPAttachmentFileEntry fetchByC_C_F(long classNameId, long classPK, long fileEntryId) { return fetchByC_C_F(classNameId, classPK, fileEntryId, true); }
java
@Override public CPAttachmentFileEntry fetchByC_C_F(long classNameId, long classPK, long fileEntryId) { return fetchByC_C_F(classNameId, classPK, fileEntryId, true); }
[ "@", "Override", "public", "CPAttachmentFileEntry", "fetchByC_C_F", "(", "long", "classNameId", ",", "long", "classPK", ",", "long", "fileEntryId", ")", "{", "return", "fetchByC_C_F", "(", "classNameId", ",", "classPK", ",", "fileEntryId", ",", "true", ")", ";",...
Returns the cp attachment file entry where classNameId = &#63; and classPK = &#63; and fileEntryId = &#63; or returns <code>null</code> if it could not be found. Uses the finder cache. @param classNameId the class name ID @param classPK the class pk @param fileEntryId the file entry ID @return the matching cp attachment file entry, or <code>null</code> if a matching cp attachment file entry could not be found
[ "Returns", "the", "cp", "attachment", "file", "entry", "where", "classNameId", "=", "&#63", ";", "and", "classPK", "=", "&#63", ";", "and", "fileEntryId", "=", "&#63", ";", "or", "returns", "<code", ">", "null<", "/", "code", ">", "if", "it", "could", ...
train
https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-product-service/src/main/java/com/liferay/commerce/product/service/persistence/impl/CPAttachmentFileEntryPersistenceImpl.java#L2680-L2684
MutabilityDetector/MutabilityDetector
src/main/java/org/mutabilitydetector/DefaultCachingAnalysisSession.java
DefaultCachingAnalysisSession.createWithCurrentClassPath
public static AnalysisSession createWithCurrentClassPath(Configuration configuration) { ClassPath classpath = new ClassPathFactory().createFromJVM(); ClassLoadingVerifierFactory verifierFactory = new ClassLoadingVerifierFactory(new CachingAnalysisClassLoader(new ClassForNameWrapper())); return createWithGivenClassPath(classpath, configuration, verifierFactory); }
java
public static AnalysisSession createWithCurrentClassPath(Configuration configuration) { ClassPath classpath = new ClassPathFactory().createFromJVM(); ClassLoadingVerifierFactory verifierFactory = new ClassLoadingVerifierFactory(new CachingAnalysisClassLoader(new ClassForNameWrapper())); return createWithGivenClassPath(classpath, configuration, verifierFactory); }
[ "public", "static", "AnalysisSession", "createWithCurrentClassPath", "(", "Configuration", "configuration", ")", "{", "ClassPath", "classpath", "=", "new", "ClassPathFactory", "(", ")", ".", "createFromJVM", "(", ")", ";", "ClassLoadingVerifierFactory", "verifierFactory",...
Creates an analysis session based suitable for runtime analysis. <p> For analysis, classes will be accessed through the runtime classpath. @param configuration custom configuration for analysis. @return AnalysisSession for runtime analysis. @see ConfigurationBuilder
[ "Creates", "an", "analysis", "session", "based", "suitable", "for", "runtime", "analysis", ".", "<p", ">", "For", "analysis", "classes", "will", "be", "accessed", "through", "the", "runtime", "classpath", "." ]
train
https://github.com/MutabilityDetector/MutabilityDetector/blob/36014d2f9e45cf0cc6d67b81395942cd39c4f6ae/src/main/java/org/mutabilitydetector/DefaultCachingAnalysisSession.java#L102-L106
lets-blade/blade
src/main/java/com/blade/kit/StringKit.java
StringKit.isBlankThen
public static void isBlankThen(String str, Consumer<String> consumer) { if (isBlank(str)) { consumer.accept(str); } }
java
public static void isBlankThen(String str, Consumer<String> consumer) { if (isBlank(str)) { consumer.accept(str); } }
[ "public", "static", "void", "isBlankThen", "(", "String", "str", ",", "Consumer", "<", "String", ">", "consumer", ")", "{", "if", "(", "isBlank", "(", "str", ")", ")", "{", "consumer", ".", "accept", "(", "str", ")", ";", "}", "}" ]
Execute consumer when the string is empty @param str string value @param consumer consumer
[ "Execute", "consumer", "when", "the", "string", "is", "empty" ]
train
https://github.com/lets-blade/blade/blob/60624ee528be12122c49a9ad1713e336b959e59a/src/main/java/com/blade/kit/StringKit.java#L87-L91
joachimvda/jtransfo
core/src/main/java/org/jtransfo/internal/ReflectionHelper.java
ReflectionHelper.makeSynthetic
List<SyntheticField> makeSynthetic(Class<?> clazz, List<Field> fields) { List<SyntheticField> result = new ArrayList<>(); for (Field field : fields) { result.add(new AccessorSyntheticField(this, clazz, field)); } return result; }
java
List<SyntheticField> makeSynthetic(Class<?> clazz, List<Field> fields) { List<SyntheticField> result = new ArrayList<>(); for (Field field : fields) { result.add(new AccessorSyntheticField(this, clazz, field)); } return result; }
[ "List", "<", "SyntheticField", ">", "makeSynthetic", "(", "Class", "<", "?", ">", "clazz", ",", "List", "<", "Field", ">", "fields", ")", "{", "List", "<", "SyntheticField", ">", "result", "=", "new", "ArrayList", "<>", "(", ")", ";", "for", "(", "Fi...
Convert list of (real) fields to synthetic fields (which use accessor methods). @param clazz class which contains the fields @param fields fields to convert to synthetic fields @return list of synthetic fields
[ "Convert", "list", "of", "(", "real", ")", "fields", "to", "synthetic", "fields", "(", "which", "use", "accessor", "methods", ")", "." ]
train
https://github.com/joachimvda/jtransfo/blob/eb1c72b64b09d6f3b6212bd3f1579cac5c983ea8/core/src/main/java/org/jtransfo/internal/ReflectionHelper.java#L114-L120
apache/groovy
src/main/java/org/codehaus/groovy/runtime/DefaultGroovyMethods.java
DefaultGroovyMethods.isCase
public static boolean isCase(Map caseValue, Object switchValue) { return DefaultTypeTransformation.castToBoolean(caseValue.get(switchValue)); }
java
public static boolean isCase(Map caseValue, Object switchValue) { return DefaultTypeTransformation.castToBoolean(caseValue.get(switchValue)); }
[ "public", "static", "boolean", "isCase", "(", "Map", "caseValue", ",", "Object", "switchValue", ")", "{", "return", "DefaultTypeTransformation", ".", "castToBoolean", "(", "caseValue", ".", "get", "(", "switchValue", ")", ")", ";", "}" ]
'Case' implementation for maps which tests the groovy truth value obtained using the 'switch' operand as key. For example: <pre class="groovyTestCase">switch( 'foo' ) { case [foo:true, bar:false]: assert true break default: assert false }</pre> @param caseValue the case value @param switchValue the switch value @return the groovy truth value from caseValue corresponding to the switchValue key @since 1.7.6
[ "Case", "implementation", "for", "maps", "which", "tests", "the", "groovy", "truth", "value", "obtained", "using", "the", "switch", "operand", "as", "key", ".", "For", "example", ":", "<pre", "class", "=", "groovyTestCase", ">", "switch", "(", "foo", ")", ...
train
https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/java/org/codehaus/groovy/runtime/DefaultGroovyMethods.java#L1181-L1183
finmath/finmath-lib
src/main/java6/net/finmath/marketdata/model/curves/ForwardCurve.java
ForwardCurve.createForwardCurveFromForwards
public static ForwardCurve createForwardCurveFromForwards(String name, Date referenceDate, String paymentOffsetCode, BusinessdayCalendarInterface paymentBusinessdayCalendar, BusinessdayCalendarInterface.DateRollConvention paymentDateRollConvention, InterpolationMethod interpolationMethod, ExtrapolationMethod extrapolationMethod, InterpolationEntity interpolationEntity, InterpolationEntityForward interpolationEntityForward, String discountCurveName, AnalyticModelInterface model, double[] times, double[] givenForwards) { LocalDate referenceDataAsLocalDate = Instant.ofEpochMilli(referenceDate.getTime()).atZone(ZoneId.systemDefault()).toLocalDate(); return createForwardCurveFromForwards(name, referenceDataAsLocalDate, paymentOffsetCode, paymentBusinessdayCalendar, paymentDateRollConvention, interpolationMethod, extrapolationMethod, interpolationEntity, interpolationEntityForward, discountCurveName, model, times, givenForwards); }
java
public static ForwardCurve createForwardCurveFromForwards(String name, Date referenceDate, String paymentOffsetCode, BusinessdayCalendarInterface paymentBusinessdayCalendar, BusinessdayCalendarInterface.DateRollConvention paymentDateRollConvention, InterpolationMethod interpolationMethod, ExtrapolationMethod extrapolationMethod, InterpolationEntity interpolationEntity, InterpolationEntityForward interpolationEntityForward, String discountCurveName, AnalyticModelInterface model, double[] times, double[] givenForwards) { LocalDate referenceDataAsLocalDate = Instant.ofEpochMilli(referenceDate.getTime()).atZone(ZoneId.systemDefault()).toLocalDate(); return createForwardCurveFromForwards(name, referenceDataAsLocalDate, paymentOffsetCode, paymentBusinessdayCalendar, paymentDateRollConvention, interpolationMethod, extrapolationMethod, interpolationEntity, interpolationEntityForward, discountCurveName, model, times, givenForwards); }
[ "public", "static", "ForwardCurve", "createForwardCurveFromForwards", "(", "String", "name", ",", "Date", "referenceDate", ",", "String", "paymentOffsetCode", ",", "BusinessdayCalendarInterface", "paymentBusinessdayCalendar", ",", "BusinessdayCalendarInterface", ".", "DateRollC...
Create a forward curve from given times and given forwards. @param name The name of this curve. @param referenceDate The reference date for this code, i.e., the date which defines t=0. @param paymentOffsetCode The maturity of the index modeled by this curve. @param paymentBusinessdayCalendar The business day calendar used for adjusting the payment date. @param paymentDateRollConvention The date roll convention used for adjusting the payment date. @param interpolationMethod The interpolation method used for the curve. @param extrapolationMethod The extrapolation method used for the curve. @param interpolationEntity The entity interpolated/extrapolated. @param interpolationEntityForward Interpolation entity used for forward rate interpolation. @param discountCurveName The name of a discount curve associated with this index (associated with it's funding or collateralization), if any. @param model The model to be used to fetch the discount curve, if needed. @param times A vector of given time points. @param givenForwards A vector of given forwards (corresponding to the given time points). @return A new ForwardCurve object.
[ "Create", "a", "forward", "curve", "from", "given", "times", "and", "given", "forwards", "." ]
train
https://github.com/finmath/finmath-lib/blob/a3c067d52dd33feb97d851df6cab130e4116759f/src/main/java6/net/finmath/marketdata/model/curves/ForwardCurve.java#L169-L176
google/closure-compiler
src/com/google/javascript/rhino/jstype/JSTypeRegistry.java
JSTypeRegistry.createTypeFromCommentNode
@SuppressWarnings("unchecked") public JSType createTypeFromCommentNode(Node n, String sourceName, StaticTypedScope scope) { return createFromTypeNodesInternal(n, sourceName, scope, true); }
java
@SuppressWarnings("unchecked") public JSType createTypeFromCommentNode(Node n, String sourceName, StaticTypedScope scope) { return createFromTypeNodesInternal(n, sourceName, scope, true); }
[ "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "public", "JSType", "createTypeFromCommentNode", "(", "Node", "n", ",", "String", "sourceName", ",", "StaticTypedScope", "scope", ")", "{", "return", "createFromTypeNodesInternal", "(", "n", ",", "sourceName", ",",...
Creates a JSType from the nodes representing a type. @param n The node with type info. @param sourceName The source file name. @param scope A scope for doing type name lookups.
[ "Creates", "a", "JSType", "from", "the", "nodes", "representing", "a", "type", "." ]
train
https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/rhino/jstype/JSTypeRegistry.java#L1971-L1974
RestComm/Restcomm-Connect
restcomm/restcomm.http/src/main/java/org/restcomm/connect/http/security/SecurityFilter.java
SecurityFilter.filterClosedAccounts
protected void filterClosedAccounts(UserIdentityContext userIdentityContext, String path) { if (userIdentityContext.getEffectiveAccount() != null && !userIdentityContext.getEffectiveAccount().getStatus().equals(Account.Status.ACTIVE)) { if (userIdentityContext.getEffectiveAccount().getStatus().equals(Account.Status.UNINITIALIZED) && path.startsWith("Accounts")) { return; } throw new WebApplicationException(status(Status.FORBIDDEN).entity("Provided Account is not active").build()); } }
java
protected void filterClosedAccounts(UserIdentityContext userIdentityContext, String path) { if (userIdentityContext.getEffectiveAccount() != null && !userIdentityContext.getEffectiveAccount().getStatus().equals(Account.Status.ACTIVE)) { if (userIdentityContext.getEffectiveAccount().getStatus().equals(Account.Status.UNINITIALIZED) && path.startsWith("Accounts")) { return; } throw new WebApplicationException(status(Status.FORBIDDEN).entity("Provided Account is not active").build()); } }
[ "protected", "void", "filterClosedAccounts", "(", "UserIdentityContext", "userIdentityContext", ",", "String", "path", ")", "{", "if", "(", "userIdentityContext", ".", "getEffectiveAccount", "(", ")", "!=", "null", "&&", "!", "userIdentityContext", ".", "getEffectiveA...
filter out accounts that are not active @param userIdentityContext
[ "filter", "out", "accounts", "that", "are", "not", "active" ]
train
https://github.com/RestComm/Restcomm-Connect/blob/2194dee4fc524cdfd0af77a218ba5f212f97f7c5/restcomm/restcomm.http/src/main/java/org/restcomm/connect/http/security/SecurityFilter.java#L105-L112
telly/groundy
library/src/main/java/com/telly/groundy/TaskResult.java
TaskResult.add
public TaskResult add(String key, Parcelable value) { mBundle.putParcelable(key, value); return this; }
java
public TaskResult add(String key, Parcelable value) { mBundle.putParcelable(key, value); return this; }
[ "public", "TaskResult", "add", "(", "String", "key", ",", "Parcelable", "value", ")", "{", "mBundle", ".", "putParcelable", "(", "key", ",", "value", ")", ";", "return", "this", ";", "}" ]
Inserts a Parcelable value into the mapping of this Bundle, replacing any existing value for the given key. Either key or value may be null. @param key a String, or null @param value a Parcelable object, or null
[ "Inserts", "a", "Parcelable", "value", "into", "the", "mapping", "of", "this", "Bundle", "replacing", "any", "existing", "value", "for", "the", "given", "key", ".", "Either", "key", "or", "value", "may", "be", "null", "." ]
train
https://github.com/telly/groundy/blob/e90baf9901a8be20b348bd1575d5ad782560cec8/library/src/main/java/com/telly/groundy/TaskResult.java#L179-L182
googleads/googleads-java-lib
modules/ads_lib/src/main/java/com/google/api/ads/common/lib/utils/CsvFiles.java
CsvFiles.getCsvDataByColumn
public static List<String> getCsvDataByColumn(String fileName, final int column, boolean headerPresent) throws IOException { final List<String> result = Lists.newArrayList(); new CsvReader(fileName, headerPresent) .processReader((headers, line, lineNumber) -> result.add(line[column])); return result; }
java
public static List<String> getCsvDataByColumn(String fileName, final int column, boolean headerPresent) throws IOException { final List<String> result = Lists.newArrayList(); new CsvReader(fileName, headerPresent) .processReader((headers, line, lineNumber) -> result.add(line[column])); return result; }
[ "public", "static", "List", "<", "String", ">", "getCsvDataByColumn", "(", "String", "fileName", ",", "final", "int", "column", ",", "boolean", "headerPresent", ")", "throws", "IOException", "{", "final", "List", "<", "String", ">", "result", "=", "Lists", "...
Returns a {@code List<String>} representing a single 0-indexed column. @param fileName the CSV file to load @param column the 0-indexed column to return @param headerPresent {@code true} if the first line is the header @return a {@code List<String>} representing a single column @throws IOException if there was an exception reading the file @throws IllegalArgumentException if the column index does not exist in the CSV
[ "Returns", "a", "{", "@code", "List<String", ">", "}", "representing", "a", "single", "0", "-", "indexed", "column", "." ]
train
https://github.com/googleads/googleads-java-lib/blob/967957cc4f6076514e3a7926fe653e4f1f7cc9c9/modules/ads_lib/src/main/java/com/google/api/ads/common/lib/utils/CsvFiles.java#L151-L157
gallandarakhneorg/afc
advanced/gis/gisbus/src/main/java/org/arakhne/afc/gis/bus/network/BusItinerary.java
BusItinerary.addBusHalt
public final BusItineraryHalt addBusHalt(String name, BusItineraryHaltType type) { return addBusHalt(null, name, type); }
java
public final BusItineraryHalt addBusHalt(String name, BusItineraryHaltType type) { return addBusHalt(null, name, type); }
[ "public", "final", "BusItineraryHalt", "addBusHalt", "(", "String", "name", ",", "BusItineraryHaltType", "type", ")", "{", "return", "addBusHalt", "(", "null", ",", "name", ",", "type", ")", ";", "}" ]
Add a bus halt inside the bus itinerary. @param name is the name of the bus halt @param type is the type of the bus halt. @return the added bus halt, otherwise <code>null</code>
[ "Add", "a", "bus", "halt", "inside", "the", "bus", "itinerary", "." ]
train
https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/gis/gisbus/src/main/java/org/arakhne/afc/gis/bus/network/BusItinerary.java#L1053-L1055
RobotiumTech/robotium
robotium-solo/src/main/java/com/robotium/solo/Clicker.java
Clicker.getViewOnAbsListLine
private View getViewOnAbsListLine(AbsListView absListView, int index, int lineIndex){ final long endTime = SystemClock.uptimeMillis() + Timeout.getSmallTimeout(); View view = absListView.getChildAt(lineIndex); while(view == null){ final boolean timedOut = SystemClock.uptimeMillis() > endTime; if (timedOut){ Assert.fail("View is null and can therefore not be clicked!"); } sleeper.sleep(); absListView = (AbsListView) viewFetcher.getIdenticalView(absListView); if(absListView == null){ absListView = waiter.waitForAndGetView(index, AbsListView.class); } view = absListView.getChildAt(lineIndex); } return view; }
java
private View getViewOnAbsListLine(AbsListView absListView, int index, int lineIndex){ final long endTime = SystemClock.uptimeMillis() + Timeout.getSmallTimeout(); View view = absListView.getChildAt(lineIndex); while(view == null){ final boolean timedOut = SystemClock.uptimeMillis() > endTime; if (timedOut){ Assert.fail("View is null and can therefore not be clicked!"); } sleeper.sleep(); absListView = (AbsListView) viewFetcher.getIdenticalView(absListView); if(absListView == null){ absListView = waiter.waitForAndGetView(index, AbsListView.class); } view = absListView.getChildAt(lineIndex); } return view; }
[ "private", "View", "getViewOnAbsListLine", "(", "AbsListView", "absListView", ",", "int", "index", ",", "int", "lineIndex", ")", "{", "final", "long", "endTime", "=", "SystemClock", ".", "uptimeMillis", "(", ")", "+", "Timeout", ".", "getSmallTimeout", "(", ")...
Returns the view in the specified list line @param absListView the ListView to use @param index the index of the list. E.g. Index 1 if two lists are available @param lineIndex the line index of the View @return the View located at a specified list line
[ "Returns", "the", "view", "in", "the", "specified", "list", "line" ]
train
https://github.com/RobotiumTech/robotium/blob/75e567c38f26a6a87dc8bef90b3886a20e28d291/robotium-solo/src/main/java/com/robotium/solo/Clicker.java#L659-L679
zerodhatech/javakiteconnect
kiteconnect/src/com/zerodhatech/kiteconnect/KiteConnect.java
KiteConnect.getHistoricalData
public HistoricalData getHistoricalData(Date from, Date to, String token, String interval, boolean continuous) throws KiteException, IOException, JSONException { SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); Map<String, Object> params = new HashMap<>(); params.put("from", format.format(from)); params.put("to", format.format(to)); params.put("continuous", continuous ? 1 : 0); String url = routes.get("market.historical").replace(":instrument_token", token).replace(":interval", interval); HistoricalData historicalData = new HistoricalData(); historicalData.parseResponse(new KiteRequestHandler(proxy).getRequest(url, params, apiKey, accessToken)); return historicalData; }
java
public HistoricalData getHistoricalData(Date from, Date to, String token, String interval, boolean continuous) throws KiteException, IOException, JSONException { SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); Map<String, Object> params = new HashMap<>(); params.put("from", format.format(from)); params.put("to", format.format(to)); params.put("continuous", continuous ? 1 : 0); String url = routes.get("market.historical").replace(":instrument_token", token).replace(":interval", interval); HistoricalData historicalData = new HistoricalData(); historicalData.parseResponse(new KiteRequestHandler(proxy).getRequest(url, params, apiKey, accessToken)); return historicalData; }
[ "public", "HistoricalData", "getHistoricalData", "(", "Date", "from", ",", "Date", "to", ",", "String", "token", ",", "String", "interval", ",", "boolean", "continuous", ")", "throws", "KiteException", ",", "IOException", ",", "JSONException", "{", "SimpleDateForm...
Retrieves historical data for an instrument. @param from "yyyy-mm-dd" for fetching candles between days and "yyyy-mm-dd hh:mm:ss" for fetching candles between timestamps. @param to "yyyy-mm-dd" for fetching candles between days and "yyyy-mm-dd hh:mm:ss" for fetching candles between timestamps. @param continuous set to true for fetching continuous data of expired instruments. @param interval can be minute, day, 3minute, 5minute, 10minute, 15minute, 30minute, 60minute. @param token is instruments token. @return HistoricalData object which contains list of historical data termed as dataArrayList. @throws KiteException is thrown for all Kite trade related errors. @throws IOException is thrown when there is connection related error.
[ "Retrieves", "historical", "data", "for", "an", "instrument", "." ]
train
https://github.com/zerodhatech/javakiteconnect/blob/4a3f15ff2c8a1b3b6ec61799f8bb047e4dfeb92d/kiteconnect/src/com/zerodhatech/kiteconnect/KiteConnect.java#L595-L606
alkacon/opencms-core
src/org/opencms/main/OpenCmsUrlServletFilter.java
OpenCmsUrlServletFilter.doFilter
public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException { if (m_isInitialized || tryToInitialize()) { if (request instanceof HttpServletRequest) { HttpServletRequest req = (HttpServletRequest)request; String uri = req.getRequestURI(); if (!uri.matches(m_regex)) { String adjustedUri = uri.replaceFirst(m_contextPath + "/", m_servletPath); req.getRequestDispatcher(adjustedUri).forward(request, response); return; } } } chain.doFilter(request, response); }
java
public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException { if (m_isInitialized || tryToInitialize()) { if (request instanceof HttpServletRequest) { HttpServletRequest req = (HttpServletRequest)request; String uri = req.getRequestURI(); if (!uri.matches(m_regex)) { String adjustedUri = uri.replaceFirst(m_contextPath + "/", m_servletPath); req.getRequestDispatcher(adjustedUri).forward(request, response); return; } } } chain.doFilter(request, response); }
[ "public", "void", "doFilter", "(", "ServletRequest", "request", ",", "ServletResponse", "response", ",", "FilterChain", "chain", ")", "throws", "IOException", ",", "ServletException", "{", "if", "(", "m_isInitialized", "||", "tryToInitialize", "(", ")", ")", "{", ...
Adjusts the requested URIs by prepending the name of the {@link org.opencms.main.OpenCmsServlet}, if the request should be handled by that servlet. @see javax.servlet.Filter#doFilter(javax.servlet.ServletRequest, javax.servlet.ServletResponse, javax.servlet.FilterChain)
[ "Adjusts", "the", "requested", "URIs", "by", "prepending", "the", "name", "of", "the", "{", "@link", "org", ".", "opencms", ".", "main", ".", "OpenCmsServlet", "}", "if", "the", "request", "should", "be", "handled", "by", "that", "servlet", "." ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/main/OpenCmsUrlServletFilter.java#L118-L133
exoplatform/jcr
exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/WeightedHighlighter.java
WeightedHighlighter.startFragment
private static int startFragment(StringBuilder sb, String text, int offset, int limit) { if (limit == 0) { // append all sb.append(text.substring(0, offset)); return offset; } String intro = "... "; int start = offset; for (int i = offset - 1; i >= limit; i--) { if (Character.isWhitespace(text.charAt(i))) { // potential start start = i + 1; if (i - 1 >= limit && PUNCTUATION.get(text.charAt(i - 1))) { // start of sentence found intro = ""; break; } } } sb.append(intro).append(text.substring(start, offset)); return offset - start; }
java
private static int startFragment(StringBuilder sb, String text, int offset, int limit) { if (limit == 0) { // append all sb.append(text.substring(0, offset)); return offset; } String intro = "... "; int start = offset; for (int i = offset - 1; i >= limit; i--) { if (Character.isWhitespace(text.charAt(i))) { // potential start start = i + 1; if (i - 1 >= limit && PUNCTUATION.get(text.charAt(i - 1))) { // start of sentence found intro = ""; break; } } } sb.append(intro).append(text.substring(start, offset)); return offset - start; }
[ "private", "static", "int", "startFragment", "(", "StringBuilder", "sb", ",", "String", "text", ",", "int", "offset", ",", "int", "limit", ")", "{", "if", "(", "limit", "==", "0", ")", "{", "// append all", "sb", ".", "append", "(", "text", ".", "subst...
Writes the start of a fragment to the string buffer <code>sb</code>. The first occurrence of a matching term is indicated by the <code>offset</code> into the <code>text</code>. @param sb where to append the start of the fragment. @param text the original text. @param offset the start offset of the first matching term in the fragment. @param limit do not go back further than <code>limit</code>. @return the length of the start fragment that was appended to <code>sb</code>.
[ "Writes", "the", "start", "of", "a", "fragment", "to", "the", "string", "buffer", "<code", ">", "sb<", "/", "code", ">", ".", "The", "first", "occurrence", "of", "a", "matching", "term", "is", "indicated", "by", "the", "<code", ">", "offset<", "/", "co...
train
https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/WeightedHighlighter.java#L228-L254
Azure/azure-sdk-for-java
eventgrid/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/eventgrid/v2019_01_01/implementation/TopicsInner.java
TopicsInner.regenerateKeyAsync
public Observable<TopicSharedAccessKeysInner> regenerateKeyAsync(String resourceGroupName, String topicName, String keyName) { return regenerateKeyWithServiceResponseAsync(resourceGroupName, topicName, keyName).map(new Func1<ServiceResponse<TopicSharedAccessKeysInner>, TopicSharedAccessKeysInner>() { @Override public TopicSharedAccessKeysInner call(ServiceResponse<TopicSharedAccessKeysInner> response) { return response.body(); } }); }
java
public Observable<TopicSharedAccessKeysInner> regenerateKeyAsync(String resourceGroupName, String topicName, String keyName) { return regenerateKeyWithServiceResponseAsync(resourceGroupName, topicName, keyName).map(new Func1<ServiceResponse<TopicSharedAccessKeysInner>, TopicSharedAccessKeysInner>() { @Override public TopicSharedAccessKeysInner call(ServiceResponse<TopicSharedAccessKeysInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "TopicSharedAccessKeysInner", ">", "regenerateKeyAsync", "(", "String", "resourceGroupName", ",", "String", "topicName", ",", "String", "keyName", ")", "{", "return", "regenerateKeyWithServiceResponseAsync", "(", "resourceGroupName", ",", "top...
Regenerate key for a topic. Regenerate a shared access key for a topic. @param resourceGroupName The name of the resource group within the user's subscription. @param topicName Name of the topic @param keyName Key name to regenerate key1 or key2 @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the TopicSharedAccessKeysInner object
[ "Regenerate", "key", "for", "a", "topic", ".", "Regenerate", "a", "shared", "access", "key", "for", "a", "topic", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/eventgrid/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/eventgrid/v2019_01_01/implementation/TopicsInner.java#L1196-L1203
TheHortonMachine/hortonmachine
gears/src/main/java/org/hortonmachine/gears/io/geopaparazzi/geopap4/DaoImages.java
DaoImages.getImagesList
public static List<Image> getImagesList( IHMConnection connection ) throws Exception { List<Image> images = new ArrayList<Image>(); String sql = "select " + // ImageTableFields.COLUMN_ID.getFieldName() + "," + // ImageTableFields.COLUMN_LON.getFieldName() + "," + // ImageTableFields.COLUMN_LAT.getFieldName() + "," + // ImageTableFields.COLUMN_ALTIM.getFieldName() + "," + // ImageTableFields.COLUMN_TS.getFieldName() + "," + // ImageTableFields.COLUMN_AZIM.getFieldName() + "," + // ImageTableFields.COLUMN_TEXT.getFieldName() + "," + // ImageTableFields.COLUMN_NOTE_ID.getFieldName() + "," + // ImageTableFields.COLUMN_IMAGEDATA_ID.getFieldName() + // " from " + TABLE_IMAGES; try (IHMStatement statement = connection.createStatement(); IHMResultSet rs = statement.executeQuery(sql);) { statement.setQueryTimeout(30); // set timeout to 30 sec. while( rs.next() ) { long id = rs.getLong(1); double lon = rs.getDouble(2); double lat = rs.getDouble(3); double altim = rs.getDouble(4); long ts = rs.getLong(5); double azim = rs.getDouble(6); String text = rs.getString(7); long noteId = rs.getLong(8); long imageDataId = rs.getLong(9); Image image = new Image(id, text, lon, lat, altim, azim, imageDataId, noteId, ts); images.add(image); } } return images; }
java
public static List<Image> getImagesList( IHMConnection connection ) throws Exception { List<Image> images = new ArrayList<Image>(); String sql = "select " + // ImageTableFields.COLUMN_ID.getFieldName() + "," + // ImageTableFields.COLUMN_LON.getFieldName() + "," + // ImageTableFields.COLUMN_LAT.getFieldName() + "," + // ImageTableFields.COLUMN_ALTIM.getFieldName() + "," + // ImageTableFields.COLUMN_TS.getFieldName() + "," + // ImageTableFields.COLUMN_AZIM.getFieldName() + "," + // ImageTableFields.COLUMN_TEXT.getFieldName() + "," + // ImageTableFields.COLUMN_NOTE_ID.getFieldName() + "," + // ImageTableFields.COLUMN_IMAGEDATA_ID.getFieldName() + // " from " + TABLE_IMAGES; try (IHMStatement statement = connection.createStatement(); IHMResultSet rs = statement.executeQuery(sql);) { statement.setQueryTimeout(30); // set timeout to 30 sec. while( rs.next() ) { long id = rs.getLong(1); double lon = rs.getDouble(2); double lat = rs.getDouble(3); double altim = rs.getDouble(4); long ts = rs.getLong(5); double azim = rs.getDouble(6); String text = rs.getString(7); long noteId = rs.getLong(8); long imageDataId = rs.getLong(9); Image image = new Image(id, text, lon, lat, altim, azim, imageDataId, noteId, ts); images.add(image); } } return images; }
[ "public", "static", "List", "<", "Image", ">", "getImagesList", "(", "IHMConnection", "connection", ")", "throws", "Exception", "{", "List", "<", "Image", ">", "images", "=", "new", "ArrayList", "<", "Image", ">", "(", ")", ";", "String", "sql", "=", "\"...
Get the list of Images from the db. @return list of notes. @throws IOException if something goes wrong.
[ "Get", "the", "list", "of", "Images", "from", "the", "db", "." ]
train
https://github.com/TheHortonMachine/hortonmachine/blob/d2b436bbdf951dc1fda56096a42dbc0eae4d35a5/gears/src/main/java/org/hortonmachine/gears/io/geopaparazzi/geopap4/DaoImages.java#L205-L238
spring-projects/spring-boot
spring-boot-project/spring-boot-tools/spring-boot-configuration-processor/src/json-shade/java/org/springframework/boot/configurationprocessor/json/JSONObject.java
JSONObject.accumulate
public JSONObject accumulate(String name, Object value) throws JSONException { Object current = this.nameValuePairs.get(checkName(name)); if (current == null) { return put(name, value); } // check in accumulate, since array.put(Object) doesn't do any checking if (value instanceof Number) { JSON.checkDouble(((Number) value).doubleValue()); } if (current instanceof JSONArray) { JSONArray array = (JSONArray) current; array.put(value); } else { JSONArray array = new JSONArray(); array.put(current); array.put(value); this.nameValuePairs.put(name, array); } return this; }
java
public JSONObject accumulate(String name, Object value) throws JSONException { Object current = this.nameValuePairs.get(checkName(name)); if (current == null) { return put(name, value); } // check in accumulate, since array.put(Object) doesn't do any checking if (value instanceof Number) { JSON.checkDouble(((Number) value).doubleValue()); } if (current instanceof JSONArray) { JSONArray array = (JSONArray) current; array.put(value); } else { JSONArray array = new JSONArray(); array.put(current); array.put(value); this.nameValuePairs.put(name, array); } return this; }
[ "public", "JSONObject", "accumulate", "(", "String", "name", ",", "Object", "value", ")", "throws", "JSONException", "{", "Object", "current", "=", "this", ".", "nameValuePairs", ".", "get", "(", "checkName", "(", "name", ")", ")", ";", "if", "(", "current...
Appends {@code value} to the array already mapped to {@code name}. If this object has no mapping for {@code name}, this inserts a new mapping. If the mapping exists but its value is not an array, the existing and new values are inserted in order into a new array which is itself mapped to {@code name}. In aggregate, this allows values to be added to a mapping one at a time. @param name the name of the property @param value a {@link JSONObject}, {@link JSONArray}, String, Boolean, Integer, Long, Double, {@link #NULL} or null. May not be {@link Double#isNaN() NaNs} or {@link Double#isInfinite() infinities}. @return this object. @throws JSONException if an error occurs
[ "Appends", "{" ]
train
https://github.com/spring-projects/spring-boot/blob/0b27f7c70e164b2b1a96477f1d9c1acba56790c1/spring-boot-project/spring-boot-tools/spring-boot-configuration-processor/src/json-shade/java/org/springframework/boot/configurationprocessor/json/JSONObject.java#L304-L326
protegeproject/jpaul
src/main/java/jpaul/DataStructs/UnionFind.java
UnionFind.union
public E union(E e1, E e2) { Node<E> node1 = _get_or_create_root_set(e1); Node<E> node2 = _get_or_create_root_set(e2); return _link(node1, node2).element; }
java
public E union(E e1, E e2) { Node<E> node1 = _get_or_create_root_set(e1); Node<E> node2 = _get_or_create_root_set(e2); return _link(node1, node2).element; }
[ "public", "E", "union", "(", "E", "e1", ",", "E", "e2", ")", "{", "Node", "<", "E", ">", "node1", "=", "_get_or_create_root_set", "(", "e1", ")", ";", "Node", "<", "E", ">", "node2", "=", "_get_or_create_root_set", "(", "e2", ")", ";", "return", "_...
Unifies the elements <code>e1</code> and <code>e2</code> and returns the representative of the resulting equivalence class.
[ "Unifies", "the", "elements", "<code", ">", "e1<", "/", "code", ">", "and", "<code", ">", "e2<", "/", "code", ">", "and", "returns", "the", "representative", "of", "the", "resulting", "equivalence", "class", "." ]
train
https://github.com/protegeproject/jpaul/blob/db579ffb16faaa4b0c577ec82c246f7349427714/src/main/java/jpaul/DataStructs/UnionFind.java#L51-L55
rometools/rome
rome/src/main/java/com/rometools/rome/io/impl/DateParser.java
DateParser.formatRFC822
public static String formatRFC822(final Date date, final Locale locale) { final SimpleDateFormat dateFormater = new SimpleDateFormat("EEE, dd MMM yyyy HH:mm:ss 'GMT'", locale); dateFormater.setTimeZone(TimeZone.getTimeZone("GMT")); return dateFormater.format(date); }
java
public static String formatRFC822(final Date date, final Locale locale) { final SimpleDateFormat dateFormater = new SimpleDateFormat("EEE, dd MMM yyyy HH:mm:ss 'GMT'", locale); dateFormater.setTimeZone(TimeZone.getTimeZone("GMT")); return dateFormater.format(date); }
[ "public", "static", "String", "formatRFC822", "(", "final", "Date", "date", ",", "final", "Locale", "locale", ")", "{", "final", "SimpleDateFormat", "dateFormater", "=", "new", "SimpleDateFormat", "(", "\"EEE, dd MMM yyyy HH:mm:ss 'GMT'\"", ",", "locale", ")", ";", ...
create a RFC822 representation of a date. <p/> Refer to the java.text.SimpleDateFormat javadocs for details on the format of each element. <p/> @param date Date to parse @return the RFC822 represented by the given Date It returns <b>null</b> if it was not possible to parse the date.
[ "create", "a", "RFC822", "representation", "of", "a", "date", ".", "<p", "/", ">", "Refer", "to", "the", "java", ".", "text", ".", "SimpleDateFormat", "javadocs", "for", "details", "on", "the", "format", "of", "each", "element", ".", "<p", "/", ">" ]
train
https://github.com/rometools/rome/blob/5fcf0b1a9a6cdedbe253a45ad9468c54a0f97010/rome/src/main/java/com/rometools/rome/io/impl/DateParser.java#L251-L255
Omertron/api-themoviedb
src/main/java/com/omertron/themoviedbapi/methods/TmdbChanges.java
TmdbChanges.getChangeList
public ResultList<ChangeListItem> getChangeList(MethodBase method, Integer page, String startDate, String endDate) throws MovieDbException { TmdbParameters params = new TmdbParameters(); params.add(Param.PAGE, page); params.add(Param.START_DATE, startDate); params.add(Param.END_DATE, endDate); URL url = new ApiUrl(apiKey, method).subMethod(MethodSub.CHANGES).buildUrl(params); WrapperGenericList<ChangeListItem> wrapper = processWrapper(getTypeReference(ChangeListItem.class), url, "changes"); return wrapper.getResultsList(); }
java
public ResultList<ChangeListItem> getChangeList(MethodBase method, Integer page, String startDate, String endDate) throws MovieDbException { TmdbParameters params = new TmdbParameters(); params.add(Param.PAGE, page); params.add(Param.START_DATE, startDate); params.add(Param.END_DATE, endDate); URL url = new ApiUrl(apiKey, method).subMethod(MethodSub.CHANGES).buildUrl(params); WrapperGenericList<ChangeListItem> wrapper = processWrapper(getTypeReference(ChangeListItem.class), url, "changes"); return wrapper.getResultsList(); }
[ "public", "ResultList", "<", "ChangeListItem", ">", "getChangeList", "(", "MethodBase", "method", ",", "Integer", "page", ",", "String", "startDate", ",", "String", "endDate", ")", "throws", "MovieDbException", "{", "TmdbParameters", "params", "=", "new", "TmdbPar...
Get a list of Media IDs that have been edited. You can then use the movie/TV/person changes API to get the actual data that has been changed. @param method The method base to get @param page @param startDate the start date of the changes, optional @param endDate the end date of the changes, optional @return List of changed movie @throws MovieDbException
[ "Get", "a", "list", "of", "Media", "IDs", "that", "have", "been", "edited", "." ]
train
https://github.com/Omertron/api-themoviedb/blob/bf132d7c7271734e13b58ba3bc92bba46f220118/src/main/java/com/omertron/themoviedbapi/methods/TmdbChanges.java#L63-L72
canoo/dolphin-platform
platform/dolphin-platform-core/src/main/java/com/canoo/dp/impl/platform/core/commons/lang/TypeUtils.java
TypeUtils.getTypeArguments
private static Map<TypeVariable<?>, Type> getTypeArguments(final ParameterizedType type) { return getTypeArguments(type, getRawType(type), null); }
java
private static Map<TypeVariable<?>, Type> getTypeArguments(final ParameterizedType type) { return getTypeArguments(type, getRawType(type), null); }
[ "private", "static", "Map", "<", "TypeVariable", "<", "?", ">", ",", "Type", ">", "getTypeArguments", "(", "final", "ParameterizedType", "type", ")", "{", "return", "getTypeArguments", "(", "type", ",", "getRawType", "(", "type", ")", ",", "null", ")", ";"...
<p>Retrieves all the type arguments for this parameterized type including owner hierarchy arguments such as {@code Outer<K,V>.Inner<T>.DeepInner<E>} . The arguments are returned in a {@link Map} specifying the argument type for each {@link TypeVariable}. </p> @param type specifies the subject parameterized type from which to harvest the parameters. @return a {@code Map} of the type arguments to their respective type variables.
[ "<p", ">", "Retrieves", "all", "the", "type", "arguments", "for", "this", "parameterized", "type", "including", "owner", "hierarchy", "arguments", "such", "as", "{", "@code", "Outer<K", "V", ">", ".", "Inner<T", ">", ".", "DeepInner<E", ">", "}", ".", "The...
train
https://github.com/canoo/dolphin-platform/blob/fb99c1fab24df80d2fa094d8688b546140146874/platform/dolphin-platform-core/src/main/java/com/canoo/dp/impl/platform/core/commons/lang/TypeUtils.java#L680-L682
Azure/azure-sdk-for-java
kusto/resource-manager/v2018_09_07_preview/src/main/java/com/microsoft/azure/management/kusto/v2018_09_07_preview/implementation/EventHubConnectionsInner.java
EventHubConnectionsInner.createOrUpdateAsync
public Observable<EventHubConnectionInner> createOrUpdateAsync(String resourceGroupName, String clusterName, String databaseName, String eventHubConnectionName, EventHubConnectionInner parameters) { return createOrUpdateWithServiceResponseAsync(resourceGroupName, clusterName, databaseName, eventHubConnectionName, parameters).map(new Func1<ServiceResponse<EventHubConnectionInner>, EventHubConnectionInner>() { @Override public EventHubConnectionInner call(ServiceResponse<EventHubConnectionInner> response) { return response.body(); } }); }
java
public Observable<EventHubConnectionInner> createOrUpdateAsync(String resourceGroupName, String clusterName, String databaseName, String eventHubConnectionName, EventHubConnectionInner parameters) { return createOrUpdateWithServiceResponseAsync(resourceGroupName, clusterName, databaseName, eventHubConnectionName, parameters).map(new Func1<ServiceResponse<EventHubConnectionInner>, EventHubConnectionInner>() { @Override public EventHubConnectionInner call(ServiceResponse<EventHubConnectionInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "EventHubConnectionInner", ">", "createOrUpdateAsync", "(", "String", "resourceGroupName", ",", "String", "clusterName", ",", "String", "databaseName", ",", "String", "eventHubConnectionName", ",", "EventHubConnectionInner", "parameters", ")", ...
Creates or updates a Event Hub connection. @param resourceGroupName The name of the resource group containing the Kusto cluster. @param clusterName The name of the Kusto cluster. @param databaseName The name of the database in the Kusto cluster. @param eventHubConnectionName The name of the event hub connection. @param parameters The Event Hub connection parameters supplied to the CreateOrUpdate operation. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable for the request
[ "Creates", "or", "updates", "a", "Event", "Hub", "connection", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/kusto/resource-manager/v2018_09_07_preview/src/main/java/com/microsoft/azure/management/kusto/v2018_09_07_preview/implementation/EventHubConnectionsInner.java#L444-L451
Esri/geometry-api-java
src/main/java/com/esri/core/geometry/Transformation2D.java
Transformation2D.setFlipY
public void setFlipY(double y0, double y1) { xx = 1; xy = 0; xd = 0; yx = 0; yy = -1; yd = y0 + y1; }
java
public void setFlipY(double y0, double y1) { xx = 1; xy = 0; xd = 0; yx = 0; yy = -1; yd = y0 + y1; }
[ "public", "void", "setFlipY", "(", "double", "y0", ",", "double", "y1", ")", "{", "xx", "=", "1", ";", "xy", "=", "0", ";", "xd", "=", "0", ";", "yx", "=", "0", ";", "yy", "=", "-", "1", ";", "yd", "=", "y0", "+", "y1", ";", "}" ]
Sets the transformation to be a flip around the Y axis. Flips the Y coordinates so that the y0 becomes y1 and vice verse. @param y0 The Y coordinate to flip. @param y1 The Y coordinate to flip to.
[ "Sets", "the", "transformation", "to", "be", "a", "flip", "around", "the", "Y", "axis", ".", "Flips", "the", "Y", "coordinates", "so", "that", "the", "y0", "becomes", "y1", "and", "vice", "verse", "." ]
train
https://github.com/Esri/geometry-api-java/blob/494da8ec953d76e7c6072afbc081abfe48ff07cf/src/main/java/com/esri/core/geometry/Transformation2D.java#L641-L648
infinispan/infinispan
core/src/main/java/org/infinispan/io/GridFile.java
GridFile.isChildOf
protected static boolean isChildOf(String parent, String child) { if (parent == null || child == null) return false; if (!child.startsWith((parent.endsWith(SEPARATOR) ? parent : parent + SEPARATOR))) return false; if (child.length() <= parent.length()) return false; int from = parent.equals(SEPARATOR) ? parent.length() : parent.length() + 1; // if(from-1 > child.length()) // return false; String[] comps = Util.components(child.substring(from), SEPARATOR); return comps != null && comps.length <= 1; }
java
protected static boolean isChildOf(String parent, String child) { if (parent == null || child == null) return false; if (!child.startsWith((parent.endsWith(SEPARATOR) ? parent : parent + SEPARATOR))) return false; if (child.length() <= parent.length()) return false; int from = parent.equals(SEPARATOR) ? parent.length() : parent.length() + 1; // if(from-1 > child.length()) // return false; String[] comps = Util.components(child.substring(from), SEPARATOR); return comps != null && comps.length <= 1; }
[ "protected", "static", "boolean", "isChildOf", "(", "String", "parent", ",", "String", "child", ")", "{", "if", "(", "parent", "==", "null", "||", "child", "==", "null", ")", "return", "false", ";", "if", "(", "!", "child", ".", "startsWith", "(", "(",...
Verifies whether child is a child (dir or file) of parent @param parent @param child @return True if child is a child, false otherwise
[ "Verifies", "whether", "child", "is", "a", "child", "(", "dir", "or", "file", ")", "of", "parent" ]
train
https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/core/src/main/java/org/infinispan/io/GridFile.java#L351-L363
wildfly/wildfly-core
host-controller/src/main/java/org/jboss/as/host/controller/jvm/JvmType.java
JvmType.createFromSystemProperty
public static JvmType createFromSystemProperty(boolean forLaunch) { final String javaHome = WildFlySecurityManager.getPropertyPrivileged(JAVA_HOME_SYS_PROP, null); return createFromJavaHome(javaHome, forLaunch); }
java
public static JvmType createFromSystemProperty(boolean forLaunch) { final String javaHome = WildFlySecurityManager.getPropertyPrivileged(JAVA_HOME_SYS_PROP, null); return createFromJavaHome(javaHome, forLaunch); }
[ "public", "static", "JvmType", "createFromSystemProperty", "(", "boolean", "forLaunch", ")", "{", "final", "String", "javaHome", "=", "WildFlySecurityManager", ".", "getPropertyPrivileged", "(", "JAVA_HOME_SYS_PROP", ",", "null", ")", ";", "return", "createFromJavaHome"...
Create a {@code JvmType} based on the location of the root dir of the JRE/JDK installation, as specified by the system property {@code java.home}. @param forLaunch {@code true} if the created object will be used for launching servers; {@code false} if it is simply a data holder. A value of {@code true} will disable some validity checks and may disable determining if the JVM is modular @return the {@code JvmType}. Will not return {@code null}
[ "Create", "a", "{" ]
train
https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/host-controller/src/main/java/org/jboss/as/host/controller/jvm/JvmType.java#L162-L165