repository_name
stringlengths
7
58
func_path_in_repository
stringlengths
11
204
func_name
stringlengths
5
103
whole_func_string
stringlengths
87
3.44k
language
stringclasses
1 value
func_code_string
stringlengths
87
3.44k
func_code_tokens
listlengths
21
714
func_documentation_string
stringlengths
61
1.95k
func_documentation_tokens
listlengths
1
482
split_name
stringclasses
1 value
func_code_url
stringlengths
102
309
tvesalainen/bcc
src/main/java/org/vesalainen/bcc/SubClass.java
SubClass.defineField
public void defineField(int modifier, String fieldName, Class<?> type) { defineField(modifier, fieldName, Typ.getTypeFor(type)); }
java
public void defineField(int modifier, String fieldName, Class<?> type) { defineField(modifier, fieldName, Typ.getTypeFor(type)); }
[ "public", "void", "defineField", "(", "int", "modifier", ",", "String", "fieldName", ",", "Class", "<", "?", ">", "type", ")", "{", "defineField", "(", "modifier", ",", "fieldName", ",", "Typ", ".", "getTypeFor", "(", "type", ")", ")", ";", "}" ]
Define a new field. @param modifier @param fieldName @param type
[ "Define", "a", "new", "field", "." ]
train
https://github.com/tvesalainen/bcc/blob/4e84e313018d487f1a8cca3952d71bc21e77d16b/src/main/java/org/vesalainen/bcc/SubClass.java#L610-L613
javamonkey/beetl2.0
beetl-core/src/main/java/org/beetl/core/om/ObjectUtil.java
ObjectUtil.invoke
private static Object invoke(Class target, Object o, String methodName, Object[] paras) throws IllegalAccessException, IllegalArgumentException, InvocationTargetException { ObjectInfo info = getObjectInfo(target); Class[] parameterType = new Class[paras.length]; int i = 0; for (Object para : paras) { parameterType[i++] = para == null ? null : para.getClass(); } ObjectMethodMatchConf mf = findMethod(target, methodName, parameterType); if (mf == null) { throw new BeetlParserException(BeetlParserException.NATIVE_CALL_INVALID, "根据参数未找到匹配的方法"+methodName+BeetlUtil.getParameterDescription(parameterType)); } Object result = invoke(o, mf, paras); return result; }
java
private static Object invoke(Class target, Object o, String methodName, Object[] paras) throws IllegalAccessException, IllegalArgumentException, InvocationTargetException { ObjectInfo info = getObjectInfo(target); Class[] parameterType = new Class[paras.length]; int i = 0; for (Object para : paras) { parameterType[i++] = para == null ? null : para.getClass(); } ObjectMethodMatchConf mf = findMethod(target, methodName, parameterType); if (mf == null) { throw new BeetlParserException(BeetlParserException.NATIVE_CALL_INVALID, "根据参数未找到匹配的方法"+methodName+BeetlUtil.getParameterDescription(parameterType)); } Object result = invoke(o, mf, paras); return result; }
[ "private", "static", "Object", "invoke", "(", "Class", "target", ",", "Object", "o", ",", "String", "methodName", ",", "Object", "[", "]", "paras", ")", "throws", "IllegalAccessException", ",", "IllegalArgumentException", ",", "InvocationTargetException", "{", "Ob...
Beetl 本地方法调用即调用此类,需要考虑到多态。beetl自动调用第一个匹配到的函数,而不会像java那样,调用最合适的匹配到的函数 @param o 对象实例 @param methodName 方法名 @param paras 方法参数 @return @throws IllegalAccessException @throws IllegalArgumentException @throws InvocationTargetException
[ "Beetl", "本地方法调用即调用此类,需要考虑到多态。beetl自动调用第一个匹配到的函数,而不会像java那样,调用最合适的匹配到的函数" ]
train
https://github.com/javamonkey/beetl2.0/blob/f32f729ad238079df5aca6e38a3c3ba0a55c78d6/beetl-core/src/main/java/org/beetl/core/om/ObjectUtil.java#L492-L511
exoplatform/jcr
exo.jcr.ext.services/src/main/java/org/exoplatform/services/jcr/ext/organization/UserProfileHandlerImpl.java
UserProfileHandlerImpl.preSave
private void preSave(UserProfile userProfile, boolean isNew) throws Exception { for (UserProfileEventListener listener : listeners) { listener.preSave(userProfile, isNew); } }
java
private void preSave(UserProfile userProfile, boolean isNew) throws Exception { for (UserProfileEventListener listener : listeners) { listener.preSave(userProfile, isNew); } }
[ "private", "void", "preSave", "(", "UserProfile", "userProfile", ",", "boolean", "isNew", ")", "throws", "Exception", "{", "for", "(", "UserProfileEventListener", "listener", ":", "listeners", ")", "{", "listener", ".", "preSave", "(", "userProfile", ",", "isNew...
Notifying listeners before profile creation. @param userProfile the user profile which is used in save operation @param isNew true, if we have a deal with new profile, otherwise it is false which mean update operation is in progress @throws Exception if any listener failed to handle the event
[ "Notifying", "listeners", "before", "profile", "creation", "." ]
train
https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.ext.services/src/main/java/org/exoplatform/services/jcr/ext/organization/UserProfileHandlerImpl.java#L408-L414
google/closure-templates
java/src/com/google/template/soy/jbcsrc/restricted/SoyExpression.java
SoyExpression.unboxAsString
public SoyExpression unboxAsString() { if (alreadyUnboxed(String.class)) { return this; } assertBoxed(String.class); Expression unboxedString; if (delegate.isNonNullable()) { unboxedString = delegate.invoke(MethodRef.SOY_VALUE_STRING_VALUE); } else { unboxedString = new Expression(BytecodeUtils.STRING_TYPE, features()) { @Override protected void doGen(CodeBuilder adapter) { Label end = new Label(); delegate.gen(adapter); BytecodeUtils.nullCoalesce(adapter, end); MethodRef.SOY_VALUE_STRING_VALUE.invokeUnchecked(adapter); adapter.mark(end); } }; } return forString(unboxedString); }
java
public SoyExpression unboxAsString() { if (alreadyUnboxed(String.class)) { return this; } assertBoxed(String.class); Expression unboxedString; if (delegate.isNonNullable()) { unboxedString = delegate.invoke(MethodRef.SOY_VALUE_STRING_VALUE); } else { unboxedString = new Expression(BytecodeUtils.STRING_TYPE, features()) { @Override protected void doGen(CodeBuilder adapter) { Label end = new Label(); delegate.gen(adapter); BytecodeUtils.nullCoalesce(adapter, end); MethodRef.SOY_VALUE_STRING_VALUE.invokeUnchecked(adapter); adapter.mark(end); } }; } return forString(unboxedString); }
[ "public", "SoyExpression", "unboxAsString", "(", ")", "{", "if", "(", "alreadyUnboxed", "(", "String", ".", "class", ")", ")", "{", "return", "this", ";", "}", "assertBoxed", "(", "String", ".", "class", ")", ";", "Expression", "unboxedString", ";", "if", ...
Unboxes this to a {@link SoyExpression} with a String runtime type. <p>This method is appropriate when you know (likely via inspection of the {@link #soyType()}, or other means) that the value does have the appropriate type but you prefer to interact with it as its unboxed representation. If you simply want to 'coerce' the given value to a new type consider {@link #coerceToString()} which is designed for that use case.
[ "Unboxes", "this", "to", "a", "{", "@link", "SoyExpression", "}", "with", "a", "String", "runtime", "type", "." ]
train
https://github.com/google/closure-templates/blob/cc61e1dff70ae97f24f417a57410081bc498bd56/java/src/com/google/template/soy/jbcsrc/restricted/SoyExpression.java#L483-L506
xm-online/xm-commons
xm-commons-permission/src/main/java/com/icthh/xm/commons/permission/service/PermissionCheckService.java
PermissionCheckService.hasPermission
public boolean hasPermission(Authentication authentication, Object privilege) { return checkRole(authentication, privilege, true) || checkPermission(authentication, null, privilege, false, true); }
java
public boolean hasPermission(Authentication authentication, Object privilege) { return checkRole(authentication, privilege, true) || checkPermission(authentication, null, privilege, false, true); }
[ "public", "boolean", "hasPermission", "(", "Authentication", "authentication", ",", "Object", "privilege", ")", "{", "return", "checkRole", "(", "authentication", ",", "privilege", ",", "true", ")", "||", "checkPermission", "(", "authentication", ",", "null", ",",...
Check permission for role and privilege key only. @param authentication the authentication @param privilege the privilege key @return true if permitted
[ "Check", "permission", "for", "role", "and", "privilege", "key", "only", "." ]
train
https://github.com/xm-online/xm-commons/blob/43eb2273adb96f40830d7b905ee3a767b8715caf/xm-commons-permission/src/main/java/com/icthh/xm/commons/permission/service/PermissionCheckService.java#L55-L59
b3dgs/lionengine
lionengine-game/src/main/java/com/b3dgs/lionengine/game/Configurer.java
Configurer.getInteger
public final int getInteger(String attribute, String... path) { try { return Integer.parseInt(getNodeString(attribute, path)); } catch (final NumberFormatException exception) { throw new LionEngineException(exception, media); } }
java
public final int getInteger(String attribute, String... path) { try { return Integer.parseInt(getNodeString(attribute, path)); } catch (final NumberFormatException exception) { throw new LionEngineException(exception, media); } }
[ "public", "final", "int", "getInteger", "(", "String", "attribute", ",", "String", "...", "path", ")", "{", "try", "{", "return", "Integer", ".", "parseInt", "(", "getNodeString", "(", "attribute", ",", "path", ")", ")", ";", "}", "catch", "(", "final", ...
Get an integer in the xml tree. @param attribute The attribute to get as integer. @param path The node path (child list) @return The integer value. @throws LionEngineException If unable to read node or not a valid integer read.
[ "Get", "an", "integer", "in", "the", "xml", "tree", "." ]
train
https://github.com/b3dgs/lionengine/blob/cac3d5578532cf11724a737b9f09e71bf9995ab2/lionengine-game/src/main/java/com/b3dgs/lionengine/game/Configurer.java#L212-L222
Kurento/kurento-module-creator
src/main/java/com/github/zafarkhaja/semver/expr/ExpressionParser.java
ExpressionParser.parseRangeExpression
private Expression parseRangeExpression() { Expression ge = new GreaterOrEqual(parseVersion()); consumeNextToken(HYPHEN); Expression le = new LessOrEqual(parseVersion()); return new And(ge, le); }
java
private Expression parseRangeExpression() { Expression ge = new GreaterOrEqual(parseVersion()); consumeNextToken(HYPHEN); Expression le = new LessOrEqual(parseVersion()); return new And(ge, le); }
[ "private", "Expression", "parseRangeExpression", "(", ")", "{", "Expression", "ge", "=", "new", "GreaterOrEqual", "(", "parseVersion", "(", ")", ")", ";", "consumeNextToken", "(", "HYPHEN", ")", ";", "Expression", "le", "=", "new", "LessOrEqual", "(", "parseVe...
Parses the {@literal <range-expr>} non-terminal. <pre> {@literal <range-expr> ::= <version> "-" <version> } </pre> @return the expression AST
[ "Parses", "the", "{", "@literal", "<range", "-", "expr", ">", "}", "non", "-", "terminal", "." ]
train
https://github.com/Kurento/kurento-module-creator/blob/c371516c665b902b5476433496a5aefcbca86d64/src/main/java/com/github/zafarkhaja/semver/expr/ExpressionParser.java#L325-L330
jhunters/jprotobuf
src/main/java/com/baidu/bjf/remoting/protobuf/ProtobufIDLProxy.java
ProtobufIDLProxy.generateSource
public static void generateSource(Reader reader, File sourceOutputPath) throws IOException { ProtoFile protoFile = ProtoSchemaParser.parse(DEFAULT_FILE_NAME, reader); List<CodeDependent> cds = new ArrayList<CodeDependent>(); doCreate(protoFile, true, false, null, true, sourceOutputPath, cds, new HashMap<String, String>(), false); }
java
public static void generateSource(Reader reader, File sourceOutputPath) throws IOException { ProtoFile protoFile = ProtoSchemaParser.parse(DEFAULT_FILE_NAME, reader); List<CodeDependent> cds = new ArrayList<CodeDependent>(); doCreate(protoFile, true, false, null, true, sourceOutputPath, cds, new HashMap<String, String>(), false); }
[ "public", "static", "void", "generateSource", "(", "Reader", "reader", ",", "File", "sourceOutputPath", ")", "throws", "IOException", "{", "ProtoFile", "protoFile", "=", "ProtoSchemaParser", ".", "parse", "(", "DEFAULT_FILE_NAME", ",", "reader", ")", ";", "List", ...
Generate source. @param reader the reader @param sourceOutputPath the source output path @throws IOException Signals that an I/O exception has occurred.
[ "Generate", "source", "." ]
train
https://github.com/jhunters/jprotobuf/blob/55832c9b4792afb128e5b35139d8a3891561d8a3/src/main/java/com/baidu/bjf/remoting/protobuf/ProtobufIDLProxy.java#L1442-L1446
jenkinsci/jenkins
core/src/main/java/hudson/FilePath.java
FilePath.createTextTempFile
public FilePath createTextTempFile(final String prefix, final String suffix, final String contents) throws IOException, InterruptedException { return createTextTempFile(prefix,suffix,contents,true); }
java
public FilePath createTextTempFile(final String prefix, final String suffix, final String contents) throws IOException, InterruptedException { return createTextTempFile(prefix,suffix,contents,true); }
[ "public", "FilePath", "createTextTempFile", "(", "final", "String", "prefix", ",", "final", "String", "suffix", ",", "final", "String", "contents", ")", "throws", "IOException", ",", "InterruptedException", "{", "return", "createTextTempFile", "(", "prefix", ",", ...
Creates a temporary file in this directory and set the contents to the given text (encoded in the platform default encoding) @param prefix The prefix string to be used in generating the file's name; must be at least three characters long @param suffix The suffix string to be used in generating the file's name; may be null, in which case the suffix ".tmp" will be used @param contents The initial contents of the temporary file. @return The new FilePath pointing to the temporary file @see File#createTempFile(String, String)
[ "Creates", "a", "temporary", "file", "in", "this", "directory", "and", "set", "the", "contents", "to", "the", "given", "text", "(", "encoded", "in", "the", "platform", "default", "encoding", ")" ]
train
https://github.com/jenkinsci/jenkins/blob/44c4d3989232082c254d27ae360aa810669f44b7/core/src/main/java/hudson/FilePath.java#L1412-L1414
powermock/powermock
powermock-api/powermock-api-easymock/src/main/java/org/powermock/api/easymock/PowerMock.java
PowerMock.createMock
public static <T> T createMock(Class<T> type, Object... constructorArguments) { Constructor<?> constructor = WhiteboxImpl.findUniqueConstructorOrThrowException(type, constructorArguments); ConstructorArgs constructorArgs = new ConstructorArgs(constructor, constructorArguments); return doMock(type, false, new DefaultMockStrategy(), constructorArgs, (Method[]) null); }
java
public static <T> T createMock(Class<T> type, Object... constructorArguments) { Constructor<?> constructor = WhiteboxImpl.findUniqueConstructorOrThrowException(type, constructorArguments); ConstructorArgs constructorArgs = new ConstructorArgs(constructor, constructorArguments); return doMock(type, false, new DefaultMockStrategy(), constructorArgs, (Method[]) null); }
[ "public", "static", "<", "T", ">", "T", "createMock", "(", "Class", "<", "T", ">", "type", ",", "Object", "...", "constructorArguments", ")", "{", "Constructor", "<", "?", ">", "constructor", "=", "WhiteboxImpl", ".", "findUniqueConstructorOrThrowException", "...
Creates a mock object that supports mocking of final and native methods and invokes a specific constructor based on the supplied argument values. @param <T> the type of the mock object @param type the type of the mock object @param constructorArguments The constructor arguments that will be used to invoke a certain constructor. @return the mock object.
[ "Creates", "a", "mock", "object", "that", "supports", "mocking", "of", "final", "and", "native", "methods", "and", "invokes", "a", "specific", "constructor", "based", "on", "the", "supplied", "argument", "values", "." ]
train
https://github.com/powermock/powermock/blob/e8cd68026c284c6a7efe66959809eeebd8d1f9ad/powermock-api/powermock-api-easymock/src/main/java/org/powermock/api/easymock/PowerMock.java#L123-L127
primefaces-extensions/core
src/main/java/org/primefaces/extensions/util/RequestParameterBuilder.java
RequestParameterBuilder.paramJson
public RequestParameterBuilder paramJson(String name, Object value) throws UnsupportedEncodingException { return paramJson(name, value, null); }
java
public RequestParameterBuilder paramJson(String name, Object value) throws UnsupportedEncodingException { return paramJson(name, value, null); }
[ "public", "RequestParameterBuilder", "paramJson", "(", "String", "name", ",", "Object", "value", ")", "throws", "UnsupportedEncodingException", "{", "return", "paramJson", "(", "name", ",", "value", ",", "null", ")", ";", "}" ]
Adds a request parameter to the URL without specifying a data type of the given parameter value. Parameter's value is converted to JSON notation when adding. Furthermore, it will be encoded according to the acquired encoding. @param name name of the request parameter @param value value of the request parameter @return RequestParameterBuilder updated this instance which can be reused @throws UnsupportedEncodingException DOCUMENT_ME
[ "Adds", "a", "request", "parameter", "to", "the", "URL", "without", "specifying", "a", "data", "type", "of", "the", "given", "parameter", "value", ".", "Parameter", "s", "value", "is", "converted", "to", "JSON", "notation", "when", "adding", ".", "Furthermor...
train
https://github.com/primefaces-extensions/core/blob/afdbca591f60f47898e3517e1e939bc2f63d5355/src/main/java/org/primefaces/extensions/util/RequestParameterBuilder.java#L101-L103
gmessner/gitlab4j-api
src/main/java/org/gitlab4j/api/MilestonesApi.java
MilestonesApi.createGroupMilestone
public Milestone createGroupMilestone(Object groupIdOrPath, String title, String description, Date dueDate, Date startDate) throws GitLabApiException { GitLabApiForm formData = new GitLabApiForm() .withParam("title", title, true) .withParam("description", description) .withParam("due_date", dueDate) .withParam("start_date", startDate); Response response = post(Response.Status.CREATED, formData, "groups", getGroupIdOrPath(groupIdOrPath), "milestones"); return (response.readEntity(Milestone.class)); }
java
public Milestone createGroupMilestone(Object groupIdOrPath, String title, String description, Date dueDate, Date startDate) throws GitLabApiException { GitLabApiForm formData = new GitLabApiForm() .withParam("title", title, true) .withParam("description", description) .withParam("due_date", dueDate) .withParam("start_date", startDate); Response response = post(Response.Status.CREATED, formData, "groups", getGroupIdOrPath(groupIdOrPath), "milestones"); return (response.readEntity(Milestone.class)); }
[ "public", "Milestone", "createGroupMilestone", "(", "Object", "groupIdOrPath", ",", "String", "title", ",", "String", "description", ",", "Date", "dueDate", ",", "Date", "startDate", ")", "throws", "GitLabApiException", "{", "GitLabApiForm", "formData", "=", "new", ...
Create a group milestone. @param groupIdOrPath the group in the form of an Integer(ID), String(path), or Group instance @param title the title for the milestone @param description the description for the milestone @param dueDate the due date for the milestone @param startDate the start date for the milestone @return the created Milestone instance @throws GitLabApiException if any exception occurs
[ "Create", "a", "group", "milestone", "." ]
train
https://github.com/gmessner/gitlab4j-api/blob/ab045070abac0a8f4ccbf17b5ed9bfdef5723eed/src/main/java/org/gitlab4j/api/MilestonesApi.java#L176-L185
caelum/vraptor4
vraptor-musicjungle/src/main/java/br/com/caelum/vraptor/musicjungle/controller/UsersController.java
UsersController.addToMyList
@Path("/users/{user.login}/musics/{music.id}") @Put public void addToMyList(User user, Music music) { User currentUser = userInfo.getUser(); userDao.refresh(currentUser); validator.check(user.getLogin().equals(currentUser.getLogin()), new SimpleMessage("user", "you_cant_add_to_others_list")); validator.check(!currentUser.getMusics().contains(music), new SimpleMessage("music", "you_already_have_this_music")); validator.onErrorUsePageOf(UsersController.class).home(); music = musicDao.load(music); currentUser.add(music); result.redirectTo(UsersController.class).home(); }
java
@Path("/users/{user.login}/musics/{music.id}") @Put public void addToMyList(User user, Music music) { User currentUser = userInfo.getUser(); userDao.refresh(currentUser); validator.check(user.getLogin().equals(currentUser.getLogin()), new SimpleMessage("user", "you_cant_add_to_others_list")); validator.check(!currentUser.getMusics().contains(music), new SimpleMessage("music", "you_already_have_this_music")); validator.onErrorUsePageOf(UsersController.class).home(); music = musicDao.load(music); currentUser.add(music); result.redirectTo(UsersController.class).home(); }
[ "@", "Path", "(", "\"/users/{user.login}/musics/{music.id}\"", ")", "@", "Put", "public", "void", "addToMyList", "(", "User", "user", ",", "Music", "music", ")", "{", "User", "currentUser", "=", "userInfo", ".", "getUser", "(", ")", ";", "userDao", ".", "ref...
Accepts HTTP PUT requests. <br> <strong>URL:</strong> /users/login/musics/id (for example, /users/john/musics/3 adds the music with id 3 to the john's collection)<br> <strong>View:</strong> redirects to user's home <br> You can use more than one variable on URI. Since the browsers don't support PUT method you have to pass an additional parameter: <strong>_method=PUT</strong> for calling this method.<br> This method adds a music to a user's collection.
[ "Accepts", "HTTP", "PUT", "requests", ".", "<br", ">" ]
train
https://github.com/caelum/vraptor4/blob/593ce9ad60f9d38c360881b2132417c56b8cc093/vraptor-musicjungle/src/main/java/br/com/caelum/vraptor/musicjungle/controller/UsersController.java#L172-L190
joniles/mpxj
src/main/java/net/sf/mpxj/conceptdraw/ConceptDrawProjectReader.java
ConceptDrawProjectReader.readWeekDay
private void readWeekDay(ProjectCalendar mpxjCalendar, WeekDay day) { if (day.isIsDayWorking()) { ProjectCalendarHours hours = mpxjCalendar.addCalendarHours(day.getDay()); for (Document.Calendars.Calendar.WeekDays.WeekDay.TimePeriods.TimePeriod period : day.getTimePeriods().getTimePeriod()) { hours.addRange(new DateRange(period.getFrom(), period.getTo())); } } }
java
private void readWeekDay(ProjectCalendar mpxjCalendar, WeekDay day) { if (day.isIsDayWorking()) { ProjectCalendarHours hours = mpxjCalendar.addCalendarHours(day.getDay()); for (Document.Calendars.Calendar.WeekDays.WeekDay.TimePeriods.TimePeriod period : day.getTimePeriods().getTimePeriod()) { hours.addRange(new DateRange(period.getFrom(), period.getTo())); } } }
[ "private", "void", "readWeekDay", "(", "ProjectCalendar", "mpxjCalendar", ",", "WeekDay", "day", ")", "{", "if", "(", "day", ".", "isIsDayWorking", "(", ")", ")", "{", "ProjectCalendarHours", "hours", "=", "mpxjCalendar", ".", "addCalendarHours", "(", "day", "...
Reads a single day for a calendar. @param mpxjCalendar ProjectCalendar instance @param day ConceptDraw PROJECT week day
[ "Reads", "a", "single", "day", "for", "a", "calendar", "." ]
train
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/conceptdraw/ConceptDrawProjectReader.java#L253-L263
mnlipp/jgrapes
org.jgrapes.io/src/org/jgrapes/net/SslCodec.java
SslCodec.onClosed
@Handler(channels = EncryptedChannel.class) public void onClosed(Closed event, IOSubchannel encryptedChannel) throws SSLException, InterruptedException { @SuppressWarnings("unchecked") final Optional<PlainChannel> plainChannel = (Optional<PlainChannel>) LinkedIOSubchannel .downstreamChannel(this, encryptedChannel); if (plainChannel.isPresent()) { plainChannel.get().upstreamClosed(); } }
java
@Handler(channels = EncryptedChannel.class) public void onClosed(Closed event, IOSubchannel encryptedChannel) throws SSLException, InterruptedException { @SuppressWarnings("unchecked") final Optional<PlainChannel> plainChannel = (Optional<PlainChannel>) LinkedIOSubchannel .downstreamChannel(this, encryptedChannel); if (plainChannel.isPresent()) { plainChannel.get().upstreamClosed(); } }
[ "@", "Handler", "(", "channels", "=", "EncryptedChannel", ".", "class", ")", "public", "void", "onClosed", "(", "Closed", "event", ",", "IOSubchannel", "encryptedChannel", ")", "throws", "SSLException", ",", "InterruptedException", "{", "@", "SuppressWarnings", "(...
Handles a close event from the encrypted channel (client). @param event the event @param encryptedChannel the channel for exchanging the encrypted data @throws InterruptedException @throws SSLException
[ "Handles", "a", "close", "event", "from", "the", "encrypted", "channel", "(", "client", ")", "." ]
train
https://github.com/mnlipp/jgrapes/blob/8b5d874935d84c34a52d3e3d3745e869b5203fa0/org.jgrapes.io/src/org/jgrapes/net/SslCodec.java#L215-L225
salesforce/Argus
ArgusCore/src/main/java/com/salesforce/dva/argus/util/Option.java
Option.createOption
public static Option createOption(String name, String description) { return new Option(Type.OPTION, name, 1, description); }
java
public static Option createOption(String name, String description) { return new Option(Type.OPTION, name, 1, description); }
[ "public", "static", "Option", "createOption", "(", "String", "name", ",", "String", "description", ")", "{", "return", "new", "Option", "(", "Type", ".", "OPTION", ",", "name", ",", "1", ",", "description", ")", ";", "}" ]
Returns a named option having one value. An example may be a logfile option for a program. <p>program -log &lt;logfile&gt;</p> <p>In this case the -log option has a length of one value of &lt;logfile&gt;.</p> @param name The name of the option. @param description The description of the option used to display usage @return The option.
[ "Returns", "a", "named", "option", "having", "one", "value", ".", "An", "example", "may", "be", "a", "logfile", "option", "for", "a", "program", "." ]
train
https://github.com/salesforce/Argus/blob/121b59a268da264316cded6a3e9271366a23cd86/ArgusCore/src/main/java/com/salesforce/dva/argus/util/Option.java#L124-L126
DDTH/ddth-tsc
ddth-tsc-core/src/main/java/com/github/ddth/tsc/cassandra/internal/CounterMetadata.java
CounterMetadata.fromMap
public static CounterMetadata fromMap(Map<String, Object> data) { if (data == null) { return null; } CounterMetadata metadata = new CounterMetadata(); Boolean boolValue = DPathUtils.getValue(data, KEY_COUNTER_COLUMN, Boolean.class); metadata.isCounterColumn = boolValue != null ? boolValue.booleanValue() : false; metadata.table = DPathUtils.getValue(data, KEY_TABLE, String.class); return metadata; }
java
public static CounterMetadata fromMap(Map<String, Object> data) { if (data == null) { return null; } CounterMetadata metadata = new CounterMetadata(); Boolean boolValue = DPathUtils.getValue(data, KEY_COUNTER_COLUMN, Boolean.class); metadata.isCounterColumn = boolValue != null ? boolValue.booleanValue() : false; metadata.table = DPathUtils.getValue(data, KEY_TABLE, String.class); return metadata; }
[ "public", "static", "CounterMetadata", "fromMap", "(", "Map", "<", "String", ",", "Object", ">", "data", ")", "{", "if", "(", "data", "==", "null", ")", "{", "return", "null", ";", "}", "CounterMetadata", "metadata", "=", "new", "CounterMetadata", "(", "...
Creates a {@link CounterMetadata} object from a Map. @param data @return
[ "Creates", "a", "{", "@link", "CounterMetadata", "}", "object", "from", "a", "Map", "." ]
train
https://github.com/DDTH/ddth-tsc/blob/d233c304c8fed2f3c069de42a36b7bbd5c8be01b/ddth-tsc-core/src/main/java/com/github/ddth/tsc/cassandra/internal/CounterMetadata.java#L91-L100
googleapis/google-http-java-client
google-http-client/src/main/java/com/google/api/client/util/SecurityUtils.java
SecurityUtils.loadKeyStore
public static void loadKeyStore(KeyStore keyStore, InputStream keyStream, String storePass) throws IOException, GeneralSecurityException { try { keyStore.load(keyStream, storePass.toCharArray()); } finally { keyStream.close(); } }
java
public static void loadKeyStore(KeyStore keyStore, InputStream keyStream, String storePass) throws IOException, GeneralSecurityException { try { keyStore.load(keyStream, storePass.toCharArray()); } finally { keyStream.close(); } }
[ "public", "static", "void", "loadKeyStore", "(", "KeyStore", "keyStore", ",", "InputStream", "keyStream", ",", "String", "storePass", ")", "throws", "IOException", ",", "GeneralSecurityException", "{", "try", "{", "keyStore", ".", "load", "(", "keyStream", ",", ...
Loads a key store from a stream. <p>Example usage: <pre> KeyStore keyStore = SecurityUtils.getJavaKeyStore(); SecurityUtils.loadKeyStore(keyStore, new FileInputStream("certs.jks"), "password"); </pre> @param keyStore key store @param keyStream input stream to the key store stream (closed at the end of this method in a finally block) @param storePass password protecting the key store file
[ "Loads", "a", "key", "store", "from", "a", "stream", "." ]
train
https://github.com/googleapis/google-http-java-client/blob/0988ae4e0f26a80f579b6adb2b276dd8254928de/google-http-client/src/main/java/com/google/api/client/util/SecurityUtils.java#L75-L82
looly/hutool
hutool-core/src/main/java/cn/hutool/core/collection/CollUtil.java
CollUtil.removeNull
public static <T> Collection<T> removeNull(Collection<T> collection) { return filter(collection, new Editor<T>() { @Override public T edit(T t) { // 返回null便不加入集合 return t; } }); }
java
public static <T> Collection<T> removeNull(Collection<T> collection) { return filter(collection, new Editor<T>() { @Override public T edit(T t) { // 返回null便不加入集合 return t; } }); }
[ "public", "static", "<", "T", ">", "Collection", "<", "T", ">", "removeNull", "(", "Collection", "<", "T", ">", "collection", ")", "{", "return", "filter", "(", "collection", ",", "new", "Editor", "<", "T", ">", "(", ")", "{", "@", "Override", "publi...
去除{@code null} 元素 @param collection 集合 @return 处理后的集合 @since 3.2.2
[ "去除", "{", "@code", "null", "}", "元素" ]
train
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/collection/CollUtil.java#L1059-L1067
looly/hutool
hutool-core/src/main/java/cn/hutool/core/io/watch/WatchMonitor.java
WatchMonitor.create
public static WatchMonitor create(String path, int maxDepth, WatchEvent.Kind<?>... events){ return create(Paths.get(path), maxDepth, events); }
java
public static WatchMonitor create(String path, int maxDepth, WatchEvent.Kind<?>... events){ return create(Paths.get(path), maxDepth, events); }
[ "public", "static", "WatchMonitor", "create", "(", "String", "path", ",", "int", "maxDepth", ",", "WatchEvent", ".", "Kind", "<", "?", ">", "...", "events", ")", "{", "return", "create", "(", "Paths", ".", "get", "(", "path", ")", ",", "maxDepth", ",",...
创建并初始化监听 @param path 路径 @param events 监听的事件列表 @param maxDepth 当监听目录时,监听目录的最大深度,当设置值为1(或小于1)时,表示不递归监听子目录 @return 监听对象
[ "创建并初始化监听" ]
train
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/io/watch/WatchMonitor.java#L162-L164
UrielCh/ovh-java-sdk
ovh-java-sdk-cloud/src/main/java/net/minidev/ovh/api/ApiOvhCloud.java
ApiOvhCloud.project_serviceName_region_regionName_workflow_backup_backupWorkflowId_GET
public OvhBackup project_serviceName_region_regionName_workflow_backup_backupWorkflowId_GET(String serviceName, String regionName, String backupWorkflowId) throws IOException { String qPath = "/cloud/project/{serviceName}/region/{regionName}/workflow/backup/{backupWorkflowId}"; StringBuilder sb = path(qPath, serviceName, regionName, backupWorkflowId); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, OvhBackup.class); }
java
public OvhBackup project_serviceName_region_regionName_workflow_backup_backupWorkflowId_GET(String serviceName, String regionName, String backupWorkflowId) throws IOException { String qPath = "/cloud/project/{serviceName}/region/{regionName}/workflow/backup/{backupWorkflowId}"; StringBuilder sb = path(qPath, serviceName, regionName, backupWorkflowId); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, OvhBackup.class); }
[ "public", "OvhBackup", "project_serviceName_region_regionName_workflow_backup_backupWorkflowId_GET", "(", "String", "serviceName", ",", "String", "regionName", ",", "String", "backupWorkflowId", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/cloud/project/{servi...
Get details about a backup workflow process REST: GET /cloud/project/{serviceName}/region/{regionName}/workflow/backup/{backupWorkflowId} @param backupWorkflowId [required] ID of your backup workflow @param regionName [required] Public Cloud region @param serviceName [required] Public Cloud project API beta
[ "Get", "details", "about", "a", "backup", "workflow", "process" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-cloud/src/main/java/net/minidev/ovh/api/ApiOvhCloud.java#L231-L236
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/java/time/ZonedDateTime.java
ZonedDateTime.resolveOffset
private ZonedDateTime resolveOffset(ZoneOffset offset) { if (offset.equals(this.offset) == false && zone.getRules().isValidOffset(dateTime, offset)) { return new ZonedDateTime(dateTime, offset, zone); } return this; }
java
private ZonedDateTime resolveOffset(ZoneOffset offset) { if (offset.equals(this.offset) == false && zone.getRules().isValidOffset(dateTime, offset)) { return new ZonedDateTime(dateTime, offset, zone); } return this; }
[ "private", "ZonedDateTime", "resolveOffset", "(", "ZoneOffset", "offset", ")", "{", "if", "(", "offset", ".", "equals", "(", "this", ".", "offset", ")", "==", "false", "&&", "zone", ".", "getRules", "(", ")", ".", "isValidOffset", "(", "dateTime", ",", "...
Resolves the offset into this zoned date-time for the with methods. <p> This typically ignores the offset, unless it can be used to switch offset in a DST overlap. @param offset the offset, not null @return the zoned date-time, not null
[ "Resolves", "the", "offset", "into", "this", "zoned", "date", "-", "time", "for", "the", "with", "methods", ".", "<p", ">", "This", "typically", "ignores", "the", "offset", "unless", "it", "can", "be", "used", "to", "switch", "offset", "in", "a", "DST", ...
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/time/ZonedDateTime.java#L636-L641
mytechia/mytechia_commons
mytechia_commons_library/src/main/java/com/mytechia/commons/patterns/prototype/PrototypeContainer.java
PrototypeContainer.registerPrototype
public void registerPrototype( String key, IPrototype prototype ) { prototypes.put(new PrototypeKey(key, prototype.getClass()), prototype); }
java
public void registerPrototype( String key, IPrototype prototype ) { prototypes.put(new PrototypeKey(key, prototype.getClass()), prototype); }
[ "public", "void", "registerPrototype", "(", "String", "key", ",", "IPrototype", "prototype", ")", "{", "prototypes", ".", "put", "(", "new", "PrototypeKey", "(", "key", ",", "prototype", ".", "getClass", "(", ")", ")", ",", "prototype", ")", ";", "}" ]
Registers a new prototype associated to the specified key NOTE: IPrototype pattern @param key key for the new prototype @param prototype the prototype to register
[ "Registers", "a", "new", "prototype", "associated", "to", "the", "specified", "key" ]
train
https://github.com/mytechia/mytechia_commons/blob/02251879085f271a1fb51663a1c8eddc8be78ae7/mytechia_commons_library/src/main/java/com/mytechia/commons/patterns/prototype/PrototypeContainer.java#L138-L143
jingwei/krati
krati-main/src/main/java/krati/util/SourceWaterMarks.java
SourceWaterMarks.syncWaterMarks
public boolean syncWaterMarks(String source, long lwmScn, long hwmScn) { setWaterMarks(source, lwmScn, hwmScn); return flush(); }
java
public boolean syncWaterMarks(String source, long lwmScn, long hwmScn) { setWaterMarks(source, lwmScn, hwmScn); return flush(); }
[ "public", "boolean", "syncWaterMarks", "(", "String", "source", ",", "long", "lwmScn", ",", "long", "hwmScn", ")", "{", "setWaterMarks", "(", "source", ",", "lwmScn", ",", "hwmScn", ")", ";", "return", "flush", "(", ")", ";", "}" ]
Sets and flushes the water marks of a source. @param source - the source @param lwmScn - the low water mark SCN @param hwmScn - the high water mark SCN @return <tt>true</tt> if flush is successful.
[ "Sets", "and", "flushes", "the", "water", "marks", "of", "a", "source", "." ]
train
https://github.com/jingwei/krati/blob/1ca0f994a7b0c8215b827eac9aaf95789ec08d21/krati-main/src/main/java/krati/util/SourceWaterMarks.java#L266-L269
jbundle/jbundle
base/remote/src/main/java/org/jbundle/base/remote/proxy/BaseSessionHolder.java
BaseSessionHolder.setReturnSessionOrObject
public void setReturnSessionOrObject(PrintWriter out, Object objReturn) { String strID = null; String strSessionClass = null; if (objReturn instanceof RemoteTable) { strSessionClass = REMOTE_TABLE; strID = this.add(new TableHolder(this, (RemoteTable)objReturn)); } else if (objReturn instanceof RemoteSession) { strSessionClass = REMOTE_SESSION; strID = this.add(new SessionHolder(this, (RemoteSession)objReturn)); } else if (objReturn instanceof RemoteBaseSession) { strSessionClass = REMOTE_BASE_SESSION; strID = this.add(new BaseSessionHolder(this, (RemoteBaseSession)objReturn)); } if (strID != null) this.setReturnString(out, strSessionClass + CLASS_SEPARATOR + strID); else this.setReturnObject(out, objReturn); }
java
public void setReturnSessionOrObject(PrintWriter out, Object objReturn) { String strID = null; String strSessionClass = null; if (objReturn instanceof RemoteTable) { strSessionClass = REMOTE_TABLE; strID = this.add(new TableHolder(this, (RemoteTable)objReturn)); } else if (objReturn instanceof RemoteSession) { strSessionClass = REMOTE_SESSION; strID = this.add(new SessionHolder(this, (RemoteSession)objReturn)); } else if (objReturn instanceof RemoteBaseSession) { strSessionClass = REMOTE_BASE_SESSION; strID = this.add(new BaseSessionHolder(this, (RemoteBaseSession)objReturn)); } if (strID != null) this.setReturnString(out, strSessionClass + CLASS_SEPARATOR + strID); else this.setReturnObject(out, objReturn); }
[ "public", "void", "setReturnSessionOrObject", "(", "PrintWriter", "out", ",", "Object", "objReturn", ")", "{", "String", "strID", "=", "null", ";", "String", "strSessionClass", "=", "null", ";", "if", "(", "objReturn", "instanceof", "RemoteTable", ")", "{", "s...
If this is a session, convert to a proxy session and return, if object, convert and return. @param out The return output stream. @param strReturn The string to return.
[ "If", "this", "is", "a", "session", "convert", "to", "a", "proxy", "session", "and", "return", "if", "object", "convert", "and", "return", "." ]
train
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/remote/src/main/java/org/jbundle/base/remote/proxy/BaseSessionHolder.java#L99-L122
facebookarchive/hadoop-20
src/core/org/apache/hadoop/record/compiler/CGenerator.java
CGenerator.genCode
void genCode(String name, ArrayList<JFile> ilist, ArrayList<JRecord> rlist, String destDir, ArrayList<String> options) throws IOException { name = new File(destDir, (new File(name)).getName()).getAbsolutePath(); FileWriter cc = new FileWriter(name+".c"); try { FileWriter hh = new FileWriter(name+".h"); try { hh.write("#ifndef __"+name.toUpperCase().replace('.','_')+"__\n"); hh.write("#define __"+name.toUpperCase().replace('.','_')+"__\n"); hh.write("#include \"recordio.h\"\n"); for (Iterator<JFile> iter = ilist.iterator(); iter.hasNext();) { hh.write("#include \""+iter.next().getName()+".h\"\n"); } cc.write("#include \""+name+".h\"\n"); /* for (Iterator<JRecord> iter = rlist.iterator(); iter.hasNext();) { iter.next().genCppCode(hh, cc); } */ hh.write("#endif //"+name.toUpperCase().replace('.','_')+"__\n"); } finally { hh.close(); } } finally { cc.close(); } }
java
void genCode(String name, ArrayList<JFile> ilist, ArrayList<JRecord> rlist, String destDir, ArrayList<String> options) throws IOException { name = new File(destDir, (new File(name)).getName()).getAbsolutePath(); FileWriter cc = new FileWriter(name+".c"); try { FileWriter hh = new FileWriter(name+".h"); try { hh.write("#ifndef __"+name.toUpperCase().replace('.','_')+"__\n"); hh.write("#define __"+name.toUpperCase().replace('.','_')+"__\n"); hh.write("#include \"recordio.h\"\n"); for (Iterator<JFile> iter = ilist.iterator(); iter.hasNext();) { hh.write("#include \""+iter.next().getName()+".h\"\n"); } cc.write("#include \""+name+".h\"\n"); /* for (Iterator<JRecord> iter = rlist.iterator(); iter.hasNext();) { iter.next().genCppCode(hh, cc); } */ hh.write("#endif //"+name.toUpperCase().replace('.','_')+"__\n"); } finally { hh.close(); } } finally { cc.close(); } }
[ "void", "genCode", "(", "String", "name", ",", "ArrayList", "<", "JFile", ">", "ilist", ",", "ArrayList", "<", "JRecord", ">", "rlist", ",", "String", "destDir", ",", "ArrayList", "<", "String", ">", "options", ")", "throws", "IOException", "{", "name", ...
Generate C code. This method only creates the requested file(s) and spits-out file-level elements (such as include statements etc.) record-level code is generated by JRecord.
[ "Generate", "C", "code", ".", "This", "method", "only", "creates", "the", "requested", "file", "(", "s", ")", "and", "spits", "-", "out", "file", "-", "level", "elements", "(", "such", "as", "include", "statements", "etc", ".", ")", "record", "-", "lev...
train
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/core/org/apache/hadoop/record/compiler/CGenerator.java#L40-L70
deeplearning4j/deeplearning4j
deeplearning4j/deeplearning4j-scaleout/spark/dl4j-spark/src/main/java/org/deeplearning4j/spark/util/MLLibUtil.java
MLLibUtil.fromLabeledPoint
public static JavaRDD<DataSet> fromLabeledPoint(JavaRDD<LabeledPoint> data, final long numPossibleLabels) { return fromLabeledPoint(data, numPossibleLabels, false); }
java
public static JavaRDD<DataSet> fromLabeledPoint(JavaRDD<LabeledPoint> data, final long numPossibleLabels) { return fromLabeledPoint(data, numPossibleLabels, false); }
[ "public", "static", "JavaRDD", "<", "DataSet", ">", "fromLabeledPoint", "(", "JavaRDD", "<", "LabeledPoint", ">", "data", ",", "final", "long", "numPossibleLabels", ")", "{", "return", "fromLabeledPoint", "(", "data", ",", "numPossibleLabels", ",", "false", ")",...
Converts JavaRDD labeled points to JavaRDD datasets. @param data JavaRDD LabeledPoints @param numPossibleLabels number of possible labels @return
[ "Converts", "JavaRDD", "labeled", "points", "to", "JavaRDD", "datasets", "." ]
train
https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-scaleout/spark/dl4j-spark/src/main/java/org/deeplearning4j/spark/util/MLLibUtil.java#L347-L349
nguillaumin/slick2d-maven
slick2d-core/src/main/java/org/newdawn/slick/tiled/TiledMap.java
TiledMap.getObjectWidth
public int getObjectWidth(int groupID, int objectID) { if (groupID >= 0 && groupID < objectGroups.size()) { ObjectGroup grp = (ObjectGroup) objectGroups.get(groupID); if (objectID >= 0 && objectID < grp.objects.size()) { GroupObject object = (GroupObject) grp.objects.get(objectID); return object.width; } } return -1; }
java
public int getObjectWidth(int groupID, int objectID) { if (groupID >= 0 && groupID < objectGroups.size()) { ObjectGroup grp = (ObjectGroup) objectGroups.get(groupID); if (objectID >= 0 && objectID < grp.objects.size()) { GroupObject object = (GroupObject) grp.objects.get(objectID); return object.width; } } return -1; }
[ "public", "int", "getObjectWidth", "(", "int", "groupID", ",", "int", "objectID", ")", "{", "if", "(", "groupID", ">=", "0", "&&", "groupID", "<", "objectGroups", ".", "size", "(", ")", ")", "{", "ObjectGroup", "grp", "=", "(", "ObjectGroup", ")", "obj...
Returns the width of a specific object from a specific group. @param groupID Index of a group @param objectID Index of an object @return The width of an object, or -1, when error occurred
[ "Returns", "the", "width", "of", "a", "specific", "object", "from", "a", "specific", "group", "." ]
train
https://github.com/nguillaumin/slick2d-maven/blob/8251f88a0ed6a70e726d2468842455cd1f80893f/slick2d-core/src/main/java/org/newdawn/slick/tiled/TiledMap.java#L886-L895
jscep/jscep
src/main/java/org/jscep/client/Client.java
Client.getCertificate
public CertStore getCertificate(final X509Certificate identity, final PrivateKey key, final BigInteger serial) throws ClientException, OperationFailureException { return getCertificate(identity, key, serial, null); }
java
public CertStore getCertificate(final X509Certificate identity, final PrivateKey key, final BigInteger serial) throws ClientException, OperationFailureException { return getCertificate(identity, key, serial, null); }
[ "public", "CertStore", "getCertificate", "(", "final", "X509Certificate", "identity", ",", "final", "PrivateKey", "key", ",", "final", "BigInteger", "serial", ")", "throws", "ClientException", ",", "OperationFailureException", "{", "return", "getCertificate", "(", "id...
Retrieves the certificate corresponding to the provided serial number. <p> This request relates only to the current CA certificate. If the CA certificate has changed since the requested certificate was issued, this operation will fail. @param identity the identity of the client. @param key the private key to sign the SCEP request. @param serial the serial number of the requested certificate. @return the certificate store containing the requested certificate. @throws ClientException if any client error occurs. @throws OperationFailureException if the SCEP server refuses to service the request.
[ "Retrieves", "the", "certificate", "corresponding", "to", "the", "provided", "serial", "number", ".", "<p", ">", "This", "request", "relates", "only", "to", "the", "current", "CA", "certificate", ".", "If", "the", "CA", "certificate", "has", "changed", "since"...
train
https://github.com/jscep/jscep/blob/d2c602f8b3adb774704c24eaf62f6b8654a40e35/src/main/java/org/jscep/client/Client.java#L495-L499
infinispan/infinispan
core/src/main/java/org/infinispan/io/GridFilesystem.java
GridFilesystem.getOutput
public OutputStream getOutput(GridFile file) throws IOException { checkIsNotDirectory(file); createIfNeeded(file); return new GridOutputStream(file, false, data); }
java
public OutputStream getOutput(GridFile file) throws IOException { checkIsNotDirectory(file); createIfNeeded(file); return new GridOutputStream(file, false, data); }
[ "public", "OutputStream", "getOutput", "(", "GridFile", "file", ")", "throws", "IOException", "{", "checkIsNotDirectory", "(", "file", ")", ";", "createIfNeeded", "(", "file", ")", ";", "return", "new", "GridOutputStream", "(", "file", ",", "false", ",", "data...
Opens an OutputStream for writing to the given file. @param file the file to write to @return an OutputStream for writing to the file @throws IOException if an error occurs
[ "Opens", "an", "OutputStream", "for", "writing", "to", "the", "given", "file", "." ]
train
https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/core/src/main/java/org/infinispan/io/GridFilesystem.java#L132-L136
aws/aws-sdk-java
aws-java-sdk-dynamodb/src/main/java/com/amazonaws/services/dynamodbv2/model/KeysAndAttributes.java
KeysAndAttributes.setKeys
public void setKeys(java.util.Collection<java.util.Map<String, AttributeValue>> keys) { if (keys == null) { this.keys = null; return; } this.keys = new java.util.ArrayList<java.util.Map<String, AttributeValue>>(keys); }
java
public void setKeys(java.util.Collection<java.util.Map<String, AttributeValue>> keys) { if (keys == null) { this.keys = null; return; } this.keys = new java.util.ArrayList<java.util.Map<String, AttributeValue>>(keys); }
[ "public", "void", "setKeys", "(", "java", ".", "util", ".", "Collection", "<", "java", ".", "util", ".", "Map", "<", "String", ",", "AttributeValue", ">", ">", "keys", ")", "{", "if", "(", "keys", "==", "null", ")", "{", "this", ".", "keys", "=", ...
<p> The primary key attribute values that define the items and the attributes associated with the items. </p> @param keys The primary key attribute values that define the items and the attributes associated with the items.
[ "<p", ">", "The", "primary", "key", "attribute", "values", "that", "define", "the", "items", "and", "the", "attributes", "associated", "with", "the", "items", ".", "<", "/", "p", ">" ]
train
https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-dynamodb/src/main/java/com/amazonaws/services/dynamodbv2/model/KeysAndAttributes.java#L166-L173
google/j2objc
jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/UnicodeSet.java
UnicodeSet.applyPattern
public final UnicodeSet applyPattern(String pattern) { checkFrozen(); return applyPattern(pattern, null, null, IGNORE_SPACE); }
java
public final UnicodeSet applyPattern(String pattern) { checkFrozen(); return applyPattern(pattern, null, null, IGNORE_SPACE); }
[ "public", "final", "UnicodeSet", "applyPattern", "(", "String", "pattern", ")", "{", "checkFrozen", "(", ")", ";", "return", "applyPattern", "(", "pattern", ",", "null", ",", "null", ",", "IGNORE_SPACE", ")", ";", "}" ]
Modifies this set to represent the set specified by the given pattern. See the class description for the syntax of the pattern language. Whitespace is ignored. @param pattern a string specifying what characters are in the set @exception java.lang.IllegalArgumentException if the pattern contains a syntax error.
[ "Modifies", "this", "set", "to", "represent", "the", "set", "specified", "by", "the", "given", "pattern", ".", "See", "the", "class", "description", "for", "the", "syntax", "of", "the", "pattern", "language", ".", "Whitespace", "is", "ignored", "." ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/UnicodeSet.java#L544-L547
couchbase/couchbase-java-client
src/main/java/com/couchbase/client/java/util/TransparentReplicaGetHelper.java
TransparentReplicaGetHelper.getFirstPrimaryOrReplica
@InterfaceStability.Experimental @InterfaceAudience.Public public static <D extends Document<?>> Single<D> getFirstPrimaryOrReplica(final String id, final Class<D> target, final Bucket bucket) { return getFirstPrimaryOrReplica(id, target, bucket, bucket.environment().kvTimeout()); }
java
@InterfaceStability.Experimental @InterfaceAudience.Public public static <D extends Document<?>> Single<D> getFirstPrimaryOrReplica(final String id, final Class<D> target, final Bucket bucket) { return getFirstPrimaryOrReplica(id, target, bucket, bucket.environment().kvTimeout()); }
[ "@", "InterfaceStability", ".", "Experimental", "@", "InterfaceAudience", ".", "Public", "public", "static", "<", "D", "extends", "Document", "<", "?", ">", ">", "Single", "<", "D", ">", "getFirstPrimaryOrReplica", "(", "final", "String", "id", ",", "final", ...
Asynchronously fetch the document from the primary and if that operations fails try all the replicas and return the first document that comes back from them (using the environments KV timeout for both primary and replica). @param id the document ID to fetch. @param target the custom document type to use. @param bucket the bucket to use when fetching the doc. @return @return a {@link Single} with either 0 or 1 {@link Document}.
[ "Asynchronously", "fetch", "the", "document", "from", "the", "primary", "and", "if", "that", "operations", "fails", "try", "all", "the", "replicas", "and", "return", "the", "first", "document", "that", "comes", "back", "from", "them", "(", "using", "the", "e...
train
https://github.com/couchbase/couchbase-java-client/blob/f36a0ee0c66923bdde47838ca543e50cbaa99e14/src/main/java/com/couchbase/client/java/util/TransparentReplicaGetHelper.java#L104-L109
astrapi69/jaulp-wicket
jaulp-wicket-annotated-header-contributors/src/main/java/de/alpharogroup/wicket/PackageResourceReferences.java
PackageResourceReferences.addJsFiles
public static void addJsFiles(final IHeaderResponse response, final Class<?> scope, final String... jsFilenames) { for (final String jsFilename : jsFilenames) { final HeaderItem item = JavaScriptHeaderItem .forReference(new PackageResourceReference(scope, jsFilename)); response.render(item); } }
java
public static void addJsFiles(final IHeaderResponse response, final Class<?> scope, final String... jsFilenames) { for (final String jsFilename : jsFilenames) { final HeaderItem item = JavaScriptHeaderItem .forReference(new PackageResourceReference(scope, jsFilename)); response.render(item); } }
[ "public", "static", "void", "addJsFiles", "(", "final", "IHeaderResponse", "response", ",", "final", "Class", "<", "?", ">", "scope", ",", "final", "String", "...", "jsFilenames", ")", "{", "for", "(", "final", "String", "jsFilename", ":", "jsFilenames", ")"...
Adds the given javascript files to the given response object in the given scope. @param response the {@link org.apache.wicket.markup.head.IHeaderResponse} @param scope The scope of the javascript files. @param jsFilenames The javascript file names.
[ "Adds", "the", "given", "javascript", "files", "to", "the", "given", "response", "object", "in", "the", "given", "scope", "." ]
train
https://github.com/astrapi69/jaulp-wicket/blob/85d74368d00abd9bb97659b5794e38c0f8a013d4/jaulp-wicket-annotated-header-contributors/src/main/java/de/alpharogroup/wicket/PackageResourceReferences.java#L80-L89
mygreen/xlsmapper
src/main/java/com/gh/mygreen/xlsmapper/util/PropertyValueNavigator.java
PropertyValueNavigator.getProperty
public Object getProperty(final Object obj, final String property) { ArgUtils.notEmpty(property, "property"); final PropertyPath path = parseProperty(property); Object targetObj = obj; for(Token token : path.getPathAsToken()) { targetObj = accessProperty(targetObj, token); if(targetObj == null && ignoreNull) { return null; } } return targetObj; }
java
public Object getProperty(final Object obj, final String property) { ArgUtils.notEmpty(property, "property"); final PropertyPath path = parseProperty(property); Object targetObj = obj; for(Token token : path.getPathAsToken()) { targetObj = accessProperty(targetObj, token); if(targetObj == null && ignoreNull) { return null; } } return targetObj; }
[ "public", "Object", "getProperty", "(", "final", "Object", "obj", ",", "final", "String", "property", ")", "{", "ArgUtils", ".", "notEmpty", "(", "property", ",", "\"property\"", ")", ";", "final", "PropertyPath", "path", "=", "parseProperty", "(", "property",...
プロパティの値を取得する。 @param obj 取得元となるオブジェクト。 @param property プロパティの式。 @return プロパティの値。 @throws IllegalArgumentException peropety is null or empty. @throws PropertyAccessException 存在しないプロパティを指定した場合など。 @throws NullPointerException アクセスしようとしたプロパティがnullの場合。 ただし、オプション ignoreNull = falseのとき。 @throws IndexOutOfBoundsException リスト、配列にアクセスする際に存在しないインデックスにアクセスした場合。 ただし、オプションignoreNotFoundKey = falseのとき。 @throws IllegalStateException マップにアクセスする際に存在しないキーにアクセスした場合。 ただし、オプションignoreNotFoundKey = falseのとき。
[ "プロパティの値を取得する。" ]
train
https://github.com/mygreen/xlsmapper/blob/a0c6b25c622e5f3a50b199ef685d2ee46ad5483c/src/main/java/com/gh/mygreen/xlsmapper/util/PropertyValueNavigator.java#L130-L146
algolia/algoliasearch-client-java
src/main/java/com/algolia/search/saas/APIClient.java
APIClient.generateSecuredApiKey
public String generateSecuredApiKey(String privateApiKey, Query query, String userToken) throws NoSuchAlgorithmException, InvalidKeyException { if (userToken != null && userToken.length() > 0) { query.setUserToken(userToken); } String queryStr = query.getQueryString(); String key = hmac(privateApiKey, queryStr); return Base64.encodeBase64String(String.format("%s%s", key, queryStr).getBytes(Charset.forName("UTF8"))); }
java
public String generateSecuredApiKey(String privateApiKey, Query query, String userToken) throws NoSuchAlgorithmException, InvalidKeyException { if (userToken != null && userToken.length() > 0) { query.setUserToken(userToken); } String queryStr = query.getQueryString(); String key = hmac(privateApiKey, queryStr); return Base64.encodeBase64String(String.format("%s%s", key, queryStr).getBytes(Charset.forName("UTF8"))); }
[ "public", "String", "generateSecuredApiKey", "(", "String", "privateApiKey", ",", "Query", "query", ",", "String", "userToken", ")", "throws", "NoSuchAlgorithmException", ",", "InvalidKeyException", "{", "if", "(", "userToken", "!=", "null", "&&", "userToken", ".", ...
Generate a secured and public API Key from a query and an optional user token identifying the current user @param privateApiKey your private API Key @param query contains the parameter applied to the query (used as security) @param userToken an optional token identifying the current user
[ "Generate", "a", "secured", "and", "public", "API", "Key", "from", "a", "query", "and", "an", "optional", "user", "token", "identifying", "the", "current", "user" ]
train
https://github.com/algolia/algoliasearch-client-java/blob/a05da2f66c099fe6f77295c7b6a8a12c24e95f9b/src/main/java/com/algolia/search/saas/APIClient.java#L1030-L1038
EvidentSolutions/dalesbred
dalesbred/src/main/java/org/dalesbred/Database.java
Database.withCurrentTransaction
private <T> T withCurrentTransaction(@NotNull SqlQuery query, @NotNull TransactionCallback<T> callback) { SqlQuery oldQuery = DebugContext.getCurrentQuery(); try { DebugContext.setCurrentQuery(query); if (allowImplicitTransactions) { return withTransaction(callback); } else { return transactionManager.withCurrentTransaction(callback, dialect); } } finally { DebugContext.setCurrentQuery(oldQuery); } }
java
private <T> T withCurrentTransaction(@NotNull SqlQuery query, @NotNull TransactionCallback<T> callback) { SqlQuery oldQuery = DebugContext.getCurrentQuery(); try { DebugContext.setCurrentQuery(query); if (allowImplicitTransactions) { return withTransaction(callback); } else { return transactionManager.withCurrentTransaction(callback, dialect); } } finally { DebugContext.setCurrentQuery(oldQuery); } }
[ "private", "<", "T", ">", "T", "withCurrentTransaction", "(", "@", "NotNull", "SqlQuery", "query", ",", "@", "NotNull", "TransactionCallback", "<", "T", ">", "callback", ")", "{", "SqlQuery", "oldQuery", "=", "DebugContext", ".", "getCurrentQuery", "(", ")", ...
Executes the block of code within context of current transaction. If there's no transaction in progress throws {@link NoActiveTransactionException} unless implicit transaction are allowed: in this case, starts a new transaction. @throws NoActiveTransactionException if there's no active transaction. @see #setAllowImplicitTransactions(boolean)
[ "Executes", "the", "block", "of", "code", "within", "context", "of", "current", "transaction", ".", "If", "there", "s", "no", "transaction", "in", "progress", "throws", "{", "@link", "NoActiveTransactionException", "}", "unless", "implicit", "transaction", "are", ...
train
https://github.com/EvidentSolutions/dalesbred/blob/713f5b6e152d97e1672ca68b9ff9c7c6c288ceb1/dalesbred/src/main/java/org/dalesbred/Database.java#L253-L265
rundeck/rundeck
core/src/main/java/com/dtolabs/rundeck/core/execution/ExecutionUtils.java
ExecutionUtils.getMessageLogLevel
public static String getMessageLogLevel(final int level, final String defLevel) { switch (level) { case (Constants.ERR_LEVEL): return Constants.MSG_ERR; case (Constants.DEBUG_LEVEL): return Constants.MSG_DEBUG; case (Constants.INFO_LEVEL): return Constants.MSG_INFO; case (Constants.VERBOSE_LEVEL): return Constants.MSG_VERBOSE; case (Constants.WARN_LEVEL): return Constants.MSG_WARN; default: return defLevel; } }
java
public static String getMessageLogLevel(final int level, final String defLevel) { switch (level) { case (Constants.ERR_LEVEL): return Constants.MSG_ERR; case (Constants.DEBUG_LEVEL): return Constants.MSG_DEBUG; case (Constants.INFO_LEVEL): return Constants.MSG_INFO; case (Constants.VERBOSE_LEVEL): return Constants.MSG_VERBOSE; case (Constants.WARN_LEVEL): return Constants.MSG_WARN; default: return defLevel; } }
[ "public", "static", "String", "getMessageLogLevel", "(", "final", "int", "level", ",", "final", "String", "defLevel", ")", "{", "switch", "(", "level", ")", "{", "case", "(", "Constants", ".", "ERR_LEVEL", ")", ":", "return", "Constants", ".", "MSG_ERR", "...
Get message loglevel string for the integer value @param level integer level @param defLevel default string to return if integer doesn't match @return loglevel string, or the default value
[ "Get", "message", "loglevel", "string", "for", "the", "integer", "value" ]
train
https://github.com/rundeck/rundeck/blob/8070f774f55bffaa1118ff0c03aea319d40a9668/core/src/main/java/com/dtolabs/rundeck/core/execution/ExecutionUtils.java#L44-L59
knowm/XChange
xchange-mercadobitcoin/src/main/java/org/knowm/xchange/mercadobitcoin/MercadoBitcoinAdapters.java
MercadoBitcoinAdapters.adaptOrderBook
public static OrderBook adaptOrderBook( MercadoBitcoinOrderBook mercadoBitcoinOrderBook, CurrencyPair currencyPair) { List<LimitOrder> asks = createOrders(currencyPair, OrderType.ASK, mercadoBitcoinOrderBook.getAsks()); List<LimitOrder> bids = createOrders(currencyPair, OrderType.BID, mercadoBitcoinOrderBook.getBids()); return new OrderBook(null, asks, bids); }
java
public static OrderBook adaptOrderBook( MercadoBitcoinOrderBook mercadoBitcoinOrderBook, CurrencyPair currencyPair) { List<LimitOrder> asks = createOrders(currencyPair, OrderType.ASK, mercadoBitcoinOrderBook.getAsks()); List<LimitOrder> bids = createOrders(currencyPair, OrderType.BID, mercadoBitcoinOrderBook.getBids()); return new OrderBook(null, asks, bids); }
[ "public", "static", "OrderBook", "adaptOrderBook", "(", "MercadoBitcoinOrderBook", "mercadoBitcoinOrderBook", ",", "CurrencyPair", "currencyPair", ")", "{", "List", "<", "LimitOrder", ">", "asks", "=", "createOrders", "(", "currencyPair", ",", "OrderType", ".", "ASK",...
Adapts a org.knowm.xchange.mercadobitcoin.dto.marketdata.OrderBook to a OrderBook Object @param currencyPair (e.g. BTC/BRL or LTC/BRL) @return The XChange OrderBook
[ "Adapts", "a", "org", ".", "knowm", ".", "xchange", ".", "mercadobitcoin", ".", "dto", ".", "marketdata", ".", "OrderBook", "to", "a", "OrderBook", "Object" ]
train
https://github.com/knowm/XChange/blob/e45f437ac8e0b89cd66cdcb3258bdb1bf3d88186/xchange-mercadobitcoin/src/main/java/org/knowm/xchange/mercadobitcoin/MercadoBitcoinAdapters.java#L51-L59
DV8FromTheWorld/JDA
src/main/java/net/dv8tion/jda/core/managers/GuildController.java
GuildController.transferOwnership
@CheckReturnValue public AuditableRestAction<Void> transferOwnership(Member newOwner) { Checks.notNull(newOwner, "Member"); checkGuild(newOwner.getGuild(), "Member"); if (!getGuild().getOwner().equals(getGuild().getSelfMember())) throw new PermissionException("The logged in account must be the owner of this Guild to be able to transfer ownership"); Checks.check(!getGuild().getSelfMember().equals(newOwner), "The member provided as the newOwner is the currently logged in account. Provide a different member to give ownership to."); Checks.check(!newOwner.getUser().isBot(), "Cannot transfer ownership of a Guild to a Bot!"); JSONObject body = new JSONObject().put("owner_id", newOwner.getUser().getId()); Route.CompiledRoute route = Route.Guilds.MODIFY_GUILD.compile(getGuild().getId()); return new AuditableRestAction<Void>(getGuild().getJDA(), route, body) { @Override protected void handleResponse(Response response, Request<Void> request) { if (response.isOk()) request.onSuccess(null); else request.onFailure(response); } }; }
java
@CheckReturnValue public AuditableRestAction<Void> transferOwnership(Member newOwner) { Checks.notNull(newOwner, "Member"); checkGuild(newOwner.getGuild(), "Member"); if (!getGuild().getOwner().equals(getGuild().getSelfMember())) throw new PermissionException("The logged in account must be the owner of this Guild to be able to transfer ownership"); Checks.check(!getGuild().getSelfMember().equals(newOwner), "The member provided as the newOwner is the currently logged in account. Provide a different member to give ownership to."); Checks.check(!newOwner.getUser().isBot(), "Cannot transfer ownership of a Guild to a Bot!"); JSONObject body = new JSONObject().put("owner_id", newOwner.getUser().getId()); Route.CompiledRoute route = Route.Guilds.MODIFY_GUILD.compile(getGuild().getId()); return new AuditableRestAction<Void>(getGuild().getJDA(), route, body) { @Override protected void handleResponse(Response response, Request<Void> request) { if (response.isOk()) request.onSuccess(null); else request.onFailure(response); } }; }
[ "@", "CheckReturnValue", "public", "AuditableRestAction", "<", "Void", ">", "transferOwnership", "(", "Member", "newOwner", ")", "{", "Checks", ".", "notNull", "(", "newOwner", ",", "\"Member\"", ")", ";", "checkGuild", "(", "newOwner", ".", "getGuild", "(", "...
Transfers the Guild ownership to the specified {@link net.dv8tion.jda.core.entities.Member Member} <br>Only available if the currently logged in account is the owner of this Guild <p>Possible {@link net.dv8tion.jda.core.requests.ErrorResponse ErrorResponses} caused by the returned {@link net.dv8tion.jda.core.requests.RestAction RestAction} include the following: <ul> <li>{@link net.dv8tion.jda.core.requests.ErrorResponse#MISSING_PERMISSIONS MISSING_PERMISSIONS} <br>The currently logged in account lost ownership before completing the task</li> <li>{@link net.dv8tion.jda.core.requests.ErrorResponse#MISSING_ACCESS MISSING_ACCESS} <br>We were removed from the Guild before finishing the task</li> <li>{@link net.dv8tion.jda.core.requests.ErrorResponse#UNKNOWN_MEMBER UNKNOWN_MEMBER} <br>The target Member was removed from the Guild before finishing the task</li> </ul> @param newOwner Not-null Member to transfer ownership to @throws net.dv8tion.jda.core.exceptions.PermissionException If the currently logged in account is not the owner of this Guild @throws IllegalArgumentException <ul> <li>If the specified Member is {@code null} or not from the same Guild</li> <li>If the specified Member already is the Guild owner</li> <li>If the specified Member is a bot account ({@link net.dv8tion.jda.core.AccountType#BOT AccountType.BOT})</li> </ul> @return {@link net.dv8tion.jda.core.requests.restaction.AuditableRestAction AuditableRestAction}
[ "Transfers", "the", "Guild", "ownership", "to", "the", "specified", "{", "@link", "net", ".", "dv8tion", ".", "jda", ".", "core", ".", "entities", ".", "Member", "Member", "}", "<br", ">", "Only", "available", "if", "the", "currently", "logged", "in", "a...
train
https://github.com/DV8FromTheWorld/JDA/blob/8ecbbe354d03f6bf448411bba573d0d4c268b560/src/main/java/net/dv8tion/jda/core/managers/GuildController.java#L1706-L1732
ansell/csvstream
src/main/java/com/github/ansell/csv/stream/CSVStream.java
CSVStream.newCSVWriter
public static SequenceWriter newCSVWriter(final Writer writer, CsvSchema schema) throws IOException { return defaultMapper().writerWithDefaultPrettyPrinter().with(schema).forType(List.class).writeValues(writer); }
java
public static SequenceWriter newCSVWriter(final Writer writer, CsvSchema schema) throws IOException { return defaultMapper().writerWithDefaultPrettyPrinter().with(schema).forType(List.class).writeValues(writer); }
[ "public", "static", "SequenceWriter", "newCSVWriter", "(", "final", "Writer", "writer", ",", "CsvSchema", "schema", ")", "throws", "IOException", "{", "return", "defaultMapper", "(", ")", ".", "writerWithDefaultPrettyPrinter", "(", ")", ".", "with", "(", "schema",...
Returns a Jackson {@link SequenceWriter} which will write CSV lines to the given {@link Writer} using the {@link CsvSchema}. @param writer The writer which will receive the CSV file. @param schema The {@link CsvSchema} that will be used by the returned Jackson {@link SequenceWriter}. @return A Jackson {@link SequenceWriter} that can have {@link SequenceWriter#write(Object)} called on it to emit CSV lines to the given {@link Writer}. @throws IOException If there is a problem writing the CSV header line to the {@link Writer}.
[ "Returns", "a", "Jackson", "{", "@link", "SequenceWriter", "}", "which", "will", "write", "CSV", "lines", "to", "the", "given", "{", "@link", "Writer", "}", "using", "the", "{", "@link", "CsvSchema", "}", "." ]
train
https://github.com/ansell/csvstream/blob/9468bfbd6997fbc4237eafc990ba811cd5905dc1/src/main/java/com/github/ansell/csv/stream/CSVStream.java#L538-L540
Ordinastie/MalisisCore
src/main/java/net/malisis/core/block/component/DirectionalComponent.java
DirectionalComponent.getMetaFromState
@Override public int getMetaFromState(Block block, IBlockState state) { if (getProperty() == HORIZONTAL) return getDirection(state).getHorizontalIndex(); else return getDirection(state).getIndex(); }
java
@Override public int getMetaFromState(Block block, IBlockState state) { if (getProperty() == HORIZONTAL) return getDirection(state).getHorizontalIndex(); else return getDirection(state).getIndex(); }
[ "@", "Override", "public", "int", "getMetaFromState", "(", "Block", "block", ",", "IBlockState", "state", ")", "{", "if", "(", "getProperty", "(", ")", "==", "HORIZONTAL", ")", "return", "getDirection", "(", "state", ")", ".", "getHorizontalIndex", "(", ")",...
Gets the metadata from the {@link IBlockState}. @param block the block @param state the state @return the meta from state
[ "Gets", "the", "metadata", "from", "the", "{", "@link", "IBlockState", "}", "." ]
train
https://github.com/Ordinastie/MalisisCore/blob/4f8e1fa462d5c372fc23414482ba9f429881cc54/src/main/java/net/malisis/core/block/component/DirectionalComponent.java#L174-L181
rometools/rome
rome/src/main/java/com/rometools/rome/io/impl/DCModuleGenerator.java
DCModuleGenerator.generateSubjectElement
protected final Element generateSubjectElement(final DCSubject subject) { final Element subjectElement = new Element("subject", getDCNamespace()); final String taxonomyUri = subject.getTaxonomyUri(); final String value = subject.getValue(); if (taxonomyUri != null) { final Attribute resourceAttribute = new Attribute("resource", taxonomyUri, getRDFNamespace()); final Element topicElement = new Element("topic", getTaxonomyNamespace()); topicElement.setAttribute(resourceAttribute); final Element descriptionElement = new Element("Description", getRDFNamespace()); descriptionElement.addContent(topicElement); if (value != null) { final Element valueElement = new Element("value", getRDFNamespace()); valueElement.addContent(value); descriptionElement.addContent(valueElement); } subjectElement.addContent(descriptionElement); } else { subjectElement.addContent(value); } return subjectElement; }
java
protected final Element generateSubjectElement(final DCSubject subject) { final Element subjectElement = new Element("subject", getDCNamespace()); final String taxonomyUri = subject.getTaxonomyUri(); final String value = subject.getValue(); if (taxonomyUri != null) { final Attribute resourceAttribute = new Attribute("resource", taxonomyUri, getRDFNamespace()); final Element topicElement = new Element("topic", getTaxonomyNamespace()); topicElement.setAttribute(resourceAttribute); final Element descriptionElement = new Element("Description", getRDFNamespace()); descriptionElement.addContent(topicElement); if (value != null) { final Element valueElement = new Element("value", getRDFNamespace()); valueElement.addContent(value); descriptionElement.addContent(valueElement); } subjectElement.addContent(descriptionElement); } else { subjectElement.addContent(value); } return subjectElement; }
[ "protected", "final", "Element", "generateSubjectElement", "(", "final", "DCSubject", "subject", ")", "{", "final", "Element", "subjectElement", "=", "new", "Element", "(", "\"subject\"", ",", "getDCNamespace", "(", ")", ")", ";", "final", "String", "taxonomyUri",...
Utility method to generate an element for a subject. <p> @param subject the subject to generate an element for. @return the element for the subject.
[ "Utility", "method", "to", "generate", "an", "element", "for", "a", "subject", ".", "<p", ">" ]
train
https://github.com/rometools/rome/blob/5fcf0b1a9a6cdedbe253a45ad9468c54a0f97010/rome/src/main/java/com/rometools/rome/io/impl/DCModuleGenerator.java#L189-L219
cycorp/api-suite
core-api/src/main/java/com/cyc/query/exception/QueryConstructionException.java
QueryConstructionException.fromThrowable
public static QueryConstructionException fromThrowable(String message, Throwable cause) { return (cause instanceof QueryConstructionException && Objects.equals(message, cause.getMessage())) ? (QueryConstructionException) cause : new QueryConstructionException(message, cause); }
java
public static QueryConstructionException fromThrowable(String message, Throwable cause) { return (cause instanceof QueryConstructionException && Objects.equals(message, cause.getMessage())) ? (QueryConstructionException) cause : new QueryConstructionException(message, cause); }
[ "public", "static", "QueryConstructionException", "fromThrowable", "(", "String", "message", ",", "Throwable", "cause", ")", "{", "return", "(", "cause", "instanceof", "QueryConstructionException", "&&", "Objects", ".", "equals", "(", "message", ",", "cause", ".", ...
Converts a Throwable to a QueryConstructionException with the specified detail message. If the Throwable is a QueryConstructionException and if the Throwable's message is identical to the one supplied, the Throwable will be passed through unmodified; otherwise, it will be wrapped in a new QueryConstructionException with the detail message. @param cause the Throwable to convert @param message the specified detail message @return a QueryConstructionException
[ "Converts", "a", "Throwable", "to", "a", "QueryConstructionException", "with", "the", "specified", "detail", "message", ".", "If", "the", "Throwable", "is", "a", "QueryConstructionException", "and", "if", "the", "Throwable", "s", "message", "is", "identical", "to"...
train
https://github.com/cycorp/api-suite/blob/1d52affabc4635e3715a059e38741712cbdbf2d5/core-api/src/main/java/com/cyc/query/exception/QueryConstructionException.java#L61-L65
jbossas/jboss-vfs
src/main/java/org/jboss/vfs/VFS.java
VFS.mountAssembly
public static Closeable mountAssembly(VirtualFileAssembly assembly, VirtualFile mountPoint) throws IOException { return doMount(new AssemblyFileSystem(assembly), mountPoint); }
java
public static Closeable mountAssembly(VirtualFileAssembly assembly, VirtualFile mountPoint) throws IOException { return doMount(new AssemblyFileSystem(assembly), mountPoint); }
[ "public", "static", "Closeable", "mountAssembly", "(", "VirtualFileAssembly", "assembly", ",", "VirtualFile", "mountPoint", ")", "throws", "IOException", "{", "return", "doMount", "(", "new", "AssemblyFileSystem", "(", "assembly", ")", ",", "mountPoint", ")", ";", ...
Create and mount an assembly file system, returning a single handle which will unmount and close the filesystem when closed. @param assembly an {@link VirtualFileAssembly} to mount in the VFS @param mountPoint the point at which the filesystem should be mounted @return a handle @throws IOException if an error occurs
[ "Create", "and", "mount", "an", "assembly", "file", "system", "returning", "a", "single", "handle", "which", "will", "unmount", "and", "close", "the", "filesystem", "when", "closed", "." ]
train
https://github.com/jbossas/jboss-vfs/blob/420f4b896d6178ee5f6758f3421e9f350d2b8ab5/src/main/java/org/jboss/vfs/VFS.java#L503-L505
apache/spark
sql/core/src/main/java/org/apache/spark/sql/execution/datasources/parquet/VectorizedRleValuesReader.java
VectorizedRleValuesReader.readIntegers
@Override public void readIntegers(int total, WritableColumnVector c, int rowId) { int left = total; while (left > 0) { if (this.currentCount == 0) this.readNextGroup(); int n = Math.min(left, this.currentCount); switch (mode) { case RLE: c.putInts(rowId, n, currentValue); break; case PACKED: c.putInts(rowId, n, currentBuffer, currentBufferIdx); currentBufferIdx += n; break; } rowId += n; left -= n; currentCount -= n; } }
java
@Override public void readIntegers(int total, WritableColumnVector c, int rowId) { int left = total; while (left > 0) { if (this.currentCount == 0) this.readNextGroup(); int n = Math.min(left, this.currentCount); switch (mode) { case RLE: c.putInts(rowId, n, currentValue); break; case PACKED: c.putInts(rowId, n, currentBuffer, currentBufferIdx); currentBufferIdx += n; break; } rowId += n; left -= n; currentCount -= n; } }
[ "@", "Override", "public", "void", "readIntegers", "(", "int", "total", ",", "WritableColumnVector", "c", ",", "int", "rowId", ")", "{", "int", "left", "=", "total", ";", "while", "(", "left", ">", "0", ")", "{", "if", "(", "this", ".", "currentCount",...
Since this is only used to decode dictionary IDs, only decoding integers is supported.
[ "Since", "this", "is", "only", "used", "to", "decode", "dictionary", "IDs", "only", "decoding", "integers", "is", "supported", "." ]
train
https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/sql/core/src/main/java/org/apache/spark/sql/execution/datasources/parquet/VectorizedRleValuesReader.java#L490-L509
jboss/jboss-jstl-api_spec
src/main/java/org/apache/taglibs/standard/tag/el/core/ExpressionUtil.java
ExpressionUtil.evalNotNull
public static Object evalNotNull(String tagName, String attributeName, String expression, Class expectedType, Tag tag, PageContext pageContext) throws JspException { if (expression != null) { Object r = ExpressionEvaluatorManager.evaluate( attributeName, expression, expectedType, tag, pageContext); if (r == null) { throw new NullAttributeException(tagName, attributeName); } return r; } else { return null; } }
java
public static Object evalNotNull(String tagName, String attributeName, String expression, Class expectedType, Tag tag, PageContext pageContext) throws JspException { if (expression != null) { Object r = ExpressionEvaluatorManager.evaluate( attributeName, expression, expectedType, tag, pageContext); if (r == null) { throw new NullAttributeException(tagName, attributeName); } return r; } else { return null; } }
[ "public", "static", "Object", "evalNotNull", "(", "String", "tagName", ",", "String", "attributeName", ",", "String", "expression", ",", "Class", "expectedType", ",", "Tag", "tag", ",", "PageContext", "pageContext", ")", "throws", "JspException", "{", "if", "(",...
Evaluates an expression if present, but does not allow the expression to evaluate to 'null', throwing a NullAttributeException if it does. The function <b>can</b> return null, however, if the expression itself is null.
[ "Evaluates", "an", "expression", "if", "present", "but", "does", "not", "allow", "the", "expression", "to", "evaluate", "to", "null", "throwing", "a", "NullAttributeException", "if", "it", "does", ".", "The", "function", "<b", ">", "can<", "/", "b", ">", "...
train
https://github.com/jboss/jboss-jstl-api_spec/blob/4ad412ae5be1ae606b8d33c188cb3d98bfcbe84c/src/main/java/org/apache/taglibs/standard/tag/el/core/ExpressionUtil.java#L42-L59
datacleaner/DataCleaner
desktop/api/src/main/java/org/datacleaner/widgets/ComboButton.java
ComboButton.addButton
public void addButton(final AbstractButton button) { WidgetUtils.setDefaultButtonStyle(button); final EmptyBorder baseBorder = new EmptyBorder(WidgetUtils.BORDER_WIDE_WIDTH - 1, 9, WidgetUtils.BORDER_WIDE_WIDTH - 1, 9); if (getComponentCount() == 0) { button.setBorder(baseBorder); } else { final Component lastComponent = getComponent(getComponentCount() - 1); if (lastComponent instanceof AbstractButton) { // previous component was also a button - add a line on the left // side final Border outsideBorder = new MatteBorder(0, 1, 0, 0, WidgetUtils.BG_COLOR_LESS_BRIGHT); button.setBorder(new CompoundBorder(outsideBorder, baseBorder)); } else { button.setBorder(baseBorder); } } button.setOpaque(false); _buttons.add(button); add(button); }
java
public void addButton(final AbstractButton button) { WidgetUtils.setDefaultButtonStyle(button); final EmptyBorder baseBorder = new EmptyBorder(WidgetUtils.BORDER_WIDE_WIDTH - 1, 9, WidgetUtils.BORDER_WIDE_WIDTH - 1, 9); if (getComponentCount() == 0) { button.setBorder(baseBorder); } else { final Component lastComponent = getComponent(getComponentCount() - 1); if (lastComponent instanceof AbstractButton) { // previous component was also a button - add a line on the left // side final Border outsideBorder = new MatteBorder(0, 1, 0, 0, WidgetUtils.BG_COLOR_LESS_BRIGHT); button.setBorder(new CompoundBorder(outsideBorder, baseBorder)); } else { button.setBorder(baseBorder); } } button.setOpaque(false); _buttons.add(button); add(button); }
[ "public", "void", "addButton", "(", "final", "AbstractButton", "button", ")", "{", "WidgetUtils", ".", "setDefaultButtonStyle", "(", "button", ")", ";", "final", "EmptyBorder", "baseBorder", "=", "new", "EmptyBorder", "(", "WidgetUtils", ".", "BORDER_WIDE_WIDTH", ...
Adds a button to this {@link ComboButton}. Beware that this method does change the styling (colors, borders etc.) of the button to make it fit the {@link ComboButton}. @param button
[ "Adds", "a", "button", "to", "this", "{", "@link", "ComboButton", "}", ".", "Beware", "that", "this", "method", "does", "change", "the", "styling", "(", "colors", "borders", "etc", ".", ")", "of", "the", "button", "to", "make", "it", "fit", "the", "{",...
train
https://github.com/datacleaner/DataCleaner/blob/9aa01fdac3560cef51c55df3cb2ac5c690b57639/desktop/api/src/main/java/org/datacleaner/widgets/ComboButton.java#L125-L146
micronaut-projects/micronaut-core
cli/src/main/groovy/io/micronaut/cli/io/support/AntPathMatcher.java
AntPathMatcher.countOccurrencesOf
public static int countOccurrencesOf(String str, String sub) { if (str == null || sub == null || str.length() == 0 || sub.length() == 0) { return 0; } int count = 0; int pos = 0; int idx; while ((idx = str.indexOf(sub, pos)) != -1) { ++count; pos = idx + sub.length(); } return count; }
java
public static int countOccurrencesOf(String str, String sub) { if (str == null || sub == null || str.length() == 0 || sub.length() == 0) { return 0; } int count = 0; int pos = 0; int idx; while ((idx = str.indexOf(sub, pos)) != -1) { ++count; pos = idx + sub.length(); } return count; }
[ "public", "static", "int", "countOccurrencesOf", "(", "String", "str", ",", "String", "sub", ")", "{", "if", "(", "str", "==", "null", "||", "sub", "==", "null", "||", "str", ".", "length", "(", ")", "==", "0", "||", "sub", ".", "length", "(", ")",...
Count the occurrences of the substring in string s. @param str string to search in. Return 0 if this is null. @param sub string to search for. Return 0 if this is null. @return The number of occurrences
[ "Count", "the", "occurrences", "of", "the", "substring", "in", "string", "s", "." ]
train
https://github.com/micronaut-projects/micronaut-core/blob/c31f5b03ce0eb88c2f6470710987db03b8967d5c/cli/src/main/groovy/io/micronaut/cli/io/support/AntPathMatcher.java#L410-L422
Azure/azure-sdk-for-java
cognitiveservices/data-plane/language/luis/authoring/src/main/java/com/microsoft/azure/cognitiveservices/language/luis/authoring/implementation/PatternsImpl.java
PatternsImpl.updatePattern
public PatternRuleInfo updatePattern(UUID appId, String versionId, UUID patternId, PatternRuleUpdateObject pattern) { return updatePatternWithServiceResponseAsync(appId, versionId, patternId, pattern).toBlocking().single().body(); }
java
public PatternRuleInfo updatePattern(UUID appId, String versionId, UUID patternId, PatternRuleUpdateObject pattern) { return updatePatternWithServiceResponseAsync(appId, versionId, patternId, pattern).toBlocking().single().body(); }
[ "public", "PatternRuleInfo", "updatePattern", "(", "UUID", "appId", ",", "String", "versionId", ",", "UUID", "patternId", ",", "PatternRuleUpdateObject", "pattern", ")", "{", "return", "updatePatternWithServiceResponseAsync", "(", "appId", ",", "versionId", ",", "patt...
Updates a pattern. @param appId The application ID. @param versionId The version ID. @param patternId The pattern ID. @param pattern An object representing a pattern. @throws IllegalArgumentException thrown if parameters fail the validation @throws ErrorResponseException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent @return the PatternRuleInfo object if successful.
[ "Updates", "a", "pattern", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/cognitiveservices/data-plane/language/luis/authoring/src/main/java/com/microsoft/azure/cognitiveservices/language/luis/authoring/implementation/PatternsImpl.java#L661-L663
Graylog2/graylog2-server
graylog2-server/src/main/java/org/graylog2/lookup/adapters/dnslookup/DnsClient.java
DnsClient.parseReverseLookupDomain
public static void parseReverseLookupDomain(PtrDnsAnswer.Builder dnsAnswerBuilder, String hostname) { dnsAnswerBuilder.fullDomain(hostname); final InternetDomainName internetDomainName = InternetDomainName.from(hostname); if (internetDomainName.hasPublicSuffix()) { // Use Guava to extract domain name. final InternetDomainName topDomainName = internetDomainName.topDomainUnderRegistrySuffix(); dnsAnswerBuilder.domain(topDomainName.toString()); } else { /* Manually extract domain name. * Eg. for hostname test.some-domain.com, only some-domain.com will be extracted. */ String[] split = hostname.split("\\."); if (split.length > 1) { dnsAnswerBuilder.domain(split[split.length - 2] + "." + split[split.length - 1]); } else if (split.length == 1) { dnsAnswerBuilder.domain(hostname); // Domain is a single word with no dots. } else { dnsAnswerBuilder.domain(""); // Domain is blank. } } }
java
public static void parseReverseLookupDomain(PtrDnsAnswer.Builder dnsAnswerBuilder, String hostname) { dnsAnswerBuilder.fullDomain(hostname); final InternetDomainName internetDomainName = InternetDomainName.from(hostname); if (internetDomainName.hasPublicSuffix()) { // Use Guava to extract domain name. final InternetDomainName topDomainName = internetDomainName.topDomainUnderRegistrySuffix(); dnsAnswerBuilder.domain(topDomainName.toString()); } else { /* Manually extract domain name. * Eg. for hostname test.some-domain.com, only some-domain.com will be extracted. */ String[] split = hostname.split("\\."); if (split.length > 1) { dnsAnswerBuilder.domain(split[split.length - 2] + "." + split[split.length - 1]); } else if (split.length == 1) { dnsAnswerBuilder.domain(hostname); // Domain is a single word with no dots. } else { dnsAnswerBuilder.domain(""); // Domain is blank. } } }
[ "public", "static", "void", "parseReverseLookupDomain", "(", "PtrDnsAnswer", ".", "Builder", "dnsAnswerBuilder", ",", "String", "hostname", ")", "{", "dnsAnswerBuilder", ".", "fullDomain", "(", "hostname", ")", ";", "final", "InternetDomainName", "internetDomainName", ...
Extract the domain name (without subdomain). The Guava {@link InternetDomainName} implementation provides a method to correctly handle this (and handles special cases for TLDs with multiple names. eg. for lb01.store.amazon.co.uk, only amazon.co.uk would be extracted). It uses https://publicsuffix.org behind the scenes. <p> Some domains (eg. completely randomly defined PTR domains) are not considered to have a public suffix according to Guava. For those, the only option is to manually extract the domain with string operations. This should be a rare case.
[ "Extract", "the", "domain", "name", "(", "without", "subdomain", ")", ".", "The", "Guava", "{" ]
train
https://github.com/Graylog2/graylog2-server/blob/50b565dcead6e0a372236d5c2f8530dc5726fa9b/graylog2-server/src/main/java/org/graylog2/lookup/adapters/dnslookup/DnsClient.java#L282-L305
btaz/data-util
src/main/java/com/btaz/util/collections/Sets.java
Sets.isSuperset
public static <T> boolean isSuperset(Set<T> setA, Set<T> setB) { return setA.containsAll(setB); }
java
public static <T> boolean isSuperset(Set<T> setA, Set<T> setB) { return setA.containsAll(setB); }
[ "public", "static", "<", "T", ">", "boolean", "isSuperset", "(", "Set", "<", "T", ">", "setA", ",", "Set", "<", "T", ">", "setB", ")", "{", "return", "setA", ".", "containsAll", "(", "setB", ")", ";", "}" ]
This method returns true if set A is a superset of set B i.e. it answers the question if A contains all items from B @param setA set A @param setB set B @param <T> type @return {@code boolean} true if A is a superset of B
[ "This", "method", "returns", "true", "if", "set", "A", "is", "a", "superset", "of", "set", "B", "i", ".", "e", ".", "it", "answers", "the", "question", "if", "A", "contains", "all", "items", "from", "B" ]
train
https://github.com/btaz/data-util/blob/f01de64854c456a88a31ffbe8bac6d605151b496/src/main/java/com/btaz/util/collections/Sets.java#L139-L141
redkale/redkale
src/org/redkale/boot/ClassFilter.java
ClassFilter.accept
@SuppressWarnings("unchecked") public boolean accept(AnyValue property, Class clazz, boolean autoscan) { if (this.refused || !Modifier.isPublic(clazz.getModifiers())) return false; if (annotationClass != null && clazz.getAnnotation(annotationClass) == null) return false; boolean rs = superClass == null || (clazz != superClass && superClass.isAssignableFrom(clazz)); if (rs && this.excludeSuperClasses != null && this.excludeSuperClasses.length > 0) { for (Class c : this.excludeSuperClasses) { if (c != null && (clazz == c || c.isAssignableFrom(clazz))) return false; } } return rs; }
java
@SuppressWarnings("unchecked") public boolean accept(AnyValue property, Class clazz, boolean autoscan) { if (this.refused || !Modifier.isPublic(clazz.getModifiers())) return false; if (annotationClass != null && clazz.getAnnotation(annotationClass) == null) return false; boolean rs = superClass == null || (clazz != superClass && superClass.isAssignableFrom(clazz)); if (rs && this.excludeSuperClasses != null && this.excludeSuperClasses.length > 0) { for (Class c : this.excludeSuperClasses) { if (c != null && (clazz == c || c.isAssignableFrom(clazz))) return false; } } return rs; }
[ "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "public", "boolean", "accept", "(", "AnyValue", "property", ",", "Class", "clazz", ",", "boolean", "autoscan", ")", "{", "if", "(", "this", ".", "refused", "||", "!", "Modifier", ".", "isPublic", "(", "cl...
判断class是否有效 @param property AnyValue @param clazz Class @param autoscan boolean @return boolean
[ "判断class是否有效" ]
train
https://github.com/redkale/redkale/blob/ea5169b5c5ea7412fd762331c0c497165832e901/src/org/redkale/boot/ClassFilter.java#L277-L288
xmlunit/xmlunit
xmlunit-core/src/main/java/org/xmlunit/util/Convert.java
Convert.toInputSource
public static InputSource toInputSource(Source s, TransformerFactory fac) { try { InputSource is = SAXSource.sourceToInputSource(s); if (is == null) { ByteArrayOutputStream bos = new ByteArrayOutputStream(); StreamResult r = new StreamResult(bos); if (fac == null) { fac = TransformerFactoryConfigurer.NoExternalAccess.configure(TransformerFactory.newInstance()); } Transformer t = fac.newTransformer(); t.transform(s, r); s = new StreamSource(new ByteArrayInputStream(bos .toByteArray())); is = SAXSource.sourceToInputSource(s); } return is; } catch (javax.xml.transform.TransformerConfigurationException e) { throw new ConfigurationException(e); } catch (javax.xml.transform.TransformerException e) { throw new XMLUnitException(e); } }
java
public static InputSource toInputSource(Source s, TransformerFactory fac) { try { InputSource is = SAXSource.sourceToInputSource(s); if (is == null) { ByteArrayOutputStream bos = new ByteArrayOutputStream(); StreamResult r = new StreamResult(bos); if (fac == null) { fac = TransformerFactoryConfigurer.NoExternalAccess.configure(TransformerFactory.newInstance()); } Transformer t = fac.newTransformer(); t.transform(s, r); s = new StreamSource(new ByteArrayInputStream(bos .toByteArray())); is = SAXSource.sourceToInputSource(s); } return is; } catch (javax.xml.transform.TransformerConfigurationException e) { throw new ConfigurationException(e); } catch (javax.xml.transform.TransformerException e) { throw new XMLUnitException(e); } }
[ "public", "static", "InputSource", "toInputSource", "(", "Source", "s", ",", "TransformerFactory", "fac", ")", "{", "try", "{", "InputSource", "is", "=", "SAXSource", ".", "sourceToInputSource", "(", "s", ")", ";", "if", "(", "is", "==", "null", ")", "{", ...
Creates a SAX InputSource from a TraX Source. <p>May use an XSLT identity transformation if SAXSource cannot convert it directly.</p> @param s the source to convert @param fac the TransformerFactory to use, will use the defaul factory if the value is null.
[ "Creates", "a", "SAX", "InputSource", "from", "a", "TraX", "Source", "." ]
train
https://github.com/xmlunit/xmlunit/blob/fe3d701d43f57ee83dcba336e4c1555619d3084b/xmlunit-core/src/main/java/org/xmlunit/util/Convert.java#L68-L89
google/error-prone-javac
src/jdk.compiler/share/classes/com/sun/tools/javac/parser/JavacParser.java
JavacParser.classDeclaration
protected JCClassDecl classDeclaration(JCModifiers mods, Comment dc) { int pos = token.pos; accept(CLASS); Name name = ident(); List<JCTypeParameter> typarams = typeParametersOpt(); JCExpression extending = null; if (token.kind == EXTENDS) { nextToken(); extending = parseType(); } List<JCExpression> implementing = List.nil(); if (token.kind == IMPLEMENTS) { nextToken(); implementing = typeList(); } List<JCTree> defs = classOrInterfaceBody(name, false); JCClassDecl result = toP(F.at(pos).ClassDef( mods, name, typarams, extending, implementing, defs)); attach(result, dc); return result; }
java
protected JCClassDecl classDeclaration(JCModifiers mods, Comment dc) { int pos = token.pos; accept(CLASS); Name name = ident(); List<JCTypeParameter> typarams = typeParametersOpt(); JCExpression extending = null; if (token.kind == EXTENDS) { nextToken(); extending = parseType(); } List<JCExpression> implementing = List.nil(); if (token.kind == IMPLEMENTS) { nextToken(); implementing = typeList(); } List<JCTree> defs = classOrInterfaceBody(name, false); JCClassDecl result = toP(F.at(pos).ClassDef( mods, name, typarams, extending, implementing, defs)); attach(result, dc); return result; }
[ "protected", "JCClassDecl", "classDeclaration", "(", "JCModifiers", "mods", ",", "Comment", "dc", ")", "{", "int", "pos", "=", "token", ".", "pos", ";", "accept", "(", "CLASS", ")", ";", "Name", "name", "=", "ident", "(", ")", ";", "List", "<", "JCType...
ClassDeclaration = CLASS Ident TypeParametersOpt [EXTENDS Type] [IMPLEMENTS TypeList] ClassBody @param mods The modifiers starting the class declaration @param dc The documentation comment for the class, or null.
[ "ClassDeclaration", "=", "CLASS", "Ident", "TypeParametersOpt", "[", "EXTENDS", "Type", "]", "[", "IMPLEMENTS", "TypeList", "]", "ClassBody" ]
train
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/parser/JavacParser.java#L3381-L3403
cache2k/cache2k
cache2k-core/src/main/java/org/cache2k/impl/xmlConfiguration/CacheConfigurationProviderImpl.java
CacheConfigurationProviderImpl.handleBean
private boolean handleBean( final ConfigurationContext ctx, final Class<?> _type, final Object cfg, final ParsedConfiguration _parsedCfg) { String _containerName = _parsedCfg.getContainer(); BeanPropertyMutator m = provideMutator(cfg.getClass()); Class<?> _targetType = m.getType(_containerName); if (_targetType == null) { return false; } if (!_targetType.isAssignableFrom(_type)) { throw new ConfigurationException("Type mismatch, expected: '" + _targetType.getName() + "'", _parsedCfg); } Object _bean = createBeanAndApplyConfiguration(ctx, _type, _parsedCfg); mutateAndCatch(cfg, m, _containerName, _bean, _parsedCfg, _bean); return true; }
java
private boolean handleBean( final ConfigurationContext ctx, final Class<?> _type, final Object cfg, final ParsedConfiguration _parsedCfg) { String _containerName = _parsedCfg.getContainer(); BeanPropertyMutator m = provideMutator(cfg.getClass()); Class<?> _targetType = m.getType(_containerName); if (_targetType == null) { return false; } if (!_targetType.isAssignableFrom(_type)) { throw new ConfigurationException("Type mismatch, expected: '" + _targetType.getName() + "'", _parsedCfg); } Object _bean = createBeanAndApplyConfiguration(ctx, _type, _parsedCfg); mutateAndCatch(cfg, m, _containerName, _bean, _parsedCfg, _bean); return true; }
[ "private", "boolean", "handleBean", "(", "final", "ConfigurationContext", "ctx", ",", "final", "Class", "<", "?", ">", "_type", ",", "final", "Object", "cfg", ",", "final", "ParsedConfiguration", "_parsedCfg", ")", "{", "String", "_containerName", "=", "_parsedC...
Create the bean, apply configuration to it and set it. @return true, if applied, false if not a property
[ "Create", "the", "bean", "apply", "configuration", "to", "it", "and", "set", "it", "." ]
train
https://github.com/cache2k/cache2k/blob/3c9ccff12608c598c387ec50957089784cc4b618/cache2k-core/src/main/java/org/cache2k/impl/xmlConfiguration/CacheConfigurationProviderImpl.java#L318-L335
lessthanoptimal/BoofCV
main/boofcv-ip/src/main/java/boofcv/alg/transform/ii/IntegralImageOps.java
IntegralImageOps.convolveSparse
public static long convolveSparse(GrayS64 integral , IntegralKernel kernel , int x , int y ) { return ImplIntegralImageOps.convolveSparse(integral,kernel,x,y); }
java
public static long convolveSparse(GrayS64 integral , IntegralKernel kernel , int x , int y ) { return ImplIntegralImageOps.convolveSparse(integral,kernel,x,y); }
[ "public", "static", "long", "convolveSparse", "(", "GrayS64", "integral", ",", "IntegralKernel", "kernel", ",", "int", "x", ",", "int", "y", ")", "{", "return", "ImplIntegralImageOps", ".", "convolveSparse", "(", "integral", ",", "kernel", ",", "x", ",", "y"...
Convolves a kernel around a single point in the integral image. @param integral Input integral image. Not modified. @param kernel Convolution kernel. @param x Pixel the convolution is performed at. @param y Pixel the convolution is performed at. @return Value of the convolution
[ "Convolves", "a", "kernel", "around", "a", "single", "point", "in", "the", "integral", "image", "." ]
train
https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-ip/src/main/java/boofcv/alg/transform/ii/IntegralImageOps.java#L354-L357
OpenLiberty/open-liberty
dev/com.ibm.ws.messaging.jms.2.0/src/com/ibm/ws/sib/api/jms/impl/JmsSessionImpl.java
JmsSessionImpl.instantiateProducer
JmsMsgProducer instantiateProducer(Destination jmsDestination) throws JMSException { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "instantiateProducer", jmsDestination); JmsMsgProducer messageProducer = new JmsMsgProducerImpl(jmsDestination, coreConnection, this); if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "instantiateProducer", messageProducer); return messageProducer; }
java
JmsMsgProducer instantiateProducer(Destination jmsDestination) throws JMSException { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "instantiateProducer", jmsDestination); JmsMsgProducer messageProducer = new JmsMsgProducerImpl(jmsDestination, coreConnection, this); if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "instantiateProducer", messageProducer); return messageProducer; }
[ "JmsMsgProducer", "instantiateProducer", "(", "Destination", "jmsDestination", ")", "throws", "JMSException", "{", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "SibTr", ".", "entry", "(", "t...
This method is overriden by subclasses in order to instantiate an instance of the MsgProducer class. This means that the QueueSession.createSender method can delegate straight to Session.createProducer, and still get back an instance of a QueueSender, rather than a vanilla MessageProducer. Note, since this method is over-ridden by Queue and Topic specific classes, updates to any one of these methods will require consideration of the other two versions.
[ "This", "method", "is", "overriden", "by", "subclasses", "in", "order", "to", "instantiate", "an", "instance", "of", "the", "MsgProducer", "class", ".", "This", "means", "that", "the", "QueueSession", ".", "createSender", "method", "can", "delegate", "straight",...
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.jms.2.0/src/com/ibm/ws/sib/api/jms/impl/JmsSessionImpl.java#L1642-L1649
Stratio/bdt
src/main/java/com/stratio/qa/specs/SeleniumSpec.java
SeleniumSpec.elementSelect
@When("^I select '(.+?)' on the element on index '(\\d+?)'$") public void elementSelect(String option, Integer index) { Select sel = null; sel = new Select(commonspec.getPreviousWebElements().getPreviousWebElements().get(index)); sel.selectByVisibleText(option); }
java
@When("^I select '(.+?)' on the element on index '(\\d+?)'$") public void elementSelect(String option, Integer index) { Select sel = null; sel = new Select(commonspec.getPreviousWebElements().getPreviousWebElements().get(index)); sel.selectByVisibleText(option); }
[ "@", "When", "(", "\"^I select '(.+?)' on the element on index '(\\\\d+?)'$\"", ")", "public", "void", "elementSelect", "(", "String", "option", ",", "Integer", "index", ")", "{", "Select", "sel", "=", "null", ";", "sel", "=", "new", "Select", "(", "commonspec", ...
Choose an @{code option} from a select webelement found previously @param option @param index
[ "Choose", "an", "@", "{", "code", "option", "}", "from", "a", "select", "webelement", "found", "previously" ]
train
https://github.com/Stratio/bdt/blob/55324d19e7497764ad3dd7139923e13eb9841d75/src/main/java/com/stratio/qa/specs/SeleniumSpec.java#L354-L360
jsonld-java/jsonld-java
core/src/main/java/com/github/jsonldjava/core/RDFDataset.java
RDFDataset.addQuad
public void addQuad(final String s, final String p, final String value, final String datatype, final String language, String graph) { if (graph == null) { graph = "@default"; } if (!containsKey(graph)) { put(graph, new ArrayList<Quad>()); } ((ArrayList<Quad>) get(graph)).add(new Quad(s, p, value, datatype, language, graph)); }
java
public void addQuad(final String s, final String p, final String value, final String datatype, final String language, String graph) { if (graph == null) { graph = "@default"; } if (!containsKey(graph)) { put(graph, new ArrayList<Quad>()); } ((ArrayList<Quad>) get(graph)).add(new Quad(s, p, value, datatype, language, graph)); }
[ "public", "void", "addQuad", "(", "final", "String", "s", ",", "final", "String", "p", ",", "final", "String", "value", ",", "final", "String", "datatype", ",", "final", "String", "language", ",", "String", "graph", ")", "{", "if", "(", "graph", "==", ...
Adds a triple to the specified graph of this dataset @param s the subject for the triple @param p the predicate for the triple @param value the value of the literal object for the triple @param datatype the datatype of the literal object for the triple (null values will default to xsd:string) @param graph the graph to add this triple to @param language the language of the literal object for the triple (or null)
[ "Adds", "a", "triple", "to", "the", "specified", "graph", "of", "this", "dataset" ]
train
https://github.com/jsonld-java/jsonld-java/blob/efeef6ee96029a0011649633457035fa6be42da1/core/src/main/java/com/github/jsonldjava/core/RDFDataset.java#L495-L504
auth0/auth0-java
src/main/java/com/auth0/client/mgmt/filter/QueryFilter.java
QueryFilter.withPage
public QueryFilter withPage(int pageNumber, int amountPerPage) { parameters.put("page", pageNumber); parameters.put("per_page", amountPerPage); return this; }
java
public QueryFilter withPage(int pageNumber, int amountPerPage) { parameters.put("page", pageNumber); parameters.put("per_page", amountPerPage); return this; }
[ "public", "QueryFilter", "withPage", "(", "int", "pageNumber", ",", "int", "amountPerPage", ")", "{", "parameters", ".", "put", "(", "\"page\"", ",", "pageNumber", ")", ";", "parameters", ".", "put", "(", "\"per_page\"", ",", "amountPerPage", ")", ";", "retu...
Filter by page @param pageNumber the page number to retrieve. @param amountPerPage the amount of items per page to retrieve. @return this filter instance
[ "Filter", "by", "page" ]
train
https://github.com/auth0/auth0-java/blob/b7bc099ee9c6cde5a87c4ecfebc6d811aeb1027c/src/main/java/com/auth0/client/mgmt/filter/QueryFilter.java#L57-L61
mongodb/stitch-android-sdk
core/services/mongodb-remote/src/main/java/com/mongodb/stitch/core/services/mongodb/remote/sync/internal/DataSynchronizer.java
DataSynchronizer.sanitizeCachedDocument
private static BsonDocument sanitizeCachedDocument( final MongoCollection<BsonDocument> localCollection, final BsonDocument document, final BsonValue documentId ) { if (document == null) { return null; } if (document.containsKey(DOCUMENT_VERSION_FIELD)) { final BsonDocument clonedDoc = sanitizeDocument(document); final BsonDocument removeVersionUpdate = new BsonDocument("$unset", new BsonDocument(DOCUMENT_VERSION_FIELD, new BsonInt32(1)) ); localCollection.findOneAndUpdate(getDocumentIdFilter(documentId), removeVersionUpdate); return clonedDoc; } return document; }
java
private static BsonDocument sanitizeCachedDocument( final MongoCollection<BsonDocument> localCollection, final BsonDocument document, final BsonValue documentId ) { if (document == null) { return null; } if (document.containsKey(DOCUMENT_VERSION_FIELD)) { final BsonDocument clonedDoc = sanitizeDocument(document); final BsonDocument removeVersionUpdate = new BsonDocument("$unset", new BsonDocument(DOCUMENT_VERSION_FIELD, new BsonInt32(1)) ); localCollection.findOneAndUpdate(getDocumentIdFilter(documentId), removeVersionUpdate); return clonedDoc; } return document; }
[ "private", "static", "BsonDocument", "sanitizeCachedDocument", "(", "final", "MongoCollection", "<", "BsonDocument", ">", "localCollection", ",", "final", "BsonDocument", "document", ",", "final", "BsonValue", "documentId", ")", "{", "if", "(", "document", "==", "nu...
Given a local collection, a document fetched from that collection, and its _id, ensure that the document does not contain forbidden fields (currently just the document version field), and remove them from the document and the local collection. If no changes are made, the original document reference is returned. If changes are made, a cloned copy of the document with the changes will be returned. @param localCollection the local MongoCollection from which the document was fetched @param document the document fetched from the local collection. this argument may be mutated @param documentId the _id of the fetched document (taken as an arg so that if the caller already knows the _id, the document need not be traversed to find it) @return a BsonDocument without any forbidden fields.
[ "Given", "a", "local", "collection", "a", "document", "fetched", "from", "that", "collection", "and", "its", "_id", "ensure", "that", "the", "document", "does", "not", "contain", "forbidden", "fields", "(", "currently", "just", "the", "document", "version", "f...
train
https://github.com/mongodb/stitch-android-sdk/blob/159b9334b1f1a827285544be5ee20cdf7b04e4cc/core/services/mongodb-remote/src/main/java/com/mongodb/stitch/core/services/mongodb/remote/sync/internal/DataSynchronizer.java#L3137-L3158
jmrozanec/cron-utils
src/main/java/com/cronutils/descriptor/refactor/SecondsDescriptor.java
SecondsDescriptor.createAndDescription
@VisibleForTesting StringBuilder createAndDescription(final StringBuilder builder, final List<FieldExpression> expressions) { if ((expressions.size() - 2) >= 0) { for (int j = 0; j < expressions.size() - 2; j++) { builder.append(String.format(" %s, ", describe(expressions.get(j), true))); } builder.append(String.format(" %s ", describe(expressions.get(expressions.size() - 2), true))); } builder.append(String.format(" %s ", bundle.getString("and"))); builder.append(describe(expressions.get(expressions.size() - 1), true)); return builder; }
java
@VisibleForTesting StringBuilder createAndDescription(final StringBuilder builder, final List<FieldExpression> expressions) { if ((expressions.size() - 2) >= 0) { for (int j = 0; j < expressions.size() - 2; j++) { builder.append(String.format(" %s, ", describe(expressions.get(j), true))); } builder.append(String.format(" %s ", describe(expressions.get(expressions.size() - 2), true))); } builder.append(String.format(" %s ", bundle.getString("and"))); builder.append(describe(expressions.get(expressions.size() - 1), true)); return builder; }
[ "@", "VisibleForTesting", "StringBuilder", "createAndDescription", "(", "final", "StringBuilder", "builder", ",", "final", "List", "<", "FieldExpression", ">", "expressions", ")", "{", "if", "(", "(", "expressions", ".", "size", "(", ")", "-", "2", ")", ">=", ...
Creates human readable description for And element. @param builder - StringBuilder instance to which description will be appended @param expressions - field expressions @return same StringBuilder instance as parameter
[ "Creates", "human", "readable", "description", "for", "And", "element", "." ]
train
https://github.com/jmrozanec/cron-utils/blob/adac5ec8fd9160b082f9762a6eedea0715731170/src/main/java/com/cronutils/descriptor/refactor/SecondsDescriptor.java#L167-L178
Azure/azure-sdk-for-java
recoveryservices.backup/resource-manager/v2016_12_01/src/main/java/com/microsoft/azure/management/recoveryservices/backup/v2016_12_01/implementation/JobCancellationsInner.java
JobCancellationsInner.triggerAsync
public Observable<Void> triggerAsync(String vaultName, String resourceGroupName, String jobName) { return triggerWithServiceResponseAsync(vaultName, resourceGroupName, jobName).map(new Func1<ServiceResponse<Void>, Void>() { @Override public Void call(ServiceResponse<Void> response) { return response.body(); } }); }
java
public Observable<Void> triggerAsync(String vaultName, String resourceGroupName, String jobName) { return triggerWithServiceResponseAsync(vaultName, resourceGroupName, jobName).map(new Func1<ServiceResponse<Void>, Void>() { @Override public Void call(ServiceResponse<Void> response) { return response.body(); } }); }
[ "public", "Observable", "<", "Void", ">", "triggerAsync", "(", "String", "vaultName", ",", "String", "resourceGroupName", ",", "String", "jobName", ")", "{", "return", "triggerWithServiceResponseAsync", "(", "vaultName", ",", "resourceGroupName", ",", "jobName", ")"...
Cancels a job. This is an asynchronous operation. To know the status of the cancellation, call GetCancelOperationResult API. @param vaultName The name of the recovery services vault. @param resourceGroupName The name of the resource group where the recovery services vault is present. @param jobName Name of the job to cancel. @throws IllegalArgumentException thrown if parameters fail the validation @return the {@link ServiceResponse} object if successful.
[ "Cancels", "a", "job", ".", "This", "is", "an", "asynchronous", "operation", ".", "To", "know", "the", "status", "of", "the", "cancellation", "call", "GetCancelOperationResult", "API", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/recoveryservices.backup/resource-manager/v2016_12_01/src/main/java/com/microsoft/azure/management/recoveryservices/backup/v2016_12_01/implementation/JobCancellationsInner.java#L97-L104
f2prateek/dart
henson/src/main/java/dart/henson/Bundler.java
Bundler.put
public Bundler put(String key, Parcelable[] value) { delegate.putParcelableArray(key, value); return this; }
java
public Bundler put(String key, Parcelable[] value) { delegate.putParcelableArray(key, value); return this; }
[ "public", "Bundler", "put", "(", "String", "key", ",", "Parcelable", "[", "]", "value", ")", "{", "delegate", ".", "putParcelableArray", "(", "key", ",", "value", ")", ";", "return", "this", ";", "}" ]
Inserts an array of Parcelable values into the mapping of the underlying Bundle, replacing any existing value for the given key. Either key or value may be null. @param key a String, or null @param value an array of Parcelable objects, or null @return this bundler instance to chain method calls
[ "Inserts", "an", "array", "of", "Parcelable", "values", "into", "the", "mapping", "of", "the", "underlying", "Bundle", "replacing", "any", "existing", "value", "for", "the", "given", "key", ".", "Either", "key", "or", "value", "may", "be", "null", "." ]
train
https://github.com/f2prateek/dart/blob/7163b1b148e5141817975ae7dad99d58a8589aeb/henson/src/main/java/dart/henson/Bundler.java#L361-L364
usc/wechat-mp-sdk
wechat-mp-web/src/main/java/org/usc/wechat/mp/web/util/WebUtil.java
WebUtil.getPostString
public static String getPostString(InputStream is, String encoding) { try { StringWriter sw = new StringWriter(); IOUtils.copy(is, sw, encoding); return sw.toString(); } catch (IOException e) { // no op return null; } finally { IOUtils.closeQuietly(is); } }
java
public static String getPostString(InputStream is, String encoding) { try { StringWriter sw = new StringWriter(); IOUtils.copy(is, sw, encoding); return sw.toString(); } catch (IOException e) { // no op return null; } finally { IOUtils.closeQuietly(is); } }
[ "public", "static", "String", "getPostString", "(", "InputStream", "is", ",", "String", "encoding", ")", "{", "try", "{", "StringWriter", "sw", "=", "new", "StringWriter", "(", ")", ";", "IOUtils", ".", "copy", "(", "is", ",", "sw", ",", "encoding", ")",...
get string from post stream @param is @param encoding @return
[ "get", "string", "from", "post", "stream" ]
train
https://github.com/usc/wechat-mp-sdk/blob/39d9574a8e3ffa3b61f88b4bef534d93645a825f/wechat-mp-web/src/main/java/org/usc/wechat/mp/web/util/WebUtil.java#L35-L47
lightblueseas/vintage-time
src/main/java/de/alpharogroup/date/CalculateDateExtensions.java
CalculateDateExtensions.substractYearsFromDate
public static Date substractYearsFromDate(final Date date, final int substractYears) { final Calendar dateOnCalendar = Calendar.getInstance(); dateOnCalendar.setTime(date); dateOnCalendar.add(Calendar.YEAR, substractYears * -1); return dateOnCalendar.getTime(); }
java
public static Date substractYearsFromDate(final Date date, final int substractYears) { final Calendar dateOnCalendar = Calendar.getInstance(); dateOnCalendar.setTime(date); dateOnCalendar.add(Calendar.YEAR, substractYears * -1); return dateOnCalendar.getTime(); }
[ "public", "static", "Date", "substractYearsFromDate", "(", "final", "Date", "date", ",", "final", "int", "substractYears", ")", "{", "final", "Calendar", "dateOnCalendar", "=", "Calendar", ".", "getInstance", "(", ")", ";", "dateOnCalendar", ".", "setTime", "(",...
Substract years to the given Date object and returns it. @param date The Date object to substract the years. @param substractYears The years to substract. @return The resulted Date object.
[ "Substract", "years", "to", "the", "given", "Date", "object", "and", "returns", "it", "." ]
train
https://github.com/lightblueseas/vintage-time/blob/fbf201e679d9f9b92e7b5771f3eea1413cc2e113/src/main/java/de/alpharogroup/date/CalculateDateExtensions.java#L436-L442
apache/incubator-gobblin
gobblin-modules/gobblin-kafka-common/src/main/java/org/apache/gobblin/source/extractor/extract/kafka/KafkaUtils.java
KafkaUtils.getPartitionAvgRecordMillis
public static double getPartitionAvgRecordMillis(State state, KafkaPartition partition) { double avgRecordMillis = state.getPropAsDouble( getPartitionPropName(partition.getTopicName(), partition.getId()) + "." + KafkaSource.AVG_RECORD_MILLIS); // cap to prevent a poorly behaved topic from impacting the bin-packing int avgFetchTimeCap = state.getPropAsInt(ConfigurationKeys.KAFKA_SOURCE_AVG_FETCH_TIME_CAP, ConfigurationKeys.DEFAULT_KAFKA_SOURCE_AVG_FETCH_TIME_CAP); if (avgFetchTimeCap > 0 && avgRecordMillis > avgFetchTimeCap) { log.info("Topic {} partition {} has an average fetch time of {}, capping it to {}", partition.getTopicName(), partition.getId(), avgRecordMillis, avgFetchTimeCap); avgRecordMillis = avgFetchTimeCap; } return avgRecordMillis; }
java
public static double getPartitionAvgRecordMillis(State state, KafkaPartition partition) { double avgRecordMillis = state.getPropAsDouble( getPartitionPropName(partition.getTopicName(), partition.getId()) + "." + KafkaSource.AVG_RECORD_MILLIS); // cap to prevent a poorly behaved topic from impacting the bin-packing int avgFetchTimeCap = state.getPropAsInt(ConfigurationKeys.KAFKA_SOURCE_AVG_FETCH_TIME_CAP, ConfigurationKeys.DEFAULT_KAFKA_SOURCE_AVG_FETCH_TIME_CAP); if (avgFetchTimeCap > 0 && avgRecordMillis > avgFetchTimeCap) { log.info("Topic {} partition {} has an average fetch time of {}, capping it to {}", partition.getTopicName(), partition.getId(), avgRecordMillis, avgFetchTimeCap); avgRecordMillis = avgFetchTimeCap; } return avgRecordMillis; }
[ "public", "static", "double", "getPartitionAvgRecordMillis", "(", "State", "state", ",", "KafkaPartition", "partition", ")", "{", "double", "avgRecordMillis", "=", "state", ".", "getPropAsDouble", "(", "getPartitionPropName", "(", "partition", ".", "getTopicName", "("...
Get the average time to pull a record of a partition, which is stored in property "[topicname].[partitionid].avg.record.millis". If state doesn't contain this property, it returns defaultValue.
[ "Get", "the", "average", "time", "to", "pull", "a", "record", "of", "a", "partition", "which", "is", "stored", "in", "property", "[", "topicname", "]", ".", "[", "partitionid", "]", ".", "avg", ".", "record", ".", "millis", ".", "If", "state", "doesn",...
train
https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-modules/gobblin-kafka-common/src/main/java/org/apache/gobblin/source/extractor/extract/kafka/KafkaUtils.java#L146-L161
mapfish/mapfish-print
core/src/main/java/org/mapfish/print/SvgUtil.java
SvgUtil.convertFromSvg
public static BufferedImage convertFromSvg(final URI svgFile, final int width, final int height) throws TranscoderException { BufferedImageTranscoder imageTranscoder = new BufferedImageTranscoder(); imageTranscoder.addTranscodingHint(TIFFTranscoder.KEY_WIDTH, (float) width); imageTranscoder.addTranscodingHint(TIFFTranscoder.KEY_HEIGHT, (float) height); TranscoderInput input = new TranscoderInput(svgFile.toString()); imageTranscoder.transcode(input, null); return imageTranscoder.getBufferedImage(); }
java
public static BufferedImage convertFromSvg(final URI svgFile, final int width, final int height) throws TranscoderException { BufferedImageTranscoder imageTranscoder = new BufferedImageTranscoder(); imageTranscoder.addTranscodingHint(TIFFTranscoder.KEY_WIDTH, (float) width); imageTranscoder.addTranscodingHint(TIFFTranscoder.KEY_HEIGHT, (float) height); TranscoderInput input = new TranscoderInput(svgFile.toString()); imageTranscoder.transcode(input, null); return imageTranscoder.getBufferedImage(); }
[ "public", "static", "BufferedImage", "convertFromSvg", "(", "final", "URI", "svgFile", ",", "final", "int", "width", ",", "final", "int", "height", ")", "throws", "TranscoderException", "{", "BufferedImageTranscoder", "imageTranscoder", "=", "new", "BufferedImageTrans...
Renders an SVG image into a {@link BufferedImage}. @param svgFile the svg file @param width the width @param height the height @return a buffered image @throws TranscoderException
[ "Renders", "an", "SVG", "image", "into", "a", "{", "@link", "BufferedImage", "}", "." ]
train
https://github.com/mapfish/mapfish-print/blob/25a452cb39f592bd8a53b20db1037703898e1e22/core/src/main/java/org/mapfish/print/SvgUtil.java#L30-L41
icode/ameba
src/main/java/ameba/message/error/ExceptionMapperUtils.java
ExceptionMapperUtils.getResponseType
public static MediaType getResponseType(ContainerRequest request, Integer status) { if (status != null && status == 406) { return MediaType.TEXT_HTML_TYPE; } List<MediaType> accepts = request.getAcceptableMediaTypes(); MediaType m; if (accepts != null && accepts.size() > 0) { m = accepts.get(0); } else { m = Requests.getMediaType(); } if (m.isWildcardType() || m.equals(LOW_IE_DEFAULT_REQ_TYPE)) { m = MediaType.TEXT_HTML_TYPE; } return m; }
java
public static MediaType getResponseType(ContainerRequest request, Integer status) { if (status != null && status == 406) { return MediaType.TEXT_HTML_TYPE; } List<MediaType> accepts = request.getAcceptableMediaTypes(); MediaType m; if (accepts != null && accepts.size() > 0) { m = accepts.get(0); } else { m = Requests.getMediaType(); } if (m.isWildcardType() || m.equals(LOW_IE_DEFAULT_REQ_TYPE)) { m = MediaType.TEXT_HTML_TYPE; } return m; }
[ "public", "static", "MediaType", "getResponseType", "(", "ContainerRequest", "request", ",", "Integer", "status", ")", "{", "if", "(", "status", "!=", "null", "&&", "status", "==", "406", ")", "{", "return", "MediaType", ".", "TEXT_HTML_TYPE", ";", "}", "Lis...
<p>getResponseType.</p> @param request a {@link org.glassfish.jersey.server.ContainerRequest} object. @param status a {@link java.lang.Integer} object. @return a {@link javax.ws.rs.core.MediaType} object.
[ "<p", ">", "getResponseType", ".", "<", "/", "p", ">" ]
train
https://github.com/icode/ameba/blob/9d4956e935898e41331b2745e400ef869cd265e0/src/main/java/ameba/message/error/ExceptionMapperUtils.java#L57-L72
sd4324530/fastweixin
src/main/java/com/github/sd4324530/fastweixin/servlet/WeixinServletSupport.java
WeixinServletSupport.doGet
@Override protected final void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { support.bindServer(request, response); }
java
@Override protected final void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { support.bindServer(request, response); }
[ "@", "Override", "protected", "final", "void", "doGet", "(", "HttpServletRequest", "request", ",", "HttpServletResponse", "response", ")", "throws", "ServletException", ",", "IOException", "{", "support", ".", "bindServer", "(", "request", ",", "response", ")", ";...
重写servlet中的get方法,用于处理微信服务器绑定,置为final方法,用户已经无需重写这个方法啦 @param request http请求对象 @param response http响应对象 @throws ServletException servlet异常 @throws IOException IO异常
[ "重写servlet中的get方法,用于处理微信服务器绑定,置为final方法,用户已经无需重写这个方法啦" ]
train
https://github.com/sd4324530/fastweixin/blob/6bc0a7abfa23aad0dbad4c3123a47a7fb53f3447/src/main/java/com/github/sd4324530/fastweixin/servlet/WeixinServletSupport.java#L40-L43
Waikato/jclasslocator
src/main/java/nz/ac/waikato/cms/locator/ClassLocator.java
ClassLocator.matches
public static boolean matches(String superclassOrIntf, String otherclass) { return isSubclass(superclassOrIntf, otherclass) || hasInterface(superclassOrIntf, otherclass); }
java
public static boolean matches(String superclassOrIntf, String otherclass) { return isSubclass(superclassOrIntf, otherclass) || hasInterface(superclassOrIntf, otherclass); }
[ "public", "static", "boolean", "matches", "(", "String", "superclassOrIntf", ",", "String", "otherclass", ")", "{", "return", "isSubclass", "(", "superclassOrIntf", ",", "otherclass", ")", "||", "hasInterface", "(", "superclassOrIntf", ",", "otherclass", ")", ";",...
Checks whether the "otherclass" is a subclass of the given "superclassOrIntf" or whether it implements "superclassOrIntf". @param superclassOrIntf the superclass/interface to check against @param otherclass this class is checked whether it is a subclass of the the superclass @return TRUE if "otherclass" is a true subclass or implements the interface
[ "Checks", "whether", "the", "otherclass", "is", "a", "subclass", "of", "the", "given", "superclassOrIntf", "or", "whether", "it", "implements", "superclassOrIntf", "." ]
train
https://github.com/Waikato/jclasslocator/blob/c899072fff607a56ee7f8c2d01fbeb15157ad144/src/main/java/nz/ac/waikato/cms/locator/ClassLocator.java#L690-L692
oehf/ipf-oht-atna
auditor/src/main/java/org/openhealthtools/ihe/atna/auditor/IHEAuditor.java
IHEAuditor.auditActorStopEvent
public void auditActorStopEvent(RFC3881EventOutcomeCodes eventOutcome, String actorName, String actorStopper) { if (!isAuditorEnabled()) { return; } ApplicationStopEvent stopEvent = new ApplicationStopEvent(eventOutcome); stopEvent.setAuditSourceId(getAuditSourceId(), getAuditEnterpriseSiteId()); stopEvent.addApplicationParticipant(actorName, null, null, getSystemNetworkId()); if (!EventUtils.isEmptyOrNull(actorStopper)) { stopEvent.addApplicationStarterParticipant(actorStopper, null, null, null); } audit(stopEvent); }
java
public void auditActorStopEvent(RFC3881EventOutcomeCodes eventOutcome, String actorName, String actorStopper) { if (!isAuditorEnabled()) { return; } ApplicationStopEvent stopEvent = new ApplicationStopEvent(eventOutcome); stopEvent.setAuditSourceId(getAuditSourceId(), getAuditEnterpriseSiteId()); stopEvent.addApplicationParticipant(actorName, null, null, getSystemNetworkId()); if (!EventUtils.isEmptyOrNull(actorStopper)) { stopEvent.addApplicationStarterParticipant(actorStopper, null, null, null); } audit(stopEvent); }
[ "public", "void", "auditActorStopEvent", "(", "RFC3881EventOutcomeCodes", "eventOutcome", ",", "String", "actorName", ",", "String", "actorStopper", ")", "{", "if", "(", "!", "isAuditorEnabled", "(", ")", ")", "{", "return", ";", "}", "ApplicationStopEvent", "stop...
Sends a DICOM Application Activity / Application Stop Event audit message @param eventOutcome Event Outcome Indicator @param actorName Application Participant User ID (Actor Name) @param actorStopper Application Starter Participant User ID (Actor Starter Name)
[ "Sends", "a", "DICOM", "Application", "Activity", "/", "Application", "Stop", "Event", "audit", "message" ]
train
https://github.com/oehf/ipf-oht-atna/blob/25ed1e926825169c94923a2c89a4618f60478ae8/auditor/src/main/java/org/openhealthtools/ihe/atna/auditor/IHEAuditor.java#L624-L636
grandstaish/paperparcel
paperparcel-compiler/src/main/java/paperparcel/Utils.java
Utils.isCreatorType
static boolean isCreatorType(Element element, Elements elements, Types types) { TypeMirror creatorType = types.getDeclaredType( elements.getTypeElement(PARCELABLE_CREATOR_CLASS_NAME), types.getWildcardType(null, null)); return types.isAssignable(element.asType(), creatorType); }
java
static boolean isCreatorType(Element element, Elements elements, Types types) { TypeMirror creatorType = types.getDeclaredType( elements.getTypeElement(PARCELABLE_CREATOR_CLASS_NAME), types.getWildcardType(null, null)); return types.isAssignable(element.asType(), creatorType); }
[ "static", "boolean", "isCreatorType", "(", "Element", "element", ",", "Elements", "elements", ",", "Types", "types", ")", "{", "TypeMirror", "creatorType", "=", "types", ".", "getDeclaredType", "(", "elements", ".", "getTypeElement", "(", "PARCELABLE_CREATOR_CLASS_N...
Returns true if {@code element} is a {@code Parcelable.Creator} type.
[ "Returns", "true", "if", "{" ]
train
https://github.com/grandstaish/paperparcel/blob/917686ced81b335b6708d81d6cc0e3e496f7280d/paperparcel-compiler/src/main/java/paperparcel/Utils.java#L212-L217
versionone/VersionOne.SDK.Java.ObjectModel
src/main/java/com/versionone/om/V1InstanceGetter.java
V1InstanceGetter.primaryWorkitems
public Collection<PrimaryWorkitem> primaryWorkitems( PrimaryWorkitemFilter filter) { return get(PrimaryWorkitem.class, (filter != null) ? filter : new PrimaryWorkitemFilter()); }
java
public Collection<PrimaryWorkitem> primaryWorkitems( PrimaryWorkitemFilter filter) { return get(PrimaryWorkitem.class, (filter != null) ? filter : new PrimaryWorkitemFilter()); }
[ "public", "Collection", "<", "PrimaryWorkitem", ">", "primaryWorkitems", "(", "PrimaryWorkitemFilter", "filter", ")", "{", "return", "get", "(", "PrimaryWorkitem", ".", "class", ",", "(", "filter", "!=", "null", ")", "?", "filter", ":", "new", "PrimaryWorkitemFi...
Get primary workitems (stories and defects) filtered by the criteria specified in the passed in filter. @param filter Limit the items returned. If null, then all items returned. @return Collection of items as specified in the filter.
[ "Get", "primary", "workitems", "(", "stories", "and", "defects", ")", "filtered", "by", "the", "criteria", "specified", "in", "the", "passed", "in", "filter", "." ]
train
https://github.com/versionone/VersionOne.SDK.Java.ObjectModel/blob/59d35b67c849299631bca45ee94143237eb2ae1a/src/main/java/com/versionone/om/V1InstanceGetter.java#L146-L149
Azure/azure-sdk-for-java
servicebus/data-plane/azure-servicebus/src/main/java/com/microsoft/azure/servicebus/ClientFactory.java
ClientFactory.createMessageSenderFromEntityPath
public static IMessageSender createMessageSenderFromEntityPath(String namespaceName, String entityPath, ClientSettings clientSettings) throws InterruptedException, ServiceBusException { return Utils.completeFuture(createMessageSenderFromEntityPathAsync(namespaceName, entityPath, clientSettings)); }
java
public static IMessageSender createMessageSenderFromEntityPath(String namespaceName, String entityPath, ClientSettings clientSettings) throws InterruptedException, ServiceBusException { return Utils.completeFuture(createMessageSenderFromEntityPathAsync(namespaceName, entityPath, clientSettings)); }
[ "public", "static", "IMessageSender", "createMessageSenderFromEntityPath", "(", "String", "namespaceName", ",", "String", "entityPath", ",", "ClientSettings", "clientSettings", ")", "throws", "InterruptedException", ",", "ServiceBusException", "{", "return", "Utils", ".", ...
Creates a message sender to the entity using the client settings. @param namespaceName namespace of entity @param entityPath path of entity @param clientSettings client settings @return IMessageSender instance @throws InterruptedException if the current thread was interrupted while waiting @throws ServiceBusException if the sender cannot be created
[ "Creates", "a", "message", "sender", "to", "the", "entity", "using", "the", "client", "settings", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/servicebus/data-plane/azure-servicebus/src/main/java/com/microsoft/azure/servicebus/ClientFactory.java#L65-L67
PeterisP/LVTagger
src/main/java/edu/stanford/nlp/ling/AnnotationLookup.java
AnnotationLookup.getValueType
@SuppressWarnings("unchecked") public static Class<?> getValueType(Class<? extends CoreAnnotation> key) { Class type = valueCache.get(key); if (type == null) { try { type = key.newInstance().getType(); } catch (Exception e) { throw new RuntimeException("Unexpected failure to instantiate - is your key class fancy?", e); } valueCache.put((Class)key, type); } return type; }
java
@SuppressWarnings("unchecked") public static Class<?> getValueType(Class<? extends CoreAnnotation> key) { Class type = valueCache.get(key); if (type == null) { try { type = key.newInstance().getType(); } catch (Exception e) { throw new RuntimeException("Unexpected failure to instantiate - is your key class fancy?", e); } valueCache.put((Class)key, type); } return type; }
[ "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "public", "static", "Class", "<", "?", ">", "getValueType", "(", "Class", "<", "?", "extends", "CoreAnnotation", ">", "key", ")", "{", "Class", "type", "=", "valueCache", ".", "get", "(", "key", ")", ";...
Returns the runtime value type associated with the given key. Caches results.
[ "Returns", "the", "runtime", "value", "type", "associated", "with", "the", "given", "key", ".", "Caches", "results", "." ]
train
https://github.com/PeterisP/LVTagger/blob/b3d44bab9ec07ace0d13612c448a6b7298c1f681/src/main/java/edu/stanford/nlp/ling/AnnotationLookup.java#L165-L177
pravega/pravega
common/src/main/java/io/pravega/common/util/BitConverter.java
BitConverter.writeShort
public static int writeShort(ArrayView target, int offset, short value) { return writeShort(target.array(), target.arrayOffset() + offset, value); }
java
public static int writeShort(ArrayView target, int offset, short value) { return writeShort(target.array(), target.arrayOffset() + offset, value); }
[ "public", "static", "int", "writeShort", "(", "ArrayView", "target", ",", "int", "offset", ",", "short", "value", ")", "{", "return", "writeShort", "(", "target", ".", "array", "(", ")", ",", "target", ".", "arrayOffset", "(", ")", "+", "offset", ",", ...
Writes the given 16-bit Short to the given ArrayView at the given offset. @param target The ArrayView to write to. @param offset The offset within the ArrayView to write at. @param value The value to write. @return The number of bytes written.
[ "Writes", "the", "given", "16", "-", "bit", "Short", "to", "the", "given", "ArrayView", "at", "the", "given", "offset", "." ]
train
https://github.com/pravega/pravega/blob/6e24df7470669b3956a07018f52b2c6b3c2a3503/common/src/main/java/io/pravega/common/util/BitConverter.java#L30-L32
nabedge/mixer2
src/main/java/org/mixer2/xhtml/AbstractJaxb.java
AbstractJaxb.setData
public void setData(String key, String value) { QName qn = new QName("data-" + key); this.getOtherAttributes().put(qn, value); }
java
public void setData(String key, String value) { QName qn = new QName("data-" + key); this.getOtherAttributes().put(qn, value); }
[ "public", "void", "setData", "(", "String", "key", ",", "String", "value", ")", "{", "QName", "qn", "=", "new", "QName", "(", "\"data-\"", "+", "key", ")", ";", "this", ".", "getOtherAttributes", "(", ")", ".", "put", "(", "qn", ",", "value", ")", ...
<p> set data-* attribute </p> <pre> Div div = new Div(); div.setData(&quot;foo&quot;, &quot;bar&quot;); // you get &lt;div data-foo=&quot;bar&quot;&gt;&lt;/div&gt; </pre> @param key data-"key"
[ "<p", ">", "set", "data", "-", "*", "attribute", "<", "/", "p", ">" ]
train
https://github.com/nabedge/mixer2/blob/8c2db27cfcd65bf0b1e0242ef9362ebd8033777c/src/main/java/org/mixer2/xhtml/AbstractJaxb.java#L650-L653
tango-controls/JTango
client/src/main/java/fr/soleil/tango/clientapi/TangoAttribute.java
TangoAttribute.extractToString
public String extractToString(final String separator, final String endSeparator) throws DevFailed { logger.debug(LOG_EXTRACTING, this); return attributeImpl.extractToString(separator, endSeparator); }
java
public String extractToString(final String separator, final String endSeparator) throws DevFailed { logger.debug(LOG_EXTRACTING, this); return attributeImpl.extractToString(separator, endSeparator); }
[ "public", "String", "extractToString", "(", "final", "String", "separator", ",", "final", "String", "endSeparator", ")", "throws", "DevFailed", "{", "logger", ".", "debug", "(", "LOG_EXTRACTING", ",", "this", ")", ";", "return", "attributeImpl", ".", "extractToS...
Extract data and format it as followed :\n SCALAR: ex: 1 SPECTRUM: one line separated by separator. \n ex: 1 3 5 IMAGE: x lines and y colums separated by endSeparator.\n ex: 3 5 8 5 6 9 @param separator @param endSeparator @return @throws DevFailed
[ "Extract", "data", "and", "format", "it", "as", "followed", ":", "\\", "n", "SCALAR", ":", "ex", ":", "1", "SPECTRUM", ":", "one", "line", "separated", "by", "separator", ".", "\\", "n", "ex", ":", "1", "3", "5", "IMAGE", ":", "x", "lines", "and", ...
train
https://github.com/tango-controls/JTango/blob/1ccc9dcb83e6de2359a9f1906d170571cacf1345/client/src/main/java/fr/soleil/tango/clientapi/TangoAttribute.java#L358-L361
fommil/matrix-toolkits-java
src/main/java/no/uib/cipr/matrix/sparse/Arrays.java
Arrays.binarySearchSmaller
public static int binarySearchSmaller(int[] index, int key, int begin, int end) { return binarySearchInterval(index, key, begin, end, false); }
java
public static int binarySearchSmaller(int[] index, int key, int begin, int end) { return binarySearchInterval(index, key, begin, end, false); }
[ "public", "static", "int", "binarySearchSmaller", "(", "int", "[", "]", "index", ",", "int", "key", ",", "int", "begin", ",", "int", "end", ")", "{", "return", "binarySearchInterval", "(", "index", ",", "key", ",", "begin", ",", "end", ",", "false", ")...
Searches for a key in a sorted array, and returns an index to an element which is smaller than or equal key. @param index Sorted array of integers @param key Search for something equal or greater @param begin Start posisiton in the index @param end One past the end position in the index @return begin-1 if nothing smaller or equal was found, else an index satisfying the search criteria
[ "Searches", "for", "a", "key", "in", "a", "sorted", "array", "and", "returns", "an", "index", "to", "an", "element", "which", "is", "smaller", "than", "or", "equal", "key", "." ]
train
https://github.com/fommil/matrix-toolkits-java/blob/6157618bc86bcda3749af2a60bf869d8f3292960/src/main/java/no/uib/cipr/matrix/sparse/Arrays.java#L86-L89
hal/core
gui/src/main/java/org/jboss/as/console/client/widgets/forms/EntityAdapter.java
EntityAdapter.fromChangeset
public ModelNode fromChangeset(Map<String, Object> changeSet, ModelNode address, ModelNode... extraSteps) { ModelNode protoType = new ModelNode(); protoType.get(ADDRESS).set(address.get(ADDRESS)); protoType.get(OP).set(WRITE_ATTRIBUTE_OPERATION); ModelNode operation = new ModelNode(); operation.get(OP).set(COMPOSITE); operation.get(ADDRESS).setEmptyList(); List<ModelNode> steps = new ArrayList<ModelNode>(); List<PropertyBinding> propertyBindings = metaData.getBeanMetaData(type).getProperties(); Map<String, ModelNode> flattenedSteps = new HashMap<String, ModelNode>(); for(PropertyBinding binding : propertyBindings) { Object value = changeSet.get(binding.getJavaName()); if (value == null) continue; ModelNode step = protoType.clone(); // account for flattened sub-attribute paths String detypedName = binding.getDetypedName(); String[] splitDetypedName = detypedName.split("/"); step.get(NAME).set(splitDetypedName[0]); splitDetypedName[0] = VALUE; ModelNode nodeToSetValueUpon = step.get(splitDetypedName); if (binding.isFlattened()) { // unflatten String attributePath = detypedName.substring(0, detypedName.lastIndexOf("/")); ModelNode savedStep = flattenedSteps.get(attributePath); if (savedStep == null) { setValue(binding, nodeToSetValueUpon, value); flattenedSteps.put(attributePath, step); } else { setValue(binding, savedStep.get(splitDetypedName), value); } } else { setValue(binding, nodeToSetValueUpon, value); steps.add(step); } } // add steps for flattened attributes for (ModelNode step : flattenedSteps.values()) steps.add(step); // add extra steps steps.addAll(Arrays.asList(extraSteps)); operation.get(STEPS).set(steps); System.out.println(operation); return operation; }
java
public ModelNode fromChangeset(Map<String, Object> changeSet, ModelNode address, ModelNode... extraSteps) { ModelNode protoType = new ModelNode(); protoType.get(ADDRESS).set(address.get(ADDRESS)); protoType.get(OP).set(WRITE_ATTRIBUTE_OPERATION); ModelNode operation = new ModelNode(); operation.get(OP).set(COMPOSITE); operation.get(ADDRESS).setEmptyList(); List<ModelNode> steps = new ArrayList<ModelNode>(); List<PropertyBinding> propertyBindings = metaData.getBeanMetaData(type).getProperties(); Map<String, ModelNode> flattenedSteps = new HashMap<String, ModelNode>(); for(PropertyBinding binding : propertyBindings) { Object value = changeSet.get(binding.getJavaName()); if (value == null) continue; ModelNode step = protoType.clone(); // account for flattened sub-attribute paths String detypedName = binding.getDetypedName(); String[] splitDetypedName = detypedName.split("/"); step.get(NAME).set(splitDetypedName[0]); splitDetypedName[0] = VALUE; ModelNode nodeToSetValueUpon = step.get(splitDetypedName); if (binding.isFlattened()) { // unflatten String attributePath = detypedName.substring(0, detypedName.lastIndexOf("/")); ModelNode savedStep = flattenedSteps.get(attributePath); if (savedStep == null) { setValue(binding, nodeToSetValueUpon, value); flattenedSteps.put(attributePath, step); } else { setValue(binding, savedStep.get(splitDetypedName), value); } } else { setValue(binding, nodeToSetValueUpon, value); steps.add(step); } } // add steps for flattened attributes for (ModelNode step : flattenedSteps.values()) steps.add(step); // add extra steps steps.addAll(Arrays.asList(extraSteps)); operation.get(STEPS).set(steps); System.out.println(operation); return operation; }
[ "public", "ModelNode", "fromChangeset", "(", "Map", "<", "String", ",", "Object", ">", "changeSet", ",", "ModelNode", "address", ",", "ModelNode", "...", "extraSteps", ")", "{", "ModelNode", "protoType", "=", "new", "ModelNode", "(", ")", ";", "protoType", "...
Turns a changeset into a composite write attribute operation. @param changeSet @param address the entity address @return composite operation
[ "Turns", "a", "changeset", "into", "a", "composite", "write", "attribute", "operation", "." ]
train
https://github.com/hal/core/blob/d6d03f0bb128dc0470f5dc75fdb1ea1014400602/gui/src/main/java/org/jboss/as/console/client/widgets/forms/EntityAdapter.java#L531-L587
sagiegurari/fax4j
src/main/java/org/fax4j/spi/comm/AbstractFaxModemAdapter.java
AbstractFaxModemAdapter.submitFaxJob
public void submitFaxJob(FaxJob faxJob,CommPortAdapter adapter) { if(faxJob==null) { throw new FaxException("Fax job not provided."); } if(adapter==null) { throw new FaxException("COMM port adapter not provided."); } //submit fax job this.submitFaxJobImpl(faxJob,adapter); }
java
public void submitFaxJob(FaxJob faxJob,CommPortAdapter adapter) { if(faxJob==null) { throw new FaxException("Fax job not provided."); } if(adapter==null) { throw new FaxException("COMM port adapter not provided."); } //submit fax job this.submitFaxJobImpl(faxJob,adapter); }
[ "public", "void", "submitFaxJob", "(", "FaxJob", "faxJob", ",", "CommPortAdapter", "adapter", ")", "{", "if", "(", "faxJob", "==", "null", ")", "{", "throw", "new", "FaxException", "(", "\"Fax job not provided.\"", ")", ";", "}", "if", "(", "adapter", "==", ...
This function will submit a new fax job.<br> The fax job ID may be populated by this method in the provided fax job object. @param faxJob The fax job object containing the needed information @param adapter The COMM port adapter
[ "This", "function", "will", "submit", "a", "new", "fax", "job", ".", "<br", ">", "The", "fax", "job", "ID", "may", "be", "populated", "by", "this", "method", "in", "the", "provided", "fax", "job", "object", "." ]
train
https://github.com/sagiegurari/fax4j/blob/42fa51acabe7bf279e27ab3dd1cf76146b27955f/src/main/java/org/fax4j/spi/comm/AbstractFaxModemAdapter.java#L67-L81
VoltDB/voltdb
src/frontend/org/voltdb/importclient/kinesis/KinesisStreamImporterConfig.java
KinesisStreamImporterConfig.getProperty
public static String getProperty(Properties props, String propertyName, String defaultValue) { String value = props.getProperty(propertyName, defaultValue).trim(); if (value.isEmpty()) { throw new IllegalArgumentException( "Property " + propertyName + " is missing in Kinesis importer configuration."); } return value; }
java
public static String getProperty(Properties props, String propertyName, String defaultValue) { String value = props.getProperty(propertyName, defaultValue).trim(); if (value.isEmpty()) { throw new IllegalArgumentException( "Property " + propertyName + " is missing in Kinesis importer configuration."); } return value; }
[ "public", "static", "String", "getProperty", "(", "Properties", "props", ",", "String", "propertyName", ",", "String", "defaultValue", ")", "{", "String", "value", "=", "props", ".", "getProperty", "(", "propertyName", ",", "defaultValue", ")", ".", "trim", "(...
get property value. If no value is available, throw IllegalArgumentException @param props The properties @param propertyName property name @param defaultValue The default value @return property value
[ "get", "property", "value", ".", "If", "no", "value", "is", "available", "throw", "IllegalArgumentException" ]
train
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/frontend/org/voltdb/importclient/kinesis/KinesisStreamImporterConfig.java#L216-L223
amaembo/streamex
src/main/java/one/util/streamex/AbstractStreamEx.java
AbstractStreamEx.toSetAndThen
public <R> R toSetAndThen(Function<? super Set<T>, R> finisher) { if (context.fjp != null) return context.terminate(() -> finisher.apply(toSet())); return finisher.apply(toSet()); }
java
public <R> R toSetAndThen(Function<? super Set<T>, R> finisher) { if (context.fjp != null) return context.terminate(() -> finisher.apply(toSet())); return finisher.apply(toSet()); }
[ "public", "<", "R", ">", "R", "toSetAndThen", "(", "Function", "<", "?", "super", "Set", "<", "T", ">", ",", "R", ">", "finisher", ")", "{", "if", "(", "context", ".", "fjp", "!=", "null", ")", "return", "context", ".", "terminate", "(", "(", ")"...
Creates a {@link Set} containing the elements of this stream, then performs finishing transformation and returns its result. There are no guarantees on the type, serializability or thread-safety of the {@code Set} created. <p> This is a terminal operation. @param <R> the result type @param finisher a function to be applied to the intermediate {@code Set} @return result of applying the finisher transformation to the {@code Set} of the stream elements. @since 0.2.3 @see #toSet()
[ "Creates", "a", "{", "@link", "Set", "}", "containing", "the", "elements", "of", "this", "stream", "then", "performs", "finishing", "transformation", "and", "returns", "its", "result", ".", "There", "are", "no", "guarantees", "on", "the", "type", "serializabil...
train
https://github.com/amaembo/streamex/blob/936bbd1b7dfbcf64a3b990682bfc848213441d14/src/main/java/one/util/streamex/AbstractStreamEx.java#L1291-L1295
jeremybrooks/jinx
src/main/java/net/jeremybrooks/jinx/api/PhotosCommentsApi.java
PhotosCommentsApi.getRecentForContacts
public Photos getRecentForContacts(String dateLastComment, List<String> contactsFilter, EnumSet<JinxConstants.PhotoExtras> extras, int perPage, int page) throws JinxException { Map<String, String> params = new TreeMap<>(); params.put("method", "flickr.photos.comments.getRecentForContacts"); if (!JinxUtils.isNullOrEmpty(dateLastComment)) { params.put("date_lastcomment", dateLastComment); } if (!JinxUtils.isNullOrEmpty(contactsFilter)) { params.put("contacts_filter", JinxUtils.buildCommaDelimitedList(contactsFilter)); } if (!JinxUtils.isNullOrEmpty(extras)) { params.put("extras", JinxUtils.buildCommaDelimitedList(extras)); } if (perPage > 0) { params.put("per_page", Integer.toString(perPage)); } if (page > 0) { params.put("page", Integer.toString(page)); } return jinx.flickrGet(params, Photos.class); }
java
public Photos getRecentForContacts(String dateLastComment, List<String> contactsFilter, EnumSet<JinxConstants.PhotoExtras> extras, int perPage, int page) throws JinxException { Map<String, String> params = new TreeMap<>(); params.put("method", "flickr.photos.comments.getRecentForContacts"); if (!JinxUtils.isNullOrEmpty(dateLastComment)) { params.put("date_lastcomment", dateLastComment); } if (!JinxUtils.isNullOrEmpty(contactsFilter)) { params.put("contacts_filter", JinxUtils.buildCommaDelimitedList(contactsFilter)); } if (!JinxUtils.isNullOrEmpty(extras)) { params.put("extras", JinxUtils.buildCommaDelimitedList(extras)); } if (perPage > 0) { params.put("per_page", Integer.toString(perPage)); } if (page > 0) { params.put("page", Integer.toString(page)); } return jinx.flickrGet(params, Photos.class); }
[ "public", "Photos", "getRecentForContacts", "(", "String", "dateLastComment", ",", "List", "<", "String", ">", "contactsFilter", ",", "EnumSet", "<", "JinxConstants", ".", "PhotoExtras", ">", "extras", ",", "int", "perPage", ",", "int", "page", ")", "throws", ...
Return the list of photos belonging to your contacts that have been commented on recently. <br> This method requires authentication with 'read' permission. @param dateLastComment (Optional) Limits the results to photos that have been commented on since this date. The date should be in the form of a Unix timestamp. The default, and maximum, offset is one hour. @param contactsFilter (Optional) A list of user id's to limit the scope of the query to. @param extras (Optional) Extra information to fetch for each returned record. @param perPage Number of photos to return per page. If this argument is less than 1, it defaults to 100. The maximum allowed value is 500. @param page The page of results to return. If this argument is less than 1, it defaults to 1. @return photos object with list of photos from your contacts that have been commented on recently. @throws JinxException if required parameters are missing, or if there are any errors. @see <a href="https://www.flickr.com/services/api/flickr.photos.comments.getRecentForContacts.html">flickr.photos.comments.getRecentForContacts</a>
[ "Return", "the", "list", "of", "photos", "belonging", "to", "your", "contacts", "that", "have", "been", "commented", "on", "recently", ".", "<br", ">", "This", "method", "requires", "authentication", "with", "read", "permission", "." ]
train
https://github.com/jeremybrooks/jinx/blob/ab7a4b7462d08bcbfd9b98bd3f5029771c20f6c6/src/main/java/net/jeremybrooks/jinx/api/PhotosCommentsApi.java#L151-L170
looly/hutool
hutool-core/src/main/java/cn/hutool/core/date/DateUtil.java
DateUtil.beginOfWeek
public static Calendar beginOfWeek(Calendar calendar, boolean isMondayAsFirstDay) { if(isMondayAsFirstDay) { calendar.setFirstDayOfWeek(Calendar.MONDAY); } return truncate(calendar, DateField.WEEK_OF_MONTH); }
java
public static Calendar beginOfWeek(Calendar calendar, boolean isMondayAsFirstDay) { if(isMondayAsFirstDay) { calendar.setFirstDayOfWeek(Calendar.MONDAY); } return truncate(calendar, DateField.WEEK_OF_MONTH); }
[ "public", "static", "Calendar", "beginOfWeek", "(", "Calendar", "calendar", ",", "boolean", "isMondayAsFirstDay", ")", "{", "if", "(", "isMondayAsFirstDay", ")", "{", "calendar", ".", "setFirstDayOfWeek", "(", "Calendar", ".", "MONDAY", ")", ";", "}", "return", ...
获取某周的开始时间,周一定为一周的开始时间 @param calendar 日期 {@link Calendar} @param isMondayAsFirstDay 是否周一做为一周的第一天(false表示周日做为第一天) @return {@link Calendar} @since 3.1.2
[ "获取某周的开始时间,周一定为一周的开始时间" ]
train
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/date/DateUtil.java#L897-L902
google/j2objc
jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/DateFormat.java
DateFormat.getDateInstance
static final public DateFormat getDateInstance(Calendar cal, int dateStyle) { return getDateInstance(cal, dateStyle, ULocale.getDefault(Category.FORMAT)); }
java
static final public DateFormat getDateInstance(Calendar cal, int dateStyle) { return getDateInstance(cal, dateStyle, ULocale.getDefault(Category.FORMAT)); }
[ "static", "final", "public", "DateFormat", "getDateInstance", "(", "Calendar", "cal", ",", "int", "dateStyle", ")", "{", "return", "getDateInstance", "(", "cal", ",", "dateStyle", ",", "ULocale", ".", "getDefault", "(", "Category", ".", "FORMAT", ")", ")", "...
Creates a {@link DateFormat} object for the default locale that can be used to format dates in the calendar system specified by <code>cal</code>. <p> @param cal The calendar system for which a date format is desired. @param dateStyle The type of date format desired. This can be {@link DateFormat#SHORT}, {@link DateFormat#MEDIUM}, etc.
[ "Creates", "a", "{", "@link", "DateFormat", "}", "object", "for", "the", "default", "locale", "that", "can", "be", "used", "to", "format", "dates", "in", "the", "calendar", "system", "specified", "by", "<code", ">", "cal<", "/", "code", ">", ".", "<p", ...
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/DateFormat.java#L1903-L1905
couchbase/couchbase-lite-java
src/main/java/com/couchbase/lite/From.java
From.groupBy
@NonNull @Override public GroupBy groupBy(@NonNull Expression... expressions) { if (expressions == null) { throw new IllegalArgumentException("expressions cannot be null."); } return new GroupBy(this, Arrays.asList(expressions)); }
java
@NonNull @Override public GroupBy groupBy(@NonNull Expression... expressions) { if (expressions == null) { throw new IllegalArgumentException("expressions cannot be null."); } return new GroupBy(this, Arrays.asList(expressions)); }
[ "@", "NonNull", "@", "Override", "public", "GroupBy", "groupBy", "(", "@", "NonNull", "Expression", "...", "expressions", ")", "{", "if", "(", "expressions", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"expressions cannot be null.\""...
Creates and chains a GroupBy object to group the query result. @param expressions The group by expression. @return The GroupBy object that represents the GROUP BY clause of the query.
[ "Creates", "and", "chains", "a", "GroupBy", "object", "to", "group", "the", "query", "result", "." ]
train
https://github.com/couchbase/couchbase-lite-java/blob/cb72c44186456e6191a9ad0a7feb310011d0b081/src/main/java/com/couchbase/lite/From.java#L88-L95
EdwardRaff/JSAT
JSAT/src/jsat/distributions/kernels/BaseL2Kernel.java
BaseL2Kernel.getSqrdNorm
protected double getSqrdNorm(int i, List<? extends Vec> vecs, List<Double> cache) { return cache.get(i); }
java
protected double getSqrdNorm(int i, List<? extends Vec> vecs, List<Double> cache) { return cache.get(i); }
[ "protected", "double", "getSqrdNorm", "(", "int", "i", ",", "List", "<", "?", "extends", "Vec", ">", "vecs", ",", "List", "<", "Double", ">", "cache", ")", "{", "return", "cache", ".", "get", "(", "i", ")", ";", "}" ]
Returns the squared L<sup>2</sup> norm of the given point from the cache @param i the index in the vector list to get the squared norm from @param vecs the list of vectors that make the collection @param cache the cache of values for each vector in the collection @return the squared norm ||x<sub>i</sub>||<sup>2</sup>
[ "Returns", "the", "squared", "L<sup", ">", "2<", "/", "sup", ">", "norm", "of", "the", "given", "point", "from", "the", "cache" ]
train
https://github.com/EdwardRaff/JSAT/blob/0ff53b7b39684b2379cc1da522f5b3a954b15cfb/JSAT/src/jsat/distributions/kernels/BaseL2Kernel.java#L59-L62
samskivert/pythagoras
src/main/java/pythagoras/f/Quaternion.java
Quaternion.randomize
public Quaternion randomize (Random rand) { // pick angles according to the surface area distribution return fromAngles(MathUtil.lerp(-FloatMath.PI, +FloatMath.PI, rand.nextFloat()), FloatMath.asin(MathUtil.lerp(-1f, +1f, rand.nextFloat())), MathUtil.lerp(-FloatMath.PI, +FloatMath.PI, rand.nextFloat())); }
java
public Quaternion randomize (Random rand) { // pick angles according to the surface area distribution return fromAngles(MathUtil.lerp(-FloatMath.PI, +FloatMath.PI, rand.nextFloat()), FloatMath.asin(MathUtil.lerp(-1f, +1f, rand.nextFloat())), MathUtil.lerp(-FloatMath.PI, +FloatMath.PI, rand.nextFloat())); }
[ "public", "Quaternion", "randomize", "(", "Random", "rand", ")", "{", "// pick angles according to the surface area distribution", "return", "fromAngles", "(", "MathUtil", ".", "lerp", "(", "-", "FloatMath", ".", "PI", ",", "+", "FloatMath", ".", "PI", ",", "rand"...
Sets this to a random rotation obtained from a completely uniform distribution.
[ "Sets", "this", "to", "a", "random", "rotation", "obtained", "from", "a", "completely", "uniform", "distribution", "." ]
train
https://github.com/samskivert/pythagoras/blob/b8fea743ee8a7d742ad9c06ee4f11f50571fbd32/src/main/java/pythagoras/f/Quaternion.java#L173-L178
apereo/cas
support/cas-server-support-spnego-webflow/src/main/java/org/apereo/cas/web/flow/SpnegoCredentialsAction.java
SpnegoCredentialsAction.setResponseHeader
private void setResponseHeader(final RequestContext context) { val credential = WebUtils.getCredential(context); if (credential == null) { LOGGER.debug("No credential was provided. No response header set."); return; } val response = WebUtils.getHttpServletResponseFromExternalWebflowContext(context); val spnegoCredentials = (SpnegoCredential) credential; val nextToken = spnegoCredentials.getNextToken(); if (nextToken != null) { LOGGER.debug("Obtained output token: [{}]", new String(nextToken, Charset.defaultCharset())); response.setHeader(SpnegoConstants.HEADER_AUTHENTICATE, (this.ntlm ? SpnegoConstants.NTLM : SpnegoConstants.NEGOTIATE) + ' ' + EncodingUtils.encodeBase64(nextToken)); } else { LOGGER.debug("Unable to obtain the output token required."); } if (spnegoCredentials.getPrincipal() == null && this.send401OnAuthenticationFailure) { LOGGER.debug("Setting HTTP Status to 401"); response.setStatus(HttpServletResponse.SC_UNAUTHORIZED); } }
java
private void setResponseHeader(final RequestContext context) { val credential = WebUtils.getCredential(context); if (credential == null) { LOGGER.debug("No credential was provided. No response header set."); return; } val response = WebUtils.getHttpServletResponseFromExternalWebflowContext(context); val spnegoCredentials = (SpnegoCredential) credential; val nextToken = spnegoCredentials.getNextToken(); if (nextToken != null) { LOGGER.debug("Obtained output token: [{}]", new String(nextToken, Charset.defaultCharset())); response.setHeader(SpnegoConstants.HEADER_AUTHENTICATE, (this.ntlm ? SpnegoConstants.NTLM : SpnegoConstants.NEGOTIATE) + ' ' + EncodingUtils.encodeBase64(nextToken)); } else { LOGGER.debug("Unable to obtain the output token required."); } if (spnegoCredentials.getPrincipal() == null && this.send401OnAuthenticationFailure) { LOGGER.debug("Setting HTTP Status to 401"); response.setStatus(HttpServletResponse.SC_UNAUTHORIZED); } }
[ "private", "void", "setResponseHeader", "(", "final", "RequestContext", "context", ")", "{", "val", "credential", "=", "WebUtils", ".", "getCredential", "(", "context", ")", ";", "if", "(", "credential", "==", "null", ")", "{", "LOGGER", ".", "debug", "(", ...
Sets the response header based on the retrieved token. @param context the context
[ "Sets", "the", "response", "header", "based", "on", "the", "retrieved", "token", "." ]
train
https://github.com/apereo/cas/blob/b4b306433a8782cef803a39bea5b1f96740e0e9b/support/cas-server-support-spnego-webflow/src/main/java/org/apereo/cas/web/flow/SpnegoCredentialsAction.java#L105-L129
OpenLiberty/open-liberty
dev/com.ibm.ws.jmx.connector.server.rest/src/com/ibm/ws/jmx/connector/server/rest/notification/NotificationManager.java
NotificationManager.getInboxIfAvailable
private ClientNotificationArea getInboxIfAvailable(int clientID, JSONConverter converter) { final ClientNotificationArea inbox = inboxes.get(clientID); if (inbox == null) { throw ErrorHelper.createRESTHandlerJsonException(new RuntimeException("The requested clientID is no longer available because it timed out."), converter, APIConstants.STATUS_GONE); } return inbox; }
java
private ClientNotificationArea getInboxIfAvailable(int clientID, JSONConverter converter) { final ClientNotificationArea inbox = inboxes.get(clientID); if (inbox == null) { throw ErrorHelper.createRESTHandlerJsonException(new RuntimeException("The requested clientID is no longer available because it timed out."), converter, APIConstants.STATUS_GONE); } return inbox; }
[ "private", "ClientNotificationArea", "getInboxIfAvailable", "(", "int", "clientID", ",", "JSONConverter", "converter", ")", "{", "final", "ClientNotificationArea", "inbox", "=", "inboxes", ".", "get", "(", "clientID", ")", ";", "if", "(", "inbox", "==", "null", ...
This method returns the client inbox or throws an error if the client ID has timed out
[ "This", "method", "returns", "the", "client", "inbox", "or", "throws", "an", "error", "if", "the", "client", "ID", "has", "timed", "out" ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jmx.connector.server.rest/src/com/ibm/ws/jmx/connector/server/rest/notification/NotificationManager.java#L424-L434
mojohaus/aspectj-maven-plugin
src/main/java/org/codehaus/mojo/aspectj/AjcHelper.java
AjcHelper.readBuildConfigFile
public static List<String> readBuildConfigFile( String fileName, File outputDir ) throws IOException { List<String> arguments = new ArrayList<String>(); File argFile = new File( outputDir, fileName ); if ( FileUtils.fileExists( argFile.getAbsolutePath() ) ) { FileReader reader = new FileReader( argFile ); BufferedReader bufRead = new BufferedReader( reader ); String line = null; do { line = bufRead.readLine(); if ( null != line ) { arguments.add( line ); } } while ( null != line ); } return arguments; }
java
public static List<String> readBuildConfigFile( String fileName, File outputDir ) throws IOException { List<String> arguments = new ArrayList<String>(); File argFile = new File( outputDir, fileName ); if ( FileUtils.fileExists( argFile.getAbsolutePath() ) ) { FileReader reader = new FileReader( argFile ); BufferedReader bufRead = new BufferedReader( reader ); String line = null; do { line = bufRead.readLine(); if ( null != line ) { arguments.add( line ); } } while ( null != line ); } return arguments; }
[ "public", "static", "List", "<", "String", ">", "readBuildConfigFile", "(", "String", "fileName", ",", "File", "outputDir", ")", "throws", "IOException", "{", "List", "<", "String", ">", "arguments", "=", "new", "ArrayList", "<", "String", ">", "(", ")", "...
Reads a build config file, and returns the List of all compiler arguments. @param fileName the filename of the argfile @param outputDir the build output area @return @throws IOException
[ "Reads", "a", "build", "config", "file", "and", "returns", "the", "List", "of", "all", "compiler", "arguments", "." ]
train
https://github.com/mojohaus/aspectj-maven-plugin/blob/120ee1ce08b93873931035ed98cd70e3ccceeefb/src/main/java/org/codehaus/mojo/aspectj/AjcHelper.java#L264-L285
wmdietl/jsr308-langtools
src/share/classes/com/sun/tools/javac/file/ZipFileIndex.java
ZipFileIndex.checkIndex
private void checkIndex() throws IOException { boolean isUpToDate = true; if (!isUpToDate()) { closeFile(); isUpToDate = false; } if (zipRandomFile != null || isUpToDate) { lastReferenceTimeStamp = System.currentTimeMillis(); return; } hasPopulatedData = true; if (readIndex()) { lastReferenceTimeStamp = System.currentTimeMillis(); return; } directories = Collections.<RelativeDirectory, DirectoryEntry>emptyMap(); allDirs = Collections.<RelativeDirectory>emptySet(); try { openFile(); long totalLength = zipRandomFile.length(); ZipDirectory directory = new ZipDirectory(zipRandomFile, 0L, totalLength, this); directory.buildIndex(); } finally { if (zipRandomFile != null) { closeFile(); } } lastReferenceTimeStamp = System.currentTimeMillis(); }
java
private void checkIndex() throws IOException { boolean isUpToDate = true; if (!isUpToDate()) { closeFile(); isUpToDate = false; } if (zipRandomFile != null || isUpToDate) { lastReferenceTimeStamp = System.currentTimeMillis(); return; } hasPopulatedData = true; if (readIndex()) { lastReferenceTimeStamp = System.currentTimeMillis(); return; } directories = Collections.<RelativeDirectory, DirectoryEntry>emptyMap(); allDirs = Collections.<RelativeDirectory>emptySet(); try { openFile(); long totalLength = zipRandomFile.length(); ZipDirectory directory = new ZipDirectory(zipRandomFile, 0L, totalLength, this); directory.buildIndex(); } finally { if (zipRandomFile != null) { closeFile(); } } lastReferenceTimeStamp = System.currentTimeMillis(); }
[ "private", "void", "checkIndex", "(", ")", "throws", "IOException", "{", "boolean", "isUpToDate", "=", "true", ";", "if", "(", "!", "isUpToDate", "(", ")", ")", "{", "closeFile", "(", ")", ";", "isUpToDate", "=", "false", ";", "}", "if", "(", "zipRando...
Here we need to make sure that the ZipFileIndex is valid. Check the timestamp of the file and if its the same as the one at the time the index was build we don't need to reopen anything.
[ "Here", "we", "need", "to", "make", "sure", "that", "the", "ZipFileIndex", "is", "valid", ".", "Check", "the", "timestamp", "of", "the", "file", "and", "if", "its", "the", "same", "as", "the", "one", "at", "the", "time", "the", "index", "was", "build",...
train
https://github.com/wmdietl/jsr308-langtools/blob/8812d28c20f4de070a0dd6de1b45602431379834/src/share/classes/com/sun/tools/javac/file/ZipFileIndex.java#L165-L199
looly/hutool
hutool-core/src/main/java/cn/hutool/core/util/ReflectUtil.java
ReflectUtil.getMethod
public static Method getMethod(Class<?> clazz, boolean ignoreCase, String methodName, Class<?>... paramTypes) throws SecurityException { if (null == clazz || StrUtil.isBlank(methodName)) { return null; } final Method[] methods = getMethods(clazz); if (ArrayUtil.isNotEmpty(methods)) { for (Method method : methods) { if (StrUtil.equals(methodName, method.getName(), ignoreCase)) { if (ClassUtil.isAllAssignableFrom(method.getParameterTypes(), paramTypes)) { return method; } } } } return null; }
java
public static Method getMethod(Class<?> clazz, boolean ignoreCase, String methodName, Class<?>... paramTypes) throws SecurityException { if (null == clazz || StrUtil.isBlank(methodName)) { return null; } final Method[] methods = getMethods(clazz); if (ArrayUtil.isNotEmpty(methods)) { for (Method method : methods) { if (StrUtil.equals(methodName, method.getName(), ignoreCase)) { if (ClassUtil.isAllAssignableFrom(method.getParameterTypes(), paramTypes)) { return method; } } } } return null; }
[ "public", "static", "Method", "getMethod", "(", "Class", "<", "?", ">", "clazz", ",", "boolean", "ignoreCase", ",", "String", "methodName", ",", "Class", "<", "?", ">", "...", "paramTypes", ")", "throws", "SecurityException", "{", "if", "(", "null", "==", ...
查找指定方法 如果找不到对应的方法则返回<code>null</code> <p> 此方法为精准获取方法名,即方法名和参数数量和类型必须一致,否则返回<code>null</code>。 </p> @param clazz 类,如果为{@code null}返回{@code null} @param ignoreCase 是否忽略大小写 @param methodName 方法名,如果为空字符串返回{@code null} @param paramTypes 参数类型,指定参数类型如果是方法的子类也算 @return 方法 @throws SecurityException 无权访问抛出异常 @since 3.2.0
[ "查找指定方法", "如果找不到对应的方法则返回<code", ">", "null<", "/", "code", ">" ]
train
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/util/ReflectUtil.java#L450-L466
stanfy/goro
goro/src/main/java/com/stanfy/enroscar/goro/Goro.java
Goro.bindWith
public static BoundGoro bindWith(final Context context, final BoundGoro.OnUnexpectedDisconnection handler) { if (context == null) { throw new IllegalArgumentException("Context cannot be null"); } if (handler == null) { throw new IllegalArgumentException("Disconnection handler cannot be null"); } return new BoundGoroImpl(context, handler); }
java
public static BoundGoro bindWith(final Context context, final BoundGoro.OnUnexpectedDisconnection handler) { if (context == null) { throw new IllegalArgumentException("Context cannot be null"); } if (handler == null) { throw new IllegalArgumentException("Disconnection handler cannot be null"); } return new BoundGoroImpl(context, handler); }
[ "public", "static", "BoundGoro", "bindWith", "(", "final", "Context", "context", ",", "final", "BoundGoro", ".", "OnUnexpectedDisconnection", "handler", ")", "{", "if", "(", "context", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"C...
Creates a Goro implementation that binds to {@link GoroService} in order to run scheduled tasks in service context. {@code BoundGoro} exposes {@code bind()} and {@code unbind()} methods that you can use to connect to and disconnect from the worker service in other component lifecycle callbacks (like {@code onStart}/{@code onStop} in {@code Activity} or {@code onCreate}/{@code onDestory} in {@code Service}). <p> The worker service ({@code GoroService}) normally stops when all {@code BoundGoro} instances unbind and all the pending tasks in {@code Goro} queues are handled. But it can also be stopped by the system server (due to a user action in Settings app or application update). In this case {@code BoundGoro} created with this method will notify the supplied handler about the event. </p> @param context context that will bind to the service @param handler callback to invoke if worker service is unexpectedly stopped by the system server @return Goro implementation that binds to {@link GoroService}.
[ "Creates", "a", "Goro", "implementation", "that", "binds", "to", "{" ]
train
https://github.com/stanfy/goro/blob/6618e63a926833d61f492ec611ee77668d756820/goro/src/main/java/com/stanfy/enroscar/goro/Goro.java#L92-L100
amzn/ion-java
src/com/amazon/ion/impl/SharedSymbolTable.java
SharedSymbolTable.newSharedSymbolTable
static SymbolTable newSharedSymbolTable(String name, int version, SymbolTable priorSymtab, Iterator<String> symbols) { if (name == null || name.length() < 1) { throw new IllegalArgumentException("name must be non-empty"); } if (version < 1) { throw new IllegalArgumentException("version must be at least 1"); } List<String> symbolsList = new ArrayList<String>(); Map<String, Integer> symbolsMap = new HashMap<String, Integer>(); assert version == (priorSymtab == null ? 1 : priorSymtab.getVersion() + 1); prepSymbolsListAndMap(priorSymtab, symbols, symbolsList, symbolsMap); // We have all necessary data, pass it over to the private constructor. return new SharedSymbolTable(name, version, symbolsList, symbolsMap); }
java
static SymbolTable newSharedSymbolTable(String name, int version, SymbolTable priorSymtab, Iterator<String> symbols) { if (name == null || name.length() < 1) { throw new IllegalArgumentException("name must be non-empty"); } if (version < 1) { throw new IllegalArgumentException("version must be at least 1"); } List<String> symbolsList = new ArrayList<String>(); Map<String, Integer> symbolsMap = new HashMap<String, Integer>(); assert version == (priorSymtab == null ? 1 : priorSymtab.getVersion() + 1); prepSymbolsListAndMap(priorSymtab, symbols, symbolsList, symbolsMap); // We have all necessary data, pass it over to the private constructor. return new SharedSymbolTable(name, version, symbolsList, symbolsMap); }
[ "static", "SymbolTable", "newSharedSymbolTable", "(", "String", "name", ",", "int", "version", ",", "SymbolTable", "priorSymtab", ",", "Iterator", "<", "String", ">", "symbols", ")", "{", "if", "(", "name", "==", "null", "||", "name", ".", "length", "(", "...
Constructs a new shared symbol table from the parameters. <p> As per {@link IonSystem#newSharedSymbolTable(String, int, Iterator, SymbolTable...)}, any duplicate or null symbol texts are skipped. <p> Therefore, <b>THIS METHOD IS NOT SUITABLE WHEN READING SERIALIZED SHARED SYMBOL TABLES</b> since that scenario must preserve all sids. @param name the name of the new shared symbol table @param version the version of the new shared symbol table @param priorSymtab may be null @param symbols never null
[ "Constructs", "a", "new", "shared", "symbol", "table", "from", "the", "parameters", ".", "<p", ">", "As", "per", "{", "@link", "IonSystem#newSharedSymbolTable", "(", "String", "int", "Iterator", "SymbolTable", "...", ")", "}", "any", "duplicate", "or", "null",...
train
https://github.com/amzn/ion-java/blob/4ce1f0f58c6a5a8e42d0425ccdb36e38be3e2270/src/com/amazon/ion/impl/SharedSymbolTable.java#L155-L178
UrielCh/ovh-java-sdk
ovh-java-sdk-telephony/src/main/java/net/minidev/ovh/api/ApiOvhTelephony.java
ApiOvhTelephony.billingAccount_conference_serviceName_histories_id_GET
public OvhConferenceHistory billingAccount_conference_serviceName_histories_id_GET(String billingAccount, String serviceName, Long id) throws IOException { String qPath = "/telephony/{billingAccount}/conference/{serviceName}/histories/{id}"; StringBuilder sb = path(qPath, billingAccount, serviceName, id); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, OvhConferenceHistory.class); }
java
public OvhConferenceHistory billingAccount_conference_serviceName_histories_id_GET(String billingAccount, String serviceName, Long id) throws IOException { String qPath = "/telephony/{billingAccount}/conference/{serviceName}/histories/{id}"; StringBuilder sb = path(qPath, billingAccount, serviceName, id); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, OvhConferenceHistory.class); }
[ "public", "OvhConferenceHistory", "billingAccount_conference_serviceName_histories_id_GET", "(", "String", "billingAccount", ",", "String", "serviceName", ",", "Long", "id", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/telephony/{billingAccount}/conference/{se...
Get this object properties REST: GET /telephony/{billingAccount}/conference/{serviceName}/histories/{id} @param billingAccount [required] The name of your billingAccount @param serviceName [required] @param id [required] Id of the object
[ "Get", "this", "object", "properties" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-telephony/src/main/java/net/minidev/ovh/api/ApiOvhTelephony.java#L4680-L4685
facebookarchive/hadoop-20
src/contrib/namespace-notifier/src/java/org/apache/hadoop/hdfs/notifier/server/ServerLogReaderTransactional.java
ServerLogReaderTransactional.setupIngestStreamWithRetries
private void setupIngestStreamWithRetries(long txid) throws IOException { for (int i = 0; i < inputStreamRetries; i++) { try { setupCurrentEditStream(txid); return; } catch (IOException e) { if (i == inputStreamRetries - 1) { throw new IOException("Cannot obtain stream for txid: " + txid, e); } LOG.info("Error :", e); } sleep(1000); LOG.info("Retrying to get edit input stream for txid: " + txid + ", tried: " + (i + 1) + " times"); } }
java
private void setupIngestStreamWithRetries(long txid) throws IOException { for (int i = 0; i < inputStreamRetries; i++) { try { setupCurrentEditStream(txid); return; } catch (IOException e) { if (i == inputStreamRetries - 1) { throw new IOException("Cannot obtain stream for txid: " + txid, e); } LOG.info("Error :", e); } sleep(1000); LOG.info("Retrying to get edit input stream for txid: " + txid + ", tried: " + (i + 1) + " times"); } }
[ "private", "void", "setupIngestStreamWithRetries", "(", "long", "txid", ")", "throws", "IOException", "{", "for", "(", "int", "i", "=", "0", ";", "i", "<", "inputStreamRetries", ";", "i", "++", ")", "{", "try", "{", "setupCurrentEditStream", "(", "txid", "...
Setup the input stream to be consumed by the reader, with retries on failures.
[ "Setup", "the", "input", "stream", "to", "be", "consumed", "by", "the", "reader", "with", "retries", "on", "failures", "." ]
train
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/contrib/namespace-notifier/src/java/org/apache/hadoop/hdfs/notifier/server/ServerLogReaderTransactional.java#L378-L393