repository_name
stringlengths
7
58
func_path_in_repository
stringlengths
18
188
func_name
stringlengths
7
127
whole_func_string
stringlengths
77
3.91k
language
stringclasses
1 value
func_code_string
stringlengths
77
3.91k
func_code_tokens
listlengths
20
745
func_documentation_string
stringlengths
61
1.98k
func_documentation_tokens
listlengths
1
477
split_name
stringclasses
1 value
func_code_url
stringlengths
111
288
geomajas/geomajas-project-client-gwt
client/src/main/java/org/geomajas/gwt/client/widget/attribute/DefaultFeatureForm.java
DefaultFeatureForm.getValue
@Api public void getValue(String name, DateAttribute attribute) { attribute.setValue((Date) formWidget.getValue(name)); }
java
@Api public void getValue(String name, DateAttribute attribute) { attribute.setValue((Date) formWidget.getValue(name)); }
[ "@", "Api", "public", "void", "getValue", "(", "String", "name", ",", "DateAttribute", "attribute", ")", "{", "attribute", ".", "setValue", "(", "(", "Date", ")", "formWidget", ".", "getValue", "(", "name", ")", ")", ";", "}" ]
Get a date value from the form, and place it in <code>attribute</code>. @param name attribute name @param attribute attribute to put value @since 1.11.1
[ "Get", "a", "date", "value", "from", "the", "form", "and", "place", "it", "in", "<code", ">", "attribute<", "/", "code", ">", "." ]
train
https://github.com/geomajas/geomajas-project-client-gwt/blob/1c1adc48deb192ed825265eebcc74d70bbf45670/client/src/main/java/org/geomajas/gwt/client/widget/attribute/DefaultFeatureForm.java#L764-L767
tango-controls/JTango
server/src/main/java/org/tango/server/device/DeviceManager.java
DeviceManager.setAttributeProperties
public void setAttributeProperties(final String attributeName, final AttributePropertiesImpl properties) throws DevFailed { final AttributeImpl attr = AttributeGetterSetter.getAttribute(attributeName, device.getAttributeList()); attr.setProperties(properties); }
java
public void setAttributeProperties(final String attributeName, final AttributePropertiesImpl properties) throws DevFailed { final AttributeImpl attr = AttributeGetterSetter.getAttribute(attributeName, device.getAttributeList()); attr.setProperties(properties); }
[ "public", "void", "setAttributeProperties", "(", "final", "String", "attributeName", ",", "final", "AttributePropertiesImpl", "properties", ")", "throws", "DevFailed", "{", "final", "AttributeImpl", "attr", "=", "AttributeGetterSetter", ".", "getAttribute", "(", "attrib...
Configure an attribute's properties @param attributeName the attribute name @param properties its properties @throws DevFailed
[ "Configure", "an", "attribute", "s", "properties" ]
train
https://github.com/tango-controls/JTango/blob/1ccc9dcb83e6de2359a9f1906d170571cacf1345/server/src/main/java/org/tango/server/device/DeviceManager.java#L110-L114
Whiley/WhileyCompiler
src/main/java/wyc/io/WhileyFileParser.java
WhileyFileParser.parseLogicalExpression
private Expr parseLogicalExpression(EnclosingScope scope, boolean terminated) { checkNotEof(); int start = index; Expr lhs = parseAndOrExpression(scope, terminated); Token lookahead = tryAndMatch(terminated, LogicalImplication, LogicalIff); if (lookahead != null) { switch (lookahead.kind) { case LogicalImplication: { Expr rhs = parseExpression(scope, terminated); lhs = new Expr.LogicalImplication(lhs, rhs); break; } case LogicalIff: { Expr rhs = parseExpression(scope, terminated); lhs = new Expr.LogicalIff(lhs, rhs); break; } default: throw new RuntimeException("deadcode"); // dead-code } lhs = annotateSourceLocation(lhs,start); } return lhs; }
java
private Expr parseLogicalExpression(EnclosingScope scope, boolean terminated) { checkNotEof(); int start = index; Expr lhs = parseAndOrExpression(scope, terminated); Token lookahead = tryAndMatch(terminated, LogicalImplication, LogicalIff); if (lookahead != null) { switch (lookahead.kind) { case LogicalImplication: { Expr rhs = parseExpression(scope, terminated); lhs = new Expr.LogicalImplication(lhs, rhs); break; } case LogicalIff: { Expr rhs = parseExpression(scope, terminated); lhs = new Expr.LogicalIff(lhs, rhs); break; } default: throw new RuntimeException("deadcode"); // dead-code } lhs = annotateSourceLocation(lhs,start); } return lhs; }
[ "private", "Expr", "parseLogicalExpression", "(", "EnclosingScope", "scope", ",", "boolean", "terminated", ")", "{", "checkNotEof", "(", ")", ";", "int", "start", "=", "index", ";", "Expr", "lhs", "=", "parseAndOrExpression", "(", "scope", ",", "terminated", "...
Parse a logical expression of the form: <pre> Expr ::= AndOrExpr [ "==>" UnitExpr] </pre> @param scope The enclosing scope for this statement, which determines the set of visible (i.e. declared) variables and also the current indentation level. @param terminated This indicates that the expression is known to be terminated (or not). An expression that's known to be terminated is one which is guaranteed to be followed by something. This is important because it means that we can ignore any newline characters encountered in parsing this expression, and that we'll never overrun the end of the expression (i.e. because there's guaranteed to be something which terminates this expression). A classic situation where terminated is true is when parsing an expression surrounded in braces. In such case, we know the right-brace will always terminate this expression. @return
[ "Parse", "a", "logical", "expression", "of", "the", "form", ":" ]
train
https://github.com/Whiley/WhileyCompiler/blob/680f8a657d3fc286f8cc422755988b6d74ab3f4c/src/main/java/wyc/io/WhileyFileParser.java#L1662-L1685
alkacon/opencms-core
src-gwt/org/opencms/ade/contenteditor/client/CmsContentEditor.java
CmsContentEditor.addEntityChangeListener
public static void addEntityChangeListener(I_CmsEntityChangeListener changeListener, String changeScope) { CmsDebugLog.getInstance().printLine("trying to ad change listener for scope: " + changeScope); if ((INSTANCE == null) || (INSTANCE.m_entityObserver == null)) { CmsDebugLog.getInstance().printLine("handling external registration"); if (isObserverExported()) { CmsDebugLog.getInstance().printLine("registration is available"); try { addNativeListener(changeListener, changeScope); } catch (Exception e) { CmsDebugLog.getInstance().printLine( "Exception occured during listener registration" + e.getMessage()); } } else { throw new RuntimeException("Editor is not initialized yet."); } } else { INSTANCE.m_entityObserver.addEntityChangeListener(changeListener, changeScope); } }
java
public static void addEntityChangeListener(I_CmsEntityChangeListener changeListener, String changeScope) { CmsDebugLog.getInstance().printLine("trying to ad change listener for scope: " + changeScope); if ((INSTANCE == null) || (INSTANCE.m_entityObserver == null)) { CmsDebugLog.getInstance().printLine("handling external registration"); if (isObserverExported()) { CmsDebugLog.getInstance().printLine("registration is available"); try { addNativeListener(changeListener, changeScope); } catch (Exception e) { CmsDebugLog.getInstance().printLine( "Exception occured during listener registration" + e.getMessage()); } } else { throw new RuntimeException("Editor is not initialized yet."); } } else { INSTANCE.m_entityObserver.addEntityChangeListener(changeListener, changeScope); } }
[ "public", "static", "void", "addEntityChangeListener", "(", "I_CmsEntityChangeListener", "changeListener", ",", "String", "changeScope", ")", "{", "CmsDebugLog", ".", "getInstance", "(", ")", ".", "printLine", "(", "\"trying to ad change listener for scope: \"", "+", "cha...
Adds an entity change listener.<p> @param changeListener the change listener @param changeScope the change scope
[ "Adds", "an", "entity", "change", "listener", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/ade/contenteditor/client/CmsContentEditor.java#L400-L420
mirage-sql/mirage
src/main/java/com/miragesql/miragesql/SqlExecutor.java
SqlExecutor.setParameters
@SuppressWarnings("unchecked") protected void setParameters(PreparedStatement stmt, Object[] params) throws SQLException { for (int i = 0; i < params.length; i++) { if(params[i] == null){ stmt.setObject(i + 1, null); } else { Class<?> propertType = params[i].getClass(); @SuppressWarnings("rawtypes") ValueType valueType = MirageUtil.getValueType(propertType, null, dialect, valueTypes); if(valueType != null){ valueType.set(propertType, stmt, params[i], i + 1); } else { if(logger.isWarnEnabled()) { logger.warn("valueType for " + propertType.getName() + " not found."); } } } } }
java
@SuppressWarnings("unchecked") protected void setParameters(PreparedStatement stmt, Object[] params) throws SQLException { for (int i = 0; i < params.length; i++) { if(params[i] == null){ stmt.setObject(i + 1, null); } else { Class<?> propertType = params[i].getClass(); @SuppressWarnings("rawtypes") ValueType valueType = MirageUtil.getValueType(propertType, null, dialect, valueTypes); if(valueType != null){ valueType.set(propertType, stmt, params[i], i + 1); } else { if(logger.isWarnEnabled()) { logger.warn("valueType for " + propertType.getName() + " not found."); } } } } }
[ "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "protected", "void", "setParameters", "(", "PreparedStatement", "stmt", ",", "Object", "[", "]", "params", ")", "throws", "SQLException", "{", "for", "(", "int", "i", "=", "0", ";", "i", "<", "params", "....
Sets parameters to the PreparedStatement. @param stmt the prepared statement @param params the parameters @throws SQLException if something goes wrong.
[ "Sets", "parameters", "to", "the", "PreparedStatement", "." ]
train
https://github.com/mirage-sql/mirage/blob/29a44b7ad267b5a48bc250cd0ef7d74813d46889/src/main/java/com/miragesql/miragesql/SqlExecutor.java#L497-L515
apptik/JustJson
json-core/src/main/java/io/apptik/json/JsonObject.java
JsonObject.putOpt
public JsonObject putOpt(String name, Object value) throws JsonException { if (name == null || value == null) { return this; } return put(name, value); }
java
public JsonObject putOpt(String name, Object value) throws JsonException { if (name == null || value == null) { return this; } return put(name, value); }
[ "public", "JsonObject", "putOpt", "(", "String", "name", ",", "Object", "value", ")", "throws", "JsonException", "{", "if", "(", "name", "==", "null", "||", "value", "==", "null", ")", "{", "return", "this", ";", "}", "return", "put", "(", "name", ",",...
Equivalent to {@code put(name, value)} when both parameters are non-null; does nothing otherwise.
[ "Equivalent", "to", "{" ]
train
https://github.com/apptik/JustJson/blob/c90f0dd7f84df26da4749be8cd9b026fff499a79/json-core/src/main/java/io/apptik/json/JsonObject.java#L216-L221
Azure/azure-sdk-for-java
edgegateway/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/edgegateway/v2019_03_01/implementation/SharesInner.java
SharesInner.beginRefresh
public void beginRefresh(String deviceName, String name, String resourceGroupName) { beginRefreshWithServiceResponseAsync(deviceName, name, resourceGroupName).toBlocking().single().body(); }
java
public void beginRefresh(String deviceName, String name, String resourceGroupName) { beginRefreshWithServiceResponseAsync(deviceName, name, resourceGroupName).toBlocking().single().body(); }
[ "public", "void", "beginRefresh", "(", "String", "deviceName", ",", "String", "name", ",", "String", "resourceGroupName", ")", "{", "beginRefreshWithServiceResponseAsync", "(", "deviceName", ",", "name", ",", "resourceGroupName", ")", ".", "toBlocking", "(", ")", ...
Refreshes the share metadata with the data from the cloud. @param deviceName The device name. @param name The share name. @param resourceGroupName The resource group name. @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
[ "Refreshes", "the", "share", "metadata", "with", "the", "data", "from", "the", "cloud", "." ]
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/SharesInner.java#L759-L761
google/closure-templates
java/src/com/google/template/soy/jbcsrc/restricted/Statement.java
Statement.writeMethodTo
private final void writeMethodTo(CodeBuilder builder) { builder.visitCode(); gen(builder); try { builder.endMethod(); } catch (Throwable t) { // ASM fails in bizarre ways, attach a trace of the thing we tried to generate to the // exception. throw new RuntimeException("Failed to generate method:\n" + this, t); } }
java
private final void writeMethodTo(CodeBuilder builder) { builder.visitCode(); gen(builder); try { builder.endMethod(); } catch (Throwable t) { // ASM fails in bizarre ways, attach a trace of the thing we tried to generate to the // exception. throw new RuntimeException("Failed to generate method:\n" + this, t); } }
[ "private", "final", "void", "writeMethodTo", "(", "CodeBuilder", "builder", ")", "{", "builder", ".", "visitCode", "(", ")", ";", "gen", "(", "builder", ")", ";", "try", "{", "builder", ".", "endMethod", "(", ")", ";", "}", "catch", "(", "Throwable", "...
Writes this statement as the complete method body to {@code ga}.
[ "Writes", "this", "statement", "as", "the", "complete", "method", "body", "to", "{" ]
train
https://github.com/google/closure-templates/blob/cc61e1dff70ae97f24f417a57410081bc498bd56/java/src/com/google/template/soy/jbcsrc/restricted/Statement.java#L140-L150
nextreports/nextreports-engine
src/ro/nextreports/engine/util/DateUtil.java
DateUtil.sameDay
public static boolean sameDay(Date dateOne, Date dateTwo) { if ((dateOne == null) || (dateTwo == null)) { return false; } Calendar cal = Calendar.getInstance(); cal.setTime(dateOne); int year = cal.get(Calendar.YEAR); int day = cal.get(Calendar.DAY_OF_YEAR); cal.setTime(dateTwo); int year2 = cal.get(Calendar.YEAR); int day2 = cal.get(Calendar.DAY_OF_YEAR); return ( (year == year2) && (day == day2) ); }
java
public static boolean sameDay(Date dateOne, Date dateTwo) { if ((dateOne == null) || (dateTwo == null)) { return false; } Calendar cal = Calendar.getInstance(); cal.setTime(dateOne); int year = cal.get(Calendar.YEAR); int day = cal.get(Calendar.DAY_OF_YEAR); cal.setTime(dateTwo); int year2 = cal.get(Calendar.YEAR); int day2 = cal.get(Calendar.DAY_OF_YEAR); return ( (year == year2) && (day == day2) ); }
[ "public", "static", "boolean", "sameDay", "(", "Date", "dateOne", ",", "Date", "dateTwo", ")", "{", "if", "(", "(", "dateOne", "==", "null", ")", "||", "(", "dateTwo", "==", "null", ")", ")", "{", "return", "false", ";", "}", "Calendar", "cal", "=", ...
Test to see if two dates are in the same day of year @param dateOne first date @param dateTwo second date @return true if the two dates are in the same day of year
[ "Test", "to", "see", "if", "two", "dates", "are", "in", "the", "same", "day", "of", "year" ]
train
https://github.com/nextreports/nextreports-engine/blob/a847575a9298b5fce63b88961190c5b83ddccc44/src/ro/nextreports/engine/util/DateUtil.java#L232-L247
sarl/sarl
main/coreplugins/io.sarl.lang/src-gen/io/sarl/lang/codebuilder/builders/SarlConstructorBuilderImpl.java
SarlConstructorBuilderImpl.eInit
public void eInit(XtendTypeDeclaration container, IJvmTypeProvider context) { setTypeResolutionContext(context); if (this.sarlConstructor == null) { this.container = container; this.sarlConstructor = SarlFactory.eINSTANCE.createSarlConstructor(); this.sarlConstructor.setAnnotationInfo(XtendFactory.eINSTANCE.createXtendMember()); container.getMembers().add(this.sarlConstructor); } }
java
public void eInit(XtendTypeDeclaration container, IJvmTypeProvider context) { setTypeResolutionContext(context); if (this.sarlConstructor == null) { this.container = container; this.sarlConstructor = SarlFactory.eINSTANCE.createSarlConstructor(); this.sarlConstructor.setAnnotationInfo(XtendFactory.eINSTANCE.createXtendMember()); container.getMembers().add(this.sarlConstructor); } }
[ "public", "void", "eInit", "(", "XtendTypeDeclaration", "container", ",", "IJvmTypeProvider", "context", ")", "{", "setTypeResolutionContext", "(", "context", ")", ";", "if", "(", "this", ".", "sarlConstructor", "==", "null", ")", "{", "this", ".", "container", ...
Initialize the Ecore element. @param container the container of the SarlConstructor.
[ "Initialize", "the", "Ecore", "element", "." ]
train
https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.lang/src-gen/io/sarl/lang/codebuilder/builders/SarlConstructorBuilderImpl.java#L62-L70
alkacon/opencms-core
src-gwt/org/opencms/ade/sitemap/client/toolbar/CmsToolbarNewButton.java
CmsToolbarNewButton.makeRedirectItem
private CmsCreatableListItem makeRedirectItem() { CmsNewResourceInfo typeInfo = getController().getData().getNewRedirectElementInfo(); CmsListInfoBean info = new CmsListInfoBean(); info.setTitle(typeInfo.getTitle()); info.setSubTitle(Messages.get().key(Messages.GUI_REDIRECT_SUBTITLE_0)); CmsListItemWidget widget = new CmsListItemWidget(info); widget.setIcon(typeInfo.getBigIconClasses()); CmsCreatableListItem listItem = new CmsCreatableListItem(widget, typeInfo, NewEntryType.redirect); listItem.initMoveHandle(CmsSitemapView.getInstance().getTree().getDnDHandler()); return listItem; }
java
private CmsCreatableListItem makeRedirectItem() { CmsNewResourceInfo typeInfo = getController().getData().getNewRedirectElementInfo(); CmsListInfoBean info = new CmsListInfoBean(); info.setTitle(typeInfo.getTitle()); info.setSubTitle(Messages.get().key(Messages.GUI_REDIRECT_SUBTITLE_0)); CmsListItemWidget widget = new CmsListItemWidget(info); widget.setIcon(typeInfo.getBigIconClasses()); CmsCreatableListItem listItem = new CmsCreatableListItem(widget, typeInfo, NewEntryType.redirect); listItem.initMoveHandle(CmsSitemapView.getInstance().getTree().getDnDHandler()); return listItem; }
[ "private", "CmsCreatableListItem", "makeRedirectItem", "(", ")", "{", "CmsNewResourceInfo", "typeInfo", "=", "getController", "(", ")", ".", "getData", "(", ")", ".", "getNewRedirectElementInfo", "(", ")", ";", "CmsListInfoBean", "info", "=", "new", "CmsListInfoBean...
Creates a list item representing a redirect.<p> @return the new list item
[ "Creates", "a", "list", "item", "representing", "a", "redirect", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/ade/sitemap/client/toolbar/CmsToolbarNewButton.java#L223-L234
alipay/sofa-rpc
extension-impl/codec-protobuf/src/main/java/com/alipay/sofa/rpc/codec/protobuf/ProtobufHelper.java
ProtobufHelper.getReqClass
public Class getReqClass(String service, String methodName) { String key = buildMethodKey(service, methodName); Class reqClass = requestClassCache.get(key); if (reqClass == null) { // 读取接口里的方法参数和返回值 String interfaceClass = ConfigUniqueNameGenerator.getInterfaceName(service); Class clazz = ClassUtils.forName(interfaceClass, true); loadProtoClassToCache(key, clazz, methodName); } return requestClassCache.get(key); }
java
public Class getReqClass(String service, String methodName) { String key = buildMethodKey(service, methodName); Class reqClass = requestClassCache.get(key); if (reqClass == null) { // 读取接口里的方法参数和返回值 String interfaceClass = ConfigUniqueNameGenerator.getInterfaceName(service); Class clazz = ClassUtils.forName(interfaceClass, true); loadProtoClassToCache(key, clazz, methodName); } return requestClassCache.get(key); }
[ "public", "Class", "getReqClass", "(", "String", "service", ",", "String", "methodName", ")", "{", "String", "key", "=", "buildMethodKey", "(", "service", ",", "methodName", ")", ";", "Class", "reqClass", "=", "requestClassCache", ".", "get", "(", "key", ")"...
从缓存中获取请求值类 @param service 接口名 @param methodName 方法名 @return 请求参数类
[ "从缓存中获取请求值类" ]
train
https://github.com/alipay/sofa-rpc/blob/a31406410291e56696185a29c3ba4bd1f54488fd/extension-impl/codec-protobuf/src/main/java/com/alipay/sofa/rpc/codec/protobuf/ProtobufHelper.java#L68-L79
DataSketches/sketches-core
src/main/java/com/yahoo/sketches/cpc/CpcSketch.java
CpcSketch.heapify
public static CpcSketch heapify(final byte[] byteArray, final long seed) { final Memory mem = Memory.wrap(byteArray); return heapify(mem, seed); }
java
public static CpcSketch heapify(final byte[] byteArray, final long seed) { final Memory mem = Memory.wrap(byteArray); return heapify(mem, seed); }
[ "public", "static", "CpcSketch", "heapify", "(", "final", "byte", "[", "]", "byteArray", ",", "final", "long", "seed", ")", "{", "final", "Memory", "mem", "=", "Memory", ".", "wrap", "(", "byteArray", ")", ";", "return", "heapify", "(", "mem", ",", "se...
Return the given byte array as a CpcSketch on the Java heap. @param byteArray the given byte array @param seed the seed used to create the original sketch from which the byte array was derived. @return the given byte array as a CpcSketch on the Java heap.
[ "Return", "the", "given", "byte", "array", "as", "a", "CpcSketch", "on", "the", "Java", "heap", "." ]
train
https://github.com/DataSketches/sketches-core/blob/900c8c9668a1e2f1d54d453e956caad54702e540/src/main/java/com/yahoo/sketches/cpc/CpcSketch.java#L243-L246
derari/cthul
objects/src/main/java/org/cthul/objects/reflection/Signatures.java
Signatures.bestConstructor
public static <T> Constructor<T> bestConstructor(Constructor<T>[] constructors, Class<?>[] argTypes) throws AmbiguousConstructorMatchException { try { return best(constructors, collectSignatures(constructors), collectVarArgs(constructors), argTypes); } catch (AmbiguousSignatureMatchException e) { throw new AmbiguousConstructorMatchException(e, constructors); } }
java
public static <T> Constructor<T> bestConstructor(Constructor<T>[] constructors, Class<?>[] argTypes) throws AmbiguousConstructorMatchException { try { return best(constructors, collectSignatures(constructors), collectVarArgs(constructors), argTypes); } catch (AmbiguousSignatureMatchException e) { throw new AmbiguousConstructorMatchException(e, constructors); } }
[ "public", "static", "<", "T", ">", "Constructor", "<", "T", ">", "bestConstructor", "(", "Constructor", "<", "T", ">", "[", "]", "constructors", ",", "Class", "<", "?", ">", "[", "]", "argTypes", ")", "throws", "AmbiguousConstructorMatchException", "{", "t...
Selects the best constructor for the given argument types. @param <T> @param constructors @param argTypes @return constructor, or {@code null} @throws AmbiguousSignatureMatchException if multiple constructors match equally
[ "Selects", "the", "best", "constructor", "for", "the", "given", "argument", "types", "." ]
train
https://github.com/derari/cthul/blob/74a31e3cb6a94f5f25cc5253d1dbd42e19a17ebc/objects/src/main/java/org/cthul/objects/reflection/Signatures.java#L67-L73
apache/groovy
src/main/java/org/codehaus/groovy/runtime/DefaultGroovyMethods.java
DefaultGroovyMethods.getAt
public static <T> T getAt(Iterable<T> self, int idx) { return getAt(self.iterator(), idx); }
java
public static <T> T getAt(Iterable<T> self, int idx) { return getAt(self.iterator(), idx); }
[ "public", "static", "<", "T", ">", "T", "getAt", "(", "Iterable", "<", "T", ">", "self", ",", "int", "idx", ")", "{", "return", "getAt", "(", "self", ".", "iterator", "(", ")", ",", "idx", ")", ";", "}" ]
Support the subscript operator for an Iterable. Typical usage: <pre class="groovyTestCase"> // custom Iterable example: class MyIterable implements Iterable { Iterator iterator() { [1, 2, 3].iterator() } } def myIterable = new MyIterable() assert myIterable[1] == 2 // Set example: def set = [1,2,3] as LinkedHashSet assert set[1] == 2 </pre> @param self an Iterable @param idx an index value (-self.size() &lt;= idx &lt; self.size()) but using -ve index values will be inefficient @return the value at the given index (after normalisation) or null if no corresponding value was found @since 2.1.0
[ "Support", "the", "subscript", "operator", "for", "an", "Iterable", ".", "Typical", "usage", ":", "<pre", "class", "=", "groovyTestCase", ">", "//", "custom", "Iterable", "example", ":", "class", "MyIterable", "implements", "Iterable", "{", "Iterator", "iterator...
train
https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/java/org/codehaus/groovy/runtime/DefaultGroovyMethods.java#L7937-L7939
google/error-prone-javac
src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/MemberSummaryBuilder.java
MemberSummaryBuilder.buildAnnotationTypeOptionalMemberSummary
public void buildAnnotationTypeOptionalMemberSummary(XMLNode node, Content memberSummaryTree) { MemberSummaryWriter writer = memberSummaryWriters.get(VisibleMemberMap.Kind.ANNOTATION_TYPE_MEMBER_OPTIONAL); VisibleMemberMap visibleMemberMap = getVisibleMemberMap(VisibleMemberMap.Kind.ANNOTATION_TYPE_MEMBER_OPTIONAL); addSummary(writer, visibleMemberMap, false, memberSummaryTree); }
java
public void buildAnnotationTypeOptionalMemberSummary(XMLNode node, Content memberSummaryTree) { MemberSummaryWriter writer = memberSummaryWriters.get(VisibleMemberMap.Kind.ANNOTATION_TYPE_MEMBER_OPTIONAL); VisibleMemberMap visibleMemberMap = getVisibleMemberMap(VisibleMemberMap.Kind.ANNOTATION_TYPE_MEMBER_OPTIONAL); addSummary(writer, visibleMemberMap, false, memberSummaryTree); }
[ "public", "void", "buildAnnotationTypeOptionalMemberSummary", "(", "XMLNode", "node", ",", "Content", "memberSummaryTree", ")", "{", "MemberSummaryWriter", "writer", "=", "memberSummaryWriters", ".", "get", "(", "VisibleMemberMap", ".", "Kind", ".", "ANNOTATION_TYPE_MEMBE...
Build the summary for the optional members. @param node the XML element that specifies which components to document @param memberSummaryTree the content tree to which the documentation will be added
[ "Build", "the", "summary", "for", "the", "optional", "members", "." ]
train
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/MemberSummaryBuilder.java#L237-L243
before/uadetector
modules/uadetector-core/src/main/java/net/sf/uadetector/parser/AbstractUserAgentStringParser.java
AbstractUserAgentStringParser.examineAsRobot
private static boolean examineAsRobot(final UserAgent.Builder builder, final Data data) { boolean isRobot = false; VersionNumber version; for (final Robot robot : data.getRobots()) { if (robot.getUserAgentString().equals(builder.getUserAgentString())) { isRobot = true; robot.copyTo(builder); // try to get the version from the last found group version = VersionNumber.parseLastVersionNumber(robot.getName()); builder.setVersionNumber(version); break; } } return isRobot; }
java
private static boolean examineAsRobot(final UserAgent.Builder builder, final Data data) { boolean isRobot = false; VersionNumber version; for (final Robot robot : data.getRobots()) { if (robot.getUserAgentString().equals(builder.getUserAgentString())) { isRobot = true; robot.copyTo(builder); // try to get the version from the last found group version = VersionNumber.parseLastVersionNumber(robot.getName()); builder.setVersionNumber(version); break; } } return isRobot; }
[ "private", "static", "boolean", "examineAsRobot", "(", "final", "UserAgent", ".", "Builder", "builder", ",", "final", "Data", "data", ")", "{", "boolean", "isRobot", "=", "false", ";", "VersionNumber", "version", ";", "for", "(", "final", "Robot", "robot", "...
Examines the user agent string whether it is a robot. @param userAgent String of an user agent @param builder Builder for an user agent information @return {@code true} if it is a robot, otherwise {@code false}
[ "Examines", "the", "user", "agent", "string", "whether", "it", "is", "a", "robot", "." ]
train
https://github.com/before/uadetector/blob/215fb652723c52866572cff885f52a3fe67b9db5/modules/uadetector-core/src/main/java/net/sf/uadetector/parser/AbstractUserAgentStringParser.java#L83-L99
deeplearning4j/deeplearning4j
nd4j/nd4j-parameter-server-parent/nd4j-parameter-server-node/src/main/java/org/nd4j/parameterserver/distributed/VoidParameterServer.java
VoidParameterServer.getVector
public INDArray getVector(@NonNull Integer key, int rowIdx) { /** * we create VoidMessage, send it, and block until it gets responded */ VectorRequestMessage message = new VectorRequestMessage(key, rowIdx); MeaningfulMessage response = transport.sendMessageAndGetResponse(message); return response.getPayload(); }
java
public INDArray getVector(@NonNull Integer key, int rowIdx) { /** * we create VoidMessage, send it, and block until it gets responded */ VectorRequestMessage message = new VectorRequestMessage(key, rowIdx); MeaningfulMessage response = transport.sendMessageAndGetResponse(message); return response.getPayload(); }
[ "public", "INDArray", "getVector", "(", "@", "NonNull", "Integer", "key", ",", "int", "rowIdx", ")", "{", "/**\n * we create VoidMessage, send it, and block until it gets responded\n */", "VectorRequestMessage", "message", "=", "new", "VectorRequestMessage", "("...
This method returns INDArray matching requested storageId value PLEASE NOTE: This method IS blocking @param rowIdx @return
[ "This", "method", "returns", "INDArray", "matching", "requested", "storageId", "value" ]
train
https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-parameter-server-parent/nd4j-parameter-server-node/src/main/java/org/nd4j/parameterserver/distributed/VoidParameterServer.java#L516-L526
cloudant/sync-android
cloudant-sync-datastore-core/src/main/java/com/cloudant/sync/internal/documentstore/DatabaseImpl.java
DatabaseImpl.attachmentsForRevision
public Map<String, ? extends Attachment> attachmentsForRevision(final InternalDocumentRevision rev) throws AttachmentException { try { return get(queue.submit(new SQLCallable<Map<String, ? extends Attachment>>() { @Override public Map<String, ? extends Attachment> call(SQLDatabase db) throws Exception { return AttachmentManager.attachmentsForRevision(db, attachmentsDir, attachmentStreamFactory, rev.getSequence()); } })); } catch (ExecutionException e) { logger.log(Level.SEVERE, "Failed to get attachments for revision"); throw new AttachmentException(e); } }
java
public Map<String, ? extends Attachment> attachmentsForRevision(final InternalDocumentRevision rev) throws AttachmentException { try { return get(queue.submit(new SQLCallable<Map<String, ? extends Attachment>>() { @Override public Map<String, ? extends Attachment> call(SQLDatabase db) throws Exception { return AttachmentManager.attachmentsForRevision(db, attachmentsDir, attachmentStreamFactory, rev.getSequence()); } })); } catch (ExecutionException e) { logger.log(Level.SEVERE, "Failed to get attachments for revision"); throw new AttachmentException(e); } }
[ "public", "Map", "<", "String", ",", "?", "extends", "Attachment", ">", "attachmentsForRevision", "(", "final", "InternalDocumentRevision", "rev", ")", "throws", "AttachmentException", "{", "try", "{", "return", "get", "(", "queue", ".", "submit", "(", "new", ...
<p>Returns all attachments for the revision.</p> <p>Used by replicator when pushing attachments</p> @param rev The revision with which the attachments are associated @return List of <code>Attachment</code> @throws AttachmentException if there was an error reading the attachment metadata from the database
[ "<p", ">", "Returns", "all", "attachments", "for", "the", "revision", ".", "<", "/", "p", ">" ]
train
https://github.com/cloudant/sync-android/blob/5f1416ed1bd9ab05d7a4b8736480c8ae68bd7383/cloudant-sync-datastore-core/src/main/java/com/cloudant/sync/internal/documentstore/DatabaseImpl.java#L855-L871
apache/incubator-gobblin
gobblin-metrics-libs/gobblin-metrics-base/src/main/java/org/apache/gobblin/filesystem/MetricsFileSystemInstrumentation.java
MetricsFileSystemInstrumentation.setOwner
public void setOwner(Path f, String user, String group) throws IOException { try (Closeable context = new TimerContextWithLog(this.setOwnerTimer.time(), "setOwner", f, user, group)) { super.setOwner(f, user, group); } }
java
public void setOwner(Path f, String user, String group) throws IOException { try (Closeable context = new TimerContextWithLog(this.setOwnerTimer.time(), "setOwner", f, user, group)) { super.setOwner(f, user, group); } }
[ "public", "void", "setOwner", "(", "Path", "f", ",", "String", "user", ",", "String", "group", ")", "throws", "IOException", "{", "try", "(", "Closeable", "context", "=", "new", "TimerContextWithLog", "(", "this", ".", "setOwnerTimer", ".", "time", "(", ")...
Add timer metrics to {@link DistributedFileSystem#setOwner(Path, String, String)}
[ "Add", "timer", "metrics", "to", "{" ]
train
https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-metrics-libs/gobblin-metrics-base/src/main/java/org/apache/gobblin/filesystem/MetricsFileSystemInstrumentation.java#L289-L293
chhh/MSFTBX
MSFileToolbox/src/main/java/umich/ms/datatypes/scancollection/impl/ScanCollectionDefault.java
ScanCollectionDefault.getNextScanAtMsLevel
@Override public IScan getNextScanAtMsLevel(int scanNum, int msLevel) { TreeMap<Integer, IScan> msLevelMap = getMapMsLevel2index().get(msLevel).getNum2scan(); if (msLevelMap == null) { return null; } Map.Entry<Integer, IScan> entry = msLevelMap.ceilingEntry(scanNum + 1); if (entry != null) { return entry.getValue(); } return null; }
java
@Override public IScan getNextScanAtMsLevel(int scanNum, int msLevel) { TreeMap<Integer, IScan> msLevelMap = getMapMsLevel2index().get(msLevel).getNum2scan(); if (msLevelMap == null) { return null; } Map.Entry<Integer, IScan> entry = msLevelMap.ceilingEntry(scanNum + 1); if (entry != null) { return entry.getValue(); } return null; }
[ "@", "Override", "public", "IScan", "getNextScanAtMsLevel", "(", "int", "scanNum", ",", "int", "msLevel", ")", "{", "TreeMap", "<", "Integer", ",", "IScan", ">", "msLevelMap", "=", "getMapMsLevel2index", "(", ")", ".", "get", "(", "msLevel", ")", ".", "get...
Finds the next scan at the same MS level, as the scan with scanNum. If the scan number provided is not in the map, this method will find the next existing one. @param scanNum Scan number @param msLevel MS Level at which to search for that scan number. That MS level must be present in the collection, otherwise an NPE is thrown. @return either next Scan, or null, if there are no further scans at this level. If MS level is incorrect, also returns null.
[ "Finds", "the", "next", "scan", "at", "the", "same", "MS", "level", "as", "the", "scan", "with", "scanNum", ".", "If", "the", "scan", "number", "provided", "is", "not", "in", "the", "map", "this", "method", "will", "find", "the", "next", "existing", "o...
train
https://github.com/chhh/MSFTBX/blob/e53ae6be982e2de3123292be7d5297715bec70bb/MSFileToolbox/src/main/java/umich/ms/datatypes/scancollection/impl/ScanCollectionDefault.java#L624-L635
EdwardRaff/JSAT
JSAT/src/jsat/utils/ListUtils.java
ListUtils.randomSample
public static <T> void randomSample(List<T> source, List<T> dest, int samples, Random rand) { randomSample((Collection<T>)source, dest, samples, rand); }
java
public static <T> void randomSample(List<T> source, List<T> dest, int samples, Random rand) { randomSample((Collection<T>)source, dest, samples, rand); }
[ "public", "static", "<", "T", ">", "void", "randomSample", "(", "List", "<", "T", ">", "source", ",", "List", "<", "T", ">", "dest", ",", "int", "samples", ",", "Random", "rand", ")", "{", "randomSample", "(", "(", "Collection", "<", "T", ">", ")",...
Obtains a random sample without replacement from a source list and places it in the destination list. This is done without modifying the source list. @param <T> the list content type involved @param source the source of values to randomly sample from @param dest the list to store the random samples in. The list does not need to be empty for the sampling to work correctly @param samples the number of samples to select from the source @param rand the source of randomness for the sampling @throws IllegalArgumentException if the sample size is not positive or l arger than the source population.
[ "Obtains", "a", "random", "sample", "without", "replacement", "from", "a", "source", "list", "and", "places", "it", "in", "the", "destination", "list", ".", "This", "is", "done", "without", "modifying", "the", "source", "list", "." ]
train
https://github.com/EdwardRaff/JSAT/blob/0ff53b7b39684b2379cc1da522f5b3a954b15cfb/JSAT/src/jsat/utils/ListUtils.java#L185-L188
googleapis/google-cloud-java
google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/deprecated/RegionForwardingRuleId.java
RegionForwardingRuleId.of
public static RegionForwardingRuleId of(String region, String rule) { return new RegionForwardingRuleId(null, region, rule); }
java
public static RegionForwardingRuleId of(String region, String rule) { return new RegionForwardingRuleId(null, region, rule); }
[ "public", "static", "RegionForwardingRuleId", "of", "(", "String", "region", ",", "String", "rule", ")", "{", "return", "new", "RegionForwardingRuleId", "(", "null", ",", "region", ",", "rule", ")", ";", "}" ]
Returns a region forwarding rule identity given the region and rule names. The forwarding rule name must be 1-63 characters long and comply with RFC1035. Specifically, the name must match the regular expression {@code [a-z]([-a-z0-9]*[a-z0-9])?} which means the first character must be a lowercase letter, and all following characters must be a dash, lowercase letter, or digit, except the last character, which cannot be a dash. @see <a href="https://www.ietf.org/rfc/rfc1035.txt">RFC1035</a>
[ "Returns", "a", "region", "forwarding", "rule", "identity", "given", "the", "region", "and", "rule", "names", ".", "The", "forwarding", "rule", "name", "must", "be", "1", "-", "63", "characters", "long", "and", "comply", "with", "RFC1035", ".", "Specifically...
train
https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/deprecated/RegionForwardingRuleId.java#L128-L130
strator-dev/greenpepper-open
extensions-external/php/src/main/java/com/greenpepper/phpsud/container/PHPClassDescriptor.java
PHPClassDescriptor.getClassDescriptor
public static PHPClassDescriptor getClassDescriptor(String className, PHPContainer container, Hashtable<String, PHPClassDescriptor> classCache) throws PHPException { PHPClassDescriptor c = classCache.get(className.toLowerCase()); if (c != null) { return c; } Object o = container.getObjectParser().parse("class_exists('" + className + "')"); if (o instanceof Boolean) { Boolean exist = (Boolean) o; if (exist) { c = new PHPClassDescriptor(className, container); LOGGER.info("Add in classcache " + className); classCache.put(className.toLowerCase(), c); return c; } } return null; }
java
public static PHPClassDescriptor getClassDescriptor(String className, PHPContainer container, Hashtable<String, PHPClassDescriptor> classCache) throws PHPException { PHPClassDescriptor c = classCache.get(className.toLowerCase()); if (c != null) { return c; } Object o = container.getObjectParser().parse("class_exists('" + className + "')"); if (o instanceof Boolean) { Boolean exist = (Boolean) o; if (exist) { c = new PHPClassDescriptor(className, container); LOGGER.info("Add in classcache " + className); classCache.put(className.toLowerCase(), c); return c; } } return null; }
[ "public", "static", "PHPClassDescriptor", "getClassDescriptor", "(", "String", "className", ",", "PHPContainer", "container", ",", "Hashtable", "<", "String", ",", "PHPClassDescriptor", ">", "classCache", ")", "throws", "PHPException", "{", "PHPClassDescriptor", "c", ...
<p>getClassDescriptor.</p> @param className a {@link java.lang.String} object. @param container a {@link com.greenpepper.phpsud.container.PHPContainer} object. @param classCache a {@link java.util.Hashtable} object. @return a {@link com.greenpepper.phpsud.container.PHPClassDescriptor} object. @throws com.greenpepper.phpsud.exceptions.PHPException if any.
[ "<p", ">", "getClassDescriptor", ".", "<", "/", "p", ">" ]
train
https://github.com/strator-dev/greenpepper-open/blob/71fd244b4989e9cd2d07ae62dd954a1f2a269a92/extensions-external/php/src/main/java/com/greenpepper/phpsud/container/PHPClassDescriptor.java#L165-L181
hazelcast/hazelcast
hazelcast/src/main/java/com/hazelcast/internal/nearcache/impl/invalidation/RepairingHandler.java
RepairingHandler.checkOrRepairSequence
public void checkOrRepairSequence(final int partition, final long nextSequence, final boolean viaAntiEntropy) { assert nextSequence > 0; MetaDataContainer metaData = getMetaDataContainer(partition); while (true) { final long currentSequence = metaData.getSequence(); if (currentSequence >= nextSequence) { break; } if (metaData.casSequence(currentSequence, nextSequence)) { final long sequenceDiff = nextSequence - currentSequence; if (viaAntiEntropy || sequenceDiff > 1L) { // we have found at least one missing sequence between current and next sequences. if miss is detected by // anti-entropy, number of missed sequences will be `miss = next - current`, otherwise it means miss is // detected by observing received invalidation event sequence numbers and number of missed sequences will be // `miss = next - current - 1`. final long missCount = viaAntiEntropy ? sequenceDiff : sequenceDiff - 1; final long totalMissCount = metaData.addAndGetMissedSequenceCount(missCount); if (logger.isFinestEnabled()) { logger.finest(format("%s:[map=%s,partition=%d,currentSequence=%d,nextSequence=%d,totalMissCount=%d]", "Invalid sequence", name, partition, currentSequence, nextSequence, totalMissCount)); } } break; } } }
java
public void checkOrRepairSequence(final int partition, final long nextSequence, final boolean viaAntiEntropy) { assert nextSequence > 0; MetaDataContainer metaData = getMetaDataContainer(partition); while (true) { final long currentSequence = metaData.getSequence(); if (currentSequence >= nextSequence) { break; } if (metaData.casSequence(currentSequence, nextSequence)) { final long sequenceDiff = nextSequence - currentSequence; if (viaAntiEntropy || sequenceDiff > 1L) { // we have found at least one missing sequence between current and next sequences. if miss is detected by // anti-entropy, number of missed sequences will be `miss = next - current`, otherwise it means miss is // detected by observing received invalidation event sequence numbers and number of missed sequences will be // `miss = next - current - 1`. final long missCount = viaAntiEntropy ? sequenceDiff : sequenceDiff - 1; final long totalMissCount = metaData.addAndGetMissedSequenceCount(missCount); if (logger.isFinestEnabled()) { logger.finest(format("%s:[map=%s,partition=%d,currentSequence=%d,nextSequence=%d,totalMissCount=%d]", "Invalid sequence", name, partition, currentSequence, nextSequence, totalMissCount)); } } break; } } }
[ "public", "void", "checkOrRepairSequence", "(", "final", "int", "partition", ",", "final", "long", "nextSequence", ",", "final", "boolean", "viaAntiEntropy", ")", "{", "assert", "nextSequence", ">", "0", ";", "MetaDataContainer", "metaData", "=", "getMetaDataContain...
multiple threads can concurrently call this method: one is anti-entropy, other one is event service thread
[ "multiple", "threads", "can", "concurrently", "call", "this", "method", ":", "one", "is", "anti", "-", "entropy", "other", "one", "is", "event", "service", "thread" ]
train
https://github.com/hazelcast/hazelcast/blob/8c4bc10515dbbfb41a33e0302c0caedf3cda1baf/hazelcast/src/main/java/com/hazelcast/internal/nearcache/impl/invalidation/RepairingHandler.java#L173-L200
Graylog2/graylog2-server
graylog2-server/src/main/java/org/graylog2/plugin/Version.java
Version.fromPluginProperties
public static Version fromPluginProperties(Class<?> pluginClass, String path, String propertyName, Version defaultVersion) { return fromClasspathProperties(pluginClass, path, propertyName, null, null, defaultVersion); }
java
public static Version fromPluginProperties(Class<?> pluginClass, String path, String propertyName, Version defaultVersion) { return fromClasspathProperties(pluginClass, path, propertyName, null, null, defaultVersion); }
[ "public", "static", "Version", "fromPluginProperties", "(", "Class", "<", "?", ">", "pluginClass", ",", "String", "path", ",", "String", "propertyName", ",", "Version", "defaultVersion", ")", "{", "return", "fromClasspathProperties", "(", "pluginClass", ",", "path...
Try to read the version from the {@literal graylog-plugin.properties} file included in a plugin. @param pluginClass Class where the class loader should be obtained from. @param path Path of the properties file on the classpath which contains the version information. @param propertyName The name of the property to read as project version ("major.minor.patch-preReleaseVersion"). @param defaultVersion The {@link Version} to return if reading the information from the properties files failed.
[ "Try", "to", "read", "the", "version", "from", "the", "{", "@literal", "graylog", "-", "plugin", ".", "properties", "}", "file", "included", "in", "a", "plugin", "." ]
train
https://github.com/Graylog2/graylog2-server/blob/50b565dcead6e0a372236d5c2f8530dc5726fa9b/graylog2-server/src/main/java/org/graylog2/plugin/Version.java#L162-L164
gallandarakhneorg/afc
core/maths/mathgraph/src/main/java/org/arakhne/afc/math/graph/GraphPath.java
GraphPath.splitAfter
public GP splitAfter(ST obj, PT startPoint) { return splitAt(indexOf(obj, startPoint), false); }
java
public GP splitAfter(ST obj, PT startPoint) { return splitAt(indexOf(obj, startPoint), false); }
[ "public", "GP", "splitAfter", "(", "ST", "obj", ",", "PT", "startPoint", ")", "{", "return", "splitAt", "(", "indexOf", "(", "obj", ",", "startPoint", ")", ",", "false", ")", ";", "}" ]
Split this path and retains the first part of the part in this object and reply the second part. The first occurrence of specified element will be in the first part. <p>This function removes until the <i>last occurence</i> of the given object. @param obj the reference segment. @param startPoint is the starting point of the searched segment. @return the rest of the path after the first occurence of the given element.
[ "Split", "this", "path", "and", "retains", "the", "first", "part", "of", "the", "part", "in", "this", "object", "and", "reply", "the", "second", "part", ".", "The", "first", "occurrence", "of", "specified", "element", "will", "be", "in", "the", "first", ...
train
https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/core/maths/mathgraph/src/main/java/org/arakhne/afc/math/graph/GraphPath.java#L1234-L1236
ibm-bluemix-mobile-services/bms-clientsdk-android-core
lib/src/main/java/com/ibm/mobilefirstplatform/clientsdk/android/security/mca/internal/AuthorizationRequestManager.java
AuthorizationRequestManager.sendRequest
public void sendRequest(String path, RequestOptions options) throws IOException, JSONException { String rootUrl; if (path == null) { throw new IllegalArgumentException("'path' parameter can't be null."); } if (path.indexOf(BMSClient.HTTP_SCHEME) == 0 && path.contains(":")) { // request using full path, split the URL to root and path URL url = new URL(path); path = url.getPath(); rootUrl = url.toString().replace(path, ""); } else { String MCATenantId = MCAAuthorizationManager.getInstance().getTenantId(); if(MCATenantId == null){ MCATenantId = BMSClient.getInstance().getBluemixAppGUID(); } String bluemixRegionSuffix = MCAAuthorizationManager.getInstance().getBluemixRegionSuffix(); if(bluemixRegionSuffix == null){ bluemixRegionSuffix = BMSClient.getInstance().getBluemixRegionSuffix(); } // "path" is a relative String serverHost = BMSClient.getInstance().getDefaultProtocol() + "://" + AUTH_SERVER_NAME + bluemixRegionSuffix; if (overrideServerHost!=null) serverHost = overrideServerHost; rootUrl = serverHost + "/" + AUTH_SERVER_NAME + "/" + AUTH_PATH + MCATenantId; } sendRequestInternal(rootUrl, path, options); }
java
public void sendRequest(String path, RequestOptions options) throws IOException, JSONException { String rootUrl; if (path == null) { throw new IllegalArgumentException("'path' parameter can't be null."); } if (path.indexOf(BMSClient.HTTP_SCHEME) == 0 && path.contains(":")) { // request using full path, split the URL to root and path URL url = new URL(path); path = url.getPath(); rootUrl = url.toString().replace(path, ""); } else { String MCATenantId = MCAAuthorizationManager.getInstance().getTenantId(); if(MCATenantId == null){ MCATenantId = BMSClient.getInstance().getBluemixAppGUID(); } String bluemixRegionSuffix = MCAAuthorizationManager.getInstance().getBluemixRegionSuffix(); if(bluemixRegionSuffix == null){ bluemixRegionSuffix = BMSClient.getInstance().getBluemixRegionSuffix(); } // "path" is a relative String serverHost = BMSClient.getInstance().getDefaultProtocol() + "://" + AUTH_SERVER_NAME + bluemixRegionSuffix; if (overrideServerHost!=null) serverHost = overrideServerHost; rootUrl = serverHost + "/" + AUTH_SERVER_NAME + "/" + AUTH_PATH + MCATenantId; } sendRequestInternal(rootUrl, path, options); }
[ "public", "void", "sendRequest", "(", "String", "path", ",", "RequestOptions", "options", ")", "throws", "IOException", ",", "JSONException", "{", "String", "rootUrl", ";", "if", "(", "path", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", ...
Assembles the request path from root and path to authorization endpoint and sends the request. @param path Path to authorization endpoint @param options BaseRequest options @throws IOException @throws JSONException
[ "Assembles", "the", "request", "path", "from", "root", "and", "path", "to", "authorization", "endpoint", "and", "sends", "the", "request", "." ]
train
https://github.com/ibm-bluemix-mobile-services/bms-clientsdk-android-core/blob/8db4f00d0d564792397bfc0e5bd57d52a238b858/lib/src/main/java/com/ibm/mobilefirstplatform/clientsdk/android/security/mca/internal/AuthorizationRequestManager.java#L158-L197
TheHortonMachine/hortonmachine
gears/src/main/java/org/hortonmachine/gears/io/grasslegacy/utils/GrassLegacyUtilities.java
GrassLegacyUtilities.ByteBufferImage
public static BufferedImage ByteBufferImage( byte[] data, int width, int height ) { int[] bandoffsets = {0, 1, 2, 3}; DataBufferByte dbb = new DataBufferByte(data, data.length); WritableRaster wr = Raster.createInterleavedRaster(dbb, width, height, width * 4, 4, bandoffsets, null); int[] bitfield = {8, 8, 8, 8}; ColorSpace cs = ColorSpace.getInstance(ColorSpace.CS_sRGB); ColorModel cm = new ComponentColorModel(cs, bitfield, true, false, Transparency.TRANSLUCENT, DataBuffer.TYPE_BYTE); return new BufferedImage(cm, wr, false, null); }
java
public static BufferedImage ByteBufferImage( byte[] data, int width, int height ) { int[] bandoffsets = {0, 1, 2, 3}; DataBufferByte dbb = new DataBufferByte(data, data.length); WritableRaster wr = Raster.createInterleavedRaster(dbb, width, height, width * 4, 4, bandoffsets, null); int[] bitfield = {8, 8, 8, 8}; ColorSpace cs = ColorSpace.getInstance(ColorSpace.CS_sRGB); ColorModel cm = new ComponentColorModel(cs, bitfield, true, false, Transparency.TRANSLUCENT, DataBuffer.TYPE_BYTE); return new BufferedImage(cm, wr, false, null); }
[ "public", "static", "BufferedImage", "ByteBufferImage", "(", "byte", "[", "]", "data", ",", "int", "width", ",", "int", "height", ")", "{", "int", "[", "]", "bandoffsets", "=", "{", "0", ",", "1", ",", "2", ",", "3", "}", ";", "DataBufferByte", "dbb"...
create a buffered image from a set of color triplets @param data @param width @param height @return
[ "create", "a", "buffered", "image", "from", "a", "set", "of", "color", "triplets" ]
train
https://github.com/TheHortonMachine/hortonmachine/blob/d2b436bbdf951dc1fda56096a42dbc0eae4d35a5/gears/src/main/java/org/hortonmachine/gears/io/grasslegacy/utils/GrassLegacyUtilities.java#L322-L332
Azure/azure-sdk-for-java
sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/JobVersionsInner.java
JobVersionsInner.listByJobAsync
public Observable<Page<JobVersionInner>> listByJobAsync(final String resourceGroupName, final String serverName, final String jobAgentName, final String jobName) { return listByJobWithServiceResponseAsync(resourceGroupName, serverName, jobAgentName, jobName) .map(new Func1<ServiceResponse<Page<JobVersionInner>>, Page<JobVersionInner>>() { @Override public Page<JobVersionInner> call(ServiceResponse<Page<JobVersionInner>> response) { return response.body(); } }); }
java
public Observable<Page<JobVersionInner>> listByJobAsync(final String resourceGroupName, final String serverName, final String jobAgentName, final String jobName) { return listByJobWithServiceResponseAsync(resourceGroupName, serverName, jobAgentName, jobName) .map(new Func1<ServiceResponse<Page<JobVersionInner>>, Page<JobVersionInner>>() { @Override public Page<JobVersionInner> call(ServiceResponse<Page<JobVersionInner>> response) { return response.body(); } }); }
[ "public", "Observable", "<", "Page", "<", "JobVersionInner", ">", ">", "listByJobAsync", "(", "final", "String", "resourceGroupName", ",", "final", "String", "serverName", ",", "final", "String", "jobAgentName", ",", "final", "String", "jobName", ")", "{", "retu...
Gets all versions of a job. @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. @param serverName The name of the server. @param jobAgentName The name of the job agent. @param jobName The name of the job to get. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the PagedList&lt;JobVersionInner&gt; object
[ "Gets", "all", "versions", "of", "a", "job", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/JobVersionsInner.java#L129-L137
ocelotds/ocelot
ocelot-web/src/main/java/org/ocelotds/core/mtc/MessageToClientManager.java
MessageToClientManager.getDataService
Object getDataService(T session, Class cls) throws DataServiceException { String dataServiceClassName = cls.getName(); logger.debug("Looking for dataservice : {}", dataServiceClassName); if (cls.isAnnotationPresent(DataService.class)) { return _getDataService(session, cls); } else { throw new DataServiceException(dataServiceClassName + " is not annotated with @" + DataService.class.getSimpleName()); } }
java
Object getDataService(T session, Class cls) throws DataServiceException { String dataServiceClassName = cls.getName(); logger.debug("Looking for dataservice : {}", dataServiceClassName); if (cls.isAnnotationPresent(DataService.class)) { return _getDataService(session, cls); } else { throw new DataServiceException(dataServiceClassName + " is not annotated with @" + DataService.class.getSimpleName()); } }
[ "Object", "getDataService", "(", "T", "session", ",", "Class", "cls", ")", "throws", "DataServiceException", "{", "String", "dataServiceClassName", "=", "cls", ".", "getName", "(", ")", ";", "logger", ".", "debug", "(", "\"Looking for dataservice : {}\"", ",", "...
Get Dataservice, store dataservice in session if session scope.<br> @param session @param cls @return @throws DataServiceException
[ "Get", "Dataservice", "store", "dataservice", "in", "session", "if", "session", "scope", ".", "<br", ">" ]
train
https://github.com/ocelotds/ocelot/blob/5f0ac37afd8fa4dc9f7234a2aac8abbb522128e7/ocelot-web/src/main/java/org/ocelotds/core/mtc/MessageToClientManager.java#L75-L83
google/j2objc
jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/util/IndianCalendar.java
IndianCalendar.IndianToJD
private static double IndianToJD(int year, int month, int date) { int leapMonth, gyear, m; double start, jd; gyear = year + INDIAN_ERA_START; if(isGregorianLeap(gyear)) { leapMonth = 31; start = gregorianToJD(gyear, 3, 21); } else { leapMonth = 30; start = gregorianToJD(gyear, 3, 22); } if (month == 1) { jd = start + (date - 1); } else { jd = start + leapMonth; m = month - 2; m = Math.min(m, 5); jd += m * 31; if (month >= 8) { m = month - 7; jd += m * 30; } jd += date - 1; } return jd; }
java
private static double IndianToJD(int year, int month, int date) { int leapMonth, gyear, m; double start, jd; gyear = year + INDIAN_ERA_START; if(isGregorianLeap(gyear)) { leapMonth = 31; start = gregorianToJD(gyear, 3, 21); } else { leapMonth = 30; start = gregorianToJD(gyear, 3, 22); } if (month == 1) { jd = start + (date - 1); } else { jd = start + leapMonth; m = month - 2; m = Math.min(m, 5); jd += m * 31; if (month >= 8) { m = month - 7; jd += m * 30; } jd += date - 1; } return jd; }
[ "private", "static", "double", "IndianToJD", "(", "int", "year", ",", "int", "month", ",", "int", "date", ")", "{", "int", "leapMonth", ",", "gyear", ",", "m", ";", "double", "start", ",", "jd", ";", "gyear", "=", "year", "+", "INDIAN_ERA_START", ";", ...
/* This routine converts an Indian date to the corresponding Julian date" @param year The year in Saka Era according to Indian calendar. @param month The month according to Indian calendar (between 1 to 12) @param date The date in month
[ "/", "*", "This", "routine", "converts", "an", "Indian", "date", "to", "the", "corresponding", "Julian", "date" ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/util/IndianCalendar.java#L439-L469
alkacon/opencms-core
src-gwt/org/opencms/gwt/client/util/CmsDomUtil.java
CmsDomUtil.getFirstChildWithClass
public static Element getFirstChildWithClass(Element element, String className) { NodeList<Node> children = element.getChildNodes(); for (int i = 0; i < children.getLength(); i++) { if (children.getItem(i).getNodeType() == Node.ELEMENT_NODE) { Element child = (Element)children.getItem(i); if (child.hasClassName(className)) { return child; } } } return null; }
java
public static Element getFirstChildWithClass(Element element, String className) { NodeList<Node> children = element.getChildNodes(); for (int i = 0; i < children.getLength(); i++) { if (children.getItem(i).getNodeType() == Node.ELEMENT_NODE) { Element child = (Element)children.getItem(i); if (child.hasClassName(className)) { return child; } } } return null; }
[ "public", "static", "Element", "getFirstChildWithClass", "(", "Element", "element", ",", "String", "className", ")", "{", "NodeList", "<", "Node", ">", "children", "=", "element", ".", "getChildNodes", "(", ")", ";", "for", "(", "int", "i", "=", "0", ";", ...
Returns the first direct child matching the given class name.<p> @param element the parent element @param className the class name to match @return the child element
[ "Returns", "the", "first", "direct", "child", "matching", "the", "given", "class", "name", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/gwt/client/util/CmsDomUtil.java#L1397-L1410
ludovicianul/selenium-on-steroids
src/main/java/com/insidecoding/sos/webdriver/WebDriverHelper.java
WebDriverHelper.assertText
public void assertText(final By by, final String text) { WebElement element = driver.findElement(by); Assert.assertEquals("Element: " + element + " does NOT contain the given text: " + text, text, element.getText()); }
java
public void assertText(final By by, final String text) { WebElement element = driver.findElement(by); Assert.assertEquals("Element: " + element + " does NOT contain the given text: " + text, text, element.getText()); }
[ "public", "void", "assertText", "(", "final", "By", "by", ",", "final", "String", "text", ")", "{", "WebElement", "element", "=", "driver", ".", "findElement", "(", "by", ")", ";", "Assert", ".", "assertEquals", "(", "\"Element: \"", "+", "element", "+", ...
Verifies that the given element contains the given text. Please not that the method will do a JUNIT Assert causing the test to fail. @param by the method of identifying the element @param text the text to be matched
[ "Verifies", "that", "the", "given", "element", "contains", "the", "given", "text", ".", "Please", "not", "that", "the", "method", "will", "do", "a", "JUNIT", "Assert", "causing", "the", "test", "to", "fail", "." ]
train
https://github.com/ludovicianul/selenium-on-steroids/blob/f89d91c59f686114f94624bfc55712f278005bfa/src/main/java/com/insidecoding/sos/webdriver/WebDriverHelper.java#L402-L408
gallandarakhneorg/afc
advanced/dbasefile/src/main/java/org/arakhne/afc/io/dbase/DBaseFileWriter.java
DBaseFileWriter.writeDBFString
private void writeDBFString(String str, int size, byte fillingChar) throws IOException { assert this.language != null; // Be sure that the encoding will be the right one int strSize = 0; if (str != null) { final Charset encodingCharset = this.language.getChatset(); if (encodingCharset == null) { throw new IOException(Locale.getString("UNKNOWN_CHARSET")); //$NON-NLS-1$ } final byte[] bytes = str.getBytes(encodingCharset); if (bytes != null) { strSize = bytes.length; for (int i = 0; i < size && i < strSize; ++i) { this.stream.writeByte(bytes[i]); } } } for (int i = strSize; i < size; ++i) { this.stream.writeByte(fillingChar); } }
java
private void writeDBFString(String str, int size, byte fillingChar) throws IOException { assert this.language != null; // Be sure that the encoding will be the right one int strSize = 0; if (str != null) { final Charset encodingCharset = this.language.getChatset(); if (encodingCharset == null) { throw new IOException(Locale.getString("UNKNOWN_CHARSET")); //$NON-NLS-1$ } final byte[] bytes = str.getBytes(encodingCharset); if (bytes != null) { strSize = bytes.length; for (int i = 0; i < size && i < strSize; ++i) { this.stream.writeByte(bytes[i]); } } } for (int i = strSize; i < size; ++i) { this.stream.writeByte(fillingChar); } }
[ "private", "void", "writeDBFString", "(", "String", "str", ",", "int", "size", ",", "byte", "fillingChar", ")", "throws", "IOException", "{", "assert", "this", ".", "language", "!=", "null", ";", "// Be sure that the encoding will be the right one", "int", "strSize"...
Write a string inside the current <var>stream</var>. Each character of the string will be written as bytes. No terminal null character is written. The string area will be filled with the given byte. @param str is the string to write @param size if the max size of the string to write. If <var>str</var> is longer than, it is cut. @param fillingChar is the character used to fill the string area. @throws IOException in case of error.
[ "Write", "a", "string", "inside", "the", "current", "<var", ">", "stream<", "/", "var", ">", ".", "Each", "character", "of", "the", "string", "will", "be", "written", "as", "bytes", ".", "No", "terminal", "null", "character", "is", "written", ".", "The",...
train
https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/dbasefile/src/main/java/org/arakhne/afc/io/dbase/DBaseFileWriter.java#L184-L205
httl/httl
httl/src/main/java/httl/Engine.java
Engine.getTemplate
public Template getTemplate(String name, Locale locale, Object args) throws IOException, ParseException { if (args instanceof String) return getTemplate(name, locale, (String) args); return getTemplate(name, locale, null, args); }
java
public Template getTemplate(String name, Locale locale, Object args) throws IOException, ParseException { if (args instanceof String) return getTemplate(name, locale, (String) args); return getTemplate(name, locale, null, args); }
[ "public", "Template", "getTemplate", "(", "String", "name", ",", "Locale", "locale", ",", "Object", "args", ")", "throws", "IOException", ",", "ParseException", "{", "if", "(", "args", "instanceof", "String", ")", "return", "getTemplate", "(", "name", ",", "...
Get template. @param name - template name @param locale - template locale @return template instance @throws IOException - If an I/O error occurs @throws ParseException - If the template cannot be parsed @see #getEngine()
[ "Get", "template", "." ]
train
https://github.com/httl/httl/blob/e13e00f4ab41252a8f53d6dafd4a6610be9dcaad/httl/src/main/java/httl/Engine.java#L416-L420
MariaDB/mariadb-connector-j
src/main/java/org/mariadb/jdbc/internal/util/Utils.java
Utils.escapeString
public static String escapeString(String value, boolean noBackslashEscapes) { if (!value.contains("'")) { if (noBackslashEscapes) { return value; } if (!value.contains("\\")) { return value; } } String escaped = value.replace("'", "''"); if (noBackslashEscapes) { return escaped; } return escaped.replace("\\", "\\\\"); }
java
public static String escapeString(String value, boolean noBackslashEscapes) { if (!value.contains("'")) { if (noBackslashEscapes) { return value; } if (!value.contains("\\")) { return value; } } String escaped = value.replace("'", "''"); if (noBackslashEscapes) { return escaped; } return escaped.replace("\\", "\\\\"); }
[ "public", "static", "String", "escapeString", "(", "String", "value", ",", "boolean", "noBackslashEscapes", ")", "{", "if", "(", "!", "value", ".", "contains", "(", "\"'\"", ")", ")", "{", "if", "(", "noBackslashEscapes", ")", "{", "return", "value", ";", ...
Escape String. @param value value to escape @param noBackslashEscapes must backslash be escaped @return escaped string.
[ "Escape", "String", "." ]
train
https://github.com/MariaDB/mariadb-connector-j/blob/d148c7cd347c4680617be65d9e511b289d38a30b/src/main/java/org/mariadb/jdbc/internal/util/Utils.java#L149-L163
alkacon/opencms-core
src-gwt/org/opencms/ade/galleries/client/CmsGalleryControllerHandler.java
CmsGalleryControllerHandler.setGalleriesTabContent
public void setGalleriesTabContent(List<CmsGalleryFolderBean> galleryInfos, List<String> selectedGalleries) { m_galleryDialog.getGalleriesTab().fillContent(galleryInfos, selectedGalleries); }
java
public void setGalleriesTabContent(List<CmsGalleryFolderBean> galleryInfos, List<String> selectedGalleries) { m_galleryDialog.getGalleriesTab().fillContent(galleryInfos, selectedGalleries); }
[ "public", "void", "setGalleriesTabContent", "(", "List", "<", "CmsGalleryFolderBean", ">", "galleryInfos", ",", "List", "<", "String", ">", "selectedGalleries", ")", "{", "m_galleryDialog", ".", "getGalleriesTab", "(", ")", ".", "fillContent", "(", "galleryInfos", ...
Sets the list content of the galleries tab.<p> @param galleryInfos the gallery info beans @param selectedGalleries the selected galleries
[ "Sets", "the", "list", "content", "of", "the", "galleries", "tab", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/ade/galleries/client/CmsGalleryControllerHandler.java#L449-L452
Azure/autorest-clientruntime-for-java
client-runtime/src/main/java/com/microsoft/rest/interceptors/CustomHeadersInterceptor.java
CustomHeadersInterceptor.addHeaderMap
public CustomHeadersInterceptor addHeaderMap(Map<String, String> headers) { for (Map.Entry<String, String> header : headers.entrySet()) { this.headers.put(header.getKey(), Collections.singletonList(header.getValue())); } return this; }
java
public CustomHeadersInterceptor addHeaderMap(Map<String, String> headers) { for (Map.Entry<String, String> header : headers.entrySet()) { this.headers.put(header.getKey(), Collections.singletonList(header.getValue())); } return this; }
[ "public", "CustomHeadersInterceptor", "addHeaderMap", "(", "Map", "<", "String", ",", "String", ">", "headers", ")", "{", "for", "(", "Map", ".", "Entry", "<", "String", ",", "String", ">", "header", ":", "headers", ".", "entrySet", "(", ")", ")", "{", ...
Add all headers in a header map. @param headers a map of headers. @return the interceptor instance itself.
[ "Add", "all", "headers", "in", "a", "header", "map", "." ]
train
https://github.com/Azure/autorest-clientruntime-for-java/blob/04621e07dbb0456dd5459dd641f06a9fd4f3abad/client-runtime/src/main/java/com/microsoft/rest/interceptors/CustomHeadersInterceptor.java#L103-L108
aws/aws-sdk-java
aws-java-sdk-ssm/src/main/java/com/amazonaws/services/simplesystemsmanagement/model/AutomationExecution.java
AutomationExecution.withParameters
public AutomationExecution withParameters(java.util.Map<String, java.util.List<String>> parameters) { setParameters(parameters); return this; }
java
public AutomationExecution withParameters(java.util.Map<String, java.util.List<String>> parameters) { setParameters(parameters); return this; }
[ "public", "AutomationExecution", "withParameters", "(", "java", ".", "util", ".", "Map", "<", "String", ",", "java", ".", "util", ".", "List", "<", "String", ">", ">", "parameters", ")", "{", "setParameters", "(", "parameters", ")", ";", "return", "this", ...
<p> The key-value map of execution parameters, which were supplied when calling StartAutomationExecution. </p> @param parameters The key-value map of execution parameters, which were supplied when calling StartAutomationExecution. @return Returns a reference to this object so that method calls can be chained together.
[ "<p", ">", "The", "key", "-", "value", "map", "of", "execution", "parameters", "which", "were", "supplied", "when", "calling", "StartAutomationExecution", ".", "<", "/", "p", ">" ]
train
https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-ssm/src/main/java/com/amazonaws/services/simplesystemsmanagement/model/AutomationExecution.java#L634-L637
Azure/azure-sdk-for-java
hdinsight/resource-manager/v2018_06_01_preview/src/main/java/com/microsoft/azure/management/hdinsight/v2018_06_01_preview/implementation/ClustersInner.java
ClustersInner.executeScriptActionsAsync
public Observable<Void> executeScriptActionsAsync(String resourceGroupName, String clusterName, ExecuteScriptActionParameters parameters) { return executeScriptActionsWithServiceResponseAsync(resourceGroupName, clusterName, parameters).map(new Func1<ServiceResponse<Void>, Void>() { @Override public Void call(ServiceResponse<Void> response) { return response.body(); } }); }
java
public Observable<Void> executeScriptActionsAsync(String resourceGroupName, String clusterName, ExecuteScriptActionParameters parameters) { return executeScriptActionsWithServiceResponseAsync(resourceGroupName, clusterName, parameters).map(new Func1<ServiceResponse<Void>, Void>() { @Override public Void call(ServiceResponse<Void> response) { return response.body(); } }); }
[ "public", "Observable", "<", "Void", ">", "executeScriptActionsAsync", "(", "String", "resourceGroupName", ",", "String", "clusterName", ",", "ExecuteScriptActionParameters", "parameters", ")", "{", "return", "executeScriptActionsWithServiceResponseAsync", "(", "resourceGroup...
Executes script actions on the specified HDInsight cluster. @param resourceGroupName The name of the resource group. @param clusterName The name of the cluster. @param parameters The parameters for executing script actions. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable for the request
[ "Executes", "script", "actions", "on", "the", "specified", "HDInsight", "cluster", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/hdinsight/resource-manager/v2018_06_01_preview/src/main/java/com/microsoft/azure/management/hdinsight/v2018_06_01_preview/implementation/ClustersInner.java#L1746-L1753
fabric8io/kubernetes-client
kubernetes-client/src/main/java/io/fabric8/kubernetes/client/dsl/base/OperationSupport.java
OperationSupport.handleCreate
protected <T, I> T handleCreate(I resource, Class<T> outputType) throws ExecutionException, InterruptedException, KubernetesClientException, IOException { RequestBody body = RequestBody.create(JSON, JSON_MAPPER.writeValueAsString(resource)); Request.Builder requestBuilder = new Request.Builder().post(body).url(getNamespacedUrl(checkNamespace(resource))); return handleResponse(requestBuilder, outputType, Collections.<String, String>emptyMap()); }
java
protected <T, I> T handleCreate(I resource, Class<T> outputType) throws ExecutionException, InterruptedException, KubernetesClientException, IOException { RequestBody body = RequestBody.create(JSON, JSON_MAPPER.writeValueAsString(resource)); Request.Builder requestBuilder = new Request.Builder().post(body).url(getNamespacedUrl(checkNamespace(resource))); return handleResponse(requestBuilder, outputType, Collections.<String, String>emptyMap()); }
[ "protected", "<", "T", ",", "I", ">", "T", "handleCreate", "(", "I", "resource", ",", "Class", "<", "T", ">", "outputType", ")", "throws", "ExecutionException", ",", "InterruptedException", ",", "KubernetesClientException", ",", "IOException", "{", "RequestBody"...
Create a resource. @param resource resource provided @param outputType resource type you want as output @param <T> template argument for output type @param <I> template argument for resource @return returns de-serialized version of apiserver response in form of type provided @throws ExecutionException Execution Exception @throws InterruptedException Interrupted Exception @throws KubernetesClientException KubernetesClientException @throws IOException IOException
[ "Create", "a", "resource", "." ]
train
https://github.com/fabric8io/kubernetes-client/blob/141668a882ed8e902c045a5cd0a80f14bd17d132/kubernetes-client/src/main/java/io/fabric8/kubernetes/client/dsl/base/OperationSupport.java#L231-L235
TheHortonMachine/hortonmachine
gears/src/main/java/org/hortonmachine/gears/io/dxfdwg/libs/dwg/utils/ByteUtils.java
ByteUtils.bytesToBigInteger
public static final BigInteger bytesToBigInteger( byte[] data, int[] offset ) { int length = bytesToInt(data, offset); byte[] bytes = new byte[length]; offset[0] += memcpy(bytes, 0, data, offset[0], length); return new BigInteger(bytes); }
java
public static final BigInteger bytesToBigInteger( byte[] data, int[] offset ) { int length = bytesToInt(data, offset); byte[] bytes = new byte[length]; offset[0] += memcpy(bytes, 0, data, offset[0], length); return new BigInteger(bytes); }
[ "public", "static", "final", "BigInteger", "bytesToBigInteger", "(", "byte", "[", "]", "data", ",", "int", "[", "]", "offset", ")", "{", "int", "length", "=", "bytesToInt", "(", "data", ",", "offset", ")", ";", "byte", "[", "]", "bytes", "=", "new", ...
Return the <code>BigInteger</code> represented by the bytes in <code>data</code> staring at offset <code>offset[0]</code>. @param data the array from which to read @param offset A single element array whose first element is the index in data from which to begin reading on function entry, and which on function exit has been incremented by the number of bytes read. @return the <code>BigInteger</code> decoded
[ "Return", "the", "<code", ">", "BigInteger<", "/", "code", ">", "represented", "by", "the", "bytes", "in", "<code", ">", "data<", "/", "code", ">", "staring", "at", "offset", "<code", ">", "offset", "[", "0", "]", "<", "/", "code", ">", "." ]
train
https://github.com/TheHortonMachine/hortonmachine/blob/d2b436bbdf951dc1fda56096a42dbc0eae4d35a5/gears/src/main/java/org/hortonmachine/gears/io/dxfdwg/libs/dwg/utils/ByteUtils.java#L358-L364
derari/cthul
matchers/src/main/java/org/cthul/matchers/diagnose/QuickDiagnosingMatcherBase.java
QuickDiagnosingMatcherBase.quickMatch
protected static boolean quickMatch(Matcher<?> matcher, Object item, Description mismatch) { return QuickDiagnose.matches(matcher, item, mismatch); }
java
protected static boolean quickMatch(Matcher<?> matcher, Object item, Description mismatch) { return QuickDiagnose.matches(matcher, item, mismatch); }
[ "protected", "static", "boolean", "quickMatch", "(", "Matcher", "<", "?", ">", "matcher", ",", "Object", "item", ",", "Description", "mismatch", ")", "{", "return", "QuickDiagnose", ".", "matches", "(", "matcher", ",", "item", ",", "mismatch", ")", ";", "}...
Uses the {@code matcher} to validate {@code item}. If validation fails, an error message is appended to {@code mismatch}. <p> The code is equivalent to <pre>{@code if (matcher.matches(item)) { return true; } else { matcher.describeMismatch(item, mismatch); return false; } }</pre> but uses optimizations for diagnosing matchers. @param matcher @param item @param mismatch @return {@code true} iif {@code item} was matched @see DiagnosingMatcher @see QuickDiagnosingMatcher
[ "Uses", "the", "{", "@code", "matcher", "}", "to", "validate", "{", "@code", "item", "}", ".", "If", "validation", "fails", "an", "error", "message", "is", "appended", "to", "{", "@code", "mismatch", "}", ".", "<p", ">", "The", "code", "is", "equivalen...
train
https://github.com/derari/cthul/blob/74a31e3cb6a94f5f25cc5253d1dbd42e19a17ebc/matchers/src/main/java/org/cthul/matchers/diagnose/QuickDiagnosingMatcherBase.java#L81-L83
openengsb/openengsb
api/ekb/src/main/java/org/openengsb/core/ekb/api/transformation/TransformationDescription.java
TransformationDescription.valueField
public void valueField(String targetField, String value) { TransformationStep step = new TransformationStep(); step.setTargetField(targetField); step.setOperationParameter(TransformationConstants.VALUE_PARAM, value); step.setOperationName("value"); steps.add(step); }
java
public void valueField(String targetField, String value) { TransformationStep step = new TransformationStep(); step.setTargetField(targetField); step.setOperationParameter(TransformationConstants.VALUE_PARAM, value); step.setOperationName("value"); steps.add(step); }
[ "public", "void", "valueField", "(", "String", "targetField", ",", "String", "value", ")", "{", "TransformationStep", "step", "=", "new", "TransformationStep", "(", ")", ";", "step", ".", "setTargetField", "(", "targetField", ")", ";", "step", ".", "setOperati...
Adds a value step to the transformation description. The given value is written to the target field.
[ "Adds", "a", "value", "step", "to", "the", "transformation", "description", ".", "The", "given", "value", "is", "written", "to", "the", "target", "field", "." ]
train
https://github.com/openengsb/openengsb/blob/d39058000707f617cd405629f9bc7f17da7b414a/api/ekb/src/main/java/org/openengsb/core/ekb/api/transformation/TransformationDescription.java#L152-L158
AKSW/RDFUnit
rdfunit-validate/src/main/java/org/aksw/rdfunit/validate/ws/AbstractRDFUnitWebService.java
AbstractRDFUnitWebService.writeResults
private static void writeResults(final RDFUnitConfiguration configuration, final TestExecution testExecution, HttpServletResponse httpServletResponse) throws RdfWriterException, IOException { SerializationFormat serializationFormat = configuration.geFirstOutputFormat(); if (serializationFormat == null) { throw new RdfWriterException("Invalid output format"); } httpServletResponse.setContentType(serializationFormat.getMimeType()); RdfWriter rdfWriter = RdfResultsWriterFactory.createWriterFromFormat(httpServletResponse.getOutputStream(), serializationFormat, testExecution); rdfWriter.write(ModelFactory.createDefaultModel()); }
java
private static void writeResults(final RDFUnitConfiguration configuration, final TestExecution testExecution, HttpServletResponse httpServletResponse) throws RdfWriterException, IOException { SerializationFormat serializationFormat = configuration.geFirstOutputFormat(); if (serializationFormat == null) { throw new RdfWriterException("Invalid output format"); } httpServletResponse.setContentType(serializationFormat.getMimeType()); RdfWriter rdfWriter = RdfResultsWriterFactory.createWriterFromFormat(httpServletResponse.getOutputStream(), serializationFormat, testExecution); rdfWriter.write(ModelFactory.createDefaultModel()); }
[ "private", "static", "void", "writeResults", "(", "final", "RDFUnitConfiguration", "configuration", ",", "final", "TestExecution", "testExecution", ",", "HttpServletResponse", "httpServletResponse", ")", "throws", "RdfWriterException", ",", "IOException", "{", "Serializatio...
Writes the output of the validation to the HttpServletResponse
[ "Writes", "the", "output", "of", "the", "validation", "to", "the", "HttpServletResponse" ]
train
https://github.com/AKSW/RDFUnit/blob/083f18ebda4ad790b1fbb4cfe1c9dd1762d51384/rdfunit-validate/src/main/java/org/aksw/rdfunit/validate/ws/AbstractRDFUnitWebService.java#L83-L92
UrielCh/ovh-java-sdk
ovh-java-sdk-sms/src/main/java/net/minidev/ovh/api/ApiOvhSms.java
ApiOvhSms.serviceName_phonebooks_bookKey_GET
public OvhPhonebook serviceName_phonebooks_bookKey_GET(String serviceName, String bookKey) throws IOException { String qPath = "/sms/{serviceName}/phonebooks/{bookKey}"; StringBuilder sb = path(qPath, serviceName, bookKey); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, OvhPhonebook.class); }
java
public OvhPhonebook serviceName_phonebooks_bookKey_GET(String serviceName, String bookKey) throws IOException { String qPath = "/sms/{serviceName}/phonebooks/{bookKey}"; StringBuilder sb = path(qPath, serviceName, bookKey); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, OvhPhonebook.class); }
[ "public", "OvhPhonebook", "serviceName_phonebooks_bookKey_GET", "(", "String", "serviceName", ",", "String", "bookKey", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/sms/{serviceName}/phonebooks/{bookKey}\"", ";", "StringBuilder", "sb", "=", "path", "(", ...
Get this object properties REST: GET /sms/{serviceName}/phonebooks/{bookKey} @param serviceName [required] The internal name of your SMS offer @param bookKey [required] Identifier of the phonebook
[ "Get", "this", "object", "properties" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-sms/src/main/java/net/minidev/ovh/api/ApiOvhSms.java#L1086-L1091
protostuff/protostuff
protostuff-parser/src/main/java/io/protostuff/parser/DefaultProtoLoader.java
DefaultProtoLoader.getResource
public static URL getResource(String resource, Class<?> context) { return getResource(resource, context, false); }
java
public static URL getResource(String resource, Class<?> context) { return getResource(resource, context, false); }
[ "public", "static", "URL", "getResource", "(", "String", "resource", ",", "Class", "<", "?", ">", "context", ")", "{", "return", "getResource", "(", "resource", ",", "context", ",", "false", ")", ";", "}" ]
Loads a {@link URL} resource from the classloader; If not found, the classloader of the {@code context} class specified will be used.
[ "Loads", "a", "{" ]
train
https://github.com/protostuff/protostuff/blob/af669cf089057d0ec83220266131ce411854af7b/protostuff-parser/src/main/java/io/protostuff/parser/DefaultProtoLoader.java#L289-L292
google/closure-compiler
src/com/google/javascript/rhino/JSDocInfo.java
JSDocInfo.declareParam
boolean declareParam(JSTypeExpression jsType, String parameter) { lazyInitInfo(); if (info.parameters == null) { info.parameters = new LinkedHashMap<>(); } if (!info.parameters.containsKey(parameter)) { info.parameters.put(parameter, jsType); return true; } else { return false; } }
java
boolean declareParam(JSTypeExpression jsType, String parameter) { lazyInitInfo(); if (info.parameters == null) { info.parameters = new LinkedHashMap<>(); } if (!info.parameters.containsKey(parameter)) { info.parameters.put(parameter, jsType); return true; } else { return false; } }
[ "boolean", "declareParam", "(", "JSTypeExpression", "jsType", ",", "String", "parameter", ")", "{", "lazyInitInfo", "(", ")", ";", "if", "(", "info", ".", "parameters", "==", "null", ")", "{", "info", ".", "parameters", "=", "new", "LinkedHashMap", "<>", "...
Declares a parameter. Parameters are described using the {@code @param} annotation. @param jsType the parameter's type, it may be {@code null} when the {@code @param} annotation did not specify a type. @param parameter the parameter's name
[ "Declares", "a", "parameter", ".", "Parameters", "are", "described", "using", "the", "{", "@code", "@param", "}", "annotation", "." ]
train
https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/rhino/JSDocInfo.java#L1383-L1394
aalmiray/Json-lib
src/main/java/net/sf/json/JsonConfig.java
JsonConfig.registerJsonValueProcessor
public void registerJsonValueProcessor( Class beanClass, Class propertyType, JsonValueProcessor jsonValueProcessor ) { if( beanClass != null && propertyType != null && jsonValueProcessor != null ) { beanTypeMap.put( beanClass, propertyType, jsonValueProcessor ); } }
java
public void registerJsonValueProcessor( Class beanClass, Class propertyType, JsonValueProcessor jsonValueProcessor ) { if( beanClass != null && propertyType != null && jsonValueProcessor != null ) { beanTypeMap.put( beanClass, propertyType, jsonValueProcessor ); } }
[ "public", "void", "registerJsonValueProcessor", "(", "Class", "beanClass", ",", "Class", "propertyType", ",", "JsonValueProcessor", "jsonValueProcessor", ")", "{", "if", "(", "beanClass", "!=", "null", "&&", "propertyType", "!=", "null", "&&", "jsonValueProcessor", ...
Registers a JsonValueProcessor.<br> [Java -&gt; JSON] @param beanClass the class to use as key @param propertyType the property type to use as key @param jsonValueProcessor the processor to register
[ "Registers", "a", "JsonValueProcessor", ".", "<br", ">", "[", "Java", "-", "&gt", ";", "JSON", "]" ]
train
https://github.com/aalmiray/Json-lib/blob/9e2b3376ee8f511a48aa7ac05f75a7414e02280f/src/main/java/net/sf/json/JsonConfig.java#L813-L817
ocelotds/ocelot
ocelot-web/src/main/java/org/ocelotds/topic/topicAccess/TopicAccessManager.java
TopicAccessManager.checkAccessTopicFromController
boolean checkAccessTopicFromController(UserContext ctx, String topic, JsTopicAccessController jsTopicAccessController) throws IllegalAccessException { logger.debug("Looking for accessController for topic '{}' from JsTopicAccessController {}", topic, jsTopicAccessController); JsTopicControls jsTopicControls = jsTopicControlsTools.getJsTopicControlsFromProxyClass(jsTopicAccessController.getClass()); logger.debug("Looking for accessController for topic '{}' from jsTopicControls {}", topic, jsTopicControls); if(null != jsTopicControls) { logger.debug("Looking for accessController for topic '{}' from jsTopicControls {}, {}", topic, jsTopicControls, jsTopicControls.value()); for (JsTopicControl jsTopicControl : jsTopicControls.value()) { if(topic.equals(jsTopicControl.value())) { logger.debug("Found accessController for topic '{}' from JsTopicControls annotation", topic); checkAccessTopicFromControllers(ctx, topic, Arrays.asList(jsTopicAccessController)); return true; } } } return false; }
java
boolean checkAccessTopicFromController(UserContext ctx, String topic, JsTopicAccessController jsTopicAccessController) throws IllegalAccessException { logger.debug("Looking for accessController for topic '{}' from JsTopicAccessController {}", topic, jsTopicAccessController); JsTopicControls jsTopicControls = jsTopicControlsTools.getJsTopicControlsFromProxyClass(jsTopicAccessController.getClass()); logger.debug("Looking for accessController for topic '{}' from jsTopicControls {}", topic, jsTopicControls); if(null != jsTopicControls) { logger.debug("Looking for accessController for topic '{}' from jsTopicControls {}, {}", topic, jsTopicControls, jsTopicControls.value()); for (JsTopicControl jsTopicControl : jsTopicControls.value()) { if(topic.equals(jsTopicControl.value())) { logger.debug("Found accessController for topic '{}' from JsTopicControls annotation", topic); checkAccessTopicFromControllers(ctx, topic, Arrays.asList(jsTopicAccessController)); return true; } } } return false; }
[ "boolean", "checkAccessTopicFromController", "(", "UserContext", "ctx", ",", "String", "topic", ",", "JsTopicAccessController", "jsTopicAccessController", ")", "throws", "IllegalAccessException", "{", "logger", ".", "debug", "(", "\"Looking for accessController for topic '{}' f...
Check if specific access control is allowed from controller @param ctx @param topic @param controllers @return true if at least one specific topicAccessControl exist @throws IllegalAccessException
[ "Check", "if", "specific", "access", "control", "is", "allowed", "from", "controller" ]
train
https://github.com/ocelotds/ocelot/blob/5f0ac37afd8fa4dc9f7234a2aac8abbb522128e7/ocelot-web/src/main/java/org/ocelotds/topic/topicAccess/TopicAccessManager.java#L128-L143
roboconf/roboconf-platform
core/roboconf-dm/src/main/java/net/roboconf/dm/internal/api/impl/ApplicationMngrImpl.java
ApplicationMngrImpl.checkErrors
static void checkErrors( Collection<RoboconfError> errors, Logger logger ) throws InvalidApplicationException { if( RoboconfErrorHelpers.containsCriticalErrors( errors )) throw new InvalidApplicationException( errors ); // Null language => English (right language for logs) Collection<RoboconfError> warnings = RoboconfErrorHelpers.findWarnings( errors ); for( String warningMsg : RoboconfErrorHelpers.formatErrors( warnings, null, true ).values()) logger.warning( warningMsg ); }
java
static void checkErrors( Collection<RoboconfError> errors, Logger logger ) throws InvalidApplicationException { if( RoboconfErrorHelpers.containsCriticalErrors( errors )) throw new InvalidApplicationException( errors ); // Null language => English (right language for logs) Collection<RoboconfError> warnings = RoboconfErrorHelpers.findWarnings( errors ); for( String warningMsg : RoboconfErrorHelpers.formatErrors( warnings, null, true ).values()) logger.warning( warningMsg ); }
[ "static", "void", "checkErrors", "(", "Collection", "<", "RoboconfError", ">", "errors", ",", "Logger", "logger", ")", "throws", "InvalidApplicationException", "{", "if", "(", "RoboconfErrorHelpers", ".", "containsCriticalErrors", "(", "errors", ")", ")", "throw", ...
A method to check errors. @param errors a non-null list of errors @param logger a logger @throws InvalidApplicationException if there are critical errors
[ "A", "method", "to", "check", "errors", "." ]
train
https://github.com/roboconf/roboconf-platform/blob/add54eead479effb138d0ff53a2d637902b82702/core/roboconf-dm/src/main/java/net/roboconf/dm/internal/api/impl/ApplicationMngrImpl.java#L336-L346
groundupworks/wings
wings-facebook/src/main/java/com/groundupworks/wings/facebook/FacebookPrivacyDialogFragment.java
FacebookPrivacyDialogFragment.newInstance
public static FacebookPrivacyDialogFragment newInstance(String albumName, String albumGraphPath) { FacebookPrivacyDialogFragment fragment = new FacebookPrivacyDialogFragment(); Bundle args = new Bundle(); args.putString(FRAGMENT_BUNDLE_KEY_ALBUM_NAME, albumName); args.putString(FRAGMENT_BUNDLE_KEY_ALBUM_GRAPH_PATH, albumGraphPath); fragment.setArguments(args); return fragment; }
java
public static FacebookPrivacyDialogFragment newInstance(String albumName, String albumGraphPath) { FacebookPrivacyDialogFragment fragment = new FacebookPrivacyDialogFragment(); Bundle args = new Bundle(); args.putString(FRAGMENT_BUNDLE_KEY_ALBUM_NAME, albumName); args.putString(FRAGMENT_BUNDLE_KEY_ALBUM_GRAPH_PATH, albumGraphPath); fragment.setArguments(args); return fragment; }
[ "public", "static", "FacebookPrivacyDialogFragment", "newInstance", "(", "String", "albumName", ",", "String", "albumGraphPath", ")", "{", "FacebookPrivacyDialogFragment", "fragment", "=", "new", "FacebookPrivacyDialogFragment", "(", ")", ";", "Bundle", "args", "=", "ne...
Creates a new {@link FacebookPrivacyDialogFragment} instance. @param albumName the name of the album to share to. @param albumGraphPath the graph path of the album to share to. @return the new {@link FacebookPrivacyDialogFragment} instance.
[ "Creates", "a", "new", "{", "@link", "FacebookPrivacyDialogFragment", "}", "instance", "." ]
train
https://github.com/groundupworks/wings/blob/03d2827c30ef55f2db4e23f7500e016c7771fa39/wings-facebook/src/main/java/com/groundupworks/wings/facebook/FacebookPrivacyDialogFragment.java#L124-L133
facebookarchive/hadoop-20
src/core/org/apache/hadoop/io/FastWritableRegister.java
FastWritableRegister.tryGetInstance
public static FastWritable tryGetInstance(String name, Configuration conf) { if (name.length() != NAME_LEN) { // we use it to fast discard the request without doing map lookup return null; } FastWritable fw = register.get(name); return fw == null ? null : fw.getFastWritableInstance(conf); }
java
public static FastWritable tryGetInstance(String name, Configuration conf) { if (name.length() != NAME_LEN) { // we use it to fast discard the request without doing map lookup return null; } FastWritable fw = register.get(name); return fw == null ? null : fw.getFastWritableInstance(conf); }
[ "public", "static", "FastWritable", "tryGetInstance", "(", "String", "name", ",", "Configuration", "conf", ")", "{", "if", "(", "name", ".", "length", "(", ")", "!=", "NAME_LEN", ")", "{", "// we use it to fast discard the request without doing map lookup", "return", ...
Tries to get an instance given the name of class. If the name is registered as FastWritable, the instance is obtained using the registry.
[ "Tries", "to", "get", "an", "instance", "given", "the", "name", "of", "class", ".", "If", "the", "name", "is", "registered", "as", "FastWritable", "the", "instance", "is", "obtained", "using", "the", "registry", "." ]
train
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/core/org/apache/hadoop/io/FastWritableRegister.java#L98-L105
sshtools/j2ssh-maverick
j2ssh-maverick/src/main/java/com/sshtools/sftp/SftpClient.java
SftpClient.get
public SftpFileAttributes get(String path, FileTransferProgress progress, boolean resume) throws FileNotFoundException, SftpStatusException, SshException, TransferCancelledException { String localfile; if (path.lastIndexOf("/") > -1) { localfile = path.substring(path.lastIndexOf("/") + 1); } else { localfile = path; } return get(path, localfile, progress, resume); }
java
public SftpFileAttributes get(String path, FileTransferProgress progress, boolean resume) throws FileNotFoundException, SftpStatusException, SshException, TransferCancelledException { String localfile; if (path.lastIndexOf("/") > -1) { localfile = path.substring(path.lastIndexOf("/") + 1); } else { localfile = path; } return get(path, localfile, progress, resume); }
[ "public", "SftpFileAttributes", "get", "(", "String", "path", ",", "FileTransferProgress", "progress", ",", "boolean", "resume", ")", "throws", "FileNotFoundException", ",", "SftpStatusException", ",", "SshException", ",", "TransferCancelledException", "{", "String", "l...
<p> Download the remote file to the local computer. </p> @param path the path to the remote file @param progress @param resume attempt to resume a interrupted download @return the downloaded file's attributes @throws FileNotFoundException @throws SftpStatusException @throws SshException @throws TransferCancelledException
[ "<p", ">", "Download", "the", "remote", "file", "to", "the", "local", "computer", ".", "<", "/", "p", ">" ]
train
https://github.com/sshtools/j2ssh-maverick/blob/ce11ceaf0aa0b129b54327a6891973e1e34689f7/j2ssh-maverick/src/main/java/com/sshtools/sftp/SftpClient.java#L824-L836
looly/hutool
hutool-core/src/main/java/cn/hutool/core/io/FileUtil.java
FileUtil.subPath
public static String subPath(String rootDir, File file) { try { return subPath(rootDir, file.getCanonicalPath()); } catch (IOException e) { throw new IORuntimeException(e); } }
java
public static String subPath(String rootDir, File file) { try { return subPath(rootDir, file.getCanonicalPath()); } catch (IOException e) { throw new IORuntimeException(e); } }
[ "public", "static", "String", "subPath", "(", "String", "rootDir", ",", "File", "file", ")", "{", "try", "{", "return", "subPath", "(", "rootDir", ",", "file", ".", "getCanonicalPath", "(", ")", ")", ";", "}", "catch", "(", "IOException", "e", ")", "{"...
获得相对子路径 栗子: <pre> dirPath: d:/aaa/bbb filePath: d:/aaa/bbb/ccc =》 ccc dirPath: d:/Aaa/bbb filePath: d:/aaa/bbb/ccc.txt =》 ccc.txt </pre> @param rootDir 绝对父路径 @param file 文件 @return 相对子路径
[ "获得相对子路径" ]
train
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/io/FileUtil.java#L1599-L1605
Alluxio/alluxio
core/base/src/main/java/alluxio/util/URIUtils.java
URIUtils.hashIgnoreCase
public static int hashIgnoreCase(int hash, String s) { if (s == null) { return hash; } int length = s.length(); for (int i = 0; i < length; i++) { hash = 31 * hash + URIUtils.toLower(s.charAt(i)); } return hash; }
java
public static int hashIgnoreCase(int hash, String s) { if (s == null) { return hash; } int length = s.length(); for (int i = 0; i < length; i++) { hash = 31 * hash + URIUtils.toLower(s.charAt(i)); } return hash; }
[ "public", "static", "int", "hashIgnoreCase", "(", "int", "hash", ",", "String", "s", ")", "{", "if", "(", "s", "==", "null", ")", "{", "return", "hash", ";", "}", "int", "length", "=", "s", ".", "length", "(", ")", ";", "for", "(", "int", "i", ...
Hashes a string for a URI hash, while ignoring the case. @param hash the input hash @param s the string to hash and combine with the input hash @return the resulting hash
[ "Hashes", "a", "string", "for", "a", "URI", "hash", "while", "ignoring", "the", "case", "." ]
train
https://github.com/Alluxio/alluxio/blob/af38cf3ab44613355b18217a3a4d961f8fec3a10/core/base/src/main/java/alluxio/util/URIUtils.java#L291-L300
finmath/finmath-lib
src/main/java6/net/finmath/marketdata/model/curves/ForwardCurve.java
ForwardCurve.createForwardCurveFromForwards
public static ForwardCurve createForwardCurveFromForwards(String name, LocalDate referenceDate, String paymentOffsetCode, String interpolationEntityForward, String discountCurveName, AnalyticModelInterface model, double[] times, double[] givenForwards) { return createForwardCurveFromForwards(name, referenceDate, paymentOffsetCode, InterpolationEntityForward.valueOf(interpolationEntityForward), discountCurveName, model, times, givenForwards); }
java
public static ForwardCurve createForwardCurveFromForwards(String name, LocalDate referenceDate, String paymentOffsetCode, String interpolationEntityForward, String discountCurveName, AnalyticModelInterface model, double[] times, double[] givenForwards) { return createForwardCurveFromForwards(name, referenceDate, paymentOffsetCode, InterpolationEntityForward.valueOf(interpolationEntityForward), discountCurveName, model, times, givenForwards); }
[ "public", "static", "ForwardCurve", "createForwardCurveFromForwards", "(", "String", "name", ",", "LocalDate", "referenceDate", ",", "String", "paymentOffsetCode", ",", "String", "interpolationEntityForward", ",", "String", "discountCurveName", ",", "AnalyticModelInterface", ...
Create a forward curve from given times and given forwards. @param name The name of this curve. @param referenceDate The reference date for this code, i.e., the date which defines t=0. @param paymentOffsetCode The maturity of the index modeled by this curve. @param interpolationEntityForward Interpolation entity used for forward rate interpolation. @param discountCurveName The name of a discount curve associated with this index (associated with it's funding or collateralization), if any. @param model The model to be used to fetch the discount curve, if needed. @param times A vector of given time points. @param givenForwards A vector of given forwards (corresponding to the given time points). @return A new ForwardCurve object.
[ "Create", "a", "forward", "curve", "from", "given", "times", "and", "given", "forwards", "." ]
train
https://github.com/finmath/finmath-lib/blob/a3c067d52dd33feb97d851df6cab130e4116759f/src/main/java6/net/finmath/marketdata/model/curves/ForwardCurve.java#L191-L193
meertensinstituut/mtas
src/main/java/mtas/search/spans/util/MtasIgnoreItem.java
MtasIgnoreItem.removeBefore
public void removeBefore(int docId, int position) { if (ignoreSpans != null && docId == currentDocId) { baseStartPositionList.entrySet() .removeIf(entry -> entry.getKey() < position); baseEndPositionList.entrySet() .removeIf(entry -> entry.getKey() < position); fullEndPositionList.entrySet() .removeIf(entry -> entry.getKey() < position); minBaseStartPosition.entrySet() .removeIf(entry -> entry.getKey() < position); maxBaseEndPosition.entrySet() .removeIf(entry -> entry.getKey() < position); minFullStartPosition.entrySet() .removeIf(entry -> entry.getKey() < position); maxFullEndPosition.entrySet() .removeIf(entry -> entry.getKey() < position); if (minimumPosition < position) { minimumPosition = position; } if (currentPosition < position) { currentPosition = position; } } }
java
public void removeBefore(int docId, int position) { if (ignoreSpans != null && docId == currentDocId) { baseStartPositionList.entrySet() .removeIf(entry -> entry.getKey() < position); baseEndPositionList.entrySet() .removeIf(entry -> entry.getKey() < position); fullEndPositionList.entrySet() .removeIf(entry -> entry.getKey() < position); minBaseStartPosition.entrySet() .removeIf(entry -> entry.getKey() < position); maxBaseEndPosition.entrySet() .removeIf(entry -> entry.getKey() < position); minFullStartPosition.entrySet() .removeIf(entry -> entry.getKey() < position); maxFullEndPosition.entrySet() .removeIf(entry -> entry.getKey() < position); if (minimumPosition < position) { minimumPosition = position; } if (currentPosition < position) { currentPosition = position; } } }
[ "public", "void", "removeBefore", "(", "int", "docId", ",", "int", "position", ")", "{", "if", "(", "ignoreSpans", "!=", "null", "&&", "docId", "==", "currentDocId", ")", "{", "baseStartPositionList", ".", "entrySet", "(", ")", ".", "removeIf", "(", "entry...
Removes the before. @param docId the doc id @param position the position
[ "Removes", "the", "before", "." ]
train
https://github.com/meertensinstituut/mtas/blob/f02ae730848616bd88b553efa7f9eddc32818e64/src/main/java/mtas/search/spans/util/MtasIgnoreItem.java#L321-L344
mapsforge/mapsforge
mapsforge-map-reader/src/main/java/org/mapsforge/map/reader/MapFile.java
MapFile.readMapData
@Override public MapReadResult readMapData(Tile upperLeft, Tile lowerRight) { return readMapData(upperLeft, lowerRight, Selector.ALL); }
java
@Override public MapReadResult readMapData(Tile upperLeft, Tile lowerRight) { return readMapData(upperLeft, lowerRight, Selector.ALL); }
[ "@", "Override", "public", "MapReadResult", "readMapData", "(", "Tile", "upperLeft", ",", "Tile", "lowerRight", ")", "{", "return", "readMapData", "(", "upperLeft", ",", "lowerRight", ",", "Selector", ".", "ALL", ")", ";", "}" ]
Reads data for an area defined by the tile in the upper left and the tile in the lower right corner. Precondition: upperLeft.tileX <= lowerRight.tileX && upperLeft.tileY <= lowerRight.tileY @param upperLeft tile that defines the upper left corner of the requested area. @param lowerRight tile that defines the lower right corner of the requested area. @return map data for the tile.
[ "Reads", "data", "for", "an", "area", "defined", "by", "the", "tile", "in", "the", "upper", "left", "and", "the", "tile", "in", "the", "lower", "right", "corner", ".", "Precondition", ":", "upperLeft", ".", "tileX", "<", "=", "lowerRight", ".", "tileX", ...
train
https://github.com/mapsforge/mapsforge/blob/c49c83f7f727552f793dff15cefa532ade030842/mapsforge-map-reader/src/main/java/org/mapsforge/map/reader/MapFile.java#L876-L879
pgjdbc/pgjdbc
pgjdbc/src/main/java/org/postgresql/jdbc/TimestampUtils.java
TimestampUtils.timeToString
public String timeToString(java.util.Date time, boolean withTimeZone) { Calendar cal = null; if (withTimeZone) { cal = calendarWithUserTz; cal.setTimeZone(timeZoneProvider.get()); } if (time instanceof Timestamp) { return toString(cal, (Timestamp) time, withTimeZone); } if (time instanceof Time) { return toString(cal, (Time) time, withTimeZone); } return toString(cal, (Date) time, withTimeZone); }
java
public String timeToString(java.util.Date time, boolean withTimeZone) { Calendar cal = null; if (withTimeZone) { cal = calendarWithUserTz; cal.setTimeZone(timeZoneProvider.get()); } if (time instanceof Timestamp) { return toString(cal, (Timestamp) time, withTimeZone); } if (time instanceof Time) { return toString(cal, (Time) time, withTimeZone); } return toString(cal, (Date) time, withTimeZone); }
[ "public", "String", "timeToString", "(", "java", ".", "util", ".", "Date", "time", ",", "boolean", "withTimeZone", ")", "{", "Calendar", "cal", "=", "null", ";", "if", "(", "withTimeZone", ")", "{", "cal", "=", "calendarWithUserTz", ";", "cal", ".", "set...
Returns the given time value as String matching what the current postgresql server would send in text mode. @param time time value @param withTimeZone whether timezone should be added @return given time value as String
[ "Returns", "the", "given", "time", "value", "as", "String", "matching", "what", "the", "current", "postgresql", "server", "would", "send", "in", "text", "mode", "." ]
train
https://github.com/pgjdbc/pgjdbc/blob/95ba7b261e39754674c5817695ae5ebf9a341fae/pgjdbc/src/main/java/org/postgresql/jdbc/TimestampUtils.java#L1307-L1320
PeterisP/LVTagger
src/main/java/edu/stanford/nlp/ie/ner/CMMClassifier.java
CMMClassifier.getDataset
public Dataset<String, String> getDataset(Collection<List<IN>> data) { return getDataset(data, null, null); }
java
public Dataset<String, String> getDataset(Collection<List<IN>> data) { return getDataset(data, null, null); }
[ "public", "Dataset", "<", "String", ",", "String", ">", "getDataset", "(", "Collection", "<", "List", "<", "IN", ">", ">", "data", ")", "{", "return", "getDataset", "(", "data", ",", "null", ",", "null", ")", ";", "}" ]
Build a Dataset from some data. Used for training a classifier. @param data This variable is a list of lists of CoreLabel. That is, it is a collection of documents, each of which is represented as a sequence of CoreLabel objects. @return The Dataset which is an efficient encoding of the information in a List of Datums
[ "Build", "a", "Dataset", "from", "some", "data", ".", "Used", "for", "training", "a", "classifier", "." ]
train
https://github.com/PeterisP/LVTagger/blob/b3d44bab9ec07ace0d13612c448a6b7298c1f681/src/main/java/edu/stanford/nlp/ie/ner/CMMClassifier.java#L629-L631
code4everything/util
src/main/java/com/zhazhapan/util/dialog/Alerts.java
Alerts.showException
public static Optional<ButtonType> showException(String title, Exception e) { return showException(title, null, e); }
java
public static Optional<ButtonType> showException(String title, Exception e) { return showException(title, null, e); }
[ "public", "static", "Optional", "<", "ButtonType", ">", "showException", "(", "String", "title", ",", "Exception", "e", ")", "{", "return", "showException", "(", "title", ",", "null", ",", "e", ")", ";", "}" ]
弹出异常框 @param title 标题 @param e 异常 @return {@link ButtonType}
[ "弹出异常框" ]
train
https://github.com/code4everything/util/blob/1fc9f0ead1108f4d7208ba7c000df4244f708418/src/main/java/com/zhazhapan/util/dialog/Alerts.java#L132-L134
dita-ot/dita-ot
src/main/java/org/dita/dost/util/XMLUtils.java
XMLUtils.getCascadeValue
public static String getCascadeValue(final Element elem, final String attrName) { Element current = elem; while (current != null) { final Attr attr = current.getAttributeNode(attrName); if (attr != null) { return attr.getValue(); } final Node parent = current.getParentNode(); if (parent != null && parent.getNodeType() == Node.ELEMENT_NODE) { current = (Element) parent; } else { break; } } return null; }
java
public static String getCascadeValue(final Element elem, final String attrName) { Element current = elem; while (current != null) { final Attr attr = current.getAttributeNode(attrName); if (attr != null) { return attr.getValue(); } final Node parent = current.getParentNode(); if (parent != null && parent.getNodeType() == Node.ELEMENT_NODE) { current = (Element) parent; } else { break; } } return null; }
[ "public", "static", "String", "getCascadeValue", "(", "final", "Element", "elem", ",", "final", "String", "attrName", ")", "{", "Element", "current", "=", "elem", ";", "while", "(", "current", "!=", "null", ")", "{", "final", "Attr", "attr", "=", "current"...
Get cascaded attribute value. @param elem attribute parent element @param attrName attribute name @return attribute value, {@code null} if not set
[ "Get", "cascaded", "attribute", "value", "." ]
train
https://github.com/dita-ot/dita-ot/blob/ea776b3c60c03d9f033b6f7ea072349e49dbcdd2/src/main/java/org/dita/dost/util/XMLUtils.java#L1020-L1035
dwdyer/reportng
reportng/src/java/main/org/uncommons/reportng/HTMLReporter.java
HTMLReporter.createGroups
private void createGroups(List<ISuite> suites, File outputDirectory) throws Exception { int index = 1; for (ISuite suite : suites) { SortedMap<String, SortedSet<ITestNGMethod>> groups = sortGroups(suite.getMethodsByGroups()); if (!groups.isEmpty()) { VelocityContext context = createContext(); context.put(SUITE_KEY, suite); context.put(GROUPS_KEY, groups); String fileName = String.format("suite%d_%s", index, GROUPS_FILE); generateFile(new File(outputDirectory, fileName), GROUPS_FILE + TEMPLATE_EXTENSION, context); } ++index; } }
java
private void createGroups(List<ISuite> suites, File outputDirectory) throws Exception { int index = 1; for (ISuite suite : suites) { SortedMap<String, SortedSet<ITestNGMethod>> groups = sortGroups(suite.getMethodsByGroups()); if (!groups.isEmpty()) { VelocityContext context = createContext(); context.put(SUITE_KEY, suite); context.put(GROUPS_KEY, groups); String fileName = String.format("suite%d_%s", index, GROUPS_FILE); generateFile(new File(outputDirectory, fileName), GROUPS_FILE + TEMPLATE_EXTENSION, context); } ++index; } }
[ "private", "void", "createGroups", "(", "List", "<", "ISuite", ">", "suites", ",", "File", "outputDirectory", ")", "throws", "Exception", "{", "int", "index", "=", "1", ";", "for", "(", "ISuite", "suite", ":", "suites", ")", "{", "SortedMap", "<", "Strin...
Generate a groups list for each suite. @param outputDirectory The target directory for the generated file(s).
[ "Generate", "a", "groups", "list", "for", "each", "suite", "." ]
train
https://github.com/dwdyer/reportng/blob/df11f9cd9ab3fb5847fbba94ed3098ae0448f770/reportng/src/java/main/org/uncommons/reportng/HTMLReporter.java#L233-L252
alkacon/opencms-core
src-modules/org/opencms/workplace/tools/accounts/A_CmsUsersList.java
A_CmsUsersList.setUserData
protected void setUserData(CmsUser user, CmsListItem item) { item.set(LIST_COLUMN_LOGIN, user.getName()); item.set(LIST_COLUMN_DISPLAY, user.getSimpleName()); item.set(LIST_COLUMN_NAME, user.getFullName()); item.set(LIST_COLUMN_EMAIL, user.getEmail()); item.set(LIST_COLUMN_LASTLOGIN, new Date(user.getLastlogin())); item.set(LIST_COLUMN_ENABLED, new Boolean(user.isEnabled())); }
java
protected void setUserData(CmsUser user, CmsListItem item) { item.set(LIST_COLUMN_LOGIN, user.getName()); item.set(LIST_COLUMN_DISPLAY, user.getSimpleName()); item.set(LIST_COLUMN_NAME, user.getFullName()); item.set(LIST_COLUMN_EMAIL, user.getEmail()); item.set(LIST_COLUMN_LASTLOGIN, new Date(user.getLastlogin())); item.set(LIST_COLUMN_ENABLED, new Boolean(user.isEnabled())); }
[ "protected", "void", "setUserData", "(", "CmsUser", "user", ",", "CmsListItem", "item", ")", "{", "item", ".", "set", "(", "LIST_COLUMN_LOGIN", ",", "user", ".", "getName", "(", ")", ")", ";", "item", ".", "set", "(", "LIST_COLUMN_DISPLAY", ",", "user", ...
Sets all needed data of the user into the list item object.<p> @param user the user to set the data for @param item the list item object to set the data into
[ "Sets", "all", "needed", "data", "of", "the", "user", "into", "the", "list", "item", "object", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-modules/org/opencms/workplace/tools/accounts/A_CmsUsersList.java#L720-L728
camunda/camunda-bpm-platform
engine/src/main/java/org/camunda/bpm/engine/impl/persistence/entity/TaskEntity.java
TaskEntity.propertyChanged
protected void propertyChanged(String propertyName, Object orgValue, Object newValue) { if (propertyChanges.containsKey(propertyName)) { // update an existing change to save the original value Object oldOrgValue = propertyChanges.get(propertyName).getOrgValue(); if ((oldOrgValue == null && newValue == null) // change back to null || (oldOrgValue != null && oldOrgValue.equals(newValue))) { // remove this change propertyChanges.remove(propertyName); } else { propertyChanges.get(propertyName).setNewValue(newValue); } } else { // save this change if ((orgValue == null && newValue != null) // null to value || (orgValue != null && newValue == null) // value to null || (orgValue != null && !orgValue.equals(newValue))) // value change propertyChanges.put(propertyName, new PropertyChange(propertyName, orgValue, newValue)); } }
java
protected void propertyChanged(String propertyName, Object orgValue, Object newValue) { if (propertyChanges.containsKey(propertyName)) { // update an existing change to save the original value Object oldOrgValue = propertyChanges.get(propertyName).getOrgValue(); if ((oldOrgValue == null && newValue == null) // change back to null || (oldOrgValue != null && oldOrgValue.equals(newValue))) { // remove this change propertyChanges.remove(propertyName); } else { propertyChanges.get(propertyName).setNewValue(newValue); } } else { // save this change if ((orgValue == null && newValue != null) // null to value || (orgValue != null && newValue == null) // value to null || (orgValue != null && !orgValue.equals(newValue))) // value change propertyChanges.put(propertyName, new PropertyChange(propertyName, orgValue, newValue)); } }
[ "protected", "void", "propertyChanged", "(", "String", "propertyName", ",", "Object", "orgValue", ",", "Object", "newValue", ")", "{", "if", "(", "propertyChanges", ".", "containsKey", "(", "propertyName", ")", ")", "{", "// update an existing change to save the origi...
Tracks a property change. Therefore the original and new value are stored in a map. It tracks multiple changes and if a property finally is changed back to the original value, then the change is removed. @param propertyName @param orgValue @param newValue
[ "Tracks", "a", "property", "change", ".", "Therefore", "the", "original", "and", "new", "value", "are", "stored", "in", "a", "map", ".", "It", "tracks", "multiple", "changes", "and", "if", "a", "property", "finally", "is", "changed", "back", "to", "the", ...
train
https://github.com/camunda/camunda-bpm-platform/blob/1a464fc887ef3760e53d6f91b9e5b871a0d77cc0/engine/src/main/java/org/camunda/bpm/engine/impl/persistence/entity/TaskEntity.java#L995-L1010
lievendoclo/Valkyrie-RCP
valkyrie-rcp-core/src/main/java/org/valkyriercp/form/binding/swing/ShuttleListBinding.java
ShuttleListBinding.collectionsEqual
protected boolean collectionsEqual(Collection a1, Collection a2) { if (a1 != null && a2 != null && a1.size() == a2.size()) { // Loop over each element and compare them using our comparator Iterator iterA1 = a1.iterator(); Iterator iterA2 = a2.iterator(); while (iterA1.hasNext()) { if (!equalByComparator(iterA1.next(), iterA2.next())) { return false; } } } else if (a1 == null && a2 == null) { return true; } return false; }
java
protected boolean collectionsEqual(Collection a1, Collection a2) { if (a1 != null && a2 != null && a1.size() == a2.size()) { // Loop over each element and compare them using our comparator Iterator iterA1 = a1.iterator(); Iterator iterA2 = a2.iterator(); while (iterA1.hasNext()) { if (!equalByComparator(iterA1.next(), iterA2.next())) { return false; } } } else if (a1 == null && a2 == null) { return true; } return false; }
[ "protected", "boolean", "collectionsEqual", "(", "Collection", "a1", ",", "Collection", "a2", ")", "{", "if", "(", "a1", "!=", "null", "&&", "a2", "!=", "null", "&&", "a1", ".", "size", "(", ")", "==", "a2", ".", "size", "(", ")", ")", "{", "// Loo...
Compare two collections for equality using the configured comparator. Element order must be the same for the collections to compare equal. @param a1 First collection to compare @param a2 Second collection to compare @return boolean true if they are equal
[ "Compare", "two", "collections", "for", "equality", "using", "the", "configured", "comparator", ".", "Element", "order", "must", "be", "the", "same", "for", "the", "collections", "to", "compare", "equal", "." ]
train
https://github.com/lievendoclo/Valkyrie-RCP/blob/6aad6e640b348cda8f3b0841f6e42025233f1eb8/valkyrie-rcp-core/src/main/java/org/valkyriercp/form/binding/swing/ShuttleListBinding.java#L375-L390
jnidzwetzki/bitfinex-v2-wss-api-java
src/main/java/com/github/jnidzwetzki/bitfinex/v2/symbol/BitfinexSymbols.java
BitfinexSymbols.rawOrderBook
public static BitfinexOrderBookSymbol rawOrderBook(final BitfinexCurrencyPair currencyPair) { return new BitfinexOrderBookSymbol(currencyPair, BitfinexOrderBookSymbol.Precision.R0, null, null); }
java
public static BitfinexOrderBookSymbol rawOrderBook(final BitfinexCurrencyPair currencyPair) { return new BitfinexOrderBookSymbol(currencyPair, BitfinexOrderBookSymbol.Precision.R0, null, null); }
[ "public", "static", "BitfinexOrderBookSymbol", "rawOrderBook", "(", "final", "BitfinexCurrencyPair", "currencyPair", ")", "{", "return", "new", "BitfinexOrderBookSymbol", "(", "currencyPair", ",", "BitfinexOrderBookSymbol", ".", "Precision", ".", "R0", ",", "null", ",",...
returns symbol for raw order book channel @param currencyPair of raw order book channel @return symbol
[ "returns", "symbol", "for", "raw", "order", "book", "channel" ]
train
https://github.com/jnidzwetzki/bitfinex-v2-wss-api-java/blob/2e6adf1eb6f8cd4c8722f1619f78ab2cc3c600ee/src/main/java/com/github/jnidzwetzki/bitfinex/v2/symbol/BitfinexSymbols.java#L107-L109
OpenTSDB/opentsdb
src/tree/TreeBuilder.java
TreeBuilder.processSplit
private void processSplit(final String parsed_value) { if (splits == null) { // then this is the first time we're processing the value, so we need to // execute the split if there's a separator, after some validation if (parsed_value == null || parsed_value.isEmpty()) { throw new IllegalArgumentException("Value was empty for rule: " + rule); } if (rule.getSeparator() == null || rule.getSeparator().isEmpty()) { throw new IllegalArgumentException("Separator was empty for rule: " + rule); } // split it splits = parsed_value.split(rule.getSeparator()); if (splits.length < 1) { testMessage("Separator did not match, created an empty list on rule: " + rule); // set the index to 1 so the next time through it thinks we're done and // moves on to the next rule split_idx = 1; return; } split_idx = 0; setCurrentName(parsed_value, splits[split_idx]); split_idx++; } else { // otherwise we have split values and we just need to grab the next one setCurrentName(parsed_value, splits[split_idx]); split_idx++; } }
java
private void processSplit(final String parsed_value) { if (splits == null) { // then this is the first time we're processing the value, so we need to // execute the split if there's a separator, after some validation if (parsed_value == null || parsed_value.isEmpty()) { throw new IllegalArgumentException("Value was empty for rule: " + rule); } if (rule.getSeparator() == null || rule.getSeparator().isEmpty()) { throw new IllegalArgumentException("Separator was empty for rule: " + rule); } // split it splits = parsed_value.split(rule.getSeparator()); if (splits.length < 1) { testMessage("Separator did not match, created an empty list on rule: " + rule); // set the index to 1 so the next time through it thinks we're done and // moves on to the next rule split_idx = 1; return; } split_idx = 0; setCurrentName(parsed_value, splits[split_idx]); split_idx++; } else { // otherwise we have split values and we just need to grab the next one setCurrentName(parsed_value, splits[split_idx]); split_idx++; } }
[ "private", "void", "processSplit", "(", "final", "String", "parsed_value", ")", "{", "if", "(", "splits", "==", "null", ")", "{", "// then this is the first time we're processing the value, so we need to", "// execute the split if there's a separator, after some validation", "if"...
Performs a split operation on the parsed value using the character set in the rule's {@code separator} field. When splitting a value, the {@link #splits} and {@link #split_idx} fields are used to track state and determine where in the split we currently are. {@link #processRuleset} will handle incrementing the rule index after we have finished our split. If the split separator character wasn't found in the parsed string, then we just return the entire string and move on to the next rule. @param parsed_value The value parsed from the calling parser method @throws IllegalStateException if the value was empty or the separator was empty
[ "Performs", "a", "split", "operation", "on", "the", "parsed", "value", "using", "the", "character", "set", "in", "the", "rule", "s", "{" ]
train
https://github.com/OpenTSDB/opentsdb/blob/3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3/src/tree/TreeBuilder.java#L962-L993
Impetus/Kundera
src/jpa-engine/core/src/main/java/com/impetus/kundera/persistence/AbstractEntityReader.java
AbstractEntityReader.getId
protected Object getId(Object entity, EntityMetadata metadata) { try { return PropertyAccessorHelper.getId(entity, metadata); } catch (PropertyAccessException e) { log.error("Error while Getting ID for entity {}, Caused by: {}.", entity, e); throw new EntityReaderException("Error while Getting ID for entity " + entity, e); } }
java
protected Object getId(Object entity, EntityMetadata metadata) { try { return PropertyAccessorHelper.getId(entity, metadata); } catch (PropertyAccessException e) { log.error("Error while Getting ID for entity {}, Caused by: {}.", entity, e); throw new EntityReaderException("Error while Getting ID for entity " + entity, e); } }
[ "protected", "Object", "getId", "(", "Object", "entity", ",", "EntityMetadata", "metadata", ")", "{", "try", "{", "return", "PropertyAccessorHelper", ".", "getId", "(", "entity", ",", "metadata", ")", ";", "}", "catch", "(", "PropertyAccessException", "e", ")"...
Gets the id. @param entity the entity @param metadata the metadata @return the id
[ "Gets", "the", "id", "." ]
train
https://github.com/Impetus/Kundera/blob/268958ab1ec09d14ec4d9184f0c8ded7a9158908/src/jpa-engine/core/src/main/java/com/impetus/kundera/persistence/AbstractEntityReader.java#L626-L638
Cleveroad/LoopBar
LoopBar-widget/src/main/java/com/cleveroad/loopbar/widget/LoopBarView.java
LoopBarView.addItemDecoration
@SuppressWarnings("unused") public final void addItemDecoration(RecyclerView.ItemDecoration decor, int index) { getRvCategories().addItemDecoration(decor, index); }
java
@SuppressWarnings("unused") public final void addItemDecoration(RecyclerView.ItemDecoration decor, int index) { getRvCategories().addItemDecoration(decor, index); }
[ "@", "SuppressWarnings", "(", "\"unused\"", ")", "public", "final", "void", "addItemDecoration", "(", "RecyclerView", ".", "ItemDecoration", "decor", ",", "int", "index", ")", "{", "getRvCategories", "(", ")", ".", "addItemDecoration", "(", "decor", ",", "index"...
Add an {@link RecyclerView.ItemDecoration} to wrapped RecyclerView. Item decorations can affect both measurement and drawing of individual item views. <p> <p>Item decorations are ordered. Decorations placed earlier in the list will be run/queried/drawn first for their effects on item views. Padding added to views will be nested; a padding added by an earlier decoration will mean further item decorations in the list will be asked to draw/pad within the previous decoration's given area.</p> @param decor Decoration to add @param index Position in the decoration chain to insert this decoration at. If this value is negative the decoration will be added at the end.
[ "Add", "an", "{", "@link", "RecyclerView", ".", "ItemDecoration", "}", "to", "wrapped", "RecyclerView", ".", "Item", "decorations", "can", "affect", "both", "measurement", "and", "drawing", "of", "individual", "item", "views", ".", "<p", ">", "<p", ">", "Ite...
train
https://github.com/Cleveroad/LoopBar/blob/6ff5e0b35e637202202f9b4ca141195bdcfd5697/LoopBar-widget/src/main/java/com/cleveroad/loopbar/widget/LoopBarView.java#L565-L568
algolia/algoliasearch-client-java
src/main/java/com/algolia/search/saas/Index.java
Index.updateApiKey
public JSONObject updateApiKey(String key, List<String> acls) throws AlgoliaException { return updateApiKey(key, acls, 0, 0, 0); }
java
public JSONObject updateApiKey(String key, List<String> acls) throws AlgoliaException { return updateApiKey(key, acls, 0, 0, 0); }
[ "public", "JSONObject", "updateApiKey", "(", "String", "key", ",", "List", "<", "String", ">", "acls", ")", "throws", "AlgoliaException", "{", "return", "updateApiKey", "(", "key", ",", "acls", ",", "0", ",", "0", ",", "0", ")", ";", "}" ]
Update an api key @param acls the list of ACL for this key. Defined by an array of strings that can contains the following values: - search: allow to search (https and http) - addObject: allows to add/update an object in the index (https only) - deleteObject : allows to delete an existing object (https only) - deleteIndex : allows to delete index content (https only) - settings : allows to get index settings (https only) - editSettings : allows to change index settings (https only)
[ "Update", "an", "api", "key" ]
train
https://github.com/algolia/algoliasearch-client-java/blob/a05da2f66c099fe6f77295c7b6a8a12c24e95f9b/src/main/java/com/algolia/search/saas/Index.java#L1159-L1161
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/java/time/format/DecimalStyle.java
DecimalStyle.withPositiveSign
public DecimalStyle withPositiveSign(char positiveSign) { if (positiveSign == this.positiveSign) { return this; } return new DecimalStyle(zeroDigit, positiveSign, negativeSign, decimalSeparator); }
java
public DecimalStyle withPositiveSign(char positiveSign) { if (positiveSign == this.positiveSign) { return this; } return new DecimalStyle(zeroDigit, positiveSign, negativeSign, decimalSeparator); }
[ "public", "DecimalStyle", "withPositiveSign", "(", "char", "positiveSign", ")", "{", "if", "(", "positiveSign", "==", "this", ".", "positiveSign", ")", "{", "return", "this", ";", "}", "return", "new", "DecimalStyle", "(", "zeroDigit", ",", "positiveSign", ","...
Returns a copy of the info with a new character that represents the positive sign. <p> The character used to represent a positive number may vary by culture. This method specifies the character to use. @param positiveSign the character for the positive sign @return a copy with a new character that represents the positive sign, not null
[ "Returns", "a", "copy", "of", "the", "info", "with", "a", "new", "character", "that", "represents", "the", "positive", "sign", ".", "<p", ">", "The", "character", "used", "to", "represent", "a", "positive", "number", "may", "vary", "by", "culture", ".", ...
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/time/format/DecimalStyle.java#L245-L250
EdwardRaff/JSAT
JSAT/src/jsat/distributions/kernels/KernelPoints.java
KernelPoints.addNewKernelPoint
public void addNewKernelPoint() { KernelPoint source = points.get(0); KernelPoint toAdd = new KernelPoint(k, errorTolerance); toAdd.setMaxBudget(maxBudget); toAdd.setBudgetStrategy(budgetStrategy); standardMove(toAdd, source); toAdd.kernelAccel = source.kernelAccel; toAdd.vecs = source.vecs; toAdd.alpha = new DoubleList(source.alpha.size()); for (int i = 0; i < source.alpha.size(); i++) toAdd.alpha.add(0.0); points.add(toAdd); }
java
public void addNewKernelPoint() { KernelPoint source = points.get(0); KernelPoint toAdd = new KernelPoint(k, errorTolerance); toAdd.setMaxBudget(maxBudget); toAdd.setBudgetStrategy(budgetStrategy); standardMove(toAdd, source); toAdd.kernelAccel = source.kernelAccel; toAdd.vecs = source.vecs; toAdd.alpha = new DoubleList(source.alpha.size()); for (int i = 0; i < source.alpha.size(); i++) toAdd.alpha.add(0.0); points.add(toAdd); }
[ "public", "void", "addNewKernelPoint", "(", ")", "{", "KernelPoint", "source", "=", "points", ".", "get", "(", "0", ")", ";", "KernelPoint", "toAdd", "=", "new", "KernelPoint", "(", "k", ",", "errorTolerance", ")", ";", "toAdd", ".", "setMaxBudget", "(", ...
Adds a new Kernel Point to the internal list this object represents. The new Kernel Point will be equivalent to creating a new KernelPoint directly.
[ "Adds", "a", "new", "Kernel", "Point", "to", "the", "internal", "list", "this", "object", "represents", ".", "The", "new", "Kernel", "Point", "will", "be", "equivalent", "to", "creating", "a", "new", "KernelPoint", "directly", "." ]
train
https://github.com/EdwardRaff/JSAT/blob/0ff53b7b39684b2379cc1da522f5b3a954b15cfb/JSAT/src/jsat/distributions/kernels/KernelPoints.java#L579-L593
ThreeTen/threetenbp
src/main/java/org/threeten/bp/YearMonth.java
YearMonth.plusMonths
public YearMonth plusMonths(long monthsToAdd) { if (monthsToAdd == 0) { return this; } long monthCount = year * 12L + (month - 1); long calcMonths = monthCount + monthsToAdd; // safe overflow int newYear = YEAR.checkValidIntValue(Jdk8Methods.floorDiv(calcMonths, 12)); int newMonth = Jdk8Methods.floorMod(calcMonths, 12) + 1; return with(newYear, newMonth); }
java
public YearMonth plusMonths(long monthsToAdd) { if (monthsToAdd == 0) { return this; } long monthCount = year * 12L + (month - 1); long calcMonths = monthCount + monthsToAdd; // safe overflow int newYear = YEAR.checkValidIntValue(Jdk8Methods.floorDiv(calcMonths, 12)); int newMonth = Jdk8Methods.floorMod(calcMonths, 12) + 1; return with(newYear, newMonth); }
[ "public", "YearMonth", "plusMonths", "(", "long", "monthsToAdd", ")", "{", "if", "(", "monthsToAdd", "==", "0", ")", "{", "return", "this", ";", "}", "long", "monthCount", "=", "year", "*", "12L", "+", "(", "month", "-", "1", ")", ";", "long", "calcM...
Returns a copy of this year-month with the specified period in months added. <p> This instance is immutable and unaffected by this method call. @param monthsToAdd the months to add, may be negative @return a {@code YearMonth} based on this year-month with the months added, not null @throws DateTimeException if the result exceeds the supported range
[ "Returns", "a", "copy", "of", "this", "year", "-", "month", "with", "the", "specified", "period", "in", "months", "added", ".", "<p", ">", "This", "instance", "is", "immutable", "and", "unaffected", "by", "this", "method", "call", "." ]
train
https://github.com/ThreeTen/threetenbp/blob/5f05b649f89f205aabd96b2f83c36796ec616fe6/src/main/java/org/threeten/bp/YearMonth.java#L735-L744
cdk/cdk
base/standard/src/main/java/org/openscience/cdk/stereo/StereoTool.java
StereoTool.isTrigonalBipyramidal
public static boolean isTrigonalBipyramidal(IAtom atomA, IAtom atomB, IAtom atomC, IAtom atomD, IAtom atomE, IAtom atomF) { Point3d pointA = atomA.getPoint3d(); Point3d pointB = atomB.getPoint3d(); Point3d pointC = atomC.getPoint3d(); Point3d pointD = atomD.getPoint3d(); Point3d pointE = atomE.getPoint3d(); Point3d pointF = atomF.getPoint3d(); boolean isColinearABF = StereoTool.isColinear(pointA, pointB, pointF); if (isColinearABF) { // the normal to the equatorial plane Vector3d normal = StereoTool.getNormal(pointC, pointD, pointE); // get the side of the plane that axis point A is TetrahedralSign handednessCDEA = StereoTool.getHandedness(normal, pointC, pointF); // get the side of the plane that axis point F is TetrahedralSign handednessCDEF = StereoTool.getHandedness(normal, pointC, pointA); // in other words, the two axial points (A,F) are on opposite sides // of the equatorial plane CDE return handednessCDEA != handednessCDEF; } else { return false; } }
java
public static boolean isTrigonalBipyramidal(IAtom atomA, IAtom atomB, IAtom atomC, IAtom atomD, IAtom atomE, IAtom atomF) { Point3d pointA = atomA.getPoint3d(); Point3d pointB = atomB.getPoint3d(); Point3d pointC = atomC.getPoint3d(); Point3d pointD = atomD.getPoint3d(); Point3d pointE = atomE.getPoint3d(); Point3d pointF = atomF.getPoint3d(); boolean isColinearABF = StereoTool.isColinear(pointA, pointB, pointF); if (isColinearABF) { // the normal to the equatorial plane Vector3d normal = StereoTool.getNormal(pointC, pointD, pointE); // get the side of the plane that axis point A is TetrahedralSign handednessCDEA = StereoTool.getHandedness(normal, pointC, pointF); // get the side of the plane that axis point F is TetrahedralSign handednessCDEF = StereoTool.getHandedness(normal, pointC, pointA); // in other words, the two axial points (A,F) are on opposite sides // of the equatorial plane CDE return handednessCDEA != handednessCDEF; } else { return false; } }
[ "public", "static", "boolean", "isTrigonalBipyramidal", "(", "IAtom", "atomA", ",", "IAtom", "atomB", ",", "IAtom", "atomC", ",", "IAtom", "atomD", ",", "IAtom", "atomE", ",", "IAtom", "atomF", ")", "{", "Point3d", "pointA", "=", "atomA", ".", "getPoint3d", ...
Checks these 6 atoms to see if they form a trigonal-bipyramidal shape. @param atomA one of the axial atoms @param atomB the central atom @param atomC one of the equatorial atoms @param atomD one of the equatorial atoms @param atomE one of the equatorial atoms @param atomF the other axial atom @return true if the geometry is trigonal-bipyramidal
[ "Checks", "these", "6", "atoms", "to", "see", "if", "they", "form", "a", "trigonal", "-", "bipyramidal", "shape", "." ]
train
https://github.com/cdk/cdk/blob/c3d0f16502bf08df50365fee392e11d7c9856657/base/standard/src/main/java/org/openscience/cdk/stereo/StereoTool.java#L242-L268
ttddyy/datasource-proxy
src/main/java/net/ttddyy/dsproxy/listener/logging/DefaultJsonQueryLogEntryCreator.java
DefaultJsonQueryLogEntryCreator.writeParamsForSinglePreparedEntry
protected void writeParamsForSinglePreparedEntry(StringBuilder sb, SortedMap<String, String> paramMap, ExecutionInfo execInfo, List<QueryInfo> queryInfoList) { sb.append("["); for (Map.Entry<String, String> paramEntry : paramMap.entrySet()) { Object value = paramEntry.getValue(); if (value == null) { sb.append("null"); } else { sb.append("\""); sb.append(escapeSpecialCharacter(value.toString())); sb.append("\""); } sb.append(","); } chompIfEndWith(sb, ','); sb.append("],"); }
java
protected void writeParamsForSinglePreparedEntry(StringBuilder sb, SortedMap<String, String> paramMap, ExecutionInfo execInfo, List<QueryInfo> queryInfoList) { sb.append("["); for (Map.Entry<String, String> paramEntry : paramMap.entrySet()) { Object value = paramEntry.getValue(); if (value == null) { sb.append("null"); } else { sb.append("\""); sb.append(escapeSpecialCharacter(value.toString())); sb.append("\""); } sb.append(","); } chompIfEndWith(sb, ','); sb.append("],"); }
[ "protected", "void", "writeParamsForSinglePreparedEntry", "(", "StringBuilder", "sb", ",", "SortedMap", "<", "String", ",", "String", ">", "paramMap", ",", "ExecutionInfo", "execInfo", ",", "List", "<", "QueryInfo", ">", "queryInfoList", ")", "{", "sb", ".", "ap...
Write parameters for single execution as json. <p>default: ["foo","100"], @param sb StringBuilder to write @param paramMap sorted parameters map @param execInfo execution info @param queryInfoList query info list
[ "Write", "parameters", "for", "single", "execution", "as", "json", "." ]
train
https://github.com/ttddyy/datasource-proxy/blob/62163ccf9a569a99aa3ad9f9151a32567447a62e/src/main/java/net/ttddyy/dsproxy/listener/logging/DefaultJsonQueryLogEntryCreator.java#L248-L263
strator-dev/greenpepper
greenpepper-open/confluence/greenpepper-confluence-code/src/main/java/com/greenpepper/confluence/velocity/ConfluenceGreenPepper.java
ConfluenceGreenPepper.getPageProperty
public String getPageProperty(String key, String identifier) { Space space = getSpaceManager().getSpace(identifier); if (space == null) return null; ContentEntityObject entityObject = getContentEntityManager().getById(space.getHomePage().getId()); return getContentPropertyManager().getStringProperty(entityObject, ServerPropertiesManager.SEQUENCE + key); }
java
public String getPageProperty(String key, String identifier) { Space space = getSpaceManager().getSpace(identifier); if (space == null) return null; ContentEntityObject entityObject = getContentEntityManager().getById(space.getHomePage().getId()); return getContentPropertyManager().getStringProperty(entityObject, ServerPropertiesManager.SEQUENCE + key); }
[ "public", "String", "getPageProperty", "(", "String", "key", ",", "String", "identifier", ")", "{", "Space", "space", "=", "getSpaceManager", "(", ")", ".", "getSpace", "(", "identifier", ")", ";", "if", "(", "space", "==", "null", ")", "return", "null", ...
<p>getPageProperty.</p> @param key a {@link java.lang.String} object. @param identifier a {@link java.lang.String} object. @return a {@link java.lang.String} object.
[ "<p", ">", "getPageProperty", ".", "<", "/", "p", ">" ]
train
https://github.com/strator-dev/greenpepper/blob/2a61e6c179b74085babcc559d677490b0cad2d30/greenpepper-open/confluence/greenpepper-confluence-code/src/main/java/com/greenpepper/confluence/velocity/ConfluenceGreenPepper.java#L837-L844
intellimate/Izou
src/main/java/org/intellimate/izou/system/sound/replaced/MixerAspect.java
MixerAspect.getAndRegisterLine
static Line getAndRegisterLine(Line line) { AddOnModel addOnModel; Optional<AddOnModel> addOnModelForClassLoader = main.getSecurityManager().getAddOnModelForClassLoader(); if (!addOnModelForClassLoader.isPresent()) { logger.debug("the SoundManager will not manage this line, obtained by system"); return line; } else { addOnModel = addOnModelForClassLoader.get(); } IzouSoundLineBaseClass izouSoundLine; if (line instanceof SourceDataLine) { if (line instanceof Clip) { izouSoundLine = new IzouSoundLineClipAndSDLine((Clip) line, (SourceDataLine) line, main, false, addOnModel); } else { izouSoundLine = new IzouSoundSourceDataLine((SourceDataLine) line, main, false, addOnModel); } } else if (line instanceof Clip) { izouSoundLine = new IzouSoundLineClip((Clip) line, main, false, addOnModel); } else if (line instanceof DataLine) { izouSoundLine = new IzouSoundDataLine((DataLine) line, main, false, addOnModel); } else { izouSoundLine = new IzouSoundLineBaseClass(line, main, false, addOnModel); } main.getSoundManager().addIzouSoundLine(addOnModel, izouSoundLine); return izouSoundLine; }
java
static Line getAndRegisterLine(Line line) { AddOnModel addOnModel; Optional<AddOnModel> addOnModelForClassLoader = main.getSecurityManager().getAddOnModelForClassLoader(); if (!addOnModelForClassLoader.isPresent()) { logger.debug("the SoundManager will not manage this line, obtained by system"); return line; } else { addOnModel = addOnModelForClassLoader.get(); } IzouSoundLineBaseClass izouSoundLine; if (line instanceof SourceDataLine) { if (line instanceof Clip) { izouSoundLine = new IzouSoundLineClipAndSDLine((Clip) line, (SourceDataLine) line, main, false, addOnModel); } else { izouSoundLine = new IzouSoundSourceDataLine((SourceDataLine) line, main, false, addOnModel); } } else if (line instanceof Clip) { izouSoundLine = new IzouSoundLineClip((Clip) line, main, false, addOnModel); } else if (line instanceof DataLine) { izouSoundLine = new IzouSoundDataLine((DataLine) line, main, false, addOnModel); } else { izouSoundLine = new IzouSoundLineBaseClass(line, main, false, addOnModel); } main.getSoundManager().addIzouSoundLine(addOnModel, izouSoundLine); return izouSoundLine; }
[ "static", "Line", "getAndRegisterLine", "(", "Line", "line", ")", "{", "AddOnModel", "addOnModel", ";", "Optional", "<", "AddOnModel", ">", "addOnModelForClassLoader", "=", "main", ".", "getSecurityManager", "(", ")", ".", "getAddOnModelForClassLoader", "(", ")", ...
creates the appropriate IzouSoundLine if the request originates from an AddOn. @param line the line @return an IzouSoundLine if an addon requested the line
[ "creates", "the", "appropriate", "IzouSoundLine", "if", "the", "request", "originates", "from", "an", "AddOn", "." ]
train
https://github.com/intellimate/Izou/blob/40a808b97998e17655c4a78e30ce7326148aed27/src/main/java/org/intellimate/izou/system/sound/replaced/MixerAspect.java#L37-L63
alkacon/opencms-core
src-gwt/org/opencms/ade/sitemap/client/hoverbar/CmsCreateCategoryMenuEntry.java
CmsCreateCategoryMenuEntry.createBasicStringProperty
public static CmsXmlContentProperty createBasicStringProperty(String name, String niceName) { CmsXmlContentProperty prop = new CmsXmlContentProperty(name, //name "string", // type "string", // widget "", // widgetconfig null, //regex null, //ruletype null, //default niceName, //nicename null, //description null, //error null //preferfolder ); return prop; }
java
public static CmsXmlContentProperty createBasicStringProperty(String name, String niceName) { CmsXmlContentProperty prop = new CmsXmlContentProperty(name, //name "string", // type "string", // widget "", // widgetconfig null, //regex null, //ruletype null, //default niceName, //nicename null, //description null, //error null //preferfolder ); return prop; }
[ "public", "static", "CmsXmlContentProperty", "createBasicStringProperty", "(", "String", "name", ",", "String", "niceName", ")", "{", "CmsXmlContentProperty", "prop", "=", "new", "CmsXmlContentProperty", "(", "name", ",", "//name", "\"string\"", ",", "// type", "\"str...
Creates a property configuration for a simple named string field.<p> @param name the name of the field @param niceName the display name of the field @return the property configuration
[ "Creates", "a", "property", "configuration", "for", "a", "simple", "named", "string", "field", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/ade/sitemap/client/hoverbar/CmsCreateCategoryMenuEntry.java#L160-L175
attribyte/wpdb
src/main/java/org/attribyte/wp/db/DB.java
DB.updatePostGuid
public boolean updatePostGuid(long postId, final String guid) throws SQLException { Connection conn = null; PreparedStatement stmt = null; Timer.Context ctx = metrics.updatePostTimer.time(); try { conn = connectionSupplier.getConnection(); stmt = conn.prepareStatement(updatePostGuidSQL); stmt.setString(1, guid); stmt.setLong(2, postId); return stmt.executeUpdate() > 0; } finally { ctx.stop(); SQLUtil.closeQuietly(conn, stmt); } }
java
public boolean updatePostGuid(long postId, final String guid) throws SQLException { Connection conn = null; PreparedStatement stmt = null; Timer.Context ctx = metrics.updatePostTimer.time(); try { conn = connectionSupplier.getConnection(); stmt = conn.prepareStatement(updatePostGuidSQL); stmt.setString(1, guid); stmt.setLong(2, postId); return stmt.executeUpdate() > 0; } finally { ctx.stop(); SQLUtil.closeQuietly(conn, stmt); } }
[ "public", "boolean", "updatePostGuid", "(", "long", "postId", ",", "final", "String", "guid", ")", "throws", "SQLException", "{", "Connection", "conn", "=", "null", ";", "PreparedStatement", "stmt", "=", "null", ";", "Timer", ".", "Context", "ctx", "=", "met...
Updates the guid for a post. @param postId The post to update. @param guid The new guid. @return Was the post modified? @throws SQLException on database error or missing post id.
[ "Updates", "the", "guid", "for", "a", "post", "." ]
train
https://github.com/attribyte/wpdb/blob/b9adf6131dfb67899ebff770c9bfeb001cc42f30/src/main/java/org/attribyte/wp/db/DB.java#L1600-L1614
landawn/AbacusUtil
src/com/landawn/abacus/util/f.java
f.flattOp
public static <T, E extends Exception> void flattOp(final T[][] a, Try.Consumer<T[], E> op) throws E { if (N.isNullOrEmpty(a)) { return; } final T[] tmp = flattenn(a); op.accept(tmp); int idx = 0; for (T[] e : a) { if (N.notNullOrEmpty(e)) { N.copy(tmp, idx, e, 0, e.length); idx += e.length; } } }
java
public static <T, E extends Exception> void flattOp(final T[][] a, Try.Consumer<T[], E> op) throws E { if (N.isNullOrEmpty(a)) { return; } final T[] tmp = flattenn(a); op.accept(tmp); int idx = 0; for (T[] e : a) { if (N.notNullOrEmpty(e)) { N.copy(tmp, idx, e, 0, e.length); idx += e.length; } } }
[ "public", "static", "<", "T", ",", "E", "extends", "Exception", ">", "void", "flattOp", "(", "final", "T", "[", "]", "[", "]", "a", ",", "Try", ".", "Consumer", "<", "T", "[", "]", ",", "E", ">", "op", ")", "throws", "E", "{", "if", "(", "N",...
flatten -> execute {@code op} -> set values back. <pre> <code> f.flattOp(a, t -> N.sort(t)); </code> </pre> @param a @param op @throws E
[ "flatten", "-", ">", "execute", "{", "@code", "op", "}", "-", ">", "set", "values", "back", ".", "<pre", ">", "<code", ">", "f", ".", "flattOp", "(", "a", "t", "-", ">", "N", ".", "sort", "(", "t", "))", ";", "<", "/", "code", ">", "<", "/"...
train
https://github.com/landawn/AbacusUtil/blob/544b7720175d15e9329f83dd22a8cc5fa4515e12/src/com/landawn/abacus/util/f.java#L210-L227
google/error-prone-javac
src/jdk.compiler/share/classes/com/sun/source/util/DocTreeScanner.java
DocTreeScanner.visitVersion
@Override public R visitVersion(VersionTree node, P p) { return scan(node.getBody(), p); }
java
@Override public R visitVersion(VersionTree node, P p) { return scan(node.getBody(), p); }
[ "@", "Override", "public", "R", "visitVersion", "(", "VersionTree", "node", ",", "P", "p", ")", "{", "return", "scan", "(", "node", ".", "getBody", "(", ")", ",", "p", ")", ";", "}" ]
{@inheritDoc} This implementation scans the children in left to right order. @param node {@inheritDoc} @param p {@inheritDoc} @return the result of scanning
[ "{", "@inheritDoc", "}", "This", "implementation", "scans", "the", "children", "in", "left", "to", "right", "order", "." ]
train
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/source/util/DocTreeScanner.java#L523-L526
unbescape/unbescape
src/main/java/org/unbescape/uri/UriEscape.java
UriEscape.escapeUriQueryParam
public static void escapeUriQueryParam(final char[] text, final int offset, final int len, final Writer writer) throws IOException { escapeUriQueryParam(text, offset, len, writer, DEFAULT_ENCODING); }
java
public static void escapeUriQueryParam(final char[] text, final int offset, final int len, final Writer writer) throws IOException { escapeUriQueryParam(text, offset, len, writer, DEFAULT_ENCODING); }
[ "public", "static", "void", "escapeUriQueryParam", "(", "final", "char", "[", "]", "text", ",", "final", "int", "offset", ",", "final", "int", "len", ",", "final", "Writer", "writer", ")", "throws", "IOException", "{", "escapeUriQueryParam", "(", "text", ","...
<p> Perform am URI query parameter (name or value) <strong>escape</strong> operation on a <tt>char[]</tt> input using <tt>UTF-8</tt> as encoding. </p> <p> The following are the only allowed chars in an URI query parameter (will not be escaped): </p> <ul> <li><tt>A-Z a-z 0-9</tt></li> <li><tt>- . _ ~</tt></li> <li><tt>! $ ' ( ) * , ;</tt></li> <li><tt>: @</tt></li> <li><tt>/ ?</tt></li> </ul> <p> All other chars will be escaped by converting them to the sequence of bytes that represents them in the <tt>UTF-8</tt> and then representing each byte in <tt>%HH</tt> syntax, being <tt>HH</tt> the hexadecimal representation of the byte. </p> <p> This method is <strong>thread-safe</strong>. </p> @param text the <tt>char[]</tt> to be escaped. @param offset the position in <tt>text</tt> at which the escape operation should start. @param len the number of characters in <tt>text</tt> that should be escaped. @param writer the <tt>java.io.Writer</tt> to which the escaped result will be written. Nothing will be written at all to this writer if input is <tt>null</tt>. @throws IOException if an input/output exception occurs
[ "<p", ">", "Perform", "am", "URI", "query", "parameter", "(", "name", "or", "value", ")", "<strong", ">", "escape<", "/", "strong", ">", "operation", "on", "a", "<tt", ">", "char", "[]", "<", "/", "tt", ">", "input", "using", "<tt", ">", "UTF", "-"...
train
https://github.com/unbescape/unbescape/blob/ec5435fb3508c2eed25d8165dc27ded2602cae13/src/main/java/org/unbescape/uri/UriEscape.java#L1338-L1341
molgenis/molgenis
molgenis-dataexplorer/src/main/java/org/molgenis/dataexplorer/controller/DataExplorerController.java
DataExplorerController.getModules
@GetMapping("/modules") @ResponseBody public ModulesConfigResponse getModules(@RequestParam("entity") String entityTypeId) { EntityType entityType = dataService.getEntityType(entityTypeId); List<Module> modules = dataExplorerService.getModules(entityType); ModulesConfigResponse modulesConfigResponse = new ModulesConfigResponse(); modules.forEach( module -> { String id; String label; String icon; switch (module) { case DATA: id = MOD_DATA; label = "Data"; icon = "grid-icon.png"; break; case AGGREGATION: id = "aggregates"; label = messageSource.getMessage( "dataexplorer_aggregates_title", new Object[] {}, getLocale()); icon = "aggregate-icon.png"; break; case REPORT: id = MOD_ENTITIESREPORT; label = dataExplorerSettings.getEntityReport(entityTypeId); icon = "report-icon.png"; break; default: throw new UnexpectedEnumException(module); } modulesConfigResponse.add(new ModuleConfig(id, label, icon)); }
java
@GetMapping("/modules") @ResponseBody public ModulesConfigResponse getModules(@RequestParam("entity") String entityTypeId) { EntityType entityType = dataService.getEntityType(entityTypeId); List<Module> modules = dataExplorerService.getModules(entityType); ModulesConfigResponse modulesConfigResponse = new ModulesConfigResponse(); modules.forEach( module -> { String id; String label; String icon; switch (module) { case DATA: id = MOD_DATA; label = "Data"; icon = "grid-icon.png"; break; case AGGREGATION: id = "aggregates"; label = messageSource.getMessage( "dataexplorer_aggregates_title", new Object[] {}, getLocale()); icon = "aggregate-icon.png"; break; case REPORT: id = MOD_ENTITIESREPORT; label = dataExplorerSettings.getEntityReport(entityTypeId); icon = "report-icon.png"; break; default: throw new UnexpectedEnumException(module); } modulesConfigResponse.add(new ModuleConfig(id, label, icon)); }
[ "@", "GetMapping", "(", "\"/modules\"", ")", "@", "ResponseBody", "public", "ModulesConfigResponse", "getModules", "(", "@", "RequestParam", "(", "\"entity\"", ")", "String", "entityTypeId", ")", "{", "EntityType", "entityType", "=", "dataService", ".", "getEntityTy...
Returns modules configuration for this entity based on current user permissions.
[ "Returns", "modules", "configuration", "for", "this", "entity", "based", "on", "current", "user", "permissions", "." ]
train
https://github.com/molgenis/molgenis/blob/b4d0d6b27e6f6c8d7505a3863dc03b589601f987/molgenis-dataexplorer/src/main/java/org/molgenis/dataexplorer/controller/DataExplorerController.java#L238-L274
google/closure-compiler
src/com/google/javascript/rhino/jstype/JSTypeRegistry.java
JSTypeRegistry.declareTypeForExactScope
public boolean declareTypeForExactScope(StaticScope scope, String name, JSType type) { checkState(!name.isEmpty()); if (getTypeForScopeInternal(scope, name) != null) { return false; } registerForScope(scope, type, name); return true; }
java
public boolean declareTypeForExactScope(StaticScope scope, String name, JSType type) { checkState(!name.isEmpty()); if (getTypeForScopeInternal(scope, name) != null) { return false; } registerForScope(scope, type, name); return true; }
[ "public", "boolean", "declareTypeForExactScope", "(", "StaticScope", "scope", ",", "String", "name", ",", "JSType", "type", ")", "{", "checkState", "(", "!", "name", ".", "isEmpty", "(", ")", ")", ";", "if", "(", "getTypeForScopeInternal", "(", "scope", ",",...
Records declared global type names. This makes resolution faster and more robust in the common case. @param name The name of the type to be recorded. @param type The actual type being associated with the name. @return True if this name is not already defined, false otherwise.
[ "Records", "declared", "global", "type", "names", ".", "This", "makes", "resolution", "faster", "and", "more", "robust", "in", "the", "common", "case", "." ]
train
https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/rhino/jstype/JSTypeRegistry.java#L1157-L1165
jbundle/jbundle
base/base/src/main/java/org/jbundle/base/field/event/CopyDataHandler.java
CopyDataHandler.init
public void init(BaseField field, BaseField fldDest, Object objValue, Converter convCheckMark) { super.init(field, fldDest, convCheckMark, null); m_bClearIfThisNull = false; // Must be for this to work this.setRespondsToMode(DBConstants.READ_MOVE, false); // Usually, you only want to move a string on screen change this.setRespondsToMode(DBConstants.INIT_MOVE, false); // Usually, you only want to move a string on screen change m_objValue = objValue; }
java
public void init(BaseField field, BaseField fldDest, Object objValue, Converter convCheckMark) { super.init(field, fldDest, convCheckMark, null); m_bClearIfThisNull = false; // Must be for this to work this.setRespondsToMode(DBConstants.READ_MOVE, false); // Usually, you only want to move a string on screen change this.setRespondsToMode(DBConstants.INIT_MOVE, false); // Usually, you only want to move a string on screen change m_objValue = objValue; }
[ "public", "void", "init", "(", "BaseField", "field", ",", "BaseField", "fldDest", ",", "Object", "objValue", ",", "Converter", "convCheckMark", ")", "{", "super", ".", "init", "(", "field", ",", "fldDest", ",", "convCheckMark", ",", "null", ")", ";", "m_bC...
Constructor. @param field The basefield owner of this listener (usually null and set on setOwner()). @param fldDest The destination field. @param stringValue The string to set the destination field to. @param convconvCheckMark If this evaluates to false, don't do the move.
[ "Constructor", "." ]
train
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/field/event/CopyDataHandler.java#L56-L63
voldemort/voldemort
src/java/voldemort/tools/admin/command/AdminCommandDebug.java
AdminCommandDebug.executeHelp
public static void executeHelp(String[] args, PrintStream stream) throws Exception { String subCmd = (args.length > 0) ? args[0] : ""; if(subCmd.equals("query-keys")) { SubCommandDebugQueryKeys.printHelp(stream); } else if(subCmd.equals("route")) { SubCommandDebugRoute.printHelp(stream); } else { printHelp(stream); } }
java
public static void executeHelp(String[] args, PrintStream stream) throws Exception { String subCmd = (args.length > 0) ? args[0] : ""; if(subCmd.equals("query-keys")) { SubCommandDebugQueryKeys.printHelp(stream); } else if(subCmd.equals("route")) { SubCommandDebugRoute.printHelp(stream); } else { printHelp(stream); } }
[ "public", "static", "void", "executeHelp", "(", "String", "[", "]", "args", ",", "PrintStream", "stream", ")", "throws", "Exception", "{", "String", "subCmd", "=", "(", "args", ".", "length", ">", "0", ")", "?", "args", "[", "0", "]", ":", "\"\"", ";...
Parses command-line input and prints help menu. @throws Exception
[ "Parses", "command", "-", "line", "input", "and", "prints", "help", "menu", "." ]
train
https://github.com/voldemort/voldemort/blob/a7dbdea58032021361680faacf2782cf981c5332/src/java/voldemort/tools/admin/command/AdminCommandDebug.java#L118-L127
querydsl/querydsl
querydsl-core/src/main/java/com/querydsl/core/types/dsl/Expressions.java
Expressions.booleanTemplate
public static BooleanTemplate booleanTemplate(Template template, List<?> args) { return new BooleanTemplate(template, ImmutableList.copyOf(args)); }
java
public static BooleanTemplate booleanTemplate(Template template, List<?> args) { return new BooleanTemplate(template, ImmutableList.copyOf(args)); }
[ "public", "static", "BooleanTemplate", "booleanTemplate", "(", "Template", "template", ",", "List", "<", "?", ">", "args", ")", "{", "return", "new", "BooleanTemplate", "(", "template", ",", "ImmutableList", ".", "copyOf", "(", "args", ")", ")", ";", "}" ]
Create a new Template expression @param template template @param args template parameters @return template expression
[ "Create", "a", "new", "Template", "expression" ]
train
https://github.com/querydsl/querydsl/blob/2bf234caf78549813a1e0f44d9c30ecc5ef734e3/querydsl-core/src/main/java/com/querydsl/core/types/dsl/Expressions.java#L1021-L1023
google/error-prone-javac
src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/AnnotationTypeBuilder.java
AnnotationTypeBuilder.buildAnnotationTypeOptionalMemberDetails
public void buildAnnotationTypeOptionalMemberDetails(XMLNode node, Content memberDetailsTree) throws DocletException { configuration.getBuilderFactory(). getAnnotationTypeOptionalMemberBuilder(writer).buildChildren(node, memberDetailsTree); }
java
public void buildAnnotationTypeOptionalMemberDetails(XMLNode node, Content memberDetailsTree) throws DocletException { configuration.getBuilderFactory(). getAnnotationTypeOptionalMemberBuilder(writer).buildChildren(node, memberDetailsTree); }
[ "public", "void", "buildAnnotationTypeOptionalMemberDetails", "(", "XMLNode", "node", ",", "Content", "memberDetailsTree", ")", "throws", "DocletException", "{", "configuration", ".", "getBuilderFactory", "(", ")", ".", "getAnnotationTypeOptionalMemberBuilder", "(", "writer...
Build the annotation type optional member documentation. @param node the XML element that specifies which components to document @param memberDetailsTree the content tree to which the documentation will be added @throws DocletException if there is a problem building the documentation
[ "Build", "the", "annotation", "type", "optional", "member", "documentation", "." ]
train
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/AnnotationTypeBuilder.java#L255-L259
jcuda/jcuda
JCudaJava/src/main/java/jcuda/driver/JCudaDriver.java
JCudaDriver.cuGraphGetNodes
public static int cuGraphGetNodes(CUgraph hGraph, CUgraphNode nodes[], long numNodes[]) { return checkResult(cuGraphGetNodesNative(hGraph, nodes, numNodes)); }
java
public static int cuGraphGetNodes(CUgraph hGraph, CUgraphNode nodes[], long numNodes[]) { return checkResult(cuGraphGetNodesNative(hGraph, nodes, numNodes)); }
[ "public", "static", "int", "cuGraphGetNodes", "(", "CUgraph", "hGraph", ",", "CUgraphNode", "nodes", "[", "]", ",", "long", "numNodes", "[", "]", ")", "{", "return", "checkResult", "(", "cuGraphGetNodesNative", "(", "hGraph", ",", "nodes", ",", "numNodes", "...
Returns a graph's nodes.<br> <br> Returns a list of \p hGraph's nodes. \p nodes may be NULL, in which case this function will return the number of nodes in \p numNodes. Otherwise, \p numNodes entries will be filled in. If \p numNodes is higher than the actual number of nodes, the remaining entries in \p nodes will be set to NULL, and the number of nodes actually obtained will be returned in \p numNodes. @param hGraph - Graph to query @param nodes - Pointer to return the nodes @param numNodes - See description @return CUDA_SUCCESS, CUDA_ERROR_DEINITIALIZED, CUDA_ERROR_NOT_INITIALIZED, CUDA_ERROR_INVALID_VALUE @see JCudaDriver#cuGraphCreate JCudaDriver#cuGraphGetRootNodes JCudaDriver#cuGraphGetEdges JCudaDriver#cuGraphNodeGetType JCudaDriver#cuGraphNodeGetDependencies JCudaDriver#cuGraphNodeGetDependentNodes
[ "Returns", "a", "graph", "s", "nodes", ".", "<br", ">", "<br", ">", "Returns", "a", "list", "of", "\\", "p", "hGraph", "s", "nodes", ".", "\\", "p", "nodes", "may", "be", "NULL", "in", "which", "case", "this", "function", "will", "return", "the", "...
train
https://github.com/jcuda/jcuda/blob/468528b5b9b37dfceb6ed83fcfd889e9b359f984/JCudaJava/src/main/java/jcuda/driver/JCudaDriver.java#L12676-L12679
UrielCh/ovh-java-sdk
ovh-java-sdk-me/src/main/java/net/minidev/ovh/api/ApiOvhMe.java
ApiOvhMe.payment_thod_GET
public ArrayList<Long> payment_thod_GET(String paymentType, OvhStatus status) throws IOException { String qPath = "/me/payment/method"; StringBuilder sb = path(qPath); query(sb, "paymentType", paymentType); query(sb, "status", status); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, t2); }
java
public ArrayList<Long> payment_thod_GET(String paymentType, OvhStatus status) throws IOException { String qPath = "/me/payment/method"; StringBuilder sb = path(qPath); query(sb, "paymentType", paymentType); query(sb, "status", status); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, t2); }
[ "public", "ArrayList", "<", "Long", ">", "payment_thod_GET", "(", "String", "paymentType", ",", "OvhStatus", "status", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/me/payment/method\"", ";", "StringBuilder", "sb", "=", "path", "(", "qPath", ")"...
Retrieve payment method ID list REST: GET /me/payment/method @param status [required] Status @param paymentType [required] Payment method type API beta
[ "Retrieve", "payment", "method", "ID", "list" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-me/src/main/java/net/minidev/ovh/api/ApiOvhMe.java#L1011-L1018
RestComm/media-core
rtp/src/main/java/org/restcomm/media/core/rtp/channels/MediaChannel.java
MediaChannel.bindRtcp
public void bindRtcp(boolean isLocal, int port) throws IOException, IllegalStateException { if(this.ice) { throw new IllegalStateException("Cannot bind when ICE is enabled"); } this.rtcpChannel.bind(isLocal, port); this.rtcpMux = (port == this.rtpChannel.getLocalPort()); }
java
public void bindRtcp(boolean isLocal, int port) throws IOException, IllegalStateException { if(this.ice) { throw new IllegalStateException("Cannot bind when ICE is enabled"); } this.rtcpChannel.bind(isLocal, port); this.rtcpMux = (port == this.rtpChannel.getLocalPort()); }
[ "public", "void", "bindRtcp", "(", "boolean", "isLocal", ",", "int", "port", ")", "throws", "IOException", ",", "IllegalStateException", "{", "if", "(", "this", ".", "ice", ")", "{", "throw", "new", "IllegalStateException", "(", "\"Cannot bind when ICE is enabled\...
Binds the RTCP component to a suitable address and port. @param isLocal Whether the binding address must be in local range. @param port A specific port to bind to @throws IOException When the RTCP component cannot be bound to an address. @throws IllegalStateException The binding operation is not allowed if ICE is active
[ "Binds", "the", "RTCP", "component", "to", "a", "suitable", "address", "and", "port", "." ]
train
https://github.com/RestComm/media-core/blob/07b8703343708599f60af66bae62aded77ee81b5/rtp/src/main/java/org/restcomm/media/core/rtp/channels/MediaChannel.java#L522-L528
Wolfgang-Schuetzelhofer/jcypher
src/main/java/iot/jcypher/domainquery/AbstractDomainQuery.java
AbstractDomainQuery.WHERE
public BooleanOperation WHERE(IPredicateOperand1 value) { IPredicateOperand1 pVal = value; if (value instanceof DomainObjectMatch<?>) { DomainObjectMatch<?> delegate = APIAccess.getDelegate((DomainObjectMatch<?>) value); if (delegate != null) // generic model pVal = delegate; } PredicateExpression pe = new PredicateExpression(pVal, this.astObjectsContainer); this.astObjectsContainer.addAstObject(pe); BooleanOperation ret = APIAccess.createBooleanOperation(pe); QueryRecorder.recordInvocation(this, "WHERE", ret, QueryRecorder.placeHolder(pVal)); return ret; }
java
public BooleanOperation WHERE(IPredicateOperand1 value) { IPredicateOperand1 pVal = value; if (value instanceof DomainObjectMatch<?>) { DomainObjectMatch<?> delegate = APIAccess.getDelegate((DomainObjectMatch<?>) value); if (delegate != null) // generic model pVal = delegate; } PredicateExpression pe = new PredicateExpression(pVal, this.astObjectsContainer); this.astObjectsContainer.addAstObject(pe); BooleanOperation ret = APIAccess.createBooleanOperation(pe); QueryRecorder.recordInvocation(this, "WHERE", ret, QueryRecorder.placeHolder(pVal)); return ret; }
[ "public", "BooleanOperation", "WHERE", "(", "IPredicateOperand1", "value", ")", "{", "IPredicateOperand1", "pVal", "=", "value", ";", "if", "(", "value", "instanceof", "DomainObjectMatch", "<", "?", ">", ")", "{", "DomainObjectMatch", "<", "?", ">", "delegate", ...
Start formulating a predicate expression. A predicate expression yields a boolean value. <br/>Takes an expression like 'person.stringAttribute("name")', yielding an attribute, <br/>e.g. WHERE(person.stringAttribute("name")).EQUALS(...) @param value the value(expression) to formulate the predicate expression upon. @return
[ "Start", "formulating", "a", "predicate", "expression", ".", "A", "predicate", "expression", "yields", "a", "boolean", "value", ".", "<br", "/", ">", "Takes", "an", "expression", "like", "person", ".", "stringAttribute", "(", "name", ")", "yielding", "an", "...
train
https://github.com/Wolfgang-Schuetzelhofer/jcypher/blob/0f36914b4d6993a004cc235bb18dd3e02a59d253/src/main/java/iot/jcypher/domainquery/AbstractDomainQuery.java#L216-L228
jingwei/krati
krati-main/src/main/java/krati/core/array/basic/ArrayFile.java
ArrayFile.resetAll
public synchronized void resetAll(long value, long maxScn) throws IOException { resetAll(value); _log.info("update hwmScn and lwmScn:" + maxScn); writeHwmScn(maxScn); writeLwmScn(maxScn); flush(); }
java
public synchronized void resetAll(long value, long maxScn) throws IOException { resetAll(value); _log.info("update hwmScn and lwmScn:" + maxScn); writeHwmScn(maxScn); writeLwmScn(maxScn); flush(); }
[ "public", "synchronized", "void", "resetAll", "(", "long", "value", ",", "long", "maxScn", ")", "throws", "IOException", "{", "resetAll", "(", "value", ")", ";", "_log", ".", "info", "(", "\"update hwmScn and lwmScn:\"", "+", "maxScn", ")", ";", "writeHwmScn",...
Resets all element values to the specified long value the max SCN (System Change Number).. @param value - the element value. @param maxScn - the system change number for the low and high water marks. @throws IOException
[ "Resets", "all", "element", "values", "to", "the", "specified", "long", "value", "the", "max", "SCN", "(", "System", "Change", "Number", ")", ".." ]
train
https://github.com/jingwei/krati/blob/1ca0f994a7b0c8215b827eac9aaf95789ec08d21/krati-main/src/main/java/krati/core/array/basic/ArrayFile.java#L840-L847
m-m-m/util
version/src/main/java/net/sf/mmm/util/version/impl/VersionIdentifierFormatterVersionSegments.java
VersionIdentifierFormatterVersionSegments.doFormatSegment
protected CharSequence doFormatSegment(VersionIdentifier value, int index) { int segment = value.getVersionSegment(index); return AbstractVersionIdentifierFormatterNumber.padNumber(segment, this.segmentPadding, 10); }
java
protected CharSequence doFormatSegment(VersionIdentifier value, int index) { int segment = value.getVersionSegment(index); return AbstractVersionIdentifierFormatterNumber.padNumber(segment, this.segmentPadding, 10); }
[ "protected", "CharSequence", "doFormatSegment", "(", "VersionIdentifier", "value", ",", "int", "index", ")", "{", "int", "segment", "=", "value", ".", "getVersionSegment", "(", "index", ")", ";", "return", "AbstractVersionIdentifierFormatterNumber", ".", "padNumber", ...
This method formats the {@link VersionIdentifier#getVersionSegment(int) segment} at the given {@code index}. @param value is the {@link VersionIdentifier}. @param index is the index of the {@link VersionIdentifier#getVersionSegment(int) segment} to format. @return the formatted segment.
[ "This", "method", "formats", "the", "{", "@link", "VersionIdentifier#getVersionSegment", "(", "int", ")", "segment", "}", "at", "the", "given", "{", "@code", "index", "}", "." ]
train
https://github.com/m-m-m/util/blob/f0e4e084448f8dfc83ca682a9e1618034a094ce6/version/src/main/java/net/sf/mmm/util/version/impl/VersionIdentifierFormatterVersionSegments.java#L87-L91
Stratio/stratio-cassandra
src/java/org/apache/cassandra/utils/BloomCalculations.java
BloomCalculations.computeBloomSpec
public static BloomSpecification computeBloomSpec(int bucketsPerElement) { assert bucketsPerElement >= 1; assert bucketsPerElement <= probs.length - 1; return new BloomSpecification(optKPerBuckets[bucketsPerElement], bucketsPerElement); }
java
public static BloomSpecification computeBloomSpec(int bucketsPerElement) { assert bucketsPerElement >= 1; assert bucketsPerElement <= probs.length - 1; return new BloomSpecification(optKPerBuckets[bucketsPerElement], bucketsPerElement); }
[ "public", "static", "BloomSpecification", "computeBloomSpec", "(", "int", "bucketsPerElement", ")", "{", "assert", "bucketsPerElement", ">=", "1", ";", "assert", "bucketsPerElement", "<=", "probs", ".", "length", "-", "1", ";", "return", "new", "BloomSpecification",...
Given the number of buckets that can be used per element, return a specification that minimizes the false positive rate. @param bucketsPerElement The number of buckets per element for the filter. @return A spec that minimizes the false positive rate.
[ "Given", "the", "number", "of", "buckets", "that", "can", "be", "used", "per", "element", "return", "a", "specification", "that", "minimizes", "the", "false", "positive", "rate", "." ]
train
https://github.com/Stratio/stratio-cassandra/blob/f6416b43ad5309083349ad56266450fa8c6a2106/src/java/org/apache/cassandra/utils/BloomCalculations.java#L97-L102
stratosphere/stratosphere
stratosphere-compiler/src/main/java/eu/stratosphere/compiler/dag/OptimizerNode.java
OptimizerNode.setBroadcastInputs
public void setBroadcastInputs(Map<Operator<?>, OptimizerNode> operatorToNode) throws CompilerException { // skip for Operators that don't support broadcast variables if (!(getPactContract() instanceof AbstractUdfOperator<?, ?>)) { return; } // get all broadcast inputs AbstractUdfOperator<?, ?> operator = ((AbstractUdfOperator<?, ?>) getPactContract()); // create connections and add them for (Map.Entry<String, Operator<?>> input : operator.getBroadcastInputs().entrySet()) { OptimizerNode predecessor = operatorToNode.get(input.getValue()); PactConnection connection = new PactConnection(predecessor, this, ShipStrategyType.BROADCAST); addBroadcastConnection(input.getKey(), connection); predecessor.addOutgoingConnection(connection); } }
java
public void setBroadcastInputs(Map<Operator<?>, OptimizerNode> operatorToNode) throws CompilerException { // skip for Operators that don't support broadcast variables if (!(getPactContract() instanceof AbstractUdfOperator<?, ?>)) { return; } // get all broadcast inputs AbstractUdfOperator<?, ?> operator = ((AbstractUdfOperator<?, ?>) getPactContract()); // create connections and add them for (Map.Entry<String, Operator<?>> input : operator.getBroadcastInputs().entrySet()) { OptimizerNode predecessor = operatorToNode.get(input.getValue()); PactConnection connection = new PactConnection(predecessor, this, ShipStrategyType.BROADCAST); addBroadcastConnection(input.getKey(), connection); predecessor.addOutgoingConnection(connection); } }
[ "public", "void", "setBroadcastInputs", "(", "Map", "<", "Operator", "<", "?", ">", ",", "OptimizerNode", ">", "operatorToNode", ")", "throws", "CompilerException", "{", "// skip for Operators that don't support broadcast variables ", "if", "(", "!", "(", "getPactContra...
This function is for plan translation purposes. Upon invocation, this method creates a {@link PactConnection} for each one of the broadcast inputs associated with the {@code Operator} referenced by this node. <p> The {@code PactConnections} must set its shipping strategy type to BROADCAST. @param operatorToNode The map associating operators with their corresponding optimizer nodes. @throws CompilerException
[ "This", "function", "is", "for", "plan", "translation", "purposes", ".", "Upon", "invocation", "this", "method", "creates", "a", "{", "@link", "PactConnection", "}", "for", "each", "one", "of", "the", "broadcast", "inputs", "associated", "with", "the", "{", ...
train
https://github.com/stratosphere/stratosphere/blob/c543a08f9676c5b2b0a7088123bd6e795a8ae0c8/stratosphere-compiler/src/main/java/eu/stratosphere/compiler/dag/OptimizerNode.java#L181-L198
auth0/Auth0.Android
auth0/src/main/java/com/auth0/android/authentication/storage/SecureCredentialsManager.java
SecureCredentialsManager.requireAuthentication
public boolean requireAuthentication(@NonNull Activity activity, @IntRange(from = 1, to = 255) int requestCode, @Nullable String title, @Nullable String description) { if (requestCode < 1 || requestCode > 255) { throw new IllegalArgumentException("Request code must be a value between 1 and 255."); } KeyguardManager kManager = (KeyguardManager) activity.getSystemService(Context.KEYGUARD_SERVICE); this.authIntent = Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP ? kManager.createConfirmDeviceCredentialIntent(title, description) : null; this.authenticateBeforeDecrypt = ((Build.VERSION.SDK_INT >= Build.VERSION_CODES.M && kManager.isDeviceSecure()) || (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP && kManager.isKeyguardSecure())) && authIntent != null; if (authenticateBeforeDecrypt) { this.activity = activity; this.authenticationRequestCode = requestCode; } return authenticateBeforeDecrypt; }
java
public boolean requireAuthentication(@NonNull Activity activity, @IntRange(from = 1, to = 255) int requestCode, @Nullable String title, @Nullable String description) { if (requestCode < 1 || requestCode > 255) { throw new IllegalArgumentException("Request code must be a value between 1 and 255."); } KeyguardManager kManager = (KeyguardManager) activity.getSystemService(Context.KEYGUARD_SERVICE); this.authIntent = Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP ? kManager.createConfirmDeviceCredentialIntent(title, description) : null; this.authenticateBeforeDecrypt = ((Build.VERSION.SDK_INT >= Build.VERSION_CODES.M && kManager.isDeviceSecure()) || (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP && kManager.isKeyguardSecure())) && authIntent != null; if (authenticateBeforeDecrypt) { this.activity = activity; this.authenticationRequestCode = requestCode; } return authenticateBeforeDecrypt; }
[ "public", "boolean", "requireAuthentication", "(", "@", "NonNull", "Activity", "activity", ",", "@", "IntRange", "(", "from", "=", "1", ",", "to", "=", "255", ")", "int", "requestCode", ",", "@", "Nullable", "String", "title", ",", "@", "Nullable", "String...
Require the user to authenticate using the configured LockScreen before accessing the credentials. This feature is disabled by default and will only work if the device is running on Android version 21 or up and if the user has configured a secure LockScreen (PIN, Pattern, Password or Fingerprint). <p> The activity passed as first argument here must override the {@link Activity#onActivityResult(int, int, Intent)} method and call {@link SecureCredentialsManager#checkAuthenticationResult(int, int)} with the received parameters. @param activity a valid activity context. Will be used in the authentication request to launch a LockScreen intent. @param requestCode the request code to use in the authentication request. Must be a value between 1 and 255. @param title the text to use as title in the authentication screen. Passing null will result in using the OS's default value. @param description the text to use as description in the authentication screen. On some Android versions it might not be shown. Passing null will result in using the OS's default value. @return whether this device supports requiring authentication or not. This result can be ignored safely.
[ "Require", "the", "user", "to", "authenticate", "using", "the", "configured", "LockScreen", "before", "accessing", "the", "credentials", ".", "This", "feature", "is", "disabled", "by", "default", "and", "will", "only", "work", "if", "the", "device", "is", "run...
train
https://github.com/auth0/Auth0.Android/blob/ee37b7f94d989c1fbab2cb1378c87fdcaf7a8156/auth0/src/main/java/com/auth0/android/authentication/storage/SecureCredentialsManager.java#L92-L106