repository_name
stringlengths
7
58
func_path_in_repository
stringlengths
18
192
func_name
stringlengths
5
108
whole_func_string
stringlengths
75
3.91k
language
stringclasses
1 value
func_code_string
stringlengths
75
3.91k
func_code_tokens
listlengths
21
629
func_documentation_string
stringlengths
61
1.98k
func_documentation_tokens
listlengths
1
647
split_name
stringclasses
1 value
func_code_url
stringlengths
111
306
nguillaumin/slick2d-maven
slick2d-core/src/main/java/org/newdawn/slick/UnicodeFont.java
UnicodeFont.createFont
private static Font createFont (String ttfFileRef) throws SlickException { try { return Font.createFont(Font.TRUETYPE_FONT, ResourceLoader.getResourceAsStream(ttfFileRef)); } catch (FontFormatException ex) { throw new SlickException("Invalid font: " + ttfFileRef, ex); } catch (IOException ex) { throw new SlickException("Error reading font: " + ttfFileRef, ex); } }
java
private static Font createFont (String ttfFileRef) throws SlickException { try { return Font.createFont(Font.TRUETYPE_FONT, ResourceLoader.getResourceAsStream(ttfFileRef)); } catch (FontFormatException ex) { throw new SlickException("Invalid font: " + ttfFileRef, ex); } catch (IOException ex) { throw new SlickException("Error reading font: " + ttfFileRef, ex); } }
[ "private", "static", "Font", "createFont", "(", "String", "ttfFileRef", ")", "throws", "SlickException", "{", "try", "{", "return", "Font", ".", "createFont", "(", "Font", ".", "TRUETYPE_FONT", ",", "ResourceLoader", ".", "getResourceAsStream", "(", "ttfFileRef", ...
Utility to create a Java font for a TTF file reference @param ttfFileRef The file system or classpath location of the TrueTypeFont file. @return The font created @throws SlickException Indicates a failure to locate or load the font into Java's font system.
[ "Utility", "to", "create", "a", "Java", "font", "for", "a", "TTF", "file", "reference" ]
train
https://github.com/nguillaumin/slick2d-maven/blob/8251f88a0ed6a70e726d2468842455cd1f80893f/slick2d-core/src/main/java/org/newdawn/slick/UnicodeFont.java#L59-L67
windup/windup
rules-java/api/src/main/java/org/jboss/windup/rules/apps/java/scan/provider/DiscoverMavenProjectsRuleProvider.java
DiscoverMavenProjectsRuleProvider.getMavenStubProject
private MavenProjectModel getMavenStubProject(MavenProjectService mavenProjectService, String groupId, String artifactId, String version) { Iterable<MavenProjectModel> mavenProjectModels = mavenProjectService.findByGroupArtifactVersion(groupId, artifactId, version); if (!mavenProjectModels.iterator().hasNext()) { return null; } for (MavenProjectModel mavenProjectModel : mavenProjectModels) { if (mavenProjectModel.getRootFileModel() == null) { // this is a stub... we can fill it in with details return mavenProjectModel; } } return null; }
java
private MavenProjectModel getMavenStubProject(MavenProjectService mavenProjectService, String groupId, String artifactId, String version) { Iterable<MavenProjectModel> mavenProjectModels = mavenProjectService.findByGroupArtifactVersion(groupId, artifactId, version); if (!mavenProjectModels.iterator().hasNext()) { return null; } for (MavenProjectModel mavenProjectModel : mavenProjectModels) { if (mavenProjectModel.getRootFileModel() == null) { // this is a stub... we can fill it in with details return mavenProjectModel; } } return null; }
[ "private", "MavenProjectModel", "getMavenStubProject", "(", "MavenProjectService", "mavenProjectService", ",", "String", "groupId", ",", "String", "artifactId", ",", "String", "version", ")", "{", "Iterable", "<", "MavenProjectModel", ">", "mavenProjectModels", "=", "ma...
A Maven stub is a Maven Project for which we have found information, but the project has not yet been located within the input application. If we have found an application of the same GAV within the input app, we should fill out this stub instead of creating a new one.
[ "A", "Maven", "stub", "is", "a", "Maven", "Project", "for", "which", "we", "have", "found", "information", "but", "the", "project", "has", "not", "yet", "been", "located", "within", "the", "input", "application", ".", "If", "we", "have", "found", "an", "...
train
https://github.com/windup/windup/blob/6668f09e7f012d24a0b4212ada8809417225b2ad/rules-java/api/src/main/java/org/jboss/windup/rules/apps/java/scan/provider/DiscoverMavenProjectsRuleProvider.java#L401-L417
apache/flink
flink-core/src/main/java/org/apache/flink/util/IOUtils.java
IOUtils.readFully
public static void readFully(final InputStream in, final byte[] buf, int off, final int len) throws IOException { int toRead = len; while (toRead > 0) { final int ret = in.read(buf, off, toRead); if (ret < 0) { throw new IOException("Premeture EOF from inputStream"); } toRead -= ret; off += ret; } }
java
public static void readFully(final InputStream in, final byte[] buf, int off, final int len) throws IOException { int toRead = len; while (toRead > 0) { final int ret = in.read(buf, off, toRead); if (ret < 0) { throw new IOException("Premeture EOF from inputStream"); } toRead -= ret; off += ret; } }
[ "public", "static", "void", "readFully", "(", "final", "InputStream", "in", ",", "final", "byte", "[", "]", "buf", ",", "int", "off", ",", "final", "int", "len", ")", "throws", "IOException", "{", "int", "toRead", "=", "len", ";", "while", "(", "toRead...
Reads len bytes in a loop. @param in The InputStream to read from @param buf The buffer to fill @param off offset from the buffer @param len the length of bytes to read @throws IOException if it could not read requested number of bytes for any reason (including EOF)
[ "Reads", "len", "bytes", "in", "a", "loop", "." ]
train
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-core/src/main/java/org/apache/flink/util/IOUtils.java#L129-L140
versionone/VersionOne.SDK.Java.ObjectModel
src/main/java/com/versionone/om/Entity.java
Entity.getMultiRelation
<T extends Entity> EntityCollection<T> getMultiRelation(String name) { return getMultiRelation(name, true); }
java
<T extends Entity> EntityCollection<T> getMultiRelation(String name) { return getMultiRelation(name, true); }
[ "<", "T", "extends", "Entity", ">", "EntityCollection", "<", "T", ">", "getMultiRelation", "(", "String", "name", ")", "{", "return", "getMultiRelation", "(", "name", ",", "true", ")", ";", "}" ]
Get a multi-value relation by name for this entity. @param name Name of the relation attribute. @return IEntityCollection of T.
[ "Get", "a", "multi", "-", "value", "relation", "by", "name", "for", "this", "entity", "." ]
train
https://github.com/versionone/VersionOne.SDK.Java.ObjectModel/blob/59d35b67c849299631bca45ee94143237eb2ae1a/src/main/java/com/versionone/om/Entity.java#L240-L242
PeterisP/LVTagger
src/main/java/edu/stanford/nlp/io/IOUtils.java
IOUtils.readReaderFromString
public static BufferedReader readReaderFromString(String textFileOrUrl, String encoding) throws IOException { InputStream is = getInputStreamFromURLOrClasspathOrFileSystem(textFileOrUrl); return new BufferedReader(new InputStreamReader(is, encoding)); }
java
public static BufferedReader readReaderFromString(String textFileOrUrl, String encoding) throws IOException { InputStream is = getInputStreamFromURLOrClasspathOrFileSystem(textFileOrUrl); return new BufferedReader(new InputStreamReader(is, encoding)); }
[ "public", "static", "BufferedReader", "readReaderFromString", "(", "String", "textFileOrUrl", ",", "String", "encoding", ")", "throws", "IOException", "{", "InputStream", "is", "=", "getInputStreamFromURLOrClasspathOrFileSystem", "(", "textFileOrUrl", ")", ";", "return", ...
Open a BufferedReader to a file or URL specified by a String name. If the String starts with https?://, then it is interpreted as a URL, otherwise it is interpreted as a local file. If the String ends in .gz, it is interpreted as a gzipped file (and uncompressed), else it is interpreted as a regular text file in the given encoding. @param textFileOrUrl What to read from @param encoding CharSet encoding @return The BufferedReader @throws IOException If there is an I/O problem
[ "Open", "a", "BufferedReader", "to", "a", "file", "or", "URL", "specified", "by", "a", "String", "name", ".", "If", "the", "String", "starts", "with", "https?", ":", "//", "then", "it", "is", "interpreted", "as", "a", "URL", "otherwise", "it", "is", "i...
train
https://github.com/PeterisP/LVTagger/blob/b3d44bab9ec07ace0d13612c448a6b7298c1f681/src/main/java/edu/stanford/nlp/io/IOUtils.java#L465-L469
Azure/azure-sdk-for-java
edgegateway/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/edgegateway/v2019_03_01/implementation/BandwidthSchedulesInner.java
BandwidthSchedulesInner.getAsync
public Observable<BandwidthScheduleInner> getAsync(String deviceName, String name, String resourceGroupName) { return getWithServiceResponseAsync(deviceName, name, resourceGroupName).map(new Func1<ServiceResponse<BandwidthScheduleInner>, BandwidthScheduleInner>() { @Override public BandwidthScheduleInner call(ServiceResponse<BandwidthScheduleInner> response) { return response.body(); } }); }
java
public Observable<BandwidthScheduleInner> getAsync(String deviceName, String name, String resourceGroupName) { return getWithServiceResponseAsync(deviceName, name, resourceGroupName).map(new Func1<ServiceResponse<BandwidthScheduleInner>, BandwidthScheduleInner>() { @Override public BandwidthScheduleInner call(ServiceResponse<BandwidthScheduleInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "BandwidthScheduleInner", ">", "getAsync", "(", "String", "deviceName", ",", "String", "name", ",", "String", "resourceGroupName", ")", "{", "return", "getWithServiceResponseAsync", "(", "deviceName", ",", "name", ",", "resourceGroupName",...
Gets the properties of the specified bandwidth schedule. @param deviceName The device name. @param name The bandwidth schedule name. @param resourceGroupName The resource group name. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the BandwidthScheduleInner object
[ "Gets", "the", "properties", "of", "the", "specified", "bandwidth", "schedule", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/edgegateway/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/edgegateway/v2019_03_01/implementation/BandwidthSchedulesInner.java#L255-L262
moparisthebest/beehive
beehive-ejb-control/src/main/java/org/apache/beehive/controls/system/ejb/internal/EJBJarDescriptorHandler.java
EJBJarDescriptorHandler.insertEJBRefInEJBJar
private void insertEJBRefInEJBJar(Element ejb, EJBInfo ei, String ejbLinkValue, Document ejbDoc) { List ejbRefArray = DomUtils.getChildElementsByName(ejb, "ejb-ref"); String insertedEjbRefName = ei.getRefName(); Node nextSibling = null; for (int j = ejbRefArray.size() - 1; j >= 0; j--) { Element ejbRef = (Element) ejbRefArray.get(j); String ejbRefName = DomUtils.getChildElementText(ejbRef, "ejb-ref-name"); if (insertedEjbRefName.equals(ejbRefName)) { nextSibling = ejbRef.getNextSibling(); ejb.removeChild(ejbRef); break; } } // insert a new <ejb-ref> entry and fill in the values Element insertedEjbRef = ejbDoc.createElement("ejb-ref"); if (nextSibling != null) { ejb.insertBefore(insertedEjbRef, nextSibling); } else { ejb.insertBefore(insertedEjbRef, findEjbRefInsertPoint(ejb)); } Element ejbRefName = ejbDoc.createElement("ejb-ref-name"); ejbRefName.setTextContent(insertedEjbRefName); insertedEjbRef.appendChild(ejbRefName); Element ejbRefType = ejbDoc.createElement("ejb-ref-type"); ejbRefType.setTextContent(ei.getBeanType()); insertedEjbRef.appendChild(ejbRefType); Element homeType = ejbDoc.createElement("home"); homeType.setTextContent(ei.getHomeInterface().getName()); insertedEjbRef.appendChild(homeType); Element remoteType = ejbDoc.createElement("remote"); remoteType.setTextContent(ei.getBeanInterface().getName()); insertedEjbRef.appendChild(remoteType); Element ejbLink = ejbDoc.createElement("ejb-link"); ejbLink.setTextContent(ejbLinkValue); insertedEjbRef.appendChild(ejbLink); }
java
private void insertEJBRefInEJBJar(Element ejb, EJBInfo ei, String ejbLinkValue, Document ejbDoc) { List ejbRefArray = DomUtils.getChildElementsByName(ejb, "ejb-ref"); String insertedEjbRefName = ei.getRefName(); Node nextSibling = null; for (int j = ejbRefArray.size() - 1; j >= 0; j--) { Element ejbRef = (Element) ejbRefArray.get(j); String ejbRefName = DomUtils.getChildElementText(ejbRef, "ejb-ref-name"); if (insertedEjbRefName.equals(ejbRefName)) { nextSibling = ejbRef.getNextSibling(); ejb.removeChild(ejbRef); break; } } // insert a new <ejb-ref> entry and fill in the values Element insertedEjbRef = ejbDoc.createElement("ejb-ref"); if (nextSibling != null) { ejb.insertBefore(insertedEjbRef, nextSibling); } else { ejb.insertBefore(insertedEjbRef, findEjbRefInsertPoint(ejb)); } Element ejbRefName = ejbDoc.createElement("ejb-ref-name"); ejbRefName.setTextContent(insertedEjbRefName); insertedEjbRef.appendChild(ejbRefName); Element ejbRefType = ejbDoc.createElement("ejb-ref-type"); ejbRefType.setTextContent(ei.getBeanType()); insertedEjbRef.appendChild(ejbRefType); Element homeType = ejbDoc.createElement("home"); homeType.setTextContent(ei.getHomeInterface().getName()); insertedEjbRef.appendChild(homeType); Element remoteType = ejbDoc.createElement("remote"); remoteType.setTextContent(ei.getBeanInterface().getName()); insertedEjbRef.appendChild(remoteType); Element ejbLink = ejbDoc.createElement("ejb-link"); ejbLink.setTextContent(ejbLinkValue); insertedEjbRef.appendChild(ejbLink); }
[ "private", "void", "insertEJBRefInEJBJar", "(", "Element", "ejb", ",", "EJBInfo", "ei", ",", "String", "ejbLinkValue", ",", "Document", "ejbDoc", ")", "{", "List", "ejbRefArray", "=", "DomUtils", ".", "getChildElementsByName", "(", "ejb", ",", "\"ejb-ref\"", ")"...
Insert a remote ejb-ref into the specified EJB's descriptor, if an ejb-ref already exists with the same name, remove it before adding a new ref. @param ejb Root DOM element of the EJB descriptor. @param ei EJBInfo helper. @param ejbLinkValue New ejb-link value. @param ejbDoc The ejb-jar DOM root.
[ "Insert", "a", "remote", "ejb", "-", "ref", "into", "the", "specified", "EJB", "s", "descriptor", "if", "an", "ejb", "-", "ref", "already", "exists", "with", "the", "same", "name", "remove", "it", "before", "adding", "a", "new", "ref", "." ]
train
https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-ejb-control/src/main/java/org/apache/beehive/controls/system/ejb/internal/EJBJarDescriptorHandler.java#L111-L155
rollbar/rollbar-java
rollbar-android/src/main/java/com/rollbar/android/Rollbar.java
Rollbar.reportMessage
@Deprecated public static void reportMessage(final String message, final String level) { reportMessage(message, level, null); }
java
@Deprecated public static void reportMessage(final String message, final String level) { reportMessage(message, level, null); }
[ "@", "Deprecated", "public", "static", "void", "reportMessage", "(", "final", "String", "message", ",", "final", "String", "level", ")", "{", "reportMessage", "(", "message", ",", "level", ",", "null", ")", ";", "}" ]
Report a message to Rollbar, specifying the level. @param message the message to send. @param level the severity level.
[ "Report", "a", "message", "to", "Rollbar", "specifying", "the", "level", "." ]
train
https://github.com/rollbar/rollbar-java/blob/5eb4537d1363722b51cfcce55b427cbd8489f17b/rollbar-android/src/main/java/com/rollbar/android/Rollbar.java#L871-L874
kuali/kc-s2sgen
coeus-s2sgen-impl/src/main/java/org/kuali/coeus/s2sgen/impl/generate/support/RRSubAwardBudget10_30_1_4V1_4Generator.java
RRSubAwardBudget10_30_1_4V1_4Generator.getFormObject
@Override public RRSubawardBudget103014Document getFormObject(ProposalDevelopmentDocumentContract proposalDevelopmentDocument) { pdDoc = proposalDevelopmentDocument; try { return getRRSubawardBudgetDocument(); } catch (IOException | XmlException e) { throw new S2SException("RRSubawardBudgetDocument could not be created ", e); } }
java
@Override public RRSubawardBudget103014Document getFormObject(ProposalDevelopmentDocumentContract proposalDevelopmentDocument) { pdDoc = proposalDevelopmentDocument; try { return getRRSubawardBudgetDocument(); } catch (IOException | XmlException e) { throw new S2SException("RRSubawardBudgetDocument could not be created ", e); } }
[ "@", "Override", "public", "RRSubawardBudget103014Document", "getFormObject", "(", "ProposalDevelopmentDocumentContract", "proposalDevelopmentDocument", ")", "{", "pdDoc", "=", "proposalDevelopmentDocument", ";", "try", "{", "return", "getRRSubawardBudgetDocument", "(", ")", ...
This method creates {@link XmlObject} of type {@link RRSubawardBudget103014Document} by populating data from the given {@link ProposalDevelopmentDocumentContract} @param proposalDevelopmentDocument for which the {@link XmlObject} needs to be created @return {@link XmlObject} which is generated using the given {@link ProposalDevelopmentDocumentContract}
[ "This", "method", "creates", "{", "@link", "XmlObject", "}", "of", "type", "{", "@link", "RRSubawardBudget103014Document", "}", "by", "populating", "data", "from", "the", "given", "{", "@link", "ProposalDevelopmentDocumentContract", "}" ]
train
https://github.com/kuali/kc-s2sgen/blob/2886380e1e3cb8bdd732ba99b2afa6ffc630bb37/coeus-s2sgen-impl/src/main/java/org/kuali/coeus/s2sgen/impl/generate/support/RRSubAwardBudget10_30_1_4V1_4Generator.java#L239-L247
Ordinastie/MalisisCore
src/main/java/net/malisis/core/renderer/animation/transformation/PositionTransform.java
PositionTransform.doTransform
@Override protected void doTransform(Position<T> transformable, float comp) { int fromX = reversed ? this.toX : this.fromX; int toX = reversed ? this.fromX : this.toX; int fromY = reversed ? this.toY : this.fromY; int toY = reversed ? this.fromY : this.toY; int x = Math.round(fromX + (toX - fromX) * comp); int y = Math.round(fromY + (toY - fromY) * comp); transformable.setPosition(x, y); }
java
@Override protected void doTransform(Position<T> transformable, float comp) { int fromX = reversed ? this.toX : this.fromX; int toX = reversed ? this.fromX : this.toX; int fromY = reversed ? this.toY : this.fromY; int toY = reversed ? this.fromY : this.toY; int x = Math.round(fromX + (toX - fromX) * comp); int y = Math.round(fromY + (toY - fromY) * comp); transformable.setPosition(x, y); }
[ "@", "Override", "protected", "void", "doTransform", "(", "Position", "<", "T", ">", "transformable", ",", "float", "comp", ")", "{", "int", "fromX", "=", "reversed", "?", "this", ".", "toX", ":", "this", ".", "fromX", ";", "int", "toX", "=", "reversed...
Calculates the transformation @param transformable the transformable @param comp the comp
[ "Calculates", "the", "transformation" ]
train
https://github.com/Ordinastie/MalisisCore/blob/4f8e1fa462d5c372fc23414482ba9f429881cc54/src/main/java/net/malisis/core/renderer/animation/transformation/PositionTransform.java#L100-L112
Azure/azure-sdk-for-java
keyvault/data-plane/azure-keyvault/src/main/java/com/microsoft/azure/keyvault/implementation/KeyVaultClientBaseImpl.java
KeyVaultClientBaseImpl.getKey
public KeyBundle getKey(String vaultBaseUrl, String keyName, String keyVersion) { return getKeyWithServiceResponseAsync(vaultBaseUrl, keyName, keyVersion).toBlocking().single().body(); }
java
public KeyBundle getKey(String vaultBaseUrl, String keyName, String keyVersion) { return getKeyWithServiceResponseAsync(vaultBaseUrl, keyName, keyVersion).toBlocking().single().body(); }
[ "public", "KeyBundle", "getKey", "(", "String", "vaultBaseUrl", ",", "String", "keyName", ",", "String", "keyVersion", ")", "{", "return", "getKeyWithServiceResponseAsync", "(", "vaultBaseUrl", ",", "keyName", ",", "keyVersion", ")", ".", "toBlocking", "(", ")", ...
Gets the public part of a stored key. The get key operation is applicable to all key types. If the requested key is symmetric, then no key material is released in the response. This operation requires the keys/get permission. @param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net. @param keyName The name of the key to get. @param keyVersion Adding the version parameter retrieves a specific version of a key. @throws IllegalArgumentException thrown if parameters fail the validation @throws KeyVaultErrorException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent @return the KeyBundle object if successful.
[ "Gets", "the", "public", "part", "of", "a", "stored", "key", ".", "The", "get", "key", "operation", "is", "applicable", "to", "all", "key", "types", ".", "If", "the", "requested", "key", "is", "symmetric", "then", "no", "key", "material", "is", "released...
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/keyvault/data-plane/azure-keyvault/src/main/java/com/microsoft/azure/keyvault/implementation/KeyVaultClientBaseImpl.java#L1385-L1387
liuyukuai/commons
commons-core/src/main/java/com/itxiaoer/commons/core/date/LocalDateUtil.java
LocalDateUtil.addDays
public static LocalDate addDays(String localDate, long days) { LocalDate parse = parse(localDate, DEFAULT_PATTERN); return parse.plusDays(days); }
java
public static LocalDate addDays(String localDate, long days) { LocalDate parse = parse(localDate, DEFAULT_PATTERN); return parse.plusDays(days); }
[ "public", "static", "LocalDate", "addDays", "(", "String", "localDate", ",", "long", "days", ")", "{", "LocalDate", "parse", "=", "parse", "(", "localDate", ",", "DEFAULT_PATTERN", ")", ";", "return", "parse", ".", "plusDays", "(", "days", ")", ";", "}" ]
addDays @param localDate 时间 @param days 天数 @return localDate
[ "addDays" ]
train
https://github.com/liuyukuai/commons/blob/ba67eddb542446b12f419f1866dbaa82e47fbf35/commons-core/src/main/java/com/itxiaoer/commons/core/date/LocalDateUtil.java#L95-L98
stackify/stackify-api-java
src/main/java/com/stackify/api/common/lang/Throwables.java
Throwables.toErrorItem
public static ErrorItem toErrorItem(final String logMessage, final Throwable t) { // get a flat list of the throwable and the causal chain List<Throwable> throwables = Throwables.getCausalChain(t); // create and populate builders for all throwables List<ErrorItem.Builder> builders = new ArrayList<ErrorItem.Builder>(throwables.size()); for (int i = 0; i < throwables.size(); ++i) { if (i == 0) { ErrorItem.Builder builder = toErrorItemBuilderWithoutCause(logMessage, throwables.get(i)); builders.add(builder); } else { ErrorItem.Builder builder = toErrorItemBuilderWithoutCause(null, throwables.get(i)); builders.add(builder); } } // attach child errors to their parent in reverse order for (int i = builders.size() - 1; 0 < i; --i) { ErrorItem.Builder parent = builders.get(i - 1); ErrorItem.Builder child = builders.get(i); parent.innerError(child.build()); } // return the assembled original error return builders.get(0).build(); }
java
public static ErrorItem toErrorItem(final String logMessage, final Throwable t) { // get a flat list of the throwable and the causal chain List<Throwable> throwables = Throwables.getCausalChain(t); // create and populate builders for all throwables List<ErrorItem.Builder> builders = new ArrayList<ErrorItem.Builder>(throwables.size()); for (int i = 0; i < throwables.size(); ++i) { if (i == 0) { ErrorItem.Builder builder = toErrorItemBuilderWithoutCause(logMessage, throwables.get(i)); builders.add(builder); } else { ErrorItem.Builder builder = toErrorItemBuilderWithoutCause(null, throwables.get(i)); builders.add(builder); } } // attach child errors to their parent in reverse order for (int i = builders.size() - 1; 0 < i; --i) { ErrorItem.Builder parent = builders.get(i - 1); ErrorItem.Builder child = builders.get(i); parent.innerError(child.build()); } // return the assembled original error return builders.get(0).build(); }
[ "public", "static", "ErrorItem", "toErrorItem", "(", "final", "String", "logMessage", ",", "final", "Throwable", "t", ")", "{", "// get a flat list of the throwable and the causal chain", "List", "<", "Throwable", ">", "throwables", "=", "Throwables", ".", "getCausalCha...
Converts a Throwable to an ErrorItem @param logMessage The log message (can be null) @param t The Throwable to be converted @return The ErrorItem
[ "Converts", "a", "Throwable", "to", "an", "ErrorItem" ]
train
https://github.com/stackify/stackify-api-java/blob/d3000b7c87ed53a88b302939b0c88405d63d7b67/src/main/java/com/stackify/api/common/lang/Throwables.java#L60-L92
Hygieia/Hygieia
api-audit/src/main/java/com/capitalone/dashboard/common/CommonCodeReview.java
CommonCodeReview.checkForServiceAccount
public static boolean checkForServiceAccount(String userLdapDN, ApiSettings settings,Map<String,String> allowedUsers,String author,List<String> commitFiles,boolean isCommit,AuditReviewResponse auditReviewResponse) { List<String> serviceAccountOU = settings.getServiceAccountOU(); boolean isValid = false; if(!MapUtils.isEmpty(allowedUsers) && isCommit){ isValid = isValidServiceAccount(author,allowedUsers,commitFiles); if(isValid){ auditReviewResponse.addAuditStatus(CodeReviewAuditStatus.DIRECT_COMMIT_CHANGE_WHITELISTED_ACCOUNT); } } if (!CollectionUtils.isEmpty(serviceAccountOU) && StringUtils.isNotBlank(userLdapDN) && !isValid) { try { String userLdapDNParsed = LdapUtils.getStringValue(new LdapName(userLdapDN), "OU"); List<String> matches = serviceAccountOU.stream().filter(it -> it.contains(userLdapDNParsed)).collect(Collectors.toList()); isValid = CollectionUtils.isNotEmpty(matches); } catch (InvalidNameException e) { LOGGER.error("Error parsing LDAP DN:" + userLdapDN); } } else { LOGGER.info("API Settings missing service account RDN"); } return isValid; }
java
public static boolean checkForServiceAccount(String userLdapDN, ApiSettings settings,Map<String,String> allowedUsers,String author,List<String> commitFiles,boolean isCommit,AuditReviewResponse auditReviewResponse) { List<String> serviceAccountOU = settings.getServiceAccountOU(); boolean isValid = false; if(!MapUtils.isEmpty(allowedUsers) && isCommit){ isValid = isValidServiceAccount(author,allowedUsers,commitFiles); if(isValid){ auditReviewResponse.addAuditStatus(CodeReviewAuditStatus.DIRECT_COMMIT_CHANGE_WHITELISTED_ACCOUNT); } } if (!CollectionUtils.isEmpty(serviceAccountOU) && StringUtils.isNotBlank(userLdapDN) && !isValid) { try { String userLdapDNParsed = LdapUtils.getStringValue(new LdapName(userLdapDN), "OU"); List<String> matches = serviceAccountOU.stream().filter(it -> it.contains(userLdapDNParsed)).collect(Collectors.toList()); isValid = CollectionUtils.isNotEmpty(matches); } catch (InvalidNameException e) { LOGGER.error("Error parsing LDAP DN:" + userLdapDN); } } else { LOGGER.info("API Settings missing service account RDN"); } return isValid; }
[ "public", "static", "boolean", "checkForServiceAccount", "(", "String", "userLdapDN", ",", "ApiSettings", "settings", ",", "Map", "<", "String", ",", "String", ">", "allowedUsers", ",", "String", "author", ",", "List", "<", "String", ">", "commitFiles", ",", "...
Check if the passed in account is a Service Account or not by comparing against list of valid ServiceAccountOU in ApiSettings. @param userLdapDN @param settings @return
[ "Check", "if", "the", "passed", "in", "account", "is", "a", "Service", "Account", "or", "not", "by", "comparing", "against", "list", "of", "valid", "ServiceAccountOU", "in", "ApiSettings", "." ]
train
https://github.com/Hygieia/Hygieia/blob/d8b67a590da2744acf59bcd99d9b34ef1bb84890/api-audit/src/main/java/com/capitalone/dashboard/common/CommonCodeReview.java#L160-L182
OpenLiberty/open-liberty
dev/com.ibm.ws.security.social/src/com/ibm/ws/security/social/twitter/TwitterEndpointServices.java
TwitterEndpointServices.evaluateVerifyCredentialsResponse
public Map<String, Object> evaluateVerifyCredentialsResponse(String responseBody) { String endpoint = TwitterConstants.TWITTER_ENDPOINT_VERIFY_CREDENTIALS; Map<String, Object> responseValues = null; try { responseValues = populateJsonResponse(responseBody); } catch (JoseException e) { return createErrorResponse("TWITTER_RESPONSE_NOT_JSON", new Object[] { endpoint, e.getLocalizedMessage(), responseBody }); } Map<String, Object> result = checkForEmptyResponse(endpoint, responseBody, responseValues); if (result != null) { return result; } // Ensure response contains email result = checkForRequiredParameters(endpoint, responseValues, TwitterConstants.RESPONSE_EMAIL); if (result != null) { return result; } responseValues.put(TwitterConstants.RESULT_RESPONSE_STATUS, TwitterConstants.RESULT_SUCCESS); return responseValues; }
java
public Map<String, Object> evaluateVerifyCredentialsResponse(String responseBody) { String endpoint = TwitterConstants.TWITTER_ENDPOINT_VERIFY_CREDENTIALS; Map<String, Object> responseValues = null; try { responseValues = populateJsonResponse(responseBody); } catch (JoseException e) { return createErrorResponse("TWITTER_RESPONSE_NOT_JSON", new Object[] { endpoint, e.getLocalizedMessage(), responseBody }); } Map<String, Object> result = checkForEmptyResponse(endpoint, responseBody, responseValues); if (result != null) { return result; } // Ensure response contains email result = checkForRequiredParameters(endpoint, responseValues, TwitterConstants.RESPONSE_EMAIL); if (result != null) { return result; } responseValues.put(TwitterConstants.RESULT_RESPONSE_STATUS, TwitterConstants.RESULT_SUCCESS); return responseValues; }
[ "public", "Map", "<", "String", ",", "Object", ">", "evaluateVerifyCredentialsResponse", "(", "String", "responseBody", ")", "{", "String", "endpoint", "=", "TwitterConstants", ".", "TWITTER_ENDPOINT_VERIFY_CREDENTIALS", ";", "Map", "<", "String", ",", "Object", ">"...
Evaluate the response from the {@value TwitterConstants#TWITTER_ENDPOINT_VERIFY_CREDENTIALS} endpoint. This checks the status code of the response and ensures that an email value is contained in the response. @param responseBody @return
[ "Evaluate", "the", "response", "from", "the", "{", "@value", "TwitterConstants#TWITTER_ENDPOINT_VERIFY_CREDENTIALS", "}", "endpoint", ".", "This", "checks", "the", "status", "code", "of", "the", "response", "and", "ensures", "that", "an", "email", "value", "is", "...
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.security.social/src/com/ibm/ws/security/social/twitter/TwitterEndpointServices.java#L749-L772
podio/podio-java
src/main/java/com/podio/contact/ContactAPI.java
ContactAPI.updateSpaceContact
public void updateSpaceContact(int profileId, ContactUpdate update, boolean silent, boolean hook) { getResourceFactory().getApiResource("/contact/" + profileId) .queryParam("silent", silent ? "1" : "0") .queryParam("hook", hook ? "1" : "0") .entity(update, MediaType.APPLICATION_JSON_TYPE).put(); }
java
public void updateSpaceContact(int profileId, ContactUpdate update, boolean silent, boolean hook) { getResourceFactory().getApiResource("/contact/" + profileId) .queryParam("silent", silent ? "1" : "0") .queryParam("hook", hook ? "1" : "0") .entity(update, MediaType.APPLICATION_JSON_TYPE).put(); }
[ "public", "void", "updateSpaceContact", "(", "int", "profileId", ",", "ContactUpdate", "update", ",", "boolean", "silent", ",", "boolean", "hook", ")", "{", "getResourceFactory", "(", ")", ".", "getApiResource", "(", "\"/contact/\"", "+", "profileId", ")", ".", ...
Updates the entire space contact. Only fields which have values specified will be updated. To delete the contents of a field, pass an empty array for the value. @param profileId The id of the space contact to be updated @param update The data for the update @param silent True if the update should be silent, false otherwise @param hook True if hooks should be executed for the change, false otherwise
[ "Updates", "the", "entire", "space", "contact", ".", "Only", "fields", "which", "have", "values", "specified", "will", "be", "updated", ".", "To", "delete", "the", "contents", "of", "a", "field", "pass", "an", "empty", "array", "for", "the", "value", "." ]
train
https://github.com/podio/podio-java/blob/a520b23bac118c957ce02cdd8ff42a6c7d17b49a/src/main/java/com/podio/contact/ContactAPI.java#L61-L66
nakamura5akihito/six-util
src/main/java/jp/go/aist/six/util/core/xml/spring327/AbstractMarshaller.java
AbstractMarshaller.marshalStreamResult
protected void marshalStreamResult(Object graph, StreamResult streamResult) throws XmlMappingException, IOException { if (streamResult.getOutputStream() != null) { marshalOutputStream(graph, streamResult.getOutputStream()); } else if (streamResult.getWriter() != null) { marshalWriter(graph, streamResult.getWriter()); } else { throw new IllegalArgumentException("StreamResult contains neither OutputStream nor Writer"); } }
java
protected void marshalStreamResult(Object graph, StreamResult streamResult) throws XmlMappingException, IOException { if (streamResult.getOutputStream() != null) { marshalOutputStream(graph, streamResult.getOutputStream()); } else if (streamResult.getWriter() != null) { marshalWriter(graph, streamResult.getWriter()); } else { throw new IllegalArgumentException("StreamResult contains neither OutputStream nor Writer"); } }
[ "protected", "void", "marshalStreamResult", "(", "Object", "graph", ",", "StreamResult", "streamResult", ")", "throws", "XmlMappingException", ",", "IOException", "{", "if", "(", "streamResult", ".", "getOutputStream", "(", ")", "!=", "null", ")", "{", "marshalOut...
Template method for handling {@code StreamResult}s. <p>This implementation delegates to {@code marshalOutputStream} or {@code marshalWriter}, depending on what is contained in the {@code StreamResult} @param graph the root of the object graph to marshal @param streamResult the {@code StreamResult} @throws IOException if an I/O Exception occurs @throws XmlMappingException if the given object cannot be marshalled to the result @throws IllegalArgumentException if {@code streamResult} does neither contain an {@code OutputStream} nor a {@code Writer}
[ "Template", "method", "for", "handling", "{" ]
train
https://github.com/nakamura5akihito/six-util/blob/a6db388a345e220cea2b1fa6324d15c80c6278b6/src/main/java/jp/go/aist/six/util/core/xml/spring327/AbstractMarshaller.java#L265-L277
Netflix/conductor
mysql-persistence/src/main/java/com/netflix/conductor/dao/mysql/MySQLBaseDAO.java
MySQLBaseDAO.queryWithTransaction
protected <R> R queryWithTransaction(String query, QueryFunction<R> function) { return getWithTransaction(tx -> query(tx, query, function)); }
java
protected <R> R queryWithTransaction(String query, QueryFunction<R> function) { return getWithTransaction(tx -> query(tx, query, function)); }
[ "protected", "<", "R", ">", "R", "queryWithTransaction", "(", "String", "query", ",", "QueryFunction", "<", "R", ">", "function", ")", "{", "return", "getWithTransaction", "(", "tx", "->", "query", "(", "tx", ",", "query", ",", "function", ")", ")", ";",...
Initiate a new transaction and execute a {@link Query} within that context, then return the results of {@literal function}. @param query The query string to prepare. @param function The functional callback to pass a {@link Query} to. @param <R> The expected return type of {@literal function}. @return The results of applying {@literal function}.
[ "Initiate", "a", "new", "transaction", "and", "execute", "a", "{", "@link", "Query", "}", "within", "that", "context", "then", "return", "the", "results", "of", "{", "@literal", "function", "}", "." ]
train
https://github.com/Netflix/conductor/blob/78fae0ed9ddea22891f9eebb96a2ec0b2783dca0/mysql-persistence/src/main/java/com/netflix/conductor/dao/mysql/MySQLBaseDAO.java#L167-L169
alkacon/opencms-core
src/org/opencms/main/CmsShellCommands.java
CmsShellCommands.importResources
public void importResources(String importFile, String importPath) throws Exception { CmsImportParameters params = new CmsImportParameters( OpenCms.getSystemInfo().getAbsoluteRfsPathRelativeToWebInf(importFile), importPath, true); OpenCms.getImportExportManager().importData( m_cms, new CmsShellReport(m_cms.getRequestContext().getLocale()), params); }
java
public void importResources(String importFile, String importPath) throws Exception { CmsImportParameters params = new CmsImportParameters( OpenCms.getSystemInfo().getAbsoluteRfsPathRelativeToWebInf(importFile), importPath, true); OpenCms.getImportExportManager().importData( m_cms, new CmsShellReport(m_cms.getRequestContext().getLocale()), params); }
[ "public", "void", "importResources", "(", "String", "importFile", ",", "String", "importPath", ")", "throws", "Exception", "{", "CmsImportParameters", "params", "=", "new", "CmsImportParameters", "(", "OpenCms", ".", "getSystemInfo", "(", ")", ".", "getAbsoluteRfsPa...
Imports a resource into the Cms.<p> @param importFile the name (absolute Path) of the import resource (zip or folder) @param importPath the name (absolute Path) of folder in which should be imported @throws Exception if something goes wrong
[ "Imports", "a", "resource", "into", "the", "Cms", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/main/CmsShellCommands.java#L912-L923
wso2/transport-http
components/org.wso2.transport.http.netty/src/main/java/org/wso2/transport/http/netty/contractimpl/common/Util.java
Util.getSystemVariableValue
private static String getSystemVariableValue(String variableName, String defaultValue) { String value; if (System.getProperty(variableName) != null) { value = System.getProperty(variableName); } else if (System.getenv(variableName) != null) { value = System.getenv(variableName); } else { value = defaultValue; } return value; }
java
private static String getSystemVariableValue(String variableName, String defaultValue) { String value; if (System.getProperty(variableName) != null) { value = System.getProperty(variableName); } else if (System.getenv(variableName) != null) { value = System.getenv(variableName); } else { value = defaultValue; } return value; }
[ "private", "static", "String", "getSystemVariableValue", "(", "String", "variableName", ",", "String", "defaultValue", ")", "{", "String", "value", ";", "if", "(", "System", ".", "getProperty", "(", "variableName", ")", "!=", "null", ")", "{", "value", "=", ...
A utility which allows reading variables from the environment or System properties. If the variable in available in the environment as well as a System property, the System property takes precedence. @param variableName System/environment variable name @param defaultValue default value to be returned if the specified system variable is not specified. @return value of the system/environment variable
[ "A", "utility", "which", "allows", "reading", "variables", "from", "the", "environment", "or", "System", "properties", ".", "If", "the", "variable", "in", "available", "in", "the", "environment", "as", "well", "as", "a", "System", "property", "the", "System", ...
train
https://github.com/wso2/transport-http/blob/c51aa715b473db6c1b82a7d7b22f6e65f74df4c9/components/org.wso2.transport.http.netty/src/main/java/org/wso2/transport/http/netty/contractimpl/common/Util.java#L556-L566
tvesalainen/util
util/src/main/java/org/vesalainen/net/ExceptionParser.java
ExceptionParser.brokenConnection
public static final Level brokenConnection(Level level, Throwable thr) { if (thr instanceof EOFException) { return level; } if (thr instanceof ClosedChannelException) { return level; } if ((thr instanceof IOException) && ( "Broken pipe".equals(thr.getMessage()) || "Connection reset by peer".equals(thr.getMessage()) ) ) { return level; } if ((thr instanceof ConnectException) && ( "Connection timed out".equals(thr.getMessage()) || "Connection refused".equals(thr.getMessage()) ) ) { return level; } Throwable cause = thr.getCause(); if (cause != null) { return brokenConnection(level, cause); } return Level.SEVERE; }
java
public static final Level brokenConnection(Level level, Throwable thr) { if (thr instanceof EOFException) { return level; } if (thr instanceof ClosedChannelException) { return level; } if ((thr instanceof IOException) && ( "Broken pipe".equals(thr.getMessage()) || "Connection reset by peer".equals(thr.getMessage()) ) ) { return level; } if ((thr instanceof ConnectException) && ( "Connection timed out".equals(thr.getMessage()) || "Connection refused".equals(thr.getMessage()) ) ) { return level; } Throwable cause = thr.getCause(); if (cause != null) { return brokenConnection(level, cause); } return Level.SEVERE; }
[ "public", "static", "final", "Level", "brokenConnection", "(", "Level", "level", ",", "Throwable", "thr", ")", "{", "if", "(", "thr", "instanceof", "EOFException", ")", "{", "return", "level", ";", "}", "if", "(", "thr", "instanceof", "ClosedChannelException",...
Tries to detect if Throwable is caused by broken connection. If detected returns level, else return SEVERE. @param level @param thr @return
[ "Tries", "to", "detect", "if", "Throwable", "is", "caused", "by", "broken", "connection", ".", "If", "detected", "returns", "level", "else", "return", "SEVERE", "." ]
train
https://github.com/tvesalainen/util/blob/bba7a44689f638ffabc8be40a75bdc9a33676433/util/src/main/java/org/vesalainen/net/ExceptionParser.java#L38-L70
graknlabs/grakn
server/src/server/kb/concept/TypeImpl.java
TypeImpl.addInstance
V addInstance(Schema.BaseType instanceBaseType, BiFunction<VertexElement, T, V> producer, boolean isInferred) { preCheckForInstanceCreation(); if (isAbstract()) throw TransactionException.addingInstancesToAbstractType(this); VertexElement instanceVertex = vertex().tx().addVertexElement(instanceBaseType); vertex().tx().ruleCache().ackTypeInstance(this); if (!Schema.MetaSchema.isMetaLabel(label())) { vertex().tx().cache().addedInstance(id()); if (isInferred) instanceVertex.property(Schema.VertexProperty.IS_INFERRED, true); } V instance = producer.apply(instanceVertex, getThis()); assert instance != null : "producer should never return null"; return instance; }
java
V addInstance(Schema.BaseType instanceBaseType, BiFunction<VertexElement, T, V> producer, boolean isInferred) { preCheckForInstanceCreation(); if (isAbstract()) throw TransactionException.addingInstancesToAbstractType(this); VertexElement instanceVertex = vertex().tx().addVertexElement(instanceBaseType); vertex().tx().ruleCache().ackTypeInstance(this); if (!Schema.MetaSchema.isMetaLabel(label())) { vertex().tx().cache().addedInstance(id()); if (isInferred) instanceVertex.property(Schema.VertexProperty.IS_INFERRED, true); } V instance = producer.apply(instanceVertex, getThis()); assert instance != null : "producer should never return null"; return instance; }
[ "V", "addInstance", "(", "Schema", ".", "BaseType", "instanceBaseType", ",", "BiFunction", "<", "VertexElement", ",", "T", ",", "V", ">", "producer", ",", "boolean", "isInferred", ")", "{", "preCheckForInstanceCreation", "(", ")", ";", "if", "(", "isAbstract",...
Utility method used to create an instance of this type @param instanceBaseType The base type of the instances of this type @param producer The factory method to produce the instance @return A new instance
[ "Utility", "method", "used", "to", "create", "an", "instance", "of", "this", "type" ]
train
https://github.com/graknlabs/grakn/blob/6aaee75ea846202474d591f8809d62028262fac5/server/src/server/kb/concept/TypeImpl.java#L92-L108
paypal/SeLion
client/src/main/java/com/paypal/selion/internal/platform/grid/LocalSelendroidNode.java
LocalSelendroidNode.checkAndValidateParameters
private void checkAndValidateParameters(ConfigProperty configProperty) { LOGGER.entering(configProperty); try { switch (configProperty) { case SELENDROID_SERVER_START_TIMEOUT: case SELENDROID_EMULATOR_START_TIMEOUT: { // Selendroid takes timeoutEmulatorStart/serverStartTimeout in milliseconds. Config.getIntConfigProperty(configProperty); break; } case MOBILE_DRIVER_SESSION_TIMEOUT: { // Selendroid takes sessionTimeout in seconds. int receivedValue = Config.getIntConfigProperty(configProperty) / 1000; if (receivedValue == 0) { String errorMessage = "Insufficient value received for configuration property " + configProperty.getName() + ", probably value is less than 1000 milliseconds."; throw new IllegalArgumentException(errorMessage); } break; } default: { throw new IllegalArgumentException( "Invalid selendroid configuration received for validation, configuration property = " + configProperty.getName()); } } } catch (ConversionException exe) { String errorMessage = "Invalid data received for configuration property " + configProperty.getName() + ", probably not an integer for milliseconds."; throw new IllegalArgumentException(errorMessage, exe); } LOGGER.exiting(); }
java
private void checkAndValidateParameters(ConfigProperty configProperty) { LOGGER.entering(configProperty); try { switch (configProperty) { case SELENDROID_SERVER_START_TIMEOUT: case SELENDROID_EMULATOR_START_TIMEOUT: { // Selendroid takes timeoutEmulatorStart/serverStartTimeout in milliseconds. Config.getIntConfigProperty(configProperty); break; } case MOBILE_DRIVER_SESSION_TIMEOUT: { // Selendroid takes sessionTimeout in seconds. int receivedValue = Config.getIntConfigProperty(configProperty) / 1000; if (receivedValue == 0) { String errorMessage = "Insufficient value received for configuration property " + configProperty.getName() + ", probably value is less than 1000 milliseconds."; throw new IllegalArgumentException(errorMessage); } break; } default: { throw new IllegalArgumentException( "Invalid selendroid configuration received for validation, configuration property = " + configProperty.getName()); } } } catch (ConversionException exe) { String errorMessage = "Invalid data received for configuration property " + configProperty.getName() + ", probably not an integer for milliseconds."; throw new IllegalArgumentException(errorMessage, exe); } LOGGER.exiting(); }
[ "private", "void", "checkAndValidateParameters", "(", "ConfigProperty", "configProperty", ")", "{", "LOGGER", ".", "entering", "(", "configProperty", ")", ";", "try", "{", "switch", "(", "configProperty", ")", "{", "case", "SELENDROID_SERVER_START_TIMEOUT", ":", "ca...
/* Checks the presence of selendroid specific parameters provided by the user and validates them. IllegalArgumentException is thrown if the parameter is either insufficient or irrelevant. Throws a NullPointerException if the received configProperty is null. @param configProperty a SeLion {@link ConfigProperty} to validate
[ "/", "*", "Checks", "the", "presence", "of", "selendroid", "specific", "parameters", "provided", "by", "the", "user", "and", "validates", "them", ".", "IllegalArgumentException", "is", "thrown", "if", "the", "parameter", "is", "either", "insufficient", "or", "ir...
train
https://github.com/paypal/SeLion/blob/694d12d0df76db48d0360b16192770c6a4fbdfd2/client/src/main/java/com/paypal/selion/internal/platform/grid/LocalSelendroidNode.java#L149-L182
landawn/AbacusUtil
src/com/landawn/abacus/util/Array.java
Array.bucketSort
static void bucketSort(final Object[] a, final int fromIndex, final int toIndex) { bucketSort(a, fromIndex, toIndex, null); }
java
static void bucketSort(final Object[] a, final int fromIndex, final int toIndex) { bucketSort(a, fromIndex, toIndex, null); }
[ "static", "void", "bucketSort", "(", "final", "Object", "[", "]", "a", ",", "final", "int", "fromIndex", ",", "final", "int", "toIndex", ")", "{", "bucketSort", "(", "a", ",", "fromIndex", ",", "toIndex", ",", "null", ")", ";", "}" ]
Note: All the objects with same value will be replaced with first element with the same value. @param a the elements in the array must implements the <code>Comparable</code> interface. @param fromIndex @param toIndex
[ "Note", ":", "All", "the", "objects", "with", "same", "value", "will", "be", "replaced", "with", "first", "element", "with", "the", "same", "value", "." ]
train
https://github.com/landawn/AbacusUtil/blob/544b7720175d15e9329f83dd22a8cc5fa4515e12/src/com/landawn/abacus/util/Array.java#L3088-L3090
westnordost/osmapi
src/main/java/de/westnordost/osmapi/map/MapDataDao.java
MapDataDao.uploadChanges
public void uploadChanges(long changesetId, Iterable<Element> elements, Handler<DiffElement> handler) { MapDataDiffParser parser = null; if(handler != null) { parser = new MapDataDiffParser(handler); } osm.makeAuthenticatedRequest( "changeset/" + changesetId + "/upload", "POST", new MapDataChangesWriter(changesetId, elements), parser ); }
java
public void uploadChanges(long changesetId, Iterable<Element> elements, Handler<DiffElement> handler) { MapDataDiffParser parser = null; if(handler != null) { parser = new MapDataDiffParser(handler); } osm.makeAuthenticatedRequest( "changeset/" + changesetId + "/upload", "POST", new MapDataChangesWriter(changesetId, elements), parser ); }
[ "public", "void", "uploadChanges", "(", "long", "changesetId", ",", "Iterable", "<", "Element", ">", "elements", ",", "Handler", "<", "DiffElement", ">", "handler", ")", "{", "MapDataDiffParser", "parser", "=", "null", ";", "if", "(", "handler", "!=", "null"...
Upload changes into an opened changeset. @param elements elements to upload. No special order required @param handler handler that processes the server's diffResult response. Optional. @throws OsmNotFoundException if the changeset does not exist (yet) or an element in the does not exist @throws OsmConflictException if the changeset has already been closed, there is a conflict for the elements being uploaded or the user who created the changeset is not the same as the one uploading the change @throws OsmAuthorizationException if the application does not have permission to edit the map (Permission.MODIFY_MAP)
[ "Upload", "changes", "into", "an", "opened", "changeset", "." ]
train
https://github.com/westnordost/osmapi/blob/dda6978fd12e117d0cf17812bc22037f61e22c4b/src/main/java/de/westnordost/osmapi/map/MapDataDao.java#L112-L124
apache/reef
lang/java/reef-common/src/main/java/org/apache/reef/util/ThreadLogger.java
ThreadLogger.logThreads
public static void logThreads(final Logger logger, final Level level, final String prefix) { logThreads(logger, level, prefix, "\n\t", "\n\t\t"); }
java
public static void logThreads(final Logger logger, final Level level, final String prefix) { logThreads(logger, level, prefix, "\n\t", "\n\t\t"); }
[ "public", "static", "void", "logThreads", "(", "final", "Logger", "logger", ",", "final", "Level", "level", ",", "final", "String", "prefix", ")", "{", "logThreads", "(", "logger", ",", "level", ",", "prefix", ",", "\"\\n\\t\"", ",", "\"\\n\\t\\t\"", ")", ...
Same as <code>logThreads(logger, level, prefix, "\n\t", "\n\t\t")</code>.
[ "Same", "as", "<code", ">", "logThreads", "(", "logger", "level", "prefix", "\\", "n", "\\", "t", "\\", "n", "\\", "t", "\\", "t", ")", "<", "/", "code", ">", "." ]
train
https://github.com/apache/reef/blob/e2c47121cde21108a602c560cf76565a40d0e916/lang/java/reef-common/src/main/java/org/apache/reef/util/ThreadLogger.java#L44-L46
landawn/AbacusUtil
src/com/landawn/abacus/util/Array.java
Array.bucketSort
static <T> void bucketSort(final List<? extends T> c, final Comparator<? super T> cmp) { if (N.isNullOrEmpty(c)) { return; } bucketSort(c, 0, c.size(), cmp); }
java
static <T> void bucketSort(final List<? extends T> c, final Comparator<? super T> cmp) { if (N.isNullOrEmpty(c)) { return; } bucketSort(c, 0, c.size(), cmp); }
[ "static", "<", "T", ">", "void", "bucketSort", "(", "final", "List", "<", "?", "extends", "T", ">", "c", ",", "final", "Comparator", "<", "?", "super", "T", ">", "cmp", ")", "{", "if", "(", "N", ".", "isNullOrEmpty", "(", "c", ")", ")", "{", "r...
Note: All the objects with same value will be replaced with first element with the same value. @param c @param cmp
[ "Note", ":", "All", "the", "objects", "with", "same", "value", "will", "be", "replaced", "with", "first", "element", "with", "the", "same", "value", "." ]
train
https://github.com/landawn/AbacusUtil/blob/544b7720175d15e9329f83dd22a8cc5fa4515e12/src/com/landawn/abacus/util/Array.java#L3171-L3177
Bandwidth/java-bandwidth
src/main/java/com/bandwidth/sdk/model/Call.java
Call.create
public static Call create(final String to, final String from, final String callbackUrl, final String tag) throws Exception { assert(to != null && from != null); final Map<String, Object> params = new HashMap<String, Object>(); params.put("to", to); params.put("from", from); params.put("callbackUrl", callbackUrl); params.put("tag", tag); final Call call = create(params); return call; }
java
public static Call create(final String to, final String from, final String callbackUrl, final String tag) throws Exception { assert(to != null && from != null); final Map<String, Object> params = new HashMap<String, Object>(); params.put("to", to); params.put("from", from); params.put("callbackUrl", callbackUrl); params.put("tag", tag); final Call call = create(params); return call; }
[ "public", "static", "Call", "create", "(", "final", "String", "to", ",", "final", "String", "from", ",", "final", "String", "callbackUrl", ",", "final", "String", "tag", ")", "throws", "Exception", "{", "assert", "(", "to", "!=", "null", "&&", "from", "!...
Convenience method to dials a call from a phone number to a phone number @param to the to number @param from the from number @param callbackUrl the callback URL @param tag the call tag @return the call @throws IOException unexpected error.
[ "Convenience", "method", "to", "dials", "a", "call", "from", "a", "phone", "number", "to", "a", "phone", "number" ]
train
https://github.com/Bandwidth/java-bandwidth/blob/2124c85148ad6a54d2f2949cb952eb3985830e2a/src/main/java/com/bandwidth/sdk/model/Call.java#L118-L131
wellner/jcarafe
jcarafe-core/src/main/java/cern/colt/list/DoubleArrayList.java
DoubleArrayList.indexOfFromTo
public int indexOfFromTo(double element, int from, int to) { // overridden for performance only. if (size==0) return -1; checkRangeFromTo(from, to, size); double[] theElements = elements; for (int i = from ; i <= to; i++) { if (element==theElements[i]) {return i;} //found } return -1; //not found }
java
public int indexOfFromTo(double element, int from, int to) { // overridden for performance only. if (size==0) return -1; checkRangeFromTo(from, to, size); double[] theElements = elements; for (int i = from ; i <= to; i++) { if (element==theElements[i]) {return i;} //found } return -1; //not found }
[ "public", "int", "indexOfFromTo", "(", "double", "element", ",", "int", "from", ",", "int", "to", ")", "{", "// overridden for performance only.\r", "if", "(", "size", "==", "0", ")", "return", "-", "1", ";", "checkRangeFromTo", "(", "from", ",", "to", ","...
Returns the index of the first occurrence of the specified element. Returns <code>-1</code> if the receiver does not contain this element. Searches between <code>from</code>, inclusive and <code>to</code>, inclusive. Tests for identity. @param element element to search for. @param from the leftmost search position, inclusive. @param to the rightmost search position, inclusive. @return the index of the first occurrence of the element in the receiver; returns <code>-1</code> if the element is not found. @exception IndexOutOfBoundsException index is out of range (<tt>size()&gt;0 && (from&lt;0 || from&gt;to || to&gt;=size())</tt>).
[ "Returns", "the", "index", "of", "the", "first", "occurrence", "of", "the", "specified", "element", ".", "Returns", "<code", ">", "-", "1<", "/", "code", ">", "if", "the", "receiver", "does", "not", "contain", "this", "element", ".", "Searches", "between",...
train
https://github.com/wellner/jcarafe/blob/ab8b0a83dbf600fe80c27711815c90bd3055b217/jcarafe-core/src/main/java/cern/colt/list/DoubleArrayList.java#L238-L248
Grasia/phatsim
phat-agents/src/main/java/phat/agents/automaton/FSM.java
FSM.registerTransition
public void registerTransition(Automaton source, Automaton destiny) { source.parent = this; destiny.parent = this; ArrayList<Transition> r = possibleTransitions.get(source); if (r == null) { r = new ArrayList<Transition>(); } r.add(new Transition(destiny)); possibleTransitions.put(source, r); }
java
public void registerTransition(Automaton source, Automaton destiny) { source.parent = this; destiny.parent = this; ArrayList<Transition> r = possibleTransitions.get(source); if (r == null) { r = new ArrayList<Transition>(); } r.add(new Transition(destiny)); possibleTransitions.put(source, r); }
[ "public", "void", "registerTransition", "(", "Automaton", "source", ",", "Automaton", "destiny", ")", "{", "source", ".", "parent", "=", "this", ";", "destiny", ".", "parent", "=", "this", ";", "ArrayList", "<", "Transition", ">", "r", "=", "possibleTransiti...
Registrar las posibles transiciones desde las que se puede ir a un estado. Si el automata tiene un único estado, se puede pasar null como destino. @param source @param destiny
[ "Registrar", "las", "posibles", "transiciones", "desde", "las", "que", "se", "puede", "ir", "a", "un", "estado", ".", "Si", "el", "automata", "tiene", "un", "único", "estado", "se", "puede", "pasar", "null", "como", "destino", "." ]
train
https://github.com/Grasia/phatsim/blob/2d4fc8189be9730b34c8e3e1a08fb4800e01c5df/phat-agents/src/main/java/phat/agents/automaton/FSM.java#L92-L101
looly/hutool
hutool-poi/src/main/java/cn/hutool/poi/excel/RowUtil.java
RowUtil.writeRow
public static void writeRow(Row row, Iterable<?> rowData, StyleSet styleSet, boolean isHeader) { int i = 0; Cell cell; for (Object value : rowData) { cell = row.createCell(i); CellUtil.setCellValue(cell, value, styleSet, isHeader); i++; } }
java
public static void writeRow(Row row, Iterable<?> rowData, StyleSet styleSet, boolean isHeader) { int i = 0; Cell cell; for (Object value : rowData) { cell = row.createCell(i); CellUtil.setCellValue(cell, value, styleSet, isHeader); i++; } }
[ "public", "static", "void", "writeRow", "(", "Row", "row", ",", "Iterable", "<", "?", ">", "rowData", ",", "StyleSet", "styleSet", ",", "boolean", "isHeader", ")", "{", "int", "i", "=", "0", ";", "Cell", "cell", ";", "for", "(", "Object", "value", ":...
写一行数据 @param row 行 @param rowData 一行的数据 @param styleSet 单元格样式集,包括日期等样式 @param isHeader 是否为标题行
[ "写一行数据" ]
train
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-poi/src/main/java/cn/hutool/poi/excel/RowUtil.java#L76-L84
baratine/baratine
core/src/main/java/com/caucho/v5/util/LruCache.java
LruCache.putIfNew
public V putIfNew(K key, V value) { V oldValue = compareAndPut(null, key, value, true); if (oldValue != null) return oldValue; else return value; }
java
public V putIfNew(K key, V value) { V oldValue = compareAndPut(null, key, value, true); if (oldValue != null) return oldValue; else return value; }
[ "public", "V", "putIfNew", "(", "K", "key", ",", "V", "value", ")", "{", "V", "oldValue", "=", "compareAndPut", "(", "null", ",", "key", ",", "value", ",", "true", ")", ";", "if", "(", "oldValue", "!=", "null", ")", "return", "oldValue", ";", "else...
Puts a new item in the cache. If the cache is full, remove the LRU item. @param key key to store data @param value value to be stored @return the value actually stored
[ "Puts", "a", "new", "item", "in", "the", "cache", ".", "If", "the", "cache", "is", "full", "remove", "the", "LRU", "item", "." ]
train
https://github.com/baratine/baratine/blob/db34b45c03c5a5e930d8142acc72319125569fcf/core/src/main/java/com/caucho/v5/util/LruCache.java#L283-L291
mikepenz/FastAdapter
library/src/main/java/com/mikepenz/fastadapter/commons/utils/FastAdapterUIUtils.java
FastAdapterUIUtils.getSelectablePressedBackground
public static StateListDrawable getSelectablePressedBackground(Context ctx, @ColorInt int selected_color, int pressed_alpha, boolean animate) { StateListDrawable states = getSelectableBackground(ctx, selected_color, animate); ColorDrawable clrPressed = new ColorDrawable(adjustAlpha(selected_color, pressed_alpha)); states.addState(new int[]{android.R.attr.state_pressed}, clrPressed); return states; }
java
public static StateListDrawable getSelectablePressedBackground(Context ctx, @ColorInt int selected_color, int pressed_alpha, boolean animate) { StateListDrawable states = getSelectableBackground(ctx, selected_color, animate); ColorDrawable clrPressed = new ColorDrawable(adjustAlpha(selected_color, pressed_alpha)); states.addState(new int[]{android.R.attr.state_pressed}, clrPressed); return states; }
[ "public", "static", "StateListDrawable", "getSelectablePressedBackground", "(", "Context", "ctx", ",", "@", "ColorInt", "int", "selected_color", ",", "int", "pressed_alpha", ",", "boolean", "animate", ")", "{", "StateListDrawable", "states", "=", "getSelectableBackgroun...
helper to get the system default selectable background inclusive an active and pressed state @param ctx the context @param selected_color the selected color @param pressed_alpha 0-255 @param animate true if you want to fade over the states (only animates if API newer than Build.VERSION_CODES.HONEYCOMB) @return the StateListDrawable
[ "helper", "to", "get", "the", "system", "default", "selectable", "background", "inclusive", "an", "active", "and", "pressed", "state" ]
train
https://github.com/mikepenz/FastAdapter/blob/3b2412abe001ba58422e0125846b704d4dba4ae9/library/src/main/java/com/mikepenz/fastadapter/commons/utils/FastAdapterUIUtils.java#L60-L65
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/util/SignatureFileVerifier.java
SignatureFileVerifier.matches
static boolean matches(CodeSigner[] signers, CodeSigner[] oldSigners, CodeSigner[] newSigners) { // special case if ((oldSigners == null) && (signers == newSigners)) return true; boolean match; // make sure all oldSigners are in signers if ((oldSigners != null) && !isSubSet(oldSigners, signers)) return false; // make sure all newSigners are in signers if (!isSubSet(newSigners, signers)) { return false; } // now make sure all the code signers in signers are // also in oldSigners or newSigners for (int i = 0; i < signers.length; i++) { boolean found = ((oldSigners != null) && contains(oldSigners, signers[i])) || contains(newSigners, signers[i]); if (!found) return false; } return true; }
java
static boolean matches(CodeSigner[] signers, CodeSigner[] oldSigners, CodeSigner[] newSigners) { // special case if ((oldSigners == null) && (signers == newSigners)) return true; boolean match; // make sure all oldSigners are in signers if ((oldSigners != null) && !isSubSet(oldSigners, signers)) return false; // make sure all newSigners are in signers if (!isSubSet(newSigners, signers)) { return false; } // now make sure all the code signers in signers are // also in oldSigners or newSigners for (int i = 0; i < signers.length; i++) { boolean found = ((oldSigners != null) && contains(oldSigners, signers[i])) || contains(newSigners, signers[i]); if (!found) return false; } return true; }
[ "static", "boolean", "matches", "(", "CodeSigner", "[", "]", "signers", ",", "CodeSigner", "[", "]", "oldSigners", ",", "CodeSigner", "[", "]", "newSigners", ")", "{", "// special case", "if", "(", "(", "oldSigners", "==", "null", ")", "&&", "(", "signers"...
returns true if signer contains exactly the same code signers as oldSigner and newSigner, false otherwise. oldSigner is allowed to be null.
[ "returns", "true", "if", "signer", "contains", "exactly", "the", "same", "code", "signers", "as", "oldSigner", "and", "newSigner", "false", "otherwise", ".", "oldSigner", "is", "allowed", "to", "be", "null", "." ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/util/SignatureFileVerifier.java#L636-L665
knowm/XChange
xchange-okcoin/src/main/java/org/knowm/xchange/okcoin/service/OkCoinTradeServiceRaw.java
OkCoinTradeServiceRaw.futureExplosive
public OkCoinFutureExplosiveResult futureExplosive( CurrencyPair pair, FuturesContract type, String status, Integer currentPage, Integer pageNumber, Integer pageLength) { return okCoin.futureExplosive( apikey, OkCoinAdapters.adaptSymbol(pair), type.getName(), status, signatureCreator(), currentPage, pageNumber, pageLength); }
java
public OkCoinFutureExplosiveResult futureExplosive( CurrencyPair pair, FuturesContract type, String status, Integer currentPage, Integer pageNumber, Integer pageLength) { return okCoin.futureExplosive( apikey, OkCoinAdapters.adaptSymbol(pair), type.getName(), status, signatureCreator(), currentPage, pageNumber, pageLength); }
[ "public", "OkCoinFutureExplosiveResult", "futureExplosive", "(", "CurrencyPair", "pair", ",", "FuturesContract", "type", ",", "String", "status", ",", "Integer", "currentPage", ",", "Integer", "pageNumber", ",", "Integer", "pageLength", ")", "{", "return", "okCoin", ...
获取合约爆仓单 @param pair @param type @param status //状态 0:最近7天未成交 1:最近7天已成交 @param currentPage @param pageNumber @param pageLength //每页获取条数,最多不超过50 @return
[ "获取合约爆仓单" ]
train
https://github.com/knowm/XChange/blob/e45f437ac8e0b89cd66cdcb3258bdb1bf3d88186/xchange-okcoin/src/main/java/org/knowm/xchange/okcoin/service/OkCoinTradeServiceRaw.java#L374-L390
facebookarchive/hadoop-20
src/hdfs/org/apache/hadoop/hdfs/server/datanode/FSDataset.java
FSDataset.validateBlockFile
File validateBlockFile(int namespaceId, Block b) throws IOException { return getValidateBlockFile(namespaceId, b, false); }
java
File validateBlockFile(int namespaceId, Block b) throws IOException { return getValidateBlockFile(namespaceId, b, false); }
[ "File", "validateBlockFile", "(", "int", "namespaceId", ",", "Block", "b", ")", "throws", "IOException", "{", "return", "getValidateBlockFile", "(", "namespaceId", ",", "b", ",", "false", ")", ";", "}" ]
Find the file corresponding to the block and return it if it exists.
[ "Find", "the", "file", "corresponding", "to", "the", "block", "and", "return", "it", "if", "it", "exists", "." ]
train
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/server/datanode/FSDataset.java#L2536-L2538
mikepenz/MaterialDrawer
library/src/main/java/com/mikepenz/materialdrawer/model/AbstractDrawerItem.java
AbstractDrawerItem.onPostBindView
public void onPostBindView(IDrawerItem drawerItem, View view) { if (mOnPostBindViewListener != null) { mOnPostBindViewListener.onBindView(drawerItem, view); } }
java
public void onPostBindView(IDrawerItem drawerItem, View view) { if (mOnPostBindViewListener != null) { mOnPostBindViewListener.onBindView(drawerItem, view); } }
[ "public", "void", "onPostBindView", "(", "IDrawerItem", "drawerItem", ",", "View", "view", ")", "{", "if", "(", "mOnPostBindViewListener", "!=", "null", ")", "{", "mOnPostBindViewListener", ".", "onBindView", "(", "drawerItem", ",", "view", ")", ";", "}", "}" ...
is called after bindView to allow some post creation setps @param drawerItem the drawerItem which is bound to the view @param view the currently view which will be bound
[ "is", "called", "after", "bindView", "to", "allow", "some", "post", "creation", "setps" ]
train
https://github.com/mikepenz/MaterialDrawer/blob/f4fb31635767edead0a01cee7b7588942b89d8d9/library/src/main/java/com/mikepenz/materialdrawer/model/AbstractDrawerItem.java#L204-L208
wcm-io/wcm-io-config
core/src/main/java/io/wcm/config/core/management/impl/PersistenceTypeConversion.java
PersistenceTypeConversion.fromPersistenceType
public static Object fromPersistenceType(Object value, Class<?> parameterType) { if (!isTypeConversionRequired(parameterType)) { return value; } if (Map.class.isAssignableFrom(parameterType) && (value instanceof String[])) { String[] rows = (String[])value; Map<String, String> map = new LinkedHashMap<>(); for (int i = 0; i < rows.length; i++) { String[] keyValue = ConversionStringUtils.splitPreserveAllTokens(rows[i], KEY_VALUE_DELIMITER.charAt(0)); if (keyValue.length == 2 && StringUtils.isNotEmpty(keyValue[0])) { String entryKey = keyValue[0]; String entryValue = StringUtils.isEmpty(keyValue[1]) ? null : keyValue[1]; map.put(ConversionStringUtils.decodeString(entryKey), ConversionStringUtils.decodeString(entryValue)); } } return map; } throw new IllegalArgumentException("Type conversion not supported: " + parameterType.getName()); }
java
public static Object fromPersistenceType(Object value, Class<?> parameterType) { if (!isTypeConversionRequired(parameterType)) { return value; } if (Map.class.isAssignableFrom(parameterType) && (value instanceof String[])) { String[] rows = (String[])value; Map<String, String> map = new LinkedHashMap<>(); for (int i = 0; i < rows.length; i++) { String[] keyValue = ConversionStringUtils.splitPreserveAllTokens(rows[i], KEY_VALUE_DELIMITER.charAt(0)); if (keyValue.length == 2 && StringUtils.isNotEmpty(keyValue[0])) { String entryKey = keyValue[0]; String entryValue = StringUtils.isEmpty(keyValue[1]) ? null : keyValue[1]; map.put(ConversionStringUtils.decodeString(entryKey), ConversionStringUtils.decodeString(entryValue)); } } return map; } throw new IllegalArgumentException("Type conversion not supported: " + parameterType.getName()); }
[ "public", "static", "Object", "fromPersistenceType", "(", "Object", "value", ",", "Class", "<", "?", ">", "parameterType", ")", "{", "if", "(", "!", "isTypeConversionRequired", "(", "parameterType", ")", ")", "{", "return", "value", ";", "}", "if", "(", "M...
Convert object from persistence to be used in configuration. @param value Persisted value @param parameterType Parameter type @return Configured value
[ "Convert", "object", "from", "persistence", "to", "be", "used", "in", "configuration", "." ]
train
https://github.com/wcm-io/wcm-io-config/blob/9a03d72a4314163a171c7ef815fb6a1eba181828/core/src/main/java/io/wcm/config/core/management/impl/PersistenceTypeConversion.java#L88-L106
structr/structr
structr-core/src/main/java/org/structr/schema/action/Function.java
Function.logParameterError
protected void logParameterError(final Object caller, final Object[] parameters, final boolean inJavaScriptContext) { logParameterError(caller, parameters, "Unsupported parameter combination/count in", inJavaScriptContext); }
java
protected void logParameterError(final Object caller, final Object[] parameters, final boolean inJavaScriptContext) { logParameterError(caller, parameters, "Unsupported parameter combination/count in", inJavaScriptContext); }
[ "protected", "void", "logParameterError", "(", "final", "Object", "caller", ",", "final", "Object", "[", "]", "parameters", ",", "final", "boolean", "inJavaScriptContext", ")", "{", "logParameterError", "(", "caller", ",", "parameters", ",", "\"Unsupported parameter...
Basic logging for functions called with wrong parameter count @param caller The element that caused the error @param parameters The function parameters @param inJavaScriptContext Has the function been called from a JavaScript context?
[ "Basic", "logging", "for", "functions", "called", "with", "wrong", "parameter", "count" ]
train
https://github.com/structr/structr/blob/c111a1d0c0201c7fea5574ed69aa5a5053185a97/structr-core/src/main/java/org/structr/schema/action/Function.java#L76-L78
EdwardRaff/JSAT
JSAT/src/jsat/classifiers/linear/STGD.java
STGD.performUpdate
private void performUpdate(final Vec x, final double y, final double yHat) { for(IndexValue iv : x) { final int j = iv.getIndex(); w.set(j, T(w.get(j)+2*learningRate*(y-yHat)*iv.getValue(), ((time-t[j])/K)*gravity*learningRate, threshold)); t[j] += ((time-t[j])/K)*K; } }
java
private void performUpdate(final Vec x, final double y, final double yHat) { for(IndexValue iv : x) { final int j = iv.getIndex(); w.set(j, T(w.get(j)+2*learningRate*(y-yHat)*iv.getValue(), ((time-t[j])/K)*gravity*learningRate, threshold)); t[j] += ((time-t[j])/K)*K; } }
[ "private", "void", "performUpdate", "(", "final", "Vec", "x", ",", "final", "double", "y", ",", "final", "double", "yHat", ")", "{", "for", "(", "IndexValue", "iv", ":", "x", ")", "{", "final", "int", "j", "=", "iv", ".", "getIndex", "(", ")", ";",...
Performs the sparse update of the weight vector @param x the input vector @param y the true value @param yHat the predicted value
[ "Performs", "the", "sparse", "update", "of", "the", "weight", "vector" ]
train
https://github.com/EdwardRaff/JSAT/blob/0ff53b7b39684b2379cc1da522f5b3a954b15cfb/JSAT/src/jsat/classifiers/linear/STGD.java#L277-L289
mgm-tp/jfunk
jfunk-common/src/main/java/com/mgmtp/jfunk/common/util/Configuration.java
Configuration.extractFromArchive
public void extractFromArchive(final File targetFile, final boolean forceOverwrite) throws IOException { if (zipArchive != null) { ZipEntry entry = zipArchive.getEntry(targetFile.getName()); if (entry != null) { if (!targetFile.exists()) { try { targetFile.createNewFile(); } catch (IOException ex) { throw new JFunkException("Error creating file: " + targetFile, ex); } } else if (!forceOverwrite) { return; } logger.info("Loading file '{}' from zip archive...", targetFile); OutputStream out = null; InputStream in = null; try { out = new FileOutputStream(targetFile); in = zipArchive.getInputStream(entry); IOUtils.copy(in, out); } finally { IOUtils.closeQuietly(in); IOUtils.closeQuietly(out); } } else { logger.error("Could not find file '{}' in zip archive", targetFile); } } }
java
public void extractFromArchive(final File targetFile, final boolean forceOverwrite) throws IOException { if (zipArchive != null) { ZipEntry entry = zipArchive.getEntry(targetFile.getName()); if (entry != null) { if (!targetFile.exists()) { try { targetFile.createNewFile(); } catch (IOException ex) { throw new JFunkException("Error creating file: " + targetFile, ex); } } else if (!forceOverwrite) { return; } logger.info("Loading file '{}' from zip archive...", targetFile); OutputStream out = null; InputStream in = null; try { out = new FileOutputStream(targetFile); in = zipArchive.getInputStream(entry); IOUtils.copy(in, out); } finally { IOUtils.closeQuietly(in); IOUtils.closeQuietly(out); } } else { logger.error("Could not find file '{}' in zip archive", targetFile); } } }
[ "public", "void", "extractFromArchive", "(", "final", "File", "targetFile", ",", "final", "boolean", "forceOverwrite", ")", "throws", "IOException", "{", "if", "(", "zipArchive", "!=", "null", ")", "{", "ZipEntry", "entry", "=", "zipArchive", ".", "getEntry", ...
Extracts the specified file from this configuration's zip file, if applicable. @param targetFile The target file. The file name without the path information is taken in order to identify the zip entry to extract. @param forceOverwrite If {@code true}, an existing file is overwritten.
[ "Extracts", "the", "specified", "file", "from", "this", "configuration", "s", "zip", "file", "if", "applicable", "." ]
train
https://github.com/mgm-tp/jfunk/blob/5b9fecac5778b988bb458085ded39ea9a4c7c2ae/jfunk-common/src/main/java/com/mgmtp/jfunk/common/util/Configuration.java#L271-L299
TakahikoKawasaki/nv-websocket-client
src/main/java/com/neovisionaries/ws/client/ReadingThread.java
ReadingThread.callOnMessageError
private void callOnMessageError(WebSocketException cause, List<WebSocketFrame> frames) { mWebSocket.getListenerManager().callOnMessageError(cause, frames); }
java
private void callOnMessageError(WebSocketException cause, List<WebSocketFrame> frames) { mWebSocket.getListenerManager().callOnMessageError(cause, frames); }
[ "private", "void", "callOnMessageError", "(", "WebSocketException", "cause", ",", "List", "<", "WebSocketFrame", ">", "frames", ")", "{", "mWebSocket", ".", "getListenerManager", "(", ")", ".", "callOnMessageError", "(", "cause", ",", "frames", ")", ";", "}" ]
Call {@link WebSocketListener#onMessageError(WebSocket, WebSocketException, List) onMessageError} method of the listeners.
[ "Call", "{" ]
train
https://github.com/TakahikoKawasaki/nv-websocket-client/blob/efaec21181d740ad3808313acf679313179e0825/src/main/java/com/neovisionaries/ws/client/ReadingThread.java#L304-L307
elki-project/elki
elki-core-distance/src/main/java/de/lmu/ifi/dbs/elki/distance/distancefunction/minkowski/EuclideanDistanceFunction.java
EuclideanDistanceFunction.maxDist
public double maxDist(SpatialComparable mbr1, SpatialComparable mbr2) { final int dim1 = mbr1.getDimensionality(), dim2 = mbr2.getDimensionality(); final int mindim = dim1 < dim2 ? dim1 : dim2; double agg = 0.; for(int d = 0; d < mindim; d++) { double d1 = mbr1.getMax(d) - mbr2.getMin(d); double d2 = mbr2.getMax(d) - mbr1.getMin(d); double delta = d1 > d2 ? d1 : d2; agg += delta * delta; } for(int d = mindim; d < dim1; d++) { double d1 = Math.abs(mbr1.getMin(d)), d2 = Math.abs(mbr1.getMax(d)); double delta = d1 > d2 ? d1 : d2; agg += delta * delta; } for(int d = mindim; d < dim2; d++) { double d1 = Math.abs(mbr2.getMin(d)), d2 = Math.abs(mbr2.getMax(d)); double delta = d1 > d2 ? d1 : d2; agg += delta * delta; } return FastMath.sqrt(agg); }
java
public double maxDist(SpatialComparable mbr1, SpatialComparable mbr2) { final int dim1 = mbr1.getDimensionality(), dim2 = mbr2.getDimensionality(); final int mindim = dim1 < dim2 ? dim1 : dim2; double agg = 0.; for(int d = 0; d < mindim; d++) { double d1 = mbr1.getMax(d) - mbr2.getMin(d); double d2 = mbr2.getMax(d) - mbr1.getMin(d); double delta = d1 > d2 ? d1 : d2; agg += delta * delta; } for(int d = mindim; d < dim1; d++) { double d1 = Math.abs(mbr1.getMin(d)), d2 = Math.abs(mbr1.getMax(d)); double delta = d1 > d2 ? d1 : d2; agg += delta * delta; } for(int d = mindim; d < dim2; d++) { double d1 = Math.abs(mbr2.getMin(d)), d2 = Math.abs(mbr2.getMax(d)); double delta = d1 > d2 ? d1 : d2; agg += delta * delta; } return FastMath.sqrt(agg); }
[ "public", "double", "maxDist", "(", "SpatialComparable", "mbr1", ",", "SpatialComparable", "mbr2", ")", "{", "final", "int", "dim1", "=", "mbr1", ".", "getDimensionality", "(", ")", ",", "dim2", "=", "mbr2", ".", "getDimensionality", "(", ")", ";", "final", ...
Maximum distance of two objects. @param mbr1 First object @param mbr2 Second object
[ "Maximum", "distance", "of", "two", "objects", "." ]
train
https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki-core-distance/src/main/java/de/lmu/ifi/dbs/elki/distance/distancefunction/minkowski/EuclideanDistanceFunction.java#L160-L182
dnsjava/dnsjava
org/xbill/DNS/ZoneTransferIn.java
ZoneTransferIn.newAXFR
public static ZoneTransferIn newAXFR(Name zone, String host, int port, TSIG key) throws UnknownHostException { if (port == 0) port = SimpleResolver.DEFAULT_PORT; return newAXFR(zone, new InetSocketAddress(host, port), key); }
java
public static ZoneTransferIn newAXFR(Name zone, String host, int port, TSIG key) throws UnknownHostException { if (port == 0) port = SimpleResolver.DEFAULT_PORT; return newAXFR(zone, new InetSocketAddress(host, port), key); }
[ "public", "static", "ZoneTransferIn", "newAXFR", "(", "Name", "zone", ",", "String", "host", ",", "int", "port", ",", "TSIG", "key", ")", "throws", "UnknownHostException", "{", "if", "(", "port", "==", "0", ")", "port", "=", "SimpleResolver", ".", "DEFAULT...
Instantiates a ZoneTransferIn object to do an AXFR (full zone transfer). @param zone The zone to transfer. @param host The host from which to transfer the zone. @param port The port to connect to on the server, or 0 for the default. @param key The TSIG key used to authenticate the transfer, or null. @return The ZoneTransferIn object. @throws UnknownHostException The host does not exist.
[ "Instantiates", "a", "ZoneTransferIn", "object", "to", "do", "an", "AXFR", "(", "full", "zone", "transfer", ")", "." ]
train
https://github.com/dnsjava/dnsjava/blob/d97b6a0685d59143372bb392ab591dd8dd840b61/org/xbill/DNS/ZoneTransferIn.java#L214-L221
kuali/ojb-1.0.4
src/java/org/apache/ojb/broker/core/PersistenceBrokerImpl.java
PersistenceBrokerImpl.doDelete
private void doDelete(Object obj, boolean ignoreReferences) throws PersistenceBrokerException { //logger.info("DELETING " + obj); // object is not null if (obj != null) { obj = getProxyFactory().getRealObject(obj); /** * Kuali Foundation modification -- 8/24/2007 */ if ( obj == null ) return; /** * End of Kuali Foundation modification */ /** * MBAIRD * 1. if we are marked for delete already, avoid recursing on this object * * arminw: * use object instead Identity object in markedForDelete List, * because using objects we get a better performance. I can't find * side-effects in doing so. */ if (markedForDelete.contains(obj)) { return; } ClassDescriptor cld = getClassDescriptor(obj.getClass()); //BRJ: check for valid pk if (!serviceBrokerHelper().assertValidPkForDelete(cld, obj)) { String msg = "Cannot delete object without valid PKs. " + obj; logger.error(msg); return; } /** * MBAIRD * 2. register object in markedForDelete map. */ markedForDelete.add(obj); Identity oid = serviceIdentity().buildIdentity(cld, obj); // Invoke events on PersistenceBrokerAware instances and listeners BEFORE_DELETE_EVENT.setTarget(obj); fireBrokerEvent(BEFORE_DELETE_EVENT); BEFORE_DELETE_EVENT.setTarget(null); // now perform deletion performDeletion(cld, obj, oid, ignoreReferences); // Invoke events on PersistenceBrokerAware instances and listeners AFTER_DELETE_EVENT.setTarget(obj); fireBrokerEvent(AFTER_DELETE_EVENT); AFTER_DELETE_EVENT.setTarget(null); // let the connection manager to execute batch connectionManager.executeBatchIfNecessary(); } }
java
private void doDelete(Object obj, boolean ignoreReferences) throws PersistenceBrokerException { //logger.info("DELETING " + obj); // object is not null if (obj != null) { obj = getProxyFactory().getRealObject(obj); /** * Kuali Foundation modification -- 8/24/2007 */ if ( obj == null ) return; /** * End of Kuali Foundation modification */ /** * MBAIRD * 1. if we are marked for delete already, avoid recursing on this object * * arminw: * use object instead Identity object in markedForDelete List, * because using objects we get a better performance. I can't find * side-effects in doing so. */ if (markedForDelete.contains(obj)) { return; } ClassDescriptor cld = getClassDescriptor(obj.getClass()); //BRJ: check for valid pk if (!serviceBrokerHelper().assertValidPkForDelete(cld, obj)) { String msg = "Cannot delete object without valid PKs. " + obj; logger.error(msg); return; } /** * MBAIRD * 2. register object in markedForDelete map. */ markedForDelete.add(obj); Identity oid = serviceIdentity().buildIdentity(cld, obj); // Invoke events on PersistenceBrokerAware instances and listeners BEFORE_DELETE_EVENT.setTarget(obj); fireBrokerEvent(BEFORE_DELETE_EVENT); BEFORE_DELETE_EVENT.setTarget(null); // now perform deletion performDeletion(cld, obj, oid, ignoreReferences); // Invoke events on PersistenceBrokerAware instances and listeners AFTER_DELETE_EVENT.setTarget(obj); fireBrokerEvent(AFTER_DELETE_EVENT); AFTER_DELETE_EVENT.setTarget(null); // let the connection manager to execute batch connectionManager.executeBatchIfNecessary(); } }
[ "private", "void", "doDelete", "(", "Object", "obj", ",", "boolean", "ignoreReferences", ")", "throws", "PersistenceBrokerException", "{", "//logger.info(\"DELETING \" + obj);", "// object is not null", "if", "(", "obj", "!=", "null", ")", "{", "obj", "=", "getProxyFa...
do delete given object. Should be used by all intern classes to delete objects.
[ "do", "delete", "given", "object", ".", "Should", "be", "used", "by", "all", "intern", "classes", "to", "delete", "objects", "." ]
train
https://github.com/kuali/ojb-1.0.4/blob/9a544372f67ce965f662cdc71609dd03683c8f04/src/java/org/apache/ojb/broker/core/PersistenceBrokerImpl.java#L532-L592
sothawo/mapjfx
src/main/java/com/sothawo/mapjfx/MapView.java
JavaConnector.processMarkerClicked
private void processMarkerClicked(final String name, final ClickType clickType) { if (logger.isTraceEnabled()) { logger.trace("JS reports marker {} clicked {}", name, clickType); } synchronized (mapCoordinateElements) { if (mapCoordinateElements.containsKey(name)) { final MapCoordinateElement mapCoordinateElement = mapCoordinateElements.get(name).get(); EventType<MarkerEvent> eventType = null; switch (clickType) { case LEFT: eventType = MarkerEvent.MARKER_CLICKED; break; case DOUBLE: eventType = MarkerEvent.MARKER_DOUBLECLICKED; break; case RIGHT: eventType = MarkerEvent.MARKER_RIGHTCLICKED; break; case MOUSEDOWN: eventType = MarkerEvent.MARKER_MOUSEDOWN; break; case MOUSEUP: eventType = MarkerEvent.MARKER_MOUSEUP; break; case ENTERED: eventType = MarkerEvent.MARKER_ENTERED; break; case EXITED: eventType = MarkerEvent.MARKER_EXITED; break; } fireEvent(new MarkerEvent(eventType, (Marker) mapCoordinateElement)); } } }
java
private void processMarkerClicked(final String name, final ClickType clickType) { if (logger.isTraceEnabled()) { logger.trace("JS reports marker {} clicked {}", name, clickType); } synchronized (mapCoordinateElements) { if (mapCoordinateElements.containsKey(name)) { final MapCoordinateElement mapCoordinateElement = mapCoordinateElements.get(name).get(); EventType<MarkerEvent> eventType = null; switch (clickType) { case LEFT: eventType = MarkerEvent.MARKER_CLICKED; break; case DOUBLE: eventType = MarkerEvent.MARKER_DOUBLECLICKED; break; case RIGHT: eventType = MarkerEvent.MARKER_RIGHTCLICKED; break; case MOUSEDOWN: eventType = MarkerEvent.MARKER_MOUSEDOWN; break; case MOUSEUP: eventType = MarkerEvent.MARKER_MOUSEUP; break; case ENTERED: eventType = MarkerEvent.MARKER_ENTERED; break; case EXITED: eventType = MarkerEvent.MARKER_EXITED; break; } fireEvent(new MarkerEvent(eventType, (Marker) mapCoordinateElement)); } } }
[ "private", "void", "processMarkerClicked", "(", "final", "String", "name", ",", "final", "ClickType", "clickType", ")", "{", "if", "(", "logger", ".", "isTraceEnabled", "(", ")", ")", "{", "logger", ".", "trace", "(", "\"JS reports marker {} clicked {}\"", ",", ...
processes a marker click @param name name of the marker @param clickType the type of click
[ "processes", "a", "marker", "click" ]
train
https://github.com/sothawo/mapjfx/blob/202091de492ab7a8b000c77efd833029f7f0ef92/src/main/java/com/sothawo/mapjfx/MapView.java#L1474-L1508
umano/AndroidSlidingUpPanel
library/src/main/java/com/sothree/slidinguppanel/ViewDragHelper.java
ViewDragHelper.tryCaptureViewForDrag
boolean tryCaptureViewForDrag(View toCapture, int pointerId) { if (toCapture == mCapturedView && mActivePointerId == pointerId) { // Already done! return true; } if (toCapture != null && mCallback.tryCaptureView(toCapture, pointerId)) { mActivePointerId = pointerId; captureChildView(toCapture, pointerId); return true; } return false; }
java
boolean tryCaptureViewForDrag(View toCapture, int pointerId) { if (toCapture == mCapturedView && mActivePointerId == pointerId) { // Already done! return true; } if (toCapture != null && mCallback.tryCaptureView(toCapture, pointerId)) { mActivePointerId = pointerId; captureChildView(toCapture, pointerId); return true; } return false; }
[ "boolean", "tryCaptureViewForDrag", "(", "View", "toCapture", ",", "int", "pointerId", ")", "{", "if", "(", "toCapture", "==", "mCapturedView", "&&", "mActivePointerId", "==", "pointerId", ")", "{", "// Already done!", "return", "true", ";", "}", "if", "(", "t...
Attempt to capture the view with the given pointer ID. The callback will be involved. This will put us into the "dragging" state. If we've already captured this view with this pointer this method will immediately return true without consulting the callback. @param toCapture View to capture @param pointerId Pointer to capture with @return true if capture was successful
[ "Attempt", "to", "capture", "the", "view", "with", "the", "given", "pointer", "ID", ".", "The", "callback", "will", "be", "involved", ".", "This", "will", "put", "us", "into", "the", "dragging", "state", ".", "If", "we", "ve", "already", "captured", "thi...
train
https://github.com/umano/AndroidSlidingUpPanel/blob/45a460435b07e764138a700328836cafc1ed5c42/library/src/main/java/com/sothree/slidinguppanel/ViewDragHelper.java#L927-L938
dlemmermann/CalendarFX
CalendarFXView/src/main/java/com/calendarfx/model/Interval.java
Interval.withEndTime
public Interval withEndTime(LocalTime time) { requireNonNull(time); return new Interval(startDate, startTime, endDate, time, zoneId); }
java
public Interval withEndTime(LocalTime time) { requireNonNull(time); return new Interval(startDate, startTime, endDate, time, zoneId); }
[ "public", "Interval", "withEndTime", "(", "LocalTime", "time", ")", "{", "requireNonNull", "(", "time", ")", ";", "return", "new", "Interval", "(", "startDate", ",", "startTime", ",", "endDate", ",", "time", ",", "zoneId", ")", ";", "}" ]
Returns a new interval based on this interval but with a different end time. @param time the new end time @return a new interval
[ "Returns", "a", "new", "interval", "based", "on", "this", "interval", "but", "with", "a", "different", "end", "time", "." ]
train
https://github.com/dlemmermann/CalendarFX/blob/f2b91c2622c3f29d004485b6426b23b86c331f96/CalendarFXView/src/main/java/com/calendarfx/model/Interval.java#L367-L370
google/error-prone-javac
src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/AbstractDoclet.java
AbstractDoclet.generateOtherFiles
protected void generateOtherFiles(DocletEnvironment docEnv, ClassTree classtree) throws DocletException { BuilderFactory builderFactory = configuration.getBuilderFactory(); AbstractBuilder constantsSummaryBuilder = builderFactory.getConstantsSummaryBuilder(); constantsSummaryBuilder.build(); AbstractBuilder serializedFormBuilder = builderFactory.getSerializedFormBuilder(); serializedFormBuilder.build(); }
java
protected void generateOtherFiles(DocletEnvironment docEnv, ClassTree classtree) throws DocletException { BuilderFactory builderFactory = configuration.getBuilderFactory(); AbstractBuilder constantsSummaryBuilder = builderFactory.getConstantsSummaryBuilder(); constantsSummaryBuilder.build(); AbstractBuilder serializedFormBuilder = builderFactory.getSerializedFormBuilder(); serializedFormBuilder.build(); }
[ "protected", "void", "generateOtherFiles", "(", "DocletEnvironment", "docEnv", ",", "ClassTree", "classtree", ")", "throws", "DocletException", "{", "BuilderFactory", "builderFactory", "=", "configuration", ".", "getBuilderFactory", "(", ")", ";", "AbstractBuilder", "co...
Generate additional documentation that is added to the API documentation. @param docEnv the DocletEnvironment @param classtree the data structure representing the class tree @throws DocletException if there is a problem while generating the documentation
[ "Generate", "additional", "documentation", "that", "is", "added", "to", "the", "API", "documentation", "." ]
train
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/AbstractDoclet.java#L224-L231
JOML-CI/JOML
src/org/joml/Matrix4d.java
Matrix4d.setPerspective
public Matrix4d setPerspective(double fovy, double aspect, double zNear, double zFar) { return setPerspective(fovy, aspect, zNear, zFar, false); }
java
public Matrix4d setPerspective(double fovy, double aspect, double zNear, double zFar) { return setPerspective(fovy, aspect, zNear, zFar, false); }
[ "public", "Matrix4d", "setPerspective", "(", "double", "fovy", ",", "double", "aspect", ",", "double", "zNear", ",", "double", "zFar", ")", "{", "return", "setPerspective", "(", "fovy", ",", "aspect", ",", "zNear", ",", "zFar", ",", "false", ")", ";", "}...
Set this matrix to be a symmetric perspective projection frustum transformation for a right-handed coordinate system using OpenGL's NDC z range of <code>[-1..+1]</code>. <p> In order to apply the perspective projection transformation to an existing transformation, use {@link #perspective(double, double, double, double) perspective()}. @see #perspective(double, double, double, double) @param fovy the vertical field of view in radians (must be greater than zero and less than {@link Math#PI PI}) @param aspect the aspect ratio (i.e. width / height; must be greater than zero) @param zNear near clipping plane distance. If the special value {@link Double#POSITIVE_INFINITY} is used, the near clipping plane will be at positive infinity. In that case, <code>zFar</code> may not also be {@link Double#POSITIVE_INFINITY}. @param zFar far clipping plane distance. If the special value {@link Double#POSITIVE_INFINITY} is used, the far clipping plane will be at positive infinity. In that case, <code>zNear</code> may not also be {@link Double#POSITIVE_INFINITY}. @return this
[ "Set", "this", "matrix", "to", "be", "a", "symmetric", "perspective", "projection", "frustum", "transformation", "for", "a", "right", "-", "handed", "coordinate", "system", "using", "OpenGL", "s", "NDC", "z", "range", "of", "<code", ">", "[", "-", "1", ".....
train
https://github.com/JOML-CI/JOML/blob/ce2652fc236b42bda3875c591f8e6645048a678f/src/org/joml/Matrix4d.java#L12628-L12630
mlhartme/mork
src/main/java/net/oneandone/mork/reflect/Constant.java
Constant.fillParas
public static Function fillParas(Function func, int ofs, Object[] paras) { int i; if (func == null) { throw new NullPointerException(); } for (i = 0; i < paras.length; i++) { // ofs is not changed! func = Composition.create(func, ofs, new Constant(paras[i].getClass(), "arg"+i, paras[i])); if (func == null) { throw new RuntimeException(); } } return func; }
java
public static Function fillParas(Function func, int ofs, Object[] paras) { int i; if (func == null) { throw new NullPointerException(); } for (i = 0; i < paras.length; i++) { // ofs is not changed! func = Composition.create(func, ofs, new Constant(paras[i].getClass(), "arg"+i, paras[i])); if (func == null) { throw new RuntimeException(); } } return func; }
[ "public", "static", "Function", "fillParas", "(", "Function", "func", ",", "int", "ofs", ",", "Object", "[", "]", "paras", ")", "{", "int", "i", ";", "if", "(", "func", "==", "null", ")", "{", "throw", "new", "NullPointerException", "(", ")", ";", "}...
Replaces arguments to Functions by Constant Functions. Results in Functions with fewer arguments. @param func Functions whose arguments are filled in @param ofs first argument to be filled @param paras Values for Constants used to fill arguments @return Function with filled arguments.
[ "Replaces", "arguments", "to", "Functions", "by", "Constant", "Functions", ".", "Results", "in", "Functions", "with", "fewer", "arguments", "." ]
train
https://github.com/mlhartme/mork/blob/a069b087750c4133bfeebaf1f599c3bc96762113/src/main/java/net/oneandone/mork/reflect/Constant.java#L66-L84
eurekaclinical/eurekaclinical-standard-apis
src/main/java/org/eurekaclinical/standardapis/props/EurekaClinicalProperties.java
EurekaClinicalProperties.getIntValue
protected final int getIntValue(final String propertyName, int defaultValue) { int result; String property = this.properties.getProperty(propertyName); try { result = Integer.parseInt(property); } catch (NumberFormatException e) { LOGGER.warn("Invalid integer property in configuration: {}", propertyName); result = defaultValue; } return result; }
java
protected final int getIntValue(final String propertyName, int defaultValue) { int result; String property = this.properties.getProperty(propertyName); try { result = Integer.parseInt(property); } catch (NumberFormatException e) { LOGGER.warn("Invalid integer property in configuration: {}", propertyName); result = defaultValue; } return result; }
[ "protected", "final", "int", "getIntValue", "(", "final", "String", "propertyName", ",", "int", "defaultValue", ")", "{", "int", "result", ";", "String", "property", "=", "this", ".", "properties", ".", "getProperty", "(", "propertyName", ")", ";", "try", "{...
Utility method to get an int from the properties file. @param propertyName The name of the property. @param defaultValue The default value to return, if the property is not found, or is malformed. @return The property value, as an int.
[ "Utility", "method", "to", "get", "an", "int", "from", "the", "properties", "file", "." ]
train
https://github.com/eurekaclinical/eurekaclinical-standard-apis/blob/690036dde82a4f2c2106d32403cdf1c713429377/src/main/java/org/eurekaclinical/standardapis/props/EurekaClinicalProperties.java#L229-L240
googleapis/google-cloud-java
google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/InterconnectClient.java
InterconnectClient.insertInterconnect
@BetaApi public final Operation insertInterconnect(String project, Interconnect interconnectResource) { InsertInterconnectHttpRequest request = InsertInterconnectHttpRequest.newBuilder() .setProject(project) .setInterconnectResource(interconnectResource) .build(); return insertInterconnect(request); }
java
@BetaApi public final Operation insertInterconnect(String project, Interconnect interconnectResource) { InsertInterconnectHttpRequest request = InsertInterconnectHttpRequest.newBuilder() .setProject(project) .setInterconnectResource(interconnectResource) .build(); return insertInterconnect(request); }
[ "@", "BetaApi", "public", "final", "Operation", "insertInterconnect", "(", "String", "project", ",", "Interconnect", "interconnectResource", ")", "{", "InsertInterconnectHttpRequest", "request", "=", "InsertInterconnectHttpRequest", ".", "newBuilder", "(", ")", ".", "se...
Creates a Interconnect in the specified project using the data included in the request. <p>Sample code: <pre><code> try (InterconnectClient interconnectClient = InterconnectClient.create()) { ProjectName project = ProjectName.of("[PROJECT]"); Interconnect interconnectResource = Interconnect.newBuilder().build(); Operation response = interconnectClient.insertInterconnect(project.toString(), interconnectResource); } </code></pre> @param project Project ID for this request. @param interconnectResource Represents an Interconnects resource. The Interconnects resource is a dedicated connection between Google's network and your on-premises network. For more information, see the Dedicated overview page. (== resource_for v1.interconnects ==) (== resource_for beta.interconnects ==) @throws com.google.api.gax.rpc.ApiException if the remote call fails
[ "Creates", "a", "Interconnect", "in", "the", "specified", "project", "using", "the", "data", "included", "in", "the", "request", "." ]
train
https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/InterconnectClient.java#L509-L518
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xpath/NodeSetDTM.java
NodeSetDTM.removeElementAt
public void removeElementAt(int i) { if (!m_mutable) throw new RuntimeException(XSLMessages.createXPATHMessage(XPATHErrorResources.ER_NODESETDTM_NOT_MUTABLE, null)); //"This NodeSetDTM is not mutable!"); super.removeElementAt(i); }
java
public void removeElementAt(int i) { if (!m_mutable) throw new RuntimeException(XSLMessages.createXPATHMessage(XPATHErrorResources.ER_NODESETDTM_NOT_MUTABLE, null)); //"This NodeSetDTM is not mutable!"); super.removeElementAt(i); }
[ "public", "void", "removeElementAt", "(", "int", "i", ")", "{", "if", "(", "!", "m_mutable", ")", "throw", "new", "RuntimeException", "(", "XSLMessages", ".", "createXPATHMessage", "(", "XPATHErrorResources", ".", "ER_NODESETDTM_NOT_MUTABLE", ",", "null", ")", "...
Deletes the component at the specified index. Each component in this vector with an index greater or equal to the specified index is shifted downward to have an index one smaller than the value it had previously. @param i The index of the node to be removed. @throws RuntimeException thrown if this NodeSetDTM is not of a mutable type.
[ "Deletes", "the", "component", "at", "the", "specified", "index", ".", "Each", "component", "in", "this", "vector", "with", "an", "index", "greater", "or", "equal", "to", "the", "specified", "index", "is", "shifted", "downward", "to", "have", "an", "index", ...
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xpath/NodeSetDTM.java#L987-L994
google/closure-templates
java/src/com/google/template/soy/internal/proto/JavaQualifiedNames.java
JavaQualifiedNames.getFileClassName
static String getFileClassName(FileDescriptorProto file, ProtoFlavor flavor) { switch (flavor) { case PROTO2: return getFileImmutableClassName(file); default: throw new AssertionError(); } }
java
static String getFileClassName(FileDescriptorProto file, ProtoFlavor flavor) { switch (flavor) { case PROTO2: return getFileImmutableClassName(file); default: throw new AssertionError(); } }
[ "static", "String", "getFileClassName", "(", "FileDescriptorProto", "file", ",", "ProtoFlavor", "flavor", ")", "{", "switch", "(", "flavor", ")", "{", "case", "PROTO2", ":", "return", "getFileImmutableClassName", "(", "file", ")", ";", "default", ":", "throw", ...
Derives the outer class name based on the protobuf (.proto) file name.
[ "Derives", "the", "outer", "class", "name", "based", "on", "the", "protobuf", "(", ".", "proto", ")", "file", "name", "." ]
train
https://github.com/google/closure-templates/blob/cc61e1dff70ae97f24f417a57410081bc498bd56/java/src/com/google/template/soy/internal/proto/JavaQualifiedNames.java#L251-L258
eclipse/xtext-extras
org.eclipse.xtext.purexbase/src-gen/org/eclipse/xtext/purexbase/pureXbase/impl/PureXbasePackageImpl.java
PureXbasePackageImpl.initializePackageContents
public void initializePackageContents() { if (isInitialized) return; isInitialized = true; // Initialize package setName(eNAME); setNsPrefix(eNS_PREFIX); setNsURI(eNS_URI); // Obtain other dependent packages XtypePackage theXtypePackage = (XtypePackage)EPackage.Registry.INSTANCE.getEPackage(XtypePackage.eNS_URI); XbasePackage theXbasePackage = (XbasePackage)EPackage.Registry.INSTANCE.getEPackage(XbasePackage.eNS_URI); // Create type parameters // Set bounds for type parameters // Add supertypes to classes // Initialize classes and features; add operations and parameters initEClass(modelEClass, Model.class, "Model", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); initEReference(getModel_ImportSection(), theXtypePackage.getXImportSection(), null, "importSection", null, 0, 1, Model.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); initEReference(getModel_Block(), theXbasePackage.getXBlockExpression(), null, "block", null, 0, 1, Model.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); // Create resource createResource(eNS_URI); }
java
public void initializePackageContents() { if (isInitialized) return; isInitialized = true; // Initialize package setName(eNAME); setNsPrefix(eNS_PREFIX); setNsURI(eNS_URI); // Obtain other dependent packages XtypePackage theXtypePackage = (XtypePackage)EPackage.Registry.INSTANCE.getEPackage(XtypePackage.eNS_URI); XbasePackage theXbasePackage = (XbasePackage)EPackage.Registry.INSTANCE.getEPackage(XbasePackage.eNS_URI); // Create type parameters // Set bounds for type parameters // Add supertypes to classes // Initialize classes and features; add operations and parameters initEClass(modelEClass, Model.class, "Model", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); initEReference(getModel_ImportSection(), theXtypePackage.getXImportSection(), null, "importSection", null, 0, 1, Model.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); initEReference(getModel_Block(), theXbasePackage.getXBlockExpression(), null, "block", null, 0, 1, Model.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); // Create resource createResource(eNS_URI); }
[ "public", "void", "initializePackageContents", "(", ")", "{", "if", "(", "isInitialized", ")", "return", ";", "isInitialized", "=", "true", ";", "// Initialize package", "setName", "(", "eNAME", ")", ";", "setNsPrefix", "(", "eNS_PREFIX", ")", ";", "setNsURI", ...
Complete the initialization of the package and its meta-model. This method is guarded to have no affect on any invocation but its first. <!-- begin-user-doc --> <!-- end-user-doc --> @generated
[ "Complete", "the", "initialization", "of", "the", "package", "and", "its", "meta", "-", "model", ".", "This", "method", "is", "guarded", "to", "have", "no", "affect", "on", "any", "invocation", "but", "its", "first", ".", "<!", "--", "begin", "-", "user"...
train
https://github.com/eclipse/xtext-extras/blob/451359541295323a29f5855e633f770cec02069a/org.eclipse.xtext.purexbase/src-gen/org/eclipse/xtext/purexbase/pureXbase/impl/PureXbasePackageImpl.java#L181-L208
zackpollard/JavaTelegramBot-API
core/src/main/java/pro/zackpollard/telegrambot/api/TelegramBot.java
TelegramBot.answerCallbackQuery
@Deprecated public boolean answerCallbackQuery(String callbackQueryId, String text, boolean showAlert) { return this.answerCallbackQuery(callbackQueryId, CallbackQueryResponse.builder().text(text).showAlert(showAlert).build()); }
java
@Deprecated public boolean answerCallbackQuery(String callbackQueryId, String text, boolean showAlert) { return this.answerCallbackQuery(callbackQueryId, CallbackQueryResponse.builder().text(text).showAlert(showAlert).build()); }
[ "@", "Deprecated", "public", "boolean", "answerCallbackQuery", "(", "String", "callbackQueryId", ",", "String", "text", ",", "boolean", "showAlert", ")", "{", "return", "this", ".", "answerCallbackQuery", "(", "callbackQueryId", ",", "CallbackQueryResponse", ".", "b...
This allows you to respond to a callback query with some text as a response. This will either show up as an alert or as a toast on the telegram client @param callbackQueryId The ID of the callback query you are responding to @param text The text you would like to respond with @param showAlert True will show the text as an alert, false will show it as a toast notification @deprecated This method is deprecated in favour of the {@link #answerCallbackQuery(String, CallbackQueryResponse)} method, this should be used for all new implementations @return True if the response was sent successfully, otherwise False
[ "This", "allows", "you", "to", "respond", "to", "a", "callback", "query", "with", "some", "text", "as", "a", "response", ".", "This", "will", "either", "show", "up", "as", "an", "alert", "or", "as", "a", "toast", "on", "the", "telegram", "client" ]
train
https://github.com/zackpollard/JavaTelegramBot-API/blob/9d100f351824042ca5fc0ea735d1fa376a13e81d/core/src/main/java/pro/zackpollard/telegrambot/api/TelegramBot.java#L980-L984
camunda/camunda-xml-model
src/main/java/org/camunda/bpm/model/xml/impl/type/reference/ReferenceImpl.java
ReferenceImpl.setReferenceTargetElement
public void setReferenceTargetElement(ModelElementInstance referenceSourceElement, T referenceTargetElement) { ModelInstance modelInstance = referenceSourceElement.getModelInstance(); String referenceTargetIdentifier = referenceTargetAttribute.getValue(referenceTargetElement); ModelElementInstance existingElement = modelInstance.getModelElementById(referenceTargetIdentifier); if(existingElement == null || !existingElement.equals(referenceTargetElement)) { throw new ModelReferenceException("Cannot create reference to model element " + referenceTargetElement +": element is not part of model. Please connect element to the model first."); } else { setReferenceIdentifier(referenceSourceElement, referenceTargetIdentifier); } }
java
public void setReferenceTargetElement(ModelElementInstance referenceSourceElement, T referenceTargetElement) { ModelInstance modelInstance = referenceSourceElement.getModelInstance(); String referenceTargetIdentifier = referenceTargetAttribute.getValue(referenceTargetElement); ModelElementInstance existingElement = modelInstance.getModelElementById(referenceTargetIdentifier); if(existingElement == null || !existingElement.equals(referenceTargetElement)) { throw new ModelReferenceException("Cannot create reference to model element " + referenceTargetElement +": element is not part of model. Please connect element to the model first."); } else { setReferenceIdentifier(referenceSourceElement, referenceTargetIdentifier); } }
[ "public", "void", "setReferenceTargetElement", "(", "ModelElementInstance", "referenceSourceElement", ",", "T", "referenceTargetElement", ")", "{", "ModelInstance", "modelInstance", "=", "referenceSourceElement", ".", "getModelInstance", "(", ")", ";", "String", "referenceT...
Set the reference target model element instance @param referenceSourceElement the reference source model element instance @param referenceTargetElement the reference target model element instance @throws ModelReferenceException if element is not already added to the model
[ "Set", "the", "reference", "target", "model", "element", "instance" ]
train
https://github.com/camunda/camunda-xml-model/blob/85b3f879e26d063f71c94cfd21ac17d9ff6baf4d/src/main/java/org/camunda/bpm/model/xml/impl/type/reference/ReferenceImpl.java#L82-L93
TheCoder4eu/BootsFaces-OSP
src/main/java/net/bootsfaces/render/CoreRenderer.java
CoreRenderer.beginDisabledFieldset
public static boolean beginDisabledFieldset(IContentDisabled component, ResponseWriter rw) throws IOException { if (component.isContentDisabled()) { rw.startElement("fieldset", (UIComponent) component); rw.writeAttribute("disabled", "disabled", "null"); return true; } return false; }
java
public static boolean beginDisabledFieldset(IContentDisabled component, ResponseWriter rw) throws IOException { if (component.isContentDisabled()) { rw.startElement("fieldset", (UIComponent) component); rw.writeAttribute("disabled", "disabled", "null"); return true; } return false; }
[ "public", "static", "boolean", "beginDisabledFieldset", "(", "IContentDisabled", "component", ",", "ResponseWriter", "rw", ")", "throws", "IOException", "{", "if", "(", "component", ".", "isContentDisabled", "(", ")", ")", "{", "rw", ".", "startElement", "(", "\...
Renders the code disabling every input field and every button within a container. @param component @param rw @return true if an element has been rendered @throws IOException
[ "Renders", "the", "code", "disabling", "every", "input", "field", "and", "every", "button", "within", "a", "container", "." ]
train
https://github.com/TheCoder4eu/BootsFaces-OSP/blob/d1a70952bc240979b5272fa4fe1c7f100873add0/src/main/java/net/bootsfaces/render/CoreRenderer.java#L621-L628
aws/aws-sdk-java
aws-java-sdk-apigatewayv2/src/main/java/com/amazonaws/services/apigatewayv2/model/CreateRouteResponseRequest.java
CreateRouteResponseRequest.withResponseModels
public CreateRouteResponseRequest withResponseModels(java.util.Map<String, String> responseModels) { setResponseModels(responseModels); return this; }
java
public CreateRouteResponseRequest withResponseModels(java.util.Map<String, String> responseModels) { setResponseModels(responseModels); return this; }
[ "public", "CreateRouteResponseRequest", "withResponseModels", "(", "java", ".", "util", ".", "Map", "<", "String", ",", "String", ">", "responseModels", ")", "{", "setResponseModels", "(", "responseModels", ")", ";", "return", "this", ";", "}" ]
<p> The response models for the route response. </p> @param responseModels The response models for the route response. @return Returns a reference to this object so that method calls can be chained together.
[ "<p", ">", "The", "response", "models", "for", "the", "route", "response", ".", "<", "/", "p", ">" ]
train
https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-apigatewayv2/src/main/java/com/amazonaws/services/apigatewayv2/model/CreateRouteResponseRequest.java#L175-L178
JOML-CI/JOML
src/org/joml/Matrix4x3d.java
Matrix4x3d.rotateXYZ
public Matrix4x3d rotateXYZ(Vector3d angles) { return rotateXYZ(angles.x, angles.y, angles.z); }
java
public Matrix4x3d rotateXYZ(Vector3d angles) { return rotateXYZ(angles.x, angles.y, angles.z); }
[ "public", "Matrix4x3d", "rotateXYZ", "(", "Vector3d", "angles", ")", "{", "return", "rotateXYZ", "(", "angles", ".", "x", ",", "angles", ".", "y", ",", "angles", ".", "z", ")", ";", "}" ]
Apply rotation of <code>angles.x</code> radians about the X axis, followed by a rotation of <code>angles.y</code> radians about the Y axis and followed by a rotation of <code>angles.z</code> radians about the Z axis. <p> When used with a right-handed coordinate system, the produced rotation will rotate a vector counter-clockwise around the rotation axis, when viewing along the negative axis direction towards the origin. When used with a left-handed coordinate system, the rotation is clockwise. <p> If <code>M</code> is <code>this</code> matrix and <code>R</code> the rotation matrix, then the new matrix will be <code>M * R</code>. So when transforming a vector <code>v</code> with the new matrix by using <code>M * R * v</code>, the rotation will be applied first! <p> This method is equivalent to calling: <code>rotateX(angles.x).rotateY(angles.y).rotateZ(angles.z)</code> @param angles the Euler angles @return this
[ "Apply", "rotation", "of", "<code", ">", "angles", ".", "x<", "/", "code", ">", "radians", "about", "the", "X", "axis", "followed", "by", "a", "rotation", "of", "<code", ">", "angles", ".", "y<", "/", "code", ">", "radians", "about", "the", "Y", "axi...
train
https://github.com/JOML-CI/JOML/blob/ce2652fc236b42bda3875c591f8e6645048a678f/src/org/joml/Matrix4x3d.java#L4388-L4390
alkacon/opencms-core
src/org/opencms/db/generic/CmsVfsDriver.java
CmsVfsDriver.prepareResourceCondition
protected void prepareResourceCondition(CmsUUID projectId, int mode, StringBuffer conditions) { if ((mode & CmsDriverManager.READMODE_ONLY_FOLDERS) > 0) { // C_READMODE_ONLY_FOLDERS: add condition to match only folders conditions.append(BEGIN_INCLUDE_CONDITION); conditions.append(m_sqlManager.readQuery(projectId, "C_RESOURCES_SELECT_ONLY_FOLDERS")); conditions.append(END_CONDITION); } else if ((mode & CmsDriverManager.READMODE_ONLY_FILES) > 0) { // C_READMODE_ONLY_FILES: add condition to match only files conditions.append(BEGIN_INCLUDE_CONDITION); conditions.append(m_sqlManager.readQuery(projectId, "C_RESOURCES_SELECT_ONLY_FILES")); conditions.append(END_CONDITION); } }
java
protected void prepareResourceCondition(CmsUUID projectId, int mode, StringBuffer conditions) { if ((mode & CmsDriverManager.READMODE_ONLY_FOLDERS) > 0) { // C_READMODE_ONLY_FOLDERS: add condition to match only folders conditions.append(BEGIN_INCLUDE_CONDITION); conditions.append(m_sqlManager.readQuery(projectId, "C_RESOURCES_SELECT_ONLY_FOLDERS")); conditions.append(END_CONDITION); } else if ((mode & CmsDriverManager.READMODE_ONLY_FILES) > 0) { // C_READMODE_ONLY_FILES: add condition to match only files conditions.append(BEGIN_INCLUDE_CONDITION); conditions.append(m_sqlManager.readQuery(projectId, "C_RESOURCES_SELECT_ONLY_FILES")); conditions.append(END_CONDITION); } }
[ "protected", "void", "prepareResourceCondition", "(", "CmsUUID", "projectId", ",", "int", "mode", ",", "StringBuffer", "conditions", ")", "{", "if", "(", "(", "mode", "&", "CmsDriverManager", ".", "READMODE_ONLY_FOLDERS", ")", ">", "0", ")", "{", "// C_READMODE_...
Appends the appropriate selection criteria related with the read mode.<p> @param projectId the id of the project of the resources @param mode the selection mode @param conditions buffer to append the selection criteria
[ "Appends", "the", "appropriate", "selection", "criteria", "related", "with", "the", "read", "mode", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/db/generic/CmsVfsDriver.java#L4388-L4401
apache/incubator-druid
processing/src/main/java/org/apache/druid/query/groupby/epinephelinae/ParallelCombiner.java
ParallelCombiner.computeRequiredBufferNum
private int computeRequiredBufferNum(int numChildNodes, int combineDegree) { // numChildrenForLastNode used to determine that the last node is needed for the current level. // Please see buildCombineTree() for more details. final int numChildrenForLastNode = numChildNodes % combineDegree; final int numCurLevelNodes = numChildNodes / combineDegree + (numChildrenForLastNode > 1 ? 1 : 0); final int numChildOfParentNodes = numCurLevelNodes + (numChildrenForLastNode == 1 ? 1 : 0); if (numChildOfParentNodes == 1) { return numCurLevelNodes; } else { return numCurLevelNodes + computeRequiredBufferNum(numChildOfParentNodes, intermediateCombineDegree); } }
java
private int computeRequiredBufferNum(int numChildNodes, int combineDegree) { // numChildrenForLastNode used to determine that the last node is needed for the current level. // Please see buildCombineTree() for more details. final int numChildrenForLastNode = numChildNodes % combineDegree; final int numCurLevelNodes = numChildNodes / combineDegree + (numChildrenForLastNode > 1 ? 1 : 0); final int numChildOfParentNodes = numCurLevelNodes + (numChildrenForLastNode == 1 ? 1 : 0); if (numChildOfParentNodes == 1) { return numCurLevelNodes; } else { return numCurLevelNodes + computeRequiredBufferNum(numChildOfParentNodes, intermediateCombineDegree); } }
[ "private", "int", "computeRequiredBufferNum", "(", "int", "numChildNodes", ",", "int", "combineDegree", ")", "{", "// numChildrenForLastNode used to determine that the last node is needed for the current level.", "// Please see buildCombineTree() for more details.", "final", "int", "nu...
Recursively compute the number of required buffers for a combining tree in a bottom-up manner. Since each node of the combining tree represents a combining task and each combining task requires one buffer, the number of required buffers is the number of nodes of the combining tree. @param numChildNodes number of child nodes @param combineDegree combine degree for the current level @return minimum number of buffers required for combining tree @see #buildCombineTree
[ "Recursively", "compute", "the", "number", "of", "required", "buffers", "for", "a", "combining", "tree", "in", "a", "bottom", "-", "up", "manner", ".", "Since", "each", "node", "of", "the", "combining", "tree", "represents", "a", "combining", "task", "and", ...
train
https://github.com/apache/incubator-druid/blob/f776b9408962b9006cfcfe4d6c1794751972cc8e/processing/src/main/java/org/apache/druid/query/groupby/epinephelinae/ParallelCombiner.java#L282-L296
cloudant/java-cloudant
cloudant-client/src/main/java/com/cloudant/client/api/Database.java
Database.removeAttachment
public com.cloudant.client.api.model.Response removeAttachment(String id, String rev, String attachmentName) { Response couchDbResponse = db.removeAttachment(id, rev, attachmentName); com.cloudant.client.api.model.Response response = new com.cloudant.client.api.model .Response(couchDbResponse); return response; }
java
public com.cloudant.client.api.model.Response removeAttachment(String id, String rev, String attachmentName) { Response couchDbResponse = db.removeAttachment(id, rev, attachmentName); com.cloudant.client.api.model.Response response = new com.cloudant.client.api.model .Response(couchDbResponse); return response; }
[ "public", "com", ".", "cloudant", ".", "client", ".", "api", ".", "model", ".", "Response", "removeAttachment", "(", "String", "id", ",", "String", "rev", ",", "String", "attachmentName", ")", "{", "Response", "couchDbResponse", "=", "db", ".", "removeAttach...
Removes the attachment from a document the specified {@code _id} and {@code _rev} and {@code attachmentName} values. <P>Example usage:</P> <pre> {@code Response response = db.removeAttachment("exampleId", "1-12345exampleRev", "example.jpg"); } </pre> @param id the document _id field @param rev the document _rev field @param attachmentName the attachment name @return {@link com.cloudant.client.api.model.Response} @throws NoDocumentException If the document is not found in the database. @throws DocumentConflictException if the attachment cannot be removed because of a conflict @see <a href="https://console.bluemix.net/docs/services/Cloudant/api/attachments.html#delete" target="_blank">Documents - delete</a>
[ "Removes", "the", "attachment", "from", "a", "document", "the", "specified", "{", "@code", "_id", "}", "and", "{", "@code", "_rev", "}", "and", "{", "@code", "attachmentName", "}", "values", ".", "<P", ">", "Example", "usage", ":", "<", "/", "P", ">", ...
train
https://github.com/cloudant/java-cloudant/blob/42c438654945361bded2cc0827afc046d535b31b/cloudant-client/src/main/java/com/cloudant/client/api/Database.java#L1342-L1347
hypercube1024/firefly
firefly-common/src/main/java/com/firefly/utils/function/Actions.java
Actions.toFunc
public static <T1, T2, T3, T4, T5, T6, T7, R> Func7<T1, T2, T3, T4, T5, T6, T7, R> toFunc( final Action7<T1, T2, T3, T4, T5, T6, T7> action, final R result) { return new Func7<T1, T2, T3, T4, T5, T6, T7, R>() { @Override public R call(T1 t1, T2 t2, T3 t3, T4 t4, T5 t5, T6 t6, T7 t7) { action.call(t1, t2, t3, t4, t5, t6, t7); return result; } }; }
java
public static <T1, T2, T3, T4, T5, T6, T7, R> Func7<T1, T2, T3, T4, T5, T6, T7, R> toFunc( final Action7<T1, T2, T3, T4, T5, T6, T7> action, final R result) { return new Func7<T1, T2, T3, T4, T5, T6, T7, R>() { @Override public R call(T1 t1, T2 t2, T3 t3, T4 t4, T5 t5, T6 t6, T7 t7) { action.call(t1, t2, t3, t4, t5, t6, t7); return result; } }; }
[ "public", "static", "<", "T1", ",", "T2", ",", "T3", ",", "T4", ",", "T5", ",", "T6", ",", "T7", ",", "R", ">", "Func7", "<", "T1", ",", "T2", ",", "T3", ",", "T4", ",", "T5", ",", "T6", ",", "T7", ",", "R", ">", "toFunc", "(", "final", ...
Converts an {@link Action7} to a function that calls the action and returns a specified value. @param action the {@link Action7} to convert @param result the value to return from the function call @return a {@link Func7} that calls {@code action} and returns {@code result}
[ "Converts", "an", "{", "@link", "Action7", "}", "to", "a", "function", "that", "calls", "the", "action", "and", "returns", "a", "specified", "value", "." ]
train
https://github.com/hypercube1024/firefly/blob/ed3fc75b7c54a65b1e7d8141d01b49144bb423a3/firefly-common/src/main/java/com/firefly/utils/function/Actions.java#L323-L332
liferay/com-liferay-commerce
commerce-tax-service/src/main/java/com/liferay/commerce/tax/service/persistence/impl/CommerceTaxMethodPersistenceImpl.java
CommerceTaxMethodPersistenceImpl.findByGroupId
@Override public List<CommerceTaxMethod> findByGroupId(long groupId, int start, int end) { return findByGroupId(groupId, start, end, null); }
java
@Override public List<CommerceTaxMethod> findByGroupId(long groupId, int start, int end) { return findByGroupId(groupId, start, end, null); }
[ "@", "Override", "public", "List", "<", "CommerceTaxMethod", ">", "findByGroupId", "(", "long", "groupId", ",", "int", "start", ",", "int", "end", ")", "{", "return", "findByGroupId", "(", "groupId", ",", "start", ",", "end", ",", "null", ")", ";", "}" ]
Returns a range of all the commerce tax methods where groupId = &#63;. <p> Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link QueryUtil#ALL_POS} will return the full result set. If <code>orderByComparator</code> is specified, then the query will include the given ORDER BY logic. If <code>orderByComparator</code> is absent and pagination is required (<code>start</code> and <code>end</code> are not {@link QueryUtil#ALL_POS}), then the query will include the default ORDER BY logic from {@link CommerceTaxMethodModelImpl}. If both <code>orderByComparator</code> and pagination are absent, for performance reasons, the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order. </p> @param groupId the group ID @param start the lower bound of the range of commerce tax methods @param end the upper bound of the range of commerce tax methods (not inclusive) @return the range of matching commerce tax methods
[ "Returns", "a", "range", "of", "all", "the", "commerce", "tax", "methods", "where", "groupId", "=", "&#63", ";", "." ]
train
https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-tax-service/src/main/java/com/liferay/commerce/tax/service/persistence/impl/CommerceTaxMethodPersistenceImpl.java#L142-L146
lecousin/java-framework-core
net.lecousin.core/src/main/java/net/lecousin/framework/concurrent/Threading.java
Threading.waitUnblockedWithError
public static <TError extends Exception> void waitUnblockedWithError(Collection<AsyncWork<?,TError>> tasks) throws TError, CancelException { for (AsyncWork<?,TError> t : tasks) t.blockResult(0); }
java
public static <TError extends Exception> void waitUnblockedWithError(Collection<AsyncWork<?,TError>> tasks) throws TError, CancelException { for (AsyncWork<?,TError> t : tasks) t.blockResult(0); }
[ "public", "static", "<", "TError", "extends", "Exception", ">", "void", "waitUnblockedWithError", "(", "Collection", "<", "AsyncWork", "<", "?", ",", "TError", ">", ">", "tasks", ")", "throws", "TError", ",", "CancelException", "{", "for", "(", "AsyncWork", ...
Wait for the given tasks to finish, if one has an error this error is immediately thrown without waiting for other tasks.
[ "Wait", "for", "the", "given", "tasks", "to", "finish", "if", "one", "has", "an", "error", "this", "error", "is", "immediately", "thrown", "without", "waiting", "for", "other", "tasks", "." ]
train
https://github.com/lecousin/java-framework-core/blob/b0c893b44bfde2c03f90ea846a49ef5749d598f3/net.lecousin.core/src/main/java/net/lecousin/framework/concurrent/Threading.java#L215-L218
pippo-java/pippo
pippo-core/src/main/java/ro/pippo/core/PippoSettings.java
PippoSettings.overrideSetting
public void overrideSetting(String name, double value) { overrides.put(name, Double.toString(value)); }
java
public void overrideSetting(String name, double value) { overrides.put(name, Double.toString(value)); }
[ "public", "void", "overrideSetting", "(", "String", "name", ",", "double", "value", ")", "{", "overrides", ".", "put", "(", "name", ",", "Double", ".", "toString", "(", "value", ")", ")", ";", "}" ]
Override the setting at runtime with the specified value. This change does not persist. @param name @param value
[ "Override", "the", "setting", "at", "runtime", "with", "the", "specified", "value", ".", "This", "change", "does", "not", "persist", "." ]
train
https://github.com/pippo-java/pippo/blob/cb5ccb453bffcc3cf386adc660674812d10b9726/pippo-core/src/main/java/ro/pippo/core/PippoSettings.java#L1078-L1080
alkacon/opencms-core
src/org/opencms/workplace/editors/CmsEditor.java
CmsEditor.deleteLocaleButton
public String deleteLocaleButton(String href, String target, String image, String label, int type) { String filename = getParamResource(); try { CmsResource res = getCms().readResource(filename, CmsResourceFilter.IGNORE_EXPIRATION); String temporaryFilename = CmsWorkplace.getTemporaryFileName(filename); if (getCms().existsResource(temporaryFilename, CmsResourceFilter.IGNORE_EXPIRATION)) { res = getCms().readResource(temporaryFilename, CmsResourceFilter.IGNORE_EXPIRATION); } CmsFile file = getCms().readFile(res); CmsXmlContent xmlContent = CmsXmlContentFactory.unmarshal(getCms(), file); int locales = xmlContent.getLocales().size(); // there are less than 2 locales, so disable the delete locale button if (locales < 2) { href = null; target = null; image += "_in"; } } catch (CmsException e) { // to nothing here in case the resource could not be opened if (LOG.isErrorEnabled()) { LOG.error(Messages.get().getBundle().key(Messages.LOG_GET_LOCALES_1, filename), e); } } return button(href, target, image, label, type, getSkinUri() + "buttons/"); }
java
public String deleteLocaleButton(String href, String target, String image, String label, int type) { String filename = getParamResource(); try { CmsResource res = getCms().readResource(filename, CmsResourceFilter.IGNORE_EXPIRATION); String temporaryFilename = CmsWorkplace.getTemporaryFileName(filename); if (getCms().existsResource(temporaryFilename, CmsResourceFilter.IGNORE_EXPIRATION)) { res = getCms().readResource(temporaryFilename, CmsResourceFilter.IGNORE_EXPIRATION); } CmsFile file = getCms().readFile(res); CmsXmlContent xmlContent = CmsXmlContentFactory.unmarshal(getCms(), file); int locales = xmlContent.getLocales().size(); // there are less than 2 locales, so disable the delete locale button if (locales < 2) { href = null; target = null; image += "_in"; } } catch (CmsException e) { // to nothing here in case the resource could not be opened if (LOG.isErrorEnabled()) { LOG.error(Messages.get().getBundle().key(Messages.LOG_GET_LOCALES_1, filename), e); } } return button(href, target, image, label, type, getSkinUri() + "buttons/"); }
[ "public", "String", "deleteLocaleButton", "(", "String", "href", ",", "String", "target", ",", "String", "image", ",", "String", "label", ",", "int", "type", ")", "{", "String", "filename", "=", "getParamResource", "(", ")", ";", "try", "{", "CmsResource", ...
Generates a button for delete locale.<p> @param href the href link for the button, if none is given the button will be disabled @param target the href link target for the button, if none is given the target will be same window @param image the image name for the button, skin path will be automatically added as prefix @param label the label for the text of the button @param type 0: image only (default), 1: image and text, 2: text only @return a button for the OpenCms workplace
[ "Generates", "a", "button", "for", "delete", "locale", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/workplace/editors/CmsEditor.java#L435-L463
k3po/k3po
driver/src/main/java/org/kaazing/k3po/driver/internal/netty/bootstrap/udp/UdpBootstrapFactorySpi.java
UdpBootstrapFactorySpi.newClientBootstrap
@Override public synchronized ClientBootstrap newClientBootstrap() throws Exception { if (clientChannelFactory == null) { Executor workerExecutor = executorServiceFactory.newExecutorService("worker.client"); NioDatagramWorkerPool workerPool = new NioDatagramWorkerPool(workerExecutor, 1); clientChannelFactory = new NioDatagramChannelFactory(workerPool); // unshared channelFactories.add(clientChannelFactory); } return new UdpClientBootstrap(clientChannelFactory, timer); }
java
@Override public synchronized ClientBootstrap newClientBootstrap() throws Exception { if (clientChannelFactory == null) { Executor workerExecutor = executorServiceFactory.newExecutorService("worker.client"); NioDatagramWorkerPool workerPool = new NioDatagramWorkerPool(workerExecutor, 1); clientChannelFactory = new NioDatagramChannelFactory(workerPool); // unshared channelFactories.add(clientChannelFactory); } return new UdpClientBootstrap(clientChannelFactory, timer); }
[ "@", "Override", "public", "synchronized", "ClientBootstrap", "newClientBootstrap", "(", ")", "throws", "Exception", "{", "if", "(", "clientChannelFactory", "==", "null", ")", "{", "Executor", "workerExecutor", "=", "executorServiceFactory", ".", "newExecutorService", ...
Returns a {@link ClientBootstrap} instance for the named transport.
[ "Returns", "a", "{" ]
train
https://github.com/k3po/k3po/blob/3ca4fd31ab4a397893aa640c62ada0e485c8bbd4/driver/src/main/java/org/kaazing/k3po/driver/internal/netty/bootstrap/udp/UdpBootstrapFactorySpi.java#L89-L102
Erudika/para
para-server/src/main/java/com/erudika/para/security/filters/PasswordAuthFilter.java
PasswordAuthFilter.attemptAuthentication
@Override public Authentication attemptAuthentication(HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException { String requestURI = request.getRequestURI(); UserAuthentication userAuth = null; User user = null; if (requestURI.endsWith(PASSWORD_ACTION)) { user = new User(); user.setIdentifier(request.getParameter(EMAIL)); user.setPassword(request.getParameter(PASSWORD)); String appid = request.getParameter(Config._APPID); if (!App.isRoot(appid)) { App app = Para.getDAO().read(App.id(appid)); if (app != null) { user.setAppid(app.getAppIdentifier()); } } if (User.passwordMatches(user) && StringUtils.contains(user.getIdentifier(), "@")) { //success! user = User.readUserForIdentifier(user); userAuth = new UserAuthentication(new AuthenticatedUserDetails(user)); } } return SecurityUtils.checkIfActive(userAuth, user, true); }
java
@Override public Authentication attemptAuthentication(HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException { String requestURI = request.getRequestURI(); UserAuthentication userAuth = null; User user = null; if (requestURI.endsWith(PASSWORD_ACTION)) { user = new User(); user.setIdentifier(request.getParameter(EMAIL)); user.setPassword(request.getParameter(PASSWORD)); String appid = request.getParameter(Config._APPID); if (!App.isRoot(appid)) { App app = Para.getDAO().read(App.id(appid)); if (app != null) { user.setAppid(app.getAppIdentifier()); } } if (User.passwordMatches(user) && StringUtils.contains(user.getIdentifier(), "@")) { //success! user = User.readUserForIdentifier(user); userAuth = new UserAuthentication(new AuthenticatedUserDetails(user)); } } return SecurityUtils.checkIfActive(userAuth, user, true); }
[ "@", "Override", "public", "Authentication", "attemptAuthentication", "(", "HttpServletRequest", "request", ",", "HttpServletResponse", "response", ")", "throws", "IOException", ",", "ServletException", "{", "String", "requestURI", "=", "request", ".", "getRequestURI", ...
Handles an authentication request. @param request HTTP request @param response HTTP response @return an authentication object that contains the principal object if successful. @throws IOException ex @throws ServletException ex
[ "Handles", "an", "authentication", "request", "." ]
train
https://github.com/Erudika/para/blob/5ba096c477042ea7b18e9a0e8b5b1ee0f5bd6ce9/para-server/src/main/java/com/erudika/para/security/filters/PasswordAuthFilter.java#L65-L90
Hygieia/Hygieia
collectors/misc/score/src/main/java/com/capitalone/dashboard/widget/QualityWidgetScore.java
QualityWidgetScore.fetchQualityValue
private Double fetchQualityValue(Iterable<CodeQuality> qualityIterable, String param) { Double paramValue = null; Iterator<CodeQuality> qualityIterator = qualityIterable.iterator(); if (!qualityIterator.hasNext()) { return paramValue; } CodeQuality codeQuality = qualityIterator.next(); for (CodeQualityMetric codeQualityMetric : codeQuality.getMetrics()) { if (codeQualityMetric.getName().equals(param)) { paramValue = Double.valueOf(codeQualityMetric.getValue()); break; } } return paramValue; }
java
private Double fetchQualityValue(Iterable<CodeQuality> qualityIterable, String param) { Double paramValue = null; Iterator<CodeQuality> qualityIterator = qualityIterable.iterator(); if (!qualityIterator.hasNext()) { return paramValue; } CodeQuality codeQuality = qualityIterator.next(); for (CodeQualityMetric codeQualityMetric : codeQuality.getMetrics()) { if (codeQualityMetric.getName().equals(param)) { paramValue = Double.valueOf(codeQualityMetric.getValue()); break; } } return paramValue; }
[ "private", "Double", "fetchQualityValue", "(", "Iterable", "<", "CodeQuality", ">", "qualityIterable", ",", "String", "param", ")", "{", "Double", "paramValue", "=", "null", ";", "Iterator", "<", "CodeQuality", ">", "qualityIterator", "=", "qualityIterable", ".", ...
Fetch param value by param name from quality values @param qualityIterable @param param quality param @return Param Value
[ "Fetch", "param", "value", "by", "param", "name", "from", "quality", "values" ]
train
https://github.com/Hygieia/Hygieia/blob/d8b67a590da2744acf59bcd99d9b34ef1bb84890/collectors/misc/score/src/main/java/com/capitalone/dashboard/widget/QualityWidgetScore.java#L276-L293
selenide/selenide
src/main/java/com/codeborne/selenide/Condition.java
Condition.exactTextCaseSensitive
public static Condition exactTextCaseSensitive(final String text) { return new Condition("exact text case sensitive") { @Override public boolean apply(Driver driver, WebElement element) { return Html.text.equalsCaseSensitive(element.getText(), text); } @Override public String toString() { return name + " '" + text + '\''; } }; }
java
public static Condition exactTextCaseSensitive(final String text) { return new Condition("exact text case sensitive") { @Override public boolean apply(Driver driver, WebElement element) { return Html.text.equalsCaseSensitive(element.getText(), text); } @Override public String toString() { return name + " '" + text + '\''; } }; }
[ "public", "static", "Condition", "exactTextCaseSensitive", "(", "final", "String", "text", ")", "{", "return", "new", "Condition", "(", "\"exact text case sensitive\"", ")", "{", "@", "Override", "public", "boolean", "apply", "(", "Driver", "driver", ",", "WebElem...
<p>Sample: <code>$("h1").shouldHave(exactTextCaseSensitive("Hello"))</code></p> <p>NB! Ignores multiple whitespaces between words</p> @param text expected text of HTML element
[ "<p", ">", "Sample", ":", "<code", ">", "$", "(", "h1", ")", ".", "shouldHave", "(", "exactTextCaseSensitive", "(", "Hello", "))", "<", "/", "code", ">", "<", "/", "p", ">" ]
train
https://github.com/selenide/selenide/blob/b867baf171942cf07725d83a985237428569883f/src/main/java/com/codeborne/selenide/Condition.java#L341-L353
taimos/dvalin
daemon/src/main/java/de/taimos/daemon/DaemonStarter.java
DaemonStarter.startDaemon
public static void startDaemon(final String _daemonName, final IDaemonLifecycleListener _lifecycleListener) { // Run de.taimos.daemon async Executors.newSingleThreadExecutor().execute(() -> DaemonStarter.doStartDaemon(_daemonName, _lifecycleListener)); }
java
public static void startDaemon(final String _daemonName, final IDaemonLifecycleListener _lifecycleListener) { // Run de.taimos.daemon async Executors.newSingleThreadExecutor().execute(() -> DaemonStarter.doStartDaemon(_daemonName, _lifecycleListener)); }
[ "public", "static", "void", "startDaemon", "(", "final", "String", "_daemonName", ",", "final", "IDaemonLifecycleListener", "_lifecycleListener", ")", "{", "// Run de.taimos.daemon async", "Executors", ".", "newSingleThreadExecutor", "(", ")", ".", "execute", "(", "(", ...
Starts the daemon and provides feedback through the life-cycle listener<br> <br> @param _daemonName the name of this daemon @param _lifecycleListener the {@link IDaemonLifecycleListener} to use for phase call-backs
[ "Starts", "the", "daemon", "and", "provides", "feedback", "through", "the", "life", "-", "cycle", "listener<br", ">", "<br", ">" ]
train
https://github.com/taimos/dvalin/blob/ff8f1bf594e43d7e8ca8de0b4da9f923b66a1a47/daemon/src/main/java/de/taimos/daemon/DaemonStarter.java#L138-L141
BorderTech/wcomponents
wcomponents-core/src/main/java/com/github/bordertech/wcomponents/AjaxHelper.java
AjaxHelper.registerContainer
static AjaxOperation registerContainer(final String triggerId, final String containerId, final String containerContentId) { AjaxOperation operation = new AjaxOperation(triggerId, containerContentId); operation.setTargetContainerId(containerId); operation.setAction(AjaxOperation.AjaxAction.REPLACE_CONTENT); registerAjaxOperation(operation); return operation; }
java
static AjaxOperation registerContainer(final String triggerId, final String containerId, final String containerContentId) { AjaxOperation operation = new AjaxOperation(triggerId, containerContentId); operation.setTargetContainerId(containerId); operation.setAction(AjaxOperation.AjaxAction.REPLACE_CONTENT); registerAjaxOperation(operation); return operation; }
[ "static", "AjaxOperation", "registerContainer", "(", "final", "String", "triggerId", ",", "final", "String", "containerId", ",", "final", "String", "containerContentId", ")", "{", "AjaxOperation", "operation", "=", "new", "AjaxOperation", "(", "triggerId", ",", "con...
This internal method is used to register an arbitrary target container. It must only used by components which contain implicit AJAX capability. @param triggerId the id of the trigger that will cause the component to be painted. @param containerId the target container id. This is not necessarily a WComponent id. @param containerContentId the container content. @return the AjaxOperation control configuration object.
[ "This", "internal", "method", "is", "used", "to", "register", "an", "arbitrary", "target", "container", ".", "It", "must", "only", "used", "by", "components", "which", "contain", "implicit", "AJAX", "capability", "." ]
train
https://github.com/BorderTech/wcomponents/blob/d1a2b2243270067db030feb36ca74255aaa94436/wcomponents-core/src/main/java/com/github/bordertech/wcomponents/AjaxHelper.java#L128-L135
Samsung/GearVRf
GVRf/Framework/framework/src/main/java/org/gearvrf/utility/Assert.java
Assert.checkNotNull
public static void checkNotNull(String parameterName, Object object) { if (object == null) { throw Exceptions.IllegalArgument("Input %s can't be null.", parameterName); } }
java
public static void checkNotNull(String parameterName, Object object) { if (object == null) { throw Exceptions.IllegalArgument("Input %s can't be null.", parameterName); } }
[ "public", "static", "void", "checkNotNull", "(", "String", "parameterName", ",", "Object", "object", ")", "{", "if", "(", "object", "==", "null", ")", "{", "throw", "Exceptions", ".", "IllegalArgument", "(", "\"Input %s can't be null.\"", ",", "parameterName", "...
Check that the parameter is not {@code null}. @param parameterName The name of the user-supplied parameter that we are validating so that the user can easily find the error in their code. @param object The parameter object can be any Java reference type, including arrays. @throws IllegalArgumentException If the object is null pointer.
[ "Check", "that", "the", "parameter", "is", "not", "{", "@code", "null", "}", "." ]
train
https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Framework/framework/src/main/java/org/gearvrf/utility/Assert.java#L47-L52
jtablesaw/tablesaw
core/src/main/java/tech/tablesaw/sorting/SortUtils.java
SortUtils.getComparator
public static IntComparator getComparator(Table table, Sort key) { Iterator<Map.Entry<String, Sort.Order>> entries = key.iterator(); Map.Entry<String, Sort.Order> sort = entries.next(); Column<?> column = table.column(sort.getKey()); return SortUtils.rowComparator(column, sort.getValue()); }
java
public static IntComparator getComparator(Table table, Sort key) { Iterator<Map.Entry<String, Sort.Order>> entries = key.iterator(); Map.Entry<String, Sort.Order> sort = entries.next(); Column<?> column = table.column(sort.getKey()); return SortUtils.rowComparator(column, sort.getValue()); }
[ "public", "static", "IntComparator", "getComparator", "(", "Table", "table", ",", "Sort", "key", ")", "{", "Iterator", "<", "Map", ".", "Entry", "<", "String", ",", "Sort", ".", "Order", ">", ">", "entries", "=", "key", ".", "iterator", "(", ")", ";", ...
Returns a comparator that can be used to sort the records in this table according to the given sort key
[ "Returns", "a", "comparator", "that", "can", "be", "used", "to", "sort", "the", "records", "in", "this", "table", "according", "to", "the", "given", "sort", "key" ]
train
https://github.com/jtablesaw/tablesaw/blob/68a75b4098ac677e9486df5572cf13ec39f9f701/core/src/main/java/tech/tablesaw/sorting/SortUtils.java#L49-L54
buschmais/jqa-java-plugin
src/main/java/com/buschmais/jqassistant/plugin/java/impl/scanner/visitor/AbstractAnnotationVisitor.java
AbstractAnnotationVisitor.createValue
private <T extends ValueDescriptor<?>> T createValue(Class<T> type, String name) { if (name != null) { this.arrayValueDescriptor = null; } String valueName; if (arrayValueDescriptor != null) { valueName = "[" + getArrayValue().size() + "]"; } else { valueName = name; } T valueDescriptor = visitorHelper.getValueDescriptor(type); valueDescriptor.setName(valueName); return valueDescriptor; }
java
private <T extends ValueDescriptor<?>> T createValue(Class<T> type, String name) { if (name != null) { this.arrayValueDescriptor = null; } String valueName; if (arrayValueDescriptor != null) { valueName = "[" + getArrayValue().size() + "]"; } else { valueName = name; } T valueDescriptor = visitorHelper.getValueDescriptor(type); valueDescriptor.setName(valueName); return valueDescriptor; }
[ "private", "<", "T", "extends", "ValueDescriptor", "<", "?", ">", ">", "T", "createValue", "(", "Class", "<", "T", ">", "type", ",", "String", "name", ")", "{", "if", "(", "name", "!=", "null", ")", "{", "this", ".", "arrayValueDescriptor", "=", "nul...
Create a value descriptor of given type and name and initializes it. @param type The class type. @param name The name @param <T> The type. @return The initialized descriptor.
[ "Create", "a", "value", "descriptor", "of", "given", "type", "and", "name", "and", "initializes", "it", "." ]
train
https://github.com/buschmais/jqa-java-plugin/blob/4c050943e9c28cf1c4a08aa962d5b5bf03c4fe54/src/main/java/com/buschmais/jqassistant/plugin/java/impl/scanner/visitor/AbstractAnnotationVisitor.java#L98-L111
Azure/azure-sdk-for-java
labservices/resource-manager/v2018_10_15/src/main/java/com/microsoft/azure/management/labservices/v2018_10_15/implementation/EnvironmentsInner.java
EnvironmentsInner.beginResetPassword
public void beginResetPassword(String resourceGroupName, String labAccountName, String labName, String environmentSettingName, String environmentName, ResetPasswordPayload resetPasswordPayload) { beginResetPasswordWithServiceResponseAsync(resourceGroupName, labAccountName, labName, environmentSettingName, environmentName, resetPasswordPayload).toBlocking().single().body(); }
java
public void beginResetPassword(String resourceGroupName, String labAccountName, String labName, String environmentSettingName, String environmentName, ResetPasswordPayload resetPasswordPayload) { beginResetPasswordWithServiceResponseAsync(resourceGroupName, labAccountName, labName, environmentSettingName, environmentName, resetPasswordPayload).toBlocking().single().body(); }
[ "public", "void", "beginResetPassword", "(", "String", "resourceGroupName", ",", "String", "labAccountName", ",", "String", "labName", ",", "String", "environmentSettingName", ",", "String", "environmentName", ",", "ResetPasswordPayload", "resetPasswordPayload", ")", "{",...
Resets the user password on an environment This operation can take a while to complete. @param resourceGroupName The name of the resource group. @param labAccountName The name of the lab Account. @param labName The name of the lab. @param environmentSettingName The name of the environment Setting. @param environmentName The name of the environment. @param resetPasswordPayload Represents the payload for resetting passwords. @throws IllegalArgumentException thrown if parameters fail the validation @throws CloudException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
[ "Resets", "the", "user", "password", "on", "an", "environment", "This", "operation", "can", "take", "a", "while", "to", "complete", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/labservices/resource-manager/v2018_10_15/src/main/java/com/microsoft/azure/management/labservices/v2018_10_15/implementation/EnvironmentsInner.java#L1276-L1278
alkacon/opencms-core
src-gwt/org/opencms/gwt/client/ui/CmsListItemWidget.java
CmsListItemWidget.initAdditionalInfo
protected void initAdditionalInfo(CmsListInfoBean infoBean) { // create the state info CmsResourceState state = infoBean.getResourceState(); if (state != null) { String stateKey = Messages.get().key(Messages.GUI_RESOURCE_STATE_0); String stateValue = CmsResourceStateUtil.getStateName(state); String stateStyle = CmsResourceStateUtil.getStateStyle(state); m_additionalInfo.add(new AdditionalInfoItem(new CmsAdditionalInfoBean(stateKey, stateValue, stateStyle))); ensureOpenCloseAdditionalInfo(); } // set the additional info if (infoBean.hasAdditionalInfo()) { ensureOpenCloseAdditionalInfo(); for (CmsAdditionalInfoBean additionalInfo : infoBean.getAdditionalInfo()) { m_additionalInfo.add(new AdditionalInfoItem(additionalInfo)); } } }
java
protected void initAdditionalInfo(CmsListInfoBean infoBean) { // create the state info CmsResourceState state = infoBean.getResourceState(); if (state != null) { String stateKey = Messages.get().key(Messages.GUI_RESOURCE_STATE_0); String stateValue = CmsResourceStateUtil.getStateName(state); String stateStyle = CmsResourceStateUtil.getStateStyle(state); m_additionalInfo.add(new AdditionalInfoItem(new CmsAdditionalInfoBean(stateKey, stateValue, stateStyle))); ensureOpenCloseAdditionalInfo(); } // set the additional info if (infoBean.hasAdditionalInfo()) { ensureOpenCloseAdditionalInfo(); for (CmsAdditionalInfoBean additionalInfo : infoBean.getAdditionalInfo()) { m_additionalInfo.add(new AdditionalInfoItem(additionalInfo)); } } }
[ "protected", "void", "initAdditionalInfo", "(", "CmsListInfoBean", "infoBean", ")", "{", "// create the state info", "CmsResourceState", "state", "=", "infoBean", ".", "getResourceState", "(", ")", ";", "if", "(", "state", "!=", "null", ")", "{", "String", "stateK...
Initializes the additional info.<p> @param infoBean the info bean
[ "Initializes", "the", "additional", "info", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/gwt/client/ui/CmsListItemWidget.java#L1137-L1156
GoogleCloudPlatform/bigdata-interop
util/src/main/java/com/google/cloud/hadoop/util/ApiErrorExtractor.java
ApiErrorExtractor.recursiveCheckForCode
protected boolean recursiveCheckForCode(Throwable e, int code) { GoogleJsonResponseException jsonException = getJsonResponseExceptionOrNull(e); if (jsonException != null) { return getHttpStatusCode(jsonException) == code; } return false; }
java
protected boolean recursiveCheckForCode(Throwable e, int code) { GoogleJsonResponseException jsonException = getJsonResponseExceptionOrNull(e); if (jsonException != null) { return getHttpStatusCode(jsonException) == code; } return false; }
[ "protected", "boolean", "recursiveCheckForCode", "(", "Throwable", "e", ",", "int", "code", ")", "{", "GoogleJsonResponseException", "jsonException", "=", "getJsonResponseExceptionOrNull", "(", "e", ")", ";", "if", "(", "jsonException", "!=", "null", ")", "{", "re...
Recursively checks getCause() if outer exception isn't an instance of the correct class.
[ "Recursively", "checks", "getCause", "()", "if", "outer", "exception", "isn", "t", "an", "instance", "of", "the", "correct", "class", "." ]
train
https://github.com/GoogleCloudPlatform/bigdata-interop/blob/918d91c80a63e36046edb28972a5c65d3326a858/util/src/main/java/com/google/cloud/hadoop/util/ApiErrorExtractor.java#L463-L469
alkacon/opencms-core
src/org/opencms/workplace/tools/CmsToolMacroResolver.java
CmsToolMacroResolver.resolveMacros
public static String resolveMacros(String input, CmsWorkplace wp) { return new CmsToolMacroResolver(wp).resolveMacros(input); }
java
public static String resolveMacros(String input, CmsWorkplace wp) { return new CmsToolMacroResolver(wp).resolveMacros(input); }
[ "public", "static", "String", "resolveMacros", "(", "String", "input", ",", "CmsWorkplace", "wp", ")", "{", "return", "new", "CmsToolMacroResolver", "(", "wp", ")", ".", "resolveMacros", "(", "input", ")", ";", "}" ]
Resolves the macros in the given input using the provided parameters.<p> A macro in the form <code>${key}</code> in the content is replaced with it's assigned value returned by the <code>{@link I_CmsMacroResolver#getMacroValue(String)}</code> method of the given <code>{@link I_CmsMacroResolver}</code> instance.<p> If a macro is found that can not be mapped to a value by the given macro resolver, it is left untouched in the input.<p> @param input the input in which to resolve the macros @param wp the workplace class for falling back @return the input with the macros resolved
[ "Resolves", "the", "macros", "in", "the", "given", "input", "using", "the", "provided", "parameters", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/workplace/tools/CmsToolMacroResolver.java#L124-L127
exoplatform/jcr
exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/LocationFactory.java
LocationFactory.createJCRPath
public JCRPath createJCRPath(JCRPath parentLoc, String relPath) throws RepositoryException { JCRPath addPath = parseNames(relPath, false); return parentLoc.add(addPath); }
java
public JCRPath createJCRPath(JCRPath parentLoc, String relPath) throws RepositoryException { JCRPath addPath = parseNames(relPath, false); return parentLoc.add(addPath); }
[ "public", "JCRPath", "createJCRPath", "(", "JCRPath", "parentLoc", ",", "String", "relPath", ")", "throws", "RepositoryException", "{", "JCRPath", "addPath", "=", "parseNames", "(", "relPath", ",", "false", ")", ";", "return", "parentLoc", ".", "add", "(", "ad...
Creates JCRPath from parent path and relPath @param parentLoc parent path @param relPath related path @return @throws RepositoryException
[ "Creates", "JCRPath", "from", "parent", "path", "and", "relPath" ]
train
https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/LocationFactory.java#L90-L94
gallandarakhneorg/afc
advanced/bootique/bootique-printconfig/src/main/java/org/arakhne/afc/bootique/printconfig/modules/PrintConfigCommandModule.java
PrintConfigCommandModule.providePrintConfigCommand
@SuppressWarnings("static-method") @Provides @Singleton public PrintConfigCommand providePrintConfigCommand( Provider<BootLogger> bootLogger, Provider<ModulesMetadata> modulesMetadata, Injector injector) { return new PrintConfigCommand(bootLogger, modulesMetadata, injector); }
java
@SuppressWarnings("static-method") @Provides @Singleton public PrintConfigCommand providePrintConfigCommand( Provider<BootLogger> bootLogger, Provider<ModulesMetadata> modulesMetadata, Injector injector) { return new PrintConfigCommand(bootLogger, modulesMetadata, injector); }
[ "@", "SuppressWarnings", "(", "\"static-method\"", ")", "@", "Provides", "@", "Singleton", "public", "PrintConfigCommand", "providePrintConfigCommand", "(", "Provider", "<", "BootLogger", ">", "bootLogger", ",", "Provider", "<", "ModulesMetadata", ">", "modulesMetadata"...
Provide the command for running the command for printing out the configuration values. @param bootLogger the boot logger. @param modulesMetadata the modules' metadata. @param injector the current injector. @return the command.
[ "Provide", "the", "command", "for", "running", "the", "command", "for", "printing", "out", "the", "configuration", "values", "." ]
train
https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/bootique/bootique-printconfig/src/main/java/org/arakhne/afc/bootique/printconfig/modules/PrintConfigCommandModule.java#L57-L65
ops4j/org.ops4j.base
ops4j-base-util-xml/src/main/java/org/ops4j/util/xml/ElementHelper.java
ElementHelper.getAttribute
public static String getAttribute( Element node, String key ) { return getAttribute( node, key, null ); }
java
public static String getAttribute( Element node, String key ) { return getAttribute( node, key, null ); }
[ "public", "static", "String", "getAttribute", "(", "Element", "node", ",", "String", "key", ")", "{", "return", "getAttribute", "(", "node", ",", "key", ",", "null", ")", ";", "}" ]
Return the value of an element attribute. @param node the DOM node @param key the attribute key @return the attribute value or null if the attribute is undefined
[ "Return", "the", "value", "of", "an", "element", "attribute", "." ]
train
https://github.com/ops4j/org.ops4j.base/blob/b0e742c0d9511f6b19ca64da2ebaf30b7a47256a/ops4j-base-util-xml/src/main/java/org/ops4j/util/xml/ElementHelper.java#L227-L230
deeplearning4j/deeplearning4j
nd4j/nd4j-common/src/main/java/org/nd4j/linalg/primitives/CounterMap.java
CounterMap.incrementAll
public void incrementAll(CounterMap<F, S> other) { for (Map.Entry<F, Counter<S>> entry : other.maps.entrySet()) { F key = entry.getKey(); Counter<S> innerCounter = entry.getValue(); for (Map.Entry<S, AtomicDouble> innerEntry : innerCounter.entrySet()) { S value = innerEntry.getKey(); incrementCount(key, value, innerEntry.getValue().get()); } } }
java
public void incrementAll(CounterMap<F, S> other) { for (Map.Entry<F, Counter<S>> entry : other.maps.entrySet()) { F key = entry.getKey(); Counter<S> innerCounter = entry.getValue(); for (Map.Entry<S, AtomicDouble> innerEntry : innerCounter.entrySet()) { S value = innerEntry.getKey(); incrementCount(key, value, innerEntry.getValue().get()); } } }
[ "public", "void", "incrementAll", "(", "CounterMap", "<", "F", ",", "S", ">", "other", ")", "{", "for", "(", "Map", ".", "Entry", "<", "F", ",", "Counter", "<", "S", ">", ">", "entry", ":", "other", ".", "maps", ".", "entrySet", "(", ")", ")", ...
This method will increment values of this counter, by counts of other counter @param other
[ "This", "method", "will", "increment", "values", "of", "this", "counter", "by", "counts", "of", "other", "counter" ]
train
https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-common/src/main/java/org/nd4j/linalg/primitives/CounterMap.java#L72-L81
opencb/biodata
biodata-tools/src/main/java/org/opencb/biodata/tools/variant/VariantNormalizer.java
VariantNormalizer.requireLeftAlignment
static boolean requireLeftAlignment(String reference, String alternate) { return StringUtils.isEmpty(reference) || StringUtils.isEmpty(alternate) || reference.charAt(reference.length() - 1) == alternate.charAt(alternate.length() - 1); }
java
static boolean requireLeftAlignment(String reference, String alternate) { return StringUtils.isEmpty(reference) || StringUtils.isEmpty(alternate) || reference.charAt(reference.length() - 1) == alternate.charAt(alternate.length() - 1); }
[ "static", "boolean", "requireLeftAlignment", "(", "String", "reference", ",", "String", "alternate", ")", "{", "return", "StringUtils", ".", "isEmpty", "(", "reference", ")", "||", "StringUtils", ".", "isEmpty", "(", "alternate", ")", "||", "reference", ".", "...
Reference and alternate are either empty or last base from each is equal @param reference @param alternate @return
[ "Reference", "and", "alternate", "are", "either", "empty", "or", "last", "base", "from", "each", "is", "equal" ]
train
https://github.com/opencb/biodata/blob/21b3d51d71f578efab908422aca4bab7a73097b1/biodata-tools/src/main/java/org/opencb/biodata/tools/variant/VariantNormalizer.java#L766-L771
JM-Lab/utils-java8
src/main/java/kr/jm/utils/helper/JMStream.java
JMStream.buildTokenStream
public static Stream<String> buildTokenStream(String text, String delimiter) { return JMStream.buildStream(delimiter == null ? new StringTokenizer( text) : new StringTokenizer(text, delimiter)) .map(o -> (String) o); }
java
public static Stream<String> buildTokenStream(String text, String delimiter) { return JMStream.buildStream(delimiter == null ? new StringTokenizer( text) : new StringTokenizer(text, delimiter)) .map(o -> (String) o); }
[ "public", "static", "Stream", "<", "String", ">", "buildTokenStream", "(", "String", "text", ",", "String", "delimiter", ")", "{", "return", "JMStream", ".", "buildStream", "(", "delimiter", "==", "null", "?", "new", "StringTokenizer", "(", "text", ")", ":",...
Build token stream stream. @param text the text @param delimiter the delimiter @return the stream
[ "Build", "token", "stream", "stream", "." ]
train
https://github.com/JM-Lab/utils-java8/blob/9e407b3f28a7990418a1e877229fa8344f4d78a5/src/main/java/kr/jm/utils/helper/JMStream.java#L192-L197
apache/reef
lang/java/reef-runtime-yarn/src/main/java/org/apache/reef/runtime/yarn/client/YarnSubmissionHelper.java
YarnSubmissionHelper.setJobSubmissionEnvVariable
public YarnSubmissionHelper setJobSubmissionEnvVariable(final String key, final String value) { environmentVariablesMap.put(key, value); return this; }
java
public YarnSubmissionHelper setJobSubmissionEnvVariable(final String key, final String value) { environmentVariablesMap.put(key, value); return this; }
[ "public", "YarnSubmissionHelper", "setJobSubmissionEnvVariable", "(", "final", "String", "key", ",", "final", "String", "value", ")", "{", "environmentVariablesMap", ".", "put", "(", "key", ",", "value", ")", ";", "return", "this", ";", "}" ]
Adds a job submission environment variable. @param key @param value @return
[ "Adds", "a", "job", "submission", "environment", "variable", "." ]
train
https://github.com/apache/reef/blob/e2c47121cde21108a602c560cf76565a40d0e916/lang/java/reef-runtime-yarn/src/main/java/org/apache/reef/runtime/yarn/client/YarnSubmissionHelper.java#L268-L271
jbundle/jbundle
base/screen/model/src/main/java/org/jbundle/base/screen/model/BasePanel.java
BasePanel.handleCommand
public boolean handleCommand(String strCommand, ScreenField sourceSField, int iUseSameWindow) { boolean bHandled = this.doCommand(strCommand, sourceSField, iUseSameWindow); // Do I handle it? if (bHandled == false) { // Not handled by this screen, try child windows for (int iFieldSeq = 0; iFieldSeq < this.getSFieldCount(); iFieldSeq++) { // See if any of my children want to handle this command ScreenField sField = this.getSField(iFieldSeq); if (sField != sourceSField) // Don't call the child that passed this up { bHandled = sField.handleCommand(strCommand, this, iUseSameWindow); // Send to children (make sure they don't call me) if (bHandled) return bHandled; } } } if (bHandled == false) bHandled = super.handleCommand(strCommand, sourceSField, iUseSameWindow); // This will send the command to my parent return bHandled; }
java
public boolean handleCommand(String strCommand, ScreenField sourceSField, int iUseSameWindow) { boolean bHandled = this.doCommand(strCommand, sourceSField, iUseSameWindow); // Do I handle it? if (bHandled == false) { // Not handled by this screen, try child windows for (int iFieldSeq = 0; iFieldSeq < this.getSFieldCount(); iFieldSeq++) { // See if any of my children want to handle this command ScreenField sField = this.getSField(iFieldSeq); if (sField != sourceSField) // Don't call the child that passed this up { bHandled = sField.handleCommand(strCommand, this, iUseSameWindow); // Send to children (make sure they don't call me) if (bHandled) return bHandled; } } } if (bHandled == false) bHandled = super.handleCommand(strCommand, sourceSField, iUseSameWindow); // This will send the command to my parent return bHandled; }
[ "public", "boolean", "handleCommand", "(", "String", "strCommand", ",", "ScreenField", "sourceSField", ",", "int", "iUseSameWindow", ")", "{", "boolean", "bHandled", "=", "this", ".", "doCommand", "(", "strCommand", ",", "sourceSField", ",", "iUseSameWindow", ")",...
Process the command. Step 1 - Process the command if possible and return true if processed. Step 2 - If I can't process, pass to all children (with me as the source). Step 3 - If children didn't process, pass to parent (with me as the source). Note: Never pass to a parent or child that matches the source (to avoid an endless loop). @param strCommand The command to process. @param sourceSField The source screen field (to avoid echos). @param iUseSameWindow If this command creates a new screen, create in a new window? @return true if success.
[ "Process", "the", "command", ".", "Step", "1", "-", "Process", "the", "command", "if", "possible", "and", "return", "true", "if", "processed", ".", "Step", "2", "-", "If", "I", "can", "t", "process", "pass", "to", "all", "children", "(", "with", "me", ...
train
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/screen/model/src/main/java/org/jbundle/base/screen/model/BasePanel.java#L389-L409
jmrozanec/cron-utils
src/main/java/com/cronutils/descriptor/DescriptionStrategyFactory.java
DescriptionStrategyFactory.daysOfWeekInstance
public static DescriptionStrategy daysOfWeekInstance(final ResourceBundle bundle, final FieldExpression expression, final FieldDefinition definition) { final Function<Integer, String> nominal = integer -> { final int diff = definition instanceof DayOfWeekFieldDefinition ? DayOfWeek.MONDAY.getValue() - ((DayOfWeekFieldDefinition) definition).getMondayDoWValue().getMondayDoWValue() : 0; return DayOfWeek.of(integer + diff < 1 ? 7 : integer + diff).getDisplayName(TextStyle.FULL, bundle.getLocale()); }; final NominalDescriptionStrategy dow = new NominalDescriptionStrategy(bundle, nominal, expression); dow.addDescription(fieldExpression -> { if (fieldExpression instanceof On) { final On on = (On) fieldExpression; switch (on.getSpecialChar().getValue()) { case HASH: return String.format("%s %s %s ", nominal.apply(on.getTime().getValue()), on.getNth(), bundle.getString("of_every_month")); case L: return String.format("%s %s %s ", bundle.getString("last"), nominal.apply(on.getTime().getValue()), bundle.getString("of_every_month")); default: return ""; } } return ""; }); return dow; }
java
public static DescriptionStrategy daysOfWeekInstance(final ResourceBundle bundle, final FieldExpression expression, final FieldDefinition definition) { final Function<Integer, String> nominal = integer -> { final int diff = definition instanceof DayOfWeekFieldDefinition ? DayOfWeek.MONDAY.getValue() - ((DayOfWeekFieldDefinition) definition).getMondayDoWValue().getMondayDoWValue() : 0; return DayOfWeek.of(integer + diff < 1 ? 7 : integer + diff).getDisplayName(TextStyle.FULL, bundle.getLocale()); }; final NominalDescriptionStrategy dow = new NominalDescriptionStrategy(bundle, nominal, expression); dow.addDescription(fieldExpression -> { if (fieldExpression instanceof On) { final On on = (On) fieldExpression; switch (on.getSpecialChar().getValue()) { case HASH: return String.format("%s %s %s ", nominal.apply(on.getTime().getValue()), on.getNth(), bundle.getString("of_every_month")); case L: return String.format("%s %s %s ", bundle.getString("last"), nominal.apply(on.getTime().getValue()), bundle.getString("of_every_month")); default: return ""; } } return ""; }); return dow; }
[ "public", "static", "DescriptionStrategy", "daysOfWeekInstance", "(", "final", "ResourceBundle", "bundle", ",", "final", "FieldExpression", "expression", ",", "final", "FieldDefinition", "definition", ")", "{", "final", "Function", "<", "Integer", ",", "String", ">", ...
Creates description strategy for days of week. @param bundle - locale @param expression - CronFieldExpression @return - DescriptionStrategy instance, never null
[ "Creates", "description", "strategy", "for", "days", "of", "week", "." ]
train
https://github.com/jmrozanec/cron-utils/blob/adac5ec8fd9160b082f9762a6eedea0715731170/src/main/java/com/cronutils/descriptor/DescriptionStrategyFactory.java#L39-L65
codescape/bitvunit
bitvunit-core/src/main/java/de/codescape/bitvunit/BitvUnit.java
BitvUnit.assertAccessibility
public static void assertAccessibility(String htmlString, Testable testable) { assertThat(htmlString, is(compliantTo(testable))); }
java
public static void assertAccessibility(String htmlString, Testable testable) { assertThat(htmlString, is(compliantTo(testable))); }
[ "public", "static", "void", "assertAccessibility", "(", "String", "htmlString", ",", "Testable", "testable", ")", "{", "assertThat", "(", "htmlString", ",", "is", "(", "compliantTo", "(", "testable", ")", ")", ")", ";", "}" ]
JUnit Assertion to verify a {@link java.lang.String} containing the HTML page for accessibility. @param htmlString {@link java.lang.String} containing the HTML page @param testable rule(s) to apply
[ "JUnit", "Assertion", "to", "verify", "a", "{", "@link", "java", ".", "lang", ".", "String", "}", "containing", "the", "HTML", "page", "for", "accessibility", "." ]
train
https://github.com/codescape/bitvunit/blob/cef6d9af60d684e41294981c10b6d92c8f063a4e/bitvunit-core/src/main/java/de/codescape/bitvunit/BitvUnit.java#L48-L50
Stratio/deep-spark
deep-commons/src/main/java/com/stratio/deep/commons/entity/Cells.java
Cells.getBytes
public Byte[] getBytes(String nameSpace, String cellName) { return getValue(nameSpace, cellName, Byte[].class); }
java
public Byte[] getBytes(String nameSpace, String cellName) { return getValue(nameSpace, cellName, Byte[].class); }
[ "public", "Byte", "[", "]", "getBytes", "(", "String", "nameSpace", ",", "String", "cellName", ")", "{", "return", "getValue", "(", "nameSpace", ",", "cellName", ",", "Byte", "[", "]", ".", "class", ")", ";", "}" ]
Returns the {@code Byte[]} value of the {@link Cell} (associated to {@code table}) whose name iscellName, or null if this Cells object contains no cell whose name is cellName. @param nameSpace the name of the owning table @param cellName the name of the Cell we want to retrieve from this Cells object. @return the {@code Byte[]} value of the {@link Cell} (associated to {@code table}) whose name is cellName, or null if this Cells object contains no cell whose name is cellName
[ "Returns", "the", "{", "@code", "Byte", "[]", "}", "value", "of", "the", "{", "@link", "Cell", "}", "(", "associated", "to", "{", "@code", "table", "}", ")", "whose", "name", "iscellName", "or", "null", "if", "this", "Cells", "object", "contains", "no"...
train
https://github.com/Stratio/deep-spark/blob/b9621c9b7a6d996f80fce1d073d696a157bed095/deep-commons/src/main/java/com/stratio/deep/commons/entity/Cells.java#L1459-L1461
UrielCh/ovh-java-sdk
ovh-java-sdk-cloud/src/main/java/net/minidev/ovh/api/ApiOvhCloud.java
ApiOvhCloud.project_serviceName_instance_instanceId_monitoring_GET
public OvhInstanceMetrics project_serviceName_instance_instanceId_monitoring_GET(String serviceName, String instanceId, OvhMetricsPeriod period, OvhMetricsType type) throws IOException { String qPath = "/cloud/project/{serviceName}/instance/{instanceId}/monitoring"; StringBuilder sb = path(qPath, serviceName, instanceId); query(sb, "period", period); query(sb, "type", type); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, OvhInstanceMetrics.class); }
java
public OvhInstanceMetrics project_serviceName_instance_instanceId_monitoring_GET(String serviceName, String instanceId, OvhMetricsPeriod period, OvhMetricsType type) throws IOException { String qPath = "/cloud/project/{serviceName}/instance/{instanceId}/monitoring"; StringBuilder sb = path(qPath, serviceName, instanceId); query(sb, "period", period); query(sb, "type", type); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, OvhInstanceMetrics.class); }
[ "public", "OvhInstanceMetrics", "project_serviceName_instance_instanceId_monitoring_GET", "(", "String", "serviceName", ",", "String", "instanceId", ",", "OvhMetricsPeriod", "period", ",", "OvhMetricsType", "type", ")", "throws", "IOException", "{", "String", "qPath", "=", ...
Return many statistics about the virtual machine for a given period REST: GET /cloud/project/{serviceName}/instance/{instanceId}/monitoring @param instanceId [required] Instance id @param period [required] The period the statistics are fetched for @param serviceName [required] Project id @param type [required] The type of statistic to be fetched
[ "Return", "many", "statistics", "about", "the", "virtual", "machine", "for", "a", "given", "period" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-cloud/src/main/java/net/minidev/ovh/api/ApiOvhCloud.java#L2033-L2040
eurekaclinical/eurekaclinical-common
src/main/java/org/eurekaclinical/common/comm/clients/EurekaClinicalClient.java
EurekaClinicalClient.doGetForProxy
protected ClientResponse doGetForProxy(String path, MultivaluedMap<String, String> parameterMap, MultivaluedMap<String, String> headers) throws ClientException { this.readLock.lock(); try { WebResource.Builder requestBuilder = getResourceWrapper().rewritten(path, HttpMethod.GET, parameterMap).getRequestBuilder(); copyHeaders(headers, requestBuilder); return requestBuilder.get(ClientResponse.class); } catch (ClientHandlerException ex) { throw new ClientException(ClientResponse.Status.INTERNAL_SERVER_ERROR, ex.getMessage()); } finally { this.readLock.unlock(); } }
java
protected ClientResponse doGetForProxy(String path, MultivaluedMap<String, String> parameterMap, MultivaluedMap<String, String> headers) throws ClientException { this.readLock.lock(); try { WebResource.Builder requestBuilder = getResourceWrapper().rewritten(path, HttpMethod.GET, parameterMap).getRequestBuilder(); copyHeaders(headers, requestBuilder); return requestBuilder.get(ClientResponse.class); } catch (ClientHandlerException ex) { throw new ClientException(ClientResponse.Status.INTERNAL_SERVER_ERROR, ex.getMessage()); } finally { this.readLock.unlock(); } }
[ "protected", "ClientResponse", "doGetForProxy", "(", "String", "path", ",", "MultivaluedMap", "<", "String", ",", "String", ">", "parameterMap", ",", "MultivaluedMap", "<", "String", ",", "String", ">", "headers", ")", "throws", "ClientException", "{", "this", "...
Gets a resource from a proxied server. @param path the path to the resource. Cannot be <code>null</code>. @param parameterMap query parameters. May be <code>null</code>. @param headers any request headers to add. @return ClientResponse the proxied server's response information. @throws ClientException if the proxied server responds with an "error" status code, which is dependent on the server being called. @see #getResourceUrl() for the URL of the proxied server.
[ "Gets", "a", "resource", "from", "a", "proxied", "server", "." ]
train
https://github.com/eurekaclinical/eurekaclinical-common/blob/1867102ff43fe94e519f76a074d5f5923e9be61c/src/main/java/org/eurekaclinical/common/comm/clients/EurekaClinicalClient.java#L978-L989
BioPAX/Paxtools
paxtools-query/src/main/java/org/biopax/paxtools/query/algorithm/BFS.java
BFS.isEquivalentInTheSet
protected boolean isEquivalentInTheSet(Node node, Set<Node> set) { return set.contains(node) || isEquivalentInTheSet(node, UPWARD, set) || isEquivalentInTheSet(node, DOWNWARD, set); }
java
protected boolean isEquivalentInTheSet(Node node, Set<Node> set) { return set.contains(node) || isEquivalentInTheSet(node, UPWARD, set) || isEquivalentInTheSet(node, DOWNWARD, set); }
[ "protected", "boolean", "isEquivalentInTheSet", "(", "Node", "node", ",", "Set", "<", "Node", ">", "set", ")", "{", "return", "set", ".", "contains", "(", "node", ")", "||", "isEquivalentInTheSet", "(", "node", ",", "UPWARD", ",", "set", ")", "||", "isEq...
Checks if an equivalent of the given node is in the set. @param node Node to check equivalents @param set Node set @return true if an equivalent is in the set
[ "Checks", "if", "an", "equivalent", "of", "the", "given", "node", "is", "in", "the", "set", "." ]
train
https://github.com/BioPAX/Paxtools/blob/2f93afa94426bf8b5afc2e0e61cd4b269a83288d/paxtools-query/src/main/java/org/biopax/paxtools/query/algorithm/BFS.java#L267-L271
web3j/web3j
core/src/main/java/org/web3j/crypto/WalletUtils.java
WalletUtils.generateBip39Wallet
public static Bip39Wallet generateBip39Wallet(String password, File destinationDirectory) throws CipherException, IOException { byte[] initialEntropy = new byte[16]; secureRandom.nextBytes(initialEntropy); String mnemonic = MnemonicUtils.generateMnemonic(initialEntropy); byte[] seed = MnemonicUtils.generateSeed(mnemonic, password); ECKeyPair privateKey = ECKeyPair.create(sha256(seed)); String walletFile = generateWalletFile(password, privateKey, destinationDirectory, false); return new Bip39Wallet(walletFile, mnemonic); }
java
public static Bip39Wallet generateBip39Wallet(String password, File destinationDirectory) throws CipherException, IOException { byte[] initialEntropy = new byte[16]; secureRandom.nextBytes(initialEntropy); String mnemonic = MnemonicUtils.generateMnemonic(initialEntropy); byte[] seed = MnemonicUtils.generateSeed(mnemonic, password); ECKeyPair privateKey = ECKeyPair.create(sha256(seed)); String walletFile = generateWalletFile(password, privateKey, destinationDirectory, false); return new Bip39Wallet(walletFile, mnemonic); }
[ "public", "static", "Bip39Wallet", "generateBip39Wallet", "(", "String", "password", ",", "File", "destinationDirectory", ")", "throws", "CipherException", ",", "IOException", "{", "byte", "[", "]", "initialEntropy", "=", "new", "byte", "[", "16", "]", ";", "sec...
Generates a BIP-39 compatible Ethereum wallet. The private key for the wallet can be calculated using following algorithm: <pre> Key = SHA-256(BIP_39_SEED(mnemonic, password)) </pre> @param password Will be used for both wallet encryption and passphrase for BIP-39 seed @param destinationDirectory The directory containing the wallet @return A BIP-39 compatible Ethereum wallet @throws CipherException if the underlying cipher is not available @throws IOException if the destination cannot be written to
[ "Generates", "a", "BIP", "-", "39", "compatible", "Ethereum", "wallet", ".", "The", "private", "key", "for", "the", "wallet", "can", "be", "calculated", "using", "following", "algorithm", ":", "<pre", ">", "Key", "=", "SHA", "-", "256", "(", "BIP_39_SEED",...
train
https://github.com/web3j/web3j/blob/f99ceb19cdd65895c18e0a565034767ca18ea9fc/core/src/main/java/org/web3j/crypto/WalletUtils.java#L97-L109
h2oai/h2o-3
h2o-core/src/main/java/hex/quantile/Quantile.java
Quantile.computeQuantile
static double computeQuantile( double lo, double hi, double row, double nrows, double prob, QuantileModel.CombineMethod method ) { if( lo==hi ) return lo; // Equal; pick either if( method == null ) method= QuantileModel.CombineMethod.INTERPOLATE; switch( method ) { case INTERPOLATE: return linearInterpolate(lo,hi,row,nrows,prob); case AVERAGE: return 0.5*(hi+lo); case LOW: return lo; case HIGH: return hi; default: Log.info("Unknown even sample size quantile combination type: " + method + ". Doing linear interpolation."); return linearInterpolate(lo,hi,row,nrows,prob); } }
java
static double computeQuantile( double lo, double hi, double row, double nrows, double prob, QuantileModel.CombineMethod method ) { if( lo==hi ) return lo; // Equal; pick either if( method == null ) method= QuantileModel.CombineMethod.INTERPOLATE; switch( method ) { case INTERPOLATE: return linearInterpolate(lo,hi,row,nrows,prob); case AVERAGE: return 0.5*(hi+lo); case LOW: return lo; case HIGH: return hi; default: Log.info("Unknown even sample size quantile combination type: " + method + ". Doing linear interpolation."); return linearInterpolate(lo,hi,row,nrows,prob); } }
[ "static", "double", "computeQuantile", "(", "double", "lo", ",", "double", "hi", ",", "double", "row", ",", "double", "nrows", ",", "double", "prob", ",", "QuantileModel", ".", "CombineMethod", "method", ")", "{", "if", "(", "lo", "==", "hi", ")", "retur...
Compute the correct final quantile from these 4 values. If the lo and hi elements are equal, use them. However if they differ, then there is no single value which exactly matches the desired quantile. There are several well-accepted definitions in this case - including picking either the lo or the hi, or averaging them, or doing a linear interpolation. @param lo the highest element less than or equal to the desired quantile @param hi the lowest element greater than or equal to the desired quantile @param row row number (zero based) of the lo element; high element is +1 @return desired quantile.
[ "Compute", "the", "correct", "final", "quantile", "from", "these", "4", "values", ".", "If", "the", "lo", "and", "hi", "elements", "are", "equal", "use", "them", ".", "However", "if", "they", "differ", "then", "there", "is", "no", "single", "value", "whi...
train
https://github.com/h2oai/h2o-3/blob/845eb49dfeaadf638b6e2f779d82fac996391fad/h2o-core/src/main/java/hex/quantile/Quantile.java#L330-L342
windup/windup
reporting/api/src/main/java/org/jboss/windup/reporting/freemarker/problemsummary/ProblemSummaryService.java
ProblemSummaryService.getProblemSummaries
public static Map<IssueCategoryModel, List<ProblemSummary>> getProblemSummaries( GraphContext graphContext, Set<ProjectModel> projectModels, Set<String> includeTags, Set<String> excludeTags) { return getProblemSummaries(graphContext, projectModels, includeTags, excludeTags, false, false); }
java
public static Map<IssueCategoryModel, List<ProblemSummary>> getProblemSummaries( GraphContext graphContext, Set<ProjectModel> projectModels, Set<String> includeTags, Set<String> excludeTags) { return getProblemSummaries(graphContext, projectModels, includeTags, excludeTags, false, false); }
[ "public", "static", "Map", "<", "IssueCategoryModel", ",", "List", "<", "ProblemSummary", ">", ">", "getProblemSummaries", "(", "GraphContext", "graphContext", ",", "Set", "<", "ProjectModel", ">", "projectModels", ",", "Set", "<", "String", ">", "includeTags", ...
Gets lists of {@link ProblemSummary} objects organized by {@link IssueCategoryModel}.
[ "Gets", "lists", "of", "{" ]
train
https://github.com/windup/windup/blob/6668f09e7f012d24a0b4212ada8809417225b2ad/reporting/api/src/main/java/org/jboss/windup/reporting/freemarker/problemsummary/ProblemSummaryService.java#L35-L42
OpenLiberty/open-liberty
dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/DurableInputHandler.java
DurableInputHandler.wakeupWaiter
protected static void wakeupWaiter(long reqID, Object result) { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "wakeupWaiter", new Object[] {new Long(reqID), result}); synchronized (_requestMap) { Long key = new Long(reqID); Object[] waiter = _requestMap.get(key); if (waiter != null) { // Waiting request, wake up waiter[0] = result; _requestMap.remove(key); synchronized (waiter) { waiter.notify(); } } } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "wakeupWaiter"); }
java
protected static void wakeupWaiter(long reqID, Object result) { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "wakeupWaiter", new Object[] {new Long(reqID), result}); synchronized (_requestMap) { Long key = new Long(reqID); Object[] waiter = _requestMap.get(key); if (waiter != null) { // Waiting request, wake up waiter[0] = result; _requestMap.remove(key); synchronized (waiter) { waiter.notify(); } } } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "wakeupWaiter"); }
[ "protected", "static", "void", "wakeupWaiter", "(", "long", "reqID", ",", "Object", "result", ")", "{", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "SibTr", ".", "entry", "(", "tc", ...
Attempt to wake up a blocked thread waiting for a request reply. @param reqID The ID of the request for which a reply was received. @param result The reply message.
[ "Attempt", "to", "wake", "up", "a", "blocked", "thread", "waiting", "for", "a", "request", "reply", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/DurableInputHandler.java#L251-L275